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/