|
@ -166,7 +166,7 @@ function addValue(data, name, value) { |
|
|
// These fields will always be a list of values
|
|
|
// These fields will always be a list of values
|
|
|
var is_group = [ |
|
|
var is_group = [ |
|
|
"ssid", "pass", "gw", "mask", "ip", "dns", |
|
|
"ssid", "pass", "gw", "mask", "ip", "dns", |
|
|
"schEnabled", "schSwitch","schAction","schHour","schMinute","schWDs", |
|
|
|
|
|
|
|
|
"schEnabled", "schSwitch","schAction","schType","schHour","schMinute","schWDs", |
|
|
"relayBoot", "relayPulse", "relayTime", |
|
|
"relayBoot", "relayPulse", "relayTime", |
|
|
"mqttGroup", "mqttGroupInv", |
|
|
"mqttGroup", "mqttGroupInv", |
|
|
"dczRelayIdx", "dczMagnitude", |
|
|
"dczRelayIdx", "dczMagnitude", |
|
@ -612,14 +612,14 @@ function moreSchedule() { |
|
|
$("div.more", parent).toggle(); |
|
|
$("div.more", parent).toggle(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function addSchedule() { |
|
|
|
|
|
|
|
|
function addSchedule(event) { |
|
|
var numSchedules = $("#schedules > div").length; |
|
|
var numSchedules = $("#schedules > div").length; |
|
|
if (numSchedules >= maxSchedules) { |
|
|
if (numSchedules >= maxSchedules) { |
|
|
alert("Max number of schedules reached"); |
|
|
alert("Max number of schedules reached"); |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
var tabindex = 200 + numSchedules * 10; |
|
|
var tabindex = 200 + numSchedules * 10; |
|
|
var template = $("#scheduleTemplate").children(); |
|
|
|
|
|
|
|
|
var template = $("#" + event.data.schType + "ScheduleTemplate").children(); |
|
|
var line = $(template).clone(); |
|
|
var line = $(template).clone(); |
|
|
$(line).find("input").each(function() { |
|
|
$(line).find("input").each(function() { |
|
|
$(this).attr("tabindex", tabindex); |
|
|
$(this).attr("tabindex", tabindex); |
|
@ -803,6 +803,9 @@ function initChannels(num) { |
|
|
|
|
|
|
|
|
line.appendTo("#channels"); |
|
|
line.appendTo("#channels"); |
|
|
|
|
|
|
|
|
|
|
|
$("select.islight").append( |
|
|
|
|
|
$("<option></option>").attr("value",i).text("Light #" + i)); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -1011,7 +1014,8 @@ function processData(data) { |
|
|
if ("schedule" === key) { |
|
|
if ("schedule" === key) { |
|
|
for (i in value) { |
|
|
for (i in value) { |
|
|
var schedule = value[i]; |
|
|
var schedule = value[i]; |
|
|
var sch_line = addSchedule(); |
|
|
|
|
|
|
|
|
var sch_line = addSchedule({ data: {schType: schedule['schType'] }}); |
|
|
|
|
|
|
|
|
Object.keys(schedule).forEach(function(key) { |
|
|
Object.keys(schedule).forEach(function(key) { |
|
|
var sch_value = schedule[key]; |
|
|
var sch_value = schedule[key]; |
|
|
$("input[name='" + key + "']", sch_line).val(sch_value); |
|
|
$("input[name='" + key + "']", sch_line).val(sch_value); |
|
@ -1268,7 +1272,8 @@ $(function() { |
|
|
$(".button-add-network").on("click", function() { |
|
|
$(".button-add-network").on("click", function() { |
|
|
$(".more", addNetwork()).toggle(); |
|
|
$(".more", addNetwork()).toggle(); |
|
|
}); |
|
|
}); |
|
|
$(".button-add-schedule").on("click", addSchedule); |
|
|
|
|
|
|
|
|
$(".button-add-switch-schedule").on("click", { schType: "switch" }, addSchedule); |
|
|
|
|
|
$(".button-add-light-schedule").on("click", { schType: "light" }, addSchedule); |
|
|
|
|
|
|
|
|
$(document).on("change", "input", hasChanged); |
|
|
$(document).on("change", "input", hasChanged); |
|
|
$(document).on("change", "select", hasChanged); |
|
|
$(document).on("change", "select", hasChanged); |
|
|