Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a56327d7

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID a56327d7da54b291ceb55af12e46757d3f8f05e4
  • Vorgänger 14d5612b
  • Nachfolger 620fd323

Lokalisierungsdateien jquery-ui hinzugefügt

Fixt #2179.

Unterschiede anzeigen:

SL/Form.pm
471 471
    jquery.multiselect2side frame_header/header
472 472
    ui-lightness/jquery-ui
473 473
    jquery-ui.custom
474
    js/jscalendar/calendar-win2k-1
475 474
  );
476 475

  
477
  $layout->use_javascript("$_.js") for qw(
478
    jquery common jscalendar/calendar jscalendar/lang/calendar-de
479
    jscalendar/calendar-setup part_selection jquery-ui jquery.cookie jqModal jquery.checkall
480
    switchmenuframe
481
  );
476
  $layout->use_javascript("$_.js") for (qw(
477
    jquery jquery-ui jquery.cookie jqModal jquery.checkall
478
    common part_selection switchmenuframe
479
  ), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}");
482 480

  
483 481
  $self->{favicon} ||= "favicon.ico";
484 482
  $self->{titlebar} = join ' - ', grep $_, $self->{title}, $self->{login}, $::myconfig{dbname}, $self->{version} if $self->{title} || !$self->{titlebar};
