2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

YAF: Added regex capability for generic widget onclick function

git-svn-id: https://svn.fhem.de/fhem/trunk@3892 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
marcproe 2013-09-10 20:26:10 +00:00
parent 839d426051
commit fd352cbbb3
4 changed files with 14 additions and 6 deletions

View File

@ -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)

View File

@ -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];
}
}
}
}

View File

@ -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;

View File

@ -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