From c934bb34acd221edb6ad2700ab1b2aedd064f1d2 Mon Sep 17 00:00:00 2001 From: ulimaass <> Date: Mon, 19 Mar 2012 18:09:35 +0000 Subject: [PATCH] Added startscreen-text when no floorplans defined, fixed startscreen- stylesheet, added div for bg-img, added arrangeByMouse New darkfloorplanstyle.css by Volker git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@1368 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- contrib/95_FLOORPLAN/95_FLOORPLAN.pm | 90 +++++++++++++++------ contrib/95_FLOORPLAN/darkfloorplanstyle.css | 45 ++++++----- 2 files changed, 88 insertions(+), 47 deletions(-) diff --git a/contrib/95_FLOORPLAN/95_FLOORPLAN.pm b/contrib/95_FLOORPLAN/95_FLOORPLAN.pm index d8280ce4d..035ae395d 100644 --- a/contrib/95_FLOORPLAN/95_FLOORPLAN.pm +++ b/contrib/95_FLOORPLAN/95_FLOORPLAN.pm @@ -16,7 +16,9 @@ # -> general release # 0009: updated selection of add-device-list: suppress CUL$ only (instead of CUL.*) # 0010: Added Style3, fp_stylesheetPrefix, fp_noMenu (Mar 13, 2012) -# 0011: Added Style4, code beautification, css review, minor $text2-fix +# 0011: Added Style4, code beautification, css review, minor $text2-fix (SVN 1342) +# 0012: Added startscreen-text when no floorplans defined, fixed startscreen-stylesheet, added div for bg-img, added arrangeByMouse +# # ################################################################ # @@ -184,7 +186,7 @@ FP_CGI(){ ### set global parameters, check florplan-name $FP_name = $htmlpart[0] if (!$FP_name); - if ($FP_name) { + if ($FP_name) { # a floorplan-name is part of URL addToAttrList("fp_$FP_name"); # create userattr fp_ if it doesn't exist yet $FP_arrange = AttrVal($FP_name, "fp_arrange", 0) if ($FP_name); # set arrange mode if(!defined($defs{$FP_name})){ @@ -192,14 +194,17 @@ FP_CGI(){ return ("text/plain; charset=$FW_encoding", $FW_RET); } $FW_subdir = "/floorplan/$FP_name"; - } else { + } else { # no floorplan-name in URL $FW_subdir = "/floorplan"; my $dev = undef; my @devs = devspec2array("*"); foreach my $fp (@devs) { - if (AttrVal($fp, "fp_default", undef)) { + if (AttrVal($fp, "fp_default", undef)) { # use floorplan with attr fp_default $FP_name = $fp; $FW_subdir = "/floorplan/$fp"; + $FP_arrange = AttrVal($fp, "fp_arrange", undef); + $FP_arrange_default = undef; + $FP_arrange_selected = undef; } } } @@ -297,9 +302,9 @@ FP_htmlHeader($) { FW_pO (""); #use floorplanstyle.css for floorplans, evtl. with fp_stylesheetPrefix $data{FWEXT}{$fhem_url}{STYLESHEET} = "$prf"."floorplanstyle.css"; } else { - my $css = $attr{global}{VIEW_CSS}; - $css = "style.css" if (!$css); - FW_pO ""; #use VIEW_CSS or style.css for fp-start-screen + my $css = AttrVal($FW_wname, "stylesheetPrefix", "") . "floorplanstyle.css"; + FW_pO ""; #use floorplanstyle.css (incl. FW-stylesheetPrefix) for fp-start-screen + $data{FWEXT}{$fhem_url}{STYLESHEET} = $css; } #set sripts FW_pO "" @@ -316,13 +321,25 @@ FP_showStart() { FP_htmlHeader("Floorplans"); FW_pO ""; FW_pO "
"; + FP_menu(); FW_pO "
"; FW_pO "
"; FW_pO ""; FW_pO ""; #input-field FW_pO "
"; - FP_menu(); + # add edit *floorplanstyle.css if FP_arrange ? + # no floorplans defined? -> show message + my $count=0; + foreach my $f (sort keys %defs) { + next if ($defs{$f}{TYPE} ne "FLOORPLAN"); + $count++; + } + if ($count == 0) { + FW_pO "



No floorplans have been defined yet. For definition, use
"; + FW_pO "
    define <name> FLOORPLAN
