From c3f5537bd41278e9d1042cf17df4ee1797d3429c Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 5 Jul 2010 13:49:04 +0000 Subject: [PATCH] embed stylesheet, background for safari git-svn-id: https://svn.fhem.de/fhem/trunk@648 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/webfrontend/pgm2/01_FHEMWEB.pm | 35 +++++++++++++++-------------- fhem/webfrontend/pgm2/98_SVG.pm | 15 +++++++++---- fhem/webfrontend/pgm2/svg_style.css | 4 ++-- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm index fad324229..011d1ce3a 100755 --- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm +++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm @@ -31,33 +31,33 @@ sub FW_AnswerCall($); sub FW_zoomLink($$$); sub FW_calcWeblink($$); -use vars qw($__ME); # webname (fhem), needed by SVG +use vars qw($__dir); # moddir (./FHEM), needed by SVG my $zlib_loaded; ######################### # As we are _not_ multithreaded, it is safe to use global variables. # Note: for delivering SVG plots we fork +my $__cmdret; # Returned data by the fhem call +my $__data; # Filecontent from browser when editing a file +my $__detail; # currently selected device for detail view +my %__devs; # hash of from/to entries per device my %__icons; # List of icons my $__iconsread; # Timestamp of last icondir check -my %__rooms; # hash of all rooms -my %__devs; # hash of from/to entries per device -my %__types; # device types, for sorting -my $__room; # currently selected room -my $__detail; # currently selected device for detail view -my $__cmdret; # Returned data by the fhem call -my %__pos; # scroll position -my $__RET; # Returned data (html) -my $__RETTYPE; # image/png or the like -my @__zoom; # "qday", "day","week","month","year" -my %__zoom; # the same as @__zoom -my $__wname; # Web instance name +my $__ME; # webname (fhem) my $__plotmode; # Global plot mode (WEB attribute) my $__plotsize; # Global plot size (WEB attribute) -my $__data; # Filecontent from browser when editing a file -my $__dir; # FHEM directory +my %__pos; # scroll position my $__reldoc; # $__ME/commandref.html; +my $__RET; # Returned data (html) +my $__RETTYPE; # image/png or the like +my $__room; # currently selected room +my %__rooms; # hash of all rooms my $__ss; # smallscreen +my %__types; # device types, for sorting +my $__wname; # Web instance name +my @__zoom; # "qday", "day","week","month","year" +my %__zoom; # the same as @__zoom ##################################### @@ -359,7 +359,8 @@ FW_AnswerCall($) my $stylecss = ($__ss ? "style_smallscreen.css" : "style.css"); pO "<link href=\"$__ME/$stylecss\" rel=\"stylesheet\"/>"; pO "<meta name=\"viewport\" content=\"width=device-width\"/>" if($__ss); - pO "<script type=\"text/javascript\" src=\"$__ME/svg.js\"></script>"; + pO "<script type=\"text/javascript\" src=\"$__ME/svg.js\"></script>" + if($__plotmode eq "SVG"); pO "</head>\n<body name=\"$t\">"; if($__cmdret) { @@ -898,7 +899,7 @@ FW_logWrapper($) my $arg = "$__ME?cmd=showlog undef $d $type $file"; if(FW_getAttr($d,"plotmode",$__plotmode) eq "SVG") { my ($w, $h) = split(",", FW_getAttr($d,"plotsize",$__plotsize)); - pO "<embed src=\"$arg\" type=\"image/svg+xml\"" . + pO "<embed data=\"$arg\" type=\"image/svg+xml\"" . "width=\"$w\" height=\"$h\" name=\"$d\"/>\n"; } else { diff --git a/fhem/webfrontend/pgm2/98_SVG.pm b/fhem/webfrontend/pgm2/98_SVG.pm index 797f4485e..edee9951f 100755 --- a/fhem/webfrontend/pgm2/98_SVG.pm +++ b/fhem/webfrontend/pgm2/98_SVG.pm @@ -53,18 +53,25 @@ SVG_render($$$$$$) # Html Header pO "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; - pO "<?xml-stylesheet href=\"$__ME/svg_style.css\" type=\"text/css\"?>"; pO "<!DOCTYPE svg>"; pO "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" ". "xmlns:xlink=\"http://www.w3.org/1999/xlink\" " . ">"; - #pO "<script type=\"text/ecmascript\" xlink:href=\"$__ME/svg.js\"/>"; - + pO "<style type=\"text/css\"><![CDATA["; + if(open(FH, "$__dir/svg_style.css")) { + pO join("", <FH>); + close(FH); + } else { + Log 0, "Can't open $__dir/svg_style.css" + } + pO "]]></style>"; + # Background + pO "<rect width =\"$ow\" height=\"$oh\" class=\"background\"/>"; # Rectangle pO "<rect x=\"$x\" y=\"$y\" width =\"$w\" height =\"$h\" ". - "stroke-width=\"1px\" class=\"border\"/>"; + "fill=\"none\" class=\"border\"/>"; my ($off1,$off2) = ($ow/2, 3*$y/4); my $title = ($conf{title} ? $conf{title} : " "); diff --git a/fhem/webfrontend/pgm2/svg_style.css b/fhem/webfrontend/pgm2/svg_style.css index 8684ccf64..3e0105a4d 100644 --- a/fhem/webfrontend/pgm2/svg_style.css +++ b/fhem/webfrontend/pgm2/svg_style.css @@ -3,8 +3,8 @@ text.title { font-size:16px; } text.copy { font-size:16px; stroke:none; fill:blue; } text.paste { font-size:16px; stroke:none; fill:blue; } -rect.border { stroke:black; stroke-width:1px; fill:none; } - +.background { fill:#FFFFE7; } +.border { stroke:black; stroke-width:1px; } polyline { stroke:black; fill:none; } .vgrid { stroke-dasharray:2,6; stroke:gray; }