From c5d0cd2824e3c3bb2f6f3834177a71c1d7b78519 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 27 Mar 2007 00:47:38 +0000 Subject: merge from 3.0 branch till 1779. --- framework/Web/Javascripts/js/compressed/prado.js | 222 ++++++++--------------- 1 file changed, 72 insertions(+), 150 deletions(-) (limited to 'framework/Web/Javascripts/js/compressed/prado.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.length0) +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;i1) +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.length28){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)([\\s\\S\\w\\W]*)()',"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=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;ihalfMax?base+1:base;for(var i=0;ihalfMax?base+1:base;var hasHalf=remainder>=halfMin&&remainder<=halfMax;for(var i=0;iindex?'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