2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

Darkstyle should work again with commandref.html / faq / etc

git-svn-id: https://svn.fhem.de/fhem/trunk@2003 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-10-22 16:49:10 +00:00
parent f49bc81841
commit 816d1f6682

View File

@ -325,11 +325,18 @@ FW_Read($)
########################### ###########################
sub sub
FW_ServeSpecial($$$) { FW_ServeSpecial($$$)
{
my ($file,$ext,$dir)= @_; my ($file,$ext,$dir)= @_;
$file =~ s,\.\./,,g; # little bit of security $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"; #Debug "We serve $dir/$file.$ext";
open(FH, "$dir/$file.$ext") || return 0; open(FH, "$dir/$file.$ext") || return 0;
binmode(FH) if($ext =~ m/$ICONEXTENSION/); # necessary for Windows binmode(FH) if($ext =~ m/$ICONEXTENSION/); # necessary for Windows
@ -580,9 +587,7 @@ FW_AnswerCall($)
} }
my $prf = AttrVal($FW_wname, "stylesheetPrefix", ""); my $prf = AttrVal($FW_wname, "stylesheetPrefix", "");
$prf = "smallscreen" if(!$prf && $FW_ss); FW_pO "<link href=\"$FW_ME/css/style.css\" rel=\"stylesheet\"/>";
$prf = "touchpad" if(!$prf && $FW_tp);
FW_pO "<link href=\"$FW_ME/css/".$prf."style.css\" rel=\"stylesheet\"/>";
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/js/svg.js\"></script>" FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/js/svg.js\"></script>"
if($FW_plotmode eq "SVG"); if($FW_plotmode eq "SVG");
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/js/fhemweb.js\"></script>"; FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/js/fhemweb.js\"></script>";
@ -1764,6 +1769,7 @@ FW_style($$)
} else { } else {
$attr{$FW_wname}{stylesheetPrefix} = $a[2]; $attr{$FW_wname}{stylesheetPrefix} = $a[2];
} }
FW_ReadIcons($defs{$FW_wname});
FW_pO "${start}Reload the page in the browser.$end"; FW_pO "${start}Reload the page in the browser.$end";
} elsif($a[1] eq "edit") { } 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 sub
FW_getIcon($) FW_getIcon($)
{ {
my ($name)= @_; my ($name)= @_;
$name= FW_canonicalizeIcon($name);
return $FW_icons{$name} ? $name : undef; return $FW_icons{$name} ? $name : undef;
} }
@ -2189,7 +2184,6 @@ sub
FW_IconPath($) FW_IconPath($)
{ {
my ($name)= @_; my ($name)= @_;
$name= FW_canonicalizeIcon($name);
my $path= $FW_icons{$name}; my $path= $FW_icons{$name};
return $path ? $FW_icondir . "/" . $path : undef; return $path ? $FW_icondir . "/" . $path : undef;
} }
@ -2202,7 +2196,6 @@ sub
FW_IconURL($) FW_IconURL($)
{ {
my ($name)= @_; my ($name)= @_;
$name= FW_canonicalizeIcon($name);
return "$FW_ME/icons/${name}"; return "$FW_ME/icons/${name}";
} }