Project

General

Profile

Download (39.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	firewall_schedule_edit.php
4
	Copyright (C) 2004 Scott Ullrich
5
	All rights reserved.
6

    
7
	originially part of m0n0wall (http://m0n0.ch/wall)
8
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
9
	All rights reserved.
10

    
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13

    
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16

    
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20

    
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/*
33
	pfSense_MODULE:	schedules
34
*/
35

    
36
##|+PRIV
37
##|*IDENT=page-firewall-schedules-edit
38
##|*NAME=Firewall: Schedules: Edit page
39
##|*DESCR=Allow access to the 'Firewall: Schedules: Edit' page.
40
##|*MATCH=firewall_schedule_edit.php*
41
##|-PRIV
42

    
43
function schedulecmp($a, $b) {
44
	return strcmp($a['name'], $b['name']);
45
}
46

    
47
function schedule_sort(){
48
        global $g, $config;
49

    
50
        if (!is_array($config['schedules']['schedule']))
51
                return;
52

    
53
        usort($config['schedules']['schedule'], "schedulecmp");
54
}
55

    
56
require("guiconfig.inc");
57
require_once("functions.inc");
58
require_once("filter.inc");
59
require_once("shaper.inc");
60

    
61
$pgtitle = array(gettext("Firewall"),gettext("Schedules"),gettext("Edit"));
62

    
63
$starttimehr = 00;
64
$starttimemin = 00;
65

    
66
$stoptimehr = 23;
67
$stoptimemin = 59;
68

    
69
$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
70
$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'));
71

    
72
if (!is_array($config['schedules']['schedule']))
73
	$config['schedules']['schedule'] = array();
74

    
75
$a_schedules = &$config['schedules']['schedule'];
76

    
77
if (is_numericint($_GET['id']))
78
	$id = $_GET['id'];
79
if (isset($_POST['id']) && is_numericint($_POST['id']))
80
	$id = $_POST['id'];
81

    
82
if (isset($id) && $a_schedules[$id]) {
83
	$pconfig['name'] = $a_schedules[$id]['name'];
84
	$pconfig['descr'] = html_entity_decode($a_schedules[$id]['descr']);
85
	$pconfig['timerange'] = $a_schedules[$id]['timerange'];
86
	$pconfig['schedlabel'] = $a_schedules[$id]['schedlabel'];
87
	$getSchedule = true;
88
}
89

    
90
if ($_POST) {
91
	
92
	if(strtolower($_POST['name']) == "lan")
93
		$input_errors[] = gettext("Schedule may not be named LAN.");
94
	if(strtolower($_POST['name']) == "wan")
95
		$input_errors[] = gettext("Schedule may not be named WAN.");
96
	if(strtolower($_POST['name']) == "")
97
		$input_errors[] = gettext("Schedule name cannot be blank.");
98

    
99
	$x = is_validaliasname($_POST['name']);
100
	if (!isset($x)) {
101
		$input_errors[] = gettext("Reserved word used for schedule name.");
102
	} else {
103
		if (is_validaliasname($_POST['name']) == false)
104
			$input_errors[] = gettext("The schedule name may only consist of the characters a-z, A-Z, 0-9");
105
	}
106
	
107
	/* check for name conflicts */
108
	foreach ($a_schedules as $schedule) {
109
		if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule))
110
			continue;
111

    
112
		if ($schedule['name'] == $_POST['name']) {
113
			$input_errors[] = gettext("A Schedule with this name already exists.");
114
			break;
115
		}
116
	}
117
	$schedule = array();
118
	
119
	$schedule['name'] = $_POST['name'];
120
	$schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');	
121
	
122
	$timerangeFound = false;
123
	for ($x=0; $x<99; $x++){
124
		if($_POST['schedule' . $x]) {
125
			$timerangeFound = true;
126
			$timeparts = array();
127
			$firstprint = false;
128
			$timestr = $_POST['schedule' . $x];
129
			$timehourstr = $_POST['starttime' . $x];
130
			$timehourstr .= "-";
131
			$timehourstr .= $_POST['stoptime' . $x];
132
			$timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8'); 
133
			$dashpos = strpos($timestr, '-');
134
			if ($dashpos === false)
135
			{
136
				$timeparts['position'] = $timestr;
137
			}
138
			else
139
			{
140
				$tempindarray = array();
141
				$monthstr = "";
142
				$daystr = "";
143
				$tempindarray = explode(",", $timestr);
144
				foreach ($tempindarray as $currentselection)
145
				{
146
					if ($currentselection){
147
						if ($firstprint)
148
						{
149
							$monthstr .= ",";
150
							$daystr .= ",";						
151
						}
152
						$tempstr = "";
153
						$monthpos = strpos($currentselection, "m");
154
						$daypos = strpos($currentselection, "d");
155
						$monthstr .= substr($currentselection, $monthpos+1, $daypos-$monthpos-1);
156
						$daystr .=  substr($currentselection, $daypos+1);			
157
						$firstprint = true;
158
					}
159
				}
160
				$timeparts['month'] = $monthstr;
161
				$timeparts['day'] = $daystr;
162
			}			
163
			$timeparts['hour'] = $timehourstr;
164
			$timeparts['rangedescr'] = $timedescrstr;
165
			$schedule['timerange'][$x] = $timeparts;
166
		}
167
	}
168
	
169
	if (!$timerangeFound)
170
		$input_errors[] = gettext("The schedule must have at least one time range configured.");
171
		
172
	if (!$input_errors) {		
173
		
174
		if (!empty($pconfig['schedlabel']))
175
			$schedule['schedlabel'] = $pconfig['schedlabel'];
176
		else
177
			$schedule['schedlabel'] = uniqid();
178

    
179
		if (isset($id) && $a_schedules[$id]){
180
			$a_schedules[$id] = $schedule;
181
		}
182
		else{
183
			$a_schedules[] = $schedule;
184
		}
185
		schedule_sort();
186
		if (write_config())
187
			filter_configure();
188

    
189
		header("Location: firewall_schedule.php");
190
		exit;
191
		
192
	}
193
	//we received input errors, copy data to prevent retype
194
	else
195
	{
196
		if (!$_POST['schedule0'])
197
			$getSchedule = false;
198
		else
199
			$getSchedule = true;
200
		$pconfig['name'] = $schedule['name'];
201
		$pconfig['descr'] = $schedule['descr'];
202
		$pconfig['timerange'] = $schedule['timerange'];
203
	}	
204

    
205
}
206
include("head.inc");
207

    
208
/* put your custom HTML head content here        */
209
/* using some of the $pfSenseHead function calls */
210
$jscriptstr = <<<EOD
211
<script type="text/javascript">
212
//<![CDATA[
213
var daysSelected = "";
214
var month_array = ['January','February','March','April','May','June','July','August','September','October','November','December'];
215
var day_array = ['Mon','Tues','Wed','Thur','Fri','Sat','Sun'];
216
var schCounter = 0;
217

    
218
function rgb2hex(rgb) {
219
	var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
220
	if (parts == null)
221
		return;
222
	function hex(x) {
223
		return ("0" + parseInt(x).toString(16)).slice(-2);
224
	}
225
	return ("#" + hex(parts[1]) + hex(parts[2]) + hex(parts[3])).toUpperCase();
226
}
227

    
228
function repeatExistingDays(){
229
	var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
230
	
231
	var dayarray = daysSelected.split(",");
232
	for (i=0; i<=dayarray.length; i++){
233
		tempstr = dayarray[i];
234
		tempstrdaypos = tempstr.search("p");
235
		week = tempstr.substring(1,tempstrdaypos);
236
		week = parseInt(week);
237
		dashpos = tempstr.search("-");		
238
		daypos = tempstr.substring(tempstrdaypos+1, dashpos);
239
		daypos = parseInt(daypos);
240
		
241
		daydone = dayposdone.search(daypos);
242
		tempstr = 'w' + week + 'p' + daypos;
243
		daycell = eval('document.getElementById(tempstr)');
244
		if (daydone == "-1"){
245
			if (rgb2hex(daycell.style.backgroundColor) == "#F08080")  // lightcoral
246
				daytogglerepeating(week,daypos,true);
247
			else
248
				daytogglerepeating(week,daypos,false);
249
			dayposdone += daypos + ",";
250
		}
251
	}	
252
}
253

    
254
function daytogglerepeating(year,week,daypos,bExists){
255
	var tempstr, daycell, dayoriginal = "";
256
	for (j=1; j<=53; j++)
257
	{						
258
		tempstr = 'y' + year +'w' + j + 'p' + daypos;
259
		daycell = eval('document.getElementById(tempstr)');
260
		dayoriginalpos =  daysSelected.indexOf(tempstr);
261
		
262
		//if bExists set to true, means cell is already select it
263
		//unselect it and remove original day from daysSelected string		
264
	
265
		if (daycell != null)
266
		{
267
			if (bExists){	
268
				daycell.style.backgroundColor = "#FFFFFF";  // white
269
			}
270
			else
271
			{
272
				daycell.style.backgroundColor = "#F08080";  // lightcoral		
273
			}	
274
	
275
			if (dayoriginalpos != "-1")
276
			{						
277
				dayoriginalend = daysSelected.indexOf(',', dayoriginalpos);
278
				tempstr = daysSelected.substring(dayoriginalpos, dayoriginalend+1);
279
				daysSelected = daysSelected.replace(tempstr, "");
280
				
281
			}				
282
		}			
283
	}	
284
}
285

    
286
function daytoggle(id) {
287
	var runrepeat, tempstr = "";
288
	var bFoundValid = false;
289
	
290
	iddashpos = id.search("-");
291

    
292
	var tempstryearpos = id.search("y");
293
	var tempstrweekpos = id.search("w");
294
	var tempstrdaypos = id.search("p");
295

    
296
	var year = id.substring(tempstryearpos + 1,tempstrweekpos);
297
	year = parseInt(year);
298

    
299
	var week = id.substring(tempstrweekpos + 1,tempstrdaypos);
300
	week = parseInt(week);
301
	
302
	if (iddashpos == "-1")
303
	{
304
		idmod = id;
305
		runrepeat = true;
306
		var daypos = id.substr(tempstrdaypos+1);	
307
	}
308
	else
309
	{		
310
		idmod = id.substring(0,iddashpos);
311
		var daypos = id.substring(tempstrdaypos+1,iddashpos);
312
	}
313
	
314
	daypos = parseInt(daypos);
315
	
316
	while (!bFoundValid){
317
		var daycell = document.getElementById(idmod);		
318
	
319
		if (daycell != null){
320
			if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){  // red
321
				daycell.style.backgroundColor = "#FFFFFF";  // white
322
				str = id + ",";
323
				daysSelected = daysSelected.replace(str, "");
324
			}
325
			else if (rgb2hex(daycell.style.backgroundColor) == "#F08080")  // lightcoral
326
			{
327
				daytogglerepeating(year,week,daypos,true);
328
			}
329
			else //color is white cell
330
			{
331
				if (!runrepeat)
332
				{
333
					daycell.style.backgroundColor = "#FF0000";  // red
334
				}
335
				else
336
				{
337
					daycell.style.backgroundColor = "#F08080";  // lightcoral
338
					daytogglerepeating(year,week,daypos,false);								
339
				}
340
				daysSelected += id + ",";
341
			}
342
			bFoundValid = true;
343
		}
344
		else
345
		{
346
			//we found an invalid cell when column was clicked, move up to the next week
347
			week++;
348
			tempstr = "y" + year + "w" + week + "p" + daypos;
349
			idmod = tempstr;			
350
		}
351
	}
