diff options
author | wei <> | 2006-02-15 07:44:51 +0000 |
---|---|---|
committer | wei <> | 2006-02-15 07:44:51 +0000 |
commit | 6e29b055b3cbc2a46e29075608c7e82a328d5270 (patch) | |
tree | 13a197ad850f360125a96f5de83f1742a12e98ad /framework/Web/Javascripts/js | |
parent | d653bda6c6217f160a4de77e3f2f0ee62096be67 (diff) |
Adding new TRatingList component.
Diffstat (limited to 'framework/Web/Javascripts/js')
-rw-r--r-- | framework/Web/Javascripts/js/prado.js | 87 |
1 files changed, 66 insertions, 21 deletions
diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js index 0ca9d306..caae1134 100644 --- a/framework/Web/Javascripts/js/prado.js +++ b/framework/Web/Javascripts/js/prado.js @@ -1404,7 +1404,7 @@ _328.appendChild(Builder._text(_329)); return (typeof _330=="string"||typeof _330=="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"]; +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"]; tags.each(function(tag){ window[tag]=function(){ var args=$A(arguments); @@ -1901,24 +1901,19 @@ Event.stop(e); } } }}); -Prado.WebUI.TListControl=Prado.WebUI.createPostBackComponent({onInit:function(_433){ -Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_433)); -}}); -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(_433){ +this.options=_433; 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(_433["Panel"],"keydown",this._event); +},triggerEvent:function(ev,_435){ +var _436=Event.keyCode(ev)==Event.KEY_RETURN; +var _437=Event.element(ev).tagName.toLowerCase()=="textarea"; +if(_436&&!_437){ +var _438=$(this.options["Target"]); +if(_438){ this.triggered=true; -Event.fireEvent(_439,this.options["Event"]); +Event.fireEvent(_438,this.options["Event"]); Event.stop(ev); } } @@ -1928,15 +1923,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 _439={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(_439,"Copy Code")); document.write(DIV(null,div).innerHTML); }}; Object.extend(Prado.WebUI.TTextHighlighter,{copy:function(obj){ -var _441=obj.parentNode.parentNode.parentNode; +var _440=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<_440.childNodes.length;i++){ +var node=_440.childNodes[i]; if(node.innerText){ text+=node.innerText=="Copy Code"?"":node.innerText; }else{ @@ -1951,4 +1946,54 @@ 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(_441){ +this.options=_441; +this.element=$(_441["ID"]); +Element.addClassName(this.element,_441.cssClass); +var _442=_441.total*_441.dx; +this.element.style.width=_442+"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=_441.pos; +this.radios=document.getElementsByName(_441.field); +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,_443){ +var obj=Event.element(e); +var _444=Position.cumulativeOffset(obj); +var _445=Event.pointerX(e)-_444[0]; +var pos=parseInt(_445/this.options.dx); +if(!_443||this.options.pos!=pos){ +this.showPosition(pos,_443); +} +},click:function(ev){ +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); +} +},showPosition:function(pos,_446){ +if(pos>=this.options.total){ +return; +} +var dy=this.options.dy*(pos+1)+this.options.iy; +var dx=_446?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; +}}; |