Author: abelevich
Date: 2008-08-05 06:21:12 -0400 (Tue, 05 Aug 2008)
New Revision: 9909
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
preparation for the
https://jira.jboss.org/jira/browse/RF-4001 added
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
---
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-08-05
09:03:55 UTC (rev 9908)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-08-05
10:21:12 UTC (rev 9909)
@@ -677,7 +677,14 @@
var bottomStyleClass;
var htmlTextWeekDayBar='';
var context;
- var eventsStr = 'onclick="'+tempStr+'eventCellOnClick(event,
this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);"
onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
+
+// TODO (version 3.3.0): remove onmouse over/up/out/down css classes and onclick
listeners if component disabled
+// var eventsStr = "";
+// if (!this.params.disabled) {
+// eventsStr = 'onclick="'+tempStr+'eventCellOnClick(event,
this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);"
onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
+// }
+
+ var eventsStr = 'onclick="'+tempStr+'eventCellOnClick(event,
this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);"
onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
if (this.params.showWeekDaysBar)
{
var htmlTextWeekDayBar = '<tr
id="'+this.params.weekDayBarId+'">';
@@ -1776,7 +1783,7 @@
changeCurrentDateOffset: function(yearOffset, monthOffset) {
var date = new Date(this.currentDate.getFullYear()+yearOffset,
this.currentDate.getMonth()+monthOffset,1);
-
+
if (this.invokeEvent("currentdateselect", $(this.id), null, date))
{
// fix for RF-2450.
@@ -1791,52 +1798,52 @@
today: function(noUpdate, noHighlight) {
- var now = new Date();
-
- var nowyear = now.getFullYear();
- var nowmonth = now.getMonth();
- var nowdate = now.getDate();
- var updateflag = false;
-
- if (nowdate!=this.todayDate.getDate()) {updateflag=true; this.todayDate = now;}
-
- if (nowyear != this.currentDate.getFullYear() || nowmonth !=
this.currentDate.getMonth() )
- {
- updateflag = true;
- this.currentDate = new Date(nowyear, nowmonth, 1);
- }
-
- if (this.todayControlMode=='select')
- {
- noHighlight=true;
- }
-
- if (updateflag)
- {
- if (noUpdate) this.render(); else this.onUpdate();
- }
- else
- {
- // highlight today
+ var now = new Date();
+
+ var nowyear = now.getFullYear();
+ var nowmonth = now.getMonth();
+ var nowdate = now.getDate();
+ var updateflag = false;
- if (this.isVisible && this.todayCellId && !noHighlight)
+ if (nowdate!=this.todayDate.getDate()) {updateflag=true; this.todayDate = now;}
+
+ if (nowyear != this.currentDate.getFullYear() || nowmonth !=
this.currentDate.getMonth() )
{
- this.clearEffect(this.todayCellId, this.highlightEffect);
- if (this.todayCellColor!="transparent")
+ updateflag = true;
+ this.currentDate = new Date(nowyear, nowmonth, 1);
+ }
+
+ if (this.todayControlMode=='select')
+ {
+ noHighlight=true;
+ }
+
+ if (updateflag)
+ {
+ if (noUpdate) this.render(); else this.onUpdate();
+ }
+ else
+ {
+ // highlight today
+
+ if (this.isVisible && this.todayCellId && !noHighlight)
{
- this.highlightEffect = new Effect.Highlight($(this.todayCellId), {startcolor:
this.todayCellColor, duration:0.3, transition: Effect.Transitions.sinoidal,
- afterFinish: this.onHighlightFinish});
+ this.clearEffect(this.todayCellId, this.highlightEffect);
+ if (this.todayCellColor!="transparent")
+ {
+ this.highlightEffect = new Effect.Highlight($(this.todayCellId), {startcolor:
this.todayCellColor, duration:0.3, transition: Effect.Transitions.sinoidal,
+ afterFinish: this.onHighlightFinish});
+ }
}
}
- }
-
- // todayControl select mode
- if (this.todayControlMode=='select')
- if (updateflag && !noUpdate && this.submitFunction)
- {
- this.afterLoad = this.selectToday;
- }
- else this.selectToday();
+
+ // todayControl select mode
+ if (this.todayControlMode=='select')
+ if (updateflag && !noUpdate && this.submitFunction)
+ {
+ this.afterLoad = this.selectToday;
+ }
+ else this.selectToday();
},
@@ -1993,7 +2000,7 @@
},
showSelectedDate: function()
- {
+ {
if (!this.selectedDate) return;
if (this.currentDate.getMonth()!=this.selectedDate.getMonth() ||
this.currentDate.getFullYear()!=this.selectedDate.getFullYear())
{
@@ -2105,18 +2112,18 @@
else editor = $(this.EDITOR_ID);
if (!this.isDateEditorLayoutCreated) this.createDateEditorLayout(editor);
else this.updateDateEditor();
-
+
$(this.DATE_EDITOR_LAYOUT_ID).show();
-
+
var editor_shadow = $(this.EDITOR_SHADOW_ID);
-
+
this.setEditorPosition($(this.id), editor, editor_shadow);
-
+
editor_shadow.show();
editor.show();
-
+
Element.clonePosition(this.EDITOR_LAYOUT_SHADOW_ID, this.DATE_EDITOR_LAYOUT_ID,
{offsetLeft: 3, offsetTop: 3});
-
+
this.isEditorVisible = true;
},
@@ -2146,8 +2153,13 @@
if (!calendar.selectedDate || calendar.showApplyButton) return "";
var text = Richfaces.Calendar.formatDate(calendar.selectedDate,(calendar.timeType ?
calendar.datePattern : calendar.params.datePattern), calendar.params.monthLabels,
calendar.params.monthLabelsShort);
-
- var markup = new E('div', {'class': 'rich-calendar-tool-btn',
'onclick':
"Richfaces.getComponent('calendar',this).showSelectedDate(); return
true;"}, [new ET(text)]);
+// TODO: version: 3.3.0
+// var onclick ="";
+// if(!calendar.params.disabled) {
+// onclick = "Richfaces.getComponent('calendar',this).showSelectedDate();
return true;"
+// }
+ var onclick = "Richfaces.getComponent('calendar',this).showSelectedDate();
return true;"
+ var markup = new E('div', {'class': 'rich-calendar-tool-btn',
'onclick': onclick}, [new ET(text)]);
return markup;
};
@@ -2158,9 +2170,18 @@
var text = Richfaces.Calendar.formatDate(calendar.selectedDate, calendar.timePattern,
calendar.params.monthLabels, calendar.params.monthLabelsShort);
- var markup = new E('div', {'class': 'rich-calendar-tool-btn
rich-calendar-tool-btn-hover rich-calendar-tool-btn-press', 'onclick':
"Richfaces.getComponent('calendar',this).showTimeEditor();return
true;",
- 'onmouseover': "Element.removeClassName(this,
'rich-calendar-tool-btn-press');",
- 'onmouseout' : "Element.addClassName(this,
'rich-calendar-tool-btn-press');"}, [new ET(text)]);
+ var onmouseover = "Element.removeClassName(this,
'rich-calendar-tool-btn-press');";
+ var onmouseout = "Element.addClassName(this,
'rich-calendar-tool-btn-press');";
+ var onclick =
"Richfaces.getComponent('calendar',this).showTimeEditor();return
true;";
+// TODO: version: 3.3.0
+// if(!calendar.params.disabled) {
+// onmouseover = "Element.removeClassName(this,
'rich-calendar-tool-btn-press');";
+// onmouseout = "Element.addClassName(this,
'rich-calendar-tool-btn-press');";
+// onclick =
"Richfaces.getComponent('calendar',this).showTimeEditor();return
true;";
+// }
+ var markup = new E('div', {'class': 'rich-calendar-tool-btn
rich-calendar-tool-btn-hover rich-calendar-tool-btn-press', 'onclick':
onclick,
+ 'onmouseover': + onmouseover ,
+ 'onmouseout' : + onmouseout}, [new ET(text)]);
return markup;
};
@@ -2170,15 +2191,50 @@
CalendarView.previousYearControl = CalendarView.getControl("<<",
CalendarView.toolButtonAttributes, "prevYear");
CalendarView.nextMonthControl = CalendarView.getControl(">",
CalendarView.toolButtonAttributes, "nextMonth");
CalendarView.previousMonthControl = CalendarView.getControl("<",
CalendarView.toolButtonAttributes, "prevMonth");
-CalendarView.currentMonthControl = function (context) { return
CalendarView.getControl(Richfaces.Calendar.formatDate(context.calendar.getCurrentDate(),
"MMMM, yyyy", context.monthLabels, context.monthLabelsShort),
CalendarView.toolButtonAttributes, "showDateEditor");};
-CalendarView.todayControl = function (context) { return
(context.calendar.todayControlMode!='hidden' ?
CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes,
"today") : "");};
-CalendarView.selectedDateControl = function (context) { return
CalendarView.getSelectedDateControl(context.calendar);};
-CalendarView.timeControl = function (context) { return
CalendarView.getTimeControl(context.calendar);};
-CalendarView.closeControl = function (context) { return (context.calendar.params.popup ?
CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes,
"close", "false") : "");};
-CalendarView.applyControl = function (context) { return (context.calendar.showApplyButton
? CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes,
"close", "true") : "");};
-CalendarView.cleanControl = function (context) { return (context.calendar.selectedDate ?
CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes,
"resetSelectedDate") : "");};
-CalendarView.timeEditorFields = function (context) { return
context.calendar.timePatternHtml;};
+//TODO: version: 3.3.0
+//CalendarView.clearAttributesIfDisabled = function (calendar, attributes){
+// var disabled = calendar.params.disabled;
+// if (disabled && attributes) {
+// attributes.onmouseup = "";
+// attributes.onmousedown = "";
+// attributes.onmouseover = "";
+// attributes.onmouseout = "";
+// attributes.onclick = "";
+// }
+// return attributes;
+//}
+CalendarView.currentMonthControl = function (context) {
+// TODO: version: 3.3.0
+// var attributes =
CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
+ return
CalendarView.getControl(Richfaces.Calendar.formatDate(context.calendar.getCurrentDate(),
"MMMM, yyyy", context.monthLabels, context.monthLabelsShort),
CalendarView.toolButtonAttributes, "showDateEditor");
+};
+CalendarView.todayControl = function (context) {
+// TODO: version: 3.3.0
+// var attributes =
CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
+ return (context.calendar.todayControlMode!='hidden' ?
CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes,
"today") : "");
+};
+
+CalendarView.closeControl = function (context) {
+// TODO: version: 3.3.0
+// var attributes =
CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
+ return (context.calendar.params.popup ?
CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes,
"close", "false") : "");
+};
+CalendarView.applyControl = function (context) {
+// TODO: version: 3.3.0
+// var attributes =
CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
+ return (context.calendar.showApplyButton ?
CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes,
"close", "true") : "");
+};
+CalendarView.cleanControl = function (context) {
+// TODO: version: 3.3.0
+// var attributes =
CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
+ return (context.calendar.selectedDate ?
CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes,
"resetSelectedDate") : "");
+};
+
+CalendarView.selectedDateControl = function (context) { return
CalendarView.getSelectedDateControl(context.calendar);};
+CalendarView.timeControl = function (context) { return
CalendarView.getTimeControl(context.calendar);};
+CalendarView.timeEditorFields = function (context) {return
context.calendar.timePatternHtml;};
+
CalendarView.header = [
new E('table',{'border': '0', 'cellpadding':
'0', 'cellspacing': '0', 'width': '100%'},
[
@@ -2302,8 +2358,28 @@
this.weekDayLabels=calendar.params.weekDayLabels;
this.weekDayLabelsShort=calendar.params.weekDayLabelsShort;
this.controlLabels=calendar.params.labels;
- },
-
+
+// TODO: remove onmouse over/up/out/down css classes and onclick listeners if component
disabled (version 3.3.0)
+// if (this.nextYearControl) {
+// var attrs = this.nextYearControl.attrs;
+// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
+// }
+//
+// if (this.previousYearControl) {
+// var attrs = this.previousYearControl.attrs;
+// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
+// }
+//
+// if (this.previousMonthControl) {
+// var attrs = this.previousMonthControl.attrs;
+// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
+// }
+//
+// if (this.nextMonthControl) {
+// var attrs = this.nextMonthControl.attrs;
+// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
+// }
+ },
nextYearControl: CalendarView.nextYearControl,
previousYearControl: CalendarView.previousYearControl,
nextMonthControl: CalendarView.nextMonthControl,