summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/debug/prado.js
diff options
context:
space:
mode:
authorwei <>2007-03-30 00:38:41 +0000
committerwei <>2007-03-30 00:38:41 +0000
commit3fb25eec92c0c72760c4bf8040efd4b86c446bc6 (patch)
treea7c76d761f432b29dfa567c4e46acb62a7abf18b /framework/Web/Javascripts/js/debug/prado.js
parenteddf47f3e36a30f6b905e4d667514eb34968ff8a (diff)
Fixed #579
Diffstat (limited to 'framework/Web/Javascripts/js/debug/prado.js')
-rw-r--r--framework/Web/Javascripts/js/debug/prado.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js
index 1388135d..0e815b99 100644
--- a/framework/Web/Javascripts/js/debug/prado.js
+++ b/framework/Web/Javascripts/js/debug/prado.js
@@ -4670,3 +4670,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(isFunction(this.options.onChange))
+ 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;
+ }
+}
+