From b01e0909032aa7bfc53a1115ea5991e393b6e4a3 Mon Sep 17 00:00:00 2001 From: ulimaass <> Date: Thu, 19 Jun 2014 07:14:56 +0000 Subject: [PATCH] added style "commands only", changed html-method "get" to "$FW_formmethod" git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@6139 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/95_FLOORPLAN.pm | 45 ++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/FHEM/95_FLOORPLAN.pm b/FHEM/95_FLOORPLAN.pm index cf547cbc4..54517ee6c 100644 --- a/FHEM/95_FLOORPLAN.pm +++ b/FHEM/95_FLOORPLAN.pm @@ -4,7 +4,7 @@ # Feedback: http://groups.google.com/group/fhem-users # Define Custom Floorplans # Released : 26.02.2012 -# Version : 2.0 +# Version : 2.1 # Revisions: # 0001: Released to testers # 0002: use local FP_select and FP_submit after clash with FHEMWEB update @@ -44,12 +44,13 @@ # 0033: Updated loglevel -> verbose, added fp_roomIcons (Feb 2, 2014) # 0034: iOS fullscreen app - navigating to other floorplan doesn't open safari anymore (Feb 15, 2014) # 0035: added allowedCommands-Attribute based on FHEMWEB (Feb 20, 2014) +# 0036: added style "commands only", changed html-method "get" to "$FW_formmethod" (June 19, 2014) # ################################################################ # # Copyright notice # -# (c) 2012-2013 Copyright: Ulrich Maass +# (c) 2012-2014 Copyright: Ulrich Maass # # This file is part of fhem. # @@ -142,7 +143,7 @@ my $FW_plotmode=""; # like in FHEMWEB: SVG my $FW_plotsize; # like in FHEMWEB: like in fhemweb dependent on regular/smallscreen/touchpad my %FW_zoom; # copied from FHEMWEB - using local version to avoid global variable my @FW_zoom; # copied from FHEMWEB - using local version to avoid global variable -my @styles = ("0 (Icon only)","1 (Name+Icon)","2 (Name+Icon+Commands)","3 (Device-Reading)","4 (S300TH-specific)","5 (Icon+Commands)","6 (Reading+Timestamp)"); +my @styles = ("0 (Icon only)","1 (Name+Icon)","2 (Name+Icon+Commands)","3 (Device-Reading)","4 (S300TH-specific)","5 (Icon+Commands)","6 (Reading+Timestamp)","7 (Commands only)"); #------------------------------------------------------------------------------- @@ -227,6 +228,12 @@ FP_CGI(){ $params[1] = $params[2]; } my @htmlpart = split("\\?", $params[1]) if ($params[1]); # split URL by ? -> htmlpart[0] = FP_name, htmlpart[1] = commandstring + if (!$htmlpart[1] && $htmlpart[0] !~ "\\?") { # in case of 'post' URL does not contain ? + $htmlpart[0] =~ /([a-z0-9.:_]+)&(.*)/i; + $htmlpart[1] = $2 if ($2); + $htmlpart[1] =~ s/\\+/&/g if ($htmlpart[1]); + $htmlpart[0] = $1 if ($1); + } $FP_name = $htmlpart[0] if (!$FP_name); ### set global parameters, check floorplan-name if ($FP_name) { # floorplan-name is part of URL @@ -258,6 +265,7 @@ FP_CGI(){ $FW_subdir = "/floorplan/$FP_name"; $FP_arrange = AttrVal($FP_name, "fp_arrange", 0); } + ## process cgi my $commands = FP_digestCgi($htmlpart[1]) if $htmlpart[1]; # analyze URL-commands my $FP_ret = AnalyzeCommand(undef, $commands, @@ -310,8 +318,9 @@ FP_digestCgi($) { $FP_fwdetail = undef; $arg =~ s,^[?/],,; foreach my $pv (split("&", $arg)) { #per each URL-section devided by & + next if($pv eq ""); # happens when post forgot to set FW_ME $pv =~ s/\+/ /g; - $pv =~ s/%(..)/chr(hex($1))/ge; + $pv =~ s/%([\dA-F][\dA-F])/chr(hex($1))/ige; my ($p,$v) = split("=",$pv, 2); #$p = parameter, $v = value $v =~ s/[\r]\n/\\\n/g if($v && $p && $p ne "data"); # Multiline: escape the NL for fhem $FP_webArgs{$p} = $v; @@ -408,7 +417,7 @@ FP_showStart() { FW_pO "
"; FP_menu(); FW_pO "