SL/Layout/MenuLeft.pm
13 13

  
14 14
sub javascripts_inline {
15 15
  my $self = shift;
16
  $self->SUPER::javascripts_inline;
16 17
  my $sections = [ section_menu($self->menu) ];
17 18
  $self->render('menu/menu', { output => 0 },
18 19
    sections  => $sections,
SL/Layout/None.pm
3 3
use strict;
4 4
use parent qw(SL::Layout::Base);
5 5

  
6
use List::MoreUtils qw(apply);
7

  
6 8
sub javascripts_inline {
7 9
  _setup_formats(),
8 10
  _setup_focus(),
......
27 29
}
28 30

  
29 31
sub _setup_formats {
30
  $::form->parse_html_template('layout/javascript_setup')
32
  my $datefmt = apply {
33
    s/d+/dd/gi;
34
    s/m+/mm/gi;
35
    s/y+/yy/gi;
36
  } $::myconfig{dateformat};
37

  
38
  $::form->parse_html_template('layout/javascript_setup', { datefmt => $datefmt });
31 39
}
32 40

  
33 41
sub _setup_focus {
SL/Template/Plugin/L.pm
358 358
  return $code;
359 359
}
360 360

  
361
my $date_tag_id_idx = 0;
361 362
sub date_tag {
362 363
  my ($self, $name, $value, @slurp) = @_;
364

  
363 365
  my %params   = _hashify(@slurp);
364
  my $name_e   = _H($name);
365
  my $seq      = _tag_id();
366
  my $datefmt  = apply {
367
    s/d+/\%d/gi;
368
    s/m+/\%m/gi;
369
    s/y+/\%Y/gi;
370
  } $::myconfig{"dateformat"};
371

  
372
  my $cal_align = delete $params{cal_align} || 'BR';
373
  my $onchange  = delete $params{onchange};
374
  my $str_value = blessed $value ? $value->to_lxoffice : $value;
375

  
376
  $self->input_tag($name, $str_value,
377
    id     => $name_e,
366
  my $id       = $self->name_to_id($name) . _tag_id();
367
  my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : ();
368
  my @class    = $params{no_cal} || $params{readonly} ? () : (class => 'datepicker');
369

  
370
  return $self->input_tag(
371
    $name, blessed($value) ? $value->to_lxoffice : $value,
372
    id     => $id,
378 373
    size   => 11,
379
    title  => _H($::myconfig{dateformat}),
380
    onBlur => 'check_right_date_format(this)',
381
    ($onchange ? (
382
    onChange => $onchange,
383
    ) : ()),
374
    onblur => "check_right_date_format(this);",
384 375
    %params,
385
  ) . ((!$params{no_cal} && !$params{readonly}) ?
386
  $self->html_tag('img', undef,
387
    src    => 'image/calendar.png',
388
    alt    => $::locale->text('Calendar'),
389
    id     => "trigger$seq",
390
    title  => _H($::myconfig{dateformat}),
391
    %params,
392
  ) .
393
  $self->javascript(
394
    "Calendar.setup({ inputField: '$name_e', ifFormat: '$datefmt', align: '$cal_align', button: 'trigger$seq' });"
395
  ) : '');
376
    @class, @onchange,
377
  );
396 378
}
397 379

  
398 380
sub customer_picker {
......
829 811
JQuery selector and clicking this checkbox will also toggle all checkboxes
830 812
matching the selector.
831 813

  
832
=item C<date_tag $name, $value, cal_align =E<gt> $align_code, %attributes>
814
=item C<date_tag $name, $value, %attributes>
833 815

  
834 816
Creates a date input field, with an attached javascript that will open a
835
calendar on click. The javascript ist by default anchoered at the bottom right
836
sight. This can be overridden with C<cal_align>, see Calendar documentation for
837
the details, usually you'll want a two letter abbreviation of the alignment.
838
Right + Bottom becomes C<BL>.
817
calendar on click.
839 818

  
840 819
=item C<radio_button_tag $name, %attributes>
841 820

  
......
861 840
with '.css' if it isn't already and prefixed with 'css/' if it doesn't
862 841
contain a slash.
863 842

  
864
=item C<date_tag $name, $value, cal_align =E<gt> $align_code, %attributes>
865

  
866
Creates a date input field, with an attached javascript that will open a
867
calendar on click. The javascript ist by default anchoered at the bottom right
868
sight. This can be overridden with C<cal_align>, see Calendar documentation for
869
the details, usually you'll want a two letter abbreviation of the alignment.
870
Right + Bottom becomes C<BL>.
871

  
872 843
=item C<tabbed \@tab, %attributes>
873 844

  
874 845
Will create a tabbed area. The tabs should be created with the helper function
js/jquery/ui/i18n/jquery.ui.datepicker-de.js
1
/* German initialisation for the jQuery UI date picker plugin. */
2
/* Written by Milian Wolff (mail@milianw.de). */
3
jQuery(function($){
4
	$.datepicker.regional['de'] = {
5
		closeText: 'Schließen',
6
		prevText: '&#x3C;Zurück',
7
		nextText: 'Vor&#x3E;',
8
		currentText: 'Heute',
9
		monthNames: ['Januar','Februar','März','April','Mai','Juni',
10
		'Juli','August','September','Oktober','November','Dezember'],
11
		monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
12
		'Jul','Aug','Sep','Okt','Nov','Dez'],
13
		dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
14
		dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
15
		dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
16
		weekHeader: 'KW',
17
		dateFormat: 'dd.mm.yy',
18
		firstDay: 1,
19
		isRTL: false,
20
		showMonthAfterYear: false,
21
		yearSuffix: ''};
22
	$.datepicker.setDefaults($.datepicker.regional['de']);
23
});
js/jquery/ui/i18n/jquery.ui.datepicker-en-GB.js
1
/* English/UK initialisation for the jQuery UI date picker plugin. */
2
/* Written by Stuart. */
3
jQuery(function($){
4
	$.datepicker.regional['en-GB'] = {
5
		closeText: 'Done',
6
		prevText: 'Prev',
7
		nextText: 'Next',
8
		currentText: 'Today',
9
		monthNames: ['January','February','March','April','May','June',
10
		'July','August','September','October','November','December'],
11
		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
12
		'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
13
		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
14
		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
15
		dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
16
		weekHeader: 'Wk',
17
		dateFormat: 'dd/mm/yy',
18
		firstDay: 1,
19
		isRTL: false,
20
		showMonthAfterYear: false,
21
		yearSuffix: ''};
22
	$.datepicker.setDefaults($.datepicker.regional['en-GB']);
23
});
js/jquery/ui/i18n/jquery.ui.datepicker-en.js
1
jquery.ui.datepicker-en-GB.js
js/jscalendar/calendar-setup.js
1
/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
2
 * ---------------------------------------------------------------------------
3
 *
4
 * The DHTML Calendar
5
 *
6
 * Details and latest version at:
7
 * http://dynarch.com/mishoo/calendar.epl
8
 *
9
 * This script is distributed under the GNU Lesser General Public License.
10
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
11
 *
12
 * This file defines helper functions for setting up the calendar.  They are
13
 * intended to help non-programmers get a working calendar on their site
14
 * quickly.  This script should not be seen as part of the calendar.  It just
15
 * shows you what one can do with the calendar, while in the same time
16
 * providing a quick and simple method for setting it up.  If you need
17
 * exhaustive customization of the calendar creation process feel free to
18
 * modify this code to suit your needs (this is recommended and much better
19
 * than modifying calendar.js itself).
20
 */
21

  
22
// $Id: calendar-setup.js,v 1.15 2004/02/04 08:10:03 mishoo Exp $
23

  
24
/**
25
 *  This function "patches" an input field (or other element) to use a calendar
26
 *  widget for date selection.
27
 *
28
 *  The "params" is a single object that can have the following properties:
29
 *
30
 *    prop. name   | description
31
 *  -------------------------------------------------------------------------------------------------
32
 *   inputField    | the ID of an input field to store the date
33
 *   displayArea   | the ID of a DIV or other element to show the date
34
 *   button        | ID of a button or other element that will trigger the calendar
35
 *   eventName     | event that will trigger the calendar, without the "on" prefix (default: "click")
36
 *   ifFormat      | date format that will be stored in the input field
37
 *   daFormat      | the date format that will be used to display the date in displayArea
38
 *   singleClick   | (true/false) wether the calendar is in single click mode or not (default: true)
39
 *   firstDay      | numeric: 0 to 6.  "0" means display Sunday first, "1" means display Monday first, etc.
40
 *   align         | alignment (default: "Br"); if you don't know what's this see the calendar documentation
41
 *   range         | array with 2 elements.  Default: [1900, 2999] -- the range of years available
42
 *   weekNumbers   | (true/false) if it's true (default) the calendar will display week numbers
43
 *   flat          | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID
44
 *   flatCallback  | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar)
45
 *   disableFunc   | function that receives a JS Date object and should return true if that date has to be disabled in the calendar
46
 *   onSelect      | function that gets called when a date is selected.  You don't _have_ to supply this (the default is generally okay)
47
 *   onClose       | function that gets called when the calendar is closed.  [default]
48
 *   onUpdate      | function that gets called after the date is updated in the input field.  Receives a reference to the calendar.
49
 *   date          | the date that the calendar will be initially displayed to
50
 *   showsTime     | default: false; if true the calendar will include a time selector
51
 *   timeFormat    | the time format; can be "12" or "24", default is "12"
52
 *   electric      | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close
53
 *   step          | configures the step of the years in drop-down boxes; default: 2
54
 *   position      | configures the calendar absolute position; default: null
55
 *   cache         | if "true" (but default: "false") it will reuse the same calendar object, where possible
56
 *   showOthers    | if "true" (but default: "false") it will show days from other months too
57
 *
58
 *  None of them is required, they all have default values.  However, if you
59
 *  pass none of "inputField", "displayArea" or "button" you'll get a warning
60
 *  saying "nothing to setup".
61
 */
62
Calendar.setup = function (params) {
63
	function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };
64

  
65
	param_default("inputField",     null);
66
	param_default("displayArea",    null);
67
	param_default("button",         null);
68
	param_default("eventName",      "click");
69
	param_default("ifFormat",       "%Y/%m/%d");
70
	param_default("daFormat",       "%Y/%m/%d");
71
	param_default("singleClick",    true);
72
	param_default("disableFunc",    null);
73
	param_default("dateStatusFunc", params["disableFunc"]);	// takes precedence if both are defined
74
	param_default("firstDay",       1); // defaults to "Sunday" first
75
	param_default("align",          "Br");
76
	param_default("range",          [1900, 2999]);
77
	param_default("weekNumbers",    true);
78
	param_default("flat",           null);
79
	param_default("flatCallback",   null);
80
	param_default("onSelect",       null);
81
	param_default("onClose",        null);
82
	param_default("onUpdate",       null);
83
	param_default("date",           null);
84
	param_default("showsTime",      false);
85
	param_default("timeFormat",     "24");
86
	param_default("electric",       true);
87
	param_default("step",           2);
88
	param_default("position",       null);
89
	param_default("cache",          false);
90
	param_default("showOthers",     false);
91

  
92
	var tmp = ["inputField", "displayArea", "button"];
93
	for (var i in tmp) {
94
		if (typeof params[tmp[i]] == "string") {
95
			params[tmp[i]] = document.getElementById(params[tmp[i]]);
96
		}
97
	}
98
	if (!(params.flat || params.inputField || params.displayArea || params.button)) {
99
		alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");
100
		return false;
101
	}
102

  
103
	function onSelect(cal) {
104
		var p = cal.params;
105
		var update = (cal.dateClicked || p.electric);
106
		if (update && p.flat) {
107
			if (typeof p.flatCallback == "function")
108
				p.flatCallback(cal);
109
			else
110
				alert("No flatCallback given -- doing nothing.");
111
			return false;
112
		}
113
		if (update && p.inputField) {
114
			p.inputField.value = cal.date.print(p.ifFormat);
115
			if (typeof p.inputField.onchange == "function")
116
				p.inputField.onchange();
117
		}
118
		if (update && p.displayArea)
119
			p.displayArea.innerHTML = cal.date.print(p.daFormat);
120
		if (update && p.singleClick && cal.dateClicked)
121
			cal.callCloseHandler();
122
		if (update && typeof p.onUpdate == "function")
123
			p.onUpdate(cal);
124
	};
125

  
126
	if (params.flat != null) {
127
		if (typeof params.flat == "string")
128
			params.flat = document.getElementById(params.flat);
129
		if (!params.flat) {
130
			alert("Calendar.setup:\n  Flat specified but can't find parent.");
131
			return false;
132
		}
133
		var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect);
134
		cal.showsTime = params.showsTime;
135
		cal.time24 = (params.timeFormat == "24");
136
		cal.params = params;
137
		cal.weekNumbers = params.weekNumbers;
138
		cal.setRange(params.range[0], params.range[1]);
139
		cal.setDateStatusHandler(params.dateStatusFunc);
140
		cal.create(params.flat);
141
		cal.show();
142
		return false;
143
	}
144

  
145
	var triggerEl = params.button || params.displayArea || params.inputField;
146
	triggerEl["on" + params.eventName] = function() {
147
		var dateEl = params.inputField || params.displayArea;
148
		var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
149
		var mustCreate = false;
150
		var cal = window.calendar;
151
		if (!(cal && params.cache)) {
152
			window.calendar = cal = new Calendar(params.firstDay,
153
							     params.date,
154
							     params.onSelect || onSelect,
155
							     params.onClose || function(cal) { cal.hide(); });
156
			cal.showsTime = params.showsTime;
157
			cal.time24 = (params.timeFormat == "24");
158
			cal.weekNumbers = params.weekNumbers;
159
			mustCreate = true;
160
		} else {
161
			if (params.date)
162
				cal.setDate(params.date);
163
			cal.hide();
164
		}
165
		cal.showsOtherMonths = params.showOthers;
166
		cal.yearStep = params.step;
167
		cal.setRange(params.range[0], params.range[1]);
168
		cal.params = params;
169
		cal.setDateStatusHandler(params.dateStatusFunc);
170
		cal.setDateFormat(dateFmt);
171
		if (mustCreate)
172
			cal.create();
173
		cal.parseDate(dateEl.value || dateEl.innerHTML);
174
		cal.refresh();
175
		if (!params.position)
176
			cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
177
		else
178
			cal.showAt(params.position[0], params.position[1]);
179
		return false;
180
	};
181
};
js/jscalendar/calendar-win2k-1.css
1
/* The main calendar widget.  DIV containing a table. */
2

  
3
.calendar {
4
  position: relative;
5
  display: none;
6
  border-top: 2px solid #fff;
7
  border-right: 2px solid #000;
8
  border-bottom: 2px solid #000;
9
  border-left: 2px solid #fff;
10
  font-size: 11px;
11
  color: #000;
12
  cursor: default;
13
  background: #d4d0c8;
14
  font-family: tahoma,verdana,sans-serif;
15
}
16

  
17
.calendar table {
18
  border-top: 1px solid #000;
19
  border-right: 1px solid #fff;
20
  border-bottom: 1px solid #fff;
21
  border-left: 1px solid #000;
22
  font-size: 11px;
23
  color: #000;
24
  cursor: default;
25
  background: #d4d0c8;
26
  font-family: tahoma,verdana,sans-serif;
27
}
28

  
29
/* Header part -- contains navigation buttons and day names. */
30

  
31
.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
32
  text-align: center;
