FHEMWEB & co: Fixed div/a order and added some further classes in order to be

able to identify each element for styling.



git-svn-id: https://svn.fhem.de/fhem/trunk@3499 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2013-07-25 08:59:13 +00:00
parent b4941ad270
commit 0e9b920d02
3 changed files with 40 additions and 27 deletions

View File

@@ -25,7 +25,7 @@ sub FW_logWrapper($);
sub FW_makeEdit($$$);
sub FW_makeImage(@);
sub FW_makeTable($$$@);
sub FW_makeTableFromArray($@);
sub FW_makeTableFromArray($$@);
sub FW_pF($@);
sub FW_pH(@);
sub FW_pHPlain(@);
@@ -702,7 +702,9 @@ FW_makeTable($$$@)
return if(!$hash || !int(keys %{$hash}));
FW_pO $title;
FW_pO "<table class=\"block wide\">";
my $titleid = lc($title);
$titleid =~ s/[^A-Za-z]/_/g;
FW_pO "<table class=\"block wide $titleid\">";
my $si = AttrVal("global", "showInternalValues", 0);
my $row = 1;
@@ -823,7 +825,7 @@ FW_doDetail($)
if($FW_ss) { # FS20MS2 special: on and off, is not the same as toggle
my $webCmd = AttrVal($d, "webCmd", undef);
if($webCmd) {
FW_pO "<table>";
FW_pO "<table class=\"webcmd\">";
foreach my $cmd (split(":", $webCmd)) {
FW_pO "<tr>";
FW_pH "cmd.$d=set $d $cmd&detail=$d", $cmd, 1, "col1";
@@ -865,7 +867,7 @@ FW_doDetail($)
}
}
FW_pO "</form>";
FW_makeTableFromArray("Probably associated with", @dob);
FW_makeTableFromArray("Probably associated with", "assoc", @dob,);
FW_pO "</td></tr></table>";
@@ -879,13 +881,13 @@ FW_doDetail($)
##############################
sub
FW_makeTableFromArray($@) {
my ($txt,@obj) = @_;
FW_makeTableFromArray($$@) {
my ($txt,$class,@obj) = @_;
if (@obj>0) {
my $row=1;
FW_pO "<br>";
FW_pO "$txt";
FW_pO '<table class="block wide">';
FW_pO '<table class="block wide $class">';
foreach (sort @obj) {
FW_pF "<tr class=\"%s\"><td>", ($row&1)?"odd":"even";
$row++;
@@ -934,8 +936,8 @@ FW_roomOverview($)
my (@list1, @list2);
push(@list1, ""); push(@list2, "");
if(!$FW_hiddenroom{save} && !$FW_hiddenroom{"Save config"}) {
push(@list1, "Save config"); push(@list2, "$FW_ME?cmd=save");
push(@list1, ""); push(@list2, "");
push(@list1, "Save config");
push(@list2, "$FW_ME?cmd=save");
}
########################
@@ -1009,12 +1011,15 @@ FW_roomOverview($)
} else {
my $tblnr = 1;
foreach(my $idx = 0; $idx < @list1; $idx++) {
my ($l1, $l2) = ($list1[$idx], $list2[$idx]);
if(!$l1) {
FW_pO "</table></td></tr>" if($idx);
FW_pO "<tr><td><table class=\"room\">"
if($idx<int(@list1)-1);
if($idx<int(@list1)-1) {
FW_pO "<tr><td><table class=\"room roomBlock$tblnr\">";
$tblnr++;
}
} else {
my $td = "<td>";
@@ -1049,7 +1054,7 @@ FW_roomOverview($)
##############
# HEADER
FW_pO "<div id=\"hdr\">";
FW_pO '<table border="0"><tr><td style="padding:0">';
FW_pO '<table border="0" class="header"><tr><td style="padding:0">';
FW_pO "<form method=\"$FW_formmethod\" action=\"$FW_ME\">";
FW_pO FW_hidden("room", "$FW_room") if($FW_room);
FW_pO FW_textfield("cmd", $FW_ss ? 25 : 40, "maininput");
@@ -1076,7 +1081,7 @@ FW_showRoom()
FW_pO "<form method=\"$FW_formmethod\" ".
"action=\"$FW_ME\" autocomplete=\"off\">";
FW_pO "<div id=\"content\">";
FW_pO "<table>"; # Need for equal width of subtables
FW_pO "<table class=\"roomoverview\">"; # Need for equal width of subtables
my $rf = ($FW_room ? "&amp;room=$FW_room" : ""); # stay in the room
@@ -1834,7 +1839,9 @@ sub
FW_displayFileList($@)
{
my ($heading,@files)= @_;
FW_pO "$heading<br>";
my $hid = lc($heading);
$hid =~ s/[^A-Za-z]/_/g;
FW_pO "<div class=\"fileList $hid\">$heading</div>";
FW_pO "<table class=\"block fileList\">";
my $row = 0;
foreach my $f (@files) {
@@ -2041,10 +2048,6 @@ FW_pH(@)
my $ret;
$link = ($link =~ m,^/,) ? $link : "$FW_ME$FW_subdir?$link";
#actually 'div' should be removed if no class is defined
# as I can't check all code for consistancy I add nonl instead
$class = ($class)?" class=\"$class\"":"";
$txt = "<div$class>$txt</div>" if (!$nonl);
# Using onclick, as href starts safari in a webapp.
# Known issue: the pointer won't change
@@ -2053,6 +2056,12 @@ FW_pH(@)
} else {
$ret = "<a href=\"$link\">$txt</a>";
}
#actually 'div' should be removed if no class is defined
# as I can't check all code for consistancy I add nonl instead
$class = ($class)?" class=\"$class\"":"";
$ret = "<div$class>$ret</div>" if (!$nonl);
$ret = "<td>$ret</td>" if($td);
return $ret if($doRet);
FW_pO $ret;
@@ -2502,8 +2511,6 @@ FW_devState($$@)
}
my $style = AttrVal($d, "devStateStyle", "");
$txt = "<div id=\"$d\" $style class=\"col2\">$txt</div>";
if($hasOnOff) {
# Have to cover: "on:An off:Aus", "A0:Aus AI:An Aus:off An:on"
@@ -2536,6 +2543,9 @@ FW_devState($$@)
}
}
my $style = AttrVal($d, "devStateStyle", "");
$txt = "<div id=\"$d\" $style class=\"col2\">$txt</div>";
my $type = $defs{$d}{TYPE};
my $sfn = $modules{$type}{FW_summaryFn};
if($sfn) {

View File

@@ -260,11 +260,12 @@ FileLog_fhemwebFn($$$$)
{
my ($FW_wname, $d, $room, $pageHash) = @_; # pageHash is set for summaryFn.
return "<div id=\"$d\" align=\"center\" class=\"col2\">$defs{$d}{STATE}</div>"
if($FW_ss && $pageHash);
return "<div id=\"$d\" align=\"center\" class=\"FileLog col2\">".
"$defs{$d}{STATE}</div>" if($FW_ss && $pageHash);
my $row = 0;
my $ret = sprintf("<table class=\"%swide\">", $pageHash ? "" : "block ");
my $ret = sprintf("<table class=\"FileLog %swide\">",
$pageHash ? "" : "block ");
foreach my $f (FW_fileList($defs{$d}{logfile})) {
my $class = (!$pageHash ? (($row++&1)?"odd":"even") : "");
$ret .= "<tr class=\"$class\">";

View File

@@ -102,11 +102,11 @@ FW_showWeblink($$$$)
sub
weblink_FwDetail($@)
{
my ($d, $text)= @_;
my ($d, $text, $nobr)= @_;
return "" if(AttrVal($d, "group", ""));
my $alias= AttrVal($d, "alias", $d);
my $ret = "<br>";
my $ret = ($nobr ? "" : "<br>");
$ret .= "$text " if($text);
$ret .= FW_pHPlain("detail=$d", $alias) if(!$FW_subdir);
$ret .= "<br>";
@@ -267,8 +267,10 @@ weblink_FwFn($$$$)
my $arg="$FW_ME?cmd=showlog $d $va[0] $va[1] $va[2]$wl";
if(AttrVal($d,"plotmode",$FW_plotmode) eq "SVG") {
my ($w, $h) = split(",", AttrVal($d,"plotsize",$FW_plotsize));
$ret .= "<div class=\"SVGplot\">";
$ret .= "<embed src=\"$arg\" type=\"image/svg+xml\" " .
"width=\"$w\" height=\"$h\" name=\"$d\"/>\n";
$ret .= "</div>";
} else {
$ret .= "<img src=\"$arg\"/>";
@@ -280,7 +282,7 @@ weblink_FwFn($$$$)
$ret .= "<br>";
} else {
$ret .= weblink_FwDetail($d) if(!$FW_hiddenroom{detail});
$ret .= weblink_FwDetail($d, "", 1) if(!$FW_hiddenroom{detail});
}
@@ -371,7 +373,7 @@ wl_PEdit($$$$)
my $ret .= "<br><form autocomplete=\"off\" action=\"$FW_ME/weblinkDetails\">";
$ret .= FW_hidden("detail", $d);
$ret .= FW_hidden("gplotName", $gp);
$ret .= "<table class=\"block wide\">";
$ret .= "<table class=\"block wide plotEditor\">";
$ret .= "<tr class=\"even\">";
$ret .= "<td>Plot title</td>";
$ret .= "<td>".wl_txt("title", "", $conf{title}, 32)."</td>";