blob: ac1ac8837b801b3b839e789127a347e1945a3f4a [file] [log] [blame]
Rushabh Mehtab73fa492012-02-24 15:07:39 +05301// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
2//
3// MIT License (MIT)
4//
5// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"),
7// to deal in the Software without restriction, including without limitation
8// the rights to use, copy, modify, merge, publish, distribute, sublicense,
9// and/or sell copies of the Software, and to permit persons to whom the
10// Software is furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
17// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21//
22
23pscript.onload_calendar = function(wrapper) {
24 if(!erpnext.calendar) {
25 erpnext.calendar = new Calendar();
26 erpnext.calendar.init(wrapper);
27 rename_observers.push(erpnext.calendar);
28 }
29}
30
31///// CALENDAR
32
33Calendar=function() {
34 this.views=[];
35 this.events = {};
Rushabh Mehtab73fa492012-02-24 15:07:39 +053036 this.events_by_name = {};
37 this.weekdays = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
38}
39
40Calendar.prototype.init=function (parent) {
41
42 this.wrapper = parent;
43 this.body = $('.cal_body').get(0);
44
45 //this.make_head_buttons();
46 //this.make_header();
47 this.view_title = $('.cal_view_title').get(0);
48
49 this.todays_date = new Date();
50 this.selected_date = this.todays_date;
51 this.selected_hour = 8;
52
53 // Create views
54 this.views['Month'] = new Calendar.MonthView(this);
55 this.views['Week'] = new Calendar.WeekView(this);
56 this.views['Day'] = new Calendar.DayView(this);
57
58 // Month view as initial
Rushabh Mehtaaa999df2012-02-27 12:54:04 +053059 this.cur_view = this.views['Month'];
60 this.views['Month'].show();
Rushabh Mehtab73fa492012-02-24 15:07:39 +053061
62}
63
64Calendar.prototype.rename_notify = function(dt, old_name, new_name) {
65 // calendar
Rushabh Mehtaaa999df2012-02-27 12:54:04 +053066 if(dt = 'Event'){
67 if(this.events_by_name[old_name]) {
68 delete this.events_by_name[old_name];
69 }
70 }
Rushabh Mehtab73fa492012-02-24 15:07:39 +053071}
72
73//------------------------------------------------------
74
75Calendar.prototype.show_event = function(ev, cal_ev) {
76 var me = this;
77 if(!this.event_dialog) {
78 var d = new Dialog(400, 400, 'Calendar Event');
79 d.make_body([
80 ['HTML','Heading']
81 ,['Text','Description']
82 ,['Check', 'Public Event']
83 ,['Check', 'Cancel Event']
84 ,['HTML', 'Event Link']
85 ,['Button', 'Save']
86 ])
87
88 // show the event when the dialog opens
89 d.onshow = function() {
90 // heading
91 var c = me.selected_date;
92 var tmp = time_to_ampm(this.ev.event_hour);
93 tmp = tmp[0]+':'+tmp[1]+' '+tmp[2];
94
95 this.widgets['Heading'].innerHTML =
96 '<div style="text-align: center; padding:4px; font-size: 14px">'
97 + erpnext.calendar.weekdays[c.getDay()] + ', ' + c.getDate() + ' ' + month_list_full[c.getMonth()] + ' ' + c.getFullYear()
98 + ' - <b>'+tmp+'</b></div>';
99
100 // set
101 this.widgets['Description'].value = cstr(this.ev.description);
102
103 this.widgets['Public Event'].checked = false;
104 this.widgets['Cancel Event'].checked = false;
105
106 if(this.ev.event_type=='Public')
107 this.widgets['Public Event'].checked = true;
108
109 this.widgets['Event Link'].innerHTML = '';
110
111 // link
112 var div = $a(this.widgets['Event Link'], 'div', 'link_type', {margin:'4px 0px'});
113 div.onclick = function() { me.event_dialog.hide(); loaddoc('Event', me.event_dialog.ev.name); }
114 div.innerHTML = 'View Event details, add or edit participants';
115
116 }
117
118 // event save
119 d.widgets['Save'].onclick = function() {
120 var d = me.event_dialog;
121
122 // save values
123 d.ev.description = d.widgets['Description'].value;
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530124 if(d.widgets['Cancel Event'].checked)
125 d.ev.event_type='Cancel';
126 else if(d.widgets['Public Event'].checked)
127 d.ev.event_type='Public';
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530128
129 me.event_dialog.hide();
130
131 // if new event
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530132 me.save_event(d.ev);
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530133 }
134 this.event_dialog = d;
135 }
136 this.event_dialog.ev = ev;
137 this.event_dialog.cal_ev = cal_ev ? cal_ev : null;
138 this.event_dialog.show();
139
140}
141
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530142Calendar.prototype.save_event = function(doc) {
143 var me = this;
144 save_doclist('Event', doc.name, 'Save', function(r) {
145 var doc = locals['Event'][r.docname];
146 var cal = erpnext.calendar;
147 cal.cur_view.refresh();
148
149 // if cancelled, hide
150 if(doc.event_type=='Cancel') {
151 $(cal.events_by_name[doc.name].body).toggle(false);
152 }
153 });
154}
155
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530156//------------------------------------------------------
157
158Calendar.prototype.add_event = function() {
159
160 var ev = LocalDB.create('Event');
161 ev = locals['Event'][ev];
162
163 ev.event_date = dateutil.obj_to_str(this.selected_date);
164 ev.event_hour = this.selected_hour+':00';
165 ev.event_type = 'Private';
166
167 this.show_event(ev);
168}
169//------------------------------------------------------
170
171Calendar.prototype.get_month_events = function(call_back) {
172 // ret fn
173 var me = this;
174 var f = function(r, rt) {
175 if(me.cur_view) me.cur_view.refresh();
176 if(call_back)call_back();
177 }
178
179 //load
180 var y=this.selected_date.getFullYear(); var m = this.selected_date.getMonth();
181 if(!this.events[y] || !this.events[y][m]) {
182 $c('webnotes.widgets.event.load_month_events', args = {
183 'month': m + 1,
184 'year' : y},
185 f);
186 }
187}
188//------------------------------------------------------
189
190Calendar.prototype.get_daily_event_list=function(day) {
191 var el = [];
192 var d = day.getDate(); var m = day.getMonth(); var y = day.getFullYear()
193 if(this.events[y] && this.events[y][m] &&
194 this.events[y][m][d]) {
195 var l = this.events[y][m][d]
196 for(var i in l) {
197 for(var j in l[i]) el[el.length] = l[i][j];
198 }
199 return el;
200 }
201 else return [];
202}
203//------------------------------------------------------
204
205Calendar.prototype.set_event = function(ev) {
206 // don't duplicate
207 if(this.events_by_name[ev.name]) {
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530208 return this.events_by_name[ev.name];
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530209 }
210
211 var dt = dateutil.str_to_obj(ev.event_date);
212 var m = dt.getMonth();
213 var d = dt.getDate();
214 var y = dt.getFullYear();
215
216 if(!this.events[y]) this.events[y] = [];
217 if(!this.events[y][m]) this.events[y][m] = [];
218 if(!this.events[y][m][d]) this.events[y][m][d] = [];
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530219 if(!this.events[y][m][d][cint(ev.event_hour)])
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530220 this.events[y][m][d][cint(ev.event_hour)] = [];
221
222 var cal_ev = new Calendar.CalEvent(ev, this);
223 this.events[y][m][d][cint(ev.event_hour)].push(cal_ev);
224 this.events_by_name[ev.name] = cal_ev;
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530225
226 return cal_ev;
227}
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530228
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530229//------------------------------------------------------
230
231Calendar.prototype.refresh = function(viewtype){//Sets the viewtype of the Calendar and Calls the View class based on the viewtype
232 if(viewtype)
233 this.viewtype = viewtype;
234 // switch view if reqd
235 if(this.cur_view.viewtype!=this.viewtype) {
236 this.cur_view.hide();
237 this.cur_view = this.views[this.viewtype];
238 this.cur_view.in_home = false; // for home page
239 this.cur_view.show();
240 }
241 else{
242 this.cur_view.refresh(this);
243 }
244}
245
246//------------------------------------------------------
247
248Calendar.CalEvent= function(doc, cal) {
249 this.body = document.createElement('div');
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530250 this.link = $a(this.body, 'a', '', {}, locals['Event'][doc.name].description || '');
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530251 this.doc = doc;
252 var me = this;
253
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530254 this.link.onclick = function() {
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530255 if(me.doc.name) {
256 cal.show_event(me.doc, me);
257 }
258 }
259}
260
261Calendar.CalEvent.prototype.show = function(vu) {
262
263 var t = this.doc.event_type;
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530264 this.my_class = 'cal_event_'+ t;
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530265
266 if(this.body.parentNode)
267 this.body.parentNode.removeChild(this.body);
268 vu.body.appendChild(this.body);
269
270 // refresh
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530271 this.link.innerHTML = this.doc.description || '';
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530272 this.body.className = this.my_class;
273}
274
Rushabh Mehtaaa999df2012-02-27 12:54:04 +0530275
Rushabh Mehtab73fa492012-02-24 15:07:39 +0530276// ----------
277
278Calendar.View =function() { this.daystep = 0; this.monthstep = 0; }
279Calendar.View.prototype.init=function(cal) {
280 this.cal = cal;
281 this.body = $a(cal.body, 'div', 'cal_view_body');
282 this.body.style.display = 'none';
283 this.create_table();
284}
285
286
287Calendar.View.prototype.show=function() {
288 this.get_events(); this.refresh(); this.body.style.display = 'block';
289}
290
291Calendar.View.prototype.hide=function() { this.body.style.display = 'none';}
292
293Calendar.View.prototype.next = function() {
294 var s = this.cal.selected_date;
295 this.cal.selected_date = new Date(s.getFullYear(), s.getMonth() + this.monthstep, s.getDate() + this.daystep);
296 this.get_events(); this.refresh();
297}
298
299Calendar.View.prototype.prev = function() {
300 var s = this.cal.selected_date;
301 this.cal.selected_date = new Date(s.getFullYear(), s.getMonth() - this.monthstep, s.getDate() - this.daystep);
302 this.get_events(); this.refresh();
303}
304
305Calendar.View.prototype.get_events = function() {
306 this.cal.get_month_events();
307}
308Calendar.View.prototype.add_unit = function(vu) {
309 this.viewunits[this.viewunits.length] = vu;
310}
311Calendar.View.prototype.refresh_units = function() {
312 // load the events
313 if(locals['Event']) {
314 for(var name in locals['Event']) {
315 this.cal.set_event(locals['Event'][name]);
316 }
317 }
318
319
320 for(var r in this.table.rows) {
321 for(var c in this.table.rows[r].cells) {
322 if(this.table.rows[r].cells[c].viewunit) {
323 this.table.rows[r].cells[c].viewunit.refresh();
324 }
325 }
326 }
327}
328
329// ................. Month View..........................
330Calendar.MonthView = function(cal) { this.init(cal); this.monthstep = 1; this.rows = 5; this.cells = 7; }
331Calendar.MonthView.prototype=new Calendar.View();
332Calendar.MonthView.prototype.create_table = function() {
333
334 // create head
335 this.head_wrapper = $a(this.body, 'div', 'cal_month_head');
336
337 // create headers
338 this.headtable = $a(this.head_wrapper, 'table', 'cal_month_headtable');
339 var r = this.headtable.insertRow(0);
340 for(var j=0;j<7;j++) {
341 var cell = r.insertCell(j);
342 cell.innerHTML = erpnext.calendar.weekdays[j]; $w(cell, (100 / 7) + '%');
343 }
344
345 this.main = $a(this.body, 'div', 'cal_month_body');
346 this.table = $a(this.main, 'table', 'cal_month_table');
347 var me = this;
348
349 // create body
350 for(var i=0;i<5;i++) {
351 var r = this.table.insertRow(i);
352 for(var j=0;j<7;j++) {
353 var cell = r.insertCell(j);
354 cell.viewunit = new Calendar.MonthViewUnit(cell);
355 }
356 }
357}
358
359Calendar.MonthView.prototype.refresh = function() {
360 var c =this.cal.selected_date;
361 var me=this;
362 // fill other days
363
364 var cur_row = 0;
365
366 var cur_month = c.getMonth();
367 var cur_year = c.getFullYear();
368
369 var d = new Date(cur_year, cur_month, 1);
370 var day = 1 - d.getDay();
371
372
373 // set day headers
374 var d = new Date(cur_year, cur_month, day);
375
376 this.cal.view_title.innerHTML = month_list_full[cur_month] + ' ' + cur_year;
377
378 for(var i=0;i<6;i++) {
379 if((i<5) || cur_month==d.getMonth()) { // if this month
380 for(var j=0;j<7;j++) {
381 var cell = this.table.rows[cur_row].cells[j];
382
383 if((i<5) || cur_month==d.getMonth()) { // if this month
384 cell.viewunit.day = d;
385 cell.viewunit.hour = 8;
386 if(cur_month == d.getMonth()) {
387 cell.viewunit.is_disabled = false;
388
389 if(same_day(this.cal.todays_date, d))
390 cell.viewunit.is_today = true;
391 else
392 cell.viewunit.is_today = false;
393
394 } else {
395 cell.viewunit.is_disabled = true;
396 }
397 }
398 // new date
399 day++;
400 d = new Date(cur_year, cur_month, day);
401 }
402 }
403 cur_row++;
404 if(cur_row == 5) {cur_row = 0;} // back to top
405 }
406 this.refresh_units();
407
408}
409 // ................. Daily View..........................
410Calendar.DayView=function(cal){ this.init(cal); this.daystep = 1; }
411Calendar.DayView.prototype=new Calendar.View();
412Calendar.DayView.prototype.create_table = function() {
413
414 // create body
415 this.main = $a(this.body, 'div', 'cal_day_body');
416 this.table = $a(this.main, 'table', 'cal_day_table');
417 var me = this;
418
419 for(var i=0;i<24;i++) {
420 var r = this.table.insertRow(i);
421 for(var j=0;j<2;j++) {
422 var cell = r.insertCell(j);
423 if(j==0) {
424 var tmp = time_to_ampm((i)+':00');
425 cell.innerHTML = tmp[0]+':'+tmp[1]+' '+tmp[2];
426 $w(cell, '10%');
427 } else {
428 cell.viewunit = new Calendar.DayViewUnit(cell);
429 cell.viewunit.hour = i;
430 $w(cell, '90%');
431 if((i>=7)&&(i<=20)) {
432 cell.viewunit.is_daytime = true;
433 }
434 }
435 }
436 }
437 }
438
439Calendar.DayView.prototype.refresh = function() {
440 var c =this.cal.selected_date;
441
442 // fill other days
443 var me=this;
444
445 this.cal.view_title.innerHTML = erpnext.calendar.weekdays[c.getDay()] + ', '
446 + c.getDate() + ' ' + month_list_full[c.getMonth()] + ' ' + c.getFullYear();
447
448 // headers
449 var d = c;
450
451 for(var i=0;i<24;i++) {
452 var cell = this.table.rows[i].cells[1];
453 if(same_day(this.cal.todays_date, d)) cell.viewunit.is_today = true;
454 else cell.viewunit.is_today = false;
455 cell.viewunit.day = d;
456 }
457 this.refresh_units();
458}
459
460// ................. Weekly View..........................
461Calendar.WeekView=function(cal) { this.init(cal); this.daystep = 7; }
462Calendar.WeekView.prototype=new Calendar.View();
463Calendar.WeekView.prototype.create_table = function() {
464
465 // create head
466 this.head_wrapper = $a(this.body, 'div', 'cal_month_head');
467
468 // day headers
469 this.headtable = $a(this.head_wrapper, 'table', 'cal_month_headtable');
470 var r = this.headtable.insertRow(0);
471 for(var j=0;j<8;j++) {
472 var cell = r.insertCell(j);
473 $w(cell, (100 / 8) + '%');
474 }
475
476 // hour header
477
478 // create body
479 this.main = $a(this.body, 'div', 'cal_week_body');
480 this.table = $a(this.main, 'table', 'cal_week_table');
481 var me = this;
482
483 for(var i=0;i<24;i++) {
484 var r = this.table.insertRow(i);
485 for(var j=0;j<8;j++) {
486 var cell = r.insertCell(j);
487 if(j==0) {
488 var tmp = time_to_ampm(i+':00');
489 cell.innerHTML = tmp[0]+':'+tmp[1]+' '+tmp[2];
490
491 $w(cell, '10%');
492 } else {
493 cell.viewunit = new Calendar.WeekViewUnit(cell);
494 cell.viewunit.hour = i;
495 if((i>=7)&&(i<=20)) {
496 cell.viewunit.is_daytime = true;
497 }
498 }
499 }
500 }
501}
502
503Calendar.WeekView.prototype.refresh = function() {
504 var c =this.cal.selected_date;
505 // fill other days
506 var me=this;
507
508 this.cal.view_title.innerHTML = month_list_full[c.getMonth()] + ' ' + c.getFullYear();
509
510 // headers
511 var d = new Date(c.getFullYear(), c.getMonth(), c.getDate() - c.getDay());
512
513 for (var k=1;k<8;k++) {
514 this.headtable.rows[0].cells[k].innerHTML = erpnext.calendar.weekdays[d.getDay()] + ' ' + d.getDate();
515
516 for(var i=0;i<24;i++) {
517 var cell = this.table.rows[i].cells[k];
518 if(same_day(this.cal.todays_date, d))
519 cell.viewunit.is_today = true;
520 else cell.viewunit.is_today = false;
521
522 cell.viewunit.day = d;
523 //cell.viewunit.refresh();
524 }
525 d=new Date(d.getFullYear(),d.getMonth(),d.getDate() + 1);
526
527 }
528
529 this.refresh_units();
530}
531
532//------------------------------------------------------.
533
534Calendar.ViewUnit = function() {}
535Calendar.ViewUnit.prototype.init = function(parent) {
536 parent.style.border = "1px solid #CCC" ;
537 this.body = $a(parent, 'div', this.default_class);
538 this.parent = parent;
539
540 var me = this;
541 this.body.onclick = function() {
542 erpnext.calendar.selected_date = me.day;
543 erpnext.calendar.selected_hour = me.hour;
544
545 if(erpnext.calendar.cur_vu && erpnext.calendar.cur_vu!=me){
546 erpnext.calendar.cur_vu.deselect();
547 me.select();
548 erpnext.calendar.cur_vu = me;
549 }
550 }
551 this.body.ondblclick = function() {
552 erpnext.calendar.add_event();
553 }
554}
555
556Calendar.ViewUnit.prototype.set_header=function(v) {
557 this.header.innerHTML = v;
558}
559
560Calendar.ViewUnit.prototype.set_today = function() {
561 this.is_today = true;
562 this.set_display();
563}
564
565Calendar.ViewUnit.prototype.clear = function() {
566 if(this.header)this.header.innerHTML = '';
567
568 // clear body
569 while(this.body.childNodes.length)
570 this.body.removeChild(this.body.childNodes[0]);
571}
572
573Calendar.ViewUnit.prototype.set_display = function() {
574 var cn = '#FFF';
575
576 // colors
577 var col_tod_sel = '#EEE';
578 var col_tod = '#FFF';
579 var col_sel = '#EEF';
580
581 if(this.is_today) {
582 if(this.selected) cn = col_tod_sel;
583 else cn = col_tod;
584 } else
585 if(this.selected) cn = col_sel;
586
587 if(this.header) {
588 if(this.is_disabled) {
589 this.body.className = this.default_class + ' cal_vu_disabled';
590 this.header.style.color = '#BBB';
591 } else {
592 this.body.className = this.default_class;
593 this.header.style.color = '#000';
594 }
595
596 if(this.day&&this.day.getDay()==0)
597 this.header.style.backgroundColor = '#FEE';
598 else
599 this.header.style.backgroundColor = '';
600 }
601 this.parent.style.backgroundColor = cn;
602}
603
604Calendar.ViewUnit.prototype.is_selected = function() {
605 return (same_day(this.day, erpnext.calendar.selected_date)
606 && this.hour==erpnext.calendar.selected_hour)
607}
608
609Calendar.ViewUnit.prototype.get_event_list = function() {
610 var y = this.day.getFullYear();
611 var m = this.day.getMonth();
612 var d = this.day.getDate();
613 if(erpnext.calendar.events[y] && erpnext.calendar.events[y][m] &&
614 erpnext.calendar.events[y][m][d] &&
615 erpnext.calendar.events[y][m][d][this.hour]) {
616 return erpnext.calendar.events[y][m][d][this.hour];
617 } else
618 return [];
619}
620
621Calendar.ViewUnit.prototype.refresh = function() {
622 this.clear();
623
624 if(this.is_selected()) {
625 if(erpnext.calendar.cur_vu)erpnext.calendar.cur_vu.deselect();
626 this.selected = true;
627 erpnext.calendar.cur_vu = this;
628 }
629 this.set_display();
630 this.el = this.get_event_list();
631 if(this.onrefresh)this.onrefresh();
632
633 for(var i in this.el) {
634 this.el[i].show(this);
635 }
636
637 var me = this;
638}
639
640Calendar.ViewUnit.prototype.select=function() { this.selected = true; this.set_display(); }
641Calendar.ViewUnit.prototype.deselect=function() { this.selected = false; this.set_display(); }
642Calendar.ViewUnit.prototype.setevent=function() { }
643
644Calendar.MonthViewUnit=function(parent) {
645 this.header = $a(parent, 'div' , "cal_month_date");
646 this.default_class = "cal_month_unit";
647
648 this.init(parent);
649
650 this.onrefresh = function() {
651 this.header.innerHTML = this.day.getDate();
652 }
653}
654Calendar.MonthViewUnit.prototype = new Calendar.ViewUnit();
655Calendar.MonthViewUnit.prototype.is_selected = function() {
656 return same_day(this.day, erpnext.calendar.selected_date)
657}
658
659Calendar.MonthViewUnit.prototype.get_event_list = function() {
660 return erpnext.calendar.get_daily_event_list(this.day);
661}
662
663Calendar.DayViewUnit= function(parent) {
664 this.default_class = "cal_day_unit"; this.init(parent);
665}
666Calendar.DayViewUnit.prototype = new Calendar.ViewUnit();
667Calendar.DayViewUnit.prototype.onrefresh = function() {
668 if(this.el.length<3)
669 this.body.style.height = '30px';
670 else this.body.style.height = '';
671}
672
673Calendar.WeekViewUnit=function(parent) {
674 this.default_class = "cal_week_unit"; this.init(parent);
675}
676Calendar.WeekViewUnit.prototype = new Calendar.ViewUnit();
677Calendar.WeekViewUnit.prototype.onrefresh = function() {
678 if(this.el.length<3) this.body.style.height = '30px';
679 else this.body.style.height = '';
680}