summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr/local/www/firewall_schedule.php277
-rw-r--r--usr/local/www/firewall_schedule_edit.php1322
2 files changed, 786 insertions, 813 deletions
diff --git a/usr/local/www/firewall_schedule.php b/usr/local/www/firewall_schedule.php
index 56687f6..347f806 100644
--- a/usr/local/www/firewall_schedule.php
+++ b/usr/local/www/firewall_schedule.php
@@ -50,8 +50,9 @@ require("shaper.inc");
$pgtitle = array(gettext("Firewall"),gettext("Schedules"));
-if (!is_array($config['schedules']['schedule']))
+if (!is_array($config['schedules']['schedule'])) {
$config['schedules']['schedule'] = array();
+}
$a_schedules = &$config['schedules']['schedule'];
@@ -63,10 +64,10 @@ if ($_GET['act'] == "del") {
$referenced_by = false;
$schedule_name = $a_schedules[$_GET['id']]['name'];
- if(is_array($config['filter']['rule'])) {
- foreach($config['filter']['rule'] as $rule) {
+ if (is_array($config['filter']['rule'])) {
+ foreach ($config['filter']['rule'] as $rule) {
//check for this later once this is established
- if ($rule['sched'] == $schedule_name){
+ if ($rule['sched'] == $schedule_name) {
$referenced_by = $rule['descr'];
$is_schedule_referenced = true;
break;
@@ -74,7 +75,7 @@ if ($_GET['act'] == "del") {
}
}
- if($is_schedule_referenced == true) {
+ if ($is_schedule_referenced == true) {
$savemsg = sprintf(gettext("Cannot delete Schedule. Currently in use by %s"),$referenced_by);
} else {
unset($a_schedules[$_GET['id']]);
@@ -94,153 +95,159 @@ include("head.inc");
<form action="firewall_schedule.php" method="post">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall schedule">
<tr>
- <td width="25%" class="listhdrr"><?=gettext("Name");?></td>
- <td width="35%" class="listhdrr"><?=gettext("Time Range(s)");?></td>
- <td width="35%" class="listhdr"><?=gettext("Description");?></td>
- <td width="5%" class="list sort_ignore">
- <table border="0" cellspacing="0" cellpadding="1" summary="add">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="firewall_schedule_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new schedule");?>" alt="add" /></a></td>
- </tr>
- </table>
- </td>
+ <td width="25%" class="listhdrr"><?=gettext("Name");?></td>
+ <td width="35%" class="listhdrr"><?=gettext("Time Range(s)");?></td>
+ <td width="35%" class="listhdr"><?=gettext("Description");?></td>
+ <td width="5%" class="list sort_ignore">
+ <table border="0" cellspacing="0" cellpadding="1" summary="add">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="firewall_schedule_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new schedule");?>" alt="add" /></a></td>
+ </tr>
+ </table>
+ </td>
</tr>
<?php $i = 0; foreach ($a_schedules as $schedule): ?>
<tr>
- <td class="listlr" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
+ <td class="listlr" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
<?=htmlspecialchars($schedule['name']);?>
- <?php
- $schedstatus = filter_get_time_based_rule_status($schedule);
- if ($schedstatus) { ?>
- &nbsp;<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_frmfld_time.png" title="<?=gettext("Schedule is currently active");?>" width="17" height="17" border="0" alt="schedule" />
- <?php } ?>
-
- </td>
- <td class="listlr" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
- <table width="98%" border="0" cellpadding="0" cellspacing="0" summary="schedule">
<?php
-
- foreach($schedule['timerange'] as $timerange) {
+ $schedstatus = filter_get_time_based_rule_status($schedule);
+ if ($schedstatus) { ?>
+ &nbsp;<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_frmfld_time.png" title="<?=gettext("Schedule is currently active");?>" width="17" height="17" border="0" alt="schedule" />
+ <?php } ?>
+ </td>
+ <td class="listlr" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
+ <table width="98%" border="0" cellpadding="0" cellspacing="0" summary="schedule">
+ <?php
+ foreach ($schedule['timerange'] as $timerange) {
+ $tempFriendlyTime = "";
+ $tempID = "";
+ $firstprint = false;
+ if ($timerange) {
+ $dayFriendly = "";
$tempFriendlyTime = "";
- $tempID = "";
- $firstprint = false;
- if ($timerange){
- $dayFriendly = "";
- $tempFriendlyTime = "";
-
- //get hours
- $temptimerange = $timerange['hour'];
- $temptimeseparator = strrpos($temptimerange, "-");
-
- $starttime = substr ($temptimerange, 0, $temptimeseparator);
- $stoptime = substr ($temptimerange, $temptimeseparator+1);
-
- if ($timerange['month']){
- $tempmontharray = explode(",", $timerange['month']);
- $tempdayarray = explode(",",$timerange['day']);
- $arraycounter = 0;
- $firstDayFound = false;
- $firstPrint = false;
- foreach ($tempmontharray as $monthtmp){
- $month = $tempmontharray[$arraycounter];
- $day = $tempdayarray[$arraycounter];
-
- if (!$firstDayFound)
- {
- $firstDay = $day;
- $firstmonth = $month;
- $firstDayFound = true;
- }
- $currentDay = $day;
- $nextDay = $tempdayarray[$arraycounter+1];
- $currentDay++;
- if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
- if ($firstPrint)
- $dayFriendly .= "<br />";
- $currentDay--;
- if ($currentDay != $firstDay)
- $dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
- else
- $dayFriendly .= $monthArray[$month-1] . " " . $day;
- $firstDayFound = false;
- $firstPrint = true;
+ //get hours
+ $temptimerange = $timerange['hour'];
+ $temptimeseparator = strrpos($temptimerange, "-");
+
+ $starttime = substr ($temptimerange, 0, $temptimeseparator);
+ $stoptime = substr ($temptimerange, $temptimeseparator+1);
+
+ if ($timerange['month']) {
+ $tempmontharray = explode(",", $timerange['month']);
+ $tempdayarray = explode(",",$timerange['day']);
+ $arraycounter = 0;
+ $firstDayFound = false;
+ $firstPrint = false;
+ foreach ($tempmontharray as $monthtmp) {
+ $month = $tempmontharray[$arraycounter];
+ $day = $tempdayarray[$arraycounter];
+
+ if (!$firstDayFound) {
+ $firstDay = $day;
+ $firstmonth = $month;
+ $firstDayFound = true;
+ }
+
+ $currentDay = $day;
+ $nextDay = $tempdayarray[$arraycounter+1];
+ $currentDay++;
+ if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) {
+ if ($firstPrint) {
+ $dayFriendly .= "<br />";
+ }
+ $currentDay--;
+ if ($currentDay != $firstDay) {
+ $dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
+ } else {
+ $dayFriendly .= $monthArray[$month-1] . " " . $day;
}
- $arraycounter++;
+ $firstDayFound = false;
+ $firstPrint = true;
}
+ $arraycounter++;
}
- else
- {
- $tempdayFriendly = $timerange['position'];
- $firstDayFound = false;
- $tempFriendlyDayArray = explode(",", $tempdayFriendly);
- $currentDay = "";
- $firstDay = "";
- $nextDay = "";
- $counter = 0;
- foreach ($tempFriendlyDayArray as $day){
- if ($day != ""){
- if (!$firstDayFound)
- {
- $firstDay = $tempFriendlyDayArray[$counter];
- $firstDayFound = true;
+ } else {
+ $tempdayFriendly = $timerange['position'];
+ $firstDayFound = false;
+ $tempFriendlyDayArray = explode(",", $tempdayFriendly);
+ $currentDay = "";
+ $firstDay = "";
+ $nextDay = "";
+ $counter = 0;
+ foreach ($tempFriendlyDayArray as $day) {
+ if ($day != "") {
+ if (!$firstDayFound) {
+ $firstDay = $tempFriendlyDayArray[$counter];
+ $firstDayFound = true;
+ }
+ $currentDay =$tempFriendlyDayArray[$counter];
+ //get next day
+ $nextDay = $tempFriendlyDayArray[$counter+1];
+ $currentDay++;
+ if ($currentDay != $nextDay) {
+ if ($firstprint) {
+ $dayFriendly .= "<br />";
}
- $currentDay =$tempFriendlyDayArray[$counter];
- //get next day
- $nextDay = $tempFriendlyDayArray[$counter+1];
- $currentDay++;
- if ($currentDay != $nextDay){
- if ($firstprint)
- $dayFriendly .= "<br />";
- $currentDay--;
- if ($currentDay != $firstDay)
- $dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
- else
- $dayFriendly .= $dayArray[$firstDay-1];
- $firstDayFound = false;
- $firstprint = true;
+ $currentDay--;
+ if ($currentDay != $firstDay) {
+ $dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
+ } else {
+ $dayFriendly .= $dayArray[$firstDay-1];
}
- $counter++;
+ $firstDayFound = false;
+ $firstprint = true;
}
+ $counter++;
}
}
- $timeFriendly = $starttime . "-" . $stoptime;
- $description = $timerange['rangedescr'];
-
- ?><tr><td><?=$dayFriendly;?></td><td><?=$timeFriendly;?></td><td><?=$description;?></td></tr><?php
}
- }//end for?></table>
- </td>
- <td class="listbg" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
- <?=htmlspecialchars($schedule['descr']);?>&nbsp;
- </td>
- <td valign="middle" class="list nowrap">
- <table border="0" cellspacing="0" cellpadding="1" summary="buttons">
- <tr>
- <td valign="middle"><a href="firewall_schedule_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit alias");?>" alt="edit" /></a></td>
- <td><a href="firewall_schedule.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext('Do you really want to delete this schedule?');?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete alias");?>" alt="delete" /></a></td>
- </tr>
- </table>
- </td>
-</tr>
+ $timeFriendly = $starttime . "-" . $stoptime;
+ $description = $timerange['rangedescr'];
+
+ ?>
+ <tr>
+ <td><?=$dayFriendly;?></td>
+ <td><?=$timeFriendly;?></td>
+ <td><?=$description;?></td>
+ </tr>
+ <?php
+ }
+ }//end for
+ ?>
+ </table>
+ </td>
+ <td class="listbg" ondblclick="document.location='firewall_schedule_edit.php?id=<?=$i;?>';">
+ <?=htmlspecialchars($schedule['descr']);?>&nbsp;
+ </td>
+ <td valign="middle" class="list nowrap">
+ <table border="0" cellspacing="0" cellpadding="1" summary="buttons">
+ <tr>
+ <td valign="middle"><a href="firewall_schedule_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit alias");?>" alt="edit" /></a></td>
+ <td><a href="firewall_schedule.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext('Do you really want to delete this schedule?');?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete alias");?>" alt="delete" /></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
<?php $i++; endforeach; ?>
-<tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1" summary="add">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="firewall_schedule_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new schedule");?>" alt="add" /></a></td>
- </tr>
- </table>
- </td>
-</tr>
-<tr>
- <td class="tabcont" colspan="3">
- <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br /></strong></span><?=gettext("Schedules act as placeholders for time ranges to be used in Firewall Rules.");?></span></p>
- </td>
-</tr>
+ <tr>
+ <td class="list" colspan="3"></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1" summary="add">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="firewall_schedule_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new schedule");?>" alt="add" /></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabcont" colspan="3">
+ <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br /></strong></span><?=gettext("Schedules act as placeholders for time ranges to be used in Firewall Rules.");?></span></p>
+ </td>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/usr/local/www/firewall_schedule_edit.php b/usr/local/www/firewall_schedule_edit.php
index 5759863..a6df301 100644
--- a/usr/local/www/firewall_schedule_edit.php
+++ b/usr/local/www/firewall_schedule_edit.php
@@ -45,13 +45,14 @@ function schedulecmp($a, $b) {
return strcmp($a['name'], $b['name']);
}
-function schedule_sort(){
- global $g, $config;
+function schedule_sort() {
+ global $g, $config;
- if (!is_array($config['schedules']['schedule']))
- return;
+ if (!is_array($config['schedules']['schedule'])) {
+ return;
+ }
- usort($config['schedules']['schedule'], "schedulecmp");
+ usort($config['schedules']['schedule'], "schedulecmp");
}
require("guiconfig.inc");
@@ -66,15 +67,18 @@ $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firew
$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
$monthArray = array (gettext('January'),gettext('February'),gettext('March'),gettext('April'),gettext('May'),gettext('June'),gettext('July'),gettext('August'),gettext('September'),gettext('October'),gettext('November'),gettext('December'));
-if (!is_array($config['schedules']['schedule']))
+if (!is_array($config['schedules']['schedule'])) {
$config['schedules']['schedule'] = array();
+}
$a_schedules = &$config['schedules']['schedule'];
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
if (isset($id) && $a_schedules[$id]) {
$pconfig['name'] = $a_schedules[$id]['name'];
@@ -85,26 +89,31 @@ if (isset($id) && $a_schedules[$id]) {
}
if ($_POST) {
-
- if(strtolower($_POST['name']) == "lan")
+
+ if (strtolower($_POST['name']) == "lan") {
$input_errors[] = gettext("Schedule may not be named LAN.");
- if(strtolower($_POST['name']) == "wan")
+ }
+ if (strtolower($_POST['name']) == "wan") {
$input_errors[] = gettext("Schedule may not be named WAN.");
- if(strtolower($_POST['name']) == "")
+ }
+ if (strtolower($_POST['name']) == "") {
$input_errors[] = gettext("Schedule name cannot be blank.");
+ }
$x = is_validaliasname($_POST['name']);
if (!isset($x)) {
$input_errors[] = gettext("Reserved word used for schedule name.");
} else {
- if (is_validaliasname($_POST['name']) == false)
+ if (is_validaliasname($_POST['name']) == false) {
$input_errors[] = gettext("The schedule name may only consist of the characters a-z, A-Z, 0-9");
+ }
}
-
+
/* check for name conflicts */
foreach ($a_schedules as $schedule) {
- if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule))
+ if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule)) {
continue;
+ }
if ($schedule['name'] == $_POST['name']) {
$input_errors[] = gettext("A Schedule with this name already exists.");
@@ -112,13 +121,13 @@ if ($_POST) {
}
}
$schedule = array();
-
+
$schedule['name'] = $_POST['name'];
- $schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
-
+ $schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
+
$timerangeFound = false;
- for ($x=0; $x<99; $x++){
- if($_POST['schedule' . $x]) {
+ for ($x=0; $x<99; $x++) {
+ if ($_POST['schedule' . $x]) {
if (!preg_match('/^[0-9]+:[0-9]+$/', $_POST['starttime' . $x])) {
$input_errors[] = sprintf(gettext("Invalid start time - '%s'"), $_POST['starttime' . $x]);
continue;
@@ -134,78 +143,73 @@ if ($_POST) {
$timehourstr = $_POST['starttime' . $x];
$timehourstr .= "-";
$timehourstr .= $_POST['stoptime' . $x];
- $timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8');
+ $timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8');
$dashpos = strpos($timestr, '-');
- if ($dashpos === false)
- {
+ if ($dashpos === false) {
$timeparts['position'] = $timestr;
- }
- else
- {
+ } else {
$tempindarray = array();
$monthstr = "";
$daystr = "";
$tempindarray = explode(",", $timestr);
- foreach ($tempindarray as $currentselection)
- {
- if ($currentselection){
- if ($firstprint)
- {
+ foreach ($tempindarray as $currentselection) {
+ if ($currentselection) {
+ if ($firstprint) {
$monthstr .= ",";
- $daystr .= ",";
+ $daystr .= ",";
}
$tempstr = "";
$monthpos = strpos($currentselection, "m");
$daypos = strpos($currentselection, "d");
$monthstr .= substr($currentselection, $monthpos+1, $daypos-$monthpos-1);
- $daystr .= substr($currentselection, $daypos+1);
+ $daystr .= substr($currentselection, $daypos+1);
$firstprint = true;
}
}
$timeparts['month'] = $monthstr;
$timeparts['day'] = $daystr;
- }
+ }
$timeparts['hour'] = $timehourstr;
$timeparts['rangedescr'] = $timedescrstr;
$schedule['timerange'][$x] = $timeparts;
}
}
-
- if (!$timerangeFound)
+
+ if (!$timerangeFound) {
$input_errors[] = gettext("The schedule must have at least one time range configured.");
-
- if (!$input_errors) {
-
- if (!empty($pconfig['schedlabel']))
+ }
+
+ if (!$input_errors) {
+
+ if (!empty($pconfig['schedlabel'])) {
$schedule['schedlabel'] = $pconfig['schedlabel'];
- else
+ } else {
$schedule['schedlabel'] = uniqid();
+ }
- if (isset($id) && $a_schedules[$id]){
+ if (isset($id) && $a_schedules[$id]) {
$a_schedules[$id] = $schedule;
- }
- else{
+ } else {
$a_schedules[] = $schedule;
}
schedule_sort();
- if (write_config())
+ if (write_config()) {
filter_configure();
+ }
header("Location: firewall_schedule.php");
exit;
-
- }
- //we received input errors, copy data to prevent retype
- else
- {
- if (!$_POST['schedule0'])
+ } else {
+ //we received input errors, copy data to prevent retype
+ if (!$_POST['schedule0']) {
$getSchedule = false;
- else
+ } else {
$getSchedule = true;
+ }
$pconfig['name'] = $schedule['name'];
$pconfig['descr'] = $schedule['descr'];
$pconfig['timerange'] = $schedule['timerange'];
- }
+ }
}
include("head.inc");
@@ -222,165 +226,148 @@ var schCounter = 0;
function rgb2hex(rgb) {
var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
- if (parts == null)
+ if (parts == null) {
return;
+ }
function hex(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
}
return ("#" + hex(parts[1]) + hex(parts[2]) + hex(parts[3])).toUpperCase();
}
-function repeatExistingDays(){
+function repeatExistingDays() {
var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
-
+
var dayarray = daysSelected.split(",");
- for (i=0; i<=dayarray.length; i++){
+ for (i=0; i<=dayarray.length; i++) {
tempstr = dayarray[i];
tempstrdaypos = tempstr.search("p");
week = tempstr.substring(1,tempstrdaypos);
week = parseInt(week);
- dashpos = tempstr.search("-");
+ dashpos = tempstr.search("-");
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
daypos = parseInt(daypos);
-
+
daydone = dayposdone.search(daypos);
tempstr = 'w' + week + 'p' + daypos;
daycell = eval('document.getElementById(tempstr)');
- if (daydone == "-1"){
- if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral
+ if (daydone == "-1") {
+ if (rgb2hex(daycell.style.backgroundColor) == "#F08080") { // lightcoral
daytogglerepeating(week,daypos,true);
- else
+ } else {
daytogglerepeating(week,daypos,false);
+ }
dayposdone += daypos + ",";
}
- }
+ }
}
-function daytogglerepeating(week,daypos,bExists){
+function daytogglerepeating(week,daypos,bExists) {
var tempstr, daycell, dayoriginal = "";
- for (j=1; j<=53; j++)
- {
+ for (j=1; j<=53; j++) {
tempstr = 'w' + j + 'p' + daypos;
daycell = eval('document.getElementById(tempstr)');
dayoriginalpos = daysSelected.indexOf(tempstr);
-
+
//if bExists set to true, means cell is already select it
- //unselect it and remove original day from daysSelected string
-
- if (daycell != null)
- {
- if (bExists){
+ //unselect it and remove original day from daysSelected string
+
+ if (daycell != null) {
+ if (bExists) {
daycell.style.backgroundColor = "#FFFFFF"; // white
+ } else {
+ daycell.style.backgroundColor = "#F08080"; // lightcoral
}
- else
- {
- daycell.style.backgroundColor = "#F08080"; // lightcoral
- }
-
- if (dayoriginalpos != "-1")
- {
+
+ if (dayoriginalpos != "-1") {
dayoriginalend = daysSelected.indexOf(',', dayoriginalpos);
tempstr = daysSelected.substring(dayoriginalpos, dayoriginalend+1);
daysSelected = daysSelected.replace(tempstr, "");
-
- }
- }
- }
+
+ }
+ }
+ }
}
function daytoggle(id) {
var runrepeat, tempstr = "";
var bFoundValid = false;
-
+
iddashpos = id.search("-");
var tempstrdaypos = id.search("p");
var week = id.substring(1,tempstrdaypos);
week = parseInt(week);
-
- if (iddashpos == "-1")
- {
+
+ if (iddashpos == "-1") {
idmod = id;
runrepeat = true;
- var daypos = id.substr(tempstrdaypos+1);
- }
- else
- {
+ var daypos = id.substr(tempstrdaypos+1);
+ } else {
idmod = id.substring(0,iddashpos);
var daypos = id.substring(tempstrdaypos+1,iddashpos);
}
-
+
daypos = parseInt(daypos);
-
- while (!bFoundValid){
- var daycell = document.getElementById(idmod);
-
- if (daycell != null){
- if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){ // red
+
+ while (!bFoundValid) {
+ var daycell = document.getElementById(idmod);
+
+ if (daycell != null) {
+ if (rgb2hex(daycell.style.backgroundColor) == "#FF0000") { // red
daycell.style.backgroundColor = "#FFFFFF"; // white
str = id + ",";
daysSelected = daysSelected.replace(str, "");
- }
- else if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral
- {
+ } else if (rgb2hex(daycell.style.backgroundColor) == "#F08080") { // lightcoral
daytogglerepeating(week,daypos,true);
- }
- else //color is white cell
- {
- if (!runrepeat)
- {
+ } else {
+ //color is white cell
+ if (!runrepeat) {
daycell.style.backgroundColor = "#FF0000"; // red
- }
- else
- {
+ } else {
daycell.style.backgroundColor = "#F08080"; // lightcoral
- daytogglerepeating(week,daypos,false);
+ daytogglerepeating(week,daypos,false);
}
daysSelected += id + ",";
}
bFoundValid = true;
- }
- else
- {
+ } else {
//we found an invalid cell when column was clicked, move up to the next week
week++;
tempstr = "w" + week + "p" + daypos;
- idmod = tempstr;
+ idmod = tempstr;
}
}
}
-function update_month(){
+function update_month() {
var indexNum = document.forms[0].monthsel.selectedIndex;
var selected = document.forms[0].monthsel.options[indexNum].text;
- for (i=0; i<=11; i++){
+ for (i=0; i<=11; i++) {
option = document.forms[0].monthsel.options[i].text;
document.popupMonthLayer = eval('document.getElementById (option)');
-
- if(selected == option) {
+
+ if (selected == option) {
document.popupMonthLayer.style.display="block";
- }
- else
+ } else {
document.popupMonthLayer.style.display="none";
+ }
}
}
-function checkForRanges(){
- if (daysSelected != "")
- {
+function checkForRanges() {
+ if (daysSelected != "") {
alert("You have not saved the specified time range. Please click 'Add Time' button to save the time range.");
return false;
- }
- else
- {
+ } else {
return true;
}
}
-function processEntries(){
+function processEntries() {
var tempstr, starttimehour, starttimemin, stoptimehour, stoptimemin, errors = "";
var passedValidiation = true;
-
+
//get time specified
starttimehour = parseInt(document.getElementById("starttimehour").value);
starttimemin = parseInt(document.getElementById("starttimemin").value);
@@ -388,31 +375,28 @@ function processEntries(){
stoptimemin = parseInt(document.getElementById("stoptimemin").value);
- //do time checks
- if (starttimehour > stoptimehour)
- {
+ //do time checks
+ if (starttimehour > stoptimehour) {
errors = "Error: Start Hour cannot be greater than Stop Hour.";
passedValidiation = false;
-
- }
- else if (starttimehour == stoptimehour)
- {
- if (starttimemin > stoptimemin){
+
+ } else if (starttimehour == stoptimehour) {
+ if (starttimemin > stoptimemin) {
errors = "Error: Start Minute cannot be greater than Stop Minute.";
passedValidiation = false;
}
- }
-
- if (passedValidiation){
- addTimeRange();
}
- else {
- if (errors != "")
+
+ if (passedValidiation) {
+ addTimeRange();
+ } else {
+ if (errors != "") {
alert(errors);
+ }
}
}
-function addTimeRange(){
+function addTimeRange() {
var tempdayarray = daysSelected.split(",");
var tempstr, tempFriendlyDay, starttimehour, starttimemin, stoptimehour, nrtempFriendlyTime, rtempFriendlyTime, nrtempID, rtempID = "";
var stoptimemin, timeRange, tempstrdaypos, week, daypos, day, month, dashpos, nrtempTime, rtempTime, monthstr, daystr = "";
@@ -422,40 +406,36 @@ function addTimeRange(){
rtempID = "";
nrtempTime = "";
rtempTime = "";
- tempdayarray.sort();
+ tempdayarray.sort();
rtempFriendlyDay = "";
monthstr = "";
daystr = "";
-
+
//check for existing entries
var findCurrentCounter;
- for (u=0; u<99; u++){
+ for (u=0; u<99; u++) {
findCurrentCounter = document.getElementById("schedule" + u);
- if (!findCurrentCounter)
- {
+ if (!findCurrentCounter) {
schCounter = u;
break;
}
}
-
- if (daysSelected != ""){
+
+ if (daysSelected != "") {
//get days selected
- for (i=0; i<tempdayarray.length; i++)
- {
+ for (i=0; i<tempdayarray.length; i++) {
tempstr = tempdayarray[i];
- if (tempstr != "")
- {
+ if (tempstr != "") {
tempstrdaypos = tempstr.search("p");
week = tempstr.substring(1,tempstrdaypos);
week = parseInt(week);
- dashpos = tempstr.search("-");
-
- if (dashpos != "-1")
- {
+ dashpos = tempstr.search("-");
+
+ if (dashpos != "-1") {
var nonrepeatingfound = true;
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
- daypos = parseInt(daypos);
- monthpos = tempstr.search("m");
+ daypos = parseInt(daypos);
+ monthpos = tempstr.search("m");
tempstrdaypos = tempstr.search("d");
month = tempstr.substring(monthpos+1, tempstrdaypos);
month = parseInt(month);
@@ -464,18 +444,16 @@ function addTimeRange(){
monthstr += month + ",";
daystr += day + ",";
nrtempID += tempstr + ",";
- }
- else
- {
+ } else {
var repeatingfound = true;
daypos = tempstr.substr(tempstrdaypos+1);
- daypos = parseInt(daypos);
+ daypos = parseInt(daypos);
rtempFriendlyDay += daypos + ",";
- rtempID += daypos + ",";
- }
- }
- }
-
+ rtempID += daypos + ",";
+ }
+ }
+ }
+
//code below spits out friendly look format for nonrepeating schedules
var foundEnd = false;
var firstDayFound = false;
@@ -483,11 +461,10 @@ function addTimeRange(){
var tempFriendlyMonthArray = monthstr.split(",");
var tempFriendlyDayArray = daystr.split(",");
var currentDay, firstDay, nextDay, currentMonth, nextMonth, firstDay, firstMonth = "";
- for (k=0; k<tempFriendlyMonthArray.length; k++){
+ for (k=0; k<tempFriendlyMonthArray.length; k++) {
tempstr = tempFriendlyMonthArray[k];
- if (tempstr != ""){
- if (!firstDayFound)
- {
+ if (tempstr != "") {
+ if (!firstDayFound) {
firstDay = tempFriendlyDayArray[k];
firstDay = parseInt(firstDay);
firstMonth = tempFriendlyMonthArray[k];
@@ -500,22 +477,24 @@ function addTimeRange(){
nextDay = tempFriendlyDayArray[k+1];
nextDay = parseInt(nextDay);
//get next month
-
- currentDay++;
- if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])){
- if (firstprint)
+
+ currentDay++;
+ if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])) {
+ if (firstprint) {
nrtempFriendlyTime += ", ";
+ }
currentDay--;
- if (currentDay != firstDay)
+ if (currentDay != firstDay) {
nrtempFriendlyTime += month_array[firstMonth-1] + " " + firstDay + "-" + currentDay;
- else
- nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay;
- firstDayFound = false;
- firstprint = true;
+ } else {
+ nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay;
+ }
+ firstDayFound = false;
+ firstprint = true;
}
- }
- }
-
+ }
+ }
+
//code below spits out friendly look format for repeating schedules
foundEnd = false;
firstDayFound = false;
@@ -523,11 +502,10 @@ function addTimeRange(){
tempFriendlyDayArray = rtempFriendlyDay.split(",");
tempFriendlyDayArray.sort();
currentDay, firstDay, nextDay = "";
- for (k=0; k<tempFriendlyDayArray.length; k++){
+ for (k=0; k<tempFriendlyDayArray.length; k++) {
tempstr = tempFriendlyDayArray[k];
- if (tempstr != ""){
- if (!firstDayFound)
- {
+ if (tempstr != "") {
+ if (!firstDayFound) {
firstDay = tempFriendlyDayArray[k];
firstDay = parseInt(firstDay);
firstDayFound = true;
@@ -537,64 +515,65 @@ function addTimeRange(){
//get next day
nextDay = tempFriendlyDayArray[k+1];
nextDay = parseInt(nextDay);
- currentDay++;
- if (currentDay != nextDay){
- if (firstprint)
+ currentDay++;
+ if (currentDay != nextDay) {
+ if (firstprint) {
rtempFriendlyTime += ", ";
+ }
currentDay--;
- if (currentDay != firstDay)
+ if (currentDay != firstDay) {
rtempFriendlyTime += day_array[firstDay-1] + " - " + day_array[currentDay-1];
- else
+ } else {
rtempFriendlyTime += day_array[firstDay-1];
- firstDayFound = false;
- firstprint = true;
+ }
+ firstDayFound = false;
+ firstprint = true;
}
}
- }
-
+ }
+
//sort the tempID
var tempsortArray = rtempID.split(",");
var isFirstdone = false;
tempsortArray.sort();
//clear tempID
rtempID = "";
- for (t=0; t<tempsortArray.length; t++)
- {
- if (tempsortArray[t] != ""){
- if (!isFirstdone){
+ for (t=0; t<tempsortArray.length; t++) {
+ if (tempsortArray[t] != "") {
+ if (!isFirstdone) {
rtempID += tempsortArray[t];
isFirstdone = true;
- }
- else
+ } else {
rtempID += "," + tempsortArray[t];
+ }
}
- }
-
-
+ }
+
+
//get time specified
starttimehour = document.getElementById("starttimehour").value
starttimemin = document.getElementById("starttimemin").value;
stoptimehour = document.getElementById("stoptimehour").value;
stoptimemin = document.getElementById("stoptimemin").value;
-
+
timeRange = "||" + starttimehour + ":";
timeRange += starttimemin + "-";
- timeRange += stoptimehour + ":";
- timeRange += stoptimemin;
-
+ timeRange += stoptimehour + ":";
+ timeRange += stoptimemin;
+
//get description for time range
- var tempdescr = document.getElementById("timerangedescr").value
-
- if (nonrepeatingfound){
+ var tempdescr = document.getElementById("timerangedescr").value
+
+ if (nonrepeatingfound) {
nrtempTime += nrtempID;
//add time ranges
- nrtempTime += timeRange;
+ nrtempTime += timeRange;
//add description
nrtempTime += "||" + tempdescr;
insertElements(nrtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, nrtempTime, nrtempID);
}
-
- if (repeatingfound){
+
+ if (repeatingfound) {
rtempTime += rtempID;
//add time ranges
rtempTime += timeRange;
@@ -602,134 +581,127 @@ function addTimeRange(){
rtempTime += "||" + tempdescr;
insertElements(rtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, rtempTime, rtempID);
}
-
- }
- else
- {
+
+ } else {
//no days were selected, alert user
alert ("You must select at least 1 day before adding time");
}
}
-function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, tempTime, tempID){
-
- //add it to the schedule list
- d = document;
- tbody = d.getElementById("scheduletable").getElementsByTagName("tbody").item(0);
- tr = d.createElement("tr");
- td = d.createElement("td");
- td.innerHTML= "<span class='vexpl'>" + tempFriendlyTime + "<\/span>";
- tr.appendChild(td);
-
- td = d.createElement("td");
- td.innerHTML="<input type='text' readonly class='vexpl' name='starttime" + schCounter + "' id='starttime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + starttimehour + ":" + starttimemin + "' />";
- tr.appendChild(td);
-
- td = d.createElement("td");
- td.innerHTML="<input type='text' readonly class='vexpl' name='stoptime" + schCounter + "' id='stoptime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + stoptimehour + ":" + stoptimemin + "' />";
- tr.appendChild(td);
-
- td = d.createElement("td");
- td.innerHTML="<input type='text' readonly class='vexpl' name='timedescr" + schCounter + "' id='timedescr" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + tempdescr + "' />";
- tr.appendChild(td);
-
- td = d.createElement("td");
- td.innerHTML = "<a onclick='editRow(\"" + tempTime + "\",this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_e.gif' alt='edit' /></\a>";
- tr.appendChild(td);
-
- td = d.createElement("td");
- td.innerHTML = "<a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_x.gif' alt='remove' /></\a>";
- tr.appendChild(td);
-
- td = d.createElement("td");
- td.innerHTML="<input type='hidden' id='schedule" + schCounter + "' name='schedule" + schCounter + "' value='" + tempID + "' />";
- tr.appendChild(td);
- tbody.appendChild(tr);
-
- schCounter++;
-
- //reset calendar and time and descr
- clearCalendar();
- clearTime();
- clearDescr();
+function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, tempTime, tempID) {
+
+ //add it to the schedule list
+ d = document;
+ tbody = d.getElementById("scheduletable").getElementsByTagName("tbody").item(0);
+ tr = d.createElement("tr");
+ td = d.createElement("td");
+ td.innerHTML= "<span class='vexpl'>" + tempFriendlyTime + "<\/span>";
+ tr.appendChild(td);
+
+ td = d.createElement("td");
+ td.innerHTML="<input type='text' readonly class='vexpl' name='starttime" + schCounter + "' id='starttime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + starttimehour + ":" + starttimemin + "' />";
+ tr.appendChild(td);
+
+ td = d.createElement("td");
+ td.innerHTML="<input type='text' readonly class='vexpl' name='stoptime" + schCounter + "' id='stoptime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + stoptimehour + ":" + stoptimemin + "' />";
+ tr.appendChild(td);
+
+ td = d.createElement("td");
+ td.innerHTML="<input type='text' readonly class='vexpl' name='timedescr" + schCounter + "' id='timedescr" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + tempdescr + "' />";
+ tr.appendChild(td);
+
+ td = d.createElement("td");
+ td.innerHTML = "<a onclick='editRow(\"" + tempTime + "\",this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_e.gif' alt='edit' /></\a>";
+ tr.appendChild(td);
+
+ td = d.createElement("td");
+ td.innerHTML = "<a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_x.gif' alt='remove' /></\a>";
+ tr.appendChild(td);
+
+ td = d.createElement("td");
+ td.innerHTML="<input type='hidden' id='schedule" + schCounter + "' name='schedule" + schCounter + "' value='" + tempID + "' />";
+ tr.appendChild(td);
+ tbody.appendChild(tr);
+
+ schCounter++;
+
+ //reset calendar and time and descr
+ clearCalendar();
+ clearTime();
+ clearDescr();
}
-function clearCalendar(){
+function clearCalendar() {
var tempstr, daycell = "";
//clear days selected
daysSelected = "";
//loop through all 52 weeks
- for (j=1; j<=53; j++)
- {
+ for (j=1; j<=53; j++) {
//loop through all 7 days
- for (k=1; k<8; k++){
+ for (k=1; k<8; k++) {
tempstr = 'w' + j + 'p' + k;
daycell = eval('document.getElementById(tempstr)');
- if (daycell != null){
- daycell.style.backgroundColor = "#FFFFFF"; // white
- }
+ if (daycell != null) {
+ daycell.style.backgroundColor = "#FFFFFF"; // white
+ }
}
- }
+ }
}
-function clearTime(){
+function clearTime() {
document.getElementById("starttimehour").value = "0";
document.getElementById("starttimemin").value = "00";
document.getElementById("stoptimehour").value = "23";
document.getElementById("stoptimemin").value = "59";
}
-function clearDescr(){
+function clearDescr() {
document.getElementById("timerangedescr").value = "";
}
function editRow(incTime, el) {
var check = checkForRanges();
-
- if (check){
-
+
+ if (check) {
+
//reset calendar and time
clearCalendar();
clearTime();
-
- var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = "";
-
+
+ var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = "";
+
tempArray = incTime.split ("||");
-
+
days = tempArray[0];
hours = tempArray[1];
descr = tempArray[2];
-
+
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];
-
+ 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 (i=0; i<tempdayArray.length; i++)
- {
- if (tempdayArray[i]){
+ for (i=0; i<tempdayArray.length; i++) {
+ if (tempdayArray[i]) {
var tempweekstr = tempdayArray[i];
- dashpos = tempweekstr.search("-");
-
- if (dashpos == "-1")
- {
+ dashpos = tempweekstr.search("-");
+
+ if (dashpos == "-1") {
tempstr = "w2p" + tempdayArray[i];
- }
- else
- {
+ } else {
tempstr = tempdayArray[i];
}
daytoggle(tempstr);
@@ -740,28 +712,30 @@ function editRow(incTime, el) {
}
function removeRownoprompt(el) {
- var cel;
- while (el && el.nodeName.toLowerCase() != "tr")
- el = el.parentNode;
-
- if (el && el.parentNode) {
- cel = el.getElementsByTagName("td").item(0);
- el.parentNode.removeChild(el);
- }
+ var cel;
+ while (el && el.nodeName.toLowerCase() != "tr") {
+ el = el.parentNode;
+ }
+
+ if (el && el.parentNode) {
+ cel = el.getElementsByTagName("td").item(0);
+ el.parentNode.removeChild(el);
+ }
}
function removeRow(el) {
var check = confirm ("Do you really want to delete this time range?");
- if (check){
- var cel;
- while (el && el.nodeName.toLowerCase() != "tr")
- el = el.parentNode;
-
- if (el && el.parentNode) {
- cel = el.getElementsByTagName("td").item(0);
- el.parentNode.removeChild(el);
- }
+ if (check) {
+ var cel;
+ while (el && el.nodeName.toLowerCase() != "tr") {
+ el = el.parentNode;
+ }
+
+ if (el && el.parentNode) {
+ cel = el.getElementsByTagName("td").item(0);
+ el.parentNode.removeChild(el);
+ }
}
}
//]]>
@@ -780,81 +754,80 @@ EOD;
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall schedule">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule information");?></td>
- </tr>
- <tr>
- <td>
- <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td width="15%" valign="top" class="vncellreq"><?=gettext("Schedule Name");?></td>
- <td width="85%" class="vtable">
- <?php if(is_schedule_inuse($pconfig['name']) == true): ?>
- <input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
- <?php echo $pconfig['name']; ?>
- <p>
- <span class="vexpl"><?=gettext("NOTE: This schedule is in use so the name may not be modified!");?></span>
- </p>
- <?php else: ?>
- <input name="name" type="text" id="name" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['name']);?>" /><br />
- <span class="vexpl">
- <?=gettext("The name of the alias may only consist of the characters a-z, A-Z and 0-9");?>
- </span>
- <?php endif; ?>
- </td>
- </tr>
- <tr>
- <td width="15%" valign="top" class="vncell"><?=gettext("Description");?></td>
- <td width="85%" class="vtable"><input name="descr" type="text" id="descr" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['descr']);?>" /><br />
- <span class="vexpl">
- <?=gettext("You may enter a description here for your reference (not parsed).");?>
- </span>
-
- </td>
- </tr>
- <!-- tr>
- </tr -->
- <tr>
- <td width="15%" valign="top" class="vncellreq"><?=gettext("Month");?></td>
- <td width="85%" class="vtable">
- <select name="monthsel" class="formselect" id="monthsel" onchange="update_month();">
- <?php
- $monthcounter = date("n");
- $monthlimit = $monthcounter + 12;
- $yearcounter = date("Y");
- for ($k=0; $k<12; $k++){?>
- <option value="<?php echo $monthcounter;?>"><?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></option>
- <?php
- if ($monthcounter == 12)
- {
- $monthcounter = 1;
- $yearcounter++;
- }
- else
- {
- $monthcounter++;
- }
- } ?>
- </select><br /><br />
- <?php
- $firstmonth = TRUE;
- $monthcounter = date("n");
- $yearcounter = date("Y");
- for ($k=0; $k<12; $k++){
- $firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
- if ($firstdayofmonth == 0)
- $firstdayofmonth = 7;
-
- $daycounter = 1;
- //number of day in month
- $numberofdays = date("t", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
- $firstdayprinted = FALSE;
- $lasttr = FALSE;
- $positioncounter = 1;//7 for Sun, 1 for Mon, 2 for Tues, etc
- ?>
- <div id="<?php echo date("F_y",mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?>" style=" position:relative; display:<?php if($firstmonth)echo "block";else echo "none";?>">
- <table border="1" cellspacing="1" cellpadding="1" id="calTable<?=$monthcounter . $yearcounter;?>" class="tabcont" summary="month">
- <tr><td colspan="7" align="center" class="listbg"><b><?php echo date("F_Y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></b></td>
+ </tr>
+ <tr>
+ <td>
+ <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td width="15%" valign="top" class="vncellreq"><?=gettext("Schedule Name");?></td>
+ <td width="85%" class="vtable">
+ <?php if (is_schedule_inuse($pconfig['name']) == true): ?>
+ <input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ <?php echo $pconfig['name']; ?>
+ <p>
+ <span class="vexpl"><?=gettext("NOTE: This schedule is in use so the name may not be modified!");?></span>
+ </p>
+ <?php else: ?>
+ <input name="name" type="text" id="name" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['name']);?>" /><br />
+ <span class="vexpl">
+ <?=gettext("The name of the alias may only consist of the characters a-z, A-Z and 0-9");?>
+ </span>
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="15%" valign="top" class="vncell"><?=gettext("Description");?></td>
+ <td width="85%" class="vtable"><input name="descr" type="text" id="descr" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['descr']);?>" /><br />
+ <span class="vexpl">
+ <?=gettext("You may enter a description here for your reference (not parsed).");?>
+ </span>
+ </td>
+ </tr>
+ <!-- tr>
+ </tr -->
+ <tr>
+ <td width="15%" valign="top" class="vncellreq"><?=gettext("Month");?></td>
+ <td width="85%" class="vtable">
+ <select name="monthsel" class="formselect" id="monthsel" onchange="update_month();">
+ <?php
+ $monthcounter = date("n");
+ $monthlimit = $monthcounter + 12;
+ $yearcounter = date("Y");
+ for ($k=0; $k<12; $k++) {?>
+ <option value="<?php echo $monthcounter;?>"><?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></option>
+ <?php
+ if ($monthcounter == 12) {
+ $monthcounter = 1;
+ $yearcounter++;
+ } else {
+ $monthcounter++;
+ }
+ } ?>
+ </select>
+ <br /><br />
+ <?php
+ $firstmonth = TRUE;
+ $monthcounter = date("n");
+ $yearcounter = date("Y");
+ for ($k=0; $k<12; $k++) {
+ $firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
+ if ($firstdayofmonth == 0) {
+ $firstdayofmonth = 7;
+ }
+
+ $daycounter = 1;
+ //number of day in month
+ $numberofdays = date("t", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
+ $firstdayprinted = FALSE;
+ $lasttr = FALSE;
+ $positioncounter = 1;//7 for Sun, 1 for Mon, 2 for Tues, etc
+ ?>
+ <div id="<?php echo date("F_y",mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?>" style=" position:relative; display:<?php if ($firstmonth)echo "block";else echo "none";?>">
+ <table border="1" cellspacing="1" cellpadding="1" id="calTable<?=$monthcounter . $yearcounter;?>" class="tabcont" summary="month">
+ <tr>
+ <td colspan="7" align="center" class="listbg"><b><?php echo date("F_Y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></b></td>
</tr>
- <tr>
+ <tr>
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p1');"><u><b><?=gettext("Mon");?></b></u></td>
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p2');"><u><b><?=gettext("Tue");?></b></u></td>
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p3');"><u><b><?=gettext("Wed");?></b></u></td>
@@ -863,318 +836,311 @@ EOD;
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p6');"><u><b><?=gettext("Sat");?></b></u></td>
<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p7');"><u><b><?=gettext("Sun");?></b></u></td>
</tr>
- <?php
- $firstmonth = FALSE;
- while ($daycounter<=$numberofdays){
- $weekcounter = date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
- $weekcounter = ltrim($weekcounter, "0");
- if ($positioncounter == 1)
- {
- echo "<tr>";
- }
- if ($firstdayofmonth == $positioncounter){?>
+ <?php
+ $firstmonth = FALSE;
+ while ($daycounter<=$numberofdays) {
+ $weekcounter = date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
+ $weekcounter = ltrim($weekcounter, "0");
+ if ($positioncounter == 1) {
+ echo "<tr>";
+ }
+ if ($firstdayofmonth == $positioncounter) {
+ ?>
<td align="center" style="cursor: pointer;" class="listr" id="w<?=$weekcounter;?>p<?=$positioncounter;?>" onclick="daytoggle('w<?=$weekcounter;?>p<?=$positioncounter;?>-m<?=$monthcounter;?>d<?=$daycounter;?>');">
- <?php echo $daycounter;
- $daycounter++;
- $firstdayprinted = TRUE;
- echo "</td>";
- }
- elseif ($firstdayprinted == TRUE && $daycounter <= $numberofdays){?>
+ <?php
+ echo $daycounter;
+ $daycounter++;
+ $firstdayprinted = TRUE;
+ echo "</td>";
+ } elseif ($firstdayprinted == TRUE && $daycounter <= $numberofdays) {
+ ?>
<td align="center" style="cursor: pointer;" class="listr" id="w<?=$weekcounter;?>p<?=$positioncounter;?>" onclick="daytoggle('w<?=$weekcounter;?>p<?=$positioncounter;?>-m<?=$monthcounter;?>d<?=$daycounter;?>');">
- <?php echo $daycounter;
- $daycounter++;
- echo "</td>";
- }
- else
- {
- echo "<td align=\"center\" class=\"listr\"></td>";
- }
-
- if ($positioncounter == 7 || $daycounter > $numberofdays){
- $positioncounter = 1;
- echo "</tr>";
- }
- else{
- $positioncounter++;
- }
-
- }//end while loop?>
+ <?php
+ echo $daycounter;
+ $daycounter++;
+ echo "</td>";
+ } else {
+ echo "<td align=\"center\" class=\"listr\"></td>";
+ }
+
+ if ($positioncounter == 7 || $daycounter > $numberofdays) {
+ $positioncounter = 1;
+ echo "</tr>";
+ } else {
+ $positioncounter++;
+ }
+
+ } //end while loop
+ ?>
</table>
</div>
- <?php
-
- if ($monthcounter == 12)
- {
+ <?php
+ if ($monthcounter == 12) {
$monthcounter = 1;
$yearcounter++;
- }
- else
- {
+ } else {
$monthcounter++;
- }
+ }
} //end for loop
?>
<br />
- <?=gettext("Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday.");?>
- </td>
- </tr>
- <tr>
- <td width="15%" valign="top" class="vncellreq"><?=gettext("Time");?></td>
- <td width="85%" class="vtable">
- <table cellspacing="2" class="tabcont" summary="time">
- <tr>
- <td class="listhdrr" align="center"><?=gettext("Start Time");?></td><td></td><td class="listhdrr" align="center"><?=gettext("Stop Time");?></td>
- </tr>
- <tr>
- <td>
- <select name="starttimehour" class="formselect" id="starttimehour">
- <?php
- for ($i=0; $i<24; $i++)
- {
- echo "<option value=\"$i\">";
- echo $i;
- echo "</option>";
- }
- ?>
- </select>&nbsp;<?=gettext("Hr"); ?>&nbsp;&nbsp;
- <select name="starttimemin" class="formselect" id="starttimemin">
- <option value="00">00</option>
- <option value="15">15</option>
- <option value="30">30</option>
- <option value="45">45</option>
- <option value="59">59</option>
- </select>&nbsp;<?=gettext("Min"); ?>
- </td>
- <td></td>
- <td>
- <select name="stoptimehour" class="formselect" id="stoptimehour">
- <?php
- for ($i=0; $i<24; $i++)
- {
- if ($i==23)
- $selected = "selected=\"selected\"";
- else
- $selected = "";
-
- echo "<option value=\"$i\" $selected>";
- echo $i;
- echo "</option>";
- }
- ?>
- </select>&nbsp;<?=gettext("Hr");?>&nbsp;&nbsp;
- <select name="stoptimemin" class="formselect" id="stoptimemin">
- <option value="00">00</option>
- <option value="15">15</option>
- <option value="30">30</option>
- <option value="45">45</option>
- <option value="59" selected="selected">59</option>
- </select>&nbsp;<?=gettext("Min");?>
- </td>
- </tr>
- </table><br />
- <?=gettext("Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59.")?>
- </td>
- </tr>
- <tr>
- <td width="15%" valign="top" class="vncell"><?=gettext("Time Range Description")?></td>
- <td width="85%" class="vtable"><input name="timerangedescr" type="text" class="formfld unknown" id="timerangedescr" size="40" maxlength="40" /><br />
- <span class="vexpl">
- <?=gettext("You may enter a description here for your reference (not parsed).")?>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input type="button" value="<?=gettext("Add Time");?>" class="formbtn" onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
- <input type="button" value="<?=gettext("Clear Selection");?>" class="formbtn" onclick="javascript:clearCalendar(); clearTime(); clearDescr();" />
- </td>
- </tr>
- <tr>
- <td width="15%" valign="top" class="vtable"></td>
- <td width="85%" class="vtable">
- </td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule repeat");?></td>
- </tr>
- <tr>
- <td width="15%" valign="top" class="vncellreq"><?=gettext("Configured Ranges");?></td>
- <td width="85%">
- <table id="scheduletable" summary="range">
- <tbody>
+ <?=gettext("Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday.");?>
+ </td>
+ </tr>
+ <tr>
+ <td width="15%" valign="top" class="vncellreq"><?=gettext("Time");?></td>
+ <td width="85%" class="vtable">
+ <table cellspacing="2" class="tabcont" summary="time">
<tr>
- <td align="center" class="listbg" width="35%"><?=gettext("Day(s)");?></td>
- <td align="center" class="listbg" width="12%"><?=gettext("Start Time");?></td>
- <td align="center" class="listbg" width="11%"><?=gettext("Stop Time");?></td>
- <td align="center" class="listbg" width="42%"><?=gettext("Description");?></td>
+ <td class="listhdrr" align="center"><?=gettext("Start Time");?></td><td></td><td class="listhdrr" align="center"><?=gettext("Stop Time");?></td>
</tr>
- <?php
- if ($getSchedule){
- $counter = 0;
-
- foreach($pconfig['timerange'] as $timerange) {
- $tempFriendlyTime = "";
- $tempID = "";
- if ($timerange){
- $dayFriendly = "";
- $tempFriendlyTime = "";
- $timedescr = $timerange['rangedescr'];
-
- //get hours
- $temptimerange = $timerange['hour'];
- $temptimeseparator = strrpos($temptimerange, "-");
-
- $starttime = substr ($temptimerange, 0, $temptimeseparator);
- $stoptime = substr ($temptimerange, $temptimeseparator+1);
- $currentDay = "";
- $firstDay = "";
- $nextDay = "";
- $foundEnd = false;
- $firstDayFound = false;
- $firstPrint = false;
- $firstprint2 = false;
-
- if ($timerange['month']){
- $tempmontharray = explode(",", $timerange['month']);
- $tempdayarray = explode(",",$timerange['day']);
- $arraycounter = 0;
- foreach ($tempmontharray as $monthtmp){
- $month = $tempmontharray[$arraycounter];
- $day = $tempdayarray[$arraycounter];
- $daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y")));
- //if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this.
- if ($daypos == 0){
- $daypos = 7;
- }
- $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y")));
- $weeknumber = ltrim($weeknumber, "0");
-
- if ($firstPrint)
- {
- $tempID .= ",";
- }
- $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day;
- $firstPrint = true;
-
- if (!$firstDayFound)
- {
- $firstDay = $day;
- $firstmonth = $month;
- $firstDayFound = true;
- }
-
- $currentDay = $day;
- $nextDay = $tempdayarray[$arraycounter+1];
- $currentDay++;
- if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
- if ($firstprint2)
- $tempFriendlyTime .= ", ";
- $currentDay--;
- if ($currentDay != $firstDay)
- $tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
- else
- $tempFriendlyTime .= $monthArray[$month-1] . " " . $day;
- $firstDayFound = false;
- $firstprint2 = true;
- }
- $arraycounter++;
- }
-
+ <tr>
+ <td>
+ <select name="starttimehour" class="formselect" id="starttimehour">
+ <?php
+ for ($i=0; $i<24; $i++) {
+ echo "<option value=\"$i\">";
+ echo $i;
+ echo "</option>";
+ }
+ ?>
+ </select>&nbsp;<?=gettext("Hr"); ?>&nbsp;&nbsp;
+ <select name="starttimemin" class="formselect" id="starttimemin">
+ <option value="00">00</option>
+ <option value="15">15</option>
+ <option value="30">30</option>
+ <option value="45">45</option>
+ <option value="59">59</option>
+ </select>&nbsp;<?=gettext("Min"); ?>
+ </td>
+ <td></td>
+ <td>
+ <select name="stoptimehour" class="formselect" id="stoptimehour">
+ <?php
+ for ($i=0; $i<24; $i++) {
+ if ($i==23) {
+ $selected = "selected=\"selected\"";
+ } else {
+ $selected = "";
+ }
+
+ echo "<option value=\"$i\" $selected>";
+ echo $i;
+ echo "</option>";
}
- else
- {
- $dayFriendly = $timerange['position'];
- $tempID = $dayFriendly;
- }
-
- $tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr;
-
- //following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
- $foundEnd = false;
- $firstDayFound = false;
- $firstprint = false;
- $tempFriendlyDayArray = explode(",", $dayFriendly);
- $currentDay = "";
- $firstDay = "";
- $nextDay = "";
- $i = 0;
- if (!$timerange['month']){
- foreach ($tempFriendlyDayArray as $day){
- if ($day != ""){
- if (!$firstDayFound)
- {
- $firstDay = $tempFriendlyDayArray[$i];
+ ?>
+ </select>&nbsp;<?=gettext("Hr");?>&nbsp;&nbsp;
+ <select name="stoptimemin" class="formselect" id="stoptimemin">
+ <option value="00">00</option>
+ <option value="15">15</option>
+ <option value="30">30</option>
+ <option value="45">45</option>
+ <option value="59" selected="selected">59</option>
+ </select>&nbsp;<?=gettext("Min");?>
+ </td>
+ </tr>
+ </table>
+ <br />
+ <?=gettext("Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59.")?>
+ </td>
+ </tr>
+ <tr>
+ <td width="15%" valign="top" class="vncell"><?=gettext("Time Range Description")?></td>
+ <td width="85%" class="vtable"><input name="timerangedescr" type="text" class="formfld unknown" id="timerangedescr" size="40" maxlength="40" /><br />
+ <span class="vexpl">
+ <?=gettext("You may enter a description here for your reference (not parsed).")?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input type="button" value="<?=gettext("Add Time");?>" class="formbtn" onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
+ <input type="button" value="<?=gettext("Clear Selection");?>" class="formbtn" onclick="javascript:clearCalendar(); clearTime(); clearDescr();" />
+ </td>
+ </tr>
+ <tr>
+ <td width="15%" valign="top" class="vtable"></td>
+ <td width="85%" class="vtable"></td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule repeat");?></td>
+ </tr>
+ <tr>
+ <td width="15%" valign="top" class="vncellreq"><?=gettext("Configured Ranges");?></td>
+ <td width="85%">
+ <table id="scheduletable" summary="range">
+ <tbody>
+ <tr>
+ <td align="center" class="listbg" width="35%"><?=gettext("Day(s)");?></td>
+ <td align="center" class="listbg" width="12%"><?=gettext("Start Time");?></td>
+ <td align="center" class="listbg" width="11%"><?=gettext("Stop Time");?></td>
+ <td align="center" class="listbg" width="42%"><?=gettext("Description");?></td>
+ </tr>
+ <?php
+ if ($getSchedule) {
+ $counter = 0;
+
+ foreach ($pconfig['timerange'] as $timerange) {
+ $tempFriendlyTime = "";
+ $tempID = "";
+ if ($timerange) {
+ $dayFriendly = "";
+ $tempFriendlyTime = "";
+ $timedescr = $timerange['rangedescr'];
+
+ //get hours
+ $temptimerange = $timerange['hour'];
+ $temptimeseparator = strrpos($temptimerange, "-");
+
+ $starttime = substr ($temptimerange, 0, $temptimeseparator);
+ $stoptime = substr ($temptimerange, $temptimeseparator+1);
+ $currentDay = "";
+ $firstDay = "";
+ $nextDay = "";
+ $foundEnd = false;
+ $firstDayFound = false;
+ $firstPrint = false;
+ $firstprint2 = false;
+
+ if ($timerange['month']) {
+ $tempmontharray = explode(",", $timerange['month']);
+ $tempdayarray = explode(",",$timerange['day']);
+ $arraycounter = 0;
+ foreach ($tempmontharray as $monthtmp) {
+ $month = $tempmontharray[$arraycounter];
+ $day = $tempdayarray[$arraycounter];
+ $daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y")));
+ //if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this.
+ if ($daypos == 0) {
+ $daypos = 7;
+ }
+ $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y")));
+ $weeknumber = ltrim($weeknumber, "0");
+
+ if ($firstPrint) {
+ $tempID .= ",";
+ }
+ $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day;
+ $firstPrint = true;
+
+ if (!$firstDayFound) {
+ $firstDay = $day;
+ $firstmonth = $month;
$firstDayFound = true;
}
- $currentDay =$tempFriendlyDayArray[$i];
- //get next day
- $nextDay = $tempFriendlyDayArray[$i+1];
- $currentDay++;
- if ($currentDay != $nextDay){
- if ($firstprint)
+
+ $currentDay = $day;
+ $nextDay = $tempdayarray[$arraycounter+1];
+ $currentDay++;
+ if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) {
+ if ($firstprint2) {
$tempFriendlyTime .= ", ";
+ }
$currentDay--;
- if ($currentDay != $firstDay)
- $tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
- else
- $tempFriendlyTime .= $dayArray[$firstDay-1];
- $firstDayFound = false;
- $firstprint = true;
+ if ($currentDay != $firstDay) {
+ $tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
+ } else {
+ $tempFriendlyTime .= $monthArray[$month-1] . " " . $day;
+ }
+ $firstDayFound = false;
+ $firstprint2 = true;
}
- $i++;
+ $arraycounter++;
}
- }
- }
-
-
+ } else {
+ $dayFriendly = $timerange['position'];
+ $tempID = $dayFriendly;
+ }
+
+ $tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr;
+
+ //following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
+ $foundEnd = false;
+ $firstDayFound = false;
+ $firstprint = false;
+ $tempFriendlyDayArray = explode(",", $dayFriendly);
+ $currentDay = "";
+ $firstDay = "";
+ $nextDay = "";
+ $i = 0;
+ if (!$timerange['month']) {
+ foreach ($tempFriendlyDayArray as $day) {
+ if ($day != "") {
+ if (!$firstDayFound) {
+ $firstDay = $tempFriendlyDayArray[$i];
+ $firstDayFound = true;
+ }
+ $currentDay =$tempFriendlyDayArray[$i];
+ //get next day
+ $nextDay = $tempFriendlyDayArray[$i+1];
+ $currentDay++;
+ if ($currentDay != $nextDay) {
+ if ($firstprint) {
+ $tempFriendlyTime .= ", ";
+ }
+ $currentDay--;
+ if ($currentDay != $firstDay) {
+ $tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
+ } else {
+ $tempFriendlyTime .= $dayArray[$firstDay-1];
+ }
+ $firstDayFound = false;
+ $firstprint = true;
+ }
+ $i++;
+ }
+ }
+ }
?>
- <tr>
- <td>
- <span class="vexpl"><?php echo $tempFriendlyTime; ?></span>
- </td>
- <td>
- <input type='text' readonly='readonly' class='vexpl' name='starttime<?php echo $counter; ?>' id='starttime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $starttime; ?>' />
- </td>
- <td>
- <input type='text' readonly='readonly' class='vexpl' name='stoptime<?php echo $counter; ?>' id='stoptime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $stoptime; ?>' />
- </td>
- <td>
- <input type='text' readonly='readonly' class='vexpl' name='timedescr<?php echo $counter; ?>' id='timedescr<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $timedescr; ?>' />
- </td>
- <td>
- <a onclick='editRow("<?php echo $tempTime; ?>",this); return false;' href='#'><img border='0' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_e.gif' alt='edit' /></a>
- </td>
- <td>
- <a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif' alt='remove' /></a>
- </td>
- <td>
- <input type='hidden' id='schedule<?php echo $counter; ?>' name='schedule<?php echo $counter; ?>' value='<?php echo $tempID; ?>' />
- </td>
- </tr>
+ <tr>
+ <td>
+ <span class="vexpl"><?php echo $tempFriendlyTime; ?></span>
+ </td>
+ <td>
+ <input type='text' readonly='readonly' class='vexpl' name='starttime<?php echo $counter; ?>' id='starttime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $starttime; ?>' />
+ </td>
+ <td>
+ <input type='text' readonly='readonly' class='vexpl' name='stoptime<?php echo $counter; ?>' id='stoptime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $stoptime; ?>' />
+ </td>
+ <td>
+ <input type='text' readonly='readonly' class='vexpl' name='timedescr<?php echo $counter; ?>' id='timedescr<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $timedescr; ?>' />
+ </td>
+ <td>
+ <a onclick='editRow("<?php echo $tempTime; ?>",this); return false;' href='#'><img border='0' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_e.gif' alt='edit' /></a>
+ </td>
+ <td>
+ <a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif' alt='remove' /></a>
+ </td>
+ <td>
+ <input type='hidden' id='schedule<?php echo $counter; ?>' name='schedule<?php echo $counter; ?>' value='<?php echo $tempID; ?>' />
+ </td>
+ </tr>
<?php
- $counter++;
- }//end if
- } // end foreach
- }//end if
- ?>
- </tbody>
- </table>
- </td>
- </tr>
- <tr>
- <td width="15%" valign="top">&nbsp;</td>
- <td width="85%">
- <input id="submit" name="submit" type="submit" onclick="return checkForRanges();" class="formbtn" value="<?=gettext("Save"); ?>" />
- <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
- <?php if (isset($id) && $a_schedules[$id]): ?>
- <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
- <?php endif; ?>
- </td>
- </tr>
- </table>
-
-</td></tr></table></form>
+ $counter++;
+ }//end if
+ } // end foreach
+ }//end if
+ ?>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="15%" valign="top">&nbsp;</td>
+ <td width="85%">
+ <input id="submit" name="submit" type="submit" onclick="return checkForRanges();" class="formbtn" value="<?=gettext("Save"); ?>" />
+ <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
+ <?php if (isset($id) && $a_schedules[$id]): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</form>
<?php include("fend.inc"); ?>
</body>
</html>
OpenPOWER on IntegriCloud