Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
972737ec
Commit
972737ec
authored
Aug 25, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) refactor firewall_schedule_edit.php
parent
9ac2f805
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1052 additions
and
1109 deletions
+1052
-1109
firewall_schedule_edit.php
src/www/firewall_schedule_edit.php
+1052
-1109
No files found.
src/www/firewall_schedule_edit.php
View file @
972737ec
<?php
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004 Scott Ullrich
Copyright (C) 2004 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
*/
*/
require_once
(
"guiconfig.inc"
);
require_once
(
"guiconfig.inc"
);
...
@@ -63,182 +63,158 @@ function is_schedule_inuse($schedule)
...
@@ -63,182 +63,158 @@ function is_schedule_inuse($schedule)
function
schedulecmp
(
$a
,
$b
)
{
function
schedulecmp
(
$a
,
$b
)
{
return
strcmp
(
$a
[
'name'
],
$b
[
'name'
]);
return
strcmp
(
$a
[
'name'
],
$b
[
'name'
]);
}
}
function
schedule_sort
(){
function
schedule_sort
(){
global
$g
,
$config
;
global
$g
,
$config
;
if
(
!
is_array
(
$config
[
'schedules'
][
'schedule'
]))
if
(
!
is_array
(
$config
[
'schedules'
][
'schedule'
]))
return
;
return
;
usort
(
$config
[
'schedules'
][
'schedule'
],
"schedulecmp"
);
usort
(
$config
[
'schedules'
][
'schedule'
],
"schedulecmp"
);
}
}
$pgtitle
=
array
(
gettext
(
"Firewall"
),
gettext
(
"Schedules"
),
gettext
(
"Edit"
));
$referer
=
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
?
$_SERVER
[
'HTTP_REFERER'
]
:
'/firewall_schedule.php'
);
$dayArray
=
array
(
gettext
(
'Mon'
),
gettext
(
'Tues'
),
gettext
(
'Wed'
),
gettext
(
'Thur'
),
gettext
(
'Fri'
),
gettext
(
'Sat'
),
gettext
(
'Sun'
));
$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'
));
$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'
]))
$config
[
'schedules'
][
'schedule'
]
=
array
();
if
(
!
isset
(
$config
[
'schedules'
][
'schedule'
]))
{
$config
[
'schedules'
][
'schedule'
]
=
array
();
}
$a_schedules
=
&
$config
[
'schedules'
][
'schedule'
];
$a_schedules
=
&
$config
[
'schedules'
][
'schedule'
];
if
(
is_numericint
(
$_GET
[
'id'
]))
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
$id
=
$_GET
[
'id'
];
// input record id, if valid
if
(
isset
(
$_POST
[
'id'
])
&&
is_numericint
(
$_POST
[
'id'
]))
if
(
!
empty
(
$_GET
[
'name'
]))
{
$id
=
$_POST
[
'id'
];
foreach
(
$a_schedules
as
$i
=>
$sched
)
{
if
(
$sched
[
'name'
]
==
$_GET
[
'name'
])
{
// quick hack, cleanup follows
$id
=
$i
;
if
(
!
empty
(
$_GET
[
'name'
]))
{
break
;
foreach
(
$a_schedules
as
$i
=>
$sched
)
{
}
if
(
$sched
[
'name'
]
==
$_GET
[
'name'
])
{
}
$id
=
$i
;
}
elseif
(
isset
(
$_GET
[
'dup'
])
&&
isset
(
$a_schedules
[
$_GET
[
'dup'
]]))
{
break
;
$configId
=
$_GET
[
'dup'
];
}
}
elseif
(
isset
(
$_GET
[
'id'
])
&&
isset
(
$a_schedules
[
$_GET
[
'id'
]]))
{
}
$id
=
$_GET
[
'id'
];
}
$configId
=
$id
;
}
$pconfig
[
'name'
]
=
$a_schedules
[
$configId
][
'name'
];
$pconfig
[
'descr'
]
=
$a_schedules
[
$configId
][
'descr'
];
$pconfig
[
'timerange'
]
=
isset
(
$a_schedules
[
$configId
][
'timerange'
])
?
$a_schedules
[
$configId
][
'timerange'
]
:
array
();
$pconfig
[
'schedlabel'
]
=
isset
(
$a_schedules
[
$configId
][
'schedlabel'
])
?
$a_schedules
[
$configId
][
'schedlabel'
]
:
uniqid
();
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
if
(
isset
(
$_POST
[
'id'
])
&&
isset
(
$a_schedules
[
$_POST
[
'id'
]]))
{
$id
=
$_POST
[
'id'
];
}
$pconfig
=
$_POST
;
// validate
if
(
strtolower
(
$pconfig
[
'name'
])
==
"lan"
)
$input_errors
[]
=
gettext
(
"Schedule may not be named LAN."
);
if
(
strtolower
(
$pconfig
[
'name'
])
==
"wan"
)
$input_errors
[]
=
gettext
(
"Schedule may not be named WAN."
);
if
(
strtolower
(
$pconfig
[
'name'
])
==
""
)
$input_errors
[]
=
gettext
(
"Schedule name cannot be blank."
);
$x
=
is_validaliasname
(
$pconfig
[
'name'
]);
if
(
!
isset
(
$x
))
{
$input_errors
[]
=
gettext
(
"Reserved word used for schedule name."
);
}
elseif
(
$x
==
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
$schedId
=>
$schedule
)
{
if
(
$schedId
!=
$id
&&
$schedule
[
'name'
]
==
$pconfig
[
'name'
])
{
$input_errors
[]
=
gettext
(
"A Schedule with this name already exists."
);
break
;
}
}
if
(
isset
(
$id
)
&&
$a_schedules
[
$id
])
{
// parse time ranges
$pconfig
[
'name'
]
=
$a_schedules
[
$id
][
'name'
];
$pconfig
[
'timerange'
]
=
array
();
$pconfig
[
'descr'
]
=
html_entity_decode
(
$a_schedules
[
$id
][
'descr'
]);
$pconfig
[
'timerange'
]
=
$a_schedules
[
$id
][
'timerange'
];
$pconfig
[
'schedlabel'
]
=
$a_schedules
[
$id
][
'schedlabel'
];
$getSchedule
=
true
;
}
if
(
$_POST
)
{
$timerangeFound
=
false
;
for
(
$x
=
0
;
$x
<
99
;
$x
++
){
if
(
strtolower
(
$_POST
[
'name'
])
==
"lan"
)
if
(
$pconfig
[
'schedule'
.
$x
])
{
$input_errors
[]
=
gettext
(
"Schedule may not be named LAN."
);
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$pconfig
[
'starttime'
.
$x
]))
{
if
(
strtolower
(
$_POST
[
'name'
])
==
"wan"
)
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid start time - '%s'"
),
$pconfig
[
'starttime'
.
$x
]);
$input_errors
[]
=
gettext
(
"Schedule may not be named WAN."
);
continue
;
if
(
strtolower
(
$_POST
[
'name'
])
==
""
)
}
$input_errors
[]
=
gettext
(
"Schedule name cannot be blank."
);
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$pconfig
[
'stoptime'
.
$x
]))
{
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid stop time - '%s'"
),
$pconfig
[
'stoptime'
.
$x
]);
$x
=
is_validaliasname
(
$_POST
[
'name'
]);
continue
;
if
(
!
isset
(
$x
))
{
}
$input_errors
[]
=
gettext
(
"Reserved word used for schedule name."
);
$timerangeFound
=
true
;
}
else
{
$timeparts
=
array
();
if
(
is_validaliasname
(
$_POST
[
'name'
])
==
false
)
$firstprint
=
false
;
$input_errors
[]
=
gettext
(
"The schedule name may only consist of the characters a-z, A-Z, 0-9"
);
$timestr
=
$pconfig
[
'schedule'
.
$x
];
}
$timehourstr
=
$pconfig
[
'starttime'
.
$x
];
$timehourstr
.=
"-"
;
/* check for name conflicts */
$timehourstr
.=
$pconfig
[
'stoptime'
.
$x
];
foreach
(
$a_schedules
as
$schedule
)
{
$timedescrstr
=
htmlentities
(
$pconfig
[
'timedescr'
.
$x
],
ENT_QUOTES
,
'UTF-8'
);
if
(
isset
(
$id
)
&&
(
$a_schedules
[
$id
])
&&
(
$a_schedules
[
$id
]
===
$schedule
))
$dashpos
=
strpos
(
$timestr
,
'-'
);
continue
;
if
(
$dashpos
===
false
)
{
$timeparts
[
'position'
]
=
$timestr
;
if
(
$schedule
[
'name'
]
==
$_POST
[
'name'
])
{
}
else
{
$input_errors
[]
=
gettext
(
"A Schedule with this name already exists."
);
$tempindarray
=
array
();
break
;
$monthstr
=
""
;
}
$daystr
=
""
;
}
$tempindarray
=
explode
(
","
,
$timestr
);
$schedule
=
array
();
foreach
(
$tempindarray
as
$currentselection
)
{
if
(
$currentselection
){
$schedule
[
'name'
]
=
$_POST
[
'name'
];
if
(
$firstprint
)
{
$schedule
[
'descr'
]
=
htmlentities
(
$_POST
[
'descr'
],
ENT_QUOTES
,
'UTF-8'
);
$monthstr
.=
","
;
$daystr
.=
","
;
$timerangeFound
=
false
;
}
for
(
$x
=
0
;
$x
<
99
;
$x
++
){
$tempstr
=
""
;
if
(
$_POST
[
'schedule'
.
$x
])
{
$monthpos
=
strpos
(
$currentselection
,
"m"
);
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$_POST
[
'starttime'
.
$x
]))
{
$daypos
=
strpos
(
$currentselection
,
"d"
);
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid start time - '%s'"
),
$_POST
[
'starttime'
.
$x
]);
$monthstr
.=
substr
(
$currentselection
,
$monthpos
+
1
,
$daypos
-
$monthpos
-
1
);
continue
;
$daystr
.=
substr
(
$currentselection
,
$daypos
+
1
);
}
$firstprint
=
true
;
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$_POST
[
'stoptime'
.
$x
]))
{
}
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid stop time - '%s'"
),
$_POST
[
'stoptime'
.
$x
]);
}
continue
;
$timeparts
[
'month'
]
=
$monthstr
;
}
$timeparts
[
'day'
]
=
$daystr
;
$timerangeFound
=
true
;
}
$timeparts
=
array
();
$timeparts
[
'hour'
]
=
$timehourstr
;
$firstprint
=
false
;
$timeparts
[
'rangedescr'
]
=
$timedescrstr
;
$timestr
=
$_POST
[
'schedule'
.
$x
];
$pconfig
[
'timerange'
][
$x
]
=
$timeparts
;
$timehourstr
=
$_POST
[
'starttime'
.
$x
];
}
$timehourstr
.=
"-"
;
}
$timehourstr
.=
$_POST
[
'stoptime'
.
$x
];
$timedescrstr
=
htmlentities
(
$_POST
[
'timedescr'
.
$x
],
ENT_QUOTES
,
'UTF-8'
);
if
(
count
(
$pconfig
[
'timerange'
])
==
0
)
{
$dashpos
=
strpos
(
$timestr
,
'-'
);
$input_errors
[]
=
gettext
(
"The schedule must have at least one time range configured."
);
if
(
$dashpos
===
false
)
}
{
$timeparts
[
'position'
]
=
$timestr
;
}
else
{
$tempindarray
=
array
();
$monthstr
=
""
;
$daystr
=
""
;
$tempindarray
=
explode
(
","
,
$timestr
);
foreach
(
$tempindarray
as
$currentselection
)
{
if
(
$currentselection
){
if
(
$firstprint
)
{
$monthstr
.=
","
;
$daystr
.=
","
;
}
$tempstr
=
""
;
$monthpos
=
strpos
(
$currentselection
,
"m"
);
$daypos
=
strpos
(
$currentselection
,
"d"
);
$monthstr
.=
substr
(
$currentselection
,
$monthpos
+
1
,
$daypos
-
$monthpos
-
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
)
$input_errors
[]
=
gettext
(
"The schedule must have at least one time range configured."
);
if
(
!
$input_errors
)
{
if
(
!
empty
(
$pconfig
[
'schedlabel'
]))
$schedule
[
'schedlabel'
]
=
$pconfig
[
'schedlabel'
];
else
$schedule
[
'schedlabel'
]
=
uniqid
();
if
(
isset
(
$id
)
&&
$a_schedules
[
$id
]){
$a_schedules
[
$id
]
=
$schedule
;
}
else
{
$a_schedules
[]
=
$schedule
;
}
schedule_sort
();
if
(
write_config
())
filter_configure
();
header
(
"Location: firewall_schedule.php"
);
exit
;
}
//we received input errors, copy data to prevent retype
else
{
if
(
!
$_POST
[
'schedule0'
])
$getSchedule
=
false
;
else
$getSchedule
=
true
;
$pconfig
[
'name'
]
=
$schedule
[
'name'
];
$pconfig
[
'descr'
]
=
$schedule
[
'descr'
];
$pconfig
[
'timerange'
]
=
$schedule
[
'timerange'
];
}
if
(
count
(
$input_errors
)
==
0
)
{
$schedule
=
array
();
$schedule
[
'name'
]
=
$pconfig
[
'name'
];
$schedule
[
'descr'
]
=
$pconfig
[
'descr'
];
$schedule
[
'timerange'
]
=
$pconfig
[
'timerange'
];
$schedule
[
'schedlabel'
]
=
$pconfig
[
'schedlabel'
];
if
(
isset
(
$id
))
{
$a_schedules
[
$id
]
=
$schedule
;
}
else
{
$a_schedules
[]
=
$schedule
;
}
schedule_sort
();
if
(
write_config
())
{
filter_configure
();
}
header
(
"Location: firewall_schedule.php"
);
exit
;
}
}
}
include
(
"head.inc"
);
/* put your custom HTML head content here */
/* using some of the new function calls */
$pgtitle
=
array
(
gettext
(
"Firewall"
),
gettext
(
"Schedules"
),
gettext
(
"Edit"
));
$jscriptstr
=
<<<EOD
legacy_html_escape_form_data
(
$pconfig
);
include
(
"head.inc"
);
?>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
//
<!
[
CDATA
[
var
daysSelected
=
""
;
var
daysSelected
=
""
;
...
@@ -247,988 +223,955 @@ var day_array = ['Mon','Tues','Wed','Thur','Fri','Sat','Sun'];
...
@@ -247,988 +223,955 @@ var day_array = ['Mon','Tues','Wed','Thur','Fri','Sat','Sun'];
var
schCounter
=
0
;
var
schCounter
=
0
;
function
rgb2hex
(
rgb
)
{
function
rgb2hex
(
rgb
)
{
var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var
parts
=
rgb
.
match
(
/^rgb
\((\d
+
)
,
\s
*
(\d
+
)
,
\s
*
(\d
+
)\)
$/
);
if (parts == null)
if
(
parts
==
null
)
return;
return
;
function hex(x) {
function
hex
(
x
)
{
return ("0" + parseInt(x).toString(16)).slice(-2);
return
(
"
0
"
+
parseInt
(
x
).
toString
(
16
)).
slice
(
-
2
);
}
}
return ("#" + hex(parts[1]) + hex(parts[2]) + hex(parts[3])).toUpperCase();
return
(
"
#
"
+
hex
(
parts
[
1
])
+
hex
(
parts
[
2
])
+
hex
(
parts
[
3
])).
toUpperCase
();
}
}
function
repeatExistingDays
(){
function
repeatExistingDays
(){
var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
var
tempstr
,
tempstrdaypos
,
week
,
daypos
,
dayposdone
=
""
;
var dayarray = daysSelected.split(",");
var
dayarray
=
daysSelected
.
split
(
"
,
"
);
for (i=0; i<=dayarray.length; i++){
for
(
i
=
0
;
i
<=
dayarray
.
length
;
i
++
){
tempstr = dayarray[i];
tempstr
=
dayarray
[
i
];
tempstrdaypos = tempstr.search("p");
tempstrdaypos
=
tempstr
.
search
(
"
p
"
);
week = tempstr.substring(1,tempstrdaypos);
week
=
tempstr
.
substring
(
1
,
tempstrdaypos
);
week = parseInt(week);
week
=
parseInt
(
week
);
dashpos = tempstr.search("-");
dashpos
=
tempstr
.
search
(
"
-
"
);
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
daypos
=
tempstr
.
substring
(
tempstrdaypos
+
1
,
dashpos
);
daypos = parseInt(daypos);
daypos
=
parseInt
(
daypos
);
daydone = dayposdone.search(daypos);
daydone
=
dayposdone
.
search
(
daypos
);
tempstr = 'w' + week + 'p' + daypos;
tempstr
=
'
w
'
+
week
+
'
p
'
+
daypos
;
daycell = eval('document.getElementById(tempstr)');
daycell
=
eval
(
'
document.getElementById(tempstr)
'
);
if (daydone == "-1"){
if
(
daydone
==
"
-1
"
){
if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral
if
(
rgb2hex
(
daycell
.
style
.
backgroundColor
)
==
"
#F08080
"
)
// lightcoral
daytogglerepeating(week,daypos,true);
daytogglerepeating
(
week
,
daypos
,
true
);
else
else
daytogglerepeating(week,daypos,false);
daytogglerepeating
(
week
,
daypos
,
false
);
dayposdone += daypos + ",";
dayposdone
+=
daypos
+
"
,
"
;
}
}
}
}
}
}
function
daytogglerepeating
(
week
,
daypos
,
bExists
){
function
daytogglerepeating
(
week
,
daypos
,
bExists
){
var tempstr, daycell, dayoriginal = "";
var
tempstr
,
daycell
,
dayoriginal
=
""
;
for (j=1; j<=53; j++)
for
(
j
=
1
;
j
<=
53
;
j
++
)
{
{
tempstr = 'w' + j + 'p' + daypos;
tempstr
=
'
w
'
+
j
+
'
p
'
+
daypos
;
daycell = eval('document.getElementById(tempstr)');
daycell
=
eval
(
'
document.getElementById(tempstr)
'
);
dayoriginalpos = daysSelected.indexOf(tempstr);
dayoriginalpos
=
daysSelected
.
indexOf
(
tempstr
);
//if bExists set to true, means cell is already select it
//if bExists set to true, means cell is already select it
//unselect it and remove original day from daysSelected string
//unselect it and remove original day from daysSelected string
if (daycell != null)
if
(
daycell
!=
null
)
{
{
if (bExists){
if
(
bExists
){
daycell.style.backgroundColor = "#FFFFFF"; // white
daycell
.
style
.
backgroundColor
=
"
#FFFFFF
"
;
// white
}
}
else
else
{
{
daycell.style.backgroundColor = "#F08080"; // lightcoral
daycell
.
style
.
backgroundColor
=
"
#F08080
"
;
// lightcoral
}
}
if (dayoriginalpos != "-1")
if
(
dayoriginalpos
!=
"
-1
"
)
{
{
dayoriginalend = daysSelected.indexOf(',', dayoriginalpos);
dayoriginalend
=
daysSelected
.
indexOf
(
'
,
'
,
dayoriginalpos
);
tempstr = daysSelected.substring(dayoriginalpos, dayoriginalend+1);
tempstr
=
daysSelected
.
substring
(
dayoriginalpos
,
dayoriginalend
+
1
);
daysSelected = daysSelected.replace(tempstr, "");
daysSelected
=
daysSelected
.
replace
(
tempstr
,
""
);
}
}
}
}
}
}
}
}
function
daytoggle
(
id
)
{
function
daytoggle
(
id
)
{
var runrepeat, tempstr = "";
var
runrepeat
,
tempstr
=
""
;
var bFoundValid = false;
var
bFoundValid
=
false
;
iddashpos = id.search("-");
iddashpos
=
id
.
search
(
"
-
"
);
var tempstrdaypos = id.search("p");
var
tempstrdaypos
=
id
.
search
(
"
p
"
);
var week = id.substring(1,tempstrdaypos);
var
week
=
id
.
substring
(
1
,
tempstrdaypos
);
week = parseInt(week);
week
=
parseInt
(
week
);
if (iddashpos == "-1")
if
(
iddashpos
==
"
-1
"
)
{
{
idmod = id;
idmod
=
id
;
runrepeat = true;
runrepeat
=
true
;
var daypos = id.substr(tempstrdaypos+1);
var
daypos
=
id
.
substr
(
tempstrdaypos
+
1
);
}
}
else
else
{
{
idmod = id.substring(0,iddashpos);
idmod
=
id
.
substring
(
0
,
iddashpos
);
var daypos = id.substring(tempstrdaypos+1,iddashpos);
var
daypos
=
id
.
substring
(
tempstrdaypos
+
1
,
iddashpos
);
}
}
daypos = parseInt(daypos);
daypos
=
parseInt
(
daypos
);
while (!bFoundValid){
while
(
!
bFoundValid
){
var daycell = document.getElementById(idmod);
var
daycell
=
document
.
getElementById
(
idmod
);
if (daycell != null){
if
(
daycell
!=
null
){
if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){ // red
if
(
rgb2hex
(
daycell
.
style
.
backgroundColor
)
==
"
#FF0000
"
){
// red
daycell.style.backgroundColor = "#FFFFFF"; // white
daycell
.
style
.
backgroundColor
=
"
#FFFFFF
"
;
// white
str = id + ",";
str
=
id
+
"
,
"
;
daysSelected = daysSelected.replace(str, "");
daysSelected
=
daysSelected
.
replace
(
str
,
""
);
}
}
else if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral
else
if
(
rgb2hex
(
daycell
.
style
.
backgroundColor
)
==
"
#F08080
"
)
// lightcoral
{
{
daytogglerepeating(week,daypos,true);
daytogglerepeating
(
week
,
daypos
,
true
);
}
}
else //color is white cell
else
//color is white cell
{
{
if (!runrepeat)
if
(
!
runrepeat
)
{
{
daycell.style.backgroundColor = "#FF0000"; // red
daycell
.
style
.
backgroundColor
=
"
#FF0000
"
;
// red
}
}
else
else
{
{
daycell.style.backgroundColor = "#F08080"; // lightcoral
daycell
.
style
.
backgroundColor
=
"
#F08080
"
;
// lightcoral
daytogglerepeating(week,daypos,false);
daytogglerepeating
(
week
,
daypos
,
false
);
}
}
daysSelected += id + ",";
daysSelected
+=
id
+
"
,
"
;
}
}
bFoundValid = true;
bFoundValid
=
true
;
}
}
else
else
{
{
//we found an invalid cell when column was clicked, move up to the next week
//we found an invalid cell when column was clicked, move up to the next week
week++;
week
++
;
tempstr = "w" + week + "p" + daypos;
tempstr
=
"
w
"
+
week
+
"
p
"
+
daypos
;
idmod = tempstr;
idmod
=
tempstr
;
}
}
}
}
}
}
function
update_month
(){
function
update_month
(){
var indexNum = document.forms[0]
.monthsel.selectedIndex;
var
indexNum
=
document
.
iform
.
monthsel
.
selectedIndex
;
var selected = document.forms[0]
.monthsel.options[indexNum].text;
var
selected
=
document
.
iform
.
monthsel
.
options
[
indexNum
].
text
;
for (i=0; i<=11; i++){
for
(
i
=
0
;
i
<=
11
;
i
++
){
option = document.forms[0]
.monthsel.options[i].text;
option
=
document
.
iform
.
monthsel
.
options
[
i
].
text
;
document.popupMonthLayer = eval('document.getElementById (option)');
document
.
popupMonthLayer
=
eval
(
'
document.getElementById (option)
'
);
if(selected == option) {
if
(
selected
==
option
)
{
document.popupMonthLayer.style.display="block";
document
.
popupMonthLayer
.
style
.
display
=
"
block
"
;
}
}
else
else
document.popupMonthLayer.style.display="none";
document
.
popupMonthLayer
.
style
.
display
=
"
none
"
;
}
}
}
}
function
checkForRanges
(){
function
checkForRanges
(){
if (daysSelected != "")
if
(
daysSelected
!=
""
)
{
{
alert("You have not saved the specified time range. Please click 'Add Time' button to save the time range.");
alert
(
"
You have not saved the specified time range. Please click 'Add Time' button to save the time range.
"
);
return false;
return
false
;
}
}
else
else
{
{
return true;
return
true
;
}
}
}
}
function
processEntries
(){
function
processEntries
(){
var tempstr, starttimehour, starttimemin, stoptimehour, stoptimemin, errors = "";
var
tempstr
,
starttimehour
,
starttimemin
,
stoptimehour
,
stoptimemin
,
errors
=
""
;
var passedValidiation = true;
var
passedValidiation
=
true
;
//get time specified
//get time specified
starttimehour = parseInt(document.getElementById("starttimehour").value);
starttimehour
=
parseInt
(
document
.
getElementById
(
"
starttimehour
"
).
value
);
starttimemin = parseInt(document.getElementById("starttimemin").value);
starttimemin
=
parseInt
(
document
.
getElementById
(
"
starttimemin
"
).
value
);
stoptimehour = parseInt(document.getElementById("stoptimehour").value);
stoptimehour
=
parseInt
(
document
.
getElementById
(
"
stoptimehour
"
).
value
);
stoptimemin = parseInt(document.getElementById("stoptimemin").value);
stoptimemin
=
parseInt
(
document
.
getElementById
(
"
stoptimemin
"
).
value
);
//do time checks
//do time checks
if (starttimehour > stoptimehour)
if
(
starttimehour
>
stoptimehour
)
{
{
errors = "Error: Start Hour cannot be greater than Stop Hour.";
errors
=
"
Error: Start Hour cannot be greater than Stop Hour.
"
;
passedValidiation = false;
passedValidiation
=
false
;
}
}
else if (starttimehour == stoptimehour)
else
if
(
starttimehour
==
stoptimehour
)
{
{
if (starttimemin > stoptimemin){
if
(
starttimemin
>
stoptimemin
){
errors = "Error: Start Minute cannot be greater than Stop Minute.";
errors
=
"
Error: Start Minute cannot be greater than Stop Minute.
"
;
passedValidiation = false;
passedValidiation
=
false
;
}
}
}
}
if (passedValidiation){
if
(
passedValidiation
){
addTimeRange();
addTimeRange
();
}
}
else {
else
{
if (errors != "")
if
(
errors
!=
""
)
alert(errors);
alert
(
errors
);
}
}
}
}
function
addTimeRange
(){
function
addTimeRange
(){
var tempdayarray = daysSelected.split(",");
var
tempdayarray
=
daysSelected
.
split
(
"
,
"
);
var tempstr, tempFriendlyDay, starttimehour, starttimemin, stoptimehour, nrtempFriendlyTime, rtempFriendlyTime, nrtempID, rtempID = "";
var
tempstr
,
tempFriendlyDay
,
starttimehour
,
starttimemin
,
stoptimehour
,
nrtempFriendlyTime
,
rtempFriendlyTime
,
nrtempID
,
rtempID
=
""
;
var stoptimemin, timeRange, tempstrdaypos, week, daypos, day, month, dashpos, nrtempTime, rtempTime, monthstr, daystr = "";
var
stoptimemin
,
timeRange
,
tempstrdaypos
,
week
,
daypos
,
day
,
month
,
dashpos
,
nrtempTime
,
rtempTime
,
monthstr
,
daystr
=
""
;
rtempFriendlyTime = "";
rtempFriendlyTime
=
""
;
nrtempFriendlyTime = "";
nrtempFriendlyTime
=
""
;
nrtempID = "";
nrtempID
=
""
;
rtempID = "";
rtempID
=
""
;
nrtempTime = "";
nrtempTime
=
""
;
rtempTime = "";
rtempTime
=
""
;
tempdayarray.sort();
tempdayarray
.
sort
();
rtempFriendlyDay = "";
rtempFriendlyDay
=
""
;
monthstr = "";
monthstr
=
""
;
daystr = "";
daystr
=
""
;
//check for existing entries
//check for existing entries
var findCurrentCounter;
var
findCurrentCounter
;
for (u=0; u<99; u++){
for
(
u
=
0
;
u
<
99
;
u
++
){
findCurrentCounter = document.getElementById("schedule" + u);
findCurrentCounter
=
document
.
getElementById
(
"
schedule
"
+
u
);
if (!findCurrentCounter)
if
(
!
findCurrentCounter
)
{
{
schCounter = u;
schCounter
=
u
;
break;
break
;
}
}
}
}
if (daysSelected != ""){
if
(
daysSelected
!=
""
){
//get days selected
//get days selected
for (i=0; i<tempdayarray.length; i++)
for
(
i
=
0
;
i
<
tempdayarray
.
length
;
i
++
)
{
{
tempstr = tempdayarray[i];
tempstr
=
tempdayarray
[
i
];
if (tempstr != "")
if
(
tempstr
!=
""
)
{
{
tempstrdaypos = tempstr.search("p");
tempstrdaypos
=
tempstr
.
search
(
"
p
"
);
week = tempstr.substring(1,tempstrdaypos);
week
=
tempstr
.
substring
(
1
,
tempstrdaypos
);
week = parseInt(week);
week
=
parseInt
(
week
);
dashpos = tempstr.search("-");
dashpos
=
tempstr
.
search
(
"
-
"
);
if (dashpos != "-1")
if
(
dashpos
!=
"
-1
"
)
{
{
var nonrepeatingfound = true;
var
nonrepeatingfound
=
true
;
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
daypos
=
tempstr
.
substring
(
tempstrdaypos
+
1
,
dashpos
);
daypos = parseInt(daypos);
daypos
=
parseInt
(
daypos
);
monthpos = tempstr.search("m");
monthpos
=
tempstr
.
search
(
"
m
"
);
tempstrdaypos = tempstr.search("d");
tempstrdaypos
=
tempstr
.
search
(
"
d
"
);
month = tempstr.substring(monthpos+1, tempstrdaypos);
month
=
tempstr
.
substring
(
monthpos
+
1
,
tempstrdaypos
);
month = parseInt(month);
month
=
parseInt
(
month
);
day = tempstr.substring(tempstrdaypos+1);
day
=
tempstr
.
substring
(
tempstrdaypos
+
1
);
day = parseInt(day);
day
=
parseInt
(
day
);
monthstr += month + ",";
monthstr
+=
month
+
"
,
"
;
daystr += day + ",";
daystr
+=
day
+
"
,
"
;
nrtempID += tempstr + ",";
nrtempID
+=
tempstr
+
"
,
"
;
}
}
else
else
{
{
var repeatingfound = true;
var
repeatingfound
=
true
;
daypos = tempstr.substr(tempstrdaypos+1);
daypos
=
tempstr
.
substr
(
tempstrdaypos
+
1
);
daypos = parseInt(daypos);
daypos
=
parseInt
(
daypos
);
rtempFriendlyDay += daypos + ",";
rtempFriendlyDay
+=
daypos
+
"
,
"
;
rtempID += daypos + ",";
rtempID
+=
daypos
+
"
,
"
;
}
}
}
}
}
}
//code below spits out friendly look format for nonrepeating schedules
//code below spits out friendly look format for nonrepeating schedules
var foundEnd = false;
var
foundEnd
=
false
;
var firstDayFound = false;
var
firstDayFound
=
false
;
var firstprint = false;
var
firstprint
=
false
;
var tempFriendlyMonthArray = monthstr.split(",");
var
tempFriendlyMonthArray
=
monthstr
.
split
(
"
,
"
);
var tempFriendlyDayArray = daystr.split(",");
var
tempFriendlyDayArray
=
daystr
.
split
(
"
,
"
);
var currentDay, firstDay, nextDay, currentMonth, nextMonth, firstDay, firstMonth = "";
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];
tempstr
=
tempFriendlyMonthArray
[
k
];
if (tempstr != ""){
if
(
tempstr
!=
""
){
if (!firstDayFound)
if
(
!
firstDayFound
)
{
{
firstDay = tempFriendlyDayArray[k];
firstDay
=
tempFriendlyDayArray
[
k
];
firstDay = parseInt(firstDay);
firstDay
=
parseInt
(
firstDay
);
firstMonth = tempFriendlyMonthArray[k];
firstMonth
=
tempFriendlyMonthArray
[
k
];
firstMonth = parseInt(firstMonth);
firstMonth
=
parseInt
(
firstMonth
);
firstDayFound = true;
firstDayFound
=
true
;
}
}
currentDay = tempFriendlyDayArray[k];
currentDay
=
tempFriendlyDayArray
[
k
];
currentDay = parseInt(currentDay);
currentDay
=
parseInt
(
currentDay
);
//get next day
//get next day
nextDay = tempFriendlyDayArray[k+1];
nextDay
=
tempFriendlyDayArray
[
k
+
1
];
nextDay = parseInt(nextDay);
nextDay
=
parseInt
(
nextDay
);
//get next month
//get next month
currentDay++;
currentDay
++
;
if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])){
if
((
currentDay
!=
nextDay
)
||
(
tempFriendlyMonthArray
[
k
]
!=
tempFriendlyMonthArray
[
k
+
1
])){
if (firstprint)
if
(
firstprint
)
nrtempFriendlyTime += ", ";
nrtempFriendlyTime
+=
"
,
"
;
currentDay--;
currentDay
--
;
if (currentDay != firstDay)
if
(
currentDay
!=
firstDay
)
nrtempFriendlyTime += month_array[firstMonth-1] + " " + firstDay + "-" + currentDay;
nrtempFriendlyTime
+=
month_array
[
firstMonth
-
1
]
+
"
"
+
firstDay
+
"
-
"
+
currentDay
;
else
else
nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay;
nrtempFriendlyTime
+=
month_array
[
firstMonth
-
1
]
+
"
"
+
currentDay
;
firstDayFound = false;
firstDayFound
=
false
;
firstprint = true;
firstprint
=
true
;
}
}
}
}
}
}
//code below spits out friendly look format for repeating schedules
//code below spits out friendly look format for repeating schedules
foundEnd = false;
foundEnd
=
false
;
firstDayFound = false;
firstDayFound
=
false
;
firstprint = false;
firstprint
=
false
;
tempFriendlyDayArray = rtempFriendlyDay.split(",");
tempFriendlyDayArray
=
rtempFriendlyDay
.
split
(
"
,
"
);
tempFriendlyDayArray.sort();
tempFriendlyDayArray
.
sort
();
currentDay, firstDay, nextDay = "";
currentDay
,
firstDay
,
nextDay
=
""
;
for (k=0; k<tempFriendlyDayArray.length; k++){
for
(
k
=
0
;
k
<
tempFriendlyDayArray
.
length
;
k
++
){
tempstr = tempFriendlyDayArray[k];
tempstr
=
tempFriendlyDayArray
[
k
];
if (tempstr != ""){
if
(
tempstr
!=
""
){
if (!firstDayFound)
if
(
!
firstDayFound
)
{
{
firstDay = tempFriendlyDayArray[k];
firstDay
=
tempFriendlyDayArray
[
k
];
firstDay = parseInt(firstDay);
firstDay
=
parseInt
(
firstDay
);
firstDayFound = true;
firstDayFound
=
true
;
}
}
currentDay = tempFriendlyDayArray[k];
currentDay
=
tempFriendlyDayArray
[
k
];
currentDay = parseInt(currentDay);
currentDay
=
parseInt
(
currentDay
);
//get next day
//get next day
nextDay = tempFriendlyDayArray[k+1];
nextDay
=
tempFriendlyDayArray
[
k
+
1
];
nextDay = parseInt(nextDay);
nextDay
=
parseInt
(
nextDay
);
currentDay++;
currentDay
++
;
if (currentDay != nextDay){
if
(
currentDay
!=
nextDay
){
if (firstprint)
if
(
firstprint
)
rtempFriendlyTime += ", ";
rtempFriendlyTime
+=
"
,
"
;
currentDay--;
currentDay
--
;
if (currentDay != firstDay)
if
(
currentDay
!=
firstDay
)
rtempFriendlyTime += day_array[firstDay-1] + " - " + day_array[currentDay-1];
rtempFriendlyTime
+=
day_array
[
firstDay
-
1
]
+
"
-
"
+
day_array
[
currentDay
-
1
];
else
else
rtempFriendlyTime += day_array[firstDay-1];
rtempFriendlyTime
+=
day_array
[
firstDay
-
1
];
firstDayFound = false;
firstDayFound
=
false
;
firstprint = true;
firstprint
=
true
;
}
}
}
}
}
}
//sort the tempID
//sort the tempID
var tempsortArray = rtempID.split(",");
var
tempsortArray
=
rtempID
.
split
(
"
,
"
);
var isFirstdone = false;
var
isFirstdone
=
false
;
tempsortArray.sort();
tempsortArray
.
sort
();
//clear tempID
//clear tempID
rtempID = "";
rtempID
=
""
;
for (t=0; t<tempsortArray.length; t++)
for
(
t
=
0
;
t
<
tempsortArray
.
length
;
t
++
)
{
{
if (tempsortArray[t] != ""){
if
(
tempsortArray
[
t
]
!=
""
){
if (!isFirstdone){
if
(
!
isFirstdone
){
rtempID += tempsortArray[t];
rtempID
+=
tempsortArray
[
t
];
isFirstdone = true;
isFirstdone
=
true
;
}
}
else
else
rtempID += "," + tempsortArray[t];
rtempID
+=
"
,
"
+
tempsortArray
[
t
];
}
}
}
}
//get time specified
//get time specified
starttimehour = document.getElementById("starttimehour").value
starttimehour
=
document
.
getElementById
(
"
starttimehour
"
).
value
starttimemin = document.getElementById("starttimemin").value;
starttimemin
=
document
.
getElementById
(
"
starttimemin
"
).
value
;
stoptimehour = document.getElementById("stoptimehour").value;
stoptimehour
=
document
.
getElementById
(
"
stoptimehour
"
).
value
;
stoptimemin = document.getElementById("stoptimemin").value;
stoptimemin
=
document
.
getElementById
(
"
stoptimemin
"
).
value
;
timeRange = "||" + starttimehour + ":";
timeRange
=
"
||
"
+
starttimehour
+
"
:
"
;
timeRange += starttimemin + "-";
timeRange
+=
starttimemin
+
"
-
"
;
timeRange += stoptimehour + ":";
timeRange
+=
stoptimehour
+
"
:
"
;
timeRange += stoptimemin;
timeRange
+=
stoptimemin
;
//get description for time range
//get description for time range
var tempdescr = document.getElementById("timerangedescr").value
var
tempdescr
=
document
.
getElementById
(
"
timerangedescr
"
).
value
if (nonrepeatingfound){
if
(
nonrepeatingfound
){
nrtempTime += nrtempID;
nrtempTime
+=
nrtempID
;
//add time ranges
//add time ranges
nrtempTime += timeRange;
nrtempTime
+=
timeRange
;
//add description
//add description
nrtempTime += "||" + tempdescr;
nrtempTime
+=
"
||
"
+
tempdescr
;
insertElements(nrtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, nrtempTime, nrtempID);
insertElements
(
nrtempFriendlyTime
,
starttimehour
,
starttimemin
,
stoptimehour
,
stoptimemin
,
tempdescr
,
nrtempTime
,
nrtempID
);
}
}
if (repeatingfound){
if
(
repeatingfound
){
rtempTime += rtempID;
rtempTime
+=
rtempID
;
//add time ranges
//add time ranges
rtempTime += timeRange;
rtempTime
+=
timeRange
;
//add description
//add description
rtempTime += "||" + tempdescr;
rtempTime
+=
"
||
"
+
tempdescr
;
insertElements(rtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, rtempTime, rtempID);
insertElements
(
rtempFriendlyTime
,
starttimehour
,
starttimemin
,
stoptimehour
,
stoptimemin
,
tempdescr
,
rtempTime
,
rtempID
);
}
}
}
}
else
else
{
{
//no days were selected, alert user
//no days were selected, alert user
alert ("You must select at least 1 day before adding time");
alert
(
"
You must select at least 1 day before adding time
"
);
}
}
}
}
function
insertElements
(
tempFriendlyTime
,
starttimehour
,
starttimemin
,
stoptimehour
,
stoptimemin
,
tempdescr
,
tempTime
,
tempID
){
function
insertElements
(
tempFriendlyTime
,
starttimehour
,
starttimemin
,
stoptimehour
,
stoptimemin
,
tempdescr
,
tempTime
,
tempID
){
//add it to the schedule list
//add it to the schedule list
d = document;
d
=
document
;
tbody = d.getElementById("scheduletable").getElementsByTagName("tbody").item(0);
tbody
=
d
.
getElementById
(
"
scheduletable
"
).
getElementsByTagName
(
"
tbody
"
).
item
(
0
);
tr = d.createElement("tr");
tr
=
d
.
createElement
(
"
tr
"
);
td = d.createElement("td");
td
=
d
.
createElement
(
"
td
"
);
td.innerHTML= "<span class='vexpl'>" + tempFriendlyTime + "<\/span>";
td
.
innerHTML
=
"
<span class='vexpl'>
"
+
tempFriendlyTime
+
"
<
\
/span>
"
;
tr.appendChild(td);
tr
.
appendChild
(
td
);
td = d.createElement("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 + "' />";
td
.
innerHTML
=
"
<input type='text' readonly
name='starttime
"
+
schCounter
+
"
' id='starttime
"
+
schCounter
+
"
' style=' word-wrap:break-word; width:100%; border:0px solid;' value='
"
+
starttimehour
+
"
:
"
+
starttimemin
+
"
' />
"
;
tr.appendChild(td);
tr
.
appendChild
(
td
);
td = d.createElement("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 + "' />";
td
.
innerHTML
=
"
<input type='text' readonly
name='stoptime
"
+
schCounter
+
"
' id='stoptime
"
+
schCounter
+
"
' style=' word-wrap:break-word; width:100%; border:0px solid;' value='
"
+
stoptimehour
+
"
:
"
+
stoptimemin
+
"
' />
"
;
tr.appendChild(td);
tr
.
appendChild
(
td
);
td = d.createElement("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 + "' />";
td
.
innerHTML
=
"
<input type='text' readonly
name='timedescr
"
+
schCounter
+
"
' id='timedescr
"
+
schCounter
+
"
' style=' word-wrap:break-word; width:100%; border:0px solid;' value='
"
+
tempdescr
+
"
' />
"
;
tr.appendChild(td);
tr
.
appendChild
(
td
);
td = d.createElement("td");
td
=
d
.
createElement
(
"
td
"
);
td.innerHTML = "<a onclick='editRow(\"" + tempTime + "\",this); return false;' href='#' class=\"btn btn-default btn-xs\"><span class=\"glyphicon glyphicon-pencil\"></span></\a>";
td
.
innerHTML
=
"
<a onclick='editRow(
\"
"
+
tempTime
+
"
\"
,this); return false;' href='#' class=
\"
btn btn-default btn-xs
\"
><span class=
\"
glyphicon glyphicon-pencil
\"
></span></
\
a>
"
;
tr.appendChild(td);
tr
.
appendChild
(
td
);
td = d.createElement("td");
td
=
d
.
createElement
(
"
td
"
);
td.innerHTML = "<a onclick='removeRow(this); return false;' href='#' class=\"btn btn-default btn-xs\"><span class=\"glyphicon glyphicon-remove\"></span></\a>";
td
.
innerHTML
=
"
<a onclick='removeRow(this); return false;' href='#' class=
\"
btn btn-default btn-xs
\"
><span class=
\"
glyphicon glyphicon-remove
\"
></span></
\
a>
"
;
tr.appendChild(td);
tr
.
appendChild
(
td
);
td = d.createElement("td");
td
=
d
.
createElement
(
"
td
"
);
td.innerHTML="<input type='hidden' id='schedule" + schCounter + "' name='schedule" + schCounter + "' value='" + tempID + "' />";
td
.
innerHTML
=
"
<input type='hidden' id='schedule
"
+
schCounter
+
"
' name='schedule
"
+
schCounter
+
"
' value='
"
+
tempID
+
"
' />
"
;
tr.appendChild(td);
tr
.
appendChild
(
td
);
tbody.appendChild(tr);
tbody
.
appendChild
(
tr
);
schCounter++;
schCounter
++
;
//reset calendar and time and descr
//reset calendar and time and descr
clearCalendar();
clearCalendar
();
clearTime();
clearTime
();
clearDescr();
clearDescr
();
}
}
function
clearCalendar
(){
function
clearCalendar
(){
var tempstr, daycell = "";
var
tempstr
,
daycell
=
""
;
//clear days selected
//clear days selected
daysSelected = "";
daysSelected
=
""
;
//loop through all 52 weeks
//loop through all 52 weeks
for (j=1; j<=53; j++)
for
(
j
=
1
;
j
<=
53
;
j
++
)
{
{
//loop through all 7 days
//loop through all 7 days
for (k=1; k<8; k++){
for
(
k
=
1
;
k
<
8
;
k
++
){
tempstr = 'w' + j + 'p' + k;
tempstr
=
'
w
'
+
j
+
'
p
'
+
k
;
daycell = eval('document.getElementById(tempstr)');
daycell
=
eval
(
'
document.getElementById(tempstr)
'
);
if (daycell != null){
if
(
daycell
!=
null
){
daycell.style.backgroundColor = "#FFFFFF"; // white
daycell
.
style
.
backgroundColor
=
"
#FFFFFF
"
;
// white
}
}
}
}
}
}
}
}
function
clearTime
(){
function
clearTime
(){
document.getElementById("starttimehour").value = "0";
document
.
getElementById
(
"
starttimehour
"
).
value
=
"
0
"
;
document.getElementById("starttimemin").value = "00";
document
.
getElementById
(
"
starttimemin
"
).
value
=
"
00
"
;
document.getElementById("stoptimehour").value = "23";
document
.
getElementById
(
"
stoptimehour
"
).
value
=
"
23
"
;
document.getElementById("stoptimemin").value = "59";
document
.
getElementById
(
"
stoptimemin
"
).
value
=
"
59
"
;
}
}
function
clearDescr
(){
function
clearDescr
(){
document.getElementById("timerangedescr").value = "";
document
.
getElementById
(
"
timerangedescr
"
).
value
=
""
;
}
}
function
editRow
(
incTime
,
el
)
{
function
editRow
(
incTime
,
el
)
{
var check = checkForRanges();
var
check
=
checkForRanges
();
if (check){
if
(
check
){
//reset calendar and time
//reset calendar and time
clearCalendar();
clearCalendar
();
clearTime();
clearTime
();
var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = "";
var
starttimehour
,
descr
,
days
,
tempstr
,
starttimemin
,
hours
,
stoptimehour
,
stoptimemin
=
""
;
tempArray = incTime.split ("||");
tempArray
=
incTime
.
split
(
"
||
"
);
days = tempArray[0];
days
=
tempArray
[
0
];
hours = tempArray[1];
hours
=
tempArray
[
1
];
descr = tempArray[2];
descr
=
tempArray
[
2
];
var tempdayArray = days.split(",");
var
tempdayArray
=
days
.
split
(
"
,
"
);
var temphourArray = hours.split("-");
var
temphourArray
=
hours
.
split
(
"
-
"
);
tempstr = temphourArray[0];
tempstr
=
temphourArray
[
0
];
var temphourArray2 = tempstr.split(":");
var
temphourArray2
=
tempstr
.
split
(
"
:
"
);
document.getElementById("starttimehour").value = temphourArray2[0];
document
.
getElementById
(
"
starttimehour
"
).
value
=
temphourArray2
[
0
];
document.getElementById("starttimemin").value = temphourArray2[1];
document
.
getElementById
(
"
starttimemin
"
).
value
=
temphourArray2
[
1
];
tempstr = temphourArray[1];
tempstr
=
temphourArray
[
1
];
temphourArray2 = tempstr.split(":");
temphourArray2
=
tempstr
.
split
(
"
:
"
);
document.getElementById("stoptimehour").value = temphourArray2[0];
document
.
getElementById
(
"
stoptimehour
"
).
value
=
temphourArray2
[
0
];
document.getElementById("stoptimemin").value = temphourArray2[1];
document
.
getElementById
(
"
stoptimemin
"
).
value
=
temphourArray2
[
1
];
document.getElementById("timerangedescr").value = descr;
document
.
getElementById
(
"
timerangedescr
"
).
value
=
descr
;
//toggle the appropriate days
//toggle the appropriate days
for (i=0; i<tempdayArray.length; i++)
for
(
i
=
0
;
i
<
tempdayArray
.
length
;
i
++
)
{
{
if (tempdayArray[i]){
if
(
tempdayArray
[
i
]){
var tempweekstr = tempdayArray[i];
var
tempweekstr
=
tempdayArray
[
i
];
dashpos = tempweekstr.search("-");
dashpos
=
tempweekstr
.
search
(
"
-
"
);
if (dashpos == "-1")
if
(
dashpos
==
"
-1
"
)
{
{
tempstr = "w2p" + tempdayArray[i];
tempstr
=
"
w2p
"
+
tempdayArray
[
i
];
}
}
else
else
{
{
tempstr = tempdayArray[i];
tempstr
=
tempdayArray
[
i
];
}
}
daytoggle(tempstr);
daytoggle
(
tempstr
);
}
}
}
}
removeRownoprompt(el);
removeRownoprompt
(
el
);
}
}
$
(
'
.selectpicker
'
).
selectpicker
(
'
refresh
'
);
}
}
function
removeRownoprompt
(
el
)
{
function
removeRownoprompt
(
el
)
{
var
cel
;
var
cel
;
while
(
el
&&
el
.
nodeName
.
toLowerCase
()
!=
"
tr
"
)
while
(
el
&&
el
.
nodeName
.
toLowerCase
()
!=
"
tr
"
)
el = el.parentNode;
el
=
el
.
parentNode
;
if
(
el
&&
el
.
parentNode
)
{
if
(
el
&&
el
.
parentNode
)
{
cel = el.getElementsByTagName("td").item(0);
cel
=
el
.
getElementsByTagName
(
"
td
"
).
item
(
0
);
el.parentNode.removeChild(el);
el
.
parentNode
.
removeChild
(
el
);
}
}
}
}
function
removeRow
(
el
)
{
function
removeRow
(
el
)
{
var check = confirm ("Do you really want to delete this time range?");
var
check
=
confirm
(
"
Do you really want to delete this time range?
"
);
if (check){
if
(
check
){
var cel;
var
cel
;
while (el && el.nodeName.toLowerCase() != "tr")
while
(
el
&&
el
.
nodeName
.
toLowerCase
()
!=
"
tr
"
)
el = el.parentNode;
el
=
el
.
parentNode
;
if (el && el.parentNode) {
if
(
el
&&
el
.
parentNode
)
{
cel = el.getElementsByTagName("td").item(0);
cel
=
el
.
getElementsByTagName
(
"
td
"
).
item
(
0
);
el.parentNode.removeChild(el);
el
.
parentNode
.
removeChild
(
el
);
}
}
}
}
}
}
//]]>
//]]>
</script>
</script>
EOD;
?>
<body>
<body>
<?php
include
(
"fbegin.inc"
);
echo
$jscriptstr
;
?>
<section
class=
"page-content-main"
>
<?php
include
(
"fbegin.inc"
);
echo
$jscriptstr
;
?>
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<?php
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
print_input_errors
(
$input_errors
);
?>
<section
class=
"page-content-main"
>
<section
class=
"col-xs-12"
>
<div
class=
"container-fluid"
>
<div
class=
"content-box content-box-main"
>
<div
class=
"row"
>
<form
action=
"firewall_schedule_edit.php"
method=
"post"
name=
"iform"
id=
"iform"
>
<input
type=
"hidden"
name=
"schedlabel"
value=
"
<?=
$pconfig
[
'schedlabel'
];
?>
"
/>
<?php
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
print_input_errors
(
$input_errors
);
?>
<div
class=
"table-responsive"
>
<div
id=
"inputerrors"
></div>
<table
class=
"table table-striped"
>
<tbody>
<tr>
<section
class=
"col-xs-12"
>
<td
width=
"15%"
><strong>
<?=
gettext
(
"Schedule information"
);
?>
</strong></td>
<td
width=
"85%"
align=
"right"
>
<div
class=
"content-box"
>
<small>
<?=
gettext
(
"full help"
);
?>
</small>
<i
class=
"fa fa-toggle-off text-danger"
style=
"cursor: pointer;"
id=
"show_all_help_page"
type=
"button"
></i></a>
<header
class=
"content-box-head container-fluid"
>
</td>
<h3>
<?=
gettext
(
"Schedule information"
);
?>
</h3>
</tr>
</header>
<tr>
<td><a
id=
"help_for_name"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Schedule Name"
);
?>
</td>
<div
class=
"content-box-main"
>
<td>
<?php
<form
action=
"firewall_schedule_edit.php"
method=
"post"
name=
"iform"
id=
"iform"
>
if
(
is_schedule_inuse
(
$pconfig
[
'name'
])
==
true
)
:?>
<
input
name
=
"name"
type
=
"hidden"
id
=
"name"
value
=
"<?=htmlspecialchars(
$pconfig['name']
);?>"
/>
<div
class=
"table-responsive"
>
<?=
$pconfig
[
'name'
];
?>
<table
class=
"table table-striped table-sort"
>
<p>
<tbody>
<?=
gettext
(
"NOTE: This schedule is in use so the name may not be modified!"
);
?>
<tr>
</p>
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Schedule Name"
);
?>
</td>
<?php
<td
width=
"85%"
class=
"vtable"
>
else
:
?>
<?php
if
(
is_schedule_inuse
(
$pconfig
[
'name'
])
==
true
)
:
?>
<input
name=
"name"
type=
"text"
id=
"name"
value=
"
<?=
$pconfig
[
'name'
];
?>
"
/>
<input
name=
"name"
type=
"hidden"
id=
"name"
size=
"40"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'name'
]);
?>
"
/>
<div
class=
"hidden"
for=
"help_for_name"
>
<?php
echo
$pconfig
[
'name'
];
?>
<?=
gettext
(
"The name of the alias may only consist of the characters a-z, A-Z and 0-9"
);
?>
<p>
</div>
<span
class=
"vexpl"
>
<?=
gettext
(
"NOTE: This schedule is in use so the name may not be modified!"
);
?>
</span>
<?php
</p>
endif
;
?>
<?php
else
:
?>
</td>
<input
name=
"name"
type=
"text"
id=
"name"
size=
"40"
maxlength=
"40"
class=
"form-control unknown"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'name'
]);
?>
"
/><br
/>
</tr>
<span
class=
"vexpl"
>
<tr>
<?=
gettext
(
"The name of the alias may only consist of the characters a-z, A-Z and 0-9"
);
?>
<td><a
id=
"help_for_description"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Description"
);
?>
</td>
</span>
<td>
<?php
endif
;
?>
<input
name=
"descr"
type=
"text"
id=
"descr"
value=
"
<?=
$pconfig
[
'descr'
];
?>
"
/><br
/>
</td>
<div
class=
"hidden"
for=
"help_for_name"
>
</tr>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
);
?>
<tr>
</div>
<td
width=
"15%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Description"
);
?>
</td>
</td>
<td
width=
"85%"
class=
"vtable"
><input
name=
"descr"
type=
"text"
id=
"descr"
size=
"40"
maxlength=
"40"
class=
"form-control unknown"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'descr'
]);
?>
"
/><br
/>
</tr>
<span
class=
"vexpl"
>
<tr>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
);
?>
<td><a
id=
"help_for_month"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Month"
);
?>
</td>
</span>
<td>
<select
name=
"monthsel"
class=
"selectpicker"
data-width=
"auto"
data-live-search=
"true"
id=
"monthsel"
onchange=
"update_month();"
>
</td>
<?php
</tr>
$monthcounter
=
date
(
"n"
);
<!-- tr>
$monthlimit
=
$monthcounter
+
12
;
</tr -->
$yearcounter
=
date
(
"Y"
);
<tr>
for
(
$k
=
0
;
$k
<
12
;
$k
++
){
?>
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Month"
);
?>
</td>
<option
value=
"
<?=
$monthcounter
;
?>
"
>
<?=
date
(
"F_y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
</option>
<td
width=
"85%"
class=
"vtable"
>
<?php
<select
name=
"monthsel"
class=
"form-control"
id=
"monthsel"
onchange=
"update_month();"
>
if
(
$monthcounter
==
12
)
{
<?php
$monthcounter
=
1
;
$monthcounter
=
date
(
"n"
);
$yearcounter
++
;
$monthlimit
=
$monthcounter
+
12
;
}
else
{
$yearcounter
=
date
(
"Y"
);
$monthcounter
++
;
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
</select>
if
(
$monthcounter
==
12
)
<br
/><br
/>
{
<?php
$monthcounter
=
1
;
$firstmonth
=
TRUE
;
$yearcounter
++
;
$monthcounter
=
date
(
"n"
);
}
$yearcounter
=
date
(
"Y"
);
else
for
(
$k
=
0
;
$k
<
12
;
$k
++
){
{
$firstdayofmonth
=
date
(
"w"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
$monthcounter
++
;
if
(
$firstdayofmonth
==
0
)
{
}
$firstdayofmonth
=
7
;
}
?>
}
</select><br
/><br
/>
$daycounter
=
1
;
<?php
//number of day in month
$firstmonth
=
TRUE
;
$numberofdays
=
date
(
"t"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
$monthcounter
=
date
(
"n"
);
$firstdayprinted
=
FALSE
;
$yearcounter
=
date
(
"Y"
);
$lasttr
=
FALSE
;
for
(
$k
=
0
;
$k
<
12
;
$k
++
){
$positioncounter
=
1
;
//7 for Sun, 1 for Mon, 2 for Tues, etc
$firstdayofmonth
=
date
(
"w"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
if
(
$firstdayofmonth
==
0
)
<div
id=
"
<?=
date
(
"F_y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
"
style=
" position:relative; display:
<?=
$firstmonth
?
"block"
:
"none"
;
?>
"
>
$firstdayofmonth
=
7
;
<table
border=
"1"
cellspacing=
"1"
cellpadding=
"1"
id=
"calTable
<?=
$monthcounter
.
$yearcounter
;
?>
"
class=
"table table-condensed"
summary=
"month"
>
<thead>
$daycounter
=
1
;
<tr><td
colspan=
"7"
align=
"center"
>
<?=
date
(
"F_Y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
</td></tr>
//number of day in month
<tr>
$numberofdays
=
date
(
"t"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
<td
align=
"center"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p1');"
><u>
<?=
gettext
(
"Mon"
);
?>
</u></td>
$firstdayprinted
=
FALSE
;
<td
align=
"center"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p2');"
><u>
<?=
gettext
(
"Tue"
);
?>
</u></td>
$lasttr
=
FALSE
;
<td
align=
"center"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p3');"
><u>
<?=
gettext
(
"Wed"
);
?>
</u></td>
$positioncounter
=
1
;
//7 for Sun, 1 for Mon, 2 for Tues, etc
<td
align=
"center"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p4');"
><u>
<?=
gettext
(
"Thu"
);
?>
</u></td>
?>
<td
align=
"center"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p5');"
><u>
<?=
gettext
(
"Fri"
);
?>
</u></td>
<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"
;
?>
"
>
<td
align=
"center"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p6');"
><u>
<?=
gettext
(
"Sat"
);
?>
</u></td>
<table
border=
"1"
cellspacing=
"1"
cellpadding=
"1"
id=
"calTable
<?=
$monthcounter
.
$yearcounter
;
?>
"
class=
"tabcont "
summary=
"month"
>
<td
align=
"center"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p7');"
><u>
<?=
gettext
(
"Sun"
);
?>
</u></td>
<thead>
</tr>
<tr><td
colspan=
"7"
align=
"center"
class=
"listbg"
>
<?php
echo
date
(
"F_Y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
</td></tr>
</thead>
<tr>
<tbody>
<td
align=
"center"
class=
"listhdrr"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p1');"
><u>
<?=
gettext
(
"Mon"
);
?>
</u></td>
<?php
<td
align=
"center"
class=
"listhdrr"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p2');"
><u>
<?=
gettext
(
"Tue"
);
?>
</u></td>
$firstmonth
=
FALSE
;
<td
align=
"center"
class=
"listhdrr"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p3');"
><u>
<?=
gettext
(
"Wed"
);
?>
</u></td>
while
(
$daycounter
<=
$numberofdays
){
<td
align=
"center"
class=
"listhdrr"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p4');"
><u>
<?=
gettext
(
"Thu"
);
?>
</u></td>
$weekcounter
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
date
(
$daycounter
),
date
(
$yearcounter
)));
<td
align=
"center"
class=
"listhdrr"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p5');"
><u>
<?=
gettext
(
"Fri"
);
?>
</u></td>
$weekcounter
=
ltrim
(
$weekcounter
,
"0"
);
<td
align=
"center"
class=
"listhdrr"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p6');"
><u>
<?=
gettext
(
"Sat"
);
?>
</u></td>
if
(
$positioncounter
==
1
)
{
<td
align=
"center"
class=
"listhdrr"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p7');"
><u>
<?=
gettext
(
"Sun"
);
?>
</u></td>
echo
"<tr>"
;
</tr>
}
</thead>
if
(
$firstdayofmonth
==
$positioncounter
){
?>
<tbody>
<td
align=
"center"
style=
"cursor: pointer;"
class=
"listr"
id=
"w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
"
onclick=
"daytoggle('w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
-m
<?=
$monthcounter
;
?>
d
<?=
$daycounter
;
?>
');"
>
<?php
<?php
echo
$daycounter
;
$firstmonth
=
FALSE
;
$daycounter
++
;
while
(
$daycounter
<=
$numberofdays
){
$firstdayprinted
=
TRUE
;
$weekcounter
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
date
(
$daycounter
),
date
(
$yearcounter
)));
echo
"</td>"
;
$weekcounter
=
ltrim
(
$weekcounter
,
"0"
);
}
elseif
(
$firstdayprinted
==
TRUE
&&
$daycounter
<=
$numberofdays
){
?>
if
(
$positioncounter
==
1
)
<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
;
echo
"<tr>"
;
$daycounter
++
;
}
echo
"</td>"
;
if
(
$firstdayofmonth
==
$positioncounter
){
?>
}
else
{
<td
align=
"center"
style=
"cursor: pointer;"
class=
"listr"
id=
"w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
"
onclick=
"daytoggle('w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
-m
<?=
$monthcounter
;
?>
d
<?=
$daycounter
;
?>
');"
>
echo
"<td align=
\"
center
\"
class=
\"
listr
\"
></td>"
;
<?php
echo
$daycounter
;
}
$daycounter
++
;
$firstdayprinted
=
TRUE
;
if
(
$positioncounter
==
7
||
$daycounter
>
$numberofdays
)
{
echo
"</td>"
;
$positioncounter
=
1
;
}
echo
"</tr>"
;
elseif
(
$firstdayprinted
==
TRUE
&&
$daycounter
<=
$numberofdays
){
?>
}
else
{
<td
align=
"center"
style=
"cursor: pointer;"
class=
"listr"
id=
"w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
"
onclick=
"daytoggle('w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
-m
<?=
$monthcounter
;
?>
d
<?=
$daycounter
;
?>
');"
>
$positioncounter
++
;
<?php
echo
$daycounter
;
}
$daycounter
++
;
}
//end while loop?>
echo
"</td>"
;
</
tbody
>
}
</
table
>
else
</
div
>
{
<?
php
echo
"<td align=
\"
center
\"
class=
\"
listr
\"
></td>"
;
if
(
$monthcounter
==
12
)
{
}
$monthcounter
=
1
;
$yearcounter
++
;
if
(
$positioncounter
==
7
||
$daycounter
>
$numberofdays
){
}
else
{
$positioncounter
=
1
;
$monthcounter
++
;
echo
"</tr>"
;
}
}
}
//end for loop
else
{
?>
$positioncounter
++
;
<div
class=
"hidden"
for=
"help_for_month"
>
}
<br
/>
<?=
gettext
(
"Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday."
);
?>
}
//end while loop?>
</div>
</
tbody
>
</td>
</
table
>
</tr>
</
div
>
<tr>
<?
php
<td><a
id=
"help_for_time"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Time"
);
?>
</td>
<td>
if
(
$monthcounter
==
12
)
<table
cellspacing=
"2"
class=
"tabcont"
summary=
"time"
>
{
<tr>
$monthcounter
=
1
;
<td>
<?=
gettext
(
"Start Time"
);
?>
</td>
$yearcounter
++
;
<td>
<?=
gettext
(
"Stop Time"
);
?>
</td>
}
</tr>
else
<tr>
{
<td>
$monthcounter
++
;
<div
class=
"input-group"
>
}
<select
name=
"starttimehour"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"starttimehour"
>
}
//end for loop
<?php
?>
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
:?>
<br
/>
<
option
value
=
"<?=
$i
;?>"
><?=
$i
;
?>
</option>
<?=
gettext
(
"Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday."
);
?>
<?php
</td>
endfor
;
?>
</tr>
</select>
<tr>
<select
name=
"starttimemin"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"starttimemin"
>
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Time"
);
?>
</td>
<option
value=
"00"
>
00
</option>
<td
width=
"85%"
class=
"vtable"
>
<option
value=
"15"
>
15
</option>
<table
cellspacing=
"2"
class=
"tabcont"
summary=
"time"
>
<option
value=
"30"
>
30
</option>
<tr>
<option
value=
"45"
>
45
</option>
<td
class=
"listhdrr"
align=
"center"
>
<?=
gettext
(
"Start Time"
);
?>
</td><td></td><td
class=
"listhdrr"
align=
"center"
>
<?=
gettext
(
"Stop Time"
);
?>
</td>
<option
value=
"59"
>
59
</option>
</tr>
</select>
<tr>
</div>
<td>
</td>
<select
name=
"starttimehour"
class=
"form-control"
id=
"starttimehour"
>
<td>
<?php
<div
class=
"input-group"
>
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
<select
name=
"stoptimehour"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"stoptimehour"
>
{
<?php
echo
"<option value=
\"
$i
\"
>"
;
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
:?>
echo
$i
;
<
option
value
=
"<?=
$i
;?>"
><?=
$i
;
?>
</option>
echo
"</option>"
;
<?php
}
endfor
;
?>
?>
</select>
</select>
<?=
gettext
(
"Hr"
);
?>
<select
name=
"stoptimemin"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"stoptimemin"
>
<select
name=
"starttimemin"
class=
"form-control"
id=
"starttimemin"
>
<option
value=
"00"
>
00
</option>
<option
value=
"00"
>
00
</option>
<option
value=
"15"
>
15
</option>
<option
value=
"15"
>
15
</option>
<option
value=
"30"
>
30
</option>
<option
value=
"30"
>
30
</option>
<option
value=
"45"
>
45
</option>
<option
value=
"45"
>
45
</option>
<option
value=
"59"
selected=
"selected"
>
59
</option>
<option
value=
"59"
>
59
</option>
</select>
</select>
<?=
gettext
(
"Min"
);
?>
</div>
</td>
</td>
<td></td>
</tr>
<td>
</table>
<select
name=
"stoptimehour"
class=
"form-control"
id=
"stoptimehour"
>
<div
class=
"hidden"
for=
"help_for_time"
>
<?php
<br
/>
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
<?=
gettext
(
"Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59."
)
?>
{
</div>
if
(
$i
==
23
)
</td>
$selected
=
"selected=
\"
selected
\"
"
;
</tr>
else
<tr>
$selected
=
""
;
<td><a
id=
"help_for_timerange_desc"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Time Range Description"
)
?>
</td>
<td>
echo
"<option value=
\"
$i
\"
$selected
>"
;
<input
name=
"timerangedescr"
type=
"text"
id=
"timerangedescr"
/>
echo
$i
;
<div
class=
"hidden"
for=
"help_for_timerange_desc"
>
echo
"</option>"
;
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
)
?>
}
</div>
?>
</td>
</select>
<?=
gettext
(
"Hr"
);
?>
</tr>
<select
name=
"stoptimemin"
class=
"form-control"
id=
"stoptimemin"
>
<tr>
<option
value=
"00"
>
00
</option>
<td>
</td>
<option
value=
"15"
>
15
</option>
<td>
<option
value=
"30"
>
30
</option>
<input
type=
"button"
value=
"
<?=
gettext
(
"Add Time"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:processEntries();"
/>
<option
value=
"45"
>
45
</option>
<input
type=
"button"
value=
"
<?=
gettext
(
"Clear Selection"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:clearCalendar(); clearTime(); clearDescr();"
/>
<option
value=
"59"
selected=
"selected"
>
59
</option>
</td>
</select>
<?=
gettext
(
"Min"
);
?>
</tr>
</td>
<tr>
</tr>
<td></td>
</table><br
/>
<td></td>
<?=
gettext
(
"Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59."
)
?>
</tr>
</td>
</tbody>
</tr>
</table>
<tr>
<table
class=
"table table-striped"
>
<td
width=
"15%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Time Range Description"
)
?>
</td>
<thead>
<td
width=
"85%"
class=
"vtable"
><input
name=
"timerangedescr"
type=
"text"
class=
"form-control unknown"
id=
"timerangedescr"
size=
"40"
maxlength=
"40"
/><br
/>
<tr>
<span
class=
"vexpl"
>
<td
colspan=
"2"
valign=
"top"
class=
"listtopic"
>
<?=
gettext
(
"Schedule repeat"
);
?>
</td>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
)
?>
</tr>
</span>
</thead>
</td>
<tbody>
</tr>
<tr>
<tr>
<td>
<?=
gettext
(
"Configured Ranges"
);
?>
</td>
<td
width=
"22%"
valign=
"top"
>
</td>
<td>
<td
width=
"78%"
>
<table
id=
"scheduletable"
summary=
"range"
>
<input
type=
"button"
value=
"
<?=
gettext
(
"Add Time"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:processEntries();"
/>
<tbody>
<input
type=
"button"
value=
"
<?=
gettext
(
"Clear Selection"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:clearCalendar(); clearTime(); clearDescr();"
/>
<tr>
</td>
<td
align=
"center"
width=
"35%"
>
<?=
gettext
(
"Day(s)"
);
?>
</td>
</tr>
<td
align=
"center"
width=
"12%"
>
<?=
gettext
(
"Start Time"
);
?>
</td>
<tr>
<td
align=
"center"
width=
"11%"
>
<?=
gettext
(
"Stop Time"
);
?>
</td>
<td
width=
"15%"
valign=
"top"
class=
"vtable"
></td>
<td
align=
"center"
width=
"42%"
>
<?=
gettext
(
"Description"
);
?>
</td>
<td
width=
"85%"
class=
"vtable"
></td>
</tr>
</tr>
<?php
</tbody>
if
(
isset
(
$pconfig
[
'timerange'
])){
</table>
$counter
=
0
;
<table
class=
"table table-striped"
>
foreach
(
$pconfig
[
'timerange'
]
as
$timerange
)
{
<thead>
$tempFriendlyTime
=
""
;
<tr>
$tempID
=
""
;
<td
colspan=
"2"
valign=
"top"
class=
"listtopic"
>
<?=
gettext
(
"Schedule repeat"
);
?>
</td>
if
(
$timerange
){
</tr>
$dayFriendly
=
""
;
</thead>
$tempFriendlyTime
=
""
;
<tbody>
$timedescr
=
$timerange
[
'rangedescr'
];
<tr>
//get hours
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Configured Ranges"
);
?>
</td>
$temptimerange
=
$timerange
[
'hour'
];
<td
width=
"85%"
>
$temptimeseparator
=
strrpos
(
$temptimerange
,
"-"
);
<table
id=
"scheduletable"
summary=
"range"
>
<tbody>
$starttime
=
substr
(
$temptimerange
,
0
,
$temptimeseparator
);
<tr>
$stoptime
=
substr
(
$temptimerange
,
$temptimeseparator
+
1
);
<td
align=
"center"
class=
"listbg"
width=
"35%"
>
<?=
gettext
(
"Day(s)"
);
?>
</td>
$currentDay
=
""
;
<td
align=
"center"
class=
"listbg"
width=
"12%"
>
<?=
gettext
(
"Start Time"
);
?>
</td>
$firstDay
=
""
;
<td
align=
"center"
class=
"listbg"
width=
"11%"
>
<?=
gettext
(
"Stop Time"
);
?>
</td>
$nextDay
=
""
;
<td
align=
"center"
class=
"listbg"
width=
"42%"
>
<?=
gettext
(
"Description"
);
?>
</td>
$foundEnd
=
false
;
</tr>
$firstDayFound
=
false
;
<?php
$firstPrint
=
false
;
if
(
$getSchedule
){
$firstprint2
=
false
;
$counter
=
0
;
if
(
!
empty
(
$timerange
[
'month'
])){
foreach
(
$pconfig
[
'timerange'
]
as
$timerange
)
{
$tempmontharray
=
explode
(
","
,
$timerange
[
'month'
]);
$tempFriendlyTime
=
""
;
$tempdayarray
=
explode
(
","
,
$timerange
[
'day'
]);
$tempID
=
""
;
$arraycounter
=
0
;
if
(
$timerange
){
foreach
(
$tempmontharray
as
$monthtmp
){
$dayFriendly
=
""
;
$month
=
$tempmontharray
[
$arraycounter
];
$tempFriendlyTime
=
""
;
$day
=
$tempdayarray
[
$arraycounter
];
$timedescr
=
$timerange
[
'rangedescr'
];
$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.
//get hours
if
(
$daypos
==
0
){
$temptimerange
=
$timerange
[
'hour'
];
$daypos
=
7
;
$temptimeseparator
=
strrpos
(
$temptimerange
,
"-"
);
}
$weeknumber
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$month
),
date
(
$day
),
date
(
"Y"
)));
$starttime
=
substr
(
$temptimerange
,
0
,
$temptimeseparator
);
$weeknumber
=
ltrim
(
$weeknumber
,
"0"
);
$stoptime
=
substr
(
$temptimerange
,
$temptimeseparator
+
1
);
if
(
$firstPrint
)
{
$currentDay
=
""
;
$tempID
.=
","
;
$firstDay
=
""
;
}
$nextDay
=
""
;
$tempID
.=
"w"
.
$weeknumber
.
"p"
.
$daypos
.
"-m"
.
$month
.
"d"
.
$day
;
$foundEnd
=
false
;
$firstPrint
=
true
;
$firstDayFound
=
false
;
if
(
!
$firstDayFound
)
{
$firstPrint
=
false
;
$firstDay
=
$day
;
$firstprint2
=
false
;
$firstmonth
=
$month
;
$firstDayFound
=
true
;
if
(
$timerange
[
'month'
]){
}
$tempmontharray
=
explode
(
","
,
$timerange
[
'month'
]);
$tempdayarray
=
explode
(
","
,
$timerange
[
'day'
]);
$currentDay
=
$day
;
$arraycounter
=
0
;
$nextDay
=
$tempdayarray
[
$arraycounter
+
1
];
foreach
(
$tempmontharray
as
$monthtmp
){
$currentDay
++
;
$month
=
$tempmontharray
[
$arraycounter
];
if
((
$currentDay
!=
$nextDay
)
||
(
$tempmontharray
[
$arraycounter
]
!=
$tempmontharray
[
$arraycounter
+
1
])){
$day
=
$tempdayarray
[
$arraycounter
];
if
(
$firstprint2
)
{
$daypos
=
date
(
"w"
,
mktime
(
0
,
0
,
0
,
date
(
$month
),
date
(
$day
),
date
(
"Y"
)));
$tempFriendlyTime
.=
", "
;
//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
){
$currentDay
--
;
$daypos
=
7
;
if
(
$currentDay
!=
$firstDay
)
{
}
$tempFriendlyTime
.=
$monthArray
[
$firstmonth
-
1
]
.
" "
.
$firstDay
.
" - "
.
$currentDay
;
$weeknumber
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$month
),
date
(
$day
),
date
(
"Y"
)));
}
else
{
$weeknumber
=
ltrim
(
$weeknumber
,
"0"
);
$tempFriendlyTime
.=
$monthArray
[
$month
-
1
]
.
" "
.
$day
;
}
if
(
$firstPrint
)
$firstDayFound
=
false
;
{
$firstprint2
=
true
;
$tempID
.=
","
;
}
}
$arraycounter
++
;
$tempID
.=
"w"
.
$weeknumber
.
"p"
.
$daypos
.
"-m"
.
$month
.
"d"
.
$day
;
}
$firstPrint
=
true
;
}
else
{
$dayFriendly
=
$timerange
[
'position'
];
if
(
!
$firstDayFound
)
$tempID
=
$dayFriendly
;
{
}
$firstDay
=
$day
;
$tempTime
=
$tempID
.
"||"
.
$starttime
.
"-"
.
$stoptime
.
"||"
.
$timedescr
;
$firstmonth
=
$month
;
$firstDayFound
=
true
;
//following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
}
$foundEnd
=
false
;
$firstDayFound
=
false
;
$currentDay
=
$day
;
$firstprint
=
false
;
$nextDay
=
$tempdayarray
[
$arraycounter
+
1
];
$tempFriendlyDayArray
=
explode
(
","
,
$dayFriendly
);
$currentDay
++
;
$currentDay
=
""
;
if
((
$currentDay
!=
$nextDay
)
||
(
$tempmontharray
[
$arraycounter
]
!=
$tempmontharray
[
$arraycounter
+
1
])){
$firstDay
=
""
;
if
(
$firstprint2
)
$nextDay
=
""
;
$tempFriendlyTime
.=
", "
;
$i
=
0
;
$currentDay
--
;
if
(
empty
(
$timerange
[
'month'
]))
{
if
(
$currentDay
!=
$firstDay
)
foreach
(
$tempFriendlyDayArray
as
$day
){
$tempFriendlyTime
.=
$monthArray
[
$firstmonth
-
1
]
.
" "
.
$firstDay
.
" - "
.
$currentDay
;
if
(
$day
!=
""
){
else
if
(
!
$firstDayFound
)
{
$tempFriendlyTime
.=
$monthArray
[
$month
-
1
]
.
" "
.
$day
;
$firstDay
=
$tempFriendlyDayArray
[
$i
];
$firstDayFound
=
false
;
$firstDayFound
=
true
;
$firstprint2
=
true
;
}
}
$currentDay
=
$tempFriendlyDayArray
[
$i
];
$arraycounter
++
;
//get next day
}
$nextDay
=
$tempFriendlyDayArray
[
$i
+
1
];
$currentDay
++
;
}
if
(
$currentDay
!=
$nextDay
){
else
if
(
$firstprint
){
{
$tempFriendlyTime
.=
", "
;
$dayFriendly
=
$timerange
[
'position'
];
}
$tempID
=
$dayFriendly
;
$currentDay
--
;
}
if
(
$currentDay
!=
$firstDay
)
{
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
]
.
" - "
.
$dayArray
[
$currentDay
-
1
];
$tempTime
=
$tempID
.
"||"
.
$starttime
.
"-"
.
$stoptime
.
"||"
.
$timedescr
;
}
else
{
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
];
//following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
}
$foundEnd
=
false
;
$firstDayFound
=
false
;
$firstDayFound
=
false
;
$firstprint
=
true
;
$firstprint
=
false
;
}
$tempFriendlyDayArray
=
explode
(
","
,
$dayFriendly
);
$i
++
;
$currentDay
=
""
;
}
$firstDay
=
""
;
}
$nextDay
=
""
;
}
$i
=
0
;
?>
if
(
!
$timerange
[
'month'
]){
<tr>
foreach
(
$tempFriendlyDayArray
as
$day
){
<td>
if
(
$day
!=
""
){
<span>
<?=
$tempFriendlyTime
;
?>
</span>
if
(
!
$firstDayFound
)
</td>
{
<td>
$firstDay
=
$tempFriendlyDayArray
[
$i
];
<input
type=
'text'
readonly=
'readonly'
name=
'starttime
<?=
$counter
;
?>
'
id=
'starttime
<?=
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?=
$starttime
;
?>
'
/>
$firstDayFound
=
true
;
</td>
}
<td>
$currentDay
=
$tempFriendlyDayArray
[
$i
];
<input
type=
'text'
readonly=
'readonly'
name=
'stoptime
<?=
$counter
;
?>
'
id=
'stoptime
<?=
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?=
$stoptime
;
?>
'
/>
//get next day
</td>
$nextDay
=
$tempFriendlyDayArray
[
$i
+
1
];
<td>
$currentDay
++
;
<input
type=
'text'
readonly=
'readonly'
name=
'timedescr
<?=
$counter
;
?>
'
id=
'timedescr
<?=
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?=
$timedescr
;
?>
'
/>
if
(
$currentDay
!=
$nextDay
){
</td>
if
(
$firstprint
)
<td>
$tempFriendlyTime
.=
", "
;
<a
onclick=
'editRow("
<?=
$tempTime
;
?>
",this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-pencil"
></span></a>
$currentDay
--
;
</td>
if
(
$currentDay
!=
$firstDay
)
<td>
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
]
.
" - "
.
$dayArray
[
$currentDay
-
1
];
<a
onclick=
'removeRow(this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-remove"
></span></a>
else
</td>
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
];
<td>
$firstDayFound
=
false
;
<input
type=
'hidden'
id=
'schedule
<?=
$counter
;
?>
'
name=
'schedule
<?=
$counter
;
?>
'
value=
'
<?=
$tempID
;
?>
'
/>
$firstprint
=
true
;
</td>
}
</tr>
$i
++
;
<?php
}
$counter
++
;
}
}
//end if
}
}
// end foreach
}
//end if
?>
?>
</tbody>
<tr>
</table>
<td>
</td>
<span
class=
"vexpl"
>
<?php
echo
$tempFriendlyTime
;
?>
</span>
</tr>
</td>
<tr>
<td>
<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
id=
"submit"
name=
"submit"
type=
"submit"
onclick=
"return checkForRanges();"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
<td>
<input
type=
"button"
class=
"btn btn-default"
value=
"
<?=
gettext
(
"Cancel"
);
?>
"
onclick=
"window.location.href='
<?=
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
?
$_SERVER
[
'HTTP_REFERER'
]
:
'/firewall_schedule.php'
);
?>
'"
/>
<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
;
?>
'
/>
<?php
if
(
isset
(
$id
))
:
?>
</td>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$id
;
?>
"
/>
<td>
<?php
endif
;
?>
<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>
</tr>
</tbody>
<td>
</table>
<a
onclick=
'editRow("
<?php
echo
$tempTime
;
?>
",this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-edit"
></span></a>
</div>
</td>
</form>
<td>
<a
onclick=
'removeRow(this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-remove"
></span></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"
>
</td>
<td
width=
"85%"
>
<input
id=
"submit"
name=
"submit"
type=
"submit"
onclick=
"return checkForRanges();"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
<input
type=
"button"
class=
"btn btn-default"
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>
</tbody>
</table>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
</section>
</div>
</div>
</div>
</section>
</section>
<?php
include
(
"foot.inc"
);
?>
<?php
include
(
"foot.inc"
);
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment