Author: pyaschenko
Date: 2007-09-27 12:14:56 -0400 (Thu, 27 Sep 2007)
New Revision: 3148
Modified:
branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
RF-978
Modified: branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml 2007-09-27 16:03:19
UTC (rev 3147)
+++ branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml 2007-09-27 16:14:56
UTC (rev 3148)
@@ -324,6 +324,13 @@
</description>
</property>
<property>
+ <name>ondateselected</name>
+ <classname>java.lang.String</classname>
+ <description>
+ onDateSelected event handler
+ </description>
+ </property>
+ <property>
<name>oncurrentdateselect</name>
<classname>java.lang.String</classname>
<description>
Modified:
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
---
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-09-27
16:03:19 UTC (rev 3147)
+++
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-09-27
16:14:56 UTC (rev 3148)
@@ -438,7 +438,7 @@
// popup offset
this.popupOffset = {dx: (isNaN(this.params.horizontalOffset) ? 0 :
parseInt(this.params.horizontalOffset,10)), dy: (isNaN(this.params.verticalOffset) ? 0 :
parseInt(this.params.verticalOffset,10))};
- this.currentDate = this.params.currentDate ? this.params.currentDate : new Date();
+ this.currentDate = this.params.currentDate ? this.params.currentDate :
(this.params.selectedDate ? this.params.selectedDate : new Date());
this.currentDate.setDate(1);
this.selectedDate = this.params.selectedDate;
@@ -1238,17 +1238,20 @@
// fire user event
var flag = true;
+ var isDateChanged = false;
if ( (oldSelectedDate - newSelectedDate) && (oldSelectedDate!=null ||
newSelectedDate!=null) )
{
+ isDateChanged = true
flag = this.invokeEvent("dateselect", eventData.element, eventData.event,
date)
}
if (flag)
- {
+ {
+ var field = $(this.INPUT_DATE_ID);
this.selectedDate = newSelectedDate;
if (this.selectedDate!=null)
{
- $(this.INPUT_DATE_ID).value=this.getSelectedDateString(this.params.datePattern);
+ field.value=this.getSelectedDateString(this.params.datePattern);
var d = new Date(this.selectedDate);
if (d.getMonth()==this.currentDate.getMonth() &&
d.getFullYear()==this.currentDate.getFullYear())
@@ -1274,7 +1277,7 @@
else
{
this.selectedDate = null;
- $(this.INPUT_DATE_ID).value = "";
+ field.value = "";
if (this.selectedDateElement)
{
Element.removeClassName(this.selectedDateElement,
"rich-calendar-select");
@@ -1291,6 +1294,12 @@
}
this.today(noUpdate, true);
}
+
+ // call user event
+ if (isDateChanged)
+ {
+ this.invokeEvent("dateselected", eventData.element, eventData.event,
this.selectedDate);
+ }
}
return flag;
@@ -1311,6 +1320,7 @@
this.renderHeader();
this.renderFooter();
this.doCollapse();
+ this.invokeEvent("dateselected", null, null, null);
}
},
Modified: branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
---
branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-09-27
16:03:19 UTC (rev 3147)
+++
branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-09-27
16:14:56 UTC (rev 3148)
@@ -53,6 +53,7 @@
firstWeekDay: #{this:getFirstWeekDay(context, component)},
minDaysInFirstWeek: #{this:getMinDaysInFirstWeek(context, component)}
+ <f:call name="writeEventHandlerFunction"><f:parameter
value="ondateselected" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter
value="ondateselect" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter
value="ondatemouseover" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter
value="ondatemouseout" /></f:call>
Show replies by date