352
}
353

    
354
function update_month(){
355
	var indexNum = document.forms[0].monthsel.selectedIndex;
356
	var selected = document.forms[0].monthsel.options[indexNum].text;
357

    
358
	for (i=0; i<=11; i++){
359
		option = document.forms[0].monthsel.options[i].text;
360
		document.popupMonthLayer = eval('document.getElementById (option)');
361
		
362
		if(selected == option) {
363
			document.popupMonthLayer.style.display="block";
364
		}
365
		else
366
			document.popupMonthLayer.style.display="none";
367
	}
368
}
369

    
370
function checkForRanges(){
371
	if (daysSelected != "")
372
	{
373
		alert("You have not saved the specified time range. Please click 'Add Time' button to save the time range.");
374
		return false;
375
	}
376
	else
377
	{
378
		return true;
379
	}
380
}
381

    
382
function processEntries(){
383
	var tempstr, starttimehour, starttimemin, stoptimehour, stoptimemin, errors = "";
384
	var passedValidiation = true;
385
	
386
	//get time specified
387
	starttimehour = parseInt(document.getElementById("starttimehour").value);
388
	starttimemin = parseInt(document.getElementById("starttimemin").value);
389
	stoptimehour = parseInt(document.getElementById("stoptimehour").value);
390
	stoptimemin = parseInt(document.getElementById("stoptimemin").value);
391

    
392

    
393
	//do time checks	
394
	if (starttimehour > stoptimehour)
395
	{
396
		errors = "Error: Start Hour cannot be greater than Stop Hour.";
397
		passedValidiation = false;
398
		
399
	}
400
	else if (starttimehour == stoptimehour)
401
	{
402
		if (starttimemin > stoptimemin){
403
			errors = "Error: Start Minute cannot be greater than Stop Minute.";
404
			passedValidiation = false;
405
		}
406
	}	
407
		
408
	if (passedValidiation){
409
		addTimeRange();
410
	}
411
	else {
412
		if (errors != "")
413
			alert(errors);
414
	}
415
}
416

    
417
function addTimeRange(){
418
	var tempdayarray = daysSelected.split(",");
419
	var tempstr, tempFriendlyDay, starttimehour, starttimemin, stoptimehour, nrtempFriendlyTime, rtempFriendlyTime, nrtempID, rtempID = "";
420
	var stoptimemin, timeRange, tempstrdaypos, week, daypos, day, month, dashpos, nrtempTime, rtempTime, monthstr, daystr = "";
421
	rtempFriendlyTime = "";
422
	nrtempFriendlyTime = "";
423
	nrtempID = "";
424
	rtempID = "";
425
	nrtempTime = "";
426
	rtempTime = "";
427
	tempdayarray.sort();	
428
	rtempFriendlyDay = "";
429
	monthstr = "";
430
	daystr = "";
431
	
432
	//check for existing entries
433
	var findCurrentCounter;
434
	for (u=0; u<99; u++){
435
		findCurrentCounter = document.getElementById("schedule" + u);
436
		if (!findCurrentCounter)
437
		{
438
			schCounter = u;
439
			break;
440
		}
441
	}
442
		
443
	if (daysSelected != ""){
444
		//get days selected
445
		for (i=0; i<tempdayarray.length; i++)
446
		{
447
			tempstr = tempdayarray[i];
448
			if (tempstr != "")
449
			{			
450
				tempstrdaypos = tempstr.search("p");
451
				week = tempstr.substring(1,tempstrdaypos);
452
				week = parseInt(week);
453
				dashpos = tempstr.search("-");			
454
				
455
				if (dashpos != "-1")
456
				{	
457
					var nonrepeatingfound = true;
458
					daypos = tempstr.substring(tempstrdaypos+1, dashpos);
459
					daypos = parseInt(daypos);	
460
					monthpos = tempstr.search("m");	
461
					tempstrdaypos = tempstr.search("d");
462
					month = tempstr.substring(monthpos+1, tempstrdaypos);
463
					month = parseInt(month);
464
					day = tempstr.substring(tempstrdaypos+1);
465
					day = parseInt(day);
466
					monthstr += month + ",";
467
					daystr += day + ",";
468
					nrtempID += tempstr + ",";
469
				}
470
				else
471
				{	
472
					var repeatingfound = true;
473
					daypos = tempstr.substr(tempstrdaypos+1);
474
					daypos = parseInt(daypos);	
475
					rtempFriendlyDay += daypos + ",";
476
					rtempID += daypos + ",";					
477
				}		
478
			}				
479
		}	
480
		
481
		//code below spits out friendly look format for nonrepeating schedules
482
		var foundEnd = false;
483
		var firstDayFound = false;
484
		var firstprint = false;
485
		var tempFriendlyMonthArray = monthstr.split(",");
486
		var tempFriendlyDayArray = daystr.split(",");
487
		var currentDay, firstDay, nextDay, currentMonth, nextMonth, firstDay, firstMonth = "";
488
		for (k=0; k<tempFriendlyMonthArray.length; k++){
489
			tempstr = tempFriendlyMonthArray[k];
490
			if (tempstr != ""){
491
				if (!firstDayFound)
492
				{
493
					firstDay = tempFriendlyDayArray[k];
494
					firstDay = parseInt(firstDay);
495
					firstMonth = tempFriendlyMonthArray[k];
496
					firstMonth = parseInt(firstMonth);
497
					firstDayFound = true;
498
				}
499
				currentDay = tempFriendlyDayArray[k];
500
				currentDay = parseInt(currentDay);
501
				//get next day
502
				nextDay = tempFriendlyDayArray[k+1];
503
				nextDay = parseInt(nextDay);
504
				//get next month
505
				
506
				currentDay++;						
507
				if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])){
508
					if (firstprint)
509
						nrtempFriendlyTime += ", ";
510
					currentDay--;
511
					if (currentDay != firstDay)
512
						nrtempFriendlyTime += month_array[firstMonth-1] + " " + firstDay + "-" + currentDay;
513
					else
514
						nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay; 
515
					firstDayFound = false;	
516
					firstprint = true;			
517
				}
518
			}			
