You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/08/03 20:20:07 UTC
svn commit: r562538 [3/3] - in
/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui:
./ assets/ assets/skins/ assets/skins/sam/ calendar/ calendar/assets/
calendar/assets/skins/ calendar/assets/skins/sam/ dom/ event/ yahoo/
Added: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event-min.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event-min.js?view=auto&rev=562538
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event-min.js (added)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event-min.js Fri Aug 3 11:20:05 2007
@@ -0,0 +1,95 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.0
+*/
+
+YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}
+var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(!fn){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}
+if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);}
+this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
+var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}}
+return found;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}
+var args=[],ret=true,i,rebuild=false;for(i=0;i<arguments.length;++i){args.push(arguments[i]);}
+var argslength=args.length;if(!this.silent){}
+for(i=0;i<len;++i){var s=this.subscribers[i];if(!s){rebuild=true;}else{if(!this.silent){}
+var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];}
+ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);}
+if(false===ret){if(!this.silent){}
+return false;}}}
+if(rebuild){var newlist=[],subs=this.subscribers;for(i=0,len=subs.length;i<len;++i){s=subs[i];newlist.push(subs[i]);}
+this.subscribers=newlist;}
+return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}
+this.subscribers=[];return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
+this.subscribers[index]=null;},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=YAHOO.lang.isUndefined(obj)?null:obj;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}
+return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var DOMReady=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var webkitKeymap={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override){o
nAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:false});retryCount=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(p_fn,p_obj,p_override){if(DOMReady){setTimeout(function(){var s=window;if(p_override){if(p_override===true){s=p_obj;}else{s=p_override;}}
+p_fn.call(s,"DOMReady",[],p_obj);},0);}else{this.DOMReadyEvent.subscribe(p_fn,p_obj,p_override);}},onContentReady:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:true});retryCount=this.POLL_RETRYS;this.startInterval();},addListener:function(el,sType,fn,obj,override){if(!fn||!fn.call){return false;}
+if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],sType,fn,obj,override)&&ok;}
+return ok;}else if(YAHOO.lang.isString(el)){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,sType,fn,obj,override);});return true;}}
+if(!el){return false;}
+if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override];return true;}
+var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}}
+var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e),obj);};var li=[el,sType,fn,wrappedFn,scope];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};}
+legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,false);}catch(ex){this.lastError=ex;this.removeListener(el,sType,fn);return false;}}
+return true;},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex];for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}}
+le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);}
+return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){if(this.webkit&&("click"==sType||"dblclick"==sType)){var v=parseInt(this.webkit,10);if(!isNaN(v)&&v<418){return true;}}
+return false;},removeListener:function(el,sType,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],sType,fn)&&ok);}
+return ok;}
+if(!fn||!fn.call){return this.purgeElement(el,false,sType);}
+if("unload"==sType){for(i=0,len=unloadListeners.length;i<len;i++){var li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners[i]=null;return true;}}
+return false;}
+var cacheItem=null;var index=arguments[3];if("undefined"==typeof index){index=this._getCacheIndex(el,sType,fn);}
+if(index>=0){cacheItem=listeners[index];}
+if(!el||!cacheItem){return false;}
+if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist[i]=null;break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],false);}catch(ex){this.lastError=ex;return false;}}
+delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners[index]=null;return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}
+return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}
+return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
+return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}
+return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}
+c=c.caller;}}
+return ev;},getCharCode:function(ev){var code=ev.keyCode||ev.charCode||0;if(YAHOO.env.ua.webkit&&(code in webkitKeymap)){code=webkitKeymap[code];}
+return code;},_getCacheIndex:function(el,sType,fn){for(var i=0,len=listeners.length;i<len;++i){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}}
+return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;}
+return id;},_isValidCollection:function(o){try{return(o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");}catch(e){return false;}},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(e){if(!loadComplete){loadComplete=true;var EU=YAHOO.util.Event;EU._ready();EU._tryPreloadAttach();}},_ready:function(e){if(!DOMReady){DOMReady=true;var EU=YAHOO.util.Event;EU.DOMReadyEvent.fire();EU._simpleRemove(document,"DOMContentLoaded",EU._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}
+if(this.isIE){if(!DOMReady){this.startInterval();return false;}}
+this.locked=true;var tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0);}
+var notAvail=[];var executeItem=function(el,item){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}}
+item.fn.call(scope,item.obj);};var i,len,item,el;for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&!item.checkReady){el=this.getEl(item.id);if(el){executeItem(el,item);onAvailStack[i]=null;}else{notAvail.push(item);}}}
+for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&item.checkReady){el=this.getEl(item.id);if(el){if(loadComplete||el.nextSibling){executeItem(el,item);onAvailStack[i]=null;}}else{notAvail.push(item);}}}
+retryCount=(notAvail.length===0)?0:retryCount-1;if(tryAgain){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}
+this.locked=false;return true;},purgeElement:function(el,recurse,sType){var elListeners=this.getListeners(el,sType);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn,l.index);}}
+if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}
+for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}
+return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}}
+l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}}
+unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}
+j=j-1;}
+l=null;EU.clearCache();}
+for(i=0,len=legacyEvents.length;i<len;++i){legacyEvents[i][0]=null;legacyEvents[i]=null;}
+legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if
(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var el,d=document,b=d.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){el=document.createElement("script");var p=d.getElementsByTagName("head")[0]||b;p.insertBefore(el,p.firstChild);}else{d.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"><'+'/script>');el=document.getElementById("_yui_eu_dr");}
+if(el){el.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};}else{}
+el=null;}else if(EU.webkit){EU._drwatch=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._drwatch);EU._drwatch=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}
+EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}
+YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];}
+subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var evts=this.__yui_events;if(p_type){var ce=evts[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}}else{for(var i in evts){var ret=true;if(YAHOO.lang.hasOwnProperty(evts,i)){ret=ret&&evts[i].unsubscribe(p_fn,p_obj);}}
+return ret;}
+return false;},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=(opts.silent);var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}
+this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}
+return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(!ce){return null;}
+var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
+return ce.fire.apply(ce,args);},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}
+return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){}
+if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
+var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
+if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
+function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;}
+if(!keyData.alt){keyData.alt=false;}
+if(!keyData.ctrl){keyData.ctrl=false;}
+if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;var keyPressed;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}}
+this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
+this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
+this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+
+(attachTo.id?"["+attachTo.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.3.0",build:"442"});
\ No newline at end of file
Added: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js?view=auto&rev=562538
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js (added)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js Fri Aug 3 11:20:05 2007
@@ -0,0 +1,42 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.0
+*/
+
+if(typeof YAHOO=="undefined"){var YAHOO={};}
+YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
+return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
+var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);}
+if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(name){return YAHOO.env.modules[name]||null;};YAHOO.env.ua=function(){var o={ie:0,opera:0,gecko:0,webkit:0};var ua=navigator.userAgent,m;if((/KHTML/).test(ua)){o.webkit=1;}
+m=ua.match(/AppleWebKit\/([^\s]*)/);if(m&&m[1]){o.webkit=parseFloat(m[1]);}
+if(!o.webkit){m=ua.match(/Opera[\s\/]([^\s]*)/);if(m&&m[1]){o.opera=parseFloat(m[1]);}else{m=ua.match(/MSIE\s([^;]*)/);if(m&&m[1]){o.ie=parseFloat(m[1]);}else{m=ua.match(/Gecko\/([^\s]*)/);if(m){o.gecko=1;m=ua.match(/rv:([^\s\)]*)/);if(m&&m[1]){o.gecko=parseFloat(m[1]);}}}}}
+return o;}();(function(){YAHOO.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}}
+if(unique){ls.push(l);}}}})();YAHOO.lang={isArray:function(o){if(o){var l=YAHOO.lang;return l.isNumber(o.length)&&l.isFunction(o.splice)&&!l.hasOwnProperty(o.length);}
+return false;},isBoolean:function(o){return typeof o==='boolean';},isFunction:function(o){return typeof o==='function';},isNull:function(o){return o===null;},isNumber:function(o){return typeof o==='number'&&isFinite(o);},isObject:function(o){return(o&&(typeof o==='object'||YAHOO.lang.isFunction(o)))||false;},isString:function(o){return typeof o==='string';},isUndefined:function(o){return typeof o==='undefined';},hasOwnProperty:function(o,prop){if(Object.prototype.hasOwnProperty){return o.hasOwnProperty(prop);}
+return!YAHOO.lang.isUndefined(o[prop])&&o.constructor.prototype[prop]!==o[prop];},_IEEnumFix:function(r,s){if(YAHOO.env.ua.ie){var add=["toString","valueOf"];for(i=0;i<add.length;i=i+1){var fname=add[i],f=s[fname];if(YAHOO.lang.isFunction(f)&&f!=Object.prototype[fname]){r[fname]=f;}}}},extend:function(subc,superc,overrides){if(!superc||!subc){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");}
+var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;}
+if(overrides){for(var i in overrides){subc.prototype[i]=overrides[i];}
+YAHOO.lang._IEEnumFix(subc.prototype,overrides);}},augmentObject:function(r,s){if(!s||!r){throw new Error("Absorb failed, verify dependencies.");}
+var a=arguments,i,p,override=a[2];if(override&&override!==true){for(i=2;i<a.length;i=i+1){r[a[i]]=s[a[i]];}}else{for(p in s){if(override||!r[p]){r[p]=s[p];}}
+YAHOO.lang._IEEnumFix(r,s);}},augmentProto:function(r,s){if(!s||!r){throw new Error("Augment failed, verify dependencies.");}
+var a=[r.prototype,s.prototype];for(var i=2;i<arguments.length;i=i+1){a.push(arguments[i]);}
+YAHOO.lang.augmentObject.apply(this,a);},dump:function(o,d){var l=YAHOO.lang,i,len,s=[],OBJ="{...}",FUN="f(){...}",COMMA=', ',ARROW=' => ';if(!l.isObject(o)||o instanceof Date||("nodeType"in o&&"tagName"in o)){return o;}else if(l.isFunction(o)){return FUN;}
+d=(l.isNumber(d))?d:3;if(l.isArray(o)){s.push("[");for(i=0,len=o.length;i<len;i=i+1){if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
+s.push(COMMA);}
+if(s.length>1){s.pop();}
+s.push("]");}else{s.push("{");for(i in o){if(l.hasOwnProperty(o,i)){s.push(i+ARROW);if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
+s.push(COMMA);}}
+if(s.length>1){s.pop();}
+s.push("}");}
+return s.join("");},substitute:function(s,o,f){var i,j,k,key,v,meta,l=YAHOO.lang,saved=[],token,DUMP='dump',SPACE=' ',LBRACE='{',RBRACE='}';for(;;){i=s.lastIndexOf(LBRACE);if(i<0){break;}
+j=s.indexOf(RBRACE,i);if(i+1>=j){break;}
+token=s.substring(i+1,j);key=token;meta=null;k=key.indexOf(SPACE);if(k>-1){meta=key.substring(k+1);key=key.substring(0,k);}
+v=o[key];if(f){v=f(key,v,meta);}
+if(l.isObject(v)){if(l.isArray(v)){v=l.dump(v,parseInt(meta,10));}else{meta=meta||"";var dump=meta.indexOf(DUMP);if(dump>-1){meta=meta.substring(4);}
+if(v.toString===Object.prototype.toString||dump>-1){v=l.dump(v,parseInt(meta,10));}else{v=v.toString();}}}else if(!l.isString(v)&&!l.isNumber(v)){v="~-"+saved.length+"-~";saved[saved.length]=token;}
+s=s.substring(0,i)+v+s.substring(j+1);}
+for(i=saved.length-1;i>=0;i=i-1){s=s.replace(new RegExp("~-"+i+"-~"),"{"+saved[i]+"}","g");}
+return s;},trim:function(s){try{return s.replace(/^\s+|\s+$/g,"");}catch(e){return s;}},merge:function(){var o={},a=arguments,i;for(i=0;i<a.length;i=i+1){YAHOO.lang.augmentObject(o,a[i],true);}
+return o;},isValue:function(o){var l=YAHOO.lang;return(l.isObject(o)||l.isString(o)||l.isNumber(o)||l.isBoolean(o));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.0",build:"442"});
\ No newline at end of file
Added: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yuiloader-beta.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yuiloader-beta.js?view=auto&rev=562538
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yuiloader-beta.js (added)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yuiloader-beta.js Fri Aug 3 11:20:05 2007
@@ -0,0 +1,1408 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.0
+*/
+/**
+ * Provides dynamic loading for the YUI library. It includes the dependency
+ * info for the library, and will automatically pull in dependencies for
+ * the modules requested. It supports rollup files (such as utilities.js
+ * and yahoo-dom-event.js), and will automatically use these when
+ * appropriate in order to minimize the number of http connections
+ * required to load all of the dependencies.
+ *
+ * @module yuiloader
+ * @namespace YAHOO.util
+ */
+
+/**
+ * YUILoader provides dynamic loading for YUI.
+ * @class YAHOO.util.YUILoader
+ * @todo
+ * version management, automatic sandboxing
+ */
+(function() {
+
+ // Define YAHOO_config if it doesn't exist. Only relevant if YAHOO is not
+ // already on the page
+ if (typeof YAHOO_config === "undefined") {
+ YAHOO_config = {};
+ }
+
+ // YUI is locally scoped, only pieces of it will be referenced in YAHOO
+ // after YAHOO has been loaded.
+ var YUI = {
+
+ /*
+ * The library metadata for the current release The is the default
+ * value for YAHOO.util.YUILoader.moduleInfo
+ * @property YUIInfo
+ * @static
+ */
+ info: {
+
+ 'base': 'http://yui.yahooapis.com/2.3.0/build/',
+
+ 'skin': {
+ 'defaultSkin': 'sam',
+ 'base': 'assets/skins/',
+ 'path': 'skin.css',
+ 'rollup': 3
+ },
+
+ 'moduleInfo': {
+
+ 'animation': {
+ 'type': 'js',
+ 'path': 'animation/animation-min.js',
+ 'requires': ['dom', 'event']
+ },
+
+ 'autocomplete': {
+ 'type': 'js',
+ 'path': 'autocomplete/autocomplete-min.js',
+ 'requires': ['dom', 'event'],
+ 'optional': ['connection', 'animation'],
+ 'skinnable': true
+ },
+
+ 'button': {
+ 'type': 'js',
+ 'path': 'button/button-beta-min.js',
+ 'requires': ['element'],
+ 'optional': ['menu'],
+ 'skinnable': true
+ },
+
+ 'calendar': {
+ 'type': 'js',
+ 'path': 'calendar/calendar-min.js',
+ 'requires': ['event', 'dom'],
+ 'skinnable': true
+ },
+
+ 'colorpicker': {
+ 'type': 'js',
+ 'path': 'colorpicker/colorpicker-beta-min.js',
+ 'requires': ['slider', 'element'],
+ 'optional': ['animation'],
+ 'skinnable': true
+ },
+
+ 'connection': {
+ 'type': 'js',
+ 'path': 'connection/connection-min.js',
+ 'requires': ['event']
+ },
+
+ 'container': {
+ 'type': 'js',
+ 'path': 'container/container-min.js',
+ 'requires': ['dom', 'event'],
+ // button is optional, but creates a circular dep
+ //'optional': ['dragdrop', 'animation', 'button'],
+ 'optional': ['dragdrop', 'animation'],
+ 'supersedes': ['containercore'],
+ 'skinnable': true
+ },
+
+ 'containercore': {
+ 'type': 'js',
+ 'path': 'container/container_core-min.js',
+ 'requires': ['dom', 'event']
+ },
+
+ 'datasource': {
+ 'type': 'js',
+ 'path': 'datasource/datasource-beta-min.js',
+ 'requires': ['event'],
+ 'optional': ['connection']
+ },
+
+ 'datatable': {
+ 'type': 'js',
+ 'path': 'datatable/datatable-beta-min.js',
+ 'requires': ['element', 'datasource'],
+ 'optional': ['calendar', 'dragdrop'],
+ 'skinnable': true
+ },
+
+ 'dom': {
+ 'type': 'js',
+ 'path': 'dom/dom-min.js',
+ 'requires': ['yahoo']
+ },
+
+ 'dragdrop': {
+ 'type': 'js',
+ 'path': 'dragdrop/dragdrop-min.js',
+ 'requires': ['dom', 'event']
+ },
+
+ 'editor': {
+ 'type': 'js',
+ 'path': 'editor/editor-beta-min.js',
+ 'requires': ['menu', 'container', 'element', 'button'],
+ 'optional': ['animation', 'dragdrop'],
+ 'skinnable': true
+ },
+
+ 'element': {
+ 'type': 'js',
+ 'path': 'element/element-beta-min.js',
+ 'requires': ['dom', 'event']
+ },
+
+ 'event': {
+ 'type': 'js',
+ 'path': 'event/event-min.js',
+ 'requires': ['yahoo']
+ },
+
+ 'fonts': {
+ 'type': 'css',
+ 'path': 'fonts/fonts-min.css'
+ },
+
+ 'grids': {
+ 'type': 'css',
+ 'path': 'grids/grids-min.css',
+ 'requires': ['fonts'],
+ 'optional': ['reset']
+ },
+
+ 'history': {
+ 'type': 'js',
+ 'path': 'history/history-beta-min.js',
+ 'requires': ['event']
+ },
+
+ 'imageloader': {
+ 'type': 'js',
+ 'path': 'imageloader/imageloader-experimental-min.js',
+ 'requires': ['event', 'dom']
+ },
+
+ 'logger': {
+ 'type': 'js',
+ 'path': 'logger/logger-min.js',
+ 'requires': ['event', 'dom'],
+ 'optional': ['dragdrop'],
+ 'skinnable': true
+ },
+
+ 'menu': {
+ 'type': 'js',
+ 'path': 'menu/menu-min.js',
+ 'requires': ['containercore'],
+ 'skinnable': true
+ },
+
+ 'reset': {
+ 'type': 'css',
+ 'path': 'reset/reset-min.css'
+ },
+
+ 'reset-fonts-grids': {
+ 'type': 'css',
+ 'path': 'reset-fonts-grids/reset-fonts-grids.css',
+ 'supersedes': ['reset', 'fonts', 'grids']
+ },
+
+ 'slider': {
+ 'type': 'js',
+ 'path': 'slider/slider-min.js',
+ 'requires': ['dragdrop'],
+ 'optional': ['animation']
+ },
+
+ 'tabview': {
+ 'type': 'js',
+ 'path': 'tabview/tabview-min.js',
+ 'requires': ['element'],
+ 'optional': ['connection'],
+ 'skinnable': true
+ },
+
+ 'treeview': {
+ 'type': 'js',
+ 'path': 'treeview/treeview-min.js',
+ 'requires': ['event'],
+ 'skinnable': true
+ },
+
+ 'utilities': {
+ 'type': 'js',
+ 'path': 'utilities/utilities.js',
+ 'supersedes': ['yahoo', 'event', 'dragdrop', 'animation', 'dom', 'connection', 'element', 'yahoo-dom-event'],
+ 'rollup': 6
+ },
+
+ 'yahoo': {
+ 'type': 'js',
+ 'path': 'yahoo/yahoo-min.js'
+ },
+
+ 'yahoo-dom-event': {
+ 'type': 'js',
+ 'path': 'yahoo-dom-event/yahoo-dom-event.js',
+ 'supersedes': ['yahoo', 'event', 'dom'],
+ 'rollup': 3
+ },
+
+ 'yuiloader': {
+ 'type': 'js',
+ 'path': 'yuiloader/yuiloader-beta-min.js'
+ },
+
+ 'yuitest': {
+ 'type': 'js',
+ 'path': 'yuitest/yuitest-beta-min.js',
+ 'requires': ['logger'],
+ 'skinnable': true
+ }
+ }
+}
+ ,
+
+ // Simple utils since we can't count on YAHOO.lang being available.
+ ObjectUtil: {
+ appendArray: function(o, a) {
+ if (a) {
+ for (var i=0; i<a.length; i=i+1) {
+ o[a[i]] = true;
+ }
+ }
+ },
+
+ clone: function(o) {
+ var c = {};
+ for (var i in o) {
+ c[i] = o[i];
+ }
+ return c;
+ },
+
+ merge: function() {
+ var o={}, a=arguments, i, j;
+ for (i=0; i<a.length; i=i+1) {
+
+ for (j in a[i]) {
+ o[j] = a[i][j];
+ }
+ }
+ return o;
+ },
+
+ keys: function(o, ordered) {
+ var a=[], i;
+ for (i in o) {
+ a.push(i);
+ }
+
+ return a;
+ }
+ },
+
+ ArrayUtil: {
+
+ appendArray: function(a1, a2) {
+ Array.prototype.push.apply(a1, a2);
+ /*
+ for (var i=0; i<a2.length; i=i+1) {
+ a1.push(a2[i]);
+ }
+ */
+ },
+
+ indexOf: function(a, val) {
+ for (var i=0; i<a.length; i=i+1) {
+ if (a[i] === val) {
+ return i;
+ }
+ }
+
+ return -1;
+ },
+
+ toObject: function(a) {
+ var o = {};
+ for (var i=0; i<a.length; i=i+1) {
+ o[a[i]] = true;
+ }
+
+ return o;
+ },
+
+ /*
+ * Returns a unique array. Does not maintain order, which is fine
+ * for this application, and performs better than it would if it
+ * did.
+ */
+ uniq: function(a) {
+ return YUI.ObjectUtil.keys(YUI.ArrayUtil.toObject(a));
+ }
+ },
+
+
+ // loader instances
+ loaders: [],
+
+ finishInit: function(yahooref) {
+
+ // YAHOO has been loaded either in this window or passed
+ // from the sandbox routine. Set up local references
+ // to the loader and module metadata in the YAHOO object
+ // in question so additional modules can be loaded.
+
+ yahooref = yahooref || YAHOO;
+
+ yahooref.env.YUIInfo=YUI.info;
+ yahooref.util.YUILoader=YUI.YUILoader;
+
+ },
+
+ /*
+ * Global handler for the module loaded event exposed by
+ * YAHOO
+ */
+ onModuleLoaded: function(minfo) {
+
+ var mname = minfo.name, m;
+
+ for (var i=0; i<YUI.loaders.length; i=i+1) {
+ YUI.loaders[i].loadNext(mname);
+ }
+
+ //console.log(YAHOO.lang.dump(minfo));
+
+ },
+
+ /*
+ * Sets up the module metadata
+ */
+ init: function() {
+
+ var c = YAHOO_config, o = c.load,
+ y_loaded = (typeof YAHOO !== "undefined" && YAHOO.env);
+
+
+ // add our listener to the existing YAHOO.env.listeners stack
+ if (y_loaded) {
+
+ YAHOO.env.listeners.push(YUI.onModuleLoaded);
+
+ // define a listener in YAHOO_config that YAHOO will pick up
+ // when it is loaded.
+ } else {
+
+ if (c.listener) {
+ YUI.cachedCallback = c.listener;
+ }
+
+ c.listener = function(minfo) {
+ YUI.onModuleLoaded(minfo);
+ if (YUI.cachedCallback) {
+ YUI.cachedCallback(minfo);
+ }
+ };
+ }
+
+ // Fetch the required modules immediately if specified
+ // in YAHOO_config. Otherwise detect YAHOO and fetch
+ // it if it doesn't exist so we have a place to put
+ // the loader. The problem with this is that it will
+ // prevent rollups from working
+ if (o || !y_loaded) {
+
+ o = o || {};
+
+ var loader = new YUI.YUILoader(o);
+ loader.onLoadComplete = function() {
+
+ YUI.finishInit();
+
+ if (o.onLoadComplete) {
+
+ loader._pushEvents();
+ o.onLoadComplete(loader);
+ }
+
+
+ };
+
+ // If no load was requested, we must load YAHOO
+ // so we have a place to put the loader
+ if (!y_loaded) {
+ loader.require("yahoo");
+ }
+
+ loader.insert(null, o);
+ } else {
+ YUI.finishInit();
+ }
+ }
+
+ };
+
+ YUI.YUILoader = function(o) {
+
+ // Inform the library that it is being injected
+ YAHOO_config.injecting = true;
+
+ o = o || {};
+
+ /**
+ * Internal callback to handle multiple internal insert() calls
+ * so that css is inserted prior to js
+ * @property _internalCallback
+ * @private
+ */
+ this._internalCallback = null;
+
+ /**
+ * Callback that will be executed when the loader is finished
+ * with an insert
+ * @method onLoadComplete
+ * @type function
+ */
+ this.onLoadComplete = null;
+
+ /**
+ * The base directory.
+ * @property base
+ * @type string
+ * @default build
+ */
+ this.base = ("base" in o) ? o.base : YUI.info.base;
+
+ /**
+ * Should we allow rollups
+ * @property allowRollup
+ * @type boolean
+ * @default true
+ */
+ this.allowRollup = ("allowRollup" in o) ? o.allowRollup : true;
+
+ /**
+ * Filter to apply to result url
+ * @property filter
+ * @type string|object
+ */
+ this.filter = o.filter;
+
+ /**
+ * Create a sandbox rather than inserting into lib into.
+ * the current context. Not currently supported
+ * property sandbox
+ * @type boolean
+ * @default false
+ */
+ this.sandbox = o.sandbox;
+
+ /**
+ * The list of requested modules
+ * @property required
+ * @type {string: boolean}
+ */
+ this.required = {};
+
+ /**
+ * The library metadata
+ * @property moduleInfo
+ */
+ this.moduleInfo = o.moduleInfo || YUI.info.moduleInfo;
+
+ /**
+ * List of rollup files found in the library metadata
+ * @property rollups
+ */
+ this.rollups = null;
+
+ /**
+ * Whether or not to load optional dependencies for
+ * the requested modules
+ * @property loadOptional
+ * @type boolean
+ * @default false
+ */
+ this.loadOptional = o.loadOptional || false;
+
+ /**
+ * All of the derived dependencies in sorted order, which
+ * will be populated when either calculate() or insert()
+ * is called
+ * @property sorted
+ * @type string[]
+ */
+ this.sorted = [];
+
+ /**
+ * Set when beginning to compute the dependency tree.
+ * Composed of what YAHOO reports to be loaded combined
+ * with what has been loaded by the tool
+ * @propery loaded
+ * @type {string: boolean}
+ */
+ this.loaded = {};
+
+ /**
+ * Flag to indicate the dependency tree needs to be recomputed
+ * if insert is called again.
+ * @property dirty
+ * @type boolean
+ * @default true
+ */
+ this.dirty = true;
+
+ /**
+ * List of modules inserted by the utility
+ * @property inserted
+ * @type {string: boolean}
+ */
+ this.inserted = {};
+
+
+ /**
+ * Provides the information used to skin the skinnable components.
+ * The following skin definition would result in 'skin1' and 'skin2'
+ * being loaded for calendar (if calendar was requested), and
+ * 'sam' for all other skinnable components:
+ *
+ * <code>
+ * skin: {
+ *
+ * // The default skin, which is automatically applied if not
+ * // overriden by a component-specific skin definition.
+ * // Change this in to apply a different skin globally
+ * defaultSkin: 'sam',
+ *
+ * // This is combined with the loader base property to get
+ * // the default root directory for a skin. ex:
+ * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
+ * base: 'assets/skins/',
+ *
+ * // The name of the rollup css file for the skin
+ * path: 'skin.css',
+ *
+ * // The number of skinnable components requested that are
+ * // required before using the rollup file rather than the
+ * // individual component css files
+ * rollup: 3,
+ *
+ * // Any component-specific overrides can be specified here,
+ * // making it possible to load different skins for different
+ * // components. It is possible to load more than one skin
+ * // for a given component as well.
+ * overrides: {
+ * calendar: ['skin1', 'skin2']
+ * }
+ * }
+ * </code>
+ * @property skin
+ */
+ this.skin = o.skin || YUI.ObjectUtil.clone(YUI.info.skin);
+
+
+ if (o.require) {
+ this.require(o.require);
+ }
+
+ YUI.loaders.push(this);
+ };
+
+ YUI.YUILoader.prototype = {
+
+ FILTERS: {
+ RAW: {
+ 'searchExp': "-min\\.js",
+ 'replaceStr': ".js"
+ },
+ DEBUG: {
+ 'searchExp': "-min\\.js",
+ 'replaceStr': "-debug.js"
+ }
+ },
+
+ SKIN_PREFIX: "skin-",
+
+ /** Add a new module to the component metadata. The javascript
+ * component must also use YAHOO.register to notify the loader
+ * when it has been loaded, or a verifier function must be
+ * provided
+ * <dl>
+ * <dt>name:</dt> <dd>required, the component name</dd>
+ * <dt>type:</dt> <dd>required, the component type (js or css)</dd>
+ * <dt>path:</dt> <dd>required, the path to the script from "base"</dd>
+ * <dt>requires:</dt> <dd>the modules required by this component</dd>
+ * <dt>optional:</dt> <dd>the optional modules for this component</dd>
+ * <dt>supersedes:</dt> <dd>the modules this component replaces</dd>
+ * <dt>rollup:</dt> <dd>the number of superseded modules required for automatic rollup</dd>
+ * <dt>verifier:</dt> <dd>a function that is executed to determine when the module is fully loaded</dd>
+ * <dt>fullpath:</dt> <dd>If fullpath is specified, this is used instead of the configured base + path</dd>
+ * <dt>skinnable:</dt> <dd>flag to determine if skin assets should automatically be pulled in</dd>
+ * </dl>
+ * @method addModule
+ * @param o An object containing the module data
+ * @return {boolean} true if the module was added, false if
+ * the object passed in did not provide all required attributes
+ */
+ addModule: function(o) {
+
+ if (!o || !o.name || !o.type || (!o.path && !o.fullpath)) {
+ return false;
+ }
+
+ this.moduleInfo[o.name] = o;
+ this.dirty = true;
+
+ return true;
+ },
+
+ /**
+ * Add a requirement for one or more module
+ * @method require
+ * @param what {string[] | string*} the modules to load
+ */
+ require: function(what) {
+ var a = (typeof what === "string") ? arguments : what;
+
+ this.dirty = true;
+
+ for (var i=0; i<a.length; i=i+1) {
+ this.required[a[i]] = true;
+ var s = this.parseSkin(a[i]);
+ if (s) {
+ this._addSkin(s.skin, s.module);
+ }
+ }
+ YUI.ObjectUtil.appendArray(this.required, a);
+ },
+
+
+ /**
+ * Adds the skin def to the module info
+ * @method _addSkin
+ * @private
+ */
+ _addSkin: function(skin, mod) {
+
+ // Add a module definition for the skin rollup css
+ var name = this.formatSkin(skin);
+ if (!this.moduleInfo[name]) {
+ this.addModule({
+ 'name': name,
+ 'type': 'css',
+ 'path': this.skin.base + skin + "/" + this.skin.path,
+ //'supersedes': '*',
+ 'rollup': this.skin.rollup
+ });
+ }
+
+ // Add a module definition for the module-specific skin css
+ if (mod) {
+ name = this.formatSkin(skin, mod);
+ if (!this.moduleInfo[name]) {
+ this.addModule({
+ 'name': name,
+ 'type': 'css',
+ //'path': this.skin.base + skin + "/" + mod + ".css"
+ 'path': mod + '/' + this.skin.base + skin + "/" + mod + ".css"
+ });
+ }
+ }
+ },
+
+ /**
+ * Returns an object containing properties for all modules required
+ * in order to load the requested module
+ * @method getRequires
+ * @param mod The module definition from moduleInfo
+ */
+ getRequires: function(mod) {
+ if (!this.dirty && mod.expanded) {
+ return mod.expanded;
+ }
+
+ mod.requires=mod.requires || [];
+ var i, d=[], r=mod.requires, o=mod.optional, s=mod.supersedes, info=this.moduleInfo;
+ for (i=0; i<r.length; i=i+1) {
+ d.push(r[i]);
+ YUI.ArrayUtil.appendArray(d, this.getRequires(info[r[i]]));
+ }
+
+ if (o && this.loadOptional) {
+ for (i=0; i<o.length; i=i+1) {
+ d.push(o[i]);
+ YUI.ArrayUtil.appendArray(d, this.getRequires(info[o[i]]));
+ }
+ }
+
+ mod.expanded = YUI.ArrayUtil.uniq(d);
+
+ return mod.expanded;
+ },
+
+ /**
+ * Returns an object literal of the modules the supplied module satisfies
+ * @method getProvides
+ * @param mod The module definition from moduleInfo
+ * @return what this module provides
+ */
+ getProvides: function(name) {
+ var mod = this.moduleInfo[name];
+
+ var o = {};
+ o[name] = true;
+ s = mod && mod.supersedes;
+
+ YUI.ObjectUtil.appendArray(o, s);
+
+ // console.log(this.sorted + ", " + name + " provides " + YUI.ObjectUtil.keys(o));
+
+ return o;
+ },
+
+ /**
+ * Calculates the dependency tree, the result is stored in the sorted
+ * property
+ * @method calculate
+ * @param o optional options object
+ */
+ calculate: function(o) {
+ if (this.dirty) {
+
+ this._setup(o);
+ this._explode();
+ this._skin();
+ if (this.allowRollup) {
+ this._rollup();
+ }
+ this._reduce();
+ this._sort();
+
+ this.dirty = false;
+ }
+ },
+
+ /**
+ * Investigates the current YUI configuration on the page. By default,
+ * modules already detected will not be loaded again unless a force
+ * option is encountered. Called by calculate()
+ * @method _setup
+ * @param o optional options object
+ * @private
+ */
+ _setup: function(o) {
+
+ o = o || {};
+ this.loaded = YUI.ObjectUtil.clone(this.inserted);
+
+ if (!this.sandbox && typeof YAHOO !== "undefined" && YAHOO.env) {
+ this.loaded = YUI.ObjectUtil.merge(this.loaded, YAHOO.env.modules);
+ }
+
+ // add the ignore list to the list of loaded packages
+ if (o.ignore) {
+ YUI.ObjectUtil.appendArray(this.loaded, o.ignore);
+ }
+
+ // remove modules on the force list from the loaded list
+ if (o.force) {
+ for (var i=0; i<o.force.length; i=i+1) {
+ if (o.force[i] in this.loaded) {
+ delete this.loaded[o.force[i]];
+ }
+ }
+ }
+ },
+
+
+ /**
+ * Inspects the required modules list looking for additional
+ * dependencies. Expands the required list to include all
+ * required modules. Called by calculate()
+ * @method _explode
+ * @private
+ */
+ _explode: function() {
+
+ var r=this.required, i, mod;
+
+ for (i in r) {
+ mod = this.moduleInfo[i];
+ if (mod) {
+
+ var req = this.getRequires(mod);
+
+ if (req) {
+ YUI.ObjectUtil.appendArray(r, req);
+ }
+ }
+ }
+ },
+
+ /**
+ * Sets up the requirements for the skin assets if any of the
+ * requested modules are skinnable
+ * @method _skin
+ * @private
+ */
+ _skin: function() {
+
+ var r=this.required, i, mod;
+
+ for (i in r) {
+ mod = this.moduleInfo[i];
+ if (mod && mod.skinnable) {
+ var o=this.skin.override, j;
+ if (o && o[i]) {
+ for (j=0; j<o[i].length; j=j+1) {
+ this.require(this.formatSkin(o[i][j], i));
+ }
+ } else {
+ this.require(this.formatSkin(this.skin.defaultSkin, i));
+ }
+ }
+ }
+ },
+
+ /**
+ * Returns the skin module name for the specified skin name. If a
+ * module name is supplied, the returned skin module name is
+ * specific to the module passed in.
+ * @method formatSkin
+ * @param skin {string} the name of the skin
+ * @param mod {string} optional: the name of a module to skin
+ * @return {string} the full skin module name
+ */
+ formatSkin: function(skin, mod) {
+ var s = this.SKIN_PREFIX + skin;
+ if (mod) {
+ s = s + "-" + mod;
+ }
+
+ return s;
+ },
+
+ /**
+ * Reverses <code>formatSkin</code>, providing the skin name and
+ * module name if the string matches the pattern for skins.
+ * @method parseSkin
+ * @param mod {string} the module name to parse
+ * @return {skin: string, module: string} the parsed skin name
+ * and module name, or null if the supplied string does not match
+ * the skin pattern
+ */
+ parseSkin: function(mod) {
+
+ if (mod.indexOf(this.SKIN_PREFIX) === 0) {
+ var a = mod.split("-");
+ return {skin: a[1], module: a[2]};
+ }
+
+ return null;
+ },
+
+ /**
+ * Look for rollup packages to determine if all of the modules a
+ * rollup supersedes are required. If so, include the rollup to
+ * help reduce the total number of connections required. Called
+ * by calculate()
+ * @method _rollup
+ * @private
+ */
+ _rollup: function() {
+ var i, j, m, s, rollups={}, r=this.required, roll;
+
+ // find and cache rollup modules
+ if (this.dirty || !this.rollups) {
+ for (i in this.moduleInfo) {
+ m = this.moduleInfo[i];
+ //if (m && m.rollup && m.supersedes) {
+ if (m && m.rollup) {
+ rollups[i] = m;
+ }
+ }
+
+ this.rollups = rollups;
+ }
+
+ // make as many passes as needed to pick up rollup rollups
+ for (;;) {
+ var rolled = false;
+
+ // go through the rollup candidates
+ for (i in rollups) {
+
+ // there can be only one
+ if (!r[i] && !this.loaded[i]) {
+ m =this.moduleInfo[i]; s = m.supersedes; roll=true;
+
+ if (!m.rollup) {
+ continue;
+ }
+
+
+ var skin = this.parseSkin(i), c = 0;
+ if (skin) {
+
+ for (j in r) {
+ if (i !== j && this.parseSkin(j)) {
+ c++;
+ roll = (c >= m.rollup);
+ if (roll) {
+ break;
+ }
+ }
+ }
+
+
+ } else {
+
+ // require all modules to trigger a rollup (using the
+ // threshold value has not proved worthwhile)
+ for (j=0;j<s.length;j=j+1) {
+
+ // if the superseded module is loaded, we can't load the rollup
+ if (this.loaded[s[j]]) {
+ roll = false;
+ break;
+ // increment the counter if this module is required. if we are
+ // beyond the rollup threshold, we will use the rollup module
+ } else if (r[s[j]]) {
+ c++;
+ roll = (c >= m.rollup);
+ if (roll) {
+ break;
+ }
+ }
+ }
+ }
+
+ if (roll) {
+ // add the rollup
+ r[i] = true;
+ rolled = true;
+
+ // expand the rollup's dependencies
+ this.getRequires(m);
+ }
+ }
+ }
+
+ // if we made it here w/o rolling up something, we are done
+ if (!rolled) {
+ break;
+ }
+ }
+ },
+
+ /**
+ * Remove superceded modules and loaded modules. Called by
+ * calculate() after we have the mega list of all dependencies
+ * @method _reduce
+ * @private
+ */
+ _reduce: function() {
+
+ var i, j, s, m, r=this.required;
+ for (i in r) {
+
+ // remove if already loaded
+ if (i in this.loaded) {
+ delete r[i];
+
+ // remove anything this module supersedes
+ } else {
+
+ var skinDef = this.parseSkin(i);
+
+ if (skinDef) {
+ //console.log("skin found in reduce: " + skinDef.skin + ", " + skinDef.module);
+ // the skin rollup will not have a module name
+ if (!skinDef.module) {
+ var skin_pre = this.SKIN_PREFIX + skinDef.skin;
+ //console.log("skin_pre: " + skin_pre);
+ for (j in r) {
+ if (j !== i && j.indexOf(skin_pre) > -1) {
+ //console.log ("removing component skin: " + j);
+ delete r[j];
+ }
+ }
+ }
+ } else {
+
+ m = this.moduleInfo[i];
+ s = m && m.supersedes;
+ if (s) {
+ for (j=0;j<s.length;j=j+1) {
+ if (s[j] in r) {
+ delete r[s[j]];
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+
+ /**
+ * Sorts the dependency tree. The last step of calculate()
+ * @method _sort
+ * @private
+ */
+ _sort: function() {
+ // create an indexed list
+ var s=[], info=this.moduleInfo, loaded=this.loaded;
+
+ // returns true if b is not loaded, and is required
+ // directly or by means of modules it supersedes.
+ var requires = function(aa, bb) {
+ if (loaded[bb]) {
+ return false;
+ }
+
+ var ii, mm=info[aa], rr=mm && mm.expanded;
+
+ if (rr && YUI.ArrayUtil.indexOf(rr, bb) > -1) {
+ return true;
+ }
+
+ var ss=info[bb] && info[bb].supersedes;
+ if (ss) {
+ for (ii=0; ii<ss.length; ii=i+1) {
+ if (requires(aa, ss[ii])) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ };
+
+ // get the required items out of the obj into an array so we
+ // can sort
+ for (var i in this.required) {
+ s.push(i);
+ }
+
+ // pointer to the first unsorted item
+ var p=0;
+
+ // keep going until we make a pass without moving anything
+ for (;;) {
+
+ var l=s.length, a, b, j, k, moved=false;
+
+ // start the loop after items that are already sorted
+ for (j=p; j<l; j=j+1) {
+
+ // check the next module on the list to see if its
+ // dependencies have been met
+ a = s[j];
+
+ // check everything below current item and move if we
+ // find a requirement for the current item
+ for (k=j+1; k<l; k=k+1) {
+ if (requires(a, s[k])) {
+
+ // extract the dependency so we can move it up
+ b = s.splice(k, 1);
+
+ // insert the dependency above the item that
+ // requires it
+ s.splice(j, 0, b[0]);
+
+ moved = true;
+ break;
+ }
+ }
+
+ // jump out of loop if we moved something
+ if (moved) {
+ break;
+ // this item is sorted, move our pointer and keep going
+ } else {
+ p = p + 1;
+ }
+ }
+
+ // when we make it here and moved is false, we are
+ // finished sorting
+ if (!moved) {
+ break;
+ }
+
+ }
+
+ this.sorted = s;
+ },
+
+ /**
+ * inserts the requested modules and their dependencies.
+ * <code>type</code> can be "js" or "css". Both script and
+ * css are inserted if type is not provided.
+ * @method insert
+ * @param callback {Function} a function to execute when the load
+ * is complete.
+ * @param o optional options object
+ * @param type {string} the type of dependency to insert
+ */
+ insert: function(callback, o, type) {
+
+ //if (!this.onLoadComplete) {
+ //this.onLoadComplete = callback;
+ //}
+
+ if (!type) {
+ var self = this;
+ this._internalCallback = function() {
+ self._internalCallback = null;
+ self.insert(callback, o, "js");
+ };
+ this.insert(null, o, "css");
+ return;
+ }
+
+ o = o || {};
+
+ // store the callback for when we are done
+ this.onLoadComplete = callback || this.onLoadComplete;
+
+ // store the optional filter
+ var f = o && o.filter || null;
+
+ if (typeof f === "string") {
+ f = f.toUpperCase();
+
+ // the logger must be available in order to use the debug
+ // versions of the library
+ if (f === "DEBUG") {
+ this.require("logger");
+ }
+ }
+
+ this.filter = this.FILTERS[f] || f || this.FILTERS[this.filter] || this.filter;
+
+ // store the options... not currently in use
+ this.insertOptions = o;
+
+ // build the dependency list
+ this.calculate(o);
+
+ // set a flag to indicate the load has started
+ this.loading = true;
+
+ // keep the loadType (js, css or undefined) cached
+ this.loadType = type;
+
+ // start the load
+ this.loadNext();
+
+ },
+
+ /**
+ * Executed every time a module is loaded, and if we are in a load
+ * cycle, we attempt to load the next script. Public so that it
+ * is possible to call this if using a method other than
+ * YAHOO.register to determine when scripts are fully loaded
+ * @method loadNext
+ * @param mname {string} optional the name of the module that has
+ * been loaded (which is usually why it is time to load the next
+ * one)
+ */
+ loadNext: function(mname) {
+
+ // console.log("loadNext executing, just loaded " + mname);
+
+ // The global handler that is called when each module is loaded
+ // will pass that module name to this function. Storing this
+ // data to avoid loading the same module multiple times
+ if (mname) {
+ this.inserted[mname] = true;
+ //var o = this.getProvides(mname);
+ //this.inserted = YUI.ObjectUtil.merge(this.inserted, o);
+ }
+
+ // It is possible that this function is executed due to something
+ // else one the page loading a YUI module. Only react when we
+ // are actively loading something
+ if (!this.loading) {
+ return;
+ }
+
+ // if the module that was just loaded isn't what we were expecting,
+ // continue to wait
+ if (mname && mname !== this.loading) {
+ return;
+ }
+
+ var s=this.sorted, len=s.length, i, m, url;
+
+ for (i=0; i<len; i=i+1) {
+
+ // This.inserted keeps track of what the loader has loaded
+ if (s[i] in this.inserted) {
+ // console.log(s[i] + " alread loaded ");
+ continue;
+ }
+
+ // Because rollups will cause multiple load notifications
+ // from YAHOO, loadNext may be called multiple times for
+ // the same module when loading a rollup. We can safely
+ // skip the subsequent requests
+ if (s[i] === this.loading) {
+ // console.log("still loading " + s[i] + ", waiting");
+ return;
+ }
+
+ // log("inserting " + s[i]);
+
+ m = this.moduleInfo[s[i]];
+
+ // The load type is stored to offer the possibility to load
+ // the css separately from the script.
+ if (!this.loadType || this.loadType === m.type) {
+ this.loading = s[i];
+
+ // Insert the css node and continue. It is possible
+ // that the css file will load out of order ... this
+ // may be a problem that needs to be addressed, but
+ // unlike the script files, there is no notification
+ // mechanism in place for the css files.
+ if (m.type === "css") {
+
+ url = m.fullpath || this._url(m.path);
+
+ this.insertCss(url);
+ this.inserted[s[i]] = true;
+
+ // Scripts must be loaded in order, so we wait for the
+ // notification from YAHOO or a verifier function to
+ // process the next script
+ } else {
+
+ url = m.fullpath || this._url(m.path);
+ this.insertScript(url);
+
+ // if a verifier was included for this module, execute
+ // it, passing the name of the module, and a callback
+ // that must be exectued when the verifier is done.
+ if (m.verifier) {
+ var self = this, name=s[i];
+ m.verifier(name, function() {
+ self.loadNext(name);
+ });
+ }
+
+ return;
+ }
+ }
+ }
+
+ // we are finished
+ this.loading = null;
+
+
+ // internal callback for loading css first
+ if (this._internalCallback) {
+ var f = this._internalCallback;
+ this._internalCallback = null;
+ f(this);
+ } else if (this.onLoadComplete) {
+ this._pushEvents();
+ this.onLoadComplete(this);
+ }
+
+ },
+
+ /**
+ * In IE, the onAvailable/onDOMReady events need help when Event is
+ * loaded dynamically
+ * @method _pushEvents
+ * @private
+ */
+ _pushEvents: function() {
+ if (typeof YAHOO !== "undefined" && YAHOO.util && YAHOO.util.Event) {
+ YAHOO.util.Event._load();
+ }
+ },
+
+ /**
+ * Generates the full url for a module
+ * method _url
+ * @param path {string} the path fragment
+ * @return {string} the full url
+ * @private
+ */
+ _url: function(path) {
+
+ var u = this.base || "", f=this.filter;
+ u = u + path;
+
+ if (f) {
+ // console.log("filter: " + f + ", " + f.searchExp +
+ // ", " + f.replaceStr);
+ u = u.replace(new RegExp(f.searchExp), f.replaceStr);
+ }
+
+ // console.log(u);
+
+ return u;
+ },
+
+ /**
+ * Inserts a script node
+ * @method insertScript
+ * @param url {string} the full url for the script
+ * @param win {Window} optional window to target
+ */
+ insertScript: function(url, win) {
+
+ //console.log("inserting script " + url);
+ var w = win || window, d=w.document, n=d.createElement("script"),
+ h = d.getElementsByTagName("head")[0];
+
+ n.src = url;
+ n.type = "text/javascript";
+ h.appendChild(n);
+ },
+
+ /**
+ * Inserts a css link node
+ * @method insertCss
+ * @param url {string} the full url for the script
+ * @param win {Window} optional window to target
+ */
+ insertCss: function(url, win) {
+ // console.log("inserting css " + url);
+ var w = win || window, d=w.document, n=d.createElement("link"),
+ h = d.getElementsByTagName("head")[0];
+
+ n.href = url;
+ n.type = "text/css";
+ n.rel = "stylesheet";
+ h.appendChild(n);
+ },
+
+ /*
+ * Interns the script for the requested modules. The callback is
+ * provided a reference to the sandboxed YAHOO object. This only
+ * applies to the script: css can not be sandboxed. Not implemented.
+ * @method sandbox
+ * @param callback {Function} the callback to exectued when the load is
+ * complete.
+ * @notimplemented
+ */
+ sandbox: function(callback) {
+ // this.calculate({
+ //sandbox: true
+ //});
+ }
+ };
+
+ YUI.init();
+
+})();