From e64166a0e0ce5e9e4e4fae75003bb3861220974f Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 24 Jan 2015 13:49:08 +0000 Subject: [PATCH] FileLog.pm: add patch from Boris (Forum #32706) and fix wizard. git-svn-id: https://svn.fhem.de/fhem/trunk@7690 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 35 +++++++++++++++++++---------------- fhem/FHEM/92_FileLog.pm | 29 ++++++++++++++--------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index e758562b7..53cd40543 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -996,9 +996,9 @@ FW_makeTable($$$@) ############################## # Used only for set or attr lists. sub -FW_detailSelect($$$$) +FW_detailSelect(@) { - my ($d, $cmd, $list,$class) = @_; + my ($d, $cmd, $list, $param) = @_; return if(!$list || $FW_hiddenroom{input}); my @al = sort map { s/:.*//;$_ } split(" ", $list); @@ -1007,17 +1007,20 @@ FW_detailSelect($$$$) $selEl = "room" if($list =~ m/room:/); $list =~ s/"/"/g; - FW_pO "
"; - FW_pO "
"; - FW_pO FW_hidden("detail", $d); - FW_pO FW_hidden("fwcsrf", $defs{$FW_wname}{CSRFTOKEN}) if($FW_CSRF); - FW_pO FW_hidden("dev.$cmd$d", $d); - FW_pO FW_submit("cmd.$cmd$d", $cmd, $class); - FW_pO "
 $d 
"; - FW_pO FW_select("sel_$cmd$d","arg.$cmd$d",\@al, $selEl, $class); - FW_pO FW_textfield("val.$cmd$d", 30, $class); - FW_pO "
"; + my $ret =""; + $ret .= "
"; + $ret .= "
"; + $ret .= FW_hidden("detail", $d); + $ret .= FW_hidden("fwcsrf", $defs{$FW_wname}{CSRFTOKEN}) if($FW_CSRF); + $ret .= FW_hidden("dev.$cmd$d", $d.($param ? " $param":"")); + $ret .= FW_submit("cmd.$cmd$d", $cmd, $cmd); + $ret .= "
 $d ". + ($param ? " $param":"")."
"; + $ret .= FW_select("sel_$cmd$d","arg.$cmd$d",\@al, $selEl, $cmd); + $ret .= FW_textfield("val.$cmd$d", 30, $cmd); + $ret .= "
"; + return $ret; } ############################## @@ -1053,8 +1056,8 @@ FW_doDetail($) use strict "refs"; } - FW_detailSelect($d, "set", FW_widgetOverride($d, getAllSets($d)), "set"); - FW_detailSelect($d, "get", FW_widgetOverride($d, getAllGets($d)), "get"); + FW_pO FW_detailSelect($d, "set", FW_widgetOverride($d, getAllSets($d))); + FW_pO FW_detailSelect($d, "get", FW_widgetOverride($d, getAllGets($d))); FW_makeTable("Internals", $d, $h); FW_makeTable("Readings", $d, $h->{READINGS}); @@ -1069,7 +1072,7 @@ FW_doDetail($) $attrList = FW_widgetOverride($d, $attrList); $attrList =~ s/\\/\\\\/g; $attrList =~ s/'/\\'/g; - FW_detailSelect($d, "attr", $attrList,"attr"); + FW_pO FW_detailSelect($d, "attr", $attrList); FW_makeTable("Attributes", $d, $attr{$d}, "deleteattr"); ## dependent objects diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index 62e61cb84..44d93f7c0 100755 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -325,8 +325,15 @@ FileLog_fhemwebFn($$$$) $ret .= "
Regexp parts"; $ret .= "
"; - my @ra = split(/\|/, $hash->{REGEXP}); - if(@ra > 1) { + + my $regexp= $hash->{REGEXP}; + my @ra= (); + while($regexp =~ /^(.+?:.+?)\|(.+?:.+)$/) { + push @ra, $1; + $regexp= $2; + } + push @ra, $regexp; + if(@ra > 0) { foreach my $r (@ra) { $ret .= ""; my $cmd = "cmd.X= set $d removeRegexpPart&val.X=$r"; # =.set: avoid JS @@ -359,20 +366,12 @@ FileLog_fhemwebFn($$$$) $list .= " $dev:" . join(",", sort keys %{$dh{$dev}}); push @al, $dev; } - $ret .= ""; - $ret .= ""; + + $ret .= ""; + $ret .= '"; } $ret .= "
"; - $ret .= FW_hidden("detail", $d); - $ret .= FW_hidden("dev.$d", "$d addRegexpPart"); - $ret .= FW_submit("cmd.$d", "set", "set"); - $ret .= "
 $d addRegexpPart 
"; $list =~ s/(['"])/./g; - $ret .= FW_select("","arg.$d",\@al, undef, "set", - "FW_selChange(this.options[selectedIndex].text,'$list','val.$d')"); - $ret .= FW_textfield("val.$d", 30, "set"); - my $al0 = (@al ? $al[0] : ""); - $ret .= ""; - $ret .= "
'; + $ret .= FW_detailSelect($d, "set", $list, "addRegexpPart"); + $ret .= "
";