519
		}		
520
		
521
		//code below spits out friendly look format for repeating schedules
522
		foundEnd = false;
523
		firstDayFound = false;
524
		firstprint = false;
525
		tempFriendlyDayArray = rtempFriendlyDay.split(",");
526
		tempFriendlyDayArray.sort();
527
		currentDay, firstDay, nextDay = "";
528
		for (k=0; k<tempFriendlyDayArray.length; k++){
529
			tempstr = tempFriendlyDayArray[k];
530
			if (tempstr != ""){
531
				if (!firstDayFound)
532
				{
533
					firstDay = tempFriendlyDayArray[k];
534
					firstDay = parseInt(firstDay);
535
					firstDayFound = true;
536
				}
537
				currentDay = tempFriendlyDayArray[k];
538
				currentDay = parseInt(currentDay);
539
				//get next day
540
				nextDay = tempFriendlyDayArray[k+1];
541
				nextDay = parseInt(nextDay);
542
				currentDay++;					
543
				if (currentDay != nextDay){
544
					if (firstprint)
545
						rtempFriendlyTime += ", ";
546
					currentDay--;
547
					if (currentDay != firstDay)
548
						rtempFriendlyTime += day_array[firstDay-1] + " - " + day_array[currentDay-1];
549
					else
550
						rtempFriendlyTime += day_array[firstDay-1];
551
					firstDayFound = false;	
552
					firstprint = true;			
553
				}
554
			}
555
		}			
