From 757c9b6b49d949b5a090de0696c888ba8999c121 Mon Sep 17 00:00:00 2001 From: Risiko <> Date: Wed, 12 Apr 2017 21:02:36 +0000 Subject: [PATCH] 98_weekprofile: new attribute widgetTranslations for translations git-svn-id: https://svn.fhem.de/fhem/trunk@13978 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/98_weekprofile.pm | 10 +++++++++- fhem/www/pgm2/fhemweb_weekprofile.js | 26 ++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index cd24e9888..834ace0c1 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 98_weekprofile: new attribute widgetTranslations for translations - bugfix: 98_weekprofile: handle csrfToken - bugfix: 02_HTTPSRV: strip parameters from filename - bugfix: 88_HMCCURPC: fixed binary RPC init procedure diff --git a/fhem/FHEM/98_weekprofile.pm b/fhem/FHEM/98_weekprofile.pm index 746bb233e..a9151002b 100644 --- a/fhem/FHEM/98_weekprofile.pm +++ b/fhem/FHEM/98_weekprofile.pm @@ -422,7 +422,7 @@ sub weekprofile_Initialize($) $hash->{StateFn} = "weekprofile_State"; $hash->{NotifyFn} = "weekprofile_Notify"; $hash->{AttrFn} = "weekprofile_Attr"; - $hash->{AttrList} = "useTopics:0,1 widgetWeekdays widgetEditOnNewPage:0,1 widgetEditDaysInRow:1,2,3,4,5,6,7 tempON tempOFF configFile ".$readingFnAttributes; + $hash->{AttrList} = "useTopics:0,1 widgetTranslations widgetWeekdays widgetEditOnNewPage:0,1 widgetEditDaysInRow:1,2,3,4,5,6,7 tempON tempOFF configFile ".$readingFnAttributes; $hash->{FW_summaryFn} = "weekprofile_SummaryFn"; @@ -1296,6 +1296,10 @@ sub weekprofile_getEditLNK_MasterDev($$) Attributes
attr name widgetTranslations Abbrechen:Cancel,Speichern:Save
+ attr name widgetWeekdays Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
@@ -1448,6 +1452,10 @@ sub weekprofile_getEditLNK_MasterDev($$)
Attribute
attr name widgetTranslations Abbrechen:Abbr,Speichern:Save
+ "); - tr.append(" | "); + + tr.append(" | "); + tr.append(" | "); } function FW_weekprofileSendCallback(devName, data) @@ -767,6 +780,14 @@ function FW_weekprofileGetValues(devName,what,data) widget.CURTOPIC = widget.TOPICNAMES[0]; } FW_weekprofileChacheTo(devName,widget.CURTOPIC,null); + } else if (what == "TRANSLATE") { + var arr = data.split(','); + widget.TRANSLATIONS = new Array(); + for (var k = 0; k < arr.length; ++k) { + var trans = arr[k].split(':'); + if (trans.length == 2) + widget.TRANSLATIONS[trans[0].trim()] = trans[1].trim(); + } } } @@ -832,6 +853,7 @@ FW_weekprofileCreate(elName, devName, vArr, currVal, set, params, cmd) widget.activateFn = function(arg){ FW_queryValue('get '+devName+' profile_data '+widget.CURTOPIC+':'+widget.CURPRF, widget); FW_cmd(FW_root+'?cmd={AttrVal("'+devName+'","widgetWeekdays","")}&XHR=1',function(data){FW_weekprofileGetValues(devName,"WEEKDAYS",data);}); + FW_cmd(FW_root+'?cmd={AttrVal("'+devName+'","widgetTranslations","")}&XHR=1',function(data){FW_weekprofileGetValues(devName,"TRANSLATE",data);}); if (widget.USETOPICS == 1) { FW_cmd(FW_root+'?cmd=get '+devName+' topic_names&XHR=1',function(data){FW_weekprofileGetValues(devName,"TOPICNAMES",data);}); } else { |