diff --git a/src/www/firewall_schedule.php b/src/www/firewall_schedule.php index d5f56d848..09aaa85f0 100644 --- a/src/www/firewall_schedule.php +++ b/src/www/firewall_schedule.php @@ -217,7 +217,7 @@ legacy_html_escape_form_data($a_schedules); } } $timeFriendly = $starttime . "-" . $stoptime; - $description = $timerange['rangedescr']; + $description = rawurldecode($timerange['rangedescr']); ?>"+tempFriendlyTime+""; + td.innerHTML= ""+label+""; tr.appendChild(td); td = document.createElement("td"); - td.innerHTML=""; + td.innerHTML=""; tr.appendChild(td); td = document.createElement("td"); - td.innerHTML=""; + td.innerHTML=""; tr.appendChild(td); td = document.createElement("td"); - td.innerHTML=""; + td.innerHTML=""; tr.appendChild(td); td = document.createElement("td"); - td.innerHTML = ""; + td.innerHTML = ``; tr.appendChild(td); td = document.createElement("td"); - td.innerHTML = ""; + td.innerHTML = ""; tr.appendChild(td); td = document.createElement("td"); - td.innerHTML=""; + td.innerHTML=""; tr.appendChild(td); tbody.appendChild(tr); @@ -687,71 +658,67 @@ function clearCalendar(){ } } } + + const month_sel = $('#monthsel'); + + month_sel.selectpicker('val', month_sel.prop('options')[0].value); + update_month(); } -function clearTime(){ - document.getElementById("starttimehour").value = "0"; - document.getElementById("starttimemin").value = "00"; - document.getElementById("stoptimehour").value = "23"; - document.getElementById("stoptimemin").value = "59"; +function clearTime() { + $('#starttimehour').selectpicker('val', '0'); + $('#starttimemin').selectpicker('val', '00'); + $('#stoptimehour').selectpicker('val', '23'); + $('#stoptimemin').selectpicker('val', '59'); } function clearDescr(){ - document.getElementById("timerangedescr").value = ""; + $('#timerangedescr').val(''); } -function editRow(incTime, el) { - if (checkForRanges()){ +function editRow(el, days, start_time, stop_time, description) { + if (!checkForRanges()) + return; - //reset calendar and time - clearCalendar(); - clearTime(); + //reset calendar and time + clearCalendar(); + clearTime(); - var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = ""; + let start_hour, start_min, stop_hour, stop_min; + [start_hour, start_min] = start_time.split(':'); + [stop_hour, stop_min] = stop_time.split(':'); - let tempArray = incTime.split ("||"); + $('#starttimehour').selectpicker('val', start_hour); + $('#starttimemin').selectpicker('val', start_min); + $('#stoptimehour').selectpicker('val', stop_hour); + $('#stoptimemin').selectpicker('val', stop_min); + $('#timerangedescr').val(description); - days = tempArray[0]; - hours = tempArray[1]; - descr = escape(tempArray[2]); + let first_selected_month = days.search('m'); + if (first_selected_month !== -1) { + first_selected_month = days.substring(first_selected_month); + first_selected_month = first_selected_month.split('d')[0].slice(1); - var tempdayArray = days.split(","); - var temphourArray = hours.split("-"); - tempstr = temphourArray[0]; - var temphourArray2 = tempstr.split(":"); - - document.getElementById("starttimehour").value = temphourArray2[0]; - document.getElementById("starttimemin").value = temphourArray2[1]; - - tempstr = temphourArray[1]; - temphourArray2 = tempstr.split(":"); - - document.getElementById("stoptimehour").value = temphourArray2[0]; - document.getElementById("stoptimemin").value = temphourArray2[1]; - - document.getElementById("timerangedescr").value = descr; - - //toggle the appropriate days - for (let i=0; i - + - +