[richfaces-svn-commits] JBoss Rich Faces SVN: r2225 - trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Aug 13 12:01:51 EDT 2007


Author: pyaschenko
Date: 2007-08-13 12:01:51 -0400 (Mon, 13 Aug 2007)
New Revision: 2225

Modified:
   trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
- Help control deleted;
- Reset control redesigned and merged with the selectedDate control.


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-13 14:27:12 UTC (rev 2224)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js	2007-08-13 16:01:51 UTC (rev 2225)
@@ -1001,10 +1001,6 @@
 		if (updateflag) if (noUpdate) this.render; else this.onUpdate();
 	},
 	
-	help: function() {
-		alert("Calendar help");
-	},
-	
 	selectDate: function(date, noUpdate) {
 		if (date)
 		{
@@ -1046,8 +1042,8 @@
 	{
 		if (!this.selectedDate) return;
 		this.selectedDate=null;
+		if (this.params.popup && this.isVisible) this.render();
 		$(this.INPUT_DATE_ID).value="";
-		if (this.params.popup && this.isVisible) this.render();
 	}
 	
 });
@@ -1070,15 +1066,30 @@
 	return new E('div',attr,[new T(text)]);
 };
 
+CalendarView.getSelectedDateControl = function(text, functionName) {
+	var attr = {
+		onclick: "Richfaces.invokeOnComponent('richfaces:calendar',this,'selectDate'); return false;",
+		className: "calendar_btn"
+	};
+	
+	var a = [new T(text)];
+	if (text)
+	{
+		a.push(new T(" "));
+		a.push(new E('a', {href: '#', onclick: "Richfaces.invokeOnComponent('richfaces:calendar',this,'resetSelectedDate');return false;"}, [new T('(x)')]));
+	}
+	
+	return new E('div',attr,a);
+};
+
 CalendarView.nextYearControl = CalendarView.getControl(">>", "nextYear");
 CalendarView.previousYearControl = CalendarView.getControl("<<", "prevYear");
 CalendarView.nextMonthControl = CalendarView.getControl(">", "nextMonth");
 CalendarView.previousMonthControl = CalendarView.getControl("<", "prevMonth");
 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.selectedDateControl = function (context) { return CalendarView.getSelectedDateControl(context.calendar.getSelectedDateString(context.calendar.params.datePattern));};
+//CalendarView.resetSelectedDateControl = function (context) { return (context.calendar.getSelectedDate() ? CalendarView.getControl("x", "resetSelectedDate") : "");};
 
 CalendarView.header = [
 	new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
@@ -1119,18 +1130,14 @@
 			[
 				new E('tr',{},
 				[
-					new E('td',{'class': 'calendar_toolfooter'},
+					/*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)})
 					]),
-					new E('td',{'class': 'calendar_toolfooter', 'width': '100%'},
-					[
-						new ET(function (context) { return Richfaces.evalMacro("helpControl", context)})
-					]),
 					new E('td',{'class': 'calendar_toolfooter', 'align': 'right'},
 					[
 						new ET(function (context) { return Richfaces.evalMacro("todayControl", context)})
@@ -1159,6 +1166,5 @@
 	currentMonthControl: CalendarView.currentMonthControl,
 	todayControl: CalendarView.todayControl,
 	selectedDateControl: CalendarView.selectedDateControl,
-	resetSelectedDateControl: CalendarView.resetSelectedDateControl,
-	helpControl: CalendarView.helpControl
+	//resetSelectedDateControl: CalendarView.resetSelectedDateControl,
 });
\ No newline at end of file




More information about the richfaces-svn-commits mailing list