summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes12
-rw-r--r--demos/quickstart/protected/pages/Controls/Simple.page7
-rw-r--r--framework/Data/TSimpleDateFormatter.php41
-rw-r--r--framework/I18N/TGlobalization.php5
-rw-r--r--framework/Web/Javascripts/datepicker/datepicker.js36
-rw-r--r--framework/Web/Javascripts/js/datepicker.js185
-rw-r--r--framework/Web/Javascripts/js/prado.js1701
-rw-r--r--framework/Web/Javascripts/ratings/10star_white.gifbin25048 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks.css29
-rw-r--r--framework/Web/Javascripts/ratings/blocks.pngbin0 -> 29885 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_blank.gifbin0 -> 72 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_half.gifbin0 -> 94 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_hover.gifbin0 -> 75 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_selected.gifbin0 -> 75 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default.css32
-rw-r--r--framework/Web/Javascripts/ratings/default_blank.gifbin0 -> 271 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_half.gifbin0 -> 619 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_hover.gifbin0 -> 618 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_selected.gifbin0 -> 614 bytes
-rw-r--r--framework/Web/Javascripts/ratings/ratings.js70
-rw-r--r--framework/Web/Javascripts/ratings/stars1.pngbin0 -> 53016 bytes
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php114
-rw-r--r--framework/Web/UI/WebControls/TRatingList.php173
-rw-r--r--tests/FunctionalTests/protected/pages/UI/DatePicker.page103
-rw-r--r--tests/FunctionalTests/protected/pages/UI/RatingList.page14
25 files changed, 1380 insertions, 1142 deletions
diff --git a/.gitattributes b/.gitattributes
index 0623b51b..9f3c92e4 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -652,9 +652,19 @@ framework/Web/Javascripts/prototype/position.js -text
framework/Web/Javascripts/prototype/prototype.js -text
framework/Web/Javascripts/prototype/range.js -text
framework/Web/Javascripts/prototype/string.js -text
-framework/Web/Javascripts/ratings/10star_white.gif -text
+framework/Web/Javascripts/ratings/blocks.css -text
+framework/Web/Javascripts/ratings/blocks.png -text
+framework/Web/Javascripts/ratings/blocks_blank.gif -text
+framework/Web/Javascripts/ratings/blocks_half.gif -text
+framework/Web/Javascripts/ratings/blocks_hover.gif -text
+framework/Web/Javascripts/ratings/blocks_selected.gif -text
framework/Web/Javascripts/ratings/default.css -text
+framework/Web/Javascripts/ratings/default_blank.gif -text
+framework/Web/Javascripts/ratings/default_half.gif -text
+framework/Web/Javascripts/ratings/default_hover.gif -text
+framework/Web/Javascripts/ratings/default_selected.gif -text
framework/Web/Javascripts/ratings/ratings.js -text
+framework/Web/Javascripts/ratings/stars1.png -text
framework/Web/Javascripts/rico/colors.js -text
framework/Web/Javascripts/rico/extension.js -text
framework/Web/Javascripts/rico/rico.js -text
diff --git a/demos/quickstart/protected/pages/Controls/Simple.page b/demos/quickstart/protected/pages/Controls/Simple.page
index c04e591f..8272707d 100644
--- a/demos/quickstart/protected/pages/Controls/Simple.page
+++ b/demos/quickstart/protected/pages/Controls/Simple.page
@@ -74,4 +74,11 @@ To determine whether the check box is checked, test the <tt>Checked</tt> propert
</p>
<com:RunBar PagePath="Controls.Samples.TRadioButton.Home" />
+<h2>TDatePicker</h2>
+<p>
+<tt>TDatePicker</tt> provide different ways to select a date.
+</p>
+<com:RunBar PagePath="Controls.Samples.TDatePicker.Home" />
+
+
</com:TContent> \ No newline at end of file
diff --git a/framework/Data/TSimpleDateFormatter.php b/framework/Data/TSimpleDateFormatter.php
index d2f78b37..f6c04027 100644
--- a/framework/Data/TSimpleDateFormatter.php
+++ b/framework/Data/TSimpleDateFormatter.php
@@ -121,6 +121,47 @@ class TSimpleDateFormatter
return str_replace(array_keys($bits), $bits, $this->pattern);
}
+ public function getMonthPattern()
+ {
+ if(is_int(strpos($this->pattern, 'MMMM')))
+ return 'MMMM';
+ if(is_int(strpos($this->pattern, 'MMM')))
+ return 'MMM';
+ if(is_int(strpos($this->pattern, 'MM')))
+ return 'MM';
+ if(is_int(strpos($this->pattern, 'M')))
+ return 'M';
+ }
+
+ public function getDayPattern()
+ {
+ if(is_int(strpos($this->pattern, 'dd')))
+ return 'dd';
+ if(is_int(strpos($this->pattern, 'd')))
+ return 'd';
+ }
+
+ public function getYearPattern()
+ {
+ if(is_int(strpos($this->pattern, 'yyyy')))
+ return 'yyyy';
+ if(is_int(strpos($this->pattern, 'yy')))
+ return 'yy';
+ }
+
+ public function getDayMonthYearOrdering()
+ {
+ $ordering = array();
+ if(is_int($day= strpos($this->pattern, 'd')))
+ $ordering['day'] = $day;
+ if(is_int($month= strpos($this->pattern, 'M')))
+ $ordering['month'] = $month;
+ if(is_int($year= strpos($this->pattern, 'yy')))
+ $ordering['year'] = $year;
+ asort($ordering);
+ return array_keys($ordering);
+ }
+
/**
* Gets the time stamp from string or integer.
* @param string|int date to parse
diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php
index 317273ac..769b7eaa 100644
--- a/framework/I18N/TGlobalization.php
+++ b/framework/I18N/TGlobalization.php
@@ -68,8 +68,9 @@ class TGlobalization extends TModule
$this->_defaultCharset = $this->getCharset();
$this->_defaultCulture = $this->getCulture();
- $config = $xml->getElementByTagName('translation')->getAttributes();
- $this->setTranslationConfiguration($config);
+ $translation = $xml->getElementByTagName('translation');
+ if($translation)
+ $this->setTranslationConfiguration($translation->getAttributes());
$this->getApplication()->setGlobalization($this);
}
diff --git a/framework/Web/Javascripts/datepicker/datepicker.js b/framework/Web/Javascripts/datepicker/datepicker.js
index 49bcfac9..e906120c 100644
--- a/framework/Web/Javascripts/datepicker/datepicker.js
+++ b/framework/Web/Javascripts/datepicker/datepicker.js
@@ -394,13 +394,19 @@ Prado.WebUI.TDatePicker.prototype =
{
var day = $(this.options.ID+"_day");
var month = $(this.options.ID+"_month");
- var years = $(this.options.ID+"_year").options;
+ var year = $(this.options.ID+"_year");
var date = this.selectedDate;
- day.selectedIndex = date.getDate()-1;
- month.selectedIndex = date.getMonth();
- var currentYear = date.getFullYear();
- for(var i = 0; i < years.length; i++)
- years[i].selected = years[i].value.toInteger() == currentYear;
+ if(day)
+ day.selectedIndex = date.getDate()-1;
+ if(month)
+ month.selectedIndex = date.getMonth();
+ if(year)
+ {
+ var years = year.options;
+ var currentYear = date.getFullYear();
+ for(var i = 0; i < years.length; i++)
+ years[i].selected = years[i].value.toInteger() == currentYear;
+ }
}
},
@@ -473,7 +479,10 @@ Prado.WebUI.TDatePicker.prototype =
if(this.options.InputMode == "TextBox")
pos[1] += this.control.offsetHeight;
else
- pos[1] += $(this.options.ID+"_day").offsetHeight-1;
+ {
+ if($(this.options.ID+"_day"))
+ pos[1] += $(this.options.ID+"_day").offsetHeight-1;
+ }
this._calDiv.style.display = "block";
this._calDiv.style.top = (pos[1]-1) + "px";
@@ -500,9 +509,16 @@ Prado.WebUI.TDatePicker.prototype =
return Date.SimpleParse($F(this.control), this.Format);
else
{
- var day = $F(this.options.ID+"_day");
- var month = $F(this.options.ID+"_month");
- var year = $F(this.options.ID+"_year");
+ var now=new Date();
+ var year=now.getFullYear();
+ var month=now.getMonth();
+ var date=1;
+ if($(this.options.ID+"_day"))
+ day = $F(this.options.ID+"_day");
+ if($(this.options.ID+"_month"))
+ month = $F(this.options.ID+"_month");
+ if($(this.options.ID+"_year"))
+ year = $F(this.options.ID+"_year");
var newdate=new Date(year,month,day, 0, 0, 0);
return newdate;
}
diff --git a/framework/Web/Javascripts/js/datepicker.js b/framework/Web/Javascripts/js/datepicker.js
index b9d7b610..58ef5c7c 100644
--- a/framework/Web/Javascripts/js/datepicker.js
+++ b/framework/Web/Javascripts/js/datepicker.js
@@ -271,30 +271,37 @@ this.control.value=this.formatDate();
}else{
var day=$(this.options.ID+"_day");
var _34=$(this.options.ID+"_month");
-var _35=$(this.options.ID+"_year").options;
+var _35=$(this.options.ID+"_year");
var _36=this.selectedDate;
+if(day){
day.selectedIndex=_36.getDate()-1;
+}
+if(_34){
_34.selectedIndex=_36.getMonth();
-var _37=_36.getFullYear();
-for(var i=0;i<_35.length;i++){
-_35[i].selected=_35[i].value.toInteger()==_37;
+}
+if(_35){
+var _37=_35.options;
+var _38=_36.getFullYear();
+for(var i=0;i<_37.length;i++){
+_37[i].selected=_37[i].value.toInteger()==_38;
+}
}
}
},formatDate:function(){
return this.selectedDate?this.selectedDate.SimpleFormat(this.Format):"";
-},newDate:function(_38){
-if(!_38){
-_38=new Date();
+},newDate:function(_39){
+if(!_39){
+_39=new Date();
}
-if(isString(_38)||isNumber(_38)){
-_38=new Date(_38);
+if(isString(_39)||isNumber(_39)){
+_39=new Date(_39);
}
-return new Date(_38.getFullYear(),_38.getMonth(),_38.getDate(),0,0,0);
-},setSelectedDate:function(_39){
-if(_39==null){
+return new Date(_39.getFullYear(),_39.getMonth(),_39.getDate(),0,0,0);
+},setSelectedDate:function(_40){
+if(_40==null){
return;
}
-this.selectedDate=this.newDate(_39);
+this.selectedDate=this.newDate(_40);
this.updateHeader();
this.update();
if(isFunction(this.onchange)){
@@ -304,13 +311,13 @@ this.onchange();
return this._calDiv;
},getSelectedDate:function(){
return isNull(this.selectedDate)?null:this.newDate(this.selectedDate);
-},setYear:function(_40){
+},setYear:function(_41){
var d=this.newDate(this.selectedDate);
-d.setFullYear(_40);
+d.setFullYear(_41);
this.setSelectedDate(d);
-},setMonth:function(_41){
+},setMonth:function(_42){
var d=this.newDate(this.selectedDate);
-d.setMonth(_41);
+d.setMonth(_42);
this.setSelectedDate(d);
},nextMonth:function(){
this.setMonth(this.selectedDate.getMonth()+1);
@@ -322,7 +329,17 @@ var pos=Position.cumulativeOffset(this.control);
if(this.options.InputMode=="TextBox"){
pos[1]+=this.control.offsetHeight;
}else{
+if($(this.options.ID+"_day")){
pos[1]+=$(this.options.ID+"_day").offsetHeight-1;
+}else{
+if($(this.options.ID+"_month")){
+pos[1]+=$(this.options.ID+"_month").offsetHeight-1;
+}else{
+if($(this.options.ID+"_year")){
+pos[1]+=$(this.options.ID+"_year").offsetHeight-1;
+}
+}
+}
}
this._calDiv.style.display="block";
this._calDiv.style.top=(pos[1]-1)+"px";
@@ -331,10 +348,10 @@ this.ieHack(false);
this.documentClickEvent=this.hideOnClick.bindEvent(this);
this.documentKeyDownEvent=this.keyPressed.bindEvent(this);
Event.observe(document.body,"click",this.documentClickEvent);
-var _43=this.getDateFromInput();
-if(!isNull(_43)){
-this.selectedDate=_43;
-this.setSelectedDate(_43);
+var _44=this.getDateFromInput();
+if(!isNull(_44)){
+this.selectedDate=_44;
+this.setSelectedDate(_44);
}
Event.observe(document,"keydown",this.documentKeyDownEvent);
this.showing=true;
@@ -343,28 +360,38 @@ this.showing=true;
if(this.options.InputMode=="TextBox"){
return Date.SimpleParse($F(this.control),this.Format);
}else{
-var day=$F(this.options.ID+"_day");
-var _44=$F(this.options.ID+"_month");
-var _45=$F(this.options.ID+"_year");
-var _46=new Date(_45,_44,day,0,0,0);
-return _46;
+var now=new Date();
+var _46=now.getFullYear();
+var _47=now.getMonth();
+var _48=1;
+if($(this.options.ID+"_day")){
+day=$F(this.options.ID+"_day");
+}
+if($(this.options.ID+"_month")){
+_47=$F(this.options.ID+"_month");
+}
+if($(this.options.ID+"_year")){
+_46=$F(this.options.ID+"_year");
+}
+var _49=new Date(_46,_47,day,0,0,0);
+return _49;
}
},hideOnClick:function(ev){
if(!this.showing){
return;
}
var el=Event.element(ev);
-var _47=false;
+var _50=false;
do{
-_47=_47||el.className==this.ClassName;
-_47=_47||el==this.trigger;
-_47=_47||el==this.control;
-if(_47){
+_50=_50||el.className==this.ClassName;
+_50=_50||el==this.trigger;
+_50=_50||el==this.control;
+if(_50){
break;
}
el=el.parentNode;
}while(el);
-if(!_47){
+if(!_50){
this.hide();
}
},hide:function(){
@@ -378,61 +405,61 @@ Event.stopObserving(document.body,"click",this.documentClickEvent);
Event.stopObserving(document,"keydown",this.documentKeyDownEvent);
}
},update:function(){
-var _48=this.selectedDate;
-var _49=(this.newDate()).toISODate();
-var _50=_48.toISODate();
-var d1=new Date(_48.getFullYear(),_48.getMonth(),1);
-var d2=new Date(_48.getFullYear(),_48.getMonth()+1,1);
-var _53=Math.round((d2-d1)/(24*60*60*1000));
-var _54=(d1.getDay()-this.FirstDayOfWeek)%7;
-if(_54<0){
-_54+=7;
-}
-var _55=0;
-while(_55<_54){
-this.dateSlot[_55].value=-1;
-this.dateSlot[_55].data.data=String.fromCharCode(160);
-this.dateSlot[_55].data.parentNode.className="empty";
-_55++;
-}
-for(i=1;i<=_53;i++,_55++){
-var _56=this.dateSlot[_55];
-var _57=_56.data.parentNode;
-_56.value=i;
-_56.data.data=i;
-_57.className="date";
-if(d1.toISODate()==_49){
-_57.className+=" today";
-}
-if(d1.toISODate()==_50){
-_57.className+=" selected";
+var _51=this.selectedDate;
+var _52=(this.newDate()).toISODate();
+var _53=_51.toISODate();
+var d1=new Date(_51.getFullYear(),_51.getMonth(),1);
+var d2=new Date(_51.getFullYear(),_51.getMonth()+1,1);
+var _56=Math.round((d2-d1)/(24*60*60*1000));
+var _57=(d1.getDay()-this.FirstDayOfWeek)%7;
+if(_57<0){
+_57+=7;
+}
+var _58=0;
+while(_58<_57){
+this.dateSlot[_58].value=-1;
+this.dateSlot[_58].data.data=String.fromCharCode(160);
+this.dateSlot[_58].data.parentNode.className="empty";
+_58++;
+}
+for(i=1;i<=_56;i++,_58++){
+var _59=this.dateSlot[_58];
+var _60=_59.data.parentNode;
+_59.value=i;
+_59.data.data=i;
+_60.className="date";
+if(d1.toISODate()==_52){
+_60.className+=" today";
+}
+if(d1.toISODate()==_53){
+_60.className+=" selected";
}
d1=new Date(d1.getFullYear(),d1.getMonth(),d1.getDate()+1);
}
-var _58=_55;
-while(_55<42){
-this.dateSlot[_55].value=-1;
-this.dateSlot[_55].data.data=String.fromCharCode(160);
-this.dateSlot[_55].data.parentNode.className="empty";
-++_55;
+var _61=_58;
+while(_58<42){
+this.dateSlot[_58].value=-1;
+this.dateSlot[_58].data.data=String.fromCharCode(160);
+this.dateSlot[_58].data.parentNode.className="empty";
+++_58;
}
},hover:function(ev){
Element.condClassName(Event.element(ev),"hover",ev.type=="mouseover");
},updateHeader:function(){
-var _59=this._monthSelect.options;
+var _62=this._monthSelect.options;
var m=this.selectedDate.getMonth();
-for(var i=0;i<_59.length;++i){
-_59[i].selected=false;
-if(_59[i].value==m){
-_59[i].selected=true;
-}
-}
-_59=this._yearSelect.options;
-var _60=this.selectedDate.getFullYear();
-for(var i=0;i<_59.length;++i){
-_59[i].selected=false;
-if(_59[i].value==_60){
-_59[i].selected=true;
+for(var i=0;i<_62.length;++i){
+_62[i].selected=false;
+if(_62[i].value==m){
+_62[i].selected=true;
+}
+}
+_62=this._yearSelect.options;
+var _63=this.selectedDate.getFullYear();
+for(var i=0;i<_62.length;++i){
+_62[i].selected=false;
+if(_62[i].value==_63){
+_62[i].selected=true;
}
}
}};
diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js
index 0ca3c0b1..b7dba8d8 100644
--- a/framework/Web/Javascripts/js/prado.js
+++ b/framework/Web/Javascripts/js/prado.js
@@ -303,15 +303,17 @@ var _54=m[2]+m[5];
var _55=m[1]+_54.replace(new RegExp("(\\"+_51+")","g"),"")+((_52>0)?"."+m[7]:"");
var num=parseFloat(_55);
return (isNaN(num)?null:num);
+},toDate:function(_56){
+return Date.SimpleParse(this,_56);
}});
var $break=new Object();
var $continue=new Object();
-var Enumerable={each:function(_56){
-var _57=0;
+var Enumerable={each:function(_57){
+var _58=0;
try{
-this._each(function(_58){
+this._each(function(_59){
try{
-_56(_58,_57++);
+_57(_59,_58++);
}
catch(e){
if(e!=$continue){
@@ -325,154 +327,154 @@ if(e!=$break){
throw e;
}
}
-},all:function(_59){
-var _60=true;
-this.each(function(_61,_62){
-_60=_60&&!!(_59||Prototype.K)(_61,_62);
-if(!_60){
+},all:function(_60){
+var _61=true;
+this.each(function(_62,_63){
+_61=_61&&!!(_60||Prototype.K)(_62,_63);
+if(!_61){
throw $break;
}
});
-return _60;
-},any:function(_63){
-var _64=true;
-this.each(function(_65,_66){
-if(_64=!!(_63||Prototype.K)(_65,_66)){
+return _61;
+},any:function(_64){
+var _65=true;
+this.each(function(_66,_67){
+if(_65=!!(_64||Prototype.K)(_66,_67)){
throw $break;
}
});
-return _64;
-},collect:function(_67){
-var _68=[];
-this.each(function(_69,_70){
-_68.push(_67(_69,_70));
+return _65;
+},collect:function(_68){
+var _69=[];
+this.each(function(_70,_71){
+_69.push(_68(_70,_71));
});
-return _68;
-},detect:function(_71){
-var _72;
-this.each(function(_73,_74){
-if(_71(_73,_74)){
-_72=_73;
+return _69;
+},detect:function(_72){
+var _73;
+this.each(function(_74,_75){
+if(_72(_74,_75)){
+_73=_74;
throw $break;
}
});
-return _72;
-},findAll:function(_75){
-var _76=[];
-this.each(function(_77,_78){
-if(_75(_77,_78)){
-_76.push(_77);
+return _73;
+},findAll:function(_76){
+var _77=[];
+this.each(function(_78,_79){
+if(_76(_78,_79)){
+_77.push(_78);
}
});
-return _76;
-},grep:function(_79,_80){
-var _81=[];
-this.each(function(_82,_83){
-var _84=_82.toString();
-if(_84.match(_79)){
-_81.push((_80||Prototype.K)(_82,_83));
+return _77;
+},grep:function(_80,_81){
+var _82=[];
+this.each(function(_83,_84){
+var _85=_83.toString();
+if(_85.match(_80)){
+_82.push((_81||Prototype.K)(_83,_84));
}
});
-return _81;
-},include:function(_85){
-var _86=false;
-this.each(function(_87){
-if(_87==_85){
-_86=true;
+return _82;
+},include:function(_86){
+var _87=false;
+this.each(function(_88){
+if(_88==_86){
+_87=true;
throw $break;
}
});
-return _86;
-},inject:function(_88,_89){
-this.each(function(_90,_91){
-_88=_89(_88,_90,_91);
+return _87;
+},inject:function(_89,_90){
+this.each(function(_91,_92){
+_89=_90(_89,_91,_92);
});
-return _88;
-},invoke:function(_92){
-var _93=$A(arguments).slice(1);
-return this.collect(function(_94){
-return _94[_92].apply(_94,_93);
+return _89;
+},invoke:function(_93){
+var _94=$A(arguments).slice(1);
+return this.collect(function(_95){
+return _95[_93].apply(_95,_94);
});
-},max:function(_95){
-var _96;
-this.each(function(_97,_98){
-_97=(_95||Prototype.K)(_97,_98);
-if(_97>=(_96||_97)){
-_96=_97;
+},max:function(_96){
+var _97;
+this.each(function(_98,_99){
+_98=(_96||Prototype.K)(_98,_99);
+if(_98>=(_97||_98)){
+_97=_98;
}
});
-return _96;
-},min:function(_99){
-var _100;
-this.each(function(_101,_102){
-_101=(_99||Prototype.K)(_101,_102);
-if(_101<=(_100||_101)){
-_100=_101;
+return _97;
+},min:function(_100){
+var _101;
+this.each(function(_102,_103){
+_102=(_100||Prototype.K)(_102,_103);
+if(_102<=(_101||_102)){
+_101=_102;
}
});
-return _100;
-},partition:function(_103){
-var _104=[],falses=[];
-this.each(function(_105,_106){
-((_103||Prototype.K)(_105,_106)?_104:falses).push(_105);
+return _101;
+},partition:function(_104){
+var _105=[],falses=[];
+this.each(function(_106,_107){
+((_104||Prototype.K)(_106,_107)?_105:falses).push(_106);
});
-return [_104,falses];
-},pluck:function(_107){
-var _108=[];
-this.each(function(_109,_110){
-_108.push(_109[_107]);
+return [_105,falses];
+},pluck:function(_108){
+var _109=[];
+this.each(function(_110,_111){
+_109.push(_110[_108]);
});
-return _108;
-},reject:function(_111){
-var _112=[];
-this.each(function(_113,_114){
-if(!_111(_113,_114)){
-_112.push(_113);
+return _109;
+},reject:function(_112){
+var _113=[];
+this.each(function(_114,_115){
+if(!_112(_114,_115)){
+_113.push(_114);
}
});
-return _112;
-},sortBy:function(_115){
-return this.collect(function(_116,_117){
-return {value:_116,criteria:_115(_116,_117)};
-}).sort(function(left,_119){
-var a=left.criteria,b=_119.criteria;
+return _113;
+},sortBy:function(_116){
+return this.collect(function(_117,_118){
+return {value:_117,criteria:_116(_117,_118)};
+}).sort(function(left,_120){
+var a=left.criteria,b=_120.criteria;
return a<b?-1:a>b?1:0;
}).pluck("value");
},toArray:function(){
return this.collect(Prototype.K);
},zip:function(){
-var _120=Prototype.K,args=$A(arguments);
+var _121=Prototype.K,args=$A(arguments);
if(typeof args.last()=="function"){
-_120=args.pop();
+_121=args.pop();
}
-var _121=[this].concat(args).map($A);
-return this.map(function(_122,_123){
-_120(_122=_121.pluck(_123));
-return _122;
+var _122=[this].concat(args).map($A);
+return this.map(function(_123,_124){
+_121(_123=_122.pluck(_124));
+return _123;
});
},inspect:function(){
return "#<Enumerable:"+this.toArray().inspect()+">";
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});
-var $A=Array.from=function(_124){
-if(!_124){
+var $A=Array.from=function(_125){
+if(!_125){
return [];
}
-if(_124.toArray){
-return _124.toArray();
+if(_125.toArray){
+return _125.toArray();
}else{
-var _125=[];
-for(var i=0;i<_124.length;i++){
-_125.push(_124[i]);
+var _126=[];
+for(var i=0;i<_125.length;i++){
+_126.push(_125[i]);
}
-return _125;
+return _126;
}
};
Object.extend(Array.prototype,Enumerable);
Array.prototype._reverse=Array.prototype.reverse;
-Object.extend(Array.prototype,{_each:function(_126){
+Object.extend(Array.prototype,{_each:function(_127){
for(var i=0;i<this.length;i++){
-_126(this[i]);
+_127(this[i]);
}
},clear:function(){
this.length=0;
@@ -482,56 +484,56 @@ return this[0];
},last:function(){
return this[this.length-1];
},compact:function(){
-return this.select(function(_127){
-return _127!=undefined||_127!=null;
+return this.select(function(_128){
+return _128!=undefined||_128!=null;
});
},flatten:function(){
-return this.inject([],function(_128,_129){
-return _128.concat(_129.constructor==Array?_129.flatten():[_129]);
+return this.inject([],function(_129,_130){
+return _129.concat(_130.constructor==Array?_130.flatten():[_130]);
});
},without:function(){
-var _130=$A(arguments);
-return this.select(function(_131){
-return !_130.include(_131);
+var _131=$A(arguments);
+return this.select(function(_132){
+return !_131.include(_132);
});
-},indexOf:function(_132){
+},indexOf:function(_133){
for(var i=0;i<this.length;i++){
-if(this[i]==_132){
+if(this[i]==_133){
return i;
}
}
return -1;
-},reverse:function(_133){
-return (_133!==false?this:this.toArray())._reverse();
+},reverse:function(_134){
+return (_134!==false?this:this.toArray())._reverse();
},shift:function(){
-var _134=this[0];
+var _135=this[0];
for(var i=0;i<this.length-1;i++){
this[i]=this[i+1];
}
this.length--;
-return _134;
+return _135;
},inspect:function(){
return "["+this.map(Object.inspect).join(", ")+"]";
}});
-var Hash={_each:function(_135){
+var Hash={_each:function(_136){
for(key in this){
-var _136=this[key];
-if(typeof _136=="function"){
+var _137=this[key];
+if(typeof _137=="function"){
continue;
}
-var pair=[key,_136];
+var pair=[key,_137];
pair.key=key;
-pair.value=_136;
-_135(pair);
+pair.value=_137;
+_136(pair);
}
},keys:function(){
return this.pluck("key");
},values:function(){
return this.pluck("value");
},merge:function(hash){
-return $H(hash).inject($H(this),function(_139,pair){
-_139[pair.key]=pair.value;
-return _139;
+return $H(hash).inject($H(this),function(_140,pair){
+_140[pair.key]=pair.value;
+return _140;
});
},toQueryString:function(){
return this.map(function(pair){
@@ -542,190 +544,190 @@ return "#<Hash:{"+this.map(function(pair){
return pair.map(Object.inspect).join(": ");
}).join(", ")+"}>";
}};
-function $H(_140){
-var hash=Object.extend({},_140||{});
+function $H(_141){
+var hash=Object.extend({},_141||{});
Object.extend(hash,Enumerable);
Object.extend(hash,Hash);
return hash;
}
ObjectRange=Class.create();
Object.extend(ObjectRange.prototype,Enumerable);
-Object.extend(ObjectRange.prototype,{initialize:function(_141,end,_143){
-this.start=_141;
+Object.extend(ObjectRange.prototype,{initialize:function(_142,end,_144){
+this.start=_142;
this.end=end;
-this.exclusive=_143;
-},_each:function(_144){
-var _145=this.start;
+this.exclusive=_144;
+},_each:function(_145){
+var _146=this.start;
do{
-_144(_145);
-_145=_145.succ();
-}while(this.include(_145));
-},include:function(_146){
-if(_146<this.start){
+_145(_146);
+_146=_146.succ();
+}while(this.include(_146));
+},include:function(_147){
+if(_147<this.start){
return false;
}
if(this.exclusive){
-return _146<this.end;
+return _147<this.end;
}
-return _146<=this.end;
+return _147<=this.end;
}});
-var $R=function(_147,end,_148){
-return new ObjectRange(_147,end,_148);
+var $R=function(_148,end,_149){
+return new ObjectRange(_148,end,_149);
};
-document.getElementsByClassName=function(_149,_150){
-var _151=($(_150)||document.body).getElementsByTagName("*");
-return $A(_151).inject([],function(_152,_153){
-if(_153.className.match(new RegExp("(^|\\s)"+_149+"(\\s|$)"))){
-_152.push(_153);
+document.getElementsByClassName=function(_150,_151){
+var _152=($(_151)||document.body).getElementsByTagName("*");
+return $A(_152).inject([],function(_153,_154){
+if(_154.className.match(new RegExp("(^|\\s)"+_150+"(\\s|$)"))){
+_153.push(_154);
}
-return _152;
+return _153;
});
};
if(!window.Element){
var Element=new Object();
}
-Object.extend(Element,{visible:function(_154){
-return $(_154).style.display!="none";
+Object.extend(Element,{visible:function(_155){
+return $(_155).style.display!="none";
},toggle:function(){
for(var i=0;i<arguments.length;i++){
-var _155=$(arguments[i]);
-Element[Element.visible(_155)?"hide":"show"](_155);
+var _156=$(arguments[i]);
+Element[Element.visible(_156)?"hide":"show"](_156);
}
},hide:function(){
for(var i=0;i<arguments.length;i++){
-var _156=$(arguments[i]);
-_156.style.display="none";
+var _157=$(arguments[i]);
+_157.style.display="none";
}
},show:function(){
for(var i=0;i<arguments.length;i++){
-var _157=$(arguments[i]);
-_157.style.display="";
-}
-},remove:function(_158){
-_158=$(_158);
-_158.parentNode.removeChild(_158);
-},update:function(_159,html){
-$(_159).innerHTML=html.stripScripts();
+var _158=$(arguments[i]);
+_158.style.display="";
+}
+},remove:function(_159){
+_159=$(_159);
+_159.parentNode.removeChild(_159);
+},update:function(_160,html){
+$(_160).innerHTML=html.stripScripts();
setTimeout(function(){
html.evalScripts();
},10);
-},getHeight:function(_161){
-_161=$(_161);
-return _161.offsetHeight;
-},classNames:function(_162){
-return new Element.ClassNames(_162);
-},hasClassName:function(_163,_164){
-if(!(_163=$(_163))){
+},getHeight:function(_162){
+_162=$(_162);
+return _162.offsetHeight;
+},classNames:function(_163){
+return new Element.ClassNames(_163);
+},hasClassName:function(_164,_165){
+if(!(_164=$(_164))){
return;
}
-return Element.classNames(_163).include(_164);
-},addClassName:function(_165,_166){
-if(!(_165=$(_165))){
+return Element.classNames(_164).include(_165);
+},addClassName:function(_166,_167){
+if(!(_166=$(_166))){
return;
}
-return Element.classNames(_165).add(_166);
-},removeClassName:function(_167,_168){
-if(!(_167=$(_167))){
+return Element.classNames(_166).add(_167);
+},removeClassName:function(_168,_169){
+if(!(_168=$(_168))){
return;
}
-return Element.classNames(_167).remove(_168);
-},cleanWhitespace:function(_169){
-_169=$(_169);
-for(var i=0;i<_169.childNodes.length;i++){
-var node=_169.childNodes[i];
+return Element.classNames(_168).remove(_169);
+},cleanWhitespace:function(_170){
+_170=$(_170);
+for(var i=0;i<_170.childNodes.length;i++){
+var node=_170.childNodes[i];
if(node.nodeType==3&&!/\S/.test(node.nodeValue)){
Element.remove(node);
}
}
-},empty:function(_171){
-return $(_171).innerHTML.match(/^\s*$/);
-},scrollTo:function(_172){
-_172=$(_172);
-var x=_172.x?_172.x:_172.offsetLeft,y=_172.y?_172.y:_172.offsetTop;
-window.scrollTo(x,y);
-},getStyle:function(_173,_174){
+},empty:function(_172){
+return $(_172).innerHTML.match(/^\s*$/);
+},scrollTo:function(_173){
_173=$(_173);
-var _175=_173.style[_174.camelize()];
-if(!_175){
+var x=_173.x?_173.x:_173.offsetLeft,y=_173.y?_173.y:_173.offsetTop;
+window.scrollTo(x,y);
+},getStyle:function(_174,_175){
+_174=$(_174);
+var _176=_174.style[_175.camelize()];
+if(!_176){
if(document.defaultView&&document.defaultView.getComputedStyle){
-var css=document.defaultView.getComputedStyle(_173,null);
-_175=css?css.getPropertyValue(_174):null;
+var css=document.defaultView.getComputedStyle(_174,null);
+_176=css?css.getPropertyValue(_175):null;
}else{
-if(_173.currentStyle){
-_175=_173.currentStyle[_174.camelize()];
+if(_174.currentStyle){
+_176=_174.currentStyle[_175.camelize()];
}
}
}
-if(window.opera&&["left","top","right","bottom"].include(_174)){
-if(Element.getStyle(_173,"position")=="static"){
-_175="auto";
+if(window.opera&&["left","top","right","bottom"].include(_175)){
+if(Element.getStyle(_174,"position")=="static"){
+_176="auto";
}
}
-return _175=="auto"?null:_175;
-},setStyle:function(_177,_178){
-_177=$(_177);
-for(name in _178){
-_177.style[name.camelize()]=_178[name];
+return _176=="auto"?null:_176;
+},setStyle:function(_178,_179){
+_178=$(_178);
+for(name in _179){
+_178.style[name.camelize()]=_179[name];
}
-},getDimensions:function(_179){
-_179=$(_179);
-if(Element.getStyle(_179,"display")!="none"){
-return {width:_179.offsetWidth,height:_179.offsetHeight};
+},getDimensions:function(_180){
+_180=$(_180);
+if(Element.getStyle(_180,"display")!="none"){
+return {width:_180.offsetWidth,height:_180.offsetHeight};
}
-var els=_179.style;
-var _181=els.visibility;
-var _182=els.position;
+var els=_180.style;
+var _182=els.visibility;
+var _183=els.position;
els.visibility="hidden";
els.position="absolute";
els.display="";
-var _183=_179.clientWidth;
-var _184=_179.clientHeight;
+var _184=_180.clientWidth;
+var _185=_180.clientHeight;
els.display="none";
-els.position=_182;
-els.visibility=_181;
-return {width:_183,height:_184};
-},makePositioned:function(_185){
-_185=$(_185);
-var pos=Element.getStyle(_185,"position");
+els.position=_183;
+els.visibility=_182;
+return {width:_184,height:_185};
+},makePositioned:function(_186){
+_186=$(_186);
+var pos=Element.getStyle(_186,"position");
if(pos=="static"||!pos){
-_185._madePositioned=true;
-_185.style.position="relative";
+_186._madePositioned=true;
+_186.style.position="relative";
if(window.opera){
-_185.style.top=0;
-_185.style.left=0;
-}
+_186.style.top=0;
+_186.style.left=0;
}
-},undoPositioned:function(_187){
-_187=$(_187);
-if(_187._madePositioned){
-_187._madePositioned=undefined;
-_187.style.position=_187.style.top=_187.style.left=_187.style.bottom=_187.style.right="";
}
-},makeClipping:function(_188){
+},undoPositioned:function(_188){
_188=$(_188);
-if(_188._overflow){
-return;
-}
-_188._overflow=_188.style.overflow;
-if((Element.getStyle(_188,"overflow")||"visible")!="hidden"){
-_188.style.overflow="hidden";
+if(_188._madePositioned){
+_188._madePositioned=undefined;
+_188.style.position=_188.style.top=_188.style.left=_188.style.bottom=_188.style.right="";
}
-},undoClipping:function(_189){
+},makeClipping:function(_189){
_189=$(_189);
if(_189._overflow){
return;
}
-_189.style.overflow=_189._overflow;
-_189._overflow=undefined;
+_189._overflow=_189.style.overflow;
+if((Element.getStyle(_189,"overflow")||"visible")!="hidden"){
+_189.style.overflow="hidden";
+}
+},undoClipping:function(_190){
+_190=$(_190);
+if(_190._overflow){
+return;
+}
+_190.style.overflow=_190._overflow;
+_190._overflow=undefined;
}});
var Toggle=new Object();
Toggle.display=Element.toggle;
-Abstract.Insertion=function(_190){
-this.adjacency=_190;
+Abstract.Insertion=function(_191){
+this.adjacency=_191;
};
-Abstract.Insertion.prototype={initialize:function(_191,_192){
-this.element=$(_191);
-this.content=_192.stripScripts();
+Abstract.Insertion.prototype={initialize:function(_192,_193){
+this.element=$(_192);
+this.content=_193.stripScripts();
if(this.adjacency&&this.element.insertAdjacentHTML){
try{
this.element.insertAdjacentHTML(this.adjacency,this.content);
@@ -745,7 +747,7 @@ this.initializeRange();
this.insertContent([this.range.createContextualFragment(this.content)]);
}
setTimeout(function(){
-_192.evalScripts();
+_193.evalScripts();
},10);
},contentFromAnonymousTable:function(){
var div=document.createElement("div");
@@ -756,71 +758,71 @@ var Insertion=new Object();
Insertion.Before=Class.create();
Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){
this.range.setStartBefore(this.element);
-},insertContent:function(_193){
-_193.each((function(_194){
-this.element.parentNode.insertBefore(_194,this.element);
+},insertContent:function(_194){
+_194.each((function(_195){
+this.element.parentNode.insertBefore(_195,this.element);
}).bind(this));
}});
Insertion.Top=Class.create();
Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){
this.range.selectNodeContents(this.element);
this.range.collapse(true);
-},insertContent:function(_195){
-_195.reverse(false).each((function(_196){
-this.element.insertBefore(_196,this.element.firstChild);
+},insertContent:function(_196){
+_196.reverse(false).each((function(_197){
+this.element.insertBefore(_197,this.element.firstChild);
}).bind(this));
}});
Insertion.Bottom=Class.create();
Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){
this.range.selectNodeContents(this.element);
this.range.collapse(this.element);
-},insertContent:function(_197){
-_197.each((function(_198){
-this.element.appendChild(_198);
+},insertContent:function(_198){
+_198.each((function(_199){
+this.element.appendChild(_199);
}).bind(this));
}});
Insertion.After=Class.create();
Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){
this.range.setStartAfter(this.element);
-},insertContent:function(_199){
-_199.each((function(_200){
-this.element.parentNode.insertBefore(_200,this.element.nextSibling);
+},insertContent:function(_200){
+_200.each((function(_201){
+this.element.parentNode.insertBefore(_201,this.element.nextSibling);
}).bind(this));
}});
Element.ClassNames=Class.create();
-Element.ClassNames.prototype={initialize:function(_201){
-this.element=$(_201);
-},_each:function(_202){
+Element.ClassNames.prototype={initialize:function(_202){
+this.element=$(_202);
+},_each:function(_203){
this.element.className.split(/\s+/).select(function(name){
return name.length>0;
-})._each(_202);
-},set:function(_204){
-this.element.className=_204;
-},add:function(_205){
-if(this.include(_205)){
+})._each(_203);
+},set:function(_205){
+this.element.className=_205;
+},add:function(_206){
+if(this.include(_206)){
return;
}
-this.set(this.toArray().concat(_205).join(" "));
-},remove:function(_206){
-if(!this.include(_206)){
+this.set(this.toArray().concat(_206).join(" "));
+},remove:function(_207){
+if(!this.include(_207)){
return;
}
-this.set(this.select(function(_207){
-return _207!=_206;
+this.set(this.select(function(_208){
+return _208!=_207;
}).join(" "));
},toString:function(){
return this.toArray().join(" ");
}};
Object.extend(Element.ClassNames.prototype,Enumerable);
-Object.extend(Element,{condClassName:function(_208,_209,cond){
-(cond?Element.addClassName:Element.removeClassName)(_208,_209);
+Object.extend(Element,{condClassName:function(_209,_210,cond){
+(cond?Element.addClassName:Element.removeClassName)(_209,_210);
}});
var Field={clear:function(){
for(var i=0;i<arguments.length;i++){
$(arguments[i]).value="";
}
-},focus:function(_211){
-$(_211).focus();
+},focus:function(_212){
+$(_212).focus();
},present:function(){
for(var i=0;i<arguments.length;i++){
if($(arguments[i]).value==""){
@@ -828,156 +830,156 @@ return false;
}
}
return true;
-},select:function(_212){
-$(_212).select();
-},activate:function(_213){
-_213=$(_213);
-_213.focus();
-if(_213.select){
-_213.select();
+},select:function(_213){
+$(_213).select();
+},activate:function(_214){
+_214=$(_214);
+_214.focus();
+if(_214.select){
+_214.select();
}
}};
var Form={serialize:function(form){
-var _215=Form.getElements($(form));
-var _216=new Array();
-for(var i=0;i<_215.length;i++){
-var _217=Form.Element.serialize(_215[i]);
-if(_217){
-_216.push(_217);
+var _216=Form.getElements($(form));
+var _217=new Array();
+for(var i=0;i<_216.length;i++){
+var _218=Form.Element.serialize(_216[i]);
+if(_218){
+_217.push(_218);
}
}
-return _216.join("&");
+return _217.join("&");
},getElements:function(form){
form=$(form);
-var _218=new Array();
+var _219=new Array();
for(tagName in Form.Element.Serializers){
-var _219=form.getElementsByTagName(tagName);
-for(var j=0;j<_219.length;j++){
-_218.push(_219[j]);
+var _220=form.getElementsByTagName(tagName);
+for(var j=0;j<_220.length;j++){
+_219.push(_220[j]);
}
}
-return _218;
-},getInputs:function(form,_221,name){
+return _219;
+},getInputs:function(form,_222,name){
form=$(form);
-var _222=form.getElementsByTagName("input");
-if(!_221&&!name){
-return _222;
-}
-var _223=new Array();
-for(var i=0;i<_222.length;i++){
-var _224=_222[i];
-if((_221&&_224.type!=_221)||(name&&_224.name!=name)){
+var _223=form.getElementsByTagName("input");
+if(!_222&&!name){
+return _223;
+}
+var _224=new Array();
+for(var i=0;i<_223.length;i++){
+var _225=_223[i];
+if((_222&&_225.type!=_222)||(name&&_225.name!=name)){
continue;
}
-_223.push(_224);
+_224.push(_225);
}
-return _223;
+return _224;
},disable:function(form){
-var _225=Form.getElements(form);
-for(var i=0;i<_225.length;i++){
-var _226=_225[i];
-_226.blur();
-_226.disabled="true";
+var _226=Form.getElements(form);
+for(var i=0;i<_226.length;i++){
+var _227=_226[i];
+_227.blur();
+_227.disabled="true";
}
},enable:function(form){
-var _227=Form.getElements(form);
-for(var i=0;i<_227.length;i++){
-var _228=_227[i];
-_228.disabled="";
+var _228=Form.getElements(form);
+for(var i=0;i<_228.length;i++){
+var _229=_228[i];
+_229.disabled="";
}
},findFirstElement:function(form){
-return Form.getElements(form).find(function(_229){
-return _229.type!="hidden"&&!_229.disabled&&["input","select","textarea"].include(_229.tagName.toLowerCase());
+return Form.getElements(form).find(function(_230){
+return _230.type!="hidden"&&!_230.disabled&&["input","select","textarea"].include(_230.tagName.toLowerCase());
});
},focusFirstElement:function(form){
Field.activate(Form.findFirstElement(form));
},reset:function(form){
$(form).reset();
}};
-Form.Element={serialize:function(_230){
-_230=$(_230);
-var _231=_230.tagName.toLowerCase();
-var _232=Form.Element.Serializers[_231](_230);
-if(_232){
-var key=encodeURIComponent(_232[0]);
+Form.Element={serialize:function(_231){
+_231=$(_231);
+var _232=_231.tagName.toLowerCase();
+var _233=Form.Element.Serializers[_232](_231);
+if(_233){
+var key=encodeURIComponent(_233[0]);
if(key.length==0){
return;
}
-if(_232[1].constructor!=Array){
-_232[1]=[_232[1]];
+if(_233[1].constructor!=Array){
+_233[1]=[_233[1]];
}
-return _232[1].map(function(_234){
-return key+"="+encodeURIComponent(_234);
+return _233[1].map(function(_235){
+return key+"="+encodeURIComponent(_235);
}).join("&");
}
-},getValue:function(_235){
-_235=$(_235);
-var _236=_235.tagName.toLowerCase();
-var _237=Form.Element.Serializers[_236](_235);
-if(_237){
-return _237[1];
+},getValue:function(_236){
+_236=$(_236);
+var _237=_236.tagName.toLowerCase();
+var _238=Form.Element.Serializers[_237](_236);
+if(_238){
+return _238[1];
}
}};
-Form.Element.Serializers={input:function(_238){
-switch(_238.type.toLowerCase()){
+Form.Element.Serializers={input:function(_239){
+switch(_239.type.toLowerCase()){
case "submit":
case "hidden":
case "password":
case "text":
-return Form.Element.Serializers.textarea(_238);
+return Form.Element.Serializers.textarea(_239);
case "checkbox":
case "radio":
-return Form.Element.Serializers.inputSelector(_238);
+return Form.Element.Serializers.inputSelector(_239);
}
return false;
-},inputSelector:function(_239){
-if(_239.checked){
-return [_239.name,_239.value];
-}
-},textarea:function(_240){
+},inputSelector:function(_240){
+if(_240.checked){
return [_240.name,_240.value];
-},select:function(_241){
-return Form.Element.Serializers[_241.type=="select-one"?"selectOne":"selectMany"](_241);
-},selectOne:function(_242){
-var _243="",opt,index=_242.selectedIndex;
+}
+},textarea:function(_241){
+return [_241.name,_241.value];
+},select:function(_242){
+return Form.Element.Serializers[_242.type=="select-one"?"selectOne":"selectMany"](_242);
+},selectOne:function(_243){
+var _244="",opt,index=_243.selectedIndex;
if(index>=0){
-opt=_242.options[index];
-_243=opt.value;
-if(!_243&&!("value" in opt)){
-_243=opt.text;
+opt=_243.options[index];
+_244=opt.value;
+if(!_244&&!("value" in opt)){
+_244=opt.text;
}
}
-return [_242.name,_243];
-},selectMany:function(_244){
-var _245=new Array();
-for(var i=0;i<_244.length;i++){
-var opt=_244.options[i];
+return [_243.name,_244];
+},selectMany:function(_245){
+var _246=new Array();
+for(var i=0;i<_245.length;i++){
+var opt=_245.options[i];
if(opt.selected){
-var _247=opt.value;
-if(!_247&&!("value" in opt)){
-_247=opt.text;
+var _248=opt.value;
+if(!_248&&!("value" in opt)){
+_248=opt.text;
}
-_245.push(_247);
+_246.push(_248);
}
}
-return [_244.name,_245];
+return [_245.name,_246];
}};
var $F=Form.Element.getValue;
Abstract.TimedObserver=function(){
};
-Abstract.TimedObserver.prototype={initialize:function(_248,_249,_250){
-this.frequency=_249;
-this.element=$(_248);
-this.callback=_250;
+Abstract.TimedObserver.prototype={initialize:function(_249,_250,_251){
+this.frequency=_250;
+this.element=$(_249);
+this.callback=_251;
this.lastValue=this.getValue();
this.registerCallback();
},registerCallback:function(){
setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},onTimerEvent:function(){
-var _251=this.getValue();
-if(this.lastValue!=_251){
-this.callback(this.element,_251);
-this.lastValue=_251;
+var _252=this.getValue();
+if(this.lastValue!=_252){
+this.callback(this.element,_252);
+this.lastValue=_252;
}
}};
Form.Element.Observer=Class.create();
@@ -990,9 +992,9 @@ return Form.serialize(this.element);
}});
Abstract.EventObserver=function(){
};
-Abstract.EventObserver.prototype={initialize:function(_252,_253){
-this.element=$(_252);
-this.callback=_253;
+Abstract.EventObserver.prototype={initialize:function(_253,_254){
+this.element=$(_253);
+this.callback=_254;
this.lastValue=this.getValue();
if(this.element.tagName.toLowerCase()=="form"){
this.registerFormCallbacks();
@@ -1000,29 +1002,29 @@ this.registerFormCallbacks();
this.registerCallback(this.element);
}
},onElementEvent:function(){
-var _254=this.getValue();
-if(this.lastValue!=_254){
-this.callback(this.element,_254);
-this.lastValue=_254;
+var _255=this.getValue();
+if(this.lastValue!=_255){
+this.callback(this.element,_255);
+this.lastValue=_255;
}
},registerFormCallbacks:function(){
-var _255=Form.getElements(this.element);
-for(var i=0;i<_255.length;i++){
-this.registerCallback(_255[i]);
+var _256=Form.getElements(this.element);
+for(var i=0;i<_256.length;i++){
+this.registerCallback(_256[i]);
}
-},registerCallback:function(_256){
-if(_256.type){
-switch(_256.type.toLowerCase()){
+},registerCallback:function(_257){
+if(_257.type){
+switch(_257.type.toLowerCase()){
case "checkbox":
case "radio":
-Event.observe(_256,"click",this.onElementEvent.bind(this));
+Event.observe(_257,"click",this.onElementEvent.bind(this));
break;
case "password":
case "text":
case "textarea":
case "select-one":
case "select-multiple":
-Event.observe(_256,"change",this.onElementEvent.bind(this));
+Event.observe(_257,"change",this.onElementEvent.bind(this));
break;
}
}
@@ -1038,39 +1040,39 @@ return Form.serialize(this.element);
if(!window.Event){
var Event=new Object();
}
-Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(_257){
-return _257.target||_257.srcElement;
-},isLeftClick:function(_258){
-return (((_258.which)&&(_258.which==1))||((_258.button)&&(_258.button==1)));
-},pointerX:function(_259){
-return _259.pageX||(_259.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));
-},pointerY:function(_260){
-return _260.pageY||(_260.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
-},stop:function(_261){
-if(_261.preventDefault){
-_261.preventDefault();
-_261.stopPropagation();
+Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(_258){
+return _258.target||_258.srcElement;
+},isLeftClick:function(_259){
+return (((_259.which)&&(_259.which==1))||((_259.button)&&(_259.button==1)));
+},pointerX:function(_260){
+return _260.pageX||(_260.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));
+},pointerY:function(_261){
+return _261.pageY||(_261.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
+},stop:function(_262){
+if(_262.preventDefault){
+_262.preventDefault();
+_262.stopPropagation();
}else{
-_261.returnValue=false;
-_261.cancelBubble=true;
+_262.returnValue=false;
+_262.cancelBubble=true;
}
-},findElement:function(_262,_263){
-var _264=Event.element(_262);
-while(_264.parentNode&&(!_264.tagName||(_264.tagName.toUpperCase()!=_263.toUpperCase()))){
-_264=_264.parentNode;
+},findElement:function(_263,_264){
+var _265=Event.element(_263);
+while(_265.parentNode&&(!_265.tagName||(_265.tagName.toUpperCase()!=_264.toUpperCase()))){
+_265=_265.parentNode;
}
-return _264;
-},observers:false,_observeAndCache:function(_265,name,_266,_267){
+return _265;
+},observers:false,_observeAndCache:function(_266,name,_267,_268){
if(!this.observers){
this.observers=[];
}
-if(_265.addEventListener){
-this.observers.push([_265,name,_266,_267]);
-_265.addEventListener(name,_266,_267);
+if(_266.addEventListener){
+this.observers.push([_266,name,_267,_268]);
+_266.addEventListener(name,_267,_268);
}else{
-if(_265.attachEvent){
-this.observers.push([_265,name,_266,_267]);
-_265.attachEvent("on"+name,_266);
+if(_266.attachEvent){
+this.observers.push([_266,name,_267,_268]);
+_266.attachEvent("on"+name,_267);
}
}
},unloadCache:function(){
@@ -1082,24 +1084,24 @@ Event.stopObserving.apply(this,Event.observers[i]);
Event.observers[i][0]=null;
}
Event.observers=false;
-},observe:function(_268,name,_269,_270){
-var _268=$(_268);
-_270=_270||false;
-if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_268.attachEvent)){
+},observe:function(_269,name,_270,_271){
+var _269=$(_269);
+_271=_271||false;
+if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_269.attachEvent)){
name="keydown";
}
-this._observeAndCache(_268,name,_269,_270);
-},stopObserving:function(_271,name,_272,_273){
-var _271=$(_271);
-_273=_273||false;
-if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_271.detachEvent)){
+this._observeAndCache(_269,name,_270,_271);
+},stopObserving:function(_272,name,_273,_274){
+var _272=$(_272);
+_274=_274||false;
+if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_272.detachEvent)){
name="keydown";
}
-if(_271.removeEventListener){
-_271.removeEventListener(name,_272,_273);
+if(_272.removeEventListener){
+_272.removeEventListener(name,_273,_274);
}else{
-if(_271.detachEvent){
-_271.detachEvent("on"+name,_272);
+if(_272.detachEvent){
+_272.detachEvent("on"+name,_273);
}
}
}});
@@ -1107,37 +1109,38 @@ Event.observe(window,"unload",Event.unloadCache,false);
Object.extend(Event,{OnLoad:function(fn){
var w=document.addEventListener&&!window.addEventListener?document:window;
Event.__observe(w,"load",fn);
-},observe:function(_276,name,_277,_278){
-if(!isList(_276)){
-return this.__observe(_276,name,_277,_278);
+},observe:function(_277,name,_278,_279){
+if(!isList(_277)){
+return this.__observe(_277,name,_278,_279);
}
-for(var i=0;i<_276.length;i++){
-this.__observe(_276[i],name,_277,_278);
+for(var i=0;i<_277.length;i++){
+this.__observe(_277[i],name,_278,_279);
}
-},__observe:function(_279,name,_280,_281){
-var _279=$(_279);
-_281=_281||false;
-if(name=="keypress"&&((navigator.appVersion.indexOf("AppleWebKit")>0)||_279.attachEvent)){
+},__observe:function(_280,name,_281,_282){
+var _280=$(_280);
+_282=_282||false;
+if(name=="keypress"&&((navigator.appVersion.indexOf("AppleWebKit")>0)||_280.attachEvent)){
name="keydown";
}
-this._observeAndCache(_279,name,_280,_281);
+this._observeAndCache(_280,name,_281,_282);
},keyCode:function(e){
return e.keyCode!=null?e.keyCode:e.charCode;
},isHTMLEvent:function(type){
-var _284=["abort","blur","change","error","focus","load","reset","resize","scroll","select","submit","unload"];
-return _284.include(type);
-},isMouseEvent:function(type){
-var _285=["click","mousedown","mousemove","mouseout","mouseover","mouseup"];
+var _285=["abort","blur","change","error","focus","load","reset","resize","scroll","select","submit","unload"];
return _285.include(type);
-},fireEvent:function(_286,type){
+},isMouseEvent:function(type){
+var _286=["click","mousedown","mousemove","mouseout","mouseover","mouseup"];
+return _286.include(type);
+},fireEvent:function(_287,type){
+_287=$(_287);
if(document.createEvent){
if(Event.isHTMLEvent(type)){
-var _287=document.createEvent("HTMLEvents");
-_287.initEvent(type,true,true);
+var _288=document.createEvent("HTMLEvents");
+_288.initEvent(type,true,true);
}else{
if(Event.isMouseEvent(type)){
-var _287=document.createEvent("MouseEvents");
-_287.initMouseEvent(type,true,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);
+var _288=document.createEvent("MouseEvents");
+_288.initMouseEvent(type,true,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);
}else{
if(Logger){
Logger.error("undefined event",type);
@@ -1145,263 +1148,263 @@ Logger.error("undefined event",type);
return;
}
}
-_286.dispatchEvent(_287);
+_287.dispatchEvent(_288);
}else{
-if(_286.fireEvent){
-_286.fireEvent("on"+type);
-_286[type]();
+if(_287.fireEvent){
+_287.fireEvent("on"+type);
+_287[type]();
}else{
-_286[type]();
+_287[type]();
}
}
}});
var Position={includeScrollOffsets:false,prepare:function(){
this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;
-},realOffset:function(_288){
-var _289=0,valueL=0;
+},realOffset:function(_289){
+var _290=0,valueL=0;
do{
-_289+=_288.scrollTop||0;
-valueL+=_288.scrollLeft||0;
-_288=_288.parentNode;
-}while(_288);
-return [valueL,_289];
-},cumulativeOffset:function(_290){
-var _291=0,valueL=0;
+_290+=_289.scrollTop||0;
+valueL+=_289.scrollLeft||0;
+_289=_289.parentNode;
+}while(_289);
+return [valueL,_290];
+},cumulativeOffset:function(_291){
+var _292=0,valueL=0;
do{
-_291+=_290.offsetTop||0;
-valueL+=_290.offsetLeft||0;
-_290=_290.offsetParent;
-}while(_290);
-return [valueL,_291];
-},positionedOffset:function(_292){
-var _293=0,valueL=0;
+_292+=_291.offsetTop||0;
+valueL+=_291.offsetLeft||0;
+_291=_291.offsetParent;
+}while(_291);
+return [valueL,_292];
+},positionedOffset:function(_293){
+var _294=0,valueL=0;
do{
-_293+=_292.offsetTop||0;
-valueL+=_292.offsetLeft||0;
-_292=_292.offsetParent;
-if(_292){
-p=Element.getStyle(_292,"position");
+_294+=_293.offsetTop||0;
+valueL+=_293.offsetLeft||0;
+_293=_293.offsetParent;
+if(_293){
+p=Element.getStyle(_293,"position");
if(p=="relative"||p=="absolute"){
break;
}
}
-}while(_292);
-return [valueL,_293];
-},offsetParent:function(_294){
-if(_294.offsetParent){
-return _294.offsetParent;
+}while(_293);
+return [valueL,_294];
+},offsetParent:function(_295){
+if(_295.offsetParent){
+return _295.offsetParent;
}
-if(_294==document.body){
-return _294;
+if(_295==document.body){
+return _295;
}
-while((_294=_294.parentNode)&&_294!=document.body){
-if(Element.getStyle(_294,"position")!="static"){
-return _294;
+while((_295=_295.parentNode)&&_295!=document.body){
+if(Element.getStyle(_295,"position")!="static"){
+return _295;
}
}
return document.body;
-},within:function(_295,x,y){
+},within:function(_296,x,y){
if(this.includeScrollOffsets){
-return this.withinIncludingScrolloffsets(_295,x,y);
+return this.withinIncludingScrolloffsets(_296,x,y);
}
this.xcomp=x;
this.ycomp=y;
-this.offset=this.cumulativeOffset(_295);
-return (y>=this.offset[1]&&y<this.offset[1]+_295.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+_295.offsetWidth);
-},withinIncludingScrolloffsets:function(_297,x,y){
-var _298=this.realOffset(_297);
-this.xcomp=x+_298[0]-this.deltaX;
-this.ycomp=y+_298[1]-this.deltaY;
-this.offset=this.cumulativeOffset(_297);
-return (this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+_297.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+_297.offsetWidth);
-},overlap:function(mode,_300){
+this.offset=this.cumulativeOffset(_296);
+return (y>=this.offset[1]&&y<this.offset[1]+_296.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+_296.offsetWidth);
+},withinIncludingScrolloffsets:function(_298,x,y){
+var _299=this.realOffset(_298);
+this.xcomp=x+_299[0]-this.deltaX;
+this.ycomp=y+_299[1]-this.deltaY;
+this.offset=this.cumulativeOffset(_298);
+return (this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+_298.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+_298.offsetWidth);
+},overlap:function(mode,_301){
if(!mode){
return 0;
}
if(mode=="vertical"){
-return ((this.offset[1]+_300.offsetHeight)-this.ycomp)/_300.offsetHeight;
+return ((this.offset[1]+_301.offsetHeight)-this.ycomp)/_301.offsetHeight;
}
if(mode=="horizontal"){
-return ((this.offset[0]+_300.offsetWidth)-this.xcomp)/_300.offsetWidth;
+return ((this.offset[0]+_301.offsetWidth)-this.xcomp)/_301.offsetWidth;
}
-},clone:function(_301,_302){
-_301=$(_301);
+},clone:function(_302,_303){
_302=$(_302);
-_302.style.position="absolute";
-var _303=this.cumulativeOffset(_301);
-_302.style.top=_303[1]+"px";
-_302.style.left=_303[0]+"px";
-_302.style.width=_301.offsetWidth+"px";
-_302.style.height=_301.offsetHeight+"px";
-},page:function(_304){
-var _305=0,valueL=0;
-var _306=_304;
+_303=$(_303);
+_303.style.position="absolute";
+var _304=this.cumulativeOffset(_302);
+_303.style.top=_304[1]+"px";
+_303.style.left=_304[0]+"px";
+_303.style.width=_302.offsetWidth+"px";
+_303.style.height=_302.offsetHeight+"px";
+},page:function(_305){
+var _306=0,valueL=0;
+var _307=_305;
do{
-_305+=_306.offsetTop||0;
-valueL+=_306.offsetLeft||0;
-if(_306.offsetParent==document.body){
-if(Element.getStyle(_306,"position")=="absolute"){
+_306+=_307.offsetTop||0;
+valueL+=_307.offsetLeft||0;
+if(_307.offsetParent==document.body){
+if(Element.getStyle(_307,"position")=="absolute"){
break;
}
}
-}while(_306=_306.offsetParent);
-_306=_304;
+}while(_307=_307.offsetParent);
+_307=_305;
do{
-_305-=_306.scrollTop||0;
-valueL-=_306.scrollLeft||0;
-}while(_306=_306.parentNode);
-return [valueL,_305];
-},clone:function(_307,_308){
-var _309=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
-_307=$(_307);
-var p=Position.page(_307);
+_306-=_307.scrollTop||0;
+valueL-=_307.scrollLeft||0;
+}while(_307=_307.parentNode);
+return [valueL,_306];
+},clone:function(_308,_309){
+var _310=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
_308=$(_308);
-var _310=[0,0];
-var _311=null;
-if(Element.getStyle(_308,"position")=="absolute"){
-_311=Position.offsetParent(_308);
-_310=Position.page(_311);
+var p=Position.page(_308);
+_309=$(_309);
+var _311=[0,0];
+var _312=null;
+if(Element.getStyle(_309,"position")=="absolute"){
+_312=Position.offsetParent(_309);
+_311=Position.page(_312);
}
-if(_311==document.body){
-_310[0]-=document.body.offsetLeft;
-_310[1]-=document.body.offsetTop;
+if(_312==document.body){
+_311[0]-=document.body.offsetLeft;
+_311[1]-=document.body.offsetTop;
}
-if(_309.setLeft){
-_308.style.left=(p[0]-_310[0]+_309.offsetLeft)+"px";
+if(_310.setLeft){
+_309.style.left=(p[0]-_311[0]+_310.offsetLeft)+"px";
}
-if(_309.setTop){
-_308.style.top=(p[1]-_310[1]+_309.offsetTop)+"px";
+if(_310.setTop){
+_309.style.top=(p[1]-_311[1]+_310.offsetTop)+"px";
}
-if(_309.setWidth){
-_308.style.width=_307.offsetWidth+"px";
+if(_310.setWidth){
+_309.style.width=_308.offsetWidth+"px";
}
-if(_309.setHeight){
-_308.style.height=_307.offsetHeight+"px";
+if(_310.setHeight){
+_309.style.height=_308.offsetHeight+"px";
}
-},absolutize:function(_312){
-_312=$(_312);
-if(_312.style.position=="absolute"){
+},absolutize:function(_313){
+_313=$(_313);
+if(_313.style.position=="absolute"){
return;
}
Position.prepare();
-var _313=Position.positionedOffset(_312);
-var top=_313[1];
-var left=_313[0];
-var _315=_312.clientWidth;
-var _316=_312.clientHeight;
-_312._originalLeft=left-parseFloat(_312.style.left||0);
-_312._originalTop=top-parseFloat(_312.style.top||0);
-_312._originalWidth=_312.style.width;
-_312._originalHeight=_312.style.height;
-_312.style.position="absolute";
-_312.style.top=top+"px";
-_312.style.left=left+"px";
-_312.style.width=_315+"px";
-_312.style.height=_316+"px";
-},relativize:function(_317){
-_317=$(_317);
-if(_317.style.position=="relative"){
+var _314=Position.positionedOffset(_313);
+var top=_314[1];
+var left=_314[0];
+var _316=_313.clientWidth;
+var _317=_313.clientHeight;
+_313._originalLeft=left-parseFloat(_313.style.left||0);
+_313._originalTop=top-parseFloat(_313.style.top||0);
+_313._originalWidth=_313.style.width;
+_313._originalHeight=_313.style.height;
+_313.style.position="absolute";
+_313.style.top=top+"px";
+_313.style.left=left+"px";
+_313.style.width=_316+"px";
+_313.style.height=_317+"px";
+},relativize:function(_318){
+_318=$(_318);
+if(_318.style.position=="relative"){
return;
}
Position.prepare();
-_317.style.position="relative";
-var top=parseFloat(_317.style.top||0)-(_317._originalTop||0);
-var left=parseFloat(_317.style.left||0)-(_317._originalLeft||0);
-_317.style.top=top+"px";
-_317.style.left=left+"px";
-_317.style.height=_317._originalHeight;
-_317.style.width=_317._originalWidth;
+_318.style.position="relative";
+var top=parseFloat(_318.style.top||0)-(_318._originalTop||0);
+var left=parseFloat(_318.style.left||0)-(_318._originalLeft||0);
+_318.style.top=top+"px";
+_318.style.left=left+"px";
+_318.style.height=_318._originalHeight;
+_318.style.width=_318._originalWidth;
}};
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
-Position.cumulativeOffset=function(_318){
-var _319=0,valueL=0;
+Position.cumulativeOffset=function(_319){
+var _320=0,valueL=0;
do{
-_319+=_318.offsetTop||0;
-valueL+=_318.offsetLeft||0;
-if(_318.offsetParent==document.body){
-if(Element.getStyle(_318,"position")=="absolute"){
+_320+=_319.offsetTop||0;
+valueL+=_319.offsetLeft||0;
+if(_319.offsetParent==document.body){
+if(Element.getStyle(_319,"position")=="absolute"){
break;
}
}
-_318=_318.offsetParent;
-}while(_318);
-return [valueL,_319];
+_319=_319.offsetParent;
+}while(_319);
+return [valueL,_320];
};
}
-var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(_320){
-_320=_320.toUpperCase();
-var _321=this.NODEMAP[_320]||"div";
-var _322=document.createElement(_321);
+var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(_321){
+_321=_321.toUpperCase();
+var _322=this.NODEMAP[_321]||"div";
+var _323=document.createElement(_322);
try{
-_322.innerHTML="<"+_320+"></"+_320+">";
+_323.innerHTML="<"+_321+"></"+_321+">";
}
catch(e){
}
-var _323=_322.firstChild||null;
-if(_323&&(_323.tagName!=_320)){
-_323=_323.getElementsByTagName(_320)[0];
+var _324=_323.firstChild||null;
+if(_324&&(_324.tagName!=_321)){
+_324=_324.getElementsByTagName(_321)[0];
}
-if(!_323){
-_323=document.createElement(_320);
+if(!_324){
+_324=document.createElement(_321);
}
-if(!_323){
+if(!_324){
return;
}
if(arguments[1]){
if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)){
-this._children(_323,arguments[1]);
+this._children(_324,arguments[1]);
}else{
-var _324=this._attributes(arguments[1]);
-if(_324.length){
+var _325=this._attributes(arguments[1]);
+if(_325.length){
try{
-_322.innerHTML="<"+_320+" "+_324+"></"+_320+">";
+_323.innerHTML="<"+_321+" "+_325+"></"+_321+">";
}
catch(e){
}
-_323=_322.firstChild||null;
-if(!_323){
-_323=document.createElement(_320);
+_324=_323.firstChild||null;
+if(!_324){
+_324=document.createElement(_321);
for(attr in arguments[1]){
-_323[attr=="class"?"className":attr]=arguments[1][attr];
+_324[attr=="class"?"className":attr]=arguments[1][attr];
}
}
-if(_323.tagName!=_320){
-_323=_322.getElementsByTagName(_320)[0];
+if(_324.tagName!=_321){
+_324=_323.getElementsByTagName(_321)[0];
}
}
}
}
if(arguments[2]){
-this._children(_323,arguments[2]);
+this._children(_324,arguments[2]);
}
-return _323;
+return _324;
},_text:function(text){
return document.createTextNode(text);
-},_attributes:function(_326){
-var _327=[];
-for(attribute in _326){
-_327.push((attribute=="className"?"class":attribute)+"=\""+_326[attribute].toString().escapeHTML()+"\"");
-}
-return _327.join(" ");
-},_children:function(_328,_329){
-if(typeof _329=="object"){
-_329.flatten().each(function(e){
+},_attributes:function(_327){
+var _328=[];
+for(attribute in _327){
+_328.push((attribute=="className"?"class":attribute)+"=\""+_327[attribute].toString().escapeHTML()+"\"");
+}
+return _328.join(" ");
+},_children:function(_329,_330){
+if(typeof _330=="object"){
+_330.flatten().each(function(e){
if(typeof e=="object"){
-_328.appendChild(e);
+_329.appendChild(e);
}else{
if(Builder._isStringOrNumber(e)){
-_328.appendChild(Builder._text(e));
+_329.appendChild(Builder._text(e));
}
}
});
}else{
-if(Builder._isStringOrNumber(_329)){
-_328.appendChild(Builder._text(_329));
+if(Builder._isStringOrNumber(_330)){
+_329.appendChild(Builder._text(_330));
}
}
-},_isStringOrNumber:function(_330){
-return (typeof _330=="string"||typeof _330=="number");
+},_isStringOrNumber:function(_331){
+return (typeof _331=="string"||typeof _331=="number");
}};
Object.extend(Builder,{exportTags:function(){
var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","CAPTION"];
@@ -1421,7 +1424,7 @@ return Builder.node(tag,args.shift(),args);
});
}});
Builder.exportTags();
-Object.extend(Date.prototype,{SimpleFormat:function(_334,data){
+Object.extend(Date.prototype,{SimpleFormat:function(_335,data){
data=data||{};
var bits=new Array();
bits["d"]=this.getDate();
@@ -1434,11 +1437,11 @@ bits["MMM"]=data.AbbreviatedMonthNames[this.getMonth()];
if(data.MonthNames){
bits["MMMM"]=data.MonthNames[this.getMonth()];
}
-var _337=""+this.getFullYear();
-_337=(_337.length==2)?"19"+_337:_337;
-bits["yyyy"]=_337;
+var _338=""+this.getFullYear();
+_338=(_338.length==2)?"19"+_338:_338;
+bits["yyyy"]=_338;
bits["yy"]=bits["yyyy"].toString().substr(2,2);
-var frm=new String(_334);
+var frm=new String(_335);
for(var sect in bits){
var reg=new RegExp("\\b"+sect+"\\b","g");
frm=frm.replace(reg,bits[sect]);
@@ -1450,70 +1453,70 @@ var m=String(this.getMonth()+1).zerofill(2);
var d=String(this.getDate()).zerofill(2);
return String(y)+String(m)+String(d);
}});
-Object.extend(Date,{SimpleParse:function(_341,_342){
-val=String(_341);
-_342=String(_342);
+Object.extend(Date,{SimpleParse:function(_342,_343){
+val=String(_342);
+_343=String(_343);
if(val.length<=0){
return null;
}
-if(_342.length<=0){
-return new Date(_341);
+if(_343.length<=0){
+return new Date(_342);
}
-var _343=function(val){
-var _345="1234567890";
+var _344=function(val){
+var _346="1234567890";
for(var i=0;i<val.length;i++){
-if(_345.indexOf(val.charAt(i))==-1){
+if(_346.indexOf(val.charAt(i))==-1){
return false;
}
}
return true;
};
-var _346=function(str,i,_348,_349){
-for(var x=_349;x>=_348;x--){
-var _350=str.substring(i,i+x);
-if(_350.length<_348){
+var _347=function(str,i,_349,_350){
+for(var x=_350;x>=_349;x--){
+var _351=str.substring(i,i+x);
+if(_351.length<_349){
return null;
}
-if(_343(_350)){
-return _350;
+if(_344(_351)){
+return _351;
}
}
return null;
};
-var _351=0;
var _352=0;
+var _353=0;
var c="";
-var _354="";
var _355="";
+var _356="";
var x,y;
var now=new Date();
var year=now.getFullYear();
-var _358=now.getMonth()+1;
+var _359=now.getMonth()+1;
var date=1;
-while(_352<_342.length){
-c=_342.charAt(_352);
-_354="";
-while((_342.charAt(_352)==c)&&(_352<_342.length)){
-_354+=_342.charAt(_352++);
-}
-if(_354=="yyyy"||_354=="yy"||_354=="y"){
-if(_354=="yyyy"){
+while(_353<_343.length){
+c=_343.charAt(_353);
+_355="";
+while((_343.charAt(_353)==c)&&(_353<_343.length)){
+_355+=_343.charAt(_353++);
+}
+if(_355=="yyyy"||_355=="yy"||_355=="y"){
+if(_355=="yyyy"){
x=4;
y=4;
}
-if(_354=="yy"){
+if(_355=="yy"){
x=2;
y=2;
}
-if(_354=="y"){
+if(_355=="y"){
x=2;
y=4;
}
-year=_346(val,_351,x,y);
+year=_347(val,_352,x,y);
if(year==null){
return null;
}
-_351+=year.length;
+_352+=year.length;
if(year.length==2){
if(year>70){
year=1900+(year-0);
@@ -1522,33 +1525,33 @@ year=2000+(year-0);
}
}
}else{
-if(_354=="MM"||_354=="M"){
-_358=_346(val,_351,_354.length,2);
-if(_358==null||(_358<1)||(_358>12)){
+if(_355=="MM"||_355=="M"){
+_359=_347(val,_352,_355.length,2);
+if(_359==null||(_359<1)||(_359>12)){
return null;
}
-_351+=_358.length;
+_352+=_359.length;
}else{
-if(_354=="dd"||_354=="d"){
-date=_346(val,_351,_354.length,2);
+if(_355=="dd"||_355=="d"){
+date=_347(val,_352,_355.length,2);
if(date==null||(date<1)||(date>31)){
return null;
}
-_351+=date.length;
+_352+=date.length;
}else{
-if(val.substring(_351,_351+_354.length)!=_354){
+if(val.substring(_352,_352+_355.length)!=_355){
return null;
}else{
-_351+=_354.length;
+_352+=_355.length;
}
}
}
}
}
-if(_351!=val.length){
+if(_352!=val.length){
return null;
}
-if(_358==2){
+if(_359==2){
if(((year%4==0)&&(year%100!=0))||(year%400==0)){
if(date>29){
return null;
@@ -1559,18 +1562,18 @@ return null;
}
}
}
-if((_358==4)||(_358==6)||(_358==9)||(_358==11)){
+if((_359==4)||(_359==6)||(_359==9)||(_359==11)){
if(date>30){
return null;
}
}
-var _360=new Date(year,_358-1,date,0,0,0);
-return _360;
+var _361=new Date(year,_359-1,date,0,0,0);
+return _361;
}});
var Prado={Version:"3.0a",Browser:function(){
var info={Version:"1.0"};
-var _362=parseInt(navigator.appVersion);
-info.nver=_362;
+var _363=parseInt(navigator.appVersion);
+info.nver=_363;
info.ver=navigator.appVersion;
info.agent=navigator.userAgent;
info.dom=document.getElementById?1:0;
@@ -1581,7 +1584,7 @@ info.ie4=(document.all&&!info.dom&&!info.opera)?1:0;
info.ie=info.ie4||info.ie5||info.ie6;
info.mac=info.agent.indexOf("Mac")>-1;
info.ns6=(info.dom&&parseInt(info.ver)>=5)?1:0;
-info.ie3=(info.ver.indexOf("MSIE")&&(_362<4));
+info.ie3=(info.ver.indexOf("MSIE")&&(_363<4));
info.hotjava=(info.agent.toLowerCase().indexOf("hotjava")!=-1)?1:0;
info.ns4=(document.layers&&!info.dom&&!info.hotjava)?1:0;
info.bw=(info.ie6||info.ie5||info.ie4||info.ns4||info.ns6||info.opera);
@@ -1589,13 +1592,13 @@ info.ver3=(info.hotjava||info.ie3);
info.opera7=((info.agent.toLowerCase().indexOf("opera 7")>-1)||(info.agent.toLowerCase().indexOf("opera/7")>-1));
info.operaOld=info.opera&&!info.opera7;
return info;
-},ImportCss:function(doc,_364){
+},ImportCss:function(doc,_365){
if(Prado.Browser().ie){
-var _365=doc.createStyleSheet(_364);
+var _366=doc.createStyleSheet(_365);
}else{
var elm=doc.createElement("link");
elm.rel="stylesheet";
-elm.href=_364;
+elm.href=_365;
if(headArr=doc.getElementsByTagName("head")){
headArr[0].appendChild(elm);
}
@@ -1603,50 +1606,50 @@ headArr[0].appendChild(elm);
}};
Prado.Focus=Class.create();
Prado.Focus.setFocus=function(id){
-var _368=document.getElementById?document.getElementById(id):document.all[id];
-if(_368&&!Prado.Focus.canFocusOn(_368)){
-_368=Prado.Focus.findTarget(_368);
+var _369=document.getElementById?document.getElementById(id):document.all[id];
+if(_369&&!Prado.Focus.canFocusOn(_369)){
+_369=Prado.Focus.findTarget(_369);
}
-if(_368){
+if(_369){
try{
-_368.focus();
-_368.scrollIntoView(false);
+_369.focus();
+_369.scrollIntoView(false);
if(window.__smartNav){
-window.__smartNav.ae=_368.id;
+window.__smartNav.ae=_369.id;
}
}
catch(e){
}
}
};
-Prado.Focus.canFocusOn=function(_369){
-if(!_369||!(_369.tagName)){
+Prado.Focus.canFocusOn=function(_370){
+if(!_370||!(_370.tagName)){
return false;
}
-var _370=_369.tagName.toLowerCase();
-return !_369.disabled&&(!_369.type||_369.type.toLowerCase()!="hidden")&&Prado.Focus.isFocusableTag(_370)&&Prado.Focus.isVisible(_369);
+var _371=_370.tagName.toLowerCase();
+return !_370.disabled&&(!_370.type||_370.type.toLowerCase()!="hidden")&&Prado.Focus.isFocusableTag(_371)&&Prado.Focus.isVisible(_370);
};
-Prado.Focus.isFocusableTag=function(_371){
-return (_371=="input"||_371=="textarea"||_371=="select"||_371=="button"||_371=="a");
+Prado.Focus.isFocusableTag=function(_372){
+return (_372=="input"||_372=="textarea"||_372=="select"||_372=="button"||_372=="a");
};
-Prado.Focus.findTarget=function(_372){
-if(!_372||!(_372.tagName)){
+Prado.Focus.findTarget=function(_373){
+if(!_373||!(_373.tagName)){
return null;
}
-var _373=_372.tagName.toLowerCase();
-if(_373=="undefined"){
+var _374=_373.tagName.toLowerCase();
+if(_374=="undefined"){
return null;
}
-var _374=_372.childNodes;
-if(_374){
-for(var i=0;i<_374.length;i++){
+var _375=_373.childNodes;
+if(_375){
+for(var i=0;i<_375.length;i++){
try{
-if(Prado.Focus.canFocusOn(_374[i])){
-return _374[i];
+if(Prado.Focus.canFocusOn(_375[i])){
+return _375[i];
}else{
-var _375=Prado.Focus.findTarget(_374[i]);
-if(_375){
-return _375;
+var _376=Prado.Focus.findTarget(_375[i]);
+if(_376){
+return _376;
}
}
}
@@ -1656,75 +1659,75 @@ catch(e){
}
return null;
};
-Prado.Focus.isVisible=function(_376){
-var _377=_376;
-while((typeof (_377)!="undefined")&&(_377!=null)){
-if(_377.disabled||(typeof (_377.style)!="undefined"&&((typeof (_377.style.display)!="undefined"&&_377.style.display=="none")||(typeof (_377.style.visibility)!="undefined"&&_377.style.visibility=="hidden")))){
+Prado.Focus.isVisible=function(_377){
+var _378=_377;
+while((typeof (_378)!="undefined")&&(_378!=null)){
+if(_378.disabled||(typeof (_378.style)!="undefined"&&((typeof (_378.style.display)!="undefined"&&_378.style.display=="none")||(typeof (_378.style.visibility)!="undefined"&&_378.style.visibility=="hidden")))){
return false;
}
-if(typeof (_377.parentNode)!="undefined"&&_377.parentNode!=null&&_377.parentNode!=_377&&_377.parentNode.tagName.toLowerCase()!="body"){
-_377=_377.parentNode;
+if(typeof (_378.parentNode)!="undefined"&&_378.parentNode!=null&&_378.parentNode!=_378&&_378.parentNode.tagName.toLowerCase()!="body"){
+_378=_378.parentNode;
}else{
return true;
}
}
return true;
};
-Prado.PostBack=function(_378,_379){
-var form=$(_379["FormID"]);
-var _380=true;
-if(_379["CausesValidation"]&&Prado.Validation){
-if(_379["ValidationGroup"]){
-Prado.Validation.SetActiveGroup(Event.element(_378),_379["ValidationGroup"]);
+Prado.PostBack=function(_379,_380){
+var form=$(_380["FormID"]);
+var _381=true;
+if(_380["CausesValidation"]&&Prado.Validation){
+if(_380["ValidationGroup"]){
+Prado.Validation.SetActiveGroup(Event.element(_379),_380["ValidationGroup"]);
}else{
Prado.Validation.SetActiveGroup(null,null);
}
if(Prado.Validation.IsValid(form)==false){
-if(_379["StopEvent"]){
-Event.stop(_378);
+if(_380["StopEvent"]){
+Event.stop(_379);
}
return;
}
}
-if(_379["PostBackUrl"]&&_379["PostBackUrl"].length>0){
-form.action=_379["PostBackUrl"];
+if(_380["PostBackUrl"]&&_380["PostBackUrl"].length>0){
+form.action=_380["PostBackUrl"];
}
-if(_379["TrackFocus"]){
-var _381=$("PRADO_LASTFOCUS");
-if(_381){
-var _382=document.activeElement;
+if(_380["TrackFocus"]){
+var _382=$("PRADO_LASTFOCUS");
if(_382){
-_381.value=_382.id;
+var _383=document.activeElement;
+if(_383){
+_382.value=_383.id;
}else{
-_381.value=_379["EventTarget"];
+_382.value=_380["EventTarget"];
}
}
}
-$("PRADO_POSTBACK_TARGET").value=_379["EventTarget"];
-$("PRADO_POSTBACK_PARAMETER").value=_379["EventParameter"];
+$("PRADO_POSTBACK_TARGET").value=_380["EventTarget"];
+$("PRADO_POSTBACK_PARAMETER").value=_380["EventParameter"];
Event.fireEvent(form,"submit");
-if(_379["StopEvent"]){
-Event.stop(_378);
+if(_380["StopEvent"]){
+Event.stop(_379);
}
};
-Prado.Element={setValue:function(_383,_384){
-var el=$(_383);
+Prado.Element={setValue:function(_384,_385){
+var el=$(_384);
if(el&&typeof (el.value)!="undefined"){
-el.value=_384;
+el.value=_385;
}
-},select:function(_386,_387,_388){
-var el=$(_386);
-var _389=_386.indexOf("[]")>-1;
-if(!el&&!_389){
+},select:function(_387,_388,_389){
+var el=$(_387);
+var _390=_387.indexOf("[]")>-1;
+if(!el&&!_390){
return;
}
-_387=_389?"check"+_387:el.tagName.toLowerCase()+_387;
-var _390=Prado.Element.Selection;
-if(isFunction(_390[_387])){
-_390[_387](_389?_386:el,_388);
+_388=_390?"check"+_388:el.tagName.toLowerCase()+_388;
+var _391=Prado.Element.Selection;
+if(isFunction(_391[_388])){
+_391[_388](_390?_387:el,_389);
}
-},click:function(_391){
-var el=$(_391);
+},click:function(_392){
+var el=$(_392);
if(!el){
return;
}
@@ -1740,25 +1743,25 @@ el.onclick();
}
}
}
-},setAttribute:function(_393,_394,_395){
-var el=$(_393);
-if(_394=="disabled"&&_395==false){
-el.removeAttribute(_394);
+},setAttribute:function(_394,_395,_396){
+var el=$(_394);
+if(_395=="disabled"&&_396==false){
+el.removeAttribute(_395);
}else{
-el.setAttribute(_394,_395);
+el.setAttribute(_395,_396);
}
-},setOptions:function(_396,_397){
-var el=$(_396);
+},setOptions:function(_397,_398){
+var el=$(_397);
if(el&&el.tagName.toLowerCase()=="select"){
while(el.length>0){
el.remove(0);
}
-for(var i=0;i<_397.length;i++){
-el.options[el.options.length]=new Option(_397[i][0],_397[i][1]);
+for(var i=0;i<_398.length;i++){
+el.options[el.options.length]=new Option(_398[i][0],_398[i][1]);
}
}
-},focus:function(_398){
-var obj=$(_398);
+},focus:function(_399){
+var obj=$(_399);
if(isObject(obj)&&isdef(obj.focus)){
setTimeout(function(){
obj.focus();
@@ -1766,22 +1769,22 @@ obj.focus();
}
return false;
}};
-Prado.Element.Selection={inputValue:function(el,_400){
+Prado.Element.Selection={inputValue:function(el,_401){
switch(el.type.toLowerCase()){
case "checkbox":
case "radio":
-return el.checked=_400;
+return el.checked=_401;
}
-},selectValue:function(el,_401){
-$A(el.options).each(function(_402){
-_402.selected=_402.value==_401;
+},selectValue:function(el,_402){
+$A(el.options).each(function(_403){
+_403.selected=_403.value==_402;
});
-},selectIndex:function(el,_403){
+},selectIndex:function(el,_404){
if(el.type=="select-one"){
-el.selectedIndex=_403;
+el.selectedIndex=_404;
}else{
for(var i=0;i<el.length;i++){
-if(i==_403){
+if(i==_404){
el.options[i].selected=true;
}
}
@@ -1789,23 +1792,23 @@ el.options[i].selected=true;
},selectClear:function(el){
el.selectedIndex=-1;
},selectAll:function(el){
-$A(el.options).each(function(_404){
-_404.selected=true;
-Logger.warn(_404.value);
+$A(el.options).each(function(_405){
+_405.selected=true;
+Logger.warn(_405.value);
});
},selectInvert:function(el){
-$A(el.options).each(function(_405){
-_405.selected=!_405.selected;
+$A(el.options).each(function(_406){
+_406.selected=!_406.selected;
});
-},checkValue:function(name,_406){
+},checkValue:function(name,_407){
$A(document.getElementsByName(name)).each(function(el){
-el.checked=el.value==_406;
+el.checked=el.value==_407;
});
-},checkIndex:function(name,_407){
-var _408=$A(document.getElementsByName(name));
-for(var i=0;i<_408.length;i++){
-if(i==_407){
-_408[i].checked=true;
+},checkIndex:function(name,_408){
+var _409=$A(document.getElementsByName(name));
+for(var i=0;i<_409.length;i++){
+if(i==_408){
+_409[i].checked=true;
}
}
},checkClear:function(name){
@@ -1821,62 +1824,62 @@ $A(document.getElementsByName(name)).each(function(el){
el.checked=!el.checked;
});
}};
-Object.extend(Prado.Element,{Insert:{After:function(_409,_410){
-new Insertion.After(_409,_410);
-},Before:function(_411,_412){
-new Insertion.Before(_411.innerHTML);
-},Below:function(_413,_414){
-new Insertion.Bottom(_413,_414);
-},Above:function(_415,_416){
-new Insertion.Top(_415,_416);
-}},CssClass:{set:function(_417,_418){
-_417=new Element.ClassNames(_417);
-_417.set(_418);
+Object.extend(Prado.Element,{Insert:{After:function(_410,_411){
+new Insertion.After(_410,_411);
+},Before:function(_412,_413){
+new Insertion.Before(_412.innerHTML);
+},Below:function(_414,_415){
+new Insertion.Bottom(_414,_415);
+},Above:function(_416,_417){
+new Insertion.Top(_416,_417);
+}},CssClass:{set:function(_418,_419){
+_418=new Element.ClassNames(_418);
+_418.set(_419);
}}});
Prado.WebUI=Class.create();
Prado.WebUI.PostBackControl=Class.create();
-Object.extend(Prado.WebUI.PostBackControl.prototype,{initialize:function(_419){
-this.element=$(_419["ID"]);
-if(_419["CausesValidation"]&&Prado.Validation){
-Prado.Validation.AddTarget(_419["ID"],_419["ValidationGroup"]);
+Object.extend(Prado.WebUI.PostBackControl.prototype,{initialize:function(_420){
+this.element=$(_420["ID"]);
+if(_420["CausesValidation"]&&Prado.Validation){
+Prado.Validation.AddTarget(_420["ID"],_420["ValidationGroup"]);
}
if(this.onInit){
-this.onInit(_419);
+this.onInit(_420);
}
}});
-Prado.WebUI.createPostBackComponent=function(_420){
-var _421=Class.create();
-Object.extend(_421.prototype,Prado.WebUI.PostBackControl.prototype);
-if(_420){
-Object.extend(_421.prototype,_420);
+Prado.WebUI.createPostBackComponent=function(_421){
+var _422=Class.create();
+Object.extend(_422.prototype,Prado.WebUI.PostBackControl.prototype);
+if(_421){
+Object.extend(_422.prototype,_421);
}
-return _421;
+return _422;
};
Prado.WebUI.TButton=Prado.WebUI.createPostBackComponent();
-Prado.WebUI.ClickableComponent=Prado.WebUI.createPostBackComponent({_elementOnClick:null,onInit:function(_422){
+Prado.WebUI.ClickableComponent=Prado.WebUI.createPostBackComponent({_elementOnClick:null,onInit:function(_423){
if(isFunction(this.element.onclick)){
this._elementOnClick=this.element.onclick;
this.element.onclick=null;
}
-Event.observe(this.element,"click",this.onClick.bindEvent(this,_422));
-},onClick:function(_423,_424){
-var src=Event.element(_423);
-var _426=true;
-var _427=null;
+Event.observe(this.element,"click",this.onClick.bindEvent(this,_423));
+},onClick:function(_424,_425){
+var src=Event.element(_424);
+var _427=true;
+var _428=null;
if(this._elementOnClick){
-var _427=this._elementOnClick(_423);
-if(isBoolean(_427)){
-_426=_427;
+var _428=this._elementOnClick(_424);
+if(isBoolean(_428)){
+_427=_428;
}
}
-if(_426){
-this.onPostBack(_423,_424);
+if(_427){
+this.onPostBack(_424,_425);
}
-if(isBoolean(_427)&&!_427){
-Event.stop(_423);
+if(isBoolean(_428)&&!_428){
+Event.stop(_424);
}
-},onPostBack:function(_428,_429){
-Prado.PostBack(_428,_429);
+},onPostBack:function(_429,_430){
+Prado.PostBack(_429,_430);
}});
Prado.WebUI.TLinkButton=Prado.WebUI.ClickableComponent;
Prado.WebUI.TImageButton=Prado.WebUI.ClickableComponent;
@@ -1884,44 +1887,44 @@ Prado.WebUI.TCheckBox=Prado.WebUI.ClickableComponent;
Prado.WebUI.TBulletedList=Prado.WebUI.ClickableComponent;
Prado.WebUI.TRadioButton=Prado.WebUI.createPostBackComponent(Prado.WebUI.ClickableComponent.prototype);
Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize=Prado.WebUI.TRadioButton.prototype.initialize;
-Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(_430){
-this.element=$(_430["ID"]);
+Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(_431){
+this.element=$(_431["ID"]);
if(!this.element.checked){
-this.onRadioButtonInitialize(_430);
+this.onRadioButtonInitialize(_431);
}
}});
-Prado.WebUI.TTextBox=Prado.WebUI.createPostBackComponent({onInit:function(_431){
-if(_431["TextMode"]!="MultiLine"){
+Prado.WebUI.TTextBox=Prado.WebUI.createPostBackComponent({onInit:function(_432){
+if(_432["TextMode"]!="MultiLine"){
Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));
}
-Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_431));
+Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_432));
},handleReturnKey:function(e){
if(Event.keyCode(e)==Event.KEY_RETURN){
-var _432=Event.element(e);
-if(_432){
-Event.fireEvent(_432,"change");
+var _433=Event.element(e);
+if(_433){
+Event.fireEvent(_433,"change");
Event.stop(e);
}
}
}});
-Prado.WebUI.TListControl=Prado.WebUI.createPostBackComponent({onInit:function(_433){
-Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_433));
+Prado.WebUI.TListControl=Prado.WebUI.createPostBackComponent({onInit:function(_434){
+Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_434));
}});
Prado.WebUI.TListBox=Prado.WebUI.TListControl;
Prado.WebUI.TDropDownList=Prado.WebUI.TListControl;
Prado.WebUI.DefaultButton=Class.create();
-Object.extend(Prado.WebUI.DefaultButton.prototype,{initialize:function(_434){
-this.options=_434;
+Object.extend(Prado.WebUI.DefaultButton.prototype,{initialize:function(_435){
+this.options=_435;
this._event=this.triggerEvent.bindEvent(this);
-Event.observe(_434["Panel"],"keydown",this._event);
-},triggerEvent:function(ev,_436){
-var _437=Event.keyCode(ev)==Event.KEY_RETURN;
-var _438=Event.element(ev).tagName.toLowerCase()=="textarea";
-if(_437&&!_438){
-var _439=$(this.options["Target"]);
-if(_439){
+Event.observe(_435["Panel"],"keydown",this._event);
+},triggerEvent:function(ev,_437){
+var _438=Event.keyCode(ev)==Event.KEY_RETURN;
+var _439=Event.element(ev).tagName.toLowerCase()=="textarea";
+if(_438&&!_439){
+var _440=$(this.options["Target"]);
+if(_440){
this.triggered=true;
-Event.fireEvent(_439,this.options["Event"]);
+Event.fireEvent(_440,this.options["Event"]);
Event.stop(ev);
}
}
@@ -1931,15 +1934,15 @@ Prado.WebUI.TTextHighlighter.prototype={initialize:function(id){
if(!window.clipboardData){
return;
}
-var _440={href:"javascript:;//copy code to clipboard",onclick:"Prado.WebUI.TTextHighlighter.copy(this)",onmouseover:"Prado.WebUI.TTextHighlighter.hover(this)",onmouseout:"Prado.WebUI.TTextHighlighter.out(this)"};
-var div=DIV({className:"copycode"},A(_440,"Copy Code"));
+var _441={href:"javascript:;//copy code to clipboard",onclick:"Prado.WebUI.TTextHighlighter.copy(this)",onmouseover:"Prado.WebUI.TTextHighlighter.hover(this)",onmouseout:"Prado.WebUI.TTextHighlighter.out(this)"};
+var div=DIV({className:"copycode"},A(_441,"Copy Code"));
document.write(DIV(null,div).innerHTML);
}};
Object.extend(Prado.WebUI.TTextHighlighter,{copy:function(obj){
-var _441=obj.parentNode.parentNode.parentNode;
+var _442=obj.parentNode.parentNode.parentNode;
var text="";
-for(var i=0;i<_441.childNodes.length;i++){
-var node=_441.childNodes[i];
+for(var i=0;i<_442.childNodes.length;i++){
+var node=_442.childNodes[i];
if(node.innerText){
text+=node.innerText=="Copy Code"?"":node.innerText;
}else{
@@ -1955,53 +1958,45 @@ obj.parentNode.className="copycode copycode_hover";
obj.parentNode.className="copycode";
}});
Prado.WebUI.TRatingList=Class.create();
-Prado.WebUI.TRatingList.prototype={selectedIndex:-1,initialize:function(_442){
-this.options=_442;
-this.element=$(_442["ID"]);
-Element.addClassName(this.element,_442.cssClass);
-var _443=_442.total*_442.dx;
-this.element.style.width=_443+"px";
-Event.observe(this.element,"mouseover",this.hover.bindEvent(this));
-Event.observe(this.element,"mouseout",this.recover.bindEvent(this));
-Event.observe(this.element,"click",this.click.bindEvent(this));
-this._onMouseMoveEvent=this.mousemoved.bindEvent(this);
-this.selectedIndex=_442.pos;
-this.radios=document.getElementsByName(_442.field);
+Prado.WebUI.TRatingList.prototype={selectedIndex:-1,initialize:function(_443){
+this.options=_443;
+this.element=$(_443["ID"]);
+Element.addClassName(this.element,_443.cssClass);
+this.radios=document.getElementsByName(_443.field);
+for(var i=0;i<this.radios.length;i++){
+Event.observe(this.radios[i].parentNode,"mouseover",this.hover.bindEvent(this,i));
+Event.observe(this.radios[i].parentNode,"mouseout",this.recover.bindEvent(this,i));
+Event.observe(this.radios[i].parentNode,"click",this.click.bindEvent(this,i));
+}
this.caption=CAPTION();
this.element.appendChild(this.caption);
-this.showPosition(this.selectedIndex,false);
-},hover:function(){
-Event.observe(this.element,"mousemove",this._onMouseMoveEvent);
-},recover:function(){
-Event.stopObserving(this.element,"mousemove",this._onMouseMoveEvent);
-this.showPosition(this.selectedIndex,false);
-},mousemoved:function(e){
-this.updatePosition(e,true);
-},updatePosition:function(e,_444){
-var obj=Event.element(e);
-var _445=Position.cumulativeOffset(obj);
-var _446=Event.pointerX(e)-_445[0];
-var pos=parseInt(_446/this.options.dx);
-if(!_444||this.options.pos!=pos){
-this.showPosition(pos,_444);
-}
-},click:function(ev){
-this.updatePosition(ev,false);
-this.selectedIndex=this.options.pos;
+this.selectedIndex=_443.selectedIndex;
+this.setRating(this.selectedIndex);
+},hover:function(ev,_444){
for(var i=0;i<this.radios.length;i++){
-this.radios[i].checked=(i==this.selectedIndex);
+this.radios[i].parentNode.className=(i<=_444)?"rating_hover":"";
+}
+this.setCaption(_444);
+},recover:function(ev,_445){
+for(var i=0;i<=_445;i++){
+Element.removeClassName(this.radios[i].parentNode,"rating_hover");
}
+this.setRating(this.selectedIndex);
+},click:function(ev,_446){
+for(var i=0;i<this.radios.length;i++){
+this.radios[i].checked=(i==_446);
+}
+this.selectedIndex=_446;
+this.setRating(_446);
if(isFunction(this.options.onChange)){
-this.options.onChange(this,this.selectedIndex);
+this.options.onChange(this,_446);
}
-},showPosition:function(pos,_447){
-if(pos>=this.options.total){
-return;
+},setRating:function(_447){
+for(var i=0;i<=_447;i++){
+this.radios[i].parentNode.className="rating_selected";
}
-var dy=this.options.dy*(pos+1)+this.options.iy;
-var dx=_447?this.options.hx+this.options.ix:this.options.ix;
-this.element.style.backgroundPosition="-"+dx+"px -"+dy+"px";
-this.options.pos=pos;
-this.caption.innerHTML=pos>=0?this.radios[this.options.pos].value:this.options.caption;
+this.setCaption(_447);
+},setCaption:function(_448){
+this.caption.innerHTML=_448>-1?this.radios[_448].value:this.options.caption;
}};
diff --git a/framework/Web/Javascripts/ratings/10star_white.gif b/framework/Web/Javascripts/ratings/10star_white.gif
deleted file mode 100644
index 0acdf5c9..00000000
--- a/framework/Web/Javascripts/ratings/10star_white.gif
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks.css b/framework/Web/Javascripts/ratings/blocks.css
new file mode 100644
index 00000000..2bf2e904
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks.css
@@ -0,0 +1,29 @@
+.TRatingList_blocks
+{
+ border-collapse: collapse;
+}
+.TRatingList_blocks input, .TRatingList_blocks label
+{
+ display: none;
+}
+.TRatingList_blocks td
+{
+ width: 17px;
+ height: 18px;
+ background-image: url(blocks_blank.gif);
+ background-repeat: no-repeat;
+ cursor: pointer;
+}
+.TRatingList_blocks td.rating_selected
+{
+ background-image: url(blocks_selected.gif);
+}
+
+.TRatingList_blocks td.rating_hover
+{
+ background-image: url(blocks_hover.gif);
+}
+.TRatingList_blocks td.rating_half
+{
+ background-image: url(blocks_half.gif);
+}
diff --git a/framework/Web/Javascripts/ratings/blocks.png b/framework/Web/Javascripts/ratings/blocks.png
new file mode 100644
index 00000000..16a2b249
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks.png
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_blank.gif b/framework/Web/Javascripts/ratings/blocks_blank.gif
new file mode 100644
index 00000000..a68d0e94
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_half.gif b/framework/Web/Javascripts/ratings/blocks_half.gif
new file mode 100644
index 00000000..4cff0148
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_hover.gif b/framework/Web/Javascripts/ratings/blocks_hover.gif
new file mode 100644
index 00000000..58ad7495
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_hover.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_selected.gif b/framework/Web/Javascripts/ratings/blocks_selected.gif
new file mode 100644
index 00000000..f91873e2
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default.css b/framework/Web/Javascripts/ratings/default.css
index 1609ee05..c15a36bd 100644
--- a/framework/Web/Javascripts/ratings/default.css
+++ b/framework/Web/Javascripts/ratings/default.css
@@ -1,21 +1,29 @@
-.TRatingList_default tr
+.TRatingList_default
+{
+ border-collapse: collapse;
+}
+.TRatingList_default input, .TRatingList_default label
{
display: none;
}
-
-.TRatingList_default
+.TRatingList_default td
{
- width: 120px;
- height: 20px;
- background-image: url(10star_white.gif);
- background-position: -0px -4px;
+ width: 17px;
+ height: 18px;
+ background-image: url(default_blank.gif);
background-repeat: no-repeat;
- margin: 4px;
cursor: pointer;
}
+.TRatingList_default td.rating_selected
+{
+ background-image: url(default_selected.gif);
+}
-.TRatingList_default caption
+.TRatingList_default td.rating_hover
{
- padding-left: 4px;
- text-align: left;
-} \ No newline at end of file
+ background-image: url(default_hover.gif);
+}
+.TRatingList_default td.rating_half
+{
+ background-image: url(default_half.gif);
+}
diff --git a/framework/Web/Javascripts/ratings/default_blank.gif b/framework/Web/Javascripts/ratings/default_blank.gif
new file mode 100644
index 00000000..4e6fda3c
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_half.gif b/framework/Web/Javascripts/ratings/default_half.gif
new file mode 100644
index 00000000..7cecf0ec
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_hover.gif b/framework/Web/Javascripts/ratings/default_hover.gif
new file mode 100644
index 00000000..ad0cd28a
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_hover.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_selected.gif b/framework/Web/Javascripts/ratings/default_selected.gif
new file mode 100644
index 00000000..a19ab39f
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/ratings.js b/framework/Web/Javascripts/ratings/ratings.js
index c5efc372..e6fd97ba 100644
--- a/framework/Web/Javascripts/ratings/ratings.js
+++ b/framework/Web/Javascripts/ratings/ratings.js
@@ -8,63 +8,53 @@ Prado.WebUI.TRatingList.prototype =
this.options = options;
this.element = $(options['ID']);
Element.addClassName(this.element,options.cssClass);
- var width = options.total * options.dx;
- this.element.style.width = width+"px";
- Event.observe(this.element, 'mouseover', this.hover.bindEvent(this));
- Event.observe(this.element, 'mouseout', this.recover.bindEvent(this));
- Event.observe(this.element, 'click', this.click.bindEvent(this));
- this._onMouseMoveEvent = this.mousemoved.bindEvent(this);
- this.selectedIndex = options.pos;
this.radios = document.getElementsByName(options.field);
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ Event.observe(this.radios[i].parentNode, "mouseover", this.hover.bindEvent(this,i));
+ Event.observe(this.radios[i].parentNode, "mouseout", this.recover.bindEvent(this,i));
+ Event.observe(this.radios[i].parentNode, "click", this.click.bindEvent(this, i));
+ }
this.caption = CAPTION();
this.element.appendChild(this.caption);
- this.showPosition(this.selectedIndex,false);
+ this.selectedIndex = options.selectedIndex;
+ this.setRating(this.selectedIndex);
},
- hover : function()
+ hover : function(ev,index)
{
- Event.observe(this.element, "mousemove", this._onMouseMoveEvent);
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
+ this.setCaption(index);
},
- recover : function()
+ recover : function(ev,index)
{
- Event.stopObserving(this.element, "mousemove", this._onMouseMoveEvent);
- this.showPosition(this.selectedIndex,false);
+ for(var i = 0; i<=index; i++)
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ this.setRating(this.selectedIndex);
},
- mousemoved : function(e)
+ click : function(ev, index)
{
- this.updatePosition(e,true);
- },
-
- updatePosition : function(e, hovering)
- {
- var obj = Event.element(e);
- var elementPos = Position.cumulativeOffset(obj);
- var clientX = Event.pointerX(e) - elementPos[0];
- var pos = parseInt(clientX / this.options.dx);
- if(!hovering || this.options.pos != pos)
- this.showPosition(pos, hovering)
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].checked = (i == index);
+ this.selectedIndex = index;
+ this.setRating(index);
+ if(isFunction(this.options.onChange))
+ this.options.onChange(this,index);
},
- click : function(ev)
+ setRating: function(index)
{
- this.updatePosition(ev,false);
- this.selectedIndex = this.options.pos;
- for(var i = 0; i < this.radios.length; i++)
- this.radios[i].checked = (i == this.selectedIndex);
- if(isFunction(this.options.onChange))
- this.options.onChange(this, this.selectedIndex);
+ for(var i = 0; i<=index; i++)
+ this.radios[i].parentNode.className = "rating_selected";
+ this.setCaption(index);
},
- showPosition : function(pos, hovering)
+ setCaption : function(index)
{
- if(pos >= this.options.total) return;
- var dy = this.options.dy * (pos+1) + this.options.iy;
- var dx = hovering ? this.options.hx + this.options.ix : this.options.ix;
- this.element.style.backgroundPosition = "-"+dx+"px -"+dy+"px";
- this.options.pos = pos;
- this.caption.innerHTML = pos >= 0 ?
- this.radios[this.options.pos].value : this.options.caption;
+ this.caption.innerHTML = index > -1 ?
+ this.radios[index].value : this.options.caption;
}
} \ No newline at end of file
diff --git a/framework/Web/Javascripts/ratings/stars1.png b/framework/Web/Javascripts/ratings/stars1.png
new file mode 100644
index 00000000..e4dd3c25
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/stars1.png
Binary files differ
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index f563e36e..8d4de13e 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -274,10 +274,26 @@ class TDatePicker extends TTextBox
public function render($writer)
{
if($this->getInputMode() == 'TextBox')
+ {
parent::render($writer);
+ $this->renderDatePickerButtons($writer);
+ }
else
+ {
$this->renderDropDownListCalendar($writer);
-
+ if($this->hasDayPattern())
+ {
+ $this->registerCalendarClientScript();
+ $this->renderDatePickerButtons($writer);
+ }
+ }
+ }
+
+ /**
+ * Renders the date picker popup buttons.
+ */
+ protected function renderDatePickerButtons($writer)
+ {
if($this->getShowCalendar())
{
switch ($this->getMode())
@@ -317,12 +333,26 @@ class TDatePicker extends TTextBox
*/
protected function getDateFromPostData($key, $values)
{
- $day = $values[$key.'$day'];
- $month = $values[$key.'$month'];
- $year = $values[$key.'$year'];
- $date = @mktime(0, 0, 0, $month+1, $day, $year);
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
- $this->getDateFormat());
+ $date = @getdate();
+
+ if(isset($values[$key.'$day']))
+ $day = intval($values[$key.'$day']);
+ else
+ $day = 1;
+
+ if(isset($values[$key.'$month']))
+ $month = intval($values[$key.'$month']) + 1;
+ else
+ $month = $date['mon'];
+
+ if(isset($values[$key.'$year']))
+ $year = intval($values[$key.'$year']);
+ else
+ $year = $date['year'];
+ $date = @mktime(0, 0, 0, $month, $day, $year);
+ $pattern = $this->getDateFormat();
+ $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter', $pattern);
return $formatter->format($date);
}
@@ -369,7 +399,8 @@ class TDatePicker extends TTextBox
protected function getCurrentCulture()
{
$app = $this->getApplication()->getGlobalization();
- return $this->getCulture() == '' ? $app->getCulture() : $this->getCulture();
+ return $this->getCulture() == '' ?
+ ($app ? $app->getCulture() : 'en') : $this->getCulture();
}
/**
@@ -401,21 +432,43 @@ class TDatePicker extends TTextBox
$writer->renderBeginTag('span');
$date = $this->getDateFromText();
-
- //renders the 3 drop down lists
- $this->renderCalendarDayOptions($writer,$date['mday']);
- $this->renderCalendarMonthOptions($writer,$date['mon']-1);
- $this->renderCalendarYearOptions($writer,$date['year']);
-
+ $this->renderCalendarSelections($writer, $date);
+
//render a hidden input field
$writer->addAttribute('name', $this->getUniqueID());
$writer->addAttribute('type', 'hidden');
$writer->addAttribute('value', $this->getText());
$writer->renderBeginTag('input');
-
- $this->registerCalendarClientScript();
+
$writer->renderEndTag();
}
+
+ protected function hasDayPattern()
+ {
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $this->getDateFormat());
+ return !is_null($formatter->getDayPattern());
+ }
+
+ /**
+ * Renders the calendar drop down list depending on the DateFormat pattern.
+ * @param THtmlWriter the Html writer to render the drop down lists.
+ * @param array the current selected date
+ */
+ protected function renderCalendarSelections($writer, $date)
+ {
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $this->getDateFormat());
+ foreach($formatter->getDayMonthYearOrdering() as $type)
+ {
+ if($type == 'day')
+ $this->renderCalendarDayOptions($writer,$date['mday']);
+ elseif($type == 'month')
+ $this->renderCalendarMonthOptions($writer,$date['mon']-1);
+ elseif($type == 'year')
+ $this->renderCalendarYearOptions($writer,$date['year']);
+ }
+ }
/**
* Gets the date from the text input using TSimpleDateFormatter
@@ -423,8 +476,9 @@ class TDatePicker extends TTextBox
*/
protected function getDateFromText()
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
- $this->getDateFormat());
+ $pattern = $this->getDateFormat();
+ $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',$pattern);
return $formatter->parse($this->getText());
}
@@ -476,11 +530,33 @@ class TDatePicker extends TTextBox
$writer->addAttribute('class', 'datepicker_month_options');
$writer->renderBeginTag('select');
$this->renderDropDownListOptions($writer,
- $info->getMonthNames(), $selected);
+ $this->getLocalizedMonthNames($info), $selected);
$writer->renderEndTag();
}
/**
+ * Returns the localized month names that depends on the month format pattern.
+ * "MMMM" will return the month names, "MM" or "MMM" return abbr. month names
+ * and "M" return month digits.
+ * @param DateTimeFormatInfo localized date format information.
+ * @return array localized month names.
+ */
+ protected function getLocalizedMonthNames($info)
+ {
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $this->getDateFormat());
+ switch($formatter->getMonthPattern())
+ {
+ case 'MMM':
+ case 'MM': return $info->getAbbreviatedMonthNames();
+ case 'M':
+ $array = array(); for($i=1;$i<=12;$i++) $array[$i] = $i;
+ return $array;
+ default : return $info->getMonthNames();
+ }
+ }
+
+ /**
* Renders the year drop down list options.
* @param THtmlWriter the writer used for the rendering purpose
* @param mixed selected year.
diff --git a/framework/Web/UI/WebControls/TRatingList.php b/framework/Web/UI/WebControls/TRatingList.php
index 006391f7..b2861f2b 100644
--- a/framework/Web/UI/WebControls/TRatingList.php
+++ b/framework/Web/UI/WebControls/TRatingList.php
@@ -12,6 +12,7 @@ Prado::using('System.Web.UI.WebControls.TRadioButtonList');
*/
class TRatingList extends TRadioButtonList
{
+ private $_ratingImages = array();
public function __construct()
{
@@ -19,12 +20,30 @@ class TRatingList extends TRadioButtonList
$this->getRepeatInfo()->setRepeatDirection('Horizontal');
}
- /**
- * @param string the direction (Vertical, Horizontal) of traversing the list
- */
- public function setRepeatDirection($value)
+ public function getAllowInput()
+ {
+ return $this->getViewState('AllowInput', true);
+ }
+
+ public function setAllowInput($value)
+ {
+ $this->setViewState('AllowInput', TPropertyValue::ensureBoolean($value), true);
+ }
+
+ public function getRating()
+ {
+ if($this->getAllowInput())
+ return $this->getSelectedIndex();
+ else
+ return $this->getViewState('Rating',0);
+ }
+
+ public function setRating($value)
{
- throw new TNotSupportedException('ratinglits_repeatdirection_unsupported');
+ if($this->getAllowInput())
+ $this->setSelectedIndex($value);
+ else
+ return $this->setViewState('Rating', TPropertyValue::ensureFloat($value),0);
}
/**
@@ -40,19 +59,13 @@ class TRatingList extends TRadioButtonList
*/
public function getRatingStyle()
{
- $style = $this->getViewState('RatingStyle', 'default');
- return is_string($style) ? $this->createRatingStyle($style) : $style;
- }
-
- protected function createRatingStyle($type)
- {
- return new TRatingListDefaultStyle;
+ return $this->getViewState('RatingStyle', 'default');
}
/**
* @return string caption text. Default is "Rate It:".
*/
- public function getCaptionText()
+ public function getCaption()
{
return $this->getViewState('Caption', 'Rate It:');
}
@@ -60,40 +73,60 @@ class TRatingList extends TRadioButtonList
/**
* @param string caption text
*/
- public function setCaptionText($value)
+ public function setCaption($value)
{
$this->setViewState('Caption', $value, 'Rate It:');
}
+
+ public function setHalfRatingLimit($value)
+ {
+ $this->setViewState('HalfRating',
+ TPropertyValue::ensureArray($value), array(0.3, 0.7));
+ }
+
+ public function getHalfRatingLimit()
+ {
+ return $this->getViewState('HalfRating', array(0.3, 0.7));
+ }
+
public function getRatingClientOptions()
{
- $options = $this->getRatingStyle()->getOptions();
+ $options['cssClass'] = 'TRatingList_'.$this->getRatingStyle();
$options['ID'] = $this->getClientID();
- $options['caption'] = $this->getCaptionText();
+ $options['caption'] = $this->getCaption();
$options['field'] = $this->getUniqueID();
- $options['total'] = $this->getItems()->getCount();
- $options['pos'] = $this->getSelectedIndex();
+ $options['selectedIndex'] = $this->getSelectedIndex();
return $options;
}
- protected function publishRatingListStyle()
+ protected function publishRatingListStyle($style)
{
$cs = $this->getPage()->getClientScript();
- $style = $this->getRatingStyle()->getStyleSheet();
- $url = $this->publishFilePath($style);
+ $stylesheet = 'System.Web.Javascripts.ratings.'.$style;
+ if(($cssFile=Prado::getPathOfNamespace($stylesheet,'.css'))===null)
+ throw new TConfigurationException('ratinglist_stylesheet_not_found',$style);
+ $url = $this->publishFilePath($cssFile);
if(!$cs->isStyleSheetFileRegistered($style))
$cs->registerStyleSheetFile($style, $url);
return $url;
}
- protected function publishRatingListAssets()
+ protected function publishRatingListImages($style, $fileExt='.gif')
{
$cs = $this->getPage()->getClientScript();
- $assets = $this->getRatingStyle()->getAssets();
- $list = array();
- foreach($assets as $file)
- $list[] = $this->publishFilePath($file);
- return $list;
+ $images['blank'] = "System.Web.Javascripts.ratings.{$style}_blank";
+ $images['hover'] = "System.Web.Javascripts.ratings.{$style}_hover";
+ $images['selected'] = "System.Web.Javascripts.ratings.{$style}_selected";
+ $images['half'] = "System.Web.Javascripts.ratings.{$style}_half";
+ $files = array();
+ foreach($images as $type => $image)
+ {
+ if(($file=Prado::getPathOfNamespace($image, $fileExt))===null)
+ throw TConfigurationException('ratinglist_image_not_found',$image);
+ $files[$type] = $this->publishFilePath($file);
+ }
+ return $files;
}
/**
@@ -102,8 +135,21 @@ class TRatingList extends TRadioButtonList
public function onPreRender($param)
{
parent::onPreRender($param);
- $this->publishRatingListStyle();
- $this->publishRatingListAssets();
+
+ $this->publishRatingListStyle($this->getRatingStyle());
+ $this->_ratingImages = $this->publishRatingListImages($this->getRatingStyle());
+
+ if($this->getAllowInput())
+ $this->registerRatingListClientScript();
+ else
+ {
+ $this->getRepeatInfo()->setCaption($this->getCaption());
+ $this->setAttribute('title', $this->getRating());
+ }
+ }
+
+ protected function registerRatingListClientScript()
+ {
$id = $this->getClientID();
$scripts = $this->getPage()->getClientScript();
$scripts->registerPradoScript('prado');
@@ -111,65 +157,38 @@ class TRatingList extends TRadioButtonList
$code = "new Prado.WebUI.TRatingList($options);";
$scripts->registerEndScript("prado:$id", $code);
}
-}
-abstract class TRatingListStyle
-{
- private $_options = array();
-
- public function __construct()
+ public function renderItem($writer,$repeatInfo,$itemType,$index)
{
- $options['pos'] = -1;
- $options['dx'] = 22;
- $options['dy'] = 30;
- $options['ix'] = 4;
- $options['iy'] = 4;
- $options['hx'] = 240;
- $options['total'] = -1;
- $this->_options = $options;
+ if($this->getAllowInput())
+ parent::renderItem($writer, $repeatInfo, $itemType, $index);
+ else
+ $this->renderRatingListItem($writer, $repeatInfo, $itemType, $index);
}
- public function getOptions()
+ protected function renderRatingListItem($writer, $repeatInfo, $itemType, $index)
{
- return $this->_options;
- }
-
- public function setOptions($options)
- {
- $this->_options = $options;
- }
-
- abstract function getStyleSheet();
-
- abstract function getAssets();
-}
-
-class TRatingListDefaultStyle extends TRatingListStyle
-{
- public function __construct()
- {
- parent::__construct();
- $options = $this->getOptions();
- $options['cssClass'] = 'TRatingList_default';
- $this->setOptions($options);
+ $image = new TImage;
+ $image->setImageUrl($this->_ratingImages[$this->getRatingImageType($index)]);
+ $image->setAlternateText($this->getRating());
+ $image->render($writer);
}
- public function getStyleSheet()
+ protected function getRatingImageType($index)
{
- $style = 'System.Web.Javascripts.ratings.default';
- if(($cssFile=Prado::getPathOfNamespace($style,'.css'))===null)
- throw new TConfigurationException('ratinglist_stylesheet_invalid',$style);
- return $cssFile;
+ $rating = floatval($this->getRating());
+ $int = intval($rating);
+ $limit = $this->getHalfRatingLimit();
+ if($index < $int || ($rating < $index + 1 && $rating > $index +$limit[1]))
+ return 'selected';
+ if($rating >= $index+$limit[0] && $rating <= $index+$limit[1])
+ return 'half';
+ return 'blank';
}
- public function getAssets()
+ public function generateItemStyle($itemType,$index)
{
- $assets = array();
- $image = 'System.Web.Javascripts.ratings.10star_white';
- if(($file=Prado::getPathOfNamespace($image, '.gif'))===null)
- throw TConfigurationException('ratinglist_asset_invalid',$image);
- $assets[] = $file;
- return $assets;
+ return new TStyle;
}
}
diff --git a/tests/FunctionalTests/protected/pages/UI/DatePicker.page b/tests/FunctionalTests/protected/pages/UI/DatePicker.page
index 09272d15..4347f748 100644
--- a/tests/FunctionalTests/protected/pages/UI/DatePicker.page
+++ b/tests/FunctionalTests/protected/pages/UI/DatePicker.page
@@ -1,48 +1,59 @@
<com:TContent ID="Content">
- <com:TDatePicker Mode="Button"/>
- <br />
- <select style="width: 200px; height: 50px"><option value="1">One</option></select>
-as<br/>
-dv<br/>
-as<br/>
-d<br/>
-<com:TDatePicker ID="Picker1" InputMode="DropDownList"/>
-<com:TButton Text="Update" />
-<%= $this->Page->Picker1->Text %>
-as<br/>
-d<br/>
-asd<br/>
-a<br/>
- <com:TDatePicker Mode="ImageButton" Culture="zh_CN" DateFormat="日期:yyyy年M月d日"/>
-sd<br/>
-dv<br/>
-as<br/>
-d<br/>
-as<br/>
-d<br/>
-asd<br/>
-a<br/>
-sd<br/>
-dv<br/>
-as<br/>
-d<br/>
-as<br/>
-d<br/>
-asd<br/>
-a<br/>
-sd<br/><com:TDatePicker />
-d<br/>
-as<br/>
-d<br/>
-asd<br/>
-a<br/>
-sd<br/>
-dv<br/>
-as<br/>
-d<br/>
-as<br/>
-d<br/>
-asd<br/>
-a<br/>
-sd<br/>
+
+<h1>TDatePicker Samples</h1>
+
+<table class="sampletable">
+
+<tr>
+ <td class="samplenote">Default TDatePicker</td>
+ <td class="sampleaction">
+ <com:TDatePicker />
+ </td>
+</tr>
+
+<tr>
+ <td class="samplenote">Button Mode</td>
+ <td class="sampleaction">
+ <com:TDatePicker Mode="Button" />
+ </td>
+</tr>
+
+<tr>
+ <td class="samplenote">InputMode="DropDownList", custom DateFormat</td>
+ <td class="sampleaction">
+ <com:TDatePicker DateFormat="yyyy/MMMM" InputMode="DropDownList"/>
+ </td>
+</tr>
+
+<tr>
+ <td class="samplenote">InputMode="DropDownList", custom DateFormat, Culture</td>
+ <td class="sampleaction">
+ <com:TDatePicker DateFormat="MM/yyyy" Culture="fr" InputMode="DropDownList"/>
+ </td>
+</tr>
+
+
+<tr>
+ <td class="samplenote">Custom DateFormat, culture, ImageButton mode</td>
+ <td class="sampleaction">
+ <com:TDatePicker Mode="ImageButton" Culture="zh_CN" DateFormat="日期:yyyy年M月d日"/>
+ </td>
+</tr>
+
+<tr>
+ <td class="samplenote">Custom DateFormat, DropDownList, pre-selected date set in as Text</td>
+ <td class="sampleaction">
+ <com:TDatePicker DateFormat="yyyy/MMMM/dd" Text="2005/05/15" InputMode="DropDownList"/>
+ </td>
+</tr>
+
+<tr>
+ <td class="samplenote">DropDownList, pre-selected date as integer</td>
+ <td class="sampleaction">
+ <com:TDatePicker InputMode="DropDownList" Date=<%= @strtotime("-1 month") %>/>
+ </td>
+</tr>
+
+</table>
+
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/UI/RatingList.page b/tests/FunctionalTests/protected/pages/UI/RatingList.page
index 1af833dc..909180c7 100644
--- a/tests/FunctionalTests/protected/pages/UI/RatingList.page
+++ b/tests/FunctionalTests/protected/pages/UI/RatingList.page
@@ -2,7 +2,7 @@
<h1>TRatingList Examples</h1>
<h2>Default TRatingList</h2>
- <com:TRatingList>
+ <com:TRatingList RepeatDirection="Vertical" Style="caption-side: right;">
<com:TListItem Text="Fair" />
<com:TListItem Text="Average" />
<com:TListItem Text="Good" />
@@ -20,7 +20,7 @@
</com:TRatingList>
<h2>TRatingList </h2>
- <com:TRatingList SelectedValue="Good">
+ <com:TRatingList RatingStyle="blocks" SelectedValue="Good">
<com:TListItem Text="Poor" />
<com:TListItem Text="Fair" />
<com:TListItem Text="Average" />
@@ -29,5 +29,13 @@
<com:TListItem Text="Super" />
</com:TRatingList>
-
+<h2>TRatingList </h2>
+ <com:TRatingList ID="Rating1" AllowInput="false" Caption="Rating:" Rating="4.6">
+ <com:TListItem Text="Poor" />
+ <com:TListItem Text="Fair" />
+ <com:TListItem Text="Average" />
+ <com:TListItem Text="Good" />
+ <com:TListItem Text="Execellent" />
+ <com:TListItem Text="Super" />
+ </com:TRatingList>
</com:TContent> \ No newline at end of file