33
  padding: 1px;
34
  border-top: 1px solid #fff;
35
  border-right: 1px solid #000;
36
  border-bottom: 1px solid #000;
37
  border-left: 1px solid #fff;
38
}
39

  
40
.calendar .nav {
41
  background: transparent url(menuarrow.gif) no-repeat 100% 100%;
42
}
43

  
44
.calendar thead .title { /* This holds the current "month, year" */
45
  font-weight: bold;
46
  padding: 1px;
47
  border: 1px solid #000;
48
  background: #848078;
49
  color: #fff;
50
  text-align: center;
51
}
52

  
53
.calendar thead .headrow { /* Row <TR> containing navigation buttons */
54
}
55

  
56
.calendar thead .daynames { /* Row <TR> containing the day names */
57
}
58

  
59
.calendar thead .name { /* Cells <TD> containing the day names */
60
  border-bottom: 1px solid #000;
61
  padding: 2px;
62
  text-align: center;
63
  background: #f4f0e8;
64
}
65

  
66
.calendar thead .weekend { /* How a weekend day name shows in header */
67
  color: #f00;
68
}
69

  
70
.calendar thead .hilite { /* How do the buttons in header appear when hover */
71
  border-top: 2px solid #fff;
72
  border-right: 2px solid #000;
73
  border-bottom: 2px solid #000;
74
  border-left: 2px solid #fff;
75
  padding: 0px;
76
  background-color: #e4e0d8;
77
}
78

  
79
.calendar thead .active { /* Active (pressed) buttons in header */
80
  padding: 2px 0px 0px 2px;
81
  border-top: 1px solid #000;
82
  border-right: 1px solid #fff;
83
  border-bottom: 1px solid #fff;
84
  border-left: 1px solid #000;
85
  background-color: #c4c0b8;
86
}
87

  
88
/* The body part -- contains all the days in month. */
89

  
90
.calendar tbody .day { /* Cells <TD> containing month days dates */
91
  width: 2em;
92
  text-align: right;
93
  padding: 2px 4px 2px 2px;
94
}
95
.calendar tbody .day.othermonth {
96
  font-size: 80%;
97
  color: #aaa;
98
}
99
.calendar tbody .day.othermonth.oweekend {
100
  color: #faa;
101
}
102

  
103
.calendar table .wn {
104
  padding: 2px 3px 2px 2px;
105
  border-right: 1px solid #000;
106
  background: #f4f0e8;
107
}
108

  
109
.calendar tbody .rowhilite td {
110
  background: #e4e0d8;
111
}
112

  
113
.calendar tbody .rowhilite td.wn {
114
  background: #d4d0c8;
115
}
116

  
117
.calendar tbody td.hilite { /* Hovered cells <TD> */
118
  padding: 1px 3px 1px 1px;
119
  border-top: 1px solid #fff;
120
  border-right: 1px solid #000;
121
  border-bottom: 1px solid #000;
122
  border-left: 1px solid #fff;
123
}
124

  
125
.calendar tbody td.active { /* Active (pressed) cells <TD> */
126
  padding: 2px 2px 0px 2px;
127
  border-top: 1px solid #000;
128
  border-right: 1px solid #fff;
129
  border-bottom: 1px solid #fff;
130
  border-left: 1px solid #000;
131
}
132

  
133
.calendar tbody td.selected { /* Cell showing selected date */
134
  font-weight: bold;
135
  border-top: 1px solid #000;
136
  border-right: 1px solid #fff;
137
  border-bottom: 1px solid #fff;
138
  border-left: 1px solid #000;
139
  padding: 2px 2px 0px 2px;
140
  background: #e4e0d8;
141
}
142

  
143
.calendar tbody td.weekend { /* Cells showing weekend days */
144
  color: #f00;
145
}
146

  
147
.calendar tbody td.today { /* Cell showing today date */
148
  font-weight: bold;
149
  color: #00f;
150
}
151

  
152
.calendar tbody .disabled { color: #999; }
153

  
154
.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
155
  visibility: hidden;
156
}
157

  
158
.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
159
  display: none;
