diff --git a/README b/README index c8a5b70..30656d2 100644 --- a/README +++ b/README @@ -48,3 +48,9 @@ phploader/combo.php phploader/tests Contains a number of tests and example loader scripts + +examples + Contains YUI PHP Loader example documentation and working code samples + +api_docs + Contains the standard YUI API style documentation diff --git a/api_docs/PHP.YAHOO_util_Loader.html b/api_docs/PHP.YAHOO_util_Loader.html new file mode 100644 index 0000000..e495864 --- /dev/null +++ b/api_docs/PHP.YAHOO_util_Loader.html @@ -0,0 +1,1271 @@ + + + + + API: phploader PHP.YAHOO_util_Loader (YUI Library) + + + + + + + + + + +
+
+

Yahoo! UI Library

+

phploader  1.0.0beta

+ Yahoo! UI Library + > phploader + > PHP.YAHOO_util_Loader + +
+
+ Search: +
+   +
+
+
+
+ +
+
+
+
+
+ Filters + + + +
+
+ +

+ + + + + Class PHP.YAHOO_util_Loader + + + +

+ + + + + +
+ The YUI PHP loader base class which provides dynamic server-side loading for YUI +
+ +
+

Constructor

+
+
+ PHP.YAHOO_util_Loader + + ( + + + + yuiVersion + + , + cacheKey + + , + modules + + , + noYUI + ) + +
+
+
Parameters:
+
+ yuiVersion + <string> + + Defines which version of YUI metadata to load +
+
+ cacheKey + <string> + + Unique APC cache key. This is combined with the YUI base +so that updates to YUI will force a new cache entry. However, if your custom config +changes, this key should be changed (otherwise the old values will be used until the cache expires). +
+
+ modules + <array> + + A list of custom modules +
+
+ noYUI + <boolean> + + Pass true if you do not want the YUI metadata +
+
+ + +
+
+
+
+ +
+
+

Properties

+
+
+

allowRollups + - boolean +

+
+
+ Should we allow rollups +
+
+ + +
+ Default Value: true +
+ + +
+
+
+

base + - string +

+
+
+ The base directory +
+
+ + +
+ Default Value: http://yui.yahooapis.com/[YUI VERSION]/build/ +
+ + +
+
+
+

combine + - boolean +

+
+
+ Combined into a single request using the combo service to pontentially reduce the number of http requests required. +
+
+ + +
+ Default Value: false +
+ + +
+
+
+

comboBase + - string +

+
+
+ The base path to the combo service. Uses the Yahoo! CDN service by default. +You do not have to set this property to use the combine option. YUI PHP Loader ships +with an intrinsic, lightweight combo-handler as well (see combo.php). +
+
+ + +
+ Default Value: http://yui.yahooapis.com/combo? +
+ + +
+
+
+

filterList + - array +

+
+
+ A list of modules to apply the filter to. If not supplied, all +modules will have any defined filters applied. Tip: Useful for debugging. +
+
+ + +
+ Default Value: null +
+ + +
+
+
+

loadOptional + - boolean +

+
+
+ Whether or not to load optional dependencies for the requested modules +
+
+ + +
+ Default Value: false +
+ + +
+
+
+

rollupsToTop + - boolean +

+
+
+ Force rollup modules to be sorted as moved to the top of +the stack when performing an automatic rollup. This has a very small performance consequence. +
+
+ + +
+ Default Value: false +
+ + +
+
+
+
+ +
+ +
+
+

Methods

+
+
+

+ css

+
+ + + + + string + css + ( + ) + + +
+ Used to output each of the required link tags +
+ +
+ + +
+
Returns: + + string +
+
(e.g.)
+
+ + + + +
+ +
+
+
+
+

+ css_data

+
+ + + + + array + css_data + ( + ) + + +
+ Used to fetch an array of the required CSS components +
+ +
+ + +
+
Returns: + + array +
+
Returns an array of data about each of the identified JavaScript components
+
+ + + + +
+ +
+
+
+
+

+ css_embed

+
+ + + + + string + css_embed + ( + ) + + +
+ Used to embed the raw CSS +
+ +
+ + +
+
Returns: + + string +
+
(e.g.) Returns the style tag(s) with the CSS inline
+
+ + + + +
+ +
+
+
+
+

+ css_json

+
+ + + + + string + css_json + ( + ) + + +
+ Used to fetch a JSON object with the required CSS components +
+ +
+ + +
+
Returns: + + string +
+
Returns a JSON object containing urls for each CSS component
+
+ + + + +
+ +
+
+
+
+

+ css_raw

+
+ + + + + string + css_raw + ( + ) + + +
+ Used to produce the raw CSS code inline without the actual style tags +
+ +
+ + +
+
Returns: + + string +
+
Returns the raw CSS code inline without the actual style tags
+
+ + + + +
+ +
+
+
+
+

+ data

+
+ + + + + string + data + ( + + + moduleType + + + , + allowRollups + + + , + skipSort + + + ) + + +
+ Used to output an Array which contains data about the required JavaScript & CSS components +
+ +
+ +
+
Parameters:
+
+ moduleType + <string> + + Type of html tag to return (i.e.) js or css. Default is both. +
+
+ allowRollups + <boolean> + + +
+
+ skipSort + <boolean> + + +
+
+ +
+
Returns: + + string +
+
+
+ + + + +
+ +
+
+
+
+

+ embed

+
+ + + + + string + embed + ( + + + moduleType + + + , + skipSort + + + ) + + +
+ Used to output each of the required html tags inline (i.e.) script and/or style +
+ +
+ +
+
Parameters:
+
+ moduleType + <string> + + Type of html tag to return (i.e.) js or css. Default is both. +
+
+ skipSort + <boolean> + + +
+
+ +
+
Returns: + + string +
+
Returns the style tag(s) with the CSS inline and/or the script tag(s) with the JavaScript inline
+
+ + + + +
+ +
+
+
+
+

+ getRemoteContent

+
+ + + + + + getRemoteContent + ( + + + url + + + ) + + +
+ Retrieve the contents of a remote resource +
+ +
+ +
+
Parameters:
+
+ url + <string> + + URL to fetch data from +
+
+ + + + + +
+ +
+
+
+
+

+ getUrl

+
+ + + + + void + getUrl + ( + + + name + + + ) + + +
+ Retrieve the calculated url for the component in question +
+ +
+ +
+
Parameters:
+
+ name + <string> + + YUI component name +
+
+ +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ json

+
+ + + + + string + json + ( + + + moduleType + + + , + allowRollups + + + , + skipSort + + + , + full + + + ) + + +
+ Used to fetch a JSON object with the required JavaScript and CSS components +
+ +
+ +
+
Parameters:
+
+ moduleType + <string> + + +
+
+ allowRollups + <boolean> + + +
+
+ skipSort + <boolean> + + +
+
+ full + <boolean> + + +
+
+ +
+
Returns: + + string +
+
Returns a JSON object with the required JavaScript and CSS components
+
+ + + + +
+ +
+
+
+
+

+ load

+
+ + + + + void + load + ( + + + string + + + ) + + +
+ Used to load YUI and/or custom components +
+ +
+ +
+
Parameters:
+
+ string + <object> + + $varname [, string $... ] List of component names +
+
+ +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ raw

+
+ + + + + string + raw + ( + + + moduleType + + + , + allowRollups + + + , + skipSort + + + ) + + +
+ Used to produce the raw Javacript and CSS code inline without the actual script or style tags +
+ +
+ +
+
Parameters:
+
+ moduleType + <string> + + +
+
+ allowRollups + <boolean> + + +
+
+ skipSort + <boolean> + + +
+
+ +
+
Returns: + + string +
+
Returns the raw JavaScript and/or CSS code inline without the actual style tags
+
+ + + + +
+ +
+
+
+
+

+ script

+
+ + + + + string + script + ( + ) + + +
+ Used to output each of the required script tags +
+ +
+ + +
+
Returns: + + string +
+
+
+ + + + +
+ +
+
+
+
+

+ script_data

+
+ + + + + array + script_data + ( + ) + + +
+ Used to fetch an array of the required JavaScript components +
+ +
+ + +
+
Returns: + + array +
+
Returns an array of data about each of the identified JavaScript components
+
+ + + + +
+ +
+
+
+
+

+ script_embed

+
+ + + + + string + script_embed + ( + ) + + +
+ Used to embed the raw JavaScript inline +
+ +
+ + +
+
Returns: + + string +
+
Returns the script tag(s) with the JavaScript inline
+
+ + + + +
+ +
+
+
+
+

+ script_json

+
+ + + + + string + script_json + ( + ) + + +
+ Used to fetch a JSON object with the required JavaScript components +
+ +
+ + +
+
Returns: + + string +
+
Returns a JSON object containing urls for each JavaScript component
+
+ + + + +
+ +
+
+
+
+

+ script_raw

+
+ + + + + string + script_raw + ( + ) + + +
+ Used to produce the raw JavaScript code inline without the actual script tags +
+ +
+ + +
+
Returns: + + string +
+
Returns the raw JavaScript code inline without the actual script tags
+
+ + + + +
+ +
+
+
+
+

+ setLoaded

+
+ + + + + void + setLoaded + ( + + + string + + + ) + + +
+ Used to specify modules that are already on the page that should not be loaded again +
+ +
+ +
+
Parameters:
+
+ string + <object> + + $varname [, string $... ] List of module names +
+
+ +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ tags

