From 52732ed93005b8d2bcc1c635fe7757d211cec3b2 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 12 Jun 2013 10:29:22 +0000 Subject: [PATCH] Fixing SVG image stuff (icon/etc) git-svn-id: https://svn.fhem.de/fhem/trunk@3276 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 40 +++++++++++++------- fhem/www/images/openautomation/iconalias.txt | 4 ++ fhem/www/pgm2/darkstyle.css | 2 +- fhem/www/pgm2/smallscreenstyle.css | 2 +- fhem/www/pgm2/style.css | 4 +- fhem/www/pgm2/touchpadstyle.css | 2 +- 6 files changed, 36 insertions(+), 18 deletions(-) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index fe618430d..54adfc3e0 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -975,7 +975,8 @@ FW_roomOverview($) my $icoName = "ico$l1"; map { my ($n,$v) = split(":",$_); $icoName=$v if($l1 =~ m/$n/); } split(" ", AttrVal($FW_wname, "roomIcons", "")); - my $icon = FW_iconName($icoName) ? FW_makeImage($icoName)." " : ""; + my $icon = FW_iconName($icoName) ? + FW_makeImage($icoName,$icoName,"icon")." " : ""; if($l2 =~ m/.html$/ || $l2 =~ m/^http/) { FW_pO "$td$icon$l1"; @@ -1063,7 +1064,7 @@ FW_showRoom() FW_pF "\n", ($row&1)?"odd":"even"; my $devName = AttrVal($d, "alias", $d); my $icon = AttrVal($d, "icon", ""); - $icon = FW_makeImage($icon) . " " if($icon); + $icon = FW_makeImage($icon,$icon,"icon") . " " if($icon); if($FW_hiddenroom{detail}) { FW_pO "
$icon$devName
"; @@ -1357,6 +1358,11 @@ FW_substcfg($$$$$$) my $oll = $attr{global}{verbose}; $attr{global}{verbose} = 0; # Else the filenames will be Log'ged + if($file eq "CURRENT") { + my @a = split(":", $defs{$wl}{LINK}); + $file = $defs{$a[0]}{currentlogfile}; + $file =~ s+.*/++; + } my $fileesc = $file; $fileesc =~ s/\\/\\\\/g; # For Windows, by MarkusRR my $title = AttrVal($wl, "title", "\"$fileesc\""); @@ -1917,15 +1923,15 @@ FW_style($$) $ret = ""; } elsif($a[1] eq "iconFor") { - FW_iconTable("iconFor", "^ico", "style setIF $a[2] %s", undef); + FW_iconTable("iconFor", "icon", "style setIF $a[2] %s", undef); } elsif($a[1] eq "setIF") { FW_fC("attr $a[2] icon $a[3]"); FW_doDetail($a[2]); } elsif($a[1] eq "showDSI") { - FW_iconTable("devStateIcon", '^((?!(weather|_big|fhemicon|darklogo)).)*$', - "style addDSI $a[2] %s", "Enter value/regexp for STATE"); + FW_iconTable("devStateIcon", "", + "style addDSI $a[2] %s", "Enter value/regexp for STATE"); } elsif($a[1] eq "addDSI") { my $dsi = AttrVal($a[2], "devStateIcon", ""); @@ -1949,12 +1955,15 @@ FW_style($$) sub FW_iconTable($$$$) { - my ($name, $re, $cmdFmt, $textfield) = @_; + my ($name, $class, $cmdFmt, $textfield) = @_; + my %icoList = (); foreach my $style (@FW_iconDirs) { - foreach my $imgName (sort grep {/^$re/} keys %{$FW_icons{$style}}) { + foreach my $imgName (sort keys %{$FW_icons{$style}}) { $imgName =~ s/\.[^.]*$//; # Cut extension next if(!$FW_icons{$style}{$imgName}); # Dont cut it twice: FS20.on.png + next if($FW_icons{$style}{$imgName} !~ m/$imgName/); # Skip alias + next if($imgName=~m+^(weather/|shutter.*big|fhemicon|favicon|darklogo)+); $icoList{$imgName} = 1; } } @@ -1965,8 +1974,8 @@ FW_iconTable($$$$) FW_pO "$textfield: ".FW_textfieldv("data",20,"iconTable",".*")."
"; } foreach my $i (sort keys %icoList) { - FW_pF "", $i, FW_makeImage($i); + FW_pF "", $i, $i, FW_makeImage($i,$i,$class); } FW_pO ""; FW_pO ""; @@ -2032,8 +2041,11 @@ FW_pHPlain(@) sub FW_makeImage(@) { - my ($name, $txt)= @_; + my ($name, $txt, $class)= @_; + $txt = $name if(!defined($txt)); + $class = "" if(!$class); + my $p = FW_iconPath($name); return $name if(!$p); if($p =~ m/\.svg$/i) { @@ -2043,21 +2055,23 @@ FW_makeImage(@) close(FH); $data =~ s/[\r\n]/ /g; $data =~ s/ *$//g; + $data =~ s/"; + $class = "class='$class'" if($class); + return "\"$txt\""; } } diff --git a/fhem/www/images/openautomation/iconalias.txt b/fhem/www/images/openautomation/iconalias.txt index 6abdcc7dc..1f60f00f0 100644 --- a/fhem/www/images/openautomation/iconalias.txt +++ b/fhem/www/images/openautomation/iconalias.txt @@ -1,3 +1,5 @@ +FS20.off light_light_dim_00.svg +FS20.on light_light_dim_100.svg off light_light_dim_00.svg on light_light_dim_100.svg @@ -9,6 +11,8 @@ Prev control_centr_arrow_left.svg Zoom-out control_zoom_out.svg Zoom-in control_zoom_in.svg +back control_centr_arrow_left.svg + dim06% light_light_dim_00.svg dim12% light_light_dim_10.svg dim18% light_light_dim_10.svg diff --git a/fhem/www/pgm2/darkstyle.css b/fhem/www/pgm2/darkstyle.css index 470a644d3..42ec3f636 100644 --- a/fhem/www/pgm2/darkstyle.css +++ b/fhem/www/pgm2/darkstyle.css @@ -61,5 +61,5 @@ select { margin-left:5px; margin-right:5px; } border:2px solid; color:white; text-align:center; } .downText { margin-top:2px; } -svg { max-height:32px; max-width:32px; fill:#fff; } +svg { height:32px; width:32px; fill:#fff; } g.on { fill:red; } diff --git a/fhem/www/pgm2/smallscreenstyle.css b/fhem/www/pgm2/smallscreenstyle.css index 30c05d6cc..db7f04b5c 100644 --- a/fhem/www/pgm2/smallscreenstyle.css +++ b/fhem/www/pgm2/smallscreenstyle.css @@ -70,5 +70,5 @@ button.dist { margin:5px; background:transparent; border:0px; cursor:pointer; } -webkit-user-select:none; -moz-user-select:none; -user-select:none; border:3px solid; color:#278727; text-align:center; } -svg { max-height:32px; max-width:32px; fill:#278727; } +svg { height:32px; width:32px; fill:#278727; } g.on { fill:red; } diff --git a/fhem/www/pgm2/style.css b/fhem/www/pgm2/style.css index 87f91cc45..012dd30d2 100644 --- a/fhem/www/pgm2/style.css +++ b/fhem/www/pgm2/style.css @@ -56,5 +56,5 @@ select { margin-left:5px; margin-right:5px; } pre { white-space: pre-wrap; } -svg { max-height:32px; max-width:32px; fill:#278727; } -g.on { fill:red; } +svg { height:32px; width:32px; fill:#278727; } +svg.on { fill:orange; } diff --git a/fhem/www/pgm2/touchpadstyle.css b/fhem/www/pgm2/touchpadstyle.css index 3d84ea117..8c6f79104 100644 --- a/fhem/www/pgm2/touchpadstyle.css +++ b/fhem/www/pgm2/touchpadstyle.css @@ -45,5 +45,5 @@ select { margin-left:5px; margin-right:5px; } border:3px solid; color:#278727; text-align:center; } .downText { margin-top:2px; } -svg { max-height:32px; max-width:32px; fill:#278727; } +svg { height:32px; width:32px; fill:#278727; } g.on { fill:red; }