diff options
author | wei <> | 2007-03-30 00:27:34 +0000 |
---|---|---|
committer | wei <> | 2007-03-30 00:27:34 +0000 |
commit | 1ebbcf85205f983531ef3b43dce4a98114714f0b (patch) | |
tree | 7c9e05075716b94a4f46ba6e1ff5266d2e441080 /framework/Web/Javascripts | |
parent | 22b818afcda89e60a1bee299f19d8ff827097e97 (diff) |
Fixed #579, reverted the rating list js.
Diffstat (limited to 'framework/Web/Javascripts')
-rw-r--r-- | framework/Web/Javascripts/js/compressed/prado.js | 15 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/debug/prado.js | 61 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/ratings/ratings.js | 24 |
3 files changed, 87 insertions, 13 deletions
diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index 083ddc56..5318d3aa 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -401,4 +401,17 @@ window.clipboardData.setData("Text",text);},hover:function(obj) {for(var i=0;i<options.ItemCount;i++) {var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TCheckBox(checkBoxOptions);}}});Prado.WebUI.TRadioButtonList=Base.extend({constructor:function(options) {for(var i=0;i<options.ItemCount;i++) -{var radioButtonOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TRadioButton(radioButtonOptions);}}});
\ No newline at end of file +{var radioButtonOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TRadioButton(radioButtonOptions);}}});Prado.WebUI.TRatingList=Class.create();Prado.WebUI.TRatingList.prototype={selectedIndex:-1,initialize:function(options) +{this.options=options;this.element=$(options['ID']);Element.addClassName(this.element,options.cssClass);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.selectedIndex=options.selectedIndex;this.setRating(this.selectedIndex);},hover:function(ev,index) +{for(var i=0;i<this.radios.length;i++) +this.radios[i].parentNode.className=(i<=index)?"rating_hover":"";this.setCaption(index);},recover:function(ev,index) +{for(var i=0;i<=index;i++) +Element.removeClassName(this.radios[i].parentNode,"rating_hover");this.setRating(this.selectedIndex);},click:function(ev,index) +{for(var i=0;i<this.radios.length;i++) +this.radios[i].checked=(i==index);this.selectedIndex=index;this.setRating(index);if(typeof(this.options.onChange)=="Function") +this.options.onChange(this,index);},setRating:function(index) +{for(var i=0;i<=index;i++) +this.radios[i].parentNode.className="rating_selected";this.setCaption(index);},setCaption:function(index) +{this.caption.innerHTML=index>-1?this.radios[index].value:this.options.caption;}}
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js index e5e87616..12aa5ce5 100644 --- a/framework/Web/Javascripts/js/debug/prado.js +++ b/framework/Web/Javascripts/js/debug/prado.js @@ -3807,3 +3807,64 @@ Prado.WebUI.TRadioButtonList = Base.extend( }
}); +Prado.WebUI.TRatingList = Class.create();
+Prado.WebUI.TRatingList.prototype =
+{
+ selectedIndex : -1,
+
+ initialize : function(options)
+ {
+ this.options = options;
+ this.element = $(options['ID']);
+ Element.addClassName(this.element,options.cssClass);
+ 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.selectedIndex = options.selectedIndex;
+ this.setRating(this.selectedIndex);
+ },
+
+ hover : function(ev,index)
+ {
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
+ this.setCaption(index);
+ },
+
+ recover : function(ev,index)
+ {
+ for(var i = 0; i<=index; i++)
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ this.setRating(this.selectedIndex);
+ },
+
+ click : function(ev, index)
+ {
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].checked = (i == index);
+ this.selectedIndex = index;
+ this.setRating(index);
+ if(typeof(this.options.onChange)=="Function")
+ this.options.onChange(this,index);
+ },
+
+ setRating: function(index)
+ {
+ for(var i = 0; i<=index; i++)
+ this.radios[i].parentNode.className = "rating_selected";
+ this.setCaption(index);
+ },
+
+ setCaption : function(index)
+ {
+ this.caption.innerHTML = index > -1 ?
+ this.radios[index].value : this.options.caption;
+ }
+} + diff --git a/framework/Web/Javascripts/prado/ratings/ratings.js b/framework/Web/Javascripts/prado/ratings/ratings.js index e6fd97ba..cc9831e9 100644 --- a/framework/Web/Javascripts/prado/ratings/ratings.js +++ b/framework/Web/Javascripts/prado/ratings/ratings.js @@ -1,5 +1,5 @@ -Prado.WebUI.TRatingList = Class.create();
-Prado.WebUI.TRatingList.prototype =
+Prado.WebUI.TRatingList = Class.create();
+Prado.WebUI.TRatingList.prototype =
{
selectedIndex : -1,
@@ -14,47 +14,47 @@ Prado.WebUI.TRatingList.prototype = 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.selectedIndex = options.selectedIndex;
this.setRating(this.selectedIndex);
},
-
+
hover : function(ev,index)
{
for(var i = 0; i<this.radios.length; i++)
this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
this.setCaption(index);
},
-
+
recover : function(ev,index)
{
for(var i = 0; i<=index; i++)
Element.removeClassName(this.radios[i].parentNode, "rating_hover");
this.setRating(this.selectedIndex);
},
-
+
click : function(ev, index)
{
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);
+ if(typeof(this.options.onChange)=="Function")
+ this.options.onChange(this,index);
},
-
+
setRating: function(index)
{
for(var i = 0; i<=index; i++)
this.radios[i].parentNode.className = "rating_selected";
this.setCaption(index);
},
-
+
setCaption : function(index)
{
- this.caption.innerHTML = index > -1 ?
- this.radios[index].value : this.options.caption;
+ this.caption.innerHTML = index > -1 ?
+ this.radios[index].value : this.options.caption;
}
}
\ No newline at end of file |