diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm index 32db1e49d..eb7d5f6b4 100755 --- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm +++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm @@ -27,6 +27,7 @@ sub FW_roomOverview($); sub FW_fatal($); sub pF($@); sub pO(@); +sub pH(@); sub FW_AnswerCall($); sub FW_zoomLink($$$); sub FW_calcWeblink($$); @@ -351,14 +352,19 @@ FW_AnswerCall($) my $t = FW_getAttr("global", "title", "Home, Sweet Home"); pO ''; - pO ''; pO "\n$t"; + + if($__ss) { + pO ''; + pO ''; + pO ''; + } + my $rf = FW_getAttr($__wname, "refresh", ""); pO "" if($rf); my $stylecss = ($__ss ? "style_smallscreen.css" : "style.css"); pO ""; - pO "" if($__ss); pO "" if($__plotmode eq "SVG"); pO "\n"; @@ -483,7 +489,7 @@ FW_makeTable($$$$$$$$) pF " ", $row?"odd":"even"; $row = ($row+1)%2; if($makelink && $__reldoc) { - pO "$v"; + pO "$v"; # no pH, want to open extra browser } else { pO "$v"; } @@ -499,7 +505,7 @@ FW_makeTable($$$$$$$$) } } - pO "$cmd" + pH "cmd.$d=$cmd $d $v&detail=$d", $cmd, 1 if($cmd); pO ""; @@ -533,12 +539,12 @@ FW_showArchive($) pF " $f", $row?"odd":"even"; $row = ($row+1)%2; if(!defined($l)) { - pO "text"; + pH "cmd=logwrapper $d text $f", "text", 1; } else { foreach my $ln (split(",", $l)) { my ($lt, $name) = split(":", $ln); $name = $lt if(!$name); - pO "$name"; + pH "cmd=logwrapper $d $lt $f", $name, 1; } } pO ""; @@ -564,14 +570,16 @@ FW_doDetail($) pO "
"; pO "
"; - pO "Delete $d"; + pH "cmd=delete $d", "Delete $d"; my $pgm = "Javascript:" . "s=document.getElementById('edit').style;". "if(s.display=='none') s.display='block'; else s.display='none';". "s=document.getElementById('disp').style;". "if(s.display=='none') s.display='block'; else s.display='none';"; - pO "Modify $d"; + pO "Modify $d"; + + pH "room=$__room", "Back:$__room" if($__ss); pO "
"; FW_makeTable($d, $t, @@ -603,13 +611,15 @@ FW_roomOverview($) # HEADER pO "
"; pO "
"; - pO ""; + pH "detail=$d", $d, 1; if($iname) { pO ""; @@ -782,8 +793,8 @@ FW_showRoom() pO ""; } if(getAllSets($d)) { - pO ""; - pO ""; + pH "cmd.$d=set $d on$rf", "on", 1; + pH "cmd.$d=set $d off$rf", "off", 1; } } elsif($type eq "FHT") { @@ -791,7 +802,7 @@ FW_showRoom() $v = ReadingsVal($d, "measured-temp", ""); $v =~ s/ .*//; - pO ""; + pH "detail=$d", $d, 1; pO ""; $v = sprintf("%2.1f", int(2*$v)/2) if($v =~ m/[0-9.-]/); @@ -807,9 +818,10 @@ FW_showRoom() } elsif($type eq "FileLog") { - pO ""; + pH "detail=$d", $d, 1; + pO ""; if(defined(FW_getAttr($d, "archivedir", undef))) { - pO ""; + pH "cmd=showarchive $d", "archive", 1; } foreach my $f (FW_fileList($defs{$d}{logfile})) { @@ -819,7 +831,7 @@ FW_showRoom() foreach my $ln (split(",", FW_getAttr($d, "logtype", "text"))) { my ($lt, $name) = split(":", $ln); $name = $lt if(!$name); - pO ""; + pH "cmd=logwrapper $d $lt $f", $name, 1; } } @@ -829,7 +841,8 @@ FW_showRoom() } else { - pO ""; + pH "detail=$d", $d, 1; + pO ""; } pO " "; @@ -906,7 +919,8 @@ FW_logWrapper($) pO ""; } - pO "
Convert to weblink
"; + pH "cmd=toweblink $d:$type:$file", "
Convert to weblink"; + pO ""; pO "
"; - pO FW_textfield("cmd", $__ss ? 20 : 40); + pO '
'; + my $tf_done; if($__room) { pO FW_hidden("room", "$__room"); # plots navigation buttons if(!$__detail || $defs{$__detail}{TYPE} eq "weblink") { if(FW_calcWeblink(undef,undef)) { + pO FW_textfield("cmd", $__ss ? 20 : 40); + $tf_done = 1; pO ""; pO "  "; FW_zoomLink("zoom=-1", "Zoom-in.png", "zoom in"); @@ -619,14 +629,15 @@ FW_roomOverview($) } } } + pO FW_textfield("cmd", $__ss ? 28 : 40) if(!$tf_done); pO "
"; pO ""; pO ""; ############## # LOGO - my $logofile = ($__ss ? "fhem_smallscreen.png" : "fhem.png"); - pO "
"; + my $logo = $__ss ? "fhem_smallscreen.png" : "fhem.png"; + pO "
"; ############## # MENU @@ -774,7 +785,7 @@ FW_showRoom() } $v = "" if(!defined($v)); - pO "
$d$vonoff$d$v°$d$v$varchive$name$d$v$v
"; pO "
"; pO "
"; @@ -1107,7 +1121,7 @@ FW_showLog($) } $ret = fC("get $d $file INT $f $t " . join(" ", @{$flog})); ($cfg, $plot) = FW_substcfg(1, $wl, $cfg, $plot, $file, ""); - SVG_render($wl, $f, $t, $cfg, $internal_data, $plot); + SVG_render($wl, $f, $t, $cfg, $internal_data, $plot, $__ss); $__RETTYPE = "image/svg+xml"; } @@ -1168,8 +1182,9 @@ FW_makeEdit($$$$) pO "
"; my $eval = $val; $eval =~ s,\\\n,\n,g; + my $ncols = $__ss ? 40 : 60; - pO ""; pO "
" . FW_submit("cmd.${cmd}$name", "$cmd $name"); pO "
"; @@ -1234,9 +1249,8 @@ FW_zoomLink($$$) } - pO ""; - pO "\"$alt\""; + pH "$cmd", "\"$alt\""; } ################## @@ -1371,7 +1385,8 @@ FW_style($$) my $row = 0; foreach my $file (@fl) { pO ""; - pO "$file"; + pH "cmd=style edit $file", $file, 1; + pO ""; $row = ($row+1)%2; } pO " "; @@ -1388,7 +1403,8 @@ FW_style($$) my $row = 0; foreach my $file (@fl) { pO ""; - pO "$file"; + pH $file, $file, 1; + pO ""; $row = ($row+1)%2; } pO " "; @@ -1446,6 +1462,22 @@ pO(@) $__RET .= "\n"; } +################# +# add href +sub +pH(@) +{ + my ($link, $txt, $td) = @_; + + pO "" if($td); + if($__ss) { + pO "$txt"; + } else { + pO "$txt"; + } + pO "" if($td); +} + ################## # print formatted sub @@ -1482,10 +1514,12 @@ FW_showWeblink($$$) my ($d, $v, $t) = @_; if($t eq "link") { - pO "$d"; + pH $v, $d, 1; } elsif($t eq "image") { - pO "
$d"; + pO "
"; + pH "detail=$d", $d; + pO ""; } elsif($t eq "fileplot") { my @va = split(":", $v, 3); @@ -1498,7 +1532,8 @@ FW_showWeblink($$$) } if($__ss) { - pO "$d
" + pH "detail=$d", $d; + pO "
"; } else { pO "
"; } @@ -1518,7 +1553,9 @@ FW_showWeblink($$$) if($__ss) { pO "
"; } else { - pO "
$d
"; + pO ""; + pH "detail=$d", $d, 1; + pO ""; } } diff --git a/fhem/webfrontend/pgm2/98_SVG.pm b/fhem/webfrontend/pgm2/98_SVG.pm index 536a252ee..9f92d37b9 100755 --- a/fhem/webfrontend/pgm2/98_SVG.pm +++ b/fhem/webfrontend/pgm2/98_SVG.pm @@ -8,7 +8,7 @@ use POSIX; -sub SVG_render($$$$$$); +sub SVG_render($$$$$$$); sub time_to_sec($); sub fmtTime($$); @@ -25,7 +25,7 @@ SVG_Initialize($) ##################################### sub -SVG_render($$$$$$) +SVG_render($$$$$$$) { my $name = shift; # e.g. wl_8 my $from = shift; # e.g. 2008-01-01 @@ -33,11 +33,12 @@ SVG_render($$$$$$) my $confp = shift; # lines from the .gplot file, w/o FileLog and plot my $dp = shift; # pointer to data (one string) my $plot = shift; # Plot lines from the .gplot file + my $__ss = shift; # small screen return "" if(!defined($dp)); my $th = 16; # "Font" height - my ($x, $y) = (3*$th, 1.2*$th); # Rect offset + my ($x, $y) = (($__ss ? 2 : 3)*$th, 1.2*$th); # Rect offset my %conf; # gnuplot file settings # Convert the configuration to a "readable" form -> array to hash @@ -97,15 +98,17 @@ SVG_render($$$$$$) my $t = ($conf{ylabel} ? $conf{ylabel} : ""); $t =~ s/"//g; - ($off1,$off2) = (3*$th/4, $oh/2); - pO "$t"; + if(!$__ss) { + ($off1,$off2) = (3*$th/4, $oh/2); + pO "$t"; - $t = ($conf{y2label} ? $conf{y2label} : ""); - $t =~ s/"//g; - ($off1,$off2) = ($ow-$th/4, $oh/2); - pO "$t"; + $t = ($conf{y2label} ? $conf{y2label} : ""); + $t =~ s/"//g; + ($off1,$off2) = ($ow-$th/4, $oh/2); + pO "$t"; + } # Digest axes/title/type from $plot (gnuplot) and draw the line-titles my (@axes,@ltitle,@type); diff --git a/fhem/webfrontend/pgm2/fhemicon.png b/fhem/webfrontend/pgm2/fhemicon.png new file mode 100644 index 000000000..87cdf6a28 Binary files /dev/null and b/fhem/webfrontend/pgm2/fhemicon.png differ diff --git a/fhem/webfrontend/pgm2/style_smallscreen.css b/fhem/webfrontend/pgm2/style_smallscreen.css index d1f1fb05c..1e5c31af1 100644 --- a/fhem/webfrontend/pgm2/style_smallscreen.css +++ b/fhem/webfrontend/pgm2/style_smallscreen.css @@ -1,8 +1,9 @@ body { background-color: #FFFFE7;} -#logo { position:absolute; top:10px; left:10px; } +#logo { position:absolute; top:10px; left:10px; } #menu { position:absolute; top:10px; left:85px; } #hdr { position:absolute; top:40px; left:85px; } #content { position:absolute; top:85px; left:10px; } + a { color: #278727; } table.block { border:1px solid gray; width: 100%; background: #F8F8E0; }