From 4cecd6f96c26f747181639046c983ead66f28f17 Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 16 Jan 2006 03:41:43 +0000 Subject: --- framework/Web/Javascripts/js/ajax.js | 1285 +++++++++++++ framework/Web/Javascripts/js/base.js | 998 ---------- framework/Web/Javascripts/js/clientscripts.php | 7 +- framework/Web/Javascripts/js/datepicker.js | 422 +++++ framework/Web/Javascripts/js/dom.js | 1676 ----------------- framework/Web/Javascripts/js/effects.js | 720 +++++++ framework/Web/Javascripts/js/prado.js | 2381 ++++++++++++++++++++++++ framework/Web/Javascripts/js/rico.js | 1900 +++++++++++++++++++ 8 files changed, 6711 insertions(+), 2678 deletions(-) delete mode 100644 framework/Web/Javascripts/js/base.js create mode 100644 framework/Web/Javascripts/js/datepicker.js delete mode 100644 framework/Web/Javascripts/js/dom.js create mode 100644 framework/Web/Javascripts/js/effects.js create mode 100644 framework/Web/Javascripts/js/prado.js create mode 100644 framework/Web/Javascripts/js/rico.js (limited to 'framework/Web/Javascripts/js') 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,""); +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;i0){ +this.index--; +}else{ +this.index=this.entryCount-1; +} +},markNext:function(){ +if(this.index=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_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("
  • "+_40.substr(0,_38.length)+""+_40.substr(_38.length)+"
  • "); +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("
  • "+_40.substr(0,_41)+""+_40.substr(_41,_38.length)+""+_40.substr(_41+_38.length)+"
  • "); +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 "
      "+ret.join("")+"
    "; +}},_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(/
    /i); +},convertHTMLLineBreaks:function(_51){ +return _51.replace(/
    /gi,"\n").replace(//gi,"\n").replace(/<\/p>/gi,"\n").replace(/

    /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(_100)&&(_15this.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:"(?:)((\n|\r|.)*?)(?:)",emptyFunction:function(){ -},K:function(x){ -return x; -}}; - -if(!Array.prototype.push){ -Array.prototype.push=function(){ -var _1=this.length; -for(var i=0;i0&&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]+>/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=(_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 ab?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 "#"; -}}; -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;ithis[i]){ -n=this[i]; -} -} -return n; -}; -Array.prototype.max=function(){ -if(!this.length){ -return; -} -var n=this[0]; -for(var i=1;i0; -}; -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 "#"; -}}; -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(_60)){ -_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>")); +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/dom.js b/framework/Web/Javascripts/js/dom.js deleted file mode 100644 index 4a4904ad..00000000 --- a/framework/Web/Javascripts/js/dom.js +++ /dev/null @@ -1,1676 +0,0 @@ -document.getElementsByClassName=function(_1,_2){ -var _3=($(_2)||document.body).getElementsByTagName("*"); -return $A(_3).inject([],function(_4,_5){ -if(_5.className.match(new RegExp("(^|\\s)"+_1+"(\\s|$)"))){ -_4.push(_5); -} -return _4; -}); -}; -if(!window.Element){ -var Element=new Object(); -} -Object.extend(Element,{visible:function(_6){ -return $(_6).style.display!="none"; -},toggle:function(){ -for(var i=0;i"; -return $A(div.childNodes[0].childNodes[0].childNodes); -}}; -var Insertion=new Object(); -Insertion.Before=Class.create(); -Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){ -this.range.setStartBefore(this.element); -},insertContent:function(_48){ -_48.each((function(_49){ -this.element.parentNode.insertBefore(_49,this.element); -}).bind(this)); -}}); -Insertion.Top=Class.create(); -Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){ -this.range.selectNodeContents(this.element); -this.range.collapse(true); -},insertContent:function(_50){ -_50.reverse(false).each((function(_51){ -this.element.insertBefore(_51,this.element.firstChild); -}).bind(this)); -}}); -Insertion.Bottom=Class.create(); -Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){ -this.range.selectNodeContents(this.element); -this.range.collapse(this.element); -},insertContent:function(_52){ -_52.each((function(_53){ -this.element.appendChild(_53); -}).bind(this)); -}}); -Insertion.After=Class.create(); -Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){ -this.range.setStartAfter(this.element); -},insertContent:function(_54){ -_54.each((function(_55){ -this.element.parentNode.insertBefore(_55,this.element.nextSibling); -}).bind(this)); -}}); -Element.ClassNames=Class.create(); -Element.ClassNames.prototype={initialize:function(_56){ -this.element=$(_56); -},_each:function(_57){ -this.element.className.split(/\s+/).select(function(_58){ -return _58.length>0; -})._each(_57); -},set:function(_59){ -this.element.className=_59; -},add:function(_60){ -if(this.include(_60)){ -return; -} -this.set(this.toArray().concat(_60).join(" ")); -},remove:function(_61){ -if(!this.include(_61)){ -return; -} -this.set(this.select(function(_62){ -return _62!=_61; -}).join(" ")); -},toString:function(){ -return this.toArray().join(" "); -}}; -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=0){ -opt=_41.options[index]; -_42=opt.value; -if(!_42&&!("value" in opt)){ -_42=opt.text; -} -} -return [_41.name,_42]; -},selectMany:function(_43){ -var _44=new Array(); -for(var i=0;i<_43.length;i++){ -var opt=_43.options[i]; -if(opt.selected){ -var _46=opt.value; -if(!_46&&!("value" in opt)){ -_46=opt.text; -} -_44.push(_46); -} -} -return [_43.name,_44]; -}}; -var $F=Form.Element.getValue; -Abstract.TimedObserver=function(){ -}; -Abstract.TimedObserver.prototype={initialize:function(_47,_48,_49){ -this.frequency=_48; -this.element=$(_47); -this.callback=_49; -this.lastValue=this.getValue(); -this.registerCallback(); -},registerCallback:function(){ -setInterval(this.onTimerEvent.bind(this),this.frequency*1000); -},onTimerEvent:function(){ -var _50=this.getValue(); -if(this.lastValue!=_50){ -this.callback(this.element,_50); -this.lastValue=_50; -} -}}; -Form.Element.Observer=Class.create(); -Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){ -return Form.Element.getValue(this.element); -}}); -Form.Observer=Class.create(); -Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){ -return Form.serialize(this.element); -}}); -Abstract.EventObserver=function(){ -}; -Abstract.EventObserver.prototype={initialize:function(_51,_52){ -this.element=$(_51); -this.callback=_52; -this.lastValue=this.getValue(); -if(this.element.tagName.toLowerCase()=="form"){ -this.registerFormCallbacks(); -}else{ -this.registerCallback(this.element); -} -},onElementEvent:function(){ -var _53=this.getValue(); -if(this.lastValue!=_53){ -this.callback(this.element,_53); -this.lastValue=_53; -} -},registerFormCallbacks:function(){ -var _54=Form.getElements(this.element); -for(var i=0;i<_54.length;i++){ -this.registerCallback(_54[i]); -} -},registerCallback:function(_55){ -if(_55.type){ -switch(_55.type.toLowerCase()){ -case "checkbox": -case "radio": -Event.observe(_55,"click",this.onElementEvent.bind(this)); -break; -case "password": -case "text": -case "textarea": -case "select-one": -case "select-multiple": -Event.observe(_55,"change",this.onElementEvent.bind(this)); -break; -} -} -}}; -Form.Element.EventObserver=Class.create(); -Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){ -return Form.Element.getValue(this.element); -}}); -Form.EventObserver=Class.create(); -Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){ -return Form.serialize(this.element); -}}); - -if(!window.Event){ -var Event=new Object(); -} -Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(_1){ -return _1.target||_1.srcElement; -},isLeftClick:function(_2){ -return (((_2.which)&&(_2.which==1))||((_2.button)&&(_2.button==1))); -},pointerX:function(_3){ -return _3.pageX||(_3.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)); -},pointerY:function(_4){ -return _4.pageY||(_4.clientY+(document.documentElement.scrollTop||document.body.scrollTop)); -},stop:function(_5){ -if(_5.preventDefault){ -_5.preventDefault(); -_5.stopPropagation(); -}else{ -_5.returnValue=false; -_5.cancelBubble=true; -} -},findElement:function(_6,_7){ -var _8=Event.element(_6); -while(_8.parentNode&&(!_8.tagName||(_8.tagName.toUpperCase()!=_7.toUpperCase()))){ -_8=_8.parentNode; -} -return _8; -},observers:false,_observeAndCache:function(_9,_10,_11,_12){ -if(!this.observers){ -this.observers=[]; -} -if(_9.addEventListener){ -this.observers.push([_9,_10,_11,_12]); -_9.addEventListener(_10,_11,_12); -}else{ -if(_9.attachEvent){ -this.observers.push([_9,_10,_11,_12]); -_9.attachEvent("on"+_10,_11); -} -} -},unloadCache:function(){ -if(!Event.observers){ -return; -} -for(var i=0;i0)||_8.attachEvent)){ -_9="keydown"; -} -this._observeAndCache(_8,_9,_10,_11); -}}); - -var Position={includeScrollOffsets:false,prepare:function(){ -this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0; -this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0; -},realOffset:function(_1){ -var _2=0,valueL=0; -do{ -_2+=_1.scrollTop||0; -valueL+=_1.scrollLeft||0; -_1=_1.parentNode; -}while(_1); -return [valueL,_2]; -},cumulativeOffset:function(_3){ -var _4=0,valueL=0; -do{ -_4+=_3.offsetTop||0; -valueL+=_3.offsetLeft||0; -_3=_3.offsetParent; -}while(_3); -return [valueL,_4]; -},positionedOffset:function(_5){ -var _6=0,valueL=0; -do{ -_6+=_5.offsetTop||0; -valueL+=_5.offsetLeft||0; -_5=_5.offsetParent; -if(_5){ -p=Element.getStyle(_5,"position"); -if(p=="relative"||p=="absolute"){ -break; -} -} -}while(_5); -return [valueL,_6]; -},offsetParent:function(_7){ -if(_7.offsetParent){ -return _7.offsetParent; -} -if(_7==document.body){ -return _7; -} -while((_7=_7.parentNode)&&_7!=document.body){ -if(Element.getStyle(_7,"position")!="static"){ -return _7; -} -} -return document.body; -},within:function(_8,x,y){ -if(this.includeScrollOffsets){ -return this.withinIncludingScrolloffsets(_8,x,y); -} -this.xcomp=x; -this.ycomp=y; -this.offset=this.cumulativeOffset(_8); -return (y>=this.offset[1]&&y=this.offset[0]&&x=this.offset[1]&&this.ycomp=this.offset[0]&&this.xcomp-1){ -var _6=token.split("#"); -var _7=_6[0]; -var id=_6[1]; -var _9=document.getElementById(id); -if(_7&&_9.nodeName.toLowerCase()!=_7){ -return new Array(); -} -_4=new Array(_9); -continue; -} -if(token.indexOf(".")>-1){ -var _6=token.split("."); -var _7=_6[0]; -var _10=_6[1]; -if(!_7){ -_7="*"; -} -var _11=new Array; -var _12=0; -for(var h=0;h<_4.length;h++){ -var _14; -if(_7=="*"){ -_14=getAllChildren(_4[h]); -}else{ -_14=_4[h].getElementsByTagName(_7); -} -for(var j=0;j<_14.length;j++){ -_11[_12++]=_14[j]; -} -} -_4=new Array; -var _16=0; -for(var k=0;k<_11.length;k++){ -if(_11[k].className&&_11[k].className.match(new RegExp("\\b"+_10+"\\b"))){ -_4[_16++]=_11[k]; -} -} -continue; -} -if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){ -var _7=RegExp.$1; -var _18=RegExp.$2; -var _19=RegExp.$3; -var _20=RegExp.$4; -if(!_7){ -_7="*"; -} -var _11=new Array; -var _12=0; -for(var h=0;h<_4.length;h++){ -var _14; -if(_7=="*"){ -_14=getAllChildren(_4[h]); -}else{ -_14=_4[h].getElementsByTagName(_7); -} -for(var j=0;j<_14.length;j++){ -_11[_12++]=_14[j]; -} -} -_4=new Array; -var _16=0; -var _21; -switch(_19){ -case "=": -_21=function(e){ -return (e.getAttribute(_18)==_20); -}; -break; -case "~": -_21=function(e){ -return (e.getAttribute(_18).match(new RegExp("\\b"+_20+"\\b"))); -}; -break; -case "|": -_21=function(e){ -return (e.getAttribute(_18).match(new RegExp("^"+_20+"-?"))); -}; -break; -case "^": -_21=function(e){ -return (e.getAttribute(_18).indexOf(_20)==0); -}; -break; -case "$": -_21=function(e){ -return (e.getAttribute(_18).lastIndexOf(_20)==e.getAttribute(_18).length-_20.length); -}; -break; -case "*": -_21=function(e){ -return (e.getAttribute(_18).indexOf(_20)>-1); -}; -break; -default: -_21=function(e){ -return e.getAttribute(_18); -}; -} -_4=new Array; -var _16=0; -for(var k=0;k<_11.length;k++){ -if(_21(_11[k])){ -_4[_16++]=_11[k]; -} -} -continue; -} -_7=token; -var _11=new Array; -var _12=0; -for(var h=0;h<_4.length;h++){ -var _14=_4[h].getElementsByTagName(_7); -for(var j=0;j<_14.length;j++){ -_11[_12++]=_14[j]; -} -} -_4=_11; -} -return _4; -}; - -var Behaviour={list:new Array,register:function(_1){ -Behaviour.list.push(_1); -},start:function(){ -Event.OnLoad(Behaviour.apply); -},apply:function(){ -for(h=0;sheet=Behaviour.list[h];h++){ -for(selector in sheet){ -list=document.getElementsBySelector(selector); -if(!list){ -continue; -} -for(i=0;element=list[i];i++){ -sheet[selector](element); -} -} -} -}}; -Behaviour.start(); - -Object.debug=function(_1){ -var _2=[]; -if(typeof _1 in ["string","number"]){ -return _1; -}else{ -for(property in _1){ -if(typeof _1[property]!="function"){ -_2.push(property+" => "+(typeof _1[property]=="string"?"\""+_1[property]+"\"":_1[property])); -} -} -} -return ("'"+_1+"' #"+typeof _1+": {"+_2.join(", ")+"}"); -}; -String.prototype.toArray=function(){ -var _3=[]; -for(var i=0;i"; -var _8=_7.firstChild||null; -if(_8&&(_8.tagName!=_5)){ -_8=_8.getElementsByTagName(_5)[0]; -} -if(!_8){ -_8=document.createElement(_5); -} -if(!_8){ -return; -} -if(arguments[1]){ -if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)){ -this._children(_8,arguments[1]); -}else{ -var _9=this._attributes(arguments[1]); -if(_9.length){ -_7.innerHTML="<"+_5+" "+_9+">"; -_8=_7.firstChild||null; -if(!_8){ -_8=document.createElement(_5); -for(attr in arguments[1]){ -_8[attr=="class"?"className":attr]=arguments[1][attr]; -} -} -if(_8.tagName!=_5){ -_8=_7.getElementsByTagName(_5)[0]; -} -} -} -} -if(arguments[2]){ -this._children(_8,arguments[2]); -} -return _8; -},_text:function(_10){ -return document.createTextNode(_10); -},_attributes:function(_11){ -var _12=[]; -for(attribute in _11){ -_12.push((attribute=="className"?"class":attribute)+"=\""+_11[attribute].toString().escapeHTML()+"\""); -} -return _12.join(" "); -},_children:function(_13,_14){ -if(typeof _14=="object"){ -_14.flatten().each(function(e){ -if(typeof e=="object"){ -_13.appendChild(e); -}else{ -if(Builder._isStringOrNumber(e)){ -_13.appendChild(Builder._text(e)); -} -} -}); -}else{ -if(Builder._isStringOrNumber(_14)){ -_13.appendChild(Builder._text(_14)); -} -} -},_isStringOrNumber:function(_16){ -return (typeof _16=="string"||typeof _16=="number"); -}}; -String.prototype.camelize=function(){ -var _17=this.split("-"); -if(_17.length==1){ -return _17[0]; -} -var ret=this.indexOf("-")==0?_17[0].charAt(0).toUpperCase()+_17[0].substring(1):_17[0]; -for(var i=1,len=_17.length;i0){ -window.scrollBy(0,0); -} -}; -Element.getOpacity=function(_37){ -var _38; -if(_38=Element.getStyle(_37,"opacity")){ -return parseFloat(_38); -} -if(_38=(Element.getStyle(_37,"filter")||"").match(/alpha\(opacity=(.*)\)/)){ -if(_38[1]){ -return parseFloat(_38[1])/100; -} -} -return 1; -}; -Element.setOpacity=function(_39,_40){ -_39=$(_39); -var els=_39.style; -if(_40==1){ -els.opacity="0.999999"; -if(/MSIE/.test(navigator.userAgent)){ -els.filter=Element.getStyle(_39,"filter").replace(/alpha\([^\)]*\)/gi,""); -} -}else{ -if(_40<0.00001){ -_40=0; -} -els.opacity=_40; -if(/MSIE/.test(navigator.userAgent)){ -els.filter=Element.getStyle(_39,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_40*100+")"; -} -} -}; -Element.getInlineOpacity=function(_42){ -_42=$(_42); -var op; -op=_42.style.opacity; -if(typeof op!="undefined"&&op!=""){ -return op; -} -return ""; -}; -Element.setInlineOpacity=function(_44,_45){ -_44=$(_44); -var els=_44.style; -els.opacity=_45; -}; -Element.getDimensions=function(_46){ -_46=$(_46); -if(Element.getStyle(_46,"display")=="none"){ -var els=_46.style; -var _47=els.visibility; -var _48=els.position; -els.visibility="hidden"; -els.position="absolute"; -els.display=""; -var _49=_46.clientWidth; -var _50=_46.clientHeight; -els.display="none"; -els.position=_48; -els.visibility=_47; -return {width:_49,height:_50}; -} -return {width:_46.offsetWidth,height:_46.offsetHeight}; -}; -Position.positionedOffset=function(_51){ -var _52=0,valueL=0; -do{ -_52+=_51.offsetTop||0; -valueL+=_51.offsetLeft||0; -_51=_51.offsetParent; -if(_51){ -p=Element.getStyle(_51,"position"); -if(p=="relative"||p=="absolute"){ -break; -} -} -}while(_51); -return [valueL,_52]; -}; -if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){ -Position.cumulativeOffset=function(_53){ -var _54=0,valueL=0; -do{ -_54+=_53.offsetTop||0; -valueL+=_53.offsetLeft||0; -if(_53.offsetParent==document.body){ -if(Element.getStyle(_53,"position")=="absolute"){ -break; -} -} -_53=_53.offsetParent; -}while(_53); -return [valueL,_54]; -}; -} -Position.page=function(_55){ -var _56=0,valueL=0; -var _57=_55; -do{ -_56+=_57.offsetTop||0; -valueL+=_57.offsetLeft||0; -if(_57.offsetParent==document.body){ -if(Element.getStyle(_57,"position")=="absolute"){ -break; -} -} -}while(_57=_57.offsetParent); -_57=_55; -do{ -_56-=_57.scrollTop||0; -valueL-=_57.scrollLeft||0; -}while(_57=_57.parentNode); -return [valueL,_56]; -}; -Position.offsetParent=function(_58){ -if(_58.offsetParent){ -return _58.offsetParent; -} -if(_58==document.body){ -return _58; -} -while((_58=_58.parentNode)&&_58!=document.body){ -if(Element.getStyle(_58,"position")!="static"){ -return _58; -} -} -return document.body; -}; -Position.clone=function(_59,_60){ -var _61=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{}); -_59=$(_59); -var p=Position.page(_59); -_60=$(_60); -var _63=[0,0]; -var _64=null; -if(Element.getStyle(_60,"position")=="absolute"){ -_64=Position.offsetParent(_60); -_63=Position.page(_64); -} -if(_64==document.body){ -_63[0]-=document.body.offsetLeft; -_63[1]-=document.body.offsetTop; -} -if(_61.setLeft){ -_60.style.left=(p[0]-_63[0]+_61.offsetLeft)+"px"; -} -if(_61.setTop){ -_60.style.top=(p[1]-_63[1]+_61.offsetTop)+"px"; -} -if(_61.setWidth){ -_60.style.width=_59.offsetWidth+"px"; -} -if(_61.setHeight){ -_60.style.height=_59.offsetHeight+"px"; -} -}; -Position.absolutize=function(_65){ -_65=$(_65); -if(_65.style.position=="absolute"){ -return; -} -Position.prepare(); -var _66=Position.positionedOffset(_65); -var top=_66[1]; -var _68=_66[0]; -var _69=_65.clientWidth; -var _70=_65.clientHeight; -_65._originalLeft=_68-parseFloat(_65.style.left||0); -_65._originalTop=top-parseFloat(_65.style.top||0); -_65._originalWidth=_65.style.width; -_65._originalHeight=_65.style.height; -_65.style.position="absolute"; -_65.style.top=top+"px"; -_65.style.left=_68+"px"; -_65.style.width=_69+"px"; -_65.style.height=_70+"px"; -}; -Position.relativize=function(_71){ -_71=$(_71); -if(_71.style.position=="relative"){ -return; -} -Position.prepare(); -_71.style.position="relative"; -var top=parseFloat(_71.style.top||0)-(_71._originalTop||0); -var _72=parseFloat(_71.style.left||0)-(_71._originalLeft||0); -_71.style.top=top+"px"; -_71.style.left=_72+"px"; -_71.style.height=_71._originalHeight; -_71.style.width=_71._originalWidth; -}; -Element.Class={toggle:function(_73,_74){ -if(Element.Class.has(_73,_74)){ -Element.Class.remove(_73,_74); -if(arguments.length==3){ -Element.Class.add(_73,arguments[2]); -} -}else{ -Element.Class.add(_73,_74); -if(arguments.length==3){ -Element.Class.remove(_73,arguments[2]); -} -} -},get:function(_75){ -return $(_75).className.split(" "); -},remove:function(_76){ -_76=$(_76); -var _77=arguments; -$R(1,arguments.length-1).each(function(_78){ -_76.className=_76.className.split(" ").reject(function(_79){ -return (_79==_77[_78]); -}).join(" "); -}); -},add:function(_80){ -_80=$(_80); -for(var i=1;i0?" ":"")+arguments[i]; -} -},has:function(_81){ -_81=$(_81); -if(!_81||!_81.className){ -return false; -} -var _82; -for(var i=1;i=_18;x--){ -var _21=str.substring(i,i+x); -if(_21.length<_18){ -return null; -} -if(_12(_21)){ -return _21; -} -} -return null; -}; -var _22=0; -var _23=0; -var c=""; -var _25=""; -var _26=""; -var x,y; -var now=new Date(); -var _28=now.getFullYear(); -var _29=now.getMonth()+1; -var _30=1; -while(_23<_11.length){ -c=_11.charAt(_23); -_25=""; -while((_11.charAt(_23)==c)&&(_23<_11.length)){ -_25+=_11.charAt(_23++); -} -if(_25=="yyyy"||_25=="yy"||_25=="y"){ -if(_25=="yyyy"){ -x=4; -y=4; -} -if(_25=="yy"){ -x=2; -y=2; -} -if(_25=="y"){ -x=2; -y=4; -} -_28=_16(val,_22,x,y); -if(_28==null){ -return null; -} -_22+=_28.length; -if(_28.length==2){ -if(_28>70){ -_28=1900+(_28-0); -}else{ -_28=2000+(_28-0); -} -} -}else{ -if(_25=="MM"||_25=="M"){ -_29=_16(val,_22,_25.length,2); -if(_29==null||(_29<1)||(_29>12)){ -return null; -} -_22+=_29.length; -}else{ -if(_25=="dd"||_25=="d"){ -_30=_16(val,_22,_25.length,2); -if(_30==null||(_30<1)||(_30>31)){ -return null; -} -_22+=_30.length; -}else{ -if(val.substring(_22,_22+_25.length)!=_25){ -return null; -}else{ -_22+=_25.length; -} -} -} -} -} -if(_22!=val.length){ -return null; -} -if(_29==2){ -if(((_28%4==0)&&(_28%100!=0))||(_28%400==0)){ -if(_30>29){ -return null; -} -}else{ -if(_30>28){ -return null; -} -} -} -if((_29==4)||(_29==6)||(_29==9)||(_29==11)){ -if(_30>30){ -return null; -} -} -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.length0?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){ -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); -}; -Prado.Util.trim=function(_19){ -if(!isString(_19)){ -return ""; -} -return _19.replace(/^\s+|\s+$/g,""); -}; - 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.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/prado.js b/framework/Web/Javascripts/js/prado.js new file mode 100644 index 00000000..6df4abd0 --- /dev/null +++ b/framework/Web/Javascripts/js/prado.js @@ -0,0 +1,2381 @@ +var Prototype={Version:"1.4.0",ScriptFragment:"(?:)((\n|\r|.)*?)(?:)",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;i0&&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]+>/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;i0?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 ab?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 "#"; +}}; +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"; +}}; +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"; +return $A(div.childNodes[0].childNodes[0].childNodes); +}}; +var Insertion=new Object(); +Insertion.Before=Class.create(); +Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){ +this.range.setStartBefore(this.element); +},insertContent:function(_48){ +_48.each((function(_49){ +this.element.parentNode.insertBefore(_49,this.element); +}).bind(this)); +}}); +Insertion.Top=Class.create(); +Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){ +this.range.selectNodeContents(this.element); +this.range.collapse(true); +},insertContent:function(_50){ +_50.reverse(false).each((function(_51){ +this.element.insertBefore(_51,this.element.firstChild); +}).bind(this)); +}}); +Insertion.Bottom=Class.create(); +Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){ +this.range.selectNodeContents(this.element); +this.range.collapse(this.element); +},insertContent:function(_52){ +_52.each((function(_53){ +this.element.appendChild(_53); +}).bind(this)); +}}); +Insertion.After=Class.create(); +Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){ +this.range.setStartAfter(this.element); +},insertContent:function(_54){ +_54.each((function(_55){ +this.element.parentNode.insertBefore(_55,this.element.nextSibling); +}).bind(this)); +}}); +Element.ClassNames=Class.create(); +Element.ClassNames.prototype={initialize:function(_56){ +this.element=$(_56); +},_each:function(_57){ +this.element.className.split(/\s+/).select(function(_58){ +return _58.length>0; +})._each(_57); +},set:function(_59){ +this.element.className=_59; +},add:function(_60){ +if(this.include(_60)){ +return; +} +this.set(this.toArray().concat(_60).join(" ")); +},remove:function(_61){ +if(!this.include(_61)){ +return; +} +this.set(this.select(function(_62){ +return _62!=_61; +}).join(" ")); +},toString:function(){ +return this.toArray().join(" "); +}}; +Object.extend(Element.ClassNames.prototype,Enumerable); + +Object.extend(Element,{condClassName:function(_1,_2,_3){ +(_3?Element.addClassName:Element.removeClassName)(_1,_2); +}}); + +var Field={clear:function(){ +for(var i=0;i=0){ +opt=_41.options[index]; +_42=opt.value; +if(!_42&&!("value" in opt)){ +_42=opt.text; +} +} +return [_41.name,_42]; +},selectMany:function(_43){ +var _44=new Array(); +for(var i=0;i<_43.length;i++){ +var opt=_43.options[i]; +if(opt.selected){ +var _46=opt.value; +if(!_46&&!("value" in opt)){ +_46=opt.text; +} +_44.push(_46); +} +} +return [_43.name,_44]; +}}; +var $F=Form.Element.getValue; +Abstract.TimedObserver=function(){ +}; +Abstract.TimedObserver.prototype={initialize:function(_47,_48,_49){ +this.frequency=_48; +this.element=$(_47); +this.callback=_49; +this.lastValue=this.getValue(); +this.registerCallback(); +},registerCallback:function(){ +setInterval(this.onTimerEvent.bind(this),this.frequency*1000); +},onTimerEvent:function(){ +var _50=this.getValue(); +if(this.lastValue!=_50){ +this.callback(this.element,_50); +this.lastValue=_50; +} +}}; +Form.Element.Observer=Class.create(); +Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){ +return Form.Element.getValue(this.element); +}}); +Form.Observer=Class.create(); +Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){ +return Form.serialize(this.element); +}}); +Abstract.EventObserver=function(){ +}; +Abstract.EventObserver.prototype={initialize:function(_51,_52){ +this.element=$(_51); +this.callback=_52; +this.lastValue=this.getValue(); +if(this.element.tagName.toLowerCase()=="form"){ +this.registerFormCallbacks(); +}else{ +this.registerCallback(this.element); +} +},onElementEvent:function(){ +var _53=this.getValue(); +if(this.lastValue!=_53){ +this.callback(this.element,_53); +this.lastValue=_53; +} +},registerFormCallbacks:function(){ +var _54=Form.getElements(this.element); +for(var i=0;i<_54.length;i++){ +this.registerCallback(_54[i]); +} +},registerCallback:function(_55){ +if(_55.type){ +switch(_55.type.toLowerCase()){ +case "checkbox": +case "radio": +Event.observe(_55,"click",this.onElementEvent.bind(this)); +break; +case "password": +case "text": +case "textarea": +case "select-one": +case "select-multiple": +Event.observe(_55,"change",this.onElementEvent.bind(this)); +break; +} +} +}}; +Form.Element.EventObserver=Class.create(); +Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){ +return Form.Element.getValue(this.element); +}}); +Form.EventObserver=Class.create(); +Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){ +return Form.serialize(this.element); +}}); + +if(!window.Event){ +var Event=new Object(); +} +Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(_1){ +return _1.target||_1.srcElement; +},isLeftClick:function(_2){ +return (((_2.which)&&(_2.which==1))||((_2.button)&&(_2.button==1))); +},pointerX:function(_3){ +return _3.pageX||(_3.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)); +},pointerY:function(_4){ +return _4.pageY||(_4.clientY+(document.documentElement.scrollTop||document.body.scrollTop)); +},stop:function(_5){ +if(_5.preventDefault){ +_5.preventDefault(); +_5.stopPropagation(); +}else{ +_5.returnValue=false; +_5.cancelBubble=true; +} +},findElement:function(_6,_7){ +var _8=Event.element(_6); +while(_8.parentNode&&(!_8.tagName||(_8.tagName.toUpperCase()!=_7.toUpperCase()))){ +_8=_8.parentNode; +} +return _8; +},observers:false,_observeAndCache:function(_9,_10,_11,_12){ +if(!this.observers){ +this.observers=[]; +} +if(_9.addEventListener){ +this.observers.push([_9,_10,_11,_12]); +_9.addEventListener(_10,_11,_12); +}else{ +if(_9.attachEvent){ +this.observers.push([_9,_10,_11,_12]); +_9.attachEvent("on"+_10,_11); +} +} +},unloadCache:function(){ +if(!Event.observers){ +return; +} +for(var i=0;i0)||_8.attachEvent)){ +_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(){ +this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0; +this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0; +},realOffset:function(_1){ +var _2=0,valueL=0; +do{ +_2+=_1.scrollTop||0; +valueL+=_1.scrollLeft||0; +_1=_1.parentNode; +}while(_1); +return [valueL,_2]; +},cumulativeOffset:function(_3){ +var _4=0,valueL=0; +do{ +_4+=_3.offsetTop||0; +valueL+=_3.offsetLeft||0; +_3=_3.offsetParent; +}while(_3); +return [valueL,_4]; +},positionedOffset:function(_5){ +var _6=0,valueL=0; +do{ +_6+=_5.offsetTop||0; +valueL+=_5.offsetLeft||0; +_5=_5.offsetParent; +if(_5){ +p=Element.getStyle(_5,"position"); +if(p=="relative"||p=="absolute"){ +break; +} +} +}while(_5); +return [valueL,_6]; +},offsetParent:function(_7){ +if(_7.offsetParent){ +return _7.offsetParent; +} +if(_7==document.body){ +return _7; +} +while((_7=_7.parentNode)&&_7!=document.body){ +if(Element.getStyle(_7,"position")!="static"){ +return _7; +} +} +return document.body; +},within:function(_8,x,y){ +if(this.includeScrollOffsets){ +return this.withinIncludingScrolloffsets(_8,x,y); +} +this.xcomp=x; +this.ycomp=y; +this.offset=this.cumulativeOffset(_8); +return (y>=this.offset[1]&&y=this.offset[0]&&x=this.offset[1]&&this.ycomp=this.offset[0]&&this.xcomp-1){ +var _6=token.split("#"); +var _7=_6[0]; +var id=_6[1]; +var _9=document.getElementById(id); +if(_7&&_9.nodeName.toLowerCase()!=_7){ +return new Array(); +} +_4=new Array(_9); +continue; +} +if(token.indexOf(".")>-1){ +var _6=token.split("."); +var _7=_6[0]; +var _10=_6[1]; +if(!_7){ +_7="*"; +} +var _11=new Array; +var _12=0; +for(var h=0;h<_4.length;h++){ +var _14; +if(_7=="*"){ +_14=getAllChildren(_4[h]); +}else{ +_14=_4[h].getElementsByTagName(_7); +} +for(var j=0;j<_14.length;j++){ +_11[_12++]=_14[j]; +} +} +_4=new Array; +var _16=0; +for(var k=0;k<_11.length;k++){ +if(_11[k].className&&_11[k].className.match(new RegExp("\\b"+_10+"\\b"))){ +_4[_16++]=_11[k]; +} +} +continue; +} +if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){ +var _7=RegExp.$1; +var _18=RegExp.$2; +var _19=RegExp.$3; +var _20=RegExp.$4; +if(!_7){ +_7="*"; +} +var _11=new Array; +var _12=0; +for(var h=0;h<_4.length;h++){ +var _14; +if(_7=="*"){ +_14=getAllChildren(_4[h]); +}else{ +_14=_4[h].getElementsByTagName(_7); +} +for(var j=0;j<_14.length;j++){ +_11[_12++]=_14[j]; +} +} +_4=new Array; +var _16=0; +var _21; +switch(_19){ +case "=": +_21=function(e){ +return (e.getAttribute(_18)==_20); +}; +break; +case "~": +_21=function(e){ +return (e.getAttribute(_18).match(new RegExp("\\b"+_20+"\\b"))); +}; +break; +case "|": +_21=function(e){ +return (e.getAttribute(_18).match(new RegExp("^"+_20+"-?"))); +}; +break; +case "^": +_21=function(e){ +return (e.getAttribute(_18).indexOf(_20)==0); +}; +break; +case "$": +_21=function(e){ +return (e.getAttribute(_18).lastIndexOf(_20)==e.getAttribute(_18).length-_20.length); +}; +break; +case "*": +_21=function(e){ +return (e.getAttribute(_18).indexOf(_20)>-1); +}; +break; +default: +_21=function(e){ +return e.getAttribute(_18); +}; +} +_4=new Array; +var _16=0; +for(var k=0;k<_11.length;k++){ +if(_21(_11[k])){ +_4[_16++]=_11[k]; +} +} +continue; +} +_7=token; +var _11=new Array; +var _12=0; +for(var h=0;h<_4.length;h++){ +var _14=_4[h].getElementsByTagName(_7); +for(var j=0;j<_14.length;j++){ +_11[_12++]=_14[j]; +} +} +_4=_11; +} +return _4; +}; + +var Behaviour={list:new Array,register:function(_1){ +Behaviour.list.push(_1); +},start:function(){ +Event.OnLoad(Behaviour.apply); +},apply:function(){ +for(h=0;sheet=Behaviour.list[h];h++){ +for(selector in sheet){ +list=document.getElementsBySelector(selector); +if(!list){ +continue; +} +for(i=0;element=list[i];i++){ +sheet[selector](element); +} +} +} +}}; +Behaviour.start(); + +Object.debug=function(_1){ +var _2=[]; +if(typeof _1 in ["string","number"]){ +return _1; +}else{ +for(property in _1){ +if(typeof _1[property]!="function"){ +_2.push(property+" => "+(typeof _1[property]=="string"?"\""+_1[property]+"\"":_1[property])); +} +} +} +return ("'"+_1+"' #"+typeof _1+": {"+_2.join(", ")+"}"); +}; +String.prototype.toArray=function(){ +var _3=[]; +for(var i=0;i"; +var _8=_7.firstChild||null; +if(_8&&(_8.tagName!=_5)){ +_8=_8.getElementsByTagName(_5)[0]; +} +if(!_8){ +_8=document.createElement(_5); +} +if(!_8){ +return; +} +if(arguments[1]){ +if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)){ +this._children(_8,arguments[1]); +}else{ +var _9=this._attributes(arguments[1]); +if(_9.length){ +_7.innerHTML="<"+_5+" "+_9+">"; +_8=_7.firstChild||null; +if(!_8){ +_8=document.createElement(_5); +for(attr in arguments[1]){ +_8[attr=="class"?"className":attr]=arguments[1][attr]; +} +} +if(_8.tagName!=_5){ +_8=_7.getElementsByTagName(_5)[0]; +} +} +} +} +if(arguments[2]){ +this._children(_8,arguments[2]); +} +return _8; +},_text:function(_10){ +return document.createTextNode(_10); +},_attributes:function(_11){ +var _12=[]; +for(attribute in _11){ +_12.push((attribute=="className"?"class":attribute)+"=\""+_11[attribute].toString().escapeHTML()+"\""); +} +return _12.join(" "); +},_children:function(_13,_14){ +if(typeof _14=="object"){ +_14.flatten().each(function(e){ +if(typeof e=="object"){ +_13.appendChild(e); +}else{ +if(Builder._isStringOrNumber(e)){ +_13.appendChild(Builder._text(e)); +} +} +}); +}else{ +if(Builder._isStringOrNumber(_14)){ +_13.appendChild(Builder._text(_14)); +} +} +},_isStringOrNumber:function(_16){ +return (typeof _16=="string"||typeof _16=="number"); +}}; +String.prototype.camelize=function(){ +var _17=this.split("-"); +if(_17.length==1){ +return _17[0]; +} +var ret=this.indexOf("-")==0?_17[0].charAt(0).toUpperCase()+_17[0].substring(1):_17[0]; +for(var i=1,len=_17.length;i0){ +window.scrollBy(0,0); +} +}; +Element.getOpacity=function(_37){ +var _38; +if(_38=Element.getStyle(_37,"opacity")){ +return parseFloat(_38); +} +if(_38=(Element.getStyle(_37,"filter")||"").match(/alpha\(opacity=(.*)\)/)){ +if(_38[1]){ +return parseFloat(_38[1])/100; +} +} +return 1; +}; +Element.setOpacity=function(_39,_40){ +_39=$(_39); +var els=_39.style; +if(_40==1){ +els.opacity="0.999999"; +if(/MSIE/.test(navigator.userAgent)){ +els.filter=Element.getStyle(_39,"filter").replace(/alpha\([^\)]*\)/gi,""); +} +}else{ +if(_40<0.00001){ +_40=0; +} +els.opacity=_40; +if(/MSIE/.test(navigator.userAgent)){ +els.filter=Element.getStyle(_39,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_40*100+")"; +} +} +}; +Element.getInlineOpacity=function(_42){ +_42=$(_42); +var op; +op=_42.style.opacity; +if(typeof op!="undefined"&&op!=""){ +return op; +} +return ""; +}; +Element.setInlineOpacity=function(_44,_45){ +_44=$(_44); +var els=_44.style; +els.opacity=_45; +}; +Element.getDimensions=function(_46){ +_46=$(_46); +if(Element.getStyle(_46,"display")=="none"){ +var els=_46.style; +var _47=els.visibility; +var _48=els.position; +els.visibility="hidden"; +els.position="absolute"; +els.display=""; +var _49=_46.clientWidth; +var _50=_46.clientHeight; +els.display="none"; +els.position=_48; +els.visibility=_47; +return {width:_49,height:_50}; +} +return {width:_46.offsetWidth,height:_46.offsetHeight}; +}; +Position.positionedOffset=function(_51){ +var _52=0,valueL=0; +do{ +_52+=_51.offsetTop||0; +valueL+=_51.offsetLeft||0; +_51=_51.offsetParent; +if(_51){ +p=Element.getStyle(_51,"position"); +if(p=="relative"||p=="absolute"){ +break; +} +} +}while(_51); +return [valueL,_52]; +}; +if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){ +Position.cumulativeOffset=function(_53){ +var _54=0,valueL=0; +do{ +_54+=_53.offsetTop||0; +valueL+=_53.offsetLeft||0; +if(_53.offsetParent==document.body){ +if(Element.getStyle(_53,"position")=="absolute"){ +break; +} +} +_53=_53.offsetParent; +}while(_53); +return [valueL,_54]; +}; +} +Position.page=function(_55){ +var _56=0,valueL=0; +var _57=_55; +do{ +_56+=_57.offsetTop||0; +valueL+=_57.offsetLeft||0; +if(_57.offsetParent==document.body){ +if(Element.getStyle(_57,"position")=="absolute"){ +break; +} +} +}while(_57=_57.offsetParent); +_57=_55; +do{ +_56-=_57.scrollTop||0; +valueL-=_57.scrollLeft||0; +}while(_57=_57.parentNode); +return [valueL,_56]; +}; +Position.offsetParent=function(_58){ +if(_58.offsetParent){ +return _58.offsetParent; +} +if(_58==document.body){ +return _58; +} +while((_58=_58.parentNode)&&_58!=document.body){ +if(Element.getStyle(_58,"position")!="static"){ +return _58; +} +} +return document.body; +}; +Position.clone=function(_59,_60){ +var _61=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{}); +_59=$(_59); +var p=Position.page(_59); +_60=$(_60); +var _63=[0,0]; +var _64=null; +if(Element.getStyle(_60,"position")=="absolute"){ +_64=Position.offsetParent(_60); +_63=Position.page(_64); +} +if(_64==document.body){ +_63[0]-=document.body.offsetLeft; +_63[1]-=document.body.offsetTop; +} +if(_61.setLeft){ +_60.style.left=(p[0]-_63[0]+_61.offsetLeft)+"px"; +} +if(_61.setTop){ +_60.style.top=(p[1]-_63[1]+_61.offsetTop)+"px"; +} +if(_61.setWidth){ +_60.style.width=_59.offsetWidth+"px"; +} +if(_61.setHeight){ +_60.style.height=_59.offsetHeight+"px"; +} +}; +Position.absolutize=function(_65){ +_65=$(_65); +if(_65.style.position=="absolute"){ +return; +} +Position.prepare(); +var _66=Position.positionedOffset(_65); +var top=_66[1]; +var _68=_66[0]; +var _69=_65.clientWidth; +var _70=_65.clientHeight; +_65._originalLeft=_68-parseFloat(_65.style.left||0); +_65._originalTop=top-parseFloat(_65.style.top||0); +_65._originalWidth=_65.style.width; +_65._originalHeight=_65.style.height; +_65.style.position="absolute"; +_65.style.top=top+"px"; +_65.style.left=_68+"px"; +_65.style.width=_69+"px"; +_65.style.height=_70+"px"; +}; +Position.relativize=function(_71){ +_71=$(_71); +if(_71.style.position=="relative"){ +return; +} +Position.prepare(); +_71.style.position="relative"; +var top=parseFloat(_71.style.top||0)-(_71._originalTop||0); +var _72=parseFloat(_71.style.left||0)-(_71._originalLeft||0); +_71.style.top=top+"px"; +_71.style.left=_72+"px"; +_71.style.height=_71._originalHeight; +_71.style.width=_71._originalWidth; +}; +Element.Class={toggle:function(_73,_74){ +if(Element.Class.has(_73,_74)){ +Element.Class.remove(_73,_74); +if(arguments.length==3){ +Element.Class.add(_73,arguments[2]); +} +}else{ +Element.Class.add(_73,_74); +if(arguments.length==3){ +Element.Class.remove(_73,arguments[2]); +} +} +},get:function(_75){ +return $(_75).className.split(" "); +},remove:function(_76){ +_76=$(_76); +var _77=arguments; +$R(1,arguments.length-1).each(function(_78){ +_76.className=_76.className.split(" ").reject(function(_79){ +return (_79==_77[_78]); +}).join(" "); +}); +},add:function(_80){ +_80=$(_80); +for(var i=1;i0?" ":"")+arguments[i]; +} +},has:function(_81){ +_81=$(_81); +if(!_81||!_81.className){ +return false; +} +var _82; +for(var i=1;i=_18;x--){ +var _21=str.substring(i,i+x); +if(_21.length<_18){ +return null; +} +if(_12(_21)){ +return _21; +} +} +return null; +}; +var _22=0; +var _23=0; +var c=""; +var _25=""; +var _26=""; +var x,y; +var now=new Date(); +var _28=now.getFullYear(); +var _29=now.getMonth()+1; +var _30=1; +while(_23<_11.length){ +c=_11.charAt(_23); +_25=""; +while((_11.charAt(_23)==c)&&(_23<_11.length)){ +_25+=_11.charAt(_23++); +} +if(_25=="yyyy"||_25=="yy"||_25=="y"){ +if(_25=="yyyy"){ +x=4; +y=4; +} +if(_25=="yy"){ +x=2; +y=2; +} +if(_25=="y"){ +x=2; +y=4; +} +_28=_16(val,_22,x,y); +if(_28==null){ +return null; +} +_22+=_28.length; +if(_28.length==2){ +if(_28>70){ +_28=1900+(_28-0); +}else{ +_28=2000+(_28-0); +} +} +}else{ +if(_25=="MM"||_25=="M"){ +_29=_16(val,_22,_25.length,2); +if(_29==null||(_29<1)||(_29>12)){ +return null; +} +_22+=_29.length; +}else{ +if(_25=="dd"||_25=="d"){ +_30=_16(val,_22,_25.length,2); +if(_30==null||(_30<1)||(_30>31)){ +return null; +} +_22+=_30.length; +}else{ +if(val.substring(_22,_22+_25.length)!=_25){ +return null; +}else{ +_22+=_25.length; +} +} +} +} +} +if(_22!=val.length){ +return null; +} +if(_29==2){ +if(((_28%4==0)&&(_28%100!=0))||(_28%400==0)){ +if(_30>29){ +return null; +} +}else{ +if(_30>28){ +return null; +} +} +} +if((_29==4)||(_29==6)||(_29==9)||(_29==11)){ +if(_30>30){ +return null; +} +} +var _31=new Date(_28,_29-1,_30,0,0,0); +return _31; +}}); + +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){ +} +} +}; +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; +}; +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(); +} +}; + +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;ithis.length){ +return false; +} +for(var i=0,n=0;i=this.accordionTabs.length){ +this.options.onLoadShowTab=0; +} +for(var i=0;i0.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"+el.innerHTML+""; +},_roundTopCorners:function(el,_91,_92){ +var _93=this._createCorner(_92); +for(var i=0;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=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;ithis.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.lengththis.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.startPos)&&(_275+this.metaData.getPageSize()<=this.endPos()); +},isNearingTopLimit:function(_276){ +return _276-this.startPos=this.startPos){ +var _282=this.maxFetchSize+_280; +if(_282>this.metaData.totalRows){ +_282=this.metaData.totalRows; +} +_281=_282-_280; +if(_280==0&&_281this.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_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;i0; +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,"

    "); +this.table.previousSibling.appendChild(this.table); +new Insertion.Before(this.table,"
    "); +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"+"   "; +} +},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="  "; +}else{ +if(_348==Rico.TableColumn.SORT_DESC){ +_349.innerHTML="  "; +} +} +} +},getSortedColumnIndex:function(){ +var cols=this.options.columns; +for(var i=0;ithis.length){ +return false; +} +for(var i=0,n=0;i=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.lengththis.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