160
}
161

  
162
/* The footer part -- status bar and "Close" button */
163

  
164
.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
165
}
166

  
167
.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
168
  background: #f4f0e8;
169
  padding: 1px;
170
  border: 1px solid #000;
171
  background: #848078;
172
  color: #fff;
173
  text-align: center;
174
}
175

  
176
.calendar tfoot .hilite { /* Hover style for buttons in footer */
177
  border-top: 1px solid #fff;
178
  border-right: 1px solid #000;
179
  border-bottom: 1px solid #000;
180
  border-left: 1px solid #fff;
181
  padding: 1px;
182
  background: #e4e0d8;
183
}
184

  
185
.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
186
  padding: 2px 0px 0px 2px;
187
  border-top: 1px solid #000;
188
  border-right: 1px solid #fff;
189
  border-bottom: 1px solid #fff;
190
  border-left: 1px solid #000;
191
}
192

  
193
/* Combo boxes (menus that display months/years for direct selection) */
194

  
195
.calendar .combo {
196
  position: absolute;
197
  display: none;
198
  width: 4em;
199
  top: 0px;
200
  left: 0px;
201
  cursor: default;
202
  border-top: 1px solid #fff;
203
  border-right: 1px solid #000;
204
  border-bottom: 1px solid #000;
205
  border-left: 1px solid #fff;
206
  background: #e4e0d8;
207
  font-size: 90%;
208
  padding: 1px;
209
}
210

  
211
.calendar .combo .label,
212
.calendar .combo .label-IEfix {
213
  text-align: center;
214
  padding: 1px;
215
}
216

  
217
.calendar .combo .label-IEfix {
218
  width: 4em;
219
}
220

  
221
.calendar .combo .active {
222
  background: #c4c0b8;
223
  padding: 0px;
224
  border-top: 1px solid #000;
225
  border-right: 1px solid #fff;
226
  border-bottom: 1px solid #fff;
227
  border-left: 1px solid #000;
228
}
229

  
230
.calendar .combo .hilite {
231
  background: #048;
232
  color: #fea;
233
}
234

  
235
.calendar td.time {
236
  border-top: 1px solid #000;
237
  padding: 1px 0px;
238
  text-align: center;
239
  background-color: #f4f0e8;
240
}
241

  
242
.calendar td.time .hour,
243
.calendar td.time .minute,
244
.calendar td.time .ampm {
245
  padding: 0px 3px 0px 4px;
246
  border: 1px solid #889;
247
  font-weight: bold;
248
  background-color: #fff;
249
}
250

  
251
.calendar td.time .ampm {
252
  text-align: center;
253
}
254

  
255
.calendar td.time .colon {
256
  padding: 0px 2px 0px 3px;
257
  font-weight: bold;
258
}
259

  
260
.calendar td.time span.hilite {
261
  border-color: #000;
262
  background-color: #766;
263
  color: #fff;
264
}
265

  
266
.calendar td.time span.active {
267
  border-color: #f00;
268
  background-color: #000;
269
  color: #0f0;
270
}
js/jscalendar/calendar.js
1
/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
2
 * ------------------------------------------------------------------
3
 *
4
 * The DHTML Calendar, version 0.9.6 "Keep cool but don't freeze"
5
 *
6
 * Details and latest version at:
7
 * http://dynarch.com/mishoo/calendar.epl
8
 *
9
 * This script is distributed under the GNU Lesser General Public License.
10
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
11
 */
12

  
13
// $Id: calendar.js,v 1.34 2004/02/06 18:53:11 mishoo Exp $
14

  
15
/** The Calendar object constructor. */
16
Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
17
	// member variables
18
	this.activeDiv = null;
19
	this.currentDateEl = null;
20
	this.getDateStatus = null;
21
	this.timeout = null;
22
	this.onSelected = onSelected || null;
23
	this.onClose = onClose || null;
24
	this.dragging = false;
25
	this.hidden = false;
26
	this.minYear = 1970;
27
	this.maxYear = 2050;
28
	this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
29
	this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
30
	this.isPopup = true;
31
	this.weekNumbers = true;
32
	this.firstDayOfWeek = firstDayOfWeek; // 0 for Sunday, 1 for Monday, etc.
33
	this.showsOtherMonths = false;
34
	this.dateStr = dateStr;
35
	this.ar_days = null;
36
	this.showsTime = false;
37
	this.time24 = true;
38
	this.yearStep = 2;
39
	// HTML elements