+
+ + + + + string + tags + ( + + + moduleType + + + , + skipSort + + + ) + + +
+ Used to output each of the required html tags (i.e.) script or link +
+ +
+ +
+
Parameters:
+
+ moduleType + <string> + + Type of html tag to return (i.e.) js or css. Default is both. +
+
+ skipSort + <boolean> + + +
+
+ +
+
Returns: + + string +
+
+
+ + + + +
+ +
+
+
+
+
+ +
+ +
+ + +
+ +
+ +
+ +
+
+
+ +
+
+
+
+ Copyright © 2009 Yahoo! Inc. All rights reserved. +
+
+ + + diff --git a/api_docs/assets/ac-js b/api_docs/assets/ac-js new file mode 100644 index 0000000..96603be --- /dev/null +++ b/api_docs/assets/ac-js @@ -0,0 +1,145 @@ +(function() { + var Event=YAHOO.util.Event, + Dom=YAHOO.util.Dom, + oACDS, oAutoComp, + show = { + 'private': false, + 'protected': false, + 'deprecated': false + }; + +Event.onAvailable('yui-classopts-form', function() { + //Checkboxes are available.. + var handleClick = function(e) { + var id, checked = false; + if (YAHOO.lang.isString(e)) { + id = e; + } else { + var tar = Event.getTarget(e); + id = tar.id; + } + var el = Dom.get(id); + checked = el.checked; + + var className = id; + if (checked) { + show[id.replace('show_', '')] = true; + Dom.addClass(document.body, className); + YAHOO.util.Cookie.setSub('yuidoc', id, 'checked'); + } else { + show[id.replace('show_', '')] = false; + Dom.removeClass(document.body, className); + YAHOO.util.Cookie.setSub('yuidoc', id, ''); + } + }; + + var checkCookie = function(id) { + var value = YAHOO.util.Cookie.getSub('yuidoc', id), + el = Dom.get(id); + if (value === 'checked') { + el.checked = true; + } else { + el.checked = false; + } + }; + + var els = ['show_deprecated', 'show_protected', 'show_private']; + + for (var i = 0; i < els.length; i++) { + Event.on(els[i], 'click', handleClick); + checkCookie(els[i]); + handleClick(els[i]); + } + +}); + +//Starting the AutoComplete code + var getResults = function(query) { + var results = []; + if(query && query.length > 0) { + + var q = query.toLowerCase(); + + for (var i=0, len=ALL_YUI_PROPS.length; i -1 ) { + results.push([query, prop]); + } + } + } + } + + return results; + }; + + // Define Custom Event handlers + var myOnDataReturn = function(sType, aArgs) { + var oAutoComp = aArgs[0]; + var query = aArgs[1]; + var aResults = aArgs[2]; + + if(aResults.length == 0) { + if (query.length > 0) { + oAutoComp.setBody("
Not found
"); + } + } + }; + + var myOnItemSelect = function(sType, aArgs) { + var ac = aArgs[0]; + var item = aArgs[2]; + location.href = item[1].url; + }; + + + Event.onAvailable("searchresults", function() { + + // Instantiate JS Function DataSource + oACDS = new YAHOO.widget.DS_JSFunction(getResults); + oACDS.maxCacheEntries = 30; + + // Instantiate AutoComplete + oAutoComp = new YAHOO.widget.AutoComplete('searchinput','searchresults', oACDS); + //oAutoComp.alwaysShowContainer = true; + oAutoComp.queryDelay = 0.2; + oAutoComp.maxResultsDisplayed = 200; + oAutoComp.minQueryLength = 0; + oAutoComp.formatResult = function(oResultItem, query) { + var sMarkup = "" + oResultItem[1].host + ' ' + oResultItem[1].name + ''; + return sMarkup; + }; + + // Subscribe to Custom Events + oAutoComp.dataReturnEvent.subscribe(myOnDataReturn); + oAutoComp.itemSelectEvent.subscribe(myOnItemSelect); + + // Set initial content in the container + oAutoComp.sendQuery(Dom.get("searchinput").value); + + }); + + var validateForm = function() { + return false; + }; + + YAHOO.util.Event.onAvailable('classTab', function() { + var tabs = new YAHOO.widget.TabView('classTab'); + }); + /* + YAHOO.util.Event.onAvailable('codeTree', function() { + var tree1 = new YAHOO.widget.TreeView('codeTree'); + tree1.render(); + }); + */ + +})(); diff --git a/api_docs/assets/api-js b/api_docs/assets/api-js new file mode 100644 index 0000000..e8132e0 --- /dev/null +++ b/api_docs/assets/api-js @@ -0,0 +1,42 @@ +/* +Copyright (c) 2008, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.6.0 +*/ +if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}if(K.length>1){K.pop();}K.push("]");}else{K.push("{");for(F in D){if(A.hasOwnProperty(D,F)){K.push(F+G);if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}}if(K.length>1){K.pop();}K.push("}");}return K.join("");},substitute:function(S,E,L){var I,H,G,O,P,R,N=[],F,J="dump",M=" ",D="{",Q="}";for(;;){I=S.lastIndexOf(D);if(I<0){break;}H=S.indexOf(Q,I);if(I+1>=H){break;}F=S.substring(I+1,H);O=F;R=null;G=O.indexOf(M);if(G>-1){R=O.substring(G+1);O=O.substring(0,G);}P=E[O];if(L){P=L(O,P,R);}if(A.isObject(P)){if(A.isArray(P)){P=A.dump(P,parseInt(R,10));}else{R=R||"";var K=R.indexOf(J);if(K>-1){R=R.substring(4);}if(P.toString===Object.prototype.toString||K>-1){P=A.dump(P,parseInt(R,10));}else{P=P.toString();}}}else{if(!A.isString(P)&&!A.isNumber(P)){P="~-"+N.length+"-~";N[N.length]=F;}}S=S.substring(0,I)+P+S.substring(H+1);}for(I=N.length-1;I>=0;I=I-1){S=S.replace(new RegExp("~-"+I+"-~"),"{"+N[I]+"}","g");}return S;},trim:function(D){try{return D.replace(/^\s+|\s+$/g,"");}catch(E){return D;}},merge:function(){var G={},E=arguments;for(var F=0,D=E.length;F=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.6.0",build:"1321"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};var K=YAHOO.env.ua.ie?"focusin":"focus";var L=YAHOO.env.ua.ie?"focusout":"blur";return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var M=this;var N=function(){M._tryPreloadAttach();};this._interval=setInterval(N,this.POLL_INTERVAL);}},onAvailable:function(R,O,S,Q,P){var M=(YAHOO.lang.isString(R))?[R]:R;for(var N=0;N-1;Q--){W=(this._removeListener(N[Q],M,V,Y)&&W);}return W;}}if(!V||!V.call){return this.purgeElement(N,false,M);}if("unload"==M){for(Q=J.length-1;Q>-1;Q--){X=J[Q];if(X&&X[0]==N&&X[1]==M&&X[2]==V){J.splice(Q,1);return true;}}return false;}var R=null;var S=arguments[4];if("undefined"===typeof S){S=this._getCacheIndex(N,M,V);}if(S>=0){R=I[S];}if(!N||!R){return false;}if(this.useLegacyEvent(N,M)){var P=this.getLegacyIndex(N,M);var O=E[P];if(O){for(Q=0,T=O.length;Q0&&F.length>0);}var R=[];var T=function(V,W){var U=V;if(W.override){if(W.override===true){U=W.obj;}else{U=W.override;}}W.fn.call(U,W.obj);};var N,M,Q,P,O=[];for(N=0,M=F.length;N-1;N--){Q=F[N];if(!Q||!Q.id){F.splice(N,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(Q,R,T){var O=(YAHOO.lang.isString(Q))?this.getEl(Q):Q;var S=this.getListeners(O,T),P,M;if(S){for(P=S.length-1;P>-1;P--){var N=S[P];this._removeListener(O,N.type,N.fn,N.capture);}}if(R&&O&&O.childNodes){for(P=0,M=O.childNodes.length;P-1;O--){N=I[O];if(N){M._removeListener(N[M.EL],N[M.TYPE],N[M.FN],N[M.CAPTURE],O);}}N=null;}G=null;M._simpleRemove(window,"unload",M._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var M=document.documentElement,N=document.body;if(M&&(M.scrollTop||M.scrollLeft)){return[M.scrollTop,M.scrollLeft];}else{if(N){return[N.scrollTop,N.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(O,P,N,M){O.addEventListener(P,N,(M));};}else{if(window.attachEvent){return function(O,P,N,M){O.attachEvent("on"+P,N);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(O,P,N,M){O.removeEventListener(P,N,(M));};}else{if(window.detachEvent){return function(N,O,M){N.detachEvent("on"+O,M);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener; +/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */ +if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=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(A,C,F,E){this.__yui_events=this.__yui_events||{}; +var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C0){if(!aCache){this._aCache=[];}else{var nCacheLength=aCache.length;if(nCacheLength>0){var oResponse=null;this.fireEvent("cacheRequestEvent",{request:oRequest,callback:oCallback,caller:oCaller});for(var i=nCacheLength-1;i>=0;i--){var oCacheElem=aCache[i];if(this.isCacheHit(oRequest,oCacheElem.request)){oResponse=oCacheElem.response;this.fireEvent("cacheResponseEvent",{request:oRequest,response:oResponse,callback:oCallback,caller:oCaller});if(i=this.maxCacheEntries){aCache.shift();}var oCacheElem={request:oRequest,response:oResponse};aCache[aCache.length]=oCacheElem;this.fireEvent("responseCacheEvent",{request:oRequest,response:oResponse});},flushCache:function(){if(this._aCache){this._aCache=[];this.fireEvent("cacheFlushEvent");}},setInterval:function(nMsec,oRequest,oCallback,oCaller){if(lang.isNumber(nMsec)&&(nMsec>=0)){var oSelf=this;var nId=setInterval(function(){oSelf.makeConnection(oRequest,oCallback,oCaller);},nMsec);this._aIntervals.push(nId);return nId;}else{}},clearInterval:function(nId){var tracker=this._aIntervals||[];for(var i=tracker.length-1;i>-1;i--){if(tracker[i]===nId){tracker.splice(i,1);clearInterval(nId);}}},clearAllIntervals:function(){var tracker=this._aIntervals||[];for(var i=tracker.length-1;i>-1;i--){clearInterval(tracker[i]);}tracker=[];},sendRequest:function(oRequest,oCallback,oCaller){var oCachedResponse=this.getCachedResponse(oRequest,oCallback,oCaller);if(oCachedResponse){DS.issueCallback(oCallback,[oRequest,oCachedResponse],false,oCaller);return null;}return this.makeConnection(oRequest,oCallback,oCaller);},makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oRawResponse=this.liveData;this.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);return tId;},handleResponse:function(oRequest,oRawResponse,oCallback,oCaller,tId){this.fireEvent("responseEvent",{tId:tId,request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller});var xhr=(this.dataType==DS.TYPE_XHR)?true:false;var oParsedResponse=null;var oFullResponse=oRawResponse;if(this.responseType===DS.TYPE_UNKNOWN){var ctype=(oRawResponse&&oRawResponse.getResponseHeader)?oRawResponse.getResponseHeader["Content-Type"]:null;if(ctype){if(ctype.indexOf("text/xml")>-1){this.responseType=DS.TYPE_XML;}else{if(ctype.indexOf("application/json")>-1){this.responseType=DS.TYPE_JSON;}else{if(ctype.indexOf("text/plain")>-1){this.responseType=DS.TYPE_TEXT;}}}}else{if(YAHOO.lang.isArray(oRawResponse)){this.responseType=DS.TYPE_JSARRAY;}else{if(oRawResponse&&oRawResponse.nodeType&&oRawResponse.nodeType==9){this.responseType=DS.TYPE_XML;}else{if(oRawResponse&&oRawResponse.nodeName&&(oRawResponse.nodeName.toLowerCase()=="table")){this.responseType=DS.TYPE_HTMLTABLE;}else{if(YAHOO.lang.isObject(oRawResponse)){this.responseType=DS.TYPE_JSON;}else{if(YAHOO.lang.isString(oRawResponse)){this.responseType=DS.TYPE_TEXT;}}}}}}}switch(this.responseType){case DS.TYPE_JSARRAY:if(xhr&&oRawResponse&&oRawResponse.responseText){oFullResponse=oRawResponse.responseText;}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseArrayData(oRequest,oFullResponse); +break;case DS.TYPE_JSON:if(xhr&&oRawResponse&&oRawResponse.responseText){oFullResponse=oRawResponse.responseText;}try{if(lang.isString(oFullResponse)){if(lang.JSON){oFullResponse=lang.JSON.parse(oFullResponse);}else{if(window.JSON&&JSON.parse){oFullResponse=JSON.parse(oFullResponse);}else{if(oFullResponse.parseJSON){oFullResponse=oFullResponse.parseJSON();}else{while(oFullResponse.length>0&&(oFullResponse.charAt(0)!="{")&&(oFullResponse.charAt(0)!="[")){oFullResponse=oFullResponse.substring(1,oFullResponse.length);}if(oFullResponse.length>0){var objEnd=Math.max(oFullResponse.lastIndexOf("]"),oFullResponse.lastIndexOf("}"));oFullResponse=oFullResponse.substring(0,objEnd+1);oFullResponse=eval("("+oFullResponse+")");}}}}}}catch(e){}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseJSONData(oRequest,oFullResponse);break;case DS.TYPE_HTMLTABLE:if(xhr&&oRawResponse.responseText){oFullResponse=oRawResponse.responseText;}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseHTMLTableData(oRequest,oFullResponse);break;case DS.TYPE_XML:if(xhr&&oRawResponse.responseXML){oFullResponse=oRawResponse.responseXML;}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseXMLData(oRequest,oFullResponse);break;case DS.TYPE_TEXT:if(xhr&&lang.isString(oRawResponse.responseText)){oFullResponse=oRawResponse.responseText;}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseTextData(oRequest,oFullResponse);break;default:oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseData(oRequest,oFullResponse);break;}oParsedResponse=oParsedResponse||{};if(!oParsedResponse.results){oParsedResponse.results=[];}if(!oParsedResponse.meta){oParsedResponse.meta={};}if(oParsedResponse&&!oParsedResponse.error){oParsedResponse=this.doBeforeCallback(oRequest,oFullResponse,oParsedResponse,oCallback);this.fireEvent("responseParseEvent",{request:oRequest,response:oParsedResponse,callback:oCallback,caller:oCaller});this.addToCache(oRequest,oParsedResponse);}else{oParsedResponse.error=true;this.fireEvent("dataErrorEvent",{request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller,message:DS.ERROR_DATANULL});}oParsedResponse.tId=tId;DS.issueCallback(oCallback,[oRequest,oParsedResponse],oParsedResponse.error,oCaller);},doBeforeParseData:function(oRequest,oFullResponse,oCallback){return oFullResponse;},doBeforeCallback:function(oRequest,oFullResponse,oParsedResponse,oCallback){return oParsedResponse;},parseData:function(oRequest,oFullResponse){if(lang.isValue(oFullResponse)){var oParsedResponse={results:oFullResponse,meta:{}};return oParsedResponse;}return null;},parseArrayData:function(oRequest,oFullResponse){if(lang.isArray(oFullResponse)){var results=[],i,j,rec,field,data;if(lang.isArray(this.responseSchema.fields)){var fields=this.responseSchema.fields;for(i=fields.length-1;i>=0;--i){if(typeof fields[i]!=="object"){fields[i]={key:fields[i]};}}var parsers={},p;for(i=fields.length-1;i>=0;--i){p=(typeof fields[i].parser==="function"?fields[i].parser:DS.Parser[fields[i].parser+""])||fields[i].converter;if(p){parsers[fields[i].key]=p;}}var arrType=lang.isArray(oFullResponse[0]);for(i=oFullResponse.length-1;i>-1;i--){var oResult={};rec=oFullResponse[i];if(typeof rec==="object"){for(j=fields.length-1;j>-1;j--){field=fields[j];data=arrType?rec[j]:rec[field.key];if(parsers[field.key]){data=parsers[field.key].call(this,data);}if(data===undefined){data=null;}oResult[field.key]=data;}}else{if(lang.isString(rec)){for(j=fields.length-1;j>-1;j--){field=fields[j];data=rec;if(parsers[field.key]){data=parsers[field.key].call(this,data);}if(data===undefined){data=null;}oResult[field.key]=data;}}}results[i]=oResult;}}else{results=oFullResponse;}var oParsedResponse={results:results};return oParsedResponse;}return null;},parseTextData:function(oRequest,oFullResponse){if(lang.isString(oFullResponse)){if(lang.isString(this.responseSchema.recordDelim)&&lang.isString(this.responseSchema.fieldDelim)){var oParsedResponse={results:[]};var recDelim=this.responseSchema.recordDelim;var fieldDelim=this.responseSchema.fieldDelim;if(oFullResponse.length>0){var newLength=oFullResponse.length-recDelim.length;if(oFullResponse.substr(newLength)==recDelim){oFullResponse=oFullResponse.substr(0,newLength);}if(oFullResponse.length>0){var recordsarray=oFullResponse.split(recDelim);for(var i=0,len=recordsarray.length,recIdx=0;i0)){var fielddataarray=recordsarray[i].split(fieldDelim);var oResult={};if(lang.isArray(this.responseSchema.fields)){var fields=this.responseSchema.fields;for(var j=fields.length-1;j>-1;j--){try{var data=fielddataarray[j];if(lang.isString(data)){if(data.charAt(0)=='"'){data=data.substr(1);}if(data.charAt(data.length-1)=='"'){data=data.substr(0,data.length-1);}var field=fields[j];var key=(lang.isValue(field.key))?field.key:field;if(!field.parser&&field.converter){field.parser=field.converter;}var parser=(typeof field.parser==="function")?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data);}if(data===undefined){data=null;}oResult[key]=data;}else{bError=true;}}catch(e){bError=true;}}}else{oResult=fielddataarray;}if(!bError){oParsedResponse.results[recIdx++]=oResult;}}}}}return oParsedResponse;}}return null;},parseXMLResult:function(result){var oResult={},schema=this.responseSchema;try{for(var m=schema.fields.length-1;m>=0;m--){var field=schema.fields[m];var key=(lang.isValue(field.key))?field.key:field;var data=null;var xmlAttr=result.attributes.getNamedItem(key);if(xmlAttr){data=xmlAttr.value;}else{var xmlNode=result.getElementsByTagName(key);if(xmlNode&&xmlNode.item(0)&&xmlNode.item(0)){data=xmlNode.item(0).firstChild.nodeValue;var item=xmlNode.item(0);data=(item.text)?item.text:(item.textContent)?item.textContent:null; +if(!data){var datapieces=[];for(var j=0,len=item.childNodes.length;j0){data=datapieces.join("");}}}}if(data===null){data="";}if(!field.parser&&field.converter){field.parser=field.converter;}var parser=(typeof field.parser==="function")?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data);}if(data===undefined){data=null;}oResult[key]=data;}}catch(e){}return oResult;},parseXMLData:function(oRequest,oFullResponse){var bError=false,schema=this.responseSchema,oParsedResponse={meta:{}},xmlList=null,metaNode=schema.metaNode,metaLocators=schema.metaFields||{},i,k,loc,v;try{xmlList=(schema.resultNode)?oFullResponse.getElementsByTagName(schema.resultNode):null;metaNode=metaNode?oFullResponse.getElementsByTagName(metaNode)[0]:oFullResponse;if(metaNode){for(k in metaLocators){if(lang.hasOwnProperty(metaLocators,k)){loc=metaLocators[k];v=metaNode.getElementsByTagName(loc)[0];if(v){v=v.firstChild.nodeValue;}else{v=metaNode.attributes.getNamedItem(loc);if(v){v=v.value;}}if(lang.isValue(v)){oParsedResponse.meta[k]=v;}}}}}catch(e){}if(!xmlList||!lang.isArray(schema.fields)){bError=true;}else{oParsedResponse.results=[];for(i=xmlList.length-1;i>=0;--i){var oResult=this.parseXMLResult(xmlList.item(i));oParsedResponse.results[i]=oResult;}}if(bError){oParsedResponse.error=true;}else{}return oParsedResponse;},parseJSONData:function(oRequest,oFullResponse){var oParsedResponse={results:[],meta:{}};if(lang.isObject(oFullResponse)&&this.responseSchema.resultsList){var schema=this.responseSchema,fields=schema.fields,resultsList=oFullResponse,results=[],metaFields=schema.metaFields||{},fieldParsers=[],fieldPaths=[],simpleFields=[],bError=false,i,len,j,v,key,parser,path;var buildPath=function(needle){var path=null,keys=[],i=0;if(needle){needle=needle.replace(/\[(['"])(.*?)\1\]/g,function(x,$1,$2){keys[i]=$2;return".@"+(i++);}).replace(/\[(\d+)\]/g,function(x,$1){keys[i]=parseInt($1,10)|0;return".@"+(i++);}).replace(/^\./,"");if(!/[^\w\.\$@]/.test(needle)){path=needle.split(".");for(i=path.length-1;i>=0;--i){if(path[i].charAt(0)==="@"){path[i]=keys[parseInt(path[i].substr(1),10)];}}}else{}}return path;};var walkPath=function(path,origin){var v=origin,i=0,len=path.length;for(;i1){fieldPaths[fieldPaths.length]={key:key,path:path};}else{simpleFields[simpleFields.length]={key:key,path:path[0]};}}else{}}for(i=resultsList.length-1;i>=0;--i){var r=resultsList[i],rec={};for(j=simpleFields.length-1;j>=0;--j){rec[simpleFields[j].key]=(r[simpleFields[j].path]!==undefined)?r[simpleFields[j].path]:r[j];}for(j=fieldPaths.length-1;j>=0;--j){rec[fieldPaths[j].key]=walkPath(fieldPaths[j].path,r);}for(j=fieldParsers.length-1;j>=0;--j){var p=fieldParsers[j].key;rec[p]=fieldParsers[j].parser(rec[p]);if(rec[p]===undefined){rec[p]=null;}}results[i]=rec;}}else{results=resultsList;}for(key in metaFields){if(lang.hasOwnProperty(metaFields,key)){path=buildPath(metaFields[key]);if(path){v=walkPath(path,oFullResponse);oParsedResponse.meta[key]=v;}}}}else{oParsedResponse.error=true;}oParsedResponse.results=results;}else{oParsedResponse.error=true;}return oParsedResponse;},parseHTMLTableData:function(oRequest,oFullResponse){var bError=false;var elTable=oFullResponse;var fields=this.responseSchema.fields;var oParsedResponse={results:[]};for(var i=0;i-1;j--){var elRow=elTbody.rows[j];var oResult={};for(var k=fields.length-1;k>-1;k--){var field=fields[k];var key=(lang.isValue(field.key))?field.key:field;var data=elRow.cells[k].innerHTML;if(!field.parser&&field.converter){field.parser=field.converter;}var parser=(typeof field.parser==="function")?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data);}if(data===undefined){data=null;}oResult[key]=data;}oParsedResponse.results[j]=oResult;}}if(bError){oParsedResponse.error=true;}else{}return oParsedResponse;}};lang.augmentProto(DS,util.EventProvider);util.LocalDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_LOCAL;if(oLiveData){if(YAHOO.lang.isArray(oLiveData)){this.responseType=DS.TYPE_JSARRAY;}else{if(oLiveData.nodeType&&oLiveData.nodeType==9){this.responseType=DS.TYPE_XML;}else{if(oLiveData.nodeName&&(oLiveData.nodeName.toLowerCase()=="table")){this.responseType=DS.TYPE_HTMLTABLE;oLiveData=oLiveData.cloneNode(true);}else{if(YAHOO.lang.isString(oLiveData)){this.responseType=DS.TYPE_TEXT;}else{if(YAHOO.lang.isObject(oLiveData)){this.responseType=DS.TYPE_JSON;}}}}}}else{oLiveData=[];this.responseType=DS.TYPE_JSARRAY;}this.constructor.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.LocalDataSource,DS);lang.augmentObject(util.LocalDataSource,DS);util.FunctionDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_JSFUNCTION;oLiveData=oLiveData||function(){};this.constructor.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.FunctionDataSource,DS,{makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oRawResponse=this.liveData(oRequest);if(this.responseType===DS.TYPE_UNKNOWN){if(YAHOO.lang.isArray(oRawResponse)){this.responseType=DS.TYPE_JSARRAY;}else{if(oRawResponse&&oRawResponse.nodeType&&oRawResponse.nodeType==9){this.responseType=DS.TYPE_XML; +}else{if(oRawResponse&&oRawResponse.nodeName&&(oRawResponse.nodeName.toLowerCase()=="table")){this.responseType=DS.TYPE_HTMLTABLE;}else{if(YAHOO.lang.isObject(oRawResponse)){this.responseType=DS.TYPE_JSON;}else{if(YAHOO.lang.isString(oRawResponse)){this.responseType=DS.TYPE_TEXT;}}}}}}this.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);return tId;}});lang.augmentObject(util.FunctionDataSource,DS);util.ScriptNodeDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_SCRIPTNODE;oLiveData=oLiveData||"";this.constructor.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.ScriptNodeDataSource,DS,{getUtility:util.Get,asyncMode:"allowAll",scriptCallbackParam:"callback",generateRequestCallback:function(id){return"&"+this.scriptCallbackParam+"=YAHOO.util.ScriptNodeDataSource.callbacks["+id+"]";},makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});if(util.ScriptNodeDataSource._nPending===0){util.ScriptNodeDataSource.callbacks=[];util.ScriptNodeDataSource._nId=0;}var id=util.ScriptNodeDataSource._nId;util.ScriptNodeDataSource._nId++;var oSelf=this;util.ScriptNodeDataSource.callbacks[id]=function(oRawResponse){if((oSelf.asyncMode!=="ignoreStaleResponses")||(id===util.ScriptNodeDataSource.callbacks.length-1)){if(oSelf.responseType===DS.TYPE_UNKNOWN){if(YAHOO.lang.isArray(oRawResponse)){oSelf.responseType=DS.TYPE_JSARRAY;}else{if(oRawResponse.nodeType&&oRawResponse.nodeType==9){oSelf.responseType=DS.TYPE_XML;}else{if(oRawResponse.nodeName&&(oRawResponse.nodeName.toLowerCase()=="table")){oSelf.responseType=DS.TYPE_HTMLTABLE;}else{if(YAHOO.lang.isObject(oRawResponse)){oSelf.responseType=DS.TYPE_JSON;}else{if(YAHOO.lang.isString(oRawResponse)){oSelf.responseType=DS.TYPE_TEXT;}}}}}}oSelf.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);}else{}delete util.ScriptNodeDataSource.callbacks[id];};util.ScriptNodeDataSource._nPending++;var sUri=this.liveData+oRequest+this.generateRequestCallback(id);this.getUtility.script(sUri,{autopurge:true,onsuccess:util.ScriptNodeDataSource._bumpPendingDown,onfail:util.ScriptNodeDataSource._bumpPendingDown});return tId;}});lang.augmentObject(util.ScriptNodeDataSource,DS);lang.augmentObject(util.ScriptNodeDataSource,{_nId:0,_nPending:0,callbacks:[]});util.XHRDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_XHR;this.connMgr=this.connMgr||util.Connect;oLiveData=oLiveData||"";this.constructor.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.XHRDataSource,DS,{connMgr:null,connXhrMode:"allowAll",connMethodPost:false,connTimeout:0,makeConnection:function(oRequest,oCallback,oCaller){var oRawResponse=null;var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oSelf=this;var oConnMgr=this.connMgr;var oQueue=this._oQueue;var _xhrSuccess=function(oResponse){if(oResponse&&(this.asyncMode=="ignoreStaleResponses")&&(oResponse.tId!=oQueue.conn.tId)){return null;}else{if(!oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:DS.ERROR_DATANULL});DS.issueCallback(oCallback,[oRequest,{error:true}],true,oCaller);return null;}else{if(this.responseType===DS.TYPE_UNKNOWN){var ctype=(oResponse.getResponseHeader)?oResponse.getResponseHeader["Content-Type"]:null;if(ctype){if(ctype.indexOf("text/xml")>-1){this.responseType=DS.TYPE_XML;}else{if(ctype.indexOf("application/json")>-1){this.responseType=DS.TYPE_JSON;}else{if(ctype.indexOf("text/plain")>-1){this.responseType=DS.TYPE_TEXT;}}}}}this.handleResponse(oRequest,oResponse,oCallback,oCaller,tId);}}};var _xhrFailure=function(oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:DS.ERROR_DATAINVALID});if(lang.isString(this.liveData)&&lang.isString(oRequest)&&(this.liveData.lastIndexOf("?")!==this.liveData.length-1)&&(oRequest.indexOf("?")!==0)){}oResponse=oResponse||{};oResponse.error=true;DS.issueCallback(oCallback,[oRequest,oResponse],true,oCaller);return null;};var _xhrCallback={success:_xhrSuccess,failure:_xhrFailure,scope:this};if(lang.isNumber(this.connTimeout)){_xhrCallback.timeout=this.connTimeout;}if(this.connXhrMode=="cancelStaleRequests"){if(oQueue.conn){if(oConnMgr.abort){oConnMgr.abort(oQueue.conn);oQueue.conn=null;}else{}}}if(oConnMgr&&oConnMgr.asyncRequest){var sLiveData=this.liveData;var isPost=this.connMethodPost;var sMethod=(isPost)?"POST":"GET";var sUri=(isPost||!lang.isValue(oRequest))?sLiveData:sLiveData+oRequest;var sRequest=(isPost)?oRequest:null;if(this.connXhrMode!="queueRequests"){oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,_xhrCallback,sRequest);}else{if(oQueue.conn){var allRequests=oQueue.requests;allRequests.push({request:oRequest,callback:_xhrCallback});if(!oQueue.interval){oQueue.interval=setInterval(function(){if(oConnMgr.isCallInProgress(oQueue.conn)){return ;}else{if(allRequests.length>0){sUri=(isPost||!lang.isValue(allRequests[0].request))?sLiveData:sLiveData+allRequests[0].request;sRequest=(isPost)?allRequests[0].request:null;oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,allRequests[0].callback,sRequest);allRequests.shift();}else{clearInterval(oQueue.interval);oQueue.interval=null;}}},50);}}else{oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,_xhrCallback,sRequest);}}}else{DS.issueCallback(oCallback,[oRequest,{error:true}],true,oCaller);}return tId;}});lang.augmentObject(util.XHRDataSource,DS);util.DataSource=function(oLiveData,oConfigs){oConfigs=oConfigs||{};var dataType=oConfigs.dataType;if(dataType){if(dataType==DS.TYPE_LOCAL){lang.augmentObject(util.DataSource,util.LocalDataSource);return new util.LocalDataSource(oLiveData,oConfigs);}else{if(dataType==DS.TYPE_XHR){lang.augmentObject(util.DataSource,util.XHRDataSource);return new util.XHRDataSource(oLiveData,oConfigs);}else{if(dataType==DS.TYPE_SCRIPTNODE){lang.augmentObject(util.DataSource,util.ScriptNodeDataSource); +return new util.ScriptNodeDataSource(oLiveData,oConfigs);}else{if(dataType==DS.TYPE_JSFUNCTION){lang.augmentObject(util.DataSource,util.FunctionDataSource);return new util.FunctionDataSource(oLiveData,oConfigs);}}}}}if(YAHOO.lang.isString(oLiveData)){lang.augmentObject(util.DataSource,util.XHRDataSource);return new util.XHRDataSource(oLiveData,oConfigs);}else{if(YAHOO.lang.isFunction(oLiveData)){lang.augmentObject(util.DataSource,util.FunctionDataSource);return new util.FunctionDataSource(oLiveData,oConfigs);}else{lang.augmentObject(util.DataSource,util.LocalDataSource);return new util.LocalDataSource(oLiveData,oConfigs);}}};lang.augmentObject(util.DataSource,DS);})();YAHOO.util.Number={format:function(B,F){F=F||{};if(!YAHOO.lang.isNumber(B)){B*=1;}if(YAHOO.lang.isNumber(B)){var D=(B<0);var J=B+"";var G=(F.decimalSeparator)?F.decimalSeparator:".";var H;if(YAHOO.lang.isNumber(F.decimalPlaces)){var I=F.decimalPlaces;var C=Math.pow(10,I);J=Math.round(B*C)/C+"";H=J.lastIndexOf(".");if(I>0){if(H<0){J+=G;H=J.length-1;}else{if(G!=="."){J=J.replace(".",G);}}while((J.length-1-H)-1)?H:J.length;var K=J.substring(H);var A=-1;for(var E=H;E>0;E--){A++;if((A%3===0)&&(E!==H)&&(!D||(E>1))){K=L+K;}K=J.charAt(E-1)+K;}J=K;}J=(F.prefix)?F.prefix+J:J;J=(F.suffix)?J+F.suffix:J;return J;}else{return B;}}};(function(){var A=function(C,E,D){if(typeof D==="undefined"){D=10;}for(;parseInt(C,10)1;D/=10){C=E.toString()+C;}return C.toString();};var B={formats:{a:function(D,C){return C.a[D.getDay()];},A:function(D,C){return C.A[D.getDay()];},b:function(D,C){return C.b[D.getMonth()];},B:function(D,C){return C.B[D.getMonth()];},C:function(C){return A(parseInt(C.getFullYear()/100,10),0);},d:["getDate","0"],e:["getDate"," "],g:function(C){return A(parseInt(B.formats.G(C)%100,10),0);},G:function(E){var F=E.getFullYear();var D=parseInt(B.formats.V(E),10);var C=parseInt(B.formats.W(E),10);if(C>D){F++;}else{if(C===0&&D>=52){F--;}}return F;},H:["getHours","0"],I:function(D){var C=D.getHours()%12;return A(C===0?12:C,0);},j:function(G){var F=new Date(""+G.getFullYear()+"/1/1 GMT");var D=new Date(""+G.getFullYear()+"/"+(G.getMonth()+1)+"/"+G.getDate()+" GMT");var C=D-F;var E=parseInt(C/60000/60/24,10)+1;return A(E,0,100);},k:["getHours"," "],l:function(D){var C=D.getHours()%12;return A(C===0?12:C," ");},m:function(C){return A(C.getMonth()+1,0);},M:["getMinutes","0"],p:function(D,C){return C.p[D.getHours()>=12?1:0];},P:function(D,C){return C.P[D.getHours()>=12?1:0];},s:function(D,C){return parseInt(D.getTime()/1000,10);},S:["getSeconds","0"],u:function(C){var D=C.getDay();return D===0?7:D;},U:function(F){var C=parseInt(B.formats.j(F),10);var E=6-F.getDay();var D=parseInt((C+E)/7,10);return A(D,0);},V:function(F){var E=parseInt(B.formats.W(F),10);var C=(new Date(""+F.getFullYear()+"/1/1")).getDay();var D=E+(C>4||C<=1?0:1);if(D===53&&(new Date(""+F.getFullYear()+"/12/31")).getDay()<4){D=1;}else{if(D===0){D=B.formats.V(new Date(""+(F.getFullYear()-1)+"/12/31"));}}return A(D,0);},w:"getDay",W:function(F){var C=parseInt(B.formats.j(F),10);var E=7-B.formats.u(F);var D=parseInt((C+E)/7,10);return A(D,0,10);},y:function(C){return A(C.getFullYear()%100,0);},Y:"getFullYear",z:function(E){var D=E.getTimezoneOffset();var C=A(parseInt(Math.abs(D/60),10),0);var F=A(Math.abs(D%60),0);return(D>0?"-":"+")+C+F;},Z:function(C){var D=C.toString().replace(/^.*:\d\d( GMT[+-]\d+)? \(?([A-Za-z ]+)\)?\d*$/,"$2").replace(/[a-z ]/g,"");if(D.length>4){D=B.formats.z(C);}return D;},"%":function(C){return"%";}},aggregates:{c:"locale",D:"%m/%d/%y",F:"%Y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"},format:function(G,F,D){F=F||{};if(!(G instanceof Date)){return YAHOO.lang.isValue(G)?G:"";}var H=F.format||"%m/%d/%Y";if(H==="YYYY/MM/DD"){H="%Y/%m/%d";}else{if(H==="DD/MM/YYYY"){H="%d/%m/%Y";}else{if(H==="MM/DD/YYYY"){H="%m/%d/%Y";}}}D=D||"en";if(!(D in YAHOO.util.DateLocale)){if(D.replace(/-[a-zA-Z]+$/,"") in YAHOO.util.DateLocale){D=D.replace(/-[a-zA-Z]+$/,"");}else{D="en";}}var J=YAHOO.util.DateLocale[D];var C=function(L,K){var M=B.aggregates[K];return(M==="locale"?J[K]:M);};var E=function(L,K){var M=B.formats[K];if(typeof M==="string"){return G[M]();}else{if(typeof M==="function"){return M.call(G,G,J);}else{if(typeof M==="object"&&typeof M[0]==="string"){return A(G[M[0]](),M[1]);}else{return K;}}}};while(H.match(/%[cDFhnrRtTxX]/)){H=H.replace(/%([cDFhnrRtTxX])/g,C);}var I=H.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,E);C=E=undefined;return I;}};YAHOO.namespace("YAHOO.util");YAHOO.util.Date=B;YAHOO.util.DateLocale={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%d/%m/%y",X:"%T"};YAHOO.util.DateLocale["en"]=YAHOO.lang.merge(YAHOO.util.DateLocale,{});YAHOO.util.DateLocale["en-US"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"],{c:"%a %d %b %Y %I:%M:%S %p %Z",x:"%m/%d/%Y",X:"%I:%M:%S %p"});YAHOO.util.DateLocale["en-GB"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"],{r:"%l:%M:%S %P %Z"});YAHOO.util.DateLocale["en-AU"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"]);})();YAHOO.register("datasource",YAHOO.util.DataSource,{version:"2.6.0",build:"1321"});/* +Copyright (c) 2008, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.6.0 +*/ +YAHOO.widget.DS_JSArray=YAHOO.util.LocalDataSource;YAHOO.widget.DS_JSFunction=YAHOO.util.FunctionDataSource;YAHOO.widget.DS_XHR=function(B,A,D){var C=new YAHOO.util.XHRDataSource(B,D);C._aDeprecatedSchema=A;return C;};YAHOO.widget.DS_ScriptNode=function(B,A,D){var C=new YAHOO.util.ScriptNodeDataSource(B,D);C._aDeprecatedSchema=A;return C;};YAHOO.widget.DS_XHR.TYPE_JSON=YAHOO.util.DataSourceBase.TYPE_JSON;YAHOO.widget.DS_XHR.TYPE_XML=YAHOO.util.DataSourceBase.TYPE_XML;YAHOO.widget.DS_XHR.TYPE_FLAT=YAHOO.util.DataSourceBase.TYPE_TEXT;YAHOO.widget.AutoComplete=function(G,B,J,C){if(G&&B&&J){if(J instanceof YAHOO.util.DataSourceBase){this.dataSource=J;}else{return ;}this.key=0;var D=J.responseSchema;if(J._aDeprecatedSchema){var K=J._aDeprecatedSchema;if(YAHOO.lang.isArray(K)){if((J.responseType===YAHOO.util.DataSourceBase.TYPE_JSON)||(J.responseType===YAHOO.util.DataSourceBase.TYPE_UNKNOWN)){D.resultsList=K[0];this.key=K[1];D.fields=(K.length<3)?null:K.slice(1);}else{if(J.responseType===YAHOO.util.DataSourceBase.TYPE_XML){D.resultNode=K[0];this.key=K[1];D.fields=K.slice(1);}else{if(J.responseType===YAHOO.util.DataSourceBase.TYPE_TEXT){D.recordDelim=K[0];D.fieldDelim=K[1];}}}J.responseSchema=D;}}if(YAHOO.util.Dom.inDocument(G)){if(YAHOO.lang.isString(G)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+G;this._elTextbox=document.getElementById(G);}else{this._sName=(G.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+G.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._elTextbox=G;}YAHOO.util.Dom.addClass(this._elTextbox,"yui-ac-input");}else{return ;}if(YAHOO.util.Dom.inDocument(B)){if(YAHOO.lang.isString(B)){this._elContainer=document.getElementById(B);}else{this._elContainer=B;}if(this._elContainer.style.display=="none"){}var E=this._elContainer.parentNode;var A=E.tagName.toLowerCase();if(A=="div"){YAHOO.util.Dom.addClass(E,"yui-ac");}else{}}else{return ;}if(this.dataSource.dataType===YAHOO.util.DataSourceBase.TYPE_LOCAL){this.applyLocalFilter=true;}if(C&&(C.constructor==Object)){for(var I in C){if(I){this[I]=C[I];}}}this._initContainerEl();this._initProps();this._initListEl();this._initContainerHelperEls();var H=this;var F=this._elTextbox;YAHOO.util.Event.addListener(F,"keyup",H._onTextboxKeyUp,H);YAHOO.util.Event.addListener(F,"keydown",H._onTextboxKeyDown,H);YAHOO.util.Event.addListener(F,"focus",H._onTextboxFocus,H);YAHOO.util.Event.addListener(F,"blur",H._onTextboxBlur,H);YAHOO.util.Event.addListener(B,"mouseover",H._onContainerMouseover,H);YAHOO.util.Event.addListener(B,"mouseout",H._onContainerMouseout,H);YAHOO.util.Event.addListener(B,"click",H._onContainerClick,H);YAHOO.util.Event.addListener(B,"scroll",H._onContainerScroll,H);YAHOO.util.Event.addListener(B,"resize",H._onContainerResize,H);YAHOO.util.Event.addListener(F,"keypress",H._onTextboxKeyPress,H);YAHOO.util.Event.addListener(window,"unload",H._onWindowUnload,H);this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerPopulateEvent=new YAHOO.util.CustomEvent("containerPopulate",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);this.textboxChangeEvent=new YAHOO.util.CustomEvent("textboxChange",this);F.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.applyLocalFilter=null;YAHOO.widget.AutoComplete.prototype.queryMatchCase=false;YAHOO.widget.AutoComplete.prototype.queryMatchContains=false;YAHOO.widget.AutoComplete.prototype.queryMatchSubset=false;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.2;YAHOO.widget.AutoComplete.prototype.typeAheadDelay=0.5;YAHOO.widget.AutoComplete.prototype.queryInterval=500;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.suppressInputUpdate=false;YAHOO.widget.AutoComplete.prototype.resultTypeList=true;YAHOO.widget.AutoComplete.prototype.queryQuestionMark=true;YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.getInputEl=function(){return this._elTextbox;};YAHOO.widget.AutoComplete.prototype.getContainerEl=function(){return this._elContainer; +};YAHOO.widget.AutoComplete.prototype.isFocused=function(){return(this._bFocused===null)?false:this._bFocused;};YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen;};YAHOO.widget.AutoComplete.prototype.getListEl=function(){return this._elList;};YAHOO.widget.AutoComplete.prototype.getListItemMatch=function(A){if(A._sResultMatch){return A._sResultMatch;}else{return null;}};YAHOO.widget.AutoComplete.prototype.getListItemData=function(A){if(A._oResultData){return A._oResultData;}else{return null;}};YAHOO.widget.AutoComplete.prototype.getListItemIndex=function(A){if(YAHOO.lang.isNumber(A._nItemIndex)){return A._nItemIndex;}else{return null;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(B){if(this._elHeader){var A=this._elHeader;if(B){A.innerHTML=B;A.style.display="block";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setFooter=function(B){if(this._elFooter){var A=this._elFooter;if(B){A.innerHTML=B;A.style.display="block";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setBody=function(A){if(this._elBody){var B=this._elBody;YAHOO.util.Event.purgeElement(B,true);if(A){B.innerHTML=A;B.style.display="block";}else{B.innerHTML="";B.style.display="none";}this._elList=null;}};YAHOO.widget.AutoComplete.prototype.generateRequest=function(B){var A=this.dataSource.dataType;if(A===YAHOO.util.DataSourceBase.TYPE_XHR){if(!this.dataSource.connMethodPost){B=(this.queryQuestionMark?"?":"")+(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}else{B=(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}}else{if(A===YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE){B="&"+(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}}return B;};YAHOO.widget.AutoComplete.prototype.sendQuery=function(B){var A=(this.delimChar)?this._elTextbox.value+B:B;this._sendQuery(A);};YAHOO.widget.AutoComplete.prototype.collapseContainer=function(){this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype.getSubsetMatches=function(E){var D,C,A;for(var B=E.length;B>=this.minQueryLength;B--){A=this.generateRequest(E.substr(0,B));this.dataRequestEvent.fire(this,D,A);C=this.dataSource.getCachedResponse(A);if(C){return this.filterResults.apply(this.dataSource,[E,C,C,{scope:this}]);}}return null;};YAHOO.widget.AutoComplete.prototype.preparseRawResponse=function(C,B,A){var D=((this.responseStripAfter!=="")&&(B.indexOf))?B.indexOf(this.responseStripAfter):-1;if(D!=-1){B=B.substring(0,D);}return B;};YAHOO.widget.AutoComplete.prototype.filterResults=function(J,L,P,K){if(J&&J!==""){P=YAHOO.widget.AutoComplete._cloneObject(P);var H=K.scope,O=this,B=P.results,M=[],D=false,I=(O.queryMatchCase||H.queryMatchCase),A=(O.queryMatchContains||H.queryMatchContains);for(var C=B.length-1;C>=0;C--){var F=B[C];var E=null;if(YAHOO.lang.isString(F)){E=F;}else{if(YAHOO.lang.isArray(F)){E=F[0];}else{if(this.responseSchema.fields){var N=this.responseSchema.fields[0].key||this.responseSchema.fields[0];E=F[N];}else{if(this.key){E=F[this.key];}}}}if(YAHOO.lang.isString(E)){var G=(I)?E.indexOf(decodeURIComponent(J)):E.toLowerCase().indexOf(decodeURIComponent(J).toLowerCase());if((!A&&(G===0))||(A&&(G>-1))){M.unshift(F);}}}P.results=M;}else{}return P;};YAHOO.widget.AutoComplete.prototype.handleResponse=function(C,A,B){if((this instanceof YAHOO.widget.AutoComplete)&&this._sName){this._populateList(C,A,B);}};YAHOO.widget.AutoComplete.prototype.doBeforeLoadData=function(C,A,B){return true;};YAHOO.widget.AutoComplete.prototype.formatResult=function(B,D,A){var C=(A)?A:"";return C;};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(D,A,C,B){return true;};YAHOO.widget.AutoComplete.prototype.destroy=function(){var B=this.toString();var A=this._elTextbox;var D=this._elContainer;this.textboxFocusEvent.unsubscribeAll();this.textboxKeyEvent.unsubscribeAll();this.dataRequestEvent.unsubscribeAll();this.dataReturnEvent.unsubscribeAll();this.dataErrorEvent.unsubscribeAll();this.containerPopulateEvent.unsubscribeAll();this.containerExpandEvent.unsubscribeAll();this.typeAheadEvent.unsubscribeAll();this.itemMouseOverEvent.unsubscribeAll();this.itemMouseOutEvent.unsubscribeAll();this.itemArrowToEvent.unsubscribeAll();this.itemArrowFromEvent.unsubscribeAll();this.itemSelectEvent.unsubscribeAll();this.unmatchedItemSelectEvent.unsubscribeAll();this.selectionEnforceEvent.unsubscribeAll();this.containerCollapseEvent.unsubscribeAll();this.textboxBlurEvent.unsubscribeAll();this.textboxChangeEvent.unsubscribeAll();YAHOO.util.Event.purgeElement(A,true);YAHOO.util.Event.purgeElement(D,true);D.innerHTML="";for(var C in this){if(YAHOO.lang.hasOwnProperty(this,C)){this[C]=null;}}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerPopulateEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete.prototype.textboxChangeEvent=null;YAHOO.widget.AutoComplete._nIndex=0; +YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._elTextbox=null;YAHOO.widget.AutoComplete.prototype._elContainer=null;YAHOO.widget.AutoComplete.prototype._elContent=null;YAHOO.widget.AutoComplete.prototype._elHeader=null;YAHOO.widget.AutoComplete.prototype._elBody=null;YAHOO.widget.AutoComplete.prototype._elFooter=null;YAHOO.widget.AutoComplete.prototype._elShadow=null;YAHOO.widget.AutoComplete.prototype._elIFrame=null;YAHOO.widget.AutoComplete.prototype._bFocused=null;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._elList=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sPastSelections="";YAHOO.widget.AutoComplete.prototype._sInitInputValue=null;YAHOO.widget.AutoComplete.prototype._elCurListItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var B=this.minQueryLength;if(!YAHOO.lang.isNumber(B)){this.minQueryLength=1;}var E=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(E)||(E<1)){this.maxResultsDisplayed=10;}var F=this.queryDelay;if(!YAHOO.lang.isNumber(F)||(F<0)){this.queryDelay=0.2;}var C=this.typeAheadDelay;if(!YAHOO.lang.isNumber(C)||(C<0)){this.typeAheadDelay=0.2;}var A=this.delimChar;if(YAHOO.lang.isString(A)&&(A.length>0)){this.delimChar=[A];}else{if(!YAHOO.lang.isArray(A)){this.delimChar=null;}}var D=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(D)||(D<0)){this.animSpeed=0.3;}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._elContent,{},this.animSpeed);}else{this._oAnim.duration=this.animSpeed;}}if(this.forceSelection&&A){}};YAHOO.widget.AutoComplete.prototype._initContainerHelperEls=function(){if(this.useShadow&&!this._elShadow){var A=document.createElement("div");A.className="yui-ac-shadow";A.style.width=0;A.style.height=0;this._elShadow=this._elContainer.appendChild(A);}if(this.useIFrame&&!this._elIFrame){var B=document.createElement("iframe");B.src=this._iFrameSrc;B.frameBorder=0;B.scrolling="no";B.style.position="absolute";B.style.width=0;B.style.height=0;B.tabIndex=-1;B.style.padding=0;this._elIFrame=this._elContainer.appendChild(B);}};YAHOO.widget.AutoComplete.prototype._initContainerEl=function(){YAHOO.util.Dom.addClass(this._elContainer,"yui-ac-container");if(!this._elContent){var C=document.createElement("div");C.className="yui-ac-content";C.style.display="none";this._elContent=this._elContainer.appendChild(C);var B=document.createElement("div");B.className="yui-ac-hd";B.style.display="none";this._elHeader=this._elContent.appendChild(B);var D=document.createElement("div");D.className="yui-ac-bd";this._elBody=this._elContent.appendChild(D);var A=document.createElement("div");A.className="yui-ac-ft";A.style.display="none";this._elFooter=this._elContent.appendChild(A);}else{}};YAHOO.widget.AutoComplete.prototype._initListEl=function(){var C=this.maxResultsDisplayed;var A=this._elList||document.createElement("ul");var B;while(A.childNodes.length=18&&A<=20)||(A==27)||(A>=33&&A<=35)||(A>=36&&A<=40)||(A>=44&&A<=45)||(A==229)){return true;}return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(G){if(this.minQueryLength<0){this._toggleContainer(false);return ;}var I=(this.delimChar)?this.delimChar:null;if(I){var B=-1;for(var F=I.length-1;F>=0;F--){var D=G.lastIndexOf(I[F]);if(D>B){B=D;}}if(I[F]==" "){for(var E=I.length-1;E>=0;E--){if(G[B-1]==I[E]){B--;break;}}}if(B>-1){var H=B+1;while(G.charAt(H)==" "){H+=1;}this._sPastSelections=G.substring(0,H);G=G.substr(H);}else{this._sPastSelections="";}}if((G&&(G.length0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}this._toggleContainer(false);return ;}G=encodeURIComponent(G);this._nDelayID=-1;if(this.dataSource.queryMatchSubset||this.queryMatchSubset){var A=this.getSubsetMatches(G);if(A){this.handleResponse(G,A,{query:G});return ;}}if(this.responseStripAfter){this.dataSource.doBeforeParseData=this.preparseRawResponse;}if(this.applyLocalFilter){this.dataSource.doBeforeCallback=this.filterResults;}var C=this.generateRequest(G);this.dataRequestEvent.fire(this,G,C);this.dataSource.sendRequest(C,{success:this.handleResponse,failure:this.handleResponse,scope:this,argument:{query:G}});};YAHOO.widget.AutoComplete.prototype._populateList=function(K,F,C){if(this._nTypeAheadDelayID!=-1){clearTimeout(this._nTypeAheadDelayID);}K=(C&&C.query)?C.query:K;var H=this.doBeforeLoadData(K,F,C);if(H&&!F.error){this.dataReturnEvent.fire(this,K,F.results);if(this._bFocused||(this._bFocused===null)){var M=decodeURIComponent(K); +this._sCurQuery=M;this._bItemSelected=false;var R=F.results,A=Math.min(R.length,this.maxResultsDisplayed),J=(this.dataSource.responseSchema.fields)?(this.dataSource.responseSchema.fields[0].key||this.dataSource.responseSchema.fields[0]):0;if(A>0){if(!this._elList||(this._elList.childNodes.length=0;Q--){var P=I[Q],E=R[Q];if(this.resultTypeList){var B=[];B[0]=(YAHOO.lang.isString(E))?E:E[J]||E[this.key];var L=this.dataSource.responseSchema.fields;if(YAHOO.lang.isArray(L)&&(L.length>1)){for(var N=1,S=L.length;N=A;O--){G=I[O];G.style.display="none";}}this._nDisplayedItems=A;this.containerPopulateEvent.fire(this,K,R);if(this.autoHighlight){var D=this._elList.firstChild;this._toggleHighlight(D,"to");this.itemArrowToEvent.fire(this,D);this._typeAhead(D,K);}else{this._toggleHighlight(this._elCurListItem,"from");}H=this.doBeforeExpandContainer(this._elTextbox,this._elContainer,K,R);this._toggleContainer(H);}else{this._toggleContainer(false);}return ;}}else{this.dataErrorEvent.fire(this,K);}};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var C=this._elTextbox.value;var B=(this.delimChar)?this.delimChar[0]:null;var A=(B)?C.lastIndexOf(B,C.length-2):-1;if(A>-1){this._elTextbox.value=C.substring(0,A);}else{this._elTextbox.value="";}this._sPastSelections=this._elTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var A=null;for(var B=this._nDisplayedItems-1;B>=0;B--){var C=this._elList.childNodes[B];var D=(""+C._sResultMatch).toLowerCase();if(D==this._sCurQuery.toLowerCase()){A=C;break;}}return(A);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(B,D){if(!this.typeAhead||(this._nKeyCode==8)){return ;}var A=this,C=this._elTextbox;if(C.setSelectionRange||C.createTextRange){this._nTypeAheadDelayID=setTimeout(function(){var F=C.value.length;A._updateValue(B);var G=C.value.length;A._selectText(C,F,G);var E=C.value.substr(F,G);A.typeAheadEvent.fire(A,D,E);},(this.typeAheadDelay*1000));}};YAHOO.widget.AutoComplete.prototype._selectText=function(D,A,B){if(D.setSelectionRange){D.setSelectionRange(A,B);}else{if(D.createTextRange){var C=D.createTextRange();C.moveStart("character",A);C.moveEnd("character",B-D.value.length);C.select();}else{D.select();}}};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(D){var E=this._elContent.offsetWidth+"px";var B=this._elContent.offsetHeight+"px";if(this.useIFrame&&this._elIFrame){var C=this._elIFrame;if(D){C.style.width=E;C.style.height=B;C.style.padding="";}else{C.style.width=0;C.style.height=0;C.style.padding=0;}}if(this.useShadow&&this._elShadow){var A=this._elShadow;if(D){A.style.width=E;A.style.height=B;}else{A.style.width=0;A.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(I){var D=this._elContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return ;}if(!I){this._toggleHighlight(this._elCurListItem,"from");this._nDisplayedItems=0;this._sCurQuery=null;if(!this._bContainerOpen){this._elContent.style.display="none";return ;}}var A=this._oAnim;if(A&&A.getEl()&&(this.animHoriz||this.animVert)){if(A.isAnimated()){A.stop(true);}var G=this._elContent.cloneNode(true);D.appendChild(G);G.style.top="-9000px";G.style.width="";G.style.height="";G.style.display="";var F=G.offsetWidth;var C=G.offsetHeight;var B=(this.animHoriz)?0:F;var E=(this.animVert)?0:C;A.attributes=(I)?{width:{to:F},height:{to:C}}:{width:{to:B},height:{to:E}};if(I&&!this._bContainerOpen){this._elContent.style.width=B+"px";this._elContent.style.height=E+"px";}else{this._elContent.style.width=F+"px";this._elContent.style.height=C+"px";}D.removeChild(G);G=null;var H=this;var J=function(){A.onComplete.unsubscribeAll();if(I){H._toggleContainerHelpers(true);H._bContainerOpen=I;H.containerExpandEvent.fire(H);}else{H._elContent.style.display="none";H._bContainerOpen=I;H.containerCollapseEvent.fire(H);}};this._toggleContainerHelpers(false);this._elContent.style.display="";A.onComplete.subscribe(J);A.animate();}else{if(I){this._elContent.style.display="";this._toggleContainerHelpers(true);this._bContainerOpen=I;this.containerExpandEvent.fire(this);}else{this._toggleContainerHelpers(false);this._elContent.style.display="none";this._bContainerOpen=I;this.containerCollapseEvent.fire(this);}}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(A,C){if(A){var B=this.highlightClassName;if(this._elCurListItem){YAHOO.util.Dom.removeClass(this._elCurListItem,B);this._elCurListItem=null;}if((C=="to")&&B){YAHOO.util.Dom.addClass(A,B);this._elCurListItem=A;}}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(B,C){if(B==this._elCurListItem){return ;}var A=this.prehighlightClassName;if((C=="mouseover")&&A){YAHOO.util.Dom.addClass(B,A);}else{YAHOO.util.Dom.removeClass(B,A);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(C){if(!this.suppressInputUpdate){var F=this._elTextbox;var E=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var B=C._sResultMatch;var D="";if(E){D=this._sPastSelections;D+=B+E;if(E!=" "){D+=" ";}}else{D=B;}F.value=D;if(F.type=="textarea"){F.scrollTop=F.scrollHeight;}var A=F.value.length;this._selectText(F,A,A);this._elCurListItem=C;}};YAHOO.widget.AutoComplete.prototype._selectItem=function(A){this._bItemSelected=true;this._updateValue(A);this._sPastSelections=this._elTextbox.value;this._clearInterval();this.itemSelectEvent.fire(this,A,A._oResultData);this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._elCurListItem){this._selectItem(this._elCurListItem); +}else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(G){if(this._bContainerOpen){var F=this._elCurListItem;var E=-1;if(F){E=F._nItemIndex;}var C=(G==40)?(E+1):(E-1);if(C<-2||C>=this._nDisplayedItems){return ;}if(F){this._toggleHighlight(F,"from");this.itemArrowFromEvent.fire(this,F);}if(C==-1){if(this.delimChar){this._elTextbox.value=this._sPastSelections+this._sCurQuery;}else{this._elTextbox.value=this._sCurQuery;}return ;}if(C==-2){this._toggleContainer(false);return ;}var D=this._elList.childNodes[C];var A=this._elContent;var B=((YAHOO.util.Dom.getStyle(A,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(A,"overflowY")=="auto"));if(B&&(C>-1)&&(C(A.scrollTop+A.offsetHeight)){A.scrollTop=(D.offsetTop+D.offsetHeight)-A.offsetHeight;}else{if((D.offsetTop+D.offsetHeight)(A.scrollTop+A.offsetHeight)){this._elContent.scrollTop=(D.offsetTop+D.offsetHeight)-A.offsetHeight;}}}}this._toggleHighlight(D,"to");this.itemArrowToEvent.fire(this,D);if(this.typeAhead){this._updateValue(D);}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return ;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseover");}else{C._toggleHighlight(D,"to");}C.itemMouseOverEvent.fire(C,D);break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=true;return ;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return ;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseout");}else{C._toggleHighlight(D,"from");}C.itemMouseOutEvent.fire(C,D);break;case"ul":C._toggleHighlight(C._elCurListItem,"to");break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=false;return ;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerClick=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return ;case"li":C._toggleHighlight(D,"to");C._selectItem(D);return ;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(A,B){B._elTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(A,B){B._toggleContainerHelpers(B._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(A,B){var C=A.keyCode;if(B._nTypeAheadDelayID!=-1){clearTimeout(B._nTypeAheadDelayID);}switch(C){case 9:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B.delimChar&&(B._nKeyCode!=C)){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 27:B._toggleContainer(false);return ;case 39:B._jumpSelection();break;case 38:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;case 40:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;default:B._bItemSelected=false;B._toggleHighlight(B._elCurListItem,"from");B.textboxKeyEvent.fire(B,C);break;}if(C===18){B._enableIntervalDetection();}B._nKeyCode=C;};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(A,B){var C=A.keyCode;if(YAHOO.env.ua.opera||(navigator.userAgent.toLowerCase().indexOf("mac")!=-1)&&(YAHOO.env.ua.webkit<420)){switch(C){case 9:if(B._bContainerOpen){if(B.delimChar){YAHOO.util.Event.stopEvent(A);}if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;default:break;}}else{if(C==229){B._enableIntervalDetection();}}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(A,C){var B=this.value;C._initProps();var D=A.keyCode;if(C._isIgnoreKey(D)){return ;}if(C._nDelayID!=-1){clearTimeout(C._nDelayID);}C._nDelayID=setTimeout(function(){C._sendQuery(B);},(C.queryDelay*1000));};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(A,B){if(!B._bFocused){B._elTextbox.setAttribute("autocomplete","off");B._bFocused=true;B._sInitInputValue=B._elTextbox.value;B.textboxFocusEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(A,C){if(!C._bOverContainer||(C._nKeyCode==9)){if(!C._bItemSelected){var B=C._textMatchesOption();if(!C._bContainerOpen||(C._bContainerOpen&&(B===null))){if(C.forceSelection){C._clearSelection();}else{C.unmatchedItemSelectEvent.fire(C,C._sCurQuery);}}else{if(C.forceSelection){C._selectItem(B);}}}if(C._bContainerOpen){C._toggleContainer(false);}C._clearInterval();C._bFocused=false;if(C._sInitInputValue!==C._elTextbox.value){C.textboxChangeEvent.fire(C);}C.textboxBlurEvent.fire(C);}};YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(A,B){if(B&&B._elTextbox&&B.allowBrowserAutocomplete){B._elTextbox.setAttribute("autocomplete","on");}};YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(A){return this.generateRequest(A);};YAHOO.widget.AutoComplete.prototype.getListItems=function(){var C=[],B=this._elList.childNodes;for(var A=B.length-1;A>=0;A--){C[A]=B[A];}return C;};YAHOO.widget.AutoComplete._cloneObject=function(D){if(!YAHOO.lang.isValue(D)){return D; +}var F={};if(YAHOO.lang.isFunction(D)){F=D;}else{if(YAHOO.lang.isArray(D)){var E=[];for(var C=0,B=D.length;C0){for(var B=0,A=D.length;B0){var B=(A===false?function(K){return K;}:decodeURIComponent);if(/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(I)){var G=I.split(/;\s/g);var H=null;var C=null;var E=null;for(var D=0,F=G.length;D + + + + API: phploader (YUI Library) + + + + + + + + + + +
+
+

Yahoo! UI Library

+

phploader  1.0.0beta

+ Yahoo! UI Library + > phploader + + +
+
+ Search: +
+   +
+
+
+
+ +
+
+
+
+
+ Filters + + + +
+
+ + +

Module: phploader + + + +

+
+ Used to specify JavaScript and CSS module requirements. It maintains a dependency +tree for these modules so when a module is requested, all of the other modules it +depends on are included as well. By default, the YUI Library is configured, and +other modules and their dependencies can be added via PHP. +
+ + + +
+
+ +

This module contains the following classes:

+ + +
+
+ +
+
+ +
+
+
+ +
+
+
+
+ Copyright © 2009 Yahoo! Inc. All rights reserved. +
+
+ + + diff --git a/examples/assets/bg_hd.gif b/examples/assets/bg_hd.gif new file mode 100644 index 0000000..c10acba Binary files /dev/null and b/examples/assets/bg_hd.gif differ diff --git a/examples/assets/custom/custom.css b/examples/assets/custom/custom.css new file mode 100644 index 0000000..2366403 --- /dev/null +++ b/examples/assets/custom/custom.css @@ -0,0 +1,3 @@ +.last { + color: red; +} \ No newline at end of file diff --git a/examples/assets/custom/data.js b/examples/assets/custom/data.js new file mode 100644 index 0000000..c2ce915 --- /dev/null +++ b/examples/assets/custom/data.js @@ -0,0 +1 @@ +var JSONString = '[{"itemText" : "List item 2"}, {"itemText" : "List item 3"}, {"itemText" : "List item 4, with custom class"}]'; \ No newline at end of file diff --git a/examples/assets/dpSyntaxHighlighter.css b/examples/assets/dpSyntaxHighlighter.css new file mode 100644 index 0000000..5fcbdf3 --- /dev/null +++ b/examples/assets/dpSyntaxHighlighter.css @@ -0,0 +1,190 @@ +/* Give syntax-highlighting textareas some height for unsupported browsers */ + +textarea.JScript, textarea.HTML, textarea.XML {height:10em;} + +/* Main style for the table */ + +.dp-highlighter { + width: 100%; + overflow: auto; + line-height: 100% !important; + margin:0 0 1em 0; +} + +.dp-highlighter table { + width:99% !important; + margin: 2px 0px 2px 0px !important; + border-collapse: collapse; + border-bottom: 2px solid #eee; + background-color: #fff; +} + +.dp-highlighter tbody.hide { display: none; } +.dp-highlighter tbody.show { display: table-row-group; _display: block; } + +.dp-highlighter td +{ + font-family: Courier New; + font-size: 11px; +} + +/* Styles for the tools */ + +.dp-highlighter .tools-corner { + background-color: #eee; + font-size: 9px; +} + +.dp-highlighter .tools { + background-color: #eee; + padding: 3px 8px 3px 10px; + border-bottom: 1px solid gray; + font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; + color: silver; +} + +.dp-highlighter .tools-corner { + background-color: #eee; +} + +.dp-highlighter .tools a { + font-size: 9px; + color: gray; + text-decoration: none; +} + +.dp-highlighter .tools a:hover { + color: red; + text-decoration: underline; +} + +/* Gutter with line number */ + +.dp-highlighter .gutter { + padding-right: 5px; + padding-left: 10px; + width: 5px; + background-color: #eee; + border-right: 1px solid gray; + color: gray; + text-align: right; + vertical-align: top; +} + +/* Single line style */ + +.dp-highlighter .line1, .line2 { + padding-left: 10px; + /*border-bottom: 1px solid #F7F7F7;*/ + white-space:nowrap; +} + +.dp-highlighter .line2 { + /*background-color: #F7F7F7;*/ +} + +/* About dialog styles */ + +.dp-about { + background-color: #fff; + margin: 0px; +} + +.dp-about table { + width: 100%; + height: 100%; + font-size: 11px; + font-family: Tahoma, Verdana, Arial, sans-serif !important; +} + +.dp-about td { + padding: 10px; + vertical-align: top; +} + +.dp-about .copy { + border-bottom: 1px solid #ACA899; + height: 95%; +} + +.dp-about .title { + color: red; + font-weight: bold; +} + +.dp-about .para { + margin-bottom: 4px; +} + +.dp-about .footer { + background-color: #ECEADB; + border-top: 1px solid #fff; + text-align: right; +} + +.dp-about .close { + font-size: 11px; + font-family: Tahoma, Verdana, Arial, sans-serif !important; + background-color: #ECEADB; + width: 60px; + height: 22px; +} + +/* Language specific styles */ + +.dp-c {} +.dp-c .comment { color: green; } +.dp-c .string { color: blue; } +.dp-c .preprocessor { color: gray; } +.dp-c .keyword { color: blue; } +.dp-c .vars { color: #d00; } +/* +.dp-vb {} +.dp-vb .comment { color: green; } +.dp-vb .string { color: blue; } +.dp-vb .preprocessor { color: gray; } +.dp-vb .keyword { color: blue; } + +.dp-sql {} +.dp-sql .comment { color: green; } +.dp-sql .string { color: red; } +.dp-sql .keyword { color: blue; } +.dp-sql .func { color: #ff1493; } +.dp-sql .op { color: #808080; } +*/ +.dp-xml {} +.dp-xml .cdata { color: #ff1493; } +.dp-xml .comments { color: green; } +.dp-xml .tag { color: blue; } +.dp-xml .tag-name { color: black; font-weight: bold; } +.dp-xml .attribute { color: red; } +.dp-xml .attribute-value { color: blue; } +/* +.dp-delphi {} +.dp-delphi .comment { color: #008200; font-style: italic; } +.dp-delphi .string { color: blue; } +.dp-delphi .number { color: blue; } +.dp-delphi .directive { color: #008284; } +.dp-delphi .keyword { font-weight: bold; color: navy; } +.dp-delphi .vars { color: #000; } + +.dp-py {} +.dp-py .comment { color: green; } +.dp-py .string { color: red; } +.dp-py .docstring { color: brown; } +.dp-py .keyword { color: blue; font-weight: bold;} +.dp-py .builtins { color: #ff1493; } +.dp-py .magicmethods { color: #808080; } +.dp-py .exceptions { color: brown; } +.dp-py .types { color: brown; font-style: italic; } +.dp-py .commonlibs { color: #8A2BE2; font-style: italic; }*/ + + +.dp-css .keyword { color: red; } +.dp-css .value { color: #ff1493; } +.dp-css .comment { color: green; } +.dp-css .string { color: blue; } +.dp-css .preprocessor { color: gray; } +.dp-css .keyword { color: blue; } +.dp-css .vars { color: #d00; } +.dp-css .colors { font-weight: bold; } diff --git a/examples/assets/dpSyntaxHighlighter.js b/examples/assets/dpSyntaxHighlighter.js new file mode 100644 index 0000000..94ad098 --- /dev/null +++ b/examples/assets/dpSyntaxHighlighter.js @@ -0,0 +1,805 @@ +/** + * Code Syntax Highlighter. + * Version 1.3.0 + * Copyright (C) 2004 Alex Gorbatchev. + * http://www.dreamprojections.com/syntaxhighlighter/ + * + * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +// +// create namespaces +// +var dp = { + sh : // dp.sh + { + Utils : {}, // dp.sh.Utils + Brushes : {}, // dp.sh.Brushes + Strings : {}, + Version : '1.3.0' + } +}; + +dp.sh.Strings = { + AboutDialog : 'About...

dp.SyntaxHighlighter

Version: {V}

http://www.dreamprojections.com/SyntaxHighlighter

©2004-2005 Alex Gorbatchev. All right reserved.
', + + // tools + ExpandCode : '+ expand code', + ViewPlain : 'view plain', + Print : 'print', + CopyToClipboard : 'copy to clipboard', + About : '?', + + CopiedToClipboard : 'The code is in your clipboard now.' +}; + +dp.SyntaxHighlighter = dp.sh; + +// +// Dialog and toolbar functions +// + +dp.sh.Utils.Expand = function(sender) +{ + var table = sender; + var span = sender; + + // find the span in which the text label and pipe contained so we can hide it + while(span != null && span.tagName != 'SPAN') + span = span.parentNode; + + // find the table + while(table != null && table.tagName != 'TABLE') + table = table.parentNode; + + // remove the 'expand code' button + span.parentNode.removeChild(span); + + table.tBodies[0].className = 'show'; + table.parentNode.style.height = '100%'; // containing div isn't getting updated properly when the TBODY is shown +} + +// opens a new windows and puts the original unformatted source code inside. +dp.sh.Utils.ViewSource = function(sender) +{ + var code = sender.parentNode.originalCode; + var wnd = window.open('', '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1'); + + code = code.replace(/' + code + ''); + wnd.document.close(); +} + +// copies the original source code in to the clipboard (IE only) +dp.sh.Utils.ToClipboard = function(sender) +{ + var code = sender.parentNode.originalCode; + + // This works only for IE. There's a way to make it work with Mozilla as well, + // but it requires security settings changed on the client, which isn't by + // default, so 99% of users won't have it working anyways. + if(window.clipboardData) + { + window.clipboardData.setData('text', code); + + alert(dp.sh.Strings.CopiedToClipboard); + } +} + +// creates an invisible iframe, puts the original source code inside and prints it +dp.sh.Utils.PrintSource = function(sender) +{ + var td = sender.parentNode; + var code = td.processedCode; + var iframe = document.createElement('IFRAME'); + var doc = null; + var wnd = + + // this hides the iframe + iframe.style.cssText = 'position:absolute; width:0px; height:0px; left:-5px; top:-5px;'; + + td.appendChild(iframe); + + doc = iframe.contentWindow.document; + code = code.replace(/' + code + ''); + doc.close(); + + iframe.contentWindow.focus(); + iframe.contentWindow.print(); + + td.removeChild(iframe); +} + +dp.sh.Utils.About = function() +{ + var wnd = window.open('', '_blank', 'dialog,width=320,height=150,scrollbars=0'); + var doc = wnd.document; + + var styles = document.getElementsByTagName('style'); + var links = document.getElementsByTagName('link'); + + doc.write(dp.sh.Strings.AboutDialog.replace('{V}', dp.sh.Version)); + + // copy over ALL the styles from the parent page + for(var i = 0; i < styles.length; i++) + doc.write(''); + + for(var i = 0; i < links.length; i++) + if(links[i].rel.toLowerCase() == 'stylesheet') + doc.write(''); + + doc.close(); + wnd.focus(); +} + +// +// Match object +// +dp.sh.Match = function(value, index, css) +{ + this.value = value; + this.index = index; + this.length = value.length; + this.css = css; +} + +// +// Highlighter object +// +dp.sh.Highlighter = function() +{ + this.addGutter = true; + this.addControls = true; + this.collapse = false; + this.tabsToSpaces = true; +} + +// static callback for the match sorting +dp.sh.Highlighter.SortCallback = function(m1, m2) +{ + // sort matches by index first + if(m1.index < m2.index) + return -1; + else if(m1.index > m2.index) + return 1; + else + { + // if index is the same, sort by length + if(m1.length < m2.length) + return -1; + else if(m1.length > m2.length) + return 1; + } + return 0; +} + +// gets a list of all matches for a given regular expression +dp.sh.Highlighter.prototype.GetMatches = function(regex, css) +{ + var index = 0; + var match = null; + + while((match = regex.exec(this.code)) != null) + { + this.matches[this.matches.length] = new dp.sh.Match(match[0], match.index, css); + } +} + +dp.sh.Highlighter.prototype.AddBit = function(str, css) +{ + var span = document.createElement('span'); + + str = str.replace(/&/g, '&'); + str = str.replace(/ /g, ' '); + str = str.replace(/'); + + // when adding a piece of code, check to see if it has line breaks in it + // and if it does, wrap individual line breaks with span tags + if(css != null) + { + var regex = new RegExp('
', 'gi'); + + if(regex.test(str)) + { + var lines = str.split(' 
'); + + str = ''; + + for(var i = 0; i < lines.length; i++) + { + span = document.createElement('SPAN'); + span.className = css; + span.innerHTML = lines[i]; + + this.div.appendChild(span); + + // don't add a
for the last line + if(i + 1 < lines.length) + this.div.appendChild(document.createElement('BR')); + } + } + else + { + span.className = css; + span.innerHTML = str; + this.div.appendChild(span); + } + } + else + { + span.innerHTML = str; + this.div.appendChild(span); + } +} + +// checks if one match is inside any other match +dp.sh.Highlighter.prototype.IsInside = function(match) +{ + if(match == null || match.length == 0) + return; + + for(var i = 0; i < this.matches.length; i++) + { + var c = this.matches[i]; + + if(c == null) + continue; + + if((match.index > c.index) && (match.index <= c.index + c.length)) + return true; + } + + return false; +} + +dp.sh.Highlighter.prototype.ProcessRegexList = function() +{ + for(var i = 0; i < this.regexList.length; i++) + this.GetMatches(this.regexList[i].regex, this.regexList[i].css); +} + +dp.sh.Highlighter.prototype.ProcessSmartTabs = function(code) +{ + var lines = code.split('\n'); + var result = ''; + var tabSize = 4; + var tab = '\t'; + + // This function inserts specified amount of spaces in the string + // where a tab is while removing that given tab. + function InsertSpaces(line, pos, count) + { + var left = line.substr(0, pos); + var right = line.substr(pos + 1, line.length); // pos + 1 will get rid of the tab + var spaces = ''; + + for(var i = 0; i < count; i++) + spaces += ' '; + + return left + spaces + right; + } + + // This function process one line for 'smart tabs' + function ProcessLine(line, tabSize) + { + if(line.indexOf(tab) == -1) + return line; + + var pos = 0; + + while((pos = line.indexOf(tab)) != -1) + { + // This is pretty much all there is to the 'smart tabs' logic. + // Based on the position within the line and size of a tab, + // calculate the amount of spaces we need to insert. + var spaces = tabSize - pos % tabSize; + + line = InsertSpaces(line, pos, spaces); + } + + return line; + } + + // Go through all the lines and do the 'smart tabs' magic. + for(var i = 0; i < lines.length; i++) + result += ProcessLine(lines[i], tabSize) + '\n'; + + return result; +} + +dp.sh.Highlighter.prototype.SwitchToTable = function() +{ + // thanks to Lachlan Donald from SitePoint.com for this
tag fix. + var html = this.div.innerHTML.replace(/<(br)\/?>/gi, '\n'); + var lines = html.split('\n'); + var row = null; + var cell = null; + var tBody = null; + var html = ''; + var pipe = ' | '; + + // creates an anchor to a utility + function UtilHref(util, text) + { + return '' + text + ''; + } + + tBody = document.createElement('TBODY'); // can be created and all others go to tBodies collection. + + this.table.appendChild(tBody); + + if(this.addGutter == true) + { + row = tBody.insertRow(-1); + cell = row.insertCell(-1); + cell.className = 'tools-corner'; + } + + if(this.addControls == true) + { + var tHead = document.createElement('THEAD'); // controls will be placed in here + this.table.appendChild(tHead); + + row = tHead.insertRow(-1); + + // add corner if there's a gutter + if(this.addGutter == true) + { + cell = row.insertCell(-1); + cell.className = 'tools-corner'; + } + + cell = row.insertCell(-1); + + // preserve some variables for the controls + cell.originalCode = this.originalCode; + cell.processedCode = this.code; + cell.className = 'tools'; + + if(this.collapse == true) + { + tBody.className = 'hide'; + cell.innerHTML += '' + UtilHref('Expand', dp.sh.Strings.ExpandCode) + '' + pipe + ''; + } + + cell.innerHTML += UtilHref('ViewSource', dp.sh.Strings.ViewPlain) + pipe + UtilHref('PrintSource', dp.sh.Strings.Print); + + // IE has this clipboard object which is easy enough to use + if(window.clipboardData) + cell.innerHTML += pipe + UtilHref('ToClipboard', dp.sh.Strings.CopyToClipboard); + + cell.innerHTML += pipe + UtilHref('About', dp.sh.Strings.About); + } + + for(var i = 0, lineIndex = this.firstLine; i < lines.length - 1; i++, lineIndex++) + { + row = tBody.insertRow(-1); + + if(this.addGutter == true) + { + cell = row.insertCell(-1); + cell.className = 'gutter'; + cell.innerHTML = lineIndex; + } + + cell = row.insertCell(-1); + cell.className = 'line' + (i % 2 + 1); // uses .line1 and .line2 css styles for alternating lines + cell.innerHTML = lines[i]; + } + + this.div.innerHTML = ''; +} + +dp.sh.Highlighter.prototype.Highlight = function(code) +{ + function Trim(str) + { + return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1'); + } + + function Chop(str) + { + return str.replace(/\n*$/, '').replace(/^\n*/, ''); + } + + function Unindent(str) + { + var lines = str.split('\n'); + var indents = new Array(); + var regex = new RegExp('^\\s*', 'g'); + var min = 1000; + + // go through every line and check for common number of indents + for(var i = 0; i < lines.length && min > 0; i++) + { + if(Trim(lines[i]).length == 0) + continue; + + var matches = regex.exec(lines[i]); + + if(matches != null && matches.length > 0) + min = Math.min(matches[0].length, min); + } + + // trim minimum common number of white space from the begining of every line + if(min > 0) + for(var i = 0; i < lines.length; i++) + lines[i] = lines[i].substr(min); + + return lines.join('\n'); + } + + // This function returns a portions of the string from pos1 to pos2 inclusive + function Copy(string, pos1, pos2) + { + return string.substr(pos1, pos2 - pos1); + } + + var pos = 0; + + this.originalCode = code; + this.code = Chop(Unindent(code)); + this.div = document.createElement('DIV'); + this.table = document.createElement('TABLE'); + this.matches = new Array(); + + if(this.CssClass != null) + this.table.className = this.CssClass; + + // replace tabs with spaces + if(this.tabsToSpaces == true) + this.code = this.ProcessSmartTabs(this.code); + + this.table.border = 0; + this.table.cellSpacing = 0; + this.table.cellPadding = 0; + + this.ProcessRegexList(); + + // if no matches found, add entire code as plain text + if(this.matches.length == 0) + { + this.AddBit(this.code, null); + this.SwitchToTable(); + return; + } + + // sort the matches + this.matches = this.matches.sort(dp.sh.Highlighter.SortCallback); + + // The following loop checks to see if any of the matches are inside + // of other matches. This process would get rid of highligting strings + // inside comments, keywords inside strings and so on. + for(var i = 0; i < this.matches.length; i++) + if(this.IsInside(this.matches[i])) + this.matches[i] = null; + + // Finally, go through the final list of matches and pull the all + // together adding everything in between that isn't a match. + for(var i = 0; i < this.matches.length; i++) + { + var match = this.matches[i]; + + if(match == null || match.length == 0) + continue; + + this.AddBit(Copy(this.code, pos, match.index), null); + this.AddBit(match.value, match.css); + + pos = match.index + match.length; + } + + this.AddBit(this.code.substr(pos), null); + + this.SwitchToTable(); +} + +dp.sh.Highlighter.prototype.GetKeywords = function(str) +{ + return '\\b' + str.replace(/ /g, '\\b|\\b') + '\\b'; +} + +// highlightes all elements identified by name and gets source code from specified property +dp.sh.HighlightAll = function(name, showGutter /* optional */, showControls /* optional */, collapseAll /* optional */, firstLine /* optional */) +{ + function FindValue() + { + var a = arguments; + + for(var i = 0; i < a.length; i++) + { + if(a[i] == null) + continue; + + if(typeof(a[i]) == 'string' && a[i] != '') + return a[i] + ''; + + if(typeof(a[i]) == 'object' && a[i].value != '') + return a[i].value + ''; + } + + return null; + } + + function IsOptionSet(value, list) + { + for(var i = 0; i < list.length; i++) + if(list[i] == value) + return true; + + return false; + } + + function GetOptionValue(name, list, defaultValue) + { + var regex = new RegExp('^' + name + '\\[(\\w+)\\]$', 'gi'); + var matches = null; + + for(var i = 0; i < list.length; i++) + if((matches = regex.exec(list[i])) != null) + return matches[1]; + + return defaultValue; + } + + var elements = document.getElementsByName(name); + var highlighter = null; + var registered = new Object(); + var propertyName = 'value'; + + // if no code blocks found, leave + if(elements == null) + return; + + // register all brushes + for(var brush in dp.sh.Brushes) + { + var aliases = dp.sh.Brushes[brush].Aliases; + + if(aliases == null) + continue; + + for(var i = 0; i < aliases.length; i++) + registered[aliases[i]] = brush; + } + + for(var i = 0; i < elements.length; i++) + { + var element = elements[i]; + var options = FindValue( + element.attributes['class'], element.className, + element.attributes['language'], element.language + ); + var language = ''; + + if(options == null) + continue; + + options = options.split(':'); + + language = options[0].toLowerCase(); + + if(registered[language] == null) + continue; + + // instantiate a brush + highlighter = new dp.sh.Brushes[registered[language]](); + + // hide the original element + element.style.display = 'none'; + + highlighter.addGutter = (showGutter == null) ? !IsOptionSet('nogutter', options) : showGutter; + highlighter.addControls = (showControls == null) ? !IsOptionSet('nocontrols', options) : showControls; + highlighter.collapse = (collapseAll == null) ? IsOptionSet('collapse', options) : collapseAll; + + // first line idea comes from Andrew Collington, thanks! + highlighter.firstLine = (firstLine == null) ? parseInt(GetOptionValue('firstline', options, 1)) : firstLine; + + highlighter.Highlight(element[propertyName]); + + // place the result table inside a div + var div = document.createElement('DIV'); + + div.className = 'dp-highlighter'; + div.appendChild(highlighter.table); + + element.parentNode.insertBefore(div, element); + } +} + + +dp.sh.Brushes.Xml = function() +{ + this.CssClass = 'dp-xml'; +} + +dp.sh.Brushes.Xml.prototype = new dp.sh.Highlighter(); +dp.sh.Brushes.Xml.Aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml']; + +dp.sh.Brushes.Xml.prototype.ProcessRegexList = function() +{ + function push(array, value) + { + array[array.length] = value; + } + + /* If only there was a way to get index of a group within a match, the whole XML + could be matched with the expression looking something like that: + + () + | () + | (<)*(\w+)*\s*(\w+)\s*=\s*(".*?"|'.*?'|\w+)(/*>)* + | () + */ + var index = 0; + var match = null; + var regex = null; + + // Match CDATA in the following format + // <\!\[[\w\s]*?\[(.|\s)*?\]\]> + this.GetMatches(new RegExp('<\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\]>', 'gm'), 'cdata'); + + // Match comments + // + this.GetMatches(new RegExp('', 'gm'), 'comments'); + + // Match attributes and their values + // (\w+)\s*=\s*(".*?"|\'.*?\'|\w+)* + regex = new RegExp('([\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*', 'gm'); + while((match = regex.exec(this.code)) != null) + { + push(this.matches, new dp.sh.Match(match[1], match.index, 'attribute')); + + // if xml is invalid and attribute has no property value, ignore it + if(match[2] != undefined) + { + push(this.matches, new dp.sh.Match(match[2], match.index + match[0].indexOf(match[2]), 'attribute-value')); + } + } + + // Match opening and closing tag brackets + // + this.GetMatches(new RegExp('', 'gm'), 'tag'); + + // Match tag names + // body #ygunav {overflow:hidden;} +#ygunav strong {font-family:verdana;} +#ygunav p {display:inline;margin:0;padding:0;} +#ygunav p em {float:left;text-align:left;font-style:normal; padding-top:.7em} +* html #ygunav p em {margin-top:1px;} +#ygunav p em i {visibility:hidden;} +#ygunav a {color:#000;} +#ygunav form {display:inline;margin:0 0 0 1em;} +#ygsp {width:8em;font-size:110%;padding:0;vertical-align:middle;} +#ygunav .ygbt {background:#dcdcdc;font:110% verdana;position:relative;top:1px;} +* html #ygunav .ygbt {top:4px;} +* html>body #ygunav .ygbt {line-height:0;top:-4px;} +#ygunav label {color:#666;font-family:tahoma;top:1px;} + +#bd ol.getstarted { margin:0; padding:0; } +#bd ol.getstarted li { font-weight:bold; color:#668AA8; margin-bottom:1em; padding-left:20px; list-style-type:none;} +#bd ol.getstarted li p { color:#000; font-weight:normal; margin:0 0 0 20px; padding:0 } + +/* removing +#bd p {margin-bottom:8px;} +*/ + +#promo {zoom:1;border: 1px solid #B6CDE1; padding:1em; /*position:relative;*/ background-color:#FFF5DF;} +/*#promo ul {margin-bottom:0;}*/ +#promo h1 {margin-top:0; padding-top:0} +#promo h2 {line-height:1.2em; color:#668AA8; margin-top:0; padding-top:0; border:none; font-size:100%} +#promo p {line-height:1.2em; font-weight:400;} +#promo h1 em {float:right; top:0; right:0; font-style:normal; font-size:80%} +#promo h4 { color:#E76300; } +#promo.component div {width:48%; float:left;} +#promo:after {content:'.';visibility:hidden;clear:left;height:0;display:block;} +#promo p#api {margin-top:.2em;} +#promo #download img {float:left; padding:0 0.5em 0.5em 0;} +#promo #blog {clear:left;} + + +code {font-family:"Courier New"; font-size: 100%; font-weight:bolder;} + +div.apisummary {height:auto; margin:10px 0; width:auto; zoom:1;} +div.apisummary table {font-size:inherit;font:100%; border-collapse:separate; border:1px solid #666666; border-left:none;} +#doc3 div.apisummary table td, #doc3 div.apisummary table th {padding:.35em; vertical-align:top;} +div.apisummary table th { background:#B6CDE1; color:#fff; vertical-align:top; font-weight:bold;} +div.apisummary table td { border-top:1px solid #666666;} +div.apisummary table td, div.apisummary table th { border-left:1px solid #666666;} +div.apisummary table tr { background-color:#ddd;} +div.apisummary table tr.odd { background-color:#fff; } +div.apisummary table tfoot tr { background-color:#fff; } + +dl#menuwidgets dt {font-weight:bold;} +dl#menuwidgets {margin:0 0 0 1.5em;} +img.example {clear:right;margin-bottom:10px;margin-left:10px;border:0;float:right;border:1px solid #999;} + +/*YUI theater box on main page top right corner*/ +#yui-theater {width:316px; overflow:hidden;} +#yui-theater h3 {margin:0; padding:0; color:#E76300; font-size:100%; font-weight:bold; font-stretch:expanded;} +#yui-theater h2 {margin:0 0 10px 0; padding:0; border:none; color:#000; font-size:122%; font-weight:bold;} +#yui-theater p {margin:7px 0 0 0;} +#yui-theater div {float:right; font-size:85%;} + +/*rss reader styles*/ +p.loading-content {background-image:url(http://l.yimg.com/a/i/ydn/yuiweb/img/busy_arrow.gif); background-position:top left; background-repeat:no-repeat; height:20px;padding:4px 0 0 25px; margin:0;} +#doc3 ul.yuirssreader {margin:0; padding:0;} +#doc3 ul.yuirssreader li {list-style-type:none;padding:5px 0 0 12px; margin:0;} +#doc3 ul.yuirssreader li p {margin:0; padding:0;} +ul.yuirssreader cite {color:#666666; margin:0;} +span.yuirssreader-date {font-size:77%; color:#E76300;} +img.rssbadge {display:inline;border:none !important;} + +#index-secondary {width:316px;float:right;margin-left:10px;} +#index-main {margin-right:331px;} +#index-main #promo li {list-style-type:none;font-size:92%;margin-top:2px;} +#index-main #promo ul {margin:0;} + +/*styles for right gutter on component pages*/ +#cheatsheet h3 {margin-top:0;} +#cheatsheet img, #componentvideo img {margin:.5em 0 .2em 0; border:1px solid #999;} +#cheatsheet p {margin:0; font-size:77%;} +#cheatsheet h4, .example-container h4, #examples h4 {margin:0.2em 0 .1em 0; color:#668AA8; font-size:92%;} +#examples ul, #morereading ul, #module ul {font-size:85%; list-style:circle; margin:0 0 1em 10px;} +#examples p, #componentvideo p {font-size:85%; margin:0 0 .2em 0;} +#examples li.selected {font-weight:bold;} + +/*styles for example pages*/ +.example .promo {background-color:#89d;border-color:#666666; padding:1em;} +.example .promo h1, .example .promo h2, .example .promo h3 {color:#FFCC66;} +.example .promo h1 {font-size:159%; padding-top:0; margin-top:0;} +.exampleIntro, .exampleIntro p, .exampleIntro a, .exampleIntro a code {color:#fff;} +.example .promo p {margin-top:.7em;} + +.example cite.byline {display:block; padding:0.5em; background-color:#eee; border:1px solid #000;margin-bottom:5px} + +firstContent {margin-top:0; padding-top:0;} +#logger {margin-top:1em;} +.example-container {background-color:#F1F6F7;} + +.example-container .bd {padding:1em; position:relative; z-index:1; zoom:1;} +.example-container .bd .bd {padding:0; position:static;} /* Reset to defaults to ensure styles are only applied to the top-level .bd of .example-container */ +.example-container>.bd:after {content:'.';visibility:hidden;clear:left;height:0;display:block;} +.example-container .exampleHd {background: url(example-hd-bg.gif) 0 0 repeat-x #4E4D4C; } +.example-container h3 {margin:.2em 0 .4em 0;} +.example .example-container h1, .example .example-container h2, .example .example-container h3, .example .example-container h4, .example .example-container h5, .example .example-container h6 {color:#E76300; font-weight:bold;} +.example-container a {color:#000;} +.example-container a:visited, .example-container a:visited code {color:#000;} +.example-container a:active, .example-container a:active code {color: #000;} + +#loggerGloss {margin-top:.5em; font-size:85%;} +#loggerDiv {font-size:77%;text-align:left;margin-top:.5em; visibility:hidden; height:280px; } /*gets turned on by script when loaded */ +#loggerDiv.yui-log {padding:.4em;width:96%;background-color:#FBE7D9;border:1px solid #666;font-family:monospace;z-index:9000;} +#loggerDiv.yui-log p {margin:1px;padding:.1em;} +#loggerDiv.yui-log .yui-log-hd {margin:0; padding:0; background-color:#CECCCC;} +#loggerDiv.yui-log .yui-log-hd h4 {display:none;} +#loggerDiv.yui-log .yui-log-bd {width:100%;height:20em;background-color:#FFF;border:1px solid #ECECEC;overflow-y:auto;overflow-x:hidden;} +#loggerDiv.yui-log .yui-log-bd pre {border-top:1px solid #ECECEC;} +#loggerDiv.yui-log .yui-log-bd code p {margin:1px 0;} +#loggerDiv.yui-log .yui-log-ft .yui-log-categoryfilters {margin-top:.5em;clear:right;} +#loggerDiv.yui-log .yui-log-ft .yui-log-sourcefilters {margin-top:.5em;border:none; clear:both;} +#loggerDiv.yui-log .yui-log-btns {margin-top:.2em;padding:.2em;background: url(bg_hd.gif) 0 0 repeat-x #CECCCC; text-align:right; float:none; position:static;} +#loggerDiv.yui-log .yui-log-filtergrp {margin-right:.3em; float:left; display:block} +#loggerDiv.yui-log .yui-log-ft {margin-top:.3em;margin-bottom:.3em; font-family:verdana; zoom:1;} +/*bug in Safari when this is applied to .yui-log-ft:*/ +#loggerDiv.yui-log:after {content:'.';visibility:hidden;clear:both;height:0;display:block;} +.example-container.newWindow {text-align:center;} +p.newWindowButton {text-align:right; margin-top:0; padding:.5em;} +.bd p.newWindowButton {text-align:center;} /*when new window is required and button appears in middle of example body*/ +p.loggerButton {text-align:center;} +#loggerLink a, #newWindowLink a {font-size:115%; font-weight:bold; color:#000099;} +#newWindowLink a {font-size:107%;} +#loggerModule {padding-bottom:.2em;} + +/*right column navigation on example rosters*/ +#exampleToc {background-color:#ecf5fa; padding:0; border:1px solid #89d; margin-top:.5em;} +#exampleToc ul {margin:0; padding:0; font-size:85%; } +#exampleToc ul li {list-style:none; padding:0; margin:0; } +#exampleToc ul li.selected { font-weight:bold; color:#fff; background:#000099; padding:0; } +#exampleToc ul li.selected a { color:#fff; } +#exampleToc ul li a { display:block; padding:2px 2px 2px 10px; text-decoration:none; } +#exampleToc ul li a:hover { color:#fff; background:#e60; } +#exampleToc ul li.selected a code { color:#fff; } + +/*theater page styles*/ +.theater h1 {border-bottom:1px dashed #CCC; margin-bottom:1em;padding-bottom:.2em;} +.theater img {border:1px solid #666;} +.theater img.last {border:1px solid #666;} +.theater p.details {font-size:77%; color:#666; margin:.2em 0 0 0; padding:0;} +.theater p.description, #doc3 .theater ul li {font-size:85%; margin:0; padding:0; color:#333;} + +#readmePanel .hd { font-weight:bold; font-size:129%; color:#fff; background:#89d; } +#readmePanel .bd {text-align:left; overflow:auto;} +#readmePanel .ft {text-align:right; background-color:#E7E7E7; font-size:85%;} +/* Browser specific (not valid) styles to make preformatted text wrap */ +#readmePanel .bd pre { + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ + font-size: 100%; + color:#000033;} + +/*ed eliot's server-side delicious badge css*/ + #delicious-badge {margin-top:.6em; font: 85% Arial, sans-serif; border: 1px solid #b1b1b1; } +#delicious-badge .bookmark { background: url(http://images.del.icio.us/static/img/delicious.small.gif) no-repeat left center; padding-left: 15px; font-weight: bold; } +#delicious-badge p, #delicious-badge div { padding: 7px; margin: 0; text-align: center; } +#delicious-badge a { color: #00f; text-decoration: none; } +#delicious-badge div { background: #eee; } +#delicious-badge div span { font-weight: bold; color: #000; } +#delicious-badge ul, #delicious-badge li { display: inline; list-style: none; padding: 0; margin: 0; } +#delicious-badge li { margin-left: 5px; } +#delicious-badge li span { position: absolute; left: -999px; width: 999px; } +#delicious-badge .saved-by { color: #999; } +#delicious-badge .saved-by span { background: #00f; padding: 3px; color: #fff; } +#delicious-badge .be-first { font-size: 85%; color: #999; } +#delicious-badge .tag-size-1 { font-size: 100%; } +#delicious-badge .tag-size-2 { font-size: 107%; } +#delicious-badge .tag-size-3 { font-size: 114%; } +#delicious-badge .tag-size-4 { font-size: 122%; } +#delicious-badge .tag-size-5 { font-size: 129%; } + +/*faq page:*/ +.yui-ge .yui-g {width:98%;} +.yui-ge .yui-g .yui-u {width:48.1%;} +#questions {margin:1em 0 2em 0; padding:0.5em; border:1px solid #838383; background-color:#E6E6E6;} +#questions ul {margin:0; list-style:none;} +#yui-main #questions li {padding-bottom:.2em; font-size:85%; margin:0;} +#questions li a {display:block; padding:.6em; text-decoration:none;} +#questions li a:hover {background-color:#F6F6F6;} + +/*for notes on file includes*/ +#configuratorBadge {display:block; float:left; margin:0 .5em .5em 0;} +.include-notice {clear:left; border:1px solid #6F7EA1; background:#eee; font:77% verdana; padding:.7em;} +.include-notice p.firstP {margin-top:0;} +.include-notice p.lastP {margin-bottom:0;} +.include-notice strong {color:#990000;} +.configurator-notice p {font-size:85%;} + +/*for site search suggest via autocomplete*/ +#ygunav {overflow:visible !important;} +#sitesearch {float:right; width:40em; position:relative; text-align:right;} +#searchinput {width:15em; font-size:11px; font-weight:bold; position:relative; top:2px;} +#searchcontainer {text-align:left; width:40em; overflow:hidden; line-height:normal; position:absolute;} +#searchcontainer .yui-ac-bd {font-size:10px; color:#666; background-color:#EAEFF2; text-align:left;} +#searchcontainer li {overflow:hidden; text-overflow:ellipsis; -o-text-overflow:ellipsis; cursor:pointer; padding-top:2px; } +#searchcontainer em {font-style:normal; font-weight:bold; color:#000033;} +.yui-ac-ft {padding:3px; font-size:10px; text-align:right;} +#searchcontainer .yui-ac-highlight {background-color:#87A4D6;} diff --git a/examples/assets/yui.gif b/examples/assets/yui.gif new file mode 100644 index 0000000..5033ff5 Binary files /dev/null and b/examples/assets/yui.gif differ diff --git a/examples/assets/yuilib.jpg b/examples/assets/yuilib.jpg new file mode 100644 index 0000000..88b8255 Binary files /dev/null and b/examples/assets/yuilib.jpg differ diff --git a/examples/inc/config.inc b/examples/inc/config.inc new file mode 100644 index 0000000..190b31e --- /dev/null +++ b/examples/inc/config.inc @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/examples/inc/footer.inc b/examples/inc/footer.inc new file mode 100644 index 0000000..f4e1905 --- /dev/null +++ b/examples/inc/footer.inc @@ -0,0 +1,17 @@ +
+

Copyright © Yahoo! Inc. All rights reserved.

+

Privacy Policy - + Terms of Service - + Copyright Policy - + Job Openings

+
+ + + + + + + + diff --git a/examples/inc/header.inc b/examples/inc/header.inc new file mode 100644 index 0000000..6f351ea --- /dev/null +++ b/examples/inc/header.inc @@ -0,0 +1,25 @@ + + + + + YUI Library: YUI Loader Utility + + + + + + + +
+
+ +
+

YUI Library: YUI PHP Loader Utility

+
+
diff --git a/examples/inc/moduleNames.inc b/examples/inc/moduleNames.inc new file mode 100644 index 0000000..4396784 --- /dev/null +++ b/examples/inc/moduleNames.inc @@ -0,0 +1,103 @@ +YUI ComponentModule Name"; + +$keys = array_keys($mmap); + +$i = 0; +foreach ($keys as $mname) { + $moduleNamesTable .= " 0) { + $moduleNamesTable .= " class='odd'"; + }; + + $mhome = (isset($moduleHomes[$mname])) ? $moduleHomes[$mname] : $mname; + + $moduleNamesTable .= ">$mmap[$mname]$mname"; +} + +$moduleNamesTable .= ""; + +$rollupNamesTable = ""; + +$keys = array_keys($rmap); + +$i = 0; +foreach ($keys as $rname) { + $rollupNamesTable .= " 0) { + $rollupNamesTable .= " class='odd'"; + }; + + $rollupNamesTable .= ">"; +} + +$rollupNamesTable .= "
YUI RollupProvides
$rname$rmap[$rname]
"; + +?> diff --git a/examples/inc/phploader.inc b/examples/inc/phploader.inc new file mode 100644 index 0000000..2ddddda --- /dev/null +++ b/examples/inc/phploader.inc @@ -0,0 +1,9 @@ +

YUI PHP Loader Utility Examples:

+ + diff --git a/examples/inc/resources.inc b/examples/inc/resources.inc new file mode 100644 index 0000000..22e3991 --- /dev/null +++ b/examples/inc/resources.inc @@ -0,0 +1,8 @@ +

More YUI Loader Utility Resources:

+ \ No newline at end of file diff --git a/examples/inc/support.inc b/examples/inc/support.inc new file mode 100644 index 0000000..7eb2216 --- /dev/null +++ b/examples/inc/support.inc @@ -0,0 +1,18 @@ +

Support & Community

+

The YUI Library and related topics are discussed on the on the ydn-javascript mailing list.

+ +
+ + + + + +
+
+ +

In addition, please visit the YUIBlog for updates and articles about the YUI Library written by the library's developers.

+ +

Filing Bugs & Feature Requests

+ +

The YUI Library's public bug tracking and feature request repositories are located on the YUILibrary.com site. Before filing new feature requests or bug reports, please review our reporting guidelines.

+ diff --git a/examples/index.php b/examples/index.php new file mode 100644 index 0000000..5e4172c --- /dev/null +++ b/examples/index.php @@ -0,0 +1,224 @@ + +
+
+
+
+ +
+

Yahoo! UI Library: YUI PHP Loader

+ +

The YUI PHP Loader Utility is a server-side utility that allows you to load specific YUI components and their dependencies into your page via PHP. YUI PHP Loader can operate as a holistic solution by loading all of your necessary YUI components, or it can be used to add one or more components to a page on which some YUI content already exists.

+ +

YUI PHP Loader adds value in the following ways:

+
    +
  1. Reliable, sorted loading of dependencies: YUI comprises more than two-dozen components, many of which work together to provide the best possible compromise between compartmentalization and code reuse. Because of this, YUI components often need to load with specific dependencies in a specific order. YUI PHP Loader understands which components depend on one another, and based on this knowledge it ensures that the right resources are loaded in the right order.
  2. +
  3. Automatic use of rolled-up files. YUI PHP Loader knows about all of the built-in rollup files that ship with YUI — like the yahoo-dom-event.js file that contains the Yahoo Global Object, the Dom Collection, and the Event Utility, three components that are commonly used together. By automatically using rolled-up files when it makes sense to do so, the YUI PHP Loader helps you reduce HTTP requests and thereby keep your page as efficient as possible.
  4. + +
+ +

As you think about how you want to load YUI on the page, you may find it useful to refer to this overview of some of the most common loading strategies and their relative merits:

+ + + + +
+ +

Getting Started

+ +

After downloading YUI PHP Loader the archive needs to be extracted somewhere within the servers webroot (e.g.) htdocs/phploader. To begin using the loader you must include the base class file and call the YAHOO_util_Loader constructor with a YUI version number to create an instance of the Loader. The chosen version must have corresponding metadata available within your local YUI PHP Loader installation.

+ + +

Simple Use Case: Adding YUI Components to the Page with the load() Method

+ +

YUI PHP Loader makes it a simple thing to get started using YUI components. After creating an instance of YAHOO_util_Loader tell it what you want to load, and let it sort out all of the dependencies on your behalf. When you are ready to output the CSS and/or JavaScript files simply call the tags() method. Since we will cover the benefits of using rollup files later in this document we will turn them off for this first example.

+ + + +

Configuration Options

+ +

The following configuration options are supported by the YUI PHP Loader Utility. +These can be set individually on a YUI PHP Loader instance:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Configuration OptionPurpose
base(string) Allows you to specify a different location (as a full or relative filepath) for the YUI build directory. By default, YUI PHP Loader will serve files from Yahoo's servers.
filter + (string) A filter to apply to result urls. This filter will modify the default + path for all modules. The default path for the YUI library is the + minified version of the files (e.g., event-min.js). The valid filters are: +
+
YUI_DEBUG
+
Selects the debug versions of the library (e.g., event-debug.js). + This option will automatically include the logger widget
+
YUI_RAW
+
Selects the non-minified version of the library (e.g., event.js). +
+
allowRollups(boolean) Should Loader use aggregate files (like yahoo-dom-event.js or utilities.js) that combine several YUI components in a single HTTP request? Default: true.
loadOptional(boolean) Should loader load optional dependencies for the components you're requesting? (Note: If you only want some but not all optional dependencies, you can list out the dependencies you want as part of your required list.) Default: false.
combine(boolean) If set to true, YUI files will be combined into a single request using the combo service provided on the Yahoo! CDN
comboBase + (string) The base path to the Yahoo! CDN service. Default: http://yui.yahooapis.com/combo?
+ Note: YUI PHP Loader also ships with an intrinsic, lightweight combo-handler (see combo.php). Refer to the included examples for a use case on this. +
+
+ +

YUI Module Names

+ +

Each YUI component has a corresponding module name that is used as a unique identifier within YUI scripts. For example, the Event Utility is internally referred to as "event". YUI PHP Loader loads components based on these unique module names. Here is the full list of YUI module names. All except YUI PHP Loader itself can be loaded via the Loader component.

+ +
+ +
+ +

YUI ships with some aggregate or "rollup" files, each comprising two or more modules, to help you reduce the number of HTTP requests you make while loading YUI content. Each aggregate file has its own module name. Moreover, some modules provide the functionality of one or more modules in the above list.

+ +

When you choose to allowRollups, YUI PHP Loader will choose the most appropriate set of files to meet your requirements while using the smallest number of included files. You can also specify an aggregate file directly as a requirement by requesting it by its own module name. The following is a list of modules that aggregate or include multiple modules:

+ +
+ +
+ +

Refining Our Use Case: Cutting out extra HTTP requests

+ +

As noted in the configuration table the YUI PHP Loader provides some additional parameters that give us even more control over the loading and performance of our component selections. By simply enabling rollups in this example we can cut down the total HTTP requests from 9 to 5. If we enabled combo handling in addition to rollups we can reduce this down to just 2 HTTP requests; one per tag type (i.e.) link and script.

+ + +

In addition to the tags() method there are a number of other class methods that will allow you to do things like embed the code inline and fetch the CSS & JavaScript seperately which is not a bad idea since there are well known performance benefits to placing CSS in the document head and JavaScript near the bottom of your document. For more information on these and other methods please refer to the API documents.

+ +

Understanding the Metadata

+ +

YUI PHP Loader relies on metadata files to calculate module dependencies, rollups, sort order, etc. The metadata files are located in the lib/meta folder. By default YUI PHP Loader ships with metadata for the latest YUI releases; both versions 2 and 3. Additional metadata can be added as needed to support older and/or newer YUI releases. YUI PHP Loader uses pre-built PHP config files first, but is capable of parsing YUI JSON metadata files if no PHP config file is available. The naming convention for PHP config files is config_{yui version}.php (e.g.) config_.php. The naming convention for JSON config files is json_{yui version}.txt (e.g.) json_.txt.

+ + + +
+ +
+ +
+ +
+ + +
+
+ +
+
+ + \ No newline at end of file diff --git a/examples/phploader-advanced.php b/examples/phploader-advanced.php new file mode 100644 index 0000000..5b072ef --- /dev/null +++ b/examples/phploader-advanced.php @@ -0,0 +1,101 @@ + + +
+
+
+
+ + +
+

YUI PHP Loader Utility: Using YUI Loader to Load the Calendar Control (Advanced)

+ +
+

In this example, we bring a YUI component onto the page using the YUI PHP Loader Utility. This example implements YUI PHP Loader via a YAHOO_util_Loader instance. We include the YUI PHP Loader script file, then specify in configuration which component we want loaded on the page — and what we want to do once it is loaded.

+

This example loads in new window to demonstrate a somewhat more advanced use case — a page with no other content, wherein the Loader is introducing YUI into a simple context.

+
+ + +
+ +

Advanced Use Case: Using YUI PHP Loader to Load the Calendar Control

+ +

This example implements the YUI PHP Loader Utility to load the Calendar Control.

+ +

The workflow happens in four steps:

+
    +
  1. Include the YUI PHP Loader class file
  2. +
  3. Create a YAHOO_util_YUILoader instance: Set configuration flags as needed, call the load method with a list of components to load, and define what to do once the components are loaded (in this case, once the components are loaded we instantiate a Calendar Control on the page).
  4. +
  5. Ouput YUI CSS <link> nodes
  6. +
  7. Ouput YUI JavaScript <script> nodes
  8. +
+

Here's what that looks like in terms of raw source — this is the full source code for this example:

+ + +

This code executes the following steps in order:

+
    +
  1. YUI PHP Loader loads taking the configuration settings into account. It gets instructions about what components are required and how to configure them.
  2. +
  3. YUI PHP Loader checks the dependency tree. Loader knows that Calendar requires the Yahoo Global Object, the Dom Collection, the Event Utility, and the Calendar Control file as well as Calendar's CSS file. It knows that it can get Yahoo, Dom and Event in a single file, so it uses a rollup for those and loads that rolled up JavaScript file via a <script> node that it inserts on the page. It waits for that file to load, then loads the Calendar Control's JavaScript file; this must be loaded after Yahoo, Dom and Event are in place.
  4. +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ \ No newline at end of file diff --git a/examples/phploader-advanced_source.php b/examples/phploader-advanced_source.php new file mode 100644 index 0000000..b46813e --- /dev/null +++ b/examples/phploader-advanced_source.php @@ -0,0 +1,38 @@ +load("calendar"); +?> + + + + YUI PHP Loader Utility Advanced Example: Loading YUI Calendar with the YUI PHP Loader Utility + css(); + ?> + + + + +

YUI PHP Loader Utility Advanced Example: Loading the YUI Calendar Control with the YUI PHP Loader Utility

+ +

In this example, we bring a YUI component onto the page using the YUI PHP Loader Utility. This example implements YUI PHP Loader via a YAHOO_util_Loader instance. We include the YUI PHP Loader class file, then specify in configuration which component we want loaded on the page — and what we want to do once it is loaded. The main difference between this advanced example and the simple one show here is that this one outputs the CSS and JavaScript files separately with two different method calls. The CSS files are included in the document head and the JavaScript files are included just before the closing body node. This is done in accordance with the best practice performance recommendations outlined here.

+ +
+ +script(); +?> + + + diff --git a/examples/phploader-basic.php b/examples/phploader-basic.php new file mode 100644 index 0000000..63ea239 --- /dev/null +++ b/examples/phploader-basic.php @@ -0,0 +1,96 @@ + + +
+
+
+
+ + +
+

YUI PHP Loader Utility: Using YUI Loader to Load the Calendar Control (Simple)

+ +
+

In this example, we bring a YUI component onto the page using the YUI PHP Loader Utility. This example implements YUI PHP Loader via a YAHOO_util_Loader instance. We include the YUI PHP Loader class file, then specify in configuration which component we want loaded on the page — and what we want to do once it is loaded.

+

This example loads in new window to demonstrate the simplest use case — a page with no other content, wherein the Loader is introducing YUI into a simple context.

+
+ + +
+ +

A Simple Use Case: Using YUI PHP Loader to Load the Calendar Control

+ +

This example implements the YUI PHP Loader Utility to load the Calendar Control.

+ +

The workflow happens in three steps:

+
    +
  1. Include the YUI PHP Loader class file
  2. +
  3. Create a YAHOO_util_YUILoader instance: Set configuration flags as needed, call the load method with a list of components to load, and define what to do once the components are loaded (in this case, once the components are loaded we instantiate a Calendar Control on the page).
  4. +
  5. Ouput Loader results
  6. +
+

Here's what that looks like in terms of raw source — this is the full source code for this example:

+ + +

This code executes the following steps in order:

+
    +
  1. YUI PHP Loader loads taking the configuration settings into account. It gets instructions about what components are required and how to configure them.
  2. +
  3. YUI PHP Loader checks the dependency tree. Loader knows that Calendar requires the Yahoo Global Object, the Dom Collection, the Event Utility, and the Calendar Control file as well as Calendar's CSS file. It knows that it can get Yahoo, Dom and Event in a single file, so it uses a rollup for those and loads that rolled up JavaScript file via a <script> node that it inserts on the page. It waits for that file to load, then loads the Calendar Control's JavaScript file; this must be loaded after Yahoo, Dom and Event are in place.
  4. +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ \ No newline at end of file diff --git a/examples/phploader-basic_source.php b/examples/phploader-basic_source.php new file mode 100644 index 0000000..4e00422 --- /dev/null +++ b/examples/phploader-basic_source.php @@ -0,0 +1,34 @@ +load("calendar"); +?> + + + + YUI PHP Loader Utility Basic Example: Loading YUI Calendar with the YUI PHP Loader Utility + tags(); + ?> + + + + +

YUI PHP Loader Utility Basic Example: Loading the YUI Calendar Control with the YUI PHP Loader Utility

+ +

In this example, we bring a YUI component onto the page using the YUI PHP Loader Utility. This example implements YUI PHP Loader via a YAHOO_util_Loader instance. We include the YUI PHP Loader class file, then specify in configuration which component we want loaded on the page — and what we want to do once it is loaded.

+ +
+ + + + diff --git a/examples/phploader-custom-modules-with-yui.php b/examples/phploader-custom-modules-with-yui.php new file mode 100644 index 0000000..cf9372f --- /dev/null +++ b/examples/phploader-custom-modules-with-yui.php @@ -0,0 +1,194 @@ + + +
+
+
+
+ + +
+

YUI PHP Loader Utility: Adding Custom Modules with YUI Dependencies

+
+

The YUI PHP Loader Utility is designed, of course, to + help you put YUI components on the page. While the YUI PHP Loader is great at loading YUI resources it is important + to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page + as well. These can be mixed in with YUI dependencies and/or be all custom modules.

+ +

This example shows you how to create a set of custom (non-YUI) modules that have YUI component dependencies and + load them via YUI PHP Loader.

+
+ + + +

Defining a Custom Module with YUI Component Dependencies

+ +

+ The YAHOO_util_Loader class constructor accepts three parameters: +

+
    +
  1. cacheKey: Unique name to use as the APC cache key. Module calculations + are cached for performance if the environment supports APC.
  2. +
  3. modules: A list of custom modules
  4. +
  5. noYUI: Enable or disable the base YUI metadata
  6. +
+ +

The modules parameter expects an associative array. The array should consist of custom JavaScript and/or + CSS modules defined using the following format:

+ + + +

Note: The module names must be unique and should not conflict with any of the existing YUI + component names if you have chosen to leave the YUI metadata enabled. To make a custom module dependent on an existing + YUI module simply default a requires key/value pair that lists out the desired YUI components.

+ +

Advanced Example with YUI Dependencies

+ +

For this example we will load some local JSON data and a custom CSS module via the + YUI PHP Loader Utility. The custom JavaScript module, customJS, + defines dependencies on the YUI DOM, Event, and JSON components so the YUI PHP loader will load these for us as well. When the document + is loaded we will process the JSON data with the JSON utility, create additional unordered list items with that data, and apply a CSS class + to the last item which will use custom styles defined in our custom CSS module.

+ +

An example without YUI dependencies can be found here. To make the examples easier to follow + the code preforms the exact same functionality. The biggest difference between these two examples is the usage of YUI Components.

+ +

Here's what that looks like in terms of raw source — this is the full source code for this example:

+ + +

This code executes the following steps in order:

+
    +
  1. The YUI PHP Loader class is included
  2. +
  3. A custom module set with some YUI component dependencies is defined
  4. +
  5. An instance of YUI PHP Loader is created: Our custom module set is passed to the Loader
  6. +
  7. YUI PHP Loader calculates the dependencies and order of our custom modules: The Loader knows + our customJS module is dependent on YUI Dom, Event, and JSON and thus these are automatically loaded as well.
  8. +
  9. YUI PHP Loader loads the modules and is used to output the CSS and JavaScript: The <link> + nodes are output in the document head and the <script> nodes are output just before the closing body node. This + is in accordance with the best practice performance recommendations outlined here.
  10. +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ \ No newline at end of file diff --git a/examples/phploader-custom-modules-with-yui_source.php b/examples/phploader-custom-modules-with-yui_source.php new file mode 100644 index 0000000..9027a27 --- /dev/null +++ b/examples/phploader-custom-modules-with-yui_source.php @@ -0,0 +1,93 @@ + array( + "name" => 'customJS', + "type" => 'js', // 'js' or 'css' + // "path" => 'path/to/file3.css', // includes base + "fullpath" => './assets/custom/data.js', // overrides path + "global" => true, // globals are always loaded + "requires" => array (0 => 'event', 1 => 'dom', 2 => 'json'), + // "supersedes" => array (0 => 'something'), // if a rollup + // "rollup" => 3 // the rollup threshold + ), + "customCSS" => array( + "name" => 'customCSS', + "type" => 'css', // 'js' or 'css' + // "path" => 'path/to/file3.css', // includes base + "fullpath" => './assets/custom/custom.css', // overrides path + "global" => true, // globals are always loaded + // "supersedes" => array (0 => 'something'), // if a rollup + // "rollup" => 3 // the rollup threshold + ) +); + +//Get a new YAHOO_util_Loader instance which includes our custom metadata along with the base YUI metadata +//Note: rand is used here to help cache bust the example +$loader = new YAHOO_util_Loader($yuiCurrentVersion, 'my_custom_config_'.rand(), $customConfig); +$loader->load("customJS", "customCSS"); +?> + + + + + + + YUI PHP Loader Utility Example: Adding Custom Modules with YUI Dependencies + css(); ?> + + +

YUI PHP Loader Utility Example: Adding Custom Modules with YUI Dependencies

+ +

The YUI PHP Loader Utility is designed, of course, to + help you put YUI components on the page. While the YUI PHP Loader is great at loading YUI resources it is important + to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page + as well. These can be mixed in with YUI dependencies and/or be all custom modules.

+ +

This example shows you how to create a set of custom (non-YUI) modules that have YUI component dependencies and + load them via YUI PHP Loader.

+ +

For this example we will load some local JSON data and a custom CSS module via the + YUI PHP Loader Utility. The custom JavaScript module, customJS, + defines dependencies on the YUI DOM, Event, and JSON components so the YUI PHP loader will load these for us as well. When the document + is loaded we will process the JSON data with the JSON utility, create additional unordered list items with that data, and apply a CSS class + to the last item which will use custom styles defined in our custom CSS module.

+ +

An example without YUI dependencies can be found here. To make the examples easier to follow + the code preforms the exact same functionality. The biggest difference between these two examples is the usage of YUI Components. The + source for this example, including the server-side PHP code, can be seen here.

+ +
    +
  • This list starts with one static list item
  • +
+ + script(); ?> + + + + diff --git a/examples/phploader-custom-modules.php b/examples/phploader-custom-modules.php new file mode 100644 index 0000000..6b2a92d --- /dev/null +++ b/examples/phploader-custom-modules.php @@ -0,0 +1,192 @@ + + +
+
+
+
+ + +
+

YUI PHP Loader Utility: Adding Custom (Non-YUI) Content with YUI PHP Loader

+
+

The YUI PHP Loader Utility is designed, of course, to + help you put YUI components on the page. While the YUI PHP Loader is great at loading YUI resources it is important + to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page + as well. These can be mixed in with YUI dependencies and/or be all custom modules.

+ +

This example shows you how to create a set of custom (non-YUI) modules and load them via YUI PHP Loader.

+
+ + + +

Defining a Custom Module

+ +

+ The YAHOO_util_Loader class constructor accepts three parameters: +

+
    +
  1. cacheKey: Unique name to use as the APC cache key. Module calculations + are cached for performance if the environment supports APC.
  2. +
  3. modules: A list of custom modules
  4. +
  5. noYUI: Enable or disable the base YUI metadata
  6. +
+ +

The modules parameter expects an associative array. The array should consist of custom JavaScript and/or + CSS modules defined using the following format:

+ + + +

Note: The module names must be unique and should not conflict with any of the existing YUI + component names if you have chosen to leave the YUI metadata enabled. To make a custom module dependant on an existing + YUI module simply default a requires key/value pair that lists out the desired YUI components.

+ +

Simple Example with no YUI Dependencies

+ +

For this example we will load a remote JavaScript resource (i.e.) Douglas Crockford's JSON utility from + JSON.org, some local JSON data, and a custom CSS module via the + YUI PHP Loader Utility. When the document is loaded will + process the JSON data with the JSON utility, create additional unordered list items with that data, and apply a CSS class + to the last item which will use custom styles defined in our custom CSS module.

+ +

Here's what that looks like in terms of raw source — this is the full source code for this example:

+ + +

This code executes the following steps in order:

+
    +
  1. The YUI PHP Loader class is included
  2. +
  3. A custom module set is defined
  4. +
  5. An instance of YUI PHP Loader is created: Our custom module set is passed to the Loader
  6. +
  7. YUI PHP Loader calculates the dependencies and order of our custom modules: The Loader knows + our customJS module is dependent on our dcJson module.
  8. +
  9. YUI PHP Loader loads the modules and is used to output the CSS and JavaScript: The <link> + nodes are output in the document head and the <script> nodes are output just before the closing body node. This + is in accordance with the best practice performance recommendations outlined here.
  10. +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ \ No newline at end of file diff --git a/examples/phploader-custom-modules_source.php b/examples/phploader-custom-modules_source.php new file mode 100644 index 0000000..f5e3883 --- /dev/null +++ b/examples/phploader-custom-modules_source.php @@ -0,0 +1,94 @@ + array( + "name" => 'dcJson', + "type" => 'js', // 'js' or 'css' + // "path" => 'path/to/file.js', // includes base + "fullpath" => 'http://www.json.org/json2.js', // overrides path + // "requires" => array (0 => 'event', 1 => 'dom'), + // "optional" => array (0 => 'connection'), + // "global" => true, // globals are always loaded + // "supersedes" => array (0 => 'something'), // if a rollup + // "rollup" => 3 // the rollup threshold + ), + "customJS" => array( + "name" => 'customJS', + "type" => 'js', // 'js' or 'css' + "fullpath" => './assets/custom/data.js', // overrides path + "global" => true, // globals are always loaded + "requires" => array (0 => 'dcJson') + ), + "customCSS" => array( + "name" => 'customCSS', + "type" => 'css', // 'js' or 'css' + "fullpath" => './assets/custom/custom.css', // overrides path + "global" => true // globals are always loaded + ) +); + +//Get a new YAHOO_util_Loader instance which includes just our custom metadata (No YUI metadata) +//Note: rand is used here to help cache bust the example +$loader = new YAHOO_util_Loader($yuiCurrentVersion, 'my_custom_config_'.rand(), $customConfig, true); +$loader->load("dcJson", "customJS", "customCSS"); +?> + + + + + + + YUI PHP Loader Utility Example: Adding Custom (Non-YUI) Content with YUI PHP Loader + css(); ?> + + +

YUI PHP Loader Utility Example: Adding Custom (Non-YUI) Content with YUI PHP Loader

+ +

The YUI PHP Loader Utility is designed, of course, to + help you put YUI components on the page. While the YUI PHP Loader is great at loading YUI resources it is important + to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page + as well. These can be mixed in with YUI dependencies and/or be all custom modules.

+ +

This example shows you how to create a set of custom (non-YUI) modules and load them via YUI PHP Loader.

+ +

For this example we will load a remote JavaScript resource (i.e.) Douglas Crockford's JSON utility from + JSON.org, some local JSON data, and a custom CSS module via the + YUI PHP Loader Utility. When the document is loaded will + process the JSON data with the JSON utility, create additional unordered list items with that data, and apply a CSS class + to the last item which will use custom styles defined in our custom CSS module. The source for this example, including + the server-side PHP code, can be seen here.

+ +
    +
  • This list starts with one static list item
  • +
+ + script(); ?> + + + + diff --git a/examples/phploader-local-combo-handler.php b/examples/phploader-local-combo-handler.php new file mode 100644 index 0000000..42a9878 --- /dev/null +++ b/examples/phploader-local-combo-handler.php @@ -0,0 +1,101 @@ + + +
+
+
+
+ + +
+

YUI PHP Loader Utility: Local Combo Handler

+ +
+

In this example, we bring a number of YUI components onto the page using the YUI PHP Loader Utility. This example implements YUI PHP Loader via a YAHOO_util_Loader instance. We include the YUI PHP Loader script file, then specify in configuration which component we want loaded on the page. + The key difference between this and other samples is the use of a local combo handler. YUI PHP Loader ships with intrinsic combo-handling support. This feature will allow YUI PHP Loader to combine files without relying on a remote combo-service such as the one outlined here. It should also + prove useful in environments where SSL is required and/or where including scripts from remote servers is prohibited. +

+
+ +
+ +

Use Case: Using the Local Combo Handler

+ +

This example implements the YUI PHP Loader Utility to load +the Calendar Control. This example is almost identical to the advanced example +outlined here. The only major difference is that we are enabling the combo handling service and overriding the +default the combo service location. By default when combo handling is requested YUI PHP Loader will serve files from Yahoo! +servers; see "Serving YUI Files from Yahoo!" for important information about this service.

+ +

Here's what that looks like in terms of raw source — this is the full source code for this example:

+ + +

This code executes the following steps in order:

+
    +
  1. YUI PHP Loader loads taking the configuration settings into account. It gets instructions about what components are required and how to configure them.
  2. +
  3. Combine option is enabled and the local combo handler is requested. The combo request will be made to the local combo handler instead of the remote combo handling service. The local combo handler will disassemble the combo url and setup YUI PHP Loader with the desired version and components.
  4. +
  5. YUI PHP Loader checks the dependency tree. The local combo handler returns a single cacheable JavaScript or CSS file. Separate requests must be made for each resource type via the script and css methods.
  6. +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ \ No newline at end of file diff --git a/lib/meta/config_2.7.0.php b/lib/meta/config_2.7.0.php index 2eadcb7..4714d28 100644 --- a/lib/meta/config_2.7.0.php +++ b/lib/meta/config_2.7.0.php @@ -1,4 +1,4 @@ - - + @@ -111,7 +111,7 @@
    -modules as $name => $allmoddef) { $checked = (array_search($name, $modules) !== false) ? "checked" : ""; @@ -123,7 +123,7 @@
    -DEV; $prod = $yui_load_manager->PROD; @@ -139,8 +139,8 @@ ?> - - + +
    @@ -150,7 +150,7 @@
    -
    +
    diff --git a/phploader/test/loader-inc.php b/phploader/test/loader-inc.php index d2f472a..6d0f1bb 100644 --- a/phploader/test/loader-inc.php +++ b/phploader/test/loader-inc.php @@ -1,4 +1,4 @@ - - -
    "> +">
      -modules)); //foreach($loader->modules as $name => $allmoddef) { @@ -164,7 +164,7 @@
      -
      - +


      - +

      - /> + /> Use Combo Loader

      - /> + /> Embed enabled

      - /> + /> Load Optional

      @@ -237,7 +237,7 @@
      -
      +
      diff --git a/phploader/test/test.php b/phploader/test/test.php index 1981307..da7a947 100644 --- a/phploader/test/test.php +++ b/phploader/test/test.php @@ -1,4 +1,4 @@ - - + - + diff --git a/phploader/test/testcallback.php b/phploader/test/testcallback.php index 244afd0..418ec65 100644 --- a/phploader/test/testcallback.php +++ b/phploader/test/testcallback.php @@ -1,4 +1,4 @@ - - - + diff --git a/phploader/test/verify.php b/phploader/test/verify.php index 7a32118..b40d416 100644 --- a/phploader/test/verify.php +++ b/phploader/test/verify.php @@ -1,4 +1,4 @@ -
      - $value) { // if ( strstr($name, 'YUI_') == $name ) { // this works if ( strpos($name, 'YUI_') !== false ) { // this is faster