2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-06 06:08:44 +00:00

98_weekprofile: widget: transfer day settings to other days

git-svn-id: https://svn.fhem.de/fhem/trunk@10743 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
risiko79 2016-02-06 17:30:56 +00:00
parent c29a9ada82
commit cc4988aa11
2 changed files with 38 additions and 5 deletions

View File

@ -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: widget: transfer day settings to other days
- bugfix: FB_CALLMONITOR: corrected internal_connection mapping.
especially FON1-FON3. Please check your configuration.
- change: 98_weekprofile: return sorted lists

View File

@ -70,7 +70,7 @@ function FW_weekprofileInputDialog(title,inp,def,parent,callback)
});
}
function FW_weekprofileMultiSelDialog(title, elementNames, elementLabels, selected,parent,callback)
function FW_weekprofileMultiSelDialog(title, elementNames, elementLabels, selected,freeInp,parent,callback)
{
var table = "<table>";
if (elementNames) {
@ -94,7 +94,8 @@ function FW_weekprofileMultiSelDialog(title, elementNames, elementLabels, select
var div = $("<div id='FW_weekprofileMultiSelDiolog'>");
$(div).append(title);
$(div).append(table);
$(div).append('<input id="FW_weekprofileMultiSelDiologFreeText" />');
if (freeInp && freeInp == 1)
$(div).append('<input id="FW_weekprofileMultiSelDiologFreeText" />');
$("body").append(div);
$(div).dialog({
@ -210,7 +211,7 @@ function FW_weekprofileSendToDev(devName,bnt)
var selected = [];
if (widget.MASTERDEV)
selected.push(widget.MASTERDEV);
FW_weekprofileMultiSelDialog("<span>Device(s):</span>",devicesNames,devicesAlias,selected,bnt,
FW_weekprofileMultiSelDialog("<span>Device(s):</span>",devicesNames,devicesAlias,selected,1,bnt,
function(sndDevs) {
if (!sndDevs || sndDevs.length==0)
return;
@ -482,16 +483,47 @@ function FW_weekprofileEditDelInterval(tr)
FW_weekprofileEditRowStyle(parent)
}
function FW_weekprofileTransDay(devName,day,bnt)
{
var widget = $('div[informid="'+devName+'"]').get(0)
var srcDay = $(widget.CONTENT).find("table[id*=\"weekprofile."+widget.DEVICE+"."+shortDays[day]+"\"]");
var dayNames = [];
var dayAlias = [];
for (var k=0; k < shortDays.length; k++) {
if (k != day) {
dayNames.push(shortDays[k]);
dayAlias.push(widget.WEEKDAYS[k]);
}
}
var selected = [];
FW_weekprofileMultiSelDialog("<span>Days(s):</span>",dayNames,dayAlias,selected,0,bnt,
function(selDays) {
if (!selDays || selDays.length==0)
return;
for (var k=0; k < selDays.length; k++) {
var destDay = $(widget.CONTENT).find("table[id*=\"weekprofile."+widget.DEVICE+"."+selDays[k]+"\"]");
destDay.empty();
destDay.append(srcDay.clone().contents());
}
});
}
function FW_weekprofileEditDay(widget,day)
{
var div = $("<div>").get(0);
$(div).append("<div style=\"margin-left:10px;margin:5px\">"+widget.WEEKDAYS[day]+"</div>");
var html= '';
html += "<div style=\"padding:5px;\">";
html += "<span style=\"margin-right:10px;margin-left:10px\">"+widget.WEEKDAYS[day]+"</span>";
html += "<a href=\"javascript:void(0)\" onclick=\"FW_weekprofileTransDay('"+widget.DEVICE+"',"+day+",this)\" data-toggle=\"tooltip\" title=\"transfer day\">--></a>";
html += "</div>";
$(div).append(html);
var table = $("<table>").get(0);
$(table).attr('id',"weekprofile."+widget.DEVICE+"."+shortDays[day]);
$(table).attr('class',"block wide weekprofile");
var html;
html = '';
var times = widget.PROFILE[shortDays[day]]['time'];
var temps = widget.PROFILE[shortDays[day]]['temp'];