"; + FW_pO 'Also check the commandref
'; + } FW_pO "
"; FW_pO ""; } @@ -334,11 +351,14 @@ FP_show(){ ### Page start FP_htmlHeader("$FP_name"); ## body - FW_pO "\n"; - FW_pO "\n"; # alternative: jpg - how? + FW_pO "\n"; + FW_pO "
"; + FW_pO ""; # alternative: jpg - how? + FW_pO "
\n"; + ## menus FP_menu(); - FP_menuArrange() if ($FP_arrange); + FP_menuArrange() if ($FP_arrange); #shows the arrange-menu # (re-) list the icons FW_ReadIcons(); ## start floorplan @@ -353,8 +373,7 @@ FP_show(){ FW_pO "\n"; } - my @devs = devspec2array("*"); - foreach my $d (@devs) { # loop all devices + foreach my $d (sort keys %defs) { # loop all devices my $type = $defs{$d}{TYPE}; my $attr = AttrVal("$d","fp_$FP_name", undef); next if(!$attr || $type eq "weblink"); # skip if device-attribute not set for current floorplan-name @@ -368,7 +387,7 @@ FP_show(){ $left = 0 if (!$left); $style = 0 if (!$style); - FW_pO "\n
"; + FW_pO "\n
"; FW_pO "
"; FW_pO " "; # Main table per device my ($allSets, $cmdlist, $txt) = FW_devState($d, ""); @@ -423,9 +442,8 @@ FP_show(){ FW_submit("cmd.$d", "set"). ""; } - FW_pO "\n"; - FW_pO "
\n"; - FW_pO ""; + FW_pO ""; + FW_pO "
\n"; } ######################## @@ -441,12 +459,16 @@ FP_show(){ next if($type ne "weblink"); # set position per weblink my ($top, $left, $style, $text) = split(/,/ , AttrVal("$d", "fp_$FP_name", undef)); - FW_pO "\n
"; + FW_pO "\n
"; # div to position the weblink + FW_pO "
"; # div to make it accessible to arrangeByMouse # print weblink $buttons = FW_showWeblink($d, $defs{$d}{LINK}, $defs{$d}{WLTYPE}, $buttons); - FW_pO "
"; + FW_pO "
"; } FW_pO ""; + +# FP_menuArrange() if ($FP_arrange); #shows the arrange-menu + FW_pO "\n"; } #------------------------------------------------------------------------------- @@ -458,14 +480,14 @@ FP_menu() { FW_pO "
"; # List FPs FW_pO ""; - FW_pO ""; + FW_pO ""; + FW_pO ""; foreach my $f (sort keys %defs) { next if ($defs{$f}{TYPE} ne "FLOORPLAN"); - FW_pO ""; + FW_pO ""; + FW_pO ""; } FW_pO "
"; FW_pH "$FW_ME", "fhem", 1; - FW_pO "
"; FW_pH "$FW_ME/floorplan/$f", $f, 1; - FW_pO "

