From 816d1f668223df6ccccbadc4bb898d09394256af Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 22 Oct 2012 16:49:10 +0000 Subject: [PATCH] Darkstyle should work again with commandref.html / faq / etc git-svn-id: https://svn.fhem.de/fhem/trunk@2003 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index dd3fab4e8..6f0293eff 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -325,11 +325,18 @@ FW_Read($) ########################### sub -FW_ServeSpecial($$$) { - +FW_ServeSpecial($$$) +{ my ($file,$ext,$dir)= @_; $file =~ s,\.\./,,g; # little bit of security + if($ext eq "css") { + my $prf = AttrVal($FW_wname, "stylesheetPrefix", ""); + $prf = "smallscreen" if(!$prf && $FW_ss); + $prf = "touchpad" if(!$prf && $FW_tp); + $file = "$prf$file" if(-f "$dir/$prf$file.$ext"); + } + #Debug "We serve $dir/$file.$ext"; open(FH, "$dir/$file.$ext") || return 0; binmode(FH) if($ext =~ m/$ICONEXTENSION/); # necessary for Windows @@ -580,9 +587,7 @@ FW_AnswerCall($) } my $prf = AttrVal($FW_wname, "stylesheetPrefix", ""); - $prf = "smallscreen" if(!$prf && $FW_ss); - $prf = "touchpad" if(!$prf && $FW_tp); - FW_pO ""; + FW_pO ""; FW_pO "" if($FW_plotmode eq "SVG"); FW_pO ""; @@ -1764,6 +1769,7 @@ FW_style($$) } else { $attr{$FW_wname}{stylesheetPrefix} = $a[2]; } + FW_ReadIcons($defs{$FW_wname}); FW_pO "${start}Reload the page in the browser.$end"; } elsif($a[1] eq "edit") { @@ -2162,22 +2168,11 @@ FW_ReadIcons($) } } -sub -FW_canonicalizeIcon($) { - my ($name)= @_; - if($name =~ m/^(.*)\.($ICONEXTENSION)$/) { - Log 1, "WARNING: argument of FW_canonicalizeIcon($name) has extension - inform the developers!"; - - $name= $1; - } - return $name; -} sub FW_getIcon($) { my ($name)= @_; - $name= FW_canonicalizeIcon($name); return $FW_icons{$name} ? $name : undef; } @@ -2189,7 +2184,6 @@ sub FW_IconPath($) { my ($name)= @_; - $name= FW_canonicalizeIcon($name); my $path= $FW_icons{$name}; return $path ? $FW_icondir . "/" . $path : undef; } @@ -2202,7 +2196,6 @@ sub FW_IconURL($) { my ($name)= @_; - $name= FW_canonicalizeIcon($name); return "$FW_ME/icons/${name}"; }