556
		
557
		//sort the tempID
558
		var tempsortArray = rtempID.split(",");
559
		var isFirstdone = false;
560
		tempsortArray.sort();
561
		//clear tempID
562
		rtempID = "";
563
		for (t=0; t<tempsortArray.length; t++)
564
		{
565
			if (tempsortArray[t] != ""){
566
				if (!isFirstdone){
567
					rtempID += tempsortArray[t];
568
					isFirstdone = true;
569
				}
570
				else
571
					rtempID += "," + tempsortArray[t];
572
			}
573
		} 
574
		
575
		 
576
		//get time specified
577
		starttimehour =  document.getElementById("starttimehour").value
578
		starttimemin = document.getElementById("starttimemin").value;
579
		stoptimehour = document.getElementById("stoptimehour").value;
580
		stoptimemin = document.getElementById("stoptimemin").value;
581
		
582
		timeRange = "||" + starttimehour + ":";
583
		timeRange += starttimemin + "-";
584
		timeRange += stoptimehour + ":";	
585
		timeRange += stoptimemin;		
586
				
587
		//get description for time range
588
		var tempdescr = document.getElementById("timerangedescr").value		
589
		
590
		if (nonrepeatingfound){
591
			nrtempTime += nrtempID;
592
			//add time ranges
593
			nrtempTime += timeRange;			
594
			//add description
595
			nrtempTime += "||" + tempdescr;
596
			insertElements(nrtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, nrtempTime, nrtempID);
597
		}
598
		
599
		if (repeatingfound){
600
			rtempTime += rtempID;
601
			//add time ranges
602
			rtempTime += timeRange;
603
			//add description
604
			rtempTime += "||" + tempdescr;
605
			insertElements(rtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, rtempTime, rtempID);
606
		}
607
		
608
	}
609
	else
610
	{
611
		//no days were selected, alert user
612
		alert ("You must select at least 1 day before adding time");
613
	}
