diff options
author | Scott Dale <sdale@pfsense.org> | 2007-04-17 18:51:47 +0000 |
---|---|---|
committer | Scott Dale <sdale@pfsense.org> | 2007-04-17 18:51:47 +0000 |
commit | 2a113ca9fce8725cd7c6ad236cfe26e9c5819953 (patch) | |
tree | fdcd84ec0443fc37d8547ada759419e309c66e3b /usr/local | |
parent | f89e550c3a1b0a68ecf257bf549419f45108a88f (diff) | |
download | pfsense-2a113ca9fce8725cd7c6ad236cfe26e9c5819953.zip pfsense-2a113ca9fce8725cd7c6ad236cfe26e9c5819953.tar.gz |
Schedule popup on firewall page, stop min 0>00
MFC: asap
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/firewall_rules.php | 110 | ||||
-rw-r--r-- | usr/local/www/firewall_schedule.php | 1 | ||||
-rw-r--r-- | usr/local/www/firewall_schedule_edit.php | 17 |
3 files changed, 117 insertions, 11 deletions
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 3e31b01..fde4826 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -331,6 +331,7 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript <?php endif; ?> </td> <?php + //build Alias popup box $span_begin = ""; $span_end = ""; $alias_src_span_begin = ""; @@ -384,6 +385,113 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript $alias_dst_port_span_end = $span_end; } } + + //build Schedule popup box + $a_schedules = &$config['schedules']['schedule']; + $schedule_span_begin = ""; + $schedule_span_end = ""; + $sched_caption = ""; + $dayArray = array ('Mon','Tues','Wed','Thur','Fri','Sat','Sun'); + $monthArray = array ('January','February','March','April','May','June','July','August','September','October','November','December'); + foreach ($a_schedules as $schedule) + { + if ($schedule['name'] == $filterent['sched'] ){ + foreach($schedule['timerange'] as $timerange) { + $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 .= ", "; + $currentDay--; + if ($currentDay != $firstDay) + $dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ; + else + $dayFriendly .= $monthArray[$month-1] . " " . $day; + $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; + } + $currentDay =$tempFriendlyDayArray[$counter]; + //get next day + $nextDay = $tempFriendlyDayArray[$counter+1]; + $currentDay++; + if ($currentDay != $nextDay){ + if ($firstprint) + $dayFriendly .= ", "; + $currentDay--; + if ($currentDay != $firstDay) + $dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; + else + $dayFriendly .= $dayArray[$firstDay-1]; + $firstDayFound = false; + $firstprint = true; + } + $counter++; + } + } + } + $timeFriendly = $starttime . " - " . $stoptime; + $description = $timerange['rangedescr']; + $sched_content .= $dayFriendly . "; " . $timeFriendly . "<br>"; + + } + } + $sched_caption = $schedule['descr']; + $schedule_span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$sched_caption</h1><p>$sched_content</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>"; + $schedule_span_end = "</U></span>"; + } + } + ?> <td class="listlr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> <?=$textss;?><?php if (isset($filterent['protocol'])) echo strtoupper($filterent['protocol']); else echo "*"; ?><?=$textse;?> @@ -404,7 +512,7 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript <?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?> </td> <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black"> - <?=$textss;?><?=htmlspecialchars($filterent['sched']);?> <?=$textse;?> + <?=$textss;?><?php echo $schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?><?php echo $schedule_span_end; ?> <?=$textse;?> </td> <td class="listbg" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" bcolor="#990000"><font color="white"> <?=$textss;?><?=htmlspecialchars($filterent['descr']);?> <?=$textse;?> diff --git a/usr/local/www/firewall_schedule.php b/usr/local/www/firewall_schedule.php index 89e309c..7bd2a24 100644 --- a/usr/local/www/firewall_schedule.php +++ b/usr/local/www/firewall_schedule.php @@ -105,7 +105,6 @@ include("head.inc"); if ($timerange){ $dayFriendly = ""; $tempFriendlyTime = ""; - $daytimeseparator = strrpos($timerange, ","); //get hours $temptimerange = $timerange['hour']; diff --git a/usr/local/www/firewall_schedule_edit.php b/usr/local/www/firewall_schedule_edit.php index d89a8bf..a187723 100644 --- a/usr/local/www/firewall_schedule_edit.php +++ b/usr/local/www/firewall_schedule_edit.php @@ -579,15 +579,15 @@ function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimeh tr.appendChild(td); td = d.createElement("td"); - td.innerHTML="<input type='text' readonly class='formfld' name='starttime" + schCounter + "' id='starttime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + starttimehour + ":" + starttimemin + "'>"; + 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='formfld' name='stoptime" + schCounter + "' id='stoptime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + stoptimehour + ":" + stoptimemin + "'>"; + 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='formfld' name='timedescr" + schCounter + "' id='timedescr" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + tempdescr + "'>"; + 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"); @@ -920,7 +920,7 @@ EOD; ?> </select> Hr <select name="stoptimemin" class="formfld" id="stoptimemin"> - <option value="0">0</option> + <option value="00">00</option> <option value="15">15</option> <option value="30">30</option> <option value="45">45</option> @@ -974,8 +974,7 @@ EOD; if ($timerange){ $dayFriendly = ""; $tempFriendlyTime = ""; - $timedescr = $timerange['rangedescr']; - $daytimeseparator = strrpos($timerange, ","); + $timedescr = $timerange['rangedescr']; //get hours $temptimerange = $timerange['hour']; @@ -1090,13 +1089,13 @@ EOD; <span class="vexpl"><?php echo $tempFriendlyTime; ?><span> </td> <td> - <input type='text' readonly class='formfld' name='starttime<?php echo $counter; ?>' id='starttime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $starttime; ?>'> + <input type='text' 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 class='formfld' name='stoptime<?php echo $counter; ?>' id='stoptime<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $stoptime; ?>'> + <input type='text' 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 class='formfld' name='timedescr<?php echo $counter; ?>' id='timedescr<?php echo $counter; ?>' style=' word-wrap:break-word; width:100%; border:0px solid;' value='<?php echo $timedescr; ?>'> + <input type='text' 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> <input type='image' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_e.gif' onclick='editRow("<?php echo $tempTime; ?>",this); return false;' value='Edit'> |