diff options
Diffstat (limited to 'framework/Web/Javascripts/js/compressed')
-rw-r--r-- | framework/Web/Javascripts/js/compressed/ajax.js | 363 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/compressed/clientscripts.php | 2 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/compressed/prado.js | 222 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/compressed/rico.js | 265 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/compressed/validator.js | 53 |
5 files changed, 89 insertions, 816 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js deleted file mode 100644 index 5bf062d9..00000000 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ /dev/null @@ -1,363 +0,0 @@ - -var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},activeRequestCount:0} -Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responderToAdd){if(!this.include(responderToAdd)) -this.responders.push(responderToAdd);},unregister:function(responderToRemove){this.responders=this.responders.without(responderToRemove);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;},onComplete:function(){Ajax.activeRequestCount--;}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',parameters:''} -Object.extend(this.options,options||{});},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);},responseIsFailure:function(){return!this.responseIsSuccess();}} -Ajax.Request=Class.create();Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize:function(url,options){this.transport=Ajax.getTransport();this.setOptions(options);this.request(url);},request:function(url){var parameters=this.options.parameters||'';if(parameters.length>0)parameters+='&_=';try{this.url=url;if(this.options.method=='get'&¶meters.length>0) -this.url+=(this.url.match(/\?/)?'&':'?')+parameters;Ajax.Responders.dispatch('onCreate',this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);setTimeout((function(){this.respondToReadyState(1)}).bind(this),10);} -this.setRequestHeaders();var body=this.options.postBody?this.options.postBody:parameters;this.transport.send(this.options.method=='post'?body:null);}catch(e){this.dispatchException(e);}},setRequestHeaders:function(){var requestHeaders=['X-Requested-With','XMLHttpRequest','X-Prototype-Version',Prototype.Version,'Accept','text/javascript, text/html, application/xml, text/xml'];if(this.options.method=='post'){requestHeaders.push('Content-type',this.options.contentType);if(this.transport.overrideMimeType) -requestHeaders.push('Connection','close');} -if(this.options.requestHeaders) -requestHeaders.push.apply(requestHeaders,this.options.requestHeaders);for(var i=0;i<requestHeaders.length;i+=2) -this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);},onStateChange:function(){var readyState=this.transport.readyState;if(readyState!=1) -this.respondToReadyState(this.transport.readyState);},header:function(name){try{return this.transport.getResponseHeader(name);}catch(e){}},evalJSON:function(){try{return eval('('+this.header('X-JSON')+')');}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText);}catch(e){this.dispatchException(e);}},respondToReadyState:function(readyState){var event=Ajax.Request.Events[readyState];var transport=this.transport,json=this.evalJSON();if(event=='Complete'){try{(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||Prototype.emptyFunction)(transport,json);}catch(e){this.dispatchException(e);} -if((this.header('Content-type')||'').match(/^text\/javascript/i)) -this.evalResponse();} -try{(this.options['on'+event]||Prototype.emptyFunction)(transport,json);Ajax.Responders.dispatch('on'+event,this,transport,json);}catch(e){this.dispatchException(e);} -if(event=='Complete') -this.transport.onreadystatechange=Prototype.emptyFunction;},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(container,url,options){this.containers={success:container.success?$(container.success):$(container),failure:container.failure?$(container.failure):(container.success?null:$(container))} -this.transport=Ajax.getTransport();this.setOptions(options);var onComplete=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(transport,object){this.updateContent();onComplete(transport,object);}).bind(this);this.request(url);},updateContent:function(){var receiver=this.responseIsSuccess()?this.containers.success:this.containers.failure;var response=this.transport.responseText;if(!this.options.evalScripts) -response=response.stripScripts();if(receiver){if(this.options.insertion){new this.options.insertion(receiver,response);}else{Element.update(receiver,response);}} -if(this.responseIsSuccess()){if(this.onComplete) -setTimeout(this.onComplete.bind(this),10);}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(container,url,options){this.setOptions(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(request){if(this.options.decay){this.decay=(request.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=request.responseText;} -this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});Object.extend(Ajax.Request.prototype,{respondToReadyState:function(readyState) -{var event=Ajax.Request.Events[readyState];var transport=this.transport,json=this.getBodyDataPart(Prado.CallbackRequest.DATA_HEADER);if(event=='Complete') -{var redirectUrl=this.getBodyContentPart(Prado.CallbackRequest.REDIRECT_HEADER);if(redirectUrl) -document.location.href=redirectUrl;if((this.header('Content-type')||'').match(/^text\/javascript/i)) -{try -{json=eval('('+transport.responseText+')');}catch(e) -{if(typeof(json)=="string") -json=Prado.CallbackRequest.decode(result);}} -try -{Prado.CallbackRequest.updatePageState(this,transport);Ajax.Responders.dispatch('on'+transport.status,this,transport,json);Prado.CallbackRequest.dispatchActions(transport,this.getBodyDataPart(Prado.CallbackRequest.ACTION_HEADER));(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||Prototype.emptyFunction)(this,json);}catch(e){this.dispatchException(e);}} -try{(this.options['on'+event]||Prototype.emptyFunction)(this,json);Ajax.Responders.dispatch('on'+event,this,transport,json);}catch(e){this.dispatchException(e);} -if(event=='Complete') -this.transport.onreadystatechange=Prototype.emptyFunction;},getHeaderData:function(name) -{return this.getJsonData(this.header(name));},getBodyContentPart:function(name) -{if(typeof(this.transport.responseText)=="string") -return Prado.Element.extractContent(this.transport.responseText,name);},getJsonData:function(json) -{try -{return eval('('+json+')');} -catch(e) -{if(typeof(json)=="string") -return Prado.CallbackRequest.decode(json);}},getBodyDataPart:function(name) -{return this.getJsonData(this.getBodyContentPart(name));}});Prado.CallbackRequest=Class.create();Object.extend(Prado.CallbackRequest,{FIELD_CALLBACK_TARGET:'PRADO_CALLBACK_TARGET',FIELD_CALLBACK_PARAMETER:'PRADO_CALLBACK_PARAMETER',FIELD_CALLBACK_PAGESTATE:'PRADO_PAGESTATE',FIELD_POSTBACK_TARGET:'PRADO_POSTBACK_TARGET',FIELD_POSTBACK_PARAMETER:'PRADO_POSTBACK_PARAMETER',PostDataLoaders:[],DATA_HEADER:'X-PRADO-DATA',ACTION_HEADER:'X-PRADO-ACTIONS',ERROR_HEADER:'X-PRADO-ERROR',PAGESTATE_HEADER:'X-PRADO-PAGESTATE',REDIRECT_HEADER:'X-PRADO-REDIRECT',requestQueue:[],requests:{},getRequestById:function(id) -{var requests=Prado.CallbackRequest.requests;if(typeof(requests[id])!="undefined") -return requests[id];},dispatch:function(id) -{var requests=Prado.CallbackRequest.requests;if(typeof(requests[id])!="undefined") -requests[id].dispatch();},addPostLoaders:function(ids) -{var self=Prado.CallbackRequest;self.PostDataLoaders=self.PostDataLoaders.concat(ids);var list=[];self.PostDataLoaders.each(function(id) -{if(list.indexOf(id)<0) -list.push(id);});self.PostDataLoaders=list;},dispatchActions:function(transport,actions) -{var self=Prado.CallbackRequest;if(actions&&actions.length>0) -actions.each(self.__run.bind(self,transport));},__run:function(transport,command) -{var self=Prado.CallbackRequest;self.transport=transport;for(var method in command) -{try -{method.toFunction().apply(self,command[method]);} -catch(e) -{if(typeof(Logger)!="undefined") -self.Exception.onException(null,e);}}},Exception:{"on500":function(request,transport,data) -{var e=request.getHeaderData(Prado.CallbackRequest.ERROR_HEADER);Logger.error("Callback Server Error "+e.code,this.formatException(e));},'on200':function(request,transport,data) -{if(transport.status<500) -{var msg='HTTP '+transport.status+" with response : \n";if(transport.responseText.trim().length>0) -{var f=RegExp('(<!--X-PRADO[^>]+-->)([\\s\\S\\w\\W]*)(<!--//X-PRADO[^>]+-->)',"m");msg+=transport.responseText.replace(f,'')+"\n";} -if(typeof(data)!="undefined"&&data!=null) -msg+="Data : \n"+inspect(data)+"\n";data=request.getBodyDataPart(Prado.CallbackRequest.ACTION_HEADER);if(data&&data.length>0) -{msg+="Actions : \n";data.each(function(action) -{msg+=inspect(action)+"\n";});} -Logger.info(msg);}},onException:function(request,e) -{msg="";$H(e).each(function(item) -{msg+=item.key+": "+item.value+"\n";}) -Logger.error('Uncaught Callback Client Exception:',msg);},formatException:function(e) -{var msg=e.type+" with message \""+e.message+"\"";msg+=" in "+e.file+"("+e.line+")\n";msg+="Stack trace:\n";var trace=e.trace;for(var i=0;i<trace.length;i++) -{msg+=" #"+i+" "+trace[i].file;msg+="("+trace[i].line+"): ";msg+=trace[i]["class"]+"->"+trace[i]["function"]+"()"+"\n";} -msg+=e.version+" "+e.time+"\n";return msg;}},encode:function(data) -{return Prado.JSON.stringify(data);},decode:function(data) -{if(typeof(data)=="string"&&data.trim().length>0) -return Prado.JSON.parse(data);else -return null;},dispatchNormalRequest:function(callback) -{new Ajax.Request(callback.url,callback.options);return true;},tryNextRequest:function() -{var self=Prado.CallbackRequest;if(typeof(self.currentRequest)=='undefined'||self.currentRequest==null) -{if(self.requestQueue.length>0) -return self.dispatchQueue();}},updatePageState:function(request,transport) -{var self=Prado.CallbackRequest;var pagestate=$(self.FIELD_CALLBACK_PAGESTATE);var enabled=request.options.EnablePageStateUpdate&&request.options.HasPriority;var aborted=self.currentRequest==null;if(enabled&&!aborted&&pagestate) -{var data=request.getBodyContentPart(self.PAGESTATE_HEADER);if(typeof(data)=="string"&&data.length>0) -pagestate.value=data;else -{if(typeof(Logger)!="undefined") -Logger.warn("Missing page state:"+data);self.endCurrentRequest();return false;}} -self.endCurrentRequest();return true;},enqueue:function(callback) -{var self=Prado.CallbackRequest;self.requestQueue.push(callback);self.tryNextRequest();},dispatchQueue:function() -{var self=Prado.CallbackRequest;var callback=self.requestQueue.shift();self.currentRequest=callback;callback.options.postBody=callback._getPostData(),callback.request=new Ajax.Request(callback.url,callback.options);callback.timeout=setTimeout(function() -{self.abortRequest(callback.id);},callback.options.RequestTimeOut);},endCurrentRequest:function() -{var self=Prado.CallbackRequest;clearTimeout(self.currentRequest.timeout);self.currentRequest=null;},abortRequest:function(id) -{var self=Prado.CallbackRequest;if(typeof(self.currentRequest)!='undefined'&&self.currentRequest!=null&&self.currentRequest.id==id) -{var request=self.currentRequest.request;if(request.transport.readyState<4) -request.transport.abort();self.endCurrentRequest();} -self.tryNextRequest();}}) -Ajax.Responders.register({onComplete:function(request) -{if(request.options.HasPriority) -Prado.CallbackRequest.tryNextRequest();}});Event.OnLoad(function() -{if(typeof Logger!="undefined") -Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackRequest.prototype={initialize:function(id,options) -{this.url=this.getCallbackUrl();this.request=null;this.Enabled=true;this.id=id;if(typeof(id)=="string") -Prado.CallbackRequest.requests[id]=this;this.options=Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{});},getCallbackUrl:function() -{return $('PRADO_PAGESTATE').form.action;},setCallbackParameter:function(value) -{this.options['params']=value;},getCallbackParameter:function() -{return this.options['params'];},setRequestTimeOut:function(timeout) -{this.options['RequestTimeOut']=timeout;},getRequestTimeOut:function() -{return this.options['RequestTimeOut'];},setCausesValidation:function(validate) -{this.options['CausesValidation']=validate;},getCausesValidation:function() -{return this.options['CausesValidation'];},setValidationGroup:function(group) -{this.options['ValidationGroup']=group;},getValidationGroup:function() -{return this.options['ValidationGroup'];},dispatch:function() -{if(typeof tinyMCE!="undefined") -tinyMCE.triggerSave();Object.extend(this.options,{parameters:''});if(this.options.CausesValidation&&typeof(Prado.Validation)!="undefined") -{var form=this.options.Form||Prado.Validation.getForm();if(Prado.Validation.validate(form,this.options.ValidationGroup,this)==false) -return false;} -if(this.options.onPreDispatch) -this.options.onPreDispatch(this,null);if(!this.Enabled) -return;if(this.options.HasPriority) -{return Prado.CallbackRequest.enqueue(this);} -else -return Prado.CallbackRequest.dispatchNormalRequest(this);},abort:function() -{return Prado.CallbackRequest.abortRequest(this.id);},_getPostData:function() -{var data={};var callback=Prado.CallbackRequest;if(this.options.PostInputs!=false) -{callback.PostDataLoaders.each(function(name) -{$A(document.getElementsByName(name)).each(function(element) -{if(element.type&&element.name==name) -{value=$F(element);if(typeof(value)!="undefined") -data[name]=value;}})})} -if(typeof(this.options.params)!="undefined") -data[callback.FIELD_CALLBACK_PARAMETER]=callback.encode(this.options.params);var pageState=$F(callback.FIELD_CALLBACK_PAGESTATE);if(typeof(pageState)!="undefined") -data[callback.FIELD_CALLBACK_PAGESTATE]=pageState;data[callback.FIELD_CALLBACK_TARGET]=this.id;if(this.options.EventTarget) -data[callback.FIELD_POSTBACK_TARGET]=this.options.EventTarget;if(this.options.EventParameter) -data[callback.FIELD_POSTBACK_PARAMETER]=this.options.EventParameter;return $H(data).toQueryString();}} -Prado.Callback=function(UniqueID,parameter,onSuccess,options) -{var callback={'params':parameter||'','onSuccess':onSuccess||Prototype.emptyFunction};Object.extend(callback,options||{});request=new Prado.CallbackRequest(UniqueID,callback);request.dispatch();return false;} -Array.prototype.______array='______array';Prado.JSON={org:'http://www.JSON.org',copyright:'(c)2005 JSON.org',license:'http://www.crockford.com/JSON/license.html',stringify:function(arg){var c,i,l,s='',v;switch(typeof arg){case'object':if(arg){if(arg.______array=='______array'){for(i=0;i<arg.length;++i){v=this.stringify(arg[i]);if(s){s+=',';} -s+=v;} -return'['+s+']';}else if(typeof arg.toString!='undefined'){for(i in arg){v=arg[i];if(typeof v!='undefined'&&typeof v!='function'){v=this.stringify(v);if(s){s+=',';} -s+=this.stringify(i)+':'+v;}} -return'{'+s+'}';}} -return'null';case'number':return isFinite(arg)?String(arg):'null';case'string':l=arg.length;s='"';for(i=0;i<l;i+=1){c=arg.charAt(i);if(c>=' '){if(c=='\\'||c=='"'){s+='\\';} -s+=c;}else{switch(c){case'\b':s+='\\b';break;case'\f':s+='\\f';break;case'\n':s+='\\n';break;case'\r':s+='\\r';break;case'\t':s+='\\t';break;default:c=c.charCodeAt();s+='\\u00'+Math.floor(c/16).toString(16)+ -(c%16).toString(16);}}} -return s+'"';case'boolean':return String(arg);default:return'null';}},parse:function(text){var at=0;var ch=' ';function error(m){throw{name:'JSONError',message:m,at:at-1,text:text};} -function next(){ch=text.charAt(at);at+=1;return ch;} -function white(){while(ch){if(ch<=' '){next();}else if(ch=='/'){switch(next()){case'/':while(next()&&ch!='\n'&&ch!='\r'){} -break;case'*':next();for(;;){if(ch){if(ch=='*'){if(next()=='/'){next();break;}}else{next();}}else{error("Unterminated comment");}} -break;default:error("Syntax error");}}else{break;}}} -function string(){var i,s='',t,u;if(ch=='"'){outer:while(next()){if(ch=='"'){next();return s;}else if(ch=='\\'){switch(next()){case'b':s+='\b';break;case'f':s+='\f';break;case'n':s+='\n';break;case'r':s+='\r';break;case't':s+='\t';break;case'u':u=0;for(i=0;i<4;i+=1){t=parseInt(next(),16);if(!isFinite(t)){break outer;} -u=u*16+t;} -s+=String.fromCharCode(u);break;default:s+=ch;}}else{s+=ch;}}} -error("Bad string");} -function array(){var a=[];if(ch=='['){next();white();if(ch==']'){next();return a;} -while(ch){a.push(value());white();if(ch==']'){next();return a;}else if(ch!=','){break;} -next();white();}} -error("Bad array");} -function object(){var k,o={};if(ch=='{'){next();white();if(ch=='}'){next();return o;} -while(ch){k=string();white();if(ch!=':'){break;} -next();o[k]=value();white();if(ch=='}'){next();return o;}else if(ch!=','){break;} -next();white();}} -error("Bad object");} -function number(){var n='',v;if(ch=='-'){n='-';next();} -while(ch>='0'&&ch<='9'){n+=ch;next();} -if(ch=='.'){n+='.';while(next()&&ch>='0'&&ch<='9'){n+=ch;}} -if(ch=='e'||ch=='E'){n+='e';next();if(ch=='-'||ch=='+'){n+=ch;next();} -while(ch>='0'&&ch<='9'){n+=ch;next();}} -v=+n;if(!isFinite(v)){}else{return v;}} -function word(){switch(ch){case't':if(next()=='r'&&next()=='u'&&next()=='e'){next();return true;} -break;case'f':if(next()=='a'&&next()=='l'&&next()=='s'&&next()=='e'){next();return false;} -break;case'n':if(next()=='u'&&next()=='l'&&next()=='l'){next();return null;} -break;} -error("Syntax error");} -function value(){white();switch(ch){case'{':return object();case'[':return array();case'"':return string();case'-':return number();default:return ch>='0'&&ch<='9'?number():word();}} -return value();}};if(typeof Effect=='undefined') -throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={} -Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(element,update,options){this.element=$(element);this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions) -this.setOptions(options);else -this.options=options||{};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(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});} -Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string') -this.options.tokens=new Array(this.options.tokens);this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(navigator.appVersion.indexOf('MSIE')>0)&&(navigator.userAgent.indexOf('Opera')<0)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');} -if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});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(event){if(this.active) -switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);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(event);return;case Event.KEY_DOWN:this.markNext();this.render();if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);return;} -else -if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(navigator.appVersion.indexOf('AppleWebKit')>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex) -{this.index=element.autocompleteIndex;this.render();} -Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++) -this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index-- -else this.index=this.entryCount-1;this.getEntry(this.index).scrollIntoView(true);},markNext:function(){if(this.index<this.entryCount-1)this.index++ -else this.index=0;this.getEntry(this.index).scrollIntoView(false);},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;} -var value='';if(this.options.select){var nodes=document.getElementsByClassName(this.options.select,selectedElement)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else -value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var lastTokenPos=this.findLastToken();if(lastTokenPos!=-1){var newValue=this.element.value.substr(0,lastTokenPos+1);var whitespace=this.element.value.substr(lastTokenPos+1).match(/^\s+/);if(whitespace) -newValue+=whitespace[0];this.element.value=newValue+value;}else{this.element.value=value;} -this.element.focus();if(this.options.afterUpdateElement) -this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.firstChild);if(this.update.firstChild&&this.update.firstChild.childNodes){this.entryCount=this.update.firstChild.childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;} -this.stopIndicator();this.index=0;this.render();}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.startIndicator();this.getUpdatedChoices();}else{this.active=false;this.hide();}},getToken:function(){var tokenPos=this.findLastToken();if(tokenPos!=-1) -var ret=this.element.value.substr(tokenPos+1).replace(/^\s+/,'').replace(/\s+$/,'');else -var ret=this.element.value;return/\n/.test(ret)?'':ret;},findLastToken:function(){var lastTokenPos=-1;for(var i=0;i<this.options.tokens.length;i++){var thisTokenPos=this.element.value.lastIndexOf(this.options.tokens[i]);if(thisTokenPos>lastTokenPos) -lastTokenPos=thisTokenPos;} -return lastTokenPos;}} -Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);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(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create();Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+ -elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+ -elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}} -foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}} -if(partial.length) -ret=ret.concat(partial.slice(0,instance.options.choices-ret.length)) -return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);} -Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(element,url,options){this.url=url;this.element=$(element);this.options=Object.extend({okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightcolor});},onFailure:function(transport){alert("Error communicating with the server: "+transport.responseText.stripTags());},callback:function(form){return Form.serialize(form);},handleLineBreaks:true,loadingText:'Loading...',savingClassName:'inplaceeditor-saving',loadingClassName:'inplaceeditor-loading',formClassName:'inplaceeditor-form',highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},options||{});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);if(!this.options.loadTextURL)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);} -if(this.options.okButton){okButton=document.createElement("input");okButton.type="submit";okButton.value=this.options.okText;okButton.className='editor_ok_button';this.form.appendChild(okButton);} -if(this.options.cancelLink){cancelLink=document.createElement("a");cancelLink.href="#";cancelLink.appendChild(document.createTextNode(this.options.cancelText));cancelLink.onclick=this.onclickCancel.bind(this);cancelLink.className='editor_cancel';this.form.appendChild(cancelLink);}},hasHTMLLineBreaks:function(string){if(!this.options.handleLineBreaks)return false;return string.match(/<br/i)||string.match(/<p>/i);},convertHTMLLineBreaks:function(string){return string.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"");},createEditField:function(){var text;if(this.options.loadTextURL){text=this.options.loadingText;}else{text=this.getText();} -var obj=this;if(this.options.rows==1&&!this.hasHTMLLineBreaks(text)){this.options.textarea=false;var textField=document.createElement("input");textField.obj=this;textField.type="text";textField.name="value";textField.value=text;textField.style.backgroundColor=this.options.highlightcolor;textField.className='editor_field';var size=this.options.size||this.options.cols||0;if(size!=0)textField.size=size;if(this.options.submitOnBlur) -textField.onblur=this.onSubmit.bind(this);this.editField=textField;}else{this.options.textarea=true;var textArea=document.createElement("textarea");textArea.obj=this;textArea.name="value";textArea.value=this.convertHTMLLineBreaks(text);textArea.rows=this.options.rows;textArea.cols=this.options.cols||40;textArea.className='editor_field';if(this.options.submitOnBlur) -textArea.onblur=this.onSubmit.bind(this);this.editField=textArea;} -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(transport){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=transport.responseText.stripTags();Field.scrollFreeActivate(this.editField);},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false;},onFailure:function(transport){this.options.onFailure(transport);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null;} -return false;},onSubmit:function(){var form=this.form;var value=this.editField.value;this.onLoading();if(this.options.evalScripts){new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(form,value),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions));}else{new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(form,value),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(transport){this.leaveEditMode();this.options.onComplete.bind(this)(transport,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);}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var selectTag=document.createElement("select");var collection=this.options.collection||[];var optionTag;collection.each(function(e,i){optionTag=document.createElement("option");optionTag.value=(e instanceof Array)?e[0]:e;if(this.options.value==optionTag.value)optionTag.selected=true;optionTag.appendChild(document.createTextNode((e instanceof Array)?e[1]:e));selectTag.appendChild(optionTag);}.bind(this));this.cached_selectTag=selectTag;} -this.editField=this.cached_selectTag;if(this.options.loadTextURL)this.loadExternalText();this.form.appendChild(this.editField);this.options.callback=function(form,value){return"value="+encodeURIComponent(value);}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){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));}};Prado.WebUI.CallbackControl=Class.extend(Prado.WebUI.PostBackControl,{onPostBack:function(event,options) -{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveLinkButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveImageButton=Class.extend(Prado.WebUI.TImageButton,{onPostBack:function(event,options) -{this.addXYInput(event,options);var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveCheckBox=Class.extend(Prado.WebUI.CallbackControl,{onPostBack:function(event,options) -{var request=new Prado.CallbackRequest(options.EventTarget,options);if(request.dispatch()==false) -Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveCheckBoxList=Base.extend({constructor:function(options) -{for(var i=0;i<options.ItemCount;i++) -{var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TActiveCheckBox(checkBoxOptions);}}});Prado.WebUI.TActiveRadioButtonList=Prado.WebUI.TActiveCheckBoxList;Prado.WebUI.TActiveTextBox=Class.extend(Prado.WebUI.TTextBox,{onInit:function(options) -{this.options=options;if(options['TextMode']!='MultiLine') -Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));if(this.options['AutoPostBack']==true) -Event.observe(this.element,"change",this.doCallback.bindEvent(this,options));},doCallback:function(event,options) -{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TAutoComplete=Class.extend(Autocompleter.Base,Prado.WebUI.TActiveTextBox.prototype);Prado.WebUI.TAutoComplete=Class.extend(Prado.WebUI.TAutoComplete,{initialize:function(options) -{this.options=options;this.baseInitialize(options.ID,options.ResultPanel,options);Object.extend(this.options,{onSuccess:this.onComplete.bind(this)});if(options.AutoPostBack) -this.onInit(options);},doCallback:function(event,options) -{if(!this.active) -{var request=new Prado.CallbackRequest(this.options.EventTarget,options);request.dispatch();Event.stop(event);}},onClick:function(event) -{var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();Event.fireEvent(this.element,"change");},getUpdatedChoices:function() -{var options=new Array(this.getToken(),"__TAutoComplete_onSuggest__");Prado.Callback(this.options.EventTarget,options,null,this.options);},onComplete:function(request,boundary) -{var result=Prado.Element.extractContent(request.transport.responseText,boundary);if(typeof(result)=="string"&&result.length>0) -this.updateChoices(result);}});Prado.WebUI.TTimeTriggeredCallback=Base.extend({constructor:function(options) -{this.options=Object.extend({Interval:1},options||{});Prado.WebUI.TTimeTriggeredCallback.register(this);},startTimer:function() -{setTimeout(this.onTimerEvent.bind(this),100);if(typeof(this.timer)=='undefined'||this.timer==null) -this.timer=setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);},stopTimer:function() -{if(typeof(this.timer)!='undefined') -{clearInterval(this.timer);this.timer=null;}},onTimerEvent:function() -{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();}},{timers:{},register:function(timer) -{Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID]=timer;},start:function(id) -{Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();},stop:function(id) -{Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options) -{this.element=$(options.ID);if(this.element) -{this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));}},doCallback:function(event) -{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options) -{this.options=options;var element=$(options['ControlID']);if(element) -Event.observe(element,this.getEventName(element),this.doCallback.bind(this));},getEventName:function(element) -{var name=this.options.EventName;if(typeof(name)=="undefined"&&element.type) -{switch(element.type.toLowerCase()) -{case'password':case'text':case'textarea':case'select-one':case'select-multiple':return'change';}} -return typeof(name)=="undefined"||name=="undefined"?'click':name;},doCallback:function(event) -{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();if(this.options.StopEvent==true) -Event.stop(event);}});Prado.WebUI.TValueTriggeredCallback=Base.extend({count:1,observing:true,constructor:function(options) -{this.options=options;this.options.PropertyName=this.options.PropertyName||'value';var element=$(options['ControlID']);this.value=element?element[this.options.PropertyName]:undefined;Prado.WebUI.TValueTriggeredCallback.register(this);this.startObserving();},stopObserving:function() -{clearTimeout(this.timer);this.observing=false;},startObserving:function() -{this.timer=setTimeout(this.checkChanges.bind(this),this.options.Interval*1000);},checkChanges:function() -{var element=$(this.options.ControlID);if(element) -{var value=element[this.options.PropertyName];if(this.value!=value) -{this.doCallback(this.value,value);this.value=value;this.count=1;} -else -this.count=this.count+this.options.Decay;if(this.observing) -this.time=setTimeout(this.checkChanges.bind(this),parseInt(this.options.Interval*1000*this.count));}},doCallback:function(oldValue,newValue) -{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);var param={'OldValue':oldValue,'NewValue':newValue};request.setCallbackParameter(param);request.dispatch();}},{timers:{},register:function(timer) -{Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID]=timer;},stop:function(id) -{Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options) -{this.options=Object.extend({LoadTextFromSource:false,TextMode:'SingleLine'},options||{});this.element=$(this.options.ID);Prado.WebUI.TInPlaceTextBox.register(this);this.createEditorInput();this.initializeListeners();},initializeListeners:function() -{this.onclickListener=this.enterEditMode.bindAsEventListener(this);Event.observe(this.element,'click',this.onclickListener);if(this.options.ExternalControl) -Event.observe($(this.options.ExternalControl),'click',this.onclickListener);},enterEditMode:function(evt) -{if(this.isSaving||this.isEditing)return;this.isEditing=true;this.onEnterEditMode();this.createEditorInput();this.showTextBox();this.editField.disabled=false;if(this.options.LoadTextOnEdit) -this.loadExternalText();Prado.Element.focus(this.editField);if(evt) -Event.stop(evt);return false;},exitEditMode:function(evt) -{this.isEditing=false;this.isSaving=false;this.editField.disabled=false;this.element.innerHTML=this.editField.value;this.showLabel();},showTextBox:function() -{Element.hide(this.element);Element.show(this.editField);},showLabel:function() -{Element.show(this.element);Element.hide(this.editField);},createEditorInput:function() -{if(this.editField==null) -this.createTextBox();this.editField.value=this.getText();},loadExternalText:function() -{this.editField.disabled=true;this.onLoadingText();options=new Array('__InlineEditor_loadExternalText__',this.getText());request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCausesValidation(false);request.setCallbackParameter(options);request.options.onSuccess=this.onloadExternalTextSuccess.bind(this);request.options.onFailure=this.onloadExternalTextFailure.bind(this);request.dispatch();},createTextBox:function() -{cssClass=this.element.className||'';inputName=this.options.EventTarget;options={'className':cssClass,name:inputName,id:this.options.TextBoxID};if(this.options.TextMode=='SingleLine') -{if(this.options.MaxLength>0) -options['maxlength']=this.options.MaxLength;this.editField=INPUT(options);} -else -{if(this.options.Rows>0) -options['rows']=this.options.Rows;if(this.options.Columns>0) -options['cols']=this.options.Columns;if(this.options.Wrap) -options['wrap']='off';this.editField=TEXTAREA(options);} -this.editField.style.display="none";this.element.parentNode.insertBefore(this.editField,this.element) -if(this.options.TextMode=='SingleLine') -{Event.observe(this.editField,"keydown",function(e) -{if(Event.keyCode(e)==Event.KEY_RETURN) -{var target=Event.element(e);if(target) -{Event.fireEvent(target,"blur");Event.stop(e);}}});} -Event.observe(this.editField,"blur",this.onTextBoxBlur.bind(this));},getText:function() -{return this.element.innerHTML;},onEnterEditMode:function() -{if(typeof(this.options.onEnterEditMode)=="function") -this.options.onEnterEditMode(this,null);},onTextBoxBlur:function(e) -{text=this.element.innerHTML;if(this.options.AutoPostBack&&text!=this.editField.value) -this.onTextChanged(text);else -{this.element.innerHTML=this.editField.value;this.isEditing=false;if(this.options.AutoHide) -this.showLabel();}},onTextChanged:function(text) -{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCallbackParameter(text);request.options.onSuccess=this.onTextChangedSuccess.bind(this);request.options.onFailure=this.onTextChangedFailure.bind(this);if(request.dispatch()) -{this.isSaving=true;this.editField.disabled=true;}},onLoadingText:function() -{},onloadExternalTextSuccess:function(request,parameter) -{this.isEditing=true;this.editField.disabled=false;this.editField.value=this.getText();Prado.Element.focus(this.editField);if(typeof(this.options.onSuccess)=="function") -this.options.onSuccess(sender,parameter);},onloadExternalTextFailure:function(request,parameter) -{this.isSaving=false;this.isEditing=false;this.showLabel();if(typeof(this.options.onFailure)=="function") -this.options.onFailure(sender,parameter);},onTextChangedSuccess:function(sender,parameter) -{this.isSaving=false;this.isEditing=false;if(this.options.AutoHide) -this.showLabel();this.element.innerHTML=parameter==null?this.editField.value:parameter;this.editField.disabled=false;if(typeof(this.options.onSuccess)=="function") -this.options.onSuccess(sender,parameter);},onTextChangedFailure:function(sender,parameter) -{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;if(typeof(this.options.onFailure)=="function") -this.options.onFailure(sender,parameter);}},{textboxes:{},register:function(obj) -{Prado.WebUI.TInPlaceTextBox.textboxes[obj.options.TextBoxID]=obj;},setDisplayTextBox:function(id,value) -{var textbox=Prado.WebUI.TInPlaceTextBox.textboxes[id];if(textbox) -{if(value) -textbox.enterEditMode(null);else -{textbox.exitEditMode(null);}}}});Prado.WebUI.TRatingList=Base.extend({selectedIndex:-1,rating:-1,enabled:true,readOnly:false,constructor:function(options) -{var cap=$(options.CaptionID);this.options=Object.extend({caption:cap?cap.innerHTML:''},options||{});Prado.WebUI.TRatingList.register(this);this._init();this.selectedIndex=options.SelectedIndex;this.rating=options.Rating;if(options.Rating<=0&&options.SelectedIndex>=0) -this.rating=options.SelectedIndex+1;this.showRating(this.rating);},_init:function(options) -{Element.addClassName($(this.options.ListID),this.options.Style);this.radios=new Array();var index=0;for(var i=0;i<this.options.ItemCount;i++) -{var radio=$(this.options.ListID+'_c'+i);var td=radio.parentNode;if(radio&&td.tagName.toLowerCase()=='td') -{this.radios.push(radio);Event.observe(td,"mouseover",this.hover.bindEvent(this,index));Event.observe(td,"mouseout",this.recover.bindEvent(this,index));Event.observe(td,"click",this.click.bindEvent(this,index));index++;Element.addClassName(td,"rating");}}},hover:function(ev,index) -{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) -{var node=this.radios[i].parentNode;var action=i<=index?'addClassName':'removeClassName' -Element[action](node,"rating_hover");Element.removeClassName(node,"rating_selected");Element.removeClassName(node,"rating_half");} -this.showCaption(this.getIndexCaption(index));},recover:function(ev,index) -{if(this.enabled==false)return;this.showRating(this.rating);this.showCaption(this.options.caption);},click:function(ev,index) -{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) -this.radios[i].checked=(i==index);this.selectedIndex=index;this.setRating(index+1);this.dispatchRequest(ev);},dispatchRequest:function(ev) -{var requestOptions=Object.extend({ID:this.options.ListID+"_c"+this.selectedIndex,EventTarget:this.options.ListName+"$c"+this.selectedIndex},this.options);var request=new Prado.CallbackRequest(requestOptions.EventTarget,requestOptions);if(request.dispatch()==false) -Event.stop(ev);},setRating:function(value) -{this.rating=value;var base=Math.floor(value-1);var remainder=value-base-1;var halfMax=this.options.HalfRating["1"];var index=remainder>halfMax?base+1:base;for(var i=0;i<this.radios.length;i++) -this.radios[i].checked=(i==index);var caption=this.getIndexCaption(index);this.setCaption(caption);this.showCaption(caption);this.showRating(value);},showRating:function(value) -{var base=Math.floor(value-1);var remainder=value-base-1;var halfMin=this.options.HalfRating["0"];var halfMax=this.options.HalfRating["1"];var index=remainder>halfMax?base+1:base;var hasHalf=remainder>=halfMin&&remainder<=halfMax;for(var i=0;i<this.radios.length;i++) -{var node=this.radios[i].parentNode;var action=i>index?'removeClassName':'addClassName';Element[action](node,"rating_selected");if(i==index+1&&hasHalf) -Element.addClassName(node,"rating_half");else -Element.removeClassName(node,"rating_half");Element.removeClassName(node,"rating_hover");}},getIndexCaption:function(index) -{return index>-1?this.radios[index].value:this.options.caption;},showCaption:function(value) -{var caption=$(this.options.CaptionID);if(caption)caption.innerHTML=value;$(this.options.ListID).title=value;},setCaption:function(value) -{this.options.caption=value;this.showCaption(value);},setEnabled:function(value) -{this.enabled=value;for(var i=0;i<this.radios.length;i++) -{var action=value?'removeClassName':'addClassName' -Element[action](this.radios[i].parentNode,"rating_disabled");}}},{ratings:{},register:function(rating) -{Prado.WebUI.TRatingList.ratings[rating.options.ListID]=rating;},setEnabled:function(id,value) -{Prado.WebUI.TRatingList.ratings[id].setEnabled(value);},setRating:function(id,value) -{Prado.WebUI.TRatingList.ratings[id].setRating(value);},setCaption:function(id,value) -{Prado.WebUI.TRatingList.ratings[id].setCaption(value);}});
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/compressed/clientscripts.php b/framework/Web/Javascripts/js/compressed/clientscripts.php index 3ac3b062..a0321bc2 100644 --- a/framework/Web/Javascripts/js/compressed/clientscripts.php +++ b/framework/Web/Javascripts/js/compressed/clientscripts.php @@ -12,7 +12,7 @@ $debugMode=(isset($_GET['mode']) && $_GET['mode']==='debug'); $expiresOffset = $debugMode ? -10000 : 3600 * 24 * 10; //no cache
//allowed libraries
-$library = array('prado', 'effects', 'ajax', 'validator', 'logger', 'datepicker', 'rico', 'colorpicker');
+$library = array('prado', 'effects', 'validator', 'logger', 'datepicker', 'colorpicker');
$param = isset($_GET['js']) ? $_GET['js'] : '';
diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index e0299c97..4a718d25 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -250,7 +250,12 @@ if(Builder._isStringOrNumber(e)) element.appendChild(Builder._text(e));});}else if(Builder._isStringOrNumber(children)) element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');},build:function(html){var element=this.node('div');$(element).update(html.strip());return element.down();},dump:function(scope){if(typeof scope!='object'&&typeof scope!='function')scope=window;var tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);tags.each(function(tag){scope[tag]=function(){return Builder.node.apply(Builder,[tag].concat($A(arguments)));}});}} -Function.prototype.bindEvent=function() +var Prado={Version:'3.1',Browser:function() +{var info={Version:"1.0"};var is_major=parseInt(navigator.appVersion);info.nver=is_major;info.ver=navigator.appVersion;info.agent=navigator.userAgent;info.dom=document.getElementById?1:0;info.opera=window.opera?1:0;info.ie5=(info.ver.indexOf("MSIE 5")>-1&&info.dom&&!info.opera)?1:0;info.ie6=(info.ver.indexOf("MSIE 6")>-1&&info.dom&&!info.opera)?1:0;info.ie4=(document.all&&!info.dom&&!info.opera)?1:0;info.ie=info.ie4||info.ie5||info.ie6;info.mac=info.agent.indexOf("Mac")>-1;info.ns6=(info.dom&&parseInt(info.ver)>=5)?1:0;info.ie3=(info.ver.indexOf("MSIE")&&(is_major<4));info.hotjava=(info.agent.toLowerCase().indexOf('hotjava')!=-1)?1:0;info.ns4=(document.layers&&!info.dom&&!info.hotjava)?1:0;info.bw=(info.ie6||info.ie5||info.ie4||info.ns4||info.ns6||info.opera);info.ver3=(info.hotjava||info.ie3);info.opera7=((info.agent.toLowerCase().indexOf('opera 7')>-1)||(info.agent.toLowerCase().indexOf('opera/7')>-1));info.operaOld=info.opera&&!info.opera7;return info;},ImportCss:function(doc,css_file) +{if(Prado.Browser().ie) +var styleSheet=doc.createStyleSheet(css_file);else +{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head")) +headArr[0].appendChild(elm);}}};Function.prototype.bindEvent=function() {var __method=this,args=$A(arguments),object=args.shift();return function(event) {return __method.apply(object,[event||window.event].concat(args));}} Class.extend=function(base,definition) @@ -259,7 +264,65 @@ Object.extend(component.prototype,definition);return component;} var Base=function(){if(arguments.length){if(this==window){Base.prototype.extend.call(arguments[0],arguments.callee.prototype);}else{this.extend(arguments[0]);}}};Base.version="1.0.2";Base.prototype={extend:function(source,value){var extend=Base.prototype.extend;if(arguments.length==2){var ancestor=this[source];if((ancestor instanceof Function)&&(value instanceof Function)&&ancestor.valueOf()!=value.valueOf()&&/\bbase\b/.test(value)){var method=value;value=function(){var previous=this.base;this.base=ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue;};value.valueOf=function(){return method;};value.toString=function(){return String(method);};} return this[source]=value;}else if(source){var _prototype={toSource:null};var _protected=["toString","valueOf"];if(Base._prototyping)_protected[2]="constructor";for(var i=0;(name=_protected[i]);i++){if(source[name]!=_prototype[name]){extend.call(this,name,source[name]);}} for(var name in source){if(!_prototype[name]){extend.call(this,name,source[name]);}}} -return this;},base:function(){}};Base.extend=function(_instance,_static){var extend=Base.prototype.extend;if(!_instance)_instance={};Base._prototyping=true;var _prototype=new this;extend.call(_prototype,_instance);var constructor=_prototype.constructor;_prototype.constructor=this;delete Base._prototyping;var klass=function(){if(!Base._prototyping)constructor.apply(this,arguments);this.constructor=klass;};klass.prototype=_prototype;klass.extend=this.extend;klass.implement=this.implement;klass.toString=function(){return String(constructor);};extend.call(klass,_static);var object=constructor?klass:_prototype;if(object.init instanceof Function)object.init();return object;};Base.implement=function(_interface){if(_interface instanceof Function)_interface=_interface.prototype;this.prototype.extend(_interface);};Object.extend(String.prototype,{pad:function(side,len,chr){if(!chr)chr=' ';var s=this;var left=side.toLowerCase()=='left';while(s.length<len)s=left?chr+s:s+chr;return s;},padLeft:function(len,chr){return this.pad('left',len,chr);},padRight:function(len,chr){return this.pad('right',len,chr);},zerofill:function(len){return this.padLeft(len,'0');},trim:function(){return this.replace(/^\s+|\s+$/g,'');},trimLeft:function(){return this.replace(/^\s+/,'');},trimRight:function(){return this.replace(/\s+$/,'');},toFunction:function() +return this;},base:function(){}};Base.extend=function(_instance,_static){var extend=Base.prototype.extend;if(!_instance)_instance={};Base._prototyping=true;var _prototype=new this;extend.call(_prototype,_instance);var constructor=_prototype.constructor;_prototype.constructor=this;delete Base._prototyping;var klass=function(){if(!Base._prototyping)constructor.apply(this,arguments);this.constructor=klass;};klass.prototype=_prototype;klass.extend=this.extend;klass.implement=this.implement;klass.toString=function(){return String(constructor);};extend.call(klass,_static);var object=constructor?klass:_prototype;if(object.init instanceof Function)object.init();return object;};Base.implement=function(_interface){if(_interface instanceof Function)_interface=_interface.prototype;this.prototype.extend(_interface);};Prado.PostBack=function(event,options) +{var form=$(options['FormID']);var canSubmit=true;if(options['CausesValidation']&&typeof(Prado.Validation)!="undefined") +{if(!Prado.Validation.validate(options['FormID'],options['ValidationGroup'],$(options['ID']))) +return Event.stop(event);} +if(options['PostBackUrl']&&options['PostBackUrl'].length>0) +form.action=options['PostBackUrl'];if(options['TrackFocus']) +{var lastFocus=$('PRADO_LASTFOCUS');if(lastFocus) +{var active=document.activeElement;if(active) +lastFocus.value=active.id;else +lastFocus.value=options['EventTarget'];}} +$('PRADO_POSTBACK_TARGET').value=options['EventTarget'];$('PRADO_POSTBACK_PARAMETER').value=options['EventParameter'];Event.stop(event);Event.fireEvent(form,"submit");} +Prado.Element={setValue:function(element,value) +{var el=$(element);if(el&&typeof(el.value)!="undefined") +el.value=value;},select:function(element,method,value) +{var el=$(element);var isList=element.indexOf('[]')>-1;if(!el&&!isList)return;method=isList?'check'+method:el.tagName.toLowerCase()+method;var selection=Prado.Element.Selection;if(isFunction(selection[method])) +selection[method](isList?element:el,value);},click:function(element) +{var el=$(element);if(el) +Event.fireEvent(el,'click');},setAttribute:function(element,attribute,value) +{var el=$(element);if(attribute=="disabled"&&value==false) +el.removeAttribute(attribute);else +el.setAttribute(attribute,value);},setOptions:function(element,options) +{var el=$(element);if(el&&el.tagName.toLowerCase()=="select") +{while(el.length>0) +el.remove(0);for(var i=0;i<options.length;i++) +el.options[el.options.length]=new Option(options[i][0],options[i][1]);}},focus:function(element) +{var obj=$(element);if(typeof(obj)!="undefined"&&typeof(obj.focus)!="undefined") +setTimeout(function(){obj.focus();},100);return false;}} +Prado.Element.Selection={inputValue:function(el,value) +{switch(el.type.toLowerCase()) +{case'checkbox':case'radio':return el.checked=value;}},selectValue:function(el,value) +{$A(el.options).each(function(option) +{option.selected=option.value==value;});},selectIndex:function(el,index) +{if(el.type=='select-one') +el.selectedIndex=index;else +{for(var i=0;i<el.length;i++) +{if(i==index) +el.options[i].selected=true;}}},selectClear:function(el) +{el.selectedIndex=-1;},selectAll:function(el) +{$A(el.options).each(function(option) +{option.selected=true;Logger.warn(option.value);});},selectInvert:function(el) +{$A(el.options).each(function(option) +{option.selected=!option.selected;});},checkValue:function(name,value) +{$A(document.getElementsByName(name)).each(function(el) +{el.checked=el.value==value});},checkIndex:function(name,index) +{var elements=$A(document.getElementsByName(name));for(var i=0;i<elements.length;i++) +{if(i==index) +elements[i].checked=true;}},checkClear:function(name) +{$A(document.getElementsByName(name)).each(function(el) +{el.checked=false;});},checkAll:function(name) +{$A(document.getElementsByName(name)).each(function(el) +{el.checked=true;});},checkInvert:function(name) +{$A(document.getElementsByName(name)).each(function(el) +{el.checked=!el.checked;});}};Object.extend(Builder,{exportTags:function() +{var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","CAPTION"];tags.each(function(tag) +{window[tag]=function() +{var args=$A(arguments);if(args.length==0) +return Builder.node(tag,null);if(args.length==1) +return Builder.node(tag,args[0]);if(args.length>1) +return Builder.node(tag,args.shift(),args);};});}});Builder.exportTags();Object.extend(String.prototype,{pad:function(side,len,chr){if(!chr)chr=' ';var s=this;var left=side.toLowerCase()=='left';while(s.length<len)s=left?chr+s:s+chr;return s;},padLeft:function(len,chr){return this.pad('left',len,chr);},padRight:function(len,chr){return this.pad('right',len,chr);},zerofill:function(len){return this.padLeft(len,'0');},trim:function(){return this.replace(/^\s+|\s+$/g,'');},trimLeft:function(){return this.replace(/^\s+/,'');},trimRight:function(){return this.replace(/\s+$/,'');},toFunction:function() {var commands=this.split(/\./);var command=window;commands.each(function(action) {if(command[new String(action)]) command=command[new String(action)];});if(typeof(command)=="function") @@ -279,16 +342,16 @@ return null;var intermed=m[2]+m[5];var cleanInput=m[1]+intermed.replace(new RegE {var w=document.addEventListener&&!window.addEventListener?document:window;Event.observe(w,'load',fn);},keyCode:function(e) {return e.keyCode!=null?e.keyCode:e.charCode},isHTMLEvent:function(type) {var events=['abort','blur','change','error','focus','load','reset','resize','scroll','select','submit','unload'];return events.include(type);},isMouseEvent:function(type) -{var events=['click','mousedown','mousemove','mouseout','mouseover','mouseup'];return events.include(type);},fireEvent:function(element,type,canBubble) -{canBubble=(typeof(canBubble)==undefined)?true:canBubble;element=$(element);if(type=="submit") +{var events=['click','mousedown','mousemove','mouseout','mouseover','mouseup'];return events.include(type);},fireEvent:function(element,type) +{element=$(element);if(type=="submit") return element.submit();if(document.createEvent) {if(Event.isHTMLEvent(type)) -{var event=document.createEvent('HTMLEvents');event.initEvent(type,canBubble,true);} +{var event=document.createEvent('HTMLEvents');event.initEvent(type,true,true);} else if(Event.isMouseEvent(type)) {var event=document.createEvent('MouseEvents');if(event.initMouseEvent) -{event.initMouseEvent(type,canBubble,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);} +{event.initMouseEvent(type,true,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);} else -{event.initEvent(type,canBubble,true);}} +{event.initEvent(type,true,true);}} element.dispatchEvent(event);} else if(document.createEventObject) {var evObj=document.createEventObject();element.fireEvent('on'+type,evObj);} @@ -333,118 +396,7 @@ if(month==2) else{if(date>28){return null;}}} if((month==4)||(month==6)||(month==9)||(month==11)) {if(date>30){return null;}} -var newdate=new Date(year,month-1,date,0,0,0);return newdate;}});Object.extend(Builder,{exportTags:function() -{var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","CAPTION"];tags.each(function(tag) -{window[tag]=function() -{var args=$A(arguments);if(args.length==0) -return Builder.node(tag,null);if(args.length==1) -return Builder.node(tag,args[0]);if(args.length>1) -return Builder.node(tag,args.shift(),args);};});}});Builder.exportTags();var Prado={Version:'3.1',Browser:function() -{var info={Version:"1.0"};var is_major=parseInt(navigator.appVersion);info.nver=is_major;info.ver=navigator.appVersion;info.agent=navigator.userAgent;info.dom=document.getElementById?1:0;info.opera=window.opera?1:0;info.ie5=(info.ver.indexOf("MSIE 5")>-1&&info.dom&&!info.opera)?1:0;info.ie6=(info.ver.indexOf("MSIE 6")>-1&&info.dom&&!info.opera)?1:0;info.ie4=(document.all&&!info.dom&&!info.opera)?1:0;info.ie=info.ie4||info.ie5||info.ie6;info.mac=info.agent.indexOf("Mac")>-1;info.ns6=(info.dom&&parseInt(info.ver)>=5)?1:0;info.ie3=(info.ver.indexOf("MSIE")&&(is_major<4));info.hotjava=(info.agent.toLowerCase().indexOf('hotjava')!=-1)?1:0;info.ns4=(document.layers&&!info.dom&&!info.hotjava)?1:0;info.bw=(info.ie6||info.ie5||info.ie4||info.ns4||info.ns6||info.opera);info.ver3=(info.hotjava||info.ie3);info.opera7=((info.agent.toLowerCase().indexOf('opera 7')>-1)||(info.agent.toLowerCase().indexOf('opera/7')>-1));info.operaOld=info.opera&&!info.opera7;return info;},ImportCss:function(doc,css_file) -{if(Prado.Browser().ie) -var styleSheet=doc.createStyleSheet(css_file);else -{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head")) -headArr[0].appendChild(elm);}}};Prado.PostBack=function(event,options) -{var form=$(options['FormID']);var canSubmit=true;if(options['CausesValidation']&&typeof(Prado.Validation)!="undefined") -{if(!Prado.Validation.validate(options['FormID'],options['ValidationGroup'],$(options['ID']))) -return Event.stop(event);} -if(options['PostBackUrl']&&options['PostBackUrl'].length>0) -form.action=options['PostBackUrl'];if(options['TrackFocus']) -{var lastFocus=$('PRADO_LASTFOCUS');if(lastFocus) -{var active=document.activeElement;if(active) -lastFocus.value=active.id;else -lastFocus.value=options['EventTarget'];}} -$('PRADO_POSTBACK_TARGET').value=options['EventTarget'];$('PRADO_POSTBACK_PARAMETER').value=options['EventParameter'];Event.stop(event);Event.fireEvent(form,"submit");} -Prado.Element={setValue:function(element,value) -{var el=$(element);if(el&&typeof(el.value)!="undefined") -el.value=value;},select:function(element,method,value,total) -{var el=$(element);if(!el)return;var selection=Prado.Element.Selection;if(typeof(selection[method])=="function") -{control=selection.isSelectable(el)?[el]:selection.getListElements(element,total);selection[method](control,value);}},click:function(element) -{var el=$(element);if(el) -Event.fireEvent(el,'click');},setAttribute:function(element,attribute,value) -{var el=$(element);if(!el)return;if((attribute=="disabled"||attribute=="multiple")&&value==false) -el.removeAttribute(attribute);else if(attribute.match(/^on/i)) -{try -{eval("(func = function(event){"+value+"})");el[attribute]=func;} -catch(e) -{throw"Error in evaluating '"+value+"' for attribute "+attribute+" for element "+element.id;}} -else -el.setAttribute(attribute,value);},setOptions:function(element,options) -{var el=$(element);if(!el)return;if(el&&el.tagName.toLowerCase()=="select") -{el.options.length=options.length;for(var i=0;i<options.length;i++) -el.options[i]=new Option(options[i][0],options[i][1]);}},focus:function(element) -{var obj=$(element);if(typeof(obj)!="undefined"&&typeof(obj.focus)!="undefined") -setTimeout(function(){obj.focus();},100);return false;},replace:function(element,method,content,boundary) -{if(boundary) -{result=Prado.Element.extractContent(this.transport.responseText,boundary);if(result!=null) -content=result;} -if(typeof(element)=="string") -{if($(element)) -method.toFunction().apply(this,[element,""+content]);} -else -{method.toFunction().apply(this,[""+content]);}},extractContent:function(text,boundary) -{var f=RegExp('(<!--'+boundary+'-->)([\\s\\S\\w\\W]*)(<!--//'+boundary+'-->)',"m");var result=text.match(f);if(result&&result.length>=2) -return result[2];else -return null;},evaluateScript:function(content) -{content.evalScripts();}} -Prado.Element.Selection={isSelectable:function(el) -{if(el&&el.type) -{switch(el.type.toLowerCase()) -{case'checkbox':case'radio':case'select':case'select-multiple':case'select-one':return true;}} -return false;},inputValue:function(el,value) -{switch(el.type.toLowerCase()) -{case'checkbox':case'radio':return el.checked=value;}},selectValue:function(elements,value) -{elements.each(function(el) -{$A(el.options).each(function(option) -{if(typeof(value)=="boolean") -options.selected=value;else if(option.value==value) -option.selected=true;});})},selectValues:function(elements,values) -{selection=this;values.each(function(value) -{selection.selectValue(elements,value);})},selectIndex:function(elements,index) -{elements.each(function(el) -{if(el.type.toLowerCase()=='select-one') -el.selectedIndex=index;else -{for(var i=0;i<el.length;i++) -{if(i==index) -el.options[i].selected=true;}}})},selectAll:function(elements) -{elements.each(function(el) -{if(el.type.toLowerCase()!='select-one') -{$A(el.options).each(function(option) -{option.selected=true;})}})},selectInvert:function(elements) -{elements.each(function(el) -{if(el.type.toLowerCase()!='select-one') -{$A(el.options).each(function(option) -{option.selected=!options.selected;})}})},selectIndices:function(elements,indices) -{selection=this;indices.each(function(index) -{selection.selectIndex(elements,index);})},selectClear:function(elements) -{elements.each(function(el) -{el.selectedIndex=-1;})},getListElements:function(element,total) -{elements=new Array();for(i=0;i<total;i++) -{el=$(element+"_c"+i);if(el) -elements.push(el);} -return elements;},checkValue:function(elements,value) -{elements.each(function(el) -{if(typeof(value)=="boolean") -el.checked=value;else if(el.value==value) -el.checked=true;});},checkValues:function(elements,values) -{selection=this;values.each(function(value) -{selection.checkValue(elements,value);})},checkIndex:function(elements,index) -{for(var i=0;i<elements.length;i++) -{if(i==index) -elements[i].checked=true;}},checkIndices:function(elements,indices) -{selection=this;indices.each(function(index) -{selection.checkIndex(elements,index);})},checkClear:function(elements) -{elements.each(function(el) -{el.checked=false;});},checkAll:function(elements) -{elements.each(function(el) -{el.checked=true;})},checkInvert:function(elements) -{elements.each(function(el) -{el.checked!=el.checked;})}};Prado.Element.Insert={append:function(element,content) -{new Insertion.Bottom(element,content);},prepend:function(element,content) -{new Insertion.Top(element,content);},after:function(element,content) -{new Insertion.After(element,content);},before:function(element,content) -{new Insertion.Before(element,content);}} -Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={initialize:function(options) +var newdate=new Date(year,month-1,date,0,0,0);return newdate;}});Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={initialize:function(options) {this._elementOnClick=null,this.element=$(options.ID);if(this.element) {if(this.onInit) this.onInit(options);}},onInit:function(options) @@ -501,34 +453,4 @@ window.clipboardData.setData("Text",text);},hover:function(obj) {for(var i=0;i<options.ItemCount;i++) {var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TCheckBox(checkBoxOptions);}}});Prado.WebUI.TRadioButtonList=Base.extend({constructor:function(options) {for(var i=0;i<options.ItemCount;i++) -{var radioButtonOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TRadioButton(radioButtonOptions);}}});Prado.WebUI.TRatingList=Base.extend({selectedIndex:-1,rating:-1,enabled:true,readOnly:false,constructor:function(options) -{var cap=$(options.CaptionID);this.options=Object.extend({caption:cap?cap.innerHTML:''},options||{});Prado.WebUI.TRatingList.register(this);this._init();this.selectedIndex=options.SelectedIndex;this.rating=options.Rating;if(options.Rating<=0&&options.SelectedIndex>=0) -this.rating=options.SelectedIndex+1;this.showRating(this.rating);},_init:function(options) -{Element.addClassName($(this.options.ListID),this.options.Style);this.radios=new Array();var index=0;for(var i=0;i<this.options.ItemCount;i++) -{var radio=$(this.options.ListID+'_c'+i);var td=radio.parentNode;if(radio&&td.tagName.toLowerCase()=='td') -{this.radios.push(radio);Event.observe(td,"mouseover",this.hover.bindEvent(this,index));Event.observe(td,"mouseout",this.recover.bindEvent(this,index));Event.observe(td,"click",this.click.bindEvent(this,index));index++;Element.addClassName(td,"rating");}}},hover:function(ev,index) -{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) -{var node=this.radios[i].parentNode;var action=i<=index?'addClassName':'removeClassName' -Element[action](node,"rating_hover");Element.removeClassName(node,"rating_selected");Element.removeClassName(node,"rating_half");} -this.showCaption(this.getIndexCaption(index));},recover:function(ev,index) -{if(this.enabled==false)return;this.showRating(this.rating);this.showCaption(this.options.caption);},click:function(ev,index) -{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) -this.radios[i].checked=(i==index);this.selectedIndex=index;this.setRating(index+1);this.dispatchRequest(ev);},dispatchRequest:function(ev) -{var requestOptions=Object.extend({ID:this.options.ListID+"_c"+this.selectedIndex,EventTarget:this.options.ListName+"$c"+this.selectedIndex},this.options);var request=new Prado.CallbackRequest(requestOptions.EventTarget,requestOptions);if(request.dispatch()==false) -Event.stop(ev);},setRating:function(value) -{this.rating=value;var base=Math.floor(value-1);var remainder=value-base-1;var halfMax=this.options.HalfRating["1"];var index=remainder>halfMax?base+1:base;for(var i=0;i<this.radios.length;i++) -this.radios[i].checked=(i==index);var caption=this.getIndexCaption(index);this.setCaption(caption);this.showCaption(caption);this.showRating(value);},showRating:function(value) -{var base=Math.floor(value-1);var remainder=value-base-1;var halfMin=this.options.HalfRating["0"];var halfMax=this.options.HalfRating["1"];var index=remainder>halfMax?base+1:base;var hasHalf=remainder>=halfMin&&remainder<=halfMax;for(var i=0;i<this.radios.length;i++) -{var node=this.radios[i].parentNode;var action=i>index?'removeClassName':'addClassName';Element[action](node,"rating_selected");if(i==index+1&&hasHalf) -Element.addClassName(node,"rating_half");else -Element.removeClassName(node,"rating_half");Element.removeClassName(node,"rating_hover");}},getIndexCaption:function(index) -{return index>-1?this.radios[index].value:this.options.caption;},showCaption:function(value) -{var caption=$(this.options.CaptionID);if(caption)caption.innerHTML=value;$(this.options.ListID).title=value;},setCaption:function(value) -{this.options.caption=value;this.showCaption(value);},setEnabled:function(value) -{this.enabled=value;for(var i=0;i<this.radios.length;i++) -{var action=value?'removeClassName':'addClassName' -Element[action](this.radios[i].parentNode,"rating_disabled");}}},{ratings:{},register:function(rating) -{Prado.WebUI.TRatingList.ratings[rating.options.ListID]=rating;},setEnabled:function(id,value) -{Prado.WebUI.TRatingList.ratings[id].setEnabled(value);},setRating:function(id,value) -{Prado.WebUI.TRatingList.ratings[id].setRating(value);},setCaption:function(id,value) -{Prado.WebUI.TRatingList.ratings[id].setCaption(value);}});
\ No newline at end of file +{var radioButtonOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TRadioButton(radioButtonOptions);}}});
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/compressed/rico.js b/framework/Web/Javascripts/js/compressed/rico.js deleted file mode 100644 index ff75a9f9..00000000 --- a/framework/Web/Javascripts/js/compressed/rico.js +++ /dev/null @@ -1,265 +0,0 @@ - -var Rico={Version:'1.1rc1',prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])} -Rico.ArrayExtensions=new Array();if(Object.prototype.extend){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;}else{Object.prototype.extend=function(object){return Object.extend.apply(this,[this,object]);} -Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;} -if(Array.prototype.push){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push;} -if(!Array.prototype.remove){Array.prototype.remove=function(dx){if(isNaN(dx)||dx>this.length) -return false;for(var i=0,n=0;i<this.length;i++) -if(i!=dx) -this[n++]=this[i];this.length-=1;};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove;} -if(!Array.prototype.removeItem){Array.prototype.removeItem=function(item){for(var i=0;i<this.length;i++) -if(this[i]==item){this.remove(i);break;}};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem;} -if(!Array.prototype.indices){Array.prototype.indices=function(){var indexArray=new Array();for(index in this){var ignoreThis=false;for(var i=0;i<Rico.ArrayExtensions.length;i++){if(this[index]==Rico.ArrayExtensions[i]){ignoreThis=true;break;}} -if(!ignoreThis) -indexArray[indexArray.length]=index;} -return indexArray;} -Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices;} -if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){if(!Document.prototype.loadXML){Document.prototype.loadXML=function(s){var doc2=(new DOMParser()).parseFromString(s,"text/xml");while(this.hasChildNodes()) -this.removeChild(this.lastChild);for(var i=0;i<doc2.childNodes.length;i++){this.appendChild(this.importNode(doc2.childNodes[i],true));}};} -Document.prototype.__defineGetter__("xml",function(){return(new XMLSerializer()).serializeToString(this);});} -document.getElementsByTagAndClassName=function(tagName,className){if(tagName==null) -tagName='*';var children=document.getElementsByTagName(tagName)||document.all;var elements=new Array();if(className==null) -return children;for(var i=0;i<children.length;i++){var child=children[i];var classNames=child.className.split(' ');for(var j=0;j<classNames.length;j++){if(classNames[j]==className){elements.push(child);break;}}} -return elements;} -Rico.Accordion=Class.create();Rico.Accordion.prototype={initialize:function(container,options){this.container=$(container);this.lastExpandedTab=null;this.accordionTabs=new Array();this.setOptions(options);this._attachBehaviors();if(!container)return;this.container.style.borderBottom='1px solid '+this.options.borderColor;if(this.options.onLoadShowTab>=this.accordionTabs.length) -this.options.onLoadShowTab=0;for(var i=0;i<this.accordionTabs.length;i++) -{if(i!=this.options.onLoadShowTab){this.accordionTabs[i].collapse();this.accordionTabs[i].content.style.display='none';}} -this.lastExpandedTab=this.accordionTabs[this.options.onLoadShowTab];if(this.options.panelHeight=='auto'){var tabToCheck=(this.options.onloadShowTab===0)?1:0;var titleBarSize=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[tabToCheck].titleBar,'height'));if(isNaN(titleBarSize)) -titleBarSize=this.accordionTabs[tabToCheck].titleBar.offsetHeight;var totalTitleBarSize=this.accordionTabs.length*titleBarSize;var parentHeight=parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode,'height'));if(isNaN(parentHeight)) -parentHeight=this.container.parentNode.offsetHeight;this.options.panelHeight=parentHeight-totalTitleBarSize-2;} -this.lastExpandedTab.content.style.height=this.options.panelHeight+"px";this.lastExpandedTab.showExpanded();this.lastExpandedTab.titleBar.style.fontWeight=this.options.expandedFontWeight;},setOptions:function(options){this.options={expandedBg:'#63699c',hoverBg:'#63699c',collapsedBg:'#6b79a5',expandedTextColor:'#ffffff',expandedFontWeight:'bold',hoverTextColor:'#ffffff',collapsedTextColor:'#ced7ef',collapsedFontWeight:'normal',hoverTextColor:'#ffffff',borderColor:'#1f669b',panelHeight:200,onHideTab:null,onShowTab:null,onLoadShowTab:0} -Object.extend(this.options,options||{});},showTabByIndex:function(anIndex,animate){var doAnimate=arguments.length==1?true:animate;this.showTab(this.accordionTabs[anIndex],doAnimate);},showTab:function(accordionTab,animate){var doAnimate=arguments.length==1?true:animate;if(this.options.onHideTab) -this.options.onHideTab(this.lastExpandedTab);this.lastExpandedTab.showCollapsed();var accordion=this;var lastExpandedTab=this.lastExpandedTab;this.lastExpandedTab.content.style.height=(this.options.panelHeight-1)+'px';accordionTab.content.style.display='';accordionTab.titleBar.style.fontWeight=this.options.expandedFontWeight;if(doAnimate){new Effect.AccordionSize(this.lastExpandedTab.content,accordionTab.content,1,this.options.panelHeight,100,10,{complete:function(){accordion.showTabDone(lastExpandedTab)}});this.lastExpandedTab=accordionTab;} -else{this.lastExpandedTab.content.style.height="1px";accordionTab.content.style.height=this.options.panelHeight+"px";this.lastExpandedTab=accordionTab;this.showTabDone(lastExpandedTab);}},showTabDone:function(collapsedTab){collapsedTab.content.style.display='none';this.lastExpandedTab.showExpanded();if(this.options.onShowTab) -this.options.onShowTab(this.lastExpandedTab);},_attachBehaviors:function(){var panels=this._getDirectChildrenByTag(this.container,'DIV');for(var i=0;i<panels.length;i++){var tabChildren=this._getDirectChildrenByTag(panels[i],'DIV');if(tabChildren.length!=2) -continue;var tabTitleBar=tabChildren[0];var tabContentBox=tabChildren[1];this.accordionTabs.push(new Rico.Accordion.Tab(this,tabTitleBar,tabContentBox));}},_getDirectChildrenByTag:function(e,tagName){var kids=new Array();var allKids=e.childNodes;for(var i=0;i<allKids.length;i++) -if(allKids[i]&&allKids[i].tagName&&allKids[i].tagName==tagName) -kids.push(allKids[i]);return kids;}};Rico.Accordion.Tab=Class.create();Rico.Accordion.Tab.prototype={initialize:function(accordion,titleBar,content){this.accordion=accordion;this.titleBar=titleBar;this.content=content;this._attachBehaviors();},collapse:function(){this.showCollapsed();this.content.style.height="1px";},showCollapsed:function(){this.expanded=false;this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;this.titleBar.style.color=this.accordion.options.collapsedTextColor;this.titleBar.style.fontWeight=this.accordion.options.collapsedFontWeight;this.content.style.overflow="hidden";},showExpanded:function(){this.expanded=true;this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;this.titleBar.style.color=this.accordion.options.expandedTextColor;this.content.style.overflow="visible";},titleBarClicked:function(e){if(this.accordion.lastExpandedTab==this) -return;this.accordion.showTab(this);},hover:function(e){this.titleBar.style.backgroundColor=this.accordion.options.hoverBg;this.titleBar.style.color=this.accordion.options.hoverTextColor;},unhover:function(e){if(this.expanded){this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;this.titleBar.style.color=this.accordion.options.expandedTextColor;} -else{this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;this.titleBar.style.color=this.accordion.options.collapsedTextColor;}},_attachBehaviors:function(){this.content.style.border="1px solid "+this.accordion.options.borderColor;this.content.style.borderTopWidth="0px";this.content.style.borderBottomWidth="0px";this.content.style.margin="0px";this.titleBar.onclick=this.titleBarClicked.bindAsEventListener(this);this.titleBar.onmouseover=this.hover.bindAsEventListener(this);this.titleBar.onmouseout=this.unhover.bindAsEventListener(this);}};Rico.Corner={round:function(e,options){var e=$(e);this._setOptions(options);var color=this.options.color;if(this.options.color=="fromElement") -color=this._background(e);var bgColor=this.options.bgColor;if(this.options.bgColor=="fromParent") -bgColor=this._background(e.offsetParent);this._roundCornersImpl(e,color,bgColor);},_roundCornersImpl:function(e,color,bgColor){if(this.options.border) -this._renderBorder(e,bgColor);if(this._isTopRounded()) -this._roundTopCorners(e,color,bgColor);if(this._isBottomRounded()) -this._roundBottomCorners(e,color,bgColor);},_renderBorder:function(el,bgColor){var borderValue="1px solid "+this._borderColor(bgColor);var borderL="border-left: "+borderValue;var borderR="border-right: "+borderValue;var style="style='"+borderL+";"+borderR+"'";el.innerHTML="<div "+style+">"+el.innerHTML+"</div>"},_roundTopCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=0;i<this.options.numSlices;i++) -corner.appendChild(this._createCornerSlice(color,bgColor,i,"top"));el.style.paddingTop=0;el.insertBefore(corner,el.firstChild);},_roundBottomCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=(this.options.numSlices-1);i>=0;i--) -corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));el.style.paddingBottom=0;el.appendChild(corner);},_createCorner:function(bgColor){var corner=document.createElement("div");corner.style.backgroundColor=(this._isTransparent()?"transparent":bgColor);return corner;},_createCornerSlice:function(color,bgColor,n,position){var slice=document.createElement("span");var inStyle=slice.style;inStyle.backgroundColor=color;inStyle.display="block";inStyle.height="1px";inStyle.overflow="hidden";inStyle.fontSize="1px";var borderColor=this._borderColor(color,bgColor);if(this.options.border&&n==0){inStyle.borderTopStyle="solid";inStyle.borderTopWidth="1px";inStyle.borderLeftWidth="0px";inStyle.borderRightWidth="0px";inStyle.borderBottomWidth="0px";inStyle.height="0px";inStyle.borderColor=borderColor;} -else if(borderColor){inStyle.borderColor=borderColor;inStyle.borderStyle="solid";inStyle.borderWidth="0px 1px";} -if(!this.options.compact&&(n==(this.options.numSlices-1))) -inStyle.height="2px";this._setMargin(slice,n,position);this._setBorder(slice,n,position);return slice;},_setOptions:function(options){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false} -Object.extend(this.options,options||{});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(color,bgColor){if(color=="transparent") -return bgColor;else if(this.options.border) -return this.options.border;else if(this.options.blend) -return this._blend(bgColor,color);else -return"";},_setMargin:function(el,n,corners){var marginSize=this._marginSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.marginLeft=marginSize+"px";el.style.marginRight="0px";} -else if(whichSide=="right"){el.style.marginRight=marginSize+"px";el.style.marginLeft="0px";} -else{el.style.marginLeft=marginSize+"px";el.style.marginRight=marginSize+"px";}},_setBorder:function(el,n,corners){var borderSize=this._borderSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth="0px";} -else if(whichSide=="right"){el.style.borderRightWidth=borderSize+"px";el.style.borderLeftWidth="0px";} -else{el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";} -if(this.options.border!=false) -el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";},_marginSize:function(n){if(this._isTransparent()) -return 0;var marginSizes=[5,3,2,1];var blendedMarginSizes=[3,2,1,0];var compactMarginSizes=[2,1];var smBlendedMarginSizes=[1,0];if(this.options.compact&&this.options.blend) -return smBlendedMarginSizes[n];else if(this.options.compact) -return compactMarginSizes[n];else if(this.options.blend) -return blendedMarginSizes[n];else -return marginSizes[n];},_borderSize:function(n){var transparentBorderSizes=[5,3,2,1];var blendedBorderSizes=[2,1,1,1];var compactBorderSizes=[1,0];var actualBorderSizes=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())) -return 1;else if(this.options.compact) -return compactBorderSizes[n];else if(this.options.blend) -return blendedBorderSizes[n];else if(this.options.border) -return actualBorderSizes[n];else if(this._isTransparent()) -return transparentBorderSizes[n];return 0;},_hasString:function(str){for(var i=1;i<arguments.length;i++)if(str.indexOf(arguments[i])>=0)return true;return false;},_blend:function(c1,c2){var cc1=Rico.Color.createFromHex(c1);cc1.blend(Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}} -if(window.Effect==undefined) -Effect={};Effect.SizeAndPosition=Class.create();Effect.SizeAndPosition.prototype={initialize:function(element,x,y,w,h,duration,steps,options){this.element=$(element);this.x=x;this.y=y;this.w=w;this.h=h;this.duration=duration;this.steps=steps;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 stepDuration=Math.round(this.duration/this.steps);var currentX=this.element.offsetLeft;var currentY=this.element.offsetTop;var currentW=this.element.offsetWidth;var currentH=this.element.offsetHeight;this.x=(this.x)?this.x:currentX;this.y=(this.y)?this.y:currentY;this.w=(this.w)?this.w:currentW;this.h=(this.h)?this.h:currentH;var difX=this.steps>0?(this.x-currentX)/this.steps:0;var difY=this.steps>0?(this.y-currentY)/this.steps:0;var difW=this.steps>0?(this.w-currentW)/this.steps:0;var difH=this.steps>0?(this.h-currentH)/this.steps:0;this.moveBy(difX,difY);this.resizeBy(difW,difH);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.sizeAndPosition.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},moveBy:function(difX,difY){var currentLeft=this.element.offsetLeft;var currentTop=this.element.offsetTop;var intDifX=parseInt(difX);var intDifY=parseInt(difY);var style=this.element.style;if(intDifX!=0) -style.left=(currentLeft+intDifX)+"px";if(intDifY!=0) -style.top=(currentTop+intDifY)+"px";},resizeBy:function(difW,difH){var currentWidth=this.element.offsetWidth;var currentHeight=this.element.offsetHeight;var intDifW=parseInt(difW);var intDifH=parseInt(difH);var style=this.element.style;if(intDifW!=0) -style.width=(currentWidth+intDifW)+"px";if(intDifH!=0) -style.height=(currentHeight+intDifH)+"px";}} -Effect.Size=Class.create();Effect.Size.prototype={initialize:function(element,w,h,duration,steps,options){new Effect.SizeAndPosition(element,null,null,w,h,duration,steps,options);}} -Effect.Position=Class.create();Effect.Position.prototype={initialize:function(element,x,y,duration,steps,options){new Effect.SizeAndPosition(element,x,y,null,null,duration,steps,options);}} -Effect.Round=Class.create();Effect.Round.prototype={initialize:function(tagName,className,options){var elements=document.getElementsByTagAndClassName(tagName,className);for(var i=0;i<elements.length;i++) -Rico.Corner.round(elements[i],options);}};Effect.FadeTo=Class.create();Effect.FadeTo.prototype={initialize:function(element,opacity,duration,steps,options){this.element=$(element);this.opacity=opacity;this.duration=duration;this.steps=steps;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 stepDuration=Math.round(this.duration/this.steps);var currentOpacity=this.getElementOpacity();var delta=this.steps>0?(this.opacity-currentOpacity)/this.steps:0;this.changeOpacityBy(delta);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.fadeTo.bind(this),stepDuration);},changeOpacityBy:function(v){var currentOpacity=this.getElementOpacity();var newOpacity=Math.max(0,Math.min(currentOpacity+v,1));this.element.ricoOpacity=newOpacity;this.element.style.filter="alpha(opacity:"+Math.round(newOpacity*100)+")";this.element.style.opacity=newOpacity;;},isFinished:function(){return this.steps<=0;},getElementOpacity:function(){if(this.element.ricoOpacity==undefined){var opacity=RicoUtil.getElementsComputedStyle(this.element,'opacity');this.element.ricoOpacity=opacity!=undefined?opacity:1.0;} -return parseFloat(this.element.ricoOpacity);}} -Effect.AccordionSize=Class.create();Effect.AccordionSize.prototype={initialize:function(e1,e2,start,end,duration,steps,options){this.e1=$(e1);this.e2=$(e2);this.start=start;this.end=end;this.duration=duration;this.steps=steps;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 stepDuration=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-=stepDuration;this.steps--;this.timer=setTimeout(this.accordionSize.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},resizeBy:function(diff){var h1Height=this.e1.offsetHeight;var h2Height=this.e2.offsetHeight;var intDiff=parseInt(diff);if(diff!=0){this.e1.style.height=(h1Height-intDiff)+"px";this.e2.style.height=(h2Height+intDiff)+"px";}}};if(window.Effect==undefined) -Effect={};Effect.SizeAndPosition=Class.create();Effect.SizeAndPosition.prototype={initialize:function(element,x,y,w,h,duration,steps,options){this.element=$(element);this.x=x;this.y=y;this.w=w;this.h=h;this.duration=duration;this.steps=steps;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 stepDuration=Math.round(this.duration/this.steps);var currentX=this.element.offsetLeft;var currentY=this.element.offsetTop;var currentW=this.element.offsetWidth;var currentH=this.element.offsetHeight;this.x=(this.x)?this.x:currentX;this.y=(this.y)?this.y:currentY;this.w=(this.w)?this.w:currentW;this.h=(this.h)?this.h:currentH;var difX=this.steps>0?(this.x-currentX)/this.steps:0;var difY=this.steps>0?(this.y-currentY)/this.steps:0;var difW=this.steps>0?(this.w-currentW)/this.steps:0;var difH=this.steps>0?(this.h-currentH)/this.steps:0;this.moveBy(difX,difY);this.resizeBy(difW,difH);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.sizeAndPosition.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},moveBy:function(difX,difY){var currentLeft=this.element.offsetLeft;var currentTop=this.element.offsetTop;var intDifX=parseInt(difX);var intDifY=parseInt(difY);var style=this.element.style;if(intDifX!=0) -style.left=(currentLeft+intDifX)+"px";if(intDifY!=0) -style.top=(currentTop+intDifY)+"px";},resizeBy:function(difW,difH){var currentWidth=this.element.offsetWidth;var currentHeight=this.element.offsetHeight;var intDifW=parseInt(difW);var intDifH=parseInt(difH);var style=this.element.style;if(intDifW!=0) -style.width=(currentWidth+intDifW)+"px";if(intDifH!=0) -style.height=(currentHeight+intDifH)+"px";}} -Effect.Size=Class.create();Effect.Size.prototype={initialize:function(element,w,h,duration,steps,options){new Effect.SizeAndPosition(element,null,null,w,h,duration,steps,options);}} -Effect.Position=Class.create();Effect.Position.prototype={initialize:function(element,x,y,duration,steps,options){new Effect.SizeAndPosition(element,x,y,null,null,duration,steps,options);}} -Effect.Round=Class.create();Effect.Round.prototype={initialize:function(tagName,className,options){var elements=document.getElementsByTagAndClassName(tagName,className);for(var i=0;i<elements.length;i++) -Rico.Corner.round(elements[i],options);}};Effect.FadeTo=Class.create();Effect.FadeTo.prototype={initialize:function(element,opacity,duration,steps,options){this.element=$(element);this.opacity=opacity;this.duration=duration;this.steps=steps;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 stepDuration=Math.round(this.duration/this.steps);var currentOpacity=this.getElementOpacity();var delta=this.steps>0?(this.opacity-currentOpacity)/this.steps:0;this.changeOpacityBy(delta);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.fadeTo.bind(this),stepDuration);},changeOpacityBy:function(v){var currentOpacity=this.getElementOpacity();var newOpacity=Math.max(0,Math.min(currentOpacity+v,1));this.element.ricoOpacity=newOpacity;this.element.style.filter="alpha(opacity:"+Math.round(newOpacity*100)+")";this.element.style.opacity=newOpacity;;},isFinished:function(){return this.steps<=0;},getElementOpacity:function(){if(this.element.ricoOpacity==undefined){var opacity=RicoUtil.getElementsComputedStyle(this.element,'opacity');this.element.ricoOpacity=opacity!=undefined?opacity:1.0;} -return parseFloat(this.element.ricoOpacity);}} -Effect.AccordionSize=Class.create();Effect.AccordionSize.prototype={initialize:function(e1,e2,start,end,duration,steps,options){this.e1=$(e1);this.e2=$(e2);this.start=start;this.end=end;this.duration=duration;this.steps=steps;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 stepDuration=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-=stepDuration;this.steps--;this.timer=setTimeout(this.accordionSize.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},resizeBy:function(diff){var h1Height=this.e1.offsetHeight;var h2Height=this.e2.offsetHeight;var intDiff=parseInt(diff);if(diff!=0){this.e1.style.height=(h1Height-intDiff)+"px";this.e2.style.height=(h2Height+intDiff)+"px";}}};Rico.LiveGridMetaData=Class.create();Rico.LiveGridMetaData.prototype={initialize:function(pageSize,totalRows,columnCount,options){this.pageSize=pageSize;this.totalRows=totalRows;this.setOptions(options);this.ArrowHeight=16;this.columnCount=columnCount;},setOptions:function(options){this.options={largeBufferSize:7.0,nearLimitFactor:0.2};Object.extend(this.options,options||{});},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(liveGrid,viewPort){this.isIE=navigator.userAgent.toLowerCase().indexOf("msie")>=0;this.liveGrid=liveGrid;this.metaData=liveGrid.metaData;this.createScrollBar();this.scrollTimeout=null;this.lastScrollPos=0;this.viewPort=viewPort;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 headerTable=$(this.liveGrid.tableId+"_header");if(headerTable) -headerTable.rows[0].cells[0].style.width=(headerTable.rows[0].cells[0].offsetWidth+1)+"px";},createScrollBar:function(){var visibleHeight=this.liveGrid.viewPort.visibleHeight();this.scrollerDiv=document.createElement("div");var scrollerStyle=this.scrollerDiv.style;scrollerStyle.borderRight=this.liveGrid.options.scrollerBorderRight;scrollerStyle.position="relative";scrollerStyle.left=this.isIE?"-6px":"-3px";scrollerStyle.width="19px";scrollerStyle.height=visibleHeight+"px";scrollerStyle.overflow="auto";this.heightDiv=document.createElement("div");this.heightDiv.style.width="1px";this.heightDiv.style.height=parseInt(visibleHeight*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";this.scrollerDiv.appendChild(this.heightDiv);this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this);var table=this.liveGrid.table;table.parentNode.parentNode.insertBefore(this.scrollerDiv,table.parentNode.nextSibling);var eventName=this.isIE?"mousewheel":"DOMMouseScroll";Event.observe(table,eventName,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 table=this.liveGrid.table;var visibleHeight=this.viewPort.visibleHeight();this.heightDiv.style.height=parseInt(visibleHeight*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";},rowToPixel:function(rowOffset){return(rowOffset/this.metaData.getTotalRows())*this.heightDiv.offsetHeight},moveScroll:function(rowOffset){this.scrollerDiv.scrollTop=this.rowToPixel(rowOffset);if(this.metaData.options.onscroll) -this.metaData.options.onscroll(this.liveGrid,rowOffset);},handleScroll:function(){if(this.scrollTimeout) -clearTimeout(this.scrollTimeout);var scrollDiff=this.lastScrollPos-this.scrollerDiv.scrollTop;if(scrollDiff!=0.00){var r=this.scrollerDiv.scrollTop%this.viewPort.rowHeight;if(r!=0){this.unplug();if(scrollDiff<0){this.scrollerDiv.scrollTop+=(this.viewPort.rowHeight-r);}else{this.scrollerDiv.scrollTop-=r;} -this.plugin();}} -var contentOffset=parseInt(this.scrollerDiv.scrollTop/this.viewPort.rowHeight);this.liveGrid.requestContentRefresh(contentOffset);this.viewPort.scrollTo(this.scrollerDiv.scrollTop);if(this.metaData.options.onscroll) -this.metaData.options.onscroll(this.liveGrid,contentOffset);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(metaData,viewPort){this.startPos=0;this.size=0;this.metaData=metaData;this.rows=new Array();this.updateInProgress=false;this.viewPort=viewPort;this.maxBufferSize=metaData.getLargeBufferSize()*2;this.maxFetchSize=metaData.getLargeBufferSize();this.lastOffset=0;},getBlankRow:function(){if(!this.blankRow){this.blankRow=new Array();for(var i=0;i<this.metaData.columnCount;i++) -this.blankRow[i]=" ";} -return this.blankRow;},loadRows:function(ajaxResponse){var rowsElement=ajaxResponse.getElementsByTagName('rows')[0];this.updateUI=rowsElement.getAttribute("update_ui")=="true" -var newRows=new Array() -var trs=rowsElement.getElementsByTagName("tr");for(var i=0;i<trs.length;i++){var row=newRows[i]=new Array();var cells=trs[i].getElementsByTagName("td");for(var j=0;j<cells.length;j++){var cell=cells[j];var convertSpaces=cell.getAttribute("convert_spaces")=="true";var cellContent=RicoUtil.getContentAsString(cell);row[j]=convertSpaces?this.convertSpaces(cellContent):cellContent;if(!row[j]) -row[j]=' ';}} -return newRows;},update:function(ajaxResponse,start){var newRows=this.loadRows(ajaxResponse);if(this.rows.length==0){this.rows=newRows;this.size=this.rows.length;this.startPos=start;return;} -if(start>this.startPos){if(this.startPos+this.rows.length<start){this.rows=newRows;this.startPos=start;}else{this.rows=this.rows.concat(newRows.slice(0,newRows.length));if(this.rows.length>this.maxBufferSize){var fullSize=this.rows.length;this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length) -this.startPos=this.startPos+(fullSize-this.rows.length);}}}else{if(start+newRows.length<this.startPos){this.rows=newRows;}else{this.rows=newRows.slice(0,this.startPos).concat(this.rows);if(this.rows.length>this.maxBufferSize) -this.rows=this.rows.slice(0,this.maxBufferSize)} -this.startPos=start;} -this.size=this.rows.length;},clear:function(){this.rows=new Array();this.startPos=0;this.size=0;},isOverlapping:function(start,size){return((start<this.endPos())&&(this.startPos<start+size))||(this.endPos()==0)},isInRange:function(position){return(position>=this.startPos)&&(position+this.metaData.getPageSize()<=this.endPos());},isNearingTopLimit:function(position){return position-this.startPos<this.metaData.getLimitTolerance();},endPos:function(){return this.startPos+this.rows.length;},isNearingBottomLimit:function(position){return this.endPos()-(position+this.metaData.getPageSize())<this.metaData.getLimitTolerance();},isAtTop:function(){return this.startPos==0;},isAtBottom:function(){return this.endPos()==this.metaData.getTotalRows();},isNearingLimit:function(position){return(!this.isAtTop()&&this.isNearingTopLimit(position))||(!this.isAtBottom()&&this.isNearingBottomLimit(position))},getFetchSize:function(offset){var adjustedOffset=this.getFetchOffset(offset);var adjustedSize=0;if(adjustedOffset>=this.startPos){var endFetchOffset=this.maxFetchSize+adjustedOffset;if(endFetchOffset>this.metaData.totalRows) -endFetchOffset=this.metaData.totalRows;adjustedSize=endFetchOffset-adjustedOffset;if(adjustedOffset==0&&adjustedSize<this.maxFetchSize){adjustedSize=this.maxFetchSize;}}else{var adjustedSize=this.startPos-adjustedOffset;if(adjustedSize>this.maxFetchSize) -adjustedSize=this.maxFetchSize;} -return adjustedSize;},getFetchOffset:function(offset){var adjustedOffset=offset;if(offset>this.startPos) -adjustedOffset=(offset>this.endPos())?offset:this.endPos();else{if(offset+this.maxFetchSize>=this.startPos){var adjustedOffset=this.startPos-this.maxFetchSize;if(adjustedOffset<0) -adjustedOffset=0;}} -this.lastOffset=adjustedOffset;return adjustedOffset;},getRows:function(start,count){var begPos=start-this.startPos -var endPos=begPos+count -if(endPos>this.size) -endPos=this.size -var results=new Array() -var index=0;for(var i=begPos;i<endPos;i++){results[index++]=this.rows[i]} -return results},convertSpaces:function(s){return s.split(" ").join(" ");}};Rico.GridViewPort=Class.create();Rico.GridViewPort.prototype={initialize:function(table,rowHeight,visibleRows,buffer,liveGrid){this.lastDisplayedStartPos=0;this.div=table.parentNode;this.table=table -this.rowHeight=rowHeight;this.div.style.height=this.rowHeight*visibleRows;this.div.style.overflow="hidden";this.buffer=buffer;this.liveGrid=liveGrid;this.visibleRows=visibleRows+1;this.lastPixelOffset=0;this.startPos=0;},populateRow:function(htmlRow,row){for(var j=0;j<row.length;j++){htmlRow.cells[j].innerHTML=row[j]}},bufferChanged:function(){this.refreshContents(parseInt(this.lastPixelOffset/this.rowHeight));},clearRows:function(){if(!this.isBlank){this.liveGrid.table.className=this.liveGrid.options.loadingClass;for(var i=0;i<this.visibleRows;i++) -this.populateRow(this.table.rows[i],this.buffer.getBlankRow());this.isBlank=true;}},clearContents:function(){this.clearRows();this.scrollTo(0);this.startPos=0;this.lastStartPos=-1;},refreshContents:function(startPos){if(startPos==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return;} -if((startPos+this.visibleRows<this.buffer.startPos)||(this.buffer.startPos+this.buffer.size<startPos)||(this.buffer.size==0)){this.clearRows();return;} -this.isBlank=false;var viewPrecedesBuffer=this.buffer.startPos>startPos -var contentStartPos=viewPrecedesBuffer?this.buffer.startPos:startPos;var contentEndPos=(this.buffer.startPos+this.buffer.size<startPos+this.visibleRows)?this.buffer.startPos+this.buffer.size:startPos+this.visibleRows;var rowSize=contentEndPos-contentStartPos;var rows=this.buffer.getRows(contentStartPos,rowSize);var blankSize=this.visibleRows-rowSize;var blankOffset=viewPrecedesBuffer?0:rowSize;var contentOffset=viewPrecedesBuffer?blankSize:0;for(var i=0;i<rows.length;i++){this.populateRow(this.table.rows[i+contentOffset],rows[i]);} -for(var i=0;i<blankSize;i++){this.populateRow(this.table.rows[i+blankOffset],this.buffer.getBlankRow());} -this.isPartialBlank=blankSize>0;this.lastRowPos=startPos;this.liveGrid.table.className=this.liveGrid.options.tableClass;var onRefreshComplete=this.liveGrid.options.onRefreshComplete;if(onRefreshComplete!=null) -onRefreshComplete();},scrollTo:function(pixelOffset){if(this.lastPixelOffset==pixelOffset) -return;this.refreshContents(parseInt(pixelOffset/this.rowHeight)) -this.div.scrollTop=pixelOffset%this.rowHeight -this.lastPixelOffset=pixelOffset;},visibleHeight:function(){return parseInt(RicoUtil.getElementsComputedStyle(this.div,'height'));}};Rico.LiveGridRequest=Class.create();Rico.LiveGridRequest.prototype={initialize:function(requestOffset,options){this.requestOffset=requestOffset;}};Rico.LiveGrid=Class.create();Rico.LiveGrid.prototype={initialize:function(tableId,visibleRows,totalRows,url,options,ajaxOptions){this.options={tableClass:$(tableId).className,loadingClass:$(tableId).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,options||{});this.ajaxOptions={parameters:null};Object.extend(this.ajaxOptions,ajaxOptions||{});this.tableId=tableId;this.table=$(tableId);this.addLiveGridHtml();var columnCount=this.table.rows[0].cells.length;this.metaData=new Rico.LiveGridMetaData(visibleRows,totalRows,columnCount,options);this.buffer=new Rico.LiveGridBuffer(this.metaData);var rowCount=this.table.rows.length;this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/rowCount,visibleRows,this.buffer,this);this.scroller=new Rico.LiveGridScroller(this,this.viewPort);this.options.sortHandler=this.sortHandler.bind(this);if($(tableId+'_header')) -this.sort=new Rico.LiveGridSort(tableId+'_header',this.options) -this.processingRequest=null;this.unprocessedRequest=null;this.initAjax(url);if(this.options.prefetchBuffer||this.options.prefetchOffset>0){var offset=0;if(this.options.offset){offset=this.options.offset;this.scroller.moveScroll(offset);this.viewPort.scrollTo(this.scroller.rowToPixel(offset));} -if(this.options.sortCol){this.sortCol=options.sortCol;this.sortDir=options.sortDir;} -this.requestContentRefresh(offset);}},addLiveGridHtml:function(){if(this.table.getElementsByTagName("thead").length>0){var tableHeader=this.table.cloneNode(true);tableHeader.setAttribute('id',this.tableId+'_header');tableHeader.setAttribute('class',this.table.className+'_header');for(var i=0;i<tableHeader.tBodies.length;i++) -tableHeader.removeChild(tableHeader.tBodies[i]);this.table.deleteTHead();this.table.parentNode.insertBefore(tableHeader,this.table);} -new Insertion.Before(this.table,"<div id='"+this.tableId+"_container'></div>");this.table.previousSibling.appendChild(this.table);new Insertion.Before(this.table,"<div id='"+this.tableId+"_viewport' style='float:left;'></div>");this.table.previousSibling.appendChild(this.table);},resetContents:function(){this.scroller.moveScroll(0);this.buffer.clear();this.viewPort.clearContents();},sortHandler:function(column){this.sortCol=column.name;this.sortDir=column.currentSort;this.resetContents();this.requestContentRefresh(0)},setTotalRows:function(newTotalRows){this.resetContents();this.metaData.setTotalRows(newTotalRows);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(offset){if(this.buffer.isInRange(offset)&&!this.buffer.isNearingLimit(offset)){return;} -if(this.processingRequest){this.unprocessedRequest=new Rico.LiveGridRequest(offset);return;} -var bufferStartPos=this.buffer.getFetchOffset(offset);this.processingRequest=new Rico.LiveGridRequest(offset);this.processingRequest.bufferOffset=bufferStartPos;var fetchSize=this.buffer.getFetchSize(offset);var partialLoaded=false;var queryString -if(this.options.requestParameters) -queryString=this._createQueryString(this.options.requestParameters,0);queryString=(queryString==null)?'':queryString+'&';queryString=queryString+'id='+this.tableId+'&page_size='+fetchSize+'&offset='+bufferStartPos;if(this.sortCol) -queryString=queryString+'&sort_col='+escape(this.sortCol)+'&sort_dir='+this.sortDir;this.ajaxOptions.parameters=queryString;ajaxEngine.sendRequest(this.tableId+'_request',this.ajaxOptions);this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout);},setRequestParams:function(){this.options.requestParameters=[];for(var i=0;i<arguments.length;i++) -this.options.requestParameters[i]=arguments[i];},requestContentRefresh:function(contentOffset){this.fetchBuffer(contentOffset);},ajaxUpdate:function(ajaxResponse){try{clearTimeout(this.timeoutHandler);this.buffer.update(ajaxResponse,this.processingRequest.bufferOffset);this.viewPort.bufferChanged();} -catch(err){} -finally{this.processingRequest=null;} -this.processQueuedRequest();},_createQueryString:function(theArgs,offset){var queryString="" -if(!theArgs) -return queryString;for(var i=offset;i<theArgs.length;i++){if(i!=offset) -queryString+="&";var anArg=theArgs[i];if(anArg.name!=undefined&&anArg.value!=undefined){queryString+=anArg.name+"="+escape(anArg.value);} -else{var ePos=anArg.indexOf('=');var argName=anArg.substring(0,ePos);var argValue=anArg.substring(ePos+1);queryString+=argName+"="+escape(argValue);}} -return queryString;},processQueuedRequest:function(){if(this.unprocessedRequest!=null){this.requestContentRefresh(this.unprocessedRequest.requestOffset);this.unprocessedRequest=null}}};Rico.LiveGridSort=Class.create();Rico.LiveGridSort.prototype={initialize:function(headerTableId,options){this.headerTableId=headerTableId;this.headerTable=$(headerTableId);this.options=options;this.setOptions();this.applySortBehavior();if(this.options.sortCol){this.setSortUI(this.options.sortCol,this.options.sortDir);}},setSortUI:function(columnName,sortDirection){var cols=this.options.columns;for(var i=0;i<cols.length;i++){if(cols[i].name==columnName){this.setColumnSort(i,sortDirection);break;}}},setOptions:function(){new Image().src=this.options.sortAscendImg;new Image().src=this.options.sortDescendImg;this.sort=this.options.sortHandler;if(!this.options.columns) -this.options.columns=this.introspectForColumnInfo();else{this.options.columns=this.convertToTableColumns(this.options.columns);}},applySortBehavior:function(){var headerRow=this.headerTable.rows[0];var headerCells=headerRow.cells;for(var i=0;i<headerCells.length;i++){this.addSortBehaviorToColumn(i,headerCells[i]);}},addSortBehaviorToColumn:function(n,cell){if(this.options.columns[n].isSortable()){cell.id=this.headerTableId+'_'+n;cell.style.cursor='pointer';cell.onclick=this.headerCellClicked.bindAsEventListener(this);cell.innerHTML=cell.innerHTML+'<span id="'+this.headerTableId+'_img_'+n+'">' -+' </span>';}},headerCellClicked:function(evt){var eventTarget=evt.target?evt.target:evt.srcElement;var cellId=eventTarget.id;var columnNumber=parseInt(cellId.substring(cellId.lastIndexOf('_')+1));var sortedColumnIndex=this.getSortedColumnIndex();if(sortedColumnIndex!=-1){if(sortedColumnIndex!=columnNumber){this.removeColumnSort(sortedColumnIndex);this.setColumnSort(columnNumber,Rico.TableColumn.SORT_ASC);} -else -this.toggleColumnSort(sortedColumnIndex);} -else -this.setColumnSort(columnNumber,Rico.TableColumn.SORT_ASC);if(this.options.sortHandler){this.options.sortHandler(this.options.columns[columnNumber]);}},removeColumnSort:function(n){this.options.columns[n].setUnsorted();this.setSortImage(n);},setColumnSort:function(n,direction){this.options.columns[n].setSorted(direction);this.setSortImage(n);},toggleColumnSort:function(n){this.options.columns[n].toggleSort();this.setSortImage(n);},setSortImage:function(n){var sortDirection=this.options.columns[n].getSortDirection();var sortImageSpan=$(this.headerTableId+'_img_'+n);if(sortDirection==Rico.TableColumn.UNSORTED) -sortImageSpan.innerHTML=' ';else if(sortDirection==Rico.TableColumn.SORT_ASC) -sortImageSpan.innerHTML=' <img width="'+this.options.sortImageWidth+'" '+'height="'+this.options.sortImageHeight+'" '+'src="'+this.options.sortAscendImg+'"/>';else if(sortDirection==Rico.TableColumn.SORT_DESC) -sortImageSpan.innerHTML=' <img width="'+this.options.sortImageWidth+'" '+'height="'+this.options.sortImageHeight+'" '+'src="'+this.options.sortDescendImg+'"/>';},getSortedColumnIndex:function(){var cols=this.options.columns;for(var i=0;i<cols.length;i++){if(cols[i].isSorted()) -return i;} -return-1;},introspectForColumnInfo:function(){var columns=new Array();var headerRow=this.headerTable.rows[0];var headerCells=headerRow.cells;for(var i=0;i<headerCells.length;i++) -columns.push(new Rico.TableColumn(this.deriveColumnNameFromCell(headerCells[i],i),true));return columns;},convertToTableColumns:function(cols){var columns=new Array();for(var i=0;i<cols.length;i++) -columns.push(new Rico.TableColumn(cols[i][0],cols[i][1]));return columns;},deriveColumnNameFromCell:function(cell,columnNumber){var cellContent=cell.innerText!=undefined?cell.innerText:cell.textContent;return cellContent?cellContent.toLowerCase().split(' ').join('_'):"col_"+columnNumber;}};Rico.TableColumn=Class.create();Rico.TableColumn.UNSORTED=0;Rico.TableColumn.SORT_ASC="ASC";Rico.TableColumn.SORT_DESC="DESC";Rico.TableColumn.prototype={initialize:function(name,sortable){this.name=name;this.sortable=sortable;this.currentSort=Rico.TableColumn.UNSORTED;},isSortable:function(){return this.sortable;},isSorted:function(){return this.currentSort!=Rico.TableColumn.UNSORTED;},getSortDirection:function(){return this.currentSort;},toggleSort:function(){if(this.currentSort==Rico.TableColumn.UNSORTED||this.currentSort==Rico.TableColumn.SORT_DESC) -this.currentSort=Rico.TableColumn.SORT_ASC;else if(this.currentSort==Rico.TableColumn.SORT_ASC) -this.currentSort=Rico.TableColumn.SORT_DESC;},setUnsorted:function(direction){this.setSorted(Rico.TableColumn.UNSORTED);},setSorted:function(direction){this.currentSort=direction;}};Rico.ArrayExtensions=new Array();if(Object.prototype.extend){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;}else{Object.prototype.extend=function(object){return Object.extend.apply(this,[this,object]);} -Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;} -if(Array.prototype.push){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push;} -if(!Array.prototype.remove){Array.prototype.remove=function(dx){if(isNaN(dx)||dx>this.length) -return false;for(var i=0,n=0;i<this.length;i++) -if(i!=dx) -this[n++]=this[i];this.length-=1;};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove;} -if(!Array.prototype.removeItem){Array.prototype.removeItem=function(item){for(var i=0;i<this.length;i++) -if(this[i]==item){this.remove(i);break;}};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem;} -if(!Array.prototype.indices){Array.prototype.indices=function(){var indexArray=new Array();for(index in this){var ignoreThis=false;for(var i=0;i<Rico.ArrayExtensions.length;i++){if(this[index]==Rico.ArrayExtensions[i]){ignoreThis=true;break;}} -if(!ignoreThis) -indexArray[indexArray.length]=index;} -return indexArray;} -Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices;} -Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.unique;Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.inArray;if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){if(!Document.prototype.loadXML){Document.prototype.loadXML=function(s){var doc2=(new DOMParser()).parseFromString(s,"text/xml");while(this.hasChildNodes()) -this.removeChild(this.lastChild);for(var i=0;i<doc2.childNodes.length;i++){this.appendChild(this.importNode(doc2.childNodes[i],true));}};} -Document.prototype.__defineGetter__("xml",function(){return(new XMLSerializer()).serializeToString(this);});} -document.getElementsByTagAndClassName=function(tagName,className){if(tagName==null) -tagName='*';var children=document.getElementsByTagName(tagName)||document.all;var elements=new Array();if(className==null) -return children;for(var i=0;i<children.length;i++){var child=children[i];var classNames=child.className.split(' ');for(var j=0;j<classNames.length;j++){if(classNames[j]==className){elements.push(child);break;}}} -return elements;} -var RicoUtil={getElementsComputedStyle:function(htmlElement,cssProperty,mozillaEquivalentCSS){if(arguments.length==2) -mozillaEquivalentCSS=cssProperty;var el=$(htmlElement);if(el.currentStyle) -return el.currentStyle[cssProperty];else -return document.defaultView.getComputedStyle(el,null).getPropertyValue(mozillaEquivalentCSS);},createXmlDocument:function(){if(document.implementation&&document.implementation.createDocument){var doc=document.implementation.createDocument("","",null);if(doc.readyState==null){doc.readyState=1;doc.addEventListener("load",function(){doc.readyState=4;if(typeof doc.onreadystatechange=="function") -doc.onreadystatechange();},false);} -return doc;} -if(window.ActiveXObject) -return Try.these(function(){return new ActiveXObject('MSXML2.DomDocument')},function(){return new ActiveXObject('Microsoft.DomDocument')},function(){return new ActiveXObject('MSXML.DomDocument')},function(){return new ActiveXObject('MSXML3.DomDocument')})||false;return null;},getContentAsString:function(parentNode){return parentNode.xml!=undefined?this._getContentAsStringIE(parentNode):this._getContentAsStringMozilla(parentNode);},_getContentAsStringIE:function(parentNode){var contentStr="";for(var i=0;i<parentNode.childNodes.length;i++){var n=parentNode.childNodes[i];if(n.nodeType==4){contentStr+=n.nodeValue;} -else{contentStr+=n.xml;}} -return contentStr;},_getContentAsStringMozilla:function(parentNode){var xmlSerializer=new XMLSerializer();var contentStr="";for(var i=0;i<parentNode.childNodes.length;i++){var n=parentNode.childNodes[i];if(n.nodeType==4){contentStr+=n.nodeValue;} -else{contentStr+=xmlSerializer.serializeToString(n);}} -return contentStr;},toViewportPosition:function(element){return this._toAbsolute(element,true);},toDocumentPosition:function(element){return this._toAbsolute(element,false);},_toAbsolute:function(element,accountForDocScroll){if(navigator.userAgent.toLowerCase().indexOf("msie")==-1) -return this._toAbsoluteMozilla(element,accountForDocScroll);var x=0;var y=0;var parent=element;while(parent){var borderXOffset=0;var borderYOffset=0;if(parent!=element){var borderXOffset=parseInt(this.getElementsComputedStyle(parent,"borderLeftWidth"));var borderYOffset=parseInt(this.getElementsComputedStyle(parent,"borderTopWidth"));borderXOffset=isNaN(borderXOffset)?0:borderXOffset;borderYOffset=isNaN(borderYOffset)?0:borderYOffset;} -x+=parent.offsetLeft-parent.scrollLeft+borderXOffset;y+=parent.offsetTop-parent.scrollTop+borderYOffset;parent=parent.offsetParent;} -if(accountForDocScroll){x-=this.docScrollLeft();y-=this.docScrollTop();} -return{x:x,y:y};},_toAbsoluteMozilla:function(element,accountForDocScroll){var x=0;var y=0;var parent=element;while(parent){x+=parent.offsetLeft;y+=parent.offsetTop;parent=parent.offsetParent;} -parent=element;while(parent&&parent!=document.body&&parent!=document.documentElement){if(parent.scrollLeft) -x-=parent.scrollLeft;if(parent.scrollTop) -y-=parent.scrollTop;parent=parent.parentNode;} -if(accountForDocScroll){x-=this.docScrollLeft();y-=this.docScrollTop();} -return{x:x,y:y};},docScrollLeft:function(){if(window.pageXOffset) -return window.pageXOffset;else if(document.documentElement&&document.documentElement.scrollLeft) -return document.documentElement.scrollLeft;else if(document.body) -return document.body.scrollLeft;else -return 0;},docScrollTop:function(){if(window.pageYOffset) -return window.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop) -return document.documentElement.scrollTop;else if(document.body) -return document.body.scrollTop;else -return 0;}};Prado.RicoLiveGrid=Class.create();Prado.RicoLiveGrid.prototype=Object.extend(Rico.LiveGrid.prototype,{initialize:function(tableId,options) -{this.options={tableClass:$(tableId).className||'',loadingClass:$(tableId).className||'',scrollerBorderRight:'1px solid #ababab',bufferTimeout:20000,sortAscendImg:'images/sort_asc.gif',sortDescendImg:'images/sort_desc.gif',sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true,visibleRows:10,totalRows:0,initialOffset:0};Object.extend(this.options,options||{});this.tableId=tableId;this.table=$(tableId);this.addLiveGridHtml();var columnCount=this.table.rows[0].cells.length;this.metaData=new Rico.LiveGridMetaData(this.options.visibleRows,this.options.totalRows,columnCount,options);this.buffer=new Rico.LiveGridBuffer(this.metaData);var rowCount=this.table.rows.length;this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/rowCount,this.options.visibleRows,this.buffer,this);this.scroller=new Rico.LiveGridScroller(this,this.viewPort);this.options.sortHandler=this.sortHandler.bind(this);if($(tableId+'_header')) -this.sort=new Rico.LiveGridSort(tableId+'_header',this.options) -this.processingRequest=null;this.unprocessedRequest=null;if(this.options.initialOffset>=0) -{var offset=this.options.initialOffset;this.scroller.moveScroll(offset);this.viewPort.scrollTo(this.scroller.rowToPixel(offset));if(this.options.sortCol){this.sortCol=options.sortCol;this.sortDir=options.sortDir;} -var grid=this;setTimeout(function(){grid.requestContentRefresh(offset);},100);}},fetchBuffer:function(offset) -{if(this.buffer.isInRange(offset)&&!this.buffer.isNearingLimit(offset)){return;} -if(this.processingRequest){this.unprocessedRequest=new Rico.LiveGridRequest(offset);return;} -var bufferStartPos=this.buffer.getFetchOffset(offset);this.processingRequest=new Rico.LiveGridRequest(offset);this.processingRequest.bufferOffset=bufferStartPos;var fetchSize=this.buffer.getFetchSize(offset);var partialLoaded=false;var param={'page_size':fetchSize,'offset':bufferStartPos};if(this.sortCol) -{Object.extend(param,{'sort_col':this.sortCol,'sort_dir':this.sortDir});} -Prado.Callback(this.tableId,param,this.ajaxUpdate.bind(this),this.options);this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout);},ajaxUpdate:function(result,output) -{try{clearTimeout(this.timeoutHandler);this.buffer.update(result,this.processingRequest.bufferOffset);this.viewPort.bufferChanged();} -catch(err){} -finally{this.processingRequest=null;} -this.processQueuedRequest();}});Object.extend(Rico.LiveGridBuffer.prototype,{update:function(newRows,start) -{if(this.rows.length==0){this.rows=newRows;this.size=this.rows.length;this.startPos=start;return;} -if(start>this.startPos){if(this.startPos+this.rows.length<start){this.rows=newRows;this.startPos=start;}else{this.rows=this.rows.concat(newRows.slice(0,newRows.length));if(this.rows.length>this.maxBufferSize){var fullSize=this.rows.length;this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length) -this.startPos=this.startPos+(fullSize-this.rows.length);}}}else{if(start+newRows.length<this.startPos){this.rows=newRows;}else{this.rows=newRows.slice(0,this.startPos).concat(this.rows);if(this.rows.length>this.maxBufferSize) -this.rows=this.rows.slice(0,this.maxBufferSize)} -this.startPos=start;} -this.size=this.rows.length;}});Object.extend(Rico.GridViewPort.prototype,{populateRow:function(htmlRow,row) -{if(isdef(htmlRow)) -{for(var j=0;j<row.length;j++){htmlRow.cells[j].innerHTML=row[j]}}}});
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js index a3b3f1cd..c173014c 100644 --- a/framework/Web/Javascripts/js/compressed/validator.js +++ b/framework/Web/Javascripts/js/compressed/validator.js @@ -3,8 +3,7 @@ Prado.Validation=Class.create();Object.extend(Prado.Validation,{managers:{},vali {if(this.managers[formID]) {return this.managers[formID].validate(groupID,invoker);} else -{throw new Error("Form '"+form+"' is not registered with Prado.Validation");}},getForm:function() -{var keys=$H(this.managers).keys();return keys[0];},isValid:function(formID,groupID) +{throw new Error("Form '"+form+"' is not registered with Prado.Validation");}},isValid:function(formID,groupID) {if(this.managers[formID]) return this.managers[formID].isValid(groupID);return true;},addValidator:function(formID,validator) {if(this.managers[formID]) @@ -12,12 +11,8 @@ this.managers[formID].addValidator(validator);else throw new Error("A validation manager for form '"+formID+"' needs to be created first.");return this.managers[formID];},addSummary:function(formID,validator) {if(this.managers[formID]) this.managers[formID].addSummary(validator);else -throw new Error("A validation manager for form '"+formID+"' needs to be created first.");return this.managers[formID];},setErrorMessage:function(validatorID,message) -{$H(Prado.Validation.managers).each(function(manager) -{manager[1].validators.each(function(validator) -{if(validator.options.ID==validatorID) -{validator.options.ErrorMessage=message;$(validatorID).innerHTML=message;}});});}});Prado.ValidationManager=Class.create();Prado.ValidationManager.prototype={initialize:function(options) -{this.validators=[];this.summaries=[];this.groups=[];this.options={};this.options=options;Prado.Validation.managers[options.FormID]=this;},validate:function(group,invoker) +throw new Error("A validation manager for form '"+formID+"' needs to be created first.");return this.managers[formID];}});Prado.ValidationManager=Class.create();Prado.ValidationManager.prototype={validators:[],summaries:[],groups:[],options:{},initialize:function(options) +{this.options=options;Prado.Validation.managers[options.FormID]=this;},validate:function(group,invoker) {if(group) return this._validateGroup(group,invoker);else return this._validateNonGroup(invoker);},_validateGroup:function(groupID,invoker) @@ -50,10 +45,9 @@ this.groups.push(validator.group);},addSummary:function(summary) {var validators=this.getValidatorsWithError(group);this.summaries.each(function(summary) {var inGroup=group&&summary.group==group;var noGroup=!group&&!summary.group;if(inGroup||noGroup) summary.updateSummary(validators,refresh);else -summary.hideSummary(true);});}};Prado.WebUI.TValidationSummary=Class.create();Prado.WebUI.TValidationSummary.prototype={initialize:function(options) -{this.options=options;this.group=options.ValidationGroup;this.messages=$(options.ID);if(this.messages) -{this.visible=this.messages.style.visibility!="hidden" -this.visible=this.visible&&this.messages.style.display!="none";Prado.Validation.addSummary(options.FormID,this);}},updateSummary:function(validators,update) +summary.hideSummary(true);});}};Prado.WebUI.TValidationSummary=Class.create();Prado.WebUI.TValidationSummary.prototype={group:null,options:{},visible:false,messages:null,initialize:function(options) +{this.options=options;this.group=options.ValidationGroup;this.messages=$(options.ID);this.visible=this.messages.style.visibility!="hidden" +this.visible=this.visible&&this.messages.style.display!="none";Prado.Validation.addSummary(options.FormID,this);},updateSummary:function(validators,update) {if(validators.length<=0) {if(update||this.options.Refresh!=false) {return this.hideSummary(validators);} @@ -86,12 +80,11 @@ this.messages.show();this.visible=true;},formats:function(type) {var output=this.options.HeaderText?this.options.HeaderText+"\n":"";for(var i=0;i<messages.length;i++) {switch(this.options.DisplayMode) {case"List":output+=messages[i]+"\n";break;case"BulletList":default:output+=" - "+messages[i]+"\n";break;case"SingleParagraph":output+=messages[i]+" ";break;}} -return output;}};Prado.WebUI.TBaseValidator=Class.create();Prado.WebUI.TBaseValidator.prototype={initialize:function(options) -{this.enabled=true;this.visible=false;this.isValid=true;this._isObserving={};this.group=null;this.requestDispatched=false;this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);if(this.control&&this.message) -{this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);}},getErrorMessage:function() +return output;}};Prado.WebUI.TBaseValidator=Class.create();Prado.WebUI.TBaseValidator.prototype={enabled:true,visible:false,isValid:true,options:{},_isObserving:{},group:null,manager:null,message:null,initialize:function(options) +{this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);},getErrorMessage:function() {return this.options.ErrorMessage;},updateControl:function(focus) {this.refreshControlAndMessage();if(this.options.FocusOnError&&!this.isValid) -Prado.Element.focus(this.options.FocusElementID);this.visible=true;},refreshControlAndMessage:function() +Prado.Element.focus(this.options.FocusElementID);},refreshControlAndMessage:function() {this.visible=true;if(this.message) {if(this.options.Display=="Dynamic") this.isValid?this.message.hide():this.message.show();this.message.style.visibility=this.isValid?"hidden":"visible";} @@ -102,24 +95,17 @@ this.updateControlCssClass(this.control,this.isValid);},updateControlCssClass:fu control.removeClassName(CssClass);else control.addClassName(CssClass);}},hide:function() {this.isValid=true;this.updateControl();this.visible=false;},validate:function(invoker) -{if(!this.control) -this.control=$(this.options.ControlToValidate);if(!this.control) -{this.isValid=true;return this.isValid;} -if(typeof(this.options.OnValidate)=="function") -{if(this.requestDispatched==false) -this.options.OnValidate(this,invoker);} -if(this.enabled) +{if(typeof(this.options.OnValidate)=="function") +this.options.OnValidate(this,invoker);if(this.enabled) this.isValid=this.evaluateIsValid();else this.isValid=true;if(this.isValid) -{if(typeof(this.options.OnValidationSuccess)=="function") -{if(this.requestDispatched==false) -{this.refreshControlAndMessage();this.options.OnValidationSuccess(this,invoker);}} +{if(typeof(this.options.OnSuccess)=="function") +{this.refreshControlAndMessage();this.options.OnSuccess(this,invoker);} else this.updateControl();} else -{if(typeof(this.options.OnValidationError)=="function") -{if(this.requestDispatched==false) -{this.refreshControlAndMessage();this.options.OnValidationError(this,invoker)}} +{if(typeof(this.options.OnError)=="function") +{this.refreshControlAndMessage();this.options.OnError(this,invoker);} else this.updateControl();} this.observeChanges(this.control);return this.isValid;},observeChanges:function(control) @@ -191,14 +177,7 @@ return true;switch(this.options.Operator) {case"NotEqual":return(op1!=op2);case"GreaterThan":return(op1>op2);case"GreaterThanEqual":return(op1>=op2);case"LessThan":return(op1<op2);case"LessThanEqual":return(op1<=op2);default:return(op1==op2);}}});Prado.WebUI.TCustomValidator=Class.extend(Prado.WebUI.TBaseValidator,{evaluateIsValid:function() {var value=this.getValidationValue();var clientFunction=this.options.ClientValidationFunction;if(typeof(clientFunction)=="string"&&clientFunction.length>0) {validate=clientFunction.toFunction();return validate(this,value);} -return true;}});Prado.WebUI.TActiveCustomValidator=Class.extend(Prado.WebUI.TBaseValidator,{validatingValue:null,evaluateIsValid:function() -{value=this.getValidationValue();if(!this.requestDispatched&&value!=this.validatingValue) -{this.validatingValue=value;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCallbackParameter(value);request.setCausesValidation(false);request.options.onSuccess=this.callbackOnSuccess.bind(this);request.options.onFailure=this.callbackOnFailure.bind(this);request.dispatch();this.requestDispatched=true;return false;} -return this.isValid;},callbackOnSuccess:function(request,data) -{this.isValid=data;this.requestDispatched=false;if(typeof(this.options.onSuccess)=="function") -this.options.onSuccess(request,data);Prado.Validation.validate(this.options.FormID,this.group,null);},callbackOnFailure:function(request,data) -{this.requestDispatched=false;if(typeof(this.options.onFailure)=="function") -this.options.onFailure(request,data);}});Prado.WebUI.TRangeValidator=Class.extend(Prado.WebUI.TBaseValidator,{evaluateIsValid:function() +return true;}});Prado.WebUI.TRangeValidator=Class.extend(Prado.WebUI.TBaseValidator,{evaluateIsValid:function() {var value=this.getValidationValue();if(value.length<=0) return true;if(typeof(this.options.DataType)=="undefined") this.options.DataType="String";if(this.options.DataType!="StringLength") |