diff options
author | wei <> | 2007-03-30 00:38:41 +0000 |
---|---|---|
committer | wei <> | 2007-03-30 00:38:41 +0000 |
commit | 3fb25eec92c0c72760c4bf8040efd4b86c446bc6 (patch) | |
tree | a7c76d761f432b29dfa567c4e46acb62a7abf18b /framework/Web/Javascripts/js/compressed | |
parent | eddf47f3e36a30f6b905e4d667514eb34968ff8a (diff) |
Fixed #579
Diffstat (limited to 'framework/Web/Javascripts/js/compressed')
-rw-r--r-- | framework/Web/Javascripts/js/compressed/ajax.js | 32 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/compressed/prado.js | 15 |
2 files changed, 45 insertions, 2 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index 7f08d38c..d67d6adb 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -315,4 +315,34 @@ this.options.onFailure(sender,parameter);}},{textboxes:{},register:function(obj) {var textbox=Prado.WebUI.TInPlaceTextBox.textboxes[id];if(textbox) {if(value) textbox.enterEditMode(null);else -{textbox.exitEditMode(null);}}}});
\ No newline at end of file +{textbox.exitEditMode(null);}}}});Prado.WebUI.TActiveRatingList=Base.extend({selectedIndex:-1,rating:-1,enabled:true,readOnly:false,constructor:function(options) +{var cap=$(options.CaptionID);this.options=Object.extend({caption:cap?cap.innerHTML:''},options||{});Prado.WebUI.TActiveRatingList.register(this);this._init();this.selectedIndex=options.SelectedIndex;this.rating=options.Rating;if(options.Rating<=0&&options.SelectedIndex>=0) +this.rating=options.SelectedIndex+1;this.showRating(this.rating);},_init:function(options) +{Element.addClassName($(this.options.ListID),this.options.Style);this.radios=new Array();var index=0;for(var i=0;i<this.options.ItemCount;i++) +{var radio=$(this.options.ListID+'_c'+i);var td=radio.parentNode;if(radio&&td.tagName.toLowerCase()=='td') +{this.radios.push(radio);Event.observe(td,"mouseover",this.hover.bindEvent(this,index));Event.observe(td,"mouseout",this.recover.bindEvent(this,index));Event.observe(td,"click",this.click.bindEvent(this,index));index++;Element.addClassName(td,"rating");}}},hover:function(ev,index) +{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) +{var node=this.radios[i].parentNode;var action=i<=index?'addClassName':'removeClassName' +Element[action](node,"rating_hover");Element.removeClassName(node,"rating_selected");Element.removeClassName(node,"rating_half");} +this.showCaption(this.getIndexCaption(index));},recover:function(ev,index) +{if(this.enabled==false)return;this.showRating(this.rating);this.showCaption(this.options.caption);},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+1);this.dispatchRequest(ev);},dispatchRequest:function(ev) +{var requestOptions=Object.extend({ID:this.options.ListID+"_c"+this.selectedIndex,EventTarget:this.options.ListName+"$c"+this.selectedIndex},this.options);var request=new Prado.CallbackRequest(requestOptions.EventTarget,requestOptions);if(request.dispatch()==false) +Event.stop(ev);},setRating:function(value) +{this.rating=value;var base=Math.floor(value-1);var remainder=value-base-1;var halfMax=this.options.HalfRating["1"];var index=remainder>halfMax?base+1:base;for(var i=0;i<this.radios.length;i++) +this.radios[i].checked=(i==index);var caption=this.getIndexCaption(index);this.setCaption(caption);this.showCaption(caption);this.showRating(value);},showRating:function(value) +{var base=Math.floor(value-1);var remainder=value-base-1;var halfMin=this.options.HalfRating["0"];var halfMax=this.options.HalfRating["1"];var index=remainder>halfMax?base+1:base;var hasHalf=remainder>=halfMin&&remainder<=halfMax;for(var i=0;i<this.radios.length;i++) +{var node=this.radios[i].parentNode;var action=i>index?'removeClassName':'addClassName';Element[action](node,"rating_selected");if(i==index+1&&hasHalf) +Element.addClassName(node,"rating_half");else +Element.removeClassName(node,"rating_half");Element.removeClassName(node,"rating_hover");}},getIndexCaption:function(index) +{return index>-1?this.radios[index].value:this.options.caption;},showCaption:function(value) +{var caption=$(this.options.CaptionID);if(caption)caption.innerHTML=value;$(this.options.ListID).title=value;},setCaption:function(value) +{this.options.caption=value;this.showCaption(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");}}},{ratings:{},register:function(rating) +{Prado.WebUI.TActiveRatingList.ratings[rating.options.ListID]=rating;},setEnabled:function(id,value) +{Prado.WebUI.TActiveRatingList.ratings[id].setEnabled(value);},setRating:function(id,value) +{Prado.WebUI.TActiveRatingList.ratings[id].setRating(value);},setCaption:function(id,value) +{Prado.WebUI.TActiveRatingList.ratings[id].setCaption(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 74c50356..9912b1fc 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -502,4 +502,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(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 |