From 9f1a3a4e84ea1fa9c506f433280dd4e27336a2c4 Mon Sep 17 00:00:00 2001
From: Ralf Becker November 5, 2003 February 6, 2004
-calendar version: 0.9.5 “Your favorite time, bis”
+calendar version: 0.9.6 “Keep cool but don’t freeze”
November 5, 2003
containing navigation buttons */
+ background: #007ED1;
+ color: #fff;
+}
+
+.calendar thead .daynames { /* Row containing the day names */
+ background: #C7E1F3;
+}
+
+.calendar thead .name { /* Cells containing the day names */
+ border-bottom: 1px solid #206A9B;
+ padding: 2px;
+ text-align: center;
+ color: #000;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+ color: #a66;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+ background-color: #34ABFA;
+ color: #000;
+ border: 1px solid #016DC5;
+ padding: 1px;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+ background-color: #006AA9;
+ border: 1px solid #008AFF;
+ padding: 2px 0px 0px 2px;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells containing month days dates */
+ width: 2em;
+ color: #456;
+ text-align: right;
+ padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #bbb;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #fbb;
+}
+
+.calendar table .wn {
+ padding: 2px 3px 2px 2px;
+ border-right: 1px solid #000;
+ background: #C7E1F3;
+}
+
+.calendar tbody .rowhilite td {
+ background: #def;
+}
+
+.calendar tbody .rowhilite td.wn {
+ background: #F1F8FC;
+}
+
+.calendar tbody td.hilite { /* Hovered cells */
+ background: #def;
+ padding: 1px 3px 1px 1px;
+ border: 1px solid #8FC4E8;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells */
+ background: #cde;
+ padding: 2px 2px 0px 2px;
+}
+
+.calendar tbody td.selected { /* Cell showing today date */
+ font-weight: bold;
+ border: 1px solid #000;
+ padding: 1px 3px 1px 1px;
+ background: #fff;
+ color: #000;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+ color: #a66;
+}
+
+.calendar tbody td.today { /* Cell showing selected date */
+ font-weight: bold;
+ color: #D50000;
+}
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+ visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+ display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The in footer (only one right now) */
+ text-align: center;
+ background: #206A9B;
+ color: #fff;
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell */
+ background: #000;
+ color: #fff;
+ border-top: 1px solid #206A9B;
+ padding: 1px;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+ background: #B8DAF0;
+ border: 1px solid #178AEB;
+ color: #000;
+ padding: 1px;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+ background: #006AA9;
+ padding: 2px 0px 0px 2px;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+ position: absolute;
+ display: none;
+ top: 0px;
+ left: 0px;
+ width: 4em;
+ cursor: default;
+ border: 1px solid #655;
+ background: #def;
+ color: #000;
+ font-size: 90%;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+ text-align: center;
+ padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+ width: 4em;
+}
+
+.calendar .combo .hilite {
+ background: #34ABFA;
+ border-top: 1px solid #46a;
+ border-bottom: 1px solid #46a;
+ font-weight: bold;
+}
+
+.calendar .combo .active {
+ border-top: 1px solid #46a;
+ border-bottom: 1px solid #46a;
+ background: #F1F8FC;
+ font-weight: bold;
+}
+
+.calendar td.time {
+ border-top: 1px solid #000;
+ padding: 1px 0px;
+ text-align: center;
+ background-color: #E3F0F9;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+ padding: 0px 3px 0px 4px;
+ border: 1px solid #889;
+ font-weight: bold;
+ background-color: #F1F8FC;
+}
+
+.calendar td.time .ampm {
+ text-align: center;
+}
+
+.calendar td.time .colon {
+ padding: 0px 2px 0px 3px;
+ font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+ border-color: #000;
+ background-color: #267DB7;
+ color: #fff;
+}
+
+.calendar td.time span.active {
+ border-color: red;
+ background-color: #000;
+ color: #A5FF00;
+}
diff --git a/phpgwapi/js/jscalendar/calendar-brown.css b/phpgwapi/js/jscalendar/calendar-brown.css
index 4ecc36d918..ed638c4600 100644
--- a/phpgwapi/js/jscalendar/calendar-brown.css
+++ b/phpgwapi/js/jscalendar/calendar-brown.css
@@ -69,6 +69,13 @@ div.calendar { position: relative; }
text-align: right;
padding: 2px 4px 2px 2px;
}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #bbb;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #fbb;
+}
.calendar table .wn {
padding: 2px 3px 2px 2px;
@@ -145,7 +152,7 @@ div.calendar { position: relative; }
/* Combo boxes (menus that display months/years for direct selection) */
-.combo {
+.calendar .combo {
position: absolute;
display: none;
top: 0px;
@@ -155,24 +162,24 @@ div.calendar { position: relative; }
border: 1px solid #655;
background: #ffe;
color: #000;
- font-size: smaller;
+ font-size: 90%;
}
-.combo .label,
-.combo .label-IEfix {
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
-.combo .label-IEfix {
+.calendar .combo .label-IEfix {
width: 4em;
}
-.combo .hilite {
+.calendar .combo .hilite {
background: #fc8;
}
-.combo .active {
+.calendar .combo .active {
border-top: 1px solid #a64;
border-bottom: 1px solid #a64;
background: #fee;
diff --git a/phpgwapi/js/jscalendar/calendar-green.css b/phpgwapi/js/jscalendar/calendar-green.css
index 55bb8aed50..df04de2a5d 100644
--- a/phpgwapi/js/jscalendar/calendar-green.css
+++ b/phpgwapi/js/jscalendar/calendar-green.css
@@ -71,6 +71,13 @@ div.calendar { position: relative; }
text-align: right;
padding: 2px 4px 2px 2px;
}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #bbb;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #fbb;
+}
.calendar table .wn {
padding: 2px 3px 2px 2px;
@@ -149,7 +156,7 @@ div.calendar { position: relative; }
/* Combo boxes (menus that display months/years for direct selection) */
-.combo {
+.calendar .combo {
position: absolute;
display: none;
top: 0px;
@@ -159,24 +166,24 @@ div.calendar { position: relative; }
border: 1px solid #565;
background: #efd;
color: #000;
- font-size: smaller;
+ font-size: 90%;
}
-.combo .label,
-.combo .label-IEfix {
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
-.combo .label-IEfix {
+.calendar .combo .label-IEfix {
width: 4em;
}
-.combo .hilite {
+.calendar .combo .hilite {
background: #af8;
}
-.combo .active {
+.calendar .combo .active {
border-top: 1px solid #6a4;
border-bottom: 1px solid #6a4;
background: #efe;
diff --git a/phpgwapi/js/jscalendar/calendar-setup.js b/phpgwapi/js/jscalendar/calendar-setup.js
index 856f4834fe..83ff12ea2b 100644
--- a/phpgwapi/js/jscalendar/calendar-setup.js
+++ b/phpgwapi/js/jscalendar/calendar-setup.js
@@ -36,8 +36,8 @@
* ifFormat | date format that will be stored in the input field
* daFormat | the date format that will be used to display the date in displayArea
* singleClick | (true/false) wether the calendar is in single click mode or not (default: true)
- * mondayFirst | (true/false) if true Monday is the first day of week, Sunday otherwise (default: true)
- * align | alignment (default: "Bl"); if you don't know what's this see the calendar documentation
+ * firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc.
+ * align | alignment (default: "Br"); if you don't know what's this see the calendar documentation
* range | array with 2 elements. Default: [1900, 2999] -- the range of years available
* weekNumbers | (true/false) if it's true (default) the calendar will display week numbers
* flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID
@@ -49,6 +49,11 @@
* date | the date that the calendar will be initially displayed to
* showsTime | default: false; if true the calendar will include a time selector
* timeFormat | the time format; can be "12" or "24", default is "12"
+ * electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close
+ * step | configures the step of the years in drop-down boxes; default: 2
+ * position | configures the calendar absolute position; default: null
+ * cache | if "true" (but default: "false") it will reuse the same calendar object, where possible
+ * showOthers | if "true" (but default: "false") it will show days from other months too
*
* None of them is required, they all have default values. However, if you
* pass none of "inputField", "displayArea" or "button" you'll get a warning
@@ -66,8 +71,8 @@ Calendar.setup = function (params) {
param_default("singleClick", true);
param_default("disableFunc", null);
param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined
- param_default("mondayFirst", true);
- param_default("align", "Bl");
+ param_default("firstDay", 0); // defaults to "Sunday" first
+ param_default("align", "Br");
param_default("range", [1900, 2999]);
param_default("weekNumbers", true);
param_default("flat", null);
@@ -78,6 +83,11 @@ Calendar.setup = function (params) {
param_default("date", null);
param_default("showsTime", false);
param_default("timeFormat", "24");
+ param_default("electric", true);
+ param_default("step", 2);
+ param_default("position", null);
+ param_default("cache", false);
+ param_default("showOthers", false);
var tmp = ["inputField", "displayArea", "button"];
for (var i in tmp) {
@@ -91,35 +101,36 @@ Calendar.setup = function (params) {
}
function onSelect(cal) {
- if (cal.params.flat) {
- if (typeof cal.params.flatCallback == "function") {
- cal.params.flatCallback(cal);
- } else {
+ var p = cal.params;
+ var update = (cal.dateClicked || p.electric);
+ if (update && p.flat) {
+ if (typeof p.flatCallback == "function")
+ p.flatCallback(cal);
+ else
alert("No flatCallback given -- doing nothing.");
- }
return false;
}
- if (cal.params.inputField) {
- cal.params.inputField.value = cal.date.print(cal.params.ifFormat);
+ if (update && p.inputField) {
+ p.inputField.value = cal.date.print(p.ifFormat);
+ if (typeof p.inputField.onchange == "function")
+ p.inputField.onchange();
}
- if (cal.params.displayArea) {
- cal.params.displayArea.innerHTML = cal.date.print(cal.params.daFormat);
- }
- if (cal.params.singleClick && cal.dateClicked) {
+ if (update && p.displayArea)
+ p.displayArea.innerHTML = cal.date.print(p.daFormat);
+ if (update && p.singleClick && cal.dateClicked)
cal.callCloseHandler();
- }
- if (typeof cal.params.onUpdate == "function") {
- cal.params.onUpdate(cal);
- }
+ if (update && typeof p.onUpdate == "function")
+ p.onUpdate(cal);
};
if (params.flat != null) {
- params.flat = document.getElementById(params.flat);
+ if (typeof params.flat == "string")
+ params.flat = document.getElementById(params.flat);
if (!params.flat) {
alert("Calendar.setup:\n Flat specified but can't find parent.");
return false;
}
- var cal = new Calendar(params.mondayFirst, params.date, params.onSelect || onSelect);
+ var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect);
cal.showsTime = params.showsTime;
cal.time24 = (params.timeFormat == "24");
cal.params = params;
@@ -137,8 +148,8 @@ Calendar.setup = function (params) {
var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
var mustCreate = false;
var cal = window.calendar;
- if (!window.calendar) {
- window.calendar = cal = new Calendar(params.mondayFirst,
+ if (!(cal && params.cache)) {
+ window.calendar = cal = new Calendar(params.firstDay,
params.date,
params.onSelect || onSelect,
params.onClose || function(cal) { cal.hide(); });
@@ -147,8 +158,12 @@ Calendar.setup = function (params) {
cal.weekNumbers = params.weekNumbers;
mustCreate = true;
} else {
+ if (params.date)
+ cal.setDate(params.date);
cal.hide();
}
+ cal.showsOtherMonths = params.showOthers;
+ cal.yearStep = params.step;
cal.setRange(params.range[0], params.range[1]);
cal.params = params;
cal.setDateStatusHandler(params.dateStatusFunc);
@@ -157,7 +172,10 @@ Calendar.setup = function (params) {
cal.create();
cal.parseDate(dateEl.value || dateEl.innerHTML);
cal.refresh();
- cal.showAtElement(params.displayArea || params.inputField, params.align);
+ if (!params.position)
+ cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
+ else
+ cal.showAt(params.position[0], params.position[1]);
return false;
};
};
diff --git a/phpgwapi/js/jscalendar/calendar-setup_stripped.js b/phpgwapi/js/jscalendar/calendar-setup_stripped.js
index 8d3aabe6d4..cc641432d9 100644
--- a/phpgwapi/js/jscalendar/calendar-setup_stripped.js
+++ b/phpgwapi/js/jscalendar/calendar-setup_stripped.js
@@ -18,4 +18,4 @@
* modify this code to suit your needs (this is recommended and much better
* than modifying calendar.js itself).
*/
- Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("mondayFirst",true);param_default("align","Bl");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){if(cal.params.flat){if(typeof cal.params.flatCallback=="function"){cal.params.flatCallback(cal);}else{alert("No flatCallback given -- doing nothing.");}return false;}if(cal.params.inputField){cal.params.inputField.value=cal.date.print(cal.params.ifFormat);}if(cal.params.displayArea){cal.params.displayArea.innerHTML=cal.date.print(cal.params.daFormat);}if(cal.params.singleClick&&cal.dateClicked){cal.callCloseHandler();}if(typeof cal.params.onUpdate=="function"){cal.params.onUpdate(cal);}};if(params.flat!=null){params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.mondayFirst,params.date,params.onSelect||onSelect);cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(!window.calendar){window.calendar=cal=new Calendar(params.mondayFirst,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{cal.hide();}cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.parseDate(dateEl.value||dateEl.innerHTML);cal.refresh();cal.showAtElement(params.displayArea||params.inputField,params.align);return false;};};
\ No newline at end of file
+ Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("firstDay",0);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);else alert("No flatCallback given -- doing nothing.");return false;}if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(!(cal&¶ms.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.parseDate(dateEl.value||dateEl.innerHTML);cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};};
\ No newline at end of file
diff --git a/phpgwapi/js/jscalendar/calendar-system.css b/phpgwapi/js/jscalendar/calendar-system.css
index 3bc1b1c983..805596967b 100644
--- a/phpgwapi/js/jscalendar/calendar-system.css
+++ b/phpgwapi/js/jscalendar/calendar-system.css
@@ -82,6 +82,13 @@
text-align: right;
padding: 2px 4px 2px 2px;
}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #faa;
+}
.calendar table .wn {
padding: 2px 3px 2px 2px;
@@ -170,7 +177,7 @@
/* Combo boxes (menus that display months/years for direct selection) */
-.combo {
+.calendar .combo {
position: absolute;
display: none;
width: 4em;
@@ -181,26 +188,26 @@
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
background: Menu;
color: MenuText;
- font-size: smaller;
+ font-size: 90%;
padding: 1px;
}
-.combo .label,
-.combo .label-IEfix {
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
-.combo .label-IEfix {
+.calendar .combo .label-IEfix {
width: 4em;
}
-.combo .active {
+.calendar .combo .active {
padding: 0px;
border: 1px solid #000;
}
-.combo .hilite {
+.calendar .combo .hilite {
background: Highlight;
color: HighlightText;
}
diff --git a/phpgwapi/js/jscalendar/calendar-tas.css b/phpgwapi/js/jscalendar/calendar-tas.css
new file mode 100644
index 0000000000..c336e71489
--- /dev/null
+++ b/phpgwapi/js/jscalendar/calendar-tas.css
@@ -0,0 +1,238 @@
+/* The main calendar widget. DIV containing a table. */
+
+div.calendar { position: relative; }
+
+.calendar, .calendar table {
+ border: 1px solid #655;
+ font-size: 11px;
+ color: #000;
+ cursor: default;
+ background: #ffd;
+ font-family: tahoma,verdana,sans-serif;
+ filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF);
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+ text-align: center; /* They are the navigation buttons */
+ padding: 2px; /* Make the buttons seem like they're pressing */
+ color:#363636;
+}
+
+.calendar .nav {
+ background: #edc url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+ font-weight: bold; /* Pressing it will take you to the current date */
+ text-align: center;
+ background: #654;
+ color: #363636;
+ padding: 2px;
+ filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#dddccc);
+}
+
+.calendar thead .headrow { /* Row containing navigation buttons */
+ /*background: #3B86A0;*/
+ color: #363636;
+ font-weight: bold;
+filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#3b86a0);
+}
+
+.calendar thead .name { /* Cells containing the day names */
+ border-bottom: 1px solid #655;
+ padding: 2px;
+ text-align: center;
+ color: #363636;
+ filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF);
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+ color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+ background-color: #ffcc86;
+ color: #000;
+ border: 1px solid #b59345;
+ padding: 1px;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+ background-color: #c77;
+ padding: 2px 0px 0px 2px;
+}
+
+.calendar thead .daynames { /* Row containing the day names */
+ background: #fed;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells containing month days dates */
+ width: 2em;
+ text-align: right;
+ padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #faa;
+}
+
+.calendar table .wn {
+ padding: 2px 3px 2px 2px;
+ border-right: 1px solid #000;
+ background: #fed;
+}
+
+.calendar tbody .rowhilite td {
+ background: #ddf;
+
+}
+
+.calendar tbody .rowhilite td.wn {
+ background: #efe;
+}
+
+.calendar tbody td.hilite { /* Hovered cells */
+ background: #ffe;
+ padding: 1px 3px 1px 1px;
+ border: 1px solid #bbb;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells */
+ background: #ddc;
+ padding: 2px 2px 0px 2px;
+}
+
+.calendar tbody td.selected { /* Cell showing today date */
+ font-weight: bold;
+ border: 1px solid #000;
+ padding: 1px 3px 1px 1px;
+ background: #fea;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+ color: #f00;
+}
+
+.calendar tbody td.today { font-weight: bold; }
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+ visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+ display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The in footer (only one right now) */
+ text-align: center;
+ background: #988;
+ color: #000;
+
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell
- */
+ border-top: 1px solid #655;
+ background: #dcb;
+ color: #363636;
+ font-weight: bold;
+ filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#FFFFFF,EndColorStr=#DDDCCC);
+}
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+ background: #faa;
+ border: 1px solid #f40;
+ padding: 1px;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+ background: #c77;
+ padding: 2px 0px 0px 2px;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.combo {
+ position: absolute;
+ display: none;
+ top: 0px;
+ left: 0px;
+ width: 4em;
+ cursor: default;
+ border: 1px solid #655;
+ background: #ffe;
+ color: #000;
+ font-size: smaller;
+}
+
+.combo .label,
+.combo .label-IEfix {
+ text-align: center;
+ padding: 1px;
+}
+
+.combo .label-IEfix {
+ width: 4em;
+}
+
+.combo .hilite {
+ background: #fc8;
+}
+
+.combo .active {
+ border-top: 1px solid #a64;
+ border-bottom: 1px solid #a64;
+ background: #fee;
+ font-weight: bold;
+}
+
+.calendar td.time {
+ border-top: 1px solid #a88;
+ padding: 1px 0px;
+ text-align: center;
+ background-color: #fed;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+ padding: 0px 3px 0px 4px;
+ border: 1px solid #988;
+ font-weight: bold;
+ background-color: #fff;
+}
+
+.calendar td.time .ampm {
+ text-align: center;
+}
+
+.calendar td.time .colon {
+ padding: 0px 2px 0px 3px;
+ font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+ border-color: #000;
+ background-color: #866;
+ color: #fff;
+}
+
+.calendar td.time span.active {
+ border-color: #f00;
+ background-color: #000;
+ color: #0f0;
+}
diff --git a/phpgwapi/js/jscalendar/calendar-win2k-1.css b/phpgwapi/js/jscalendar/calendar-win2k-1.css
index bbc98c85f0..2c008c6031 100644
--- a/phpgwapi/js/jscalendar/calendar-win2k-1.css
+++ b/phpgwapi/js/jscalendar/calendar-win2k-1.css
@@ -92,6 +92,13 @@
text-align: right;
padding: 2px 4px 2px 2px;
}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #faa;
+}
.calendar table .wn {
padding: 2px 3px 2px 2px;
@@ -185,7 +192,7 @@
/* Combo boxes (menus that display months/years for direct selection) */
-.combo {
+.calendar .combo {
position: absolute;
display: none;
width: 4em;
@@ -197,21 +204,21 @@
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
background: #e4e0d8;
- font-size: smaller;
+ font-size: 90%;
padding: 1px;
}
-.combo .label,
-.combo .label-IEfix {
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
-.combo .label-IEfix {
+.calendar .combo .label-IEfix {
width: 4em;
}
-.combo .active {
+.calendar .combo .active {
background: #c4c0b8;
padding: 0px;
border-top: 1px solid #000;
@@ -220,7 +227,7 @@
border-left: 1px solid #000;
}
-.combo .hilite {
+.calendar .combo .hilite {
background: #048;
color: #fea;
}
diff --git a/phpgwapi/js/jscalendar/calendar-win2k-2.css b/phpgwapi/js/jscalendar/calendar-win2k-2.css
index 9727d1b9a9..6001cfaa4b 100644
--- a/phpgwapi/js/jscalendar/calendar-win2k-2.css
+++ b/phpgwapi/js/jscalendar/calendar-win2k-2.css
@@ -92,6 +92,13 @@
text-align: right;
padding: 2px 4px 2px 2px;
}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #faa;
+}
.calendar table .wn {
padding: 2px 3px 2px 2px;
@@ -185,7 +192,7 @@
/* Combo boxes (menus that display months/years for direct selection) */
-.combo {
+.calendar .combo {
position: absolute;
display: none;
width: 4em;
@@ -197,21 +204,21 @@
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
background: #e4d8e0;
- font-size: smaller;
+ font-size: 90%;
padding: 1px;
}
-.combo .label,
-.combo .label-IEfix {
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
-.combo .label-IEfix {
+.calendar .combo .label-IEfix {
width: 4em;
}
-.combo .active {
+.calendar .combo .active {
background: #d4c8d0;
padding: 0px;
border-top: 1px solid #000;
@@ -220,7 +227,7 @@
border-left: 1px solid #000;
}
-.combo .hilite {
+.calendar .combo .hilite {
background: #408;
color: #fea;
}
diff --git a/phpgwapi/js/jscalendar/calendar-win2k-cold-1.css b/phpgwapi/js/jscalendar/calendar-win2k-cold-1.css
index f3ca5e0d52..bb5c2cbc9f 100644
--- a/phpgwapi/js/jscalendar/calendar-win2k-cold-1.css
+++ b/phpgwapi/js/jscalendar/calendar-win2k-cold-1.css
@@ -92,6 +92,13 @@
text-align: right;
padding: 2px 4px 2px 2px;
}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #faa;
+}
.calendar table .wn {
padding: 2px 3px 2px 2px;
@@ -179,7 +186,7 @@
/* Combo boxes (menus that display months/years for direct selection) */
-.combo {
+.calendar .combo {
position: absolute;
display: none;
width: 4em;
@@ -191,21 +198,21 @@
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
background: #d8e0e4;
- font-size: smaller;
+ font-size: 90%;
padding: 1px;
}
-.combo .label,
-.combo .label-IEfix {
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
-.combo .label-IEfix {
+.calendar .combo .label-IEfix {
width: 4em;
}
-.combo .active {
+.calendar .combo .active {
background: #c8d0d4;
padding: 0px;
border-top: 1px solid #000;
@@ -214,7 +221,7 @@
border-left: 1px solid #000;
}
-.combo .hilite {
+.calendar .combo .hilite {
background: #048;
color: #aef;
}
diff --git a/phpgwapi/js/jscalendar/calendar-win2k-cold-2.css b/phpgwapi/js/jscalendar/calendar-win2k-cold-2.css
index b757ea66e1..b43ce57d37 100644
--- a/phpgwapi/js/jscalendar/calendar-win2k-cold-2.css
+++ b/phpgwapi/js/jscalendar/calendar-win2k-cold-2.css
@@ -92,6 +92,13 @@
text-align: right;
padding: 2px 4px 2px 2px;
}
+.calendar tbody .day.othermonth {
+ font-size: 80%;
+ color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+ color: #faa;
+}
.calendar table .wn {
padding: 2px 3px 2px 2px;
@@ -185,7 +192,7 @@
/* Combo boxes (menus that display months/years for direct selection) */
-.combo {
+.calendar .combo {
position: absolute;
display: none;
width: 4em;
@@ -197,21 +204,21 @@
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
background: #d8e4e0;
- font-size: smaller;
+ font-size: 90%;
padding: 1px;
}
-.combo .label,
-.combo .label-IEfix {
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
-.combo .label-IEfix {
+.calendar .combo .label-IEfix {
width: 4em;
}
-.combo .active {
+.calendar .combo .active {
background: #c8d4d0;
padding: 0px;
border-top: 1px solid #000;
@@ -220,7 +227,7 @@
border-left: 1px solid #000;
}
-.combo .hilite {
+.calendar .combo .hilite {
background: #048;
color: #aef;
}
diff --git a/phpgwapi/js/jscalendar/calendar.js b/phpgwapi/js/jscalendar/calendar.js
index dde8b00caa..96bec6f78e 100644
--- a/phpgwapi/js/jscalendar/calendar.js
+++ b/phpgwapi/js/jscalendar/calendar.js
@@ -1,7 +1,7 @@
/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/
* ------------------------------------------------------------------
*
- * The DHTML Calendar, version 0.9.5 "Your favorite time, bis"
+ * The DHTML Calendar, version 0.9.6 "Keep cool but don't freeze"
*
* Details and latest version at:
* http://dynarch.com/mishoo/calendar.epl
@@ -13,7 +13,7 @@
// $Id$
/** The Calendar object constructor. */
-Calendar = function (mondayFirst, dateStr, onSelected, onClose) {
+Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
// member variables
this.activeDiv = null;
this.currentDateEl = null;
@@ -29,11 +29,13 @@ Calendar = function (mondayFirst, dateStr, onSelected, onClose) {
this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
this.isPopup = true;
this.weekNumbers = true;
- this.mondayFirst = mondayFirst;
+ this.firstDayOfWeek = firstDayOfWeek; // 0 for Sunday, 1 for Monday, etc.
+ this.showsOtherMonths = false;
this.dateStr = dateStr;
this.ar_days = null;
this.showsTime = false;
this.time24 = true;
+ this.yearStep = 2;
// HTML elements
this.table = null;
this.element = null;
@@ -79,6 +81,8 @@ Calendar._C = null;
Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
!/opera/i.test(navigator.userAgent) );
+Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );
+
/// detect Opera browser
Calendar.is_opera = /opera/i.test(navigator.userAgent);
@@ -97,7 +101,7 @@ Calendar.getAbsolutePos = function(el) {
ST = el.scrollTop;
var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
if (el.offsetParent) {
- var tmp = Calendar.getAbsolutePos(el.offsetParent);
+ var tmp = this.getAbsolutePos(el.offsetParent);
r.x += tmp.x;
r.y += tmp.y;
}
@@ -261,8 +265,13 @@ Calendar.showMonthsCombo = function () {
s.display = "block";
if (cd.navtype < 0)
s.left = cd.offsetLeft + "px";
- else
- s.left = (cd.offsetLeft + cd.offsetWidth - mc.offsetWidth) + "px";
+ else {
+ var mcw = mc.offsetWidth;
+ if (typeof mcw == "undefined")
+ // Konqueror brain-dead techniques
+ mcw = 50;
+ s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
+ }
s.top = (cd.offsetTop + cd.offsetHeight) + "px";
};
@@ -294,15 +303,20 @@ Calendar.showYearsCombo = function (fwd) {
yr.style.display = "none";
}
yr = yr.nextSibling;
- Y += fwd ? 2 : -2;
+ Y += fwd ? cal.yearStep : -cal.yearStep;
}
if (show) {
var s = yc.style;
s.display = "block";
if (cd.navtype < 0)
s.left = cd.offsetLeft + "px";
- else
- s.left = (cd.offsetLeft + cd.offsetWidth - yc.offsetWidth) + "px";
+ else {
+ var ycw = yc.offsetWidth;
+ if (typeof ycw == "undefined")
+ // Konqueror brain-dead techniques
+ ycw = 50;
+ s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
+ }
s.top = (cd.offsetTop + cd.offsetHeight) + "px";
}
};
@@ -397,9 +411,9 @@ Calendar.tableMouseOver = function (ev) {
break;
while (count-- > 0)
if (decrease) {
- if (!(--i in range))
+ if (--i < 0)
i = range.length - 1;
- } else if (!(++i in range))
+ } else if ( ++i >= range.length )
i = 0;
var newval = range[i];
el.firstChild.data = newval;
@@ -474,7 +488,6 @@ Calendar.calDragEnd = function (ev) {
cal.dragging = false;
with (Calendar) {
removeEvent(document, "mousemove", calDragIt);
- removeEvent(document, "mouseover", stopEvent);
removeEvent(document, "mouseup", calDragEnd);
tableMouseUp(ev);
}
@@ -490,11 +503,12 @@ Calendar.dayMouseDown = function(ev) {
cal.activeDiv = el;
Calendar._C = cal;
if (el.navtype != 300) with (Calendar) {
- if (el.navtype == 50)
+ if (el.navtype == 50) {
el._current = el.firstChild.data;
+ addEvent(document, "mousemove", tableMouseOver);
+ } else
+ addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
addClass(el, "hilite active");
- addEvent(document, "mouseover", tableMouseOver);
- addEvent(document, "mousemove", tableMouseOver);
addEvent(document, "mouseup", tableMouseUp);
} else if (cal.isPopup) {
cal._dragStart(ev);
@@ -525,11 +539,7 @@ Calendar.dayMouseOver = function(ev) {
}
if (el.ttip) {
if (el.ttip.substr(0, 1) == "_") {
- var date = null;
- with (el.calendar.date) {
- date = new Date(getFullYear(), getMonth(), el.caldate);
- }
- el.ttip = date.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
+ el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
}
el.calendar.tooltips.firstChild.data = el.ttip;
}
@@ -573,11 +583,12 @@ Calendar.cellClick = function(el, ev) {
if (!closing) {
cal.currentDateEl = el;
}
- cal.date.setDate(el.caldate);
+ cal.date = new Date(el.caldate);
date = cal.date;
newdate = true;
// a date was clicked
- cal.dateClicked = true;
+ if (!(cal.dateClicked = !el.otherMonth))
+ cal._init(cal.firstDayOfWeek, date);
} else {
if (el.navtype == 200) {
Calendar.removeClass(el, "hilite");
@@ -644,7 +655,7 @@ Calendar.cellClick = function(el, ev) {
}
break;
case 100:
- cal.setMondayFirst(!cal.mondayFirst);
+ cal.setFirstDayOfWeek(el.fdow);
return;
case 50:
var range = el._range;
@@ -653,9 +664,9 @@ Calendar.cellClick = function(el, ev) {
if (range[i] == current)
break;
if (ev && ev.shiftKey) {
- if (!(--i in range))
+ if (--i < 0)
i = range.length - 1;
- } else if (!(++i in range))
+ } else if ( ++i >= range.length )
i = 0;
var newval = range[i];
el.firstChild.data = newval;
@@ -824,7 +835,7 @@ Calendar.prototype.create = function (_par) {
cell = Calendar.createElement("td", row);
cell.className = "time";
cell.colSpan = 2;
- cell.innerHTML = " ";
+ cell.innerHTML = Calendar._TT["TIME"] || " ";
cell = Calendar.createElement("td", row);
cell.className = "time";
@@ -941,7 +952,7 @@ Calendar.prototype.create = function (_par) {
div.appendChild(yr);
}
- this._init(this.mondayFirst, this.date);
+ this._init(this.firstDayOfWeek, this.date);
parent.appendChild(this.element);
};
@@ -975,7 +986,7 @@ Calendar._keyEvent = function(ev) {
Calendar.cellClick(cal._nav_now);
break;
case 27: // KEY esc
- act && cal.hide();
+ act && cal.callCloseHandler();
break;
case 37: // KEY left
case 38: // KEY up
@@ -1014,7 +1025,7 @@ Calendar._keyEvent = function(ev) {
}
Calendar.removeClass(el, "selected");
Calendar.addClass(ne, "selected");
- cal.date.setDate(ne.caldate);
+ cal.date = new Date(ne.caldate);
cal.callHandler();
cal.currentDateEl = ne;
}
@@ -1032,12 +1043,11 @@ Calendar._keyEvent = function(ev) {
};
/**
- * (RE)Initializes the calendar to the given date and style (if mondayFirst is
- * true it makes Monday the first day of week, otherwise the weeks start on
- * Sunday.
+ * (RE)Initializes the calendar to the given date and firstDayOfWeek
*/
-Calendar.prototype._init = function (mondayFirst, date) {
+Calendar.prototype._init = function (firstDayOfWeek, date) {
var today = new Date();
+ this.table.style.visibility = "hidden";
var year = date.getFullYear();
if (year < this.minYear) {
year = this.minYear;
@@ -1046,53 +1056,57 @@ Calendar.prototype._init = function (mondayFirst, date) {
year = this.maxYear;
date.setFullYear(year);
}
- this.mondayFirst = mondayFirst;
+ this.firstDayOfWeek = firstDayOfWeek;
this.date = new Date(date);
var month = date.getMonth();
var mday = date.getDate();
var no_days = date.getMonthDays();
+
+ // calendar voodoo for computing the first day that would actually be
+ // displayed in the calendar, even if it's from the previous month.
+ // WARNING: this is magic. ;-)
date.setDate(1);
- var wday = date.getDay();
- var MON = mondayFirst ? 1 : 0;
- var SAT = mondayFirst ? 5 : 6;
- var SUN = mondayFirst ? 6 : 0;
- if (mondayFirst) {
- wday = (wday > 0) ? (wday - 1) : 6;
- }
- var iday = 1;
+ var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
+ if (day1 < 0)
+ day1 += 7;
+ date.setDate(-day1);
+ date.setDate(date.getDate() + 1);
+
var row = this.tbody.firstChild;
var MN = Calendar._SMN[month];
- var hasToday = ((today.getFullYear() == year) && (today.getMonth() == month));
- var todayDate = today.getDate();
- var week_number = date.getWeekNumber();
var ar_days = new Array();
- for (var i = 0; i < 6; ++i) {
- if (iday > no_days) {
- row.className = "emptyrow";
- row = row.nextSibling;
- continue;
- }
+ var weekend = Calendar._TT["WEEKEND"];
+ for (var i = 0; i < 6; ++i, row = row.nextSibling) {
var cell = row.firstChild;
if (this.weekNumbers) {
cell.className = "day wn";
- cell.firstChild.data = week_number;
+ cell.firstChild.data = date.getWeekNumber();
cell = cell.nextSibling;
}
- ++week_number;
row.className = "daysrow";
- for (var j = 0; j < 7; ++j) {
+ var hasdays = false;
+ for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(date.getDate() + 1)) {
+ var iday = date.getDate();
+ var wday = date.getDay();
cell.className = "day";
- if ((!i && j < wday) || iday > no_days) {
- // cell.className = "emptycell";
- cell.innerHTML = " ";
- cell.disabled = true;
- cell = cell.nextSibling;
- continue;
+ var current_month = (date.getMonth() == month);
+ if (!current_month) {
+ if (this.showsOtherMonths) {
+ cell.className += " othermonth";
+ cell.otherMonth = true;
+ } else {
+ cell.className = "emptycell";
+ cell.innerHTML = " ";
+ cell.disabled = true;
+ continue;
+ }
+ } else {
+ cell.otherMonth = false;
+ hasdays = true;
}
cell.disabled = false;
cell.firstChild.data = iday;
if (typeof this.getDateStatus == "function") {
- date.setDate(iday);
var status = this.getDateStatus(date, year, month, iday);
if (status === true) {
cell.className += " disabled";
@@ -1105,29 +1119,30 @@ Calendar.prototype._init = function (mondayFirst, date) {
}
if (!cell.disabled) {
ar_days[ar_days.length] = cell;
- cell.caldate = iday;
+ cell.caldate = new Date(date);
cell.ttip = "_";
- if (iday == mday) {
+ if (current_month && iday == mday) {
cell.className += " selected";
this.currentDateEl = cell;
}
- if (hasToday && (iday == todayDate)) {
+ if (date.getFullYear() == today.getFullYear() &&
+ date.getMonth() == today.getMonth() &&
+ iday == today.getDate()) {
cell.className += " today";
cell.ttip += Calendar._TT["PART_TODAY"];
}
- if (wday == SAT || wday == SUN) {
- cell.className += " weekend";
+ if (weekend.indexOf(wday.toString()) != -1) {
+ cell.className += cell.otherMonth ? " oweekend" : " weekend";
}
}
- ++iday;
- ((++wday) ^ 7) || (wday = 0);
- cell = cell.nextSibling;
}
- row = row.nextSibling;
+ if (!(hasdays || this.showsOtherMonths))
+ row.className = "emptyrow";
}
this.ar_days = ar_days;
this.title.firstChild.data = Calendar._MN[month] + ", " + year;
this.onSetTime();
+ this.table.style.visibility = "visible";
// PROFILE
// this.tooltips.firstChild.data = "Generated in " + ((new Date()) - today) + " ms";
};
@@ -1138,7 +1153,7 @@ Calendar.prototype._init = function (mondayFirst, date) {
*/
Calendar.prototype.setDate = function (date) {
if (!date.equalsTo(this.date)) {
- this._init(this.mondayFirst, date);
+ this._init(this.firstDayOfWeek, date);
}
};
@@ -1149,12 +1164,12 @@ Calendar.prototype.setDate = function (date) {
* should * change.
*/
Calendar.prototype.refresh = function () {
- this._init(this.mondayFirst, this.date);
+ this._init(this.firstDayOfWeek, this.date);
};
-/** Modifies the "mondayFirst" parameter (EU/US style). */
-Calendar.prototype.setMondayFirst = function (mondayFirst) {
- this._init(mondayFirst, this.date);
+/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
+Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
+ this._init(firstDayOfWeek, this.date);
this._displayWeekdays();
};
@@ -1282,6 +1297,30 @@ Calendar.prototype.showAtElement = function (el, opts) {
this.showAt(p.x, p.y + el.offsetHeight);
return true;
}
+ function fixPosition(box) {
+ if (box.x < 0)
+ box.x = 0;
+ if (box.y < 0)
+ box.y = 0;
+ var cp = document.createElement("div");
+ var s = cp.style;
+ s.position = "absolute";
+ s.right = s.bottom = s.width = s.height = "0px";
+ document.body.appendChild(cp);
+ var br = Calendar.getAbsolutePos(cp);
+ document.body.removeChild(cp);
+ if (Calendar.is_ie) {
+ br.y += document.body.scrollTop;
+ br.x += document.body.scrollLeft;
+ } else {
+ br.y += window.scrollY;
+ br.x += window.scrollX;
+ }
+ var tmp = box.x + box.width - br.x;
+ if (tmp > 0) box.x -= tmp;
+ tmp = box.y + box.height - br.y;
+ if (tmp > 0) box.y -= tmp;
+ };
this.element.style.display = "block";
Calendar.continuation_for_the_fucking_khtml_browser = function() {
var w = self.element.offsetWidth;
@@ -1308,6 +1347,10 @@ Calendar.prototype.showAtElement = function (el, opts) {
case "r": p.x += el.offsetWidth - w; break;
case "l": break; // already there
}
+ p.width = w;
+ p.height = h + 40;
+ self.monthsCombo.style.display = "none";
+ fixPosition(p);
self.showAt(p.x, p.y);
};
if (Calendar.is_khtml)
@@ -1338,38 +1381,52 @@ Calendar.prototype.parseDate = function (str, fmt) {
if (!fmt) {
fmt = this.dateFormat;
}
- var b = [];
- fmt.replace(/(%.)/g, function(str, par) {
- return b[b.length] = par;
- });
+ var b = fmt.match(/%./g);
var i = 0, j = 0;
var hr = 0;
var min = 0;
for (i = 0; i < a.length; ++i) {
- if (b[i] == "%a" || b[i] == "%A") {
+ if (!a[i])
continue;
- }
- if (b[i] == "%d" || b[i] == "%e") {
+ switch (b[i]) {
+ case "%d":
+ case "%e":
d = parseInt(a[i], 10);
- }
- if (b[i] == "%m") {
+ break;
+
+ case "%m":
m = parseInt(a[i], 10) - 1;
- }
- if (b[i] == "%Y" || b[i] == "%y") {
+ break;
+
+ case "%Y":
+ case "%y":
y = parseInt(a[i], 10);
(y < 100) && (y += (y > 29) ? 1900 : 2000);
- }
- if (b[i] == "%b" || b[i] == "%B") {
+ break;
+
+ case "%b":
+ case "%B":
for (j = 0; j < 12; ++j) {
if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
}
- } else if (/%[HIkl]/.test(b[i])) {
+ break;
+
+ case "%H":
+ case "%I":
+ case "%k":
+ case "%l":
hr = parseInt(a[i], 10);
- } else if (/%[pP]/.test(b[i])) {
+ break;
+
+ case "%P":
+ case "%p":
if (/pm/i.test(a[i]) && hr < 12)
hr += 12;
- } else if (b[i] == "%M") {
+ break;
+
+ case "%M":
min = parseInt(a[i], 10);
+ break;
}
}
if (y != 0 && m != -1 && d != 0) {
@@ -1471,22 +1528,23 @@ Calendar.prototype.hideShowCovered = function () {
/** Internal function; it displays the bar with the names of the weekday. */
Calendar.prototype._displayWeekdays = function () {
- var MON = this.mondayFirst ? 0 : 1;
- var SUN = this.mondayFirst ? 6 : 0;
- var SAT = this.mondayFirst ? 5 : 6;
+ var fdow = this.firstDayOfWeek;
var cell = this.firstdayname;
+ var weekend = Calendar._TT["WEEKEND"];
for (var i = 0; i < 7; ++i) {
cell.className = "day name";
- if (!i) {
- cell.ttip = this.mondayFirst ? Calendar._TT["SUN_FIRST"] : Calendar._TT["MON_FIRST"];
+ var realday = (i + fdow) % 7;
+ if (i) {
+ cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]);
cell.navtype = 100;
cell.calendar = this;
+ cell.fdow = realday;
Calendar._add_evs(cell);
}
- if (i == SUN || i == SAT) {
+ if (weekend.indexOf(realday.toString()) != -1) {
Calendar.addClass(cell, "weekend");
}
- cell.firstChild.data = Calendar._SDN[i + 1 - MON];
+ cell.firstChild.data = Calendar._SDN[(i + fdow) % 7];
cell = cell.nextSibling;
}
};
@@ -1517,7 +1575,6 @@ Calendar.prototype._dragStart = function (ev) {
this.yOffs = posY - parseInt(st.top);
with (Calendar) {
addEvent(document, "mousemove", calDragIt);
- addEvent(document, "mouseover", stopEvent);
addEvent(document, "mouseup", calDragEnd);
}
};
@@ -1550,20 +1607,20 @@ Date.prototype.getMonthDays = function(month) {
/** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function() {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
- var then = new Date(this.getFullYear(), 0, 1, 0, 0, 0);
+ var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
var time = now - then;
return Math.floor(time / Date.DAY);
};
/** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function() {
- var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
- var then = new Date(this.getFullYear(), 0, 1, 0, 0, 0);
- var time = now - then;
- var day = then.getDay(); // 0 means Sunday
- if (day == 0) day = 7;
- (day > 4) && (day -= 4) || (day += 3);
- return Math.round(((time / Date.DAY) + day) / 7);
+ var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
+ var DoW = d.getDay();
+ d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
+ var ms = d.valueOf(); // GMT
+ d.setMonth(0);
+ d.setDate(4); // Thu in Week 1
+ return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
};
/** Checks dates equality (ignores time) */
@@ -1625,17 +1682,34 @@ Date.prototype.print = function (str) {
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character
- var re = Date._msh_formatRegexp;
- if (typeof re == "undefined") {
- var tmp = "";
- for (var i in s)
- tmp += tmp ? ("|" + i) : i;
- Date._msh_formatRegexp = re = new RegExp("(" + tmp + ")", 'g');
+
+ var re = /%./g;
+ if (!Calendar.is_ie5)
+ return str.replace(re, function (par) { return s[par] || par; });
+
+ var a = str.match(re);
+ for (var i = 0; i < a.length; i++) {
+ var tmp = s[a[i]];
+ if (tmp) {
+ re = new RegExp(a[i], 'g');
+ str = str.replace(re, tmp);
+ }
}
- return str.replace(re, function(match, par) { return s[par]; });
+
+ return str;
+};
+
+Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
+Date.prototype.setFullYear = function(y) {
+ var d = new Date(this);
+ d.__msh_oldSetFullYear(y);
+ if (d.getMonth() != this.getMonth())
+ this.setDate(28);
+ this.__msh_oldSetFullYear(y);
};
// END: DATE OBJECT PATCHES
+
// global object that remembers the calendar
window.calendar = null;
diff --git a/phpgwapi/js/jscalendar/calendar.php b/phpgwapi/js/jscalendar/calendar.php
new file mode 100644
index 0000000000..5b9120d67c
--- /dev/null
+++ b/phpgwapi/js/jscalendar/calendar.php
@@ -0,0 +1,119 @@
+calendar_file = 'calendar_stripped.js';
+ $this->calendar_setup_file = 'calendar-setup_stripped.js';
+ } else {
+ $this->calendar_file = 'calendar.js';
+ $this->calendar_setup_file = 'calendar-setup.js';
+ }
+ $this->calendar_lang_file = 'lang/calendar-' . $lang . '.js';
+ $this->calendar_theme_file = $theme.'.css';
+ $this->calendar_lib_path = preg_replace('/\/+$/', '/', $calendar_lib_path);
+ $this->calendar_options = array('ifFormat' => '%Y/%m/%d',
+ 'daFormat' => '%Y/%m/%d');
+ }
+
+ function set_option($name, $value) {
+ $this->calendar_options[$name] = $value;
+ }
+
+ function load_files() {
+ echo $this->get_load_files_code();
+ }
+
+ function get_load_files_code() {
+ $code = ( '' . NEWLINE );
+ $code .= ( '' . NEWLINE );
+ $code .= ( '' . NEWLINE );
+ $code .= ( '' );
+ return $code;
+ }
+
+ function _make_calendar($other_options = array()) {
+ $js_options = $this->_make_js_hash(array_merge($this->calendar_options, $other_options));
+ $code = ( '' );
+ return $code;
+ }
+
+ function make_input_field($cal_options = array(), $field_attributes = array()) {
+ $id = $this->_gen_id();
+ $attrstr = $this->_make_html_attr(array_merge($field_attributes,
+ array('id' => $this->_field_id($id),
+ 'type' => 'text')));
+ echo '';
+ echo '' .
+ '';
+
+ $options = array_merge($cal_options,
+ array('inputField' => $this->_field_id($id),
+ 'button' => $this->_trigger_id($id)));
+ echo $this->_make_calendar($options);
+ }
+
+ /// PRIVATE SECTION
+
+ function _field_id($id) { return 'f-calendar-field-' . $id; }
+ function _trigger_id($id) { return 'f-calendar-trigger-' . $id; }
+ function _gen_id() { static $id = 0; return ++$id; }
+
+ function _make_js_hash($array) {
+ $jstr = '';
+ reset($array);
+ while (list($key, $val) = each($array)) {
+ if (is_bool($val))
+ $val = $val ? 'true' : 'false';
+ else if (!is_numeric($val))
+ $val = '"'.$val.'"';
+ if ($jstr) $jstr .= ',';
+ $jstr .= '"' . $key . '":' . $val;
+ }
+ return $jstr;
+ }
+
+ function _make_html_attr($array) {
+ $attrstr = '';
+ reset($array);
+ while (list($key, $val) = each($array)) {
+ $attrstr .= $key . '="' . $val . '" ';
+ }
+ return $attrstr;
+ }
+};
+
+?>
\ No newline at end of file
diff --git a/phpgwapi/js/jscalendar/calendar.udiff b/phpgwapi/js/jscalendar/calendar.udiff
new file mode 100644
index 0000000000..3be79ceda6
--- /dev/null
+++ b/phpgwapi/js/jscalendar/calendar.udiff
@@ -0,0 +1,48 @@
+Index: calendar.js
+===================================================================
+RCS file: /cvsroot/egroupware/phpgwapi/js/jscalendar/calendar.js,v
+retrieving revision 1.2
+diff -u -r1.2 calendar.js
+--- calendar.js 11 Nov 2003 14:50:19 -0000 1.2
++++ calendar.js 6 May 2004 07:38:00 -0000
+@@ -601,6 +601,10 @@
+ date.setMonth(m);
+ };
+ switch (el.navtype) {
++// TEST RB
++ case 500:
++ window.location="/egroupware/?menuaction=calendar.uicalendar.week&date="+el.caldate.print('%Y%m%d');
++ return;
+ case 400:
+ Calendar.removeClass(el, "hilite");
+ var text = Calendar._TT["ABOUT"];
+@@ -806,8 +810,11 @@
+ for (i = 6; i > 0; --i) {
+ row = Calendar.createElement("tr", tbody);
+ if (this.weekNumbers) {
+- cell = Calendar.createElement("td", row);
+- cell.appendChild(document.createTextNode(""));
++// cell = Calendar.createElement("td", row);
++// cell.appendChild(document.createTextNode(""));
++// TEST RB
++ cell = hh("",1,500)
++ cell.ttip = "go to week-view";
+ }
+ for (var j = 7; j > 0; --j) {
+ cell = Calendar.createElement("td", row);
+@@ -1076,6 +1083,15 @@
+ if (this.weekNumbers) {
+ cell.className = "day wn";
+ cell.firstChild.data = week_number;
++// TEST RB
++ cell.caldate = new Date(date);
++ if (!i && wday != 1) {
++ cell.caldate.setTime(date.getTime()-wday*Date.DAY);
++ }
++ else
++ {
++ cell.caldate.setDate(iday);
++ }
+ cell = cell.nextSibling;
+ }
+ ++week_number;
diff --git a/phpgwapi/js/jscalendar/calendar_stripped.js b/phpgwapi/js/jscalendar/calendar_stripped.js
index 029496a749..6a8e326af2 100644
--- a/phpgwapi/js/jscalendar/calendar_stripped.js
+++ b/phpgwapi/js/jscalendar/calendar_stripped.js
@@ -1,7 +1,7 @@
/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/
* ------------------------------------------------------------------
*
- * The DHTML Calendar, version 0.9.5 "Your favorite time, bis"
+ * The DHTML Calendar, version 0.9.6 "Keep cool but don't freeze"
*
* Details and latest version at:
* http://dynarch.com/mishoo/calendar.epl
@@ -9,4 +9,4 @@
* This script is distributed under the GNU Lesser General Public License.
* Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
*/
- Calendar=function(mondayFirst,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.mondayFirst=mondayFirst;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=Calendar.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}while(related){if(related==el){return true;}related=related.parentNode;}return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){if(Calendar.is_ie){return window.event.srcElement;}else{return ev.currentTarget;}};Calendar.getTargetElement=function(ev){if(Calendar.is_ie){return window.event.srcElement;}else{return ev.target;}};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}if(typeof parent!="undefined"){parent.appendChild(el);}return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else s.left=(cd.offsetLeft+cd.offsetWidth-mc.offsetWidth)+"px";s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.firstChild.data=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}yr=yr.nextSibling;Y+=fwd?2:-2;}if(show){var s=yc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else s.left=(cd.offsetLeft+cd.offsetWidth-yc.offsetWidth)+"px";s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)if(range[i]==current)break;while(count-->0)if(decrease){if(!(--i in range))i=range.length-1;}else if(!(++i in range))i=0;var newval=range[i];el.firstChild.data=newval;cal.onUpdateTime();}var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseover",stopEvent);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50)el._current=el.firstChild.data;addClass(el,"hilite active");addEvent(document,"mouseover",tableMouseOver);addEvent(document,"mousemove",tableMouseOver);addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}if(el.ttip){if(el.ttip.substr(0,1)=="_"){var date=null;with(el.calendar.date){date=new Date(getFullYear(),getMonth(),el.caldate);}el.ttip=date.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}el.calendar.tooltips.firstChild.data=el.ttip;}if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled){return false;}removeClass(el,"hilite");if(el.caldate){removeClass(el.parentNode,"rowhilite");}el.calendar.tooltips.firstChild.data=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}cal.date.setDate(el.caldate);date=cal.date;newdate=true;cal.dateClicked=true;}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}date=(el.navtype==0)?new Date():new Date(cal.date);cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to
DHTML Calendar Widget
4.3.11 Calendar.showAtElement
4.3.12 Calendar.setDate
- 4.3.13 Calendar.setMondayFirst
+ 4.3.13 Calendar.setFirstDayOfWeek
4.3.14 Calendar.parseDate
4.3.15 Calendar.setRange
@@ -218,7 +218,7 @@ this in your document’s <head> section, also make sure you
correct paths to the scripts.
<style type="text/css">@import url(calendar-win2k-1.css)</style>
+
<style type="text/css">@import url(calendar-win2k-1.css);</style>
<script type="text/javascript" src="calendar.js"></script>
<script type="text/javascript" src="lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar-setup.js"></script>
@@ -244,9 +244,9 @@ insert the following code immediately after the HTML form:
<script type="text/javascript">
Calendar.setup(
{
- inputField : "data", // ID of the input field
- ifFormat : "M d, y", // the date format
- button : "trigger" // ID of the button
+ inputField : "data", // ID of the input field
+ ifFormat : "%m %d, %Y", // the date format
+ button : "trigger" // ID of the button
}
);
</script>
@@ -373,13 +373,12 @@ as a CSS class and appended to the date element. If this string is
4.3.8.
null
mondayFirst
- boolean If true (default) then the calendar will display with
-Monday being the first day of week. If false then Sunday will be
-the first day of week. This has changed from default false to
-default true because the ISO 8601 defines week as starting Monday
-and this definition is used for computing the week number.
- true
+ firstDay
+ integer Specifies which day is to be displayed as the first day of
+week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, ..., 6
+means Saturday. The end user can easily change this too, by clicking on the
+day name in the calendar header.
+ 0
+weekNumbers
boolean If “true” then the calendar will display week numbers.
@@ -444,6 +443,27 @@ allow time selection.
string Set this to “12” or “24” to configure the way that the
calendar will display time.
“24”
+
+electric
+ boolean Set this to “false” if you want the calendar to update the
+field only when closed (by default it updates the field at each date change,
+even if the calendar is not closed) true
+
+position
+ array Specifies the [x, y] position, relative to page’s top-left corner,
+where the calendar will be displayed. If not passed then the position will
+be computed based on the “align” parameter. Defaults to “null” (not
+used). null
+
+cache
+ boolean Set this to “true” if you want to cache the calendar object.
+This means that a single calendar object will be used for all fields that
+require a popup calendar false
+
@@ -675,7 +695,7 @@ i.e. highlight them differently). Details in section
Synopsis:showOthers
+ boolean If set to “true” then days belonging to months overlapping
+with the currently displayed month will also be displayed in the calendar
+(but in a “faded-out” color) false
-
var calendar = Calendar(mondayFirst, date, onSelect, onClose); +var calendar = Calendar(firstDayOfWeek, date, onSelect, onClose);Parameters are as follows:
@@ -683,8 +703,9 @@ Parameters are as follows:
-
mondayFirst — boolean, if it’s true the calendar will have -Monday as first day of week, if false weeks start on Sunday.
+firstDayOfWeek — specifies which day is to be displayed as the first +day of week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, +..., 6 means Saturday.
date — a JavaScript Date object or null. If null @@ -791,9 +812,9 @@ variable to false before calling Calendar.create.
selector will be in 12-hour format. It is in 24-hour format by default.-
mondayFirst — if true then the calendar uses Monday -as first day of week, otherwise Sunday. This variable is set from constructor, -but you still have a chance to modify it before calling +
firstDayOfWeek — specifies the first day of week (0 to 6, pass +0 for Sunday, 1 for Monday, ..., 6 for Saturday). This variable is set from +constructor, but you still have a chance to modify it before calling Calendar.create.
@@ -903,7 +924,7 @@ There are more algorithms for computing the week number. All three specifiers currently implement the same one, as defined by ISO 8601: “the week 01 is the week that has the Thursday in the current year, which is equivalent to the week that contains the fourth day of January. Weeks start on -Monday. +Monday.”
@@ -1126,8 +1147,7 @@ calendar aligned to the right margin of the element).
If the “align” parameter is missing the calendar will choose -“Bl”. This resembles the behavior of older versions (prior to -0.9.3) which did not support custom alignment.
+“Br”.@@ -1142,13 +1162,13 @@ calendar. If the calendar is visible the new date is displayed immediately.
-
-Changes the first day of week. If the parameter is true then Monday -will be the first day of week, otherwise Sunday.
+Changes the first day of week. The parameter has to be a numeric value ranging +from 0 to 6. Pass 0 for Sunday, 1 for Monday, ..., 6 for Saturday.-
calendar.setMondayFirst(false); // use Sunday +calendar.setFirstDayOfWeek(5); // start weeks on Friday@@ -1247,13 +1267,19 @@ feature and pay me for implementing it) or donate some money please
+
Sunny Chowdhury (www.ex3.com)
++
+Ian Barrack (www.simban.com)
++
Himanshukumar Shah
-
Seyhan Ersoy (http://www.oocgi.com)
+Seyhan Ersoy (www.oocgi.com)
-
Jon Stokkeland (http://www.sauen.com)
+Jon Stokkeland (www.sauen.com)
4 user interface