2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

01_FHEMWEB.pm: the default style is renamed to f11 (Forum #90983)

git-svn-id: https://svn.fhem.de/fhem/trunk@23825 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-02-25 20:17:07 +00:00
parent c92976a09e
commit e6c3d2fde9
2 changed files with 25 additions and 20 deletions

View File

@ -795,6 +795,18 @@ FW_serveSpecial($$$$)
return FW_returnFileAsStream("$dir/$fname", "", $FW_RETTYPE, 0, $cacheable);
}
sub
FW_setStylesheet()
{
$FW_sp = AttrVal($FW_wname, "stylesheetPrefix", "f18");
$FW_sp = "" if($FW_sp eq "default");
$FW_sp =~ s/^f11//; # Compatibility, #90983
$FW_ss = ($FW_sp =~ m/smallscreen/);
$FW_tp = ($FW_sp =~ m/smallscreen|touchpad/);
@FW_iconDirs = grep { $_ } split(":", AttrVal($FW_wname, "iconPath",
"${FW_sp}:fhemSVG:openautomation:default"));
}
sub
FW_answerCall($)
{
@ -805,12 +817,7 @@ FW_answerCall($)
$FW_RETTYPE = "text/html; charset=$FW_encoding";
$MW_dir = "$attr{global}{modpath}/FHEM";
$FW_sp = AttrVal($FW_wname, "stylesheetPrefix", "f18");
$FW_ss = ($FW_sp =~ m/smallscreen/);
$FW_tp = ($FW_sp =~ m/smallscreen|touchpad/);
my $spDir = ($FW_sp eq "default" ? "" : "$FW_sp:");
@FW_iconDirs = grep { $_ } split(":", AttrVal($FW_wname, "iconPath",
"${spDir}fhemSVG:openautomation:default"));
FW_setStylesheet();
@FW_fhemwebjs = ("fhemweb.js");
push(@FW_fhemwebjs, "$FW_sp.js") if(-r "$FW_dir/pgm2/$FW_sp.js");
@ -2418,18 +2425,21 @@ FW_style($$)
FW_pO $end;
} elsif($a[1] eq "select") {
my @fl = grep { $_ !~ m/(floorplan|dashboard)/ }
FW_fileList("$FW_cssdir/.*style.css");
my %smap= ( ""=>"f11", "touchpad"=>"f11touchpad",
"smallscreen"=>"f11smallscreen");
my @fl = map { $_ =~ s/style.css//; $smap{$_} ? $smap{$_} : $_ }
grep { $_ !~ m/(svg_|floorplan|dashboard)/ }
FW_fileList("$FW_cssdir/.*style.css");
FW_addContent($start);
FW_pO "<div class='fileList styles'>Styles</div>";
FW_pO "<table class='block wide fileList'>";
my $sp = $FW_sp eq "default" ? "" : $FW_sp;;
$sp = $smap{$sp} if($smap{$sp});
my $row = 0;
foreach my $file (@fl) {
next if($file =~ m/svg_/);
$file =~ s/style.css//;
$file = "default" if($file eq "");
foreach my $file (sort @fl) {
FW_pO "<tr class=\"" . ($row?"odd":"even") . "\">";
FW_pH "cmd=style set $file", "$file", 1;
FW_pH "cmd=style set $file", "$file", 1,
"style$file ".($sp eq $file ? "changed":"");
FW_pO "</tr>";
$row = ($row+1)%2;
}
@ -3100,13 +3110,7 @@ FW_Notify($$)
$FW_wname = $ntfy->{SNAME};
$FW_ME = "/" . AttrVal($FW_wname, "webname", "fhem");
$FW_subdir = ($h->{iconPath} ? "/floorplan/$h->{iconPath}" : ""); # 47864
$FW_sp = AttrVal($FW_wname, "stylesheetPrefix", "f18");
$FW_sp = "" if($FW_sp eq "default");
$FW_ss = ($FW_sp =~ m/smallscreen/);
$FW_tp = ($FW_sp =~ m/smallscreen|touchpad/);
my $spDir = ($FW_sp eq "default" ? "" : "$FW_sp:");
@FW_iconDirs = grep { $_ } split(":", AttrVal($FW_wname, "iconPath",
"${spDir}fhemSVG:openautomation:default"));
FW_setStylesheet();
if($h->{iconPath}) {
unshift @FW_iconDirs, $h->{iconPath};
FW_readIcons($h->{iconPath});

View File

@ -292,3 +292,4 @@ body.commandref div#menu br { display:none; }
body.commandref div#menu h3 { display:none; }
.SVGplot { position:relative;}
div.stylef18.changed a { color:red!important }