diff --git a/fhem/contrib/YAF/CHANGED b/fhem/contrib/YAF/CHANGED index f4781af22..23a05cad5 100644 --- a/fhem/contrib/YAF/CHANGED +++ b/fhem/contrib/YAF/CHANGED @@ -1,3 +1,4 @@ +- Added regex capability for generic widget onclick function - Added foundation for modify dialog and modify dialog for generic widget (marcproe) - Added Conig Save button (marcproe) - Added widget generic (marcproe) diff --git a/fhem/contrib/YAF/FHEM/YAF/YAFConfig.pm b/fhem/contrib/YAF/FHEM/YAF/YAFConfig.pm index 171451544..1708f0eff 100644 --- a/fhem/contrib/YAF/FHEM/YAF/YAFConfig.pm +++ b/fhem/contrib/YAF/FHEM/YAF/YAFConfig.pm @@ -461,6 +461,7 @@ sub YAF_getWidgetAttribute{ my $widgetId = $_[1]; my $attributeName = $_[2]; my $default = (defined $_[3]) ? $_[3] : 0; + my $regex = (defined $_[4]) ? $_[4] : 0; if($isInit == 0) { #after a restart of fhem the config hashes might be empty, because they are filled while YAF_FHEMConfig(); #loading the "yaf.htm" page. However, when restarting FHEM without reloading the page, there @@ -481,8 +482,14 @@ sub YAF_getWidgetAttribute{ my @tokens = split(/,/,$attrString); foreach my $akey (@tokens) { #cycle through the other values my @skey = split(/=/, $akey); #split them for = - if($skey[0] eq $attributeName) { #the first value is the key, if it is the wanted attribute - $retAttr = $skey[1]; #return it. + if($regex == 0) { + if($skey[0] eq $attributeName) { #the first value is the key, if it is the wanted attribute + $retAttr = $skey[1]; #return it. + } + } else { + if($attributeName =~ $skey[0]) { + $retAttr = $skey[1]; + } } } } diff --git a/fhem/contrib/YAF/FHEM/YAF/widgets/generic/generic.pm b/fhem/contrib/YAF/FHEM/YAF/widgets/generic/generic.pm index 12c18b0be..90bd1eb47 100644 --- a/fhem/contrib/YAF/FHEM/YAF/widgets/generic/generic.pm +++ b/fhem/contrib/YAF/FHEM/YAF/widgets/generic/generic.pm @@ -346,13 +346,13 @@ sub generic_on_click() { } return encode_json(\@ret); } - my $setstate = YAF_getWidgetAttribute($_GET{"view_id"}, $_GET{"widget_id"}, "_".$d->{STATE}, ""); + my $setstate = YAF_getWidgetAttribute($_GET{"view_id"}, $_GET{"widget_id"}, "_".$d->{STATE}, "",1); if($setstate ne "") { fhem("set " . $fhemname . " " . $setstate); + $ret[0] = "setstate"; return encode_json(\@ret); } - } 1; diff --git a/fhem/contrib/YAF/controls_yaf.txt b/fhem/contrib/YAF/controls_yaf.txt index 27716c146..6b66fde4d 100644 --- a/fhem/contrib/YAF/controls_yaf.txt +++ b/fhem/contrib/YAF/controls_yaf.txt @@ -21,7 +21,7 @@ UPD 2013-08-14_21:30:00 12046 FHEM/01_YAF.pm UPD 2013-05-15_20:00:00 6590 FHEM/YAF/widgets/fs20st/fs20st.pm UPD 2013-08-14_21:30:00 7471 FHEM/YAF/widgets/fht80/fht80.pm UPD 2013-07-31_15:30:00 6534 FHEM/YAF/widgets/fhttk/fhttk.pm -UPD 2013-08-14_21:30:00 11361 FHEM/YAF/widgets/generic/generic.pm +UPD 2013-09-10_22:20:00 11387 FHEM/YAF/widgets/generic/generic.pm UPD 2013-05-15_20:00:00 6617 FHEM/YAF/widgets/fs20easylamp/fs20easylamp.pm UPD 2013-05-15_20:00:00 2608 FHEM/YAF/www/img/loading.gif UPD 2013-05-15_20:00:00 766 FHEM/YAF/www/img/lamp_off.png @@ -53,5 +53,5 @@ UPD 2013-05-15_20:00:00 101 FHEM/YAF/www/css/smoothness/images/ui-bg_highlight-s UPD 2013-05-15_20:00:00 26086 FHEM/YAF/www/css/smoothness/jquery-ui-1.9.1.custom.min.css UPD 2013-05-15_20:00:00 3641 FHEM/YAF/xml/xmlSchema.xsd UPD 2013-05-15_20:00:00 1690 FHEM/YAF/xml/yafConfig.xml -UPD 2013-08-14_21:30:00 15797 FHEM/YAF/YAFConfig.pm +UPD 2013-09-10_22:20:00 15962 FHEM/YAF/YAFConfig.pm UPD 2013-05-15_20:00:00 3439 FHEM/YAF/YAFWidgets.pm