Author: pyaschenko
Date: 2007-08-03 09:18:41 -0400 (Fri, 03 Aug 2007)
New Revision: 2047
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
resetSelectedDate function and control added
other fixes
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 2007-08-03
13:18:12 UTC (rev 2046)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-08-03
13:18:41 UTC (rev 2047)
@@ -360,8 +360,8 @@
// direction - [top-left, top-right, bottom-left, bottom-right, auto]
// jointPoint - [top-left, top-right, bottom-left, bottom-right]
// popup - true
- // userClasses - inputClass, inputDisabledClass, inputInvalidClass, buttonClass,
buttonDisabledClass
- // id+PopupButton, id+PopupInput,
+ // id+PopupButton, id+InputDate,
+ // inputType - [readonly-default, hidden, editable] - this parameter used only on
server side
this.id = id;
@@ -1007,6 +1007,7 @@
d.setDate(1);
if (d.getMonth()==this.currentDate.getMonth() &&
d.getFullYear()==this.currentDate.getFullYear())
{
+ if (d.getDate()==this.currentDate.getDate()) return;
// find cell and call onklick event
var e = $(this.DATE_ELEMENT_ID+(this.firstDateIndex +
this.selectedDate.getDate()-1));
if (e) Richfaces.createEvent ('click', e).fire();
@@ -1024,6 +1025,13 @@
this.selectedDate=null;
this.today(noUpdate);
}
+ },
+
+ resetSelectedDate: function()
+ {
+ if (!this.selectedDate) return;
+ this.selectedDate=null;
+ this.render();
}
});
@@ -1053,6 +1061,7 @@
CalendarView.currentMonthControl = function (context) { return
context.calendar.getCurrentDate().format("MMMM, y", context.monthLabels,
context.monthLabelsShort);};
CalendarView.todayControl = CalendarView.getControl("Today",
"today");
CalendarView.selectedDateControl = function (context) { return
CalendarView.getControl(context.calendar.getSelectedDateString(context.calendar.params.datePattern),
"selectDate");};
+CalendarView.resetSelectedDateControl = function (context) { return
(context.calendar.getSelectedDate() ? CalendarView.getControl("x",
"resetSelectedDate") : "");};
CalendarView.helpControl = CalendarView.getControl("Help", "help");
CalendarView.header = [
@@ -1094,6 +1103,10 @@
[
new E('tr',{},
[
+ new E('td',{'class': 'calendar_toolfooter'},
+ [
+ new ET(function (context) { return
Richfaces.evalMacro("resetSelectedDateControl", context)})
+ ]),
new E('td',{'class': 'calendar_toolfooter', 'style':
'white-space:nowrap'},
[
new ET(function (context) { return
Richfaces.evalMacro("selectedDateControl", context)})
@@ -1130,5 +1143,6 @@
currentMonthControl: CalendarView.currentMonthControl,
todayControl: CalendarView.todayControl,
selectedDateControl: CalendarView.selectedDateControl,
+ resetSelectedDateControl: CalendarView.resetSelectedDateControl,
helpControl: CalendarView.helpControl
});
\ No newline at end of file