[richfaces-svn-commits] JBoss Rich Faces SVN: r2094 - in trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html: scripts and 1 other directory.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Tue Aug 7 08:18:59 EDT 2007
Author: pyaschenko
Date: 2007-08-07 08:18:59 -0400 (Tue, 07 Aug 2007)
New Revision: 2094
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
boundaryDatesMode parameter added
styles fixes
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-08-07 11:21:30 UTC (rev 2093)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-08-07 12:18:59 UTC (rev 2094)
@@ -173,6 +173,10 @@
background-color : #e4f5e2; /*unknown parameter - need to add
}
*/
+ <u:selector name=".calendar_boundary_dates table tr td">
+ <u:style name="color" value="#a0a0a0"/> /*unknown parameter - need to add*/
+ </u:selector>
+
<u:selector name=".calendar_current">
<u:style name="background-color" value="#ff7800"/> /*unknown parameter - need to add*/
<u:style name="color" value="#ffebda"/> /*unknown parameter - need to add*/
@@ -185,6 +189,10 @@
<u:style name="font-weight" skin="headerWeightFont"/>
</u:selector>
+ <u:selector name=".calendar_hover">
+ <u:style name="background-color" value="#f3f3f3"/> /*unknown parameter - need to add*/
+ </u:selector>
+
<u:selector name=".calendar_toolfooter">
<u:style name="border-top-color" skin="panelBorderColor"/>
<u:style name="border-right-color" skin="panelBorderColor"/>
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-07 11:21:30 UTC (rev 2093)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-08-07 12:18:59 UTC (rev 2094)
@@ -363,7 +363,12 @@
// id+PopupButton, id+InputDate,
// inputType - [readonly-default, hidden, editable] - this parameter used only on server side
+ // boundaryDatesMode - boundary dates onclick action:
+ // "inactive" or undefined - no action (default)
+ // "scroll" - change current month
+ // "select" - change current month and select date
+
this.id = id;
this.params = parameters;
if (!this.params.showWeekDaysBar) this.params.showWeekDaysBar = true;
@@ -380,7 +385,9 @@
this.currentDate = this.params.currentDate ? this.params.currentDate : new Date();
this.currentDate.setDate(1);
this.selectedDate = this.params.selectedDate;
-
+
+ if (typeof this.params.boundaryDatesMode=="string") this.params.boundaryDatesMode = this.params.boundaryDatesMode.toLowerCase();
+
this.todayDate = new Date();
this.selectedDateElement;
@@ -474,7 +481,7 @@
bottomStyleClass = (k==6 ? "bottom_cell " : "");
for (var i=0;i<7;i++)
{
- styleClass = bottomStyleClass+"cell_size calendar_cell calendar_btn";
+ styleClass = bottomStyleClass+"cell_size calendar_cell";
if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber) styleClass+=" calendar_holly";
if (i==6) styleClass+=" right_cell";
@@ -680,10 +687,18 @@
this.renderFooter();
// popup mode
- if (this.params.popup) this.doCollapse();
+ this.doCollapse();
} else {
- if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
+ if (this.params.boundaryDatesMode == "scroll")
+ if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
+ else if (this.params.boundaryDatesMode == "select")
+ {
+ this.selectDate(new Date(this.currentDate.getFullYear(), this.currentDate.getMonth()+daydata._month, daydata.day), true);
+ $(this.INPUT_DATE_ID).value=this.getSelectedDateString(this.params.datePattern);
+ // popup mode
+ this.doCollapse();
+ }
}
}
},
@@ -693,7 +708,7 @@
if (obj)
{
var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- if (daydata._month==0 && Element.hasClassName(obj,daydata._className)) Element.replaceClassName(obj,daydata._className, daydata._hoverClassName);
+ if (daydata._month==0) Element.addClassName(obj,'calendar_hover');
}
},
@@ -702,7 +717,7 @@
if (obj)
{
var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- if (daydata._month==0 && Element.hasClassName(obj,daydata._hoverClassName)) Element.replaceClassName(obj,daydata._hoverClassName, daydata._className);
+ if (daydata._month==0) Element.removeClassName(obj,'calendar_hover');
}
},
@@ -774,7 +789,7 @@
var dayCounter = previousMonthDays - wd + 1;
// previuos month days
- if (wd>0) while (dayCounter<=previousMonthDays) {this.days.push({day:dayCounter, _isWeekend: this.isWeekend(p), _month:month, _className:"Disableddayclass"}); dayCounter++; p++; }
+ if (wd>0) while (dayCounter<=previousMonthDays) {this.days.push({day:dayCounter, _isWeekend: this.isWeekend(p), _month:month}); dayCounter++; p++; }
dayCounter = 1;
month=0;
@@ -787,10 +802,7 @@
var firstDay = this.daysData.days[idx].day;
while (dayCounter<firstDay)
{
- if (this.isWeekend(p%7))
- this.days.push({day:dayCounter, _isWeekend: true, _month:month, _className:"Weekenddayclass", _hoverClassName:"Hoveredweekclass"});
- else
- this.days.push({day:dayCounter, _isWeekend: false, _month:month, _className:"Commondayclass", _hoverClassName:"Hovereddayclass"});
+ this.days.push({day:dayCounter, _isWeekend:this.isWeekend(p%7), _month:month});
dayCounter++;
p++;
@@ -806,8 +818,6 @@
obj.day = dayCounter;
obj._isWeekend = flag;
obj._month = month;
- if (flag) {obj._className = "Weekenddayclass"; obj._hoverClassName = "Hoveredweekclass";}
- else {obj._className = "Commondayclass"; obj._hoverClassName = "Hovereddayclass";}
this.days.push(obj);
idx++;
dayCounter++;
@@ -817,10 +827,7 @@
while (p<42)
{
if (dayCounter>currentMonthDays) {dayCounter=1; month=1;}
- if (this.isWeekend(p%7))
- this.days.push({day:dayCounter, _isWeekend: true, _month:month, _className:"Weekenddayclass", _hoverClassName:"Hoveredweekclass"});
- else
- this.days.push({day:dayCounter, _isWeekend: false, _month:month, _className:"Commondayclass", _hoverClassName:"Hovereddayclass"});
+ this.days.push({day:dayCounter, _isWeekend: this.isWeekend(p%7), _month:month});
dayCounter++;
p++;
}
@@ -841,6 +848,8 @@
var weekflag=true;
var e;
+
+ var boundaryDatesModeFlag = (this.params.boundaryDatesMode == "scroll" || this.params.boundaryDatesMode == "select");
//var _d=new Date();
@@ -884,7 +893,9 @@
// class styles
e = Element.classNames(element);
- // ?? dataobj._className
+ if (dataobj._month!=0) { e.add('calendar_boundary_dates'); if (boundaryDatesModeFlag) e.add('calendar_btn');}
+ else e.add('calendar_btn');
+
// TODO make some optimization with calendar_current class
if (todayflag && dataobj._month==0 && dataobj.day==todaydate) e.add("calendar_current"); else e.remove("calendar_current");
if (selectedflag && dataobj._month==0 && dataobj.day==selecteddate) {
More information about the richfaces-svn-commits
mailing list