diff --git a/fhem/contrib/YAF/FHEM/YAF/widgets/fht80/fht80.pm b/fhem/contrib/YAF/FHEM/YAF/widgets/fht80/fht80.pm index e14f02b49..69ed02965 100644 --- a/fhem/contrib/YAF/FHEM/YAF/widgets/fht80/fht80.pm +++ b/fhem/contrib/YAF/FHEM/YAF/widgets/fht80/fht80.pm @@ -71,6 +71,8 @@ sub fht80_get_widgetcss() { sub fht80_get_widgetjs() { my $output = ' + function fht80_on_click(view_id, widget_id) { + } function fht80_update_widget(view_id, widget_id) { $.ajax({ type: "GET", @@ -206,8 +208,8 @@ sub fht80_get_temp() { my $desi = fht80_isdef($defs{$fhemname}{READINGS}{"desired-temp"}{VAL}, ""); my $battery = fht80_isdef($defs{$fhemname}{READINGS}{battery}{VAL}, ""); my $nomode = YAF_getWidgetAttribute($viewid, $widgetid, "nomode", 0); - my $labeltype = YAF_getWidgetAttribute($viewid, $widgetid, "labeltype", ""); - $ret[1] = YAF_getWidgetAttribute($viewid, $widgetid, "size", 1); #we don't process the size, so put it in the return array right away. + my $labeltype = YAF_getWidgetAttribute($viewid, $widgetid, "labeltype", ""); + $ret[1] = YAF_getWidgetAttribute($viewid, $widgetid, "size", 1); #we don't process the size, so put it in the return array right away. #process data my $label = ""; diff --git a/fhem/contrib/YAF/FHEM/YAF/widgets/fhttk/fhttk.pm b/fhem/contrib/YAF/FHEM/YAF/widgets/fhttk/fhttk.pm index 4706d36c6..2bd961859 100644 --- a/fhem/contrib/YAF/FHEM/YAF/widgets/fhttk/fhttk.pm +++ b/fhem/contrib/YAF/FHEM/YAF/widgets/fhttk/fhttk.pm @@ -70,9 +70,11 @@ sub fhttk_get_widgetcss() { sub fhttk_get_widgetjs() { my $output = ' - function endsWith(str, suffix) { + function fhttk_endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } + function fhttk_on_click(view_id, widget_id) { + } function fhttk_update_widget(view_id, widget_id) { $.ajax({ type: "GET", @@ -83,7 +85,7 @@ sub fhttk_get_widgetjs() { success: function(get_state) { var widget = $("#widget_"+view_id+"_"+widget_id); $("#widget_"+view_id+"_"+widget_id).attr("title",get_state); - if (endsWith(get_state,"Open")) { + if (fhttk_endsWith(get_state,"Open")) { if (widget.hasClass("widget_fhttk_closed")) { widget.removeClass("widget_fhttk_closed"); } @@ -92,7 +94,7 @@ sub fhttk_get_widgetjs() { } widget.html(""); } - else if (endsWith(get_state,"Closed")) { + else if (fhttk_endsWith(get_state,"Closed")) { if (!widget.hasClass("widget_fhttk_closed")) { widget.addClass("widget_fhttk_closed"); } diff --git a/fhem/contrib/YAF/FHEM/YAF/widgets/generic/generic.pm b/fhem/contrib/YAF/FHEM/YAF/widgets/generic/generic.pm new file mode 100644 index 000000000..9cce2a166 --- /dev/null +++ b/fhem/contrib/YAF/FHEM/YAF/widgets/generic/generic.pm @@ -0,0 +1,296 @@ +######################################################################################## +# +# generic.pm +# +# YAF - Yet Another Floorplan +# FHEM Projektgruppe Hochschule Karlsruhe, 2013 +# Markus Mangei, Daniel Weisensee, Prof. Dr. Peter A. Henning +# +# generic Widget: Marc Pro +# +######################################################################################## +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +######################################################################################## +package main; + +use strict; +use warnings; + +my $yaf_version = 0.41; + +use vars qw(%_GET); +use vars qw(%defs); + +####################################################################################### +# +# generic_get_widgetcss - Create the CSS code for this widget +# +# no parameter +# +######################################################################################## +sub generic_get_widgetcss() { + my $output = " + .widget_generic { + width: 200px; + height: 50px; + background-repeat:no-repeat; + background-position:center center; + opacity:1 !important; + text-align: center; + } + "; + return $output; +} + +######################################################################################## +# +# generic_get_widgetjs - Create the javascript code for this widget +# +# no parameter +# +######################################################################################## + +sub generic_get_widgetjs() { + + my $output = ' + function generic_endsWith(str, suffix) { + if(!str) { + return false; + } + return str.indexOf(suffix, str.length - suffix.length) !== -1; + } + function generic_on_click(view_id, widget_id) { + } + function generic_update_widget(view_id, widget_id) { + $.ajax({ + type: "GET", + async: true, + url: "../../ajax/widget/generic/get_state", + data: "view_id="+view_id+"&widget_id="+widget_id, + context: document.body, + success: function(get_state) { + var data = jQuery.parseJSON(get_state); + var label = data[0]; + var icon = data[1]; + var statesave = $("#widget_generic_state_"+view_id+"_"+widget_id); + var state = data[2]; + var statespan = data[3]; + var fhemname = data[4]; + var widget = $("#widget_"+view_id+"_"+widget_id); + + if (!statesave.hasClass("widget_generic_"+state)) { + if(generic_endsWith(icon,"png")) { + var iconstring = label+"
"+statespan; + widget.html(iconstring); + } else { + var textstring = ""+label+"
" + state; + widget.html(textstring+" "+statespan); + } + } + } + }); + }'; + + # $output .=' + # function generic_get_reading_keys() { + # $.ajax({ + # type: "GET", + # async: true, + # url: "../../ajax/widget/generic/get_reading_keys", + # data: "fhemname="+$("#combobox").val(), + # context: document.body, + # success: function(dataarr) { + # var data = jQuery.parseJSON(dataarr); + # //alert(data[0]); + # var mySelect = $("#generic_combobox_readings"); + # mySelect + # .find("option") + # .remove() + # .end() + # ; +# ; + # $.each(data, function(val,text) { + # mySelect.append( + # $("").val(text).html(text) + # ); + # }); + # } + # }); + # } + # '; + return $output; +} + +######################################################################################## +# +# generic_getwidgethtml - HTML code for this widget +# +# no parameter +# +######################################################################################## + +sub generic_get_widgethtml() { + my $output = " "; + return $output; +} + +######################################################################################## +# +# generic_get_addwidget_setup_html - Create the selection of devices for this widget +# +# no parameter +# +######################################################################################## + +sub generic_get_addwidget_setup_html() { + my $output = ""; + $output = ""; + $output .=""; + # $output .= "
Use Reading as state: + +
@@ -176,6 +189,5 @@

Einstellungen

- diff --git a/fhem/contrib/YAF/controls_yaf.txt b/fhem/contrib/YAF/controls_yaf.txt index b30370f21..f8d008bd4 100644 --- a/fhem/contrib/YAF/controls_yaf.txt +++ b/fhem/contrib/YAF/controls_yaf.txt @@ -8,6 +8,8 @@ DIR FHEM/YAF/widgets/fht80 DIR FHEM/YAF/widgets/fht80/www DIR FHEM/YAF/widgets/fhttk DIR FHEM/YAF/widgets/fhttk/www +DIR FHEM/YAF/widgets/generic +DIR FHEM/YAF/widgets/generic/www DIR FHEM/YAF/www DIR FHEM/YAF/www/css DIR FHEM/YAF/www/smoothness @@ -17,19 +19,20 @@ DIR FHEM/YAF/www/js DIR FHEM/YAF/xml UPD 2013-07-23_20:45:00 11477 FHEM/01_YAF.pm UPD 2013-05-15_20:00:00 6590 FHEM/YAF/widgets/fs20st/fs20st.pm -UPD 2013-07-28_17:00:00 7498 FHEM/YAF/widgets/fht80/fht80.pm -UPD 2013-07-28_17:00:00 6460 FHEM/YAF/widgets/fhttk/fhttk.pm +UPD 2013-07-31_15:30:00 7548 FHEM/YAF/widgets/fht80/fht80.pm +UPD 2013-07-31_15:30:00 6534 FHEM/YAF/widgets/fhttk/fhttk.pm +UPD 2013-07-31_15:30:00 8834 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 UPD 2013-05-15_20:00:00 19226 FHEM/YAF/www/img/background.png UPD 2013-05-15_20:00:00 831 FHEM/YAF/www/img/lamp_on.png -UPD 2013-05-15_20:00:00 7146 FHEM/YAF/www/yaf.htm -UPD 2013-07-20_16:00:00 14672 FHEM/YAF/www/js/yaf-dialogs.js +UPD 2013-07-31_15:30:00 11957 FHEM/YAF/www/js/yaf-basics.js +UPD 2013-07-31_15:30:00 10727 FHEM/YAF/www/js/yaf-dialogs.js +UPD 2013-07-31_15:30:00 7512 FHEM/YAF/www/yaf.htm UPD 2013-05-15_20:00:00 3433 FHEM/YAF/www/js/combobox.js UPD 2013-05-15_20:00:00 4593 FHEM/YAF/www/js/jquery.ui.touch-punch.min.js UPD 2013-05-15_20:00:00 237176 FHEM/YAF/www/js/jquery-ui-1.9.1.custom.min.js -UPD 2013-07-20_16:00:00 13913 FHEM/YAF/www/js/yaf-basics.js UPD 2013-05-15_20:00:00 448301 FHEM/YAF/www/js/jquery-ui-1.9.1.custom.js UPD 2013-05-15_20:00:00 265218 FHEM/YAF/www/js/jquery-1.8.2.js UPD 2013-05-15_24:00:00 2313 FHEM/YAF/www/css/yaf.css