diff options
Diffstat (limited to 'scire')
-rwxr-xr-x | scire/.smarty/templates/add_job.tpl | 19 | ||||
-rw-r--r-- | scire/calendar/calendar.html | 169 | ||||
-rw-r--r-- | scire/calendar/calendar3.js | 165 | ||||
-rw-r--r-- | scire/calendar/img/cal.gif | bin | 0 -> 127 bytes | |||
-rw-r--r-- | scire/calendar/img/icon_demo.gif | bin | 0 -> 160 bytes | |||
-rw-r--r-- | scire/calendar/img/icon_docs.gif | bin | 0 -> 151 bytes | |||
-rw-r--r-- | scire/calendar/img/icon_download.gif | bin | 0 -> 157 bytes | |||
-rw-r--r-- | scire/calendar/img/icon_forum.gif | bin | 0 -> 204 bytes | |||
-rw-r--r-- | scire/calendar/img/icon_home.gif | bin | 0 -> 198 bytes | |||
-rw-r--r-- | scire/calendar/img/logo.gif | bin | 0 -> 660 bytes | |||
-rw-r--r-- | scire/calendar/img/next.gif | bin | 0 -> 214 bytes | |||
-rw-r--r-- | scire/calendar/img/next_year.gif | bin | 0 -> 256 bytes | |||
-rw-r--r-- | scire/calendar/img/pixel.gif | bin | 0 -> 67 bytes | |||
-rw-r--r-- | scire/calendar/img/prev.gif | bin | 0 -> 212 bytes | |||
-rw-r--r-- | scire/calendar/img/prev_year.gif | bin | 0 -> 259 bytes | |||
-rw-r--r-- | scire/calendar/img/tc.gif | bin | 0 -> 8301 bytes |
16 files changed, 351 insertions, 2 deletions
diff --git a/scire/.smarty/templates/add_job.tpl b/scire/.smarty/templates/add_job.tpl index 8c6b804..63c58f7 100755 --- a/scire/.smarty/templates/add_job.tpl +++ b/scire/.smarty/templates/add_job.tpl @@ -321,10 +321,25 @@ Recurring stuff here. <b>You need to select all of them to get it to save the sc </td></tr> <tr><td> -<label for="deploy_time">Start time: <B>CODE ME</B</label> +<script language="JavaScript" src="calendar/calendar3.js"></script><!-- Date only with year scrolling --> +<label for="deploy_time">Start time: <input type="Text" name="deploy_time" value=""> + <a href="javascript:cal1.popup();"><img src="calendar/img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></label> </td> <td> -<label for="expiration_time">End time: <B>CODE ME</B</label> +<label for="expiration_time">End time: <input type="Text" name="expiration_time" value=""> + <a href="javascript:cal2.popup();"><img src="calendar/img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></label> +<script language="JavaScript"> + <!-- // create calendar object(s) just after form tag closed + // specify form element as the only parameter (document.forms['formname'].elements['inputname']); + // note: you can have as many calendar objects as you need for your application + var cal1 = new calendar3(document.forms['add_jobform'].elements['deploy_time']); + cal1.year_scroll = false; + cal1.time_comp = true; + var cal2 = new calendar3(document.forms['add_jobform'].elements['expiration_time']); + cal2.year_scroll = false; + cal2.time_comp = true; + //--> + </script> </td> </tr> </table> diff --git a/scire/calendar/calendar.html b/scire/calendar/calendar.html new file mode 100644 index 0000000..202fb41 --- /dev/null +++ b/scire/calendar/calendar.html @@ -0,0 +1,169 @@ +<!--
+Title: Tigra Calendar
+URL: http://www.softcomplex.com/products/tigra_calendar/
+Version: 3.4 (all formats)
+Date: 01/06/2007
+Note: Permission given to use this script in ANY kind of applications if
+ header lines are left unchanged.
+Note: Script consists of two files: calendar?.js and calendar.html
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title>Select Date, Please.</title>
+<style>
+ td {font-family: Tahoma, Verdana, sans-serif; font-size: 12px;}
+ td a {text-decoration: none;}
+</style>
+<script language="JavaScript">
+
+// months as they appear in the calendar's title
+var ARR_MONTHS = ["January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"];
+// week day titles as they appear on the calendar
+var ARR_WEEKDAYS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
+// day week starts from (normally 0-Su or 1-Mo)
+var NUM_WEEKSTART = 1;
+// path to the directory where calendar images are stored. trailing slash req.
+var STR_ICONPATH = 'img/';
+
+var re_urlCur = new RegExp('c=(\\-?\\d+)');
+var re_urlSel = new RegExp('s=(\\-?\\d+)');
+var re_id = new RegExp('id=(\\d+)');
+
+var dt_selected = (re_urlSel.exec(String(window.location))
+ ? new Date(new Number(RegExp.$1)) : new Date());
+var dt_current = (re_urlCur.exec(String(window.location))
+ ? new Date(new Number(RegExp.$1)) : dt_selected);
+var num_id = (re_id.exec(String(window.location))
+ ? new Number(RegExp.$1) : 0);
+
+var obj_caller = (window.opener ? window.opener.calendars[num_id] : null);
+
+if (obj_caller && obj_caller.year_scroll) {
+ // get same date in the previous year
+ var dt_prev_year = new Date(dt_current);
+ dt_prev_year.setFullYear(dt_prev_year.getFullYear() - 1);
+ if (dt_prev_year.getDate() != dt_current.getDate())
+ dt_prev_year.setDate(0);
+
+ // get same date in the next year
+ var dt_next_year = new Date(dt_current);
+ dt_next_year.setFullYear(dt_next_year.getFullYear() + 1);
+ if (dt_next_year.getDate() != dt_current.getDate())
+ dt_next_year.setDate(0);
+}
+
+// get same date in the previous month
+var dt_prev_month = new Date(dt_current);
+if (dt_prev_month.getMonth()) {
+ dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);
+ if (dt_prev_month.getDate() != dt_current.getDate())
+ dt_prev_month.setDate(0);
+}
+else {
+ dt_prev_month.setFullYear(dt_prev_month.getFullYear() - 1);
+ dt_prev_month.setMonth(11);
+}
+
+// get same date in the next month
+var dt_next_month = new Date(dt_current);
+dt_next_month.setMonth(dt_next_month.getMonth() + 1);
+if (dt_next_month.getDate() != dt_current.getDate())
+ dt_next_month.setDate(0);
+
+// get first day to display in the grid for current month
+var dt_firstday = new Date(dt_current);
+dt_firstday.setDate(1);
+dt_firstday.setDate(1 - (7 + dt_firstday.getDay() - NUM_WEEKSTART) % 7);
+
+// function passing selected date to calling window
+function set_datetime(n_datetime, b_close) {
+ if (!obj_caller) return;
+
+ var dt_datetime = obj_caller.prs_time(
+ (document.cal ? document.cal.time.value : ''),
+ new Date(n_datetime)
+ );
+
+ if (!dt_datetime) return;
+ if (b_close) {
+
+ obj_caller.target.value = (document.cal
+ ? obj_caller.gen_tsmp(dt_datetime)
+ : obj_caller.gen_date(dt_datetime)
+ );window.close();
+ }
+ else obj_caller.popup(dt_datetime.valueOf());
+}
+
+</script>
+</head>
+<body bgcolor="#FFFFFF" marginheight="5" marginwidth="5" topmargin="5" leftmargin="5" rightmargin="5">
+<table class="clsOTable" cellspacing="0" border="0" width="100%">
+<tr><td bgcolor="#4682B4">
+<table cellspacing="1" cellpadding="3" border="0" width="100%">
+<tr><td colspan="7"><table cellspacing="0" cellpadding="0" border="0" width="100%">
+<tr>
+<script language="JavaScript">
+document.write(
+'<td nowrap>'+(obj_caller&&obj_caller.year_scroll?'<a href="javascript:set_datetime('+dt_prev_year.valueOf()+')"><img src="'+STR_ICONPATH+'prev_year.gif" width="16" height="16" border="0" alt="previous year"></a> ':'')+'<a href="javascript:set_datetime('+dt_prev_month.valueOf()+')"><img src="'+STR_ICONPATH+'prev.gif" width="16" height="16" border="0" alt="previous month"></a></td>'+
+'<td align="center" width="100%"><font color="#ffffff">'+ARR_MONTHS[dt_current.getMonth()]+' '+dt_current.getFullYear() + '</font></td>'+
+'<td nowrap><a href="javascript:set_datetime('+dt_next_month.valueOf()+')"><img src="'+STR_ICONPATH+'next.gif" width="16" height="16" border="0" alt="next month"></a>'+(obj_caller && obj_caller.year_scroll?' <a href="javascript:set_datetime('+dt_next_year.valueOf()+')"><img src="'+STR_ICONPATH+'next_year.gif" width="16" height="16" border="0" alt="next year"></a>':'')+'</td>'
+);
+</script>
+</tr>
+</table></td></tr>
+<tr>
+<script language="JavaScript">
+
+// print weekdays titles
+for (var n=0; n<7; n++)
+ document.write('<td bgcolor="#87cefa" align="center"><font color="#ffffff">'+ARR_WEEKDAYS[(NUM_WEEKSTART+n)%7]+'</font></td>');
+document.write('</tr>');
+
+// print calendar table
+var dt_current_day = new Date(dt_firstday);
+while (dt_current_day.getMonth() == dt_current.getMonth() ||
+ dt_current_day.getMonth() == dt_firstday.getMonth()) {
+ // print row heder
+ document.write('<tr>');
+ for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
+ if (dt_current_day.getDate() == dt_selected.getDate() &&
+ dt_current_day.getMonth() == dt_selected.getMonth() &&
+ dt_current_day.getFullYear() == dt_selected.getFullYear())
+ // print current date
+ document.write('<td bgcolor="#ffb6c1" align="center" width="14%">');
+ else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
+ // weekend days
+ document.write('<td bgcolor="#dbeaf5" align="center" width="14%">');
+ else
+ // print working days of current month
+ document.write('<td bgcolor="#ffffff" align="center" width="14%">');
+
+ document.write('<a href="javascript:set_datetime('+dt_current_day.valueOf() +', true);">');
+
+ if (dt_current_day.getMonth() == this.dt_current.getMonth())
+ // print days of current month
+ document.write('<font color="#000000">');
+ else
+ // print days of other months
+ document.write('<font color="#606060">');
+
+ document.write(dt_current_day.getDate()+'</font></a></td>');
+ dt_current_day.setDate(dt_current_day.getDate()+1);
+ }
+ // print row footer
+ document.write('</tr>');
+}
+if (obj_caller && obj_caller.time_comp) {
+ document.write('<form onsubmit="javascript:set_datetime('+dt_current.valueOf()+', true)" name="cal"><tr><td colspan="7" bgcolor="#87CEFA"><font color="White" face="tahoma, verdana" size="2">Time: <input type="text" name="time" value="'+obj_caller.gen_time(this.dt_current)+'" size="8" maxlength="8"></font></td></tr></form>');
+ document.forms['cal'].elements['time'].focus();
+}
+</script>
+</table>
+</td></tr></table>
+</body>
+</html>
+
diff --git a/scire/calendar/calendar3.js b/scire/calendar/calendar3.js new file mode 100644 index 0000000..9b88ed2 --- /dev/null +++ b/scire/calendar/calendar3.js @@ -0,0 +1,165 @@ +// Title: Tigra Calendar +// URL: http://www.softcomplex.com/products/tigra_calendar/ +// Version: 3.4 (mySQL format) +// Date: 07/12/2007 +// Note: Permission given to use this script in ANY kind of applications if +// header lines are left unchanged. +// Note: Script consists of two files: calendar?.js and calendar.html + +// if two digit year input dates after this year considered 20 century. +var NUM_CENTYEAR = 30; +// is time input control required by default +var BUL_TIMECOMPONENT = false; +// are year scrolling buttons required by default +var BUL_YEARSCROLL = true; + +var calendars = []; +var RE_NUM = /^\-?\d+$/; + +function calendar3(obj_target) { + + // assigning methods + this.gen_date = cal_gen_date3; + this.gen_time = cal_gen_time3; + this.gen_tsmp = cal_gen_tsmp3; + this.prs_date = cal_prs_date3; + this.prs_time = cal_prs_time3; + this.prs_tsmp = cal_prs_tsmp3; + this.popup = cal_popup3; + + // validate input parameters + if (!obj_target) + return cal_error("Error calling the calendar: no target control specified"); + if (obj_target.value == null) + return cal_error("Error calling the calendar: parameter specified is not valid target control"); + this.target = obj_target; + this.time_comp = BUL_TIMECOMPONENT; + this.year_scroll = BUL_YEARSCROLL; + + // register in global collections + this.id = calendars.length; + calendars[this.id] = this; +} + +function cal_popup3 (str_datetime) { + if (str_datetime) + this.dt_current = this.prs_tsmp(str_datetime); + else + this.dt_selected = this.dt_current = this.prs_tsmp(this.target.value); + + if (!this.dt_current) return; + + var obj_calwindow = window.open( + 'calendar/calendar.html?id=' + this.id + '&s=' + this.dt_selected.valueOf() + '&c=' + this.dt_current.valueOf(), + 'Calendar', 'width=200,height=' + (this.time_comp ? 215 : 190) + + ',status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes' + ); + obj_calwindow.opener = window; + obj_calwindow.focus(); +} + +// timestamp generating function +function cal_gen_tsmp3 (dt_datetime) { + return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime)); +} + +// date generating function +function cal_gen_date3 (dt_datetime) { + return ( + dt_datetime.getFullYear() + "-" + + (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "-" + + (dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate() + ); +} +// time generating function +function cal_gen_time3 (dt_datetime) { + return ( + (dt_datetime.getHours() < 10 ? '0' : '') + dt_datetime.getHours() + ":" + + (dt_datetime.getMinutes() < 10 ? '0' : '') + (dt_datetime.getMinutes()) + ":" + + (dt_datetime.getSeconds() < 10 ? '0' : '') + (dt_datetime.getSeconds()) + ); +} + +// timestamp parsing function +function cal_prs_tsmp3 (str_datetime) { + // if no parameter specified return current timestamp + if (!str_datetime) + return (new Date()); + + // if positive integer treat as milliseconds from epoch + if (RE_NUM.exec(str_datetime)) + return new Date(str_datetime); + + // else treat as date in string format + var arr_datetime = str_datetime.split(' '); + return this.prs_time(arr_datetime[1], this.prs_date(arr_datetime[0])); +} + +// date parsing function +function cal_prs_date3 (str_date) { + + var arr_date = str_date.split('-'); + + if (arr_date.length != 3) return alert ("Invalid date format: '" + str_date + "'.\nFormat accepted is yyyy-mm-dd."); + + if (!arr_date[0]) return alert ("Invalid date format: '" + str_date + "'.\nNo year value can be found."); + if (!RE_NUM.exec(arr_date[0])) return alert ("Invalid year value: '" + arr_date[0] + "'.\nAllowed values are unsigned integers."); + + if (!arr_date[1]) return alert ("Invalid date format: '" + str_date + "'.\nNo month value can be found."); + if (!RE_NUM.exec(arr_date[1])) return alert ("Invalid month value: '" + arr_date[1] + "'.\nAllowed values are unsigned integers."); + + if (!arr_date[2]) return alert ("Invalid date format: '" + str_date + "'.\nNo day of month value can be found."); + if (!RE_NUM.exec(arr_date[2])) return alert ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed values are unsigned integers."); + + + + var dt_date = new Date(); + dt_date.setDate(1); + + if (arr_date[0] < 100) arr_date[0] = Number(arr_date[0]) + (arr_date[0] < NUM_CENTYEAR ? 2000 : 1900); + dt_date.setFullYear(arr_date[0]); + + + if (arr_date[1] < 1 || arr_date[1] > 12) return alert ("Invalid month value: '" + arr_date[1] + "'.\nAllowed range is 01-12."); + dt_date.setMonth(arr_date[1] - 1); + + + var dt_numdays = new Date(arr_date[0], arr_date[1], 0); + dt_date.setDate(arr_date[2]); + if (dt_date.getMonth() != (arr_date[1]-1)) return alert ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed range is 01-"+dt_numdays.getDate()+"."); + + return (dt_date) +} + +// time parsing function +function cal_prs_time3 (str_time, dt_date) { + + if (!dt_date) return null; + var arr_time = String(str_time ? str_time : '').split(':'); + + if (!arr_time[0]) dt_date.setHours(0); + else if (RE_NUM.exec(arr_time[0])) + if (arr_time[0] < 24) dt_date.setHours(arr_time[0]); + else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed range is 00-23."); + else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed values are unsigned integers."); + + if (!arr_time[1]) dt_date.setMinutes(0); + else if (RE_NUM.exec(arr_time[1])) + if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]); + else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed range is 00-59."); + else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed values are unsigned integers."); + + if (!arr_time[2]) dt_date.setSeconds(0); + else if (RE_NUM.exec(arr_time[2])) + if (arr_time[2] < 60) dt_date.setSeconds(arr_time[2]); + else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed range is 00-59."); + else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed values are unsigned integers."); + + dt_date.setMilliseconds(0); + return dt_date; +} + +function cal_error (str_message) { + alert (str_message); + return null; +} diff --git a/scire/calendar/img/cal.gif b/scire/calendar/img/cal.gif Binary files differnew file mode 100644 index 0000000..8526cf5 --- /dev/null +++ b/scire/calendar/img/cal.gif diff --git a/scire/calendar/img/icon_demo.gif b/scire/calendar/img/icon_demo.gif Binary files differnew file mode 100644 index 0000000..b6479eb --- /dev/null +++ b/scire/calendar/img/icon_demo.gif diff --git a/scire/calendar/img/icon_docs.gif b/scire/calendar/img/icon_docs.gif Binary files differnew file mode 100644 index 0000000..f8c401c --- /dev/null +++ b/scire/calendar/img/icon_docs.gif diff --git a/scire/calendar/img/icon_download.gif b/scire/calendar/img/icon_download.gif Binary files differnew file mode 100644 index 0000000..47d15f7 --- /dev/null +++ b/scire/calendar/img/icon_download.gif diff --git a/scire/calendar/img/icon_forum.gif b/scire/calendar/img/icon_forum.gif Binary files differnew file mode 100644 index 0000000..c99a254 --- /dev/null +++ b/scire/calendar/img/icon_forum.gif diff --git a/scire/calendar/img/icon_home.gif b/scire/calendar/img/icon_home.gif Binary files differnew file mode 100644 index 0000000..92a4f2e --- /dev/null +++ b/scire/calendar/img/icon_home.gif diff --git a/scire/calendar/img/logo.gif b/scire/calendar/img/logo.gif Binary files differnew file mode 100644 index 0000000..6b5397d --- /dev/null +++ b/scire/calendar/img/logo.gif diff --git a/scire/calendar/img/next.gif b/scire/calendar/img/next.gif Binary files differnew file mode 100644 index 0000000..bf02152 --- /dev/null +++ b/scire/calendar/img/next.gif diff --git a/scire/calendar/img/next_year.gif b/scire/calendar/img/next_year.gif Binary files differnew file mode 100644 index 0000000..ac12ea1 --- /dev/null +++ b/scire/calendar/img/next_year.gif diff --git a/scire/calendar/img/pixel.gif b/scire/calendar/img/pixel.gif Binary files differnew file mode 100644 index 0000000..46a2cf0 --- /dev/null +++ b/scire/calendar/img/pixel.gif diff --git a/scire/calendar/img/prev.gif b/scire/calendar/img/prev.gif Binary files differnew file mode 100644 index 0000000..211e1fa --- /dev/null +++ b/scire/calendar/img/prev.gif diff --git a/scire/calendar/img/prev_year.gif b/scire/calendar/img/prev_year.gif Binary files differnew file mode 100644 index 0000000..d8145d5 --- /dev/null +++ b/scire/calendar/img/prev_year.gif diff --git a/scire/calendar/img/tc.gif b/scire/calendar/img/tc.gif Binary files differnew file mode 100644 index 0000000..576e148 --- /dev/null +++ b/scire/calendar/img/tc.gif |