614
}
615

    
616
function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, tempTime, tempID){
617
	
618
		//add it to the schedule list
619
		d = document;
620
		tbody = d.getElementById("scheduletable").getElementsByTagName("tbody").item(0);
621
		tr = d.createElement("tr");
622
		td = d.createElement("td");
623
		td.innerHTML= "<span class='vexpl'>" + tempFriendlyTime + "<\/span>";
624
		tr.appendChild(td);	
625
			
626
		td = d.createElement("td");
627
		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 + "' />";
628
		tr.appendChild(td);
629
		
630
		td = d.createElement("td");
631
		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 + "' />";
632
		tr.appendChild(td);
633
		
634
		td = d.createElement("td");
635
		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 + "' />";
636
		tr.appendChild(td);
637
		
638
		td = d.createElement("td");
639
		td.innerHTML = "<a onclick='editRow(\"" + tempTime + "\",this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_e.gif' alt='edit' /></\a>";
640
		tr.appendChild(td);
641
			
642
		td = d.createElement("td");
643
		td.innerHTML = "<a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_x.gif' alt='remove' /></\a>";
644
		tr.appendChild(td);
645
		
646
		td = d.createElement("td");		
647
		td.innerHTML="<input type='hidden' id='schedule" + schCounter + "' name='schedule" + schCounter + "' value='" + tempID + "' />";		
648
		tr.appendChild(td);
649
		tbody.appendChild(tr);
650
		
651
		schCounter++;
652
		
653
		//reset calendar and time and descr
654
		clearCalendar();
655
		clearTime();
656
		clearDescr();
657
}
658

    
659

    
660
function clearCalendar(){
661
	var tempstr, daycell = "";
662
	//clear days selected
663
	daysSelected = "";
664
	//loop through all 52 weeks
665
	for (j=1; j<=53; j++)
666
	{
667
		//loop through all 7 days
668
		for (k=1; k<8; k++){
669
			tempstr = 'w' + j + 'p' + k;
670
			daycell = eval('document.getElementById(tempstr)');
671
			if (daycell != null){
672
				daycell.style.backgroundColor = "#FFFFFF";  // white	
673
			}	
674
		}
675
	}	
676
}
677

    
678
function clearTime(){
679
	document.getElementById("starttimehour").value = $starttimehr;
680
	document.getElementById("starttimemin").value = $starttimemin;
681
	document.getElementById("stoptimehour").value = $stoptimehr;
682
	document.getElementById("stoptimemin").value = $stoptimemin;
683
}
684

    
685
function clearDescr(){
686
	document.getElementById("timerangedescr").value = "";
687
}
688

    
689
function editRow(incTime, el) {
690
	var check = checkForRanges();
691
	
692
	if (check){  
693
		
694
		//reset calendar and time
695
		clearCalendar();
696
		clearTime();
697
		
698
		var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = ""; 
699
		
700
		tempArray = incTime.split ("||");
701
		
702
		days = tempArray[0];
703
		hours = tempArray[1];
704
		descr = tempArray[2];
705
		
706
		var tempdayArray = days.split(",");
707
		var temphourArray = hours.split("-");
708
		tempstr = temphourArray[0];
709
		var temphourArray2 = tempstr.split(":");
710
	
711
		document.getElementById("starttimehour").value = temphourArray2[0];
712
		document.getElementById("starttimemin").value = temphourArray2[1];	
713
		
714
		tempstr = temphourArray[1];
715
		temphourArray2 = tempstr.split(":");
716
		
717
		document.getElementById("stoptimehour").value = temphourArray2[0];
718
		document.getElementById("stoptimemin").value = temphourArray2[1];
719
		
720
		document.getElementById("timerangedescr").value = descr;
721
	
722
		//toggle the appropriate days
723
		for (i=0; i<tempdayArray.length; i++)
724
		{
725
			if (tempdayArray[i]){
726
				var tempweekstr = tempdayArray[i];
727
				dashpos = tempweekstr.search("-");			
728
						
729
				if (dashpos == "-1")
730
				{
731
					tempstr = "w2p" + tempdayArray[i];
732
				}
733
				else
734
				{
735
					tempstr = tempdayArray[i];
736
				}
737
				daytoggle(tempstr);
738
			}
739
		}
740
		removeRownoprompt(el);
741
	}
742
}
743

    
744
function removeRownoprompt(el) {
745
    var cel;
746
    while (el && el.nodeName.toLowerCase() != "tr")
747
	    el = el.parentNode;
748

    
749
    if (el && el.parentNode) {
750
	cel = el.getElementsByTagName("td").item(0);
751
	el.parentNode.removeChild(el);
752
    }
753
}
754

    
755

    
756
function removeRow(el) {
757
	var check = confirm ("Do you really want to delete this time range?");
758
	if (check){
759
	    var cel;
760
	    while (el && el.nodeName.toLowerCase() != "tr")
761
		    el = el.parentNode;
762
	
763
	    if (el && el.parentNode) {
764
		cel = el.getElementsByTagName("td").item(0);
765
		el.parentNode.removeChild(el);
766
	    }
767
	}
768
}
769
//]]>
770
</script>
771
EOD;
772
?>
773

    
774
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
775

    
776

    
777
<?php include("fbegin.inc");	echo $jscriptstr; ?>
778
<?php if ($input_errors) print_input_errors($input_errors); ?>
779
<div id="inputerrors"></div>
780

    
781
<form action="firewall_schedule_edit.php" method="post" name="iform" id="iform">
782
	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall schedule">
783
		<tr>
784
			<td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule information");?></td>
785
		</tr>	
786
        <tr>
787
          <td>
788
			  <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
789
               	<tr>
790
				  <td width="15%" valign="top" class="vncellreq"><?=gettext("Schedule Name");?></td>
791
				  <td width="85%" class="vtable">
792
				  <?php if(is_schedule_inuse($pconfig['name']) == true): ?>
793
				  			<input name="name" type="hidden" id="name" size="40"  value="<?=htmlspecialchars($pconfig['name']);?>" />
794
						  <?php echo $pconfig['name']; ?>
795
						      <p>
796
						        <span class="vexpl"><?=gettext("NOTE: This schedule is in use so the name may not be modified!");?></span>
797
						      </p>
798
				<?php else: ?>
799
				  <input name="name" type="text" id="name" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['name']);?>" /><br/>
800
				      	<span class="vexpl">
801
     					   <?=gettext("The name of the alias may only consist of the characters a-z, A-Z and 0-9");?>
802
      					</span>
803
      			<?php endif; ?>   					
804
				  </td>
805
				</tr>
806
				<tr>
807
					<td width="15%" valign="top" class="vncell"><?=gettext("Description");?></td>
808
					<td width="85%" class="vtable"><input name="descr" type="text" id="descr" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['descr']);?>" /><br/>
809
 						<span class="vexpl">
810
				        	<?=gettext("You may enter a description here for your reference (not parsed).");?>
811
				      	</span>
812
				  
813
					</td>
814
				</tr>
815
				<!-- tr>
816
				</tr -->
817
			    <tr>
818
				  <td width="15%" valign="top" class="vncellreq"><?=gettext("Month");?></td>
819
				  <td width="85%" class="vtable">
820
                    <select name="monthsel" class="formselect" id="monthsel" onchange="update_month();">
821
                    	<?php 
822
                    	$monthcounter = date("n");
823
                    	$monthlimit = $monthcounter + 12;
824
                    	$yearcounter = date("Y");
825
                    	for ($k=0; $k<12; $k++){?>	             
826
                    		<option value="<?php echo $monthcounter;?>"><?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></option>
827
                          <?php        	
828
                          if ($monthcounter == 12)
829
							{
830
								$monthcounter = 1;
831
								$yearcounter++;
832
							}
833
							else
834
							{
835
								$monthcounter++;
836
							}	
837
						} ?>      	
838
                    </select><br/><br/>
839
            		<?php
840
            		$firstmonth = TRUE;
841
            		$monthcounter = date("n");
842
            		$yearcounter = date("Y");
843
            		for ($k=0; $k<12; $k++){
844
						$firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
845
						if ($firstdayofmonth == 0)
846
							$firstdayofmonth = 7;
847
							
848
						$daycounter = 1;
849
						//number of day in month
850
						$numberofdays = date("t", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
851
						$firstdayprinted = FALSE;
852
						$lasttr = FALSE;
853
						$positioncounter = 1;//7 for Sun, 1 for Mon, 2 for Tues, etc						
854
						?>	
855
	                        <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";?>">    	
856
		                   	<table border="1" cellspacing="1" cellpadding="1" id="calTable<?=$monthcounter . $yearcounter;?>" class="tabcont" summary="month">
857
								<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>
858
								</tr>
859
								<tr>	
860
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('y<?=$yearcounter;?>w1p1');"><u><b><?=gettext("Mon");?></b></u></td>
861
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('y<?=$yearcounter;?>w1p2');"><u><b><?=gettext("Tue");?></b></u></td>
862
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('y<?=$yearcounter;?>w1p3');"><u><b><?=gettext("Wed");?></b></u></td>
863
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('y<?=$yearcounter;?>w1p4');"><u><b><?=gettext("Thu");?></b></u></td>
864
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('y<?=$yearcounter;?>w1p5');"><u><b><?=gettext("Fri");?></b></u></td>
865
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('y<?=$yearcounter;?>w1p6');"><u><b><?=gettext("Sat");?></b></u></td>
866
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('y<?=$yearcounter;?>w1p7');"><u><b><?=gettext("Sun");?></b></u></td>
867
								</tr>
868
								<?php			
869
								$firstmonth = FALSE;				
870
								while ($daycounter<=$numberofdays){
871
									$weekcounter =  date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
872
									$weekcounter = ltrim($weekcounter, "0");
873
									if ($positioncounter == 1)
874
									{
875
										echo "<tr>";
876
									}											
877
									if ($firstdayofmonth == $positioncounter){?>
878
										<td align="center" style="cursor: pointer;" class="listr" id="y<?=$yearcounter;?>w<?=$weekcounter;?>p<?=$positioncounter;?>" onclick="daytoggle('y<?=$yearcounter;?>w<?=$weekcounter;?>p<?=$positioncounter;?>-m<?=$monthcounter;?>d<?=$daycounter;?>');">
879
										<?php echo $daycounter;
880
										$daycounter++;
881
										$firstdayprinted = TRUE;
882
										echo "</td>";
883
									}
884
									elseif ($firstdayprinted == TRUE && $daycounter <= $numberofdays){?>
885
										<td align="center" style="cursor: pointer;" class="listr" id="y<?=$yearcounter;?>w<?=$weekcounter;?>p<?=$positioncounter;?>" onclick="daytoggle('y<?=$yearcounter;?>w<?=$weekcounter;?>p<?=$positioncounter;?>-m<?=$monthcounter;?>d<?=$daycounter;?>');">
886
										<?php echo $daycounter;
887
										$daycounter++;
888
										echo "</td>";
889
									}
890
									else
891
									{
892
										echo "<td align=\"center\" class=\"listr\"></td>";
893
									}
894
									
895
									if ($positioncounter == 7 || $daycounter > $numberofdays){
896
										$positioncounter = 1;
897
										echo "</tr>";
898
									}
899
									else{
900
										$positioncounter++;
901
									}
902
								
903
								}//end while loop?>	
904
							</table>
905
							</div>
906
					<?php 
907
						
908
						if ($monthcounter == 12)
909
						{
910
							$monthcounter = 1;
911
							$yearcounter++;
912
						}
913
						else
914
						{
915
							$monthcounter++;
916
						}					
917
					} //end for loop
918
					?>
919
							<br/>
920
					<?=gettext("Click individual date to select that date only. Click the appropriate weekday Header to select all occurences of that weekday.");?>
921
	                 </td>
922
				</tr>
923
				<tr>
924
				  <td width="15%" valign="top" class="vncellreq"><?=gettext("Time");?></td>
925
				  <td width="85%" class="vtable">
926
				  	<table cellspacing="2" class="tabcont" summary="time">
927
				  		<tr>
928
				  			<td class="listhdrr" align="center"><?=gettext("Start Time");?></td><td></td><td class="listhdrr" align="center"><?=gettext("Stop Time");?></td>
929
				  		</tr>
930
				  		<tr>
931
				  			<td>
932
				  				<select name="starttimehour" class="formselect" id="starttimehour">
933
				  					<?php 
934
				  						for ($i=0; $i<24; $i++)
935
				  						{				  							
936
				  							echo "<option value=\"$i\">";
937
				  							echo $i;
938
				  							echo "</option>";
939
				  						}
940
				  					?>
941
				  				</select>&nbsp;<?=gettext("Hr"); ?>&nbsp;&nbsp;
942
				  				<select name="starttimemin" class="formselect" id="starttimemin">
943
				  					<option value="00">00</option>
944
				  					<option value="15">15</option>
945
				  					<option value="30">30</option>
946
				  					<option value="45">45</option>
947
				  					<option value="59">59</option>
948
				  				</select>&nbsp;<?=gettext("Min"); ?>
949
				  			</td>
950
				  			<td></td>
951
				  			<td>
952
				  				<select name="stoptimehour" class="formselect" id="stoptimehour">
953
				  				<?php 
954
				  						for ($i=0; $i<24; $i++)
955
				  						{
956
				  							if ($i==23)
957
				  								$selected = "selected=\"selected\"";
958
				  							else
959
				  								$selected = "";
960
				  								
961
				  							echo "<option value=\"$i\" $selected>";
962
				  							echo $i;
963
				  							echo "</option>";
964
				  						}
965
				  					?>
966
				  				</select>&nbsp;<?=gettext("Hr");?>&nbsp;&nbsp;
967
				  				<select name="stoptimemin" class="formselect" id="stoptimemin">
968
				  					<option value="00">00</option>
969
				  					<option value="15">15</option>
970
				  					<option value="30">30</option>
971
				  					<option value="45">45</option>
972
				  					<option value="59" selected="selected">59</option>
973
				  				</select>&nbsp;<?=gettext("Min");?>
974
				  			</td>
975
				  		</tr>
976
				  	</table><br/>
977
                   <?=gettext("Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59.")?>
978
					</td>
979
				</tr>
980
				<tr>
981
					<td width="15%" valign="top" class="vncell"><?=gettext("Time Range Description")?></td>
982
					<td width="85%" class="vtable"><input name="timerangedescr" type="text" class="formfld unknown" id="timerangedescr" size="40" maxlength="40" /><br/>
983
 						<span class="vexpl">
984
				        	<?=gettext("You may enter a description here for your reference (not parsed).")?>
985
				      	</span>     
986
				      </td>					
987
				</tr>
988
				<tr>
989
				  <td width="22%" valign="top">&nbsp;</td>
990
				  <td width="78%">
991
				  	<input type="button" value="<?=gettext("Add Time");?>"  class="formbtn"  onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
992
				  	<input type="button" value="<?=gettext("Clear Selection");?>" class="formbtn" onclick="javascript:clearCalendar(); clearTime(); clearDescr();" />
993
                    </td>
994
				</tr>
995
				<tr>
996
				  <td width="15%" valign="top" class="vtable"></td>
997
				  <td width="85%" class="vtable">
998
                    </td>
999
				</tr>
1000
				<tr>
1001
					<td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule repeat");?></td>
1002
				</tr>	
1003
				<tr>
1004
					<td width="15%" valign="top" class="vncellreq"><?=gettext("Configured Ranges");?></td>
1005
					<td width="85%">
1006
						<table id="scheduletable" summary="range">
1007
							<tbody>
1008
								<tr>
1009
									<td align="center" class="listbg" width="35%"><?=gettext("Day(s)");?></td>
1010
									<td align="center" class="listbg" width="12%"><?=gettext("Start Time");?></td>
1011
									<td align="center" class="listbg" width="11%"><?=gettext("Stop Time");?></td>
1012
									<td align="center" class="listbg" width="42%"><?=gettext("Description");?></td>
1013
								</tr>
1014
								<?php
1015
								if ($getSchedule){
1016
									$counter = 0;
1017
																		
1018
									foreach($pconfig['timerange'] as $timerange) {
1019
										$tempFriendlyTime = "";
1020
										$tempID = "";
1021
										if ($timerange){
1022
											$dayFriendly = "";
1023
											$tempFriendlyTime = "";
1024
											$timedescr = $timerange['rangedescr'];			
1025
												
1026
											//get hours
1027
											$temptimerange = $timerange['hour'];
1028
											$temptimeseparator = strrpos($temptimerange, "-");
1029
											
1030
											$starttime = substr ($temptimerange, 0, $temptimeseparator); 
1031
											$stoptime = substr ($temptimerange, $temptimeseparator+1); 
1032
											$currentDay = "";
1033
											$firstDay = "";
1034
											$nextDay = "";
1035
											$foundEnd = false;
1036
											$firstDayFound = false;
1037
											$firstPrint = false;	
1038
											$firstprint2 = false;
1039
											
1040
											if ($timerange['month']){
1041
												$tempmontharray = explode(",", $timerange['month']);
1042
												$tempdayarray = explode(",",$timerange['day']);
1043
												$arraycounter = 0;
1044
												foreach ($tempmontharray as $monthtmp){
1045
													$month = $tempmontharray[$arraycounter];
1046
													$day = $tempdayarray[$arraycounter];
1047
													$daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y")));
1048
													//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.
1049
													if ($daypos == 0){
1050
														$daypos = 7;
1051
													}									
1052
													$weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y")));
1053
													$weeknumber = ltrim($weeknumber, "0");		
1054
																										
1055
													if ($firstPrint)
1056
													{
1057
														$tempID .= ",";
1058
													}
1059
													$tempID .= "w" . $weeknumber . "p" . $daypos . "-m" .  $month . "d" . $day;
1060
													$firstPrint = true;
1061
													
1062
													if (!$firstDayFound)
1063
													{
1064
														$firstDay = $day;
1065
														$firstmonth = $month;
1066
														$firstDayFound = true;
1067
													}
1068
														
1069
													$currentDay = $day;
1070
													$nextDay = $tempdayarray[$arraycounter+1];
1071
													$currentDay++;
1072
													if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
1073
														if ($firstprint2)
1074
															$tempFriendlyTime .= ", ";
1075
														$currentDay--;
1076
														if ($currentDay != $firstDay)
1077
															$tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
1078
														else
1079
															$tempFriendlyTime .=  $monthArray[$month-1] . " " . $day;
1080
														$firstDayFound = false;	
1081
														$firstprint2 = true;
1082
													}													
1083
													$arraycounter++;			
1084
												}																						
1085
												
1086
											}
1087
											else
1088
											{
1089
												$dayFriendly = $timerange['position'];
1090
												$tempID = $dayFriendly;
1091
											}											
1092
											
1093
											$tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr;
1094
									
1095
											//following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
1096
											$foundEnd = false;
1097
											$firstDayFound = false;
1098
											$firstprint = false;
1099
											$tempFriendlyDayArray = explode(",", $dayFriendly);
1100
											$currentDay = "";
1101
											$firstDay = "";
1102
											$nextDay = "";
1103
											$i = 0;
1104
											if (!$timerange['month']){										
1105
												foreach ($tempFriendlyDayArray as $day){
1106
													if ($day != ""){
1107
														if (!$firstDayFound)
1108
														{
1109
															$firstDay = $tempFriendlyDayArray[$i];
1110
															$firstDayFound = true;
1111
														}
1112
														$currentDay =$tempFriendlyDayArray[$i];
1113
														//get next day
1114
														$nextDay = $tempFriendlyDayArray[$i+1];
1115
														$currentDay++;					
1116
														if ($currentDay != $nextDay){
1117
															if ($firstprint)
1118
																$tempFriendlyTime .= ", ";
1119
															$currentDay--;
1120
															if ($currentDay != $firstDay)
1121
																$tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
1122
															else
1123
																$tempFriendlyTime .= $dayArray[$firstDay-1];
1124
															$firstDayFound = false;	
1125
															$firstprint = true;			
1126
														}
1127
														$i++;
1128
													}
1129
												}		
1130
											}	
1131
												
1132
																																													
1133
									?>
1134
						          <tr>
1135
						          	<td>
1136
						          		<span class="vexpl"><?php echo $tempFriendlyTime; ?></span>
1137
						          	</td>
1138
									<td>
1139
						              <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; ?>' />
1140
							        </td>
1141
						            <td>
1142
						              <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; ?>' /> 
1143
							        </td>
1144
							        <td>
1145
							        	<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; ?>' />
1146
							        </td>
1147
							        <td>
1148
							        	<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>
1149
							        </td>
1150
							        <td>
1151
							        	<a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif' alt='remove' /></a>
1152
							        </td>
1153
							        <td>
1154
							        	<input type='hidden' id='schedule<?php echo $counter; ?>' name='schedule<?php echo $counter; ?>' value='<?php echo $tempID; ?>' />
1155
							        </td>
1156
						          </tr>
1157
									<?php
1158
						        $counter++;
1159
									}//end if						
1160
						        } // end foreach	
1161
								}//end if							
1162
								?>
1163
							</tbody>	
1164
						</table>				
1165
					</td>
1166
				</tr>
1167
			 	<tr>
1168
				    <td width="15%" valign="top">&nbsp;</td>
1169
				    <td width="85%">
1170
				      <input id="submit" name="submit" type="submit" onclick="return checkForRanges();" class="formbtn" value="<?=gettext("Save"); ?>" />
1171
				      <input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="history.back()" />
1172
				      <?php if (isset($id) && $a_schedules[$id]): ?>
1173
				      <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
1174
				      <?php endif; ?>
1175
				    </td>
1176
			  	</tr>
1177
			 </table>
1178
		
1179
</td></tr></table></form>
1180
<?php include("fend.inc"); ?>
1181
</body>
1182
</html>
(72-72/246)