40
	this.table = null;
41
	this.element = null;
42
	this.tbody = null;
43
	this.firstdayname = null;
44
	// Combo boxes
45
	this.monthsCombo = null;
46
	this.yearsCombo = null;
47
	this.hilitedMonth = null;
48
	this.activeMonth = null;
49
	this.hilitedYear = null;
50
	this.activeYear = null;
51
	// Information
52
	this.dateClicked = false;
53

  
54
	// one-time initializations
55
	if (typeof Calendar._SDN == "undefined") {
56
		// table of short day names
57
		if (typeof Calendar._SDN_len == "undefined")
58
			Calendar._SDN_len = 3;
59
		var ar = new Array();
60
		for (var i = 8; i > 0;) {
61
			ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
62
		}
63
		Calendar._SDN = ar;
64
		// table of short month names
65
		if (typeof Calendar._SMN_len == "undefined")
66
			Calendar._SMN_len = 3;
67
		ar = new Array();
68
		for (var i = 12; i > 0;) {
69
			ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
70
		}
71
		Calendar._SMN = ar;
72
	}
73
};
74

  
75
// ** constants
76

  
77
/// "static", needed for event handlers.
78
Calendar._C = null;
79

  
80
/// detect a special case of "web browser"
81
Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
82
		   !/opera/i.test(navigator.userAgent) );
