+2004-08-15 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * v0.9.41
+
+ * images/*: new images for UIxDatePicker and skycalendar.html.
+
+ * French.lproj/skycalendar.*, English.lproj/skycalendar.*: new js
+ based date picker taken from OGo.
+ NOTE: these files are currently NOT used/installed due to a bug
+ in SOPE. Instead, the non-localized versions are used. This will
+ go away as soon as the bug in SOPE is fixed.
+
+ * skycalendar.js, skycalendar.html: the non-localized versions as a
+ workaround to the problem described above.
+
+ * product.plist: added new images and the non-localized js date picker
+ as public resources.
+
+ * UIxDatePicker.[m,wox], UIxDatePickerScript.[m,wox]: new reusable
+ component for picking a date fancy style. ;-) Use UIxDatePickerScript
+ to load the necessary js code once in your component.
+
2004-08-15 Helge Hess <helge.hess@skyrix.com>
* v0.9.40
* UIxAppointmentView.wox, UIxCalWeekOverview.wox: minor cleanups
-2004-08-14 Marcus Mueller <znek@mulle-kybernetik.com>
+2004-08-15 Marcus Mueller <znek@mulle-kybernetik.com>
* v0.9.38
--- /dev/null
+<!--
+Title: Tigra Calendar
+Description: See the demo at url
+URL: http://www.softcomplex.com/products/tigra_calendar/
+Version: 3.1
+Date: 08-08-2002 (mm-dd-yyyy)
+Feedback: feedback@softcomplex.com (specify product title in the subject)
+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
+About us: Our company provides offshore IT consulting services.
+ Contact us at sales@softcomplex.com if you have any programming task you
+ want to be handled by professionals. Our typical hourly rate is $20.
+
+modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
+-->
+<html>
+<head>
+<title>Select Date, Please.</title>
+<style>
+ td {font-family: Tahoma, Verdana, sans-serif; font-size: 12px;}
+</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-Mo or 1-Su)
+var NUM_WEEKSTART = 1;
+// path to the directory where calendar images are stored. trailing slash req.
+var STR_ICONPATH = '';
+
+var re_url = new RegExp('datetime=(\\-?\\d+)');
+var dt_current = (re_url.exec(String(window.location))
+ ? new Date(new Number(RegExp.$1)) : new Date());
+var re_id = new RegExp('id=(\\d+)');
+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);
+dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);
+if (dt_prev_month.getDate() != dt_current.getDate())
+ dt_prev_month.setDate(0);
+
+// 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 = new Date(n_datetime);
+
+ if (!dt_datetime) {
+ alert('failed to generate date string');
+ return;
+ }
+ if (b_close) { // only set value when closing window
+ obj_caller.target.value = (document.cal
+ ? obj_caller.gen_tsmp(dt_datetime)
+ : obj_caller.gen_date(dt_datetime)
+ );
+ }
+ if (b_close) 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="#E8E8E0">
+<table cellspacing="1" cellpadding="3" border="0" width="100%">
+<tr><td colspan="7" bgcolor="#D0D0D0"><table cellspacing="0" cellpadding="0" border="0" width="100%">
+<tr>
+<script language="JavaScript">
+document.write(
+'<td>'+(obj_caller&&obj_caller.year_scroll?'<a href="javascript:set_datetime('+dt_prev_year.valueOf()+')"><img src="'+STR_ICONPATH+'first.gif" width="15" height="15" border="0" alt="previous year" title="previous year"></a> ':'')+'<a href="javascript:set_datetime('+dt_prev_month.valueOf()+')"><img src="'+STR_ICONPATH+'previous.gif" width="15" height="15" border="0" alt="previous month" title="previous month"></a></td>'+
+'<td align="center" width="100%"><font color="#000000">'+ARR_MONTHS[dt_current.getMonth()]+' '+dt_current.getFullYear() + '</font></td>'+
+'<td><a href="javascript:set_datetime('+dt_next_month.valueOf()+')"><img src="'+STR_ICONPATH+'next.gif" width="15" height="15" border="0" alt="next month" title="next month"></a>'+(obj_caller && obj_caller.year_scroll?' <a href="javascript:set_datetime('+dt_next_year.valueOf()+')"><img src="'+STR_ICONPATH+'last.gif" width="15" height="15" border="0" alt="next year" title="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="#D0D0D0" align="center"><font color="#000000">'+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_current.getDate() &&
+ dt_current_day.getMonth() == dt_current.getMonth())
+ // print current date
+ document.write('<td bgcolor="#F18D39" align="center" width="14%">');
+ //else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
+ else if (dt_current_day.getMonth() != dt_current.getMonth())
+ // old: weekend days // new: other month
+ document.write('<td bgcolor="#D0D0D0" align="center" width="14%">');
+ else
+ // print working days of current month
+ document.write('<td bgcolor="#E0E0E0" 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="#555555">');
+
+ 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>');
+</script>
+</table></tr></td>
+</table>
+</body>
+</html>
+
--- /dev/null
+// Title: Tigra Calendar
+// Description: See the demo at url
+// URL: http://www.softcomplex.com/products/tigra_calendar/
+// Version: 3.1 (European date format)
+// Date: 08-08-2002 (mm-dd-yyyy)
+// Feedback: feedback@softcomplex.com (specify product title in the subject)
+// 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
+// About us: Our company provides offshore IT consulting services.
+// Contact us at sales@softcomplex.com if you have any programming task you
+// want to be handled by professionals. Our typical hourly rate is $20.
+
+// modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
+// 2003-01-23 added date format support (Martin Hoerning)
+
+// if two digit year input dates after this year considered 20 century.
+var NUM_CENTYEAR = 30;
+// are year scrolling buttons required by default
+var BUL_YEARSCROLL = true;
+var DEF_CALPAGE = 'skycalendar.html';
+
+var calendars = [];
+var RE_NUM = /^\-?\d+$/;
+var dateFormat = "yyyy-mm-dd";
+
+function skycalendar(obj_target) {
+ // assing methods
+ this.gen_date = cal_gen_date1;
+ this.gen_tsmp = cal_gen_tsmp1;
+ this.prs_date = cal_prs_date1;
+ this.prs_tsmp = cal_prs_tsmp1;
+ this.popup = cal_popup1;
+ this.setCalendarPage = cal_setcalpage1;
+ this.setDateFormat = cal_setdateformat1;
+
+ // 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 tardet control");
+ this.target = obj_target;
+ this.year_scroll = BUL_YEARSCROLL;
+ this.calpage = DEF_CALPAGE;
+
+ // register in global collections
+ this.id = calendars.length;
+ calendars[this.id] = this;
+}
+
+function cal_setcalpage1(str_page) {
+ this.calpage = str_page;
+}
+
+function cal_setdateformat1(str_dateformat) {
+ this.dateFormat = str_dateformat;
+}
+
+function cal_popup1(str_datetime) {
+ this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.target.value);
+ if (!this.dt_current) return;
+
+ var obj_calwindow = window.open(
+ this.calpage+'?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
+ 'Calendar', 'width=200,height=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_tsmp1(dt_datetime) {
+ return this.gen_date(dt_datetime);
+}
+
+// date generating function
+function cal_gen_date1(dt_datetime) {
+ var out = this.dateFormat;
+ var idx;
+ if (out.indexOf("yyyy") != 1) {
+ t = out.split("yyyy");
+ out = t.join(dt_datetime.getFullYear());
+ }
+ else {
+ return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
+ }
+ if (out.indexOf("mm") != 1) {
+ t = out.split("mm");
+ out = t.join((dt_datetime.getMonth() < 9 ? '0' : '')+
+ (dt_datetime.getMonth()+1));
+ }
+ else {
+ return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
+ }
+ if (out.indexOf("dd") != 1) {
+ t = out.split("dd");
+ out = t.join((dt_datetime.getDate() < 10 ? '0' : '')+
+ dt_datetime.getDate());
+ }
+ else {
+ return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
+ }
+
+ return out;
+}
+
+// timestamp parsing function
+function cal_prs_tsmp1(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);
+
+ return this.prs_date(str_datetime);
+}
+
+// date parsing function
+function cal_prs_date1(str_date) {
+ var idx;
+ var year = null;
+ var month = null;
+ var day = null;
+
+ if (str_date.length != this.dateFormat.length) {
+ return cal_error ("Invalid date format: '"+str_date+
+ "'.\nFormat accepted is '"+this.dateFormat+"'.");
+ }
+
+ if ((idx = this.dateFormat.indexOf("yyyy")) != 1) {
+ year = str_date.substring(idx, idx+4);
+ }
+ else {
+ return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
+ }
+ if ((idx = this.dateFormat.indexOf("mm")) != 1) {
+ month = str_date.substring(idx, idx+2);
+ }
+ else {
+ return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
+ }
+ if ((idx = this.dateFormat.indexOf("dd")) != 1) {
+ day = str_date.substring(idx, idx+2);
+ }
+ else {
+ return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
+ }
+
+ if (!day) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo day of month value can be found.");
+ if (!RE_NUM.exec(day))
+ return cal_error("Invalid day of month value: '"+day+
+ "'.\nAllowed values are unsigned integers.");
+
+ if (!month) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo month of year value can be found.");
+ if (!RE_NUM.exec(month))
+ return cal_error("Invalid month of year value: '"+month+
+ "'.\nAllowed values are unsigned integers.");
+
+ if (!year) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo year value can be found.");
+ if (!RE_NUM.exec(year))
+ return cal_error("Invalid year value: '"+year+
+ "'.\nAllowed values are unsigned integers.");
+
+
+ var dt_date = new Date();
+ dt_date.setDate(1);
+ if (month < 1 || month > 12)
+ return cal_error("Invalid month value: '"+month+
+ "'.\nAllowed range is 01-12.");
+ dt_date.setMonth(month-1);
+ if (year < 100) year = Number(year)+(year < NUM_CENTYEAR ? 2000 : 1900);
+ dt_date.setFullYear(year);
+ var dt_numdays = new Date(year, month, 0);
+ dt_date.setDate(day);
+ if (dt_date.getMonth() != (month-1))
+ return cal_error("Invalid day of month value: '"+day+
+ "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");
+ return (dt_date);
+}
+
+function cal_error(str_message) {
+ alert (str_message);
+ return null;
+}
--- /dev/null
+<!--
+Title: Tigra Calendar
+Description: See the demo at url
+URL: http://www.softcomplex.com/products/tigra_calendar/
+Version: 3.1
+Date: 08-08-2002 (mm-dd-yyyy)
+Feedback: feedback@softcomplex.com (specify product title in the subject)
+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
+About us: Our company provides offshore IT consulting services.
+ Contact us at sales@softcomplex.com if you have any programming task you
+ want to be handled by professionals. Our typical hourly rate is $20.
+
+modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
+-->
+<html>
+<head>
+<title>Select Date, Please.</title>
+<style>
+ td {font-family: Tahoma, Verdana, sans-serif; font-size: 12px;}
+</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-Mo or 1-Su)
+var NUM_WEEKSTART = 1;
+// path to the directory where calendar images are stored. trailing slash req.
+var STR_ICONPATH = '';
+
+var re_url = new RegExp('datetime=(\\-?\\d+)');
+var dt_current = (re_url.exec(String(window.location))
+ ? new Date(new Number(RegExp.$1)) : new Date());
+var re_id = new RegExp('id=(\\d+)');
+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);
+dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);
+if (dt_prev_month.getDate() != dt_current.getDate())
+ dt_prev_month.setDate(0);
+
+// 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 = new Date(n_datetime);
+
+ if (!dt_datetime) {
+ alert('failed to generate date string');
+ return;
+ }
+ if (b_close) { // only set value when closing window
+ obj_caller.target.value = (document.cal
+ ? obj_caller.gen_tsmp(dt_datetime)
+ : obj_caller.gen_date(dt_datetime)
+ );
+ }
+ if (b_close) 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="#E8E8E0">
+<table cellspacing="1" cellpadding="3" border="0" width="100%">
+<tr><td colspan="7" bgcolor="#D0D0D0"><table cellspacing="0" cellpadding="0" border="0" width="100%">
+<tr>
+<script language="JavaScript">
+document.write(
+'<td>'+(obj_caller&&obj_caller.year_scroll?'<a href="javascript:set_datetime('+dt_prev_year.valueOf()+')"><img src="'+STR_ICONPATH+'first.gif" width="15" height="15" border="0" alt="previous year" title="previous year"></a> ':'')+'<a href="javascript:set_datetime('+dt_prev_month.valueOf()+')"><img src="'+STR_ICONPATH+'previous.gif" width="15" height="15" border="0" alt="previous month" title="previous month"></a></td>'+
+'<td align="center" width="100%"><font color="#000000">'+ARR_MONTHS[dt_current.getMonth()]+' '+dt_current.getFullYear() + '</font></td>'+
+'<td><a href="javascript:set_datetime('+dt_next_month.valueOf()+')"><img src="'+STR_ICONPATH+'next.gif" width="15" height="15" border="0" alt="next month" title="next month"></a>'+(obj_caller && obj_caller.year_scroll?' <a href="javascript:set_datetime('+dt_next_year.valueOf()+')"><img src="'+STR_ICONPATH+'last.gif" width="15" height="15" border="0" alt="next year" title="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="#D0D0D0" align="center"><font color="#000000">'+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_current.getDate() &&
+ dt_current_day.getMonth() == dt_current.getMonth())
+ // print current date
+ document.write('<td bgcolor="#F18D39" align="center" width="14%">');
+ //else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
+ else if (dt_current_day.getMonth() != dt_current.getMonth())
+ // old: weekend days // new: other month
+ document.write('<td bgcolor="#D0D0D0" align="center" width="14%">');
+ else
+ // print working days of current month
+ document.write('<td bgcolor="#E0E0E0" 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="#555555">');
+
+ 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>');
+</script>
+</table></tr></td>
+</table>
+</body>
+</html>
+
--- /dev/null
+// Title: Tigra Calendar
+// Description: See the demo at url
+// URL: http://www.softcomplex.com/products/tigra_calendar/
+// Version: 3.1 (European date format)
+// Date: 08-08-2002 (mm-dd-yyyy)
+// Feedback: feedback@softcomplex.com (specify product title in the subject)
+// 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
+// About us: Our company provides offshore IT consulting services.
+// Contact us at sales@softcomplex.com if you have any programming task you
+// want to be handled by professionals. Our typical hourly rate is $20.
+
+// modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
+// 2003-01-23 added date format support (Martin Hoerning)
+
+// if two digit year input dates after this year considered 20 century.
+var NUM_CENTYEAR = 30;
+// are year scrolling buttons required by default
+var BUL_YEARSCROLL = true;
+var DEF_CALPAGE = 'skycalendar.html';
+
+var calendars = [];
+var RE_NUM = /^\-?\d+$/;
+var dateFormat = "yyyy-mm-dd";
+
+function skycalendar(obj_target) {
+ // assing methods
+ this.gen_date = cal_gen_date1;
+ this.gen_tsmp = cal_gen_tsmp1;
+ this.prs_date = cal_prs_date1;
+ this.prs_tsmp = cal_prs_tsmp1;
+ this.popup = cal_popup1;
+ this.setCalendarPage = cal_setcalpage1;
+ this.setDateFormat = cal_setdateformat1;
+
+ // 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 tardet control");
+ this.target = obj_target;
+ this.year_scroll = BUL_YEARSCROLL;
+ this.calpage = DEF_CALPAGE;
+
+ // register in global collections
+ this.id = calendars.length;
+ calendars[this.id] = this;
+}
+
+function cal_setcalpage1(str_page) {
+ this.calpage = str_page;
+}
+
+function cal_setdateformat1(str_dateformat) {
+ this.dateFormat = str_dateformat;
+}
+
+function cal_popup1(str_datetime) {
+ this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.target.value);
+ if (!this.dt_current) return;
+
+ var obj_calwindow = window.open(
+ this.calpage+'?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
+ 'Calendar', 'width=200,height=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_tsmp1(dt_datetime) {
+ return this.gen_date(dt_datetime);
+}
+
+// date generating function
+function cal_gen_date1(dt_datetime) {
+ var out = this.dateFormat;
+ var idx;
+ if (out.indexOf("yyyy") != 1) {
+ t = out.split("yyyy");
+ out = t.join(dt_datetime.getFullYear());
+ }
+ else {
+ return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
+ }
+ if (out.indexOf("mm") != 1) {
+ t = out.split("mm");
+ out = t.join((dt_datetime.getMonth() < 9 ? '0' : '')+
+ (dt_datetime.getMonth()+1));
+ }
+ else {
+ return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
+ }
+ if (out.indexOf("dd") != 1) {
+ t = out.split("dd");
+ out = t.join((dt_datetime.getDate() < 10 ? '0' : '')+
+ dt_datetime.getDate());
+ }
+ else {
+ return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
+ }
+
+ return out;
+}
+
+// timestamp parsing function
+function cal_prs_tsmp1(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);
+
+ return this.prs_date(str_datetime);
+}
+
+// date parsing function
+function cal_prs_date1(str_date) {
+ var idx;
+ var year = null;
+ var month = null;
+ var day = null;
+
+ if (str_date.length != this.dateFormat.length) {
+ return cal_error ("Invalid date format: '"+str_date+
+ "'.\nFormat accepted is '"+this.dateFormat+"'.");
+ }
+
+ if ((idx = this.dateFormat.indexOf("yyyy")) != 1) {
+ year = str_date.substring(idx, idx+4);
+ }
+ else {
+ return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
+ }
+ if ((idx = this.dateFormat.indexOf("mm")) != 1) {
+ month = str_date.substring(idx, idx+2);
+ }
+ else {
+ return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
+ }
+ if ((idx = this.dateFormat.indexOf("dd")) != 1) {
+ day = str_date.substring(idx, idx+2);
+ }
+ else {
+ return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
+ }
+
+ if (!day) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo day of month value can be found.");
+ if (!RE_NUM.exec(day))
+ return cal_error("Invalid day of month value: '"+day+
+ "'.\nAllowed values are unsigned integers.");
+
+ if (!month) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo month of year value can be found.");
+ if (!RE_NUM.exec(month))
+ return cal_error("Invalid month of year value: '"+month+
+ "'.\nAllowed values are unsigned integers.");
+
+ if (!year) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo year value can be found.");
+ if (!RE_NUM.exec(year))
+ return cal_error("Invalid year value: '"+year+
+ "'.\nAllowed values are unsigned integers.");
+
+
+ var dt_date = new Date();
+ dt_date.setDate(1);
+ if (month < 1 || month > 12)
+ return cal_error("Invalid month value: '"+month+
+ "'.\nAllowed range is 01-12.");
+ dt_date.setMonth(month-1);
+ if (year < 100) year = Number(year)+(year < NUM_CENTYEAR ? 2000 : 1900);
+ dt_date.setFullYear(year);
+ var dt_numdays = new Date(year, month, 0);
+ dt_date.setDate(day);
+ if (dt_date.getMonth() != (month-1))
+ return cal_error("Invalid day of month value: '"+day+
+ "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");
+ return (dt_date);
+}
+
+function cal_error(str_message) {
+ alert (str_message);
+ return null;
+}
UIxCalDateLabel.m \
UIxCalBackForthNavView.m \
UIxAppointmentProposal.m \
+ UIxDatePicker.m \
+ UIxDatePickerScript.m \
SchedulerUI_RESOURCE_FILES += \
Version \
UIxCalSelectTab.wox \
UIxCalDateLabel.wox \
UIxCalBackForthNavView.wox \
- UIxAppointmentProposal.wox
+ UIxAppointmentProposal.wox \
+ UIxDatePicker.wox \
+ UIxDatePickerScript.wox \
SchedulerUI_RESOURCE_FILES += \
images/next_week.gif \
images/icon_view_list.gif \
images/icon_view_list_inactive.gif \
images/icon_view_columns.gif \
- images/icon_view_columns_inactive.gif
+ images/icon_view_columns_inactive.gif \
+ images/icon_popupcalendar.gif \
+ images/first.gif \
+ images/previous.gif \
+ images/next.gif \
+ images/last.gif \
SchedulerUI_LOCALIZED_RESOURCE_FILES += \
- default.strings
+ default.strings \
+
+# if SoProduct is fixed to enable localized resources, add this to
+# SchedulerUI_LOCALIZED_RESOURCE_FILES instead
+SchedulerUI_RESOURCE_FILES += \
+ skycalendar.html \
+ skycalendar.js \
ADDITIONAL_INCLUDE_DIRS += \
-I.. -I../.. -I../../..
--- /dev/null
+/*
+ Copyright (C) 2000-2004 SKYRIX Software AG
+
+ This file is part of OGo
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+// $Id$
+
+
+#include <NGObjWeb/NGObjWeb.h>
+
+
+@interface UIxDatePicker : WOComponent
+{
+ NSString *dateID;
+ NSCalendarDate *date;
+ NSString *label;
+}
+
+- (NSString *)dateID;
+- (NSString *)dateFormat;
+
+@end
+
+@implementation UIxDatePicker
+
+- (void)dealloc {
+ [self->dateID release];
+ [self->date release];
+ [self->label release];
+ [super dealloc];
+}
+
+/* Accessors */
+
+- (void)setDateID:(NSString *)_dateID {
+ ASSIGN(self->dateID, _dateID);
+}
+- (NSString *)dateID {
+ return self->dateID;
+}
+
+- (void)setDate:(NSCalendarDate *)_date {
+ ASSIGN(self->date, _date);
+}
+- (NSCalendarDate *)date {
+ return self->date;
+}
+
+- (void)setLabel:(NSString *)_label {
+ ASSIGN(self->label, _label);
+}
+- (NSString *)label {
+ return self->label;
+}
+
+- (NSString *)formattedDateString {
+ return [date descriptionWithCalendarFormat:@"%Y-%m-%d"];
+}
+
+- (NSString *)dateFormat {
+ return @"yyyy-mm-dd";
+}
+
+- (NSString *)calendarPageURL {
+ WOResourceManager *rm;
+ WOContext *ctx;
+ NSArray *languages;
+
+ if ((rm = [self resourceManager]) == nil)
+ rm = [[WOApplication application] resourceManager];
+ if (rm == nil)
+ [self debugWithFormat:@"WARNING: missing resource manager!"];
+
+ /* lookup languages */
+
+ ctx = [self context];
+#if 0
+ languages = [ctx hasSession]
+ ? [[ctx session] languages]
+ : [[ctx request] browserLanguages];
+#else
+#warning !! FIX SoProduct to enable localizable resource, then disable this!
+ languages = nil;
+#endif
+
+ return [rm urlForResourceNamed:@"skycalendar.html"
+ inFramework:nil
+ languages:languages
+ request:[ctx request]];
+}
+
+/* JavaScript */
+
+- (NSString *)jsPopup {
+ return [NSString stringWithFormat:@"javascript:calendar_%@.popup()",
+ [self dateID]];
+}
+
+- (NSString *)jsCode {
+ static NSString *code = \
+ @"var calendar_%@ = new skycalendar(document.getElementById('%@'));\n"
+ @"calendar_%@.setCalendarPage('%@');\n"
+ @"calendar_%@.setDateFormat('%@');\n";
+
+ return [NSString stringWithFormat:code,
+ self->dateID,
+ self->dateID,
+ self->dateID,
+ [self calendarPageURL],
+ self->dateID,
+ [self dateFormat]];
+}
+
+@end
--- /dev/null
+<?xml version='1.0' standalone='yes'?>
+
+<span xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:var="http://www.skyrix.com/od/binding"
+ xmlns:const="http://www.skyrix.com/od/constant"
+ xmlns:rsrc="OGo:url"
+>
+ <input type="text"
+ var:name="dateID"
+ var:id="dateID"
+ var:value="formattedDateString"
+ size="12"
+ /><a var:href="jsPopup"
+ ><img rsrc:src="icon_popupcalendar.gif"
+ var:title="label"
+ var:alt="label"
+ border="0"
+ /></a>
+ <script language="JavaScript">
+ <var:string value="jsCode" />\r </script>
+</span>
\ No newline at end of file
--- /dev/null
+/*
+ Copyright (C) 2000-2004 SKYRIX Software AG
+
+ This file is part of OGo
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+// $Id$
+
+
+#include <NGObjWeb/NGObjWeb.h>
+
+
+@interface UIxDatePickerScript : WOComponent
+{
+
+}
+
+@end
+
+
+@implementation UIxDatePickerScript
+
+@end
--- /dev/null
+<?xml version='1.0' standalone='yes'?>
+
+<script xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:var="http://www.skyrix.com/od/binding"
+ xmlns:const="http://www.skyrix.com/od/constant"
+ xmlns:rsrc="OGo:url"
+ language="JavaScript"
+ rsrc:src="skycalendar.js"
+>
+</script>
\ No newline at end of file
# $Id$
-SUBMINOR_VERSION:=40
+SUBMINOR_VERSION:=41
+# v0.9.41 requires libNGObjWeb v4.2.431
# v0.9.31 requires libWEExtensions v4.2.52
# v0.9.29 requires libWEExtensions v4.2.51
icon_view_list.gif,
icon_view_list_inactive.gif,
icon_view_columns.gif,
- icon_view_columns_inactive.gif
+ icon_view_columns_inactive.gif,
+ icon_popupcalendar.gif,
+ first.gif,
+ previous.gif,
+ next.gif,
+ last.gif,
+ skycalendar.html,
+ skycalendar.js
);
factories = {
--- /dev/null
+<!--
+Title: Tigra Calendar
+Description: See the demo at url
+URL: http://www.softcomplex.com/products/tigra_calendar/
+Version: 3.1
+Date: 08-08-2002 (mm-dd-yyyy)
+Feedback: feedback@softcomplex.com (specify product title in the subject)
+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
+About us: Our company provides offshore IT consulting services.
+ Contact us at sales@softcomplex.com if you have any programming task you
+ want to be handled by professionals. Our typical hourly rate is $20.
+
+modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
+-->
+<html>
+<head>
+<title>Select Date, Please.</title>
+<style>
+ td {font-family: Tahoma, Verdana, sans-serif; font-size: 12px;}
+</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-Mo or 1-Su)
+var NUM_WEEKSTART = 1;
+// path to the directory where calendar images are stored. trailing slash req.
+var STR_ICONPATH = '';
+
+var re_url = new RegExp('datetime=(\\-?\\d+)');
+var dt_current = (re_url.exec(String(window.location))
+ ? new Date(new Number(RegExp.$1)) : new Date());
+var re_id = new RegExp('id=(\\d+)');
+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);
+dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);
+if (dt_prev_month.getDate() != dt_current.getDate())
+ dt_prev_month.setDate(0);
+
+// 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 = new Date(n_datetime);
+
+ if (!dt_datetime) {
+ alert('failed to generate date string');
+ return;
+ }
+ if (b_close) { // only set value when closing window
+ obj_caller.target.value = (document.cal
+ ? obj_caller.gen_tsmp(dt_datetime)
+ : obj_caller.gen_date(dt_datetime)
+ );
+ }
+ if (b_close) 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="#E8E8E0">
+<table cellspacing="1" cellpadding="3" border="0" width="100%">
+<tr><td colspan="7" bgcolor="#D0D0D0"><table cellspacing="0" cellpadding="0" border="0" width="100%">
+<tr>
+<script language="JavaScript">
+document.write(
+'<td>'+(obj_caller&&obj_caller.year_scroll?'<a href="javascript:set_datetime('+dt_prev_year.valueOf()+')"><img src="'+STR_ICONPATH+'first.gif" width="15" height="15" border="0" alt="previous year" title="previous year"></a> ':'')+'<a href="javascript:set_datetime('+dt_prev_month.valueOf()+')"><img src="'+STR_ICONPATH+'previous.gif" width="15" height="15" border="0" alt="previous month" title="previous month"></a></td>'+
+'<td align="center" width="100%"><font color="#000000">'+ARR_MONTHS[dt_current.getMonth()]+' '+dt_current.getFullYear() + '</font></td>'+
+'<td><a href="javascript:set_datetime('+dt_next_month.valueOf()+')"><img src="'+STR_ICONPATH+'next.gif" width="15" height="15" border="0" alt="next month" title="next month"></a>'+(obj_caller && obj_caller.year_scroll?' <a href="javascript:set_datetime('+dt_next_year.valueOf()+')"><img src="'+STR_ICONPATH+'last.gif" width="15" height="15" border="0" alt="next year" title="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="#D0D0D0" align="center"><font color="#000000">'+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_current.getDate() &&
+ dt_current_day.getMonth() == dt_current.getMonth())
+ // print current date
+ document.write('<td bgcolor="#F18D39" align="center" width="14%">');
+ //else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
+ else if (dt_current_day.getMonth() != dt_current.getMonth())
+ // old: weekend days // new: other month
+ document.write('<td bgcolor="#D0D0D0" align="center" width="14%">');
+ else
+ // print working days of current month
+ document.write('<td bgcolor="#E0E0E0" 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="#555555">');
+
+ 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>');
+</script>
+</table></tr></td>
+</table>
+</body>
+</html>
+
--- /dev/null
+// Title: Tigra Calendar
+// Description: See the demo at url
+// URL: http://www.softcomplex.com/products/tigra_calendar/
+// Version: 3.1 (European date format)
+// Date: 08-08-2002 (mm-dd-yyyy)
+// Feedback: feedback@softcomplex.com (specify product title in the subject)
+// 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
+// About us: Our company provides offshore IT consulting services.
+// Contact us at sales@softcomplex.com if you have any programming task you
+// want to be handled by professionals. Our typical hourly rate is $20.
+
+// modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
+// 2003-01-23 added date format support (Martin Hoerning)
+
+// if two digit year input dates after this year considered 20 century.
+var NUM_CENTYEAR = 30;
+// are year scrolling buttons required by default
+var BUL_YEARSCROLL = true;
+var DEF_CALPAGE = 'skycalendar.html';
+
+var calendars = [];
+var RE_NUM = /^\-?\d+$/;
+var dateFormat = "yyyy-mm-dd";
+
+function skycalendar(obj_target) {
+ // assing methods
+ this.gen_date = cal_gen_date1;
+ this.gen_tsmp = cal_gen_tsmp1;
+ this.prs_date = cal_prs_date1;
+ this.prs_tsmp = cal_prs_tsmp1;
+ this.popup = cal_popup1;
+ this.setCalendarPage = cal_setcalpage1;
+ this.setDateFormat = cal_setdateformat1;
+
+ // 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 tardet control");
+ this.target = obj_target;
+ this.year_scroll = BUL_YEARSCROLL;
+ this.calpage = DEF_CALPAGE;
+
+ // register in global collections
+ this.id = calendars.length;
+ calendars[this.id] = this;
+}
+
+function cal_setcalpage1(str_page) {
+ this.calpage = str_page;
+}
+
+function cal_setdateformat1(str_dateformat) {
+ this.dateFormat = str_dateformat;
+}
+
+function cal_popup1(str_datetime) {
+ this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.target.value);
+ if (!this.dt_current) return;
+
+ var obj_calwindow = window.open(
+ this.calpage+'?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
+ 'Calendar', 'width=200,height=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_tsmp1(dt_datetime) {
+ return this.gen_date(dt_datetime);
+}
+
+// date generating function
+function cal_gen_date1(dt_datetime) {
+ var out = this.dateFormat;
+ var idx;
+ if (out.indexOf("yyyy") != 1) {
+ t = out.split("yyyy");
+ out = t.join(dt_datetime.getFullYear());
+ }
+ else {
+ return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
+ }
+ if (out.indexOf("mm") != 1) {
+ t = out.split("mm");
+ out = t.join((dt_datetime.getMonth() < 9 ? '0' : '')+
+ (dt_datetime.getMonth()+1));
+ }
+ else {
+ return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
+ }
+ if (out.indexOf("dd") != 1) {
+ t = out.split("dd");
+ out = t.join((dt_datetime.getDate() < 10 ? '0' : '')+
+ dt_datetime.getDate());
+ }
+ else {
+ return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
+ }
+
+ return out;
+}
+
+// timestamp parsing function
+function cal_prs_tsmp1(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);
+
+ return this.prs_date(str_datetime);
+}
+
+// date parsing function
+function cal_prs_date1(str_date) {
+ var idx;
+ var year = null;
+ var month = null;
+ var day = null;
+
+ if (str_date.length != this.dateFormat.length) {
+ return cal_error ("Invalid date format: '"+str_date+
+ "'.\nFormat accepted is '"+this.dateFormat+"'.");
+ }
+
+ if ((idx = this.dateFormat.indexOf("yyyy")) != 1) {
+ year = str_date.substring(idx, idx+4);
+ }
+ else {
+ return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
+ }
+ if ((idx = this.dateFormat.indexOf("mm")) != 1) {
+ month = str_date.substring(idx, idx+2);
+ }
+ else {
+ return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
+ }
+ if ((idx = this.dateFormat.indexOf("dd")) != 1) {
+ day = str_date.substring(idx, idx+2);
+ }
+ else {
+ return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
+ }
+
+ if (!day) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo day of month value can be found.");
+ if (!RE_NUM.exec(day))
+ return cal_error("Invalid day of month value: '"+day+
+ "'.\nAllowed values are unsigned integers.");
+
+ if (!month) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo month of year value can be found.");
+ if (!RE_NUM.exec(month))
+ return cal_error("Invalid month of year value: '"+month+
+ "'.\nAllowed values are unsigned integers.");
+
+ if (!year) return cal_error("Invalid date format: '"+str_date+
+ "'.\nNo year value can be found.");
+ if (!RE_NUM.exec(year))
+ return cal_error("Invalid year value: '"+year+
+ "'.\nAllowed values are unsigned integers.");
+
+
+ var dt_date = new Date();
+ dt_date.setDate(1);
+ if (month < 1 || month > 12)
+ return cal_error("Invalid month value: '"+month+
+ "'.\nAllowed range is 01-12.");
+ dt_date.setMonth(month-1);
+ if (year < 100) year = Number(year)+(year < NUM_CENTYEAR ? 2000 : 1900);
+ dt_date.setFullYear(year);
+ var dt_numdays = new Date(year, month, 0);
+ dt_date.setDate(day);
+ if (dt_date.getMonth() != (month-1))
+ return cal_error("Invalid day of month value: '"+day+
+ "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");
+ return (dt_date);
+}
+
+function cal_error(str_message) {
+ alert (str_message);
+ return null;
+}