diff options
author | wei <> | 2006-10-01 03:09:18 +0000 |
---|---|---|
committer | wei <> | 2006-10-01 03:09:18 +0000 |
commit | 36f2ce766bde98c11d57b889fd9e1a7f8dff6010 (patch) | |
tree | 87c33c9e4447e20159932824b4de6167da495d49 /framework/Web/Javascripts | |
parent | 1c32172efb18e8d08ea483e2460813670ebfe1a5 (diff) |
Fixed #350 and #148, Add TActiveRatingList, should remove TRatingList from WebControls.
Diffstat (limited to 'framework/Web/Javascripts')
29 files changed, 454 insertions, 193 deletions
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js index e464fa94..e257931a 100644 --- a/framework/Web/Javascripts/extended/event.js +++ b/framework/Web/Javascripts/extended/event.js @@ -1,14 +1,14 @@ /**
* @class Event extensions.
*/
-Object.extend(Event,
+Object.extend(Event,
{
/**
- * Register a function to be executed when the page is loaded.
- * Note that the page is only loaded if all resources (e.g. images)
+ * Register a function to be executed when the page is loaded.
+ * Note that the page is only loaded if all resources (e.g. images)
* are loaded.
- *
- * Example: Show an alert box with message "Page Loaded!" when the
+ *
+ * Example: Show an alert box with message "Page Loaded!" when the
* page finished loading.
* <code>
* Event.OnLoad(function(){ alert("Page Loaded!"); });
@@ -16,18 +16,18 @@ Object.extend(Event, *
* @param {Function} function to execute when page is loaded.
*/
- OnLoad : function (fn)
+ OnLoad : function (fn)
{
// opera onload is in document, not window
- var w = document.addEventListener &&
+ var w = document.addEventListener &&
!window.addEventListener ? document : window;
Event.observe(w,'load',fn);
},
/**
* @param {Event} a keyboard event
- * @return {Number} the Unicode character code generated by the key
- * that was struck.
+ * @return {Number} the Unicode character code generated by the key
+ * that was struck.
*/
keyCode : function(e)
{
@@ -36,64 +36,65 @@ Object.extend(Event, /**
* @param {String} event type or event name.
- * @return {Boolean} true if event type is of HTMLEvent, false
+ * @return {Boolean} true if event type is of HTMLEvent, false
* otherwise
*/
isHTMLEvent : function(type)
{
- var events = ['abort', 'blur', 'change', 'error', 'focus',
- 'load', 'reset', 'resize', 'scroll', 'select',
+ var events = ['abort', 'blur', 'change', 'error', 'focus',
+ 'load', 'reset', 'resize', 'scroll', 'select',
'submit', 'unload'];
return events.include(type);
},
/**
* @param {String} event type or event name
- * @return {Boolean} true if event type is of MouseEvent,
+ * @return {Boolean} true if event type is of MouseEvent,
* false otherwise
*/
isMouseEvent : function(type)
{
- var events = ['click', 'mousedown', 'mousemove', 'mouseout',
+ var events = ['click', 'mousedown', 'mousemove', 'mouseout',
'mouseover', 'mouseup'];
return events.include(type);
},
/**
- * Dispatch the DOM event of a given <tt>type</tt> on a DOM
- * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
- * dispatched, keyboard events or UIEvent can not be dispatch
+ * Dispatch the DOM event of a given <tt>type</tt> on a DOM
+ * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
+ * dispatched, keyboard events or UIEvent can not be dispatch
* via javascript consistently.
* For the "submit" event the submit() method is called.
* @param {Object} element id string or a DOM element.
* @param {String} event type to dispatch.
*/
- fireEvent : function(element,type)
+ fireEvent : function(element,type,canBubble)
{
+ canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
element = $(element);
if(type == "submit")
return element.submit();
if(document.createEvent)
- {
+ {
if(Event.isHTMLEvent(type))
{
var event = document.createEvent('HTMLEvents');
- event.initEvent(type, true, true);
+ event.initEvent(type, canBubble, true);
}
else if(Event.isMouseEvent(type))
{
- var event = document.createEvent('MouseEvents');
+ var event = document.createEvent('MouseEvents');
if (event.initMouseEvent)
{
- event.initMouseEvent(type,true,true,
- document.defaultView, 1, 0, 0, 0, 0, false,
+ event.initMouseEvent(type,canBubble,true,
+ document.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, 0, null);
}
else
{
// Safari
// TODO we should be initialising other mouse-event related attributes here
- event.initEvent(type, true, true);
+ event.initEvent(type, canBubble, true);
}
}
element.dispatchEvent(event);
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index 79ef1848..e620399f 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -214,7 +214,9 @@ this.editField=this.cached_selectTag;if(this.options.loadTextURL)this.loadExtern {request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveLinkButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveImageButton=Class.extend(Prado.WebUI.TImageButton,{onPostBack:function(event,options) {this.addXYInput(event,options);request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveCheckBox=Class.extend(Prado.WebUI.CallbackControl,{onPostBack:function(event,options) {request=new Prado.CallbackRequest(options.EventTarget,options);if(request.dispatch()==false) -Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveTextBox=Class.extend(Prado.WebUI.TTextBox,{onInit:function(options) +Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveCheckBoxList=Base.extend({constructor:function(options) +{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.TActiveCheckBox(checkBoxOptions);}}});Prado.WebUI.TActiveRadioButtonList=Prado.WebUI.TActiveCheckBoxList;Prado.WebUI.TActiveTextBox=Class.extend(Prado.WebUI.TTextBox,{onInit:function(options) {if(options['TextMode']!='MultiLine') Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));Event.observe(this.element,"change",this.doCallback.bindEvent(this,options));},doCallback:function(event,options) {request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TAutoComplete=Class.extend(Autocompleter.Base,Prado.WebUI.TActiveTextBox.prototype);Prado.WebUI.TAutoComplete=Class.extend(Prado.WebUI.TAutoComplete,{initialize:function(options) @@ -228,18 +230,16 @@ this.onInit(options);},doCallback:function(event,options) this.updateChoices(result);}});Prado.WebUI.TTimeTriggeredCallback=Base.extend({count:0,timeout:0,constructor:function(options) {this.options=Object.extend({Interval:1,DecayRate:0},options||{}) this.onComplete=this.options.onComplete;Prado.WebUI.TTimeTriggeredCallback.register(this);},startTimer:function() -{this.options.onComplete=this.onRequestComplete.bind(this);setTimeout(this.onTimerEvent.bind(this),200);},stopTimer:function() +{this.options.onComplete=this.onRequestComplete.bind(this);this.timer=setTimeout(this.onTimerEvent.bind(this),200);},stopTimer:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.options.onComplete=undefined;clearTimeout(this.timer);this.timer=undefined;this.count=0;},onTimerEvent:function() {this.options.params=this.timeout/1000;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();},onRequestComplete:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.timer=setTimeout(this.onTimerEvent.bind(this),this.getNewTimeout())},getNewTimeout:function() {switch(this.options.DecayType) {case'Exponential':t=(Math.exp(this.options.DecayRate*this.count*this.options.Interval))-1;break;case'Linear':t=this.options.DecayRate*this.count*this.options.Interval;break;case'Quadratic':t=this.options.DecayRate*this.count*this.count*this.options.Interval;break;case'Cubic':t=this.options.DecayRate*this.count*this.count*this.count*this.options.Interval;break;default:t=0;} this.timeout=(t+this.options.Interval)*1000;this.count++;return parseInt(this.timeout);}},{timers:{},register:function(timer) -{this.timers[timer.options.ID]=timer;},start:function(id) -{if(this.timers[id]) -this.timers[id].startTimer();},stop:function(id) -{if(this.timers[id]) -this.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options) +{Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID]=timer;},start:function(id) +{Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();},stop:function(id) +{Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options) {this.element=$(options.ID);this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));},doCallback:function(event) {request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options) {this.options=options;element=$(options['ControlID']);if(element) @@ -260,9 +260,8 @@ else this.count=this.count+this.options.Decay;if(this.observing) this.time=setTimeout(this.checkChanges.bind(this),parseInt(this.options.Interval*1000*this.count));}},doCallback:function(oldValue,newValue) {request=new Prado.CallbackRequest(this.options.EventTarget,this.options);param={'OldValue':oldValue,'NewValue':newValue};request.setCallbackParameter(param);request.dispatch();}},{timers:{},register:function(timer) -{this.timers[timer.options.ID]=timer;},stop:function(id) -{if(this.timers[id]) -this.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options) +{Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID]=timer;},stop:function(id) +{Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options) {this.options=Object.extend({LoadTextFromSource:false,TextMode:'SingleLine'},options||{});this.element=$(this.options.ID);this.initializeListeners();},initializeListeners:function() {this.onclickListener=this.enterEditMode.bindAsEventListener(this);Event.observe(this.element,'click',this.onclickListener);if(this.options.ExternalControl) Event.observe($(this.options.ExternalControl),'click',this.onclickListener);},enterEditMode:function(evt) @@ -303,4 +302,28 @@ this.showLabel();}},onTextChanged:function(text) {this.isSaving=false;this.isEditing=false;this.showLabel();},onTextChangedSuccess:function(sender,parameter) {this.isSaving=false;this.isEditing=false;if(this.options.AutoHide) this.showLabel();this.element.innerHTML=parameter==null?this.editField.value:parameter;this.editField.disabled=false;},onTextChangedFailure:function(sender,parameter) -{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;}});
\ No newline at end of file +{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;}});Prado.WebUI.TRatingList=Base.extend({selectedIndex:-1,enabled:true,constructor:function(options) +{var cap=$(options.CaptionID);this.options=Object.extend({caption:cap?cap.innerHTML:''},options||{});Prado.WebUI.TRatingList.register(this);this._init();this.selectedIndex=options.SelectedIndex;this.setRating(this.selectedIndex);},_init:function(options) +{Element.addClassName($(this.options.ListID),this.options.Style);var radios=document.getElementsByName(this.options.ListName);this.radios=new Array();var index=0;for(var i=0;i<radios.length;i++) +{var node=radios[i].parentNode;if(node.tagName.toLowerCase()=='td') +{this.radios.push(radios[i]);Event.observe(node,"mouseover",this.hover.bindEvent(this,index));Event.observe(node,"mouseout",this.recover.bindEvent(this,index));Event.observe(node,"click",this.click.bindEvent(this,index));index++;Element.addClassName(node,"rating");}}},hover:function(ev,index) +{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) +{var action=i<=index?'addClassName':'removeClassName' +Element[action](this.radios[i].parentNode,"rating_hover");} +this.setCaption(index);},recover:function(ev,index) +{if(this.enabled==false)return;for(var i=0;i<=index;i++) +Element.removeClassName(this.radios[i].parentNode,"rating_hover");this.setRating(this.selectedIndex);},click:function(ev,index) +{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) +this.radios[i].checked=(i==index);this.selectedIndex=index;this.setRating(index);var requestOptions=Object.extend({ID:this.options.ListID+"_c"+index,EventTarget:this.options.ListName+"$c"+index},this.options);var request=new Prado.CallbackRequest(requestOptions.EventTarget,requestOptions);if(request.dispatch()==false) +Event.stop(ev);},setRating:function(index) +{for(var i=0;i<this.radios.length;i++) +{var action=i<=index?'addClassName':'removeClassName' +Element[action](this.radios[i].parentNode,"rating_selected");} +this.setCaption(index);},setCaption:function(index) +{var value=index>-1?this.radios[index].value:this.options.caption;var caption=$(this.options.CaptionID);if(caption)caption.innerHTML=value;$(this.options.ListName).title=value;},setEnabled:function(value) +{this.enabled=value;for(var i=0;i<this.radios.length;i++) +{var action=value?'removeClassName':'addClassName' +Element[action](this.radios[i].parentNode,"rating_disabled");Element.removeClassName(this.radios[i].parentNode,"rating_hover");}}},{ratings:{},register:function(rating) +{Prado.WebUI.TRatingList.ratings[rating.options.ListID]=rating;},setEnabled:function(id,value) +{Prado.WebUI.TRatingList.ratings[id].setEnabled(value);},setRating:function(id,value) +{Prado.WebUI.TRatingList.ratings[id].setRating(value);Prado.WebUI.TRatingList.ratings[id].selectedIndex=value;}});
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index 2f6f7eed..376e3a7b 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -131,16 +131,16 @@ Event.observe(window,'unload',Event.unloadCache,false);Object.extend(Event,{OnLo {var w=document.addEventListener&&!window.addEventListener?document:window;Event.observe(w,'load',fn);},keyCode:function(e) {return e.keyCode!=null?e.keyCode:e.charCode},isHTMLEvent:function(type) {var events=['abort','blur','change','error','focus','load','reset','resize','scroll','select','submit','unload'];return events.include(type);},isMouseEvent:function(type) -{var events=['click','mousedown','mousemove','mouseout','mouseover','mouseup'];return events.include(type);},fireEvent:function(element,type) -{element=$(element);if(type=="submit") +{var events=['click','mousedown','mousemove','mouseout','mouseover','mouseup'];return events.include(type);},fireEvent:function(element,type,canBubble) +{canBubble=(typeof(canBubble)==undefined)?true:canBubble;element=$(element);if(type=="submit") return element.submit();if(document.createEvent) {if(Event.isHTMLEvent(type)) -{var event=document.createEvent('HTMLEvents');event.initEvent(type,true,true);} +{var event=document.createEvent('HTMLEvents');event.initEvent(type,canBubble,true);} else if(Event.isMouseEvent(type)) {var event=document.createEvent('MouseEvents');if(event.initMouseEvent) -{event.initMouseEvent(type,true,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);} +{event.initMouseEvent(type,canBubble,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);} else -{event.initEvent(type,true,true);}} +{event.initEvent(type,canBubble,true);}} element.dispatchEvent(event);} else if(document.createEventObject) {var evObj=document.createEventObject();element.fireEvent('on'+type,evObj);} @@ -390,17 +390,8 @@ text+=node.nodeValue;} if(text.length>0) window.clipboardData.setData("Text",text);},hover:function(obj) {obj.parentNode.className="copycode copycode_hover";},out:function(obj) -{obj.parentNode.className="copycode";}});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;}}
\ No newline at end of file +{obj.parentNode.className="copycode";}});Prado.WebUI.TCheckBoxList=Base.extend({constructor:function(options) +{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 diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js index 5acdfb63..dc35043d 100644 --- a/framework/Web/Javascripts/js/debug/ajax.js +++ b/framework/Web/Javascripts/js/debug/ajax.js @@ -2065,6 +2065,24 @@ Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox);
+Prado.WebUI.TActiveCheckBoxList = Base.extend(
+{
+ constructor : function(options)
+ {
+ 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.TActiveCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TActiveRadioButtonList = Prado.WebUI.TActiveCheckBoxList;
+
/**
* TActiveTextBox control, handles onchange event.
*/
@@ -2161,7 +2179,7 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( startTimer : function()
{
this.options.onComplete = this.onRequestComplete.bind(this);
- setTimeout(this.onTimerEvent.bind(this), 200);
+ this.timer = setTimeout(this.onTimerEvent.bind(this), 200);
},
stopTimer : function()
@@ -2215,19 +2233,17 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( register : function(timer)
{
- this.timers[timer.options.ID] = timer;
+ Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer;
},
start : function(id)
{
- if(this.timers[id])
- this.timers[id].startTimer();
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();
},
stop : function(id)
{
- if(this.timers[id])
- this.timers[id].stopTimer();
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();
}
});
@@ -2355,13 +2371,12 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( register : function(timer)
{
- this.timers[timer.options.ID] = timer;
+ Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer;
},
stop : function(id)
{
- if(this.timers[id])
- this.timers[id].stopObserving();
+ Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();
}
});
@@ -2595,3 +2610,127 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( }
}); +Prado.WebUI.TRatingList = Base.extend(
+{
+ selectedIndex : -1,
+ enabled : true,
+
+ constructor : function(options)
+ {
+ var cap = $(options.CaptionID);
+ this.options = Object.extend(
+ {
+ caption : cap ? cap.innerHTML : ''
+ }, options || {});
+
+ Prado.WebUI.TRatingList.register(this);
+ this._init();
+ this.selectedIndex = options.SelectedIndex;
+ this.setRating(this.selectedIndex);
+ },
+
+ _init: function(options)
+ {
+ Element.addClassName($(this.options.ListID),this.options.Style);
+ var radios = document.getElementsByName(this.options.ListName);
+ this.radios = new Array();
+ var index=0;
+ for(var i = 0; i<radios.length; i++)
+ {
+ var node = radios[i].parentNode;
+ if(node.tagName.toLowerCase()=='td')
+ {
+ this.radios.push(radios[i]);
+ Event.observe(node, "mouseover", this.hover.bindEvent(this,index));
+ Event.observe(node, "mouseout", this.recover.bindEvent(this,index));
+ Event.observe(node, "click", this.click.bindEvent(this, index));
+ index++;
+ Element.addClassName(node,"rating");
+ }
+ }
+ },
+
+ hover : function(ev,index)
+ {
+ if(this.enabled==false) return;
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = i <= index ? 'addClassName' : 'removeClassName'
+ Element[action](this.radios[i].parentNode,"rating_hover");
+ }
+ this.setCaption(index);
+ },
+
+ recover : function(ev,index)
+ {
+ if(this.enabled==false) return;
+ for(var i = 0; i<=index; i++)
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ this.setRating(this.selectedIndex);
+ },
+
+ click : function(ev, index)
+ {
+ if(this.enabled==false) return;
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].checked = (i == index);
+ this.selectedIndex = index;
+ this.setRating(index);
+ var requestOptions = Object.extend(
+ {
+ ID : this.options.ListID+"_c"+index,
+ EventTarget : this.options.ListName+"$c"+index
+ },this.options);
+ var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
+ if(request.dispatch()==false)
+ Event.stop(ev);
+ },
+
+ setRating: function(index)
+ {
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = i <= index ? 'addClassName' : 'removeClassName'
+ Element[action](this.radios[i].parentNode, "rating_selected");
+ }
+ this.setCaption(index);
+ },
+
+ setCaption : function(index)
+ {
+ var value = index > -1 ? this.radios[index].value : this.options.caption;
+ var caption = $(this.options.CaptionID);
+ if(caption) caption.innerHTML = value;
+ $(this.options.ListName).title = value;
+ },
+
+ setEnabled : function(value)
+ {
+ this.enabled = value;
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = value ? 'removeClassName' : 'addClassName'
+ Element[action](this.radios[i].parentNode, "rating_disabled");
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ }
+ }
+},
+{
+ratings : {},
+register : function(rating)
+{
+ Prado.WebUI.TRatingList.ratings[rating.options.ListID] = rating;
+},
+
+setEnabled : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setEnabled(value);
+},
+
+setRating : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setRating(value);
+ Prado.WebUI.TRatingList.ratings[id].selectedIndex = value;
+}
+}); + diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js index 122a5640..a455a0dd 100644 --- a/framework/Web/Javascripts/js/debug/prado.js +++ b/framework/Web/Javascripts/js/debug/prado.js @@ -1924,14 +1924,14 @@ if (navigator.appVersion.match(/\bMSIE\b/)) /**
* @class Event extensions.
*/
-Object.extend(Event,
+Object.extend(Event,
{
/**
- * Register a function to be executed when the page is loaded.
- * Note that the page is only loaded if all resources (e.g. images)
+ * Register a function to be executed when the page is loaded.
+ * Note that the page is only loaded if all resources (e.g. images)
* are loaded.
- *
- * Example: Show an alert box with message "Page Loaded!" when the
+ *
+ * Example: Show an alert box with message "Page Loaded!" when the
* page finished loading.
* <code>
* Event.OnLoad(function(){ alert("Page Loaded!"); });
@@ -1939,18 +1939,18 @@ Object.extend(Event, *
* @param {Function} function to execute when page is loaded.
*/
- OnLoad : function (fn)
+ OnLoad : function (fn)
{
// opera onload is in document, not window
- var w = document.addEventListener &&
+ var w = document.addEventListener &&
!window.addEventListener ? document : window;
Event.observe(w,'load',fn);
},
/**
* @param {Event} a keyboard event
- * @return {Number} the Unicode character code generated by the key
- * that was struck.
+ * @return {Number} the Unicode character code generated by the key
+ * that was struck.
*/
keyCode : function(e)
{
@@ -1959,64 +1959,65 @@ Object.extend(Event, /**
* @param {String} event type or event name.
- * @return {Boolean} true if event type is of HTMLEvent, false
+ * @return {Boolean} true if event type is of HTMLEvent, false
* otherwise
*/
isHTMLEvent : function(type)
{
- var events = ['abort', 'blur', 'change', 'error', 'focus',
- 'load', 'reset', 'resize', 'scroll', 'select',
+ var events = ['abort', 'blur', 'change', 'error', 'focus',
+ 'load', 'reset', 'resize', 'scroll', 'select',
'submit', 'unload'];
return events.include(type);
},
/**
* @param {String} event type or event name
- * @return {Boolean} true if event type is of MouseEvent,
+ * @return {Boolean} true if event type is of MouseEvent,
* false otherwise
*/
isMouseEvent : function(type)
{
- var events = ['click', 'mousedown', 'mousemove', 'mouseout',
+ var events = ['click', 'mousedown', 'mousemove', 'mouseout',
'mouseover', 'mouseup'];
return events.include(type);
},
/**
- * Dispatch the DOM event of a given <tt>type</tt> on a DOM
- * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
- * dispatched, keyboard events or UIEvent can not be dispatch
+ * Dispatch the DOM event of a given <tt>type</tt> on a DOM
+ * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
+ * dispatched, keyboard events or UIEvent can not be dispatch
* via javascript consistently.
* For the "submit" event the submit() method is called.
* @param {Object} element id string or a DOM element.
* @param {String} event type to dispatch.
*/
- fireEvent : function(element,type)
+ fireEvent : function(element,type,canBubble)
{
+ canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
element = $(element);
if(type == "submit")
return element.submit();
if(document.createEvent)
- {
+ {
if(Event.isHTMLEvent(type))
{
var event = document.createEvent('HTMLEvents');
- event.initEvent(type, true, true);
+ event.initEvent(type, canBubble, true);
}
else if(Event.isMouseEvent(type))
{
- var event = document.createEvent('MouseEvents');
+ var event = document.createEvent('MouseEvents');
if (event.initMouseEvent)
{
- event.initMouseEvent(type,true,true,
- document.defaultView, 1, 0, 0, 0, 0, false,
+ event.initMouseEvent(type,canBubble,true,
+ document.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, 0, null);
}
else
{
// Safari
// TODO we should be initialising other mouse-event related attributes here
- event.initEvent(type, true, true);
+ event.initEvent(type, canBubble, true);
}
}
element.dispatchEvent(event);
@@ -3471,7 +3472,7 @@ Prado.WebUI.DefaultButton.prototype = if(defaultButton)
{
this.triggered = true;
- $('PRADO_POSTBACK_TARGET').value = this.options.EventTarget;
+ $('PRADO_POSTBACK_TARGET').value = this.options.EventTarget;
Event.fireEvent(defaultButton, this.options['Event']);
Event.stop(ev);
}
@@ -3525,66 +3526,37 @@ Object.extend(Prado.WebUI.TTextHighlighter, obj.parentNode.className = "copycode";
}
});
- - -Prado.WebUI.TRatingList = Class.create();
-Prado.WebUI.TRatingList.prototype =
-{
- selectedIndex : -1,
- initialize : function(options)
+
+Prado.WebUI.TCheckBoxList = Base.extend(
+{
+ constructor : 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++)
+ for(var i = 0; i<options.ItemCount; 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)
+ 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)
{
- this.caption.innerHTML = index > -1 ?
- this.radios[index].value : this.options.caption;
+ 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);
+ }
}
-} +}); diff --git a/framework/Web/Javascripts/prado/activecontrols3.js b/framework/Web/Javascripts/prado/activecontrols3.js index 315ead78..68ea3cf3 100644 --- a/framework/Web/Javascripts/prado/activecontrols3.js +++ b/framework/Web/Javascripts/prado/activecontrols3.js @@ -49,6 +49,24 @@ Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox);
+Prado.WebUI.TActiveCheckBoxList = Base.extend(
+{
+ constructor : function(options)
+ {
+ 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.TActiveCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TActiveRadioButtonList = Prado.WebUI.TActiveCheckBoxList;
+
/**
* TActiveTextBox control, handles onchange event.
*/
@@ -199,19 +217,17 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( register : function(timer)
{
- this.timers[timer.options.ID] = timer;
+ Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer;
},
start : function(id)
{
- if(this.timers[id])
- this.timers[id].startTimer();
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();
},
stop : function(id)
{
- if(this.timers[id])
- this.timers[id].stopTimer();
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();
}
});
@@ -339,12 +355,11 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( register : function(timer)
{
- this.timers[timer.options.ID] = timer;
+ Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer;
},
stop : function(id)
{
- if(this.timers[id])
- this.timers[id].stopObserving();
+ Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();
}
});
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js index 8595b5fd..76ff828c 100644 --- a/framework/Web/Javascripts/prado/controls.js +++ b/framework/Web/Javascripts/prado/controls.js @@ -220,7 +220,7 @@ Prado.WebUI.DefaultButton.prototype = if(defaultButton)
{
this.triggered = true;
- $('PRADO_POSTBACK_TARGET').value = this.options.EventTarget;
+ $('PRADO_POSTBACK_TARGET').value = this.options.EventTarget;
Event.fireEvent(defaultButton, this.options['Event']);
Event.stop(ev);
}
@@ -274,3 +274,36 @@ Object.extend(Prado.WebUI.TTextHighlighter, obj.parentNode.className = "copycode";
}
});
+
+
+Prado.WebUI.TCheckBoxList = Base.extend(
+{
+ constructor : function(options)
+ {
+ 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 diff --git a/framework/Web/Javascripts/ratings/blocks.css b/framework/Web/Javascripts/ratings/blocks.css index 2bf2e904..63cb7c2b 100644 --- a/framework/Web/Javascripts/ratings/blocks.css +++ b/framework/Web/Javascripts/ratings/blocks.css @@ -6,24 +6,36 @@ {
display: none;
}
+
.TRatingList_blocks td
{
- width: 17px;
- height: 18px;
- background-image: url(blocks_blank.gif);
+ width: 18px;
+ height: 9px;
+ padding: 1px;
+}
+
+.TRatingList_blocks td.rating
+{
+ background-image: url(blocks_combined.png);
background-repeat: no-repeat;
cursor: pointer;
+ background-position: 1px 0px;
}
.TRatingList_blocks td.rating_selected
{
- background-image: url(blocks_selected.gif);
+ background-position: 1px -100px;
}
.TRatingList_blocks td.rating_hover
{
- background-image: url(blocks_hover.gif);
+ background-position: 1px -200px;
}
.TRatingList_blocks td.rating_half
{
- background-image: url(blocks_half.gif);
+ background-position: 1px -300px;
}
+
+.TRatingList_blocks td.rating_disabled
+{
+ cursor: default !important;
+}
\ No newline at end of file diff --git a/framework/Web/Javascripts/ratings/blocks.png b/framework/Web/Javascripts/ratings/blocks.png Binary files differindex 16a2b249..923cda09 100644 --- a/framework/Web/Javascripts/ratings/blocks.png +++ b/framework/Web/Javascripts/ratings/blocks.png diff --git a/framework/Web/Javascripts/ratings/blocks_blank.gif b/framework/Web/Javascripts/ratings/blocks_blank.gif Binary files differdeleted file mode 100644 index a68d0e94..00000000 --- a/framework/Web/Javascripts/ratings/blocks_blank.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/blocks_blank.png b/framework/Web/Javascripts/ratings/blocks_blank.png Binary files differnew file mode 100644 index 00000000..d5004d2d --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_blank.png diff --git a/framework/Web/Javascripts/ratings/blocks_combined.png b/framework/Web/Javascripts/ratings/blocks_combined.png Binary files differnew file mode 100644 index 00000000..57c07672 --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_combined.png diff --git a/framework/Web/Javascripts/ratings/blocks_half.gif b/framework/Web/Javascripts/ratings/blocks_half.gif Binary files differdeleted file mode 100644 index 4cff0148..00000000 --- a/framework/Web/Javascripts/ratings/blocks_half.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/blocks_half.png b/framework/Web/Javascripts/ratings/blocks_half.png Binary files differnew file mode 100644 index 00000000..344aa207 --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_half.png diff --git a/framework/Web/Javascripts/ratings/blocks_hover.gif b/framework/Web/Javascripts/ratings/blocks_hover.gif Binary files differdeleted file mode 100644 index 58ad7495..00000000 --- a/framework/Web/Javascripts/ratings/blocks_hover.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/blocks_selected.gif b/framework/Web/Javascripts/ratings/blocks_selected.gif Binary files differdeleted file mode 100644 index f91873e2..00000000 --- a/framework/Web/Javascripts/ratings/blocks_selected.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/blocks_selected.png b/framework/Web/Javascripts/ratings/blocks_selected.png Binary files differnew file mode 100644 index 00000000..dfdb6889 --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_selected.png diff --git a/framework/Web/Javascripts/ratings/default.css b/framework/Web/Javascripts/ratings/default.css index c15a36bd..cf8f7558 100644 --- a/framework/Web/Javascripts/ratings/default.css +++ b/framework/Web/Javascripts/ratings/default.css @@ -6,24 +6,36 @@ {
display: none;
}
+
.TRatingList_default td
{
- width: 17px;
+ width: 18px;
height: 18px;
- background-image: url(default_blank.gif);
+ padding: 0;
+}
+
+.TRatingList_default td.rating
+{
+ background-image: url(default_combined.png);
background-repeat: no-repeat;
cursor: pointer;
+ background-position: 0px 0px;
}
.TRatingList_default td.rating_selected
{
- background-image: url(default_selected.gif);
+ background-position: 0px -100px;
}
.TRatingList_default td.rating_hover
{
- background-image: url(default_hover.gif);
+ background-position: 0px -200px;
}
.TRatingList_default td.rating_half
{
- background-image: url(default_half.gif);
+ background-position: 0px -300px;
}
+
+.TRatingList_default td.rating_disabled
+{
+ cursor: default !important;
+}
\ No newline at end of file diff --git a/framework/Web/Javascripts/ratings/default.png b/framework/Web/Javascripts/ratings/default.png Binary files differnew file mode 100644 index 00000000..f9f380a9 --- /dev/null +++ b/framework/Web/Javascripts/ratings/default.png diff --git a/framework/Web/Javascripts/ratings/default_blank.gif b/framework/Web/Javascripts/ratings/default_blank.gif Binary files differdeleted file mode 100644 index 4e6fda3c..00000000 --- a/framework/Web/Javascripts/ratings/default_blank.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default_blank.png b/framework/Web/Javascripts/ratings/default_blank.png Binary files differnew file mode 100644 index 00000000..f857ff17 --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_blank.png diff --git a/framework/Web/Javascripts/ratings/default_combined.png b/framework/Web/Javascripts/ratings/default_combined.png Binary files differnew file mode 100644 index 00000000..1756f912 --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_combined.png diff --git a/framework/Web/Javascripts/ratings/default_half.gif b/framework/Web/Javascripts/ratings/default_half.gif Binary files differdeleted file mode 100644 index 7cecf0ec..00000000 --- a/framework/Web/Javascripts/ratings/default_half.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default_half.png b/framework/Web/Javascripts/ratings/default_half.png Binary files differnew file mode 100644 index 00000000..6c826054 --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_half.png diff --git a/framework/Web/Javascripts/ratings/default_hover.gif b/framework/Web/Javascripts/ratings/default_hover.gif Binary files differdeleted file mode 100644 index ad0cd28a..00000000 --- a/framework/Web/Javascripts/ratings/default_hover.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default_selected.gif b/framework/Web/Javascripts/ratings/default_selected.gif Binary files differdeleted file mode 100644 index a19ab39f..00000000 --- a/framework/Web/Javascripts/ratings/default_selected.gif +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default_selected.png b/framework/Web/Javascripts/ratings/default_selected.png Binary files differnew file mode 100644 index 00000000..e40d6b04 --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_selected.png diff --git a/framework/Web/Javascripts/ratings/ratings.js b/framework/Web/Javascripts/ratings/ratings.js index e6fd97ba..04ebd31d 100644 --- a/framework/Web/Javascripts/ratings/ratings.js +++ b/framework/Web/Javascripts/ratings/ratings.js @@ -1,60 +1,123 @@ -Prado.WebUI.TRatingList = Class.create();
-Prado.WebUI.TRatingList.prototype =
+Prado.WebUI.TRatingList = Base.extend(
{
selectedIndex : -1,
+ enabled : true,
- initialize : function(options)
+ constructor : 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++)
+ var cap = $(options.CaptionID);
+ this.options = Object.extend(
{
- 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;
+ caption : cap ? cap.innerHTML : ''
+ }, options || {});
+
+ Prado.WebUI.TRatingList.register(this);
+ this._init();
+ this.selectedIndex = options.SelectedIndex;
this.setRating(this.selectedIndex);
},
-
+
+ _init: function(options)
+ {
+ Element.addClassName($(this.options.ListID),this.options.Style);
+ var radios = document.getElementsByName(this.options.ListName);
+ this.radios = new Array();
+ var index=0;
+ for(var i = 0; i<radios.length; i++)
+ {
+ var node = radios[i].parentNode;
+ if(node.tagName.toLowerCase()=='td')
+ {
+ this.radios.push(radios[i]);
+ Event.observe(node, "mouseover", this.hover.bindEvent(this,index));
+ Event.observe(node, "mouseout", this.recover.bindEvent(this,index));
+ Event.observe(node, "click", this.click.bindEvent(this, index));
+ index++;
+ Element.addClassName(node,"rating");
+ }
+ }
+ },
+
hover : function(ev,index)
{
+ if(this.enabled==false) return;
for(var i = 0; i<this.radios.length; i++)
- this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
+ {
+ var action = i <= index ? 'addClassName' : 'removeClassName'
+ Element[action](this.radios[i].parentNode,"rating_hover");
+ }
this.setCaption(index);
},
-
+
recover : function(ev,index)
{
+ if(this.enabled==false) return;
for(var i = 0; i<=index; i++)
Element.removeClassName(this.radios[i].parentNode, "rating_hover");
this.setRating(this.selectedIndex);
},
-
+
click : function(ev, index)
{
+ if(this.enabled==false) return;
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);
+ var requestOptions = Object.extend(
+ {
+ ID : this.options.ListID+"_c"+index,
+ EventTarget : this.options.ListName+"$c"+index
+ },this.options);
+ var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
+ if(request.dispatch()==false)
+ Event.stop(ev);
},
-
+
setRating: function(index)
{
- for(var i = 0; i<=index; i++)
- this.radios[i].parentNode.className = "rating_selected";
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = i <= index ? 'addClassName' : 'removeClassName'
+ Element[action](this.radios[i].parentNode, "rating_selected");
+ }
this.setCaption(index);
},
-
+
setCaption : function(index)
{
- this.caption.innerHTML = index > -1 ?
- this.radios[index].value : this.options.caption;
+ var value = index > -1 ? this.radios[index].value : this.options.caption;
+ var caption = $(this.options.CaptionID);
+ if(caption) caption.innerHTML = value;
+ $(this.options.ListName).title = value;
+ },
+
+ setEnabled : function(value)
+ {
+ this.enabled = value;
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = value ? 'removeClassName' : 'addClassName'
+ Element[action](this.radios[i].parentNode, "rating_disabled");
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ }
}
-}
\ No newline at end of file +},
+{
+ratings : {},
+register : function(rating)
+{
+ Prado.WebUI.TRatingList.ratings[rating.options.ListID] = rating;
+},
+
+setEnabled : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setEnabled(value);
+},
+
+setRating : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setRating(value);
+ Prado.WebUI.TRatingList.ratings[id].selectedIndex = value;
+}
+});
\ No newline at end of file diff --git a/framework/Web/Javascripts/ratings/stars1.png b/framework/Web/Javascripts/ratings/stars1.png Binary files differdeleted file mode 100644 index e4dd3c25..00000000 --- a/framework/Web/Javascripts/ratings/stars1.png +++ /dev/null |