From 68eb20ae56e35cc48982be6f15c0738a276c3684 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 21 Oct 2006 02:46:12 +0000 Subject: update ajax callback to be quequed --- framework/Web/Javascripts/js/compressed/ajax.js | 56 ++-- framework/Web/Javascripts/js/compressed/prado.js | 377 +---------------------- 2 files changed, 36 insertions(+), 397 deletions(-) (limited to 'framework/Web/Javascripts/js/compressed') diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index 115be3d3..f0516df5 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -36,18 +36,18 @@ this.transport.onreadystatechange=Prototype.emptyFunction;},getHeaderData:functi {var json=this.header(name);return eval('('+json+')');} catch(e) {if(typeof(json)=="string") -return Prado.CallbackRequest.decode(json);}}});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',requestInProgress:null,addPostLoaders:function(ids) -{this.PostDataLoaders=this.PostDataLoaders.concat(ids);list=[];this.PostDataLoaders.each(function(id) +return Prado.CallbackRequest.decode(json);}}});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',currentRequest:null,requestQueque:[],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);});this.PostDataLoaders=list;},dispatchActions:function(transport,actions) -{if(actions&&actions.length>0) -actions.each(this.__run.bind(this,transport));},__run:function(transport,command) -{this.transport=transport;for(var method in command) +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(this,command[method]);} +{method.toFunction().apply(self,command[method]);} catch(e) {if(typeof(Logger)!="undefined") -Prado.CallbackRequest.Exception.onException(null,e);}}},Exception:{"on500":function(request,transport,data) +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) @@ -66,22 +66,34 @@ msg+=e.version+" "+e.time+"\n";return msg;}},encode:function(data) {if(typeof(data)=="string"&&data.trim().length>0) return Prado.JSON.parse(data);else return null;},dispatchPriorityRequest:function(callback) -{this.abortRequestInProgress();callback.request=new Ajax.Request(callback.url,callback.options);callback.timeout=setTimeout(function() -{Prado.CallbackRequest.abortRequestInProgress();},callback.options.RequestTimeOut);this.requestInProgress=callback;return true;},dispatchNormalRequest:function(callback) -{new Ajax.Request(callback.url,callback.options);return true;},abortRequestInProgress:function() -{inProgress=Prado.CallbackRequest.requestInProgress;if(inProgress) -{if(inProgress.request.transport.readyState<4) -inProgress.request.transport.abort();clearTimeout(inProgress.timeout);Prado.CallbackRequest.requestInProgress=null;return true;} -return false;},updatePageState:function(request,transport) -{pagestate=$(this.FIELD_CALLBACK_PAGESTATE);if(request.options.EnablePageStateUpdate&&request.options.HasPriority&&pagestate) -{data=request.header(this.PAGESTATE_HEADER);if(typeof(data)=="string"&&data.length>0) +{var self=Prado.CallbackRequest;callback.request=new Ajax.Request(callback.url,callback.options);callback.timeout=setTimeout(function() +{self.abortCurrentRequest();},callback.options.RequestTimeOut);self.currentRequest=callback;return true;},dispatchNormalRequest:function(callback) +{new Ajax.Request(callback.url,callback.options);return true;},abortCurrentRequest:function() +{var self=Prado.CallbackRequest;var inProgress=self.currentRequest;if(inProgress) +{clearTimeout(inProgress.timeout);self.currentRequest=null;if(inProgress.request.transport.readyState<4) +inProgress.request.transport.abort();return self.dispatchQueque();} +else +return self.dispatchQueque();},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.header(self.PAGESTATE_HEADER);if(typeof(data)=="string"&&data.length>0) pagestate.value=data;else {if(typeof(Logger)!="undefined") Logger.warn("Missing page state:"+data);return false;}} -return true;}}) +return true;},enqueque:function(callback) +{var self=Prado.CallbackRequest;if(self.currentRequest==null) +self.dispatchPriorityRequest(callback);else +self.requestQueque.push(callback);},dispatchQueque:function() +{var self=Prado.CallbackRequest;if(self.requestQueque.length>0) +{var callback=self.requestQueque.shift();return self.dispatchPriorityRequest(callback);} +return false;},abortRequest:function(id) +{var self=Prado.CallbackRequest;if(self.currentRequest!=null&&self.currentRequest.id==id) +self.abortCurrentRequest();else +{var queque=[];self.requestQueque.each(function(callback) +{if(callback.id!=id) +queque.push(callback);});self.requestQueque=queque;}}}) Ajax.Responders.register({onComplete:function(request) {if(request.options.HasPriority) -Prado.CallbackRequest.abortRequestInProgress();}});Event.OnLoad(function() +Prado.CallbackRequest.abortCurrentRequest();}});Event.OnLoad(function() {if(typeof Logger!="undefined") Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackRequest.prototype={url:window.location.href,options:{},id:null,request:null,Enabled:true,initialize:function(id,options) {this.id=id;this.options=Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{});},setCallbackParameter:function(value) @@ -100,8 +112,10 @@ return false;} if(this.options.onPreDispatch) this.options.onPreDispatch(this,null);if(!this.Enabled) return;if(this.options.HasPriority) -return Prado.CallbackRequest.dispatchPriorityRequest(this);else -return Prado.CallbackRequest.dispatchNormalRequest(this);},_getPostData:function() +{return Prado.CallbackRequest.enqueque(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) diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index 9f8cdb19..fbd2a9a2 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -19,379 +19,4 @@ var Base=function(){if(arguments.length){if(this==window){Base.prototype.extend. 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,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=(replacement(match)||'').toString();source=source.slice(match.index+match[0].length);}else{result+=source,source='';}} -return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return this;},truncate:function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:this;},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var div=document.createElement('div');var text=document.createTextNode(this);div.appendChild(text);return div.innerHTML;},unescapeHTML:function(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?div.childNodes[0].nodeValue:'';},toQueryParams:function(){var pairs=this.match(/^\??(.*)$/)[1].split('&');return pairs.inject({},function(params,pairString){var pair=pairString.split('=');params[pair[0]]=pair[1];return params;});},toArray:function(){return this.split('');},camelize:function(){var oStringList=this.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=this.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,len=oStringList.length;i0?m[2]:"0")+"."+m[4];var num=parseFloat(cleanInput);return(isNaN(num)?null:num);},toCurrency:function(groupchar,digits,decimalchar) -{groupchar=groupchar||",";decimalchar=decimalchar||".";digits=typeof(digits)=="undefined"?2:digits;var exp=new RegExp("^\\s*([-\\+])?(((\\d+)\\"+groupchar+")*)(\\d+)" -+((digits>0)?"(\\"+decimalchar+"(\\d{1,"+digits+"}))?":"") -+"\\s*$");var m=this.match(exp);if(m==null) -return null;var intermed=m[2]+m[5];var cleanInput=m[1]+intermed.replace(new RegExp("(\\"+groupchar+")","g"),"") -+((digits>0)?"."+m[7]:"");var num=parseFloat(cleanInput);return(isNaN(num)?null:num);},toDate:function(format) -{return Date.SimpleParse(this,format);}});var $break=new Object();var $continue=new Object();var Enumerable={each:function(iterator){var index=0;try{this._each(function(value){try{iterator(value,index++);}catch(e){if(e!=$continue)throw e;}});}catch(e){if(e!=$break)throw e;}},all:function(iterator){var result=true;this.each(function(value,index){result=result&&!!(iterator||Prototype.K)(value,index);if(!result)throw $break;});return result;},any:function(iterator){var result=true;this.each(function(value,index){if(result=!!(iterator||Prototype.K)(value,index)) -throw $break;});return result;},collect:function(iterator){var results=[];this.each(function(value,index){results.push(iterator(value,index));});return results;},detect:function(iterator){var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break;}});return result;},findAll:function(iterator){var results=[];this.each(function(value,index){if(iterator(value,index)) -results.push(value);});return results;},grep:function(pattern,iterator){var results=[];this.each(function(value,index){var stringValue=value.toString();if(stringValue.match(pattern)) -results.push((iterator||Prototype.K)(value,index));}) -return results;},include:function(object){var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inject:function(memo,iterator){this.each(function(value,index){memo=iterator(memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.collect(function(value){return value[method].apply(value,args);});},max:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||value>=result) -result=value;});return result;},min:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||valueb?1:0;}).pluck('value');},toArray:function(){return this.collect(Prototype.K);},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(typeof args.last()=='function') -iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});},inspect:function(){return'#';}} -Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(iterable){if(!iterable)return[];if(iterable.toArray){return iterable.toArray();}else{var results=[];for(var i=0;i';}} -function $H(object){var hash=Object.extend({},object||{});Object.extend(hash,Enumerable);Object.extend(hash,Hash);return hash;} -ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;do{iterator(value);value=value.succ();}while(this.include(value));},include:function(value){if(value'+this.content+'';return $A(div.childNodes[0].childNodes[0].childNodes);}} -var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion('beforeBegin'),{initializeRange:function(){this.range.setStartBefore(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element);}).bind(this));}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion('afterBegin'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true);},insertContent:function(fragments){fragments.reverse(false).each((function(fragment){this.element.insertBefore(fragment,this.element.firstChild);}).bind(this));}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion('beforeEnd'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.appendChild(fragment);}).bind(this));}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion('afterEnd'),{initializeRange:function(){this.range.setStartAfter(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element.nextSibling);}).bind(this));}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set(this.toArray().concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set(this.select(function(className){return className!=classNameToRemove;}).join(' '));},toString:function(){return this.toArray().join(' ');}} -Object.extend(Element.ClassNames.prototype,Enumerable);var Field={clear:function(){for(var i=0;i=0){opt=element.options[index];value=opt.value||opt.text;} -return[element.name,value];},selectMany:function(element){var value=[];for(var i=0;i=this.offset[1]&&y=this.offset[0]&&x=this.offset[1]&&this.ycomp=this.offset[0]&&this.xcomp0)abort(expr.inspect());},buildMatchExpression:function(){var params=this.params,conditions=[],clause;if(params.wildcard) -conditions.push('true');if(clause=params.id) -conditions.push('element.id == '+clause.inspect());if(clause=params.tagName) -conditions.push('element.tagName.toUpperCase() == '+clause.inspect());if((clause=params.classNames).length>0) -for(var i=0;i";}catch(e){} -var element=parentElement.firstChild||null;if(element&&(element.tagName!=elementName)) -element=element.getElementsByTagName(elementName)[0];if(!element)element=document.createElement(elementName);if(!element)return;if(arguments[1]) -if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)){this._children(element,arguments[1]);}else{var attrs=this._attributes(arguments[1]);if(attrs.length){try{parentElement.innerHTML="<"+elementName+" "+ -attrs+">";}catch(e){} -element=parentElement.firstChild||null;if(!element){element=document.createElement(elementName);for(attr in arguments[1]) -element[attr=='class'?'className':attr]=arguments[1][attr];} -if(element.tagName!=elementName) -element=parentElement.getElementsByTagName(elementName)[0];}} -if(arguments[2]) -this._children(element,arguments[2]);return element;},_text:function(text){return document.createTextNode(text);},_attributes:function(attributes){var attrs=[];for(attribute in attributes) -attrs.push((attribute=='className'?'class':attribute)+'="'+attributes[attribute].toString().escapeHTML()+'"');return attrs.join(" ");},_children:function(element,children){if(typeof children=='object'){children.flatten().each(function(e){if(typeof e=='object') -element.appendChild(e) -else -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');}} -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(Date.prototype,{SimpleFormat:function(format,data) -{data=data||{};var bits=new Array();bits['d']=this.getDate();bits['dd']=String(this.getDate()).zerofill(2);bits['M']=this.getMonth()+1;bits['MM']=String(this.getMonth()+1).zerofill(2);if(data.AbbreviatedMonthNames) -bits['MMM']=data.AbbreviatedMonthNames[this.getMonth()];if(data.MonthNames) -bits['MMMM']=data.MonthNames[this.getMonth()];var yearStr=""+this.getFullYear();yearStr=(yearStr.length==2)?'19'+yearStr:yearStr;bits['yyyy']=yearStr;bits['yy']=bits['yyyy'].toString().substr(2,2);var frm=new String(format);for(var sect in bits) -{var reg=new RegExp("\\b"+sect+"\\b","g");frm=frm.replace(reg,bits[sect]);} -return frm;},toISODate:function() -{var y=this.getFullYear();var m=String(this.getMonth()+1).zerofill(2);var d=String(this.getDate()).zerofill(2);return String(y)+String(m)+String(d);}});Object.extend(Date,{SimpleParse:function(value,format) -{val=String(value);format=String(format);if(val.length<=0)return null;if(format.length<=0)return new Date(value);var isInteger=function(val) -{var digits="1234567890";for(var i=0;i=minlength;x--) -{var token=str.substring(i,i+x);if(token.length70){year=1900+(year-0);} -else{year=2000+(year-0);}}} -else if(token=="MM"||token=="M") -{month=getInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12)){return null;} -i_val+=month.length;} -else if(token=="dd"||token=="d") -{date=getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return null;} -i_val+=date.length;} -else -{if(val.substring(i_val,i_val+token.length)!=token){return null;} -else{i_val+=token.length;}}} -if(i_val!=val.length){return null;} -if(month==2) -{if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(date>29){return null;}} -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;}});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);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((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&&el.tagName.toLowerCase()=="select") -{el.options.length=options.length;for(var i=0;i)([\\s\\S\\w\\W]*)()',"m");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;i0) -window.clipboardData.setData("Text",text);},hover:function(obj) -{obj.parentNode.className="copycode copycode_hover";},out:function(obj) -{obj.parentNode.className="copycode";}});Prado.WebUI.TCheckBoxList=Base.extend({constructor:function(options) -{for(var i=0;i