diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/Javascripts/build.bat | 2 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/ajax.js | 1285 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/base.js | 998 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/clientscripts.php | 7 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/datepicker.js | 422 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/effects.js | 720 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/prado.js (renamed from framework/Web/Javascripts/js/dom.js) | 1031 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/rico.js | 1900 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/controls.js | 188 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/form.js | 167 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/prado.js | 49 | ||||
-rw-r--r-- | framework/Web/Javascripts/prototype/compat.js | 27 | ||||
-rw-r--r-- | framework/Web/UI/TClientScriptManager.php | 20 |
13 files changed, 5413 insertions, 1403 deletions
diff --git a/framework/Web/Javascripts/build.bat b/framework/Web/Javascripts/build.bat new file mode 100644 index 00000000..30561e68 --- /dev/null +++ b/framework/Web/Javascripts/build.bat @@ -0,0 +1,2 @@ +@echo off
+php ../../../tools/jsbuilder/build.php %1 %2 %3 %4 %5 %6 %7 %8 %9
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/ajax.js b/framework/Web/Javascripts/js/ajax.js index c4a56254..7eb523c0 100644 --- a/framework/Web/Javascripts/js/ajax.js +++ b/framework/Web/Javascripts/js/ajax.js @@ -707,3 +707,1288 @@ return ch>="0"&&ch<="9"?number():word(); return value(); }}; +var Autocompleter={}; +Autocompleter.Base=function(){ +}; +Autocompleter.Base.prototype={baseInitialize:function(_1,_2,_3){ +this.element=$(_1); +this.update=$(_2); +this.hasFocus=false; +this.changed=false; +this.active=false; +this.index=0; +this.entryCount=0; +if(this.setOptions){ +this.setOptions(_3); +}else{ +this.options=_3||{}; +} +this.options.paramName=this.options.paramName||this.element.name; +this.options.tokens=this.options.tokens||[]; +this.options.frequency=this.options.frequency||0.4; +this.options.minChars=this.options.minChars||1; +this.options.onShow=this.options.onShow||function(_1,_2){ +if(!_2.style.position||_2.style.position=="absolute"){ +_2.style.position="absolute"; +Position.clone(_1,_2,{setHeight:false,offsetTop:_1.offsetHeight}); +} +Effect.Appear(_2,{duration:0.15}); +}; +this.options.onHide=this.options.onHide||function(_4,_5){ +new Effect.Fade(_5,{duration:0.15}); +}; +if(typeof (this.options.tokens)=="string"){ +this.options.tokens=new Array(this.options.tokens); +} +this.observer=null; +this.element.setAttribute("autocomplete","off"); +Element.hide(this.update); +Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this)); +Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this)); +},show:function(){ +if(Element.getStyle(this.update,"display")=="none"){ +this.options.onShow(this.element,this.update); +} +if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(Element.getStyle(this.update,"position")=="absolute")){ +new Insertion.After(this.update,"<iframe id=\""+this.update.id+"_iefix\" "+"style=\"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" "+"src=\"javascript:false;\" frameborder=\"0\" scrolling=\"no\"></iframe>"); +this.iefix=$(this.update.id+"_iefix"); +} +if(this.iefix){ +setTimeout(this.fixIEOverlapping.bind(this),50); +} +},fixIEOverlapping:function(){ +Position.clone(this.update,this.iefix); +this.iefix.style.zIndex=1; +this.update.style.zIndex=2; +Element.show(this.iefix); +},hide:function(){ +this.stopIndicator(); +if(Element.getStyle(this.update,"display")!="none"){ +this.options.onHide(this.element,this.update); +} +if(this.iefix){ +Element.hide(this.iefix); +} +},startIndicator:function(){ +if(this.options.indicator){ +Element.show(this.options.indicator); +} +},stopIndicator:function(){ +if(this.options.indicator){ +Element.hide(this.options.indicator); +} +},onKeyPress:function(_6){ +if(this.active){ +switch(_6.keyCode){ +case Event.KEY_TAB: +case Event.KEY_RETURN: +this.selectEntry(); +Event.stop(_6); +case Event.KEY_ESC: +this.hide(); +this.active=false; +Event.stop(_6); +return; +case Event.KEY_LEFT: +case Event.KEY_RIGHT: +return; +case Event.KEY_UP: +this.markPrevious(); +this.render(); +if(navigator.appVersion.indexOf("AppleWebKit")>0){ +Event.stop(_6); +} +return; +case Event.KEY_DOWN: +this.markNext(); +this.render(); +if(navigator.appVersion.indexOf("AppleWebKit")>0){ +Event.stop(_6); +} +return; +} +}else{ +if(_6.keyCode==Event.KEY_TAB||_6.keyCode==Event.KEY_RETURN){ +return; +} +} +this.changed=true; +this.hasFocus=true; +if(this.observer){ +clearTimeout(this.observer); +} +this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000); +},onHover:function(_7){ +var _8=Event.findElement(_7,"LI"); +if(this.index!=_8.autocompleteIndex){ +this.index=_8.autocompleteIndex; +this.render(); +} +Event.stop(_7); +},onClick:function(_9){ +var _10=Event.findElement(_9,"LI"); +this.index=_10.autocompleteIndex; +this.selectEntry(); +this.hide(); +},onBlur:function(_11){ +setTimeout(this.hide.bind(this),250); +this.hasFocus=false; +this.active=false; +},render:function(){ +if(this.entryCount>0){ +for(var i=0;i<this.entryCount;i++){ +this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected"); +} +if(this.hasFocus){ +this.show(); +this.active=true; +} +}else{ +this.active=false; +this.hide(); +} +},markPrevious:function(){ +if(this.index>0){ +this.index--; +}else{ +this.index=this.entryCount-1; +} +},markNext:function(){ +if(this.index<this.entryCount-1){ +this.index++; +}else{ +this.index=0; +} +},getEntry:function(_13){ +return this.update.firstChild.childNodes[_13]; +},getCurrentEntry:function(){ +return this.getEntry(this.index); +},selectEntry:function(){ +this.active=false; +this.updateElement(this.getCurrentEntry()); +},updateElement:function(_14){ +if(this.options.updateElement){ +this.options.updateElement(_14); +return; +} +var _15=Element.collectTextNodesIgnoreClass(_14,"informal"); +var _16=this.findLastToken(); +if(_16!=-1){ +var _17=this.element.value.substr(0,_16+1); +var _18=this.element.value.substr(_16+1).match(/^\s+/); +if(_18){ +_17+=_18[0]; +} +this.element.value=_17+_15; +}else{ +this.element.value=_15; +} +this.element.focus(); +if(this.options.afterUpdateElement){ +this.options.afterUpdateElement(this.element,_14); +} +},updateChoices:function(_19){ +if(!this.changed&&this.hasFocus){ +this.update.innerHTML=_19; +Element.cleanWhitespace(this.update); +Element.cleanWhitespace(this.update.firstChild); +if(this.update.firstChild&&this.update.firstChild.childNodes){ +this.entryCount=this.update.firstChild.childNodes.length; +for(var i=0;i<this.entryCount;i++){ +var _20=this.getEntry(i); +_20.autocompleteIndex=i; +this.addObservers(_20); +} +}else{ +this.entryCount=0; +} +this.stopIndicator(); +this.index=0; +this.render(); +} +},addObservers:function(_21){ +Event.observe(_21,"mouseover",this.onHover.bindAsEventListener(this)); +Event.observe(_21,"click",this.onClick.bindAsEventListener(this)); +},onObserverEvent:function(){ +this.changed=false; +if(this.getToken().length>=this.options.minChars){ +this.startIndicator(); +this.getUpdatedChoices(); +}else{ +this.active=false; +this.hide(); +} +},getToken:function(){ +var _22=this.findLastToken(); +if(_22!=-1){ +var ret=this.element.value.substr(_22+1).replace(/^\s+/,"").replace(/\s+$/,""); +}else{ +var ret=this.element.value; +} +return /\n/.test(ret)?"":ret; +},findLastToken:function(){ +var _24=-1; +for(var i=0;i<this.options.tokens.length;i++){ +var _25=this.element.value.lastIndexOf(this.options.tokens[i]); +if(_25>_24){ +_24=_25; +} +} +return _24; +}}; +Ajax.Autocompleter=Class.create(); +Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(_26,_27,url,_29){ +this.baseInitialize(_26,_27,_29); +this.options.asynchronous=true; +this.options.onComplete=this.onComplete.bind(this); +this.options.defaultParams=this.options.parameters||null; +this.url=url; +},getUpdatedChoices:function(){ +entry=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken()); +this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry; +if(this.options.defaultParams){ +this.options.parameters+="&"+this.options.defaultParams; +} +new Ajax.Request(this.url,this.options); +},onComplete:function(_30){ +this.updateChoices(_30.responseText); +}}); +Autocompleter.Local=Class.create(); +Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(_31,_32,_33,_34){ +this.baseInitialize(_31,_32,_34); +this.options.array=_33; +},getUpdatedChoices:function(){ +this.updateChoices(this.options.selector(this)); +},setOptions:function(_35){ +this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(_36){ +var ret=[]; +var _37=[]; +var _38=_36.getToken(); +var _39=0; +for(var i=0;i<_36.options.array.length&&ret.length<_36.options.choices;i++){ +var _40=_36.options.array[i]; +var _41=_36.options.ignoreCase?_40.toLowerCase().indexOf(_38.toLowerCase()):_40.indexOf(_38); +while(_41!=-1){ +if(_41==0&&_40.length!=_38.length){ +ret.push("<li><strong>"+_40.substr(0,_38.length)+"</strong>"+_40.substr(_38.length)+"</li>"); +break; +}else{ +if(_38.length>=_36.options.partialChars&&_36.options.partialSearch&&_41!=-1){ +if(_36.options.fullSearch||/\s/.test(_40.substr(_41-1,1))){ +_37.push("<li>"+_40.substr(0,_41)+"<strong>"+_40.substr(_41,_38.length)+"</strong>"+_40.substr(_41+_38.length)+"</li>"); +break; +} +} +} +_41=_36.options.ignoreCase?_40.toLowerCase().indexOf(_38.toLowerCase(),_41+1):_40.indexOf(_38,_41+1); +} +} +if(_37.length){ +ret=ret.concat(_37.slice(0,_36.options.choices-ret.length)); +} +return "<ul>"+ret.join("")+"</ul>"; +}},_35||{}); +}}); +Field.scrollFreeActivate=function(_42){ +setTimeout(function(){ +Field.activate(_42); +},1); +}; +Ajax.InPlaceEditor=Class.create(); +Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99"; +Ajax.InPlaceEditor.prototype={initialize:function(_43,url,_44){ +this.url=url; +this.element=$(_43); +this.options=Object.extend({okText:"ok",cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(_45,_43){ +new Effect.Highlight(_43,{startcolor:this.options.highlightcolor}); +},onFailure:function(_46){ +alert("Error communicating with the server: "+_46.responseText.stripTags()); +},callback:function(_47){ +return Form.serialize(_47); +},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,ajaxOptions:{}},_44||{}); +if(!this.options.formId&&this.element.id){ +this.options.formId=this.element.id+"-inplaceeditor"; +if($(this.options.formId)){ +this.options.formId=null; +} +} +if(this.options.externalControl){ +this.options.externalControl=$(this.options.externalControl); +} +this.originalBackground=Element.getStyle(this.element,"background-color"); +if(!this.originalBackground){ +this.originalBackground="transparent"; +} +this.element.title=this.options.clickToEditText; +this.onclickListener=this.enterEditMode.bindAsEventListener(this); +this.mouseoverListener=this.enterHover.bindAsEventListener(this); +this.mouseoutListener=this.leaveHover.bindAsEventListener(this); +Event.observe(this.element,"click",this.onclickListener); +Event.observe(this.element,"mouseover",this.mouseoverListener); +Event.observe(this.element,"mouseout",this.mouseoutListener); +if(this.options.externalControl){ +Event.observe(this.options.externalControl,"click",this.onclickListener); +Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener); +Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener); +} +},enterEditMode:function(evt){ +if(this.saving){ +return; +} +if(this.editing){ +return; +} +this.editing=true; +this.onEnterEditMode(); +if(this.options.externalControl){ +Element.hide(this.options.externalControl); +} +Element.hide(this.element); +this.createForm(); +this.element.parentNode.insertBefore(this.form,this.element); +Field.scrollFreeActivate(this.editField); +if(evt){ +Event.stop(evt); +} +return false; +},createForm:function(){ +this.form=document.createElement("form"); +this.form.id=this.options.formId; +Element.addClassName(this.form,this.options.formClassName); +this.form.onsubmit=this.onSubmit.bind(this); +this.createEditField(); +if(this.options.textarea){ +var br=document.createElement("br"); +this.form.appendChild(br); +} +okButton=document.createElement("input"); +okButton.type="submit"; +okButton.value=this.options.okText; +this.form.appendChild(okButton); +cancelLink=document.createElement("a"); +cancelLink.href="#"; +cancelLink.appendChild(document.createTextNode(this.options.cancelText)); +cancelLink.onclick=this.onclickCancel.bind(this); +this.form.appendChild(cancelLink); +},hasHTMLLineBreaks:function(_50){ +if(!this.options.handleLineBreaks){ +return false; +} +return _50.match(/<br/i)||_50.match(/<p>/i); +},convertHTMLLineBreaks:function(_51){ +return _51.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,""); +},createEditField:function(){ +var _52; +if(this.options.loadTextURL){ +_52=this.options.loadingText; +}else{ +_52=this.getText(); +} +if(this.options.rows==1&&!this.hasHTMLLineBreaks(_52)){ +this.options.textarea=false; +var _53=document.createElement("input"); +_53.type="text"; +_53.name="value"; +_53.value=_52; +_53.style.backgroundColor=this.options.highlightcolor; +var _54=this.options.size||this.options.cols||0; +if(_54!=0){ +_53.size=_54; +} +this.editField=_53; +}else{ +this.options.textarea=true; +var _55=document.createElement("textarea"); +_55.name="value"; +_55.value=this.convertHTMLLineBreaks(_52); +_55.rows=this.options.rows; +_55.cols=this.options.cols||40; +this.editField=_55; +} +if(this.options.loadTextURL){ +this.loadExternalText(); +} +this.form.appendChild(this.editField); +},getText:function(){ +return this.element.innerHTML; +},loadExternalText:function(){ +Element.addClassName(this.form,this.options.loadingClassName); +this.editField.disabled=true; +new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions)); +},onLoadedExternalText:function(_56){ +Element.removeClassName(this.form,this.options.loadingClassName); +this.editField.disabled=false; +this.editField.value=_56.responseText.stripTags(); +},onclickCancel:function(){ +this.onComplete(); +this.leaveEditMode(); +return false; +},onFailure:function(_57){ +this.options.onFailure(_57); +if(this.oldInnerHTML){ +this.element.innerHTML=this.oldInnerHTML; +this.oldInnerHTML=null; +} +return false; +},onSubmit:function(){ +var _58=this.form; +var _59=this.editField.value; +this.onLoading(); +new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(_58,_59),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions)); +if(arguments.length>1){ +Event.stop(arguments[0]); +} +return false; +},onLoading:function(){ +this.saving=true; +this.removeForm(); +this.leaveHover(); +this.showSaving(); +},showSaving:function(){ +this.oldInnerHTML=this.element.innerHTML; +this.element.innerHTML=this.options.savingText; +Element.addClassName(this.element,this.options.savingClassName); +this.element.style.backgroundColor=this.originalBackground; +Element.show(this.element); +},removeForm:function(){ +if(this.form){ +if(this.form.parentNode){ +Element.remove(this.form); +} +this.form=null; +} +},enterHover:function(){ +if(this.saving){ +return; +} +this.element.style.backgroundColor=this.options.highlightcolor; +if(this.effect){ +this.effect.cancel(); +} +Element.addClassName(this.element,this.options.hoverClassName); +},leaveHover:function(){ +if(this.options.backgroundColor){ +this.element.style.backgroundColor=this.oldBackground; +} +Element.removeClassName(this.element,this.options.hoverClassName); +if(this.saving){ +return; +} +this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground}); +},leaveEditMode:function(){ +Element.removeClassName(this.element,this.options.savingClassName); +this.removeForm(); +this.leaveHover(); +this.element.style.backgroundColor=this.originalBackground; +Element.show(this.element); +if(this.options.externalControl){ +Element.show(this.options.externalControl); +} +this.editing=false; +this.saving=false; +this.oldInnerHTML=null; +this.onLeaveEditMode(); +},onComplete:function(_60){ +this.leaveEditMode(); +this.options.onComplete.bind(this)(_60,this.element); +},onEnterEditMode:function(){ +},onLeaveEditMode:function(){ +},dispose:function(){ +if(this.oldInnerHTML){ +this.element.innerHTML=this.oldInnerHTML; +} +this.leaveEditMode(); +Event.stopObserving(this.element,"click",this.onclickListener); +Event.stopObserving(this.element,"mouseover",this.mouseoverListener); +Event.stopObserving(this.element,"mouseout",this.mouseoutListener); +if(this.options.externalControl){ +Event.stopObserving(this.options.externalControl,"click",this.onclickListener); +Event.stopObserving(this.options.externalControl,"mouseover",this.mouseoverListener); +Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListener); +} +}}; +Form.Element.DelayedObserver=Class.create(); +Form.Element.DelayedObserver.prototype={initialize:function(_61,_62,_63){ +this.delay=_62||0.5; +this.element=$(_61); +this.callback=_63; +this.timer=null; +this.lastValue=$F(this.element); +Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this)); +},delayedListener:function(_64){ +if(this.lastValue==$F(this.element)){ +return; +} +if(this.timer){ +clearTimeout(this.timer); +} +this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000); +this.lastValue=$F(this.element); +},onTimerEvent:function(){ +this.timer=null; +this.callback(this.element,$F(this.element)); +}}; +
+var Droppables={drops:[],remove:function(_1){ +this.drops=this.drops.reject(function(d){ +return d.element==$(_1); +}); +},add:function(_3){ +_3=$(_3); +var _4=Object.extend({greedy:true,hoverclass:null},arguments[1]||{}); +if(_4.containment){ +_4._containers=[]; +var _5=_4.containment; +if((typeof _5=="object")&&(_5.constructor==Array)){ +_5.each(function(c){ +_4._containers.push($(c)); +}); +}else{ +_4._containers.push($(_5)); +} +} +if(_4.accept){ +_4.accept=[_4.accept].flatten(); +} +Element.makePositioned(_3); +_4.element=_3; +this.drops.push(_4); +},isContained:function(_7,_8){ +var _9=_7.parentNode; +return _8._containers.detect(function(c){ +return _9==c; +}); +},isAffected:function(_10,_11,_12){ +return ((_12.element!=_11)&&((!_12._containers)||this.isContained(_11,_12))&&((!_12.accept)||(Element.classNames(_11).detect(function(v){ +return _12.accept.include(v); +})))&&Position.within(_12.element,_10[0],_10[1])); +},deactivate:function(_14){ +if(_14.hoverclass){ +Element.removeClassName(_14.element,_14.hoverclass); +} +this.last_active=null; +},activate:function(_15){ +if(_15.hoverclass){ +Element.addClassName(_15.element,_15.hoverclass); +} +this.last_active=_15; +},show:function(_16,_17){ +if(!this.drops.length){ +return; +} +if(this.last_active){ +this.deactivate(this.last_active); +} +this.drops.each(function(_18){ +if(Droppables.isAffected(_16,_17,_18)){ +if(_18.onHover){ +_18.onHover(_17,_18.element,Position.overlap(_18.overlap,_18.element)); +} +if(_18.greedy){ +Droppables.activate(_18); +} +} +}); +},fire:function(_19,_20){ +if(!this.last_active){ +return; +} +Position.prepare(); +if(this.isAffected([Event.pointerX(_19),Event.pointerY(_19)],_20,this.last_active)){ +if(this.last_active.onDrop){ +this.last_active.onDrop(_20,this.last_active.element,_19); +} +} +},reset:function(){ +if(this.last_active){ +this.deactivate(this.last_active); +} +}}; +var Draggables={drags:[],observers:[],register:function(_21){ +if(this.drags.length==0){ +this.eventMouseUp=this.endDrag.bindAsEventListener(this); +this.eventMouseMove=this.updateDrag.bindAsEventListener(this); +this.eventKeypress=this.keyPress.bindAsEventListener(this); +Event.observe(document,"mouseup",this.eventMouseUp); +Event.observe(document,"mousemove",this.eventMouseMove); +Event.observe(document,"keypress",this.eventKeypress); +} +this.drags.push(_21); +},unregister:function(_22){ +this.drags=this.drags.reject(function(d){ +return d==_22; +}); +if(this.drags.length==0){ +Event.stopObserving(document,"mouseup",this.eventMouseUp); +Event.stopObserving(document,"mousemove",this.eventMouseMove); +Event.stopObserving(document,"keypress",this.eventKeypress); +} +},activate:function(_23){ +window.focus(); +this.activeDraggable=_23; +},deactivate:function(_24){ +this.activeDraggable=null; +},updateDrag:function(_25){ +if(!this.activeDraggable){ +return; +} +var _26=[Event.pointerX(_25),Event.pointerY(_25)]; +if(this._lastPointer&&(this._lastPointer.inspect()==_26.inspect())){ +return; +} +this._lastPointer=_26; +this.activeDraggable.updateDrag(_25,_26); +},endDrag:function(_27){ +if(!this.activeDraggable){ +return; +} +this._lastPointer=null; +this.activeDraggable.endDrag(_27); +},keyPress:function(_28){ +if(this.activeDraggable){ +this.activeDraggable.keyPress(_28); +} +},addObserver:function(_29){ +this.observers.push(_29); +this._cacheObserverCallbacks(); +},removeObserver:function(_30){ +this.observers=this.observers.reject(function(o){ +return o.element==_30; +}); +this._cacheObserverCallbacks(); +},notify:function(_32,_33,_34){ +if(this[_32+"Count"]>0){ +this.observers.each(function(o){ +if(o[_32]){ +o[_32](_32,_33,_34); +} +}); +} +},_cacheObserverCallbacks:function(){ +["onStart","onEnd","onDrag"].each(function(_35){ +Draggables[_35+"Count"]=Draggables.observers.select(function(o){ +return o[_35]; +}).length; +}); +}}; +var Draggable=Class.create(); +Draggable.prototype={initialize:function(_36){ +this.element=$(_36); +var _37=Object.extend({handle:false,starteffect:function(_36){ +new Effect.Opacity(_36,{duration:0.2,from:1,to:0.7}); +},reverteffect:function(_38,_39,_40){ +var dur=Math.sqrt(Math.abs(_39^2)+Math.abs(_40^2))*0.02; +_38._revert=new Effect.MoveBy(_38,-_39,-_40,{duration:dur}); +},endeffect:function(_42){ +new Effect.Opacity(_42,{duration:0.2,from:0.7,to:1}); +},zindex:1000,revert:false,snap:false},arguments[1]||{}); +if(_37.handle&&(typeof _37.handle=="string")){ +this.handle=Element.childrenWithClassName(this.element,_37.handle)[0]; +} +if(!this.handle){ +this.handle=$(_37.handle); +} +if(!this.handle){ +this.handle=this.element; +} +Element.makePositioned(this.element); +this.delta=this.currentDelta(); +this.options=_37; +this.dragging=false; +this.eventMouseDown=this.initDrag.bindAsEventListener(this); +Event.observe(this.handle,"mousedown",this.eventMouseDown); +Draggables.register(this); +},destroy:function(){ +Event.stopObserving(this.handle,"mousedown",this.eventMouseDown); +Draggables.unregister(this); +},currentDelta:function(){ +return ([parseInt(this.element.style.left||"0"),parseInt(this.element.style.top||"0")]); +},initDrag:function(_43){ +if(Event.isLeftClick(_43)){ +var src=Event.element(_43); +if(src.tagName&&(src.tagName=="INPUT"||src.tagName=="SELECT"||src.tagName=="BUTTON"||src.tagName=="TEXTAREA")){ +return; +} +if(this.element._revert){ +this.element._revert.cancel(); +this.element._revert=null; +} +var _45=[Event.pointerX(_43),Event.pointerY(_43)]; +var pos=Position.cumulativeOffset(this.element); +this.offset=[0,1].map(function(i){ +return (_45[i]-pos[i]); +}); +Draggables.activate(this); +Event.stop(_43); +} +},startDrag:function(_48){ +this.dragging=true; +if(this.options.zindex){ +this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0); +this.element.style.zIndex=this.options.zindex; +} +if(this.options.ghosting){ +this._clone=this.element.cloneNode(true); +Position.absolutize(this.element); +this.element.parentNode.insertBefore(this._clone,this.element); +} +Draggables.notify("onStart",this,_48); +if(this.options.starteffect){ +this.options.starteffect(this.element); +} +},updateDrag:function(_49,_50){ +if(!this.dragging){ +this.startDrag(_49); +} +Position.prepare(); +Droppables.show(_50,this.element); +Draggables.notify("onDrag",this,_49); +this.draw(_50); +if(this.options.change){ +this.options.change(this); +} +if(navigator.appVersion.indexOf("AppleWebKit")>0){ +window.scrollBy(0,0); +} +Event.stop(_49); +},finishDrag:function(_51,_52){ +this.dragging=false; +if(this.options.ghosting){ +Position.relativize(this.element); +Element.remove(this._clone); +this._clone=null; +} +if(_52){ +Droppables.fire(_51,this.element); +} +Draggables.notify("onEnd",this,_51); +var _53=this.options.revert; +if(_53&&typeof _53=="function"){ +_53=_53(this.element); +} +var d=this.currentDelta(); +if(_53&&this.options.reverteffect){ +this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]); +}else{ +this.delta=d; +} +if(this.options.zindex){ +this.element.style.zIndex=this.originalZ; +} +if(this.options.endeffect){ +this.options.endeffect(this.element); +} +Draggables.deactivate(this); +Droppables.reset(); +},keyPress:function(_54){ +if(!_54.keyCode==Event.KEY_ESC){ +return; +} +this.finishDrag(_54,false); +Event.stop(_54); +},endDrag:function(_55){ +if(!this.dragging){ +return; +} +this.finishDrag(_55,true); +Event.stop(_55); +},draw:function(_56){ +var pos=Position.cumulativeOffset(this.element); +var d=this.currentDelta(); +pos[0]-=d[0]; +pos[1]-=d[1]; +var p=[0,1].map(function(i){ +return (_56[i]-pos[i]-this.offset[i]); +}.bind(this)); +if(this.options.snap){ +if(typeof this.options.snap=="function"){ +p=this.options.snap(p[0],p[1]); +}else{ +if(this.options.snap instanceof Array){ +p=p.map(function(v,i){ +return Math.round(v/this.options.snap[i])*this.options.snap[i]; +}.bind(this)); +}else{ +p=p.map(function(v){ +return Math.round(v/this.options.snap)*this.options.snap; +}.bind(this)); +} +} +} +var _58=this.element.style; +if((!this.options.constraint)||(this.options.constraint=="horizontal")){ +_58.left=p[0]+"px"; +} +if((!this.options.constraint)||(this.options.constraint=="vertical")){ +_58.top=p[1]+"px"; +} +if(_58.visibility=="hidden"){ +_58.visibility=""; +} +}}; +var SortableObserver=Class.create(); +SortableObserver.prototype={initialize:function(_59,_60){ +this.element=$(_59); +this.observer=_60; +this.lastValue=Sortable.serialize(this.element); +},onStart:function(){ +this.lastValue=Sortable.serialize(this.element); +},onEnd:function(){ +Sortable.unmark(); +if(this.lastValue!=Sortable.serialize(this.element)){ +this.observer(this.element); +} +}}; +var Sortable={sortables:new Array(),options:function(_61){ +_61=$(_61); +return this.sortables.detect(function(s){ +return s.element==_61; +}); +},destroy:function(_63){ +_63=$(_63); +this.sortables.findAll(function(s){ +return s.element==_63; +}).each(function(s){ +Draggables.removeObserver(s.element); +s.droppables.each(function(d){ +Droppables.remove(d); +}); +s.draggables.invoke("destroy"); +}); +this.sortables=this.sortables.reject(function(s){ +return s.element==_63; +}); +},create:function(_64){ +_64=$(_64); +var _65=Object.extend({element:_64,tag:"li",dropOnEmpty:false,tree:false,overlap:"vertical",constraint:"vertical",containment:_64,handle:false,only:false,hoverclass:null,ghosting:false,format:null,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{}); +this.destroy(_64); +var _66={revert:true,ghosting:_65.ghosting,constraint:_65.constraint,handle:_65.handle}; +if(_65.starteffect){ +_66.starteffect=_65.starteffect; +} +if(_65.reverteffect){ +_66.reverteffect=_65.reverteffect; +}else{ +if(_65.ghosting){ +_66.reverteffect=function(_64){ +_64.style.top=0; +_64.style.left=0; +}; +} +} +if(_65.endeffect){ +_66.endeffect=_65.endeffect; +} +if(_65.zindex){ +_66.zindex=_65.zindex; +} +var _67={overlap:_65.overlap,containment:_65.containment,hoverclass:_65.hoverclass,onHover:Sortable.onHover,greedy:!_65.dropOnEmpty}; +Element.cleanWhitespace(element); +_65.draggables=[]; +_65.droppables=[]; +if(_65.dropOnEmpty){ +Droppables.add(element,{containment:_65.containment,onHover:Sortable.onEmptyHover,greedy:false}); +_65.droppables.push(element); +} +(this.findElements(element,_65)||[]).each(function(e){ +var _69=_65.handle?Element.childrenWithClassName(e,_65.handle)[0]:e; +_65.draggables.push(new Draggable(e,Object.extend(_66,{handle:_69}))); +Droppables.add(e,_67); +_65.droppables.push(e); +}); +this.sortables.push(_65); +Draggables.addObserver(new SortableObserver(element,_65.onUpdate)); +},findElements:function(_70,_71){ +if(!_70.hasChildNodes()){ +return null; +} +var _72=[]; +$A(_70.childNodes).each(function(e){ +if(e.tagName&&e.tagName.toUpperCase()==_71.tag.toUpperCase()&&(!_71.only||(Element.hasClassName(e,_71.only)))){ +_72.push(e); +} +if(_71.tree){ +var _73=this.findElements(e,_71); +if(_73){ +_72.push(_73); +} +} +}); +return (_72.length>0?_72.flatten():null); +},onHover:function(_74,_75,_76){ +if(_76>0.5){ +Sortable.mark(_75,"before"); +if(_75.previousSibling!=_74){ +var _77=_74.parentNode; +_74.style.visibility="hidden"; +_75.parentNode.insertBefore(_74,_75); +if(_75.parentNode!=_77){ +Sortable.options(_77).onChange(_74); +} +Sortable.options(_75.parentNode).onChange(_74); +} +}else{ +Sortable.mark(_75,"after"); +var _78=_75.nextSibling||null; +if(_78!=_74){ +var _77=_74.parentNode; +_74.style.visibility="hidden"; +_75.parentNode.insertBefore(_74,_78); +if(_75.parentNode!=_77){ +Sortable.options(_77).onChange(_74); +} +Sortable.options(_75.parentNode).onChange(_74); +} +} +},onEmptyHover:function(_79,_80){ +if(_79.parentNode!=_80){ +var _81=_79.parentNode; +_80.appendChild(_79); +Sortable.options(_81).onChange(_79); +Sortable.options(_80).onChange(_79); +} +},unmark:function(){ +if(Sortable._marker){ +Element.hide(Sortable._marker); +} +},mark:function(_82,_83){ +var _84=Sortable.options(_82.parentNode); +if(_84&&!_84.ghosting){ +return; +} +if(!Sortable._marker){ +Sortable._marker=$("dropmarker")||document.createElement("DIV"); +Element.hide(Sortable._marker); +Element.addClassName(Sortable._marker,"dropmarker"); +Sortable._marker.style.position="absolute"; +document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); +} +var _85=Position.cumulativeOffset(_82); +Sortable._marker.style.left=_85[0]+"px"; +Sortable._marker.style.top=_85[1]+"px"; +if(_83=="after"){ +if(_84.overlap=="horizontal"){ +Sortable._marker.style.left=(_85[0]+_82.clientWidth)+"px"; +}else{ +Sortable._marker.style.top=(_85[1]+_82.clientHeight)+"px"; +} +} +Element.show(Sortable._marker); +},serialize:function(_86){ +_86=$(_86); +var _87=this.options(_86); +var _88=Object.extend({tag:_87.tag,only:_87.only,name:_86.id,format:_87.format||/^[^_]*_(.*)$/},arguments[1]||{}); +return $(this.findElements(_86,_88)||[]).map(function(_89){ +return (encodeURIComponent(_88.name)+"[]="+encodeURIComponent(_89.id.match(_88.format)?_89.id.match(_88.format)[1]:"")); +}).join("&"); +}}; +
+if(!Control){ +var Control={}; +} +Control.Slider=Class.create(); +Control.Slider.prototype={initialize:function(_1,_2,_3){ +var _4=this; +if(_1 instanceof Array){ +this.handles=_1.collect(function(e){ +return $(e); +}); +}else{ +this.handles=[$(_1)]; +} +this.track=$(_2); +this.options=_3||{}; +this.axis=this.options.axis||"horizontal"; +this.increment=this.options.increment||1; +this.step=parseInt(this.options.step||"1"); +this.range=this.options.range||$R(0,1); +this.value=0; +this.values=this.handles.map(function(){ +return 0; +}); +this.spans=this.options.spans?this.options.spans.map(function(s){ +return $(s); +}):false; +this.options.startSpan=$(this.options.startSpan||null); +this.options.endSpan=$(this.options.endSpan||null); +this.restricted=this.options.restricted||false; +this.maximum=this.options.maximum||this.range.end; +this.minimum=this.options.minimum||this.range.start; +this.alignX=parseInt(this.options.alignX||"0"); +this.alignY=parseInt(this.options.alignY||"0"); +this.trackLength=this.maximumOffset()-this.minimumOffset(); +this.handleLength=this.isVertical()?this.handles[0].offsetHeight:this.handles[0].offsetWidth; +this.active=false; +this.dragging=false; +this.disabled=false; +if(this.options.disabled){ +this.setDisabled(); +} +this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false; +if(this.allowedValues){ +this.minimum=this.allowedValues.min(); +this.maximum=this.allowedValues.max(); +} +this.eventMouseDown=this.startDrag.bindAsEventListener(this); +this.eventMouseUp=this.endDrag.bindAsEventListener(this); +this.eventMouseMove=this.update.bindAsEventListener(this); +this.handles.each(function(h,i){ +i=_4.handles.length-1-i; +_4.setValue(parseFloat((_4.options.sliderValue instanceof Array?_4.options.sliderValue[i]:_4.options.sliderValue)||_4.range.start),i); +Element.makePositioned(h); +Event.observe(h,"mousedown",_4.eventMouseDown); +}); +Event.observe(this.track,"mousedown",this.eventMouseDown); +Event.observe(document,"mouseup",this.eventMouseUp); +Event.observe(document,"mousemove",this.eventMouseMove); +this.initialized=true; +},dispose:function(){ +var _9=this; +Event.stopObserving(this.track,"mousedown",this.eventMouseDown); +Event.stopObserving(document,"mouseup",this.eventMouseUp); +Event.stopObserving(document,"mousemove",this.eventMouseMove); +this.handles.each(function(h){ +Event.stopObserving(h,"mousedown",_9.eventMouseDown); +}); +},setDisabled:function(){ +this.disabled=true; +},setEnabled:function(){ +this.disabled=false; +},getNearestValue:function(_10){ +if(this.allowedValues){ +if(_10>=this.allowedValues.max()){ +return (this.allowedValues.max()); +} +if(_10<=this.allowedValues.min()){ +return (this.allowedValues.min()); +} +var _11=Math.abs(this.allowedValues[0]-_10); +var _12=this.allowedValues[0]; +this.allowedValues.each(function(v){ +var _14=Math.abs(v-_10); +if(_14<=_11){ +_12=v; +_11=_14; +} +}); +return _12; +} +if(_10>this.range.end){ +return this.range.end; +} +if(_10<this.range.start){ +return this.range.start; +} +return _10; +},setValue:function(_15,_16){ +if(!this.active){ +this.activeHandle=this.handles[_16]; +this.activeHandleIdx=_16; +this.updateStyles(); +} +_16=_16||this.activeHandleIdx||0; +if(this.initialized&&this.restricted){ +if((_16>0)&&(_15<this.values[_16-1])){ +_15=this.values[_16-1]; +} +if((_16<(this.handles.length-1))&&(_15>this.values[_16+1])){ +_15=this.values[_16+1]; +} +} +_15=this.getNearestValue(_15); +this.values[_16]=_15; +this.value=this.values[0]; +this.handles[_16].style[this.isVertical()?"top":"left"]=this.translateToPx(_15); +this.drawSpans(); +if(!this.dragging||!this.event){ +this.updateFinished(); +} +},setValueBy:function(_17,_18){ +this.setValue(this.values[_18||this.activeHandleIdx||0]+_17,_18||this.activeHandleIdx||0); +},translateToPx:function(_19){ +return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(_19-this.range.start))+"px"; +},translateToValue:function(_20){ +return ((_20/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start); +},getRange:function(_21){ +var v=this.values.sortBy(Prototype.K); +_21=_21||0; +return $R(v[_21],v[_21+1]); +},minimumOffset:function(){ +return (this.isVertical()?this.alignY:this.alignX); +},maximumOffset:function(){ +return (this.isVertical()?this.track.offsetHeight-this.alignY:this.track.offsetWidth-this.alignX); +},isVertical:function(){ +return (this.axis=="vertical"); +},drawSpans:function(){ +var _22=this; +if(this.spans){ +$R(0,this.spans.length-1).each(function(r){ +_22.setSpan(_22.spans[r],_22.getRange(r)); +}); +} +if(this.options.startSpan){ +this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value)); +} +if(this.options.endSpan){ +this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum)); +} +},setSpan:function(_24,_25){ +if(this.isVertical()){ +_24.style.top=this.translateToPx(_25.start); +_24.style.height=this.translateToPx(_25.end-_25.start); +}else{ +_24.style.left=this.translateToPx(_25.start); +_24.style.width=this.translateToPx(_25.end-_25.start); +} +},updateStyles:function(){ +this.handles.each(function(h){ +Element.removeClassName(h,"selected"); +}); +Element.addClassName(this.activeHandle,"selected"); +},startDrag:function(_26){ +if(Event.isLeftClick(_26)){ +if(!this.disabled){ +this.active=true; +var _27=Event.element(_26); +var _28=[Event.pointerX(_26),Event.pointerY(_26)]; +if(_27==this.track){ +var _29=Position.cumulativeOffset(this.track); +this.event=_26; +this.setValue(this.translateToValue((this.isVertical()?_28[1]-_29[1]:_28[0]-_29[0])-(this.handleLength/2))); +var _29=Position.cumulativeOffset(this.activeHandle); +this.offsetX=(_28[0]-_29[0]); +this.offsetY=(_28[1]-_29[1]); +}else{ +while((this.handles.indexOf(_27)==-1)&&_27.parentNode){ +_27=_27.parentNode; +} +this.activeHandle=_27; +this.activeHandleIdx=this.handles.indexOf(this.activeHandle); +this.updateStyles(); +var _29=Position.cumulativeOffset(this.activeHandle); +this.offsetX=(_28[0]-_29[0]); +this.offsetY=(_28[1]-_29[1]); +} +} +Event.stop(_26); +} +},update:function(_30){ +if(this.active){ +if(!this.dragging){ +this.dragging=true; +} +this.draw(_30); +if(navigator.appVersion.indexOf("AppleWebKit")>0){ +window.scrollBy(0,0); +} +Event.stop(_30); +} +},draw:function(_31){ +var _32=[Event.pointerX(_31),Event.pointerY(_31)]; +var _33=Position.cumulativeOffset(this.track); +_32[0]-=this.offsetX+_33[0]; +_32[1]-=this.offsetY+_33[1]; +this.event=_31; +this.setValue(this.translateToValue(this.isVertical()?_32[1]:_32[0])); +if(this.initialized&&this.options.onSlide){ +this.options.onSlide(this.values.length>1?this.values:this.value,this); +} +},endDrag:function(_34){ +if(this.active&&this.dragging){ +this.finishDrag(_34,true); +Event.stop(_34); +} +this.active=false; +this.dragging=false; +},finishDrag:function(_35,_36){ +this.active=false; +this.dragging=false; +this.updateFinished(); +},updateFinished:function(){ +if(this.initialized&&this.options.onChange){ +this.options.onChange(this.values.length>1?this.values:this.value,this); +} +this.event=null; +}}; +
+Prado.AutoCompleter=Class.create(); +Prado.AutoCompleter.Base=function(){ +}; +Prado.AutoCompleter.Base.prototype=Object.extend(Autocompleter.Base.prototype,{updateElement:function(_1){ +if(this.options.updateElement){ +this.options.updateElement(_1); +return; +} +var _2=Element.collectTextNodesIgnoreClass(_1,"informal"); +var _3=this.findLastToken(); +if(_3!=-1){ +var _4=this.element.value.substr(0,_3+1); +var _5=this.element.value.substr(_3+1).match(/^\s+/); +if(_5){ +_4+=_5[0]; +} +this.element.value=(_4+_2).trim(); +}else{ +this.element.value=_2.trim(); +} +this.element.focus(); +if(this.options.afterUpdateElement){ +this.options.afterUpdateElement(this.element,_1); +} +}}); +Prado.AutoCompleter.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(_6,_7,_8){ +this.baseInitialize(_6,_7,_8); +},onUpdateReturn:function(_9){ +if(isString(_9)&&_9.length>0){ +this.updateChoices(_9); +} +},getUpdatedChoices:function(){ +Prado.Callback(this.element.id,this.getToken(),this.onUpdateReturn.bind(this)); +}}); +Prado.ActivePanel={callbacks:{},register:function(id,_11){ +Prado.ActivePanel.callbacks[id]=_11; +},update:function(id,_12){ +var _13=new Prado.ActivePanel.Request(id,Prado.ActivePanel.callbacks[id]); +_13.callback(_12); +}}; +Prado.ActivePanel.Request=Class.create(); +Prado.ActivePanel.Request.prototype={initialize:function(_14,_15){ +this.element=_14; +this.setOptions(_15); +},setOptions:function(_16){ +this.options={onSuccess:this.onSuccess.bind(this)}; +Object.extend(this.options,_16||{}); +},callback:function(_17){ +this.options.params=[_17]; +new Prado.AJAX.Callback(this.element,this.options); +},onSuccess:function(_18,_19){ +if(this.options.update){ +if(!this.options.evalScripts){ +_19=_19.stripScripts(); +} +Element.update(this.options.update,_19); +} +}}; +Prado.DropContainer=Class.create(); +Prado.DropContainer.prototype=Object.extend(new Prado.ActivePanel.Request(),{initialize:function(_20,_21){ +this.element=_20; +this.setOptions(_21); +Object.extend(this.options,{onDrop:this.onDrop.bind(this),evalScripts:true,onSuccess:_21.onSuccess||this.onSuccess.bind(this)}); +Droppables.add(_20,this.options); +},onDrop:function(_22,_23){ +this.callback(_22.id); +}}); +Prado.ActiveImageButton=Class.create(); +Prado.ActiveImageButton.prototype={initialize:function(_24,_25){ +this.element=$(_24); +this.options=_25; +Event.observe(this.element,"click",this.click.bind(this)); +},click:function(e){ +var el=$("{$this->ClientID}"); +var _28=Position.cumulativeOffset(this.element); +var _29=[e.clientX,e.clientY]; +var _30=(_29[0]-_28[0]+1)+","+(_29[1]-_28[1]+1); +Prado.Callback(this.element,_30,null,this.options); +Event.stop(e); +}}; +
diff --git a/framework/Web/Javascripts/js/base.js b/framework/Web/Javascripts/js/base.js deleted file mode 100644 index 8b687300..00000000 --- a/framework/Web/Javascripts/js/base.js +++ /dev/null @@ -1,998 +0,0 @@ -var Prototype={Version:"1.4.0",ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){ -},K:function(x){ -return x; -}}; -
-if(!Array.prototype.push){ -Array.prototype.push=function(){ -var _1=this.length; -for(var i=0;i<arguments.length;i++){ -this[_1+i]=arguments[i]; -} -return this.length; -}; -} -if(!Function.prototype.apply){ -Function.prototype.apply=function(_3,_4){ -var _5=new Array(); -if(!_3){ -_3=window; -} -if(!_4){ -_4=new Array(); -} -for(var i=0;i<_4.length;i++){ -_5[i]="parameters["+i+"]"; -} -_3.__apply__=this; -var _6=eval("object.__apply__("+_5.join(", ")+")"); -_3.__apply__=null; -return _6; -}; -} -
-var Class={create:function(){ -return function(){ -this.initialize.apply(this,arguments); -}; -}}; -var Abstract=new Object(); -Object.extend=function(_1,_2){ -for(property in _2){ -_1[property]=_2[property]; -} -return _1; -}; -Object.inspect=function(_3){ -try{ -if(_3==undefined){ -return "undefined"; -} -if(_3==null){ -return "null"; -} -return _3.inspect?_3.inspect():_3.toString(); -} -catch(e){ -if(e instanceof RangeError){ -return "..."; -} -throw e; -} -}; -Function.prototype.bind=function(){ -var _4=this,args=$A(arguments),object=args.shift(); -return function(){ -return _4.apply(object,args.concat($A(arguments))); -}; -}; -Function.prototype.bindAsEventListener=function(_5){ -var _6=this; -return function(_7){ -return _6.call(_5,_7||window.event); -}; -}; -Object.extend(Number.prototype,{toColorPart:function(){ -var _8=this.toString(16); -if(this<16){ -return "0"+_8; -} -return _8; -},succ:function(){ -return this+1; -},times:function(_9){ -$R(0,this,true).each(_9); -return this; -}}); -var Try={these:function(){ -var _10; -for(var i=0;i<arguments.length;i++){ -var _12=arguments[i]; -try{ -_10=_12(); -break; -} -catch(e){ -} -} -return _10; -}}; -var PeriodicalExecuter=Class.create(); -PeriodicalExecuter.prototype={initialize:function(_13,_14){ -this.callback=_13; -this.frequency=_14; -this.currentlyExecuting=false; -this.registerCallback(); -},registerCallback:function(){ -setInterval(this.onTimerEvent.bind(this),this.frequency*1000); -},onTimerEvent:function(){ -if(!this.currentlyExecuting){ -try{ -this.currentlyExecuting=true; -this.callback(); -} -finally{ -this.currentlyExecuting=false; -} -} -}}; -function $(){ -var _15=new Array(); -for(var i=0;i<arguments.length;i++){ -var _16=arguments[i]; -if(typeof _16=="string"){ -_16=document.getElementById(_16); -} -if(arguments.length==1){ -return _16; -} -_15.push(_16); -} -return _15; -} -
-function isElement(o,_2){ -return o&&isObject(o)&&((!_2&&(o==window||o==document))||o.nodeType==1); -} -function $(n,d){ -if(isElement(n)){ -return n; -} -if(isString(n)==false){ -return null; -} -var p,i,x; -if(!d){ -d=document; -} -if((p=n.indexOf("?"))>0&&parent.frames.length){ -d=parent.frames[n.substring(p+1)].document; -n=n.substring(0,p); -} -if(!(x=d[n])&&d.all){ -x=d.all[n]; -} -for(i=0;!x&&i<d.forms.length;i++){ -x=d.forms[i][n]; -} -for(i=0;!x&&d.layers&&i<d.layers.length;i++){ -x=DOM.find(n,d.layers[i].document); -} -if(!x&&d.getElementById){ -x=d.getElementById(n); -} -return x; -} -
-function isAlien(a){ -return isObject(a)&&typeof a.constructor!="function"; -} -function isArray(a){ -return isObject(a)&&a.constructor==Array; -} -function isBoolean(a){ -return typeof a=="boolean"; -} -function isFunction(a){ -return typeof a=="function"; -} -function isNull(a){ -return typeof a=="object"&&!a; -} -function isNumber(a){ -return typeof a=="number"&&isFinite(a); -} -function isObject(a){ -return (a&&typeof a=="object")||isFunction(a); -} -function isRegexp(a){ -return a&&a.constructor==RegExp; -} -function isString(a){ -return typeof a=="string"; -} -function isUndefined(a){ -return typeof a=="undefined"; -} -function isEmpty(o){ -var i,v; -if(isObject(o)){ -for(i in o){ -v=o[i]; -if(isUndefined(v)&&isFunction(v)){ -return false; -} -} -} -return true; -} -function undef(v){ -return isUndefined(v); -} -function isdef(v){ -return !isUndefined(v); -} -function isElement(o,_5){ -return o&&isObject(o)&&((!_5&&(o==window||o==document))||o.nodeType==1); -} -function isList(o){ -return o&&isObject(o)&&(isArray(o)||o.item); -} -
-Object.extend(String.prototype,{stripTags:function(){ -return this.replace(/<\/?[^>]+>/gi,""); -},stripScripts:function(){ -return this.replace(new RegExp(Prototype.ScriptFragment,"img"),""); -},extractScripts:function(){ -var _1=new RegExp(Prototype.ScriptFragment,"img"); -var _2=new RegExp(Prototype.ScriptFragment,"im"); -return (this.match(_1)||[]).map(function(_3){ -return (_3.match(_2)||["",""])[1]; -}); -},evalScripts:function(){ -return this.extractScripts().map(eval); -},escapeHTML:function(){ -var _4=document.createElement("div"); -var _5=document.createTextNode(this); -_4.appendChild(_5); -return _4.innerHTML; -},unescapeHTML:function(){ -var _6=document.createElement("div"); -_6.innerHTML=this.stripTags(); -return _6.childNodes[0]?_6.childNodes[0].nodeValue:""; -},toQueryParams:function(){ -var _7=this.match(/^\??(.*)$/)[1].split("&"); -return _7.inject({},function(_8,_9){ -var _10=_9.split("="); -_8[_10[0]]=_10[1]; -return _8; -}); -},toArray:function(){ -return this.split(""); -},camelize:function(){ -var _11=this.split("-"); -if(_11.length==1){ -return _11[0]; -} -var _12=this.indexOf("-")==0?_11[0].charAt(0).toUpperCase()+_11[0].substring(1):_11[0]; -for(var i=1,len=_11.length;i<len;i++){ -var s=_11[i]; -_12+=s.charAt(0).toUpperCase()+s.substring(1); -} -return _12; -},inspect:function(){ -return "'"+this.replace("\\","\\\\").replace("'","\\'")+"'"; -}}); -String.prototype.parseQuery=String.prototype.toQueryParams; -
-Object.extend(String.prototype,{pad:function(_1,_2,_3){ -if(!_3){ -_3=" "; -} -var s=this; -var _5=_1.toLowerCase()=="left"; -while(s.length<_2){ -s=_5?_3+s:s+_3; -} -return s; -},padLeft:function(_6,_7){ -return this.pad("left",_6,_7); -},padRight:function(_8,_9){ -return this.pad("right",_8,_9); -},zerofill:function(len){ -var s=this; -var ix=/^[+-]/.test(s)?1:0; -while(s.length<len){ -s=s.insert(ix,"0"); -} -return s; -},trim:function(){ -return this.replace(/^\s+|\s+$/g,""); -},trimLeft:function(){ -return this.replace(/^\s+/,""); -},trimRight:function(){ -return this.replace(/\s+$/,""); -},toFunction:function(){ -var _12=this.split(/\./); -var _13=window; -_12.each(function(_14){ -if(_13[new String(_14)]){ -_13=_13[new String(_14)]; -} -}); -if(isFunction(_13)){ -return _13; -}else{ -if(typeof Logger!="undefined"){ -Logger.error("Missing function",this); -} -return Prototype.emptyFunction; -} -}}); -
-var $break=new Object(); -var $continue=new Object(); -var Enumerable={each:function(_1){ -var _2=0; -try{ -this._each(function(_3){ -try{ -_1(_3,_2++); -} -catch(e){ -if(e!=$continue){ -throw e; -} -} -}); -} -catch(e){ -if(e!=$break){ -throw e; -} -} -},all:function(_4){ -var _5=true; -this.each(function(_6,_7){ -_5=_5&&!!(_4||Prototype.K)(_6,_7); -if(!_5){ -throw $break; -} -}); -return _5; -},any:function(_8){ -var _9=true; -this.each(function(_10,_11){ -if(_9=!!(_8||Prototype.K)(_10,_11)){ -throw $break; -} -}); -return _9; -},collect:function(_12){ -var _13=[]; -this.each(function(_14,_15){ -_13.push(_12(_14,_15)); -}); -return _13; -},detect:function(_16){ -var _17; -this.each(function(_18,_19){ -if(_16(_18,_19)){ -_17=_18; -throw $break; -} -}); -return _17; -},findAll:function(_20){ -var _21=[]; -this.each(function(_22,_23){ -if(_20(_22,_23)){ -_21.push(_22); -} -}); -return _21; -},grep:function(_24,_25){ -var _26=[]; -this.each(function(_27,_28){ -var _29=_27.toString(); -if(_29.match(_24)){ -_26.push((_25||Prototype.K)(_27,_28)); -} -}); -return _26; -},include:function(_30){ -var _31=false; -this.each(function(_32){ -if(_32==_30){ -_31=true; -throw $break; -} -}); -return _31; -},inject:function(_33,_34){ -this.each(function(_35,_36){ -_33=_34(_33,_35,_36); -}); -return _33; -},invoke:function(_37){ -var _38=$A(arguments).slice(1); -return this.collect(function(_39){ -return _39[_37].apply(_39,_38); -}); -},max:function(_40){ -var _41; -this.each(function(_42,_43){ -_42=(_40||Prototype.K)(_42,_43); -if(_42>=(_41||_42)){ -_41=_42; -} -}); -return _41; -},min:function(_44){ -var _45; -this.each(function(_46,_47){ -_46=(_44||Prototype.K)(_46,_47); -if(_46<=(_45||_46)){ -_45=_46; -} -}); -return _45; -},partition:function(_48){ -var _49=[],falses=[]; -this.each(function(_50,_51){ -((_48||Prototype.K)(_50,_51)?_49:falses).push(_50); -}); -return [_49,falses]; -},pluck:function(_52){ -var _53=[]; -this.each(function(_54,_55){ -_53.push(_54[_52]); -}); -return _53; -},reject:function(_56){ -var _57=[]; -this.each(function(_58,_59){ -if(!_56(_58,_59)){ -_57.push(_58); -} -}); -return _57; -},sortBy:function(_60){ -return this.collect(function(_61,_62){ -return {value:_61,criteria:_60(_61,_62)}; -}).sort(function(_63,_64){ -var a=_63.criteria,b=_64.criteria; -return a<b?-1:a>b?1:0; -}).pluck("value"); -},toArray:function(){ -return this.collect(Prototype.K); -},zip:function(){ -var _66=Prototype.K,args=$A(arguments); -if(typeof args.last()=="function"){ -_66=args.pop(); -} -var _67=[this].concat(args).map($A); -return this.map(function(_68,_69){ -_66(_68=_67.pluck(_69)); -return _68; -}); -},inspect:function(){ -return "#<Enumerable:"+this.toArray().inspect()+">"; -}}; -Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray}); -
-var $A=Array.from=function(_1){ -if(!_1){ -return []; -} -if(_1.toArray){ -return _1.toArray(); -}else{ -var _2=[]; -for(var i=0;i<_1.length;i++){ -_2.push(_1[i]); -} -return _2; -} -}; -Object.extend(Array.prototype,Enumerable); -Array.prototype._reverse=Array.prototype.reverse; -Object.extend(Array.prototype,{_each:function(_4){ -for(var i=0;i<this.length;i++){ -_4(this[i]); -} -},clear:function(){ -this.length=0; -return this; -},first:function(){ -return this[0]; -},last:function(){ -return this[this.length-1]; -},compact:function(){ -return this.select(function(_5){ -return _5!=undefined||_5!=null; -}); -},flatten:function(){ -return this.inject([],function(_6,_7){ -return _6.concat(_7.constructor==Array?_7.flatten():[_7]); -}); -},without:function(){ -var _8=$A(arguments); -return this.select(function(_9){ -return !_8.include(_9); -}); -},indexOf:function(_10){ -for(var i=0;i<this.length;i++){ -if(this[i]==_10){ -return i; -} -} -return -1; -},reverse:function(_11){ -return (_11!==false?this:this.toArray())._reverse(); -},shift:function(){ -var _12=this[0]; -for(var i=0;i<this.length-1;i++){ -this[i]=this[i+1]; -} -this.length--; -return _12; -},inspect:function(){ -return "["+this.map(Object.inspect).join(", ")+"]"; -}}); -
-Array.prototype.indexOf=function(_1,_2,_3){ -_2=_2||0; -for(var i=_2;i<this.length;i++){ -var _5=this[i]; -if(_3?_5===_1:isRegexp(_1)?_1.test(_5):isFunction(_1)?_1(_5):_5==_1){ -return i; -} -} -return -1; -}; -Array.prototype.find=function(_6,_7,_8){ -var i=this.indexOf(_6,_7,_8); -if(i!=-1){ -return this[i]; -} -return null; -}; -Array.prototype.contains=function(_9,_10){ -return this.indexOf(_9,0,_10)!==-1; -}; -Array.prototype.has=Array.prototype.contains; -Array.prototype.include=Array.prototype.contains; -Array.prototype.count=function(_11,_12){ -var pos,start=0,count=0; -while((pos=this.indexOf(_11,start,_12))!==-1){ -start=pos+1; -count++; -} -return count; -}; -Array.prototype.remove=function(_14,all,_16){ -while(this.contains(_14,_16)){ -this.splice(this.indexOf(_14,0,_16),1); -if(!all){ -break; -} -} -return this; -}; -Array.prototype.merge=function(){ -var a=[]; -for(var i=0;i<arguments.length;i++){ -for(var j=0;j<arguments[i].length;j++){ -a.push(arguments[i][j]); -} -} -for(var i=0;i<a.length;i++){ -this.push(a[i]); -} -return this; -}; -Array.prototype.min=function(){ -if(!this.length){ -return; -} -var n=this[0]; -for(var i=1;i<this.length;i++){ -if(n>this[i]){ -n=this[i]; -} -} -return n; -}; -Array.prototype.max=function(){ -if(!this.length){ -return; -} -var n=this[0]; -for(var i=1;i<this.length;i++){ -if(n<this[i]){ -n=this[i]; -} -} -return n; -}; -Array.prototype.first=function(){ -return this[0]; -}; -Array.prototype.last=function(){ -return this[this.length-1]; -}; -Array.prototype.sjoin=function(){ -return this.join(" "); -}; -Array.prototype.njoin=function(){ -return this.join("\n"); -}; -Array.prototype.cjoin=function(){ -return this.join(", "); -}; -Array.prototype.equals=function(a,_20){ -if(this==a){ -return true; -} -if(a.length!=this.length){ -return false; -} -return this.map(function(_21,idx){ -return _20?_21===a[idx]:_21==a[idx]; -}).all(); -}; -Array.prototype.all=function(fn){ -return filter(this,fn).length==this.length; -}; -Array.prototype.any=function(fn){ -return filter(this,fn).length>0; -}; -Array.prototype.each=function(fn){ -return each(this,fn); -}; -Array.prototype.map=function(fn){ -return map(this,fn); -}; -Array.prototype.filter=function(fn){ -return filter(this,fn); -}; -Array.prototype.select=Array.prototype.filter; -Array.prototype.reduce=function(){ -var _24=map(arguments); -fn=_24.pop(); -d=_24.pop(); -return reduce(this,d,fn); -}; -Array.prototype.inject=Array.prototype.reduce; -Array.prototype.reject=function(fn){ -if(typeof (fn)=="string"){ -fn=__strfn("item,idx,list",fn); -} -var _25=this; -var _26=[]; -fn=fn||function(v){ -return v; -}; -map(_25,function(_28,idx,_29){ -if(fn(_28,idx,_29)){ -_26.push(idx); -} -}); -_26.reverse().each(function(idx){ -_25.splice(idx,1); -}); -return _25; -}; -function __strfn(_30,fn){ -function quote(s){ -return "\""+s.replace(/"/g,"\\\"")+"\""; -} -if(!/\breturn\b/.test(fn)){ -fn=fn.replace(/;\s*$/,""); -fn=fn.insert(fn.lastIndexOf(";")+1," return "); -} -return eval("new Function("+map(_30.split(/\s*,\s*/),quote).join()+","+quote(fn)+")"); -} -function each(_32,fn){ -if(typeof (fn)=="string"){ -return each(_32,__strfn("item,idx,list",fn)); -} -for(var i=0;i<_32.length;i++){ -fn(_32[i],i,_32); -} -} -function map(_33,fn){ -if(typeof (fn)=="string"){ -return map(_33,__strfn("item,idx,list",fn)); -} -var _34=[]; -fn=fn||function(v){ -return v; -}; -for(var i=0;i<_33.length;i++){ -_34.push(fn(_33[i],i,_33)); -} -return _34; -} -function combine(){ -var _35=map(arguments); -var _36=map(_35.slice(0,-1),"map(item)"); -var fn=_35.last(); -var _37=map(_36,"item.length").max(); -var _38=[]; -if(!fn){ -fn=function(){ -return map(arguments); -}; -} -if(typeof fn=="string"){ -if(_36.length>26){ -throw "string functions can take at most 26 lists"; -} -var a="a".charCodeAt(0); -fn=__strfn(map(range(a,a+_36.length),"String.fromCharCode(item)").join(","),fn); -} -map(_36,function(li){ -while(li.length<_37){ -li.push(null); -} -map(li,function(_40,ix){ -if(ix<_38.length){ -_38[ix].push(_40); -}else{ -_38.push([_40]); -} -}); -}); -return map(_38,function(val){ -return fn.apply(fn,val); -}); -} -function filter(_43,fn){ -if(typeof (fn)=="string"){ -return filter(_43,__strfn("item,idx,list",fn)); -} -var _44=[]; -fn=fn||function(v){ -return v; -}; -map(_43,function(_45,idx,_43){ -if(fn(_45,idx,_43)){ -_44.push(_45); -} -}); -return _44; -} -function reduce(_46,_47,fn){ -if(undef(fn)){ -fn=_47; -_47=window.undefined; -} -if(typeof (fn)=="string"){ -return reduce(_46,_47,__strfn("a,b",fn)); -} -if(isdef(_47)){ -_46.splice(0,0,_47); -} -if(_46.length===0){ -return false; -} -if(_46.length===1){ -return _46[0]; -} -var _48=_46[0]; -var i=1; -while(i<_46.length){ -_48=fn(_48,_46[i++]); -} -return _48; -} -function range(_49,_50,_51){ -if(isUndefined(_50)){ -return range(0,_49,_51); -} -if(isUndefined(_51)){ -_51=1; -} -var ss=(_51/Math.abs(_51)); -var r=[]; -for(i=_49;i*ss<_50*ss;i=i+_51){ -r.push(i); -} -return r; -} -
-var Hash={_each:function(_1){ -for(key in this){ -var _2=this[key]; -if(typeof _2=="function"){ -continue; -} -var _3=[key,_2]; -_3.key=key; -_3.value=_2; -_1(_3); -} -},keys:function(){ -return this.pluck("key"); -},values:function(){ -return this.pluck("value"); -},merge:function(_4){ -return $H(_4).inject($H(this),function(_5,_6){ -_5[_6.key]=_6.value; -return _5; -}); -},toQueryString:function(){ -return this.map(function(_7){ -return _7.map(encodeURIComponent).join("="); -}).join("&"); -},inspect:function(){ -return "#<Hash:{"+this.map(function(_8){ -return _8.map(Object.inspect).join(": "); -}).join(", ")+"}>"; -}}; -function $H(_9){ -var _10=Object.extend({},_9||{}); -Object.extend(_10,Enumerable); -Object.extend(_10,Hash); -return _10; -} -
-ObjectRange=Class.create(); -Object.extend(ObjectRange.prototype,Enumerable); -Object.extend(ObjectRange.prototype,{initialize:function(_1,_2,_3){ -this.start=_1; -this.end=_2; -this.exclusive=_3; -},_each:function(_4){ -var _5=this.start; -do{ -_4(_5); -_5=_5.succ(); -}while(this.include(_5)); -},include:function(_6){ -if(_6<this.start){ -return false; -} -if(this.exclusive){ -return _6<this.end; -} -return _6<=this.end; -}}); -var $R=function(_7,_8,_9){ -return new ObjectRange(_7,_8,_9); -}; -
-function __strfn(_1,fn){ -function quote(s){ -return "\""+s.replace(/"/g,"\\\"")+"\""; -} -if(!/\breturn\b/.test(fn)){ -fn=fn.replace(/;\s*$/,""); -fn=fn.insert(fn.lastIndexOf(";")+1," return "); -} -return eval("new Function("+map(_1.split(/\s*,\s*/),quote).join()+","+quote(fn)+")"); -} -function each(_4,fn){ -if(typeof (fn)=="string"){ -return each(_4,__strfn("item,idx,list",fn)); -} -for(var i=0;i<_4.length;i++){ -fn(_4[i],i,_4); -} -} -function map(_6,fn){ -if(typeof (fn)=="string"){ -return map(_6,__strfn("item,idx,list",fn)); -} -var _7=[]; -fn=fn||function(v){ -return v; -}; -for(var i=0;i<_6.length;i++){ -_7.push(fn(_6[i],i,_6)); -} -return _7; -} -
-var Prado={Version:2}; -
-Prado.doPostBack=function(_1,_2,_3,_4,_5,_6,_7,_8){ -if(typeof (_4)=="undefined"){ -var _4=false; -var _5=""; -var _6=null; -var _7=false; -var _8=true; -} -var _9=document.getElementById?document.getElementById(_1):document.forms[_1]; -var _10=true; -if(_4){ -_10=Prado.Validation.IsValid(_9); -} -if(_10){ -if(_6!=null&&(_6.length>0)){ -_9.action=_6; -} -if(_7){ -var _11=_9.elements["PRADO_LASTFOCUS"]; -if((typeof (_11)!="undefined")&&(_11!=null)){ -var _12=document.activeElement; -if(typeof (_12)=="undefined"){ -_11.value=_2; -}else{ -if((_12!=null)&&(typeof (_12.id)!="undefined")){ -if(_12.id.length>0){ -_11.value=_12.id; -}else{ -if(typeof (_12.name)!="undefined"){ -_11.value=_12.name; -} -} -} -} -} -} -if(!_8){ -_10=false; -} -} -if(_10&&(!_9.onsubmit||_9.onsubmit())){ -_9.PRADO_POSTBACK_TARGET.value=_2; -_9.PRADO_POSTBACK_PARAMETER.value=_3; -_9.submit(); -} -}; -
-Prado.Focus=Class.create(); -Prado.Focus.setFocus=function(id){ -var _2=document.getElementById?document.getElementById(id):document.all[id]; -if(_2&&!Prado.Focus.canFocusOn(_2)){ -_2=Prado.Focus.findTarget(_2); -} -if(_2){ -try{ -_2.focus(); -_2.scrollIntoView(false); -if(window.__smartNav){ -window.__smartNav.ae=_2.id; -} -} -catch(e){ -} -} -}; -Prado.Focus.canFocusOn=function(_3){ -if(!_3||!(_3.tagName)){ -return false; -} -var _4=_3.tagName.toLowerCase(); -return !_3.disabled&&(!_3.type||_3.type.toLowerCase()!="hidden")&&Prado.Focus.isFocusableTag(_4)&&Prado.Focus.isVisible(_3); -}; -Prado.Focus.isFocusableTag=function(_5){ -return (_5=="input"||_5=="textarea"||_5=="select"||_5=="button"||_5=="a"); -}; -Prado.Focus.findTarget=function(_6){ -if(!_6||!(_6.tagName)){ -return null; -} -var _7=_6.tagName.toLowerCase(); -if(_7=="undefined"){ -return null; -} -var _8=_6.childNodes; -if(_8){ -for(var i=0;i<_8.length;i++){ -try{ -if(Prado.Focus.canFocusOn(_8[i])){ -return _8[i]; -}else{ -var _10=Prado.Focus.findTarget(_8[i]); -if(_10){ -return _10; -} -} -} -catch(e){ -} -} -} -return null; -}; -Prado.Focus.isVisible=function(_11){ -var _12=_11; -while((typeof (_12)!="undefined")&&(_12!=null)){ -if(_12.disabled||(typeof (_12.style)!="undefined"&&((typeof (_12.style.display)!="undefined"&&_12.style.display=="none")||(typeof (_12.style.visibility)!="undefined"&&_12.style.visibility=="hidden")))){ -return false; -} -if(typeof (_12.parentNode)!="undefined"&&_12.parentNode!=null&&_12.parentNode!=_12&&_12.parentNode.tagName.toLowerCase()!="body"){ -_12=_12.parentNode; -}else{ -return true; -} -} -return true; -}; -
-
diff --git a/framework/Web/Javascripts/js/clientscripts.php b/framework/Web/Javascripts/js/clientscripts.php index 2bc206da..bc5d10f9 100644 --- a/framework/Web/Javascripts/js/clientscripts.php +++ b/framework/Web/Javascripts/js/clientscripts.php @@ -6,14 +6,13 @@ * - Add local file cache for the GZip:ed version.
*/
-if(isset($_GET['nocache']))
+if(is_int(strpos($_SERVER['REQUEST_URI'], '__nocache')))
$expiresOffset = -10000; //no cache
else
$expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires
-// Get data to load
-$library = array( 'base', 'dom', 'effects', 'controls', 'logger',
- 'ajax', 'rico', 'validator', 'datepicker');
+//allowed libraries
+$library = array('prado', 'effects', 'ajax', 'validator', 'logger', 'datepicker', 'rico');
$param = isset($_GET['js']) ? $_GET['js'] : '';
diff --git a/framework/Web/Javascripts/js/datepicker.js b/framework/Web/Javascripts/js/datepicker.js new file mode 100644 index 00000000..b57da791 --- /dev/null +++ b/framework/Web/Javascripts/js/datepicker.js @@ -0,0 +1,422 @@ +Prado.Calendar=Class.create(); +Prado.Calendar.Util=Class.create(); +Object.extend(Prado.Calendar.Util,{IsLeapYear:function(_1){ +return ((_1%4==0)&&((_1%100!=0)||(_1%400==0))); +},yearLength:function(_2){ +if(this.isLeapYear(_2)){ +return 366; +}else{ +return 365; +} +},dayOfYear:function(_3){ +var a=this.isLeapYear(_3.getFullYear())?Calendar.LEAP_NUM_DAYS:Calendar.NUM_DAYS; +return a[_3.getMonth()]+_3.getDate(); +},browser:function(){ +var _5={Version:"1.0"}; +var _6=parseInt(navigator.appVersion); +_5.nver=_6; +_5.ver=navigator.appVersion; +_5.agent=navigator.userAgent; +_5.dom=document.getElementById?1:0; +_5.opera=window.opera?1:0; +_5.ie5=(_5.ver.indexOf("MSIE 5")>-1&&_5.dom&&!_5.opera)?1:0; +_5.ie6=(_5.ver.indexOf("MSIE 6")>-1&&_5.dom&&!_5.opera)?1:0; +_5.ie4=(document.all&&!_5.dom&&!_5.opera)?1:0; +_5.ie=_5.ie4||_5.ie5||_5.ie6; +_5.mac=_5.agent.indexOf("Mac")>-1; +_5.ns6=(_5.dom&&parseInt(_5.ver)>=5)?1:0; +_5.ie3=(_5.ver.indexOf("MSIE")&&(_6<4)); +_5.hotjava=(_5.agent.toLowerCase().indexOf("hotjava")!=-1)?1:0; +_5.ns4=(document.layers&&!_5.dom&&!_5.hotjava)?1:0; +_5.bw=(_5.ie6||_5.ie5||_5.ie4||_5.ns4||_5.ns6||_5.opera); +_5.ver3=(_5.hotjava||_5.ie3); +_5.opera7=((_5.agent.toLowerCase().indexOf("opera 7")>-1)||(_5.agent.toLowerCase().indexOf("opera/7")>-1)); +_5.operaOld=_5.opera&&!_5.opera7; +return _5; +},ImportCss:function(_7,_8){ +if(this.browser().ie){ +var _9=_7.createStyleSheet(_8); +}else{ +var elm=_7.createElement("link"); +elm.rel="stylesheet"; +elm.href=_8; +if(headArr=_7.getElementsByTagName("head")){ +headArr[0].appendChild(elm); +} +} +}}); +Object.extend(Prado.Calendar,{NUM_DAYS:[0,31,59,90,120,151,181,212,243,273,304,334],LEAP_NUM_DAYS:[0,31,60,91,121,152,182,213,244,274,305,335]}); +Prado.Calendar.prototype={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],shortWeekDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],format:"yyyy-MM-dd",css:"calendar_system.css",initialize:function(_11,_12){ +this.attr=_12||[]; +this.control=$(_11); +this.dateSlot=new Array(42); +this.weekSlot=new Array(6); +this.firstDayOfWeek=1; +this.minimalDaysInFirstWeek=4; +this.currentDate=new Date(); +this.selectedDate=null; +this.className="Prado_Calendar"; +this.trigger=this.attr.trigger?$(this.attr.trigger):this.control; +Event.observe(this.trigger,"click",this.show.bind(this)); +Prado.Calendar.Util.ImportCss(document,this.css); +if(this.attr.format){ +this.format=this.attr.format; +} +this.create(); +this.hookEvents(); +},create:function(){ +var div; +var _14; +var _15; +var tr; +var td; +this._calDiv=document.createElement("div"); +this._calDiv.className=this.className; +this._calDiv.style.display="none"; +div=document.createElement("div"); +div.className="calendarHeader"; +this._calDiv.appendChild(div); +_14=document.createElement("table"); +_14.style.cellSpacing=0; +div.appendChild(_14); +_15=document.createElement("tbody"); +_14.appendChild(_15); +tr=document.createElement("tr"); +_15.appendChild(tr); +td=document.createElement("td"); +td.className="prevMonthButton"; +this._previousMonth=document.createElement("button"); +this._previousMonth.appendChild(document.createTextNode("<<")); +td.appendChild(this._previousMonth); +tr.appendChild(td); +td=document.createElement("td"); +td.className="labelContainer"; +tr.appendChild(td); +this._monthSelect=document.createElement("select"); +for(var i=0;i<this.monthNames.length;i++){ +var opt=document.createElement("option"); +opt.innerHTML=this.monthNames[i]; +opt.value=i; +if(i==this.currentDate.getMonth()){ +opt.selected=true; +} +this._monthSelect.appendChild(opt); +} +td.appendChild(this._monthSelect); +td=document.createElement("td"); +td.className="labelContainer"; +tr.appendChild(td); +this._yearSelect=document.createElement("select"); +for(var i=1920;i<2050;++i){ +var opt=document.createElement("option"); +opt.innerHTML=i; +opt.value=i; +if(i==this.currentDate.getFullYear()){ +opt.selected=false; +} +this._yearSelect.appendChild(opt); +} +td.appendChild(this._yearSelect); +td=document.createElement("td"); +td.className="nextMonthButton"; +this._nextMonth=document.createElement("button"); +this._nextMonth.appendChild(document.createTextNode(">>")); +td.appendChild(this._nextMonth); +tr.appendChild(td); +div=document.createElement("div"); +div.className="calendarBody"; +this._calDiv.appendChild(div); +this._table=div; +var _20; +_14=document.createElement("table"); +_14.className="grid"; +div.appendChild(_14); +var _21=document.createElement("thead"); +_14.appendChild(_21); +tr=document.createElement("tr"); +_21.appendChild(tr); +for(i=0;i<7;++i){ +td=document.createElement("th"); +_20=document.createTextNode(this.shortWeekDayNames[(i+this.firstDayOfWeek)%7]); +td.appendChild(_20); +td.className="weekDayHead"; +tr.appendChild(td); +} +_15=document.createElement("tbody"); +_14.appendChild(_15); +for(week=0;week<6;++week){ +tr=document.createElement("tr"); +_15.appendChild(tr); +for(day=0;day<7;++day){ +td=document.createElement("td"); +td.className="calendarDate"; +_20=document.createTextNode(String.fromCharCode(160)); +td.appendChild(_20); +tr.appendChild(td); +var tmp=new Object(); +tmp.tag="DATE"; +tmp.value=-1; +tmp.data=_20; +this.dateSlot[(week*7)+day]=tmp; +Event.observe(td,"mouseover",this.hover.bind(this)); +Event.observe(td,"mouseout",this.hover.bind(this)); +} +} +div=document.createElement("div"); +div.className="calendarFooter"; +this._calDiv.appendChild(div); +_14=document.createElement("table"); +_14.className="footerTable"; +div.appendChild(_14); +_15=document.createElement("tbody"); +_14.appendChild(_15); +tr=document.createElement("tr"); +_15.appendChild(tr); +td=document.createElement("td"); +td.className="todayButton"; +this._todayButton=document.createElement("button"); +var _23=new Date(); +var _24=_23.getDate()+" "+this.monthNames[_23.getMonth()]+", "+_23.getFullYear(); +this._todayButton.appendChild(document.createTextNode(_24)); +td.appendChild(this._todayButton); +tr.appendChild(td); +td=document.createElement("td"); +td.className="clearButton"; +this._clearButton=document.createElement("button"); +var _23=new Date(); +_24="Clear"; +this._clearButton.appendChild(document.createTextNode(_24)); +td.appendChild(this._clearButton); +tr.appendChild(td); +document.body.appendChild(this._calDiv); +this.update(); +this.updateHeader(); +return this._calDiv; +},hookEvents:function(){ +this._previousMonth.hideFocus=true; +this._nextMonth.hideFocus=true; +this._todayButton.hideFocus=true; +Event.observe(this._previousMonth,"click",this.prevMonth.bind(this)); +Event.observe(this._nextMonth,"click",this.nextMonth.bind(this)); +Event.observe(this._todayButton,"click",this.selectToday.bind(this)); +Event.observe(this._clearButton,"click",this.clearSelection.bind(this)); +Event.observe(this._monthSelect,"change",this.monthSelect.bind(this)); +Event.observe(this._yearSelect,"change",this.yearSelect.bind(this)); +Event.observe(this._calDiv,"mousewheel",this.mouseWheelChange.bind(this)); +Event.observe(this._table,"click",this.selectDate.bind(this)); +Event.observe(this._calDiv,"keydown",this.keyPressed.bind(this)); +},keyPressed:function(ev){ +if(!ev){ +ev=document.parentWindow.event; +} +var kc=ev.keyCode!=null?ev.keyCode:ev.charCode; +if(kc=Event.KEY_RETURN){ +this.setSelectedDate(this.currentDate); +this.hide(); +return false; +} +if(kc<37||kc>40){ +return true; +} +var d=new Date(this.currentDate).valueOf(); +if(kc==Event.KEY_LEFT){ +d-=86400000; +}else{ +if(kc==Event.KEY_RIGHT){ +d+=86400000; +}else{ +if(kc==Event.KEY_UP){ +d-=604800000; +}else{ +if(kc==Event.KEY_DOWN){ +d+=604800000; +} +} +} +} +this.setCurrentDate(new Date(d)); +return false; +},selectDate:function(ev){ +var el=Event.element(ev); +while(el.nodeType!=1){ +el=el.parentNode; +} +while(el!=null&&el.tagName&&el.tagName.toLowerCase()!="td"){ +el=el.parentNode; +} +if(el==null||el.tagName==null||el.tagName.toLowerCase()!="td"){ +return; +} +var d=new Date(this.currentDate); +var n=Number(el.firstChild.data); +if(isNaN(n)||n<=0||n==null){ +return; +} +d.setDate(n); +this.setSelectedDate(d); +this.hide(); +},selectToday:function(){ +this.setSelectedDate(new Date()); +this.hide(); +},clearSelection:function(){ +this.selectedDate=null; +if(isFunction(this.onchange)){ +this.onchange(); +} +this.hide(); +},monthSelect:function(ev){ +this.setMonth(Form.Element.getValue(Event.element(ev))); +},yearSelect:function(ev){ +this.setYear(Form.Element.getValue(Event.element(ev))); +},mouseWheelChange:function(e){ +if(e==null){ +e=document.parentWindow.event; +} +var n=-e.wheelDelta/120; +var d=new Date(this.currentDate); +var m=this.getMonth()+n; +this.setMonth(m); +this.setCurrentDate(d); +return false; +},onchange:function(){ +this.control.value=this.formatDate(); +},formatDate:function(){ +return Prado.Calendar.Util.FormatDate(this.selectedDate,this.format); +},setCurrentDate:function(_32){ +if(_32==null){ +return; +} +if(isString(_32)||isNumber(_32)){ +_32=new Date(_32); +} +if(this.currentDate.getDate()!=_32.getDate()||this.currentDate.getMonth()!=_32.getMonth()||this.currentDate.getFullYear()!=_32.getFullYear()){ +this.currentDate=new Date(_32); +this.updateHeader(); +this.update(); +} +},setSelectedDate:function(_33){ +this.selectedDate=new Date(_33); +this.setCurrentDate(this.selectedDate); +if(isFunction(this.onchange)){ +this.onchange(); +} +},getElement:function(){ +return this._calDiv; +},getSelectedDate:function(){ +return isNull(this.selectedDate)?null:new Date(this.selectedDate); +},setYear:function(_34){ +var d=new Date(this.currentDate); +d.setFullYear(_34); +this.setCurrentDate(d); +},setMonth:function(_35){ +var d=new Date(this.currentDate); +d.setMonth(_35); +this.setCurrentDate(d); +},nextMonth:function(){ +this.setMonth(this.currentDate.getMonth()+1); +},prevMonth:function(){ +this.setMonth(this.currentDate.getMonth()-1); +},show:function(){ +if(!this.showing){ +var pos=Position.cumulativeOffset(this.control); +pos[1]+=this.control.offsetHeight; +this._calDiv.style.display="block"; +this._calDiv.style.top=pos[1]+"px"; +this._calDiv.style.left=pos[0]+"px"; +Event.observe(document.body,"click",this.hideOnClick.bind(this)); +var _37=Prado.Calendar.Util.ParseDate(Form.Element.getValue(this.control),this.format); +if(!isNull(_37)){ +this.selectedDate=_37; +this.setCurrentDate(_37); +} +this.showing=true; +} +},hideOnClick:function(ev){ +if(!this.showing){ +return; +} +var el=Event.element(ev); +var _38=false; +do{ +_38=_38||el.className==this.className; +_38=_38||el==this.trigger; +_38=_38||el==this.control; +if(_38){ +break; +} +el=el.parentNode; +}while(el); +if(!_38){ +this.hide(); +} +},hide:function(){ +if(this.showing){ +this._calDiv.style.display="none"; +this.showing=false; +Event.stopObserving(document.body,"click",this.hideOnClick.bind(this)); +} +},update:function(){ +var _39=Prado.Calendar.Util; +var _40=this.currentDate; +var _41=_39.ISODate(new Date()); +var _42=isNull(this.selectedDate)?"":_39.ISODate(this.selectedDate); +var _43=_39.ISODate(_40); +var d1=new Date(_40.getFullYear(),_40.getMonth(),1); +var d2=new Date(_40.getFullYear(),_40.getMonth()+1,1); +var _46=Math.round((d2-d1)/(24*60*60*1000)); +var _47=(d1.getDay()-this.firstDayOfWeek)%7; +if(_47<0){ +_47+=7; +} +var _48=0; +while(_48<_47){ +this.dateSlot[_48].value=-1; +this.dateSlot[_48].data.data=String.fromCharCode(160); +this.dateSlot[_48].data.parentNode.className="empty"; +_48++; +} +for(i=1;i<=_46;i++,_48++){ +var _49=this.dateSlot[_48]; +var _50=_49.data.parentNode; +_49.value=i; +_49.data.data=i; +_50.className="date"; +if(_39.ISODate(d1)==_41){ +_50.className+=" today"; +} +if(_39.ISODate(d1)==_43){ +_50.className+=" current"; +} +if(_39.ISODate(d1)==_42){ +_50.className+=" selected"; +} +d1=new Date(d1.getFullYear(),d1.getMonth(),d1.getDate()+1); +} +var _51=_48; +while(_48<42){ +this.dateSlot[_48].value=-1; +this.dateSlot[_48].data.data=String.fromCharCode(160); +this.dateSlot[_48].data.parentNode.className="empty"; +++_48; +} +},hover:function(ev){ +Element.condClassName(Event.element(ev),"hover",ev.type=="mouseover"); +},updateHeader:function(){ +var _52=this._monthSelect.options; +var m=this.currentDate.getMonth(); +for(var i=0;i<_52.length;++i){ +_52[i].selected=false; +if(_52[i].value==m){ +_52[i].selected=true; +} +} +_52=this._yearSelect.options; +var _53=this.currentDate.getFullYear(); +for(var i=0;i<_52.length;++i){ +_52[i].selected=false; +if(_52[i].value==_53){ +_52[i].selected=true; +} +} +}}; +
diff --git a/framework/Web/Javascripts/js/effects.js b/framework/Web/Javascripts/js/effects.js new file mode 100644 index 00000000..44f1a4e8 --- /dev/null +++ b/framework/Web/Javascripts/js/effects.js @@ -0,0 +1,720 @@ +String.prototype.parseColor=function(){ +var _1="#"; +if(this.slice(0,4)=="rgb("){ +var _2=this.slice(4,this.length-1).split(","); +var i=0; +do{ +_1+=parseInt(_2[i]).toColorPart(); +}while(++i<3); +}else{ +if(this.slice(0,1)=="#"){ +if(this.length==4){ +for(var i=1;i<4;i++){ +_1+=(this.charAt(i)+this.charAt(i)).toLowerCase(); +} +} +if(this.length==7){ +_1=this.toLowerCase(); +} +} +} +return (_1.length==7?_1:(arguments[0]||this)); +}; +Element.collectTextNodesIgnoreClass=function(_4,_5){ +var _6=$(_4).childNodes; +var _7=""; +var _8=new RegExp("^([^ ]+ )*"+_5+"( [^ ]+)*$","i"); +for(var i=0;i<_6.length;i++){ +if(_6[i].nodeType==3){ +_7+=_6[i].nodeValue; +}else{ +if((!_6[i].className.match(_8))&&_6[i].hasChildNodes()){ +_7+=Element.collectTextNodesIgnoreClass(_6[i],_5); +} +} +} +return _7; +}; +Element.setStyle=function(_9,_10){ +_9=$(_9); +for(k in _10){ +_9.style[k.camelize()]=_10[k]; +} +}; +Element.setContentZoom=function(_11,_12){ +Element.setStyle(_11,{fontSize:(_12/100)+"em"}); +if(navigator.appVersion.indexOf("AppleWebKit")>0){ +window.scrollBy(0,0); +} +}; +Element.getOpacity=function(_13){ +var _14; +if(_14=Element.getStyle(_13,"opacity")){ +return parseFloat(_14); +} +if(_14=(Element.getStyle(_13,"filter")||"").match(/alpha\(opacity=(.*)\)/)){ +if(_14[1]){ +return parseFloat(_14[1])/100; +} +} +return 1; +}; +Element.setOpacity=function(_15,_16){ +_15=$(_15); +if(_16==1){ +Element.setStyle(_15,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null}); +if(/MSIE/.test(navigator.userAgent)){ +Element.setStyle(_15,{filter:Element.getStyle(_15,"filter").replace(/alpha\([^\)]*\)/gi,"")}); +} +}else{ +if(_16<0.00001){ +_16=0; +} +Element.setStyle(_15,{opacity:_16}); +if(/MSIE/.test(navigator.userAgent)){ +Element.setStyle(_15,{filter:Element.getStyle(_15,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_16*100+")"}); +} +} +}; +Element.getInlineOpacity=function(_17){ +return $(_17).style.opacity||""; +}; +Element.childrenWithClassName=function(_18,_19){ +return $A($(_18).getElementsByTagName("*")).select(function(c){ +return Element.hasClassName(c,_19); +}); +}; +Array.prototype.call=function(){ +var _21=arguments; +this.each(function(f){ +f.apply(this,_21); +}); +}; +var Effect={tagifyText:function(_23){ +var _24="position:relative"; +if(/MSIE/.test(navigator.userAgent)){ +_24+=";zoom:1"; +} +_23=$(_23); +$A(_23.childNodes).each(function(_25){ +if(_25.nodeType==3){ +_25.nodeValue.toArray().each(function(_26){ +_23.insertBefore(Builder.node("span",{style:_24},_26==" "?String.fromCharCode(160):_26),_25); +}); +Element.remove(_25); +} +}); +},multiple:function(_27,_28){ +var _29; +if(((typeof _27=="object")||(typeof _27=="function"))&&(_27.length)){ +_29=_27; +}else{ +_29=$(_27).childNodes; +} +var _30=Object.extend({speed:0.1,delay:0},arguments[2]||{}); +var _31=_30.delay; +$A(_29).each(function(_27,_32){ +new _28(_27,Object.extend(_30,{delay:_32*_30.speed+_31})); +}); +}}; +var Effect2=Effect; +Effect.Transitions={}; +Effect.Transitions.linear=function(pos){ +return pos; +}; +Effect.Transitions.sinoidal=function(pos){ +return (-Math.cos(pos*Math.PI)/2)+0.5; +}; +Effect.Transitions.reverse=function(pos){ +return 1-pos; +}; +Effect.Transitions.flicker=function(pos){ +return ((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4; +}; +Effect.Transitions.wobble=function(pos){ +return (-Math.cos(pos*Math.PI*(9*pos))/2)+0.5; +}; +Effect.Transitions.pulse=function(pos){ +return (Math.floor(pos*10)%2==0?(pos*10-Math.floor(pos*10)):1-(pos*10-Math.floor(pos*10))); +}; +Effect.Transitions.none=function(pos){ +return 0; +}; +Effect.Transitions.full=function(pos){ +return 1; +}; +Effect.Queue={effects:[],_each:function(_34){ +this.effects._each(_34); +},interval:null,add:function(_35){ +var _36=new Date().getTime(); +switch(_35.options.queue){ +case "front": +this.effects.findAll(function(e){ +return e.state=="idle"; +}).each(function(e){ +e.startOn+=_35.finishOn; +e.finishOn+=_35.finishOn; +}); +break; +case "end": +_36=this.effects.pluck("finishOn").max()||_36; +break; +} +_35.startOn+=_36; +_35.finishOn+=_36; +this.effects.push(_35); +if(!this.interval){ +this.interval=setInterval(this.loop.bind(this),40); +} +},remove:function(_38){ +this.effects=this.effects.reject(function(e){ +return e==_38; +}); +if(this.effects.length==0){ +clearInterval(this.interval); +this.interval=null; +} +},loop:function(){ +var _39=new Date().getTime(); +this.effects.invoke("loop",_39); +}}; +Object.extend(Effect.Queue,Enumerable); +Effect.Base=function(){ +}; +Effect.Base.prototype={position:null,setOptions:function(_40){ +this.options=Object.extend({transition:Effect.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"},_40||{}); +},start:function(_41){ +this.setOptions(_41||{}); +this.currentFrame=0; +this.state="idle"; +this.startOn=this.options.delay*1000; +this.finishOn=this.startOn+(this.options.duration*1000); +this.event("beforeStart"); +if(!this.options.sync){ +Effect.Queue.add(this); +} +},loop:function(_42){ +if(_42>=this.startOn){ +if(_42>=this.finishOn){ +this.render(1); +this.cancel(); +this.event("beforeFinish"); +if(this.finish){ +this.finish(); +} +this.event("afterFinish"); +return; +} +var pos=(_42-this.startOn)/(this.finishOn-this.startOn); +var _43=Math.round(pos*this.options.fps*this.options.duration); +if(_43>this.currentFrame){ +this.render(pos); +this.currentFrame=_43; +} +} +},render:function(pos){ +if(this.state=="idle"){ +this.state="running"; +this.event("beforeSetup"); +if(this.setup){ +this.setup(); +} +this.event("afterSetup"); +} +if(this.state=="running"){ +if(this.options.transition){ +pos=this.options.transition(pos); +} +pos*=(this.options.to-this.options.from); +pos+=this.options.from; +this.position=pos; +this.event("beforeUpdate"); +if(this.update){ +this.update(pos); +} +this.event("afterUpdate"); +} +},cancel:function(){ +if(!this.options.sync){ +Effect.Queue.remove(this); +} +this.state="finished"; +},event:function(_44){ +if(this.options[_44+"Internal"]){ +this.options[_44+"Internal"](this); +} +if(this.options[_44]){ +this.options[_44](this); +} +},inspect:function(){ +return "#<Effect:"+$H(this).inspect()+",options:"+$H(this.options).inspect()+">"; +}}; +Effect.Parallel=Class.create(); +Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(_45){ +this.effects=_45||[]; +this.start(arguments[1]); +},update:function(_46){ +this.effects.invoke("render",_46); +},finish:function(_47){ +this.effects.each(function(_48){ +_48.render(1); +_48.cancel(); +_48.event("beforeFinish"); +if(_48.finish){ +_48.finish(_47); +} +_48.event("afterFinish"); +}); +}}); +Effect.Opacity=Class.create(); +Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(_49){ +this.element=$(_49); +if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout)){ +Element.setStyle(this.element,{zoom:1}); +} +var _50=Object.extend({from:Element.getOpacity(this.element)||0,to:1},arguments[1]||{}); +this.start(_50); +},update:function(_51){ +Element.setOpacity(this.element,_51); +}}); +Effect.MoveBy=Class.create(); +Object.extend(Object.extend(Effect.MoveBy.prototype,Effect.Base.prototype),{initialize:function(_52,_53,_54){ +this.element=$(_52); +this.toTop=_53; +this.toLeft=_54; +this.start(arguments[3]); +},setup:function(){ +Element.makePositioned(this.element); +this.originalTop=parseFloat(Element.getStyle(this.element,"top")||"0"); +this.originalLeft=parseFloat(Element.getStyle(this.element,"left")||"0"); +},update:function(_55){ +Element.setStyle(this.element,{top:this.toTop*_55+this.originalTop+"px",left:this.toLeft*_55+this.originalLeft+"px"}); +}}); +Effect.Scale=Class.create(); +Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(_56,_57){ +this.element=$(_56); +var _58=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_57},arguments[2]||{}); +this.start(_58); +},setup:function(){ +this.restoreAfterFinish=this.options.restoreAfterFinish||false; +this.elementPositioning=Element.getStyle(this.element,"position"); +this.originalStyle={}; +["top","left","width","height","fontSize"].each(function(k){ +this.originalStyle[k]=this.element.style[k]; +}.bind(this)); +this.originalTop=this.element.offsetTop; +this.originalLeft=this.element.offsetLeft; +var _60=Element.getStyle(this.element,"font-size")||"100%"; +["em","px","%"].each(function(_61){ +if(_60.indexOf(_61)>0){ +this.fontSize=parseFloat(_60); +this.fontSizeType=_61; +} +}.bind(this)); +this.factor=(this.options.scaleTo-this.options.scaleFrom)/100; +this.dims=null; +if(this.options.scaleMode=="box"){ +this.dims=[this.element.offsetHeight,this.element.offsetWidth]; +} +if(/^content/.test(this.options.scaleMode)){ +this.dims=[this.element.scrollHeight,this.element.scrollWidth]; +} +if(!this.dims){ +this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]; +} +},update:function(_62){ +var _63=(this.options.scaleFrom/100)+(this.factor*_62); +if(this.options.scaleContent&&this.fontSize){ +Element.setStyle(this.element,{fontSize:this.fontSize*_63+this.fontSizeType}); +} +this.setDimensions(this.dims[0]*_63,this.dims[1]*_63); +},finish:function(_64){ +if(this.restoreAfterFinish){ +Element.setStyle(this.element,this.originalStyle); +} +},setDimensions:function(_65,_66){ +var d={}; +if(this.options.scaleX){ +d.width=_66+"px"; +} +if(this.options.scaleY){ +d.height=_65+"px"; +} +if(this.options.scaleFromCenter){ +var _68=(_65-this.dims[0])/2; +var _69=(_66-this.dims[1])/2; +if(this.elementPositioning=="absolute"){ +if(this.options.scaleY){ +d.top=this.originalTop-_68+"px"; +} +if(this.options.scaleX){ +d.left=this.originalLeft-_69+"px"; +} +}else{ +if(this.options.scaleY){ +d.top=-_68+"px"; +} +if(this.options.scaleX){ +d.left=-_69+"px"; +} +} +} +Element.setStyle(this.element,d); +}}); +Effect.Highlight=Class.create(); +Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(_70){ +this.element=$(_70); +var _71=Object.extend({startcolor:"#ffff99"},arguments[1]||{}); +this.start(_71); +},setup:function(){ +if(Element.getStyle(this.element,"display")=="none"){ +this.cancel(); +return; +} +this.oldStyle={backgroundImage:Element.getStyle(this.element,"background-image")}; +Element.setStyle(this.element,{backgroundImage:"none"}); +if(!this.options.endcolor){ +this.options.endcolor=Element.getStyle(this.element,"background-color").parseColor("#ffffff"); +} +if(!this.options.restorecolor){ +this.options.restorecolor=Element.getStyle(this.element,"background-color"); +} +this._base=$R(0,2).map(function(i){ +return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16); +}.bind(this)); +this._delta=$R(0,2).map(function(i){ +return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]; +}.bind(this)); +},update:function(_72){ +Element.setStyle(this.element,{backgroundColor:$R(0,2).inject("#",function(m,v,i){ +return m+(Math.round(this._base[i]+(this._delta[i]*_72)).toColorPart()); +}.bind(this))}); +},finish:function(){ +Element.setStyle(this.element,Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor})); +}}); +Effect.ScrollTo=Class.create(); +Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(_75){ +this.element=$(_75); +this.start(arguments[1]||{}); +},setup:function(){ +Position.prepare(); +var _76=Position.cumulativeOffset(this.element); +if(this.options.offset){ +_76[1]+=this.options.offset; +} +var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight); +this.scrollStart=Position.deltaY; +this.delta=(_76[1]>max?max:_76[1])-this.scrollStart; +},update:function(_78){ +Position.prepare(); +window.scrollTo(Position.deltaX,this.scrollStart+(_78*this.delta)); +}}); +Effect.Fade=function(_79){ +var _80=Element.getInlineOpacity(_79); +var _81=Object.extend({from:Element.getOpacity(_79)||1,to:0,afterFinishInternal:function(_82){ +with(Element){ +if(_82.options.to!=0){ +return; +} +hide(_82.element); +setStyle(_82.element,{opacity:_80}); +} +}},arguments[1]||{}); +return new Effect.Opacity(_79,_81); +}; +Effect.Appear=function(_83){ +var _84=Object.extend({from:(Element.getStyle(_83,"display")=="none"?0:Element.getOpacity(_83)||0),to:1,beforeSetup:function(_85){ +with(Element){ +setOpacity(_85.element,_85.options.from); +show(_85.element); +} +}},arguments[1]||{}); +return new Effect.Opacity(_83,_84); +}; +Effect.Puff=function(_86){ +_86=$(_86); +var _87={opacity:Element.getInlineOpacity(_86),position:Element.getStyle(_86,"position")}; +return new Effect.Parallel([new Effect.Scale(_86,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(_86,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(_88){ +with(Element){ +setStyle(_88.effects[0].element,{position:"absolute"}); +} +},afterFinishInternal:function(_89){ +with(Element){ +hide(_89.effects[0].element); +setStyle(_89.effects[0].element,_87); +} +}},arguments[1]||{})); +}; +Effect.BlindUp=function(_90){ +_90=$(_90); +Element.makeClipping(_90); +return new Effect.Scale(_90,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_91){ +with(Element){ +[hide,undoClipping].call(_91.element); +} +}},arguments[1]||{})); +}; +Effect.BlindDown=function(_92){ +_92=$(_92); +var _93=Element.getStyle(_92,"height"); +var _94=Element.getDimensions(_92); +return new Effect.Scale(_92,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_94.height,originalWidth:_94.width},restoreAfterFinish:true,afterSetup:function(_95){ +with(Element){ +makeClipping(_95.element); +setStyle(_95.element,{height:"0px"}); +show(_95.element); +} +},afterFinishInternal:function(_96){ +with(Element){ +undoClipping(_96.element); +setStyle(_96.element,{height:_93}); +} +}},arguments[1]||{})); +}; +Effect.SwitchOff=function(_97){ +_97=$(_97); +var _98=Element.getInlineOpacity(_97); +return new Effect.Appear(_97,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(_99){ +new Effect.Scale(_99.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(_99){ +with(Element){ +[makePositioned,makeClipping].call(_99.element); +} +},afterFinishInternal:function(_100){ +with(Element){ +[hide,undoClipping,undoPositioned].call(_100.element); +setStyle(_100.element,{opacity:_98}); +} +}}); +}}); +}; +Effect.DropOut=function(_101){ +_101=$(_101); +var _102={top:Element.getStyle(_101,"top"),left:Element.getStyle(_101,"left"),opacity:Element.getInlineOpacity(_101)}; +return new Effect.Parallel([new Effect.MoveBy(_101,100,0,{sync:true}),new Effect.Opacity(_101,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(_103){ +with(Element){ +makePositioned(_103.effects[0].element); +} +},afterFinishInternal:function(_104){ +with(Element){ +[hide,undoPositioned].call(_104.effects[0].element); +setStyle(_104.effects[0].element,_102); +} +}},arguments[1]||{})); +}; +Effect.Shake=function(_105){ +_105=$(_105); +var _106={top:Element.getStyle(_105,"top"),left:Element.getStyle(_105,"left")}; +return new Effect.MoveBy(_105,0,20,{duration:0.05,afterFinishInternal:function(_107){ +new Effect.MoveBy(_107.element,0,-40,{duration:0.1,afterFinishInternal:function(_107){ +new Effect.MoveBy(_107.element,0,40,{duration:0.1,afterFinishInternal:function(_107){ +new Effect.MoveBy(_107.element,0,-40,{duration:0.1,afterFinishInternal:function(_107){ +new Effect.MoveBy(_107.element,0,40,{duration:0.1,afterFinishInternal:function(_107){ +new Effect.MoveBy(_107.element,0,-20,{duration:0.05,afterFinishInternal:function(_107){ +with(Element){ +undoPositioned(_107.element); +setStyle(_107.element,_106); +} +}}); +}}); +}}); +}}); +}}); +}}); +}; +Effect.SlideDown=function(_108){ +_108=$(_108); +Element.cleanWhitespace(_108); +var _109=Element.getStyle(_108.firstChild,"bottom"); +var _110=Element.getDimensions(_108); +return new Effect.Scale(_108,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_110.height,originalWidth:_110.width},restoreAfterFinish:true,afterSetup:function(_111){ +with(Element){ +makePositioned(_111.element); +makePositioned(_111.element.firstChild); +if(window.opera){ +setStyle(_111.element,{top:""}); +} +makeClipping(_111.element); +setStyle(_111.element,{height:"0px"}); +show(_108); +} +},afterUpdateInternal:function(_112){ +with(Element){ +setStyle(_112.element.firstChild,{bottom:(_112.dims[0]-_112.element.clientHeight)+"px"}); +} +},afterFinishInternal:function(_113){ +with(Element){ +undoClipping(_113.element); +undoPositioned(_113.element.firstChild); +undoPositioned(_113.element); +setStyle(_113.element.firstChild,{bottom:_109}); +} +}},arguments[1]||{})); +}; +Effect.SlideUp=function(_114){ +_114=$(_114); +Element.cleanWhitespace(_114); +var _115=Element.getStyle(_114.firstChild,"bottom"); +return new Effect.Scale(_114,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_116){ +with(Element){ +makePositioned(_116.element); +makePositioned(_116.element.firstChild); +if(window.opera){ +setStyle(_116.element,{top:""}); +} +makeClipping(_116.element); +show(_114); +} +},afterUpdateInternal:function(_117){ +with(Element){ +setStyle(_117.element.firstChild,{bottom:(_117.dims[0]-_117.element.clientHeight)+"px"}); +} +},afterFinishInternal:function(_118){ +with(Element){ +[hide,undoClipping].call(_118.element); +undoPositioned(_118.element.firstChild); +undoPositioned(_118.element); +setStyle(_118.element.firstChild,{bottom:_115}); +} +}},arguments[1]||{})); +}; +Effect.Squish=function(_119){ +return new Effect.Scale(_119,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(_120){ +with(Element){ +makeClipping(_120.element); +} +},afterFinishInternal:function(_121){ +with(Element){ +hide(_121.element); +undoClipping(_121.element); +} +}}); +}; +Effect.Grow=function(_122){ +_122=$(_122); +var _123=Object.extend({direction:"center",moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{}); +var _124={top:_122.style.top,left:_122.style.left,height:_122.style.height,width:_122.style.width,opacity:Element.getInlineOpacity(_122)}; +var dims=Element.getDimensions(_122); +var _126,initialMoveY; +var _127,moveY; +switch(_123.direction){ +case "top-left": +_126=initialMoveY=_127=moveY=0; +break; +case "top-right": +_126=dims.width; +initialMoveY=moveY=0; +_127=-dims.width; +break; +case "bottom-left": +_126=_127=0; +initialMoveY=dims.height; +moveY=-dims.height; +break; +case "bottom-right": +_126=dims.width; +initialMoveY=dims.height; +_127=-dims.width; +moveY=-dims.height; +break; +case "center": +_126=dims.width/2; +initialMoveY=dims.height/2; +_127=-dims.width/2; +moveY=-dims.height/2; +break; +} +return new Effect.MoveBy(_122,initialMoveY,_126,{duration:0.01,beforeSetup:function(_128){ +with(Element){ +hide(_128.element); +makeClipping(_128.element); +makePositioned(_128.element); +} +},afterFinishInternal:function(_129){ +new Effect.Parallel([new Effect.Opacity(_129.element,{sync:true,to:1,from:0,transition:_123.opacityTransition}),new Effect.MoveBy(_129.element,moveY,_127,{sync:true,transition:_123.moveTransition}),new Effect.Scale(_129.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:_123.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(_129){ +with(Element){ +setStyle(_129.effects[0].element,{height:"0px"}); +show(_129.effects[0].element); +} +},afterFinishInternal:function(_130){ +with(Element){ +[undoClipping,undoPositioned].call(_130.effects[0].element); +setStyle(_130.effects[0].element,_124); +} +}},_123)); +}}); +}; +Effect.Shrink=function(_131){ +_131=$(_131); +var _132=Object.extend({direction:"center",moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{}); +var _133={top:_131.style.top,left:_131.style.left,height:_131.style.height,width:_131.style.width,opacity:Element.getInlineOpacity(_131)}; +var dims=Element.getDimensions(_131); +var _134,moveY; +switch(_132.direction){ +case "top-left": +_134=moveY=0; +break; +case "top-right": +_134=dims.width; +moveY=0; +break; +case "bottom-left": +_134=0; +moveY=dims.height; +break; +case "bottom-right": +_134=dims.width; +moveY=dims.height; +break; +case "center": +_134=dims.width/2; +moveY=dims.height/2; +break; +} +return new Effect.Parallel([new Effect.Opacity(_131,{sync:true,to:0,from:1,transition:_132.opacityTransition}),new Effect.Scale(_131,window.opera?1:0,{sync:true,transition:_132.scaleTransition,restoreAfterFinish:true}),new Effect.MoveBy(_131,moveY,_134,{sync:true,transition:_132.moveTransition})],Object.extend({beforeStartInternal:function(_135){ +with(Element){ +[makePositioned,makeClipping].call(_135.effects[0].element); +} +},afterFinishInternal:function(_136){ +with(Element){ +[hide,undoClipping,undoPositioned].call(_136.effects[0].element); +setStyle(_136.effects[0].element,_133); +} +}},_132)); +}; +Effect.Pulsate=function(_137){ +_137=$(_137); +var _138=arguments[1]||{}; +var _139=Element.getInlineOpacity(_137); +var _140=_138.transition||Effect.Transitions.sinoidal; +var _141=function(pos){ +return _140(1-Effect.Transitions.pulse(pos)); +}; +_141.bind(_140); +return new Effect.Opacity(_137,Object.extend(Object.extend({duration:3,from:0,afterFinishInternal:function(_142){ +Element.setStyle(_142.element,{opacity:_139}); +}},_138),{transition:_141})); +}; +Effect.Fold=function(_143){ +_143=$(_143); +var _144={top:_143.style.top,left:_143.style.left,width:_143.style.width,height:_143.style.height}; +Element.makeClipping(_143); +return new Effect.Scale(_143,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(_145){ +new Effect.Scale(_143,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_145){ +with(Element){ +[hide,undoClipping].call(_145.element); +setStyle(_145.element,_144); +} +}}); +}},arguments[1]||{})); +}; +
+Prado.Effect={Highlight:function(_1,_2){ +new Effect.Highlight(_1,{"duration":_2}); +},Scale:function(_3,_4){ +new Effect.Scale(_3,_4); +},MoveBy:function(_5,_6,_7){ +new Effect.MoveBy(_5,_6,_7); +},ScrollTo:function(_8,_9){ +new Effect.ScrollTo(_8,{"duration":_9}); +}}; +
diff --git a/framework/Web/Javascripts/js/dom.js b/framework/Web/Javascripts/js/prado.js index 4a4904ad..6df4abd0 100644 --- a/framework/Web/Javascripts/js/dom.js +++ b/framework/Web/Javascripts/js/prado.js @@ -1,3 +1,595 @@ +var Prototype={Version:"1.4.0",ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){ +},K:function(x){ +return x; +}}; +
+var Class={create:function(){ +return function(){ +this.initialize.apply(this,arguments); +}; +}}; +var Abstract=new Object(); +Object.extend=function(_1,_2){ +for(property in _2){ +_1[property]=_2[property]; +} +return _1; +}; +Object.inspect=function(_3){ +try{ +if(_3==undefined){ +return "undefined"; +} +if(_3==null){ +return "null"; +} +return _3.inspect?_3.inspect():_3.toString(); +} +catch(e){ +if(e instanceof RangeError){ +return "..."; +} +throw e; +} +}; +Function.prototype.bind=function(){ +var _4=this,args=$A(arguments),object=args.shift(); +return function(){ +return _4.apply(object,args.concat($A(arguments))); +}; +}; +Function.prototype.bindAsEventListener=function(_5){ +var _6=this; +return function(_7){ +return _6.call(_5,_7||window.event); +}; +}; +Object.extend(Number.prototype,{toColorPart:function(){ +var _8=this.toString(16); +if(this<16){ +return "0"+_8; +} +return _8; +},succ:function(){ +return this+1; +},times:function(_9){ +$R(0,this,true).each(_9); +return this; +}}); +var Try={these:function(){ +var _10; +for(var i=0;i<arguments.length;i++){ +var _12=arguments[i]; +try{ +_10=_12(); +break; +} +catch(e){ +} +} +return _10; +}}; +var PeriodicalExecuter=Class.create(); +PeriodicalExecuter.prototype={initialize:function(_13,_14){ +this.callback=_13; +this.frequency=_14; +this.currentlyExecuting=false; +this.registerCallback(); +},registerCallback:function(){ +setInterval(this.onTimerEvent.bind(this),this.frequency*1000); +},onTimerEvent:function(){ +if(!this.currentlyExecuting){ +try{ +this.currentlyExecuting=true; +this.callback(); +} +finally{ +this.currentlyExecuting=false; +} +} +}}; +function $(){ +var _15=new Array(); +for(var i=0;i<arguments.length;i++){ +var _16=arguments[i]; +if(typeof _16=="string"){ +_16=document.getElementById(_16); +} +if(arguments.length==1){ +return _16; +} +_15.push(_16); +} +return _15; +} +
+function isAlien(a){ +return isObject(a)&&typeof a.constructor!="function"; +} +function isArray(a){ +return isObject(a)&&a.constructor==Array; +} +function isBoolean(a){ +return typeof a=="boolean"; +} +function isFunction(a){ +return typeof a=="function"; +} +function isNull(a){ +return typeof a=="object"&&!a; +} +function isNumber(a){ +return typeof a=="number"&&isFinite(a); +} +function isObject(a){ +return (a&&typeof a=="object")||isFunction(a); +} +function isRegexp(a){ +return a&&a.constructor==RegExp; +} +function isString(a){ +return typeof a=="string"; +} +function isUndefined(a){ +return typeof a=="undefined"; +} +function isEmpty(o){ +var i,v; +if(isObject(o)){ +for(i in o){ +v=o[i]; +if(isUndefined(v)&&isFunction(v)){ +return false; +} +} +} +return true; +} +function undef(v){ +return isUndefined(v); +} +function isdef(v){ +return !isUndefined(v); +} +function isElement(o,_5){ +return o&&isObject(o)&&((!_5&&(o==window||o==document))||o.nodeType==1); +} +function isList(o){ +return o&&isObject(o)&&(isArray(o)||o.item); +} +
+function isElement(o,_2){ +return o&&isObject(o)&&((!_2&&(o==window||o==document))||o.nodeType==1); +} +function $(n,d){ +if(isElement(n)){ +return n; +} +if(isString(n)==false){ +return null; +} +var p,i,x; +if(!d){ +d=document; +} +if((p=n.indexOf("?"))>0&&parent.frames.length){ +d=parent.frames[n.substring(p+1)].document; +n=n.substring(0,p); +} +if(!(x=d[n])&&d.all){ +x=d.all[n]; +} +for(i=0;!x&&i<d.forms.length;i++){ +x=d.forms[i][n]; +} +for(i=0;!x&&d.layers&&i<d.layers.length;i++){ +x=DOM.find(n,d.layers[i].document); +} +if(!x&&d.getElementById){ +x=d.getElementById(n); +} +return x; +} +Function.prototype.bindEvent=function(){ +var _6=this,args=$A(arguments),object=args.shift(); +return function(_7){ +return _6.call(object,[_7||window.event].concat(args)); +}; +}; +
+Object.extend(String.prototype,{stripTags:function(){ +return this.replace(/<\/?[^>]+>/gi,""); +},stripScripts:function(){ +return this.replace(new RegExp(Prototype.ScriptFragment,"img"),""); +},extractScripts:function(){ +var _1=new RegExp(Prototype.ScriptFragment,"img"); +var _2=new RegExp(Prototype.ScriptFragment,"im"); +return (this.match(_1)||[]).map(function(_3){ +return (_3.match(_2)||["",""])[1]; +}); +},evalScripts:function(){ +return this.extractScripts().map(eval); +},escapeHTML:function(){ +var _4=document.createElement("div"); +var _5=document.createTextNode(this); +_4.appendChild(_5); +return _4.innerHTML; +},unescapeHTML:function(){ +var _6=document.createElement("div"); +_6.innerHTML=this.stripTags(); +return _6.childNodes[0]?_6.childNodes[0].nodeValue:""; +},toQueryParams:function(){ +var _7=this.match(/^\??(.*)$/)[1].split("&"); +return _7.inject({},function(_8,_9){ +var _10=_9.split("="); +_8[_10[0]]=_10[1]; +return _8; +}); +},toArray:function(){ +return this.split(""); +},camelize:function(){ +var _11=this.split("-"); +if(_11.length==1){ +return _11[0]; +} +var _12=this.indexOf("-")==0?_11[0].charAt(0).toUpperCase()+_11[0].substring(1):_11[0]; +for(var i=1,len=_11.length;i<len;i++){ +var s=_11[i]; +_12+=s.charAt(0).toUpperCase()+s.substring(1); +} +return _12; +},inspect:function(){ +return "'"+this.replace("\\","\\\\").replace("'","\\'")+"'"; +}}); +String.prototype.parseQuery=String.prototype.toQueryParams; +
+Object.extend(String.prototype,{pad:function(_1,_2,_3){ +if(!_3){ +_3=" "; +} +var s=this; +var _5=_1.toLowerCase()=="left"; +while(s.length<_2){ +s=_5?_3+s:s+_3; +} +return s; +},padLeft:function(_6,_7){ +return this.pad("left",_6,_7); +},padRight:function(_8,_9){ +return this.pad("right",_8,_9); +},zerofill:function(len){ +var s=this; +var ix=/^[+-]/.test(s)?1:0; +while(s.length<len){ +s=s.insert(ix,"0"); +} +return s; +},trim:function(){ +return this.replace(/^\s+|\s+$/g,""); +},trimLeft:function(){ +return this.replace(/^\s+/,""); +},trimRight:function(){ +return this.replace(/\s+$/,""); +},toFunction:function(){ +var _12=this.split(/\./); +var _13=window; +_12.each(function(_14){ +if(_13[new String(_14)]){ +_13=_13[new String(_14)]; +} +}); +if(isFunction(_13)){ +return _13; +}else{ +if(typeof Logger!="undefined"){ +Logger.error("Missing function",this); +} +return Prototype.emptyFunction; +} +},toInteger:function(){ +var exp=/^\s*[-\+]?\d+\s*$/; +if(this.match(exp)==null){ +return null; +} +var num=parseInt(this,10); +return (isNaN(num)?null:num); +},toDouble:function(_17){ +_17=_17||"."; +var exp=new RegExp("^\\s*([-\\+])?(\\d+)?(\\"+_17+"(\\d+))?\\s*$"); +var m=this.match(exp); +if(m==null){ +return null; +} +var _19=m[1]+(m[2].length>0?m[2]:"0")+"."+m[4]; +var num=parseFloat(_19); +return (isNaN(num)?null:num); +},toCurrency:function(_20,_21,_22){ +_20=_20||","; +_22=_22||"."; +_21=typeof (_21)=="undefined"?2:_21; +var exp=new RegExp("^\\s*([-\\+])?(((\\d+)\\"+_20+")*)(\\d+)"+((_21>0)?"(\\"+_22+"(\\d{1,"+_21+"}))?":"")+"\\s*$"); +var m=this.match(exp); +if(m==null){ +return null; +} +var _23=m[2]+m[5]; +var _24=m[1]+_23.replace(new RegExp("(\\"+_20+")","g"),"")+((_21>0)?"."+m[7]:""); +var num=parseFloat(_24); +return (isNaN(num)?null:num); +}}); +
+var $break=new Object(); +var $continue=new Object(); +var Enumerable={each:function(_1){ +var _2=0; +try{ +this._each(function(_3){ +try{ +_1(_3,_2++); +} +catch(e){ +if(e!=$continue){ +throw e; +} +} +}); +} +catch(e){ +if(e!=$break){ +throw e; +} +} +},all:function(_4){ +var _5=true; +this.each(function(_6,_7){ +_5=_5&&!!(_4||Prototype.K)(_6,_7); +if(!_5){ +throw $break; +} +}); +return _5; +},any:function(_8){ +var _9=true; +this.each(function(_10,_11){ +if(_9=!!(_8||Prototype.K)(_10,_11)){ +throw $break; +} +}); +return _9; +},collect:function(_12){ +var _13=[]; +this.each(function(_14,_15){ +_13.push(_12(_14,_15)); +}); +return _13; +},detect:function(_16){ +var _17; +this.each(function(_18,_19){ +if(_16(_18,_19)){ +_17=_18; +throw $break; +} +}); +return _17; +},findAll:function(_20){ +var _21=[]; +this.each(function(_22,_23){ +if(_20(_22,_23)){ +_21.push(_22); +} +}); +return _21; +},grep:function(_24,_25){ +var _26=[]; +this.each(function(_27,_28){ +var _29=_27.toString(); +if(_29.match(_24)){ +_26.push((_25||Prototype.K)(_27,_28)); +} +}); +return _26; +},include:function(_30){ +var _31=false; +this.each(function(_32){ +if(_32==_30){ +_31=true; +throw $break; +} +}); +return _31; +},inject:function(_33,_34){ +this.each(function(_35,_36){ +_33=_34(_33,_35,_36); +}); +return _33; +},invoke:function(_37){ +var _38=$A(arguments).slice(1); +return this.collect(function(_39){ +return _39[_37].apply(_39,_38); +}); +},max:function(_40){ +var _41; +this.each(function(_42,_43){ +_42=(_40||Prototype.K)(_42,_43); +if(_42>=(_41||_42)){ +_41=_42; +} +}); +return _41; +},min:function(_44){ +var _45; +this.each(function(_46,_47){ +_46=(_44||Prototype.K)(_46,_47); +if(_46<=(_45||_46)){ +_45=_46; +} +}); +return _45; +},partition:function(_48){ +var _49=[],falses=[]; +this.each(function(_50,_51){ +((_48||Prototype.K)(_50,_51)?_49:falses).push(_50); +}); +return [_49,falses]; +},pluck:function(_52){ +var _53=[]; +this.each(function(_54,_55){ +_53.push(_54[_52]); +}); +return _53; +},reject:function(_56){ +var _57=[]; +this.each(function(_58,_59){ +if(!_56(_58,_59)){ +_57.push(_58); +} +}); +return _57; +},sortBy:function(_60){ +return this.collect(function(_61,_62){ +return {value:_61,criteria:_60(_61,_62)}; +}).sort(function(_63,_64){ +var a=_63.criteria,b=_64.criteria; +return a<b?-1:a>b?1:0; +}).pluck("value"); +},toArray:function(){ +return this.collect(Prototype.K); +},zip:function(){ +var _66=Prototype.K,args=$A(arguments); +if(typeof args.last()=="function"){ +_66=args.pop(); +} +var _67=[this].concat(args).map($A); +return this.map(function(_68,_69){ +_66(_68=_67.pluck(_69)); +return _68; +}); +},inspect:function(){ +return "#<Enumerable:"+this.toArray().inspect()+">"; +}}; +Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray}); +
+var $A=Array.from=function(_1){ +if(!_1){ +return []; +} +if(_1.toArray){ +return _1.toArray(); +}else{ +var _2=[]; +for(var i=0;i<_1.length;i++){ +_2.push(_1[i]); +} +return _2; +} +}; +Object.extend(Array.prototype,Enumerable); +Array.prototype._reverse=Array.prototype.reverse; +Object.extend(Array.prototype,{_each:function(_4){ +for(var i=0;i<this.length;i++){ +_4(this[i]); +} +},clear:function(){ +this.length=0; +return this; +},first:function(){ +return this[0]; +},last:function(){ +return this[this.length-1]; +},compact:function(){ +return this.select(function(_5){ +return _5!=undefined||_5!=null; +}); +},flatten:function(){ +return this.inject([],function(_6,_7){ +return _6.concat(_7.constructor==Array?_7.flatten():[_7]); +}); +},without:function(){ +var _8=$A(arguments); +return this.select(function(_9){ +return !_8.include(_9); +}); +},indexOf:function(_10){ +for(var i=0;i<this.length;i++){ +if(this[i]==_10){ +return i; +} +} +return -1; +},reverse:function(_11){ +return (_11!==false?this:this.toArray())._reverse(); +},shift:function(){ +var _12=this[0]; +for(var i=0;i<this.length-1;i++){ +this[i]=this[i+1]; +} +this.length--; +return _12; +},inspect:function(){ +return "["+this.map(Object.inspect).join(", ")+"]"; +}}); +
+var Hash={_each:function(_1){ +for(key in this){ +var _2=this[key]; +if(typeof _2=="function"){ +continue; +} +var _3=[key,_2]; +_3.key=key; +_3.value=_2; +_1(_3); +} +},keys:function(){ +return this.pluck("key"); +},values:function(){ +return this.pluck("value"); +},merge:function(_4){ +return $H(_4).inject($H(this),function(_5,_6){ +_5[_6.key]=_6.value; +return _5; +}); +},toQueryString:function(){ +return this.map(function(_7){ +return _7.map(encodeURIComponent).join("="); +}).join("&"); +},inspect:function(){ +return "#<Hash:{"+this.map(function(_8){ +return _8.map(Object.inspect).join(": "); +}).join(", ")+"}>"; +}}; +function $H(_9){ +var _10=Object.extend({},_9||{}); +Object.extend(_10,Enumerable); +Object.extend(_10,Hash); +return _10; +} +
+ObjectRange=Class.create(); +Object.extend(ObjectRange.prototype,Enumerable); +Object.extend(ObjectRange.prototype,{initialize:function(_1,_2,_3){ +this.start=_1; +this.end=_2; +this.exclusive=_3; +},_each:function(_4){ +var _5=this.start; +do{ +_4(_5); +_5=_5.succ(); +}while(this.include(_5)); +},include:function(_6){ +if(_6<this.start){ +return false; +} +if(this.exclusive){ +return _6<this.end; +} +return _6<=this.end; +}}); +var $R=function(_7,_8,_9){ +return new ObjectRange(_7,_8,_9); +}; +
document.getElementsByClassName=function(_1,_2){ var _3=($(_2)||document.body).getElementsByTagName("*"); return $A(_3).inject([],function(_4,_5){ @@ -242,132 +834,6 @@ Object.extend(Element.ClassNames.prototype,Enumerable); Object.extend(Element,{condClassName:function(_1,_2,_3){ (_3?Element.addClassName:Element.removeClassName)(_1,_2); }}); -Prado.Element={setValue:function(_4,_5){ -var el=$(_4); -if(el&&typeof (el.value)!="undefined"){ -el.value=_5; -} -},select:function(_7,_8,_9){ -var el=$(_7); -var _10=_7.indexOf("[]")>-1; -if(!el&&!_10){ -return; -} -_8=_10?"check"+_8:el.tagName.toLowerCase()+_8; -var _11=Prado.Element.Selection; -if(isFunction(_11[_8])){ -_11[_8](_10?_7:el,_9); -} -},click:function(_12){ -var el=$(_12); -if(!el){ -return; -} -if(document.createEvent){ -var evt=document.createEvent("HTMLEvents"); -evt.initEvent("click",true,true); -el.dispatchEvent(evt); -}else{ -if(el.fireEvent){ -el.fireEvent("onclick"); -if(isFunction(el.onclick)){ -el.onclick(); -} -} -} -},setAttribute:function(_14,_15,_16){ -var el=$(_14); -if(_15=="disabled"&&_16==false){ -el.removeAttribute(_15); -}else{ -el.setAttribute(_15,_16); -} -},setOptions:function(_17,_18){ -var el=$(_17); -if(el&&el.tagName.toLowerCase()=="select"){ -while(el.length>0){ -el.remove(0); -} -for(var i=0;i<_18.length;i++){ -el.options[el.options.length]=new Option(_18[i][0],_18[i][1]); -} -} -},focus:function(_20){ -var obj=$(_20); -if(isObject(obj)&&isdef(obj.focus)){ -setTimeout(function(){ -obj.focus(); -},100); -} -return false; -}}; -Prado.Element.Selection={inputValue:function(el,_22){ -switch(el.type.toLowerCase()){ -case "checkbox": -case "radio": -return el.checked=_22; -} -},selectValue:function(el,_23){ -$A(el.options).each(function(_24){ -_24.selected=_24.value==_23; -}); -},selectIndex:function(el,_25){ -if(el.type=="select-one"){ -el.selectedIndex=_25; -}else{ -for(var i=0;i<el.length;i++){ -if(i==_25){ -el.options[i].selected=true; -} -} -} -},selectClear:function(el){ -el.selectedIndex=-1; -},selectAll:function(el){ -$A(el.options).each(function(_26){ -_26.selected=true; -Logger.warn(_26.value); -}); -},selectInvert:function(el){ -$A(el.options).each(function(_27){ -_27.selected=!_27.selected; -}); -},checkValue:function(_28,_29){ -$A(document.getElementsByName(_28)).each(function(el){ -el.checked=el.value==_29; -}); -},checkIndex:function(_30,_31){ -var _32=$A(document.getElementsByName(_30)); -for(var i=0;i<_32.length;i++){ -if(i==_31){ -_32[i].checked=true; -} -} -},checkClear:function(_33){ -$A(document.getElementsByName(_33)).each(function(el){ -el.checked=false; -}); -},checkAll:function(_34){ -$A(document.getElementsByName(_34)).each(function(el){ -el.checked=true; -}); -},checkInvert:function(_35){ -$A(document.getElementsByName(_35)).each(function(el){ -el.checked=!el.checked; -}); -}}; -Object.extend(Prado.Element,{Insert:{After:function(_36,_37){ -new Insertion.After(_36,_37); -},Before:function(_38,_39){ -new Insertion.Before(_38.innerHTML); -},Below:function(_40,_41){ -new Insertion.Bottom(_40,_41); -},Above:function(_42,_43){ -new Insertion.Top(_42,_43); -}},CssClass:{set:function(_44,_45){ -_44=new Element.ClassNames(_44); -_44.set(_45); -}}}); var Field={clear:function(){ for(var i=0;i<arguments.length;i++){ @@ -677,6 +1143,21 @@ if(_9=="keypress"&&((navigator.appVersion.indexOf("AppleWebKit")>0)||_8.attachEv _9="keydown"; } this._observeAndCache(_8,_9,_10,_11); +},keyCode:function(e){ +return e.keyCode!=null?e.keyCode:e.charCode; +},fireEvent:function(el,_14){ +if(document.createEvent){ +var evt=document.createEvent("HTMLEvents"); +evt.initEvent(_14,true,true); +el.dispatchEvent(evt); +}else{ +if(el.fireEvent){ +el.fireEvent("on"+_14); +el[_14](); +}else{ +el[_14](); +} +} }}); var Position={includeScrollOffsets:false,prepare:function(){ @@ -1625,52 +2106,276 @@ var _31=new Date(_28,_29-1,_30,0,0,0); return _31; }}); -Prado.Util={}; -Prado.Util.pad=function(_1,X){ -X=(!X?2:X); -_1=""+_1; -while(_1.length<X){ -_1="0"+_1; +var Prado={Version:"3.0a"}; +
+Prado.Focus=Class.create(); +Prado.Focus.setFocus=function(id){ +var _2=document.getElementById?document.getElementById(id):document.all[id]; +if(_2&&!Prado.Focus.canFocusOn(_2)){ +_2=Prado.Focus.findTarget(_2); +} +if(_2){ +try{ +_2.focus(); +_2.scrollIntoView(false); +if(window.__smartNav){ +window.__smartNav.ae=_2.id; +} +} +catch(e){ +} } -return _1; }; -Prado.Util.toInteger=function(_3){ -var _4=/^\s*[-\+]?\d+\s*$/; -if(_3.match(_4)==null){ -return null; +Prado.Focus.canFocusOn=function(_3){ +if(!_3||!(_3.tagName)){ +return false; } -var _5=parseInt(_3,10); -return (isNaN(_5)?null:_5); +var _4=_3.tagName.toLowerCase(); +return !_3.disabled&&(!_3.type||_3.type.toLowerCase()!="hidden")&&Prado.Focus.isFocusableTag(_4)&&Prado.Focus.isVisible(_3); }; -Prado.Util.toDouble=function(_6,_7){ -_7=undef(_7)?".":_7; -var _8=new RegExp("^\\s*([-\\+])?(\\d+)?(\\"+_7+"(\\d+))?\\s*$"); -var m=_6.match(_8); -if(m==null){ +Prado.Focus.isFocusableTag=function(_5){ +return (_5=="input"||_5=="textarea"||_5=="select"||_5=="button"||_5=="a"); +}; +Prado.Focus.findTarget=function(_6){ +if(!_6||!(_6.tagName)){ return null; } -var _10=m[1]+(m[2].length>0?m[2]:"0")+"."+m[4]; -var num=parseFloat(_10); -return (isNaN(num)?null:num); -}; -Prado.Util.toCurrency=function(_12,_13,_14,_15){ -_13=undef(_13)?",":_13; -_15=undef(_15)?".":_15; -_14=undef(_14)?2:_14; -var exp=new RegExp("^\\s*([-\\+])?(((\\d+)\\"+_13+")*)(\\d+)"+((_14>0)?"(\\"+_15+"(\\d{1,"+_14+"}))?":"")+"\\s*$"); -var m=_12.match(exp); -if(m==null){ +var _7=_6.tagName.toLowerCase(); +if(_7=="undefined"){ return null; } -var _17=m[2]+m[5]; -var _18=m[1]+_17.replace(new RegExp("(\\"+_13+")","g"),"")+((_14>0)?"."+m[7]:""); -var num=parseFloat(_18); -return (isNaN(num)?null:num); +var _8=_6.childNodes; +if(_8){ +for(var i=0;i<_8.length;i++){ +try{ +if(Prado.Focus.canFocusOn(_8[i])){ +return _8[i]; +}else{ +var _10=Prado.Focus.findTarget(_8[i]); +if(_10){ +return _10; +} +} +} +catch(e){ +} +} +} +return null; }; -Prado.Util.trim=function(_19){ -if(!isString(_19)){ -return ""; +Prado.Focus.isVisible=function(_11){ +var _12=_11; +while((typeof (_12)!="undefined")&&(_12!=null)){ +if(_12.disabled||(typeof (_12.style)!="undefined"&&((typeof (_12.style.display)!="undefined"&&_12.style.display=="none")||(typeof (_12.style.visibility)!="undefined"&&_12.style.visibility=="hidden")))){ +return false; +} +if(typeof (_12.parentNode)!="undefined"&&_12.parentNode!=null&&_12.parentNode!=_12&&_12.parentNode.tagName.toLowerCase()!="body"){ +_12=_12.parentNode; +}else{ +return true; +} +} +return true; +}; +Prado.doPostBack=function(_13,_14,_15,_16,_17,_18,_19,_20){ +if(typeof (_16)=="undefined"){ +var _16=false; +var _17=""; +var _18=null; +var _19=false; +var _20=true; +} +var _21=document.getElementById?document.getElementById(_13):document.forms[_13]; +var _22=true; +if(_16){ +_22=Prado.Validation.IsValid(_21); +} +if(_22){ +if(_18!=null&&(_18.length>0)){ +_21.action=_18; +} +if(_19){ +var _23=_21.elements["PRADO_LASTFOCUS"]; +if((typeof (_23)!="undefined")&&(_23!=null)){ +var _24=document.activeElement; +if(typeof (_24)=="undefined"){ +_23.value=_14; +}else{ +if((_24!=null)&&(typeof (_24.id)!="undefined")){ +if(_24.id.length>0){ +_23.value=_24.id; +}else{ +if(typeof (_24.name)!="undefined"){ +_23.value=_24.name; +} +} +} +} +} +} +if(!_20){ +_22=false; +} +} +if(_22&&(!_21.onsubmit||_21.onsubmit())){ +_21.PRADO_POSTBACK_TARGET.value=_14; +_21.PRADO_POSTBACK_PARAMETER.value=_15; +_21.submit(); } -return _19.replace(/^\s+|\s+$/g,""); }; +Prado.Element={setValue:function(_1,_2){ +var el=$(_1); +if(el&&typeof (el.value)!="undefined"){ +el.value=_2; +} +},select:function(_4,_5,_6){ +var el=$(_4); +var _7=_4.indexOf("[]")>-1; +if(!el&&!_7){ +return; +} +_5=_7?"check"+_5:el.tagName.toLowerCase()+_5; +var _8=Prado.Element.Selection; +if(isFunction(_8[_5])){ +_8[_5](_7?_4:el,_6); +} +},click:function(_9){ +var el=$(_9); +if(!el){ +return; +} +if(document.createEvent){ +var evt=document.createEvent("HTMLEvents"); +evt.initEvent("click",true,true); +el.dispatchEvent(evt); +}else{ +if(el.fireEvent){ +el.fireEvent("onclick"); +if(isFunction(el.onclick)){ +el.onclick(); +} +} +} +},setAttribute:function(_11,_12,_13){ +var el=$(_11); +if(_12=="disabled"&&_13==false){ +el.removeAttribute(_12); +}else{ +el.setAttribute(_12,_13); +} +},setOptions:function(_14,_15){ +var el=$(_14); +if(el&&el.tagName.toLowerCase()=="select"){ +while(el.length>0){ +el.remove(0); +} +for(var i=0;i<_15.length;i++){ +el.options[el.options.length]=new Option(_15[i][0],_15[i][1]); +} +} +},focus:function(_17){ +var obj=$(_17); +if(isObject(obj)&&isdef(obj.focus)){ +setTimeout(function(){ +obj.focus(); +},100); +} +return false; +}}; +Prado.Element.Selection={inputValue:function(el,_19){ +switch(el.type.toLowerCase()){ +case "checkbox": +case "radio": +return el.checked=_19; +} +},selectValue:function(el,_20){ +$A(el.options).each(function(_21){ +_21.selected=_21.value==_20; +}); +},selectIndex:function(el,_22){ +if(el.type=="select-one"){ +el.selectedIndex=_22; +}else{ +for(var i=0;i<el.length;i++){ +if(i==_22){ +el.options[i].selected=true; +} +} +} +},selectClear:function(el){ +el.selectedIndex=-1; +},selectAll:function(el){ +$A(el.options).each(function(_23){ +_23.selected=true; +Logger.warn(_23.value); +}); +},selectInvert:function(el){ +$A(el.options).each(function(_24){ +_24.selected=!_24.selected; +}); +},checkValue:function(_25,_26){ +$A(document.getElementsByName(_25)).each(function(el){ +el.checked=el.value==_26; +}); +},checkIndex:function(_27,_28){ +var _29=$A(document.getElementsByName(_27)); +for(var i=0;i<_29.length;i++){ +if(i==_28){ +_29[i].checked=true; +} +} +},checkClear:function(_30){ +$A(document.getElementsByName(_30)).each(function(el){ +el.checked=false; +}); +},checkAll:function(_31){ +$A(document.getElementsByName(_31)).each(function(el){ +el.checked=true; +}); +},checkInvert:function(_32){ +$A(document.getElementsByName(_32)).each(function(el){ +el.checked=!el.checked; +}); +}}; +Object.extend(Prado.Element,{Insert:{After:function(_33,_34){ +new Insertion.After(_33,_34); +},Before:function(_35,_36){ +new Insertion.Before(_35.innerHTML); +},Below:function(_37,_38){ +new Insertion.Bottom(_37,_38); +},Above:function(_39,_40){ +new Insertion.Top(_39,_40); +}},CssClass:{set:function(_41,_42){ +_41=new Element.ClassNames(_41); +_41.set(_42); +}}}); +
+Prado.Button=Class.create(); +Object.extend(Prado.Button,{buttonFired:false,fireButton:function(e,_2){ +var _3=!this.buttonFired&&Event.keyCode(e)==Event.KEY_RETURN; +var _4=Event.element(e).targName.toLowerCase()=="textarea"; +if(_3&&!_4){ +var _5=$(_2); +if(_5){ +Prado.Button.buttonFired=true; +Event.fireEvent(_5,"click"); +Event.stop(e); +return false; +} +} +return true; +}}); +Prado.TextBox=Class.create(); +Object.extend(Prado.TextBox,{handleReturnKey:function(e){ +if(Event.keyCode(e)==Event.KEY_RETURN){ +var _6=Event.element(e); +if(_6){ +Event.fireEvent(_6,"change"); +Event.stop(e); +return false; +} +} +return true; +}}); +
diff --git a/framework/Web/Javascripts/js/rico.js b/framework/Web/Javascripts/js/rico.js new file mode 100644 index 00000000..7cc64193 --- /dev/null +++ b/framework/Web/Javascripts/js/rico.js @@ -0,0 +1,1900 @@ +var Rico={Version:"1.1rc1",prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])}; +Rico.ArrayExtensions=new Array(); +if(Object.prototype.extend){ +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend; +}else{ +Object.prototype.extend=function(_1){ +return Object.extend.apply(this,[this,_1]); +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend; +} +if(Array.prototype.push){ +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push; +} +if(!Array.prototype.remove){ +Array.prototype.remove=function(dx){ +if(isNaN(dx)||dx>this.length){ +return false; +} +for(var i=0,n=0;i<this.length;i++){ +if(i!=dx){ +this[n++]=this[i]; +} +} +this.length-=1; +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove; +} +if(!Array.prototype.removeItem){ +Array.prototype.removeItem=function(_4){ +for(var i=0;i<this.length;i++){ +if(this[i]==_4){ +this.remove(i); +break; +} +} +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem; +} +if(!Array.prototype.indices){ +Array.prototype.indices=function(){ +var _5=new Array(); +for(index in this){ +var _6=false; +for(var i=0;i<Rico.ArrayExtensions.length;i++){ +if(this[index]==Rico.ArrayExtensions[i]){ +_6=true; +break; +} +} +if(!_6){ +_5[_5.length]=index; +} +} +return _5; +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices; +} +if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){ +if(!Document.prototype.loadXML){ +Document.prototype.loadXML=function(s){ +var _8=(new DOMParser()).parseFromString(s,"text/xml"); +while(this.hasChildNodes()){ +this.removeChild(this.lastChild); +} +for(var i=0;i<_8.childNodes.length;i++){ +this.appendChild(this.importNode(_8.childNodes[i],true)); +} +}; +} +Document.prototype.__defineGetter__("xml",function(){ +return (new XMLSerializer()).serializeToString(this); +}); +} +document.getElementsByTagAndClassName=function(_9,_10){ +if(_9==null){ +_9="*"; +} +var _11=document.getElementsByTagName(_9)||document.all; +var _12=new Array(); +if(_10==null){ +return _11; +} +for(var i=0;i<_11.length;i++){ +var _13=_11[i]; +var _14=_13.className.split(" "); +for(var j=0;j<_14.length;j++){ +if(_14[j]==_10){ +_12.push(_13); +break; +} +} +} +return _12; +}; +Rico.Accordion=Class.create(); +Rico.Accordion.prototype={initialize:function(_16,_17){ +this.container=$(_16); +this.lastExpandedTab=null; +this.accordionTabs=new Array(); +this.setOptions(_17); +this._attachBehaviors(); +if(!_16){ +return; +} +this.container.style.borderBottom="1px solid "+this.options.borderColor; +if(this.options.onLoadShowTab>=this.accordionTabs.length){ +this.options.onLoadShowTab=0; +} +for(var i=0;i<this.accordionTabs.length;i++){ +if(i!=this.options.onLoadShowTab){ +this.accordionTabs[i].collapse(); +this.accordionTabs[i].content.style.display="none"; +} +} +this.lastExpandedTab=this.accordionTabs[this.options.onLoadShowTab]; +if(this.options.panelHeight=="auto"){ +var _18=(this.options.onloadShowTab===0)?1:0; +var _19=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[_18].titleBar,"height")); +if(isNaN(_19)){ +_19=this.accordionTabs[_18].titleBar.offsetHeight; +} +var _20=this.accordionTabs.length*_19; +var _21=parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode,"height")); +if(isNaN(_21)){ +_21=this.container.parentNode.offsetHeight; +} +this.options.panelHeight=_21-_20-2; +} +this.lastExpandedTab.content.style.height=this.options.panelHeight+"px"; +this.lastExpandedTab.showExpanded(); +this.lastExpandedTab.titleBar.style.fontWeight=this.options.expandedFontWeight; +},setOptions:function(_22){ +this.options={expandedBg:"#63699c",hoverBg:"#63699c",collapsedBg:"#6b79a5",expandedTextColor:"#ffffff",expandedFontWeight:"bold",hoverTextColor:"#ffffff",collapsedTextColor:"#ced7ef",collapsedFontWeight:"normal",hoverTextColor:"#ffffff",borderColor:"#1f669b",panelHeight:200,onHideTab:null,onShowTab:null,onLoadShowTab:0}; +Object.extend(this.options,_22||{}); +},showTabByIndex:function(_23,_24){ +var _25=arguments.length==1?true:_24; +this.showTab(this.accordionTabs[_23],_25); +},showTab:function(_26,_27){ +var _28=arguments.length==1?true:_27; +if(this.options.onHideTab){ +this.options.onHideTab(this.lastExpandedTab); +} +this.lastExpandedTab.showCollapsed(); +var _29=this; +var _30=this.lastExpandedTab; +this.lastExpandedTab.content.style.height=(this.options.panelHeight-1)+"px"; +_26.content.style.display=""; +_26.titleBar.style.fontWeight=this.options.expandedFontWeight; +if(_28){ +new Effect.AccordionSize(this.lastExpandedTab.content,_26.content,1,this.options.panelHeight,100,10,{complete:function(){ +_29.showTabDone(_30); +}}); +this.lastExpandedTab=_26; +}else{ +this.lastExpandedTab.content.style.height="1px"; +_26.content.style.height=this.options.panelHeight+"px"; +this.lastExpandedTab=_26; +this.showTabDone(_30); +} +},showTabDone:function(_31){ +_31.content.style.display="none"; +this.lastExpandedTab.showExpanded(); +if(this.options.onShowTab){ +this.options.onShowTab(this.lastExpandedTab); +} +},_attachBehaviors:function(){ +var _32=this._getDirectChildrenByTag(this.container,"DIV"); +for(var i=0;i<_32.length;i++){ +var _33=this._getDirectChildrenByTag(_32[i],"DIV"); +if(_33.length!=2){ +continue; +} +var _34=_33[0]; +var _35=_33[1]; +this.accordionTabs.push(new Rico.Accordion.Tab(this,_34,_35)); +} +},_getDirectChildrenByTag:function(e,_37){ +var _38=new Array(); +var _39=e.childNodes; +for(var i=0;i<_39.length;i++){ +if(_39[i]&&_39[i].tagName&&_39[i].tagName==_37){ +_38.push(_39[i]); +} +} +return _38; +}}; +Rico.Accordion.Tab=Class.create(); +Rico.Accordion.Tab.prototype={initialize:function(_40,_41,_42){ +this.accordion=_40; +this.titleBar=_41; +this.content=_42; +this._attachBehaviors(); +},collapse:function(){ +this.showCollapsed(); +this.content.style.height="1px"; +},showCollapsed:function(){ +this.expanded=false; +this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg; +this.titleBar.style.color=this.accordion.options.collapsedTextColor; +this.titleBar.style.fontWeight=this.accordion.options.collapsedFontWeight; +this.content.style.overflow="hidden"; +},showExpanded:function(){ +this.expanded=true; +this.titleBar.style.backgroundColor=this.accordion.options.expandedBg; +this.titleBar.style.color=this.accordion.options.expandedTextColor; +this.content.style.overflow="visible"; +},titleBarClicked:function(e){ +if(this.accordion.lastExpandedTab==this){ +return; +} +this.accordion.showTab(this); +},hover:function(e){ +this.titleBar.style.backgroundColor=this.accordion.options.hoverBg; +this.titleBar.style.color=this.accordion.options.hoverTextColor; +},unhover:function(e){ +if(this.expanded){ +this.titleBar.style.backgroundColor=this.accordion.options.expandedBg; +this.titleBar.style.color=this.accordion.options.expandedTextColor; +}else{ +this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg; +this.titleBar.style.color=this.accordion.options.collapsedTextColor; +} +},_attachBehaviors:function(){ +this.content.style.border="1px solid "+this.accordion.options.borderColor; +this.content.style.borderTopWidth="0px"; +this.content.style.borderBottomWidth="0px"; +this.content.style.margin="0px"; +this.titleBar.onclick=this.titleBarClicked.bindAsEventListener(this); +this.titleBar.onmouseover=this.hover.bindAsEventListener(this); +this.titleBar.onmouseout=this.unhover.bindAsEventListener(this); +}}; +Rico.Color=Class.create(); +Rico.Color.prototype={initialize:function(red,_44,_45){ +this.rgb={r:red,g:_44,b:_45}; +},setRed:function(r){ +this.rgb.r=r; +},setGreen:function(g){ +this.rgb.g=g; +},setBlue:function(b){ +this.rgb.b=b; +},setHue:function(h){ +var hsb=this.asHSB(); +hsb.h=h; +this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b); +},setSaturation:function(s){ +var hsb=this.asHSB(); +hsb.s=s; +this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b); +},setBrightness:function(b){ +var hsb=this.asHSB(); +hsb.b=b; +this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b); +},darken:function(_51){ +var hsb=this.asHSB(); +this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.max(hsb.b-_51,0)); +},brighten:function(_52){ +var hsb=this.asHSB(); +this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.min(hsb.b+_52,1)); +},blend:function(_53){ +this.rgb.r=Math.floor((this.rgb.r+_53.rgb.r)/2); +this.rgb.g=Math.floor((this.rgb.g+_53.rgb.g)/2); +this.rgb.b=Math.floor((this.rgb.b+_53.rgb.b)/2); +},isBright:function(){ +var hsb=this.asHSB(); +return this.asHSB().b>0.5; +},isDark:function(){ +return !this.isBright(); +},asRGB:function(){ +return "rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"; +},asHex:function(){ +return "#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart(); +},asHSB:function(){ +return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b); +},toString:function(){ +return this.asHex(); +}}; +Rico.Color.createFromHex=function(_54){ +if(_54.indexOf("#")==0){ +_54=_54.substring(1); +} +var red=_54.substring(0,2); +var _55=_54.substring(2,4); +var _56=_54.substring(4,6); +return new Rico.Color(parseInt(red,16),parseInt(_55,16),parseInt(_56,16)); +}; +Rico.Color.createColorFromBackground=function(_57){ +var _58=RicoUtil.getElementsComputedStyle($(_57),"backgroundColor","background-color"); +if(_58=="transparent"&&_57.parent){ +return Rico.Color.createColorFromBackground(_57.parent); +} +if(_58==null){ +return new Rico.Color(255,255,255); +} +if(_58.indexOf("rgb(")==0){ +var _59=_58.substring(4,_58.length-1); +var _60=_59.split(","); +return new Rico.Color(parseInt(_60[0]),parseInt(_60[1]),parseInt(_60[2])); +}else{ +if(_58.indexOf("#")==0){ +var _61=parseInt(_58.substring(1,3),16); +var _62=parseInt(_58.substring(3,5),16); +var _63=parseInt(_58.substring(5),16); +return new Rico.Color(_61,_62,_63); +}else{ +return new Rico.Color(255,255,255); +} +} +}; +Rico.Color.HSBtoRGB=function(hue,_65,_66){ +var red=0; +var _67=0; +var _68=0; +if(_65==0){ +red=parseInt(_66*255+0.5); +_67=red; +_68=red; +}else{ +var h=(hue-Math.floor(hue))*6; +var f=h-Math.floor(h); +var p=_66*(1-_65); +var q=_66*(1-_65*f); +var t=_66*(1-(_65*(1-f))); +switch(parseInt(h)){ +case 0: +red=(_66*255+0.5); +_67=(t*255+0.5); +_68=(p*255+0.5); +break; +case 1: +red=(q*255+0.5); +_67=(_66*255+0.5); +_68=(p*255+0.5); +break; +case 2: +red=(p*255+0.5); +_67=(_66*255+0.5); +_68=(t*255+0.5); +break; +case 3: +red=(p*255+0.5); +_67=(q*255+0.5); +_68=(_66*255+0.5); +break; +case 4: +red=(t*255+0.5); +_67=(p*255+0.5); +_68=(_66*255+0.5); +break; +case 5: +red=(_66*255+0.5); +_67=(p*255+0.5); +_68=(q*255+0.5); +break; +} +} +return {r:parseInt(red),g:parseInt(_67),b:parseInt(_68)}; +}; +Rico.Color.RGBtoHSB=function(r,g,b){ +var hue; +var _73; +var _74; +var _75=(r>g)?r:g; +if(b>_75){ +_75=b; +} +var _76=(r<g)?r:g; +if(b<_76){ +_76=b; +} +_74=_75/255; +if(_75!=0){ +saturation=(_75-_76)/_75; +}else{ +saturation=0; +} +if(saturation==0){ +hue=0; +}else{ +var _77=(_75-r)/(_75-_76); +var _78=(_75-g)/(_75-_76); +var _79=(_75-b)/(_75-_76); +if(r==_75){ +hue=_79-_78; +}else{ +if(g==_75){ +hue=2+_77-_79; +}else{ +hue=4+_78-_77; +} +} +hue=hue/6; +if(hue<0){ +hue=hue+1; +} +} +return {h:hue,s:saturation,b:_74}; +}; +Rico.Corner={round:function(e,_80){ +var e=$(e); +this._setOptions(_80); +var _81=this.options.color; +if(this.options.color=="fromElement"){ +_81=this._background(e); +} +var _82=this.options.bgColor; +if(this.options.bgColor=="fromParent"){ +_82=this._background(e.offsetParent); +} +this._roundCornersImpl(e,_81,_82); +},_roundCornersImpl:function(e,_83,_84){ +if(this.options.border){ +this._renderBorder(e,_84); +} +if(this._isTopRounded()){ +this._roundTopCorners(e,_83,_84); +} +if(this._isBottomRounded()){ +this._roundBottomCorners(e,_83,_84); +} +},_renderBorder:function(el,_86){ +var _87="1px solid "+this._borderColor(_86); +var _88="border-left: "+_87; +var _89="border-right: "+_87; +var _90="style='"+_88+";"+_89+"'"; +el.innerHTML="<div "+_90+">"+el.innerHTML+"</div>"; +},_roundTopCorners:function(el,_91,_92){ +var _93=this._createCorner(_92); +for(var i=0;i<this.options.numSlices;i++){ +_93.appendChild(this._createCornerSlice(_91,_92,i,"top")); +} +el.style.paddingTop=0; +el.insertBefore(_93,el.firstChild); +},_roundBottomCorners:function(el,_94,_95){ +var _96=this._createCorner(_95); +for(var i=(this.options.numSlices-1);i>=0;i--){ +_96.appendChild(this._createCornerSlice(_94,_95,i,"bottom")); +} +el.style.paddingBottom=0; +el.appendChild(_96); +},_createCorner:function(_97){ +var _98=document.createElement("div"); +_98.style.backgroundColor=(this._isTransparent()?"transparent":_97); +return _98; +},_createCornerSlice:function(_99,_100,n,_102){ +var _103=document.createElement("span"); +var _104=_103.style; +_104.backgroundColor=_99; +_104.display="block"; +_104.height="1px"; +_104.overflow="hidden"; +_104.fontSize="1px"; +var _105=this._borderColor(_99,_100); +if(this.options.border&&n==0){ +_104.borderTopStyle="solid"; +_104.borderTopWidth="1px"; +_104.borderLeftWidth="0px"; +_104.borderRightWidth="0px"; +_104.borderBottomWidth="0px"; +_104.height="0px"; +_104.borderColor=_105; +}else{ +if(_105){ +_104.borderColor=_105; +_104.borderStyle="solid"; +_104.borderWidth="0px 1px"; +} +} +if(!this.options.compact&&(n==(this.options.numSlices-1))){ +_104.height="2px"; +} +this._setMargin(_103,n,_102); +this._setBorder(_103,n,_102); +return _103; +},_setOptions:function(_106){ +this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false}; +Object.extend(this.options,_106||{}); +this.options.numSlices=this.options.compact?2:4; +if(this._isTransparent()){ +this.options.blend=false; +} +},_whichSideTop:function(){ +if(this._hasString(this.options.corners,"all","top")){ +return ""; +} +if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){ +return ""; +} +if(this.options.corners.indexOf("tl")>=0){ +return "left"; +}else{ +if(this.options.corners.indexOf("tr")>=0){ +return "right"; +} +} +return ""; +},_whichSideBottom:function(){ +if(this._hasString(this.options.corners,"all","bottom")){ +return ""; +} +if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){ +return ""; +} +if(this.options.corners.indexOf("bl")>=0){ +return "left"; +}else{ +if(this.options.corners.indexOf("br")>=0){ +return "right"; +} +} +return ""; +},_borderColor:function(_107,_108){ +if(_107=="transparent"){ +return _108; +}else{ +if(this.options.border){ +return this.options.border; +}else{ +if(this.options.blend){ +return this._blend(_108,_107); +}else{ +return ""; +} +} +} +},_setMargin:function(el,n,_109){ +var _110=this._marginSize(n); +var _111=_109=="top"?this._whichSideTop():this._whichSideBottom(); +if(_111=="left"){ +el.style.marginLeft=_110+"px"; +el.style.marginRight="0px"; +}else{ +if(_111=="right"){ +el.style.marginRight=_110+"px"; +el.style.marginLeft="0px"; +}else{ +el.style.marginLeft=_110+"px"; +el.style.marginRight=_110+"px"; +} +} +},_setBorder:function(el,n,_112){ +var _113=this._borderSize(n); +var _114=_112=="top"?this._whichSideTop():this._whichSideBottom(); +if(_114=="left"){ +el.style.borderLeftWidth=_113+"px"; +el.style.borderRightWidth="0px"; +}else{ +if(_114=="right"){ +el.style.borderRightWidth=_113+"px"; +el.style.borderLeftWidth="0px"; +}else{ +el.style.borderLeftWidth=_113+"px"; +el.style.borderRightWidth=_113+"px"; +} +} +if(this.options.border!=false){ +el.style.borderLeftWidth=_113+"px"; +} +el.style.borderRightWidth=_113+"px"; +},_marginSize:function(n){ +if(this._isTransparent()){ +return 0; +} +var _115=[5,3,2,1]; +var _116=[3,2,1,0]; +var _117=[2,1]; +var _118=[1,0]; +if(this.options.compact&&this.options.blend){ +return _118[n]; +}else{ +if(this.options.compact){ +return _117[n]; +}else{ +if(this.options.blend){ +return _116[n]; +}else{ +return _115[n]; +} +} +} +},_borderSize:function(n){ +var _119=[5,3,2,1]; +var _120=[2,1,1,1]; +var _121=[1,0]; +var _122=[0,2,0,0]; +if(this.options.compact&&(this.options.blend||this._isTransparent())){ +return 1; +}else{ +if(this.options.compact){ +return _121[n]; +}else{ +if(this.options.blend){ +return _120[n]; +}else{ +if(this.options.border){ +return _122[n]; +}else{ +if(this._isTransparent()){ +return _119[n]; +} +} +} +} +} +return 0; +},_hasString:function(str){ +for(var i=1;i<arguments.length;i++){ +if(str.indexOf(arguments[i])>=0){ +return true; +} +} +return false; +},_blend:function(c1,c2){ +var cc1=Rico.Color.createFromHex(c1); +cc1.blend(Rico.Color.createFromHex(c2)); +return cc1; +},_background:function(el){ +try{ +return Rico.Color.createColorFromBackground(el).asHex(); +} +catch(err){ +return "#ffffff"; +} +},_isTransparent:function(){ +return this.options.color=="transparent"; +},_isTopRounded:function(){ +return this._hasString(this.options.corners,"all","top","tl","tr"); +},_isBottomRounded:function(){ +return this._hasString(this.options.corners,"all","bottom","bl","br"); +},_hasSingleTextChild:function(el){ +return el.childNodes.length==1&&el.childNodes[0].nodeType==3; +}}; +if(window.Effect==undefined){ +Effect={}; +} +Effect.SizeAndPosition=Class.create(); +Effect.SizeAndPosition.prototype={initialize:function(_127,x,y,w,h,_131,_132,_133){ +this.element=$(_127); +this.x=x; +this.y=y; +this.w=w; +this.h=h; +this.duration=_131; +this.steps=_132; +this.options=arguments[7]||{}; +this.sizeAndPosition(); +},sizeAndPosition:function(){ +if(this.isFinished()){ +if(this.options.complete){ +this.options.complete(this); +} +return; +} +if(this.timer){ +clearTimeout(this.timer); +} +var _134=Math.round(this.duration/this.steps); +var _135=this.element.offsetLeft; +var _136=this.element.offsetTop; +var _137=this.element.offsetWidth; +var _138=this.element.offsetHeight; +this.x=(this.x)?this.x:_135; +this.y=(this.y)?this.y:_136; +this.w=(this.w)?this.w:_137; +this.h=(this.h)?this.h:_138; +var difX=this.steps>0?(this.x-_135)/this.steps:0; +var difY=this.steps>0?(this.y-_136)/this.steps:0; +var difW=this.steps>0?(this.w-_137)/this.steps:0; +var difH=this.steps>0?(this.h-_138)/this.steps:0; +this.moveBy(difX,difY); +this.resizeBy(difW,difH); +this.duration-=_134; +this.steps--; +this.timer=setTimeout(this.sizeAndPosition.bind(this),_134); +},isFinished:function(){ +return this.steps<=0; +},moveBy:function(difX,difY){ +var _143=this.element.offsetLeft; +var _144=this.element.offsetTop; +var _145=parseInt(difX); +var _146=parseInt(difY); +var _147=this.element.style; +if(_145!=0){ +_147.left=(_143+_145)+"px"; +} +if(_146!=0){ +_147.top=(_144+_146)+"px"; +} +},resizeBy:function(difW,difH){ +var _148=this.element.offsetWidth; +var _149=this.element.offsetHeight; +var _150=parseInt(difW); +var _151=parseInt(difH); +var _152=this.element.style; +if(_150!=0){ +_152.width=(_148+_150)+"px"; +} +if(_151!=0){ +_152.height=(_149+_151)+"px"; +} +}}; +Effect.Size=Class.create(); +Effect.Size.prototype={initialize:function(_153,w,h,_154,_155,_156){ +new Effect.SizeAndPosition(_153,null,null,w,h,_154,_155,_156); +}}; +Effect.Position=Class.create(); +Effect.Position.prototype={initialize:function(_157,x,y,_158,_159,_160){ +new Effect.SizeAndPosition(_157,x,y,null,null,_158,_159,_160); +}}; +Effect.Round=Class.create(); +Effect.Round.prototype={initialize:function(_161,_162,_163){ +var _164=document.getElementsByTagAndClassName(_161,_162); +for(var i=0;i<_164.length;i++){ +Rico.Corner.round(_164[i],_163); +} +}}; +Effect.FadeTo=Class.create(); +Effect.FadeTo.prototype={initialize:function(_165,_166,_167,_168,_169){ +this.element=$(_165); +this.opacity=_166; +this.duration=_167; +this.steps=_168; +this.options=arguments[4]||{}; +this.fadeTo(); +},fadeTo:function(){ +if(this.isFinished()){ +if(this.options.complete){ +this.options.complete(this); +} +return; +} +if(this.timer){ +clearTimeout(this.timer); +} +var _170=Math.round(this.duration/this.steps); +var _171=this.getElementOpacity(); +var _172=this.steps>0?(this.opacity-_171)/this.steps:0; +this.changeOpacityBy(_172); +this.duration-=_170; +this.steps--; +this.timer=setTimeout(this.fadeTo.bind(this),_170); +},changeOpacityBy:function(v){ +var _174=this.getElementOpacity(); +var _175=Math.max(0,Math.min(_174+v,1)); +this.element.ricoOpacity=_175; +this.element.style.filter="alpha(opacity:"+Math.round(_175*100)+")"; +this.element.style.opacity=_175; +},isFinished:function(){ +return this.steps<=0; +},getElementOpacity:function(){ +if(this.element.ricoOpacity==undefined){ +var _176=RicoUtil.getElementsComputedStyle(this.element,"opacity"); +this.element.ricoOpacity=_176!=undefined?_176:1; +} +return parseFloat(this.element.ricoOpacity); +}}; +Effect.AccordionSize=Class.create(); +Effect.AccordionSize.prototype={initialize:function(e1,e2,_179,end,_181,_182,_183){ +this.e1=$(e1); +this.e2=$(e2); +this.start=_179; +this.end=end; +this.duration=_181; +this.steps=_182; +this.options=arguments[6]||{}; +this.accordionSize(); +},accordionSize:function(){ +if(this.isFinished()){ +this.e1.style.height=this.start+"px"; +this.e2.style.height=this.end+"px"; +if(this.options.complete){ +this.options.complete(this); +} +return; +} +if(this.timer){ +clearTimeout(this.timer); +} +var _184=Math.round(this.duration/this.steps); +var diff=this.steps>0?(parseInt(this.e1.offsetHeight)-this.start)/this.steps:0; +this.resizeBy(diff); +this.duration-=_184; +this.steps--; +this.timer=setTimeout(this.accordionSize.bind(this),_184); +},isFinished:function(){ +return this.steps<=0; +},resizeBy:function(diff){ +var _186=this.e1.offsetHeight; +var _187=this.e2.offsetHeight; +var _188=parseInt(diff); +if(diff!=0){ +this.e1.style.height=(_186-_188)+"px"; +this.e2.style.height=(_187+_188)+"px"; +} +}}; +if(window.Effect==undefined){ +Effect={}; +} +Effect.SizeAndPosition=Class.create(); +Effect.SizeAndPosition.prototype={initialize:function(_189,x,y,w,h,_190,_191,_192){ +this.element=$(_189); +this.x=x; +this.y=y; +this.w=w; +this.h=h; +this.duration=_190; +this.steps=_191; +this.options=arguments[7]||{}; +this.sizeAndPosition(); +},sizeAndPosition:function(){ +if(this.isFinished()){ +if(this.options.complete){ +this.options.complete(this); +} +return; +} +if(this.timer){ +clearTimeout(this.timer); +} +var _193=Math.round(this.duration/this.steps); +var _194=this.element.offsetLeft; +var _195=this.element.offsetTop; +var _196=this.element.offsetWidth; +var _197=this.element.offsetHeight; +this.x=(this.x)?this.x:_194; +this.y=(this.y)?this.y:_195; +this.w=(this.w)?this.w:_196; +this.h=(this.h)?this.h:_197; +var difX=this.steps>0?(this.x-_194)/this.steps:0; +var difY=this.steps>0?(this.y-_195)/this.steps:0; +var difW=this.steps>0?(this.w-_196)/this.steps:0; +var difH=this.steps>0?(this.h-_197)/this.steps:0; +this.moveBy(difX,difY); +this.resizeBy(difW,difH); +this.duration-=_193; +this.steps--; +this.timer=setTimeout(this.sizeAndPosition.bind(this),_193); +},isFinished:function(){ +return this.steps<=0; +},moveBy:function(difX,difY){ +var _198=this.element.offsetLeft; +var _199=this.element.offsetTop; +var _200=parseInt(difX); +var _201=parseInt(difY); +var _202=this.element.style; +if(_200!=0){ +_202.left=(_198+_200)+"px"; +} +if(_201!=0){ +_202.top=(_199+_201)+"px"; +} +},resizeBy:function(difW,difH){ +var _203=this.element.offsetWidth; +var _204=this.element.offsetHeight; +var _205=parseInt(difW); +var _206=parseInt(difH); +var _207=this.element.style; +if(_205!=0){ +_207.width=(_203+_205)+"px"; +} +if(_206!=0){ +_207.height=(_204+_206)+"px"; +} +}}; +Effect.Size=Class.create(); +Effect.Size.prototype={initialize:function(_208,w,h,_209,_210,_211){ +new Effect.SizeAndPosition(_208,null,null,w,h,_209,_210,_211); +}}; +Effect.Position=Class.create(); +Effect.Position.prototype={initialize:function(_212,x,y,_213,_214,_215){ +new Effect.SizeAndPosition(_212,x,y,null,null,_213,_214,_215); +}}; +Effect.Round=Class.create(); +Effect.Round.prototype={initialize:function(_216,_217,_218){ +var _219=document.getElementsByTagAndClassName(_216,_217); +for(var i=0;i<_219.length;i++){ +Rico.Corner.round(_219[i],_218); +} +}}; +Effect.FadeTo=Class.create(); +Effect.FadeTo.prototype={initialize:function(_220,_221,_222,_223,_224){ +this.element=$(_220); +this.opacity=_221; +this.duration=_222; +this.steps=_223; +this.options=arguments[4]||{}; +this.fadeTo(); +},fadeTo:function(){ +if(this.isFinished()){ +if(this.options.complete){ +this.options.complete(this); +} +return; +} +if(this.timer){ +clearTimeout(this.timer); +} +var _225=Math.round(this.duration/this.steps); +var _226=this.getElementOpacity(); +var _227=this.steps>0?(this.opacity-_226)/this.steps:0; +this.changeOpacityBy(_227); +this.duration-=_225; +this.steps--; +this.timer=setTimeout(this.fadeTo.bind(this),_225); +},changeOpacityBy:function(v){ +var _228=this.getElementOpacity(); +var _229=Math.max(0,Math.min(_228+v,1)); +this.element.ricoOpacity=_229; +this.element.style.filter="alpha(opacity:"+Math.round(_229*100)+")"; +this.element.style.opacity=_229; +},isFinished:function(){ +return this.steps<=0; +},getElementOpacity:function(){ +if(this.element.ricoOpacity==undefined){ +var _230=RicoUtil.getElementsComputedStyle(this.element,"opacity"); +this.element.ricoOpacity=_230!=undefined?_230:1; +} +return parseFloat(this.element.ricoOpacity); +}}; +Effect.AccordionSize=Class.create(); +Effect.AccordionSize.prototype={initialize:function(e1,e2,_231,end,_232,_233,_234){ +this.e1=$(e1); +this.e2=$(e2); +this.start=_231; +this.end=end; +this.duration=_232; +this.steps=_233; +this.options=arguments[6]||{}; +this.accordionSize(); +},accordionSize:function(){ +if(this.isFinished()){ +this.e1.style.height=this.start+"px"; +this.e2.style.height=this.end+"px"; +if(this.options.complete){ +this.options.complete(this); +} +return; +} +if(this.timer){ +clearTimeout(this.timer); +} +var _235=Math.round(this.duration/this.steps); +var diff=this.steps>0?(parseInt(this.e1.offsetHeight)-this.start)/this.steps:0; +this.resizeBy(diff); +this.duration-=_235; +this.steps--; +this.timer=setTimeout(this.accordionSize.bind(this),_235); +},isFinished:function(){ +return this.steps<=0; +},resizeBy:function(diff){ +var _236=this.e1.offsetHeight; +var _237=this.e2.offsetHeight; +var _238=parseInt(diff); +if(diff!=0){ +this.e1.style.height=(_236-_238)+"px"; +this.e2.style.height=(_237+_238)+"px"; +} +}}; +Rico.LiveGridMetaData=Class.create(); +Rico.LiveGridMetaData.prototype={initialize:function(_239,_240,_241,_242){ +this.pageSize=_239; +this.totalRows=_240; +this.setOptions(_242); +this.ArrowHeight=16; +this.columnCount=_241; +},setOptions:function(_243){ +this.options={largeBufferSize:7,nearLimitFactor:0.2}; +Object.extend(this.options,_243||{}); +},getPageSize:function(){ +return this.pageSize; +},getTotalRows:function(){ +return this.totalRows; +},setTotalRows:function(n){ +this.totalRows=n; +},getLargeBufferSize:function(){ +return parseInt(this.options.largeBufferSize*this.pageSize); +},getLimitTolerance:function(){ +return parseInt(this.getLargeBufferSize()*this.options.nearLimitFactor); +}}; +Rico.LiveGridScroller=Class.create(); +Rico.LiveGridScroller.prototype={initialize:function(_244,_245){ +this.isIE=navigator.userAgent.toLowerCase().indexOf("msie")>=0; +this.liveGrid=_244; +this.metaData=_244.metaData; +this.createScrollBar(); +this.scrollTimeout=null; +this.lastScrollPos=0; +this.viewPort=_245; +this.rows=new Array(); +},isUnPlugged:function(){ +return this.scrollerDiv.onscroll==null; +},plugin:function(){ +this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this); +},unplug:function(){ +this.scrollerDiv.onscroll=null; +},sizeIEHeaderHack:function(){ +if(!this.isIE){ +return; +} +var _246=$(this.liveGrid.tableId+"_header"); +if(_246){ +_246.rows[0].cells[0].style.width=(_246.rows[0].cells[0].offsetWidth+1)+"px"; +} +},createScrollBar:function(){ +var _247=this.liveGrid.viewPort.visibleHeight(); +this.scrollerDiv=document.createElement("div"); +var _248=this.scrollerDiv.style; +_248.borderRight=this.liveGrid.options.scrollerBorderRight; +_248.position="relative"; +_248.left=this.isIE?"-6px":"-3px"; +_248.width="19px"; +_248.height=_247+"px"; +_248.overflow="auto"; +this.heightDiv=document.createElement("div"); +this.heightDiv.style.width="1px"; +this.heightDiv.style.height=parseInt(_247*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px"; +this.scrollerDiv.appendChild(this.heightDiv); +this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this); +var _249=this.liveGrid.table; +_249.parentNode.parentNode.insertBefore(this.scrollerDiv,_249.parentNode.nextSibling); +var _250=this.isIE?"mousewheel":"DOMMouseScroll"; +Event.observe(_249,_250,function(evt){ +if(evt.wheelDelta>=0||evt.detail<0){ +this.scrollerDiv.scrollTop-=(2*this.viewPort.rowHeight); +}else{ +this.scrollerDiv.scrollTop+=(2*this.viewPort.rowHeight); +} +this.handleScroll(false); +}.bindAsEventListener(this),false); +},updateSize:function(){ +var _252=this.liveGrid.table; +var _253=this.viewPort.visibleHeight(); +this.heightDiv.style.height=parseInt(_253*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px"; +},rowToPixel:function(_254){ +return (_254/this.metaData.getTotalRows())*this.heightDiv.offsetHeight; +},moveScroll:function(_255){ +this.scrollerDiv.scrollTop=this.rowToPixel(_255); +if(this.metaData.options.onscroll){ +this.metaData.options.onscroll(this.liveGrid,_255); +} +},handleScroll:function(){ +if(this.scrollTimeout){ +clearTimeout(this.scrollTimeout); +} +var _256=this.lastScrollPos-this.scrollerDiv.scrollTop; +if(_256!=0){ +var r=this.scrollerDiv.scrollTop%this.viewPort.rowHeight; +if(r!=0){ +this.unplug(); +if(_256<0){ +this.scrollerDiv.scrollTop+=(this.viewPort.rowHeight-r); +}else{ +this.scrollerDiv.scrollTop-=r; +} +this.plugin(); +} +} +var _257=parseInt(this.scrollerDiv.scrollTop/this.viewPort.rowHeight); +this.liveGrid.requestContentRefresh(_257); +this.viewPort.scrollTo(this.scrollerDiv.scrollTop); +if(this.metaData.options.onscroll){ +this.metaData.options.onscroll(this.liveGrid,_257); +} +this.scrollTimeout=setTimeout(this.scrollIdle.bind(this),1200); +this.lastScrollPos=this.scrollerDiv.scrollTop; +},scrollIdle:function(){ +if(this.metaData.options.onscrollidle){ +this.metaData.options.onscrollidle(); +} +}}; +Rico.LiveGridBuffer=Class.create(); +Rico.LiveGridBuffer.prototype={initialize:function(_258,_259){ +this.startPos=0; +this.size=0; +this.metaData=_258; +this.rows=new Array(); +this.updateInProgress=false; +this.viewPort=_259; +this.maxBufferSize=_258.getLargeBufferSize()*2; +this.maxFetchSize=_258.getLargeBufferSize(); +this.lastOffset=0; +},getBlankRow:function(){ +if(!this.blankRow){ +this.blankRow=new Array(); +for(var i=0;i<this.metaData.columnCount;i++){ +this.blankRow[i]=" "; +} +} +return this.blankRow; +},loadRows:function(_260){ +var _261=_260.getElementsByTagName("rows")[0]; +this.updateUI=_261.getAttribute("update_ui")=="true"; +var _262=new Array(); +var trs=_261.getElementsByTagName("tr"); +for(var i=0;i<trs.length;i++){ +var row=_262[i]=new Array(); +var _265=trs[i].getElementsByTagName("td"); +for(var j=0;j<_265.length;j++){ +var cell=_265[j]; +var _267=cell.getAttribute("convert_spaces")=="true"; +var _268=RicoUtil.getContentAsString(cell); +row[j]=_267?this.convertSpaces(_268):_268; +if(!row[j]){ +row[j]=" "; +} +} +} +return _262; +},update:function(_269,_270){ +var _271=this.loadRows(_269); +if(this.rows.length==0){ +this.rows=_271; +this.size=this.rows.length; +this.startPos=_270; +return; +} +if(_270>this.startPos){ +if(this.startPos+this.rows.length<_270){ +this.rows=_271; +this.startPos=_270; +}else{ +this.rows=this.rows.concat(_271.slice(0,_271.length)); +if(this.rows.length>this.maxBufferSize){ +var _272=this.rows.length; +this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length); +this.startPos=this.startPos+(_272-this.rows.length); +} +} +}else{ +if(_270+_271.length<this.startPos){ +this.rows=_271; +}else{ +this.rows=_271.slice(0,this.startPos).concat(this.rows); +if(this.rows.length>this.maxBufferSize){ +this.rows=this.rows.slice(0,this.maxBufferSize); +} +} +this.startPos=_270; +} +this.size=this.rows.length; +},clear:function(){ +this.rows=new Array(); +this.startPos=0; +this.size=0; +},isOverlapping:function(_273,size){ +return ((_273<this.endPos())&&(this.startPos<_273+size))||(this.endPos()==0); +},isInRange:function(_275){ +return (_275>=this.startPos)&&(_275+this.metaData.getPageSize()<=this.endPos()); +},isNearingTopLimit:function(_276){ +return _276-this.startPos<this.metaData.getLimitTolerance(); +},endPos:function(){ +return this.startPos+this.rows.length; +},isNearingBottomLimit:function(_277){ +return this.endPos()-(_277+this.metaData.getPageSize())<this.metaData.getLimitTolerance(); +},isAtTop:function(){ +return this.startPos==0; +},isAtBottom:function(){ +return this.endPos()==this.metaData.getTotalRows(); +},isNearingLimit:function(_278){ +return (!this.isAtTop()&&this.isNearingTopLimit(_278))||(!this.isAtBottom()&&this.isNearingBottomLimit(_278)); +},getFetchSize:function(_279){ +var _280=this.getFetchOffset(_279); +var _281=0; +if(_280>=this.startPos){ +var _282=this.maxFetchSize+_280; +if(_282>this.metaData.totalRows){ +_282=this.metaData.totalRows; +} +_281=_282-_280; +if(_280==0&&_281<this.maxFetchSize){ +_281=this.maxFetchSize; +} +}else{ +var _281=this.startPos-_280; +if(_281>this.maxFetchSize){ +_281=this.maxFetchSize; +} +} +return _281; +},getFetchOffset:function(_283){ +var _284=_283; +if(_283>this.startPos){ +_284=(_283>this.endPos())?_283:this.endPos(); +}else{ +if(_283+this.maxFetchSize>=this.startPos){ +var _284=this.startPos-this.maxFetchSize; +if(_284<0){ +_284=0; +} +} +} +this.lastOffset=_284; +return _284; +},getRows:function(_285,_286){ +var _287=_285-this.startPos; +var _288=_287+_286; +if(_288>this.size){ +_288=this.size; +} +var _289=new Array(); +var _290=0; +for(var i=_287;i<_288;i++){ +_289[_290++]=this.rows[i]; +} +return _289; +},convertSpaces:function(s){ +return s.split(" ").join(" "); +}}; +Rico.GridViewPort=Class.create(); +Rico.GridViewPort.prototype={initialize:function(_291,_292,_293,_294,_295){ +this.lastDisplayedStartPos=0; +this.div=_291.parentNode; +this.table=_291; +this.rowHeight=_292; +this.div.style.height=this.rowHeight*_293; +this.div.style.overflow="hidden"; +this.buffer=_294; +this.liveGrid=_295; +this.visibleRows=_293+1; +this.lastPixelOffset=0; +this.startPos=0; +},populateRow:function(_296,row){ +for(var j=0;j<row.length;j++){ +_296.cells[j].innerHTML=row[j]; +} +},bufferChanged:function(){ +this.refreshContents(parseInt(this.lastPixelOffset/this.rowHeight)); +},clearRows:function(){ +if(!this.isBlank){ +this.liveGrid.table.className=this.liveGrid.options.loadingClass; +for(var i=0;i<this.visibleRows;i++){ +this.populateRow(this.table.rows[i],this.buffer.getBlankRow()); +} +this.isBlank=true; +} +},clearContents:function(){ +this.clearRows(); +this.scrollTo(0); +this.startPos=0; +this.lastStartPos=-1; +},refreshContents:function(_297){ +if(_297==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){ +return; +} +if((_297+this.visibleRows<this.buffer.startPos)||(this.buffer.startPos+this.buffer.size<_297)||(this.buffer.size==0)){ +this.clearRows(); +return; +} +this.isBlank=false; +var _298=this.buffer.startPos>_297; +var _299=_298?this.buffer.startPos:_297; +var _300=(this.buffer.startPos+this.buffer.size<_297+this.visibleRows)?this.buffer.startPos+this.buffer.size:_297+this.visibleRows; +var _301=_300-_299; +var rows=this.buffer.getRows(_299,_301); +var _303=this.visibleRows-_301; +var _304=_298?0:_301; +var _305=_298?_303:0; +for(var i=0;i<rows.length;i++){ +this.populateRow(this.table.rows[i+_305],rows[i]); +} +for(var i=0;i<_303;i++){ +this.populateRow(this.table.rows[i+_304],this.buffer.getBlankRow()); +} +this.isPartialBlank=_303>0; +this.lastRowPos=_297; +this.liveGrid.table.className=this.liveGrid.options.tableClass; +var _306=this.liveGrid.options.onRefreshComplete; +if(_306!=null){ +_306(); +} +},scrollTo:function(_307){ +if(this.lastPixelOffset==_307){ +return; +} +this.refreshContents(parseInt(_307/this.rowHeight)); +this.div.scrollTop=_307%this.rowHeight; +this.lastPixelOffset=_307; +},visibleHeight:function(){ +return parseInt(RicoUtil.getElementsComputedStyle(this.div,"height")); +}}; +Rico.LiveGridRequest=Class.create(); +Rico.LiveGridRequest.prototype={initialize:function(_308,_309){ +this.requestOffset=_308; +}}; +Rico.LiveGrid=Class.create(); +Rico.LiveGrid.prototype={initialize:function(_310,_311,_312,url,_314,_315){ +this.options={tableClass:$(_310).className,loadingClass:$(_310).className,scrollerBorderRight:"1px solid #ababab",bufferTimeout:20000,sortAscendImg:"images/sort_asc.gif",sortDescendImg:"images/sort_desc.gif",sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true}; +Object.extend(this.options,_314||{}); +this.ajaxOptions={parameters:null}; +Object.extend(this.ajaxOptions,_315||{}); +this.tableId=_310; +this.table=$(_310); +this.addLiveGridHtml(); +var _316=this.table.rows[0].cells.length; +this.metaData=new Rico.LiveGridMetaData(_311,_312,_316,_314); +this.buffer=new Rico.LiveGridBuffer(this.metaData); +var _317=this.table.rows.length; +this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/_317,_311,this.buffer,this); +this.scroller=new Rico.LiveGridScroller(this,this.viewPort); +this.options.sortHandler=this.sortHandler.bind(this); +if($(_310+"_header")){ +this.sort=new Rico.LiveGridSort(_310+"_header",this.options); +} +this.processingRequest=null; +this.unprocessedRequest=null; +this.initAjax(url); +if(this.options.prefetchBuffer||this.options.prefetchOffset>0){ +var _318=0; +if(this.options.offset){ +_318=this.options.offset; +this.scroller.moveScroll(_318); +this.viewPort.scrollTo(this.scroller.rowToPixel(_318)); +} +if(this.options.sortCol){ +this.sortCol=_314.sortCol; +this.sortDir=_314.sortDir; +} +this.requestContentRefresh(_318); +} +},addLiveGridHtml:function(){ +if(this.table.getElementsByTagName("thead").length>0){ +var _319=this.table.cloneNode(true); +_319.setAttribute("id",this.tableId+"_header"); +_319.setAttribute("class",this.table.className+"_header"); +for(var i=0;i<_319.tBodies.length;i++){ +_319.removeChild(_319.tBodies[i]); +} +this.table.deleteTHead(); +this.table.parentNode.insertBefore(_319,this.table); +} +new Insertion.Before(this.table,"<div id='"+this.tableId+"_container'></div>"); +this.table.previousSibling.appendChild(this.table); +new Insertion.Before(this.table,"<div id='"+this.tableId+"_viewport' style='float:left;'></div>"); +this.table.previousSibling.appendChild(this.table); +},resetContents:function(){ +this.scroller.moveScroll(0); +this.buffer.clear(); +this.viewPort.clearContents(); +},sortHandler:function(_320){ +this.sortCol=_320.name; +this.sortDir=_320.currentSort; +this.resetContents(); +this.requestContentRefresh(0); +},setTotalRows:function(_321){ +this.resetContents(); +this.metaData.setTotalRows(_321); +this.scroller.updateSize(); +},initAjax:function(url){ +ajaxEngine.registerRequest(this.tableId+"_request",url); +ajaxEngine.registerAjaxObject(this.tableId+"_updater",this); +},invokeAjax:function(){ +},handleTimedOut:function(){ +this.processingRequest=null; +this.processQueuedRequest(); +},fetchBuffer:function(_322){ +if(this.buffer.isInRange(_322)&&!this.buffer.isNearingLimit(_322)){ +return; +} +if(this.processingRequest){ +this.unprocessedRequest=new Rico.LiveGridRequest(_322); +return; +} +var _323=this.buffer.getFetchOffset(_322); +this.processingRequest=new Rico.LiveGridRequest(_322); +this.processingRequest.bufferOffset=_323; +var _324=this.buffer.getFetchSize(_322); +var _325=false; +var _326; +if(this.options.requestParameters){ +_326=this._createQueryString(this.options.requestParameters,0); +} +_326=(_326==null)?"":_326+"&"; +_326=_326+"id="+this.tableId+"&page_size="+_324+"&offset="+_323; +if(this.sortCol){ +_326=_326+"&sort_col="+escape(this.sortCol)+"&sort_dir="+this.sortDir; +} +this.ajaxOptions.parameters=_326; +ajaxEngine.sendRequest(this.tableId+"_request",this.ajaxOptions); +this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout); +},setRequestParams:function(){ +this.options.requestParameters=[]; +for(var i=0;i<arguments.length;i++){ +this.options.requestParameters[i]=arguments[i]; +} +},requestContentRefresh:function(_327){ +this.fetchBuffer(_327); +},ajaxUpdate:function(_328){ +try{ +clearTimeout(this.timeoutHandler); +this.buffer.update(_328,this.processingRequest.bufferOffset); +this.viewPort.bufferChanged(); +} +catch(err){ +} +finally{ +this.processingRequest=null; +} +this.processQueuedRequest(); +},_createQueryString:function(_329,_330){ +var _331=""; +if(!_329){ +return _331; +} +for(var i=_330;i<_329.length;i++){ +if(i!=_330){ +_331+="&"; +} +var _332=_329[i]; +if(_332.name!=undefined&&_332.value!=undefined){ +_331+=_332.name+"="+escape(_332.value); +}else{ +var ePos=_332.indexOf("="); +var _334=_332.substring(0,ePos); +var _335=_332.substring(ePos+1); +_331+=_334+"="+escape(_335); +} +} +return _331; +},processQueuedRequest:function(){ +if(this.unprocessedRequest!=null){ +this.requestContentRefresh(this.unprocessedRequest.requestOffset); +this.unprocessedRequest=null; +} +}}; +Rico.LiveGridSort=Class.create(); +Rico.LiveGridSort.prototype={initialize:function(_336,_337){ +this.headerTableId=_336; +this.headerTable=$(_336); +this.options=_337; +this.setOptions(); +this.applySortBehavior(); +if(this.options.sortCol){ +this.setSortUI(this.options.sortCol,this.options.sortDir); +} +},setSortUI:function(_338,_339){ +var cols=this.options.columns; +for(var i=0;i<cols.length;i++){ +if(cols[i].name==_338){ +this.setColumnSort(i,_339); +break; +} +} +},setOptions:function(){ +new Image().src=this.options.sortAscendImg; +new Image().src=this.options.sortDescendImg; +this.sort=this.options.sortHandler; +if(!this.options.columns){ +this.options.columns=this.introspectForColumnInfo(); +}else{ +this.options.columns=this.convertToTableColumns(this.options.columns); +} +},applySortBehavior:function(){ +var _341=this.headerTable.rows[0]; +var _342=_341.cells; +for(var i=0;i<_342.length;i++){ +this.addSortBehaviorToColumn(i,_342[i]); +} +},addSortBehaviorToColumn:function(n,cell){ +if(this.options.columns[n].isSortable()){ +cell.id=this.headerTableId+"_"+n; +cell.style.cursor="pointer"; +cell.onclick=this.headerCellClicked.bindAsEventListener(this); +cell.innerHTML=cell.innerHTML+"<span id=\""+this.headerTableId+"_img_"+n+"\">"+" </span>"; +} +},headerCellClicked:function(evt){ +var _343=evt.target?evt.target:evt.srcElement; +var _344=_343.id; +var _345=parseInt(_344.substring(_344.lastIndexOf("_")+1)); +var _346=this.getSortedColumnIndex(); +if(_346!=-1){ +if(_346!=_345){ +this.removeColumnSort(_346); +this.setColumnSort(_345,Rico.TableColumn.SORT_ASC); +}else{ +this.toggleColumnSort(_346); +} +}else{ +this.setColumnSort(_345,Rico.TableColumn.SORT_ASC); +} +if(this.options.sortHandler){ +this.options.sortHandler(this.options.columns[_345]); +} +},removeColumnSort:function(n){ +this.options.columns[n].setUnsorted(); +this.setSortImage(n); +},setColumnSort:function(n,_347){ +this.options.columns[n].setSorted(_347); +this.setSortImage(n); +},toggleColumnSort:function(n){ +this.options.columns[n].toggleSort(); +this.setSortImage(n); +},setSortImage:function(n){ +var _348=this.options.columns[n].getSortDirection(); +var _349=$(this.headerTableId+"_img_"+n); +if(_348==Rico.TableColumn.UNSORTED){ +_349.innerHTML=" "; +}else{ +if(_348==Rico.TableColumn.SORT_ASC){ +_349.innerHTML=" <img width=\""+this.options.sortImageWidth+"\" "+"height=\""+this.options.sortImageHeight+"\" "+"src=\""+this.options.sortAscendImg+"\"/>"; +}else{ +if(_348==Rico.TableColumn.SORT_DESC){ +_349.innerHTML=" <img width=\""+this.options.sortImageWidth+"\" "+"height=\""+this.options.sortImageHeight+"\" "+"src=\""+this.options.sortDescendImg+"\"/>"; +} +} +} +},getSortedColumnIndex:function(){ +var cols=this.options.columns; +for(var i=0;i<cols.length;i++){ +if(cols[i].isSorted()){ +return i; +} +} +return -1; +},introspectForColumnInfo:function(){ +var _350=new Array(); +var _351=this.headerTable.rows[0]; +var _352=_351.cells; +for(var i=0;i<_352.length;i++){ +_350.push(new Rico.TableColumn(this.deriveColumnNameFromCell(_352[i],i),true)); +} +return _350; +},convertToTableColumns:function(cols){ +var _353=new Array(); +for(var i=0;i<cols.length;i++){ +_353.push(new Rico.TableColumn(cols[i][0],cols[i][1])); +} +return _353; +},deriveColumnNameFromCell:function(cell,_354){ +var _355=cell.innerText!=undefined?cell.innerText:cell.textContent; +return _355?_355.toLowerCase().split(" ").join("_"):"col_"+_354; +}}; +Rico.TableColumn=Class.create(); +Rico.TableColumn.UNSORTED=0; +Rico.TableColumn.SORT_ASC="ASC"; +Rico.TableColumn.SORT_DESC="DESC"; +Rico.TableColumn.prototype={initialize:function(name,_357){ +this.name=name; +this.sortable=_357; +this.currentSort=Rico.TableColumn.UNSORTED; +},isSortable:function(){ +return this.sortable; +},isSorted:function(){ +return this.currentSort!=Rico.TableColumn.UNSORTED; +},getSortDirection:function(){ +return this.currentSort; +},toggleSort:function(){ +if(this.currentSort==Rico.TableColumn.UNSORTED||this.currentSort==Rico.TableColumn.SORT_DESC){ +this.currentSort=Rico.TableColumn.SORT_ASC; +}else{ +if(this.currentSort==Rico.TableColumn.SORT_ASC){ +this.currentSort=Rico.TableColumn.SORT_DESC; +} +} +},setUnsorted:function(_358){ +this.setSorted(Rico.TableColumn.UNSORTED); +},setSorted:function(_359){ +this.currentSort=_359; +}}; +Rico.ArrayExtensions=new Array(); +if(Object.prototype.extend){ +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend; +}else{ +Object.prototype.extend=function(_360){ +return Object.extend.apply(this,[this,_360]); +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend; +} +if(Array.prototype.push){ +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push; +} +if(!Array.prototype.remove){ +Array.prototype.remove=function(dx){ +if(isNaN(dx)||dx>this.length){ +return false; +} +for(var i=0,n=0;i<this.length;i++){ +if(i!=dx){ +this[n++]=this[i]; +} +} +this.length-=1; +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove; +} +if(!Array.prototype.removeItem){ +Array.prototype.removeItem=function(item){ +for(var i=0;i<this.length;i++){ +if(this[i]==item){ +this.remove(i); +break; +} +} +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem; +} +if(!Array.prototype.indices){ +Array.prototype.indices=function(){ +var _362=new Array(); +for(index in this){ +var _363=false; +for(var i=0;i<Rico.ArrayExtensions.length;i++){ +if(this[index]==Rico.ArrayExtensions[i]){ +_363=true; +break; +} +} +if(!_363){ +_362[_362.length]=index; +} +} +return _362; +}; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices; +} +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.unique; +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.inArray; +if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){ +if(!Document.prototype.loadXML){ +Document.prototype.loadXML=function(s){ +var doc2=(new DOMParser()).parseFromString(s,"text/xml"); +while(this.hasChildNodes()){ +this.removeChild(this.lastChild); +} +for(var i=0;i<doc2.childNodes.length;i++){ +this.appendChild(this.importNode(doc2.childNodes[i],true)); +} +}; +} +Document.prototype.__defineGetter__("xml",function(){ +return (new XMLSerializer()).serializeToString(this); +}); +} +document.getElementsByTagAndClassName=function(_365,_366){ +if(_365==null){ +_365="*"; +} +var _367=document.getElementsByTagName(_365)||document.all; +var _368=new Array(); +if(_366==null){ +return _367; +} +for(var i=0;i<_367.length;i++){ +var _369=_367[i]; +var _370=_369.className.split(" "); +for(var j=0;j<_370.length;j++){ +if(_370[j]==_366){ +_368.push(_369); +break; +} +} +} +return _368; +}; +var RicoUtil={getElementsComputedStyle:function(_371,_372,_373){ +if(arguments.length==2){ +_373=_372; +} +var el=$(_371); +if(el.currentStyle){ +return el.currentStyle[_372]; +}else{ +return document.defaultView.getComputedStyle(el,null).getPropertyValue(_373); +} +},createXmlDocument:function(){ +if(document.implementation&&document.implementation.createDocument){ +var doc=document.implementation.createDocument("","",null); +if(doc.readyState==null){ +doc.readyState=1; +doc.addEventListener("load",function(){ +doc.readyState=4; +if(typeof doc.onreadystatechange=="function"){ +doc.onreadystatechange(); +} +},false); +} +return doc; +} +if(window.ActiveXObject){ +return Try.these(function(){ +return new ActiveXObject("MSXML2.DomDocument"); +},function(){ +return new ActiveXObject("Microsoft.DomDocument"); +},function(){ +return new ActiveXObject("MSXML.DomDocument"); +},function(){ +return new ActiveXObject("MSXML3.DomDocument"); +})||false; +} +return null; +},getContentAsString:function(_375){ +return _375.xml!=undefined?this._getContentAsStringIE(_375):this._getContentAsStringMozilla(_375); +},_getContentAsStringIE:function(_376){ +var _377=""; +for(var i=0;i<_376.childNodes.length;i++){ +var n=_376.childNodes[i]; +if(n.nodeType==4){ +_377+=n.nodeValue; +}else{ +_377+=n.xml; +} +} +return _377; +},_getContentAsStringMozilla:function(_378){ +var _379=new XMLSerializer(); +var _380=""; +for(var i=0;i<_378.childNodes.length;i++){ +var n=_378.childNodes[i]; +if(n.nodeType==4){ +_380+=n.nodeValue; +}else{ +_380+=_379.serializeToString(n); +} +} +return _380; +},toViewportPosition:function(_381){ +return this._toAbsolute(_381,true); +},toDocumentPosition:function(_382){ +return this._toAbsolute(_382,false); +},_toAbsolute:function(_383,_384){ +if(navigator.userAgent.toLowerCase().indexOf("msie")==-1){ +return this._toAbsoluteMozilla(_383,_384); +} +var x=0; +var y=0; +var _385=_383; +while(_385){ +var _386=0; +var _387=0; +if(_385!=_383){ +var _386=parseInt(this.getElementsComputedStyle(_385,"borderLeftWidth")); +var _387=parseInt(this.getElementsComputedStyle(_385,"borderTopWidth")); +_386=isNaN(_386)?0:_386; +_387=isNaN(_387)?0:_387; +} +x+=_385.offsetLeft-_385.scrollLeft+_386; +y+=_385.offsetTop-_385.scrollTop+_387; +_385=_385.offsetParent; +} +if(_384){ +x-=this.docScrollLeft(); +y-=this.docScrollTop(); +} +return {x:x,y:y}; +},_toAbsoluteMozilla:function(_388,_389){ +var x=0; +var y=0; +var _390=_388; +while(_390){ +x+=_390.offsetLeft; +y+=_390.offsetTop; +_390=_390.offsetParent; +} +_390=_388; +while(_390&&_390!=document.body&&_390!=document.documentElement){ +if(_390.scrollLeft){ +x-=_390.scrollLeft; +} +if(_390.scrollTop){ +y-=_390.scrollTop; +} +_390=_390.parentNode; +} +if(_389){ +x-=this.docScrollLeft(); +y-=this.docScrollTop(); +} +return {x:x,y:y}; +},docScrollLeft:function(){ +if(window.pageXOffset){ +return window.pageXOffset; +}else{ +if(document.documentElement&&document.documentElement.scrollLeft){ +return document.documentElement.scrollLeft; +}else{ +if(document.body){ +return document.body.scrollLeft; +}else{ +return 0; +} +} +} +},docScrollTop:function(){ +if(window.pageYOffset){ +return window.pageYOffset; +}else{ +if(document.documentElement&&document.documentElement.scrollTop){ +return document.documentElement.scrollTop; +}else{ +if(document.body){ +return document.body.scrollTop; +}else{ +return 0; +} +} +} +}}; +
+Prado.RicoLiveGrid=Class.create(); +Prado.RicoLiveGrid.prototype=Object.extend(Rico.LiveGrid.prototype,{initialize:function(_1,_2){ +this.options={tableClass:$(_1).className||"",loadingClass:$(_1).className||"",scrollerBorderRight:"1px solid #ababab",bufferTimeout:20000,sortAscendImg:"images/sort_asc.gif",sortDescendImg:"images/sort_desc.gif",sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true,visibleRows:10,totalRows:0,initialOffset:0}; +Object.extend(this.options,_2||{}); +this.tableId=_1; +this.table=$(_1); +this.addLiveGridHtml(); +var _3=this.table.rows[0].cells.length; +this.metaData=new Rico.LiveGridMetaData(this.options.visibleRows,this.options.totalRows,_3,_2); +this.buffer=new Rico.LiveGridBuffer(this.metaData); +var _4=this.table.rows.length; +this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/_4,this.options.visibleRows,this.buffer,this); +this.scroller=new Rico.LiveGridScroller(this,this.viewPort); +this.options.sortHandler=this.sortHandler.bind(this); +if($(_1+"_header")){ +this.sort=new Rico.LiveGridSort(_1+"_header",this.options); +} +this.processingRequest=null; +this.unprocessedRequest=null; +if(this.options.initialOffset>=0){ +var _5=this.options.initialOffset; +this.scroller.moveScroll(_5); +this.viewPort.scrollTo(this.scroller.rowToPixel(_5)); +if(this.options.sortCol){ +this.sortCol=_2.sortCol; +this.sortDir=_2.sortDir; +} +var _6=this; +setTimeout(function(){ +_6.requestContentRefresh(_5); +},100); +} +},fetchBuffer:function(_7){ +if(this.buffer.isInRange(_7)&&!this.buffer.isNearingLimit(_7)){ +return; +} +if(this.processingRequest){ +this.unprocessedRequest=new Rico.LiveGridRequest(_7); +return; +} +var _8=this.buffer.getFetchOffset(_7); +this.processingRequest=new Rico.LiveGridRequest(_7); +this.processingRequest.bufferOffset=_8; +var _9=this.buffer.getFetchSize(_7); +var _10=false; +var _11={"page_size":_9,"offset":_8}; +if(this.sortCol){ +Object.extend(_11,{"sort_col":this.sortCol,"sort_dir":this.sortDir}); +} +Prado.Callback(this.tableId,_11,this.ajaxUpdate.bind(this),this.options); +this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout); +},ajaxUpdate:function(_12,_13){ +try{ +clearTimeout(this.timeoutHandler); +this.buffer.update(_12,this.processingRequest.bufferOffset); +this.viewPort.bufferChanged(); +} +catch(err){ +} +finally{ +this.processingRequest=null; +} +this.processQueuedRequest(); +}}); +Object.extend(Rico.LiveGridBuffer.prototype,{update:function(_14,_15){ +if(this.rows.length==0){ +this.rows=_14; +this.size=this.rows.length; +this.startPos=_15; +return; +} +if(_15>this.startPos){ +if(this.startPos+this.rows.length<_15){ +this.rows=_14; +this.startPos=_15; +}else{ +this.rows=this.rows.concat(_14.slice(0,_14.length)); +if(this.rows.length>this.maxBufferSize){ +var _16=this.rows.length; +this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length); +this.startPos=this.startPos+(_16-this.rows.length); +} +} +}else{ +if(_15+_14.length<this.startPos){ +this.rows=_14; +}else{ +this.rows=_14.slice(0,this.startPos).concat(this.rows); +if(this.rows.length>this.maxBufferSize){ +this.rows=this.rows.slice(0,this.maxBufferSize); +} +} +this.startPos=_15; +} +this.size=this.rows.length; +}}); +Object.extend(Rico.GridViewPort.prototype,{populateRow:function(_17,row){ +if(isdef(_17)){ +for(var j=0;j<row.length;j++){ +_17.cells[j].innerHTML=row[j]; +} +} +}}); +
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js index bc902178..08b7e94f 100644 --- a/framework/Web/Javascripts/prado/controls.js +++ b/framework/Web/Javascripts/prado/controls.js @@ -1,167 +1,51 @@ -Prado.Focus = Class.create();
-Prado.Focus.setFocus = function(id)
-{
- var target = document.getElementById ? document.getElementById(id) : document.all[id];
- if(target && !Prado.Focus.canFocusOn(target))
- {
- target = Prado.Focus.findTarget(target);
- }
- if(target)
- {
- try
- {
- target.focus();
- target.scrollIntoView(false);
- if (window.__smartNav)
- {
- window.__smartNav.ae = target.id;
- }
- }
- catch (e)
- {
- }
- }
-}
-Prado.Focus.canFocusOn = function(element)
-{
- if(!element || !(element.tagName))
- return false;
- var tagName = element.tagName.toLowerCase();
- return !element.disabled && (!element.type || element.type.toLowerCase() != "hidden") && Prado.Focus.isFocusableTag(tagName) && Prado.Focus.isVisible(element);
-}
+Prado.Button = Class.create();
-Prado.Focus.isFocusableTag = function(tagName)
+/**
+ * Usage: Event.observe("panelID", "keypress", Prado.fireButton.bindEvent($("panelID"), "targetButtonID"));
+ */
+Object.extend(Prado.Button,
{
- return (tagName == "input" || tagName == "textarea" || tagName == "select" || tagName == "button" || tagName == "a");
-}
-
-
-Prado.Focus.findTarget = function(element)
-{
- if(!element || !(element.tagName))
- {
- return null;
- }
- var tagName = element.tagName.toLowerCase();
- if (tagName == "undefined")
- {
- return null;
- }
- var children = element.childNodes;
- if (children)
- {
- for(var i=0;i<children.length;i++)
- {
- try
+ buttonFired : false,
+ fireButton : function(e, target)
+ {
+ var eventFired = !this.buttonFired && Event.keyCode(e) == Event.KEY_RETURN;
+ var isTextArea = Event.element(e).targName.toLowerCase() == "textarea";
+ if (eventFired && !isTextArea)
+ {
+ var defaultButton = $(target);
+ if (defaultButton)
{
- if(Prado.Focus.canFocusOn(children[i]))
- {
- return children[i];
- }
- else
- {
- var target = Prado.Focus.findTarget(children[i]);
- if(target)
- {
- return target;
- }
- }
+ Prado.Button.buttonFired = true;
+ Event.fireEvent(defaultButton,"click");
+ Event.stop(e);
+ return false;
}
- catch (e)
- {
- }
- }
- }
- return null;
-}
-
-Prado.Focus.isVisible = function(element)
-{
- var current = element;
- while((typeof(current) != "undefined") && (current != null))
- {
- if(current.disabled || (typeof(current.style) != "undefined" && ((typeof(current.style.display) != "undefined" && current.style.display == "none") || (typeof(current.style.visibility) != "undefined" && current.style.visibility == "hidden") )))
- {
- return false;
- }
- if(typeof(current.parentNode) != "undefined" && current.parentNode != null && current.parentNode != current && current.parentNode.tagName.toLowerCase() != "body")
- {
- current = current.parentNode;
- }
- else
- {
- return true;
- }
+ }
+ return true;
}
- return true;
-}
+});
+Prado.TextBox = Class.create();
-Prado.doPostBack = function(formID, eventTarget, eventParameter, performValidation, validationGroup, actionUrl, trackFocus, clientSubmit)
+/**
+ * Usage: Event.observe("textboxID", "keypress", Prado.fireButton.bindEvent($("textboxID")));
+ */
+Object.extend(Prado.TextBox,
{
- if (typeof(performValidation) == 'undefined')
- {
- var performValidation = false;
- var validationGroup = '';
- var actionUrl = null;
- var trackFocus = false;
- var clientSubmit = true;
- }
- var theForm = document.getElementById ? document.getElementById(formID) : document.forms[formID];
- var canSubmit = true;
- if (performValidation)
- {
- //canSubmit = Prado.Validation.validate(validationGroup);
- /* Prado.Validation.ActiveTarget = theForm;
- Prado.Validation.CurrentTargetGroup = null;
- Prado.Validation.IsGroupValidation = false;
- canSubmit = Prado.Validation.IsValid(theForm);
- Logger.debug(canSubmit);*/
- canSubmit = Prado.Validation.IsValid(theForm);
- }
- if (canSubmit)
+ handleReturnKey : function(e)
{
- if (actionUrl != null && (actionUrl.length > 0))
- {
- theForm.action = actionUrl;
- }
- if (trackFocus)
- {
- var lastFocus = theForm.elements['PRADO_LASTFOCUS'];
- if ((typeof(lastFocus) != 'undefined') && (lastFocus != null))
+ if(Event.keyCode(e) == Event.KEY_RETURN)
+ {
+ var target = Event.element(e);
+ if(target)
{
- var active = document.activeElement;
- if (typeof(active) == 'undefined')
- {
- lastFocus.value = eventTarget;
- }
- else
- {
- if ((active != null) && (typeof(active.id) != 'undefined'))
- {
- if (active.id.length > 0)
- {
- lastFocus.value = active.id;
- }
- else if (typeof(active.name) != 'undefined')
- {
- lastFocus.value = active.name;
- }
- }
- }
+ Event.fireEvent(target, "change");
+ Event.stop(e);
+ return false;
}
}
- if (!clientSubmit)
- {
- canSubmit = false;
- }
- }
- if (canSubmit && (!theForm.onsubmit || theForm.onsubmit()))
- {
- theForm.PRADO_POSTBACK_TARGET.value = eventTarget;
- theForm.PRADO_POSTBACK_PARAMETER.value = eventParameter;
- theForm.submit();
+ return true;
}
-}
\ No newline at end of file +});
diff --git a/framework/Web/Javascripts/prado/form.js b/framework/Web/Javascripts/prado/form.js new file mode 100644 index 00000000..810acbd8 --- /dev/null +++ b/framework/Web/Javascripts/prado/form.js @@ -0,0 +1,167 @@ +Prado.Focus = Class.create();
+
+Prado.Focus.setFocus = function(id)
+{
+ var target = document.getElementById ? document.getElementById(id) : document.all[id];
+ if(target && !Prado.Focus.canFocusOn(target))
+ {
+ target = Prado.Focus.findTarget(target);
+ }
+ if(target)
+ {
+ try
+ {
+ target.focus();
+ target.scrollIntoView(false);
+ if (window.__smartNav)
+ {
+ window.__smartNav.ae = target.id;
+ }
+ }
+ catch (e)
+ {
+ }
+ }
+}
+
+Prado.Focus.canFocusOn = function(element)
+{
+ if(!element || !(element.tagName))
+ return false;
+ var tagName = element.tagName.toLowerCase();
+ return !element.disabled && (!element.type || element.type.toLowerCase() != "hidden") && Prado.Focus.isFocusableTag(tagName) && Prado.Focus.isVisible(element);
+}
+
+Prado.Focus.isFocusableTag = function(tagName)
+{
+ return (tagName == "input" || tagName == "textarea" || tagName == "select" || tagName == "button" || tagName == "a");
+}
+
+
+Prado.Focus.findTarget = function(element)
+{
+ if(!element || !(element.tagName))
+ {
+ return null;
+ }
+ var tagName = element.tagName.toLowerCase();
+ if (tagName == "undefined")
+ {
+ return null;
+ }
+ var children = element.childNodes;
+ if (children)
+ {
+ for(var i=0;i<children.length;i++)
+ {
+ try
+ {
+ if(Prado.Focus.canFocusOn(children[i]))
+ {
+ return children[i];
+ }
+ else
+ {
+ var target = Prado.Focus.findTarget(children[i]);
+ if(target)
+ {
+ return target;
+ }
+ }
+ }
+ catch (e)
+ {
+ }
+ }
+ }
+ return null;
+}
+
+Prado.Focus.isVisible = function(element)
+{
+ var current = element;
+ while((typeof(current) != "undefined") && (current != null))
+ {
+ if(current.disabled || (typeof(current.style) != "undefined" && ((typeof(current.style.display) != "undefined" && current.style.display == "none") || (typeof(current.style.visibility) != "undefined" && current.style.visibility == "hidden") )))
+ {
+ return false;
+ }
+ if(typeof(current.parentNode) != "undefined" && current.parentNode != null && current.parentNode != current && current.parentNode.tagName.toLowerCase() != "body")
+ {
+ current = current.parentNode;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ return true;
+}
+
+
+Prado.doPostBack = function(formID, eventTarget, eventParameter, performValidation, validationGroup, actionUrl, trackFocus, clientSubmit)
+{
+ if (typeof(performValidation) == 'undefined')
+ {
+ var performValidation = false;
+ var validationGroup = '';
+ var actionUrl = null;
+ var trackFocus = false;
+ var clientSubmit = true;
+ }
+ var theForm = document.getElementById ? document.getElementById(formID) : document.forms[formID];
+ var canSubmit = true;
+ if (performValidation)
+ {
+ //canSubmit = Prado.Validation.validate(validationGroup);
+ /* Prado.Validation.ActiveTarget = theForm;
+ Prado.Validation.CurrentTargetGroup = null;
+ Prado.Validation.IsGroupValidation = false;
+ canSubmit = Prado.Validation.IsValid(theForm);
+ Logger.debug(canSubmit);*/
+ canSubmit = Prado.Validation.IsValid(theForm);
+ }
+ if (canSubmit)
+ {
+ if (actionUrl != null && (actionUrl.length > 0))
+ {
+ theForm.action = actionUrl;
+ }
+ if (trackFocus)
+ {
+ var lastFocus = theForm.elements['PRADO_LASTFOCUS'];
+ if ((typeof(lastFocus) != 'undefined') && (lastFocus != null))
+ {
+ var active = document.activeElement;
+ if (typeof(active) == 'undefined')
+ {
+ lastFocus.value = eventTarget;
+ }
+ else
+ {
+ if ((active != null) && (typeof(active.id) != 'undefined'))
+ {
+ if (active.id.length > 0)
+ {
+ lastFocus.value = active.id;
+ }
+ else if (typeof(active.name) != 'undefined')
+ {
+ lastFocus.value = active.name;
+ }
+ }
+ }
+ }
+ }
+ if (!clientSubmit)
+ {
+ canSubmit = false;
+ }
+ }
+ if (canSubmit && (!theForm.onsubmit || theForm.onsubmit()))
+ {
+ theForm.PRADO_POSTBACK_TARGET.value = eventTarget;
+ theForm.PRADO_POSTBACK_PARAMETER.value = eventParameter;
+ theForm.submit();
+ }
+}
diff --git a/framework/Web/Javascripts/prado/prado.js b/framework/Web/Javascripts/prado/prado.js index 52bf2b89..90ddbe8d 100644 --- a/framework/Web/Javascripts/prado/prado.js +++ b/framework/Web/Javascripts/prado/prado.js @@ -1,51 +1,2 @@ var Prado = { Version: '3.0a' };
-Prado.Button = Class.create();
-
-/**
- * Usage: Event.observe("panelID", "keypress", Prado.fireButton.bindEvent($("panelID"), "targetButtonID"));
- */
-Object.extend(Prado.Button,
-{
- buttonFired : false,
- fireButton : function(e, target)
- {
- var eventFired = !this.buttonFired && Event.keyCode(e) == Event.KEY_RETURN;
- var isTextArea = Event.element(e).targName.toLowerCase() == "textarea";
- if (eventFired && !isTextArea)
- {
- var defaultButton = $(target);
- if (defaultButton)
- {
- Prado.Button.buttonFired = true;
- Event.fireEvent(defaultButton,"click");
- Event.stop(e);
- return false;
- }
- }
- return true;
- }
-});
-
-Prado.TextBox = Class.create();
-
-/**
- * Usage: Event.observe("textboxID", "keypress", Prado.fireButton.bindEvent($("textboxID")));
- */
-Object.extend(Prado.TextBox,
-{
- handleReturnKey = function(e)
- {
- if(Event.keyCode(e) == Event.KEY_RETURN)
- {
- var target = Event.element(e);
- if(target)
- {
- Event.fireEvent(target, "change");
- Event.stop(e);
- return false;
- }
- }
- return true;
- }
-});
diff --git a/framework/Web/Javascripts/prototype/compat.js b/framework/Web/Javascripts/prototype/compat.js deleted file mode 100644 index 09c32582..00000000 --- a/framework/Web/Javascripts/prototype/compat.js +++ /dev/null @@ -1,27 +0,0 @@ -if (!Array.prototype.push) {
- Array.prototype.push = function() {
- var startLength = this.length;
- for (var i = 0; i < arguments.length; i++)
- this[startLength + i] = arguments[i];
- return this.length;
- }
-}
-
-if (!Function.prototype.apply) {
- // Based on code from http://www.youngpup.net/
- Function.prototype.apply = function(object, parameters) {
- var parameterStrings = new Array();
- if (!object) object = window;
- if (!parameters) parameters = new Array();
-
- for (var i = 0; i < parameters.length; i++)
- parameterStrings[i] = 'parameters[' + i + ']';
-
- object.__apply__ = this;
- var result = eval('object.__apply__(' +
- parameterStrings.join(', ') + ')');
- object.__apply__ = null;
-
- return result;
- }
-}
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index f7778de9..acbe7f20 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -198,7 +198,7 @@ class TClientScriptManager extends TComponent $url = $this->publishClientScriptCompressorAsset(); $url .= '?js='.implode(',', $scripts); if(Prado::getApplication()->getMode() == TApplication::STATE_DEBUG) - $url .= '&nocache'; + $url .= '&__nocache'; $this->registerScriptFile('prado:gzipscripts', $url); } @@ -276,7 +276,7 @@ class TClientScriptManager extends TComponent public function registerDefaultButtonScript($button) { - $this->registerPradoScript('base'); + $this->registerPradoScript('prado'); return 'return Prado.Button.fireButton(event,\''.$button->getClientID().'\')'; } @@ -510,7 +510,7 @@ class TClientScriptManager extends TComponent public function registerClientEvent($control, $event, $code) { if(empty($code)) return; - $this->registerPradoScript("dom"); + $this->registerPradoScript("prado"); $script= "Event.observe('{$control->ClientID}', '{$event}', function(e){ {$code} });"; $key = "prado:{$control->ClientID}:{$event}"; $this->registerEndScript($key, $script); @@ -678,13 +678,13 @@ class TPradoClientScript * @var array */ protected static $dependencies = array( - 'base' => array('base'), - 'dom' => array('base', 'dom'), - 'effects' => array('base', 'dom', 'effects'), - 'controls' => array('base', 'dom', 'effects', 'controls'), - 'validator' => array('base', 'dom', 'validator'), - 'logger' => array('base', 'dom', 'logger'), - 'ajax' => array('base', 'dom', 'ajax') + 'prado' => array('prado'), + 'effects' => array('prado', 'effects'), + 'ajax' => array('prado', 'effects', 'ajax'), + 'validator' => array('prado', 'validator'), + 'logger' => array('prado', 'logger'), + 'datepicker' => array('prado', 'datepicker'), + 'rico' => array('prado', 'effects', 'ajax', 'rico') ); /** |