83

  
84
Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );
85

  
86
/// detect Opera browser
87
Calendar.is_opera = /opera/i.test(navigator.userAgent);
88

  
89
/// detect KHTML-based browsers
90
Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
91

  
92
// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
93
//        library, at some point.
94

  
95
Calendar.getAbsolutePos = function(el) {
96
	var SL = 0, ST = 0;
97
	var is_div = /^div$/i.test(el.tagName);
98
	if (is_div && el.scrollLeft)
99
		SL = el.scrollLeft;
100
	if (is_div && el.scrollTop)
101
		ST = el.scrollTop;
102
	var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
103
	if (el.offsetParent) {
104
		var tmp = this.getAbsolutePos(el.offsetParent);
105
		r.x += tmp.x;
106
		r.y += tmp.y;
107
	}
108
	return r;
109
};
110

  
111
Calendar.isRelated = function (el, evt) {
112
	var related = evt.relatedTarget;
113
	if (!related) {
114
		var type = evt.type;
115
		if (type == "mouseover") {
116
			related = evt.fromElement;
117
		} else if (type == "mouseout") {
118
			related = evt.toElement;
119
		}
120
	}
121
	while (related) {
122
		if (related == el) {
123
			return true;
124
		}
125
		related = related.parentNode;
126
	}
127
	return false;
128
};
129

  
130
Calendar.removeClass = function(el, className) {
131
	if (!(el && el.className)) {
132
		return;
133
	}
134
	var cls = el.className.split(" ");
135
	var ar = new Array();
136
	for (var i = cls.length; i > 0;) {
137
		if (cls[--i] != className) {
138
			ar[ar.length] = cls[i];
139
		}
140
	}
141
	el.className = ar.join(" ");
142
};
143

  
144
Calendar.addClass = function(el, className) {
145
	Calendar.removeClass(el, className);
146
	el.className += " " + className;
147
};
148

  
149
Calendar.getElement = function(ev) {
150
	if (Calendar.is_ie) {
151
		return window.event.srcElement;
152
	} else {
153
		return ev.currentTarget;
154
	}
155
};
156

  
157
Calendar.getTargetElement = function(ev) {
158
	if (Calendar.is_ie) {
159
		return window.event.srcElement;
160
	} else {
161
		return ev.target;
162
	}
163
};
164

  
165
Calendar.stopEvent = function(ev) {
166
	ev || (ev = window.event);
167
	if (Calendar.is_ie) {
168
		ev.cancelBubble = true;
169
		ev.returnValue = false;
170
	} else {
171
		ev.preventDefault();
172
		ev.stopPropagation();
173
	}
174
	return false;
175
};
176

  
177
Calendar.addEvent = function(el, evname, func) {
178
	if (el.attachEvent) { // IE
179
		el.attachEvent("on" + evname, func);
180
	} else if (el.addEventListener) { // Gecko / W3C
181
		el.addEventListener(evname, func, true);
182
	} else {
183
		el["on" + evname] = func;
184
	}
185
};
186

  
187
Calendar.removeEvent = function(el, evname, func) {
188
	if (el.detachEvent) { // IE
189
		el.detachEvent("on" + evname, func);
190
	} else if (el.removeEventListener) { // Gecko / W3C
191
		el.removeEventListener(evname, func, true);
192
	} else {
193
		el["on" + evname] = null;
194
	}
195
};
196

  
197
Calendar.createElement = function(type, parent) {
198
	var el = null;
199
	if (document.createElementNS) {
200
		// use the XHTML namespace; IE won't normally get here unless
201
		// _they_ "fix" the DOM2 implementation.
202
		el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
203
	} else {
204
		el = document.createElement(type);
205
	}
206
	if (typeof parent != "undefined") {
207
		parent.appendChild(el);
208
	}
209
	return el;
210
};
211

  
212
// END: UTILITY FUNCTIONS
213

  
214
// BEGIN: CALENDAR STATIC FUNCTIONS
215

  
216
/** Internal -- adds a set of events to make some element behave like a button. */
217
Calendar._add_evs = function(el) {
218
	with (Calendar) {
219
		addEvent(el, "mouseover", dayMouseOver);
220
		addEvent(el, "mousedown", dayMouseDown);
221
		addEvent(el, "mouseout", dayMouseOut);
222
		if (is_ie) {
223
			addEvent(el, "dblclick", dayMouseDblClick);
224
			el.setAttribute("unselectable", true);
225
		}
226
	}
227
};
228

  
229
Calendar.findMonth = function(el) {
230
	if (typeof el.month != "undefined") {
231
		return el;
232
	} else if (typeof el.parentNode.month != "undefined") {
233
		return el.parentNode;
234
	}
235
	return null;
236
};
237

  
238
Calendar.findYear = function(el) {
239
	if (typeof el.year != "undefined") {
240
		return el;
241
	} else if (typeof el.parentNode.year != "undefined") {
242
		return el.parentNode;
243
	}
244
	return null;
245
};
246

  
247
Calendar.showMonthsCombo = function () {
248
	var cal = Calendar._C;
249
	if (!cal) {
250
		return false;
251
	}
252
	var cal = cal;
253
	var cd = cal.activeDiv;
254
	var mc = cal.monthsCombo;
255
	if (cal.hilitedMonth) {
256
		Calendar.removeClass(cal.hilitedMonth, "hilite");
257
	}
258
	if (cal.activeMonth) {
259
		Calendar.removeClass(cal.activeMonth, "active");
260
	}
261
	var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
262
	Calendar.addClass(mon, "active");
263
	cal.activeMonth = mon;
264
	var s = mc.style;
265
	s.display = "block";
266
	if (cd.navtype < 0)
267
		s.left = cd.offsetLeft + "px";
268
	else {
269
		var mcw = mc.offsetWidth;
270
		if (typeof mcw == "undefined")
271
			// Konqueror brain-dead techniques
272
			mcw = 50;
273
		s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
274
	}
275
	s.top = (cd.offsetTop + cd.offsetHeight) + "px";
276
};
277

  
278
Calendar.showYearsCombo = function (fwd) {
279
	var cal = Calendar._C;
280
	if (!cal) {
281
		return false;
282
	}
283
	var cal = cal;
284
	var cd = cal.activeDiv;
285
	var yc = cal.yearsCombo;
286
	if (cal.hilitedYear) {
287
		Calendar.removeClass(cal.hilitedYear, "hilite");
288
	}
289
	if (cal.activeYear) {
290
		Calendar.removeClass(cal.activeYear, "active");
291
	}
292
	cal.activeYear = null;
293
	var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
294
	var yr = yc.firstChild;
295
	var show = false;
296
	for (var i = 12; i > 0; --i) {
297
		if (Y >= cal.minYear && Y <= cal.maxYear) {
298
			yr.firstChild.data = Y;
299
			yr.year = Y;
300
			yr.style.display = "block";
301
			show = true;
302
		} else {
303
			yr.style.display = "none";
304
		}
305
		yr = yr.nextSibling;
306
		Y += fwd ? cal.yearStep : -cal.yearStep;
307
	}
308
	if (show) {
309
		var s = yc.style;
310
		s.display = "block";
311
		if (cd.navtype < 0)
312
			s.left = cd.offsetLeft + "px";
313
		else {
314
			var ycw = yc.offsetWidth;
315
			if (typeof ycw == "undefined")
316
				// Konqueror brain-dead techniques
317
				ycw = 50;
318
			s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
319
		}
320
		s.top = (cd.offsetTop + cd.offsetHeight) + "px";
321
	}
322
};
323

  
324
// event handlers
325

  
326
Calendar.tableMouseUp = function(ev) {
327
	var cal = Calendar._C;
328
	if (!cal) {
329
		return false;
330
	}
331
	if (cal.timeout) {
332
		clearTimeout(cal.timeout);
333
	}
334
	var el = cal.activeDiv;
335
	if (!el) {
336
		return false;
337
	}
338
	var target = Calendar.getTargetElement(ev);
339
	ev || (ev = window.event);
340
	Calendar.removeClass(el, "active");
341
	if (target == el || target.parentNode == el) {
342
		Calendar.cellClick(el, ev);
343
	}
344
	var mon = Calendar.findMonth(target);
345
	var date = null;
346
	if (mon) {
347
		date = new Date(cal.date);
348
		if (mon.month != date.getMonth()) {
349
			date.setMonth(mon.month);
350
			cal.setDate(date);
351
			cal.dateClicked = false;
352
			cal.callHandler();
353
		}
354
	} else {
355
		var year = Calendar.findYear(target);
356
		if (year) {
357
			date = new Date(cal.date);
358
			if (year.year != date.getFullYear()) {
359
				date.setFullYear(year.year);
360
				cal.setDate(date);
361
				cal.dateClicked = false;
362
				cal.callHandler();
363
			}
364
		}
365
	}
366
	with (Calendar) {
367
		removeEvent(document, "mouseup", tableMouseUp);
368
		removeEvent(document, "mouseover", tableMouseOver);
369
		removeEvent(document, "mousemove", tableMouseOver);
370
		cal._hideCombos();
371
		_C = null;
372
		return stopEvent(ev);
373
	}
374
};
375

  
376
Calendar.tableMouseOver = function (ev) {
377
	var cal = Calendar._C;
378
	if (!cal) {
379
		return;
380
	}
381
	var el = cal.activeDiv;
382
	var target = Calendar.getTargetElement(ev);
383
	if (target == el || target.parentNode == el) {
384
		Calendar.addClass(el, "hilite active");
385
		Calendar.addClass(el.parentNode, "rowhilite");
386
	} else {
387
		if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
388
			Calendar.removeClass(el, "active");
389
		Calendar.removeClass(el, "hilite");
390
		Calendar.removeClass(el.parentNode, "rowhilite");
391
	}
392
	ev || (ev = window.event);
393
	if (el.navtype == 50 && target != el) {
394
		var pos = Calendar.getAbsolutePos(el);
395
		var w = el.offsetWidth;
396
		var x = ev.clientX;
397
		var dx;
398
		var decrease = true;
399
		if (x > pos.x + w) {
400
			dx = x - pos.x - w;
401
			decrease = false;
402
		} else
403
			dx = pos.x - x;
404

  
405
		if (dx < 0) dx = 0;
406
		var range = el._range;
407
		var current = el._current;
408
		var count = Math.floor(dx / 10) % range.length;
409
		for (var i = range.length; --i >= 0;)
410
			if (range[i] == current)
411
				break;
412
		while (count-- > 0)
413
			if (decrease) {
414
				if (--i < 0)
415
					i = range.length - 1;
416
			} else if ( ++i >= range.length )
417
				i = 0;
418
		var newval = range[i];
419
		el.firstChild.data = newval;
420

  
421
		cal.onUpdateTime();
422
	}
423
	var mon = Calendar.findMonth(target);
424
	if (mon) {
425
		if (mon.month != cal.date.getMonth()) {
426
			if (cal.hilitedMonth) {
427
				Calendar.removeClass(cal.hilitedMonth, "hilite");
428
			}
429
			Calendar.addClass(mon, "hilite");
430
			cal.hilitedMonth = mon;
431
		} else if (cal.hilitedMonth) {
432
			Calendar.removeClass(cal.hilitedMonth, "hilite");
433
		}
434
	} else {
435
		if (cal.hilitedMonth) {
436
			Calendar.removeClass(cal.hilitedMonth, "hilite");
437
		}
438
		var year = Calendar.findYear(target);
439
		if (year) {
440
			if (year.year != cal.date.getFullYear()) {
441
				if (cal.hilitedYear) {
442
					Calendar.removeClass(cal.hilitedYear, "hilite");
443
				}
444
				Calendar.addClass(year, "hilite");
445
				cal.hilitedYear = year;
446
			} else if (cal.hilitedYear) {
447
				Calendar.removeClass(cal.hilitedYear, "hilite");
448
			}
449
		} else if (cal.hilitedYear) {
450
			Calendar.removeClass(cal.hilitedYear, "hilite");
451
		}
452
	}
453
	return Calendar.stopEvent(ev);
454
};
455

  
456
Calendar.tableMouseDown = function (ev) {
457
	if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
458
		return Calendar.stopEvent(ev);
459
	}
