Go to the source code of this file.
Functions | |
if (Date.prototype.__msh_oldSetFullYear==null) | |
Variables | |
Calendar | _add_evs |
Internal -- adds a set of events to make some element behave like a button. | |
Calendar | _C = null |
"static", needed for event handlers. | |
Calendar | _checkCalendar |
Calendar prototype | _displayWeekdays |
Internal function; it displays the bar with the names of the weekday. | |
Calendar prototype | _dragStart |
Internal function. | |
window | _dynarch_popupCalendar = null |
Calendar prototype | _hideCombos |
Internal function. | |
Calendar prototype | _init |
(RE)Initializes the calendar to the given date and firstDayOfWeek | |
Calendar prototype | _initMultipleDates |
Calendar | _keyEvent |
keyboard navigation, only for popup calendars | |
Date | _MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31) |
Adds the number of days array to the Date object. | |
Calendar prototype | _toggleMultipleDate |
Calendar | addClass |
Calendar | addEvent |
Calendar | calDragEnd |
Calendar | calDragIt |
Calendar | |
The Calendar object constructor. | |
Calendar prototype | callCloseHandler |
Calls the second user handler (closeHandler). | |
Calendar prototype | callHandler |
Calls the first user handler (selectedHandler). | |
Calendar | cellClick |
A generic "click" handler :) handles all types of buttons defined in this calendar. | |
Calendar prototype | create |
This function creates the calendar inside the given parent. | |
Calendar | createElement |
Date | DAY = 24 * Date.HOUR |
Calendar | dayMouseDblClick |
Calendar | dayMouseDown |
Calendar | dayMouseOut |
Calendar | dayMouseOver |
Calendar prototype | destroy |
Removes the calendar object from the DOM tree and destroys it. | |
Date prototype | equalsTo |
Checks date and time equality. | |
Calendar | findMonth |
Calendar | findYear |
Calendar | getAbsolutePos |
Date prototype | getDayOfYear |
Returns the number of day in the year. | |
Calendar | getElement |
Date prototype | getMonthDays |
Returns the number of days in the current month. | |
Calendar | getTargetElement |
Date prototype | getWeekNumber |
Returns the number of the week in year, as defined in ISO 8601. | |
Calendar prototype | hide |
Hides the calendar. | |
Calendar prototype | hideShowCovered |
Date | HOUR = 60 * Date.MINUTE |
Calendar | is_ie |
detect a special case of "web browser" | |
Calendar | is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ) |
Calendar | is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent) |
detect KHTML-based browsers | |
Calendar | is_opera = /opera/i.test(navigator.userAgent) |
detect Opera browser | |
Calendar | isRelated |
Date | MINUTE = 60 * Date.SECOND |
Calendar prototype | parseDate |
Tries to identify the date represented in a string. | |
Date prototype | |
Prints the date in a string according to the given format. | |
Calendar prototype | refresh |
Refreshes the calendar. | |
Calendar | removeClass |
Calendar | removeEvent |
Calendar prototype | reparent |
Moves the calendar element to a different section in the DOM tree (changes its parent). | |
Date | SECOND = 1000 |
Constants used for time computations. | |
Calendar prototype | setDate |
Calls _init function above for going to a certain date (but only if the date is different than the currently selected one). | |
Calendar prototype | setDateFormat |
Customizes the date format. | |
Date prototype | setDateOnly |
Set only the year, month, date parts (keep existing time) | |
Calendar prototype | setDateStatusHandler |
Allows customization of what dates are enabled. | |
Calendar prototype | setDateToolTipHandler |
Calendar prototype | setFirstDayOfWeek |
Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). | |
Date prototype | setFullYear |
Calendar prototype | setRange |
Customization of allowed year range for the calendar. | |
Calendar prototype | setTtDateFormat |
Customizes the tooltip date format. | |
Calendar prototype | show |
Shows the calendar. | |
Calendar prototype | showAt |
Shows the calendar at a given absolute position (beware that, depending on the calendar element style -- position property -- this might be relative to the parent's containing rectangle). | |
Calendar prototype | showAtElement |
Shows the calendar near a given element. | |
Calendar | showMonthsCombo |
Calendar | showYearsCombo |
Calendar | stopEvent |
Calendar | tableMouseDown |
Calendar | tableMouseOver |
Calendar | tableMouseUp |
Date | WEEK = 7 * Date.DAY |
if | ( | Date.prototype. | __msh_oldSetFullYear = = null | ) |
Definition at line 1793 of file calendar.js.
{ Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; }
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); } } }
Internal -- adds a set of events to make some element behave like a button.
Definition at line 222 of file calendar.js.
"static", needed for event handlers.
Definition at line 84 of file calendar.js.
function(ev) { var calendar = window._dynarch_popupCalendar; if (!calendar) { return false; } var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); for (; el != null && el != calendar.element; el = el.parentNode); if (el == null) { window._dynarch_popupCalendar.callCloseHandler(); return Calendar.stopEvent(ev); } }
Definition at line 1307 of file calendar.js.
function () { var fdow = this.firstDayOfWeek; var cell = this.firstdayname; var weekend = Calendar._TT["WEEKEND"]; for (var i = 0; i < 7; ++i) { cell.className = "day name"; 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 (weekend.indexOf(realday.toString()) != -1) { Calendar.addClass(cell, "weekend"); } cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; cell = cell.nextSibling; } }
Internal function; it displays the bar with the names of the weekday.
Definition at line 1520 of file calendar.js.
function (ev) { if (this.dragging) { return; } this.dragging = true; var posX; var posY; if (Calendar.is_ie) { posY = window.event.clientY + document.body.scrollTop; posX = window.event.clientX + document.body.scrollLeft; } else { posY = ev.clientY + window.scrollY; posX = ev.clientX + window.scrollX; } var st = this.element.style; this.xOffs = posX - parseInt(st.left); this.yOffs = posY - parseInt(st.top); with (Calendar) { addEvent(document, "mousemove", calDragIt); addEvent(document, "mouseup", calDragEnd); } }
Internal function.
Starts dragging the element.
Definition at line 1549 of file calendar.js.
window _dynarch_popupCalendar = null |
Definition at line 1810 of file calendar.js.
function () { this.monthsCombo.style.display = "none"; this.yearsCombo.style.display = "none"; }
Internal function.
Hides all combo boxes that might be displayed.
Definition at line 1543 of file calendar.js.
(RE)Initializes the calendar to the given date and firstDayOfWeek
Definition at line 1081 of file calendar.js.
function() { if (this.multiple) { for (var i in this.multiple) { var cell = this.datesCells[i]; var d = this.multiple[i]; if (!d) continue; if (cell) cell.className += " selected"; } } }
Definition at line 1195 of file calendar.js.
keyboard navigation, only for popup calendars
Definition at line 963 of file calendar.js.
Date _MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31) |
Adds the number of days array to the Date object.
Definition at line 1575 of file calendar.js.
function(date) { if (this.multiple) { var ds = date.print("%Y%m%d"); var cell = this.datesCells[ds]; if (cell) { var d = this.multiple[ds]; if (!d) { Calendar.addClass(cell, "selected"); this.multiple[ds] = date; } else { Calendar.removeClass(cell, "selected"); delete this.multiple[ds]; } } } }
Definition at line 1208 of file calendar.js.
function(el, className) { Calendar.removeClass(el, className); el.className += " " + className; }
Definition at line 150 of file calendar.js.
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; } }
Definition at line 182 of file calendar.js.
function (ev) { var cal = Calendar._C; if (!cal) { return false; } cal.dragging = false; with (Calendar) { removeEvent(document, "mousemove", calDragIt); removeEvent(document, "mouseup", calDragEnd); tableMouseUp(ev); } cal.hideShowCovered(); }
Definition at line 488 of file calendar.js.
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); }
Definition at line 467 of file calendar.js.
The Calendar object constructor.
Definition at line 18 of file calendar.js.
function () { if (this.onClose) { this.onClose(this); } this.hideShowCovered(); }
Calls the second user handler (closeHandler).
Definition at line 1279 of file calendar.js.
function () { if (this.onSelected) { this.onSelected(this, this.date.print(this.dateFormat)); } }
Calls the first user handler (selectedHandler).
Definition at line 1272 of file calendar.js.
A generic "click" handler :) handles all types of buttons defined in this calendar.
Definition at line 578 of file calendar.js.
This function creates the calendar inside the given parent.
If _par is null than it creates a popup calendar inside the BODY element. If _par is an element, be it BODY, then it creates a non-popup calendar (still hidden). Some properties need to be set before calling this function.
Definition at line 720 of file calendar.js.
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; }
Definition at line 202 of file calendar.js.
Definition at line 1581 of file calendar.js.
function(ev) { Calendar.cellClick(Calendar.getElement(ev), ev || window.event); if (Calendar.is_ie) { document.selection.empty(); } }
Definition at line 533 of file calendar.js.
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.innerHTML; addEvent(document, "mousemove", tableMouseOver); } else addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); addClass(el, "hilite active"); 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); }
Definition at line 502 of file calendar.js.
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"); if (el.calendar) el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; return stopEvent(ev); } }
Definition at line 560 of file calendar.js.
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) == "_") { el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); } el.calendar.tooltips.innerHTML = el.ttip; } if (el.navtype != 300) { Calendar.addClass(el, "hilite"); if (el.caldate) { Calendar.addClass(el.parentNode, "rowhilite"); } } return Calendar.stopEvent(ev); }
Definition at line 540 of file calendar.js.
function () { var el = this.element.parentNode; el.removeChild(this.element); Calendar._C = null; window._dynarch_popupCalendar = null; }
Removes the calendar object from the DOM tree and destroys it.
Definition at line 1287 of file calendar.js.
function(date) { return ((this.getFullYear() == date.getFullYear()) && (this.getMonth() == date.getMonth()) && (this.getDate() == date.getDate()) && (this.getHours() == date.getHours()) && (this.getMinutes() == date.getMinutes())); }
Checks date and time equality.
Definition at line 1709 of file calendar.js.
function(el) { if (typeof el.month != "undefined") { return el; } else if (typeof el.parentNode.month != "undefined") { return el.parentNode; } return null; }
Definition at line 234 of file calendar.js.
function(el) { if (typeof el.year != "undefined") { return el; } else if (typeof el.parentNode.year != "undefined") { return el.parentNode; } return null; }
Definition at line 243 of file calendar.js.
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 = this.getAbsolutePos(el.offsetParent); r.x += tmp.x; r.y += tmp.y; } return r; }
Definition at line 101 of file calendar.js.
Date prototype getDayOfYear |
function() { var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 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 day in the year.
Definition at line 1690 of file calendar.js.
function(ev) { var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; while (f.nodeType != 1 || /^div$/i.test(f.tagName)) f = f.parentNode; return f; }
Definition at line 156 of file calendar.js.
Date prototype getMonthDays |
function(month) { var year = this.getFullYear(); if (typeof month == "undefined") { month = this.getMonth(); } if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { return 29; } else { return Date._MD[month]; } }
Returns the number of days in the current month.
Definition at line 1677 of file calendar.js.
function(ev) { var f = Calendar.is_ie ? window.event.srcElement : ev.target; while (f.nodeType != 1) f = f.parentNode; return f; }
Definition at line 163 of file calendar.js.
Date prototype getWeekNumber |
function() { 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); var ms = d.valueOf(); d.setMonth(0); d.setDate(4); return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; }
Returns the number of the week in year, as defined in ISO 8601.
Definition at line 1698 of file calendar.js.
function () { if (this.isPopup) { Calendar.removeEvent(document, "keydown", Calendar._keyEvent); Calendar.removeEvent(document, "keypress", Calendar._keyEvent); Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); } this.element.style.display = "none"; this.hidden = true; this.hideShowCovered(); }
Hides the calendar.
Also removes any "hilite" from the class of any TD element.
Definition at line 1349 of file calendar.js.
Referenced by compute_ledger(), detail_category_show(), Calendar::fill_from_action(), ledger_fin_add_row(), profile_show(), search_letter(), show_description(), show_fin_chdate(), todo_list_remove(), toggleHideShow(), and update_document().
Definition at line 1462 of file calendar.js.
Date HOUR = 60 * Date.MINUTE |
Definition at line 1580 of file calendar.js.
( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) )
detect a special case of "web browser"
Definition at line 87 of file calendar.js.
Calendar is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ) |
Definition at line 90 of file calendar.js.
detect KHTML-based browsers
Definition at line 96 of file calendar.js.
detect Opera browser
Definition at line 93 of file calendar.js.
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; }
Definition at line 117 of file calendar.js.
Date MINUTE = 60 * Date.SECOND |
Definition at line 1579 of file calendar.js.
Date parseDate |
function(str, fmt) { if (!fmt) fmt = this.dateFormat; this.setDate(Date.parseDate(str, fmt)); }
Tries to identify the date represented in a string.
If successful it also calls this.setDate which moves the calendar to the given date.
Definition at line 1456 of file calendar.js.
Prints the date in a string according to the given format.
Definition at line 1727 of file calendar.js.
function () { this._init(this.firstDayOfWeek, this.date); }
Refreshes the calendar.
Useful if the "disabledHandler" function is dynamic, meaning that the list of disabled date can change at runtime. Just * call this function if you think that the list of disabled dates should * change.
Definition at line 1245 of file calendar.js.
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(" "); }
Definition at line 136 of file calendar.js.
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; } }
Definition at line 192 of file calendar.js.
function (new_parent) {
var el = this.element;
el.parentNode.removeChild(el);
new_parent.appendChild(el);
}
Moves the calendar element to a different section in the DOM tree (changes its parent).
Definition at line 1298 of file calendar.js.
Date SECOND = 1000 |
Constants used for time computations.
Definition at line 1578 of file calendar.js.
function (date) { if (!date.equalsTo(this.date)) { this._init(this.firstDayOfWeek, date); } }
Calls _init function above for going to a certain date (but only if the date is different than the currently selected one).
Definition at line 1233 of file calendar.js.
function (str) {
this.dateFormat = str;
}
Customizes the date format.
Definition at line 1443 of file calendar.js.
Date prototype setDateOnly |
function(date) { var tmp = new Date(date); this.setDate(1); this.setFullYear(tmp.getFullYear()); this.setMonth(tmp.getMonth()); this.setDate(tmp.getDate()); }
Set only the year, month, date parts (keep existing time)
Definition at line 1718 of file calendar.js.
Calendar.prototype.setDisabledHandler = function (unaryFunction) { this.getDateStatus = unaryFunction; }
Allows customization of what dates are enabled.
The "unaryFunction" parameter must be a function object that receives the date (as a JS Date object) and returns a boolean value. If the returned value is true then the passed date will be marked as disabled.
Definition at line 1261 of file calendar.js.
function (unaryFunction) {
this.getDateToolTip = unaryFunction;
}
Definition at line 1225 of file calendar.js.
function (firstDayOfWeek) { this._init(firstDayOfWeek, this.date); this._displayWeekdays(); }
Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.).
Definition at line 1250 of file calendar.js.
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); }
Definition at line 1798 of file calendar.js.
function (a, z) {
this.minYear = a;
this.maxYear = z;
}
Customization of allowed year range for the calendar.
Definition at line 1266 of file calendar.js.
function (str) {
this.ttDateFormat = str;
}
Customizes the tooltip date format.
Definition at line 1448 of file calendar.js.
function () { var rows = this.table.getElementsByTagName("tr"); for (var i = rows.length; i > 0;) { var row = rows[--i]; Calendar.removeClass(row, "rowhilite"); var cells = row.getElementsByTagName("td"); for (var j = cells.length; j > 0;) { var cell = cells[--j]; Calendar.removeClass(cell, "hilite"); Calendar.removeClass(cell, "active"); } } this.element.style.display = "block"; this.hidden = false; if (this.isPopup) { window._dynarch_popupCalendar = this; Calendar.addEvent(document, "keydown", Calendar._keyEvent); Calendar.addEvent(document, "keypress", Calendar._keyEvent); Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); } this.hideShowCovered(); }
Shows the calendar.
Definition at line 1322 of file calendar.js.
Referenced by ajax_card(), ajax_get_success(), calendar_zoom(), detail_category_show(), get_profile_detail(), PcmnUpdate(), profile_show(), search_letter(), show_box(), show_description(), show_fin_chdate(), toggleHideShow(), and update_document().
function (x, y) { var s = this.element.style; s.left = x + "px"; s.top = y + "px"; this.show(); }
Shows the calendar at a given absolute position (beware that, depending on the calendar element style -- position property -- this might be relative to the parent's containing rectangle).
Definition at line 1365 of file calendar.js.
Shows the calendar near a given element.
Definition at line 1373 of file calendar.js.
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 { var mcw = mc.offsetWidth; if (typeof mcw == "undefined") mcw = 50; s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; } s.top = (cd.offsetTop + cd.offsetHeight) + "px"; }
Definition at line 252 of file calendar.js.
Definition at line 283 of file calendar.js.
function(ev) { ev || (ev = window.event); if (Calendar.is_ie) { ev.cancelBubble = true; ev.returnValue = false; } else { ev.preventDefault(); ev.stopPropagation(); } return false; }
Definition at line 170 of file calendar.js.
function (ev) { if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { return Calendar.stopEvent(ev); } }
Definition at line 461 of file calendar.js.
Definition at line 381 of file calendar.js.
Definition at line 331 of file calendar.js.
Definition at line 1582 of file calendar.js.