diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 0be7eaa3a..85bb450d0 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -709,7 +709,7 @@ FW_digestCgi($) if($p eq "room") { $FW_room = $v; } if($p eq "cmd") { $cmd = $v; } if($p =~ m/^arg\.(.*)$/) { $arg{$1} = $v; } - if($p =~ m/^val\.(.*)$/) { $val{$1} = $v; } + if($p =~ m/^val\.(.*)$/) { $val{$1} = ($val{$1} ? $val{$1}.",$v" : $v) } if($p =~ m/^dev\.(.*)$/) { $dev{$1} = $v; } if($p =~ m/^cmd\.(.*)$/) { $cmd = $v; $c = $1; } if($p eq "pos") { %FW_pos = split(/[=;]/, $v); } @@ -914,7 +914,7 @@ FW_doDetail($) FW_makeTable("Readings", $d, $h->{READINGS}); my $attrList = getAllAttr($d); - my $roomList = join(",", sort grep !/ /, keys %FW_rooms); + my $roomList = "multiple,".join(",", sort grep !/ /, keys %FW_rooms); $attrList =~ s/room /room:$roomList /; FW_makeSelect($d, "attr", $attrList,"attr"); @@ -2848,8 +2848,10 @@ FW_ActivateInform() displayed.
  • if the modifier is ":textField", an input field is displayed.
  • if the modifier is of the form - ":slider,<min>,<step>,<max>", then a javascript - driven slider is displayed
  • + ":slider,<min>,<step>,<max>", then a javascript + driven slider is displayed +
  • if the modifier is of the form ":multiple,val1,val2,...", then + multiple values can be selected, the result is comma separated.
  • else a dropdown with all the modifier values is displayed
  • If the command is state, then the value will be used as a command.
    @@ -3329,6 +3331,9 @@ FW_ActivateInform() ":slider,<min>,<step>,<max>", so wird ein in JavaScript programmierter Slider angezeigt +
  • Ist der Modifier ":multiple,val1,val2,...", dann ein + Mehrfachauswahl ist möglich, das Ergebnis ist Komma-separiert. +
  • In allen anderen Fällen erscheint ein Dropdown mit allen Modifier Werten.
  • diff --git a/fhem/www/pgm2/fhemweb_multiple.js b/fhem/www/pgm2/fhemweb_multiple.js new file mode 100644 index 000000000..3806558eb --- /dev/null +++ b/fhem/www/pgm2/fhemweb_multiple.js @@ -0,0 +1,36 @@ +function +FW_multipleSelChange(name, devName, vArr) +{ + if(vArr.length < 2 || vArr[0] != "multiple") + return undefined; + + var o = new Object(); + o.newEl = document.createElement('select'); + o.newEl.setAttribute('multiple', true); + for(var j=1; j < vArr.length; j++) { + o.newEl.options[j-1] = new Option(vArr[j], vArr[j]); + } + o.qFn = 'FW_multipleSetSelected(qArg, "%")'; + o.qArg = o.newEl; + return o; +} + +function +FW_multipleSetSelected(el, val) +{ + if(typeof el == 'string') + el = document.getElementById(el); + + var l = val.split(","); + for(var j=0;j