460
};
461

  
462
Calendar.calDragIt = function (ev) {
463
	var cal = Calendar._C;
464
	if (!(cal && cal.dragging)) {
465
		return false;
466
	}
467
	var posX;
468
	var posY;
469
	if (Calendar.is_ie) {
470
		posY = window.event.clientY + document.body.scrollTop;
471
		posX = window.event.clientX + document.body.scrollLeft;
472
	} else {
473
		posX = ev.pageX;
474
		posY = ev.pageY;
475
	}
476
	cal.hideShowCovered();
477
	var st = cal.element.style;
478
	st.left = (posX - cal.xOffs) + "px";
479
	st.top = (posY - cal.yOffs) + "px";
480
	return Calendar.stopEvent(ev);
481
};
482

  
483
Calendar.calDragEnd = function (ev) {
484
	var cal = Calendar._C;
485
	if (!cal) {
486
		return false;
487
	}
488
	cal.dragging = false;
489
	with (Calendar) {
490
		removeEvent(document, "mousemove", calDragIt);
491
		removeEvent(document, "mouseup", calDragEnd);
492
		tableMouseUp(ev);
493
	}
494
	cal.hideShowCovered();
495
};
496

  
497
Calendar.dayMouseDown = function(ev) {
498
	var el = Calendar.getElement(ev);
499
	if (el.disabled) {
500
		return false;
501
	}
502
	var cal = el.calendar;
503
	cal.activeDiv = el;
504
	Calendar._C = cal;
505
	if (el.navtype != 300) with (Calendar) {
506
		if (el.navtype == 50) {
507
			el._current = el.firstChild.data;
508
			addEvent(document, "mousemove", tableMouseOver);
509
		} else
510
			addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
511
		addClass(el, "hilite active");
512
		addEvent(document, "mouseup", tableMouseUp);
513
	} else if (cal.isPopup) {
514
		cal._dragStart(ev);
515
	}
516
	if (el.navtype == -1 || el.navtype == 1) {
517
		if (cal.timeout) clearTimeout(cal.timeout);
518
		cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
519
	} else if (el.navtype == -2 || el.navtype == 2) {
520
		if (cal.timeout) clearTimeout(cal.timeout);
521
		cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
522
	} else {
523
		cal.timeout = null;
524
	}
525
	return Calendar.stopEvent(ev);
526
};
527

  
528
Calendar.dayMouseDblClick = function(ev) {
529
	Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
530
	if (Calendar.is_ie) {
531
		document.selection.empty();
532
	}
533
};
534

  
535
Calendar.dayMouseOver = function(ev) {
536
	var el = Calendar.getElement(ev);
537
	if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
538
		return false;
539
	}
540
	if (el.ttip) {
541
		if (el.ttip.substr(0, 1) == "_") {
542
			el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
543
		}
544
		el.calendar.tooltips.firstChild.data = el.ttip;
545
	}
546
	if (el.navtype != 300) {
547
		Calendar.addClass(el, "hilite");
548
		if (el.caldate) {
549
			Calendar.addClass(el.parentNode, "rowhilite");
550
		}
551
	}
552
	return Calendar.stopEvent(ev);
553
};
554

  
555
Calendar.dayMouseOut = function(ev) {
556
	with (Calendar) {
557
		var el = getElement(ev);
558
		if (isRelated(el, ev) || _C || el.disabled) {
559
			return false;
560
		}
561
		removeClass(el, "hilite");
562
		if (el.caldate) {
563
			removeClass(el.parentNode, "rowhilite");
564
		}
565
		el.calendar.tooltips.firstChild.data = _TT["SEL_DATE"];
566
		return stopEvent(ev);
567
	}
568
};
569

  
570
/**
571
 *  A generic "click" handler :) handles all types of buttons defined in this
572
 *  calendar.
573
 */
