From a1beda939868be5080eec55ab4c4054d09827138 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 18 Sep 2013 11:45:00 +0000 Subject: [PATCH] FHEMWEB: textField by justme1968 git-svn-id: https://svn.fhem.de/fhem/trunk@3922 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 31 ++++++++++++++++++++++++++++-- fhem/www/pgm2/fhemweb_textField.js | 31 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 fhem/www/pgm2/fhemweb_textField.js diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 1a0a0730c..50a2fca3f 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -137,7 +137,8 @@ FHEMWEB_Initialize($) $data{webCmdFn}{slider} = "FW_sliderFn"; $data{webCmdFn}{timepicker} = "FW_timepickerFn"; - $data{webCmdFn}{noArg} = "FW_noArg"; + $data{webCmdFn}{noArg} = "FW_noArgFn"; + $data{webCmdFn}{textField} = "FW_textFieldFn"; $data{webCmdFn}{"~dropdown"}= "FW_dropdownFn"; # Should be the last } @@ -2147,6 +2148,8 @@ FW_htmlEscape($) return $txt; } +########################### +# Widgets START sub FW_sliderFn($$$$$) { @@ -2173,7 +2176,7 @@ FW_sliderFn($$$$$) } sub -FW_noArg($$$$$) +FW_noArgFn($$$$$) { my ($FW_wname, $d, $FW_room, $cmd, $values) = @_; @@ -2234,6 +2237,29 @@ FW_dropdownFn() return undef; } +sub +FW_textFieldFn($$$$) +{ + my ($FW_wname, $d, $FW_room, $cmd, $values) = @_; + + my @args = split("[ \t]+", $cmd); + + return undef if($values !~ m/^textField$/); + return "" if($cmd =~ m/ /); + my $srf = $FW_room ? "&room=$FW_room" : ""; + my $cv = ReadingsVal($d, $cmd, ""); + my $id = ($cmd eq "state") ? "" : "-$cmd"; + + my $c = "$FW_ME?XHR=1&cmd=setreading $d $cmd %$srf"; + return '