"; FW_pO "
\n"; @@ -491,7 +513,7 @@ FP_menuArrange() { my $attrd = ""; my $d = $FP_arrange_selected; $attrd = AttrVal($d, "fp_$FP_name", undef) if ($d); - FW_pO "
\n"; + FW_pO "
"; # add device to floorplan if (!defined($FP_arrange_selected)) { @@ -513,6 +535,22 @@ FP_menuArrange() { # fields for top,left,style,text if ($attrd) { + #### arrangeByMouse by Torsten + FW_pO ""; + + + ### build the form FW_pO "
"; #form3 my ($top, $left, $style, $text, $text2) = split(",", $attrd); $text .= ','.$text2 if ($text2); # re-append Description after reading-ID for style3 @@ -521,8 +559,8 @@ FP_menuArrange() { FP_input("deva.$d", $d, "hidden") . "\n" . FP_input("dscr.$d", $d, "text", "Selected device", 45, "", "disabled") . "\n
\n" . FP_input("attr.$d", "fp_$FP_name", "hidden") . "\n" . - FP_input("top.$d", $top ? $top : 10, "text", "Top", 4, 4 ) . "\n" . - FP_input("left.$d", $left ? $left : 10, "text", "Left", 4, 4 ) . "\n" . + FP_input("top.$d", $top ? $top : 10, "text", "Top", 4, 4, 'id="fp_ar_input_top"') . "\n" . + FP_input("left.$d", $left ? $left : 10, "text", "Left", 4, 4, 'id="fp_ar_input_left"' ) . "\n" . FW_select("style.$d", \@styles, $style ? $style : 0, "menu-arrange") . "\n" . FP_input("text.$d", $text ? $text : "", "text", "Description", 15) . "\n" . FW_submit("cmd.$d", "attr") ; diff --git a/contrib/95_FLOORPLAN/darkfloorplanstyle.css b/contrib/95_FLOORPLAN/darkfloorplanstyle.css index 984df58f0..31710d158 100644 --- a/contrib/95_FLOORPLAN/darkfloorplanstyle.css +++ b/contrib/95_FLOORPLAN/darkfloorplanstyle.css @@ -1,34 +1,36 @@ -body { background-color: #444444; font-family:Verdana, sans-serif; font-size:9px; background-image:url(darklogo.png); background-repeat:no-repeat; } -body[name~=Media] { background-color: #A5A5A5; - font-family:Verdana, sans-serif; - font-size:9px; - background-image:url(Media.bak.png); - background-repeat:no-repeat; } -#menu.fp-list { position:absolute; top:190px;left:20px; width:140px; font-size:11px; } +body { background-color: #444444; font-family:Verdana; font-size:9px; background-image:url(darklogo.png); background-repeat:no-repeat; } +body[id~=Media] { background-color: #A5A5A5; font-family:Verdana; font-size:9px; background-image:url(Media.bak.png); background-repeat:no-repeat; } +#backimg {position:absolute; top:15px; left:190px;} #logo { position:absolute; top: 10px; left: 10px; width:180px; height:600px; background-image:url(darklogo.png); visibility:hidden;} -#fp_menu { position:absolute; top:190px;left:20px; width:140px; font-size:12px; } -#menu { position:absolute; top:190px; left:20px; width:140px; } -#menu.floorplan { position:absolute; top:190px; left:40px; width:140px; font-size:12px; } -#fpmenu.fp_arrange { position:absolute; bottom:20px; left:20px; width:310px; font-size:9px; border:1px solid gray;} -#hdr { position:absolute; top:10px; left:180px; } +#fpmenu.fp_arrange { position:absolute; bottom:20px; left:30px; min-width:310px; font-size:9px; border:1px solid #CCCCCC; background: #111111; -moz-border-radius:8px; border-radius:8px; border-spacing: 6px; padding: 6px; + box-shadow:5px 5px 5px #000; } + +#menu { position:absolute; top:180px; left:30px; width:140px; -moz-border-radius:8px; border-radius:8px; border-spacing: 6px; padding-bottom: 6px; padding-top: 6px;} +#menu.floorplan { position:absolute; top:180px; left:30px; width:128px; font-size:12px; border:1px solid #CCCCCC; background: #111111; box-shadow:5px 5px 5px #000; padding: 6px;} + +#hdr { position:absolute; top:15px; left:190px; border:1px solid #CCCCCC; background: #111111; -moz-border-radius:8px; border-radius:8px; border-spacing: 6px; padding: 6px; + box-shadow:5px 5px 5px #000; margin-bottom: 10px;} #content { position:absolute; top:50px; left:180px; bottom:10px; right:10px; text-align:center} a { color:#CCCCCC; } -img { border-style: none; } + +img { -moz-border-radius:8px; border-radius:8px;} + table { -moz-border-radius:8px; border-radius:8px; } +table tr.sel { backround: #333333;} +table a:hover {color: #ffffff;} -.fp_Grundriss {border:0px solid gray;} - -.devicename {font-size: 11px; text-align:center; } -.devicestate {text-align:center; } -.devicecommands {font-size:14px; text-align:center; } + .fp_Erdgeschoss { } + .devicename { font-size: 14px; text-align:center; color: #111111; } + .devicestate { text-align:center; color: #111111; } + .devicecommands { font-size:14px; text-align:center; color: #111111; } #sz_Rollo.devicename {font-size:14px;} #sz_Rollo.devicecommands {font-size:12px; text-align:center; } #ez_Aussentemperatur_dummy.devicestate {color:green; font-size:30px; } #HomeStatus.devicestate {color:green; font-size:30px; } -table.dummy {width:100px; } +table.dummy {width:100px;} table.FHT {width:100px; } #wakeup.devicestate {color:green; font-size:11px; } #ez_FHT.devicestate {color:green; font-size:30px; } @@ -36,6 +38,7 @@ table.FHT {width:100px; } #Home.fp_Media {font-size:14px; text-align:left; } #Media {font-size:14px; } #Grundriss {font-size:14px; text-align:left; } +#w_MucWeather {font-size:16px; color:#D4D4D4} +#w_WertListe1 {font-size:20px; color:gray} -h2,h3,h4 { color:#52865D; line-height:1.3; - margin-top:1.5em; font-family:Verdana,Sans-serif; } +h2,h3,h4 { color:#52865D; line-height:1.3; margin-top:1.5em; font-family:Verdana; }