annotate gnv/src/main/webapp/scripts/calendar.js @ 680:ba3370dbc8c5

Parse time to live of a wms-layer from meta document and show it in html gui (issue197). gnv/trunk@830 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Mar 2010 09:22:32 +0000
parents 9719cbd1a23f
children
rev   line source
14
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 * -----------------------------------------------------------
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 *
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 * The DHTML Calendar, version 1.0 "It is happening again"
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5 *
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 * Details and latest version at:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 * www.dynarch.com/projects/calendar
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 *
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 * This script is developed by Dynarch.com. Visit us at www.dynarch.com.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 *
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 * This script is distributed under the GNU Lesser General Public License.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 // $Id: calendar.js,v 1.1 2007/12/06 13:55:16 drewnak Exp $
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 /** The Calendar object constructor. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 // member variables
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 this.activeDiv = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 this.currentDateEl = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 this.getDateStatus = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 this.getDateToolTip = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 this.getDateText = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 this.timeout = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 this.onSelected = onSelected || null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 this.onClose = onClose || null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 this.dragging = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 this.hidden = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 this.minYear = 1970;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 this.maxYear = 2050;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 this.isPopup = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 this.weekNumbers = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 this.showsOtherMonths = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 this.dateStr = dateStr;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 this.ar_days = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 this.showsTime = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 this.time24 = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 this.yearStep = 2;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 this.hiliteToday = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 this.multiple = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 // HTML elements
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 this.table = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 this.element = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 this.tbody = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 this.firstdayname = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 // Combo boxes
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 this.monthsCombo = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 this.yearsCombo = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 this.hilitedMonth = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 this.activeMonth = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 this.hilitedYear = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 this.activeYear = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 // Information
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 this.dateClicked = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 // one-time initializations
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 if (typeof Calendar._SDN == "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 // table of short day names
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 if (typeof Calendar._SDN_len == "undefined")
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 Calendar._SDN_len = 3;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 var ar = new Array();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 for (var i = 8; i > 0;) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 Calendar._SDN = ar;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 // table of short month names
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 if (typeof Calendar._SMN_len == "undefined")
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 Calendar._SMN_len = 3;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 ar = new Array();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 for (var i = 12; i > 0;) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 Calendar._SMN = ar;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 // ** constants
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 /// "static", needed for event handlers.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 Calendar._C = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 /// detect a special case of "web browser"
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 !/opera/i.test(navigator.userAgent) );
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 /// detect Opera browser
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 Calendar.is_opera = /opera/i.test(navigator.userAgent);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 /// detect KHTML-based browsers
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96 Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 // BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 // library, at some point.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 Calendar.getAbsolutePos = function(el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 var SL = 0, ST = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 var is_div = /^div$/i.test(el.tagName);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 if (is_div && el.scrollLeft)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 SL = el.scrollLeft;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 if (is_div && el.scrollTop)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 ST = el.scrollTop;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 if (el.offsetParent) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 var tmp = this.getAbsolutePos(el.offsetParent);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 r.x += tmp.x;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 r.y += tmp.y;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 return r;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 Calendar.isRelated = function (el, evt) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118 var related = evt.relatedTarget;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 if (!related) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 var type = evt.type;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 if (type == "mouseover") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 related = evt.fromElement;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 } else if (type == "mouseout") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 related = evt.toElement;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 while (related) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 if (related == el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 return true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 related = related.parentNode;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
134 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
136 Calendar.removeClass = function(el, className) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137 if (!(el && el.className)) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
138 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140 var cls = el.className.split(" ");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141 var ar = new Array();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
142 for (var i = cls.length; i > 0;) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143 if (cls[--i] != className) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 ar[ar.length] = cls[i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 el.className = ar.join(" ");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 Calendar.addClass = function(el, className) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 Calendar.removeClass(el, className);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 el.className += " " + className;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 // FIXME: the following 2 functions totally suck, are useless and should be replaced immediately.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 Calendar.getElement = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158 while (f.nodeType != 1 || /^div$/i.test(f.tagName))
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 f = f.parentNode;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 return f;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 Calendar.getTargetElement = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 var f = Calendar.is_ie ? window.event.srcElement : ev.target;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 while (f.nodeType != 1)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 f = f.parentNode;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 return f;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 Calendar.stopEvent = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 ev || (ev = window.event);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172 if (Calendar.is_ie) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 ev.cancelBubble = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 ev.returnValue = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 ev.preventDefault();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177 ev.stopPropagation();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 Calendar.addEvent = function(el, evname, func) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183 if (el.attachEvent) { // IE
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184 el.attachEvent("on" + evname, func);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 } else if (el.addEventListener) { // Gecko / W3C
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
186 el.addEventListener(evname, func, true);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
188 el["on" + evname] = func;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
191
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
192 Calendar.removeEvent = function(el, evname, func) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
193 if (el.detachEvent) { // IE
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
194 el.detachEvent("on" + evname, func);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
195 } else if (el.removeEventListener) { // Gecko / W3C
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
196 el.removeEventListener(evname, func, true);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
197 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
198 el["on" + evname] = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
199 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
200 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
201
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
202 Calendar.createElement = function(type, parent) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
203 var el = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
204 if (document.createElementNS) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
205 // use the XHTML namespace; IE won't normally get here unless
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
206 // _they_ "fix" the DOM2 implementation.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
207 el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
208 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
209 el = document.createElement(type);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
210 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
211 if (typeof parent != "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
212 parent.appendChild(el);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
213 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
214 return el;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
215 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
216
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
217 // END: UTILITY FUNCTIONS
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
218
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
219 // BEGIN: CALENDAR STATIC FUNCTIONS
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
220
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
221 /** Internal -- adds a set of events to make some element behave like a button. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
222 Calendar._add_evs = function(el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
223 with (Calendar) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
224 addEvent(el, "mouseover", dayMouseOver);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
225 addEvent(el, "mousedown", dayMouseDown);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
226 addEvent(el, "mouseout", dayMouseOut);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
227 if (is_ie) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
228 addEvent(el, "dblclick", dayMouseDblClick);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
229 el.setAttribute("unselectable", true);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
230 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
231 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
232 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
233
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
234 Calendar.findMonth = function(el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
235 if (typeof el.month != "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
236 return el;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
237 } else if (typeof el.parentNode.month != "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
238 return el.parentNode;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
239 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
240 return null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
241 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
242
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
243 Calendar.findYear = function(el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
244 if (typeof el.year != "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
245 return el;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
246 } else if (typeof el.parentNode.year != "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
247 return el.parentNode;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
248 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
249 return null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
250 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
251
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
252 Calendar.showMonthsCombo = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
253 var cal = Calendar._C;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
254 if (!cal) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
255 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
256 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
257 var cal = cal;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
258 var cd = cal.activeDiv;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
259 var mc = cal.monthsCombo;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
260 if (cal.hilitedMonth) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
261 Calendar.removeClass(cal.hilitedMonth, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
262 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
263 if (cal.activeMonth) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
264 Calendar.removeClass(cal.activeMonth, "active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
265 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
266 var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
267 Calendar.addClass(mon, "active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
268 cal.activeMonth = mon;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
269 var s = mc.style;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
270 s.display = "block";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
271 if (cd.navtype < 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
272 s.left = cd.offsetLeft + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
273 else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
274 var mcw = mc.offsetWidth;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
275 if (typeof mcw == "undefined")
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
276 // Konqueror brain-dead techniques
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
277 mcw = 50;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
278 s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
279 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
280 s.top = (cd.offsetTop + cd.offsetHeight) + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
281 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
282
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
283 Calendar.showYearsCombo = function (fwd) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
284 var cal = Calendar._C;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
285 if (!cal) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
286 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
287 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
288 var cal = cal;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
289 var cd = cal.activeDiv;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
290 var yc = cal.yearsCombo;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
291 if (cal.hilitedYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
292 Calendar.removeClass(cal.hilitedYear, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
293 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
294 if (cal.activeYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
295 Calendar.removeClass(cal.activeYear, "active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
296 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
297 cal.activeYear = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
298 var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
299 var yr = yc.firstChild;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
300 var show = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
301 for (var i = 12; i > 0; --i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
302 if (Y >= cal.minYear && Y <= cal.maxYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
303 yr.innerHTML = Y;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
304 yr.year = Y;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
305 yr.style.display = "block";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
306 show = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
307 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
308 yr.style.display = "none";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
309 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
310 yr = yr.nextSibling;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
311 Y += fwd ? cal.yearStep : -cal.yearStep;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
312 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
313 if (show) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
314 var s = yc.style;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
315 s.display = "block";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
316 if (cd.navtype < 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
317 s.left = cd.offsetLeft + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
318 else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
319 var ycw = yc.offsetWidth;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
320 if (typeof ycw == "undefined")
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
321 // Konqueror brain-dead techniques
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
322 ycw = 50;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
323 s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
324 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
325 s.top = (cd.offsetTop + cd.offsetHeight) + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
326 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
327 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
328
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
329 // event handlers
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
330
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
331 Calendar.tableMouseUp = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
332 var cal = Calendar._C;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
333 if (!cal) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
334 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
335 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
336 if (cal.timeout) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
337 clearTimeout(cal.timeout);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
338 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
339 var el = cal.activeDiv;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
340 if (!el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
341 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
342 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
343 var target = Calendar.getTargetElement(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
344 ev || (ev = window.event);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
345 Calendar.removeClass(el, "active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
346 if (target == el || target.parentNode == el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
347 Calendar.cellClick(el, ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
348 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
349 var mon = Calendar.findMonth(target);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
350 var date = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
351 if (mon) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
352 date = new Date(cal.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
353 if (mon.month != date.getMonth()) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
354 date.setMonth(mon.month);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
355 cal.setDate(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
356 cal.dateClicked = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
357 cal.callHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
358 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
359 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
360 var year = Calendar.findYear(target);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
361 if (year) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
362 date = new Date(cal.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
363 if (year.year != date.getFullYear()) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
364 date.setFullYear(year.year);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
365 cal.setDate(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
366 cal.dateClicked = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
367 cal.callHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
368 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
369 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
370 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
371 with (Calendar) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
372 removeEvent(document, "mouseup", tableMouseUp);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
373 removeEvent(document, "mouseover", tableMouseOver);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
374 removeEvent(document, "mousemove", tableMouseOver);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
375 cal._hideCombos();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
376 _C = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
377 return stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
378 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
379 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
380
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
381 Calendar.tableMouseOver = function (ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
382 var cal = Calendar._C;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
383 if (!cal) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
384 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
385 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
386 var el = cal.activeDiv;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
387 var target = Calendar.getTargetElement(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
388 if (target == el || target.parentNode == el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
389 Calendar.addClass(el, "hilite active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
390 Calendar.addClass(el.parentNode, "rowhilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
391 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
392 if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
393 Calendar.removeClass(el, "active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
394 Calendar.removeClass(el, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
395 Calendar.removeClass(el.parentNode, "rowhilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
396 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
397 ev || (ev = window.event);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
398 if (el.navtype == 50 && target != el) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
399 var pos = Calendar.getAbsolutePos(el);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
400 var w = el.offsetWidth;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
401 var x = ev.clientX;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
402 var dx;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
403 var decrease = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
404 if (x > pos.x + w) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
405 dx = x - pos.x - w;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
406 decrease = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
407 } else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
408 dx = pos.x - x;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
409
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
410 if (dx < 0) dx = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
411 var range = el._range;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
412 var current = el._current;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
413 var count = Math.floor(dx / 10) % range.length;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
414 for (var i = range.length; --i >= 0;)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
415 if (range[i] == current)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
416 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
417 while (count-- > 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
418 if (decrease) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
419 if (--i < 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
420 i = range.length - 1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
421 } else if ( ++i >= range.length )
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
422 i = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
423 var newval = range[i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
424 el.innerHTML = newval;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
425
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
426 cal.onUpdateTime();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
427 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
428 var mon = Calendar.findMonth(target);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
429 if (mon) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
430 if (mon.month != cal.date.getMonth()) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
431 if (cal.hilitedMonth) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
432 Calendar.removeClass(cal.hilitedMonth, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
433 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
434 Calendar.addClass(mon, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
435 cal.hilitedMonth = mon;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
436 } else if (cal.hilitedMonth) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
437 Calendar.removeClass(cal.hilitedMonth, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
438 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
439 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
440 if (cal.hilitedMonth) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
441 Calendar.removeClass(cal.hilitedMonth, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
442 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
443 var year = Calendar.findYear(target);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
444 if (year) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
445 if (year.year != cal.date.getFullYear()) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
446 if (cal.hilitedYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
447 Calendar.removeClass(cal.hilitedYear, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
448 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
449 Calendar.addClass(year, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
450 cal.hilitedYear = year;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
451 } else if (cal.hilitedYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
452 Calendar.removeClass(cal.hilitedYear, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
453 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
454 } else if (cal.hilitedYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
455 Calendar.removeClass(cal.hilitedYear, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
456 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
457 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
458 return Calendar.stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
459 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
460
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
461 Calendar.tableMouseDown = function (ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
462 if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
463 return Calendar.stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
464 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
465 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
466
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
467 Calendar.calDragIt = function (ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
468 var cal = Calendar._C;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
469 if (!(cal && cal.dragging)) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
470 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
471 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
472 var posX;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
473 var posY;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
474 if (Calendar.is_ie) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
475 posY = window.event.clientY + document.body.scrollTop;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
476 posX = window.event.clientX + document.body.scrollLeft;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
477 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
478 posX = ev.pageX;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
479 posY = ev.pageY;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
480 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
481 cal.hideShowCovered();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
482 var st = cal.element.style;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
483 st.left = (posX - cal.xOffs) + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
484 st.top = (posY - cal.yOffs) + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
485 return Calendar.stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
486 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
487
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
488 Calendar.calDragEnd = function (ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
489 var cal = Calendar._C;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
490 if (!cal) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
491 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
492 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
493 cal.dragging = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
494 with (Calendar) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
495 removeEvent(document, "mousemove", calDragIt);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
496 removeEvent(document, "mouseup", calDragEnd);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
497 tableMouseUp(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
498 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
499 cal.hideShowCovered();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
500 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
501
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
502 Calendar.dayMouseDown = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
503 var el = Calendar.getElement(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
504 if (el.disabled) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
505 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
506 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
507 var cal = el.calendar;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
508 cal.activeDiv = el;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
509 Calendar._C = cal;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
510 if (el.navtype != 300) with (Calendar) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
511 if (el.navtype == 50) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
512 el._current = el.innerHTML;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
513 addEvent(document, "mousemove", tableMouseOver);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
514 } else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
515 addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
516 addClass(el, "hilite active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
517 addEvent(document, "mouseup", tableMouseUp);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
518 } else if (cal.isPopup) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
519 cal._dragStart(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
520 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
521 if (el.navtype == -1 || el.navtype == 1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
522 if (cal.timeout) clearTimeout(cal.timeout);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
523 cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
524 } else if (el.navtype == -2 || el.navtype == 2) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
525 if (cal.timeout) clearTimeout(cal.timeout);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
526 cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
527 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
528 cal.timeout = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
529 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
530 return Calendar.stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
531 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
532
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
533 Calendar.dayMouseDblClick = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
534 Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
535 if (Calendar.is_ie) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
536 document.selection.empty();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
537 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
538 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
539
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
540 Calendar.dayMouseOver = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
541 var el = Calendar.getElement(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
542 if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
543 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
544 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
545 if (el.ttip) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
546 if (el.ttip.substr(0, 1) == "_") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
547 el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
548 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
549 el.calendar.tooltips.innerHTML = el.ttip;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
550 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
551 if (el.navtype != 300) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
552 Calendar.addClass(el, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
553 if (el.caldate) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
554 Calendar.addClass(el.parentNode, "rowhilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
555 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
556 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
557 return Calendar.stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
558 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
559
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
560 Calendar.dayMouseOut = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
561 with (Calendar) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
562 var el = getElement(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
563 if (isRelated(el, ev) || _C || el.disabled)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
564 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
565 removeClass(el, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
566 if (el.caldate)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
567 removeClass(el.parentNode, "rowhilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
568 if (el.calendar)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
569 el.calendar.tooltips.innerHTML = _TT["SEL_DATE"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
570 return stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
571 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
572 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
573
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
574 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
575 * A generic "click" handler :) handles all types of buttons defined in this
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
576 * calendar.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
577 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
578 Calendar.cellClick = function(el, ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
579 var cal = el.calendar;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
580 var closing = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
581 var newdate = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
582 var date = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
583 if (typeof el.navtype == "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
584 if (cal.currentDateEl) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
585 Calendar.removeClass(cal.currentDateEl, "selected");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
586 Calendar.addClass(el, "selected");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
587 closing = (cal.currentDateEl == el);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
588 if (!closing) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
589 cal.currentDateEl = el;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
590 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
591 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
592 cal.date.setDateOnly(el.caldate);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
593 date = cal.date;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
594 var other_month = !(cal.dateClicked = !el.otherMonth);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
595 if (!other_month && !cal.currentDateEl)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
596 cal._toggleMultipleDate(new Date(date));
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
597 else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
598 newdate = !el.disabled;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
599 // a date was clicked
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
600 if (other_month)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
601 cal._init(cal.firstDayOfWeek, date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
602 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
603 if (el.navtype == 200) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
604 Calendar.removeClass(el, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
605 cal.callCloseHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
606 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
607 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
608 date = new Date(cal.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
609 if (el.navtype == 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
610 date.setDateOnly(new Date()); // TODAY
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
611 // unless "today" was clicked, we assume no date was clicked so
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
612 // the selected handler will know not to close the calenar when
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
613 // in single-click mode.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
614 // cal.dateClicked = (el.navtype == 0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
615 cal.dateClicked = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
616 var year = date.getFullYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
617 var mon = date.getMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
618 function setMonth(m) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
619 var day = date.getDate();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
620 var max = date.getMonthDays(m);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
621 if (day > max) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
622 date.setDate(max);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
623 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
624 date.setMonth(m);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
625 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
626 switch (el.navtype) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
627 case 400:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
628 Calendar.removeClass(el, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
629 var text = Calendar._TT["ABOUT"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
630 if (typeof text != "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
631 text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
632 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
633 // FIXME: this should be removed as soon as lang files get updated!
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
634 text = "Help and about box text is not translated into this language.\n" +
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
635 "If you know this language and you feel generous please update\n" +
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
636 "the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
637 "and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n" +
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
638 "Thank you!\n" +
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
639 "http://dynarch.com/mishoo/calendar.epl\n";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
640 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
641 alert(text);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
642 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
643 case -2:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
644 if (year > cal.minYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
645 date.setFullYear(year - 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
646 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
647 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
648 case -1:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
649 if (mon > 0) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
650 setMonth(mon - 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
651 } else if (year-- > cal.minYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
652 date.setFullYear(year);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
653 setMonth(11);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
654 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
655 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
656 case 1:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
657 if (mon < 11) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
658 setMonth(mon + 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
659 } else if (year < cal.maxYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
660 date.setFullYear(year + 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
661 setMonth(0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
662 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
663 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
664 case 2:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
665 if (year < cal.maxYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
666 date.setFullYear(year + 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
667 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
668 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
669 case 100:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
670 cal.setFirstDayOfWeek(el.fdow);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
671 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
672 case 50:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
673 var range = el._range;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
674 var current = el.innerHTML;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
675 for (var i = range.length; --i >= 0;)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
676 if (range[i] == current)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
677 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
678 if (ev && ev.shiftKey) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
679 if (--i < 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
680 i = range.length - 1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
681 } else if ( ++i >= range.length )
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
682 i = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
683 var newval = range[i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
684 el.innerHTML = newval;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
685 cal.onUpdateTime();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
686 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
687 case 0:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
688 // TODAY will bring us here
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
689 if ((typeof cal.getDateStatus == "function") &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
690 cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
691 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
692 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
693 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
694 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
695 if (!date.equalsTo(cal.date)) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
696 cal.setDate(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
697 newdate = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
698 } else if (el.navtype == 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
699 newdate = closing = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
700 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
701 if (newdate) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
702 ev && cal.callHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
703 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
704 if (closing) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
705 Calendar.removeClass(el, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
706 ev && cal.callCloseHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
707 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
708 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
709
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
710 // END: CALENDAR STATIC FUNCTIONS
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
711
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
712 // BEGIN: CALENDAR OBJECT FUNCTIONS
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
713
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
714 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
715 * This function creates the calendar inside the given parent. If _par is
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
716 * null than it creates a popup calendar inside the BODY element. If _par is
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
717 * an element, be it BODY, then it creates a non-popup calendar (still
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
718 * hidden). Some properties need to be set before calling this function.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
719 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
720 Calendar.prototype.create = function (_par) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
721 var parent = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
722 if (! _par) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
723 // default parent is the document body, in which case we create
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
724 // a popup calendar.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
725 parent = document.getElementsByTagName("body")[0];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
726 this.isPopup = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
727 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
728 parent = _par;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
729 this.isPopup = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
730 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
731 this.date = this.dateStr ? new Date(this.dateStr) : new Date();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
732
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
733 var table = Calendar.createElement("table");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
734 this.table = table;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
735 table.cellSpacing = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
736 table.cellPadding = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
737 table.calendar = this;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
738 Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
739
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
740 var div = Calendar.createElement("div");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
741 this.element = div;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
742 div.className = "calendar";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
743 if (this.isPopup) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
744 div.style.position = "absolute";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
745 div.style.display = "none";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
746 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
747 div.appendChild(table);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
748
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
749 var thead = Calendar.createElement("thead", table);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
750 var cell = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
751 var row = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
752
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
753 var cal = this;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
754 var hh = function (text, cs, navtype) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
755 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
756 cell.colSpan = cs;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
757 cell.className = "button";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
758 if (navtype != 0 && Math.abs(navtype) <= 2)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
759 cell.className += " nav";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
760 Calendar._add_evs(cell);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
761 cell.calendar = cal;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
762 cell.navtype = navtype;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
763 cell.innerHTML = "<div unselectable='on'>" + text + "</div>";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
764 return cell;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
765 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
766
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
767 row = Calendar.createElement("tr", thead);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
768 var title_length = 6;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
769 (this.isPopup) && --title_length;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
770 (this.weekNumbers) && ++title_length;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
771
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
772 hh("?", 1, 400).ttip = Calendar._TT["INFO"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
773 this.title = hh("", title_length, 300);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
774 this.title.className = "title";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
775 if (this.isPopup) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
776 this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
777 this.title.style.cursor = "move";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
778 hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
779 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
780
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
781 row = Calendar.createElement("tr", thead);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
782 row.className = "headrow";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
783
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
784 this._nav_py = hh("&#x00ab;", 1, -2);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
785 this._nav_py.ttip = Calendar._TT["PREV_YEAR"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
786
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
787 this._nav_pm = hh("&#x2039;", 1, -1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
788 this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
789
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
790 this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
791 this._nav_now.ttip = Calendar._TT["GO_TODAY"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
792
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
793 this._nav_nm = hh("&#x203a;", 1, 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
794 this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
795
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
796 this._nav_ny = hh("&#x00bb;", 1, 2);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
797 this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
798
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
799 // day names
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
800 row = Calendar.createElement("tr", thead);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
801 row.className = "daynames";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
802 if (this.weekNumbers) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
803 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
804 cell.className = "name wn";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
805 cell.innerHTML = Calendar._TT["WK"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
806 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
807 for (var i = 7; i > 0; --i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
808 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
809 if (!i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
810 cell.navtype = 100;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
811 cell.calendar = this;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
812 Calendar._add_evs(cell);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
813 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
814 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
815 this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
816 this._displayWeekdays();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
817
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
818 var tbody = Calendar.createElement("tbody", table);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
819 this.tbody = tbody;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
820
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
821 for (i = 6; i > 0; --i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
822 row = Calendar.createElement("tr", tbody);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
823 if (this.weekNumbers) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
824 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
825 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
826 for (var j = 7; j > 0; --j) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
827 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
828 cell.calendar = this;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
829 Calendar._add_evs(cell);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
830 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
831 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
832
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
833 if (this.showsTime) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
834 row = Calendar.createElement("tr", tbody);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
835 row.className = "time";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
836
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
837 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
838 cell.className = "time";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
839 cell.colSpan = 2;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
840 cell.innerHTML = Calendar._TT["TIME"] || "&nbsp;";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
841
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
842 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
843 cell.className = "time";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
844 cell.colSpan = this.weekNumbers ? 4 : 3;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
845
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
846 (function(){
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
847 function makeTimePart(className, init, range_start, range_end) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
848 var part = Calendar.createElement("span", cell);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
849 part.className = className;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
850 part.innerHTML = init;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
851 part.calendar = cal;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
852 part.ttip = Calendar._TT["TIME_PART"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
853 part.navtype = 50;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
854 part._range = [];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
855 if (typeof range_start != "number")
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
856 part._range = range_start;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
857 else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
858 for (var i = range_start; i <= range_end; ++i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
859 var txt;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
860 if (i < 10 && range_end >= 10) txt = '0' + i;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
861 else txt = '' + i;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
862 part._range[part._range.length] = txt;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
863 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
864 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
865 Calendar._add_evs(part);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
866 return part;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
867 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
868 var hrs = cal.date.getHours();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
869 var mins = cal.date.getMinutes();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
870 var t12 = !cal.time24;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
871 var pm = (hrs > 12);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
872 if (t12 && pm) hrs -= 12;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
873 var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
874 var span = Calendar.createElement("span", cell);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
875 span.innerHTML = ":";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
876 span.className = "colon";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
877 var M = makeTimePart("minute", mins, 0, 59);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
878 var AP = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
879 cell = Calendar.createElement("td", row);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
880 cell.className = "time";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
881 cell.colSpan = 2;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
882 if (t12)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
883 AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
884 else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
885 cell.innerHTML = "&nbsp;";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
886
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
887 cal.onSetTime = function() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
888 var pm, hrs = this.date.getHours(),
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
889 mins = this.date.getMinutes();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
890 if (t12) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
891 pm = (hrs >= 12);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
892 if (pm) hrs -= 12;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
893 if (hrs == 0) hrs = 12;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
894 AP.innerHTML = pm ? "pm" : "am";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
895 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
896 H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
897 M.innerHTML = (mins < 10) ? ("0" + mins) : mins;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
898 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
899
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
900 cal.onUpdateTime = function() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
901 var date = this.date;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
902 var h = parseInt(H.innerHTML, 10);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
903 if (t12) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
904 if (/pm/i.test(AP.innerHTML) && h < 12)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
905 h += 12;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
906 else if (/am/i.test(AP.innerHTML) && h == 12)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
907 h = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
908 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
909 var d = date.getDate();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
910 var m = date.getMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
911 var y = date.getFullYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
912 date.setHours(h);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
913 date.setMinutes(parseInt(M.innerHTML, 10));
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
914 date.setFullYear(y);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
915 date.setMonth(m);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
916 date.setDate(d);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
917 this.dateClicked = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
918 this.callHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
919 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
920 })();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
921 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
922 this.onSetTime = this.onUpdateTime = function() {};
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
923 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
924
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
925 var tfoot = Calendar.createElement("tfoot", table);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
926
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
927 row = Calendar.createElement("tr", tfoot);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
928 row.className = "footrow";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
929
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
930 cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
931 cell.className = "ttip";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
932 if (this.isPopup) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
933 cell.ttip = Calendar._TT["DRAG_TO_MOVE"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
934 cell.style.cursor = "move";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
935 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
936 this.tooltips = cell;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
937
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
938 div = Calendar.createElement("div", this.element);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
939 this.monthsCombo = div;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
940 div.className = "combo";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
941 for (i = 0; i < Calendar._MN.length; ++i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
942 var mn = Calendar.createElement("div");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
943 mn.className = Calendar.is_ie ? "label-IEfix" : "label";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
944 mn.month = i;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
945 mn.innerHTML = Calendar._SMN[i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
946 div.appendChild(mn);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
947 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
948
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
949 div = Calendar.createElement("div", this.element);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
950 this.yearsCombo = div;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
951 div.className = "combo";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
952 for (i = 12; i > 0; --i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
953 var yr = Calendar.createElement("div");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
954 yr.className = Calendar.is_ie ? "label-IEfix" : "label";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
955 div.appendChild(yr);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
956 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
957
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
958 this._init(this.firstDayOfWeek, this.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
959 parent.appendChild(this.element);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
960 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
961
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
962 /** keyboard navigation, only for popup calendars */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
963 Calendar._keyEvent = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
964 var cal = window._dynarch_popupCalendar;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
965 if (!cal || cal.multiple)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
966 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
967 (Calendar.is_ie) && (ev = window.event);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
968 var act = (Calendar.is_ie || ev.type == "keypress"),
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
969 K = ev.keyCode;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
970 if (ev.ctrlKey) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
971 switch (K) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
972 case 37: // KEY left
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
973 act && Calendar.cellClick(cal._nav_pm);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
974 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
975 case 38: // KEY up
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
976 act && Calendar.cellClick(cal._nav_py);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
977 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
978 case 39: // KEY right
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
979 act && Calendar.cellClick(cal._nav_nm);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
980 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
981 case 40: // KEY down
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
982 act && Calendar.cellClick(cal._nav_ny);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
983 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
984 default:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
985 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
986 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
987 } else switch (K) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
988 case 32: // KEY space (now)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
989 Calendar.cellClick(cal._nav_now);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
990 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
991 case 27: // KEY esc
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
992 act && cal.callCloseHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
993 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
994 case 37: // KEY left
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
995 case 38: // KEY up
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
996 case 39: // KEY right
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
997 case 40: // KEY down
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
998 if (act) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
999 var prev, x, y, ne, el, step;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1000 prev = K == 37 || K == 38;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1001 step = (K == 37 || K == 39) ? 1 : 7;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1002 function setVars() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1003 el = cal.currentDateEl;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1004 var p = el.pos;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1005 x = p & 15;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1006 y = p >> 4;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1007 ne = cal.ar_days[y][x];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1008 };setVars();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1009 function prevMonth() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1010 var date = new Date(cal.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1011 date.setDate(date.getDate() - step);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1012 cal.setDate(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1013 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1014 function nextMonth() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1015 var date = new Date(cal.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1016 date.setDate(date.getDate() + step);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1017 cal.setDate(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1018 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1019 while (1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1020 switch (K) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1021 case 37: // KEY left
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1022 if (--x >= 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1023 ne = cal.ar_days[y][x];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1024 else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1025 x = 6;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1026 K = 38;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1027 continue;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1028 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1029 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1030 case 38: // KEY up
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1031 if (--y >= 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1032 ne = cal.ar_days[y][x];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1033 else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1034 prevMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1035 setVars();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1036 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1037 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1038 case 39: // KEY right
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1039 if (++x < 7)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1040 ne = cal.ar_days[y][x];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1041 else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1042 x = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1043 K = 40;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1044 continue;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1045 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1046 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1047 case 40: // KEY down
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1048 if (++y < cal.ar_days.length)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1049 ne = cal.ar_days[y][x];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1050 else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1051 nextMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1052 setVars();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1053 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1054 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1055 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1056 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1057 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1058 if (ne) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1059 if (!ne.disabled)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1060 Calendar.cellClick(ne);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1061 else if (prev)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1062 prevMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1063 else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1064 nextMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1065 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1066 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1067 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1068 case 13: // KEY enter
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1069 if (act)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1070 Calendar.cellClick(cal.currentDateEl, ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1071 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1072 default:
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1073 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1074 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1075 return Calendar.stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1076 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1077
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1078 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1079 * (RE)Initializes the calendar to the given date and firstDayOfWeek
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1080 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1081 Calendar.prototype._init = function (firstDayOfWeek, date) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1082 var today = new Date(),
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1083 TY = today.getFullYear(),
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1084 TM = today.getMonth(),
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1085 TD = today.getDate();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1086 this.table.style.visibility = "hidden";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1087 var year = date.getFullYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1088 if (year < this.minYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1089 year = this.minYear;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1090 date.setFullYear(year);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1091 } else if (year > this.maxYear) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1092 year = this.maxYear;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1093 date.setFullYear(year);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1094 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1095 this.firstDayOfWeek = firstDayOfWeek;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1096 this.date = new Date(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1097 var month = date.getMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1098 var mday = date.getDate();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1099 var no_days = date.getMonthDays();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1100
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1101 // calendar voodoo for computing the first day that would actually be
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1102 // displayed in the calendar, even if it's from the previous month.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1103 // WARNING: this is magic. ;-)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1104 date.setDate(1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1105 var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1106 if (day1 < 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1107 day1 += 7;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1108 date.setDate(-day1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1109 date.setDate(date.getDate() + 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1110
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1111 var row = this.tbody.firstChild;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1112 var MN = Calendar._SMN[month];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1113 var ar_days = this.ar_days = new Array();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1114 var weekend = Calendar._TT["WEEKEND"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1115 var dates = this.multiple ? (this.datesCells = {}) : null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1116 for (var i = 0; i < 6; ++i, row = row.nextSibling) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1117 var cell = row.firstChild;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1118 if (this.weekNumbers) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1119 cell.className = "day wn";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1120 cell.innerHTML = date.getWeekNumber();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1121 cell = cell.nextSibling;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1122 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1123 row.className = "daysrow";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1124 var hasdays = false, iday, dpos = ar_days[i] = [];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1125 for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1126 iday = date.getDate();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1127 var wday = date.getDay();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1128 cell.className = "day";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1129 cell.pos = i << 4 | j;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1130 dpos[j] = cell;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1131 var current_month = (date.getMonth() == month);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1132 if (!current_month) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1133 if (this.showsOtherMonths) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1134 cell.className += " othermonth";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1135 cell.otherMonth = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1136 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1137 cell.className = "emptycell";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1138 cell.innerHTML = "&nbsp;";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1139 cell.disabled = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1140 continue;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1141 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1142 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1143 cell.otherMonth = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1144 hasdays = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1145 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1146 cell.disabled = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1147 cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1148 if (dates)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1149 dates[date.print("%Y%m%d")] = cell;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1150 if (this.getDateStatus) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1151 var status = this.getDateStatus(date, year, month, iday);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1152 if (this.getDateToolTip) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1153 var toolTip = this.getDateToolTip(date, year, month, iday);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1154 if (toolTip)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1155 cell.title = toolTip;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1156 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1157 if (status === true) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1158 cell.className += " disabled";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1159 cell.disabled = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1160 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1161 if (/disabled/i.test(status))
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1162 cell.disabled = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1163 cell.className += " " + status;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1164 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1165 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1166 if (!cell.disabled) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1167 cell.caldate = new Date(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1168 cell.ttip = "_";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1169 if (!this.multiple && current_month
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1170 && iday == mday && this.hiliteToday) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1171 cell.className += " selected";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1172 this.currentDateEl = cell;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1173 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1174 if (date.getFullYear() == TY &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1175 date.getMonth() == TM &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1176 iday == TD) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1177 cell.className += " today";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1178 cell.ttip += Calendar._TT["PART_TODAY"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1179 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1180 if (weekend.indexOf(wday.toString()) != -1)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1181 cell.className += cell.otherMonth ? " oweekend" : " weekend";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1182 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1183 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1184 if (!(hasdays || this.showsOtherMonths))
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1185 row.className = "emptyrow";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1186 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1187 this.title.innerHTML = Calendar._MN[month] + ", " + year;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1188 this.onSetTime();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1189 this.table.style.visibility = "visible";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1190 this._initMultipleDates();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1191 // PROFILE
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1192 // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1193 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1194
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1195 Calendar.prototype._initMultipleDates = function() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1196 if (this.multiple) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1197 for (var i in this.multiple) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1198 var cell = this.datesCells[i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1199 var d = this.multiple[i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1200 if (!d)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1201 continue;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1202 if (cell)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1203 cell.className += " selected";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1204 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1205 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1206 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1207
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1208 Calendar.prototype._toggleMultipleDate = function(date) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1209 if (this.multiple) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1210 var ds = date.print("%Y%m%d");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1211 var cell = this.datesCells[ds];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1212 if (cell) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1213 var d = this.multiple[ds];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1214 if (!d) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1215 Calendar.addClass(cell, "selected");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1216 this.multiple[ds] = date;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1217 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1218 Calendar.removeClass(cell, "selected");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1219 delete this.multiple[ds];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1220 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1221 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1222 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1223 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1224
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1225 Calendar.prototype.setDateToolTipHandler = function (unaryFunction) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1226 this.getDateToolTip = unaryFunction;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1227 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1228
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1229 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1230 * Calls _init function above for going to a certain date (but only if the
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1231 * date is different than the currently selected one).
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1232 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1233 Calendar.prototype.setDate = function (date) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1234 if (!date.equalsTo(this.date)) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1235 this._init(this.firstDayOfWeek, date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1236 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1237 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1238
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1239 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1240 * Refreshes the calendar. Useful if the "disabledHandler" function is
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1241 * dynamic, meaning that the list of disabled date can change at runtime.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1242 * Just * call this function if you think that the list of disabled dates
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1243 * should * change.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1244 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1245 Calendar.prototype.refresh = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1246 this._init(this.firstDayOfWeek, this.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1247 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1248
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1249 /** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1250 Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1251 this._init(firstDayOfWeek, this.date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1252 this._displayWeekdays();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1253 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1254
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1255 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1256 * Allows customization of what dates are enabled. The "unaryFunction"
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1257 * parameter must be a function object that receives the date (as a JS Date
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1258 * object) and returns a boolean value. If the returned value is true then
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1259 * the passed date will be marked as disabled.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1260 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1261 Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1262 this.getDateStatus = unaryFunction;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1263 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1264
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1265 /** Customization of allowed year range for the calendar. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1266 Calendar.prototype.setRange = function (a, z) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1267 this.minYear = a;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1268 this.maxYear = z;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1269 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1270
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1271 /** Calls the first user handler (selectedHandler). */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1272 Calendar.prototype.callHandler = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1273 if (this.onSelected) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1274 this.onSelected(this, this.date.print(this.dateFormat));
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1275 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1276 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1277
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1278 /** Calls the second user handler (closeHandler). */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1279 Calendar.prototype.callCloseHandler = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1280 if (this.onClose) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1281 this.onClose(this);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1282 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1283 this.hideShowCovered();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1284 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1285
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1286 /** Removes the calendar object from the DOM tree and destroys it. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1287 Calendar.prototype.destroy = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1288 var el = this.element.parentNode;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1289 el.removeChild(this.element);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1290 Calendar._C = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1291 window._dynarch_popupCalendar = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1292 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1293
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1294 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1295 * Moves the calendar element to a different section in the DOM tree (changes
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1296 * its parent).
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1297 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1298 Calendar.prototype.reparent = function (new_parent) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1299 var el = this.element;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1300 el.parentNode.removeChild(el);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1301 new_parent.appendChild(el);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1302 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1303
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1304 // This gets called when the user presses a mouse button anywhere in the
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1305 // document, if the calendar is shown. If the click was outside the open
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1306 // calendar this function closes it.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1307 Calendar._checkCalendar = function(ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1308 var calendar = window._dynarch_popupCalendar;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1309 if (!calendar) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1310 return false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1311 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1312 var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1313 for (; el != null && el != calendar.element; el = el.parentNode);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1314 if (el == null) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1315 // calls closeHandler which should hide the calendar.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1316 window._dynarch_popupCalendar.callCloseHandler();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1317 return Calendar.stopEvent(ev);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1318 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1319 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1320
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1321 /** Shows the calendar. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1322 Calendar.prototype.show = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1323 var rows = this.table.getElementsByTagName("tr");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1324 for (var i = rows.length; i > 0;) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1325 var row = rows[--i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1326 Calendar.removeClass(row, "rowhilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1327 var cells = row.getElementsByTagName("td");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1328 for (var j = cells.length; j > 0;) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1329 var cell = cells[--j];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1330 Calendar.removeClass(cell, "hilite");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1331 Calendar.removeClass(cell, "active");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1332 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1333 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1334 this.element.style.display = "block";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1335 this.hidden = false;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1336 if (this.isPopup) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1337 window._dynarch_popupCalendar = this;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1338 Calendar.addEvent(document, "keydown", Calendar._keyEvent);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1339 Calendar.addEvent(document, "keypress", Calendar._keyEvent);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1340 Calendar.addEvent(document, "mousedown", Calendar._checkCalendar);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1341 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1342 this.hideShowCovered();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1343 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1344
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1345 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1346 * Hides the calendar. Also removes any "hilite" from the class of any TD
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1347 * element.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1348 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1349 Calendar.prototype.hide = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1350 if (this.isPopup) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1351 Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1352 Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1353 Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1354 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1355 this.element.style.display = "none";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1356 this.hidden = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1357 this.hideShowCovered();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1358 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1359
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1360 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1361 * Shows the calendar at a given absolute position (beware that, depending on
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1362 * the calendar element style -- position property -- this might be relative
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1363 * to the parent's containing rectangle).
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1364 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1365 Calendar.prototype.showAt = function (x, y) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1366 var s = this.element.style;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1367 s.left = x + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1368 s.top = y + "px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1369 this.show();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1370 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1371
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1372 /** Shows the calendar near a given element. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1373 Calendar.prototype.showAtElement = function (el, opts) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1374 var self = this;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1375 var p = Calendar.getAbsolutePos(el);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1376 if (!opts || typeof opts != "string") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1377 this.showAt(p.x, p.y + el.offsetHeight);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1378 return true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1379 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1380 function fixPosition(box) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1381 if (box.x < 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1382 box.x = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1383 if (box.y < 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1384 box.y = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1385 var cp = document.createElement("div");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1386 var s = cp.style;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1387 s.position = "absolute";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1388 s.right = s.bottom = s.width = s.height = "0px";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1389 document.body.appendChild(cp);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1390 var br = Calendar.getAbsolutePos(cp);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1391 document.body.removeChild(cp);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1392 if (Calendar.is_ie) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1393 br.y += document.body.scrollTop;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1394 br.x += document.body.scrollLeft;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1395 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1396 br.y += window.scrollY;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1397 br.x += window.scrollX;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1398 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1399 var tmp = box.x + box.width - br.x;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1400 if (tmp > 0) box.x -= tmp;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1401 tmp = box.y + box.height - br.y;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1402 if (tmp > 0) box.y -= tmp;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1403 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1404 this.element.style.display = "block";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1405 Calendar.continuation_for_the_fucking_khtml_browser = function() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1406 var w = self.element.offsetWidth;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1407 var h = self.element.offsetHeight;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1408 self.element.style.display = "none";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1409 var valign = opts.substr(0, 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1410 var halign = "l";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1411 if (opts.length > 1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1412 halign = opts.substr(1, 1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1413 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1414 // vertical alignment
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1415 switch (valign) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1416 case "T": p.y -= h; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1417 case "B": p.y += el.offsetHeight; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1418 case "C": p.y += (el.offsetHeight - h) / 2; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1419 case "t": p.y += el.offsetHeight - h; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1420 case "b": break; // already there
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1421 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1422 // horizontal alignment
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1423 switch (halign) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1424 case "L": p.x -= w; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1425 case "R": p.x += el.offsetWidth; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1426 case "C": p.x += (el.offsetWidth - w) / 2; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1427 case "l": p.x += el.offsetWidth - w; break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1428 case "r": break; // already there
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1429 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1430 p.width = w;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1431 p.height = h + 40;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1432 self.monthsCombo.style.display = "none";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1433 fixPosition(p);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1434 self.showAt(p.x, p.y);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1435 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1436 if (Calendar.is_khtml)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1437 setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1438 else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1439 Calendar.continuation_for_the_fucking_khtml_browser();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1440 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1441
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1442 /** Customizes the date format. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1443 Calendar.prototype.setDateFormat = function (str) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1444 this.dateFormat = str;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1445 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1446
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1447 /** Customizes the tooltip date format. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1448 Calendar.prototype.setTtDateFormat = function (str) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1449 this.ttDateFormat = str;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1450 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1451
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1452 /**
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1453 * Tries to identify the date represented in a string. If successful it also
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1454 * calls this.setDate which moves the calendar to the given date.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1455 */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1456 Calendar.prototype.parseDate = function(str, fmt) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1457 if (!fmt)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1458 fmt = this.dateFormat;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1459 this.setDate(Date.parseDate(str, fmt));
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1460 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1461
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1462 Calendar.prototype.hideShowCovered = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1463 if (!Calendar.is_ie && !Calendar.is_opera)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1464 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1465 function getVisib(obj){
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1466 var value = obj.style.visibility;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1467 if (!value) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1468 if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1469 if (!Calendar.is_khtml)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1470 value = document.defaultView.
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1471 getComputedStyle(obj, "").getPropertyValue("visibility");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1472 else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1473 value = '';
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1474 } else if (obj.currentStyle) { // IE
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1475 value = obj.currentStyle.visibility;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1476 } else
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1477 value = '';
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1478 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1479 return value;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1480 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1481
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1482 var tags = new Array("applet", "iframe", "select");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1483 var el = this.element;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1484
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1485 var p = Calendar.getAbsolutePos(el);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1486 var EX1 = p.x;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1487 var EX2 = el.offsetWidth + EX1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1488 var EY1 = p.y;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1489 var EY2 = el.offsetHeight + EY1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1490
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1491 for (var k = tags.length; k > 0; ) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1492 var ar = document.getElementsByTagName(tags[--k]);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1493 var cc = null;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1494
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1495 for (var i = ar.length; i > 0;) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1496 cc = ar[--i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1497
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1498 p = Calendar.getAbsolutePos(cc);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1499 var CX1 = p.x;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1500 var CX2 = cc.offsetWidth + CX1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1501 var CY1 = p.y;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1502 var CY2 = cc.offsetHeight + CY1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1503
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1504 if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1505 if (!cc.__msh_save_visibility) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1506 cc.__msh_save_visibility = getVisib(cc);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1507 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1508 cc.style.visibility = cc.__msh_save_visibility;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1509 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1510 if (!cc.__msh_save_visibility) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1511 cc.__msh_save_visibility = getVisib(cc);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1512 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1513 cc.style.visibility = "hidden";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1514 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1515 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1516 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1517 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1518
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1519 /** Internal function; it displays the bar with the names of the weekday. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1520 Calendar.prototype._displayWeekdays = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1521 var fdow = this.firstDayOfWeek;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1522 var cell = this.firstdayname;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1523 var weekend = Calendar._TT["WEEKEND"];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1524 for (var i = 0; i < 7; ++i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1525 cell.className = "day name";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1526 var realday = (i + fdow) % 7;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1527 if (i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1528 cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1529 cell.navtype = 100;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1530 cell.calendar = this;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1531 cell.fdow = realday;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1532 Calendar._add_evs(cell);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1533 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1534 if (weekend.indexOf(realday.toString()) != -1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1535 Calendar.addClass(cell, "weekend");
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1536 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1537 cell.innerHTML = Calendar._SDN[(i + fdow) % 7];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1538 cell = cell.nextSibling;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1539 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1540 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1541
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1542 /** Internal function. Hides all combo boxes that might be displayed. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1543 Calendar.prototype._hideCombos = function () {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1544 this.monthsCombo.style.display = "none";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1545 this.yearsCombo.style.display = "none";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1546 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1547
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1548 /** Internal function. Starts dragging the element. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1549 Calendar.prototype._dragStart = function (ev) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1550 if (this.dragging) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1551 return;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1552 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1553 this.dragging = true;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1554 var posX;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1555 var posY;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1556 if (Calendar.is_ie) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1557 posY = window.event.clientY + document.body.scrollTop;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1558 posX = window.event.clientX + document.body.scrollLeft;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1559 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1560 posY = ev.clientY + window.scrollY;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1561 posX = ev.clientX + window.scrollX;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1562 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1563 var st = this.element.style;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1564 this.xOffs = posX - parseInt(st.left);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1565 this.yOffs = posY - parseInt(st.top);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1566 with (Calendar) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1567 addEvent(document, "mousemove", calDragIt);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1568 addEvent(document, "mouseup", calDragEnd);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1569 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1570 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1571
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1572 // BEGIN: DATE OBJECT PATCHES
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1573
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1574 /** Adds the number of days array to the Date object. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1575 Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1576
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1577 /** Constants used for time computations */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1578 Date.SECOND = 1000 /* milliseconds */;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1579 Date.MINUTE = 60 * Date.SECOND;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1580 Date.HOUR = 60 * Date.MINUTE;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1581 Date.DAY = 24 * Date.HOUR;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1582 Date.WEEK = 7 * Date.DAY;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1583
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1584 Date.parseDate = function(str, fmt) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1585 var today = new Date();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1586 var y = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1587 var m = -1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1588 var d = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1589 var a = str.split(/\W+/);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1590 var b = fmt.match(/%./g);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1591 var i = 0, j = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1592 var hr = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1593 var min = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1594 for (i = 0; i < a.length; ++i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1595 if (!a[i])
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1596 continue;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1597 switch (b[i]) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1598 case "%d":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1599 case "%e":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1600 d = parseInt(a[i], 10);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1601 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1602
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1603 case "%m":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1604 m = parseInt(a[i], 10) - 1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1605 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1606
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1607 case "%Y":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1608 case "%y":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1609 y = parseInt(a[i], 10);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1610 (y < 100) && (y += (y > 29) ? 1900 : 2000);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1611 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1612
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1613 case "%b":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1614 case "%B":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1615 for (j = 0; j < 12; ++j) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1616 if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1617 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1618 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1619
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1620 case "%H":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1621 case "%I":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1622 case "%k":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1623 case "%l":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1624 hr = parseInt(a[i], 10);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1625 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1626
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1627 case "%P":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1628 case "%p":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1629 if (/pm/i.test(a[i]) && hr < 12)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1630 hr += 12;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1631 else if (/am/i.test(a[i]) && hr >= 12)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1632 hr -= 12;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1633 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1634
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1635 case "%M":
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1636 min = parseInt(a[i], 10);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1637 break;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1638 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1639 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1640 if (isNaN(y)) y = today.getFullYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1641 if (isNaN(m)) m = today.getMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1642 if (isNaN(d)) d = today.getDate();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1643 if (isNaN(hr)) hr = today.getHours();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1644 if (isNaN(min)) min = today.getMinutes();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1645 if (y != 0 && m != -1 && d != 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1646 return new Date(y, m, d, hr, min, 0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1647 y = 0; m = -1; d = 0;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1648 for (i = 0; i < a.length; ++i) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1649 if (a[i].search(/[a-zA-Z]+/) != -1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1650 var t = -1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1651 for (j = 0; j < 12; ++j) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1652 if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1653 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1654 if (t != -1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1655 if (m != -1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1656 d = m+1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1657 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1658 m = t;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1659 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1660 } else if (parseInt(a[i], 10) <= 12 && m == -1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1661 m = a[i]-1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1662 } else if (parseInt(a[i], 10) > 31 && y == 0) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1663 y = parseInt(a[i], 10);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1664 (y < 100) && (y += (y > 29) ? 1900 : 2000);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1665 } else if (d == 0) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1666 d = a[i];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1667 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1668 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1669 if (y == 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1670 y = today.getFullYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1671 if (m != -1 && d != 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1672 return new Date(y, m, d, hr, min, 0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1673 return today;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1674 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1675
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1676 /** Returns the number of days in the current month */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1677 Date.prototype.getMonthDays = function(month) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1678 var year = this.getFullYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1679 if (typeof month == "undefined") {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1680 month = this.getMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1681 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1682 if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1683 return 29;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1684 } else {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1685 return Date._MD[month];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1686 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1687 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1688
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1689 /** Returns the number of day in the year. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1690 Date.prototype.getDayOfYear = function() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1691 var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1692 var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1693 var time = now - then;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1694 return Math.floor(time / Date.DAY);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1695 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1696
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1697 /** Returns the number of the week in year, as defined in ISO 8601. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1698 Date.prototype.getWeekNumber = function() {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1699 var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1700 var DoW = d.getDay();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1701 d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1702 var ms = d.valueOf(); // GMT
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1703 d.setMonth(0);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1704 d.setDate(4); // Thu in Week 1
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1705 return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1706 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1707
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1708 /** Checks date and time equality */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1709 Date.prototype.equalsTo = function(date) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1710 return ((this.getFullYear() == date.getFullYear()) &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1711 (this.getMonth() == date.getMonth()) &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1712 (this.getDate() == date.getDate()) &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1713 (this.getHours() == date.getHours()) &&
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1714 (this.getMinutes() == date.getMinutes()));
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1715 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1716
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1717 /** Set only the year, month, date parts (keep existing time) */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1718 Date.prototype.setDateOnly = function(date) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1719 var tmp = new Date(date);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1720 this.setDate(1);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1721 this.setFullYear(tmp.getFullYear());
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1722 this.setMonth(tmp.getMonth());
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1723 this.setDate(tmp.getDate());
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1724 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1725
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1726 /** Prints the date in a string according to the given format. */
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1727 Date.prototype.print = function (str) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1728 var m = this.getMonth();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1729 var d = this.getDate();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1730 var y = this.getFullYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1731 var wn = this.getWeekNumber();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1732 var w = this.getDay();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1733 var s = {};
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1734 var hr = this.getHours();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1735 var pm = (hr >= 12);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1736 var ir = (pm) ? (hr - 12) : hr;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1737 var dy = this.getDayOfYear();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1738 if (ir == 0)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1739 ir = 12;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1740 var min = this.getMinutes();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1741 var sec = this.getSeconds();
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1742 s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N]
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1743 s["%A"] = Calendar._DN[w]; // full weekday name
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1744 s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N]
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1745 s["%B"] = Calendar._MN[m]; // full month name
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1746 // FIXME: %c : preferred date and time representation for the current locale
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1747 s["%C"] = 1 + Math.floor(y / 100); // the century number
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1748 s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1749 s["%e"] = d; // the day of the month (range 1 to 31)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1750 // FIXME: %D : american date style: %m/%d/%y
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1751 // FIXME: %E, %F, %G, %g, %h (man strftime)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1752 s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1753 s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1754 s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1755 s["%k"] = hr; // hour, range 0 to 23 (24h format)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1756 s["%l"] = ir; // hour, range 1 to 12 (12h format)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1757 s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1758 s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1759 s["%n"] = "\n"; // a newline character
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1760 s["%p"] = pm ? "PM" : "AM";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1761 s["%P"] = pm ? "pm" : "am";
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1762 // FIXME: %r : the time in am/pm notation %I:%M:%S %p
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1763 // FIXME: %R : the time in 24-hour notation %H:%M
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1764 s["%s"] = Math.floor(this.getTime() / 1000);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1765 s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1766 s["%t"] = "\t"; // a tab character
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1767 // FIXME: %T : the time in 24-hour notation (%H:%M:%S)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1768 s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1769 s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1770 s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1771 // FIXME: %x : preferred date representation for the current locale without the time
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1772 // FIXME: %X : preferred time representation for the current locale without the date
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1773 s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1774 s["%Y"] = y; // year with the century
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1775 s["%%"] = "%"; // a literal '%' character
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1776
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1777 var re = /%./g;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1778 if (!Calendar.is_ie5 && !Calendar.is_khtml)
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1779 return str.replace(re, function (par) { return s[par] || par; });
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1780
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1781 var a = str.match(re);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1782 for (var i = 0; i < a.length; i++) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1783 var tmp = s[a[i]];
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1784 if (tmp) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1785 re = new RegExp(a[i], 'g');
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1786 str = str.replace(re, tmp);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1787 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1788 }
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1789
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1790 return str;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1791 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1792
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1793 Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1794 Date.prototype.setFullYear = function(y) {
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1795 var d = new Date(this);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1796 d.__msh_oldSetFullYear(y);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1797 if (d.getMonth() != this.getMonth())
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1798 this.setDate(28);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1799 this.__msh_oldSetFullYear(y);
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1800 };
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1801
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1802 // END: DATE OBJECT PATCHES
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1803
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1804
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1805 // global object that remembers the calendar
9719cbd1a23f Import of MainLayout, Styles, images and Scripts from old System Revision: 3101 Does not compile
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1806 window._dynarch_popupCalendar = null;

http://dive4elements.wald.intevation.org