574
Calendar.cellClick = function(el, ev) {
575
	var cal = el.calendar;
576
	var closing = false;
577
	var newdate = false;
578
	var date = null;
579
	if (typeof el.navtype == "undefined") {
580
		Calendar.removeClass(cal.currentDateEl, "selected");
581
		Calendar.addClass(el, "selected");
582
		closing = (cal.currentDateEl == el);
583
		if (!closing) {
584
			cal.currentDateEl = el;
585
		}
586
		cal.date = new Date(el.caldate);
587
		date = cal.date;
588
		newdate = true;
589
		// a date was clicked
590
		if (!(cal.dateClicked = !el.otherMonth))
591
			cal._init(cal.firstDayOfWeek, date);
592
	} else {
593
		if (el.navtype == 200) {
594
			Calendar.removeClass(el, "hilite");
595
			cal.callCloseHandler();
596
			return;
597
		}
598
		date = (el.navtype == 0) ? new Date() : new Date(cal.date);
599
		// unless "today" was clicked, we assume no date was clicked so
600
		// the selected handler will know not to close the calenar when
601
		// in single-click mode.
602
		// cal.dateClicked = (el.navtype == 0);
603
		cal.dateClicked = false;
604
		var year = date.getFullYear();
605
		var mon = date.getMonth();
606
		function setMonth(m) {
607
			var day = date.getDate();
608
			var max = date.getMonthDays(m);
609
			if (day > max) {
610
				date.setDate(max);
611
			}
612
			date.setMonth(m);
613
		};
614
		switch (el.navtype) {
615
		    case 400:
616
			Calendar.removeClass(el, "hilite");
617
			var text = Calendar._TT["ABOUT"];
618
			if (typeof text != "undefined") {
619
				text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
620
			} else {
621
				// FIXME: this should be removed as soon as lang files get updated!
622
				text = "Help and about box text is not translated into this language.\n" +
623
					"If you know this language and you feel generous please update\n" +
624
					"the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
625
					"and send it back to <mishoo@infoiasi.ro> to get it into the distribution  ;-)\n\n" +
626
					"Thank you!\n" +
627
					"http://dynarch.com/mishoo/calendar.epl\n";
628
			}
629
			alert(text);
630
			return;
631
		    case -2:
632
			if (year > cal.minYear) {
633
				date.setFullYear(year - 1);
634
			}
635
			break;
636
		    case -1:
637
			if (mon > 0) {
638
				setMonth(mon - 1);
639
			} else if (year-- > cal.minYear) {
640
				date.setFullYear(year);
641
				setMonth(11);
642
			}
643
			break;
644
		    case 1:
645
			if (mon < 11) {
646
				setMonth(mon + 1);
647
			} else if (year < cal.maxYear) {
648
				date.setFullYear(year + 1);
649
				setMonth(0);
650
			}
651
			break;
652
		    case 2:
653
			if (year < cal.maxYear) {
654
				date.setFullYear(year + 1);
655
			}
656
			break;
657
		    case 100:
658
			cal.setFirstDayOfWeek(el.fdow);
659
			return;
660
		    case 50:
661
			var range = el._range;
662
			var current = el.firstChild.data;
663
			for (var i = range.length; --i >= 0;)
664
				if (range[i] == current)
665
					break;
666
			if (ev && ev.shiftKey) {
667
				if (--i < 0)
668
					i = range.length - 1;
669
			} else if ( ++i >= range.length )
670
				i = 0;
671
			var newval = range[i];
672
			el.firstChild.data = newval;
673
			cal.onUpdateTime();
674
			return;
675
		    case 0:
676
			// TODAY will bring us here
677
			if ((typeof cal.getDateStatus == "function") && cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
678
				// remember, "date" was previously set to new
679
				// Date() if TODAY was clicked; thus, it
680
				// contains today date.
681
				return false;
682
			}
683
			break;
684
		}
685
		if (!date.equalsTo(cal.date)) {
686
			cal.setDate(date);
687
			newdate = true;
688
		}
689
	}
690
	if (newdate) {
691
		cal.callHandler();
692
	}
693
	if (closing) {
694
		Calendar.removeClass(el, "hilite");
695
		cal.callCloseHandler();
696
	}
697
};
698

  
699
// END: CALENDAR STATIC FUNCTIONS
700

  
701
// BEGIN: CALENDAR OBJECT FUNCTIONS
702

  
703
/**
704
 *  This function creates the calendar inside the given parent.  If _par is
705
 *  null than it creates a popup calendar inside the BODY element.  If _par is
706
 *  an element, be it BODY, then it creates a non-popup calendar (still
707
 *  hidden).  Some properties need to be set before calling this function.
708
 */
709
Calendar.prototype.create = function (_par) {
710
	var parent = null;
711
	if (! _par) {
712
		// default parent is the document body, in which case we create
713
		// a popup calendar.
714
		parent = document.getElementsByTagName("body")[0];
715
		this.isPopup = true;
716
	} else {
717
		parent = _par;
718
		this.isPopup = false;
719
	}
720
	this.date = this.dateStr ? new Date(this.dateStr) : new Date();
721

  
722
	var table = Calendar.createElement("table");
723
	this.table = table;
724
	table.cellSpacing = 0;
725
	table.cellPadding = 0;
726
	table.calendar = this;
727
	Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
728

  
729
	var div = Calendar.createElement("div");
730
	this.element = div;
731
	div.className = "calendar";
732
	if (this.isPopup) {
733
		div.style.position = "absolute";
734
		div.style.display = "none";
735
	}
736
	div.appendChild(table);
737

  
738
	var thead = Calendar.createElement("thead", table);
739
	var cell = null;
740
	var row = null;
741

  
742
	var cal = this;
743
	var hh = function (text, cs, navtype) {
744
		cell = Calendar.createElement("td", row);
745
		cell.colSpan = cs;
746
		cell.className = "button";
747
		if (navtype != 0 && Math.abs(navtype) <= 2)
748
			cell.className += " nav";
749
		Calendar._add_evs(cell);
750
		cell.calendar = cal;
751
		cell.navtype = navtype;
752
		if (text.substr(0, 1) != "&") {
753
			cell.appendChild(document.createTextNode(text));
754
		}
755
		else {
756
			// FIXME: dirty hack for entities
757
			cell.innerHTML = text;
758
		}
759
		return cell;
760
	};
761

  
762
	row = Calendar.createElement("tr", thead);
763
	var title_length = 6;
764
	(this.isPopup) && --title_length;
765
	(this.weekNumbers) && ++title_length;
766

  
767
	hh("?", 1, 400).ttip = Calendar._TT["INFO"];
768
	this.title = hh("", title_length, 300);
769
	this.title.className = "title";
770
	if (this.isPopup) {
771
		this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
772
		this.title.style.cursor = "move";
773
		hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"];
774
	}
775

  
776
	row = Calendar.createElement("tr", thead);
777
	row.className = "headrow";
778

  
779
	this._nav_py = hh("&#x00ab;", 1, -2);
780
	this._nav_py.ttip = Calendar._TT["PREV_YEAR"];
781

  
782
	this._nav_pm = hh("&#x2039;", 1, -1);
783
	this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];
784

  
785
	this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
786
	this._nav_now.ttip = Calendar._TT["GO_TODAY"];
787

  
788
	this._nav_nm = hh("&#x203a;", 1, 1);
789
	this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];
790

  
791
	this._nav_ny = hh("&#x00bb;", 1, 2);
792
	this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];
793

  
794
	// day names
795
	row = Calendar.createElement("tr", thead);
796
	row.className = "daynames";
797
	if (this.weekNumbers) {
798
		cell = Calendar.createElement("td", row);
799
		cell.className = "name wn";
800
		cell.appendChild(document.createTextNode(Calendar._TT["WK"]));
801
	}
802
	for (var i = 7; i > 0; --i) {
803
		cell = Calendar.createElement("td", row);
804
		cell.appendChild(document.createTextNode(""));
805
		if (!i) {
806
			cell.navtype = 100;
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff