72e52b5fa6
Monotone-Revision: afea868d034dc2b80619494e70e70ef64acc3627 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-18T22:33:47 Monotone-Branch: ca.inverse.sogo
185 lines
7.4 KiB
HTML
185 lines
7.4 KiB
HTML
<!--
|
|
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 labels = window.opener.labels;
|
|
if (labels) {
|
|
for (var i = 0; i < ARR_MONTHS.length; i++) {
|
|
var string = ARR_MONTHS[i];
|
|
if (labels[string])
|
|
ARR_MONTHS[i] = labels[string];
|
|
}
|
|
|
|
if (labels['a2_Sunday'])
|
|
ARR_WEEKDAYS[0] = labels['a2_Sunday'];
|
|
if (labels['a2_Monday'])
|
|
ARR_WEEKDAYS[1] = labels['a2_Monday'];
|
|
if (labels['a2_Tuesday'])
|
|
ARR_WEEKDAYS[2] = labels['a2_Tuesday'];
|
|
if (labels['a2_Wednesday'])
|
|
ARR_WEEKDAYS[3] = labels['a2_Wednesday'];
|
|
if (labels['a2_Thursday'])
|
|
ARR_WEEKDAYS[4] = labels['a2_Thursday'];
|
|
if (labels['a2_Friday'])
|
|
ARR_WEEKDAYS[5] = labels['a2_Friday'];
|
|
if (labels['a2_Saturday'])
|
|
ARR_WEEKDAYS[6] = labels['a2_Saturday'];
|
|
}
|
|
|
|
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>
|
|
|