diff options
| author | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
|---|---|---|
| committer | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
| commit | b62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch) | |
| tree | 86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo-1.6/dojox/dtl | |
Diffstat (limited to '')
67 files changed, 15970 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/dtl.js b/js/dojo-1.6/dojox/dtl.js new file mode 100644 index 0000000..3687b81 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl.js @@ -0,0 +1,14 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+/*
+ This is an optimized version of Dojo, built for deployment and not for
+ development. To get sources and documentation, please visit:
+
+ http://dojotoolkit.org
+*/
+
+if(!dojo._hasResource["dojox.string.Builder"]){dojo._hasResource["dojox.string.Builder"]=true;dojo.provide("dojox.string.Builder");dojox.string.Builder=function(_1){var b="";this.length=0;this.append=function(s){if(arguments.length>1){var _2="",l=arguments.length;switch(l){case 9:_2=""+arguments[8]+_2;case 8:_2=""+arguments[7]+_2;case 7:_2=""+arguments[6]+_2;case 6:_2=""+arguments[5]+_2;case 5:_2=""+arguments[4]+_2;case 4:_2=""+arguments[3]+_2;case 3:_2=""+arguments[2]+_2;case 2:b+=""+arguments[0]+arguments[1]+_2;break;default:var i=0;while(i<arguments.length){_2+=arguments[i++];}b+=_2;}}else{b+=s;}this.length=b.length;return this;};this.concat=function(s){return this.append.apply(this,arguments);};this.appendArray=function(_3){return this.append.apply(this,_3);};this.clear=function(){b="";this.length=0;return this;};this.replace=function(_4,_5){b=b.replace(_4,_5);this.length=b.length;return this;};this.remove=function(_6,_7){if(_7===undefined){_7=b.length;}if(_7==0){return this;}b=b.substr(0,_6)+b.substr(_6+_7);this.length=b.length;return this;};this.insert=function(_8,_9){if(_8==0){b=_9+b;}else{b=b.slice(0,_8)+_9+b.slice(_8);}this.length=b.length;return this;};this.toString=function(){return b;};if(_1){this.append(_1);}};}if(!dojo._hasResource["dojox.string.tokenize"]){dojo._hasResource["dojox.string.tokenize"]=true;dojo.provide("dojox.string.tokenize");dojox.string.tokenize=function(_a,re,_b,_c){var _d=[];var _e,_f,_10=0;while(_e=re.exec(_a)){_f=_a.slice(_10,re.lastIndex-_e[0].length);if(_f.length){_d.push(_f);}if(_b){if(dojo.isOpera){var _11=_e.slice(0);while(_11.length<_e.length){_11.push(null);}_e=_11;}var _12=_b.apply(_c,_e.slice(1).concat(_d.length));if(typeof _12!="undefined"){_d.push(_12);}}_10=re.lastIndex;}_f=_a.slice(_10);if(_f.length){_d.push(_f);}return _d;};}if(!dojo._hasResource["dojox.dtl._base"]){dojo._hasResource["dojox.dtl._base"]=true;dojo.provide("dojox.dtl._base");dojo.experimental("dojox.dtl");(function(){var dd=dojox.dtl;dd.TOKEN_BLOCK=-1;dd.TOKEN_VAR=-2;dd.TOKEN_COMMENT=-3;dd.TOKEN_TEXT=3;dd._Context=dojo.extend(function(_13){if(_13){dojo._mixin(this,_13);if(_13.get){this._getter=_13.get;delete this.get;}}},{push:function(){var _14=this;var _15=dojo.delegate(this);_15.pop=function(){return _14;};return _15;},pop:function(){throw new Error("pop() called on empty Context");},get:function(key,_16){var n=this._normalize;if(this._getter){var got=this._getter(key);if(typeof got!="undefined"){return n(got);}}if(typeof this[key]!="undefined"){return n(this[key]);}return _16;},_normalize:function(_17){if(_17 instanceof Date){_17.year=_17.getFullYear();_17.month=_17.getMonth()+1;_17.day=_17.getDate();_17.date=_17.year+"-"+("0"+_17.month).slice(-2)+"-"+("0"+_17.day).slice(-2);_17.hour=_17.getHours();_17.minute=_17.getMinutes();_17.second=_17.getSeconds();_17.microsecond=_17.getMilliseconds();}return _17;},update:function(_18){var _19=this.push();if(_18){dojo._mixin(this,_18);}return _19;}});var _1a=/("(?:[^"\\]*(?:\\.[^"\\]*)*)"|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)/g;var _1b=/\s+/g;var _1c=function(_1d,_1e){_1d=_1d||_1b;if(!(_1d instanceof RegExp)){_1d=new RegExp(_1d,"g");}if(!_1d.global){throw new Error("You must use a globally flagged RegExp with split "+_1d);}_1d.exec("");var _1f,_20=[],_21=0,i=0;while(_1f=_1d.exec(this)){_20.push(this.slice(_21,_1d.lastIndex-_1f[0].length));_21=_1d.lastIndex;if(_1e&&(++i>_1e-1)){break;}}_20.push(this.slice(_21));return _20;};dd.Token=function(_22,_23){this.token_type=_22;this.contents=new String(dojo.trim(_23));this.contents.split=_1c;this.split=function(){return String.prototype.split.apply(this.contents,arguments);};};dd.Token.prototype.split_contents=function(_24){var bit,_25=[],i=0;_24=_24||999;while(i++<_24&&(bit=_1a.exec(this.contents))){bit=bit[0];if(bit.charAt(0)=="\""&&bit.slice(-1)=="\""){_25.push("\""+bit.slice(1,-1).replace("\\\"","\"").replace("\\\\","\\")+"\"");}else{if(bit.charAt(0)=="'"&&bit.slice(-1)=="'"){_25.push("'"+bit.slice(1,-1).replace("\\'","'").replace("\\\\","\\")+"'");}else{_25.push(bit);}}}return _25;};var ddt=dd.text={_get:function(_26,_27,_28){var _29=dd.register.get(_26,_27.toLowerCase(),_28);if(!_29){if(!_28){throw new Error("No tag found for "+_27);}return null;}var fn=_29[1];var _2a=_29[2];var _2b;if(fn.indexOf(":")!=-1){_2b=fn.split(":");fn=_2b.pop();}dojo["require"](_2a);var _2c=dojo.getObject(_2a);return _2c[fn||_27]||_2c[_27+"_"]||_2c[fn+"_"];},getTag:function(_2d,_2e){return ddt._get("tag",_2d,_2e);},getFilter:function(_2f,_30){return ddt._get("filter",_2f,_30);},getTemplate:function(_31){return new dd.Template(ddt.getTemplateString(_31));},getTemplateString:function(_32){return dojo._getText(_32.toString())||"";},_resolveLazy:function(_33,_34,_35){if(_34){if(_35){return dojo.fromJson(dojo._getText(_33))||{};}else{return dd.text.getTemplateString(_33);}}else{return dojo.xhrGet({handleAs:(_35)?"json":"text",url:_33});}},_resolveTemplateArg:function(arg,_36){if(ddt._isTemplate(arg)){if(!_36){var d=new dojo.Deferred();d.callback(arg);return d;}return arg;}return ddt._resolveLazy(arg,_36);},_isTemplate:function(arg){return (typeof arg=="undefined")||(typeof arg=="string"&&(arg.match(/^\s*[<{]/)||arg.indexOf(" ")!=-1));},_resolveContextArg:function(arg,_37){if(arg.constructor==Object){if(!_37){var d=new dojo.Deferred;d.callback(arg);return d;}return arg;}return ddt._resolveLazy(arg,_37,true);},_re:/(?:\{\{\s*(.+?)\s*\}\}|\{%\s*(load\s*)?(.+?)\s*%\})/g,tokenize:function(str){return dojox.string.tokenize(str,ddt._re,ddt._parseDelims);},_parseDelims:function(_38,_39,tag){if(_38){return [dd.TOKEN_VAR,_38];}else{if(_39){var _3a=dojo.trim(tag).split(/\s+/g);for(var i=0,_3b;_3b=_3a[i];i++){dojo["require"](_3b);}}else{return [dd.TOKEN_BLOCK,tag];}}}};dd.Template=dojo.extend(function(_3c,_3d){var str=_3d?_3c:ddt._resolveTemplateArg(_3c,true)||"";var _3e=ddt.tokenize(str);var _3f=new dd._Parser(_3e);this.nodelist=_3f.parse();},{update:function(_40,_41){return ddt._resolveContextArg(_41).addCallback(this,function(_42){var _43=this.render(new dd._Context(_42));if(_40.forEach){_40.forEach(function(_44){_44.innerHTML=_43;});}else{dojo.byId(_40).innerHTML=_43;}return this;});},render:function(_45,_46){_46=_46||this.getBuffer();_45=_45||new dd._Context({});return this.nodelist.render(_45,_46)+"";},getBuffer:function(){return new dojox.string.Builder();}});var _47=/\{\{\s*(.+?)\s*\}\}/g;dd.quickFilter=function(str){if(!str){return new dd._NodeList();}if(str.indexOf("{%")==-1){return new dd._QuickNodeList(dojox.string.tokenize(str,_47,function(_48){return new dd._Filter(_48);}));}};dd._QuickNodeList=dojo.extend(function(_49){this.contents=_49;},{render:function(_4a,_4b){for(var i=0,l=this.contents.length;i<l;i++){if(this.contents[i].resolve){_4b=_4b.concat(this.contents[i].resolve(_4a));}else{_4b=_4b.concat(this.contents[i]);}}return _4b;},dummyRender:function(_4c){return this.render(_4c,dd.Template.prototype.getBuffer()).toString();},clone:function(_4d){return this;}});dd._Filter=dojo.extend(function(_4e){if(!_4e){throw new Error("Filter must be called with variable name");}this.contents=_4e;var _4f=this._cache[_4e];if(_4f){this.key=_4f[0];this.filters=_4f[1];}else{this.filters=[];dojox.string.tokenize(_4e,this._re,this._tokenize,this);this._cache[_4e]=[this.key,this.filters];}},{_cache:{},_re:/(?:^_\("([^\\"]*(?:\\.[^\\"])*)"\)|^"([^\\"]*(?:\\.[^\\"]*)*)"|^([a-zA-Z0-9_.]+)|\|(\w+)(?::(?:_\("([^\\"]*(?:\\.[^\\"])*)"\)|"([^\\"]*(?:\\.[^\\"]*)*)"|([a-zA-Z0-9_.]+)|'([^\\']*(?:\\.[^\\']*)*)'))?|^'([^\\']*(?:\\.[^\\']*)*)')/g,_values:{0:"\"",1:"\"",2:"",8:"\""},_args:{4:"\"",5:"\"",6:"",7:"'"},_tokenize:function(){var pos,arg;for(var i=0,has=[];i<arguments.length;i++){has[i]=(typeof arguments[i]!="undefined"&&typeof arguments[i]=="string"&&arguments[i]);}if(!this.key){for(pos in this._values){if(has[pos]){this.key=this._values[pos]+arguments[pos]+this._values[pos];break;}}}else{for(pos in this._args){if(has[pos]){var _50=arguments[pos];if(this._args[pos]=="'"){_50=_50.replace(/\\'/g,"'");}else{if(this._args[pos]=="\""){_50=_50.replace(/\\"/g,"\"");}}arg=[!this._args[pos],_50];break;}}var fn=ddt.getFilter(arguments[3]);if(!dojo.isFunction(fn)){throw new Error(arguments[3]+" is not registered as a filter");}this.filters.push([fn,arg]);}},getExpression:function(){return this.contents;},resolve:function(_51){if(typeof this.key=="undefined"){return "";}var str=this.resolvePath(this.key,_51);for(var i=0,_52;_52=this.filters[i];i++){if(_52[1]){if(_52[1][0]){str=_52[0](str,this.resolvePath(_52[1][1],_51));}else{str=_52[0](str,_52[1][1]);}}else{str=_52[0](str);}}return str;},resolvePath:function(_53,_54){var _55,_56;var _57=_53.charAt(0);var _58=_53.slice(-1);if(!isNaN(parseInt(_57))){_55=(_53.indexOf(".")==-1)?parseInt(_53):parseFloat(_53);}else{if(_57=="\""&&_57==_58){_55=_53.slice(1,-1);}else{if(_53=="true"){return true;}if(_53=="false"){return false;}if(_53=="null"||_53=="None"){return null;}_56=_53.split(".");_55=_54.get(_56[0]);if(dojo.isFunction(_55)){var _59=_54.getThis&&_54.getThis();if(_55.alters_data){_55="";}else{if(_59){_55=_55.call(_59);}else{_55="";}}}for(var i=1;i<_56.length;i++){var _5a=_56[i];if(_55){var _5b=_55;if(dojo.isObject(_55)&&_5a=="items"&&typeof _55[_5a]=="undefined"){var _5c=[];for(var key in _55){_5c.push([key,_55[key]]);}_55=_5c;continue;}if(_55.get&&dojo.isFunction(_55.get)&&_55.get.safe){_55=_55.get(_5a);}else{if(typeof _55[_5a]=="undefined"){_55=_55[_5a];break;}else{_55=_55[_5a];}}if(dojo.isFunction(_55)){if(_55.alters_data){_55="";}else{_55=_55.call(_5b);}}else{if(_55 instanceof Date){_55=dd._Context.prototype._normalize(_55);}}}else{return "";}}}}return _55;}});dd._TextNode=dd._Node=dojo.extend(function(obj){this.contents=obj;},{set:function(_5d){this.contents=_5d;return this;},render:function(_5e,_5f){return _5f.concat(this.contents);},isEmpty:function(){return !dojo.trim(this.contents);},clone:function(){return this;}});dd._NodeList=dojo.extend(function(_60){this.contents=_60||[];this.last="";},{push:function(_61){this.contents.push(_61);return this;},concat:function(_62){this.contents=this.contents.concat(_62);return this;},render:function(_63,_64){for(var i=0;i<this.contents.length;i++){_64=this.contents[i].render(_63,_64);if(!_64){throw new Error("Template must return buffer");}}return _64;},dummyRender:function(_65){return this.render(_65,dd.Template.prototype.getBuffer()).toString();},unrender:function(){return arguments[1];},clone:function(){return this;},rtrim:function(){while(1){i=this.contents.length-1;if(this.contents[i] instanceof dd._TextNode&&this.contents[i].isEmpty()){this.contents.pop();}else{break;}}return this;}});dd._VarNode=dojo.extend(function(str){this.contents=new dd._Filter(str);},{render:function(_66,_67){var str=this.contents.resolve(_66);if(!str.safe){str=dd._base.escape(""+str);}return _67.concat(str);}});dd._noOpNode=new function(){this.render=this.unrender=function(){return arguments[1];};this.clone=function(){return this;};};dd._Parser=dojo.extend(function(_68){this.contents=_68;},{i:0,parse:function(_69){var _6a={},_6b;_69=_69||[];for(var i=0;i<_69.length;i++){_6a[_69[i]]=true;}var _6c=new dd._NodeList();while(this.i<this.contents.length){_6b=this.contents[this.i++];if(typeof _6b=="string"){_6c.push(new dd._TextNode(_6b));}else{var _6d=_6b[0];var _6e=_6b[1];if(_6d==dd.TOKEN_VAR){_6c.push(new dd._VarNode(_6e));}else{if(_6d==dd.TOKEN_BLOCK){if(_6a[_6e]){--this.i;return _6c;}var cmd=_6e.split(/\s+/g);if(cmd.length){cmd=cmd[0];var fn=ddt.getTag(cmd);if(fn){_6c.push(fn(this,new dd.Token(_6d,_6e)));}}}}}}if(_69.length){throw new Error("Could not find closing tag(s): "+_69.toString());}this.contents.length=0;return _6c;},next_token:function(){var _6f=this.contents[this.i++];return new dd.Token(_6f[0],_6f[1]);},delete_first_token:function(){this.i++;},skip_past:function(_70){while(this.i<this.contents.length){var _71=this.contents[this.i++];if(_71[0]==dd.TOKEN_BLOCK&&_71[1]==_70){return;}}throw new Error("Unclosed tag found when looking for "+_70);},create_variable_node:function(_72){return new dd._VarNode(_72);},create_text_node:function(_73){return new dd._TextNode(_73||"");},getTemplate:function(_74){return new dd.Template(_74);}});dd.register={_registry:{attributes:[],tags:[],filters:[]},get:function(_75,_76){var _77=dd.register._registry[_75+"s"];for(var i=0,_78;_78=_77[i];i++){if(typeof _78[0]=="string"){if(_78[0]==_76){return _78;}}else{if(_76.match(_78[0])){return _78;}}}},getAttributeTags:function(){var _79=[];var _7a=dd.register._registry.attributes;for(var i=0,_7b;_7b=_7a[i];i++){if(_7b.length==3){_79.push(_7b);}else{var fn=dojo.getObject(_7b[1]);if(fn&&dojo.isFunction(fn)){_7b.push(fn);_79.push(_7b);}}}return _79;},_any:function(_7c,_7d,_7e){for(var _7f in _7e){for(var i=0,fn;fn=_7e[_7f][i];i++){var key=fn;if(dojo.isArray(fn)){key=fn[0];fn=fn[1];}if(typeof key=="string"){if(key.substr(0,5)=="attr:"){var _80=fn;if(_80.substr(0,5)=="attr:"){_80=_80.slice(5);}dd.register._registry.attributes.push([_80.toLowerCase(),_7d+"."+_7f+"."+_80]);}key=key.toLowerCase();}dd.register._registry[_7c].push([key,fn,_7d+"."+_7f]);}}},tags:function(_81,_82){dd.register._any("tags",_81,_82);},filters:function(_83,_84){dd.register._any("filters",_83,_84);}};var _85=/&/g;var _86=/</g;var _87=/>/g;var _88=/'/g;var _89=/"/g;dd._base.escape=function(_8a){return dd.mark_safe(_8a.replace(_85,"&").replace(_86,"<").replace(_87,">").replace(_89,""").replace(_88,"'"));};dd._base.safe=function(_8b){if(typeof _8b=="string"){_8b=new String(_8b);}if(typeof _8b=="object"){_8b.safe=true;}return _8b;};dd.mark_safe=dd._base.safe;dd.register.tags("dojox.dtl.tag",{"date":["now"],"logic":["if","for","ifequal","ifnotequal"],"loader":["extends","block","include","load","ssi"],"misc":["comment","debug","filter","firstof","spaceless","templatetag","widthratio","with"],"loop":["cycle","ifchanged","regroup"]});dd.register.filters("dojox.dtl.filter",{"dates":["date","time","timesince","timeuntil"],"htmlstrings":["linebreaks","linebreaksbr","removetags","striptags"],"integers":["add","get_digit"],"lists":["dictsort","dictsortreversed","first","join","length","length_is","random","slice","unordered_list"],"logic":["default","default_if_none","divisibleby","yesno"],"misc":["filesizeformat","pluralize","phone2numeric","pprint"],"strings":["addslashes","capfirst","center","cut","fix_ampersands","floatformat","iriencode","linenumbers","ljust","lower","make_list","rjust","slugify","stringformat","title","truncatewords","truncatewords_html","upper","urlencode","urlize","urlizetrunc","wordcount","wordwrap"]});dd.register.filters("dojox.dtl",{"_base":["escape","safe"]});})();}if(!dojo._hasResource["dojox.dtl"]){dojo._hasResource["dojox.dtl"]=true;dojo.provide("dojox.dtl");}if(!dojo._hasResource["dojox.dtl.Context"]){dojo._hasResource["dojox.dtl.Context"]=true;dojo.provide("dojox.dtl.Context");dojox.dtl.Context=dojo.extend(function(_8c){this._this={};dojox.dtl._Context.call(this,_8c);},dojox.dtl._Context.prototype,{getKeys:function(){var _8d=[];for(var key in this){if(this.hasOwnProperty(key)&&key!="_this"){_8d.push(key);}}return _8d;},extend:function(obj){return dojo.delegate(this,obj);},filter:function(_8e){var _8f=new dojox.dtl.Context();var _90=[];var i,arg;if(_8e instanceof dojox.dtl.Context){_90=_8e.getKeys();}else{if(typeof _8e=="object"){for(var key in _8e){_90.push(key);}}else{for(i=0;arg=arguments[i];i++){if(typeof arg=="string"){_90.push(arg);}}}}for(i=0,key;key=_90[i];i++){_8f[key]=this[key];}return _8f;},setThis:function(_91){this._this=_91;},getThis:function(){return this._this;},hasKey:function(key){if(this._getter){var got=this._getter(key);if(typeof got!="undefined"){return true;}}if(typeof this[key]!="undefined"){return true;}return false;}});}if(!dojo._hasResource["dojox.dtl.tag.logic"]){dojo._hasResource["dojox.dtl.tag.logic"]=true;dojo.provide("dojox.dtl.tag.logic");(function(){var dd=dojox.dtl;var ddt=dd.text;var _92=dd.tag.logic;_92.IfNode=dojo.extend(function(_93,_94,_95,_96){this.bools=_93;this.trues=_94;this.falses=_95;this.type=_96;},{render:function(_97,_98){var i,_99,_9a,_9b,_9c;if(this.type=="or"){for(i=0;_99=this.bools[i];i++){_9a=_99[0];_9b=_99[1];_9c=_9b.resolve(_97);if((_9c&&!_9a)||(_9a&&!_9c)){if(this.falses){_98=this.falses.unrender(_97,_98);}return (this.trues)?this.trues.render(_97,_98,this):_98;}}if(this.trues){_98=this.trues.unrender(_97,_98);}return (this.falses)?this.falses.render(_97,_98,this):_98;}else{for(i=0;_99=this.bools[i];i++){_9a=_99[0];_9b=_99[1];_9c=_9b.resolve(_97);if(_9c==_9a){if(this.trues){_98=this.trues.unrender(_97,_98);}return (this.falses)?this.falses.render(_97,_98,this):_98;}}if(this.falses){_98=this.falses.unrender(_97,_98);}return (this.trues)?this.trues.render(_97,_98,this):_98;}return _98;},unrender:function(_9d,_9e){_9e=(this.trues)?this.trues.unrender(_9d,_9e):_9e;_9e=(this.falses)?this.falses.unrender(_9d,_9e):_9e;return _9e;},clone:function(_9f){var _a0=(this.trues)?this.trues.clone(_9f):null;var _a1=(this.falses)?this.falses.clone(_9f):null;return new this.constructor(this.bools,_a0,_a1,this.type);}});_92.IfEqualNode=dojo.extend(function(_a2,_a3,_a4,_a5,_a6){this.var1=new dd._Filter(_a2);this.var2=new dd._Filter(_a3);this.trues=_a4;this.falses=_a5;this.negate=_a6;},{render:function(_a7,_a8){var _a9=this.var1.resolve(_a7);var _aa=this.var2.resolve(_a7);_a9=(typeof _a9!="undefined")?_a9:"";_aa=(typeof _a9!="undefined")?_aa:"";if((this.negate&&_a9!=_aa)||(!this.negate&&_a9==_aa)){if(this.falses){_a8=this.falses.unrender(_a7,_a8,this);}return (this.trues)?this.trues.render(_a7,_a8,this):_a8;}if(this.trues){_a8=this.trues.unrender(_a7,_a8,this);}return (this.falses)?this.falses.render(_a7,_a8,this):_a8;},unrender:function(_ab,_ac){return _92.IfNode.prototype.unrender.call(this,_ab,_ac);},clone:function(_ad){var _ae=this.trues?this.trues.clone(_ad):null;var _af=this.falses?this.falses.clone(_ad):null;return new this.constructor(this.var1.getExpression(),this.var2.getExpression(),_ae,_af,this.negate);}});_92.ForNode=dojo.extend(function(_b0,_b1,_b2,_b3){this.assign=_b0;this.loop=new dd._Filter(_b1);this.reversed=_b2;this.nodelist=_b3;this.pool=[];},{render:function(_b4,_b5){var i,j,k;var _b6=false;var _b7=this.assign;for(k=0;k<_b7.length;k++){if(typeof _b4[_b7[k]]!="undefined"){_b6=true;_b4=_b4.push();break;}}if(!_b6&&_b4.forloop){_b6=true;_b4=_b4.push();}var _b8=this.loop.resolve(_b4)||[];for(i=_b8.length;i<this.pool.length;i++){this.pool[i].unrender(_b4,_b5,this);}if(this.reversed){_b8=_b8.slice(0).reverse();}var _b9=dojo.isObject(_b8)&&!dojo.isArrayLike(_b8);var _ba=[];if(_b9){for(var key in _b8){_ba.push(_b8[key]);}}else{_ba=_b8;}var _bb=_b4.forloop={parentloop:_b4.get("forloop",{})};var j=0;for(i=0;i<_ba.length;i++){var _bc=_ba[i];_bb.counter0=j;_bb.counter=j+1;_bb.revcounter0=_ba.length-j-1;_bb.revcounter=_ba.length-j;_bb.first=!j;_bb.last=(j==_ba.length-1);if(_b7.length>1&&dojo.isArrayLike(_bc)){if(!_b6){_b6=true;_b4=_b4.push();}var _bd={};for(k=0;k<_bc.length&&k<_b7.length;k++){_bd[_b7[k]]=_bc[k];}dojo.mixin(_b4,_bd);}else{_b4[_b7[0]]=_bc;}if(j+1>this.pool.length){this.pool.push(this.nodelist.clone(_b5));}_b5=this.pool[j++].render(_b4,_b5,this);}delete _b4.forloop;if(_b6){_b4=_b4.pop();}else{for(k=0;k<_b7.length;k++){delete _b4[_b7[k]];}}return _b5;},unrender:function(_be,_bf){for(var i=0,_c0;_c0=this.pool[i];i++){_bf=_c0.unrender(_be,_bf);}return _bf;},clone:function(_c1){return new this.constructor(this.assign,this.loop.getExpression(),this.reversed,this.nodelist.clone(_c1));}});dojo.mixin(_92,{if_:function(_c2,_c3){var i,_c4,_c5,_c6=[],_c7=_c3.contents.split();_c7.shift();_c3=_c7.join(" ");_c7=_c3.split(" and ");if(_c7.length==1){_c5="or";_c7=_c3.split(" or ");}else{_c5="and";for(i=0;i<_c7.length;i++){if(_c7[i].indexOf(" or ")!=-1){throw new Error("'if' tags can't mix 'and' and 'or'");}}}for(i=0;_c4=_c7[i];i++){var not=false;if(_c4.indexOf("not ")==0){_c4=_c4.slice(4);not=true;}_c6.push([not,new dd._Filter(_c4)]);}var _c8=_c2.parse(["else","endif"]);var _c9=false;var _c3=_c2.next_token();if(_c3.contents=="else"){_c9=_c2.parse(["endif"]);_c2.next_token();}return new _92.IfNode(_c6,_c8,_c9,_c5);},_ifequal:function(_ca,_cb,_cc){var _cd=_cb.split_contents();if(_cd.length!=3){throw new Error(_cd[0]+" takes two arguments");}var end="end"+_cd[0];var _ce=_ca.parse(["else",end]);var _cf=false;var _cb=_ca.next_token();if(_cb.contents=="else"){_cf=_ca.parse([end]);_ca.next_token();}return new _92.IfEqualNode(_cd[1],_cd[2],_ce,_cf,_cc);},ifequal:function(_d0,_d1){return _92._ifequal(_d0,_d1);},ifnotequal:function(_d2,_d3){return _92._ifequal(_d2,_d3,true);},for_:function(_d4,_d5){var _d6=_d5.contents.split();if(_d6.length<4){throw new Error("'for' statements should have at least four words: "+_d5.contents);}var _d7=_d6[_d6.length-1]=="reversed";var _d8=(_d7)?-3:-2;if(_d6[_d6.length+_d8]!="in"){throw new Error("'for' tag received an invalid argument: "+_d5.contents);}var _d9=_d6.slice(1,_d8).join(" ").split(/ *, */);for(var i=0;i<_d9.length;i++){if(!_d9[i]||_d9[i].indexOf(" ")!=-1){throw new Error("'for' tag received an invalid argument: "+_d5.contents);}}var _da=_d4.parse(["endfor"]);_d4.next_token();return new _92.ForNode(_d9,_d6[_d6.length+_d8+1],_d7,_da);}});})();}if(!dojo._hasResource["dojox.dtl.tag.loop"]){dojo._hasResource["dojox.dtl.tag.loop"]=true;dojo.provide("dojox.dtl.tag.loop");(function(){var dd=dojox.dtl;var _db=dd.tag.loop;_db.CycleNode=dojo.extend(function(_dc,_dd,_de,_df){this.cyclevars=_dc;this.name=_dd;this.contents=_de;this.shared=_df||{counter:-1,map:{}};},{render:function(_e0,_e1){if(_e0.forloop&&!_e0.forloop.counter0){this.shared.counter=-1;}++this.shared.counter;var _e2=this.cyclevars[this.shared.counter%this.cyclevars.length];var map=this.shared.map;if(!map[_e2]){map[_e2]=new dd._Filter(_e2);}_e2=map[_e2].resolve(_e0,_e1);if(this.name){_e0[this.name]=_e2;}this.contents.set(_e2);return this.contents.render(_e0,_e1);},unrender:function(_e3,_e4){return this.contents.unrender(_e3,_e4);},clone:function(_e5){return new this.constructor(this.cyclevars,this.name,this.contents.clone(_e5),this.shared);}});_db.IfChangedNode=dojo.extend(function(_e6,_e7,_e8){this.nodes=_e6;this._vars=_e7;this.shared=_e8||{last:null,counter:0};this.vars=dojo.map(_e7,function(_e9){return new dojox.dtl._Filter(_e9);});},{render:function(_ea,_eb){if(_ea.forloop){if(_ea.forloop.counter<=this.shared.counter){this.shared.last=null;}this.shared.counter=_ea.forloop.counter;}var _ec;if(this.vars.length){_ec=dojo.toJson(dojo.map(this.vars,function(_ed){return _ed.resolve(_ea);}));}else{_ec=this.nodes.dummyRender(_ea,_eb);}if(_ec!=this.shared.last){var _ee=(this.shared.last===null);this.shared.last=_ec;_ea=_ea.push();_ea.ifchanged={firstloop:_ee};_eb=this.nodes.render(_ea,_eb);_ea=_ea.pop();}else{_eb=this.nodes.unrender(_ea,_eb);}return _eb;},unrender:function(_ef,_f0){return this.nodes.unrender(_ef,_f0);},clone:function(_f1){return new this.constructor(this.nodes.clone(_f1),this._vars,this.shared);}});_db.RegroupNode=dojo.extend(function(_f2,key,_f3){this._expression=_f2;this.expression=new dd._Filter(_f2);this.key=key;this.alias=_f3;},{_push:function(_f4,_f5,_f6){if(_f6.length){_f4.push({grouper:_f5,list:_f6});}},render:function(_f7,_f8){_f7[this.alias]=[];var _f9=this.expression.resolve(_f7);if(_f9){var _fa=null;var _fb=[];for(var i=0;i<_f9.length;i++){var id=_f9[i][this.key];if(_fa!==id){this._push(_f7[this.alias],_fa,_fb);_fa=id;_fb=[_f9[i]];}else{_fb.push(_f9[i]);}}this._push(_f7[this.alias],_fa,_fb);}return _f8;},unrender:function(_fc,_fd){return _fd;},clone:function(_fe,_ff){return this;}});dojo.mixin(_db,{cycle:function(_100,_101){var args=_101.split_contents();if(args.length<2){throw new Error("'cycle' tag requires at least two arguments");}if(args[1].indexOf(",")!=-1){var vars=args[1].split(",");args=[args[0]];for(var i=0;i<vars.length;i++){args.push("\""+vars[i]+"\"");}}if(args.length==2){var name=args[args.length-1];if(!_100._namedCycleNodes){throw new Error("No named cycles in template: '"+name+"' is not defined");}if(!_100._namedCycleNodes[name]){throw new Error("Named cycle '"+name+"' does not exist");}return _100._namedCycleNodes[name];}if(args.length>4&&args[args.length-2]=="as"){var name=args[args.length-1];var node=new _db.CycleNode(args.slice(1,args.length-2),name,_100.create_text_node());if(!_100._namedCycleNodes){_100._namedCycleNodes={};}_100._namedCycleNodes[name]=node;}else{node=new _db.CycleNode(args.slice(1),null,_100.create_text_node());}return node;},ifchanged:function(_102,_103){var _104=_103.contents.split();var _105=_102.parse(["endifchanged"]);_102.delete_first_token();return new _db.IfChangedNode(_105,_104.slice(1));},regroup:function(_106,_107){var _108=dojox.string.tokenize(_107.contents,/(\s+)/g,function(_109){return _109;});if(_108.length<11||_108[_108.length-3]!="as"||_108[_108.length-7]!="by"){throw new Error("Expected the format: regroup list by key as newList");}var _10a=_108.slice(2,-8).join("");var key=_108[_108.length-5];var _10b=_108[_108.length-1];return new _db.RegroupNode(_10a,key,_10b);}});})();}if(!dojo._hasResource["dojo.date"]){dojo._hasResource["dojo.date"]=true;dojo.provide("dojo.date");dojo.getObject("date",true,dojo);dojo.date.getDaysInMonth=function(_10c){var _10d=_10c.getMonth();var days=[31,28,31,30,31,30,31,31,30,31,30,31];if(_10d==1&&dojo.date.isLeapYear(_10c)){return 29;}return days[_10d];};dojo.date.isLeapYear=function(_10e){var year=_10e.getFullYear();return !(year%400)||(!(year%4)&&!!(year%100));};dojo.date.getTimezoneName=function(_10f){var str=_10f.toString();var tz="";var _110;var pos=str.indexOf("(");if(pos>-1){tz=str.substring(++pos,str.indexOf(")"));}else{var pat=/([A-Z\/]+) \d{4}$/;if((_110=str.match(pat))){tz=_110[1];}else{str=_10f.toLocaleString();pat=/ ([A-Z\/]+)$/;if((_110=str.match(pat))){tz=_110[1];}}}return (tz=="AM"||tz=="PM")?"":tz;};dojo.date.compare=function(_111,_112,_113){_111=new Date(+_111);_112=new Date(+(_112||new Date()));if(_113=="date"){_111.setHours(0,0,0,0);_112.setHours(0,0,0,0);}else{if(_113=="time"){_111.setFullYear(0,0,0);_112.setFullYear(0,0,0);}}if(_111>_112){return 1;}if(_111<_112){return -1;}return 0;};dojo.date.add=function(date,_114,_115){var sum=new Date(+date);var _116=false;var _117="Date";switch(_114){case "day":break;case "weekday":var days,_118;var mod=_115%5;if(!mod){days=(_115>0)?5:-5;_118=(_115>0)?((_115-5)/5):((_115+5)/5);}else{days=mod;_118=parseInt(_115/5);}var strt=date.getDay();var adj=0;if(strt==6&&_115>0){adj=1;}else{if(strt==0&&_115<0){adj=-1;}}var trgt=strt+days;if(trgt==0||trgt==6){adj=(_115>0)?2:-2;}_115=(7*_118)+days+adj;break;case "year":_117="FullYear";_116=true;break;case "week":_115*=7;break;case "quarter":_115*=3;case "month":_116=true;_117="Month";break;default:_117="UTC"+_114.charAt(0).toUpperCase()+_114.substring(1)+"s";}if(_117){sum["set"+_117](sum["get"+_117]()+_115);}if(_116&&(sum.getDate()<date.getDate())){sum.setDate(0);}return sum;};dojo.date.difference=function(_119,_11a,_11b){_11a=_11a||new Date();_11b=_11b||"day";var _11c=_11a.getFullYear()-_119.getFullYear();var _11d=1;switch(_11b){case "quarter":var m1=_119.getMonth();var m2=_11a.getMonth();var q1=Math.floor(m1/3)+1;var q2=Math.floor(m2/3)+1;q2+=(_11c*4);_11d=q2-q1;break;case "weekday":var days=Math.round(dojo.date.difference(_119,_11a,"day"));var _11e=parseInt(dojo.date.difference(_119,_11a,"week"));var mod=days%7;if(mod==0){days=_11e*5;}else{var adj=0;var aDay=_119.getDay();var bDay=_11a.getDay();_11e=parseInt(days/7);mod=days%7;var _11f=new Date(_119);_11f.setDate(_11f.getDate()+(_11e*7));var _120=_11f.getDay();if(days>0){switch(true){case aDay==6:adj=-1;break;case aDay==0:adj=0;break;case bDay==6:adj=-1;break;case bDay==0:adj=-2;break;case (_120+mod)>5:adj=-2;}}else{if(days<0){switch(true){case aDay==6:adj=0;break;case aDay==0:adj=1;break;case bDay==6:adj=2;break;case bDay==0:adj=1;break;case (_120+mod)<0:adj=2;}}}days+=adj;days-=(_11e*2);}_11d=days;break;case "year":_11d=_11c;break;case "month":_11d=(_11a.getMonth()-_119.getMonth())+(_11c*12);break;case "week":_11d=parseInt(dojo.date.difference(_119,_11a,"day")/7);break;case "day":_11d/=24;case "hour":_11d/=60;case "minute":_11d/=60;case "second":_11d/=1000;case "millisecond":_11d*=_11a.getTime()-_119.getTime();}return Math.round(_11d);};}if(!dojo._hasResource["dojox.date.php"]){dojo._hasResource["dojox.date.php"]=true;dojo.provide("dojox.date.php");dojox.date.php.format=function(date,_121){var df=new dojox.date.php.DateFormat(_121);return df.format(date);};dojox.date.php.DateFormat=function(_122){if(!this.regex){var keys=[];for(var key in this.constructor.prototype){if(dojo.isString(key)&&key.length==1&&dojo.isFunction(this[key])){keys.push(key);}}this.constructor.prototype.regex=new RegExp("(?:(\\\\.)|(["+keys.join("")+"]))","g");}var _123=[];this.tokens=dojox.string.tokenize(_122,this.regex,function(_124,_125,i){if(_125){_123.push([i,_125]);return _125;}if(_124){return _124.charAt(1);}});this.replacements=_123;};dojo.extend(dojox.date.php.DateFormat,{weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdays_3:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_3:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthdays:[31,28,31,30,31,30,31,31,30,31,30,31],format:function(date){this.date=date;for(var i=0,_126;_126=this.replacements[i];i++){this.tokens[_126[0]]=this[_126[1]]();}return this.tokens.join("");},d:function(){var j=this.j();return (j.length==1)?"0"+j:j;},D:function(){return this.weekdays_3[this.date.getDay()];},j:function(){return this.date.getDate()+"";},l:function(){return this.weekdays[this.date.getDay()];},N:function(){var w=this.w();return (!w)?7:w;},S:function(){switch(this.date.getDate()){case 11:case 12:case 13:return "th";case 1:case 21:case 31:return "st";case 2:case 22:return "nd";case 3:case 23:return "rd";default:return "th";}},w:function(){return this.date.getDay()+"";},z:function(){var _127=this.date.getTime()-new Date(this.date.getFullYear(),0,1).getTime();return Math.floor(_127/86400000)+"";},W:function(){var week;var _128=new Date(this.date.getFullYear(),0,1).getDay()+1;var w=this.date.getDay()+1;var z=parseInt(this.z());if(z<=(8-_128)&&_128>4){var _129=new Date(this.date.getFullYear()-1,this.date.getMonth(),this.date.getDate());if(_128==5||(_128==6&&dojo.date.isLeapYear(_129))){week=53;}else{week=52;}}else{var i;if(Boolean(this.L())){i=366;}else{i=365;}if((i-z)<(4-w)){week=1;}else{var j=z+(7-w)+(_128-1);week=Math.ceil(j/7);if(_128>4){--week;}}}return week;},F:function(){return this.months[this.date.getMonth()];},m:function(){var n=this.n();return (n.length==1)?"0"+n:n;},M:function(){return this.months_3[this.date.getMonth()];},n:function(){return this.date.getMonth()+1+"";},t:function(){return (Boolean(this.L())&&this.date.getMonth()==1)?29:this.monthdays[this.getMonth()];},L:function(){return (dojo.date.isLeapYear(this.date))?"1":"0";},o:function(){},Y:function(){return this.date.getFullYear()+"";},y:function(){return this.Y().slice(-2);},a:function(){return this.date.getHours()>=12?"pm":"am";},b:function(){return this.a().toUpperCase();},B:function(){var off=this.date.getTimezoneOffset()+60;var secs=(this.date.getHours()*3600)+(this.date.getMinutes()*60)+this.getSeconds()+(off*60);var beat=Math.abs(Math.floor(secs/86.4)%1000)+"";while(beat.length<2){beat="0"+beat;}return beat;},g:function(){return (this.date.getHours()>12)?this.date.getHours()-12+"":this.date.getHours()+"";},G:function(){return this.date.getHours()+"";},h:function(){var g=this.g();return (g.length==1)?"0"+g:g;},H:function(){var G=this.G();return (G.length==1)?"0"+G:G;},i:function(){var mins=this.date.getMinutes()+"";return (mins.length==1)?"0"+mins:mins;},s:function(){var secs=this.date.getSeconds()+"";return (secs.length==1)?"0"+secs:secs;},e:function(){return dojo.date.getTimezoneName(this.date);},I:function(){},O:function(){var off=Math.abs(this.date.getTimezoneOffset());var _12a=Math.floor(off/60)+"";var mins=(off%60)+"";if(_12a.length==1){_12a="0"+_12a;}if(mins.length==1){_12a="0"+mins;}return ((this.date.getTimezoneOffset()<0)?"+":"-")+_12a+mins;},P:function(){var O=this.O();return O.substring(0,2)+":"+O.substring(2,4);},T:function(){return this.e().substring(0,3);},Z:function(){return this.date.getTimezoneOffset()*-60;},c:function(){return this.Y()+"-"+this.m()+"-"+this.d()+"T"+this.h()+":"+this.i()+":"+this.s()+this.P();},r:function(){return this.D()+", "+this.d()+" "+this.M()+" "+this.Y()+" "+this.H()+":"+this.i()+":"+this.s()+" "+this.O();},U:function(){return Math.floor(this.date.getTime()/1000);}});}if(!dojo._hasResource["dojox.dtl.utils.date"]){dojo._hasResource["dojox.dtl.utils.date"]=true;dojo.provide("dojox.dtl.utils.date");dojox.dtl.utils.date.DateFormat=function(_12b){dojox.date.php.DateFormat.call(this,_12b);};dojo.extend(dojox.dtl.utils.date.DateFormat,dojox.date.php.DateFormat.prototype,{f:function(){return (!this.date.getMinutes())?this.g():this.g()+":"+this.i();},N:function(){return dojox.dtl.utils.date._months_ap[this.date.getMonth()];},P:function(){if(!this.date.getMinutes()&&!this.date.getHours()){return "midnight";}if(!this.date.getMinutes()&&this.date.getHours()==12){return "noon";}return this.f()+" "+this.a();}});dojo.mixin(dojox.dtl.utils.date,{format:function(date,_12c){var df=new dojox.dtl.utils.date.DateFormat(_12c);return df.format(date);},timesince:function(d,now){if(!(d instanceof Date)){d=new Date(d.year,d.month,d.day);}if(!now){now=new Date();}var _12d=Math.abs(now.getTime()-d.getTime());for(var i=0,_12e;_12e=dojox.dtl.utils.date._chunks[i];i++){var _12f=Math.floor(_12d/_12e[0]);if(_12f){break;}}return _12f+" "+_12e[1](_12f);},_chunks:[[60*60*24*365*1000,function(n){return (n==1)?"year":"years";}],[60*60*24*30*1000,function(n){return (n==1)?"month":"months";}],[60*60*24*7*1000,function(n){return (n==1)?"week":"weeks";}],[60*60*24*1000,function(n){return (n==1)?"day":"days";}],[60*60*1000,function(n){return (n==1)?"hour":"hours";}],[60*1000,function(n){return (n==1)?"minute":"minutes";}]],_months_ap:["Jan.","Feb.","March","April","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec."]});}if(!dojo._hasResource["dojox.dtl.tag.date"]){dojo._hasResource["dojox.dtl.tag.date"]=true;dojo.provide("dojox.dtl.tag.date");dojox.dtl.tag.date.NowNode=function(_130,node){this._format=_130;this.format=new dojox.dtl.utils.date.DateFormat(_130);this.contents=node;};dojo.extend(dojox.dtl.tag.date.NowNode,{render:function(_131,_132){this.contents.set(this.format.format(new Date()));return this.contents.render(_131,_132);},unrender:function(_133,_134){return this.contents.unrender(_133,_134);},clone:function(_135){return new this.constructor(this._format,this.contents.clone(_135));}});dojox.dtl.tag.date.now=function(_136,_137){var _138=_137.split_contents();if(_138.length!=2){throw new Error("'now' statement takes one argument");}return new dojox.dtl.tag.date.NowNode(_138[1].slice(1,-1),_136.create_text_node());};}if(!dojo._hasResource["dojox.dtl.tag.loader"]){dojo._hasResource["dojox.dtl.tag.loader"]=true;dojo.provide("dojox.dtl.tag.loader");(function(){var dd=dojox.dtl;var ddtl=dd.tag.loader;ddtl.BlockNode=dojo.extend(function(name,_139){this.name=name;this.nodelist=_139;},{"super":function(){if(this.parent){var html=this.parent.nodelist.dummyRender(this.context,null,true);if(typeof html=="string"){html=new String(html);}html.safe=true;return html;}return "";},render:function(_13a,_13b){var name=this.name;var _13c=this.nodelist;var _13d;if(_13b.blocks){var _13e=_13b.blocks[name];if(_13e){_13d=_13e.parent;_13c=_13e.nodelist;_13e.used=true;}}this.rendered=_13c;_13a=_13a.push();this.context=_13a;this.parent=null;if(_13c!=this.nodelist){this.parent=this;}_13a.block=this;if(_13b.getParent){var _13f=_13b.getParent();var _140=dojo.connect(_13b,"onSetParent",function(node,up,root){if(up&&root){_13b.setParent(_13f);}});}_13b=_13c.render(_13a,_13b,this);_140&&dojo.disconnect(_140);_13a=_13a.pop();return _13b;},unrender:function(_141,_142){return this.rendered.unrender(_141,_142);},clone:function(_143){return new this.constructor(this.name,this.nodelist.clone(_143));},toString:function(){return "dojox.dtl.tag.loader.BlockNode";}});ddtl.ExtendsNode=dojo.extend(function(_144,_145,_146,_147,key){this.getTemplate=_144;this.nodelist=_145;this.shared=_146;this.parent=_147;this.key=key;},{parents:{},getParent:function(_148){var _149=this.parent;if(!_149){var _14a;_149=this.parent=_148.get(this.key,false);if(!_149){throw new Error("extends tag used a variable that did not resolve");}if(typeof _149=="object"){var url=_149.url||_149.templatePath;if(_149.shared){this.shared=true;}if(url){_149=this.parent=url.toString();}else{if(_149.templateString){_14a=_149.templateString;_149=this.parent=" ";}else{_149=this.parent=this.parent.toString();}}}if(_149&&_149.indexOf("shared:")===0){this.shared=true;_149=this.parent=_149.substring(7,_149.length);}}if(!_149){throw new Error("Invalid template name in 'extends' tag.");}if(_149.render){return _149;}if(this.parents[_149]){return this.parents[_149];}this.parent=this.getTemplate(_14a||dojox.dtl.text.getTemplateString(_149));if(this.shared){this.parents[_149]=this.parent;}return this.parent;},render:function(_14b,_14c){var _14d=this.getParent(_14b);_14d.blocks=_14d.blocks||{};_14c.blocks=_14c.blocks||{};for(var i=0,node;node=this.nodelist.contents[i];i++){if(node instanceof dojox.dtl.tag.loader.BlockNode){var old=_14d.blocks[node.name];if(old&&old.nodelist!=node.nodelist){_14c=old.nodelist.unrender(_14b,_14c);}_14d.blocks[node.name]=_14c.blocks[node.name]={shared:this.shared,nodelist:node.nodelist,used:false};}}this.rendered=_14d;return _14d.nodelist.render(_14b,_14c,this);},unrender:function(_14e,_14f){return this.rendered.unrender(_14e,_14f,this);},toString:function(){return "dojox.dtl.block.ExtendsNode";}});ddtl.IncludeNode=dojo.extend(function(path,_150,_151,text,_152){this._path=path;this.constant=_150;this.path=(_150)?path:new dd._Filter(path);this.getTemplate=_151;this.text=text;this.parsed=(arguments.length==5)?_152:true;},{_cache:[{},{}],render:function(_153,_154){var _155=((this.constant)?this.path:this.path.resolve(_153)).toString();var _156=Number(this.parsed);var _157=false;if(_155!=this.last){_157=true;if(this.last){_154=this.unrender(_153,_154);}this.last=_155;}var _158=this._cache[_156];if(_156){if(!_158[_155]){_158[_155]=dd.text._resolveTemplateArg(_155,true);}if(_157){var _159=this.getTemplate(_158[_155]);this.rendered=_159.nodelist;}return this.rendered.render(_153,_154,this);}else{if(this.text instanceof dd._TextNode){if(_157){this.rendered=this.text;this.rendered.set(dd.text._resolveTemplateArg(_155,true));}return this.rendered.render(_153,_154);}else{if(!_158[_155]){var _15a=[];var div=document.createElement("div");div.innerHTML=dd.text._resolveTemplateArg(_155,true);var _15b=div.childNodes;while(_15b.length){var _15c=div.removeChild(_15b[0]);_15a.push(_15c);}_158[_155]=_15a;}if(_157){this.nodelist=[];var _15d=true;for(var i=0,_15e;_15e=_158[_155][i];i++){this.nodelist.push(_15e.cloneNode(true));}}for(var i=0,node;node=this.nodelist[i];i++){_154=_154.concat(node);}}}return _154;},unrender:function(_15f,_160){if(this.rendered){_160=this.rendered.unrender(_15f,_160);}if(this.nodelist){for(var i=0,node;node=this.nodelist[i];i++){_160=_160.remove(node);}}return _160;},clone:function(_161){return new this.constructor(this._path,this.constant,this.getTemplate,this.text.clone(_161),this.parsed);}});dojo.mixin(ddtl,{block:function(_162,_163){var _164=_163.contents.split();var name=_164[1];_162._blocks=_162._blocks||{};_162._blocks[name]=_162._blocks[name]||[];_162._blocks[name].push(name);var _165=_162.parse(["endblock","endblock "+name]).rtrim();_162.next_token();return new dojox.dtl.tag.loader.BlockNode(name,_165);},extends_:function(_166,_167){var _168=_167.contents.split();var _169=false;var _16a=null;var key=null;if(_168[1].charAt(0)=="\""||_168[1].charAt(0)=="'"){_16a=_168[1].substring(1,_168[1].length-1);}else{key=_168[1];}if(_16a&&_16a.indexOf("shared:")==0){_169=true;_16a=_16a.substring(7,_16a.length);}var _16b=_166.parse();return new dojox.dtl.tag.loader.ExtendsNode(_166.getTemplate,_16b,_169,_16a,key);},include:function(_16c,_16d){var _16e=_16d.contents.split();if(_16e.length!=2){throw new Error(_16e[0]+" tag takes one argument: the name of the template to be included");}var path=_16e[1];var _16f=false;if((path.charAt(0)=="\""||path.slice(-1)=="'")&&path.charAt(0)==path.slice(-1)){path=path.slice(1,-1);_16f=true;}return new ddtl.IncludeNode(path,_16f,_16c.getTemplate,_16c.create_text_node());},ssi:function(_170,_171){var _172=_171.contents.split();var _173=false;if(_172.length==3){_173=(_172.pop()=="parsed");if(!_173){throw new Error("Second (optional) argument to ssi tag must be 'parsed'");}}var node=ddtl.include(_170,new dd.Token(_171.token_type,_172.join(" ")));node.parsed=_173;return node;}});})();}if(!dojo._hasResource["dojox.dtl.tag.misc"]){dojo._hasResource["dojox.dtl.tag.misc"]=true;dojo.provide("dojox.dtl.tag.misc");(function(){var dd=dojox.dtl;var ddtm=dd.tag.misc;ddtm.DebugNode=dojo.extend(function(text){this.text=text;},{render:function(_174,_175){var keys=_174.getKeys();var _176=[];var only={};for(var i=0,key;key=keys[i];i++){only[key]=_174[key];_176+="["+key+": "+typeof _174[key]+"]\n";}return this.text.set(_176).render(_174,_175,this);},unrender:function(_177,_178){return _178;},clone:function(_179){return new this.constructor(this.text.clone(_179));},toString:function(){return "ddtm.DebugNode";}});ddtm.FilterNode=dojo.extend(function(_17a,_17b){this._varnode=_17a;this._nodelist=_17b;},{render:function(_17c,_17d){var _17e=this._nodelist.render(_17c,new dojox.string.Builder());_17c=_17c.update({"var":_17e.toString()});var _17f=this._varnode.render(_17c,_17d);_17c=_17c.pop();return _17d;},unrender:function(_180,_181){return _181;},clone:function(_182){return new this.constructor(this._expression,this._nodelist.clone(_182));}});ddtm.FirstOfNode=dojo.extend(function(vars,text){this._vars=vars;this.vars=dojo.map(vars,function(item){return new dojox.dtl._Filter(item);});this.contents=text;},{render:function(_183,_184){for(var i=0,item;item=this.vars[i];i++){var _185=item.resolve(_183);if(typeof _185!="undefined"){if(_185===null){_185="null";}this.contents.set(_185);return this.contents.render(_183,_184);}}return this.contents.unrender(_183,_184);},unrender:function(_186,_187){return this.contents.unrender(_186,_187);},clone:function(_188){return new this.constructor(this._vars,this.contents.clone(_188));}});ddtm.SpacelessNode=dojo.extend(function(_189,text){this.nodelist=_189;this.contents=text;},{render:function(_18a,_18b){if(_18b.getParent){var _18c=[dojo.connect(_18b,"onAddNodeComplete",this,"_watch"),dojo.connect(_18b,"onSetParent",this,"_watchParent")];_18b=this.nodelist.render(_18a,_18b);dojo.disconnect(_18c[0]);dojo.disconnect(_18c[1]);}else{var _18d=this.nodelist.dummyRender(_18a);this.contents.set(_18d.replace(/>\s+</g,"><"));_18b=this.contents.render(_18a,_18b);}return _18b;},unrender:function(_18e,_18f){return this.nodelist.unrender(_18e,_18f);},clone:function(_190){return new this.constructor(this.nodelist.clone(_190),this.contents.clone(_190));},_isEmpty:function(node){return (node.nodeType==3&&!node.data.match(/[^\s\n]/));},_watch:function(node){if(this._isEmpty(node)){var _191=false;if(node.parentNode.firstChild==node){node.parentNode.removeChild(node);}}else{var _192=node.parentNode.childNodes;if(node.nodeType==1&&_192.length>2){for(var i=2,_193;_193=_192[i];i++){if(_192[i-2].nodeType==1&&this._isEmpty(_192[i-1])){node.parentNode.removeChild(_192[i-1]);return;}}}}},_watchParent:function(node){var _194=node.childNodes;if(_194.length){while(node.childNodes.length){var last=node.childNodes[node.childNodes.length-1];if(!this._isEmpty(last)){return;}node.removeChild(last);}}}});ddtm.TemplateTagNode=dojo.extend(function(tag,text){this.tag=tag;this.contents=text;},{mapping:{openblock:"{%",closeblock:"%}",openvariable:"{{",closevariable:"}}",openbrace:"{",closebrace:"}",opencomment:"{#",closecomment:"#}"},render:function(_195,_196){this.contents.set(this.mapping[this.tag]);return this.contents.render(_195,_196);},unrender:function(_197,_198){return this.contents.unrender(_197,_198);},clone:function(_199){return new this.constructor(this.tag,this.contents.clone(_199));}});ddtm.WidthRatioNode=dojo.extend(function(_19a,max,_19b,text){this.current=new dd._Filter(_19a);this.max=new dd._Filter(max);this.width=_19b;this.contents=text;},{render:function(_19c,_19d){var _19e=+this.current.resolve(_19c);var max=+this.max.resolve(_19c);if(typeof _19e!="number"||typeof max!="number"||!max){this.contents.set("");}else{this.contents.set(""+Math.round((_19e/max)*this.width));}return this.contents.render(_19c,_19d);},unrender:function(_19f,_1a0){return this.contents.unrender(_19f,_1a0);},clone:function(_1a1){return new this.constructor(this.current.getExpression(),this.max.getExpression(),this.width,this.contents.clone(_1a1));}});ddtm.WithNode=dojo.extend(function(_1a2,_1a3,_1a4){this.target=new dd._Filter(_1a2);this.alias=_1a3;this.nodelist=_1a4;},{render:function(_1a5,_1a6){var _1a7=this.target.resolve(_1a5);_1a5=_1a5.push();_1a5[this.alias]=_1a7;_1a6=this.nodelist.render(_1a5,_1a6);_1a5=_1a5.pop();return _1a6;},unrender:function(_1a8,_1a9){return _1a9;},clone:function(_1aa){return new this.constructor(this.target.getExpression(),this.alias,this.nodelist.clone(_1aa));}});dojo.mixin(ddtm,{comment:function(_1ab,_1ac){_1ab.skip_past("endcomment");return dd._noOpNode;},debug:function(_1ad,_1ae){return new ddtm.DebugNode(_1ad.create_text_node());},filter:function(_1af,_1b0){var rest=_1b0.contents.split(null,1)[1];var _1b1=_1af.create_variable_node("var|"+rest);var _1b2=_1af.parse(["endfilter"]);_1af.next_token();return new ddtm.FilterNode(_1b1,_1b2);},firstof:function(_1b3,_1b4){var _1b5=_1b4.split_contents().slice(1);if(!_1b5.length){throw new Error("'firstof' statement requires at least one argument");}return new ddtm.FirstOfNode(_1b5,_1b3.create_text_node());},spaceless:function(_1b6,_1b7){var _1b8=_1b6.parse(["endspaceless"]);_1b6.delete_first_token();return new ddtm.SpacelessNode(_1b8,_1b6.create_text_node());},templatetag:function(_1b9,_1ba){var _1bb=_1ba.contents.split();if(_1bb.length!=2){throw new Error("'templatetag' statement takes one argument");}var tag=_1bb[1];var _1bc=ddtm.TemplateTagNode.prototype.mapping;if(!_1bc[tag]){var keys=[];for(var key in _1bc){keys.push(key);}throw new Error("Invalid templatetag argument: '"+tag+"'. Must be one of: "+keys.join(", "));}return new ddtm.TemplateTagNode(tag,_1b9.create_text_node());},widthratio:function(_1bd,_1be){var _1bf=_1be.contents.split();if(_1bf.length!=4){throw new Error("widthratio takes three arguments");}var _1c0=+_1bf[3];if(typeof _1c0!="number"){throw new Error("widthratio final argument must be an integer");}return new ddtm.WidthRatioNode(_1bf[1],_1bf[2],_1c0,_1bd.create_text_node());},with_:function(_1c1,_1c2){var _1c3=_1c2.split_contents();if(_1c3.length!=4||_1c3[2]!="as"){throw new Error("do_width expected format as 'with value as name'");}var _1c4=_1c1.parse(["endwith"]);_1c1.next_token();return new ddtm.WithNode(_1c3[1],_1c3[3],_1c4);}});})();}if(!dojo._hasResource["dojox.dtl.ext-dojo.NodeList"]){dojo._hasResource["dojox.dtl.ext-dojo.NodeList"]=true;dojo.provide("dojox.dtl.ext-dojo.NodeList");dojo.extend(dojo.NodeList,{dtl:function(_1c5,_1c6){var d=dojox.dtl;var self=this;var _1c7=function(_1c8,_1c9){var _1ca=_1c8.render(new d._Context(_1c9));self.forEach(function(node){node.innerHTML=_1ca;});};d.text._resolveTemplateArg(_1c5).addCallback(function(_1cb){_1c5=new d.Template(_1cb);d.text._resolveContextArg(_1c6).addCallback(function(_1cc){_1c7(_1c5,_1cc);});});return this;}});}
diff --git a/js/dojo-1.6/dojox/dtl.js.uncompressed.js b/js/dojo-1.6/dojox/dtl.js.uncompressed.js new file mode 100644 index 0000000..e385fef --- /dev/null +++ b/js/dojo-1.6/dojox/dtl.js.uncompressed.js @@ -0,0 +1,2866 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+/*
+ This is an optimized version of Dojo, built for deployment and not for
+ development. To get sources and documentation, please visit:
+
+ http://dojotoolkit.org
+*/
+
+if(!dojo._hasResource["dojox.string.Builder"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.string.Builder"] = true;
+dojo.provide("dojox.string.Builder");
+
+dojox.string.Builder = function(/*String?*/str){
+ // summary:
+ // A fast buffer for creating large strings.
+ //
+ // length: Number
+ // The current length of the internal string.
+
+ // N.B. the public nature of the internal buffer is no longer
+ // needed because the IE-specific fork is no longer needed--TRT.
+ var b = "";
+ this.length = 0;
+
+ this.append = function(/* String... */s){
+ // summary: Append all arguments to the end of the buffer
+ if(arguments.length>1){
+ /*
+ This is a loop unroll was designed specifically for Firefox;
+ it would seem that static index access on an Arguments
+ object is a LOT faster than doing dynamic index access.
+ Therefore, we create a buffer string and take advantage
+ of JS's switch fallthrough. The peformance of this method
+ comes very close to straight up string concatenation (+=).
+
+ If the arguments object length is greater than 9, we fall
+ back to standard dynamic access.
+
+ This optimization seems to have no real effect on either
+ Safari or Opera, so we just use it for all.
+
+ It turns out also that this loop unroll can increase performance
+ significantly with Internet Explorer, particularly when
+ as many arguments are provided as possible.
+
+ Loop unroll per suggestion from Kris Zyp, implemented by
+ Tom Trenka.
+
+ Note: added empty string to force a string cast if needed.
+ */
+ var tmp="", l=arguments.length;
+ switch(l){
+ case 9: tmp=""+arguments[8]+tmp;
+ case 8: tmp=""+arguments[7]+tmp;
+ case 7: tmp=""+arguments[6]+tmp;
+ case 6: tmp=""+arguments[5]+tmp;
+ case 5: tmp=""+arguments[4]+tmp;
+ case 4: tmp=""+arguments[3]+tmp;
+ case 3: tmp=""+arguments[2]+tmp;
+ case 2: {
+ b+=""+arguments[0]+arguments[1]+tmp;
+ break;
+ }
+ default: {
+ var i=0;
+ while(i<arguments.length){
+ tmp += arguments[i++];
+ }
+ b += tmp;
+ }
+ }
+ } else {
+ b += s;
+ }
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.concat = function(/*String...*/s){
+ // summary:
+ // Alias for append.
+ return this.append.apply(this, arguments); // dojox.string.Builder
+ };
+
+ this.appendArray = function(/*Array*/strings) {
+ // summary:
+ // Append an array of items to the internal buffer.
+
+ // Changed from String.prototype.concat.apply because of IE.
+ return this.append.apply(this, strings); // dojox.string.Builder
+ };
+
+ this.clear = function(){
+ // summary:
+ // Remove all characters from the buffer.
+ b = "";
+ this.length = 0;
+ return this; // dojox.string.Builder
+ };
+
+ this.replace = function(/* String */oldStr, /* String */ newStr){
+ // summary:
+ // Replace instances of one string with another in the buffer.
+ b = b.replace(oldStr,newStr);
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.remove = function(/* Number */start, /* Number? */len){
+ // summary:
+ // Remove len characters starting at index start. If len
+ // is not provided, the end of the string is assumed.
+ if(len===undefined){ len = b.length; }
+ if(len == 0){ return this; }
+ b = b.substr(0, start) + b.substr(start+len);
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.insert = function(/* Number */index, /* String */str){
+ // summary:
+ // Insert string str starting at index.
+ if(index == 0){
+ b = str + b;
+ }else{
+ b = b.slice(0, index) + str + b.slice(index);
+ }
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.toString = function(){
+ // summary:
+ // Return the string representation of the internal buffer.
+ return b; // String
+ };
+
+ // initialize the buffer.
+ if(str){ this.append(str); }
+};
+
+}
+
+if(!dojo._hasResource["dojox.string.tokenize"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.string.tokenize"] = true;
+dojo.provide("dojox.string.tokenize");
+
+dojox.string.tokenize = function(/*String*/ str, /*RegExp*/ re, /*Function?*/ parseDelim, /*Object?*/ instance){
+ // summary:
+ // Split a string by a regular expression with the ability to capture the delimeters
+ // parseDelim:
+ // Each group (excluding the 0 group) is passed as a parameter. If the function returns
+ // a value, it's added to the list of tokens.
+ // instance:
+ // Used as the "this" instance when calling parseDelim
+ var tokens = [];
+ var match, content, lastIndex = 0;
+ while(match = re.exec(str)){
+ content = str.slice(lastIndex, re.lastIndex - match[0].length);
+ if(content.length){
+ tokens.push(content);
+ }
+ if(parseDelim){
+ if(dojo.isOpera){
+ var copy = match.slice(0);
+ while(copy.length < match.length){
+ copy.push(null);
+ }
+ match = copy;
+ }
+ var parsed = parseDelim.apply(instance, match.slice(1).concat(tokens.length));
+ if(typeof parsed != "undefined"){
+ tokens.push(parsed);
+ }
+ }
+ lastIndex = re.lastIndex;
+ }
+ content = str.slice(lastIndex);
+ if(content.length){
+ tokens.push(content);
+ }
+ return tokens;
+}
+
+}
+
+if(!dojo._hasResource["dojox.dtl._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._base"] = true;
+dojo.provide("dojox.dtl._base");
+
+
+
+
+dojo.experimental("dojox.dtl");
+
+(function(){
+ var dd = dojox.dtl;
+
+ dd.TOKEN_BLOCK = -1;
+ dd.TOKEN_VAR = -2;
+ dd.TOKEN_COMMENT = -3;
+ dd.TOKEN_TEXT = 3;
+
+ dd._Context = dojo.extend(function(dict){
+ // summary: Pass one of these when rendering a template to tell the template what values to use.
+ if(dict){
+ dojo._mixin(this, dict);
+ if(dict.get){
+ // Preserve passed getter and restore prototype get
+ this._getter = dict.get;
+ delete this.get;
+ }
+ }
+ },
+ {
+ push: function(){
+ var last = this;
+ var context = dojo.delegate(this);
+ context.pop = function(){ return last; }
+ return context;
+ },
+ pop: function(){
+ throw new Error("pop() called on empty Context");
+ },
+ get: function(key, otherwise){
+ var n = this._normalize;
+
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return n(got);
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return n(this[key]);
+ }
+
+ return otherwise;
+ },
+ _normalize: function(value){
+ if(value instanceof Date){
+ value.year = value.getFullYear();
+ value.month = value.getMonth() + 1;
+ value.day = value.getDate();
+ value.date = value.year + "-" + ("0" + value.month).slice(-2) + "-" + ("0" + value.day).slice(-2);
+ value.hour = value.getHours();
+ value.minute = value.getMinutes();
+ value.second = value.getSeconds();
+ value.microsecond = value.getMilliseconds();
+ }
+ return value;
+ },
+ update: function(dict){
+ var context = this.push();
+ if(dict){
+ dojo._mixin(this, dict);
+ }
+ return context;
+ }
+ });
+
+ var smart_split_re = /("(?:[^"\\]*(?:\\.[^"\\]*)*)"|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)/g;
+ var split_re = /\s+/g;
+ var split = function(/*String|RegExp?*/ splitter, /*Integer?*/ limit){
+ splitter = splitter || split_re;
+ if(!(splitter instanceof RegExp)){
+ splitter = new RegExp(splitter, "g");
+ }
+ if(!splitter.global){
+ throw new Error("You must use a globally flagged RegExp with split " + splitter);
+ }
+ splitter.exec(""); // Reset the global
+
+ var part, parts = [], lastIndex = 0, i = 0;
+ while(part = splitter.exec(this)){
+ parts.push(this.slice(lastIndex, splitter.lastIndex - part[0].length));
+ lastIndex = splitter.lastIndex;
+ if(limit && (++i > limit - 1)){
+ break;
+ }
+ }
+ parts.push(this.slice(lastIndex));
+ return parts;
+ }
+
+ dd.Token = function(token_type, contents){
+ this.token_type = token_type;
+ this.contents = new String(dojo.trim(contents));
+ this.contents.split = split;
+ this.split = function(){
+ return String.prototype.split.apply(this.contents, arguments);
+ }
+ }
+ dd.Token.prototype.split_contents = function(/*Integer?*/ limit){
+ var bit, bits = [], i = 0;
+ limit = limit || 999;
+ while(i++ < limit && (bit = smart_split_re.exec(this.contents))){
+ bit = bit[0];
+ if(bit.charAt(0) == '"' && bit.slice(-1) == '"'){
+ bits.push('"' + bit.slice(1, -1).replace('\\"', '"').replace('\\\\', '\\') + '"');
+ }else if(bit.charAt(0) == "'" && bit.slice(-1) == "'"){
+ bits.push("'" + bit.slice(1, -1).replace("\\'", "'").replace('\\\\', '\\') + "'");
+ }else{
+ bits.push(bit);
+ }
+ }
+ return bits;
+ }
+
+ var ddt = dd.text = {
+ _get: function(module, name, errorless){
+ // summary: Used to find both tags and filters
+ var params = dd.register.get(module, name.toLowerCase(), errorless);
+ if(!params){
+ if(!errorless){
+ throw new Error("No tag found for " + name);
+ }
+ return null;
+ }
+
+ var fn = params[1];
+ var require = params[2];
+
+ var parts;
+ if(fn.indexOf(":") != -1){
+ parts = fn.split(":");
+ fn = parts.pop();
+ }
+
+ dojo["require"](require);
+
+ var parent = dojo.getObject(require);
+
+ return parent[fn || name] || parent[name + "_"] || parent[fn + "_"];
+ },
+ getTag: function(name, errorless){
+ return ddt._get("tag", name, errorless);
+ },
+ getFilter: function(name, errorless){
+ return ddt._get("filter", name, errorless);
+ },
+ getTemplate: function(file){
+ return new dd.Template(ddt.getTemplateString(file));
+ },
+ getTemplateString: function(file){
+ return dojo._getText(file.toString()) || "";
+ },
+ _resolveLazy: function(location, sync, json){
+ if(sync){
+ if(json){
+ return dojo.fromJson(dojo._getText(location)) || {};
+ }else{
+ return dd.text.getTemplateString(location);
+ }
+ }else{
+ return dojo.xhrGet({
+ handleAs: (json) ? "json" : "text",
+ url: location
+ });
+ }
+ },
+ _resolveTemplateArg: function(arg, sync){
+ if(ddt._isTemplate(arg)){
+ if(!sync){
+ var d = new dojo.Deferred();
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync);
+ },
+ _isTemplate: function(arg){
+ return (typeof arg == "undefined") || (typeof arg == "string" && (arg.match(/^\s*[<{]/) || arg.indexOf(" ") != -1));
+ },
+ _resolveContextArg: function(arg, sync){
+ if(arg.constructor == Object){
+ if(!sync){
+ var d = new dojo.Deferred;
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync, true);
+ },
+ _re: /(?:\{\{\s*(.+?)\s*\}\}|\{%\s*(load\s*)?(.+?)\s*%\})/g,
+ tokenize: function(str){
+ return dojox.string.tokenize(str, ddt._re, ddt._parseDelims);
+ },
+ _parseDelims: function(varr, load, tag){
+ if(varr){
+ return [dd.TOKEN_VAR, varr];
+ }else if(load){
+ var parts = dojo.trim(tag).split(/\s+/g);
+ for(var i = 0, part; part = parts[i]; i++){
+ dojo["require"](part);
+ }
+ }else{
+ return [dd.TOKEN_BLOCK, tag];
+ }
+ }
+ }
+
+ dd.Template = dojo.extend(function(/*String|dojo._Url*/ template, /*Boolean*/ isString){
+ // template:
+ // The string or location of the string to
+ // use as a template
+ var str = isString ? template : ddt._resolveTemplateArg(template, true) || "";
+ var tokens = ddt.tokenize(str);
+ var parser = new dd._Parser(tokens);
+ this.nodelist = parser.parse();
+ },
+ {
+ update: function(node, context){
+ // node: DOMNode|String|dojo.NodeList
+ // A node reference or set of nodes
+ // context: dojo._Url|String|Object
+ // The context object or location
+ return ddt._resolveContextArg(context).addCallback(this, function(contextObject){
+ var content = this.render(new dd._Context(contextObject));
+ if(node.forEach){
+ node.forEach(function(item){
+ item.innerHTML = content;
+ });
+ }else{
+ dojo.byId(node).innerHTML = content;
+ }
+ return this;
+ });
+ },
+ render: function(context, /*concatenatable?*/ buffer){
+ buffer = buffer || this.getBuffer();
+ context = context || new dd._Context({});
+ return this.nodelist.render(context, buffer) + "";
+ },
+ getBuffer: function(){
+
+ return new dojox.string.Builder();
+ }
+ });
+
+ var qfRe = /\{\{\s*(.+?)\s*\}\}/g;
+ dd.quickFilter = function(str){
+ if(!str){
+ return new dd._NodeList();
+ }
+
+ if(str.indexOf("{%") == -1){
+ return new dd._QuickNodeList(dojox.string.tokenize(str, qfRe, function(token){
+ return new dd._Filter(token);
+ }));
+ }
+ }
+
+ dd._QuickNodeList = dojo.extend(function(contents){
+ this.contents = contents;
+ },
+ {
+ render: function(context, buffer){
+ for(var i=0, l=this.contents.length; i<l; i++){
+ if(this.contents[i].resolve){
+ buffer = buffer.concat(this.contents[i].resolve(context));
+ }else{
+ buffer = buffer.concat(this.contents[i]);
+ }
+ }
+ return buffer;
+ },
+ dummyRender: function(context){ return this.render(context, dd.Template.prototype.getBuffer()).toString(); },
+ clone: function(buffer){ return this; }
+ });
+
+ dd._Filter = dojo.extend(function(token){
+ // summary: Uses a string to find (and manipulate) a variable
+ if(!token) throw new Error("Filter must be called with variable name");
+ this.contents = token;
+
+ var cache = this._cache[token];
+ if(cache){
+ this.key = cache[0];
+ this.filters = cache[1];
+ }else{
+ this.filters = [];
+ dojox.string.tokenize(token, this._re, this._tokenize, this);
+ this._cache[token] = [this.key, this.filters];
+ }
+ },
+ {
+ _cache: {},
+ _re: /(?:^_\("([^\\"]*(?:\\.[^\\"])*)"\)|^"([^\\"]*(?:\\.[^\\"]*)*)"|^([a-zA-Z0-9_.]+)|\|(\w+)(?::(?:_\("([^\\"]*(?:\\.[^\\"])*)"\)|"([^\\"]*(?:\\.[^\\"]*)*)"|([a-zA-Z0-9_.]+)|'([^\\']*(?:\\.[^\\']*)*)'))?|^'([^\\']*(?:\\.[^\\']*)*)')/g,
+ _values: {
+ 0: '"', // _("text")
+ 1: '"', // "text"
+ 2: "", // variable
+ 8: '"' // 'text'
+ },
+ _args: {
+ 4: '"', // :_("text")
+ 5: '"', // :"text"
+ 6: "", // :variable
+ 7: "'"// :'text'
+ },
+ _tokenize: function(){
+ var pos, arg;
+
+ for(var i = 0, has = []; i < arguments.length; i++){
+ has[i] = (typeof arguments[i] != "undefined" && typeof arguments[i] == "string" && arguments[i]);
+ }
+
+ if(!this.key){
+ for(pos in this._values){
+ if(has[pos]){
+ this.key = this._values[pos] + arguments[pos] + this._values[pos];
+ break;
+ }
+ }
+ }else{
+ for(pos in this._args){
+ if(has[pos]){
+ var value = arguments[pos];
+ if(this._args[pos] == "'"){
+ value = value.replace(/\\'/g, "'");
+ }else if(this._args[pos] == '"'){
+ value = value.replace(/\\"/g, '"');
+ }
+ arg = [!this._args[pos], value];
+ break;
+ }
+ }
+ // Get a named filter
+ var fn = ddt.getFilter(arguments[3]);
+ if(!dojo.isFunction(fn)) throw new Error(arguments[3] + " is not registered as a filter");
+ this.filters.push([fn, arg]);
+ }
+ },
+ getExpression: function(){
+ return this.contents;
+ },
+ resolve: function(context){
+ if(typeof this.key == "undefined"){
+ return "";
+ }
+
+ var str = this.resolvePath(this.key, context);
+
+ for(var i = 0, filter; filter = this.filters[i]; i++){
+ // Each filter has the function in [0], a boolean in [1][0] of whether it's a variable or a string
+ // and [1][1] is either the variable name of the string content.
+ if(filter[1]){
+ if(filter[1][0]){
+ str = filter[0](str, this.resolvePath(filter[1][1], context));
+ }else{
+ str = filter[0](str, filter[1][1]);
+ }
+ }else{
+ str = filter[0](str);
+ }
+ }
+
+ return str;
+ },
+ resolvePath: function(path, context){
+ var current, parts;
+ var first = path.charAt(0);
+ var last = path.slice(-1);
+ if(!isNaN(parseInt(first))){
+ current = (path.indexOf(".") == -1) ? parseInt(path) : parseFloat(path);
+ }else if(first == '"' && first == last){
+ current = path.slice(1, -1);
+ }else{
+ if(path == "true"){ return true; }
+ if(path == "false"){ return false; }
+ if(path == "null" || path == "None"){ return null; }
+ parts = path.split(".");
+ current = context.get(parts[0]);
+
+ if(dojo.isFunction(current)){
+ var self = context.getThis && context.getThis();
+ if(current.alters_data){
+ current = "";
+ }else if(self){
+ current = current.call(self);
+ }else{
+ current = "";
+ }
+ }
+
+ for(var i = 1; i < parts.length; i++){
+ var part = parts[i];
+ if(current){
+ var base = current;
+ if(dojo.isObject(current) && part == "items" && typeof current[part] == "undefined"){
+ var items = [];
+ for(var key in current){
+ items.push([key, current[key]]);
+ }
+ current = items;
+ continue;
+ }
+
+ if(current.get && dojo.isFunction(current.get) && current.get.safe){
+ current = current.get(part);
+ }else if(typeof current[part] == "undefined"){
+ current = current[part];
+ break;
+ }else{
+ current = current[part];
+ }
+
+ if(dojo.isFunction(current)){
+ if(current.alters_data){
+ current = "";
+ }else{
+ current = current.call(base);
+ }
+ }else if(current instanceof Date){
+ current = dd._Context.prototype._normalize(current);
+ }
+ }else{
+ return "";
+ }
+ }
+ }
+ return current;
+ }
+ });
+
+ dd._TextNode = dd._Node = dojo.extend(function(/*Object*/ obj){
+ // summary: Basic catch-all node
+ this.contents = obj;
+ },
+ {
+ set: function(data){
+ this.contents = data;
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds content onto the buffer
+ return buffer.concat(this.contents);
+ },
+ isEmpty: function(){
+ return !dojo.trim(this.contents);
+ },
+ clone: function(){ return this; }
+ });
+
+ dd._NodeList = dojo.extend(function(/*Node[]*/ nodes){
+ // summary: Allows us to render a group of nodes
+ this.contents = nodes || [];
+ this.last = "";
+ },
+ {
+ push: function(node){
+ // summary: Add a new node to the list
+ this.contents.push(node);
+ return this;
+ },
+ concat: function(nodes){
+ this.contents = this.contents.concat(nodes);
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds all content onto the buffer
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].render(context, buffer);
+ if(!buffer) throw new Error("Template must return buffer");
+ }
+ return buffer;
+ },
+ dummyRender: function(context){
+ return this.render(context, dd.Template.prototype.getBuffer()).toString();
+ },
+ unrender: function(){ return arguments[1]; },
+ clone: function(){ return this; },
+ rtrim: function(){
+ while(1){
+ i = this.contents.length - 1;
+ if(this.contents[i] instanceof dd._TextNode && this.contents[i].isEmpty()){
+ this.contents.pop();
+ }else{
+ break;
+ }
+ }
+
+ return this;
+ }
+ });
+
+ dd._VarNode = dojo.extend(function(str){
+ // summary: A node to be processed as a variable
+ this.contents = new dd._Filter(str);
+ },
+ {
+ render: function(context, buffer){
+ var str = this.contents.resolve(context);
+ if(!str.safe){
+ str = dd._base.escape("" + str);
+ }
+ return buffer.concat(str);
+ }
+ });
+
+ dd._noOpNode = new function(){
+ // summary: Adds a no-op node. Useful in custom tags
+ this.render = this.unrender = function(){ return arguments[1]; }
+ this.clone = function(){ return this; }
+ }
+
+ dd._Parser = dojo.extend(function(tokens){
+ // summary: Parser used during initialization and for tag groups.
+ this.contents = tokens;
+ },
+ {
+ i: 0,
+ parse: function(/*Array?*/ stop_at){
+ // summary: Turns tokens into nodes
+ // description: Steps into tags are they're found. Blocks use the parse object
+ // to find their closing tag (the stop_at array). stop_at is inclusive, it
+ // returns the node that matched.
+ var terminators = {}, token;
+ stop_at = stop_at || [];
+ for(var i = 0; i < stop_at.length; i++){
+ terminators[stop_at[i]] = true;
+ }
+
+ var nodelist = new dd._NodeList();
+ while(this.i < this.contents.length){
+ token = this.contents[this.i++];
+ if(typeof token == "string"){
+ nodelist.push(new dd._TextNode(token));
+ }else{
+ var type = token[0];
+ var text = token[1];
+ if(type == dd.TOKEN_VAR){
+ nodelist.push(new dd._VarNode(text));
+ }else if(type == dd.TOKEN_BLOCK){
+ if(terminators[text]){
+ --this.i;
+ return nodelist;
+ }
+ var cmd = text.split(/\s+/g);
+ if(cmd.length){
+ cmd = cmd[0];
+ var fn = ddt.getTag(cmd);
+ if(fn){
+ nodelist.push(fn(this, new dd.Token(type, text)));
+ }
+ }
+ }
+ }
+ }
+
+ if(stop_at.length){
+ throw new Error("Could not find closing tag(s): " + stop_at.toString());
+ }
+
+ this.contents.length = 0;
+ return nodelist;
+ },
+ next_token: function(){
+ // summary: Returns the next token in the list.
+ var token = this.contents[this.i++];
+ return new dd.Token(token[0], token[1]);
+ },
+ delete_first_token: function(){
+ this.i++;
+ },
+ skip_past: function(endtag){
+ while(this.i < this.contents.length){
+ var token = this.contents[this.i++];
+ if(token[0] == dd.TOKEN_BLOCK && token[1] == endtag){
+ return;
+ }
+ }
+ throw new Error("Unclosed tag found when looking for " + endtag);
+ },
+ create_variable_node: function(expr){
+ return new dd._VarNode(expr);
+ },
+ create_text_node: function(expr){
+ return new dd._TextNode(expr || "");
+ },
+ getTemplate: function(file){
+ return new dd.Template(file);
+ }
+ });
+
+ dd.register = {
+ _registry: {
+ attributes: [],
+ tags: [],
+ filters: []
+ },
+ get: function(/*String*/ module, /*String*/ name){
+ var registry = dd.register._registry[module + "s"];
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(typeof entry[0] == "string"){
+ if(entry[0] == name){
+ return entry;
+ }
+ }else if(name.match(entry[0])){
+ return entry;
+ }
+ }
+ },
+ getAttributeTags: function(){
+ var tags = [];
+ var registry = dd.register._registry.attributes;
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(entry.length == 3){
+ tags.push(entry);
+ }else{
+ var fn = dojo.getObject(entry[1]);
+ if(fn && dojo.isFunction(fn)){
+ entry.push(fn);
+ tags.push(entry);
+ }
+ }
+ }
+ return tags;
+ },
+ _any: function(type, base, locations){
+ for(var path in locations){
+ for(var i = 0, fn; fn = locations[path][i]; i++){
+ var key = fn;
+ if(dojo.isArray(fn)){
+ key = fn[0];
+ fn = fn[1];
+ }
+ if(typeof key == "string"){
+ if(key.substr(0, 5) == "attr:"){
+ var attr = fn;
+ if(attr.substr(0, 5) == "attr:"){
+ attr = attr.slice(5);
+ }
+ dd.register._registry.attributes.push([attr.toLowerCase(), base + "." + path + "." + attr]);
+ }
+ key = key.toLowerCase()
+ }
+ dd.register._registry[type].push([
+ key,
+ fn,
+ base + "." + path
+ ]);
+ }
+ }
+ },
+ tags: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("tags", base, locations);
+ },
+ filters: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("filters", base, locations);
+ }
+ }
+
+ var escapeamp = /&/g;
+ var escapelt = /</g;
+ var escapegt = />/g;
+ var escapeqt = /'/g;
+ var escapedblqt = /"/g;
+ dd._base.escape = function(value){
+ // summary: Escapes a string's HTML
+ return dd.mark_safe(value.replace(escapeamp, '&').replace(escapelt, '<').replace(escapegt, '>').replace(escapedblqt, '"').replace(escapeqt, '''));
+ }
+
+ dd._base.safe = function(value){
+ if(typeof value == "string"){
+ value = new String(value);
+ }
+ if(typeof value == "object"){
+ value.safe = true;
+ }
+ return value;
+ }
+ dd.mark_safe = dd._base.safe;
+
+ dd.register.tags("dojox.dtl.tag", {
+ "date": ["now"],
+ "logic": ["if", "for", "ifequal", "ifnotequal"],
+ "loader": ["extends", "block", "include", "load", "ssi"],
+ "misc": ["comment", "debug", "filter", "firstof", "spaceless", "templatetag", "widthratio", "with"],
+ "loop": ["cycle", "ifchanged", "regroup"]
+ });
+ dd.register.filters("dojox.dtl.filter", {
+ "dates": ["date", "time", "timesince", "timeuntil"],
+ "htmlstrings": ["linebreaks", "linebreaksbr", "removetags", "striptags"],
+ "integers": ["add", "get_digit"],
+ "lists": ["dictsort", "dictsortreversed", "first", "join", "length", "length_is", "random", "slice", "unordered_list"],
+ "logic": ["default", "default_if_none", "divisibleby", "yesno"],
+ "misc": ["filesizeformat", "pluralize", "phone2numeric", "pprint"],
+ "strings": ["addslashes", "capfirst", "center", "cut", "fix_ampersands", "floatformat", "iriencode", "linenumbers", "ljust", "lower", "make_list", "rjust", "slugify", "stringformat", "title", "truncatewords", "truncatewords_html", "upper", "urlencode", "urlize", "urlizetrunc", "wordcount", "wordwrap"]
+ });
+ dd.register.filters("dojox.dtl", {
+ "_base": ["escape", "safe"]
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl"] = true;
+dojo.provide("dojox.dtl");
+
+
+}
+
+if(!dojo._hasResource["dojox.dtl.Context"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.Context"] = true;
+dojo.provide("dojox.dtl.Context");
+
+
+dojox.dtl.Context = dojo.extend(function(dict){
+ this._this = {};
+ dojox.dtl._Context.call(this, dict);
+}, dojox.dtl._Context.prototype,
+{
+ getKeys: function(){
+ var keys = [];
+ for(var key in this){
+ if(this.hasOwnProperty(key) && key != "_this"){
+ keys.push(key);
+ }
+ }
+ return keys;
+ },
+ extend: function(/*dojox.dtl.Context|Object*/ obj){
+ // summary: Returns a clone of this context object, with the items from the
+ // passed objecct mixed in.
+ return dojo.delegate(this, obj);
+ },
+ filter: function(/*dojox.dtl.Context|Object|String...*/ filter){
+ // summary: Returns a clone of this context, only containing the items
+ // defined in the filter.
+ var context = new dojox.dtl.Context();
+ var keys = [];
+ var i, arg;
+ if(filter instanceof dojox.dtl.Context){
+ keys = filter.getKeys();
+ }else if(typeof filter == "object"){
+ for(var key in filter){
+ keys.push(key);
+ }
+ }else{
+ for(i = 0; arg = arguments[i]; i++){
+ if(typeof arg == "string"){
+ keys.push(arg);
+ }
+ }
+ }
+
+ for(i = 0, key; key = keys[i]; i++){
+ context[key] = this[key];
+ }
+
+ return context;
+ },
+ setThis: function(/*Object*/ _this){
+ this._this = _this;
+ },
+ getThis: function(){
+ return this._this;
+ },
+ hasKey: function(key){
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return true;
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return true;
+ }
+
+ return false;
+ }
+});
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.logic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.logic"] = true;
+dojo.provide("dojox.dtl.tag.logic");
+
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddt = dd.text;
+ var ddtl = dd.tag.logic;
+
+ ddtl.IfNode = dojo.extend(function(bools, trues, falses, type){
+ this.bools = bools;
+ this.trues = trues;
+ this.falses = falses;
+ this.type = type;
+ },
+ {
+ render: function(context, buffer){
+ var i, bool, ifnot, filter, value;
+ if(this.type == "or"){
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ if((value && !ifnot) || (ifnot && !value)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }else{
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ // If we ever encounter a false value
+ if(value == ifnot){
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ buffer = (this.trues) ? this.trues.unrender(context, buffer) : buffer;
+ buffer = (this.falses) ? this.falses.unrender(context, buffer) : buffer;
+ return buffer;
+ },
+ clone: function(buffer){
+ var trues = (this.trues) ? this.trues.clone(buffer) : null;
+ var falses = (this.falses) ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.bools, trues, falses, this.type);
+ }
+ });
+
+ ddtl.IfEqualNode = dojo.extend(function(var1, var2, trues, falses, negate){
+ this.var1 = new dd._Filter(var1);
+ this.var2 = new dd._Filter(var2);
+ this.trues = trues;
+ this.falses = falses;
+ this.negate = negate;
+ },
+ {
+ render: function(context, buffer){
+ var var1 = this.var1.resolve(context);
+ var var2 = this.var2.resolve(context);
+ var1 = (typeof var1 != "undefined") ? var1 : "";
+ var2 = (typeof var1 != "undefined") ? var2 : "";
+ if((this.negate && var1 != var2) || (!this.negate && var1 == var2)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer, this);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer, this);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ },
+ unrender: function(context, buffer){
+ return ddtl.IfNode.prototype.unrender.call(this, context, buffer);
+ },
+ clone: function(buffer){
+ var trues = this.trues ? this.trues.clone(buffer) : null;
+ var falses = this.falses ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.var1.getExpression(), this.var2.getExpression(), trues, falses, this.negate);
+ }
+ });
+
+ ddtl.ForNode = dojo.extend(function(assign, loop, reversed, nodelist){
+ this.assign = assign;
+ this.loop = new dd._Filter(loop);
+ this.reversed = reversed;
+ this.nodelist = nodelist;
+ this.pool = [];
+ },
+ {
+ render: function(context, buffer){
+ var i, j, k;
+ var dirty = false;
+ var assign = this.assign;
+
+ for(k = 0; k < assign.length; k++){
+ if(typeof context[assign[k]] != "undefined"){
+ dirty = true;
+ context = context.push();
+ break;
+ }
+ }
+ if(!dirty && context.forloop){
+ dirty = true;
+ context = context.push();
+ }
+
+ var items = this.loop.resolve(context) || [];
+ for(i = items.length; i < this.pool.length; i++){
+ this.pool[i].unrender(context, buffer, this);
+ }
+ if(this.reversed){
+ items = items.slice(0).reverse();
+ }
+
+ var isObject = dojo.isObject(items) && !dojo.isArrayLike(items);
+ var arred = [];
+ if(isObject){
+ for(var key in items){
+ arred.push(items[key]);
+ }
+ }else{
+ arred = items;
+ }
+
+ var forloop = context.forloop = {
+ parentloop: context.get("forloop", {})
+ };
+ var j = 0;
+ for(i = 0; i < arred.length; i++){
+ var item = arred[i];
+
+ forloop.counter0 = j;
+ forloop.counter = j + 1;
+ forloop.revcounter0 = arred.length - j - 1;
+ forloop.revcounter = arred.length - j;
+ forloop.first = !j;
+ forloop.last = (j == arred.length - 1);
+
+ if(assign.length > 1 && dojo.isArrayLike(item)){
+ if(!dirty){
+ dirty = true;
+ context = context.push();
+ }
+ var zipped = {};
+ for(k = 0; k < item.length && k < assign.length; k++){
+ zipped[assign[k]] = item[k];
+ }
+ dojo.mixin(context, zipped);
+ }else{
+ context[assign[0]] = item;
+ }
+
+ if(j + 1 > this.pool.length){
+ this.pool.push(this.nodelist.clone(buffer));
+ }
+ buffer = this.pool[j++].render(context, buffer, this);
+ }
+
+ delete context.forloop;
+ if(dirty){
+ context = context.pop();
+ }else{
+ for(k = 0; k < assign.length; k++){
+ delete context[assign[k]];
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ for(var i = 0, pool; pool = this.pool[i]; i++){
+ buffer = pool.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.assign, this.loop.getExpression(), this.reversed, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ if_: function(parser, token){
+ var i, part, type, bools = [], parts = token.contents.split();
+ parts.shift();
+ token = parts.join(" ");
+ parts = token.split(" and ");
+ if(parts.length == 1){
+ type = "or";
+ parts = token.split(" or ");
+ }else{
+ type = "and";
+ for(i = 0; i < parts.length; i++){
+ if(parts[i].indexOf(" or ") != -1){
+ // Note, since we split by and, this is the only place we need to error check
+ throw new Error("'if' tags can't mix 'and' and 'or'");
+ }
+ }
+ }
+ for(i = 0; part = parts[i]; i++){
+ var not = false;
+ if(part.indexOf("not ") == 0){
+ part = part.slice(4);
+ not = true;
+ }
+ bools.push([not, new dd._Filter(part)]);
+ }
+ var trues = parser.parse(["else", "endif"]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse(["endif"]);
+ parser.next_token();
+ }
+ return new ddtl.IfNode(bools, trues, falses, type);
+ },
+ _ifequal: function(parser, token, negate){
+ var parts = token.split_contents();
+ if(parts.length != 3){
+ throw new Error(parts[0] + " takes two arguments");
+ }
+ var end = 'end' + parts[0];
+ var trues = parser.parse(["else", end]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse([end]);
+ parser.next_token();
+ }
+ return new ddtl.IfEqualNode(parts[1], parts[2], trues, falses, negate);
+ },
+ ifequal: function(parser, token){
+ return ddtl._ifequal(parser, token);
+ },
+ ifnotequal: function(parser, token){
+ return ddtl._ifequal(parser, token, true);
+ },
+ for_: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length < 4){
+ throw new Error("'for' statements should have at least four words: " + token.contents);
+ }
+ var reversed = parts[parts.length - 1] == "reversed";
+ var index = (reversed) ? -3 : -2;
+ if(parts[parts.length + index] != "in"){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ var loopvars = parts.slice(1, index).join(" ").split(/ *, */);
+ for(var i = 0; i < loopvars.length; i++){
+ if(!loopvars[i] || loopvars[i].indexOf(" ") != -1){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ }
+ var nodelist = parser.parse(["endfor"]);
+ parser.next_token();
+ return new ddtl.ForNode(loopvars, parts[parts.length + index + 1], reversed, nodelist);
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.loop"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loop"] = true;
+dojo.provide("dojox.dtl.tag.loop");
+
+
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loop;
+
+ ddtl.CycleNode = dojo.extend(function(cyclevars, name, text, shared){
+ this.cyclevars = cyclevars;
+ this.name = name;
+ this.contents = text;
+ this.shared = shared || {counter: -1, map: {}};
+ },
+ {
+ render: function(context, buffer){
+ if(context.forloop && !context.forloop.counter0){
+ this.shared.counter = -1;
+ }
+
+ ++this.shared.counter;
+ var value = this.cyclevars[this.shared.counter % this.cyclevars.length];
+
+ var map = this.shared.map;
+ if(!map[value]){
+ map[value] = new dd._Filter(value);
+ }
+ value = map[value].resolve(context, buffer);
+
+ if(this.name){
+ context[this.name] = value;
+ }
+ this.contents.set(value);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.cyclevars, this.name, this.contents.clone(buffer), this.shared);
+ }
+ });
+
+ ddtl.IfChangedNode = dojo.extend(function(nodes, vars, shared){
+ this.nodes = nodes;
+ this._vars = vars;
+ this.shared = shared || {last: null, counter: 0};
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ }, {
+ render: function(context, buffer){
+ if(context.forloop){
+ if(context.forloop.counter <= this.shared.counter){
+ this.shared.last = null;
+ }
+ this.shared.counter = context.forloop.counter;
+ }
+
+ var change;
+ if(this.vars.length){
+ change = dojo.toJson(dojo.map(this.vars, function(item){
+ return item.resolve(context);
+ }));
+ }else{
+ change = this.nodes.dummyRender(context, buffer);
+ }
+
+ if(change != this.shared.last){
+ var firstloop = (this.shared.last === null);
+ this.shared.last = change;
+ context = context.push();
+ context.ifchanged = {firstloop: firstloop};
+ buffer = this.nodes.render(context, buffer);
+ context = context.pop();
+ }else{
+ buffer = this.nodes.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodes.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodes.clone(buffer), this._vars, this.shared);
+ }
+ });
+
+ ddtl.RegroupNode = dojo.extend(function(expression, key, alias){
+ this._expression = expression;
+ this.expression = new dd._Filter(expression);
+ this.key = key;
+ this.alias = alias;
+ },
+ {
+ _push: function(container, grouper, stack){
+ if(stack.length){
+ container.push({ grouper: grouper, list: stack });
+ }
+ },
+ render: function(context, buffer){
+ context[this.alias] = [];
+ var list = this.expression.resolve(context);
+ if(list){
+ var last = null;
+ var stack = [];
+ for(var i = 0; i < list.length; i++){
+ var id = list[i][this.key];
+ if(last !== id){
+ this._push(context[this.alias], last, stack);
+ last = id;
+ stack = [list[i]];
+ }else{
+ stack.push(list[i]);
+ }
+ }
+ this._push(context[this.alias], last, stack);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(context, buffer){
+ return this;
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ cycle: function(parser, token){
+ // summary: Cycle among the given strings each time this tag is encountered
+ var args = token.split_contents();
+
+ if(args.length < 2){
+ throw new Error("'cycle' tag requires at least two arguments");
+ }
+
+ if(args[1].indexOf(",") != -1){
+ var vars = args[1].split(",");
+ args = [args[0]];
+ for(var i = 0; i < vars.length; i++){
+ args.push('"' + vars[i] + '"');
+ }
+ }
+
+ if(args.length == 2){
+ var name = args[args.length - 1];
+
+ if(!parser._namedCycleNodes){
+ throw new Error("No named cycles in template: '" + name + "' is not defined");
+ }
+ if(!parser._namedCycleNodes[name]){
+ throw new Error("Named cycle '" + name + "' does not exist");
+ }
+
+ return parser._namedCycleNodes[name];
+ }
+
+ if(args.length > 4 && args[args.length - 2] == "as"){
+ var name = args[args.length - 1];
+
+ var node = new ddtl.CycleNode(args.slice(1, args.length - 2), name, parser.create_text_node());
+
+ if(!parser._namedCycleNodes){
+ parser._namedCycleNodes = {};
+ }
+ parser._namedCycleNodes[name] = node;
+ }else{
+ node = new ddtl.CycleNode(args.slice(1), null, parser.create_text_node());
+ }
+
+ return node;
+ },
+ ifchanged: function(parser, token){
+ var parts = token.contents.split();
+ var nodes = parser.parse(["endifchanged"]);
+ parser.delete_first_token();
+ return new ddtl.IfChangedNode(nodes, parts.slice(1));
+ },
+ regroup: function(parser, token){
+ var tokens = dojox.string.tokenize(token.contents, /(\s+)/g, function(spaces){
+ return spaces;
+ });
+ if(tokens.length < 11 || tokens[tokens.length - 3] != "as" || tokens[tokens.length - 7] != "by"){
+ throw new Error("Expected the format: regroup list by key as newList");
+ }
+ var expression = tokens.slice(2, -8).join("");
+ var key = tokens[tokens.length - 5];
+ var alias = tokens[tokens.length - 1];
+ return new ddtl.RegroupNode(expression, key, alias);
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojo.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo.date"] = true;
+dojo.provide("dojo.date");
+
+
+dojo.getObject("date", true, dojo);
+
+/*=====
+dojo.date = {
+ // summary: Date manipulation utilities
+}
+=====*/
+
+dojo.date.getDaysInMonth = function(/*Date*/dateObject){
+ // summary:
+ // Returns the number of days in the month used by dateObject
+ var month = dateObject.getMonth();
+ var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+ if(month == 1 && dojo.date.isLeapYear(dateObject)){ return 29; } // Number
+ return days[month]; // Number
+};
+
+dojo.date.isLeapYear = function(/*Date*/dateObject){
+ // summary:
+ // Determines if the year of the dateObject is a leap year
+ // description:
+ // Leap years are years with an additional day YYYY-02-29, where the
+ // year number is a multiple of four with the following exception: If
+ // a year is a multiple of 100, then it is only a leap year if it is
+ // also a multiple of 400. For example, 1900 was not a leap year, but
+ // 2000 is one.
+
+ var year = dateObject.getFullYear();
+ return !(year%400) || (!(year%4) && !!(year%100)); // Boolean
+};
+
+// FIXME: This is not localized
+dojo.date.getTimezoneName = function(/*Date*/dateObject){
+ // summary:
+ // Get the user's time zone as provided by the browser
+ // dateObject:
+ // Needed because the timezone may vary with time (daylight savings)
+ // description:
+ // Try to get time zone info from toString or toLocaleString method of
+ // the Date object -- UTC offset is not a time zone. See
+ // http://www.twinsun.com/tz/tz-link.htm Note: results may be
+ // inconsistent across browsers.
+
+ var str = dateObject.toString(); // Start looking in toString
+ var tz = ''; // The result -- return empty string if nothing found
+ var match;
+
+ // First look for something in parentheses -- fast lookup, no regex
+ var pos = str.indexOf('(');
+ if(pos > -1){
+ tz = str.substring(++pos, str.indexOf(')'));
+ }else{
+ // If at first you don't succeed ...
+ // If IE knows about the TZ, it appears before the year
+ // Capital letters or slash before a 4-digit year
+ // at the end of string
+ var pat = /([A-Z\/]+) \d{4}$/;
+ if((match = str.match(pat))){
+ tz = match[1];
+ }else{
+ // Some browsers (e.g. Safari) glue the TZ on the end
+ // of toLocaleString instead of putting it in toString
+ str = dateObject.toLocaleString();
+ // Capital letters or slash -- end of string,
+ // after space
+ pat = / ([A-Z\/]+)$/;
+ if((match = str.match(pat))){
+ tz = match[1];
+ }
+ }
+ }
+
+ // Make sure it doesn't somehow end up return AM or PM
+ return (tz == 'AM' || tz == 'PM') ? '' : tz; // String
+};
+
+// Utility methods to do arithmetic calculations with Dates
+
+dojo.date.compare = function(/*Date*/date1, /*Date?*/date2, /*String?*/portion){
+ // summary:
+ // Compare two date objects by date, time, or both.
+ // description:
+ // Returns 0 if equal, positive if a > b, else negative.
+ // date1:
+ // Date object
+ // date2:
+ // Date object. If not specified, the current Date is used.
+ // portion:
+ // A string indicating the "date" or "time" portion of a Date object.
+ // Compares both "date" and "time" by default. One of the following:
+ // "date", "time", "datetime"
+
+ // Extra step required in copy for IE - see #3112
+ date1 = new Date(+date1);
+ date2 = new Date(+(date2 || new Date()));
+
+ if(portion == "date"){
+ // Ignore times and compare dates.
+ date1.setHours(0, 0, 0, 0);
+ date2.setHours(0, 0, 0, 0);
+ }else if(portion == "time"){
+ // Ignore dates and compare times.
+ date1.setFullYear(0, 0, 0);
+ date2.setFullYear(0, 0, 0);
+ }
+
+ if(date1 > date2){ return 1; } // int
+ if(date1 < date2){ return -1; } // int
+ return 0; // int
+};
+
+dojo.date.add = function(/*Date*/date, /*String*/interval, /*int*/amount){
+ // summary:
+ // Add to a Date in intervals of different size, from milliseconds to years
+ // date: Date
+ // Date object to start with
+ // interval:
+ // A string representing the interval. One of the following:
+ // "year", "month", "day", "hour", "minute", "second",
+ // "millisecond", "quarter", "week", "weekday"
+ // amount:
+ // How much to add to the date.
+
+ var sum = new Date(+date); // convert to Number before copying to accomodate IE (#3112)
+ var fixOvershoot = false;
+ var property = "Date";
+
+ switch(interval){
+ case "day":
+ break;
+ case "weekday":
+ //i18n FIXME: assumes Saturday/Sunday weekend, but this is not always true. see dojo.cldr.supplemental
+
+ // Divide the increment time span into weekspans plus leftover days
+ // e.g., 8 days is one 5-day weekspan / and two leftover days
+ // Can't have zero leftover days, so numbers divisible by 5 get
+ // a days value of 5, and the remaining days make up the number of weeks
+ var days, weeks;
+ var mod = amount % 5;
+ if(!mod){
+ days = (amount > 0) ? 5 : -5;
+ weeks = (amount > 0) ? ((amount-5)/5) : ((amount+5)/5);
+ }else{
+ days = mod;
+ weeks = parseInt(amount/5);
+ }
+ // Get weekday value for orig date param
+ var strt = date.getDay();
+ // Orig date is Sat / positive incrementer
+ // Jump over Sun
+ var adj = 0;
+ if(strt == 6 && amount > 0){
+ adj = 1;
+ }else if(strt == 0 && amount < 0){
+ // Orig date is Sun / negative incrementer
+ // Jump back over Sat
+ adj = -1;
+ }
+ // Get weekday val for the new date
+ var trgt = strt + days;
+ // New date is on Sat or Sun
+ if(trgt == 0 || trgt == 6){
+ adj = (amount > 0) ? 2 : -2;
+ }
+ // Increment by number of weeks plus leftover days plus
+ // weekend adjustments
+ amount = (7 * weeks) + days + adj;
+ break;
+ case "year":
+ property = "FullYear";
+ // Keep increment/decrement from 2/29 out of March
+ fixOvershoot = true;
+ break;
+ case "week":
+ amount *= 7;
+ break;
+ case "quarter":
+ // Naive quarter is just three months
+ amount *= 3;
+ // fallthrough...
+ case "month":
+ // Reset to last day of month if you overshoot
+ fixOvershoot = true;
+ property = "Month";
+ break;
+// case "hour":
+// case "minute":
+// case "second":
+// case "millisecond":
+ default:
+ property = "UTC"+interval.charAt(0).toUpperCase() + interval.substring(1) + "s";
+ }
+
+ if(property){
+ sum["set"+property](sum["get"+property]()+amount);
+ }
+
+ if(fixOvershoot && (sum.getDate() < date.getDate())){
+ sum.setDate(0);
+ }
+
+ return sum; // Date
+};
+
+dojo.date.difference = function(/*Date*/date1, /*Date?*/date2, /*String?*/interval){
+ // summary:
+ // Get the difference in a specific unit of time (e.g., number of
+ // months, weeks, days, etc.) between two dates, rounded to the
+ // nearest integer.
+ // date1:
+ // Date object
+ // date2:
+ // Date object. If not specified, the current Date is used.
+ // interval:
+ // A string representing the interval. One of the following:
+ // "year", "month", "day", "hour", "minute", "second",
+ // "millisecond", "quarter", "week", "weekday"
+ // Defaults to "day".
+
+ date2 = date2 || new Date();
+ interval = interval || "day";
+ var yearDiff = date2.getFullYear() - date1.getFullYear();
+ var delta = 1; // Integer return value
+
+ switch(interval){
+ case "quarter":
+ var m1 = date1.getMonth();
+ var m2 = date2.getMonth();
+ // Figure out which quarter the months are in
+ var q1 = Math.floor(m1/3) + 1;
+ var q2 = Math.floor(m2/3) + 1;
+ // Add quarters for any year difference between the dates
+ q2 += (yearDiff * 4);
+ delta = q2 - q1;
+ break;
+ case "weekday":
+ var days = Math.round(dojo.date.difference(date1, date2, "day"));
+ var weeks = parseInt(dojo.date.difference(date1, date2, "week"));
+ var mod = days % 7;
+
+ // Even number of weeks
+ if(mod == 0){
+ days = weeks*5;
+ }else{
+ // Weeks plus spare change (< 7 days)
+ var adj = 0;
+ var aDay = date1.getDay();
+ var bDay = date2.getDay();
+
+ weeks = parseInt(days/7);
+ mod = days % 7;
+ // Mark the date advanced by the number of
+ // round weeks (may be zero)
+ var dtMark = new Date(date1);
+ dtMark.setDate(dtMark.getDate()+(weeks*7));
+ var dayMark = dtMark.getDay();
+
+ // Spare change days -- 6 or less
+ if(days > 0){
+ switch(true){
+ // Range starts on Sat
+ case aDay == 6:
+ adj = -1;
+ break;
+ // Range starts on Sun
+ case aDay == 0:
+ adj = 0;
+ break;
+ // Range ends on Sat
+ case bDay == 6:
+ adj = -1;
+ break;
+ // Range ends on Sun
+ case bDay == 0:
+ adj = -2;
+ break;
+ // Range contains weekend
+ case (dayMark + mod) > 5:
+ adj = -2;
+ }
+ }else if(days < 0){
+ switch(true){
+ // Range starts on Sat
+ case aDay == 6:
+ adj = 0;
+ break;
+ // Range starts on Sun
+ case aDay == 0:
+ adj = 1;
+ break;
+ // Range ends on Sat
+ case bDay == 6:
+ adj = 2;
+ break;
+ // Range ends on Sun
+ case bDay == 0:
+ adj = 1;
+ break;
+ // Range contains weekend
+ case (dayMark + mod) < 0:
+ adj = 2;
+ }
+ }
+ days += adj;
+ days -= (weeks*2);
+ }
+ delta = days;
+ break;
+ case "year":
+ delta = yearDiff;
+ break;
+ case "month":
+ delta = (date2.getMonth() - date1.getMonth()) + (yearDiff * 12);
+ break;
+ case "week":
+ // Truncate instead of rounding
+ // Don't use Math.floor -- value may be negative
+ delta = parseInt(dojo.date.difference(date1, date2, "day")/7);
+ break;
+ case "day":
+ delta /= 24;
+ // fallthrough
+ case "hour":
+ delta /= 60;
+ // fallthrough
+ case "minute":
+ delta /= 60;
+ // fallthrough
+ case "second":
+ delta /= 1000;
+ // fallthrough
+ case "millisecond":
+ delta *= date2.getTime() - date1.getTime();
+ }
+
+ // Round for fractional values and DST leaps
+ return Math.round(delta); // Number (integer)
+};
+
+}
+
+if(!dojo._hasResource["dojox.date.php"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.date.php"] = true;
+dojo.provide("dojox.date.php");
+
+
+
+dojox.date.php.format = function(/*Date*/ date, /*String*/ format){
+ // summary: Get a formatted string for a given date object
+ var df = new dojox.date.php.DateFormat(format);
+ return df.format(date);
+}
+
+dojox.date.php.DateFormat = function(/*String*/ format){
+ // summary: Format the internal date object
+ if(!this.regex){
+ var keys = [];
+ for(var key in this.constructor.prototype){
+ if(dojo.isString(key) && key.length == 1 && dojo.isFunction(this[key])){
+ keys.push(key);
+ }
+ }
+ this.constructor.prototype.regex = new RegExp("(?:(\\\\.)|([" + keys.join("") + "]))", "g");
+ }
+
+ var replacements = [];
+
+ this.tokens = dojox.string.tokenize(format, this.regex, function(escape, token, i){
+ if(token){
+ replacements.push([i, token]);
+ return token;
+ }
+ if(escape){
+ return escape.charAt(1);
+ }
+ });
+
+ this.replacements = replacements;
+}
+dojo.extend(dojox.date.php.DateFormat, {
+ weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
+ weekdays_3: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
+ months_3: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
+ monthdays: [31,28,31,30,31,30,31,31,30,31,30,31],
+
+ format: function(/*Date*/ date){
+ this.date = date;
+ for(var i = 0, replacement; replacement = this.replacements[i]; i++){
+ this.tokens[replacement[0]] = this[replacement[1]]();
+ }
+ return this.tokens.join("");
+ },
+
+ // Day
+
+ d: function(){
+ // summary: Day of the month, 2 digits with leading zeros
+ var j = this.j();
+ return (j.length == 1) ? "0" + j : j;
+ },
+
+ D: function(){
+ // summary: A textual representation of a day, three letters
+ return this.weekdays_3[this.date.getDay()];
+ },
+
+ j: function(){
+ // summary: Day of the month without leading zeros
+ return this.date.getDate() + "";
+ },
+
+ l: function(){
+ // summary: A full textual representation of the day of the week
+ return this.weekdays[this.date.getDay()];
+ },
+
+ N: function(){
+ // summary: ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)
+ var w = this.w();
+ return (!w) ? 7 : w;
+ },
+
+ S: function(){
+ // summary: English ordinal suffix for the day of the month, 2 characters
+ switch(this.date.getDate()){
+ case 11: case 12: case 13: return "th";
+ case 1: case 21: case 31: return "st";
+ case 2: case 22: return "nd";
+ case 3: case 23: return "rd";
+ default: return "th";
+ }
+ },
+
+ w: function(){
+ // summary: Numeric representation of the day of the week
+ return this.date.getDay() + "";
+ },
+
+ z: function(){
+ // summary: The day of the year (starting from 0)
+ var millis = this.date.getTime() - new Date(this.date.getFullYear(), 0, 1).getTime();
+ return Math.floor(millis/86400000) + "";
+ },
+
+ // Week
+
+ W: function(){
+ // summary: ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)
+ var week;
+ var jan1_w = new Date(this.date.getFullYear(), 0, 1).getDay() + 1;
+ var w = this.date.getDay() + 1;
+ var z = parseInt(this.z());
+
+ if(z <= (8 - jan1_w) && jan1_w > 4){
+ var last_year = new Date(this.date.getFullYear() - 1, this.date.getMonth(), this.date.getDate());
+ if(jan1_w == 5 || (jan1_w == 6 && dojo.date.isLeapYear(last_year))){
+ week = 53;
+ }else{
+ week = 52;
+ }
+ }else{
+ var i;
+ if(Boolean(this.L())){
+ i = 366;
+ }else{
+ i = 365;
+ }
+ if((i - z) < (4 - w)){
+ week = 1;
+ }else{
+ var j = z + (7 - w) + (jan1_w - 1);
+ week = Math.ceil(j / 7);
+ if(jan1_w > 4){
+ --week;
+ }
+ }
+ }
+
+ return week;
+ },
+
+ // Month
+
+ F: function(){
+ // summary: A full textual representation of a month, such as January or March
+ return this.months[this.date.getMonth()];
+ },
+
+ m: function(){
+ // summary: Numeric representation of a month, with leading zeros
+ var n = this.n();
+ return (n.length == 1) ? "0" + n : n;
+ },
+
+ M: function(){
+ // summary: A short textual representation of a month, three letters
+ return this.months_3[this.date.getMonth()];
+ },
+
+ n: function(){
+ // summary: Numeric representation of a month, without leading zeros
+ return this.date.getMonth() + 1 + "";
+ },
+
+ t: function(){
+ // summary: Number of days in the given month
+ return (Boolean(this.L()) && this.date.getMonth() == 1) ? 29 : this.monthdays[this.getMonth()];
+ },
+
+ // Year
+
+ L: function(){
+ // summary: Whether it's a leap year
+ return (dojo.date.isLeapYear(this.date)) ? "1" : "0";
+ },
+
+ o: function(){
+ // summary:
+ // ISO-8601 year number. This has the same value as Y, except that if
+ // the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)
+ // TODO: Figure out what this means
+ },
+
+ Y: function(){
+ // summary: A full numeric representation of a year, 4 digits
+ return this.date.getFullYear() + "";
+ },
+
+ y: function(){
+ // summary: A two digit representation of a year
+ return this.Y().slice(-2);
+ },
+
+ // Time
+
+ a: function(){
+ // summary: Lowercase Ante meridiem and Post meridiem
+ return this.date.getHours() >= 12 ? "pm" : "am";
+ },
+
+ b: function(){
+ // summary: Uppercase Ante meridiem and Post meridiem
+ return this.a().toUpperCase();
+ },
+
+ B: function(){
+ // summary:
+ // Swatch Internet time
+ // A day is 1,000 beats. All time is measured from GMT + 1
+ var off = this.date.getTimezoneOffset() + 60;
+ var secs = (this.date.getHours() * 3600) + (this.date.getMinutes() * 60) + this.getSeconds() + (off * 60);
+ var beat = Math.abs(Math.floor(secs / 86.4) % 1000) + "";
+ while(beat.length < 2) beat = "0" + beat;
+ return beat;
+ },
+
+ g: function(){
+ // summary: 12-hour format of an hour without leading zeros
+ return (this.date.getHours() > 12) ? this.date.getHours() - 12 + "" : this.date.getHours() + "";
+ },
+
+ G: function(){
+ // summary: 24-hour format of an hour without leading zeros
+ return this.date.getHours() + "";
+ },
+
+ h: function(){
+ // summary: 12-hour format of an hour with leading zeros
+ var g = this.g();
+ return (g.length == 1) ? "0" + g : g;
+ },
+
+ H: function(){
+ // summary: 24-hour format of an hour with leading zeros
+ var G = this.G();
+ return (G.length == 1) ? "0" + G : G;
+ },
+
+ i: function(){
+ // summary: Minutes with leading zeros
+ var mins = this.date.getMinutes() + "";
+ return (mins.length == 1) ? "0" + mins : mins;
+ },
+
+ s: function(){
+ // summary: Seconds, with leading zeros
+ var secs = this.date.getSeconds() + "";
+ return (secs.length == 1) ? "0" + secs : secs;
+ },
+
+ // Timezone
+
+ e: function(){
+ // summary: Timezone identifier (added in PHP 5.1.0)
+ return dojo.date.getTimezoneName(this.date);
+ },
+
+ I: function(){
+ // summary: Whether or not the date is in daylight saving time
+ // TODO: Can dojo.date do this?
+ },
+
+ O: function(){
+ // summary: Difference to Greenwich time (GMT) in hours
+ var off = Math.abs(this.date.getTimezoneOffset());
+ var hours = Math.floor(off / 60) + "";
+ var mins = (off % 60) + "";
+ if(hours.length == 1) hours = "0" + hours;
+ if(mins.length == 1) hours = "0" + mins;
+ return ((this.date.getTimezoneOffset() < 0) ? "+" : "-") + hours + mins;
+ },
+
+ P: function(){
+ // summary: Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)
+ var O = this.O();
+ return O.substring(0, 2) + ":" + O.substring(2, 4);
+ },
+
+ T: function(){
+ // summary: Timezone abbreviation
+
+ // Guess...
+ return this.e().substring(0, 3);
+ },
+
+ Z: function(){
+ // summary:
+ // Timezone offset in seconds. The offset for timezones west of UTC is always negative,
+ // and for those east of UTC is always positive.
+ return this.date.getTimezoneOffset() * -60;
+ },
+
+ // Full Date/Time
+
+ c: function(){
+ // summary: ISO 8601 date (added in PHP 5)
+ return this.Y() + "-" + this.m() + "-" + this.d() + "T" + this.h() + ":" + this.i() + ":" + this.s() + this.P();
+ },
+
+ r: function(){
+ // summary: RFC 2822 formatted date
+ return this.D() + ", " + this.d() + " " + this.M() + " " + this.Y() + " " + this.H() + ":" + this.i() + ":" + this.s() + " " + this.O();
+ },
+
+ U: function(){
+ // summary: Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
+ return Math.floor(this.date.getTime() / 1000);
+ }
+
+});
+
+}
+
+if(!dojo._hasResource["dojox.dtl.utils.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.utils.date"] = true;
+dojo.provide("dojox.dtl.utils.date");
+
+
+
+dojox.dtl.utils.date.DateFormat = function(/*String*/ format){
+ dojox.date.php.DateFormat.call(this, format);
+}
+dojo.extend(dojox.dtl.utils.date.DateFormat, dojox.date.php.DateFormat.prototype, {
+ f: function(){
+ // summary:
+ // Time, in 12-hour hours and minutes, with minutes left off if they're zero.
+ // description:
+ // Examples: '1', '1:30', '2:05', '2'
+ // Proprietary extension.
+ return (!this.date.getMinutes()) ? this.g() : this.g() + ":" + this.i();
+ },
+ N: function(){
+ // summary: Month abbreviation in Associated Press style. Proprietary extension.
+ return dojox.dtl.utils.date._months_ap[this.date.getMonth()];
+ },
+ P: function(){
+ // summary:
+ // Time, in 12-hour hours, minutes and 'a.m.'/'p.m.', with minutes left off
+ // if they're zero and the strings 'midnight' and 'noon' if appropriate.
+ // description:
+ // Examples: '1 a.m.', '1:30 p.m.', 'midnight', 'noon', '12:30 p.m.'
+ // Proprietary extension.
+ if(!this.date.getMinutes() && !this.date.getHours()){
+ return 'midnight';
+ }
+ if(!this.date.getMinutes() && this.date.getHours() == 12){
+ return 'noon';
+ }
+ return this.f() + " " + this.a();
+ }
+});
+
+dojo.mixin(dojox.dtl.utils.date, {
+ format: function(/*Date*/ date, /*String*/ format){
+ var df = new dojox.dtl.utils.date.DateFormat(format);
+ return df.format(date);
+ },
+ timesince: function(d, now){
+ // summary:
+ // Takes two datetime objects and returns the time between then and now
+ // as a nicely formatted string, e.g "10 minutes"
+ // description:
+ // Adapted from http://blog.natbat.co.uk/archive/2003/Jun/14/time_since
+ if(!(d instanceof Date)){
+ d = new Date(d.year, d.month, d.day);
+ }
+ if(!now){
+ now = new Date();
+ }
+
+ var delta = Math.abs(now.getTime() - d.getTime());
+ for(var i = 0, chunk; chunk = dojox.dtl.utils.date._chunks[i]; i++){
+ var count = Math.floor(delta / chunk[0]);
+ if(count) break;
+ }
+ return count + " " + chunk[1](count);
+ },
+ _chunks: [
+ [60 * 60 * 24 * 365 * 1000, function(n){ return (n == 1) ? 'year' : 'years'; }],
+ [60 * 60 * 24 * 30 * 1000, function(n){ return (n == 1) ? 'month' : 'months'; }],
+ [60 * 60 * 24 * 7 * 1000, function(n){ return (n == 1) ? 'week' : 'weeks'; }],
+ [60 * 60 * 24 * 1000, function(n){ return (n == 1) ? 'day' : 'days'; }],
+ [60 * 60 * 1000, function(n){ return (n == 1) ? 'hour' : 'hours'; }],
+ [60 * 1000, function(n){ return (n == 1) ? 'minute' : 'minutes'; }]
+ ],
+ _months_ap: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."]
+});
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.date"] = true;
+dojo.provide("dojox.dtl.tag.date");
+
+
+
+
+dojox.dtl.tag.date.NowNode = function(format, node){
+ this._format = format;
+ this.format = new dojox.dtl.utils.date.DateFormat(format);
+ this.contents = node;
+}
+dojo.extend(dojox.dtl.tag.date.NowNode, {
+ render: function(context, buffer){
+ this.contents.set(this.format.format(new Date()));
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._format, this.contents.clone(buffer));
+ }
+});
+
+dojox.dtl.tag.date.now = function(parser, token){
+ // Split by either :" or :'
+ var parts = token.split_contents();
+ if(parts.length != 2){
+ throw new Error("'now' statement takes one argument");
+ }
+ return new dojox.dtl.tag.date.NowNode(parts[1].slice(1, -1), parser.create_text_node());
+}
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loader"] = true;
+dojo.provide("dojox.dtl.tag.loader");
+
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loader;
+
+ ddtl.BlockNode = dojo.extend(function(name, nodelist){
+ this.name = name;
+ this.nodelist = nodelist; // Can be overridden
+ },
+ {
+ "super": function(){
+ if(this.parent){
+ var html = this.parent.nodelist.dummyRender(this.context, null, true);
+ if(typeof html == "string"){
+ html = new String(html);
+ }
+ html.safe = true;
+ return html;
+ }
+ return '';
+ },
+ render: function(context, buffer){
+ var name = this.name;
+ var nodelist = this.nodelist;
+ var parent;
+ if(buffer.blocks){
+ var block = buffer.blocks[name];
+ if(block){
+ parent = block.parent;
+ nodelist = block.nodelist;
+ block.used = true;
+ }
+ }
+
+ this.rendered = nodelist;
+
+ context = context.push();
+ this.context = context;
+ this.parent = null;
+ if(nodelist != this.nodelist){
+ this.parent = this;
+ }
+ context.block = this;
+
+ if(buffer.getParent){
+ var bufferParent = buffer.getParent();
+ var setParent = dojo.connect(buffer, "onSetParent", function(node, up, root){
+ if(up && root){
+ buffer.setParent(bufferParent);
+ }
+ });
+ }
+ buffer = nodelist.render(context, buffer, this);
+ setParent && dojo.disconnect(setParent);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.name, this.nodelist.clone(buffer));
+ },
+ toString: function(){ return "dojox.dtl.tag.loader.BlockNode"; }
+ });
+
+ ddtl.ExtendsNode = dojo.extend(function(getTemplate, nodelist, shared, parent, key){
+ this.getTemplate = getTemplate;
+ this.nodelist = nodelist;
+ this.shared = shared;
+ this.parent = parent;
+ this.key = key;
+ },
+ {
+ parents: {},
+ getParent: function(context){
+ var parent = this.parent;
+ if(!parent){
+ var string;
+ parent = this.parent = context.get(this.key, false);
+ if(!parent){
+ throw new Error("extends tag used a variable that did not resolve");
+ }
+ if(typeof parent == "object"){
+ var url = parent.url || parent.templatePath;
+ if(parent.shared){
+ this.shared = true;
+ }
+ if(url){
+ parent = this.parent = url.toString();
+ }else if(parent.templateString){
+ // Allow the builder's string interning to work
+ string = parent.templateString;
+ parent = this.parent = " ";
+ }else{
+ parent = this.parent = this.parent.toString();
+ }
+ }
+ if(parent && parent.indexOf("shared:") === 0){
+ this.shared = true;
+ parent = this.parent = parent.substring(7, parent.length);
+ }
+ }
+ if(!parent){
+ throw new Error("Invalid template name in 'extends' tag.");
+ }
+ if(parent.render){
+ return parent;
+ }
+ if(this.parents[parent]){
+ return this.parents[parent];
+ }
+ this.parent = this.getTemplate(string || dojox.dtl.text.getTemplateString(parent));
+ if(this.shared){
+ this.parents[parent] = this.parent;
+ }
+ return this.parent;
+ },
+ render: function(context, buffer){
+ var parent = this.getParent(context);
+
+ parent.blocks = parent.blocks || {};
+ buffer.blocks = buffer.blocks || {};
+
+ for(var i = 0, node; node = this.nodelist.contents[i]; i++){
+ if(node instanceof dojox.dtl.tag.loader.BlockNode){
+ var old = parent.blocks[node.name];
+ if(old && old.nodelist != node.nodelist){
+ // In a shared template, the individual blocks might change
+ buffer = old.nodelist.unrender(context, buffer);
+ }
+ parent.blocks[node.name] = buffer.blocks[node.name] = {
+ shared: this.shared,
+ nodelist: node.nodelist,
+ used: false
+ }
+ }
+ }
+
+ this.rendered = parent;
+ return parent.nodelist.render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer, this);
+ },
+ toString: function(){ return "dojox.dtl.block.ExtendsNode"; }
+ });
+
+ ddtl.IncludeNode = dojo.extend(function(path, constant, getTemplate, text, parsed){
+ this._path = path;
+ this.constant = constant;
+ this.path = (constant) ? path : new dd._Filter(path);
+ this.getTemplate = getTemplate;
+ this.text = text;
+ this.parsed = (arguments.length == 5) ? parsed : true;
+ },
+ {
+ _cache: [{}, {}],
+ render: function(context, buffer){
+ var location = ((this.constant) ? this.path : this.path.resolve(context)).toString();
+ var parsed = Number(this.parsed);
+ var dirty = false;
+ if(location != this.last){
+ dirty = true;
+ if(this.last){
+ buffer = this.unrender(context, buffer);
+ }
+ this.last = location;
+ }
+
+ var cache = this._cache[parsed];
+
+ if(parsed){
+ if(!cache[location]){
+ cache[location] = dd.text._resolveTemplateArg(location, true);
+ }
+ if(dirty){
+ var template = this.getTemplate(cache[location]);
+ this.rendered = template.nodelist;
+ }
+ return this.rendered.render(context, buffer, this);
+ }else{
+ if(this.text instanceof dd._TextNode){
+ if(dirty){
+ this.rendered = this.text;
+ this.rendered.set(dd.text._resolveTemplateArg(location, true));
+ }
+ return this.rendered.render(context, buffer);
+ }else{
+ if(!cache[location]){
+ var nodelist = [];
+ var div = document.createElement("div");
+ div.innerHTML = dd.text._resolveTemplateArg(location, true);
+ var children = div.childNodes;
+ while(children.length){
+ var removed = div.removeChild(children[0]);
+ nodelist.push(removed);
+ }
+ cache[location] = nodelist;
+ }
+ if(dirty){
+ this.nodelist = [];
+ var exists = true;
+ for(var i = 0, child; child = cache[location][i]; i++){
+ this.nodelist.push(child.cloneNode(true));
+ }
+ }
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.concat(node);
+ }
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ if(this.rendered){
+ buffer = this.rendered.unrender(context, buffer);
+ }
+ if(this.nodelist){
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.remove(node);
+ }
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._path, this.constant, this.getTemplate, this.text.clone(buffer), this.parsed);
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ block: function(parser, token){
+ var parts = token.contents.split();
+ var name = parts[1];
+
+ parser._blocks = parser._blocks || {};
+ parser._blocks[name] = parser._blocks[name] || [];
+ parser._blocks[name].push(name);
+
+ var nodelist = parser.parse(["endblock", "endblock " + name]).rtrim();
+ parser.next_token();
+ return new dojox.dtl.tag.loader.BlockNode(name, nodelist);
+ },
+ extends_: function(parser, token){
+ var parts = token.contents.split();
+ var shared = false;
+ var parent = null;
+ var key = null;
+ if(parts[1].charAt(0) == '"' || parts[1].charAt(0) == "'"){
+ parent = parts[1].substring(1, parts[1].length - 1);
+ }else{
+ key = parts[1];
+ }
+ if(parent && parent.indexOf("shared:") == 0){
+ shared = true;
+ parent = parent.substring(7, parent.length);
+ }
+ var nodelist = parser.parse();
+ return new dojox.dtl.tag.loader.ExtendsNode(parser.getTemplate, nodelist, shared, parent, key);
+ },
+ include: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error(parts[0] + " tag takes one argument: the name of the template to be included");
+ }
+ var path = parts[1];
+ var constant = false;
+ if((path.charAt(0) == '"' || path.slice(-1) == "'") && path.charAt(0) == path.slice(-1)){
+ path = path.slice(1, -1);
+ constant = true;
+ }
+ return new ddtl.IncludeNode(path, constant, parser.getTemplate, parser.create_text_node());
+ },
+ ssi: function(parser, token){
+ // We're going to treat things a little differently here.
+ // First of all, this tag is *not* portable, so I'm not
+ // concerned about it being a "drop in" replacement.
+
+ // Instead, we'll just replicate the include tag, but with that
+ // optional "parsed" parameter.
+ var parts = token.contents.split();
+ var parsed = false;
+ if(parts.length == 3){
+ parsed = (parts.pop() == "parsed");
+ if(!parsed){
+ throw new Error("Second (optional) argument to ssi tag must be 'parsed'");
+ }
+ }
+ var node = ddtl.include(parser, new dd.Token(token.token_type, parts.join(" ")));
+ node.parsed = parsed;
+ return node;
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.misc"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.misc"] = true;
+dojo.provide("dojox.dtl.tag.misc");
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtm = dd.tag.misc;
+
+ ddtm.DebugNode = dojo.extend(function(text){
+ this.text = text;
+ },
+ {
+ render: function(context, buffer){
+ var keys = context.getKeys();
+ var debug = [];
+ var only = {};
+ for(var i = 0, key; key = keys[i]; i++){
+ only[key] = context[key];
+ debug += "[" + key + ": " + typeof context[key] + "]\n";
+ }
+ console.debug(only);
+ return this.text.set(debug).render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.text.clone(buffer));
+ },
+ toString: function(){ return "ddtm.DebugNode"; }
+ });
+
+ ddtm.FilterNode = dojo.extend(function(varnode, nodelist){
+ this._varnode = varnode;
+ this._nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ // Doing this in HTML requires a different buffer with a fake root node
+ var output = this._nodelist.render(context, new dojox.string.Builder());
+ context = context.update({ "var": output.toString() });
+ var filtered = this._varnode.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._expression, this._nodelist.clone(buffer));
+ }
+ });
+
+ ddtm.FirstOfNode = dojo.extend(function(vars, text){
+ this._vars = vars;
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ for(var i = 0, item; item = this.vars[i]; i++){
+ var resolved = item.resolve(context);
+ if(typeof resolved != "undefined"){
+ if(resolved === null){
+ resolved = "null";
+ }
+ this.contents.set(resolved);
+ return this.contents.render(context, buffer);
+ }
+ }
+ return this.contents.unrender(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._vars, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.SpacelessNode = dojo.extend(function(nodelist, text){
+ this.nodelist = nodelist;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ if(buffer.getParent){
+ // Unfortunately, we have to branch here
+ var watch = [
+ dojo.connect(buffer, "onAddNodeComplete", this, "_watch"),
+ dojo.connect(buffer, "onSetParent", this, "_watchParent")
+ ];
+ buffer = this.nodelist.render(context, buffer);
+ dojo.disconnect(watch[0]);
+ dojo.disconnect(watch[1]);
+ }else{
+ var value = this.nodelist.dummyRender(context);
+ this.contents.set(value.replace(/>\s+</g, '><'));
+ buffer = this.contents.render(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodelist.clone(buffer), this.contents.clone(buffer));
+ },
+ _isEmpty: function(node){
+ return (node.nodeType == 3 && !node.data.match(/[^\s\n]/));
+ },
+ _watch: function(node){
+ if(this._isEmpty(node)){
+ var remove = false;
+ if(node.parentNode.firstChild == node){
+ node.parentNode.removeChild(node);
+ }
+ }else{
+ var children = node.parentNode.childNodes;
+ if(node.nodeType == 1 && children.length > 2){
+ for(var i = 2, child; child = children[i]; i++){
+ if(children[i - 2].nodeType == 1 && this._isEmpty(children[i - 1])){
+ node.parentNode.removeChild(children[i - 1]);
+ return;
+ }
+ }
+ }
+ }
+ },
+ _watchParent: function(node){
+ var children = node.childNodes;
+ if(children.length){
+ while(node.childNodes.length){
+ var last = node.childNodes[node.childNodes.length - 1];
+ if(!this._isEmpty(last)){
+ return;
+ }
+ node.removeChild(last);
+ }
+ }
+ }
+ });
+
+ ddtm.TemplateTagNode = dojo.extend(function(tag, text){
+ this.tag = tag;
+ this.contents = text;
+ },
+ {
+ mapping: {
+ openblock: "{%",
+ closeblock: "%}",
+ openvariable: "{{",
+ closevariable: "}}",
+ openbrace: "{",
+ closebrace: "}",
+ opencomment: "{#",
+ closecomment: "#}"
+ },
+ render: function(context, buffer){
+ this.contents.set(this.mapping[this.tag]);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.tag, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WidthRatioNode = dojo.extend(function(current, max, width, text){
+ this.current = new dd._Filter(current);
+ this.max = new dd._Filter(max);
+ this.width = width;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ var current = +this.current.resolve(context);
+ var max = +this.max.resolve(context);
+ if(typeof current != "number" || typeof max != "number" || !max){
+ this.contents.set("");
+ }else{
+ this.contents.set("" + Math.round((current / max) * this.width));
+ }
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.current.getExpression(), this.max.getExpression(), this.width, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WithNode = dojo.extend(function(target, alias, nodelist){
+ this.target = new dd._Filter(target);
+ this.alias = alias;
+ this.nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ var target = this.target.resolve(context);
+ context = context.push();
+ context[this.alias] = target;
+ buffer = this.nodelist.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.target.getExpression(), this.alias, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtm, {
+ comment: function(parser, token){
+ // summary: Ignore everything between {% comment %} and {% endcomment %}
+ parser.skip_past("endcomment");
+ return dd._noOpNode;
+ },
+ debug: function(parser, token){
+ // summary: Output the current context, maybe add more stuff later.
+ return new ddtm.DebugNode(parser.create_text_node());
+ },
+ filter: function(parser, token){
+ // summary: Filter the contents of the blog through variable filters.
+ var rest = token.contents.split(null, 1)[1];
+ var varnode = parser.create_variable_node("var|" + rest);
+ var nodelist = parser.parse(["endfilter"]);
+ parser.next_token();
+ return new ddtm.FilterNode(varnode, nodelist);
+ },
+ firstof: function(parser, token){
+ var parts = token.split_contents().slice(1);
+ if(!parts.length){
+ throw new Error("'firstof' statement requires at least one argument");
+ }
+ return new ddtm.FirstOfNode(parts, parser.create_text_node());
+ },
+ spaceless: function(parser, token){
+ var nodelist = parser.parse(["endspaceless"]);
+ parser.delete_first_token();
+ return new ddtm.SpacelessNode(nodelist, parser.create_text_node());
+ },
+ templatetag: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error("'templatetag' statement takes one argument");
+ }
+ var tag = parts[1];
+ var mapping = ddtm.TemplateTagNode.prototype.mapping;
+ if(!mapping[tag]){
+ var keys = [];
+ for(var key in mapping){
+ keys.push(key);
+ }
+ throw new Error("Invalid templatetag argument: '" + tag + "'. Must be one of: " + keys.join(", "));
+ }
+ return new ddtm.TemplateTagNode(tag, parser.create_text_node());
+ },
+ widthratio: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 4){
+ throw new Error("widthratio takes three arguments");
+ }
+ var width = +parts[3];
+ if(typeof width != "number"){
+ throw new Error("widthratio final argument must be an integer");
+ }
+ return new ddtm.WidthRatioNode(parts[1], parts[2], width, parser.create_text_node());
+ },
+ with_: function(parser, token){
+ var parts = token.split_contents();
+ if(parts.length != 4 || parts[2] != "as"){
+ throw new Error("do_width expected format as 'with value as name'");
+ }
+ var nodelist = parser.parse(["endwith"]);
+ parser.next_token();
+ return new ddtm.WithNode(parts[1], parts[3], nodelist);
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl.ext-dojo.NodeList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.ext-dojo.NodeList"] = true;
+dojo.provide("dojox.dtl.ext-dojo.NodeList");
+
+
+dojo.extend(dojo.NodeList, {
+ dtl: function(template, context){
+ // template: dojox.dtl.__StringArgs|String
+ // The template string or location
+ // context: dojox.dtl.__ObjectArgs|Object
+ // The context object or location
+ var d = dojox.dtl;
+
+ var self = this;
+ var render = function(template, context){
+ var content = template.render(new d._Context(context));
+ self.forEach(function(node){
+ node.innerHTML = content;
+ });
+ }
+
+ d.text._resolveTemplateArg(template).addCallback(function(templateString){
+ template = new d.Template(templateString);
+ d.text._resolveContextArg(context).addCallback(function(context){
+ render(template, context);
+ });
+ });
+
+ return this;
+ }
+});
+
+}
+
diff --git a/js/dojo-1.6/dojox/dtl.xd.js b/js/dojo-1.6/dojox/dtl.xd.js new file mode 100644 index 0000000..c5a2797 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl.xd.js @@ -0,0 +1,14 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+/*
+ This is an optimized version of Dojo, built for deployment and not for
+ development. To get sources and documentation, please visit:
+
+ http://dojotoolkit.org
+*/
+
+dojo._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.string.Builder"],["provide","dojox.string.tokenize"],["provide","dojox.dtl._base"],["provide","dojox.dtl"],["provide","dojox.dtl.Context"],["provide","dojox.dtl.tag.logic"],["provide","dojox.dtl.tag.loop"],["provide","dojo.date"],["provide","dojox.date.php"],["provide","dojox.dtl.utils.date"],["provide","dojox.dtl.tag.date"],["provide","dojox.dtl.tag.loader"],["provide","dojox.dtl.tag.misc"],["provide","dojox.dtl.ext-dojo.NodeList"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.string.Builder"]){_4._hasResource["dojox.string.Builder"]=true;_4.provide("dojox.string.Builder");_6.string.Builder=function(_7){var b="";this.length=0;this.append=function(s){if(arguments.length>1){var _8="",l=arguments.length;switch(l){case 9:_8=""+arguments[8]+_8;case 8:_8=""+arguments[7]+_8;case 7:_8=""+arguments[6]+_8;case 6:_8=""+arguments[5]+_8;case 5:_8=""+arguments[4]+_8;case 4:_8=""+arguments[3]+_8;case 3:_8=""+arguments[2]+_8;case 2:b+=""+arguments[0]+arguments[1]+_8;break;default:var i=0;while(i<arguments.length){_8+=arguments[i++];}b+=_8;}}else{b+=s;}this.length=b.length;return this;};this.concat=function(s){return this.append.apply(this,arguments);};this.appendArray=function(_9){return this.append.apply(this,_9);};this.clear=function(){b="";this.length=0;return this;};this.replace=function(_a,_b){b=b.replace(_a,_b);this.length=b.length;return this;};this.remove=function(_c,_d){if(_d===undefined){_d=b.length;}if(_d==0){return this;}b=b.substr(0,_c)+b.substr(_c+_d);this.length=b.length;return this;};this.insert=function(_e,_f){if(_e==0){b=_f+b;}else{b=b.slice(0,_e)+_f+b.slice(_e);}this.length=b.length;return this;};this.toString=function(){return b;};if(_7){this.append(_7);}};}if(!_4._hasResource["dojox.string.tokenize"]){_4._hasResource["dojox.string.tokenize"]=true;_4.provide("dojox.string.tokenize");_6.string.tokenize=function(str,re,_10,_11){var _12=[];var _13,_14,_15=0;while(_13=re.exec(str)){_14=str.slice(_15,re.lastIndex-_13[0].length);if(_14.length){_12.push(_14);}if(_10){if(_4.isOpera){var _16=_13.slice(0);while(_16.length<_13.length){_16.push(null);}_13=_16;}var _17=_10.apply(_11,_13.slice(1).concat(_12.length));if(typeof _17!="undefined"){_12.push(_17);}}_15=re.lastIndex;}_14=str.slice(_15);if(_14.length){_12.push(_14);}return _12;};}if(!_4._hasResource["dojox.dtl._base"]){_4._hasResource["dojox.dtl._base"]=true;_4.provide("dojox.dtl._base");_4.experimental("dojox.dtl");(function(){var dd=_6.dtl;dd.TOKEN_BLOCK=-1;dd.TOKEN_VAR=-2;dd.TOKEN_COMMENT=-3;dd.TOKEN_TEXT=3;dd._Context=_4.extend(function(_18){if(_18){_4._mixin(this,_18);if(_18.get){this._getter=_18.get;delete this.get;}}},{push:function(){var _19=this;var _1a=_4.delegate(this);_1a.pop=function(){return _19;};return _1a;},pop:function(){throw new Error("pop() called on empty Context");},get:function(key,_1b){var n=this._normalize;if(this._getter){var got=this._getter(key);if(typeof got!="undefined"){return n(got);}}if(typeof this[key]!="undefined"){return n(this[key]);}return _1b;},_normalize:function(_1c){if(_1c instanceof Date){_1c.year=_1c.getFullYear();_1c.month=_1c.getMonth()+1;_1c.day=_1c.getDate();_1c.date=_1c.year+"-"+("0"+_1c.month).slice(-2)+"-"+("0"+_1c.day).slice(-2);_1c.hour=_1c.getHours();_1c.minute=_1c.getMinutes();_1c.second=_1c.getSeconds();_1c.microsecond=_1c.getMilliseconds();}return _1c;},update:function(_1d){var _1e=this.push();if(_1d){_4._mixin(this,_1d);}return _1e;}});var _1f=/("(?:[^"\\]*(?:\\.[^"\\]*)*)"|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)/g;var _20=/\s+/g;var _21=function(_22,_23){_22=_22||_20;if(!(_22 instanceof RegExp)){_22=new RegExp(_22,"g");}if(!_22.global){throw new Error("You must use a globally flagged RegExp with split "+_22);}_22.exec("");var _24,_25=[],_26=0,i=0;while(_24=_22.exec(this)){_25.push(this.slice(_26,_22.lastIndex-_24[0].length));_26=_22.lastIndex;if(_23&&(++i>_23-1)){break;}}_25.push(this.slice(_26));return _25;};dd.Token=function(_27,_28){this.token_type=_27;this.contents=new String(_4.trim(_28));this.contents.split=_21;this.split=function(){return String.prototype.split.apply(this.contents,arguments);};};dd.Token.prototype.split_contents=function(_29){var bit,_2a=[],i=0;_29=_29||999;while(i++<_29&&(bit=_1f.exec(this.contents))){bit=bit[0];if(bit.charAt(0)=="\""&&bit.slice(-1)=="\""){_2a.push("\""+bit.slice(1,-1).replace("\\\"","\"").replace("\\\\","\\")+"\"");}else{if(bit.charAt(0)=="'"&&bit.slice(-1)=="'"){_2a.push("'"+bit.slice(1,-1).replace("\\'","'").replace("\\\\","\\")+"'");}else{_2a.push(bit);}}}return _2a;};var ddt=dd.text={_get:function(_2b,_2c,_2d){var _2e=dd.register.get(_2b,_2c.toLowerCase(),_2d);if(!_2e){if(!_2d){throw new Error("No tag found for "+_2c);}return null;}var fn=_2e[1];var _2f=_2e[2];var _30;if(fn.indexOf(":")!=-1){_30=fn.split(":");fn=_30.pop();}_4["require"](_2f);var _31=_4.getObject(_2f);return _31[fn||_2c]||_31[_2c+"_"]||_31[fn+"_"];},getTag:function(_32,_33){return ddt._get("tag",_32,_33);},getFilter:function(_34,_35){return ddt._get("filter",_34,_35);},getTemplate:function(_36){return new dd.Template(ddt.getTemplateString(_36));},getTemplateString:function(_37){return _4._getText(_37.toString())||"";},_resolveLazy:function(_38,_39,_3a){if(_39){if(_3a){return _4.fromJson(_4._getText(_38))||{};}else{return dd.text.getTemplateString(_38);}}else{return _4.xhrGet({handleAs:(_3a)?"json":"text",url:_38});}},_resolveTemplateArg:function(arg,_3b){if(ddt._isTemplate(arg)){if(!_3b){var d=new _4.Deferred();d.callback(arg);return d;}return arg;}return ddt._resolveLazy(arg,_3b);},_isTemplate:function(arg){return (typeof arg=="undefined")||(typeof arg=="string"&&(arg.match(/^\s*[<{]/)||arg.indexOf(" ")!=-1));},_resolveContextArg:function(arg,_3c){if(arg.constructor==Object){if(!_3c){var d=new _4.Deferred;d.callback(arg);return d;}return arg;}return ddt._resolveLazy(arg,_3c,true);},_re:/(?:\{\{\s*(.+?)\s*\}\}|\{%\s*(load\s*)?(.+?)\s*%\})/g,tokenize:function(str){return _6.string.tokenize(str,ddt._re,ddt._parseDelims);},_parseDelims:function(_3d,_3e,tag){if(_3d){return [dd.TOKEN_VAR,_3d];}else{if(_3e){var _3f=_4.trim(tag).split(/\s+/g);for(var i=0,_40;_40=_3f[i];i++){_4["require"](_40);}}else{return [dd.TOKEN_BLOCK,tag];}}}};dd.Template=_4.extend(function(_41,_42){var str=_42?_41:ddt._resolveTemplateArg(_41,true)||"";var _43=ddt.tokenize(str);var _44=new dd._Parser(_43);this.nodelist=_44.parse();},{update:function(_45,_46){return ddt._resolveContextArg(_46).addCallback(this,function(_47){var _48=this.render(new dd._Context(_47));if(_45.forEach){_45.forEach(function(_49){_49.innerHTML=_48;});}else{_4.byId(_45).innerHTML=_48;}return this;});},render:function(_4a,_4b){_4b=_4b||this.getBuffer();_4a=_4a||new dd._Context({});return this.nodelist.render(_4a,_4b)+"";},getBuffer:function(){return new _6.string.Builder();}});var _4c=/\{\{\s*(.+?)\s*\}\}/g;dd.quickFilter=function(str){if(!str){return new dd._NodeList();}if(str.indexOf("{%")==-1){return new dd._QuickNodeList(_6.string.tokenize(str,_4c,function(_4d){return new dd._Filter(_4d);}));}};dd._QuickNodeList=_4.extend(function(_4e){this.contents=_4e;},{render:function(_4f,_50){for(var i=0,l=this.contents.length;i<l;i++){if(this.contents[i].resolve){_50=_50.concat(this.contents[i].resolve(_4f));}else{_50=_50.concat(this.contents[i]);}}return _50;},dummyRender:function(_51){return this.render(_51,dd.Template.prototype.getBuffer()).toString();},clone:function(_52){return this;}});dd._Filter=_4.extend(function(_53){if(!_53){throw new Error("Filter must be called with variable name");}this.contents=_53;var _54=this._cache[_53];if(_54){this.key=_54[0];this.filters=_54[1];}else{this.filters=[];_6.string.tokenize(_53,this._re,this._tokenize,this);this._cache[_53]=[this.key,this.filters];}},{_cache:{},_re:/(?:^_\("([^\\"]*(?:\\.[^\\"])*)"\)|^"([^\\"]*(?:\\.[^\\"]*)*)"|^([a-zA-Z0-9_.]+)|\|(\w+)(?::(?:_\("([^\\"]*(?:\\.[^\\"])*)"\)|"([^\\"]*(?:\\.[^\\"]*)*)"|([a-zA-Z0-9_.]+)|'([^\\']*(?:\\.[^\\']*)*)'))?|^'([^\\']*(?:\\.[^\\']*)*)')/g,_values:{0:"\"",1:"\"",2:"",8:"\""},_args:{4:"\"",5:"\"",6:"",7:"'"},_tokenize:function(){var pos,arg;for(var i=0,has=[];i<arguments.length;i++){has[i]=(typeof arguments[i]!="undefined"&&typeof arguments[i]=="string"&&arguments[i]);}if(!this.key){for(pos in this._values){if(has[pos]){this.key=this._values[pos]+arguments[pos]+this._values[pos];break;}}}else{for(pos in this._args){if(has[pos]){var _55=arguments[pos];if(this._args[pos]=="'"){_55=_55.replace(/\\'/g,"'");}else{if(this._args[pos]=="\""){_55=_55.replace(/\\"/g,"\"");}}arg=[!this._args[pos],_55];break;}}var fn=ddt.getFilter(arguments[3]);if(!_4.isFunction(fn)){throw new Error(arguments[3]+" is not registered as a filter");}this.filters.push([fn,arg]);}},getExpression:function(){return this.contents;},resolve:function(_56){if(typeof this.key=="undefined"){return "";}var str=this.resolvePath(this.key,_56);for(var i=0,_57;_57=this.filters[i];i++){if(_57[1]){if(_57[1][0]){str=_57[0](str,this.resolvePath(_57[1][1],_56));}else{str=_57[0](str,_57[1][1]);}}else{str=_57[0](str);}}return str;},resolvePath:function(_58,_59){var _5a,_5b;var _5c=_58.charAt(0);var _5d=_58.slice(-1);if(!isNaN(parseInt(_5c))){_5a=(_58.indexOf(".")==-1)?parseInt(_58):parseFloat(_58);}else{if(_5c=="\""&&_5c==_5d){_5a=_58.slice(1,-1);}else{if(_58=="true"){return true;}if(_58=="false"){return false;}if(_58=="null"||_58=="None"){return null;}_5b=_58.split(".");_5a=_59.get(_5b[0]);if(_4.isFunction(_5a)){var _5e=_59.getThis&&_59.getThis();if(_5a.alters_data){_5a="";}else{if(_5e){_5a=_5a.call(_5e);}else{_5a="";}}}for(var i=1;i<_5b.length;i++){var _5f=_5b[i];if(_5a){var _60=_5a;if(_4.isObject(_5a)&&_5f=="items"&&typeof _5a[_5f]=="undefined"){var _61=[];for(var key in _5a){_61.push([key,_5a[key]]);}_5a=_61;continue;}if(_5a.get&&_4.isFunction(_5a.get)&&_5a.get.safe){_5a=_5a.get(_5f);}else{if(typeof _5a[_5f]=="undefined"){_5a=_5a[_5f];break;}else{_5a=_5a[_5f];}}if(_4.isFunction(_5a)){if(_5a.alters_data){_5a="";}else{_5a=_5a.call(_60);}}else{if(_5a instanceof Date){_5a=dd._Context.prototype._normalize(_5a);}}}else{return "";}}}}return _5a;}});dd._TextNode=dd._Node=_4.extend(function(obj){this.contents=obj;},{set:function(_62){this.contents=_62;return this;},render:function(_63,_64){return _64.concat(this.contents);},isEmpty:function(){return !_4.trim(this.contents);},clone:function(){return this;}});dd._NodeList=_4.extend(function(_65){this.contents=_65||[];this.last="";},{push:function(_66){this.contents.push(_66);return this;},concat:function(_67){this.contents=this.contents.concat(_67);return this;},render:function(_68,_69){for(var i=0;i<this.contents.length;i++){_69=this.contents[i].render(_68,_69);if(!_69){throw new Error("Template must return buffer");}}return _69;},dummyRender:function(_6a){return this.render(_6a,dd.Template.prototype.getBuffer()).toString();},unrender:function(){return arguments[1];},clone:function(){return this;},rtrim:function(){while(1){i=this.contents.length-1;if(this.contents[i] instanceof dd._TextNode&&this.contents[i].isEmpty()){this.contents.pop();}else{break;}}return this;}});dd._VarNode=_4.extend(function(str){this.contents=new dd._Filter(str);},{render:function(_6b,_6c){var str=this.contents.resolve(_6b);if(!str.safe){str=dd._base.escape(""+str);}return _6c.concat(str);}});dd._noOpNode=new function(){this.render=this.unrender=function(){return arguments[1];};this.clone=function(){return this;};};dd._Parser=_4.extend(function(_6d){this.contents=_6d;},{i:0,parse:function(_6e){var _6f={},_70;_6e=_6e||[];for(var i=0;i<_6e.length;i++){_6f[_6e[i]]=true;}var _71=new dd._NodeList();while(this.i<this.contents.length){_70=this.contents[this.i++];if(typeof _70=="string"){_71.push(new dd._TextNode(_70));}else{var _72=_70[0];var _73=_70[1];if(_72==dd.TOKEN_VAR){_71.push(new dd._VarNode(_73));}else{if(_72==dd.TOKEN_BLOCK){if(_6f[_73]){--this.i;return _71;}var cmd=_73.split(/\s+/g);if(cmd.length){cmd=cmd[0];var fn=ddt.getTag(cmd);if(fn){_71.push(fn(this,new dd.Token(_72,_73)));}}}}}}if(_6e.length){throw new Error("Could not find closing tag(s): "+_6e.toString());}this.contents.length=0;return _71;},next_token:function(){var _74=this.contents[this.i++];return new dd.Token(_74[0],_74[1]);},delete_first_token:function(){this.i++;},skip_past:function(_75){while(this.i<this.contents.length){var _76=this.contents[this.i++];if(_76[0]==dd.TOKEN_BLOCK&&_76[1]==_75){return;}}throw new Error("Unclosed tag found when looking for "+_75);},create_variable_node:function(_77){return new dd._VarNode(_77);},create_text_node:function(_78){return new dd._TextNode(_78||"");},getTemplate:function(_79){return new dd.Template(_79);}});dd.register={_registry:{attributes:[],tags:[],filters:[]},get:function(_7a,_7b){var _7c=dd.register._registry[_7a+"s"];for(var i=0,_7d;_7d=_7c[i];i++){if(typeof _7d[0]=="string"){if(_7d[0]==_7b){return _7d;}}else{if(_7b.match(_7d[0])){return _7d;}}}},getAttributeTags:function(){var _7e=[];var _7f=dd.register._registry.attributes;for(var i=0,_80;_80=_7f[i];i++){if(_80.length==3){_7e.push(_80);}else{var fn=_4.getObject(_80[1]);if(fn&&_4.isFunction(fn)){_80.push(fn);_7e.push(_80);}}}return _7e;},_any:function(_81,_82,_83){for(var _84 in _83){for(var i=0,fn;fn=_83[_84][i];i++){var key=fn;if(_4.isArray(fn)){key=fn[0];fn=fn[1];}if(typeof key=="string"){if(key.substr(0,5)=="attr:"){var _85=fn;if(_85.substr(0,5)=="attr:"){_85=_85.slice(5);}dd.register._registry.attributes.push([_85.toLowerCase(),_82+"."+_84+"."+_85]);}key=key.toLowerCase();}dd.register._registry[_81].push([key,fn,_82+"."+_84]);}}},tags:function(_86,_87){dd.register._any("tags",_86,_87);},filters:function(_88,_89){dd.register._any("filters",_88,_89);}};var _8a=/&/g;var _8b=/</g;var _8c=/>/g;var _8d=/'/g;var _8e=/"/g;dd._base.escape=function(_8f){return dd.mark_safe(_8f.replace(_8a,"&").replace(_8b,"<").replace(_8c,">").replace(_8e,""").replace(_8d,"'"));};dd._base.safe=function(_90){if(typeof _90=="string"){_90=new String(_90);}if(typeof _90=="object"){_90.safe=true;}return _90;};dd.mark_safe=dd._base.safe;dd.register.tags("dojox.dtl.tag",{"date":["now"],"logic":["if","for","ifequal","ifnotequal"],"loader":["extends","block","include","load","ssi"],"misc":["comment","debug","filter","firstof","spaceless","templatetag","widthratio","with"],"loop":["cycle","ifchanged","regroup"]});dd.register.filters("dojox.dtl.filter",{"dates":["date","time","timesince","timeuntil"],"htmlstrings":["linebreaks","linebreaksbr","removetags","striptags"],"integers":["add","get_digit"],"lists":["dictsort","dictsortreversed","first","join","length","length_is","random","slice","unordered_list"],"logic":["default","default_if_none","divisibleby","yesno"],"misc":["filesizeformat","pluralize","phone2numeric","pprint"],"strings":["addslashes","capfirst","center","cut","fix_ampersands","floatformat","iriencode","linenumbers","ljust","lower","make_list","rjust","slugify","stringformat","title","truncatewords","truncatewords_html","upper","urlencode","urlize","urlizetrunc","wordcount","wordwrap"]});dd.register.filters("dojox.dtl",{"_base":["escape","safe"]});})();}if(!_4._hasResource["dojox.dtl"]){_4._hasResource["dojox.dtl"]=true;_4.provide("dojox.dtl");}if(!_4._hasResource["dojox.dtl.Context"]){_4._hasResource["dojox.dtl.Context"]=true;_4.provide("dojox.dtl.Context");_6.dtl.Context=_4.extend(function(_91){this._this={};_6.dtl._Context.call(this,_91);},_6.dtl._Context.prototype,{getKeys:function(){var _92=[];for(var key in this){if(this.hasOwnProperty(key)&&key!="_this"){_92.push(key);}}return _92;},extend:function(obj){return _4.delegate(this,obj);},filter:function(_93){var _94=new _6.dtl.Context();var _95=[];var i,arg;if(_93 instanceof _6.dtl.Context){_95=_93.getKeys();}else{if(typeof _93=="object"){for(var key in _93){_95.push(key);}}else{for(i=0;arg=arguments[i];i++){if(typeof arg=="string"){_95.push(arg);}}}}for(i=0,key;key=_95[i];i++){_94[key]=this[key];}return _94;},setThis:function(_96){this._this=_96;},getThis:function(){return this._this;},hasKey:function(key){if(this._getter){var got=this._getter(key);if(typeof got!="undefined"){return true;}}if(typeof this[key]!="undefined"){return true;}return false;}});}if(!_4._hasResource["dojox.dtl.tag.logic"]){_4._hasResource["dojox.dtl.tag.logic"]=true;_4.provide("dojox.dtl.tag.logic");(function(){var dd=_6.dtl;var ddt=dd.text;var _97=dd.tag.logic;_97.IfNode=_4.extend(function(_98,_99,_9a,_9b){this.bools=_98;this.trues=_99;this.falses=_9a;this.type=_9b;},{render:function(_9c,_9d){var i,_9e,_9f,_a0,_a1;if(this.type=="or"){for(i=0;_9e=this.bools[i];i++){_9f=_9e[0];_a0=_9e[1];_a1=_a0.resolve(_9c);if((_a1&&!_9f)||(_9f&&!_a1)){if(this.falses){_9d=this.falses.unrender(_9c,_9d);}return (this.trues)?this.trues.render(_9c,_9d,this):_9d;}}if(this.trues){_9d=this.trues.unrender(_9c,_9d);}return (this.falses)?this.falses.render(_9c,_9d,this):_9d;}else{for(i=0;_9e=this.bools[i];i++){_9f=_9e[0];_a0=_9e[1];_a1=_a0.resolve(_9c);if(_a1==_9f){if(this.trues){_9d=this.trues.unrender(_9c,_9d);}return (this.falses)?this.falses.render(_9c,_9d,this):_9d;}}if(this.falses){_9d=this.falses.unrender(_9c,_9d);}return (this.trues)?this.trues.render(_9c,_9d,this):_9d;}return _9d;},unrender:function(_a2,_a3){_a3=(this.trues)?this.trues.unrender(_a2,_a3):_a3;_a3=(this.falses)?this.falses.unrender(_a2,_a3):_a3;return _a3;},clone:function(_a4){var _a5=(this.trues)?this.trues.clone(_a4):null;var _a6=(this.falses)?this.falses.clone(_a4):null;return new this.constructor(this.bools,_a5,_a6,this.type);}});_97.IfEqualNode=_4.extend(function(_a7,_a8,_a9,_aa,_ab){this.var1=new dd._Filter(_a7);this.var2=new dd._Filter(_a8);this.trues=_a9;this.falses=_aa;this.negate=_ab;},{render:function(_ac,_ad){var _ae=this.var1.resolve(_ac);var _af=this.var2.resolve(_ac);_ae=(typeof _ae!="undefined")?_ae:"";_af=(typeof _ae!="undefined")?_af:"";if((this.negate&&_ae!=_af)||(!this.negate&&_ae==_af)){if(this.falses){_ad=this.falses.unrender(_ac,_ad,this);}return (this.trues)?this.trues.render(_ac,_ad,this):_ad;}if(this.trues){_ad=this.trues.unrender(_ac,_ad,this);}return (this.falses)?this.falses.render(_ac,_ad,this):_ad;},unrender:function(_b0,_b1){return _97.IfNode.prototype.unrender.call(this,_b0,_b1);},clone:function(_b2){var _b3=this.trues?this.trues.clone(_b2):null;var _b4=this.falses?this.falses.clone(_b2):null;return new this.constructor(this.var1.getExpression(),this.var2.getExpression(),_b3,_b4,this.negate);}});_97.ForNode=_4.extend(function(_b5,_b6,_b7,_b8){this.assign=_b5;this.loop=new dd._Filter(_b6);this.reversed=_b7;this.nodelist=_b8;this.pool=[];},{render:function(_b9,_ba){var i,j,k;var _bb=false;var _bc=this.assign;for(k=0;k<_bc.length;k++){if(typeof _b9[_bc[k]]!="undefined"){_bb=true;_b9=_b9.push();break;}}if(!_bb&&_b9.forloop){_bb=true;_b9=_b9.push();}var _bd=this.loop.resolve(_b9)||[];for(i=_bd.length;i<this.pool.length;i++){this.pool[i].unrender(_b9,_ba,this);}if(this.reversed){_bd=_bd.slice(0).reverse();}var _be=_4.isObject(_bd)&&!_4.isArrayLike(_bd);var _bf=[];if(_be){for(var key in _bd){_bf.push(_bd[key]);}}else{_bf=_bd;}var _c0=_b9.forloop={parentloop:_b9.get("forloop",{})};var j=0;for(i=0;i<_bf.length;i++){var _c1=_bf[i];_c0.counter0=j;_c0.counter=j+1;_c0.revcounter0=_bf.length-j-1;_c0.revcounter=_bf.length-j;_c0.first=!j;_c0.last=(j==_bf.length-1);if(_bc.length>1&&_4.isArrayLike(_c1)){if(!_bb){_bb=true;_b9=_b9.push();}var _c2={};for(k=0;k<_c1.length&&k<_bc.length;k++){_c2[_bc[k]]=_c1[k];}_4.mixin(_b9,_c2);}else{_b9[_bc[0]]=_c1;}if(j+1>this.pool.length){this.pool.push(this.nodelist.clone(_ba));}_ba=this.pool[j++].render(_b9,_ba,this);}delete _b9.forloop;if(_bb){_b9=_b9.pop();}else{for(k=0;k<_bc.length;k++){delete _b9[_bc[k]];}}return _ba;},unrender:function(_c3,_c4){for(var i=0,_c5;_c5=this.pool[i];i++){_c4=_c5.unrender(_c3,_c4);}return _c4;},clone:function(_c6){return new this.constructor(this.assign,this.loop.getExpression(),this.reversed,this.nodelist.clone(_c6));}});_4.mixin(_97,{if_:function(_c7,_c8){var i,_c9,_ca,_cb=[],_cc=_c8.contents.split();_cc.shift();_c8=_cc.join(" ");_cc=_c8.split(" and ");if(_cc.length==1){_ca="or";_cc=_c8.split(" or ");}else{_ca="and";for(i=0;i<_cc.length;i++){if(_cc[i].indexOf(" or ")!=-1){throw new Error("'if' tags can't mix 'and' and 'or'");}}}for(i=0;_c9=_cc[i];i++){var not=false;if(_c9.indexOf("not ")==0){_c9=_c9.slice(4);not=true;}_cb.push([not,new dd._Filter(_c9)]);}var _cd=_c7.parse(["else","endif"]);var _ce=false;var _c8=_c7.next_token();if(_c8.contents=="else"){_ce=_c7.parse(["endif"]);_c7.next_token();}return new _97.IfNode(_cb,_cd,_ce,_ca);},_ifequal:function(_cf,_d0,_d1){var _d2=_d0.split_contents();if(_d2.length!=3){throw new Error(_d2[0]+" takes two arguments");}var end="end"+_d2[0];var _d3=_cf.parse(["else",end]);var _d4=false;var _d0=_cf.next_token();if(_d0.contents=="else"){_d4=_cf.parse([end]);_cf.next_token();}return new _97.IfEqualNode(_d2[1],_d2[2],_d3,_d4,_d1);},ifequal:function(_d5,_d6){return _97._ifequal(_d5,_d6);},ifnotequal:function(_d7,_d8){return _97._ifequal(_d7,_d8,true);},for_:function(_d9,_da){var _db=_da.contents.split();if(_db.length<4){throw new Error("'for' statements should have at least four words: "+_da.contents);}var _dc=_db[_db.length-1]=="reversed";var _dd=(_dc)?-3:-2;if(_db[_db.length+_dd]!="in"){throw new Error("'for' tag received an invalid argument: "+_da.contents);}var _de=_db.slice(1,_dd).join(" ").split(/ *, */);for(var i=0;i<_de.length;i++){if(!_de[i]||_de[i].indexOf(" ")!=-1){throw new Error("'for' tag received an invalid argument: "+_da.contents);}}var _df=_d9.parse(["endfor"]);_d9.next_token();return new _97.ForNode(_de,_db[_db.length+_dd+1],_dc,_df);}});})();}if(!_4._hasResource["dojox.dtl.tag.loop"]){_4._hasResource["dojox.dtl.tag.loop"]=true;_4.provide("dojox.dtl.tag.loop");(function(){var dd=_6.dtl;var _e0=dd.tag.loop;_e0.CycleNode=_4.extend(function(_e1,_e2,_e3,_e4){this.cyclevars=_e1;this.name=_e2;this.contents=_e3;this.shared=_e4||{counter:-1,map:{}};},{render:function(_e5,_e6){if(_e5.forloop&&!_e5.forloop.counter0){this.shared.counter=-1;}++this.shared.counter;var _e7=this.cyclevars[this.shared.counter%this.cyclevars.length];var map=this.shared.map;if(!map[_e7]){map[_e7]=new dd._Filter(_e7);}_e7=map[_e7].resolve(_e5,_e6);if(this.name){_e5[this.name]=_e7;}this.contents.set(_e7);return this.contents.render(_e5,_e6);},unrender:function(_e8,_e9){return this.contents.unrender(_e8,_e9);},clone:function(_ea){return new this.constructor(this.cyclevars,this.name,this.contents.clone(_ea),this.shared);}});_e0.IfChangedNode=_4.extend(function(_eb,_ec,_ed){this.nodes=_eb;this._vars=_ec;this.shared=_ed||{last:null,counter:0};this.vars=_4.map(_ec,function(_ee){return new _6.dtl._Filter(_ee);});},{render:function(_ef,_f0){if(_ef.forloop){if(_ef.forloop.counter<=this.shared.counter){this.shared.last=null;}this.shared.counter=_ef.forloop.counter;}var _f1;if(this.vars.length){_f1=_4.toJson(_4.map(this.vars,function(_f2){return _f2.resolve(_ef);}));}else{_f1=this.nodes.dummyRender(_ef,_f0);}if(_f1!=this.shared.last){var _f3=(this.shared.last===null);this.shared.last=_f1;_ef=_ef.push();_ef.ifchanged={firstloop:_f3};_f0=this.nodes.render(_ef,_f0);_ef=_ef.pop();}else{_f0=this.nodes.unrender(_ef,_f0);}return _f0;},unrender:function(_f4,_f5){return this.nodes.unrender(_f4,_f5);},clone:function(_f6){return new this.constructor(this.nodes.clone(_f6),this._vars,this.shared);}});_e0.RegroupNode=_4.extend(function(_f7,key,_f8){this._expression=_f7;this.expression=new dd._Filter(_f7);this.key=key;this.alias=_f8;},{_push:function(_f9,_fa,_fb){if(_fb.length){_f9.push({grouper:_fa,list:_fb});}},render:function(_fc,_fd){_fc[this.alias]=[];var _fe=this.expression.resolve(_fc);if(_fe){var _ff=null;var _100=[];for(var i=0;i<_fe.length;i++){var id=_fe[i][this.key];if(_ff!==id){this._push(_fc[this.alias],_ff,_100);_ff=id;_100=[_fe[i]];}else{_100.push(_fe[i]);}}this._push(_fc[this.alias],_ff,_100);}return _fd;},unrender:function(_101,_102){return _102;},clone:function(_103,_104){return this;}});_4.mixin(_e0,{cycle:function(_105,_106){var args=_106.split_contents();if(args.length<2){throw new Error("'cycle' tag requires at least two arguments");}if(args[1].indexOf(",")!=-1){var vars=args[1].split(",");args=[args[0]];for(var i=0;i<vars.length;i++){args.push("\""+vars[i]+"\"");}}if(args.length==2){var name=args[args.length-1];if(!_105._namedCycleNodes){throw new Error("No named cycles in template: '"+name+"' is not defined");}if(!_105._namedCycleNodes[name]){throw new Error("Named cycle '"+name+"' does not exist");}return _105._namedCycleNodes[name];}if(args.length>4&&args[args.length-2]=="as"){var name=args[args.length-1];var node=new _e0.CycleNode(args.slice(1,args.length-2),name,_105.create_text_node());if(!_105._namedCycleNodes){_105._namedCycleNodes={};}_105._namedCycleNodes[name]=node;}else{node=new _e0.CycleNode(args.slice(1),null,_105.create_text_node());}return node;},ifchanged:function(_107,_108){var _109=_108.contents.split();var _10a=_107.parse(["endifchanged"]);_107.delete_first_token();return new _e0.IfChangedNode(_10a,_109.slice(1));},regroup:function(_10b,_10c){var _10d=_6.string.tokenize(_10c.contents,/(\s+)/g,function(_10e){return _10e;});if(_10d.length<11||_10d[_10d.length-3]!="as"||_10d[_10d.length-7]!="by"){throw new Error("Expected the format: regroup list by key as newList");}var _10f=_10d.slice(2,-8).join("");var key=_10d[_10d.length-5];var _110=_10d[_10d.length-1];return new _e0.RegroupNode(_10f,key,_110);}});})();}if(!_4._hasResource["dojo.date"]){_4._hasResource["dojo.date"]=true;_4.provide("dojo.date");_4.getObject("date",true,_4);_4.date.getDaysInMonth=function(_111){var _112=_111.getMonth();var days=[31,28,31,30,31,30,31,31,30,31,30,31];if(_112==1&&_4.date.isLeapYear(_111)){return 29;}return days[_112];};_4.date.isLeapYear=function(_113){var year=_113.getFullYear();return !(year%400)||(!(year%4)&&!!(year%100));};_4.date.getTimezoneName=function(_114){var str=_114.toString();var tz="";var _115;var pos=str.indexOf("(");if(pos>-1){tz=str.substring(++pos,str.indexOf(")"));}else{var pat=/([A-Z\/]+) \d{4}$/;if((_115=str.match(pat))){tz=_115[1];}else{str=_114.toLocaleString();pat=/ ([A-Z\/]+)$/;if((_115=str.match(pat))){tz=_115[1];}}}return (tz=="AM"||tz=="PM")?"":tz;};_4.date.compare=function(_116,_117,_118){_116=new Date(+_116);_117=new Date(+(_117||new Date()));if(_118=="date"){_116.setHours(0,0,0,0);_117.setHours(0,0,0,0);}else{if(_118=="time"){_116.setFullYear(0,0,0);_117.setFullYear(0,0,0);}}if(_116>_117){return 1;}if(_116<_117){return -1;}return 0;};_4.date.add=function(date,_119,_11a){var sum=new Date(+date);var _11b=false;var _11c="Date";switch(_119){case "day":break;case "weekday":var days,_11d;var mod=_11a%5;if(!mod){days=(_11a>0)?5:-5;_11d=(_11a>0)?((_11a-5)/5):((_11a+5)/5);}else{days=mod;_11d=parseInt(_11a/5);}var strt=date.getDay();var adj=0;if(strt==6&&_11a>0){adj=1;}else{if(strt==0&&_11a<0){adj=-1;}}var trgt=strt+days;if(trgt==0||trgt==6){adj=(_11a>0)?2:-2;}_11a=(7*_11d)+days+adj;break;case "year":_11c="FullYear";_11b=true;break;case "week":_11a*=7;break;case "quarter":_11a*=3;case "month":_11b=true;_11c="Month";break;default:_11c="UTC"+_119.charAt(0).toUpperCase()+_119.substring(1)+"s";}if(_11c){sum["set"+_11c](sum["get"+_11c]()+_11a);}if(_11b&&(sum.getDate()<date.getDate())){sum.setDate(0);}return sum;};_4.date.difference=function(_11e,_11f,_120){_11f=_11f||new Date();_120=_120||"day";var _121=_11f.getFullYear()-_11e.getFullYear();var _122=1;switch(_120){case "quarter":var m1=_11e.getMonth();var m2=_11f.getMonth();var q1=Math.floor(m1/3)+1;var q2=Math.floor(m2/3)+1;q2+=(_121*4);_122=q2-q1;break;case "weekday":var days=Math.round(_4.date.difference(_11e,_11f,"day"));var _123=parseInt(_4.date.difference(_11e,_11f,"week"));var mod=days%7;if(mod==0){days=_123*5;}else{var adj=0;var aDay=_11e.getDay();var bDay=_11f.getDay();_123=parseInt(days/7);mod=days%7;var _124=new Date(_11e);_124.setDate(_124.getDate()+(_123*7));var _125=_124.getDay();if(days>0){switch(true){case aDay==6:adj=-1;break;case aDay==0:adj=0;break;case bDay==6:adj=-1;break;case bDay==0:adj=-2;break;case (_125+mod)>5:adj=-2;}}else{if(days<0){switch(true){case aDay==6:adj=0;break;case aDay==0:adj=1;break;case bDay==6:adj=2;break;case bDay==0:adj=1;break;case (_125+mod)<0:adj=2;}}}days+=adj;days-=(_123*2);}_122=days;break;case "year":_122=_121;break;case "month":_122=(_11f.getMonth()-_11e.getMonth())+(_121*12);break;case "week":_122=parseInt(_4.date.difference(_11e,_11f,"day")/7);break;case "day":_122/=24;case "hour":_122/=60;case "minute":_122/=60;case "second":_122/=1000;case "millisecond":_122*=_11f.getTime()-_11e.getTime();}return Math.round(_122);};}if(!_4._hasResource["dojox.date.php"]){_4._hasResource["dojox.date.php"]=true;_4.provide("dojox.date.php");_6.date.php.format=function(date,_126){var df=new _6.date.php.DateFormat(_126);return df.format(date);};_6.date.php.DateFormat=function(_127){if(!this.regex){var keys=[];for(var key in this.constructor.prototype){if(_4.isString(key)&&key.length==1&&_4.isFunction(this[key])){keys.push(key);}}this.constructor.prototype.regex=new RegExp("(?:(\\\\.)|(["+keys.join("")+"]))","g");}var _128=[];this.tokens=_6.string.tokenize(_127,this.regex,function(_129,_12a,i){if(_12a){_128.push([i,_12a]);return _12a;}if(_129){return _129.charAt(1);}});this.replacements=_128;};_4.extend(_6.date.php.DateFormat,{weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdays_3:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_3:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthdays:[31,28,31,30,31,30,31,31,30,31,30,31],format:function(date){this.date=date;for(var i=0,_12b;_12b=this.replacements[i];i++){this.tokens[_12b[0]]=this[_12b[1]]();}return this.tokens.join("");},d:function(){var j=this.j();return (j.length==1)?"0"+j:j;},D:function(){return this.weekdays_3[this.date.getDay()];},j:function(){return this.date.getDate()+"";},l:function(){return this.weekdays[this.date.getDay()];},N:function(){var w=this.w();return (!w)?7:w;},S:function(){switch(this.date.getDate()){case 11:case 12:case 13:return "th";case 1:case 21:case 31:return "st";case 2:case 22:return "nd";case 3:case 23:return "rd";default:return "th";}},w:function(){return this.date.getDay()+"";},z:function(){var _12c=this.date.getTime()-new Date(this.date.getFullYear(),0,1).getTime();return Math.floor(_12c/86400000)+"";},W:function(){var week;var _12d=new Date(this.date.getFullYear(),0,1).getDay()+1;var w=this.date.getDay()+1;var z=parseInt(this.z());if(z<=(8-_12d)&&_12d>4){var _12e=new Date(this.date.getFullYear()-1,this.date.getMonth(),this.date.getDate());if(_12d==5||(_12d==6&&_4.date.isLeapYear(_12e))){week=53;}else{week=52;}}else{var i;if(Boolean(this.L())){i=366;}else{i=365;}if((i-z)<(4-w)){week=1;}else{var j=z+(7-w)+(_12d-1);week=Math.ceil(j/7);if(_12d>4){--week;}}}return week;},F:function(){return this.months[this.date.getMonth()];},m:function(){var n=this.n();return (n.length==1)?"0"+n:n;},M:function(){return this.months_3[this.date.getMonth()];},n:function(){return this.date.getMonth()+1+"";},t:function(){return (Boolean(this.L())&&this.date.getMonth()==1)?29:this.monthdays[this.getMonth()];},L:function(){return (_4.date.isLeapYear(this.date))?"1":"0";},o:function(){},Y:function(){return this.date.getFullYear()+"";},y:function(){return this.Y().slice(-2);},a:function(){return this.date.getHours()>=12?"pm":"am";},b:function(){return this.a().toUpperCase();},B:function(){var off=this.date.getTimezoneOffset()+60;var secs=(this.date.getHours()*3600)+(this.date.getMinutes()*60)+this.getSeconds()+(off*60);var beat=Math.abs(Math.floor(secs/86.4)%1000)+"";while(beat.length<2){beat="0"+beat;}return beat;},g:function(){return (this.date.getHours()>12)?this.date.getHours()-12+"":this.date.getHours()+"";},G:function(){return this.date.getHours()+"";},h:function(){var g=this.g();return (g.length==1)?"0"+g:g;},H:function(){var G=this.G();return (G.length==1)?"0"+G:G;},i:function(){var mins=this.date.getMinutes()+"";return (mins.length==1)?"0"+mins:mins;},s:function(){var secs=this.date.getSeconds()+"";return (secs.length==1)?"0"+secs:secs;},e:function(){return _4.date.getTimezoneName(this.date);},I:function(){},O:function(){var off=Math.abs(this.date.getTimezoneOffset());var _12f=Math.floor(off/60)+"";var mins=(off%60)+"";if(_12f.length==1){_12f="0"+_12f;}if(mins.length==1){_12f="0"+mins;}return ((this.date.getTimezoneOffset()<0)?"+":"-")+_12f+mins;},P:function(){var O=this.O();return O.substring(0,2)+":"+O.substring(2,4);},T:function(){return this.e().substring(0,3);},Z:function(){return this.date.getTimezoneOffset()*-60;},c:function(){return this.Y()+"-"+this.m()+"-"+this.d()+"T"+this.h()+":"+this.i()+":"+this.s()+this.P();},r:function(){return this.D()+", "+this.d()+" "+this.M()+" "+this.Y()+" "+this.H()+":"+this.i()+":"+this.s()+" "+this.O();},U:function(){return Math.floor(this.date.getTime()/1000);}});}if(!_4._hasResource["dojox.dtl.utils.date"]){_4._hasResource["dojox.dtl.utils.date"]=true;_4.provide("dojox.dtl.utils.date");_6.dtl.utils.date.DateFormat=function(_130){_6.date.php.DateFormat.call(this,_130);};_4.extend(_6.dtl.utils.date.DateFormat,_6.date.php.DateFormat.prototype,{f:function(){return (!this.date.getMinutes())?this.g():this.g()+":"+this.i();},N:function(){return _6.dtl.utils.date._months_ap[this.date.getMonth()];},P:function(){if(!this.date.getMinutes()&&!this.date.getHours()){return "midnight";}if(!this.date.getMinutes()&&this.date.getHours()==12){return "noon";}return this.f()+" "+this.a();}});_4.mixin(_6.dtl.utils.date,{format:function(date,_131){var df=new _6.dtl.utils.date.DateFormat(_131);return df.format(date);},timesince:function(d,now){if(!(d instanceof Date)){d=new Date(d.year,d.month,d.day);}if(!now){now=new Date();}var _132=Math.abs(now.getTime()-d.getTime());for(var i=0,_133;_133=_6.dtl.utils.date._chunks[i];i++){var _134=Math.floor(_132/_133[0]);if(_134){break;}}return _134+" "+_133[1](_134);},_chunks:[[60*60*24*365*1000,function(n){return (n==1)?"year":"years";}],[60*60*24*30*1000,function(n){return (n==1)?"month":"months";}],[60*60*24*7*1000,function(n){return (n==1)?"week":"weeks";}],[60*60*24*1000,function(n){return (n==1)?"day":"days";}],[60*60*1000,function(n){return (n==1)?"hour":"hours";}],[60*1000,function(n){return (n==1)?"minute":"minutes";}]],_months_ap:["Jan.","Feb.","March","April","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec."]});}if(!_4._hasResource["dojox.dtl.tag.date"]){_4._hasResource["dojox.dtl.tag.date"]=true;_4.provide("dojox.dtl.tag.date");_6.dtl.tag.date.NowNode=function(_135,node){this._format=_135;this.format=new _6.dtl.utils.date.DateFormat(_135);this.contents=node;};_4.extend(_6.dtl.tag.date.NowNode,{render:function(_136,_137){this.contents.set(this.format.format(new Date()));return this.contents.render(_136,_137);},unrender:function(_138,_139){return this.contents.unrender(_138,_139);},clone:function(_13a){return new this.constructor(this._format,this.contents.clone(_13a));}});_6.dtl.tag.date.now=function(_13b,_13c){var _13d=_13c.split_contents();if(_13d.length!=2){throw new Error("'now' statement takes one argument");}return new _6.dtl.tag.date.NowNode(_13d[1].slice(1,-1),_13b.create_text_node());};}if(!_4._hasResource["dojox.dtl.tag.loader"]){_4._hasResource["dojox.dtl.tag.loader"]=true;_4.provide("dojox.dtl.tag.loader");(function(){var dd=_6.dtl;var ddtl=dd.tag.loader;ddtl.BlockNode=_4.extend(function(name,_13e){this.name=name;this.nodelist=_13e;},{"super":function(){if(this.parent){var html=this.parent.nodelist.dummyRender(this.context,null,true);if(typeof html=="string"){html=new String(html);}html.safe=true;return html;}return "";},render:function(_13f,_140){var name=this.name;var _141=this.nodelist;var _142;if(_140.blocks){var _143=_140.blocks[name];if(_143){_142=_143.parent;_141=_143.nodelist;_143.used=true;}}this.rendered=_141;_13f=_13f.push();this.context=_13f;this.parent=null;if(_141!=this.nodelist){this.parent=this;}_13f.block=this;if(_140.getParent){var _144=_140.getParent();var _145=_4.connect(_140,"onSetParent",function(node,up,root){if(up&&root){_140.setParent(_144);}});}_140=_141.render(_13f,_140,this);_145&&_4.disconnect(_145);_13f=_13f.pop();return _140;},unrender:function(_146,_147){return this.rendered.unrender(_146,_147);},clone:function(_148){return new this.constructor(this.name,this.nodelist.clone(_148));},toString:function(){return "dojox.dtl.tag.loader.BlockNode";}});ddtl.ExtendsNode=_4.extend(function(_149,_14a,_14b,_14c,key){this.getTemplate=_149;this.nodelist=_14a;this.shared=_14b;this.parent=_14c;this.key=key;},{parents:{},getParent:function(_14d){var _14e=this.parent;if(!_14e){var _14f;_14e=this.parent=_14d.get(this.key,false);if(!_14e){throw new Error("extends tag used a variable that did not resolve");}if(typeof _14e=="object"){var url=_14e.url||_14e.templatePath;if(_14e.shared){this.shared=true;}if(url){_14e=this.parent=url.toString();}else{if(_14e.templateString){_14f=_14e.templateString;_14e=this.parent=" ";}else{_14e=this.parent=this.parent.toString();}}}if(_14e&&_14e.indexOf("shared:")===0){this.shared=true;_14e=this.parent=_14e.substring(7,_14e.length);}}if(!_14e){throw new Error("Invalid template name in 'extends' tag.");}if(_14e.render){return _14e;}if(this.parents[_14e]){return this.parents[_14e];}this.parent=this.getTemplate(_14f||_6.dtl.text.getTemplateString(_14e));if(this.shared){this.parents[_14e]=this.parent;}return this.parent;},render:function(_150,_151){var _152=this.getParent(_150);_152.blocks=_152.blocks||{};_151.blocks=_151.blocks||{};for(var i=0,node;node=this.nodelist.contents[i];i++){if(node instanceof _6.dtl.tag.loader.BlockNode){var old=_152.blocks[node.name];if(old&&old.nodelist!=node.nodelist){_151=old.nodelist.unrender(_150,_151);}_152.blocks[node.name]=_151.blocks[node.name]={shared:this.shared,nodelist:node.nodelist,used:false};}}this.rendered=_152;return _152.nodelist.render(_150,_151,this);},unrender:function(_153,_154){return this.rendered.unrender(_153,_154,this);},toString:function(){return "dojox.dtl.block.ExtendsNode";}});ddtl.IncludeNode=_4.extend(function(path,_155,_156,text,_157){this._path=path;this.constant=_155;this.path=(_155)?path:new dd._Filter(path);this.getTemplate=_156;this.text=text;this.parsed=(arguments.length==5)?_157:true;},{_cache:[{},{}],render:function(_158,_159){var _15a=((this.constant)?this.path:this.path.resolve(_158)).toString();var _15b=Number(this.parsed);var _15c=false;if(_15a!=this.last){_15c=true;if(this.last){_159=this.unrender(_158,_159);}this.last=_15a;}var _15d=this._cache[_15b];if(_15b){if(!_15d[_15a]){_15d[_15a]=dd.text._resolveTemplateArg(_15a,true);}if(_15c){var _15e=this.getTemplate(_15d[_15a]);this.rendered=_15e.nodelist;}return this.rendered.render(_158,_159,this);}else{if(this.text instanceof dd._TextNode){if(_15c){this.rendered=this.text;this.rendered.set(dd.text._resolveTemplateArg(_15a,true));}return this.rendered.render(_158,_159);}else{if(!_15d[_15a]){var _15f=[];var div=document.createElement("div");div.innerHTML=dd.text._resolveTemplateArg(_15a,true);var _160=div.childNodes;while(_160.length){var _161=div.removeChild(_160[0]);_15f.push(_161);}_15d[_15a]=_15f;}if(_15c){this.nodelist=[];var _162=true;for(var i=0,_163;_163=_15d[_15a][i];i++){this.nodelist.push(_163.cloneNode(true));}}for(var i=0,node;node=this.nodelist[i];i++){_159=_159.concat(node);}}}return _159;},unrender:function(_164,_165){if(this.rendered){_165=this.rendered.unrender(_164,_165);}if(this.nodelist){for(var i=0,node;node=this.nodelist[i];i++){_165=_165.remove(node);}}return _165;},clone:function(_166){return new this.constructor(this._path,this.constant,this.getTemplate,this.text.clone(_166),this.parsed);}});_4.mixin(ddtl,{block:function(_167,_168){var _169=_168.contents.split();var name=_169[1];_167._blocks=_167._blocks||{};_167._blocks[name]=_167._blocks[name]||[];_167._blocks[name].push(name);var _16a=_167.parse(["endblock","endblock "+name]).rtrim();_167.next_token();return new _6.dtl.tag.loader.BlockNode(name,_16a);},extends_:function(_16b,_16c){var _16d=_16c.contents.split();var _16e=false;var _16f=null;var key=null;if(_16d[1].charAt(0)=="\""||_16d[1].charAt(0)=="'"){_16f=_16d[1].substring(1,_16d[1].length-1);}else{key=_16d[1];}if(_16f&&_16f.indexOf("shared:")==0){_16e=true;_16f=_16f.substring(7,_16f.length);}var _170=_16b.parse();return new _6.dtl.tag.loader.ExtendsNode(_16b.getTemplate,_170,_16e,_16f,key);},include:function(_171,_172){var _173=_172.contents.split();if(_173.length!=2){throw new Error(_173[0]+" tag takes one argument: the name of the template to be included");}var path=_173[1];var _174=false;if((path.charAt(0)=="\""||path.slice(-1)=="'")&&path.charAt(0)==path.slice(-1)){path=path.slice(1,-1);_174=true;}return new ddtl.IncludeNode(path,_174,_171.getTemplate,_171.create_text_node());},ssi:function(_175,_176){var _177=_176.contents.split();var _178=false;if(_177.length==3){_178=(_177.pop()=="parsed");if(!_178){throw new Error("Second (optional) argument to ssi tag must be 'parsed'");}}var node=ddtl.include(_175,new dd.Token(_176.token_type,_177.join(" ")));node.parsed=_178;return node;}});})();}if(!_4._hasResource["dojox.dtl.tag.misc"]){_4._hasResource["dojox.dtl.tag.misc"]=true;_4.provide("dojox.dtl.tag.misc");(function(){var dd=_6.dtl;var ddtm=dd.tag.misc;ddtm.DebugNode=_4.extend(function(text){this.text=text;},{render:function(_179,_17a){var keys=_179.getKeys();var _17b=[];var only={};for(var i=0,key;key=keys[i];i++){only[key]=_179[key];_17b+="["+key+": "+typeof _179[key]+"]\n";}return this.text.set(_17b).render(_179,_17a,this);},unrender:function(_17c,_17d){return _17d;},clone:function(_17e){return new this.constructor(this.text.clone(_17e));},toString:function(){return "ddtm.DebugNode";}});ddtm.FilterNode=_4.extend(function(_17f,_180){this._varnode=_17f;this._nodelist=_180;},{render:function(_181,_182){var _183=this._nodelist.render(_181,new _6.string.Builder());_181=_181.update({"var":_183.toString()});var _184=this._varnode.render(_181,_182);_181=_181.pop();return _182;},unrender:function(_185,_186){return _186;},clone:function(_187){return new this.constructor(this._expression,this._nodelist.clone(_187));}});ddtm.FirstOfNode=_4.extend(function(vars,text){this._vars=vars;this.vars=_4.map(vars,function(item){return new _6.dtl._Filter(item);});this.contents=text;},{render:function(_188,_189){for(var i=0,item;item=this.vars[i];i++){var _18a=item.resolve(_188);if(typeof _18a!="undefined"){if(_18a===null){_18a="null";}this.contents.set(_18a);return this.contents.render(_188,_189);}}return this.contents.unrender(_188,_189);},unrender:function(_18b,_18c){return this.contents.unrender(_18b,_18c);},clone:function(_18d){return new this.constructor(this._vars,this.contents.clone(_18d));}});ddtm.SpacelessNode=_4.extend(function(_18e,text){this.nodelist=_18e;this.contents=text;},{render:function(_18f,_190){if(_190.getParent){var _191=[_4.connect(_190,"onAddNodeComplete",this,"_watch"),_4.connect(_190,"onSetParent",this,"_watchParent")];_190=this.nodelist.render(_18f,_190);_4.disconnect(_191[0]);_4.disconnect(_191[1]);}else{var _192=this.nodelist.dummyRender(_18f);this.contents.set(_192.replace(/>\s+</g,"><"));_190=this.contents.render(_18f,_190);}return _190;},unrender:function(_193,_194){return this.nodelist.unrender(_193,_194);},clone:function(_195){return new this.constructor(this.nodelist.clone(_195),this.contents.clone(_195));},_isEmpty:function(node){return (node.nodeType==3&&!node.data.match(/[^\s\n]/));},_watch:function(node){if(this._isEmpty(node)){var _196=false;if(node.parentNode.firstChild==node){node.parentNode.removeChild(node);}}else{var _197=node.parentNode.childNodes;if(node.nodeType==1&&_197.length>2){for(var i=2,_198;_198=_197[i];i++){if(_197[i-2].nodeType==1&&this._isEmpty(_197[i-1])){node.parentNode.removeChild(_197[i-1]);return;}}}}},_watchParent:function(node){var _199=node.childNodes;if(_199.length){while(node.childNodes.length){var last=node.childNodes[node.childNodes.length-1];if(!this._isEmpty(last)){return;}node.removeChild(last);}}}});ddtm.TemplateTagNode=_4.extend(function(tag,text){this.tag=tag;this.contents=text;},{mapping:{openblock:"{%",closeblock:"%}",openvariable:"{{",closevariable:"}}",openbrace:"{",closebrace:"}",opencomment:"{#",closecomment:"#}"},render:function(_19a,_19b){this.contents.set(this.mapping[this.tag]);return this.contents.render(_19a,_19b);},unrender:function(_19c,_19d){return this.contents.unrender(_19c,_19d);},clone:function(_19e){return new this.constructor(this.tag,this.contents.clone(_19e));}});ddtm.WidthRatioNode=_4.extend(function(_19f,max,_1a0,text){this.current=new dd._Filter(_19f);this.max=new dd._Filter(max);this.width=_1a0;this.contents=text;},{render:function(_1a1,_1a2){var _1a3=+this.current.resolve(_1a1);var max=+this.max.resolve(_1a1);if(typeof _1a3!="number"||typeof max!="number"||!max){this.contents.set("");}else{this.contents.set(""+Math.round((_1a3/max)*this.width));}return this.contents.render(_1a1,_1a2);},unrender:function(_1a4,_1a5){return this.contents.unrender(_1a4,_1a5);},clone:function(_1a6){return new this.constructor(this.current.getExpression(),this.max.getExpression(),this.width,this.contents.clone(_1a6));}});ddtm.WithNode=_4.extend(function(_1a7,_1a8,_1a9){this.target=new dd._Filter(_1a7);this.alias=_1a8;this.nodelist=_1a9;},{render:function(_1aa,_1ab){var _1ac=this.target.resolve(_1aa);_1aa=_1aa.push();_1aa[this.alias]=_1ac;_1ab=this.nodelist.render(_1aa,_1ab);_1aa=_1aa.pop();return _1ab;},unrender:function(_1ad,_1ae){return _1ae;},clone:function(_1af){return new this.constructor(this.target.getExpression(),this.alias,this.nodelist.clone(_1af));}});_4.mixin(ddtm,{comment:function(_1b0,_1b1){_1b0.skip_past("endcomment");return dd._noOpNode;},debug:function(_1b2,_1b3){return new ddtm.DebugNode(_1b2.create_text_node());},filter:function(_1b4,_1b5){var rest=_1b5.contents.split(null,1)[1];var _1b6=_1b4.create_variable_node("var|"+rest);var _1b7=_1b4.parse(["endfilter"]);_1b4.next_token();return new ddtm.FilterNode(_1b6,_1b7);},firstof:function(_1b8,_1b9){var _1ba=_1b9.split_contents().slice(1);if(!_1ba.length){throw new Error("'firstof' statement requires at least one argument");}return new ddtm.FirstOfNode(_1ba,_1b8.create_text_node());},spaceless:function(_1bb,_1bc){var _1bd=_1bb.parse(["endspaceless"]);_1bb.delete_first_token();return new ddtm.SpacelessNode(_1bd,_1bb.create_text_node());},templatetag:function(_1be,_1bf){var _1c0=_1bf.contents.split();if(_1c0.length!=2){throw new Error("'templatetag' statement takes one argument");}var tag=_1c0[1];var _1c1=ddtm.TemplateTagNode.prototype.mapping;if(!_1c1[tag]){var keys=[];for(var key in _1c1){keys.push(key);}throw new Error("Invalid templatetag argument: '"+tag+"'. Must be one of: "+keys.join(", "));}return new ddtm.TemplateTagNode(tag,_1be.create_text_node());},widthratio:function(_1c2,_1c3){var _1c4=_1c3.contents.split();if(_1c4.length!=4){throw new Error("widthratio takes three arguments");}var _1c5=+_1c4[3];if(typeof _1c5!="number"){throw new Error("widthratio final argument must be an integer");}return new ddtm.WidthRatioNode(_1c4[1],_1c4[2],_1c5,_1c2.create_text_node());},with_:function(_1c6,_1c7){var _1c8=_1c7.split_contents();if(_1c8.length!=4||_1c8[2]!="as"){throw new Error("do_width expected format as 'with value as name'");}var _1c9=_1c6.parse(["endwith"]);_1c6.next_token();return new ddtm.WithNode(_1c8[1],_1c8[3],_1c9);}});})();}if(!_4._hasResource["dojox.dtl.ext-dojo.NodeList"]){_4._hasResource["dojox.dtl.ext-dojo.NodeList"]=true;_4.provide("dojox.dtl.ext-dojo.NodeList");_4.extend(_4.NodeList,{dtl:function(_1ca,_1cb){var d=_6.dtl;var self=this;var _1cc=function(_1cd,_1ce){var _1cf=_1cd.render(new d._Context(_1ce));self.forEach(function(node){node.innerHTML=_1cf;});};d.text._resolveTemplateArg(_1ca).addCallback(function(_1d0){_1ca=new d.Template(_1d0);d.text._resolveContextArg(_1cb).addCallback(function(_1d1){_1cc(_1ca,_1d1);});});return this;}});}}};});
diff --git a/js/dojo-1.6/dojox/dtl.xd.js.uncompressed.js b/js/dojo-1.6/dojox/dtl.xd.js.uncompressed.js new file mode 100644 index 0000000..b042750 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl.xd.js.uncompressed.js @@ -0,0 +1,2883 @@ +dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.string.Builder"],
+["provide", "dojox.string.tokenize"],
+["provide", "dojox.dtl._base"],
+["provide", "dojox.dtl"],
+["provide", "dojox.dtl.Context"],
+["provide", "dojox.dtl.tag.logic"],
+["provide", "dojox.dtl.tag.loop"],
+["provide", "dojo.date"],
+["provide", "dojox.date.php"],
+["provide", "dojox.dtl.utils.date"],
+["provide", "dojox.dtl.tag.date"],
+["provide", "dojox.dtl.tag.loader"],
+["provide", "dojox.dtl.tag.misc"],
+["provide", "dojox.dtl.ext-dojo.NodeList"]],
+defineResource: function(dojo, dijit, dojox){/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+/*
+ This is an optimized version of Dojo, built for deployment and not for
+ development. To get sources and documentation, please visit:
+
+ http://dojotoolkit.org
+*/
+
+if(!dojo._hasResource["dojox.string.Builder"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.string.Builder"] = true;
+dojo.provide("dojox.string.Builder");
+
+dojox.string.Builder = function(/*String?*/str){
+ // summary:
+ // A fast buffer for creating large strings.
+ //
+ // length: Number
+ // The current length of the internal string.
+
+ // N.B. the public nature of the internal buffer is no longer
+ // needed because the IE-specific fork is no longer needed--TRT.
+ var b = "";
+ this.length = 0;
+
+ this.append = function(/* String... */s){
+ // summary: Append all arguments to the end of the buffer
+ if(arguments.length>1){
+ /*
+ This is a loop unroll was designed specifically for Firefox;
+ it would seem that static index access on an Arguments
+ object is a LOT faster than doing dynamic index access.
+ Therefore, we create a buffer string and take advantage
+ of JS's switch fallthrough. The peformance of this method
+ comes very close to straight up string concatenation (+=).
+
+ If the arguments object length is greater than 9, we fall
+ back to standard dynamic access.
+
+ This optimization seems to have no real effect on either
+ Safari or Opera, so we just use it for all.
+
+ It turns out also that this loop unroll can increase performance
+ significantly with Internet Explorer, particularly when
+ as many arguments are provided as possible.
+
+ Loop unroll per suggestion from Kris Zyp, implemented by
+ Tom Trenka.
+
+ Note: added empty string to force a string cast if needed.
+ */
+ var tmp="", l=arguments.length;
+ switch(l){
+ case 9: tmp=""+arguments[8]+tmp;
+ case 8: tmp=""+arguments[7]+tmp;
+ case 7: tmp=""+arguments[6]+tmp;
+ case 6: tmp=""+arguments[5]+tmp;
+ case 5: tmp=""+arguments[4]+tmp;
+ case 4: tmp=""+arguments[3]+tmp;
+ case 3: tmp=""+arguments[2]+tmp;
+ case 2: {
+ b+=""+arguments[0]+arguments[1]+tmp;
+ break;
+ }
+ default: {
+ var i=0;
+ while(i<arguments.length){
+ tmp += arguments[i++];
+ }
+ b += tmp;
+ }
+ }
+ } else {
+ b += s;
+ }
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.concat = function(/*String...*/s){
+ // summary:
+ // Alias for append.
+ return this.append.apply(this, arguments); // dojox.string.Builder
+ };
+
+ this.appendArray = function(/*Array*/strings) {
+ // summary:
+ // Append an array of items to the internal buffer.
+
+ // Changed from String.prototype.concat.apply because of IE.
+ return this.append.apply(this, strings); // dojox.string.Builder
+ };
+
+ this.clear = function(){
+ // summary:
+ // Remove all characters from the buffer.
+ b = "";
+ this.length = 0;
+ return this; // dojox.string.Builder
+ };
+
+ this.replace = function(/* String */oldStr, /* String */ newStr){
+ // summary:
+ // Replace instances of one string with another in the buffer.
+ b = b.replace(oldStr,newStr);
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.remove = function(/* Number */start, /* Number? */len){
+ // summary:
+ // Remove len characters starting at index start. If len
+ // is not provided, the end of the string is assumed.
+ if(len===undefined){ len = b.length; }
+ if(len == 0){ return this; }
+ b = b.substr(0, start) + b.substr(start+len);
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.insert = function(/* Number */index, /* String */str){
+ // summary:
+ // Insert string str starting at index.
+ if(index == 0){
+ b = str + b;
+ }else{
+ b = b.slice(0, index) + str + b.slice(index);
+ }
+ this.length = b.length;
+ return this; // dojox.string.Builder
+ };
+
+ this.toString = function(){
+ // summary:
+ // Return the string representation of the internal buffer.
+ return b; // String
+ };
+
+ // initialize the buffer.
+ if(str){ this.append(str); }
+};
+
+}
+
+if(!dojo._hasResource["dojox.string.tokenize"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.string.tokenize"] = true;
+dojo.provide("dojox.string.tokenize");
+
+dojox.string.tokenize = function(/*String*/ str, /*RegExp*/ re, /*Function?*/ parseDelim, /*Object?*/ instance){
+ // summary:
+ // Split a string by a regular expression with the ability to capture the delimeters
+ // parseDelim:
+ // Each group (excluding the 0 group) is passed as a parameter. If the function returns
+ // a value, it's added to the list of tokens.
+ // instance:
+ // Used as the "this" instance when calling parseDelim
+ var tokens = [];
+ var match, content, lastIndex = 0;
+ while(match = re.exec(str)){
+ content = str.slice(lastIndex, re.lastIndex - match[0].length);
+ if(content.length){
+ tokens.push(content);
+ }
+ if(parseDelim){
+ if(dojo.isOpera){
+ var copy = match.slice(0);
+ while(copy.length < match.length){
+ copy.push(null);
+ }
+ match = copy;
+ }
+ var parsed = parseDelim.apply(instance, match.slice(1).concat(tokens.length));
+ if(typeof parsed != "undefined"){
+ tokens.push(parsed);
+ }
+ }
+ lastIndex = re.lastIndex;
+ }
+ content = str.slice(lastIndex);
+ if(content.length){
+ tokens.push(content);
+ }
+ return tokens;
+}
+
+}
+
+if(!dojo._hasResource["dojox.dtl._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._base"] = true;
+dojo.provide("dojox.dtl._base");
+
+
+
+
+dojo.experimental("dojox.dtl");
+
+(function(){
+ var dd = dojox.dtl;
+
+ dd.TOKEN_BLOCK = -1;
+ dd.TOKEN_VAR = -2;
+ dd.TOKEN_COMMENT = -3;
+ dd.TOKEN_TEXT = 3;
+
+ dd._Context = dojo.extend(function(dict){
+ // summary: Pass one of these when rendering a template to tell the template what values to use.
+ if(dict){
+ dojo._mixin(this, dict);
+ if(dict.get){
+ // Preserve passed getter and restore prototype get
+ this._getter = dict.get;
+ delete this.get;
+ }
+ }
+ },
+ {
+ push: function(){
+ var last = this;
+ var context = dojo.delegate(this);
+ context.pop = function(){ return last; }
+ return context;
+ },
+ pop: function(){
+ throw new Error("pop() called on empty Context");
+ },
+ get: function(key, otherwise){
+ var n = this._normalize;
+
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return n(got);
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return n(this[key]);
+ }
+
+ return otherwise;
+ },
+ _normalize: function(value){
+ if(value instanceof Date){
+ value.year = value.getFullYear();
+ value.month = value.getMonth() + 1;
+ value.day = value.getDate();
+ value.date = value.year + "-" + ("0" + value.month).slice(-2) + "-" + ("0" + value.day).slice(-2);
+ value.hour = value.getHours();
+ value.minute = value.getMinutes();
+ value.second = value.getSeconds();
+ value.microsecond = value.getMilliseconds();
+ }
+ return value;
+ },
+ update: function(dict){
+ var context = this.push();
+ if(dict){
+ dojo._mixin(this, dict);
+ }
+ return context;
+ }
+ });
+
+ var smart_split_re = /("(?:[^"\\]*(?:\\.[^"\\]*)*)"|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)/g;
+ var split_re = /\s+/g;
+ var split = function(/*String|RegExp?*/ splitter, /*Integer?*/ limit){
+ splitter = splitter || split_re;
+ if(!(splitter instanceof RegExp)){
+ splitter = new RegExp(splitter, "g");
+ }
+ if(!splitter.global){
+ throw new Error("You must use a globally flagged RegExp with split " + splitter);
+ }
+ splitter.exec(""); // Reset the global
+
+ var part, parts = [], lastIndex = 0, i = 0;
+ while(part = splitter.exec(this)){
+ parts.push(this.slice(lastIndex, splitter.lastIndex - part[0].length));
+ lastIndex = splitter.lastIndex;
+ if(limit && (++i > limit - 1)){
+ break;
+ }
+ }
+ parts.push(this.slice(lastIndex));
+ return parts;
+ }
+
+ dd.Token = function(token_type, contents){
+ this.token_type = token_type;
+ this.contents = new String(dojo.trim(contents));
+ this.contents.split = split;
+ this.split = function(){
+ return String.prototype.split.apply(this.contents, arguments);
+ }
+ }
+ dd.Token.prototype.split_contents = function(/*Integer?*/ limit){
+ var bit, bits = [], i = 0;
+ limit = limit || 999;
+ while(i++ < limit && (bit = smart_split_re.exec(this.contents))){
+ bit = bit[0];
+ if(bit.charAt(0) == '"' && bit.slice(-1) == '"'){
+ bits.push('"' + bit.slice(1, -1).replace('\\"', '"').replace('\\\\', '\\') + '"');
+ }else if(bit.charAt(0) == "'" && bit.slice(-1) == "'"){
+ bits.push("'" + bit.slice(1, -1).replace("\\'", "'").replace('\\\\', '\\') + "'");
+ }else{
+ bits.push(bit);
+ }
+ }
+ return bits;
+ }
+
+ var ddt = dd.text = {
+ _get: function(module, name, errorless){
+ // summary: Used to find both tags and filters
+ var params = dd.register.get(module, name.toLowerCase(), errorless);
+ if(!params){
+ if(!errorless){
+ throw new Error("No tag found for " + name);
+ }
+ return null;
+ }
+
+ var fn = params[1];
+ var require = params[2];
+
+ var parts;
+ if(fn.indexOf(":") != -1){
+ parts = fn.split(":");
+ fn = parts.pop();
+ }
+
+ dojo["require"](require);
+
+ var parent = dojo.getObject(require);
+
+ return parent[fn || name] || parent[name + "_"] || parent[fn + "_"];
+ },
+ getTag: function(name, errorless){
+ return ddt._get("tag", name, errorless);
+ },
+ getFilter: function(name, errorless){
+ return ddt._get("filter", name, errorless);
+ },
+ getTemplate: function(file){
+ return new dd.Template(ddt.getTemplateString(file));
+ },
+ getTemplateString: function(file){
+ return dojo._getText(file.toString()) || "";
+ },
+ _resolveLazy: function(location, sync, json){
+ if(sync){
+ if(json){
+ return dojo.fromJson(dojo._getText(location)) || {};
+ }else{
+ return dd.text.getTemplateString(location);
+ }
+ }else{
+ return dojo.xhrGet({
+ handleAs: (json) ? "json" : "text",
+ url: location
+ });
+ }
+ },
+ _resolveTemplateArg: function(arg, sync){
+ if(ddt._isTemplate(arg)){
+ if(!sync){
+ var d = new dojo.Deferred();
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync);
+ },
+ _isTemplate: function(arg){
+ return (typeof arg == "undefined") || (typeof arg == "string" && (arg.match(/^\s*[<{]/) || arg.indexOf(" ") != -1));
+ },
+ _resolveContextArg: function(arg, sync){
+ if(arg.constructor == Object){
+ if(!sync){
+ var d = new dojo.Deferred;
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync, true);
+ },
+ _re: /(?:\{\{\s*(.+?)\s*\}\}|\{%\s*(load\s*)?(.+?)\s*%\})/g,
+ tokenize: function(str){
+ return dojox.string.tokenize(str, ddt._re, ddt._parseDelims);
+ },
+ _parseDelims: function(varr, load, tag){
+ if(varr){
+ return [dd.TOKEN_VAR, varr];
+ }else if(load){
+ var parts = dojo.trim(tag).split(/\s+/g);
+ for(var i = 0, part; part = parts[i]; i++){
+ dojo["require"](part);
+ }
+ }else{
+ return [dd.TOKEN_BLOCK, tag];
+ }
+ }
+ }
+
+ dd.Template = dojo.extend(function(/*String|dojo._Url*/ template, /*Boolean*/ isString){
+ // template:
+ // The string or location of the string to
+ // use as a template
+ var str = isString ? template : ddt._resolveTemplateArg(template, true) || "";
+ var tokens = ddt.tokenize(str);
+ var parser = new dd._Parser(tokens);
+ this.nodelist = parser.parse();
+ },
+ {
+ update: function(node, context){
+ // node: DOMNode|String|dojo.NodeList
+ // A node reference or set of nodes
+ // context: dojo._Url|String|Object
+ // The context object or location
+ return ddt._resolveContextArg(context).addCallback(this, function(contextObject){
+ var content = this.render(new dd._Context(contextObject));
+ if(node.forEach){
+ node.forEach(function(item){
+ item.innerHTML = content;
+ });
+ }else{
+ dojo.byId(node).innerHTML = content;
+ }
+ return this;
+ });
+ },
+ render: function(context, /*concatenatable?*/ buffer){
+ buffer = buffer || this.getBuffer();
+ context = context || new dd._Context({});
+ return this.nodelist.render(context, buffer) + "";
+ },
+ getBuffer: function(){
+
+ return new dojox.string.Builder();
+ }
+ });
+
+ var qfRe = /\{\{\s*(.+?)\s*\}\}/g;
+ dd.quickFilter = function(str){
+ if(!str){
+ return new dd._NodeList();
+ }
+
+ if(str.indexOf("{%") == -1){
+ return new dd._QuickNodeList(dojox.string.tokenize(str, qfRe, function(token){
+ return new dd._Filter(token);
+ }));
+ }
+ }
+
+ dd._QuickNodeList = dojo.extend(function(contents){
+ this.contents = contents;
+ },
+ {
+ render: function(context, buffer){
+ for(var i=0, l=this.contents.length; i<l; i++){
+ if(this.contents[i].resolve){
+ buffer = buffer.concat(this.contents[i].resolve(context));
+ }else{
+ buffer = buffer.concat(this.contents[i]);
+ }
+ }
+ return buffer;
+ },
+ dummyRender: function(context){ return this.render(context, dd.Template.prototype.getBuffer()).toString(); },
+ clone: function(buffer){ return this; }
+ });
+
+ dd._Filter = dojo.extend(function(token){
+ // summary: Uses a string to find (and manipulate) a variable
+ if(!token) throw new Error("Filter must be called with variable name");
+ this.contents = token;
+
+ var cache = this._cache[token];
+ if(cache){
+ this.key = cache[0];
+ this.filters = cache[1];
+ }else{
+ this.filters = [];
+ dojox.string.tokenize(token, this._re, this._tokenize, this);
+ this._cache[token] = [this.key, this.filters];
+ }
+ },
+ {
+ _cache: {},
+ _re: /(?:^_\("([^\\"]*(?:\\.[^\\"])*)"\)|^"([^\\"]*(?:\\.[^\\"]*)*)"|^([a-zA-Z0-9_.]+)|\|(\w+)(?::(?:_\("([^\\"]*(?:\\.[^\\"])*)"\)|"([^\\"]*(?:\\.[^\\"]*)*)"|([a-zA-Z0-9_.]+)|'([^\\']*(?:\\.[^\\']*)*)'))?|^'([^\\']*(?:\\.[^\\']*)*)')/g,
+ _values: {
+ 0: '"', // _("text")
+ 1: '"', // "text"
+ 2: "", // variable
+ 8: '"' // 'text'
+ },
+ _args: {
+ 4: '"', // :_("text")
+ 5: '"', // :"text"
+ 6: "", // :variable
+ 7: "'"// :'text'
+ },
+ _tokenize: function(){
+ var pos, arg;
+
+ for(var i = 0, has = []; i < arguments.length; i++){
+ has[i] = (typeof arguments[i] != "undefined" && typeof arguments[i] == "string" && arguments[i]);
+ }
+
+ if(!this.key){
+ for(pos in this._values){
+ if(has[pos]){
+ this.key = this._values[pos] + arguments[pos] + this._values[pos];
+ break;
+ }
+ }
+ }else{
+ for(pos in this._args){
+ if(has[pos]){
+ var value = arguments[pos];
+ if(this._args[pos] == "'"){
+ value = value.replace(/\\'/g, "'");
+ }else if(this._args[pos] == '"'){
+ value = value.replace(/\\"/g, '"');
+ }
+ arg = [!this._args[pos], value];
+ break;
+ }
+ }
+ // Get a named filter
+ var fn = ddt.getFilter(arguments[3]);
+ if(!dojo.isFunction(fn)) throw new Error(arguments[3] + " is not registered as a filter");
+ this.filters.push([fn, arg]);
+ }
+ },
+ getExpression: function(){
+ return this.contents;
+ },
+ resolve: function(context){
+ if(typeof this.key == "undefined"){
+ return "";
+ }
+
+ var str = this.resolvePath(this.key, context);
+
+ for(var i = 0, filter; filter = this.filters[i]; i++){
+ // Each filter has the function in [0], a boolean in [1][0] of whether it's a variable or a string
+ // and [1][1] is either the variable name of the string content.
+ if(filter[1]){
+ if(filter[1][0]){
+ str = filter[0](str, this.resolvePath(filter[1][1], context));
+ }else{
+ str = filter[0](str, filter[1][1]);
+ }
+ }else{
+ str = filter[0](str);
+ }
+ }
+
+ return str;
+ },
+ resolvePath: function(path, context){
+ var current, parts;
+ var first = path.charAt(0);
+ var last = path.slice(-1);
+ if(!isNaN(parseInt(first))){
+ current = (path.indexOf(".") == -1) ? parseInt(path) : parseFloat(path);
+ }else if(first == '"' && first == last){
+ current = path.slice(1, -1);
+ }else{
+ if(path == "true"){ return true; }
+ if(path == "false"){ return false; }
+ if(path == "null" || path == "None"){ return null; }
+ parts = path.split(".");
+ current = context.get(parts[0]);
+
+ if(dojo.isFunction(current)){
+ var self = context.getThis && context.getThis();
+ if(current.alters_data){
+ current = "";
+ }else if(self){
+ current = current.call(self);
+ }else{
+ current = "";
+ }
+ }
+
+ for(var i = 1; i < parts.length; i++){
+ var part = parts[i];
+ if(current){
+ var base = current;
+ if(dojo.isObject(current) && part == "items" && typeof current[part] == "undefined"){
+ var items = [];
+ for(var key in current){
+ items.push([key, current[key]]);
+ }
+ current = items;
+ continue;
+ }
+
+ if(current.get && dojo.isFunction(current.get) && current.get.safe){
+ current = current.get(part);
+ }else if(typeof current[part] == "undefined"){
+ current = current[part];
+ break;
+ }else{
+ current = current[part];
+ }
+
+ if(dojo.isFunction(current)){
+ if(current.alters_data){
+ current = "";
+ }else{
+ current = current.call(base);
+ }
+ }else if(current instanceof Date){
+ current = dd._Context.prototype._normalize(current);
+ }
+ }else{
+ return "";
+ }
+ }
+ }
+ return current;
+ }
+ });
+
+ dd._TextNode = dd._Node = dojo.extend(function(/*Object*/ obj){
+ // summary: Basic catch-all node
+ this.contents = obj;
+ },
+ {
+ set: function(data){
+ this.contents = data;
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds content onto the buffer
+ return buffer.concat(this.contents);
+ },
+ isEmpty: function(){
+ return !dojo.trim(this.contents);
+ },
+ clone: function(){ return this; }
+ });
+
+ dd._NodeList = dojo.extend(function(/*Node[]*/ nodes){
+ // summary: Allows us to render a group of nodes
+ this.contents = nodes || [];
+ this.last = "";
+ },
+ {
+ push: function(node){
+ // summary: Add a new node to the list
+ this.contents.push(node);
+ return this;
+ },
+ concat: function(nodes){
+ this.contents = this.contents.concat(nodes);
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds all content onto the buffer
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].render(context, buffer);
+ if(!buffer) throw new Error("Template must return buffer");
+ }
+ return buffer;
+ },
+ dummyRender: function(context){
+ return this.render(context, dd.Template.prototype.getBuffer()).toString();
+ },
+ unrender: function(){ return arguments[1]; },
+ clone: function(){ return this; },
+ rtrim: function(){
+ while(1){
+ i = this.contents.length - 1;
+ if(this.contents[i] instanceof dd._TextNode && this.contents[i].isEmpty()){
+ this.contents.pop();
+ }else{
+ break;
+ }
+ }
+
+ return this;
+ }
+ });
+
+ dd._VarNode = dojo.extend(function(str){
+ // summary: A node to be processed as a variable
+ this.contents = new dd._Filter(str);
+ },
+ {
+ render: function(context, buffer){
+ var str = this.contents.resolve(context);
+ if(!str.safe){
+ str = dd._base.escape("" + str);
+ }
+ return buffer.concat(str);
+ }
+ });
+
+ dd._noOpNode = new function(){
+ // summary: Adds a no-op node. Useful in custom tags
+ this.render = this.unrender = function(){ return arguments[1]; }
+ this.clone = function(){ return this; }
+ }
+
+ dd._Parser = dojo.extend(function(tokens){
+ // summary: Parser used during initialization and for tag groups.
+ this.contents = tokens;
+ },
+ {
+ i: 0,
+ parse: function(/*Array?*/ stop_at){
+ // summary: Turns tokens into nodes
+ // description: Steps into tags are they're found. Blocks use the parse object
+ // to find their closing tag (the stop_at array). stop_at is inclusive, it
+ // returns the node that matched.
+ var terminators = {}, token;
+ stop_at = stop_at || [];
+ for(var i = 0; i < stop_at.length; i++){
+ terminators[stop_at[i]] = true;
+ }
+
+ var nodelist = new dd._NodeList();
+ while(this.i < this.contents.length){
+ token = this.contents[this.i++];
+ if(typeof token == "string"){
+ nodelist.push(new dd._TextNode(token));
+ }else{
+ var type = token[0];
+ var text = token[1];
+ if(type == dd.TOKEN_VAR){
+ nodelist.push(new dd._VarNode(text));
+ }else if(type == dd.TOKEN_BLOCK){
+ if(terminators[text]){
+ --this.i;
+ return nodelist;
+ }
+ var cmd = text.split(/\s+/g);
+ if(cmd.length){
+ cmd = cmd[0];
+ var fn = ddt.getTag(cmd);
+ if(fn){
+ nodelist.push(fn(this, new dd.Token(type, text)));
+ }
+ }
+ }
+ }
+ }
+
+ if(stop_at.length){
+ throw new Error("Could not find closing tag(s): " + stop_at.toString());
+ }
+
+ this.contents.length = 0;
+ return nodelist;
+ },
+ next_token: function(){
+ // summary: Returns the next token in the list.
+ var token = this.contents[this.i++];
+ return new dd.Token(token[0], token[1]);
+ },
+ delete_first_token: function(){
+ this.i++;
+ },
+ skip_past: function(endtag){
+ while(this.i < this.contents.length){
+ var token = this.contents[this.i++];
+ if(token[0] == dd.TOKEN_BLOCK && token[1] == endtag){
+ return;
+ }
+ }
+ throw new Error("Unclosed tag found when looking for " + endtag);
+ },
+ create_variable_node: function(expr){
+ return new dd._VarNode(expr);
+ },
+ create_text_node: function(expr){
+ return new dd._TextNode(expr || "");
+ },
+ getTemplate: function(file){
+ return new dd.Template(file);
+ }
+ });
+
+ dd.register = {
+ _registry: {
+ attributes: [],
+ tags: [],
+ filters: []
+ },
+ get: function(/*String*/ module, /*String*/ name){
+ var registry = dd.register._registry[module + "s"];
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(typeof entry[0] == "string"){
+ if(entry[0] == name){
+ return entry;
+ }
+ }else if(name.match(entry[0])){
+ return entry;
+ }
+ }
+ },
+ getAttributeTags: function(){
+ var tags = [];
+ var registry = dd.register._registry.attributes;
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(entry.length == 3){
+ tags.push(entry);
+ }else{
+ var fn = dojo.getObject(entry[1]);
+ if(fn && dojo.isFunction(fn)){
+ entry.push(fn);
+ tags.push(entry);
+ }
+ }
+ }
+ return tags;
+ },
+ _any: function(type, base, locations){
+ for(var path in locations){
+ for(var i = 0, fn; fn = locations[path][i]; i++){
+ var key = fn;
+ if(dojo.isArray(fn)){
+ key = fn[0];
+ fn = fn[1];
+ }
+ if(typeof key == "string"){
+ if(key.substr(0, 5) == "attr:"){
+ var attr = fn;
+ if(attr.substr(0, 5) == "attr:"){
+ attr = attr.slice(5);
+ }
+ dd.register._registry.attributes.push([attr.toLowerCase(), base + "." + path + "." + attr]);
+ }
+ key = key.toLowerCase()
+ }
+ dd.register._registry[type].push([
+ key,
+ fn,
+ base + "." + path
+ ]);
+ }
+ }
+ },
+ tags: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("tags", base, locations);
+ },
+ filters: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("filters", base, locations);
+ }
+ }
+
+ var escapeamp = /&/g;
+ var escapelt = /</g;
+ var escapegt = />/g;
+ var escapeqt = /'/g;
+ var escapedblqt = /"/g;
+ dd._base.escape = function(value){
+ // summary: Escapes a string's HTML
+ return dd.mark_safe(value.replace(escapeamp, '&').replace(escapelt, '<').replace(escapegt, '>').replace(escapedblqt, '"').replace(escapeqt, '''));
+ }
+
+ dd._base.safe = function(value){
+ if(typeof value == "string"){
+ value = new String(value);
+ }
+ if(typeof value == "object"){
+ value.safe = true;
+ }
+ return value;
+ }
+ dd.mark_safe = dd._base.safe;
+
+ dd.register.tags("dojox.dtl.tag", {
+ "date": ["now"],
+ "logic": ["if", "for", "ifequal", "ifnotequal"],
+ "loader": ["extends", "block", "include", "load", "ssi"],
+ "misc": ["comment", "debug", "filter", "firstof", "spaceless", "templatetag", "widthratio", "with"],
+ "loop": ["cycle", "ifchanged", "regroup"]
+ });
+ dd.register.filters("dojox.dtl.filter", {
+ "dates": ["date", "time", "timesince", "timeuntil"],
+ "htmlstrings": ["linebreaks", "linebreaksbr", "removetags", "striptags"],
+ "integers": ["add", "get_digit"],
+ "lists": ["dictsort", "dictsortreversed", "first", "join", "length", "length_is", "random", "slice", "unordered_list"],
+ "logic": ["default", "default_if_none", "divisibleby", "yesno"],
+ "misc": ["filesizeformat", "pluralize", "phone2numeric", "pprint"],
+ "strings": ["addslashes", "capfirst", "center", "cut", "fix_ampersands", "floatformat", "iriencode", "linenumbers", "ljust", "lower", "make_list", "rjust", "slugify", "stringformat", "title", "truncatewords", "truncatewords_html", "upper", "urlencode", "urlize", "urlizetrunc", "wordcount", "wordwrap"]
+ });
+ dd.register.filters("dojox.dtl", {
+ "_base": ["escape", "safe"]
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl"] = true;
+dojo.provide("dojox.dtl");
+
+
+}
+
+if(!dojo._hasResource["dojox.dtl.Context"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.Context"] = true;
+dojo.provide("dojox.dtl.Context");
+
+
+dojox.dtl.Context = dojo.extend(function(dict){
+ this._this = {};
+ dojox.dtl._Context.call(this, dict);
+}, dojox.dtl._Context.prototype,
+{
+ getKeys: function(){
+ var keys = [];
+ for(var key in this){
+ if(this.hasOwnProperty(key) && key != "_this"){
+ keys.push(key);
+ }
+ }
+ return keys;
+ },
+ extend: function(/*dojox.dtl.Context|Object*/ obj){
+ // summary: Returns a clone of this context object, with the items from the
+ // passed objecct mixed in.
+ return dojo.delegate(this, obj);
+ },
+ filter: function(/*dojox.dtl.Context|Object|String...*/ filter){
+ // summary: Returns a clone of this context, only containing the items
+ // defined in the filter.
+ var context = new dojox.dtl.Context();
+ var keys = [];
+ var i, arg;
+ if(filter instanceof dojox.dtl.Context){
+ keys = filter.getKeys();
+ }else if(typeof filter == "object"){
+ for(var key in filter){
+ keys.push(key);
+ }
+ }else{
+ for(i = 0; arg = arguments[i]; i++){
+ if(typeof arg == "string"){
+ keys.push(arg);
+ }
+ }
+ }
+
+ for(i = 0, key; key = keys[i]; i++){
+ context[key] = this[key];
+ }
+
+ return context;
+ },
+ setThis: function(/*Object*/ _this){
+ this._this = _this;
+ },
+ getThis: function(){
+ return this._this;
+ },
+ hasKey: function(key){
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return true;
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return true;
+ }
+
+ return false;
+ }
+});
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.logic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.logic"] = true;
+dojo.provide("dojox.dtl.tag.logic");
+
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddt = dd.text;
+ var ddtl = dd.tag.logic;
+
+ ddtl.IfNode = dojo.extend(function(bools, trues, falses, type){
+ this.bools = bools;
+ this.trues = trues;
+ this.falses = falses;
+ this.type = type;
+ },
+ {
+ render: function(context, buffer){
+ var i, bool, ifnot, filter, value;
+ if(this.type == "or"){
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ if((value && !ifnot) || (ifnot && !value)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }else{
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ // If we ever encounter a false value
+ if(value == ifnot){
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ buffer = (this.trues) ? this.trues.unrender(context, buffer) : buffer;
+ buffer = (this.falses) ? this.falses.unrender(context, buffer) : buffer;
+ return buffer;
+ },
+ clone: function(buffer){
+ var trues = (this.trues) ? this.trues.clone(buffer) : null;
+ var falses = (this.falses) ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.bools, trues, falses, this.type);
+ }
+ });
+
+ ddtl.IfEqualNode = dojo.extend(function(var1, var2, trues, falses, negate){
+ this.var1 = new dd._Filter(var1);
+ this.var2 = new dd._Filter(var2);
+ this.trues = trues;
+ this.falses = falses;
+ this.negate = negate;
+ },
+ {
+ render: function(context, buffer){
+ var var1 = this.var1.resolve(context);
+ var var2 = this.var2.resolve(context);
+ var1 = (typeof var1 != "undefined") ? var1 : "";
+ var2 = (typeof var1 != "undefined") ? var2 : "";
+ if((this.negate && var1 != var2) || (!this.negate && var1 == var2)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer, this);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer, this);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ },
+ unrender: function(context, buffer){
+ return ddtl.IfNode.prototype.unrender.call(this, context, buffer);
+ },
+ clone: function(buffer){
+ var trues = this.trues ? this.trues.clone(buffer) : null;
+ var falses = this.falses ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.var1.getExpression(), this.var2.getExpression(), trues, falses, this.negate);
+ }
+ });
+
+ ddtl.ForNode = dojo.extend(function(assign, loop, reversed, nodelist){
+ this.assign = assign;
+ this.loop = new dd._Filter(loop);
+ this.reversed = reversed;
+ this.nodelist = nodelist;
+ this.pool = [];
+ },
+ {
+ render: function(context, buffer){
+ var i, j, k;
+ var dirty = false;
+ var assign = this.assign;
+
+ for(k = 0; k < assign.length; k++){
+ if(typeof context[assign[k]] != "undefined"){
+ dirty = true;
+ context = context.push();
+ break;
+ }
+ }
+ if(!dirty && context.forloop){
+ dirty = true;
+ context = context.push();
+ }
+
+ var items = this.loop.resolve(context) || [];
+ for(i = items.length; i < this.pool.length; i++){
+ this.pool[i].unrender(context, buffer, this);
+ }
+ if(this.reversed){
+ items = items.slice(0).reverse();
+ }
+
+ var isObject = dojo.isObject(items) && !dojo.isArrayLike(items);
+ var arred = [];
+ if(isObject){
+ for(var key in items){
+ arred.push(items[key]);
+ }
+ }else{
+ arred = items;
+ }
+
+ var forloop = context.forloop = {
+ parentloop: context.get("forloop", {})
+ };
+ var j = 0;
+ for(i = 0; i < arred.length; i++){
+ var item = arred[i];
+
+ forloop.counter0 = j;
+ forloop.counter = j + 1;
+ forloop.revcounter0 = arred.length - j - 1;
+ forloop.revcounter = arred.length - j;
+ forloop.first = !j;
+ forloop.last = (j == arred.length - 1);
+
+ if(assign.length > 1 && dojo.isArrayLike(item)){
+ if(!dirty){
+ dirty = true;
+ context = context.push();
+ }
+ var zipped = {};
+ for(k = 0; k < item.length && k < assign.length; k++){
+ zipped[assign[k]] = item[k];
+ }
+ dojo.mixin(context, zipped);
+ }else{
+ context[assign[0]] = item;
+ }
+
+ if(j + 1 > this.pool.length){
+ this.pool.push(this.nodelist.clone(buffer));
+ }
+ buffer = this.pool[j++].render(context, buffer, this);
+ }
+
+ delete context.forloop;
+ if(dirty){
+ context = context.pop();
+ }else{
+ for(k = 0; k < assign.length; k++){
+ delete context[assign[k]];
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ for(var i = 0, pool; pool = this.pool[i]; i++){
+ buffer = pool.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.assign, this.loop.getExpression(), this.reversed, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ if_: function(parser, token){
+ var i, part, type, bools = [], parts = token.contents.split();
+ parts.shift();
+ token = parts.join(" ");
+ parts = token.split(" and ");
+ if(parts.length == 1){
+ type = "or";
+ parts = token.split(" or ");
+ }else{
+ type = "and";
+ for(i = 0; i < parts.length; i++){
+ if(parts[i].indexOf(" or ") != -1){
+ // Note, since we split by and, this is the only place we need to error check
+ throw new Error("'if' tags can't mix 'and' and 'or'");
+ }
+ }
+ }
+ for(i = 0; part = parts[i]; i++){
+ var not = false;
+ if(part.indexOf("not ") == 0){
+ part = part.slice(4);
+ not = true;
+ }
+ bools.push([not, new dd._Filter(part)]);
+ }
+ var trues = parser.parse(["else", "endif"]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse(["endif"]);
+ parser.next_token();
+ }
+ return new ddtl.IfNode(bools, trues, falses, type);
+ },
+ _ifequal: function(parser, token, negate){
+ var parts = token.split_contents();
+ if(parts.length != 3){
+ throw new Error(parts[0] + " takes two arguments");
+ }
+ var end = 'end' + parts[0];
+ var trues = parser.parse(["else", end]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse([end]);
+ parser.next_token();
+ }
+ return new ddtl.IfEqualNode(parts[1], parts[2], trues, falses, negate);
+ },
+ ifequal: function(parser, token){
+ return ddtl._ifequal(parser, token);
+ },
+ ifnotequal: function(parser, token){
+ return ddtl._ifequal(parser, token, true);
+ },
+ for_: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length < 4){
+ throw new Error("'for' statements should have at least four words: " + token.contents);
+ }
+ var reversed = parts[parts.length - 1] == "reversed";
+ var index = (reversed) ? -3 : -2;
+ if(parts[parts.length + index] != "in"){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ var loopvars = parts.slice(1, index).join(" ").split(/ *, */);
+ for(var i = 0; i < loopvars.length; i++){
+ if(!loopvars[i] || loopvars[i].indexOf(" ") != -1){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ }
+ var nodelist = parser.parse(["endfor"]);
+ parser.next_token();
+ return new ddtl.ForNode(loopvars, parts[parts.length + index + 1], reversed, nodelist);
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.loop"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loop"] = true;
+dojo.provide("dojox.dtl.tag.loop");
+
+
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loop;
+
+ ddtl.CycleNode = dojo.extend(function(cyclevars, name, text, shared){
+ this.cyclevars = cyclevars;
+ this.name = name;
+ this.contents = text;
+ this.shared = shared || {counter: -1, map: {}};
+ },
+ {
+ render: function(context, buffer){
+ if(context.forloop && !context.forloop.counter0){
+ this.shared.counter = -1;
+ }
+
+ ++this.shared.counter;
+ var value = this.cyclevars[this.shared.counter % this.cyclevars.length];
+
+ var map = this.shared.map;
+ if(!map[value]){
+ map[value] = new dd._Filter(value);
+ }
+ value = map[value].resolve(context, buffer);
+
+ if(this.name){
+ context[this.name] = value;
+ }
+ this.contents.set(value);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.cyclevars, this.name, this.contents.clone(buffer), this.shared);
+ }
+ });
+
+ ddtl.IfChangedNode = dojo.extend(function(nodes, vars, shared){
+ this.nodes = nodes;
+ this._vars = vars;
+ this.shared = shared || {last: null, counter: 0};
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ }, {
+ render: function(context, buffer){
+ if(context.forloop){
+ if(context.forloop.counter <= this.shared.counter){
+ this.shared.last = null;
+ }
+ this.shared.counter = context.forloop.counter;
+ }
+
+ var change;
+ if(this.vars.length){
+ change = dojo.toJson(dojo.map(this.vars, function(item){
+ return item.resolve(context);
+ }));
+ }else{
+ change = this.nodes.dummyRender(context, buffer);
+ }
+
+ if(change != this.shared.last){
+ var firstloop = (this.shared.last === null);
+ this.shared.last = change;
+ context = context.push();
+ context.ifchanged = {firstloop: firstloop};
+ buffer = this.nodes.render(context, buffer);
+ context = context.pop();
+ }else{
+ buffer = this.nodes.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodes.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodes.clone(buffer), this._vars, this.shared);
+ }
+ });
+
+ ddtl.RegroupNode = dojo.extend(function(expression, key, alias){
+ this._expression = expression;
+ this.expression = new dd._Filter(expression);
+ this.key = key;
+ this.alias = alias;
+ },
+ {
+ _push: function(container, grouper, stack){
+ if(stack.length){
+ container.push({ grouper: grouper, list: stack });
+ }
+ },
+ render: function(context, buffer){
+ context[this.alias] = [];
+ var list = this.expression.resolve(context);
+ if(list){
+ var last = null;
+ var stack = [];
+ for(var i = 0; i < list.length; i++){
+ var id = list[i][this.key];
+ if(last !== id){
+ this._push(context[this.alias], last, stack);
+ last = id;
+ stack = [list[i]];
+ }else{
+ stack.push(list[i]);
+ }
+ }
+ this._push(context[this.alias], last, stack);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(context, buffer){
+ return this;
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ cycle: function(parser, token){
+ // summary: Cycle among the given strings each time this tag is encountered
+ var args = token.split_contents();
+
+ if(args.length < 2){
+ throw new Error("'cycle' tag requires at least two arguments");
+ }
+
+ if(args[1].indexOf(",") != -1){
+ var vars = args[1].split(",");
+ args = [args[0]];
+ for(var i = 0; i < vars.length; i++){
+ args.push('"' + vars[i] + '"');
+ }
+ }
+
+ if(args.length == 2){
+ var name = args[args.length - 1];
+
+ if(!parser._namedCycleNodes){
+ throw new Error("No named cycles in template: '" + name + "' is not defined");
+ }
+ if(!parser._namedCycleNodes[name]){
+ throw new Error("Named cycle '" + name + "' does not exist");
+ }
+
+ return parser._namedCycleNodes[name];
+ }
+
+ if(args.length > 4 && args[args.length - 2] == "as"){
+ var name = args[args.length - 1];
+
+ var node = new ddtl.CycleNode(args.slice(1, args.length - 2), name, parser.create_text_node());
+
+ if(!parser._namedCycleNodes){
+ parser._namedCycleNodes = {};
+ }
+ parser._namedCycleNodes[name] = node;
+ }else{
+ node = new ddtl.CycleNode(args.slice(1), null, parser.create_text_node());
+ }
+
+ return node;
+ },
+ ifchanged: function(parser, token){
+ var parts = token.contents.split();
+ var nodes = parser.parse(["endifchanged"]);
+ parser.delete_first_token();
+ return new ddtl.IfChangedNode(nodes, parts.slice(1));
+ },
+ regroup: function(parser, token){
+ var tokens = dojox.string.tokenize(token.contents, /(\s+)/g, function(spaces){
+ return spaces;
+ });
+ if(tokens.length < 11 || tokens[tokens.length - 3] != "as" || tokens[tokens.length - 7] != "by"){
+ throw new Error("Expected the format: regroup list by key as newList");
+ }
+ var expression = tokens.slice(2, -8).join("");
+ var key = tokens[tokens.length - 5];
+ var alias = tokens[tokens.length - 1];
+ return new ddtl.RegroupNode(expression, key, alias);
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojo.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo.date"] = true;
+dojo.provide("dojo.date");
+
+
+dojo.getObject("date", true, dojo);
+
+/*=====
+dojo.date = {
+ // summary: Date manipulation utilities
+}
+=====*/
+
+dojo.date.getDaysInMonth = function(/*Date*/dateObject){
+ // summary:
+ // Returns the number of days in the month used by dateObject
+ var month = dateObject.getMonth();
+ var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+ if(month == 1 && dojo.date.isLeapYear(dateObject)){ return 29; } // Number
+ return days[month]; // Number
+};
+
+dojo.date.isLeapYear = function(/*Date*/dateObject){
+ // summary:
+ // Determines if the year of the dateObject is a leap year
+ // description:
+ // Leap years are years with an additional day YYYY-02-29, where the
+ // year number is a multiple of four with the following exception: If
+ // a year is a multiple of 100, then it is only a leap year if it is
+ // also a multiple of 400. For example, 1900 was not a leap year, but
+ // 2000 is one.
+
+ var year = dateObject.getFullYear();
+ return !(year%400) || (!(year%4) && !!(year%100)); // Boolean
+};
+
+// FIXME: This is not localized
+dojo.date.getTimezoneName = function(/*Date*/dateObject){
+ // summary:
+ // Get the user's time zone as provided by the browser
+ // dateObject:
+ // Needed because the timezone may vary with time (daylight savings)
+ // description:
+ // Try to get time zone info from toString or toLocaleString method of
+ // the Date object -- UTC offset is not a time zone. See
+ // http://www.twinsun.com/tz/tz-link.htm Note: results may be
+ // inconsistent across browsers.
+
+ var str = dateObject.toString(); // Start looking in toString
+ var tz = ''; // The result -- return empty string if nothing found
+ var match;
+
+ // First look for something in parentheses -- fast lookup, no regex
+ var pos = str.indexOf('(');
+ if(pos > -1){
+ tz = str.substring(++pos, str.indexOf(')'));
+ }else{
+ // If at first you don't succeed ...
+ // If IE knows about the TZ, it appears before the year
+ // Capital letters or slash before a 4-digit year
+ // at the end of string
+ var pat = /([A-Z\/]+) \d{4}$/;
+ if((match = str.match(pat))){
+ tz = match[1];
+ }else{
+ // Some browsers (e.g. Safari) glue the TZ on the end
+ // of toLocaleString instead of putting it in toString
+ str = dateObject.toLocaleString();
+ // Capital letters or slash -- end of string,
+ // after space
+ pat = / ([A-Z\/]+)$/;
+ if((match = str.match(pat))){
+ tz = match[1];
+ }
+ }
+ }
+
+ // Make sure it doesn't somehow end up return AM or PM
+ return (tz == 'AM' || tz == 'PM') ? '' : tz; // String
+};
+
+// Utility methods to do arithmetic calculations with Dates
+
+dojo.date.compare = function(/*Date*/date1, /*Date?*/date2, /*String?*/portion){
+ // summary:
+ // Compare two date objects by date, time, or both.
+ // description:
+ // Returns 0 if equal, positive if a > b, else negative.
+ // date1:
+ // Date object
+ // date2:
+ // Date object. If not specified, the current Date is used.
+ // portion:
+ // A string indicating the "date" or "time" portion of a Date object.
+ // Compares both "date" and "time" by default. One of the following:
+ // "date", "time", "datetime"
+
+ // Extra step required in copy for IE - see #3112
+ date1 = new Date(+date1);
+ date2 = new Date(+(date2 || new Date()));
+
+ if(portion == "date"){
+ // Ignore times and compare dates.
+ date1.setHours(0, 0, 0, 0);
+ date2.setHours(0, 0, 0, 0);
+ }else if(portion == "time"){
+ // Ignore dates and compare times.
+ date1.setFullYear(0, 0, 0);
+ date2.setFullYear(0, 0, 0);
+ }
+
+ if(date1 > date2){ return 1; } // int
+ if(date1 < date2){ return -1; } // int
+ return 0; // int
+};
+
+dojo.date.add = function(/*Date*/date, /*String*/interval, /*int*/amount){
+ // summary:
+ // Add to a Date in intervals of different size, from milliseconds to years
+ // date: Date
+ // Date object to start with
+ // interval:
+ // A string representing the interval. One of the following:
+ // "year", "month", "day", "hour", "minute", "second",
+ // "millisecond", "quarter", "week", "weekday"
+ // amount:
+ // How much to add to the date.
+
+ var sum = new Date(+date); // convert to Number before copying to accomodate IE (#3112)
+ var fixOvershoot = false;
+ var property = "Date";
+
+ switch(interval){
+ case "day":
+ break;
+ case "weekday":
+ //i18n FIXME: assumes Saturday/Sunday weekend, but this is not always true. see dojo.cldr.supplemental
+
+ // Divide the increment time span into weekspans plus leftover days
+ // e.g., 8 days is one 5-day weekspan / and two leftover days
+ // Can't have zero leftover days, so numbers divisible by 5 get
+ // a days value of 5, and the remaining days make up the number of weeks
+ var days, weeks;
+ var mod = amount % 5;
+ if(!mod){
+ days = (amount > 0) ? 5 : -5;
+ weeks = (amount > 0) ? ((amount-5)/5) : ((amount+5)/5);
+ }else{
+ days = mod;
+ weeks = parseInt(amount/5);
+ }
+ // Get weekday value for orig date param
+ var strt = date.getDay();
+ // Orig date is Sat / positive incrementer
+ // Jump over Sun
+ var adj = 0;
+ if(strt == 6 && amount > 0){
+ adj = 1;
+ }else if(strt == 0 && amount < 0){
+ // Orig date is Sun / negative incrementer
+ // Jump back over Sat
+ adj = -1;
+ }
+ // Get weekday val for the new date
+ var trgt = strt + days;
+ // New date is on Sat or Sun
+ if(trgt == 0 || trgt == 6){
+ adj = (amount > 0) ? 2 : -2;
+ }
+ // Increment by number of weeks plus leftover days plus
+ // weekend adjustments
+ amount = (7 * weeks) + days + adj;
+ break;
+ case "year":
+ property = "FullYear";
+ // Keep increment/decrement from 2/29 out of March
+ fixOvershoot = true;
+ break;
+ case "week":
+ amount *= 7;
+ break;
+ case "quarter":
+ // Naive quarter is just three months
+ amount *= 3;
+ // fallthrough...
+ case "month":
+ // Reset to last day of month if you overshoot
+ fixOvershoot = true;
+ property = "Month";
+ break;
+// case "hour":
+// case "minute":
+// case "second":
+// case "millisecond":
+ default:
+ property = "UTC"+interval.charAt(0).toUpperCase() + interval.substring(1) + "s";
+ }
+
+ if(property){
+ sum["set"+property](sum["get"+property]()+amount);
+ }
+
+ if(fixOvershoot && (sum.getDate() < date.getDate())){
+ sum.setDate(0);
+ }
+
+ return sum; // Date
+};
+
+dojo.date.difference = function(/*Date*/date1, /*Date?*/date2, /*String?*/interval){
+ // summary:
+ // Get the difference in a specific unit of time (e.g., number of
+ // months, weeks, days, etc.) between two dates, rounded to the
+ // nearest integer.
+ // date1:
+ // Date object
+ // date2:
+ // Date object. If not specified, the current Date is used.
+ // interval:
+ // A string representing the interval. One of the following:
+ // "year", "month", "day", "hour", "minute", "second",
+ // "millisecond", "quarter", "week", "weekday"
+ // Defaults to "day".
+
+ date2 = date2 || new Date();
+ interval = interval || "day";
+ var yearDiff = date2.getFullYear() - date1.getFullYear();
+ var delta = 1; // Integer return value
+
+ switch(interval){
+ case "quarter":
+ var m1 = date1.getMonth();
+ var m2 = date2.getMonth();
+ // Figure out which quarter the months are in
+ var q1 = Math.floor(m1/3) + 1;
+ var q2 = Math.floor(m2/3) + 1;
+ // Add quarters for any year difference between the dates
+ q2 += (yearDiff * 4);
+ delta = q2 - q1;
+ break;
+ case "weekday":
+ var days = Math.round(dojo.date.difference(date1, date2, "day"));
+ var weeks = parseInt(dojo.date.difference(date1, date2, "week"));
+ var mod = days % 7;
+
+ // Even number of weeks
+ if(mod == 0){
+ days = weeks*5;
+ }else{
+ // Weeks plus spare change (< 7 days)
+ var adj = 0;
+ var aDay = date1.getDay();
+ var bDay = date2.getDay();
+
+ weeks = parseInt(days/7);
+ mod = days % 7;
+ // Mark the date advanced by the number of
+ // round weeks (may be zero)
+ var dtMark = new Date(date1);
+ dtMark.setDate(dtMark.getDate()+(weeks*7));
+ var dayMark = dtMark.getDay();
+
+ // Spare change days -- 6 or less
+ if(days > 0){
+ switch(true){
+ // Range starts on Sat
+ case aDay == 6:
+ adj = -1;
+ break;
+ // Range starts on Sun
+ case aDay == 0:
+ adj = 0;
+ break;
+ // Range ends on Sat
+ case bDay == 6:
+ adj = -1;
+ break;
+ // Range ends on Sun
+ case bDay == 0:
+ adj = -2;
+ break;
+ // Range contains weekend
+ case (dayMark + mod) > 5:
+ adj = -2;
+ }
+ }else if(days < 0){
+ switch(true){
+ // Range starts on Sat
+ case aDay == 6:
+ adj = 0;
+ break;
+ // Range starts on Sun
+ case aDay == 0:
+ adj = 1;
+ break;
+ // Range ends on Sat
+ case bDay == 6:
+ adj = 2;
+ break;
+ // Range ends on Sun
+ case bDay == 0:
+ adj = 1;
+ break;
+ // Range contains weekend
+ case (dayMark + mod) < 0:
+ adj = 2;
+ }
+ }
+ days += adj;
+ days -= (weeks*2);
+ }
+ delta = days;
+ break;
+ case "year":
+ delta = yearDiff;
+ break;
+ case "month":
+ delta = (date2.getMonth() - date1.getMonth()) + (yearDiff * 12);
+ break;
+ case "week":
+ // Truncate instead of rounding
+ // Don't use Math.floor -- value may be negative
+ delta = parseInt(dojo.date.difference(date1, date2, "day")/7);
+ break;
+ case "day":
+ delta /= 24;
+ // fallthrough
+ case "hour":
+ delta /= 60;
+ // fallthrough
+ case "minute":
+ delta /= 60;
+ // fallthrough
+ case "second":
+ delta /= 1000;
+ // fallthrough
+ case "millisecond":
+ delta *= date2.getTime() - date1.getTime();
+ }
+
+ // Round for fractional values and DST leaps
+ return Math.round(delta); // Number (integer)
+};
+
+}
+
+if(!dojo._hasResource["dojox.date.php"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.date.php"] = true;
+dojo.provide("dojox.date.php");
+
+
+
+dojox.date.php.format = function(/*Date*/ date, /*String*/ format){
+ // summary: Get a formatted string for a given date object
+ var df = new dojox.date.php.DateFormat(format);
+ return df.format(date);
+}
+
+dojox.date.php.DateFormat = function(/*String*/ format){
+ // summary: Format the internal date object
+ if(!this.regex){
+ var keys = [];
+ for(var key in this.constructor.prototype){
+ if(dojo.isString(key) && key.length == 1 && dojo.isFunction(this[key])){
+ keys.push(key);
+ }
+ }
+ this.constructor.prototype.regex = new RegExp("(?:(\\\\.)|([" + keys.join("") + "]))", "g");
+ }
+
+ var replacements = [];
+
+ this.tokens = dojox.string.tokenize(format, this.regex, function(escape, token, i){
+ if(token){
+ replacements.push([i, token]);
+ return token;
+ }
+ if(escape){
+ return escape.charAt(1);
+ }
+ });
+
+ this.replacements = replacements;
+}
+dojo.extend(dojox.date.php.DateFormat, {
+ weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
+ weekdays_3: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
+ months_3: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
+ monthdays: [31,28,31,30,31,30,31,31,30,31,30,31],
+
+ format: function(/*Date*/ date){
+ this.date = date;
+ for(var i = 0, replacement; replacement = this.replacements[i]; i++){
+ this.tokens[replacement[0]] = this[replacement[1]]();
+ }
+ return this.tokens.join("");
+ },
+
+ // Day
+
+ d: function(){
+ // summary: Day of the month, 2 digits with leading zeros
+ var j = this.j();
+ return (j.length == 1) ? "0" + j : j;
+ },
+
+ D: function(){
+ // summary: A textual representation of a day, three letters
+ return this.weekdays_3[this.date.getDay()];
+ },
+
+ j: function(){
+ // summary: Day of the month without leading zeros
+ return this.date.getDate() + "";
+ },
+
+ l: function(){
+ // summary: A full textual representation of the day of the week
+ return this.weekdays[this.date.getDay()];
+ },
+
+ N: function(){
+ // summary: ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)
+ var w = this.w();
+ return (!w) ? 7 : w;
+ },
+
+ S: function(){
+ // summary: English ordinal suffix for the day of the month, 2 characters
+ switch(this.date.getDate()){
+ case 11: case 12: case 13: return "th";
+ case 1: case 21: case 31: return "st";
+ case 2: case 22: return "nd";
+ case 3: case 23: return "rd";
+ default: return "th";
+ }
+ },
+
+ w: function(){
+ // summary: Numeric representation of the day of the week
+ return this.date.getDay() + "";
+ },
+
+ z: function(){
+ // summary: The day of the year (starting from 0)
+ var millis = this.date.getTime() - new Date(this.date.getFullYear(), 0, 1).getTime();
+ return Math.floor(millis/86400000) + "";
+ },
+
+ // Week
+
+ W: function(){
+ // summary: ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)
+ var week;
+ var jan1_w = new Date(this.date.getFullYear(), 0, 1).getDay() + 1;
+ var w = this.date.getDay() + 1;
+ var z = parseInt(this.z());
+
+ if(z <= (8 - jan1_w) && jan1_w > 4){
+ var last_year = new Date(this.date.getFullYear() - 1, this.date.getMonth(), this.date.getDate());
+ if(jan1_w == 5 || (jan1_w == 6 && dojo.date.isLeapYear(last_year))){
+ week = 53;
+ }else{
+ week = 52;
+ }
+ }else{
+ var i;
+ if(Boolean(this.L())){
+ i = 366;
+ }else{
+ i = 365;
+ }
+ if((i - z) < (4 - w)){
+ week = 1;
+ }else{
+ var j = z + (7 - w) + (jan1_w - 1);
+ week = Math.ceil(j / 7);
+ if(jan1_w > 4){
+ --week;
+ }
+ }
+ }
+
+ return week;
+ },
+
+ // Month
+
+ F: function(){
+ // summary: A full textual representation of a month, such as January or March
+ return this.months[this.date.getMonth()];
+ },
+
+ m: function(){
+ // summary: Numeric representation of a month, with leading zeros
+ var n = this.n();
+ return (n.length == 1) ? "0" + n : n;
+ },
+
+ M: function(){
+ // summary: A short textual representation of a month, three letters
+ return this.months_3[this.date.getMonth()];
+ },
+
+ n: function(){
+ // summary: Numeric representation of a month, without leading zeros
+ return this.date.getMonth() + 1 + "";
+ },
+
+ t: function(){
+ // summary: Number of days in the given month
+ return (Boolean(this.L()) && this.date.getMonth() == 1) ? 29 : this.monthdays[this.getMonth()];
+ },
+
+ // Year
+
+ L: function(){
+ // summary: Whether it's a leap year
+ return (dojo.date.isLeapYear(this.date)) ? "1" : "0";
+ },
+
+ o: function(){
+ // summary:
+ // ISO-8601 year number. This has the same value as Y, except that if
+ // the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)
+ // TODO: Figure out what this means
+ },
+
+ Y: function(){
+ // summary: A full numeric representation of a year, 4 digits
+ return this.date.getFullYear() + "";
+ },
+
+ y: function(){
+ // summary: A two digit representation of a year
+ return this.Y().slice(-2);
+ },
+
+ // Time
+
+ a: function(){
+ // summary: Lowercase Ante meridiem and Post meridiem
+ return this.date.getHours() >= 12 ? "pm" : "am";
+ },
+
+ b: function(){
+ // summary: Uppercase Ante meridiem and Post meridiem
+ return this.a().toUpperCase();
+ },
+
+ B: function(){
+ // summary:
+ // Swatch Internet time
+ // A day is 1,000 beats. All time is measured from GMT + 1
+ var off = this.date.getTimezoneOffset() + 60;
+ var secs = (this.date.getHours() * 3600) + (this.date.getMinutes() * 60) + this.getSeconds() + (off * 60);
+ var beat = Math.abs(Math.floor(secs / 86.4) % 1000) + "";
+ while(beat.length < 2) beat = "0" + beat;
+ return beat;
+ },
+
+ g: function(){
+ // summary: 12-hour format of an hour without leading zeros
+ return (this.date.getHours() > 12) ? this.date.getHours() - 12 + "" : this.date.getHours() + "";
+ },
+
+ G: function(){
+ // summary: 24-hour format of an hour without leading zeros
+ return this.date.getHours() + "";
+ },
+
+ h: function(){
+ // summary: 12-hour format of an hour with leading zeros
+ var g = this.g();
+ return (g.length == 1) ? "0" + g : g;
+ },
+
+ H: function(){
+ // summary: 24-hour format of an hour with leading zeros
+ var G = this.G();
+ return (G.length == 1) ? "0" + G : G;
+ },
+
+ i: function(){
+ // summary: Minutes with leading zeros
+ var mins = this.date.getMinutes() + "";
+ return (mins.length == 1) ? "0" + mins : mins;
+ },
+
+ s: function(){
+ // summary: Seconds, with leading zeros
+ var secs = this.date.getSeconds() + "";
+ return (secs.length == 1) ? "0" + secs : secs;
+ },
+
+ // Timezone
+
+ e: function(){
+ // summary: Timezone identifier (added in PHP 5.1.0)
+ return dojo.date.getTimezoneName(this.date);
+ },
+
+ I: function(){
+ // summary: Whether or not the date is in daylight saving time
+ // TODO: Can dojo.date do this?
+ },
+
+ O: function(){
+ // summary: Difference to Greenwich time (GMT) in hours
+ var off = Math.abs(this.date.getTimezoneOffset());
+ var hours = Math.floor(off / 60) + "";
+ var mins = (off % 60) + "";
+ if(hours.length == 1) hours = "0" + hours;
+ if(mins.length == 1) hours = "0" + mins;
+ return ((this.date.getTimezoneOffset() < 0) ? "+" : "-") + hours + mins;
+ },
+
+ P: function(){
+ // summary: Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)
+ var O = this.O();
+ return O.substring(0, 2) + ":" + O.substring(2, 4);
+ },
+
+ T: function(){
+ // summary: Timezone abbreviation
+
+ // Guess...
+ return this.e().substring(0, 3);
+ },
+
+ Z: function(){
+ // summary:
+ // Timezone offset in seconds. The offset for timezones west of UTC is always negative,
+ // and for those east of UTC is always positive.
+ return this.date.getTimezoneOffset() * -60;
+ },
+
+ // Full Date/Time
+
+ c: function(){
+ // summary: ISO 8601 date (added in PHP 5)
+ return this.Y() + "-" + this.m() + "-" + this.d() + "T" + this.h() + ":" + this.i() + ":" + this.s() + this.P();
+ },
+
+ r: function(){
+ // summary: RFC 2822 formatted date
+ return this.D() + ", " + this.d() + " " + this.M() + " " + this.Y() + " " + this.H() + ":" + this.i() + ":" + this.s() + " " + this.O();
+ },
+
+ U: function(){
+ // summary: Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
+ return Math.floor(this.date.getTime() / 1000);
+ }
+
+});
+
+}
+
+if(!dojo._hasResource["dojox.dtl.utils.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.utils.date"] = true;
+dojo.provide("dojox.dtl.utils.date");
+
+
+
+dojox.dtl.utils.date.DateFormat = function(/*String*/ format){
+ dojox.date.php.DateFormat.call(this, format);
+}
+dojo.extend(dojox.dtl.utils.date.DateFormat, dojox.date.php.DateFormat.prototype, {
+ f: function(){
+ // summary:
+ // Time, in 12-hour hours and minutes, with minutes left off if they're zero.
+ // description:
+ // Examples: '1', '1:30', '2:05', '2'
+ // Proprietary extension.
+ return (!this.date.getMinutes()) ? this.g() : this.g() + ":" + this.i();
+ },
+ N: function(){
+ // summary: Month abbreviation in Associated Press style. Proprietary extension.
+ return dojox.dtl.utils.date._months_ap[this.date.getMonth()];
+ },
+ P: function(){
+ // summary:
+ // Time, in 12-hour hours, minutes and 'a.m.'/'p.m.', with minutes left off
+ // if they're zero and the strings 'midnight' and 'noon' if appropriate.
+ // description:
+ // Examples: '1 a.m.', '1:30 p.m.', 'midnight', 'noon', '12:30 p.m.'
+ // Proprietary extension.
+ if(!this.date.getMinutes() && !this.date.getHours()){
+ return 'midnight';
+ }
+ if(!this.date.getMinutes() && this.date.getHours() == 12){
+ return 'noon';
+ }
+ return this.f() + " " + this.a();
+ }
+});
+
+dojo.mixin(dojox.dtl.utils.date, {
+ format: function(/*Date*/ date, /*String*/ format){
+ var df = new dojox.dtl.utils.date.DateFormat(format);
+ return df.format(date);
+ },
+ timesince: function(d, now){
+ // summary:
+ // Takes two datetime objects and returns the time between then and now
+ // as a nicely formatted string, e.g "10 minutes"
+ // description:
+ // Adapted from http://blog.natbat.co.uk/archive/2003/Jun/14/time_since
+ if(!(d instanceof Date)){
+ d = new Date(d.year, d.month, d.day);
+ }
+ if(!now){
+ now = new Date();
+ }
+
+ var delta = Math.abs(now.getTime() - d.getTime());
+ for(var i = 0, chunk; chunk = dojox.dtl.utils.date._chunks[i]; i++){
+ var count = Math.floor(delta / chunk[0]);
+ if(count) break;
+ }
+ return count + " " + chunk[1](count);
+ },
+ _chunks: [
+ [60 * 60 * 24 * 365 * 1000, function(n){ return (n == 1) ? 'year' : 'years'; }],
+ [60 * 60 * 24 * 30 * 1000, function(n){ return (n == 1) ? 'month' : 'months'; }],
+ [60 * 60 * 24 * 7 * 1000, function(n){ return (n == 1) ? 'week' : 'weeks'; }],
+ [60 * 60 * 24 * 1000, function(n){ return (n == 1) ? 'day' : 'days'; }],
+ [60 * 60 * 1000, function(n){ return (n == 1) ? 'hour' : 'hours'; }],
+ [60 * 1000, function(n){ return (n == 1) ? 'minute' : 'minutes'; }]
+ ],
+ _months_ap: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."]
+});
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.date"] = true;
+dojo.provide("dojox.dtl.tag.date");
+
+
+
+
+dojox.dtl.tag.date.NowNode = function(format, node){
+ this._format = format;
+ this.format = new dojox.dtl.utils.date.DateFormat(format);
+ this.contents = node;
+}
+dojo.extend(dojox.dtl.tag.date.NowNode, {
+ render: function(context, buffer){
+ this.contents.set(this.format.format(new Date()));
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._format, this.contents.clone(buffer));
+ }
+});
+
+dojox.dtl.tag.date.now = function(parser, token){
+ // Split by either :" or :'
+ var parts = token.split_contents();
+ if(parts.length != 2){
+ throw new Error("'now' statement takes one argument");
+ }
+ return new dojox.dtl.tag.date.NowNode(parts[1].slice(1, -1), parser.create_text_node());
+}
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loader"] = true;
+dojo.provide("dojox.dtl.tag.loader");
+
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loader;
+
+ ddtl.BlockNode = dojo.extend(function(name, nodelist){
+ this.name = name;
+ this.nodelist = nodelist; // Can be overridden
+ },
+ {
+ "super": function(){
+ if(this.parent){
+ var html = this.parent.nodelist.dummyRender(this.context, null, true);
+ if(typeof html == "string"){
+ html = new String(html);
+ }
+ html.safe = true;
+ return html;
+ }
+ return '';
+ },
+ render: function(context, buffer){
+ var name = this.name;
+ var nodelist = this.nodelist;
+ var parent;
+ if(buffer.blocks){
+ var block = buffer.blocks[name];
+ if(block){
+ parent = block.parent;
+ nodelist = block.nodelist;
+ block.used = true;
+ }
+ }
+
+ this.rendered = nodelist;
+
+ context = context.push();
+ this.context = context;
+ this.parent = null;
+ if(nodelist != this.nodelist){
+ this.parent = this;
+ }
+ context.block = this;
+
+ if(buffer.getParent){
+ var bufferParent = buffer.getParent();
+ var setParent = dojo.connect(buffer, "onSetParent", function(node, up, root){
+ if(up && root){
+ buffer.setParent(bufferParent);
+ }
+ });
+ }
+ buffer = nodelist.render(context, buffer, this);
+ setParent && dojo.disconnect(setParent);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.name, this.nodelist.clone(buffer));
+ },
+ toString: function(){ return "dojox.dtl.tag.loader.BlockNode"; }
+ });
+
+ ddtl.ExtendsNode = dojo.extend(function(getTemplate, nodelist, shared, parent, key){
+ this.getTemplate = getTemplate;
+ this.nodelist = nodelist;
+ this.shared = shared;
+ this.parent = parent;
+ this.key = key;
+ },
+ {
+ parents: {},
+ getParent: function(context){
+ var parent = this.parent;
+ if(!parent){
+ var string;
+ parent = this.parent = context.get(this.key, false);
+ if(!parent){
+ throw new Error("extends tag used a variable that did not resolve");
+ }
+ if(typeof parent == "object"){
+ var url = parent.url || parent.templatePath;
+ if(parent.shared){
+ this.shared = true;
+ }
+ if(url){
+ parent = this.parent = url.toString();
+ }else if(parent.templateString){
+ // Allow the builder's string interning to work
+ string = parent.templateString;
+ parent = this.parent = " ";
+ }else{
+ parent = this.parent = this.parent.toString();
+ }
+ }
+ if(parent && parent.indexOf("shared:") === 0){
+ this.shared = true;
+ parent = this.parent = parent.substring(7, parent.length);
+ }
+ }
+ if(!parent){
+ throw new Error("Invalid template name in 'extends' tag.");
+ }
+ if(parent.render){
+ return parent;
+ }
+ if(this.parents[parent]){
+ return this.parents[parent];
+ }
+ this.parent = this.getTemplate(string || dojox.dtl.text.getTemplateString(parent));
+ if(this.shared){
+ this.parents[parent] = this.parent;
+ }
+ return this.parent;
+ },
+ render: function(context, buffer){
+ var parent = this.getParent(context);
+
+ parent.blocks = parent.blocks || {};
+ buffer.blocks = buffer.blocks || {};
+
+ for(var i = 0, node; node = this.nodelist.contents[i]; i++){
+ if(node instanceof dojox.dtl.tag.loader.BlockNode){
+ var old = parent.blocks[node.name];
+ if(old && old.nodelist != node.nodelist){
+ // In a shared template, the individual blocks might change
+ buffer = old.nodelist.unrender(context, buffer);
+ }
+ parent.blocks[node.name] = buffer.blocks[node.name] = {
+ shared: this.shared,
+ nodelist: node.nodelist,
+ used: false
+ }
+ }
+ }
+
+ this.rendered = parent;
+ return parent.nodelist.render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer, this);
+ },
+ toString: function(){ return "dojox.dtl.block.ExtendsNode"; }
+ });
+
+ ddtl.IncludeNode = dojo.extend(function(path, constant, getTemplate, text, parsed){
+ this._path = path;
+ this.constant = constant;
+ this.path = (constant) ? path : new dd._Filter(path);
+ this.getTemplate = getTemplate;
+ this.text = text;
+ this.parsed = (arguments.length == 5) ? parsed : true;
+ },
+ {
+ _cache: [{}, {}],
+ render: function(context, buffer){
+ var location = ((this.constant) ? this.path : this.path.resolve(context)).toString();
+ var parsed = Number(this.parsed);
+ var dirty = false;
+ if(location != this.last){
+ dirty = true;
+ if(this.last){
+ buffer = this.unrender(context, buffer);
+ }
+ this.last = location;
+ }
+
+ var cache = this._cache[parsed];
+
+ if(parsed){
+ if(!cache[location]){
+ cache[location] = dd.text._resolveTemplateArg(location, true);
+ }
+ if(dirty){
+ var template = this.getTemplate(cache[location]);
+ this.rendered = template.nodelist;
+ }
+ return this.rendered.render(context, buffer, this);
+ }else{
+ if(this.text instanceof dd._TextNode){
+ if(dirty){
+ this.rendered = this.text;
+ this.rendered.set(dd.text._resolveTemplateArg(location, true));
+ }
+ return this.rendered.render(context, buffer);
+ }else{
+ if(!cache[location]){
+ var nodelist = [];
+ var div = document.createElement("div");
+ div.innerHTML = dd.text._resolveTemplateArg(location, true);
+ var children = div.childNodes;
+ while(children.length){
+ var removed = div.removeChild(children[0]);
+ nodelist.push(removed);
+ }
+ cache[location] = nodelist;
+ }
+ if(dirty){
+ this.nodelist = [];
+ var exists = true;
+ for(var i = 0, child; child = cache[location][i]; i++){
+ this.nodelist.push(child.cloneNode(true));
+ }
+ }
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.concat(node);
+ }
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ if(this.rendered){
+ buffer = this.rendered.unrender(context, buffer);
+ }
+ if(this.nodelist){
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.remove(node);
+ }
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._path, this.constant, this.getTemplate, this.text.clone(buffer), this.parsed);
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ block: function(parser, token){
+ var parts = token.contents.split();
+ var name = parts[1];
+
+ parser._blocks = parser._blocks || {};
+ parser._blocks[name] = parser._blocks[name] || [];
+ parser._blocks[name].push(name);
+
+ var nodelist = parser.parse(["endblock", "endblock " + name]).rtrim();
+ parser.next_token();
+ return new dojox.dtl.tag.loader.BlockNode(name, nodelist);
+ },
+ extends_: function(parser, token){
+ var parts = token.contents.split();
+ var shared = false;
+ var parent = null;
+ var key = null;
+ if(parts[1].charAt(0) == '"' || parts[1].charAt(0) == "'"){
+ parent = parts[1].substring(1, parts[1].length - 1);
+ }else{
+ key = parts[1];
+ }
+ if(parent && parent.indexOf("shared:") == 0){
+ shared = true;
+ parent = parent.substring(7, parent.length);
+ }
+ var nodelist = parser.parse();
+ return new dojox.dtl.tag.loader.ExtendsNode(parser.getTemplate, nodelist, shared, parent, key);
+ },
+ include: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error(parts[0] + " tag takes one argument: the name of the template to be included");
+ }
+ var path = parts[1];
+ var constant = false;
+ if((path.charAt(0) == '"' || path.slice(-1) == "'") && path.charAt(0) == path.slice(-1)){
+ path = path.slice(1, -1);
+ constant = true;
+ }
+ return new ddtl.IncludeNode(path, constant, parser.getTemplate, parser.create_text_node());
+ },
+ ssi: function(parser, token){
+ // We're going to treat things a little differently here.
+ // First of all, this tag is *not* portable, so I'm not
+ // concerned about it being a "drop in" replacement.
+
+ // Instead, we'll just replicate the include tag, but with that
+ // optional "parsed" parameter.
+ var parts = token.contents.split();
+ var parsed = false;
+ if(parts.length == 3){
+ parsed = (parts.pop() == "parsed");
+ if(!parsed){
+ throw new Error("Second (optional) argument to ssi tag must be 'parsed'");
+ }
+ }
+ var node = ddtl.include(parser, new dd.Token(token.token_type, parts.join(" ")));
+ node.parsed = parsed;
+ return node;
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl.tag.misc"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.misc"] = true;
+dojo.provide("dojox.dtl.tag.misc");
+
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtm = dd.tag.misc;
+
+ ddtm.DebugNode = dojo.extend(function(text){
+ this.text = text;
+ },
+ {
+ render: function(context, buffer){
+ var keys = context.getKeys();
+ var debug = [];
+ var only = {};
+ for(var i = 0, key; key = keys[i]; i++){
+ only[key] = context[key];
+ debug += "[" + key + ": " + typeof context[key] + "]\n";
+ }
+ console.debug(only);
+ return this.text.set(debug).render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.text.clone(buffer));
+ },
+ toString: function(){ return "ddtm.DebugNode"; }
+ });
+
+ ddtm.FilterNode = dojo.extend(function(varnode, nodelist){
+ this._varnode = varnode;
+ this._nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ // Doing this in HTML requires a different buffer with a fake root node
+ var output = this._nodelist.render(context, new dojox.string.Builder());
+ context = context.update({ "var": output.toString() });
+ var filtered = this._varnode.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._expression, this._nodelist.clone(buffer));
+ }
+ });
+
+ ddtm.FirstOfNode = dojo.extend(function(vars, text){
+ this._vars = vars;
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ for(var i = 0, item; item = this.vars[i]; i++){
+ var resolved = item.resolve(context);
+ if(typeof resolved != "undefined"){
+ if(resolved === null){
+ resolved = "null";
+ }
+ this.contents.set(resolved);
+ return this.contents.render(context, buffer);
+ }
+ }
+ return this.contents.unrender(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._vars, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.SpacelessNode = dojo.extend(function(nodelist, text){
+ this.nodelist = nodelist;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ if(buffer.getParent){
+ // Unfortunately, we have to branch here
+ var watch = [
+ dojo.connect(buffer, "onAddNodeComplete", this, "_watch"),
+ dojo.connect(buffer, "onSetParent", this, "_watchParent")
+ ];
+ buffer = this.nodelist.render(context, buffer);
+ dojo.disconnect(watch[0]);
+ dojo.disconnect(watch[1]);
+ }else{
+ var value = this.nodelist.dummyRender(context);
+ this.contents.set(value.replace(/>\s+</g, '><'));
+ buffer = this.contents.render(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodelist.clone(buffer), this.contents.clone(buffer));
+ },
+ _isEmpty: function(node){
+ return (node.nodeType == 3 && !node.data.match(/[^\s\n]/));
+ },
+ _watch: function(node){
+ if(this._isEmpty(node)){
+ var remove = false;
+ if(node.parentNode.firstChild == node){
+ node.parentNode.removeChild(node);
+ }
+ }else{
+ var children = node.parentNode.childNodes;
+ if(node.nodeType == 1 && children.length > 2){
+ for(var i = 2, child; child = children[i]; i++){
+ if(children[i - 2].nodeType == 1 && this._isEmpty(children[i - 1])){
+ node.parentNode.removeChild(children[i - 1]);
+ return;
+ }
+ }
+ }
+ }
+ },
+ _watchParent: function(node){
+ var children = node.childNodes;
+ if(children.length){
+ while(node.childNodes.length){
+ var last = node.childNodes[node.childNodes.length - 1];
+ if(!this._isEmpty(last)){
+ return;
+ }
+ node.removeChild(last);
+ }
+ }
+ }
+ });
+
+ ddtm.TemplateTagNode = dojo.extend(function(tag, text){
+ this.tag = tag;
+ this.contents = text;
+ },
+ {
+ mapping: {
+ openblock: "{%",
+ closeblock: "%}",
+ openvariable: "{{",
+ closevariable: "}}",
+ openbrace: "{",
+ closebrace: "}",
+ opencomment: "{#",
+ closecomment: "#}"
+ },
+ render: function(context, buffer){
+ this.contents.set(this.mapping[this.tag]);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.tag, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WidthRatioNode = dojo.extend(function(current, max, width, text){
+ this.current = new dd._Filter(current);
+ this.max = new dd._Filter(max);
+ this.width = width;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ var current = +this.current.resolve(context);
+ var max = +this.max.resolve(context);
+ if(typeof current != "number" || typeof max != "number" || !max){
+ this.contents.set("");
+ }else{
+ this.contents.set("" + Math.round((current / max) * this.width));
+ }
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.current.getExpression(), this.max.getExpression(), this.width, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WithNode = dojo.extend(function(target, alias, nodelist){
+ this.target = new dd._Filter(target);
+ this.alias = alias;
+ this.nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ var target = this.target.resolve(context);
+ context = context.push();
+ context[this.alias] = target;
+ buffer = this.nodelist.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.target.getExpression(), this.alias, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtm, {
+ comment: function(parser, token){
+ // summary: Ignore everything between {% comment %} and {% endcomment %}
+ parser.skip_past("endcomment");
+ return dd._noOpNode;
+ },
+ debug: function(parser, token){
+ // summary: Output the current context, maybe add more stuff later.
+ return new ddtm.DebugNode(parser.create_text_node());
+ },
+ filter: function(parser, token){
+ // summary: Filter the contents of the blog through variable filters.
+ var rest = token.contents.split(null, 1)[1];
+ var varnode = parser.create_variable_node("var|" + rest);
+ var nodelist = parser.parse(["endfilter"]);
+ parser.next_token();
+ return new ddtm.FilterNode(varnode, nodelist);
+ },
+ firstof: function(parser, token){
+ var parts = token.split_contents().slice(1);
+ if(!parts.length){
+ throw new Error("'firstof' statement requires at least one argument");
+ }
+ return new ddtm.FirstOfNode(parts, parser.create_text_node());
+ },
+ spaceless: function(parser, token){
+ var nodelist = parser.parse(["endspaceless"]);
+ parser.delete_first_token();
+ return new ddtm.SpacelessNode(nodelist, parser.create_text_node());
+ },
+ templatetag: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error("'templatetag' statement takes one argument");
+ }
+ var tag = parts[1];
+ var mapping = ddtm.TemplateTagNode.prototype.mapping;
+ if(!mapping[tag]){
+ var keys = [];
+ for(var key in mapping){
+ keys.push(key);
+ }
+ throw new Error("Invalid templatetag argument: '" + tag + "'. Must be one of: " + keys.join(", "));
+ }
+ return new ddtm.TemplateTagNode(tag, parser.create_text_node());
+ },
+ widthratio: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 4){
+ throw new Error("widthratio takes three arguments");
+ }
+ var width = +parts[3];
+ if(typeof width != "number"){
+ throw new Error("widthratio final argument must be an integer");
+ }
+ return new ddtm.WidthRatioNode(parts[1], parts[2], width, parser.create_text_node());
+ },
+ with_: function(parser, token){
+ var parts = token.split_contents();
+ if(parts.length != 4 || parts[2] != "as"){
+ throw new Error("do_width expected format as 'with value as name'");
+ }
+ var nodelist = parser.parse(["endwith"]);
+ parser.next_token();
+ return new ddtm.WithNode(parts[1], parts[3], nodelist);
+ }
+ });
+})();
+
+}
+
+if(!dojo._hasResource["dojox.dtl.ext-dojo.NodeList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.ext-dojo.NodeList"] = true;
+dojo.provide("dojox.dtl.ext-dojo.NodeList");
+
+
+dojo.extend(dojo.NodeList, {
+ dtl: function(template, context){
+ // template: dojox.dtl.__StringArgs|String
+ // The template string or location
+ // context: dojox.dtl.__ObjectArgs|Object
+ // The context object or location
+ var d = dojox.dtl;
+
+ var self = this;
+ var render = function(template, context){
+ var content = template.render(new d._Context(context));
+ self.forEach(function(node){
+ node.innerHTML = content;
+ });
+ }
+
+ d.text._resolveTemplateArg(template).addCallback(function(templateString){
+ template = new d.Template(templateString);
+ d.text._resolveContextArg(context).addCallback(function(context){
+ render(template, context);
+ });
+ });
+
+ return this;
+ }
+});
+
+}
+
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/Context.js b/js/dojo-1.6/dojox/dtl/Context.js new file mode 100644 index 0000000..0eff0f9 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/Context.js @@ -0,0 +1,80 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.Context"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.Context"] = true;
+dojo.provide("dojox.dtl.Context");
+dojo.require("dojox.dtl._base");
+
+dojox.dtl.Context = dojo.extend(function(dict){
+ this._this = {};
+ dojox.dtl._Context.call(this, dict);
+}, dojox.dtl._Context.prototype,
+{
+ getKeys: function(){
+ var keys = [];
+ for(var key in this){
+ if(this.hasOwnProperty(key) && key != "_this"){
+ keys.push(key);
+ }
+ }
+ return keys;
+ },
+ extend: function(/*dojox.dtl.Context|Object*/ obj){
+ // summary: Returns a clone of this context object, with the items from the
+ // passed objecct mixed in.
+ return dojo.delegate(this, obj);
+ },
+ filter: function(/*dojox.dtl.Context|Object|String...*/ filter){
+ // summary: Returns a clone of this context, only containing the items
+ // defined in the filter.
+ var context = new dojox.dtl.Context();
+ var keys = [];
+ var i, arg;
+ if(filter instanceof dojox.dtl.Context){
+ keys = filter.getKeys();
+ }else if(typeof filter == "object"){
+ for(var key in filter){
+ keys.push(key);
+ }
+ }else{
+ for(i = 0; arg = arguments[i]; i++){
+ if(typeof arg == "string"){
+ keys.push(arg);
+ }
+ }
+ }
+
+ for(i = 0, key; key = keys[i]; i++){
+ context[key] = this[key];
+ }
+
+ return context;
+ },
+ setThis: function(/*Object*/ _this){
+ this._this = _this;
+ },
+ getThis: function(){
+ return this._this;
+ },
+ hasKey: function(key){
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return true;
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return true;
+ }
+
+ return false;
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/Context.xd.js b/js/dojo-1.6/dojox/dtl/Context.xd.js new file mode 100644 index 0000000..efd2ded --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/Context.xd.js @@ -0,0 +1,85 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.Context"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.Context"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.Context"] = true;
+dojo.provide("dojox.dtl.Context");
+dojo.require("dojox.dtl._base");
+
+dojox.dtl.Context = dojo.extend(function(dict){
+ this._this = {};
+ dojox.dtl._Context.call(this, dict);
+}, dojox.dtl._Context.prototype,
+{
+ getKeys: function(){
+ var keys = [];
+ for(var key in this){
+ if(this.hasOwnProperty(key) && key != "_this"){
+ keys.push(key);
+ }
+ }
+ return keys;
+ },
+ extend: function(/*dojox.dtl.Context|Object*/ obj){
+ // summary: Returns a clone of this context object, with the items from the
+ // passed objecct mixed in.
+ return dojo.delegate(this, obj);
+ },
+ filter: function(/*dojox.dtl.Context|Object|String...*/ filter){
+ // summary: Returns a clone of this context, only containing the items
+ // defined in the filter.
+ var context = new dojox.dtl.Context();
+ var keys = [];
+ var i, arg;
+ if(filter instanceof dojox.dtl.Context){
+ keys = filter.getKeys();
+ }else if(typeof filter == "object"){
+ for(var key in filter){
+ keys.push(key);
+ }
+ }else{
+ for(i = 0; arg = arguments[i]; i++){
+ if(typeof arg == "string"){
+ keys.push(arg);
+ }
+ }
+ }
+
+ for(i = 0, key; key = keys[i]; i++){
+ context[key] = this[key];
+ }
+
+ return context;
+ },
+ setThis: function(/*Object*/ _this){
+ this._this = _this;
+ },
+ getThis: function(){
+ return this._this;
+ },
+ hasKey: function(key){
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return true;
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return true;
+ }
+
+ return false;
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/DomInline.js b/js/dojo-1.6/dojox/dtl/DomInline.js new file mode 100644 index 0000000..f74c4fc --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/DomInline.js @@ -0,0 +1,47 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.DomInline"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.DomInline"] = true;
+dojo.provide("dojox.dtl.DomInline");
+dojo.require("dojox.dtl.dom");
+
+dojo.require("dijit._Widget");
+
+dojox.dtl.DomInline = dojo.extend(function(args, node){
+ this.create(args, node);
+},
+dijit._Widget.prototype,
+{
+ context: null,
+ render: function(/*dojox.dtl.Context?*/ context){
+ this.context = context || this.context;
+ this.postMixInProperties();
+ var root = this.template.render(this.context).getRootNode();
+ if(root != this.containerNode){
+ this.containerNode.parentNode.replaceChild(root, this.containerNode);
+ this.containerNode = root;
+ }
+ },
+ declaredClass: "dojox.dtl.Inline",
+ buildRendering: function(){
+ var div = this.domNode = document.createElement("div");
+ this.containerNode = div.appendChild(document.createElement("div"));
+ var node = this.srcNodeRef;
+ if(node.parentNode){
+ node.parentNode.replaceChild(div, node);
+ }
+
+ this.template = new dojox.dtl.DomTemplate(dojo.trim(node.text), true);
+ this.render();
+ },
+ postMixInProperties: function(){
+ this.context = (this.context.get === dojox.dtl._Context.prototype.get) ? this.context : new dojox.dtl.Context(this.context);
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/DomInline.xd.js b/js/dojo-1.6/dojox/dtl/DomInline.xd.js new file mode 100644 index 0000000..35c9b13 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/DomInline.xd.js @@ -0,0 +1,53 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.DomInline"],
+["require", "dojox.dtl.dom"],
+["require", "dijit._Widget"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.DomInline"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.DomInline"] = true;
+dojo.provide("dojox.dtl.DomInline");
+dojo.require("dojox.dtl.dom");
+
+dojo.require("dijit._Widget");
+
+dojox.dtl.DomInline = dojo.extend(function(args, node){
+ this.create(args, node);
+},
+dijit._Widget.prototype,
+{
+ context: null,
+ render: function(/*dojox.dtl.Context?*/ context){
+ this.context = context || this.context;
+ this.postMixInProperties();
+ var root = this.template.render(this.context).getRootNode();
+ if(root != this.containerNode){
+ this.containerNode.parentNode.replaceChild(root, this.containerNode);
+ this.containerNode = root;
+ }
+ },
+ declaredClass: "dojox.dtl.Inline",
+ buildRendering: function(){
+ var div = this.domNode = document.createElement("div");
+ this.containerNode = div.appendChild(document.createElement("div"));
+ var node = this.srcNodeRef;
+ if(node.parentNode){
+ node.parentNode.replaceChild(div, node);
+ }
+
+ this.template = new dojox.dtl.DomTemplate(dojo.trim(node.text), true);
+ this.render();
+ },
+ postMixInProperties: function(){
+ this.context = (this.context.get === dojox.dtl._Context.prototype.get) ? this.context : new dojox.dtl.Context(this.context);
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/HtmlInline.js b/js/dojo-1.6/dojox/dtl/HtmlInline.js new file mode 100644 index 0000000..c2c1ba4 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/HtmlInline.js @@ -0,0 +1,16 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.HtmlInline"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.HtmlInline"] = true;
+dojo.provide("dojox.dtl.HtmlInline");
+dojo.require("dojox.dtl.DomInline");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+dojox.dtl.HtmlInline = dojox.dtl.DomInline;
+dojox.dtl.HtmlInline.prototype.declaredClass = "dojox.dtl.HtmlInline";
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/HtmlInline.xd.js b/js/dojo-1.6/dojox/dtl/HtmlInline.xd.js new file mode 100644 index 0000000..4a59231 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/HtmlInline.xd.js @@ -0,0 +1,21 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.HtmlInline"],
+["require", "dojox.dtl.DomInline"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.HtmlInline"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.HtmlInline"] = true;
+dojo.provide("dojox.dtl.HtmlInline");
+dojo.require("dojox.dtl.DomInline");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+dojox.dtl.HtmlInline = dojox.dtl.DomInline;
+dojox.dtl.HtmlInline.prototype.declaredClass = "dojox.dtl.HtmlInline";
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/Inline.js b/js/dojo-1.6/dojox/dtl/Inline.js new file mode 100644 index 0000000..2d0ac22 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/Inline.js @@ -0,0 +1,43 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.Inline"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.Inline"] = true;
+dojo.provide("dojox.dtl.Inline");
+dojo.require("dojox.dtl._base");
+
+dojo.require("dijit._Widget");
+
+dojox.dtl.Inline = dojo.extend(function(args, node){
+ this.create(args, node);
+},
+dijit._Widget.prototype,
+{
+ context: null,
+ render: function(/*Object|dojox.dtl.Context?*/ context){
+ this.context = context || this.context;
+ this.postMixInProperties();
+ dojo.query("*", this.domNode).orphan();
+ this.domNode.innerHTML = this.template.render(this.context);
+ },
+ declaredClass: "dojox.dtl.Inline",
+ buildRendering: function(){
+ var div = this.domNode = document.createElement("div");
+ var node = this.srcNodeRef;
+ if(node.parentNode){
+ node.parentNode.replaceChild(div, node);
+ }
+
+ this.template = new dojox.dtl.Template(dojo.trim(node.text), true);
+ this.render();
+ },
+ postMixInProperties: function(){
+ this.context = (this.context.get === dojox.dtl._Context.prototype.get) ? this.context : new dojox.dtl._Context(this.context);
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/Inline.xd.js b/js/dojo-1.6/dojox/dtl/Inline.xd.js new file mode 100644 index 0000000..ffd7feb --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/Inline.xd.js @@ -0,0 +1,49 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.Inline"],
+["require", "dojox.dtl._base"],
+["require", "dijit._Widget"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.Inline"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.Inline"] = true;
+dojo.provide("dojox.dtl.Inline");
+dojo.require("dojox.dtl._base");
+
+dojo.require("dijit._Widget");
+
+dojox.dtl.Inline = dojo.extend(function(args, node){
+ this.create(args, node);
+},
+dijit._Widget.prototype,
+{
+ context: null,
+ render: function(/*Object|dojox.dtl.Context?*/ context){
+ this.context = context || this.context;
+ this.postMixInProperties();
+ dojo.query("*", this.domNode).orphan();
+ this.domNode.innerHTML = this.template.render(this.context);
+ },
+ declaredClass: "dojox.dtl.Inline",
+ buildRendering: function(){
+ var div = this.domNode = document.createElement("div");
+ var node = this.srcNodeRef;
+ if(node.parentNode){
+ node.parentNode.replaceChild(div, node);
+ }
+
+ this.template = new dojox.dtl.Template(dojo.trim(node.text), true);
+ this.render();
+ },
+ postMixInProperties: function(){
+ this.context = (this.context.get === dojox.dtl._Context.prototype.get) ? this.context : new dojox.dtl._Context(this.context);
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/README b/js/dojo-1.6/dojox/dtl/README new file mode 100644 index 0000000..54dd4f3 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/README @@ -0,0 +1,207 @@ +------------------------------------------------------------------------------- +DojoX Django Template Language +------------------------------------------------------------------------------- +Version 0.0 +Release date: 09/20/2007 +------------------------------------------------------------------------------- +Project state: experimental/feature incomplete +------------------------------------------------------------------------------- +Project authors + Neil Roberts (pottedmeat@dojotoolkit.org) +------------------------------------------------------------------------------- +Project description + +The Django Template language uses a system of templates that can be compiled +once and rendered indefinitely afterwards. It uses a simple system of tags +and filters. + +This is a 1:1 match with the Django Template Language as outlined in +http://www.djangoproject.com/documentation/templates/. All applicable tags and +filters have been implemented (see below), along with new filters and tags as +necessary (see below). + +The Django Template Language is intended within Django to only handle text. +Our implementation is able to handle HTML in addition to text. Actually, the +text and HTML portions of dojox.dtl are two separate layers, the HTML layer +sits on top of the text layer (base). It's also been implemented in such a way +that you have little to fear when moving your code from Django to dojox.dtl. +Your existing templates should work, and will benefit from the massive +performance gain of being able to manipulate nodes, rather than having to do +clunky innerHTML swaps you would have to do with a text-only system. It also +allows for new HTML-centric abilities, outlined below. + +Despite having two levels of complexity, if you write your tags correctly, they +will work in both environments. +------------------------------------------------------------------------------- +Dependencies + +Base: +dojox.string.Builder + +Date filters and tags: +dojox.date.php + +Widget: +dijit._Widget +dijit._Container +------------------------------------------------------------------------------- +Installation instructions + +Grab the following from the Dojo SVN Repository: +http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/dtl.js +http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/dtl/* + +Install into the following directory structure: +/dojox/dtl/ + +...which should be at the same level as your Dojo checkout. +------------------------------------------------------------------------------- +What's Been Done + +Note: HTML Unit Tests should only be around for the oddities of HTML, tag/filter +code is the same for each environment with minor exceptions. Cloning of all tags +should be tested inside a for loop. + +| Implemented | Tag | Text Unit Test | HTML Unit Test | +| X | block | X | | +| X | comment | X | | +| X | cycle | X | | +| X | debug | X | | +| X | extends | X | | +| X | filter | X | | +| X | firstof | X | | +| X | for | X | | +| X | if | X | | +| X | ifchanged | X | X | +| X | ifequal | X | | +| X | ifnotequal | X | | +| X | include | X | X | +| X | load | X | | +| X | now | X | | +| X | regroup | X | | +| X | spaceless | X | X | +| X | ssi | X | X | +| X | templatetag | X | | +| N/A | url | | | +| X | widthratio | X | | +| X | with | X | | + +| Implemented | Filter | Text Unit Test | HTML Unit Test | +| X | add | X | | +| X | addslashes | X | | +| X | capfirst | X | | +| X | center | X | | +| X | cut | X | | +| X | date | X | | +| X | default | X | | +| X | default_if_none | X | | +| X | dictsort | X | | +| X | dictsort_reversed | X | | +| X | divisibleby | X | | +| X | escape | X | | +| X | filesizeformat | X | | +| X | first | X | | +| X | fix_ampersands | X | | +| X | floatformat | X | | +| X | get_digit | X | | +| X | iriencode | X | | +| X | join | X | | +| X | length | X | | +| X | length_is | X | | +| X | linebreaks | X | | +| X | linebreaksbr | X | | +| X | linenumbers | X | | +| X | ljust | X | | +| X | lower | X | | +| X | make_list | X | | +| X | phone2numeric | X | | +| X | pluralize | X | | +| X | pprint | X | | +| X | random | X | | +| X | removetags | X | | +| X | rjust | X | | +| X | slice | X | | +| X | slugify | X | | +| X | stringformat | X | | +| X | striptags | X | | +| X | time | X | | +| X | timesince | X | | +| X | timeuntil | X | | +| X | title | X | | +| X | truncatewords | X | | +| X | truncatewords_html | X | | +| X | unordered_list | X | | +| X | upper | X | | +| X | urlencode | X | | +| X | urlize | X | | +| X | urlizetrunc | X | | +| X | wordcount | X | | +| X | wordwrap | X | | +| X | yesno | X | | +------------------------------------------------------------------------------- +HTML-Specific Additions +------------------------------------------------------------------------------- +{%extends "shared:templates/template.html" %} + +When using the {% extends %} tag, we don't always want to replace the parent +node in DOM. For example, if we have a list view and a detail view, but both +share the same base template, we want it to share the parent template. This +basically means that the same nodes will be used in the parent for both views. + +To use this, simply add "shared:" to the beginning of the specified template. +------------------------------------------------------------------------------- +<!--{% commented markup %}--> + +Some browsers treat comment nodes as full fledged nodes. If performance is +important to you, you can wrap your markup in comments. The comments will be +automatically stripped for browsers that cannot support this. +------------------------------------------------------------------------------- +Attribute Tags + +If a tag name begins with "attr:" then it will be able to inject an object +into the parsed template. (See dojox.dtl.tag.event.EventNode) + +onclick/onmouseover/etc attributes work by attaching to the rendering object. + +tstyle attribute allows for styles to be changed dynamically. Use them just +like a "style" attribute. + +attach attribute attaches the node to the rendering object. +------------------------------------------------------------------------------- +New Context Functions + +setThis() and getThis() returns the object "in charge" of the current rendering. +This is used so that we can attach events. + +mixin() and filter() clone the current context, and either add to or reduce +the keys in the context. +------------------------------------------------------------------------------- +Buffers + +Both the base and HTML versions of dojox.dtl use buffers. The base version uses +dojox.string.Builder and the HTML version uses dojox.dtl.DomBuffer. + +The HTML buffer has several calls important to rendering: + +setParent/getParent/concat/remove: + +setParent and concat are used in order to render our HTML. As we move through +the parsed template, different nodes change the parent or add on to the +current parent. getParent is useful in things like the attribute tags, since +they can use getParent to find the node that they're an attribute on. remove is +used during unrendering. + +setAttribute: + +Sets an attribute on the current parent +------------------------------------------------------------------------------- +Tags Need clone/unrender Functions. + +One of the biggest challenges of getting dojox.dtl to work in an HTML +environment was logic blocks. Nodes and objects inside a for loop need to be +cloned, they can't simply be re-rendered, especially if they involve a Node. +Also, in the case of an if/else block, we need to be able to not just render +one of the blocks, but also unrender the second. + +This is really simple code, a good example is the dojox.dtl.DomNode +object. Each function in this object is only one line long.
\ No newline at end of file diff --git a/js/dojo-1.6/dojox/dtl/_DomTemplated.js b/js/dojo-1.6/dojox/dtl/_DomTemplated.js new file mode 100644 index 0000000..ee1c84e --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_DomTemplated.js @@ -0,0 +1,91 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl._DomTemplated"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._DomTemplated"] = true;
+dojo.provide("dojox.dtl._DomTemplated");
+
+dojo.require("dijit._Templated");
+dojo.require("dojox.dtl.dom");
+dojo.require("dojox.dtl.render.dom");
+dojo.require("dojox.dtl.contrib.dijit");
+
+dojox.dtl._DomTemplated = function(){};
+dojox.dtl._DomTemplated.prototype = {
+ _dijitTemplateCompat: false,
+ buildRendering: function(){
+ // summary:
+ // Construct the UI for this widget, setting this.domNode.
+
+ //render needs a domNode to work with
+ this.domNode = this.srcNodeRef;
+
+ if(!this._render){
+ var ddcd = dojox.dtl.contrib.dijit;
+ var old = ddcd.widgetsInTemplate;
+ ddcd.widgetsInTemplate = this.widgetsInTemplate;
+ this.template = this.template || this._getCachedTemplate(this.templatePath, this.templateString);
+ this._render = new dojox.dtl.render.dom.Render(this.domNode, this.template);
+ ddcd.widgetsInTemplate = old;
+ }
+
+ var context = this._getContext();
+ if(!this._created){
+ delete context._getter;
+ }
+ this.render(context);
+
+ this.domNode = this.template.getRootNode();
+ if(this.srcNodeRef && this.srcNodeRef.parentNode){
+ dojo.destroy(this.srcNodeRef);
+ delete this.srcNodeRef;
+ }
+ },
+ setTemplate: function(/*String|dojo._Url*/ template, /*dojox.dtl.Context?*/ context){
+ // summary:
+ // Quickly switch between templated by location
+ if(dojox.dtl.text._isTemplate(template)){
+ this.template = this._getCachedTemplate(null, template);
+ }else{
+ this.template = this._getCachedTemplate(template);
+ }
+ this.render(context);
+ },
+ render: function(/*dojox.dtl.Context?*/ context, /*dojox.dtl.DomTemplate?*/ tpl){
+ if(tpl){
+ this.template = tpl;
+ }
+ this._render.render(this._getContext(context), this.template);
+ },
+ _getContext: function(context){
+ if (!(context instanceof dojox.dtl.Context)) {
+ context = false;
+ }
+ context = context || new dojox.dtl.Context(this);
+ context.setThis(this);
+ return context;
+ },
+ _getCachedTemplate: function(templatePath, templateString){
+ if(!this._templates){
+ this._templates = {};
+ }
+ var key = templateString || templatePath.toString();
+ var tmplts = this._templates;
+ if(tmplts[key]){
+ return tmplts[key];
+ }
+ return (tmplts[key] = new dojox.dtl.DomTemplate(
+ dijit._Templated.getCachedTemplate(
+ templatePath,
+ templateString,
+ true
+ )
+ ));
+ }
+};
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/_DomTemplated.xd.js b/js/dojo-1.6/dojox/dtl/_DomTemplated.xd.js new file mode 100644 index 0000000..3a23c6a --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_DomTemplated.xd.js @@ -0,0 +1,99 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl._DomTemplated"],
+["require", "dijit._Templated"],
+["require", "dojox.dtl.dom"],
+["require", "dojox.dtl.render.dom"],
+["require", "dojox.dtl.contrib.dijit"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl._DomTemplated"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._DomTemplated"] = true;
+dojo.provide("dojox.dtl._DomTemplated");
+
+dojo.require("dijit._Templated");
+dojo.require("dojox.dtl.dom");
+dojo.require("dojox.dtl.render.dom");
+dojo.require("dojox.dtl.contrib.dijit");
+
+dojox.dtl._DomTemplated = function(){};
+dojox.dtl._DomTemplated.prototype = {
+ _dijitTemplateCompat: false,
+ buildRendering: function(){
+ // summary:
+ // Construct the UI for this widget, setting this.domNode.
+
+ //render needs a domNode to work with
+ this.domNode = this.srcNodeRef;
+
+ if(!this._render){
+ var ddcd = dojox.dtl.contrib.dijit;
+ var old = ddcd.widgetsInTemplate;
+ ddcd.widgetsInTemplate = this.widgetsInTemplate;
+ this.template = this.template || this._getCachedTemplate(this.templatePath, this.templateString);
+ this._render = new dojox.dtl.render.dom.Render(this.domNode, this.template);
+ ddcd.widgetsInTemplate = old;
+ }
+
+ var context = this._getContext();
+ if(!this._created){
+ delete context._getter;
+ }
+ this.render(context);
+
+ this.domNode = this.template.getRootNode();
+ if(this.srcNodeRef && this.srcNodeRef.parentNode){
+ dojo.destroy(this.srcNodeRef);
+ delete this.srcNodeRef;
+ }
+ },
+ setTemplate: function(/*String|dojo._Url*/ template, /*dojox.dtl.Context?*/ context){
+ // summary:
+ // Quickly switch between templated by location
+ if(dojox.dtl.text._isTemplate(template)){
+ this.template = this._getCachedTemplate(null, template);
+ }else{
+ this.template = this._getCachedTemplate(template);
+ }
+ this.render(context);
+ },
+ render: function(/*dojox.dtl.Context?*/ context, /*dojox.dtl.DomTemplate?*/ tpl){
+ if(tpl){
+ this.template = tpl;
+ }
+ this._render.render(this._getContext(context), this.template);
+ },
+ _getContext: function(context){
+ if (!(context instanceof dojox.dtl.Context)) {
+ context = false;
+ }
+ context = context || new dojox.dtl.Context(this);
+ context.setThis(this);
+ return context;
+ },
+ _getCachedTemplate: function(templatePath, templateString){
+ if(!this._templates){
+ this._templates = {};
+ }
+ var key = templateString || templatePath.toString();
+ var tmplts = this._templates;
+ if(tmplts[key]){
+ return tmplts[key];
+ }
+ return (tmplts[key] = new dojox.dtl.DomTemplate(
+ dijit._Templated.getCachedTemplate(
+ templatePath,
+ templateString,
+ true
+ )
+ ));
+ }
+};
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/_HtmlTemplated.js b/js/dojo-1.6/dojox/dtl/_HtmlTemplated.js new file mode 100644 index 0000000..f7f9b3b --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_HtmlTemplated.js @@ -0,0 +1,16 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl._HtmlTemplated"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._HtmlTemplated"] = true;
+dojo.provide("dojox.dtl._HtmlTemplated");
+dojo.require("dojox.dtl._DomTemplated");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+dojox.dtl._HtmlTemplated = dojox.dtl._DomTemplated;
+dojox.dtl._HtmlTemplated.prototype.declaredClass = "dojox.dtl._HtmlTemplated";
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/_HtmlTemplated.xd.js b/js/dojo-1.6/dojox/dtl/_HtmlTemplated.xd.js new file mode 100644 index 0000000..24cbef2 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_HtmlTemplated.xd.js @@ -0,0 +1,21 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl._HtmlTemplated"],
+["require", "dojox.dtl._DomTemplated"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl._HtmlTemplated"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._HtmlTemplated"] = true;
+dojo.provide("dojox.dtl._HtmlTemplated");
+dojo.require("dojox.dtl._DomTemplated");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+dojox.dtl._HtmlTemplated = dojox.dtl._DomTemplated;
+dojox.dtl._HtmlTemplated.prototype.declaredClass = "dojox.dtl._HtmlTemplated";
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/_Templated.js b/js/dojo-1.6/dojox/dtl/_Templated.js new file mode 100644 index 0000000..6187b72 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_Templated.js @@ -0,0 +1,138 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl._Templated"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._Templated"] = true;
+dojo.provide("dojox.dtl._Templated");
+dojo.require("dijit._Templated");
+dojo.require("dojox.dtl._base");
+
+dojo.declare("dojox.dtl._Templated", dijit._Templated, {
+ _dijitTemplateCompat: false,
+ buildRendering: function(){
+ var node;
+
+ if(this.domNode && !this._template){
+ return;
+ }
+
+ if(!this._template){
+ var t = this.getCachedTemplate(
+ this.templatePath,
+ this.templateString,
+ this._skipNodeCache
+ );
+ if(t instanceof dojox.dtl.Template) {
+ this._template = t;
+ }else{
+ node = t;
+ }
+ }
+ if(!node){
+ var context = new dojox.dtl._Context(this);
+ if(!this._created){
+ delete context._getter;
+ }
+ var nodes = dojo._toDom(
+ this._template.render(context)
+ );
+ // TODO: is it really necessary to look for the first node?
+ if(nodes.nodeType !== 1 && nodes.nodeType !== 3){
+ // nodes.nodeType === 11
+ // the node is a document fragment
+ for(var i = 0, l = nodes.childNodes.length; i < l; ++i){
+ node = nodes.childNodes[i];
+ if(node.nodeType == 1){
+ break;
+ }
+ }
+ }else{
+ // the node is an element or a text
+ node = nodes;
+ }
+ }
+
+ this._attachTemplateNodes(node);
+
+ if(this.widgetsInTemplate){
+ //Make sure dojoType is used for parsing widgets in template.
+ //The dojo.parser.query could be changed from multiversion support.
+ var parser = dojo.parser, qry, attr;
+ if(parser._query != "[dojoType]"){
+ qry = parser._query;
+ attr = parser._attrName;
+ parser._query = "[dojoType]";
+ parser._attrName = "dojoType";
+ }
+
+ //Store widgets that we need to start at a later point in time
+ var cw = (this._startupWidgets = dojo.parser.parse(node, {
+ noStart: !this._earlyTemplatedStartup,
+ inherited: {dir: this.dir, lang: this.lang}
+ }));
+
+ //Restore the query.
+ if(qry){
+ parser._query = qry;
+ parser._attrName = attr;
+ }
+
+ this._supportingWidgets = dijit.findWidgets(node);
+
+ this._attachTemplateNodes(cw, function(n,p){
+ return n[p];
+ });
+ }
+
+ if(this.domNode){
+ dojo.place(node, this.domNode, "before");
+ this.destroyDescendants();
+ dojo.destroy(this.domNode);
+ }
+ this.domNode = node;
+
+ this._fillContent(this.srcNodeRef);
+ },
+ _templateCache: {},
+ getCachedTemplate: function(templatePath, templateString, alwaysUseString){
+ // summary:
+ // Layer for dijit._Templated.getCachedTemplate
+ var tmplts = this._templateCache;
+ var key = templateString || templatePath;
+ if(tmplts[key]){
+ return tmplts[key];
+ }
+
+ templateString = dojo.string.trim(templateString || dojo.cache(templatePath, {sanitize: true}));
+
+ if( this._dijitTemplateCompat &&
+ (alwaysUseString || templateString.match(/\$\{([^\}]+)\}/g))
+ ){
+ templateString = this._stringRepl(templateString);
+ }
+
+ // If we always use a string, or find no variables, just store it as a node
+ if(alwaysUseString || !templateString.match(/\{[{%]([^\}]+)[%}]\}/g)){
+ return tmplts[key] = dojo._toDom(templateString);
+ }else{
+ return tmplts[key] = new dojox.dtl.Template(templateString);
+ }
+ },
+ render: function(){
+ this.buildRendering();
+ },
+ startup: function(){
+ dojo.forEach(this._startupWidgets, function(w){
+ if(w && !w._started && w.startup){
+ w.startup();
+ }
+ });
+ this.inherited(arguments);
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/_Templated.xd.js b/js/dojo-1.6/dojox/dtl/_Templated.xd.js new file mode 100644 index 0000000..e74e6c8 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_Templated.xd.js @@ -0,0 +1,144 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl._Templated"],
+["require", "dijit._Templated"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl._Templated"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._Templated"] = true;
+dojo.provide("dojox.dtl._Templated");
+dojo.require("dijit._Templated");
+dojo.require("dojox.dtl._base");
+
+dojo.declare("dojox.dtl._Templated", dijit._Templated, {
+ _dijitTemplateCompat: false,
+ buildRendering: function(){
+ var node;
+
+ if(this.domNode && !this._template){
+ return;
+ }
+
+ if(!this._template){
+ var t = this.getCachedTemplate(
+ this.templatePath,
+ this.templateString,
+ this._skipNodeCache
+ );
+ if(t instanceof dojox.dtl.Template) {
+ this._template = t;
+ }else{
+ node = t;
+ }
+ }
+ if(!node){
+ var context = new dojox.dtl._Context(this);
+ if(!this._created){
+ delete context._getter;
+ }
+ var nodes = dojo._toDom(
+ this._template.render(context)
+ );
+ // TODO: is it really necessary to look for the first node?
+ if(nodes.nodeType !== 1 && nodes.nodeType !== 3){
+ // nodes.nodeType === 11
+ // the node is a document fragment
+ for(var i = 0, l = nodes.childNodes.length; i < l; ++i){
+ node = nodes.childNodes[i];
+ if(node.nodeType == 1){
+ break;
+ }
+ }
+ }else{
+ // the node is an element or a text
+ node = nodes;
+ }
+ }
+
+ this._attachTemplateNodes(node);
+
+ if(this.widgetsInTemplate){
+ //Make sure dojoType is used for parsing widgets in template.
+ //The dojo.parser.query could be changed from multiversion support.
+ var parser = dojo.parser, qry, attr;
+ if(parser._query != "[dojoType]"){
+ qry = parser._query;
+ attr = parser._attrName;
+ parser._query = "[dojoType]";
+ parser._attrName = "dojoType";
+ }
+
+ //Store widgets that we need to start at a later point in time
+ var cw = (this._startupWidgets = dojo.parser.parse(node, {
+ noStart: !this._earlyTemplatedStartup,
+ inherited: {dir: this.dir, lang: this.lang}
+ }));
+
+ //Restore the query.
+ if(qry){
+ parser._query = qry;
+ parser._attrName = attr;
+ }
+
+ this._supportingWidgets = dijit.findWidgets(node);
+
+ this._attachTemplateNodes(cw, function(n,p){
+ return n[p];
+ });
+ }
+
+ if(this.domNode){
+ dojo.place(node, this.domNode, "before");
+ this.destroyDescendants();
+ dojo.destroy(this.domNode);
+ }
+ this.domNode = node;
+
+ this._fillContent(this.srcNodeRef);
+ },
+ _templateCache: {},
+ getCachedTemplate: function(templatePath, templateString, alwaysUseString){
+ // summary:
+ // Layer for dijit._Templated.getCachedTemplate
+ var tmplts = this._templateCache;
+ var key = templateString || templatePath;
+ if(tmplts[key]){
+ return tmplts[key];
+ }
+
+ templateString = dojo.string.trim(templateString || dojo.cache(templatePath, {sanitize: true}));
+
+ if( this._dijitTemplateCompat &&
+ (alwaysUseString || templateString.match(/\$\{([^\}]+)\}/g))
+ ){
+ templateString = this._stringRepl(templateString);
+ }
+
+ // If we always use a string, or find no variables, just store it as a node
+ if(alwaysUseString || !templateString.match(/\{[{%]([^\}]+)[%}]\}/g)){
+ return tmplts[key] = dojo._toDom(templateString);
+ }else{
+ return tmplts[key] = new dojox.dtl.Template(templateString);
+ }
+ },
+ render: function(){
+ this.buildRendering();
+ },
+ startup: function(){
+ dojo.forEach(this._startupWidgets, function(w){
+ if(w && !w._started && w.startup){
+ w.startup();
+ }
+ });
+ this.inherited(arguments);
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/_base.js b/js/dojo-1.6/dojox/dtl/_base.js new file mode 100644 index 0000000..78222f3 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_base.js @@ -0,0 +1,721 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._base"] = true;
+dojo.provide("dojox.dtl._base");
+
+dojo.require("dojox.string.Builder");
+dojo.require("dojox.string.tokenize");
+
+dojo.experimental("dojox.dtl");
+
+(function(){
+ var dd = dojox.dtl;
+
+ dd.TOKEN_BLOCK = -1;
+ dd.TOKEN_VAR = -2;
+ dd.TOKEN_COMMENT = -3;
+ dd.TOKEN_TEXT = 3;
+
+ dd._Context = dojo.extend(function(dict){
+ // summary: Pass one of these when rendering a template to tell the template what values to use.
+ if(dict){
+ dojo._mixin(this, dict);
+ if(dict.get){
+ // Preserve passed getter and restore prototype get
+ this._getter = dict.get;
+ delete this.get;
+ }
+ }
+ },
+ {
+ push: function(){
+ var last = this;
+ var context = dojo.delegate(this);
+ context.pop = function(){ return last; }
+ return context;
+ },
+ pop: function(){
+ throw new Error("pop() called on empty Context");
+ },
+ get: function(key, otherwise){
+ var n = this._normalize;
+
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return n(got);
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return n(this[key]);
+ }
+
+ return otherwise;
+ },
+ _normalize: function(value){
+ if(value instanceof Date){
+ value.year = value.getFullYear();
+ value.month = value.getMonth() + 1;
+ value.day = value.getDate();
+ value.date = value.year + "-" + ("0" + value.month).slice(-2) + "-" + ("0" + value.day).slice(-2);
+ value.hour = value.getHours();
+ value.minute = value.getMinutes();
+ value.second = value.getSeconds();
+ value.microsecond = value.getMilliseconds();
+ }
+ return value;
+ },
+ update: function(dict){
+ var context = this.push();
+ if(dict){
+ dojo._mixin(this, dict);
+ }
+ return context;
+ }
+ });
+
+ var smart_split_re = /("(?:[^"\\]*(?:\\.[^"\\]*)*)"|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)/g;
+ var split_re = /\s+/g;
+ var split = function(/*String|RegExp?*/ splitter, /*Integer?*/ limit){
+ splitter = splitter || split_re;
+ if(!(splitter instanceof RegExp)){
+ splitter = new RegExp(splitter, "g");
+ }
+ if(!splitter.global){
+ throw new Error("You must use a globally flagged RegExp with split " + splitter);
+ }
+ splitter.exec(""); // Reset the global
+
+ var part, parts = [], lastIndex = 0, i = 0;
+ while(part = splitter.exec(this)){
+ parts.push(this.slice(lastIndex, splitter.lastIndex - part[0].length));
+ lastIndex = splitter.lastIndex;
+ if(limit && (++i > limit - 1)){
+ break;
+ }
+ }
+ parts.push(this.slice(lastIndex));
+ return parts;
+ }
+
+ dd.Token = function(token_type, contents){
+ this.token_type = token_type;
+ this.contents = new String(dojo.trim(contents));
+ this.contents.split = split;
+ this.split = function(){
+ return String.prototype.split.apply(this.contents, arguments);
+ }
+ }
+ dd.Token.prototype.split_contents = function(/*Integer?*/ limit){
+ var bit, bits = [], i = 0;
+ limit = limit || 999;
+ while(i++ < limit && (bit = smart_split_re.exec(this.contents))){
+ bit = bit[0];
+ if(bit.charAt(0) == '"' && bit.slice(-1) == '"'){
+ bits.push('"' + bit.slice(1, -1).replace('\\"', '"').replace('\\\\', '\\') + '"');
+ }else if(bit.charAt(0) == "'" && bit.slice(-1) == "'"){
+ bits.push("'" + bit.slice(1, -1).replace("\\'", "'").replace('\\\\', '\\') + "'");
+ }else{
+ bits.push(bit);
+ }
+ }
+ return bits;
+ }
+
+ var ddt = dd.text = {
+ _get: function(module, name, errorless){
+ // summary: Used to find both tags and filters
+ var params = dd.register.get(module, name.toLowerCase(), errorless);
+ if(!params){
+ if(!errorless){
+ throw new Error("No tag found for " + name);
+ }
+ return null;
+ }
+
+ var fn = params[1];
+ var require = params[2];
+
+ var parts;
+ if(fn.indexOf(":") != -1){
+ parts = fn.split(":");
+ fn = parts.pop();
+ }
+
+ dojo["require"](require);
+
+ var parent = dojo.getObject(require);
+
+ return parent[fn || name] || parent[name + "_"] || parent[fn + "_"];
+ },
+ getTag: function(name, errorless){
+ return ddt._get("tag", name, errorless);
+ },
+ getFilter: function(name, errorless){
+ return ddt._get("filter", name, errorless);
+ },
+ getTemplate: function(file){
+ return new dd.Template(ddt.getTemplateString(file));
+ },
+ getTemplateString: function(file){
+ return dojo._getText(file.toString()) || "";
+ },
+ _resolveLazy: function(location, sync, json){
+ if(sync){
+ if(json){
+ return dojo.fromJson(dojo._getText(location)) || {};
+ }else{
+ return dd.text.getTemplateString(location);
+ }
+ }else{
+ return dojo.xhrGet({
+ handleAs: (json) ? "json" : "text",
+ url: location
+ });
+ }
+ },
+ _resolveTemplateArg: function(arg, sync){
+ if(ddt._isTemplate(arg)){
+ if(!sync){
+ var d = new dojo.Deferred();
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync);
+ },
+ _isTemplate: function(arg){
+ return (typeof arg == "undefined") || (typeof arg == "string" && (arg.match(/^\s*[<{]/) || arg.indexOf(" ") != -1));
+ },
+ _resolveContextArg: function(arg, sync){
+ if(arg.constructor == Object){
+ if(!sync){
+ var d = new dojo.Deferred;
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync, true);
+ },
+ _re: /(?:\{\{\s*(.+?)\s*\}\}|\{%\s*(load\s*)?(.+?)\s*%\})/g,
+ tokenize: function(str){
+ return dojox.string.tokenize(str, ddt._re, ddt._parseDelims);
+ },
+ _parseDelims: function(varr, load, tag){
+ if(varr){
+ return [dd.TOKEN_VAR, varr];
+ }else if(load){
+ var parts = dojo.trim(tag).split(/\s+/g);
+ for(var i = 0, part; part = parts[i]; i++){
+ dojo["require"](part);
+ }
+ }else{
+ return [dd.TOKEN_BLOCK, tag];
+ }
+ }
+ }
+
+ dd.Template = dojo.extend(function(/*String|dojo._Url*/ template, /*Boolean*/ isString){
+ // template:
+ // The string or location of the string to
+ // use as a template
+ var str = isString ? template : ddt._resolveTemplateArg(template, true) || "";
+ var tokens = ddt.tokenize(str);
+ var parser = new dd._Parser(tokens);
+ this.nodelist = parser.parse();
+ },
+ {
+ update: function(node, context){
+ // node: DOMNode|String|dojo.NodeList
+ // A node reference or set of nodes
+ // context: dojo._Url|String|Object
+ // The context object or location
+ return ddt._resolveContextArg(context).addCallback(this, function(contextObject){
+ var content = this.render(new dd._Context(contextObject));
+ if(node.forEach){
+ node.forEach(function(item){
+ item.innerHTML = content;
+ });
+ }else{
+ dojo.byId(node).innerHTML = content;
+ }
+ return this;
+ });
+ },
+ render: function(context, /*concatenatable?*/ buffer){
+ buffer = buffer || this.getBuffer();
+ context = context || new dd._Context({});
+ return this.nodelist.render(context, buffer) + "";
+ },
+ getBuffer: function(){
+ dojo.require("dojox.string.Builder");
+ return new dojox.string.Builder();
+ }
+ });
+
+ var qfRe = /\{\{\s*(.+?)\s*\}\}/g;
+ dd.quickFilter = function(str){
+ if(!str){
+ return new dd._NodeList();
+ }
+
+ if(str.indexOf("{%") == -1){
+ return new dd._QuickNodeList(dojox.string.tokenize(str, qfRe, function(token){
+ return new dd._Filter(token);
+ }));
+ }
+ }
+
+ dd._QuickNodeList = dojo.extend(function(contents){
+ this.contents = contents;
+ },
+ {
+ render: function(context, buffer){
+ for(var i=0, l=this.contents.length; i<l; i++){
+ if(this.contents[i].resolve){
+ buffer = buffer.concat(this.contents[i].resolve(context));
+ }else{
+ buffer = buffer.concat(this.contents[i]);
+ }
+ }
+ return buffer;
+ },
+ dummyRender: function(context){ return this.render(context, dd.Template.prototype.getBuffer()).toString(); },
+ clone: function(buffer){ return this; }
+ });
+
+ dd._Filter = dojo.extend(function(token){
+ // summary: Uses a string to find (and manipulate) a variable
+ if(!token) throw new Error("Filter must be called with variable name");
+ this.contents = token;
+
+ var cache = this._cache[token];
+ if(cache){
+ this.key = cache[0];
+ this.filters = cache[1];
+ }else{
+ this.filters = [];
+ dojox.string.tokenize(token, this._re, this._tokenize, this);
+ this._cache[token] = [this.key, this.filters];
+ }
+ },
+ {
+ _cache: {},
+ _re: /(?:^_\("([^\\"]*(?:\\.[^\\"])*)"\)|^"([^\\"]*(?:\\.[^\\"]*)*)"|^([a-zA-Z0-9_.]+)|\|(\w+)(?::(?:_\("([^\\"]*(?:\\.[^\\"])*)"\)|"([^\\"]*(?:\\.[^\\"]*)*)"|([a-zA-Z0-9_.]+)|'([^\\']*(?:\\.[^\\']*)*)'))?|^'([^\\']*(?:\\.[^\\']*)*)')/g,
+ _values: {
+ 0: '"', // _("text")
+ 1: '"', // "text"
+ 2: "", // variable
+ 8: '"' // 'text'
+ },
+ _args: {
+ 4: '"', // :_("text")
+ 5: '"', // :"text"
+ 6: "", // :variable
+ 7: "'"// :'text'
+ },
+ _tokenize: function(){
+ var pos, arg;
+
+ for(var i = 0, has = []; i < arguments.length; i++){
+ has[i] = (typeof arguments[i] != "undefined" && typeof arguments[i] == "string" && arguments[i]);
+ }
+
+ if(!this.key){
+ for(pos in this._values){
+ if(has[pos]){
+ this.key = this._values[pos] + arguments[pos] + this._values[pos];
+ break;
+ }
+ }
+ }else{
+ for(pos in this._args){
+ if(has[pos]){
+ var value = arguments[pos];
+ if(this._args[pos] == "'"){
+ value = value.replace(/\\'/g, "'");
+ }else if(this._args[pos] == '"'){
+ value = value.replace(/\\"/g, '"');
+ }
+ arg = [!this._args[pos], value];
+ break;
+ }
+ }
+ // Get a named filter
+ var fn = ddt.getFilter(arguments[3]);
+ if(!dojo.isFunction(fn)) throw new Error(arguments[3] + " is not registered as a filter");
+ this.filters.push([fn, arg]);
+ }
+ },
+ getExpression: function(){
+ return this.contents;
+ },
+ resolve: function(context){
+ if(typeof this.key == "undefined"){
+ return "";
+ }
+
+ var str = this.resolvePath(this.key, context);
+
+ for(var i = 0, filter; filter = this.filters[i]; i++){
+ // Each filter has the function in [0], a boolean in [1][0] of whether it's a variable or a string
+ // and [1][1] is either the variable name of the string content.
+ if(filter[1]){
+ if(filter[1][0]){
+ str = filter[0](str, this.resolvePath(filter[1][1], context));
+ }else{
+ str = filter[0](str, filter[1][1]);
+ }
+ }else{
+ str = filter[0](str);
+ }
+ }
+
+ return str;
+ },
+ resolvePath: function(path, context){
+ var current, parts;
+ var first = path.charAt(0);
+ var last = path.slice(-1);
+ if(!isNaN(parseInt(first))){
+ current = (path.indexOf(".") == -1) ? parseInt(path) : parseFloat(path);
+ }else if(first == '"' && first == last){
+ current = path.slice(1, -1);
+ }else{
+ if(path == "true"){ return true; }
+ if(path == "false"){ return false; }
+ if(path == "null" || path == "None"){ return null; }
+ parts = path.split(".");
+ current = context.get(parts[0]);
+
+ if(dojo.isFunction(current)){
+ var self = context.getThis && context.getThis();
+ if(current.alters_data){
+ current = "";
+ }else if(self){
+ current = current.call(self);
+ }else{
+ current = "";
+ }
+ }
+
+ for(var i = 1; i < parts.length; i++){
+ var part = parts[i];
+ if(current){
+ var base = current;
+ if(dojo.isObject(current) && part == "items" && typeof current[part] == "undefined"){
+ var items = [];
+ for(var key in current){
+ items.push([key, current[key]]);
+ }
+ current = items;
+ continue;
+ }
+
+ if(current.get && dojo.isFunction(current.get) && current.get.safe){
+ current = current.get(part);
+ }else if(typeof current[part] == "undefined"){
+ current = current[part];
+ break;
+ }else{
+ current = current[part];
+ }
+
+ if(dojo.isFunction(current)){
+ if(current.alters_data){
+ current = "";
+ }else{
+ current = current.call(base);
+ }
+ }else if(current instanceof Date){
+ current = dd._Context.prototype._normalize(current);
+ }
+ }else{
+ return "";
+ }
+ }
+ }
+ return current;
+ }
+ });
+
+ dd._TextNode = dd._Node = dojo.extend(function(/*Object*/ obj){
+ // summary: Basic catch-all node
+ this.contents = obj;
+ },
+ {
+ set: function(data){
+ this.contents = data;
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds content onto the buffer
+ return buffer.concat(this.contents);
+ },
+ isEmpty: function(){
+ return !dojo.trim(this.contents);
+ },
+ clone: function(){ return this; }
+ });
+
+ dd._NodeList = dojo.extend(function(/*Node[]*/ nodes){
+ // summary: Allows us to render a group of nodes
+ this.contents = nodes || [];
+ this.last = "";
+ },
+ {
+ push: function(node){
+ // summary: Add a new node to the list
+ this.contents.push(node);
+ return this;
+ },
+ concat: function(nodes){
+ this.contents = this.contents.concat(nodes);
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds all content onto the buffer
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].render(context, buffer);
+ if(!buffer) throw new Error("Template must return buffer");
+ }
+ return buffer;
+ },
+ dummyRender: function(context){
+ return this.render(context, dd.Template.prototype.getBuffer()).toString();
+ },
+ unrender: function(){ return arguments[1]; },
+ clone: function(){ return this; },
+ rtrim: function(){
+ while(1){
+ i = this.contents.length - 1;
+ if(this.contents[i] instanceof dd._TextNode && this.contents[i].isEmpty()){
+ this.contents.pop();
+ }else{
+ break;
+ }
+ }
+
+ return this;
+ }
+ });
+
+ dd._VarNode = dojo.extend(function(str){
+ // summary: A node to be processed as a variable
+ this.contents = new dd._Filter(str);
+ },
+ {
+ render: function(context, buffer){
+ var str = this.contents.resolve(context);
+ if(!str.safe){
+ str = dd._base.escape("" + str);
+ }
+ return buffer.concat(str);
+ }
+ });
+
+ dd._noOpNode = new function(){
+ // summary: Adds a no-op node. Useful in custom tags
+ this.render = this.unrender = function(){ return arguments[1]; }
+ this.clone = function(){ return this; }
+ }
+
+ dd._Parser = dojo.extend(function(tokens){
+ // summary: Parser used during initialization and for tag groups.
+ this.contents = tokens;
+ },
+ {
+ i: 0,
+ parse: function(/*Array?*/ stop_at){
+ // summary: Turns tokens into nodes
+ // description: Steps into tags are they're found. Blocks use the parse object
+ // to find their closing tag (the stop_at array). stop_at is inclusive, it
+ // returns the node that matched.
+ var terminators = {}, token;
+ stop_at = stop_at || [];
+ for(var i = 0; i < stop_at.length; i++){
+ terminators[stop_at[i]] = true;
+ }
+
+ var nodelist = new dd._NodeList();
+ while(this.i < this.contents.length){
+ token = this.contents[this.i++];
+ if(typeof token == "string"){
+ nodelist.push(new dd._TextNode(token));
+ }else{
+ var type = token[0];
+ var text = token[1];
+ if(type == dd.TOKEN_VAR){
+ nodelist.push(new dd._VarNode(text));
+ }else if(type == dd.TOKEN_BLOCK){
+ if(terminators[text]){
+ --this.i;
+ return nodelist;
+ }
+ var cmd = text.split(/\s+/g);
+ if(cmd.length){
+ cmd = cmd[0];
+ var fn = ddt.getTag(cmd);
+ if(fn){
+ nodelist.push(fn(this, new dd.Token(type, text)));
+ }
+ }
+ }
+ }
+ }
+
+ if(stop_at.length){
+ throw new Error("Could not find closing tag(s): " + stop_at.toString());
+ }
+
+ this.contents.length = 0;
+ return nodelist;
+ },
+ next_token: function(){
+ // summary: Returns the next token in the list.
+ var token = this.contents[this.i++];
+ return new dd.Token(token[0], token[1]);
+ },
+ delete_first_token: function(){
+ this.i++;
+ },
+ skip_past: function(endtag){
+ while(this.i < this.contents.length){
+ var token = this.contents[this.i++];
+ if(token[0] == dd.TOKEN_BLOCK && token[1] == endtag){
+ return;
+ }
+ }
+ throw new Error("Unclosed tag found when looking for " + endtag);
+ },
+ create_variable_node: function(expr){
+ return new dd._VarNode(expr);
+ },
+ create_text_node: function(expr){
+ return new dd._TextNode(expr || "");
+ },
+ getTemplate: function(file){
+ return new dd.Template(file);
+ }
+ });
+
+ dd.register = {
+ _registry: {
+ attributes: [],
+ tags: [],
+ filters: []
+ },
+ get: function(/*String*/ module, /*String*/ name){
+ var registry = dd.register._registry[module + "s"];
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(typeof entry[0] == "string"){
+ if(entry[0] == name){
+ return entry;
+ }
+ }else if(name.match(entry[0])){
+ return entry;
+ }
+ }
+ },
+ getAttributeTags: function(){
+ var tags = [];
+ var registry = dd.register._registry.attributes;
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(entry.length == 3){
+ tags.push(entry);
+ }else{
+ var fn = dojo.getObject(entry[1]);
+ if(fn && dojo.isFunction(fn)){
+ entry.push(fn);
+ tags.push(entry);
+ }
+ }
+ }
+ return tags;
+ },
+ _any: function(type, base, locations){
+ for(var path in locations){
+ for(var i = 0, fn; fn = locations[path][i]; i++){
+ var key = fn;
+ if(dojo.isArray(fn)){
+ key = fn[0];
+ fn = fn[1];
+ }
+ if(typeof key == "string"){
+ if(key.substr(0, 5) == "attr:"){
+ var attr = fn;
+ if(attr.substr(0, 5) == "attr:"){
+ attr = attr.slice(5);
+ }
+ dd.register._registry.attributes.push([attr.toLowerCase(), base + "." + path + "." + attr]);
+ }
+ key = key.toLowerCase()
+ }
+ dd.register._registry[type].push([
+ key,
+ fn,
+ base + "." + path
+ ]);
+ }
+ }
+ },
+ tags: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("tags", base, locations);
+ },
+ filters: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("filters", base, locations);
+ }
+ }
+
+ var escapeamp = /&/g;
+ var escapelt = /</g;
+ var escapegt = />/g;
+ var escapeqt = /'/g;
+ var escapedblqt = /"/g;
+ dd._base.escape = function(value){
+ // summary: Escapes a string's HTML
+ return dd.mark_safe(value.replace(escapeamp, '&').replace(escapelt, '<').replace(escapegt, '>').replace(escapedblqt, '"').replace(escapeqt, '''));
+ }
+
+ dd._base.safe = function(value){
+ if(typeof value == "string"){
+ value = new String(value);
+ }
+ if(typeof value == "object"){
+ value.safe = true;
+ }
+ return value;
+ }
+ dd.mark_safe = dd._base.safe;
+
+ dd.register.tags("dojox.dtl.tag", {
+ "date": ["now"],
+ "logic": ["if", "for", "ifequal", "ifnotequal"],
+ "loader": ["extends", "block", "include", "load", "ssi"],
+ "misc": ["comment", "debug", "filter", "firstof", "spaceless", "templatetag", "widthratio", "with"],
+ "loop": ["cycle", "ifchanged", "regroup"]
+ });
+ dd.register.filters("dojox.dtl.filter", {
+ "dates": ["date", "time", "timesince", "timeuntil"],
+ "htmlstrings": ["linebreaks", "linebreaksbr", "removetags", "striptags"],
+ "integers": ["add", "get_digit"],
+ "lists": ["dictsort", "dictsortreversed", "first", "join", "length", "length_is", "random", "slice", "unordered_list"],
+ "logic": ["default", "default_if_none", "divisibleby", "yesno"],
+ "misc": ["filesizeformat", "pluralize", "phone2numeric", "pprint"],
+ "strings": ["addslashes", "capfirst", "center", "cut", "fix_ampersands", "floatformat", "iriencode", "linenumbers", "ljust", "lower", "make_list", "rjust", "slugify", "stringformat", "title", "truncatewords", "truncatewords_html", "upper", "urlencode", "urlize", "urlizetrunc", "wordcount", "wordwrap"]
+ });
+ dd.register.filters("dojox.dtl", {
+ "_base": ["escape", "safe"]
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/_base.xd.js b/js/dojo-1.6/dojox/dtl/_base.xd.js new file mode 100644 index 0000000..f1cab09 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/_base.xd.js @@ -0,0 +1,728 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl._base"],
+["require", "dojox.string.Builder"],
+["require", "dojox.string.tokenize"],
+["require", "dojox.string.Builder"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl._base"] = true;
+dojo.provide("dojox.dtl._base");
+
+dojo.require("dojox.string.Builder");
+dojo.require("dojox.string.tokenize");
+
+dojo.experimental("dojox.dtl");
+
+(function(){
+ var dd = dojox.dtl;
+
+ dd.TOKEN_BLOCK = -1;
+ dd.TOKEN_VAR = -2;
+ dd.TOKEN_COMMENT = -3;
+ dd.TOKEN_TEXT = 3;
+
+ dd._Context = dojo.extend(function(dict){
+ // summary: Pass one of these when rendering a template to tell the template what values to use.
+ if(dict){
+ dojo._mixin(this, dict);
+ if(dict.get){
+ // Preserve passed getter and restore prototype get
+ this._getter = dict.get;
+ delete this.get;
+ }
+ }
+ },
+ {
+ push: function(){
+ var last = this;
+ var context = dojo.delegate(this);
+ context.pop = function(){ return last; }
+ return context;
+ },
+ pop: function(){
+ throw new Error("pop() called on empty Context");
+ },
+ get: function(key, otherwise){
+ var n = this._normalize;
+
+ if(this._getter){
+ var got = this._getter(key);
+ if(typeof got != "undefined"){
+ return n(got);
+ }
+ }
+
+ if(typeof this[key] != "undefined"){
+ return n(this[key]);
+ }
+
+ return otherwise;
+ },
+ _normalize: function(value){
+ if(value instanceof Date){
+ value.year = value.getFullYear();
+ value.month = value.getMonth() + 1;
+ value.day = value.getDate();
+ value.date = value.year + "-" + ("0" + value.month).slice(-2) + "-" + ("0" + value.day).slice(-2);
+ value.hour = value.getHours();
+ value.minute = value.getMinutes();
+ value.second = value.getSeconds();
+ value.microsecond = value.getMilliseconds();
+ }
+ return value;
+ },
+ update: function(dict){
+ var context = this.push();
+ if(dict){
+ dojo._mixin(this, dict);
+ }
+ return context;
+ }
+ });
+
+ var smart_split_re = /("(?:[^"\\]*(?:\\.[^"\\]*)*)"|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)/g;
+ var split_re = /\s+/g;
+ var split = function(/*String|RegExp?*/ splitter, /*Integer?*/ limit){
+ splitter = splitter || split_re;
+ if(!(splitter instanceof RegExp)){
+ splitter = new RegExp(splitter, "g");
+ }
+ if(!splitter.global){
+ throw new Error("You must use a globally flagged RegExp with split " + splitter);
+ }
+ splitter.exec(""); // Reset the global
+
+ var part, parts = [], lastIndex = 0, i = 0;
+ while(part = splitter.exec(this)){
+ parts.push(this.slice(lastIndex, splitter.lastIndex - part[0].length));
+ lastIndex = splitter.lastIndex;
+ if(limit && (++i > limit - 1)){
+ break;
+ }
+ }
+ parts.push(this.slice(lastIndex));
+ return parts;
+ }
+
+ dd.Token = function(token_type, contents){
+ this.token_type = token_type;
+ this.contents = new String(dojo.trim(contents));
+ this.contents.split = split;
+ this.split = function(){
+ return String.prototype.split.apply(this.contents, arguments);
+ }
+ }
+ dd.Token.prototype.split_contents = function(/*Integer?*/ limit){
+ var bit, bits = [], i = 0;
+ limit = limit || 999;
+ while(i++ < limit && (bit = smart_split_re.exec(this.contents))){
+ bit = bit[0];
+ if(bit.charAt(0) == '"' && bit.slice(-1) == '"'){
+ bits.push('"' + bit.slice(1, -1).replace('\\"', '"').replace('\\\\', '\\') + '"');
+ }else if(bit.charAt(0) == "'" && bit.slice(-1) == "'"){
+ bits.push("'" + bit.slice(1, -1).replace("\\'", "'").replace('\\\\', '\\') + "'");
+ }else{
+ bits.push(bit);
+ }
+ }
+ return bits;
+ }
+
+ var ddt = dd.text = {
+ _get: function(module, name, errorless){
+ // summary: Used to find both tags and filters
+ var params = dd.register.get(module, name.toLowerCase(), errorless);
+ if(!params){
+ if(!errorless){
+ throw new Error("No tag found for " + name);
+ }
+ return null;
+ }
+
+ var fn = params[1];
+ var require = params[2];
+
+ var parts;
+ if(fn.indexOf(":") != -1){
+ parts = fn.split(":");
+ fn = parts.pop();
+ }
+
+ dojo["require"](require);
+
+ var parent = dojo.getObject(require);
+
+ return parent[fn || name] || parent[name + "_"] || parent[fn + "_"];
+ },
+ getTag: function(name, errorless){
+ return ddt._get("tag", name, errorless);
+ },
+ getFilter: function(name, errorless){
+ return ddt._get("filter", name, errorless);
+ },
+ getTemplate: function(file){
+ return new dd.Template(ddt.getTemplateString(file));
+ },
+ getTemplateString: function(file){
+ return dojo._getText(file.toString()) || "";
+ },
+ _resolveLazy: function(location, sync, json){
+ if(sync){
+ if(json){
+ return dojo.fromJson(dojo._getText(location)) || {};
+ }else{
+ return dd.text.getTemplateString(location);
+ }
+ }else{
+ return dojo.xhrGet({
+ handleAs: (json) ? "json" : "text",
+ url: location
+ });
+ }
+ },
+ _resolveTemplateArg: function(arg, sync){
+ if(ddt._isTemplate(arg)){
+ if(!sync){
+ var d = new dojo.Deferred();
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync);
+ },
+ _isTemplate: function(arg){
+ return (typeof arg == "undefined") || (typeof arg == "string" && (arg.match(/^\s*[<{]/) || arg.indexOf(" ") != -1));
+ },
+ _resolveContextArg: function(arg, sync){
+ if(arg.constructor == Object){
+ if(!sync){
+ var d = new dojo.Deferred;
+ d.callback(arg);
+ return d;
+ }
+ return arg;
+ }
+ return ddt._resolveLazy(arg, sync, true);
+ },
+ _re: /(?:\{\{\s*(.+?)\s*\}\}|\{%\s*(load\s*)?(.+?)\s*%\})/g,
+ tokenize: function(str){
+ return dojox.string.tokenize(str, ddt._re, ddt._parseDelims);
+ },
+ _parseDelims: function(varr, load, tag){
+ if(varr){
+ return [dd.TOKEN_VAR, varr];
+ }else if(load){
+ var parts = dojo.trim(tag).split(/\s+/g);
+ for(var i = 0, part; part = parts[i]; i++){
+ dojo["require"](part);
+ }
+ }else{
+ return [dd.TOKEN_BLOCK, tag];
+ }
+ }
+ }
+
+ dd.Template = dojo.extend(function(/*String|dojo._Url*/ template, /*Boolean*/ isString){
+ // template:
+ // The string or location of the string to
+ // use as a template
+ var str = isString ? template : ddt._resolveTemplateArg(template, true) || "";
+ var tokens = ddt.tokenize(str);
+ var parser = new dd._Parser(tokens);
+ this.nodelist = parser.parse();
+ },
+ {
+ update: function(node, context){
+ // node: DOMNode|String|dojo.NodeList
+ // A node reference or set of nodes
+ // context: dojo._Url|String|Object
+ // The context object or location
+ return ddt._resolveContextArg(context).addCallback(this, function(contextObject){
+ var content = this.render(new dd._Context(contextObject));
+ if(node.forEach){
+ node.forEach(function(item){
+ item.innerHTML = content;
+ });
+ }else{
+ dojo.byId(node).innerHTML = content;
+ }
+ return this;
+ });
+ },
+ render: function(context, /*concatenatable?*/ buffer){
+ buffer = buffer || this.getBuffer();
+ context = context || new dd._Context({});
+ return this.nodelist.render(context, buffer) + "";
+ },
+ getBuffer: function(){
+ dojo.require("dojox.string.Builder");
+ return new dojox.string.Builder();
+ }
+ });
+
+ var qfRe = /\{\{\s*(.+?)\s*\}\}/g;
+ dd.quickFilter = function(str){
+ if(!str){
+ return new dd._NodeList();
+ }
+
+ if(str.indexOf("{%") == -1){
+ return new dd._QuickNodeList(dojox.string.tokenize(str, qfRe, function(token){
+ return new dd._Filter(token);
+ }));
+ }
+ }
+
+ dd._QuickNodeList = dojo.extend(function(contents){
+ this.contents = contents;
+ },
+ {
+ render: function(context, buffer){
+ for(var i=0, l=this.contents.length; i<l; i++){
+ if(this.contents[i].resolve){
+ buffer = buffer.concat(this.contents[i].resolve(context));
+ }else{
+ buffer = buffer.concat(this.contents[i]);
+ }
+ }
+ return buffer;
+ },
+ dummyRender: function(context){ return this.render(context, dd.Template.prototype.getBuffer()).toString(); },
+ clone: function(buffer){ return this; }
+ });
+
+ dd._Filter = dojo.extend(function(token){
+ // summary: Uses a string to find (and manipulate) a variable
+ if(!token) throw new Error("Filter must be called with variable name");
+ this.contents = token;
+
+ var cache = this._cache[token];
+ if(cache){
+ this.key = cache[0];
+ this.filters = cache[1];
+ }else{
+ this.filters = [];
+ dojox.string.tokenize(token, this._re, this._tokenize, this);
+ this._cache[token] = [this.key, this.filters];
+ }
+ },
+ {
+ _cache: {},
+ _re: /(?:^_\("([^\\"]*(?:\\.[^\\"])*)"\)|^"([^\\"]*(?:\\.[^\\"]*)*)"|^([a-zA-Z0-9_.]+)|\|(\w+)(?::(?:_\("([^\\"]*(?:\\.[^\\"])*)"\)|"([^\\"]*(?:\\.[^\\"]*)*)"|([a-zA-Z0-9_.]+)|'([^\\']*(?:\\.[^\\']*)*)'))?|^'([^\\']*(?:\\.[^\\']*)*)')/g,
+ _values: {
+ 0: '"', // _("text")
+ 1: '"', // "text"
+ 2: "", // variable
+ 8: '"' // 'text'
+ },
+ _args: {
+ 4: '"', // :_("text")
+ 5: '"', // :"text"
+ 6: "", // :variable
+ 7: "'"// :'text'
+ },
+ _tokenize: function(){
+ var pos, arg;
+
+ for(var i = 0, has = []; i < arguments.length; i++){
+ has[i] = (typeof arguments[i] != "undefined" && typeof arguments[i] == "string" && arguments[i]);
+ }
+
+ if(!this.key){
+ for(pos in this._values){
+ if(has[pos]){
+ this.key = this._values[pos] + arguments[pos] + this._values[pos];
+ break;
+ }
+ }
+ }else{
+ for(pos in this._args){
+ if(has[pos]){
+ var value = arguments[pos];
+ if(this._args[pos] == "'"){
+ value = value.replace(/\\'/g, "'");
+ }else if(this._args[pos] == '"'){
+ value = value.replace(/\\"/g, '"');
+ }
+ arg = [!this._args[pos], value];
+ break;
+ }
+ }
+ // Get a named filter
+ var fn = ddt.getFilter(arguments[3]);
+ if(!dojo.isFunction(fn)) throw new Error(arguments[3] + " is not registered as a filter");
+ this.filters.push([fn, arg]);
+ }
+ },
+ getExpression: function(){
+ return this.contents;
+ },
+ resolve: function(context){
+ if(typeof this.key == "undefined"){
+ return "";
+ }
+
+ var str = this.resolvePath(this.key, context);
+
+ for(var i = 0, filter; filter = this.filters[i]; i++){
+ // Each filter has the function in [0], a boolean in [1][0] of whether it's a variable or a string
+ // and [1][1] is either the variable name of the string content.
+ if(filter[1]){
+ if(filter[1][0]){
+ str = filter[0](str, this.resolvePath(filter[1][1], context));
+ }else{
+ str = filter[0](str, filter[1][1]);
+ }
+ }else{
+ str = filter[0](str);
+ }
+ }
+
+ return str;
+ },
+ resolvePath: function(path, context){
+ var current, parts;
+ var first = path.charAt(0);
+ var last = path.slice(-1);
+ if(!isNaN(parseInt(first))){
+ current = (path.indexOf(".") == -1) ? parseInt(path) : parseFloat(path);
+ }else if(first == '"' && first == last){
+ current = path.slice(1, -1);
+ }else{
+ if(path == "true"){ return true; }
+ if(path == "false"){ return false; }
+ if(path == "null" || path == "None"){ return null; }
+ parts = path.split(".");
+ current = context.get(parts[0]);
+
+ if(dojo.isFunction(current)){
+ var self = context.getThis && context.getThis();
+ if(current.alters_data){
+ current = "";
+ }else if(self){
+ current = current.call(self);
+ }else{
+ current = "";
+ }
+ }
+
+ for(var i = 1; i < parts.length; i++){
+ var part = parts[i];
+ if(current){
+ var base = current;
+ if(dojo.isObject(current) && part == "items" && typeof current[part] == "undefined"){
+ var items = [];
+ for(var key in current){
+ items.push([key, current[key]]);
+ }
+ current = items;
+ continue;
+ }
+
+ if(current.get && dojo.isFunction(current.get) && current.get.safe){
+ current = current.get(part);
+ }else if(typeof current[part] == "undefined"){
+ current = current[part];
+ break;
+ }else{
+ current = current[part];
+ }
+
+ if(dojo.isFunction(current)){
+ if(current.alters_data){
+ current = "";
+ }else{
+ current = current.call(base);
+ }
+ }else if(current instanceof Date){
+ current = dd._Context.prototype._normalize(current);
+ }
+ }else{
+ return "";
+ }
+ }
+ }
+ return current;
+ }
+ });
+
+ dd._TextNode = dd._Node = dojo.extend(function(/*Object*/ obj){
+ // summary: Basic catch-all node
+ this.contents = obj;
+ },
+ {
+ set: function(data){
+ this.contents = data;
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds content onto the buffer
+ return buffer.concat(this.contents);
+ },
+ isEmpty: function(){
+ return !dojo.trim(this.contents);
+ },
+ clone: function(){ return this; }
+ });
+
+ dd._NodeList = dojo.extend(function(/*Node[]*/ nodes){
+ // summary: Allows us to render a group of nodes
+ this.contents = nodes || [];
+ this.last = "";
+ },
+ {
+ push: function(node){
+ // summary: Add a new node to the list
+ this.contents.push(node);
+ return this;
+ },
+ concat: function(nodes){
+ this.contents = this.contents.concat(nodes);
+ return this;
+ },
+ render: function(context, buffer){
+ // summary: Adds all content onto the buffer
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].render(context, buffer);
+ if(!buffer) throw new Error("Template must return buffer");
+ }
+ return buffer;
+ },
+ dummyRender: function(context){
+ return this.render(context, dd.Template.prototype.getBuffer()).toString();
+ },
+ unrender: function(){ return arguments[1]; },
+ clone: function(){ return this; },
+ rtrim: function(){
+ while(1){
+ i = this.contents.length - 1;
+ if(this.contents[i] instanceof dd._TextNode && this.contents[i].isEmpty()){
+ this.contents.pop();
+ }else{
+ break;
+ }
+ }
+
+ return this;
+ }
+ });
+
+ dd._VarNode = dojo.extend(function(str){
+ // summary: A node to be processed as a variable
+ this.contents = new dd._Filter(str);
+ },
+ {
+ render: function(context, buffer){
+ var str = this.contents.resolve(context);
+ if(!str.safe){
+ str = dd._base.escape("" + str);
+ }
+ return buffer.concat(str);
+ }
+ });
+
+ dd._noOpNode = new function(){
+ // summary: Adds a no-op node. Useful in custom tags
+ this.render = this.unrender = function(){ return arguments[1]; }
+ this.clone = function(){ return this; }
+ }
+
+ dd._Parser = dojo.extend(function(tokens){
+ // summary: Parser used during initialization and for tag groups.
+ this.contents = tokens;
+ },
+ {
+ i: 0,
+ parse: function(/*Array?*/ stop_at){
+ // summary: Turns tokens into nodes
+ // description: Steps into tags are they're found. Blocks use the parse object
+ // to find their closing tag (the stop_at array). stop_at is inclusive, it
+ // returns the node that matched.
+ var terminators = {}, token;
+ stop_at = stop_at || [];
+ for(var i = 0; i < stop_at.length; i++){
+ terminators[stop_at[i]] = true;
+ }
+
+ var nodelist = new dd._NodeList();
+ while(this.i < this.contents.length){
+ token = this.contents[this.i++];
+ if(typeof token == "string"){
+ nodelist.push(new dd._TextNode(token));
+ }else{
+ var type = token[0];
+ var text = token[1];
+ if(type == dd.TOKEN_VAR){
+ nodelist.push(new dd._VarNode(text));
+ }else if(type == dd.TOKEN_BLOCK){
+ if(terminators[text]){
+ --this.i;
+ return nodelist;
+ }
+ var cmd = text.split(/\s+/g);
+ if(cmd.length){
+ cmd = cmd[0];
+ var fn = ddt.getTag(cmd);
+ if(fn){
+ nodelist.push(fn(this, new dd.Token(type, text)));
+ }
+ }
+ }
+ }
+ }
+
+ if(stop_at.length){
+ throw new Error("Could not find closing tag(s): " + stop_at.toString());
+ }
+
+ this.contents.length = 0;
+ return nodelist;
+ },
+ next_token: function(){
+ // summary: Returns the next token in the list.
+ var token = this.contents[this.i++];
+ return new dd.Token(token[0], token[1]);
+ },
+ delete_first_token: function(){
+ this.i++;
+ },
+ skip_past: function(endtag){
+ while(this.i < this.contents.length){
+ var token = this.contents[this.i++];
+ if(token[0] == dd.TOKEN_BLOCK && token[1] == endtag){
+ return;
+ }
+ }
+ throw new Error("Unclosed tag found when looking for " + endtag);
+ },
+ create_variable_node: function(expr){
+ return new dd._VarNode(expr);
+ },
+ create_text_node: function(expr){
+ return new dd._TextNode(expr || "");
+ },
+ getTemplate: function(file){
+ return new dd.Template(file);
+ }
+ });
+
+ dd.register = {
+ _registry: {
+ attributes: [],
+ tags: [],
+ filters: []
+ },
+ get: function(/*String*/ module, /*String*/ name){
+ var registry = dd.register._registry[module + "s"];
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(typeof entry[0] == "string"){
+ if(entry[0] == name){
+ return entry;
+ }
+ }else if(name.match(entry[0])){
+ return entry;
+ }
+ }
+ },
+ getAttributeTags: function(){
+ var tags = [];
+ var registry = dd.register._registry.attributes;
+ for(var i = 0, entry; entry = registry[i]; i++){
+ if(entry.length == 3){
+ tags.push(entry);
+ }else{
+ var fn = dojo.getObject(entry[1]);
+ if(fn && dojo.isFunction(fn)){
+ entry.push(fn);
+ tags.push(entry);
+ }
+ }
+ }
+ return tags;
+ },
+ _any: function(type, base, locations){
+ for(var path in locations){
+ for(var i = 0, fn; fn = locations[path][i]; i++){
+ var key = fn;
+ if(dojo.isArray(fn)){
+ key = fn[0];
+ fn = fn[1];
+ }
+ if(typeof key == "string"){
+ if(key.substr(0, 5) == "attr:"){
+ var attr = fn;
+ if(attr.substr(0, 5) == "attr:"){
+ attr = attr.slice(5);
+ }
+ dd.register._registry.attributes.push([attr.toLowerCase(), base + "." + path + "." + attr]);
+ }
+ key = key.toLowerCase()
+ }
+ dd.register._registry[type].push([
+ key,
+ fn,
+ base + "." + path
+ ]);
+ }
+ }
+ },
+ tags: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("tags", base, locations);
+ },
+ filters: function(/*String*/ base, /*Object*/ locations){
+ dd.register._any("filters", base, locations);
+ }
+ }
+
+ var escapeamp = /&/g;
+ var escapelt = /</g;
+ var escapegt = />/g;
+ var escapeqt = /'/g;
+ var escapedblqt = /"/g;
+ dd._base.escape = function(value){
+ // summary: Escapes a string's HTML
+ return dd.mark_safe(value.replace(escapeamp, '&').replace(escapelt, '<').replace(escapegt, '>').replace(escapedblqt, '"').replace(escapeqt, '''));
+ }
+
+ dd._base.safe = function(value){
+ if(typeof value == "string"){
+ value = new String(value);
+ }
+ if(typeof value == "object"){
+ value.safe = true;
+ }
+ return value;
+ }
+ dd.mark_safe = dd._base.safe;
+
+ dd.register.tags("dojox.dtl.tag", {
+ "date": ["now"],
+ "logic": ["if", "for", "ifequal", "ifnotequal"],
+ "loader": ["extends", "block", "include", "load", "ssi"],
+ "misc": ["comment", "debug", "filter", "firstof", "spaceless", "templatetag", "widthratio", "with"],
+ "loop": ["cycle", "ifchanged", "regroup"]
+ });
+ dd.register.filters("dojox.dtl.filter", {
+ "dates": ["date", "time", "timesince", "timeuntil"],
+ "htmlstrings": ["linebreaks", "linebreaksbr", "removetags", "striptags"],
+ "integers": ["add", "get_digit"],
+ "lists": ["dictsort", "dictsortreversed", "first", "join", "length", "length_is", "random", "slice", "unordered_list"],
+ "logic": ["default", "default_if_none", "divisibleby", "yesno"],
+ "misc": ["filesizeformat", "pluralize", "phone2numeric", "pprint"],
+ "strings": ["addslashes", "capfirst", "center", "cut", "fix_ampersands", "floatformat", "iriencode", "linenumbers", "ljust", "lower", "make_list", "rjust", "slugify", "stringformat", "title", "truncatewords", "truncatewords_html", "upper", "urlencode", "urlize", "urlizetrunc", "wordcount", "wordwrap"]
+ });
+ dd.register.filters("dojox.dtl", {
+ "_base": ["escape", "safe"]
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/contrib/data.js b/js/dojo-1.6/dojox/dtl/contrib/data.js new file mode 100644 index 0000000..c779764 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/data.js @@ -0,0 +1,169 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.contrib.data"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.data"] = true;
+dojo.provide("dojox.dtl.contrib.data");
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddcd = dd.contrib.data;
+
+ var first = true;
+
+ ddcd._BoundItem = dojo.extend(function(item, store){
+ this.item = item;
+ this.store = store;
+ },
+ {
+ get: function(key){
+ var store = this.store;
+ var item = this.item;
+
+ if(key == "getLabel"){
+ return store.getLabel(item);
+ }else if(key == "getAttributes"){
+ return store.getAttributes(item);
+ }else if(key == "getIdentity"){
+ if(store.getIdentity){
+ return store.getIdentity(item);
+ }
+ return "Store has no identity API";
+ }else{
+ if(!store.hasAttribute(item, key)){
+ if(key.slice(-1) == "s"){
+ if(first){
+ first = false;
+ dojo.deprecated("You no longer need an extra s to call getValues, it can be figured out automatically");
+ }
+ key = key.slice(0, -1);
+ }
+ if(!store.hasAttribute(item, key)){
+ return;
+ }
+ }
+
+ var values = store.getValues(item, key);
+ if(!values){
+ return;
+ }
+ if(!dojo.isArray(values)){
+ return new ddcd._BoundItem(values, store);
+ }
+
+ values = dojo.map(values, function(value){
+ if(dojo.isObject(value) && store.isItem(value)){
+ return new ddcd._BoundItem(value, store);
+ }
+ return value;
+ });
+ values.get = ddcd._get;
+ return values;
+ }
+ }
+ });
+ ddcd._BoundItem.prototype.get.safe = true;
+
+ ddcd.BindDataNode = dojo.extend(function(items, query, store, alias){
+ this.items = items && new dd._Filter(items);
+ this.query = query && new dd._Filter(query);
+ this.store = new dd._Filter(store);
+ this.alias = alias;
+ },
+ {
+ render: function(context, buffer){
+ var items = this.items && this.items.resolve(context);
+ var query = this.query && this.query.resolve(context);
+ var store = this.store.resolve(context);
+ if(!store || !store.getFeatures){
+ throw new Error("data_bind didn't receive a store");
+ }
+
+ if(query){
+ var sync = false;
+
+ store.fetch({
+ query: query,
+ sync: true,
+ scope: this,
+ onComplete: function(it){
+ sync = true;
+ items = it;
+ }
+ });
+
+ if(!sync){
+ throw new Error("The bind_data tag only works with a query if the store executed synchronously");
+ }
+ }
+
+ var list = [];
+
+ if(items){
+ for(var i = 0, item; item = items[i]; i++){
+ list.push(new ddcd._BoundItem(item, store));
+ }
+ }
+
+ context[this.alias] = list;
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(){
+ return this;
+ }
+ });
+
+ dojo.mixin(ddcd, {
+ _get: function(key){
+ if(this.length){
+ return (this[0] instanceof ddcd._BoundItem) ? this[0].get(key) : this[0][key];
+ }
+ },
+ bind_data: function(parser, token){
+ // summary: Turns a list of data store items into DTL compatible items
+ // example:
+ // `contextItems` and `contextStore` should be an item list
+ // and a data store that get assigned to `newVariable`
+ //
+ // | {% bind_data contextItems to contextStore as newVariable %}
+ var parts = token.contents.split();
+
+ if(parts[2] != 'to' || parts[4] != 'as' || !parts[5]){
+ throw new Error("data_bind expects the format: 'data_bind items to store as varName'");
+ }
+
+ return new ddcd.BindDataNode(parts[1], null, parts[3], parts[5]);
+ },
+ bind_query: function(parser, token){
+ // summary: Queries a data store and makes the returned items DTL compatible
+ // example:
+ // You can only use this with data stores that work in a synchronous
+ // way (meaning that `onComplete` is fired during the `fetch` call).
+ // A `sync` flag is sent to the fetch call so that stores that usually
+ // work asynchronously make themselves syncrhonous if possible.
+ // | {% bind_query contextQuery to contextStore as newVariable %}
+ var parts = token.contents.split();
+
+ if(parts[2] != 'to' || parts[4] != 'as' || !parts[5]){
+ throw new Error("data_bind expects the format: 'bind_query query to store as varName'");
+ }
+
+ return new ddcd.BindDataNode(null, parts[1], parts[3], parts[5]);
+ }
+ });
+ ddcd._get.safe = true;
+
+ dd.register.tags("dojox.dtl.contrib", {
+ "data": ["bind_data", "bind_query"]
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/contrib/data.xd.js b/js/dojo-1.6/dojox/dtl/contrib/data.xd.js new file mode 100644 index 0000000..e2dbc8e --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/data.xd.js @@ -0,0 +1,174 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.contrib.data"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.contrib.data"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.data"] = true;
+dojo.provide("dojox.dtl.contrib.data");
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddcd = dd.contrib.data;
+
+ var first = true;
+
+ ddcd._BoundItem = dojo.extend(function(item, store){
+ this.item = item;
+ this.store = store;
+ },
+ {
+ get: function(key){
+ var store = this.store;
+ var item = this.item;
+
+ if(key == "getLabel"){
+ return store.getLabel(item);
+ }else if(key == "getAttributes"){
+ return store.getAttributes(item);
+ }else if(key == "getIdentity"){
+ if(store.getIdentity){
+ return store.getIdentity(item);
+ }
+ return "Store has no identity API";
+ }else{
+ if(!store.hasAttribute(item, key)){
+ if(key.slice(-1) == "s"){
+ if(first){
+ first = false;
+ dojo.deprecated("You no longer need an extra s to call getValues, it can be figured out automatically");
+ }
+ key = key.slice(0, -1);
+ }
+ if(!store.hasAttribute(item, key)){
+ return;
+ }
+ }
+
+ var values = store.getValues(item, key);
+ if(!values){
+ return;
+ }
+ if(!dojo.isArray(values)){
+ return new ddcd._BoundItem(values, store);
+ }
+
+ values = dojo.map(values, function(value){
+ if(dojo.isObject(value) && store.isItem(value)){
+ return new ddcd._BoundItem(value, store);
+ }
+ return value;
+ });
+ values.get = ddcd._get;
+ return values;
+ }
+ }
+ });
+ ddcd._BoundItem.prototype.get.safe = true;
+
+ ddcd.BindDataNode = dojo.extend(function(items, query, store, alias){
+ this.items = items && new dd._Filter(items);
+ this.query = query && new dd._Filter(query);
+ this.store = new dd._Filter(store);
+ this.alias = alias;
+ },
+ {
+ render: function(context, buffer){
+ var items = this.items && this.items.resolve(context);
+ var query = this.query && this.query.resolve(context);
+ var store = this.store.resolve(context);
+ if(!store || !store.getFeatures){
+ throw new Error("data_bind didn't receive a store");
+ }
+
+ if(query){
+ var sync = false;
+
+ store.fetch({
+ query: query,
+ sync: true,
+ scope: this,
+ onComplete: function(it){
+ sync = true;
+ items = it;
+ }
+ });
+
+ if(!sync){
+ throw new Error("The bind_data tag only works with a query if the store executed synchronously");
+ }
+ }
+
+ var list = [];
+
+ if(items){
+ for(var i = 0, item; item = items[i]; i++){
+ list.push(new ddcd._BoundItem(item, store));
+ }
+ }
+
+ context[this.alias] = list;
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(){
+ return this;
+ }
+ });
+
+ dojo.mixin(ddcd, {
+ _get: function(key){
+ if(this.length){
+ return (this[0] instanceof ddcd._BoundItem) ? this[0].get(key) : this[0][key];
+ }
+ },
+ bind_data: function(parser, token){
+ // summary: Turns a list of data store items into DTL compatible items
+ // example:
+ // `contextItems` and `contextStore` should be an item list
+ // and a data store that get assigned to `newVariable`
+ //
+ // | {% bind_data contextItems to contextStore as newVariable %}
+ var parts = token.contents.split();
+
+ if(parts[2] != 'to' || parts[4] != 'as' || !parts[5]){
+ throw new Error("data_bind expects the format: 'data_bind items to store as varName'");
+ }
+
+ return new ddcd.BindDataNode(parts[1], null, parts[3], parts[5]);
+ },
+ bind_query: function(parser, token){
+ // summary: Queries a data store and makes the returned items DTL compatible
+ // example:
+ // You can only use this with data stores that work in a synchronous
+ // way (meaning that `onComplete` is fired during the `fetch` call).
+ // A `sync` flag is sent to the fetch call so that stores that usually
+ // work asynchronously make themselves syncrhonous if possible.
+ // | {% bind_query contextQuery to contextStore as newVariable %}
+ var parts = token.contents.split();
+
+ if(parts[2] != 'to' || parts[4] != 'as' || !parts[5]){
+ throw new Error("data_bind expects the format: 'bind_query query to store as varName'");
+ }
+
+ return new ddcd.BindDataNode(null, parts[1], parts[3], parts[5]);
+ }
+ });
+ ddcd._get.safe = true;
+
+ dd.register.tags("dojox.dtl.contrib", {
+ "data": ["bind_data", "bind_query"]
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/contrib/dijit.js b/js/dojo-1.6/dojox/dtl/contrib/dijit.js new file mode 100644 index 0000000..4206010 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/dijit.js @@ -0,0 +1,231 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.contrib.dijit"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.dijit"] = true;
+dojo.provide("dojox.dtl.contrib.dijit");
+
+dojo.require("dojox.dtl.dom");
+dojo.require("dojo.parser");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddcd = dd.contrib.dijit;
+
+ ddcd.AttachNode = dojo.extend(function(keys, object){
+ this._keys = keys;
+ this._object = object;
+ },
+ {
+ render: function(context, buffer){
+ if(!this._rendered){
+ this._rendered = true;
+ for(var i=0, key; key = this._keys[i]; i++){
+ context.getThis()[key] = this._object || buffer.getParent();
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ if(this._rendered){
+ this._rendered = false;
+ for(var i=0, key; key = this._keys[i]; i++){
+ if(context.getThis()[key] === (this._object || buffer.getParent())){
+ delete context.getThis()[key];
+ }
+ }
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._keys, this._object);
+ }
+ });
+
+ ddcd.EventNode = dojo.extend(function(command, obj){
+ this._command = command;
+
+ var type, events = command.split(/\s*,\s*/);
+ var trim = dojo.trim;
+ var types = [];
+ var fns = [];
+ while(type = events.pop()){
+ if(type){
+ var fn = null;
+ if(type.indexOf(":") != -1){
+ // oh, if only JS had tuple assignment
+ var funcNameArr = type.split(":");
+ type = trim(funcNameArr[0]);
+ fn = trim(funcNameArr.slice(1).join(":"));
+ }else{
+ type = trim(type);
+ }
+ if(!fn){
+ fn = type;
+ }
+ types.push(type);
+ fns.push(fn);
+ }
+ }
+
+ this._types = types;
+ this._fns = fns;
+ this._object = obj;
+ this._rendered = [];
+ },
+ {
+ // _clear: Boolean
+ // Make sure we kill the actual tags (onclick problems, etc)
+ _clear: false,
+ render: function(context, buffer){
+ for(var i = 0, type; type = this._types[i]; i++){
+ if(!this._clear && !this._object){
+ buffer.getParent()[type] = null;
+ }
+ var fn = this._fns[i];
+ var args;
+ if(fn.indexOf(" ") != -1){
+ if(this._rendered[i]){
+ dojo.disconnect(this._rendered[i]);
+ this._rendered[i] = false;
+ }
+ args = dojo.map(fn.split(" ").slice(1), function(item){
+ return new dd._Filter(item).resolve(context);
+ });
+ fn = fn.split(" ", 2)[0];
+ }
+ if(!this._rendered[i]){
+ if(!this._object){
+ this._rendered[i] = buffer.addEvent(context, type, fn, args);
+ }else{
+ this._rendered[i] = dojo.connect(this._object, type, context.getThis(), fn);
+ }
+ }
+ }
+ this._clear = true;
+
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ while(this._rendered.length){
+ dojo.disconnect(this._rendered.pop());
+ }
+ return buffer;
+ },
+ clone: function(){
+ return new this.constructor(this._command, this._object);
+ }
+ });
+
+ function cloneNode(n1){
+ var n2 = n1.cloneNode(true);
+ if(dojo.isIE){
+ dojo.query("script", n2).forEach("item.text = this[index].text;", dojo.query("script", n1));
+ }
+ return n2;
+ }
+
+ ddcd.DojoTypeNode = dojo.extend(function(node, parsed){
+ this._node = node;
+ this._parsed = parsed;
+
+ var events = node.getAttribute("dojoAttachEvent");
+ if(events){
+ this._events = new ddcd.EventNode(dojo.trim(events));
+ }
+ var attach = node.getAttribute("dojoAttachPoint");
+ if(attach){
+ this._attach = new ddcd.AttachNode(dojo.trim(attach).split(/\s*,\s*/));
+ }
+
+ if (!parsed){
+ this._dijit = dojo.parser.instantiate([cloneNode(node)])[0];
+ }else{
+ node = cloneNode(node);
+ var old = ddcd.widgetsInTemplate;
+ ddcd.widgetsInTemplate = false;
+ this._template = new dd.DomTemplate(node);
+ ddcd.widgetsInTemplate = old;
+ }
+ },
+ {
+ render: function(context, buffer){
+ if(this._parsed){
+ var _buffer = new dd.DomBuffer();
+ this._template.render(context, _buffer);
+ var root = cloneNode(_buffer.getRootNode());
+ var div = document.createElement("div");
+ div.appendChild(root);
+ var rendered = div.innerHTML;
+ div.removeChild(root);
+ if(rendered != this._rendered){
+ this._rendered = rendered;
+ if(this._dijit){
+ this._dijit.destroyRecursive();
+ }
+ this._dijit = dojo.parser.instantiate([root])[0];
+ }
+ }
+
+ var node = this._dijit.domNode;
+
+ if(this._events){
+ this._events._object = this._dijit;
+ this._events.render(context, buffer);
+ }
+ if(this._attach){
+ this._attach._object = this._dijit;
+ this._attach.render(context, buffer);
+ }
+
+ return buffer.concat(node);
+ },
+ unrender: function(context, buffer){
+ return buffer.remove(this._dijit.domNode);
+ },
+ clone: function(){
+ return new this.constructor(this._node, this._parsed);
+ }
+ });
+
+ dojo.mixin(ddcd, {
+ widgetsInTemplate: true,
+ dojoAttachPoint: function(parser, token){
+ return new ddcd.AttachNode(token.contents.slice(16).split(/\s*,\s*/));
+ },
+ dojoAttachEvent: function(parser, token){
+ return new ddcd.EventNode(token.contents.slice(16));
+ },
+ dojoType: function(parser, token){
+ var parsed = false;
+ if(token.contents.slice(-7) == " parsed"){
+ parsed = true;
+ }
+ var contents = token.contents.slice(9);
+ var dojoType = parsed ? contents.slice(0, -7) : contents.toString();
+
+ if(ddcd.widgetsInTemplate){
+ var node = parser.swallowNode();
+ node.setAttribute("dojoType", dojoType);
+ return new ddcd.DojoTypeNode(node, parsed);
+ }
+
+ return new dd.AttributeNode("dojoType", dojoType);
+ },
+ on: function(parser, token){
+ // summary: Associates an event type to a function (on the current widget) by name
+ var parts = token.contents.split();
+ return new ddcd.EventNode(parts[0] + ":" + parts.slice(1).join(" "));
+ }
+ });
+
+ dd.register.tags("dojox.dtl.contrib", {
+ "dijit": ["attr:dojoType", "attr:dojoAttachPoint", ["attr:attach", "dojoAttachPoint"], "attr:dojoAttachEvent", [/(attr:)?on(click|key(up))/i, "on"]]
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/contrib/dijit.xd.js b/js/dojo-1.6/dojox/dtl/contrib/dijit.xd.js new file mode 100644 index 0000000..34ad11e --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/dijit.xd.js @@ -0,0 +1,237 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.contrib.dijit"],
+["require", "dojox.dtl.dom"],
+["require", "dojo.parser"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.contrib.dijit"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.dijit"] = true;
+dojo.provide("dojox.dtl.contrib.dijit");
+
+dojo.require("dojox.dtl.dom");
+dojo.require("dojo.parser");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddcd = dd.contrib.dijit;
+
+ ddcd.AttachNode = dojo.extend(function(keys, object){
+ this._keys = keys;
+ this._object = object;
+ },
+ {
+ render: function(context, buffer){
+ if(!this._rendered){
+ this._rendered = true;
+ for(var i=0, key; key = this._keys[i]; i++){
+ context.getThis()[key] = this._object || buffer.getParent();
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ if(this._rendered){
+ this._rendered = false;
+ for(var i=0, key; key = this._keys[i]; i++){
+ if(context.getThis()[key] === (this._object || buffer.getParent())){
+ delete context.getThis()[key];
+ }
+ }
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._keys, this._object);
+ }
+ });
+
+ ddcd.EventNode = dojo.extend(function(command, obj){
+ this._command = command;
+
+ var type, events = command.split(/\s*,\s*/);
+ var trim = dojo.trim;
+ var types = [];
+ var fns = [];
+ while(type = events.pop()){
+ if(type){
+ var fn = null;
+ if(type.indexOf(":") != -1){
+ // oh, if only JS had tuple assignment
+ var funcNameArr = type.split(":");
+ type = trim(funcNameArr[0]);
+ fn = trim(funcNameArr.slice(1).join(":"));
+ }else{
+ type = trim(type);
+ }
+ if(!fn){
+ fn = type;
+ }
+ types.push(type);
+ fns.push(fn);
+ }
+ }
+
+ this._types = types;
+ this._fns = fns;
+ this._object = obj;
+ this._rendered = [];
+ },
+ {
+ // _clear: Boolean
+ // Make sure we kill the actual tags (onclick problems, etc)
+ _clear: false,
+ render: function(context, buffer){
+ for(var i = 0, type; type = this._types[i]; i++){
+ if(!this._clear && !this._object){
+ buffer.getParent()[type] = null;
+ }
+ var fn = this._fns[i];
+ var args;
+ if(fn.indexOf(" ") != -1){
+ if(this._rendered[i]){
+ dojo.disconnect(this._rendered[i]);
+ this._rendered[i] = false;
+ }
+ args = dojo.map(fn.split(" ").slice(1), function(item){
+ return new dd._Filter(item).resolve(context);
+ });
+ fn = fn.split(" ", 2)[0];
+ }
+ if(!this._rendered[i]){
+ if(!this._object){
+ this._rendered[i] = buffer.addEvent(context, type, fn, args);
+ }else{
+ this._rendered[i] = dojo.connect(this._object, type, context.getThis(), fn);
+ }
+ }
+ }
+ this._clear = true;
+
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ while(this._rendered.length){
+ dojo.disconnect(this._rendered.pop());
+ }
+ return buffer;
+ },
+ clone: function(){
+ return new this.constructor(this._command, this._object);
+ }
+ });
+
+ function cloneNode(n1){
+ var n2 = n1.cloneNode(true);
+ if(dojo.isIE){
+ dojo.query("script", n2).forEach("item.text = this[index].text;", dojo.query("script", n1));
+ }
+ return n2;
+ }
+
+ ddcd.DojoTypeNode = dojo.extend(function(node, parsed){
+ this._node = node;
+ this._parsed = parsed;
+
+ var events = node.getAttribute("dojoAttachEvent");
+ if(events){
+ this._events = new ddcd.EventNode(dojo.trim(events));
+ }
+ var attach = node.getAttribute("dojoAttachPoint");
+ if(attach){
+ this._attach = new ddcd.AttachNode(dojo.trim(attach).split(/\s*,\s*/));
+ }
+
+ if (!parsed){
+ this._dijit = dojo.parser.instantiate([cloneNode(node)])[0];
+ }else{
+ node = cloneNode(node);
+ var old = ddcd.widgetsInTemplate;
+ ddcd.widgetsInTemplate = false;
+ this._template = new dd.DomTemplate(node);
+ ddcd.widgetsInTemplate = old;
+ }
+ },
+ {
+ render: function(context, buffer){
+ if(this._parsed){
+ var _buffer = new dd.DomBuffer();
+ this._template.render(context, _buffer);
+ var root = cloneNode(_buffer.getRootNode());
+ var div = document.createElement("div");
+ div.appendChild(root);
+ var rendered = div.innerHTML;
+ div.removeChild(root);
+ if(rendered != this._rendered){
+ this._rendered = rendered;
+ if(this._dijit){
+ this._dijit.destroyRecursive();
+ }
+ this._dijit = dojo.parser.instantiate([root])[0];
+ }
+ }
+
+ var node = this._dijit.domNode;
+
+ if(this._events){
+ this._events._object = this._dijit;
+ this._events.render(context, buffer);
+ }
+ if(this._attach){
+ this._attach._object = this._dijit;
+ this._attach.render(context, buffer);
+ }
+
+ return buffer.concat(node);
+ },
+ unrender: function(context, buffer){
+ return buffer.remove(this._dijit.domNode);
+ },
+ clone: function(){
+ return new this.constructor(this._node, this._parsed);
+ }
+ });
+
+ dojo.mixin(ddcd, {
+ widgetsInTemplate: true,
+ dojoAttachPoint: function(parser, token){
+ return new ddcd.AttachNode(token.contents.slice(16).split(/\s*,\s*/));
+ },
+ dojoAttachEvent: function(parser, token){
+ return new ddcd.EventNode(token.contents.slice(16));
+ },
+ dojoType: function(parser, token){
+ var parsed = false;
+ if(token.contents.slice(-7) == " parsed"){
+ parsed = true;
+ }
+ var contents = token.contents.slice(9);
+ var dojoType = parsed ? contents.slice(0, -7) : contents.toString();
+
+ if(ddcd.widgetsInTemplate){
+ var node = parser.swallowNode();
+ node.setAttribute("dojoType", dojoType);
+ return new ddcd.DojoTypeNode(node, parsed);
+ }
+
+ return new dd.AttributeNode("dojoType", dojoType);
+ },
+ on: function(parser, token){
+ // summary: Associates an event type to a function (on the current widget) by name
+ var parts = token.contents.split();
+ return new ddcd.EventNode(parts[0] + ":" + parts.slice(1).join(" "));
+ }
+ });
+
+ dd.register.tags("dojox.dtl.contrib", {
+ "dijit": ["attr:dojoType", "attr:dojoAttachPoint", ["attr:attach", "dojoAttachPoint"], "attr:dojoAttachEvent", [/(attr:)?on(click|key(up))/i, "on"]]
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/contrib/dom.js b/js/dojo-1.6/dojox/dtl/contrib/dom.js new file mode 100644 index 0000000..efc35a9 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/dom.js @@ -0,0 +1,180 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.contrib.dom"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.dom"] = true;
+dojo.provide("dojox.dtl.contrib.dom");
+
+dojo.require("dojox.dtl.dom");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddch = dd.contrib.dom;
+
+ var simple = {render: function(){ return this.contents; }};
+
+ ddch.StyleNode = dojo.extend(function(styles){
+ this.contents = {};
+ this._current = {};
+ this._styles = styles;
+ for(var key in styles){
+ if(styles[key].indexOf("{{") != -1){
+ var node = new dd.Template(styles[key]);
+ }else{
+ var node = dojo.delegate(simple);
+ node.contents = styles[key];
+ }
+ this.contents[key] = node;
+ }
+ },
+ {
+ render: function(context, buffer){
+ for(var key in this.contents){
+ var value = this.contents[key].render(context);
+ if(this._current[key] != value){
+ dojo.style(buffer.getParent(), key, this._current[key] = value);
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ this._current = {};
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._styles);
+ }
+ });
+
+ ddch.BufferNode = dojo.extend(function(nodelist, options){
+ this.nodelist = nodelist;
+ this.options = options;
+ },
+ {
+ _swap: function(type, node){
+ if(!this.swapped && this.parent.parentNode){
+ if(type == "node"){
+ if((node.nodeType == 3 && !this.options.text) || (node.nodeType == 1 && !this.options.node)){
+ return;
+ }
+ }else if(type == "class"){
+ if(type != "class"){
+ return;
+ }
+ }
+
+ this.onAddNode && dojo.disconnect(this.onAddNode);
+ this.onRemoveNode && dojo.disconnect(this.onRemoveNode);
+ this.onChangeAttribute && dojo.disconnect(this.onChangeAttribute);
+ this.onChangeData && dojo.disconnect(this.onChangeData);
+
+ this.swapped = this.parent.cloneNode(true);
+ this.parent.parentNode.replaceChild(this.swapped, this.parent);
+ }
+ },
+ render: function(context, buffer){
+ this.parent = buffer.getParent();
+ if(this.options.node){
+ this.onAddNode = dojo.connect(buffer, "onAddNode", dojo.hitch(this, "_swap", "node"));
+ this.onRemoveNode = dojo.connect(buffer, "onRemoveNode", dojo.hitch(this, "_swap", "node"));
+ }
+ if(this.options.text){
+ this.onChangeData = dojo.connect(buffer, "onChangeData", dojo.hitch(this, "_swap", "node"));
+ }
+ if(this.options["class"]){
+ this.onChangeAttribute = dojo.connect(buffer, "onChangeAttribute", dojo.hitch(this, "_swap", "class"));
+ }
+
+ buffer = this.nodelist.render(context, buffer);
+
+ if(this.swapped){
+ this.swapped.parentNode.replaceChild(this.parent, this.swapped);
+ dojo.destroy(this.swapped);
+ }else{
+ this.onAddNode && dojo.disconnect(this.onAddNode);
+ this.onRemoveNode && dojo.disconnect(this.onRemoveNode);
+ this.onChangeAttribute && dojo.disconnect(this.onChangeAttribute);
+ this.onChangeData && dojo.disconnect(this.onChangeData);
+ }
+
+ delete this.parent;
+ delete this.swapped;
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodelist.clone(buffer), this.options);
+ }
+ });
+
+ dojo.mixin(ddch, {
+ buffer: function(parser, token){
+ // summary:
+ // Buffer large DOM manipulations during re-render.
+ // description:
+ // When using DomTemplate, wrap any content
+ // that you expect to change often during
+ // re-rendering. It will then remove its parent
+ // from the main document while it re-renders that
+ // section of code. It will only remove it from
+ // the main document if a mainpulation of somes sort
+ // happens. ie It won't swap out if it diesn't have to.
+ // example:
+ // By default, it considers only node addition/removal
+ // to be "changing"
+ //
+ // | {% buffer %}{% for item in items %}<li>{{ item }}</li>{% endfor %}{% endbuffer %}
+ // example:
+ // You can explicitly declare options:
+ //
+ // * node: Watch node removal/addition
+ // * class: Watch for a classname to be changed
+ // * text: Watch for any text to be changed
+ //
+ // | {% buffer node class %}{% for item in items %}<li>{{ item }}</li>{% endfor %}{% endbuffer %}
+ var parts = token.contents.split().slice(1);
+ var options = {};
+ var found = false;
+ for(var i=parts.length; i--;){
+ found = true;
+ options[parts[i]] = true;
+ }
+ if(!found){
+ options.node = true;
+ }
+ var nodelist = parser.parse(["endbuffer"]);
+ parser.next_token();
+ return new ddch.BufferNode(nodelist, options);
+ },
+ html: function(parser, token){
+ dojo.deprecated("{% html someVariable %}", "Use {{ someVariable|safe }} instead");
+ return parser.create_variable_node(token.contents.slice(5) + "|safe");
+ },
+ style_: function(parser, token){
+ var styles = {};
+ token = token.contents.replace(/^style\s+/, "");
+ var rules = token.split(/\s*;\s*/g);
+ for(var i = 0, rule; rule = rules[i]; i++){
+ var parts = rule.split(/\s*:\s*/g);
+ var key = parts[0];
+ var value = dojo.trim(parts[1]);
+ if(value){
+ styles[key] = value;
+ }
+ }
+ return new ddch.StyleNode(styles);
+ }
+ });
+
+ dd.register.tags("dojox.dtl.contrib", {
+ "dom": ["html", "attr:style", "buffer"]
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/contrib/dom.xd.js b/js/dojo-1.6/dojox/dtl/contrib/dom.xd.js new file mode 100644 index 0000000..a2c0fcc --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/dom.xd.js @@ -0,0 +1,185 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.contrib.dom"],
+["require", "dojox.dtl.dom"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.contrib.dom"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.dom"] = true;
+dojo.provide("dojox.dtl.contrib.dom");
+
+dojo.require("dojox.dtl.dom");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddch = dd.contrib.dom;
+
+ var simple = {render: function(){ return this.contents; }};
+
+ ddch.StyleNode = dojo.extend(function(styles){
+ this.contents = {};
+ this._current = {};
+ this._styles = styles;
+ for(var key in styles){
+ if(styles[key].indexOf("{{") != -1){
+ var node = new dd.Template(styles[key]);
+ }else{
+ var node = dojo.delegate(simple);
+ node.contents = styles[key];
+ }
+ this.contents[key] = node;
+ }
+ },
+ {
+ render: function(context, buffer){
+ for(var key in this.contents){
+ var value = this.contents[key].render(context);
+ if(this._current[key] != value){
+ dojo.style(buffer.getParent(), key, this._current[key] = value);
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ this._current = {};
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._styles);
+ }
+ });
+
+ ddch.BufferNode = dojo.extend(function(nodelist, options){
+ this.nodelist = nodelist;
+ this.options = options;
+ },
+ {
+ _swap: function(type, node){
+ if(!this.swapped && this.parent.parentNode){
+ if(type == "node"){
+ if((node.nodeType == 3 && !this.options.text) || (node.nodeType == 1 && !this.options.node)){
+ return;
+ }
+ }else if(type == "class"){
+ if(type != "class"){
+ return;
+ }
+ }
+
+ this.onAddNode && dojo.disconnect(this.onAddNode);
+ this.onRemoveNode && dojo.disconnect(this.onRemoveNode);
+ this.onChangeAttribute && dojo.disconnect(this.onChangeAttribute);
+ this.onChangeData && dojo.disconnect(this.onChangeData);
+
+ this.swapped = this.parent.cloneNode(true);
+ this.parent.parentNode.replaceChild(this.swapped, this.parent);
+ }
+ },
+ render: function(context, buffer){
+ this.parent = buffer.getParent();
+ if(this.options.node){
+ this.onAddNode = dojo.connect(buffer, "onAddNode", dojo.hitch(this, "_swap", "node"));
+ this.onRemoveNode = dojo.connect(buffer, "onRemoveNode", dojo.hitch(this, "_swap", "node"));
+ }
+ if(this.options.text){
+ this.onChangeData = dojo.connect(buffer, "onChangeData", dojo.hitch(this, "_swap", "node"));
+ }
+ if(this.options["class"]){
+ this.onChangeAttribute = dojo.connect(buffer, "onChangeAttribute", dojo.hitch(this, "_swap", "class"));
+ }
+
+ buffer = this.nodelist.render(context, buffer);
+
+ if(this.swapped){
+ this.swapped.parentNode.replaceChild(this.parent, this.swapped);
+ dojo.destroy(this.swapped);
+ }else{
+ this.onAddNode && dojo.disconnect(this.onAddNode);
+ this.onRemoveNode && dojo.disconnect(this.onRemoveNode);
+ this.onChangeAttribute && dojo.disconnect(this.onChangeAttribute);
+ this.onChangeData && dojo.disconnect(this.onChangeData);
+ }
+
+ delete this.parent;
+ delete this.swapped;
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodelist.clone(buffer), this.options);
+ }
+ });
+
+ dojo.mixin(ddch, {
+ buffer: function(parser, token){
+ // summary:
+ // Buffer large DOM manipulations during re-render.
+ // description:
+ // When using DomTemplate, wrap any content
+ // that you expect to change often during
+ // re-rendering. It will then remove its parent
+ // from the main document while it re-renders that
+ // section of code. It will only remove it from
+ // the main document if a mainpulation of somes sort
+ // happens. ie It won't swap out if it diesn't have to.
+ // example:
+ // By default, it considers only node addition/removal
+ // to be "changing"
+ //
+ // | {% buffer %}{% for item in items %}<li>{{ item }}</li>{% endfor %}{% endbuffer %}
+ // example:
+ // You can explicitly declare options:
+ //
+ // * node: Watch node removal/addition
+ // * class: Watch for a classname to be changed
+ // * text: Watch for any text to be changed
+ //
+ // | {% buffer node class %}{% for item in items %}<li>{{ item }}</li>{% endfor %}{% endbuffer %}
+ var parts = token.contents.split().slice(1);
+ var options = {};
+ var found = false;
+ for(var i=parts.length; i--;){
+ found = true;
+ options[parts[i]] = true;
+ }
+ if(!found){
+ options.node = true;
+ }
+ var nodelist = parser.parse(["endbuffer"]);
+ parser.next_token();
+ return new ddch.BufferNode(nodelist, options);
+ },
+ html: function(parser, token){
+ dojo.deprecated("{% html someVariable %}", "Use {{ someVariable|safe }} instead");
+ return parser.create_variable_node(token.contents.slice(5) + "|safe");
+ },
+ style_: function(parser, token){
+ var styles = {};
+ token = token.contents.replace(/^style\s+/, "");
+ var rules = token.split(/\s*;\s*/g);
+ for(var i = 0, rule; rule = rules[i]; i++){
+ var parts = rule.split(/\s*:\s*/g);
+ var key = parts[0];
+ var value = dojo.trim(parts[1]);
+ if(value){
+ styles[key] = value;
+ }
+ }
+ return new ddch.StyleNode(styles);
+ }
+ });
+
+ dd.register.tags("dojox.dtl.contrib", {
+ "dom": ["html", "attr:style", "buffer"]
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/contrib/html.js b/js/dojo-1.6/dojox/dtl/contrib/html.js new file mode 100644 index 0000000..1230807 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/html.js @@ -0,0 +1,14 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.contrib.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.html"] = true;
+dojo.provide("dojox.dtl.contrib.html");
+dojo.require("dojox.dtl.contrib.dom");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/contrib/html.xd.js b/js/dojo-1.6/dojox/dtl/contrib/html.xd.js new file mode 100644 index 0000000..bd42f11 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/html.xd.js @@ -0,0 +1,19 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.contrib.html"],
+["require", "dojox.dtl.contrib.dom"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.contrib.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.html"] = true;
+dojo.provide("dojox.dtl.contrib.html");
+dojo.require("dojox.dtl.contrib.dom");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/contrib/objects.js b/js/dojo-1.6/dojox/dtl/contrib/objects.js new file mode 100644 index 0000000..1ee7693 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/objects.js @@ -0,0 +1,22 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.contrib.objects"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.objects"] = true;
+dojo.provide("dojox.dtl.contrib.objects");
+
+dojo.mixin(dojox.dtl.contrib.objects, {
+ key: function(value, arg){
+ return value[arg];
+ }
+});
+
+dojox.dtl.register.filters("dojox.dtl.contrib", {
+ "objects": ["key"]
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/contrib/objects.xd.js b/js/dojo-1.6/dojox/dtl/contrib/objects.xd.js new file mode 100644 index 0000000..4f944be --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/contrib/objects.xd.js @@ -0,0 +1,26 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.contrib.objects"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.contrib.objects"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.contrib.objects"] = true;
+dojo.provide("dojox.dtl.contrib.objects");
+
+dojo.mixin(dojox.dtl.contrib.objects, {
+ key: function(value, arg){
+ return value[arg];
+ }
+});
+
+dojox.dtl.register.filters("dojox.dtl.contrib", {
+ "objects": ["key"]
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/dom.js b/js/dojo-1.6/dojox/dtl/dom.js new file mode 100644 index 0000000..86f0f32 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/dom.js @@ -0,0 +1,1042 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.dom"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.dom"] = true;
+dojo.provide("dojox.dtl.dom");
+
+dojo.require("dojox.dtl._base");
+dojo.require("dojox.dtl.Context");
+
+(function(){
+ var dd = dojox.dtl;
+
+ dd.BOOLS = {checked: 1, disabled: 1, readonly: 1};
+ dd.TOKEN_CHANGE = -11;
+ dd.TOKEN_ATTR = -12;
+ dd.TOKEN_CUSTOM = -13;
+ dd.TOKEN_NODE = 1;
+
+ var ddt = dd.text;
+ var ddh = dd.dom = {
+ _attributes: {},
+ _uppers: {},
+ _re4: /^function anonymous\(\)\s*{\s*(.*)\s*}$/,
+ _reTrim: /(?:^[\n\s]*(\{%)?\s*|\s*(%\})?[\n\s]*$)/g,
+ _reSplit: /\s*%\}[\n\s]*\{%\s*/g,
+ getTemplate: function(text){
+ if(typeof this._commentable == "undefined"){
+ // Check to see if the browser can handle comments
+ this._commentable = false;
+ var div = document.createElement("div");
+ div.innerHTML = "<!--Test comment handling, and long comments, using comments whenever possible.-->";
+ if(div.childNodes.length && div.childNodes[0].nodeType == 8 && div.childNodes[0].data == "comment"){
+ this._commentable = true;
+ }
+ }
+
+ if(!this._commentable){
+ // Strip comments
+ text = text.replace(/<!--({({|%).*?(%|})})-->/g, "$1");
+ }
+
+ if(dojo.isIE){
+ text = text.replace(/\b(checked|disabled|readonly|style)="/g, 't$1="');
+ }
+ text = text.replace(/\bstyle="/g, 'tstyle="');
+
+ var match;
+ var table = dojo.isWebKit;
+ var pairs = [ // Format: [enable, parent, allowed children (first for nesting), nestings]
+ [true, "select", "option"],
+ [table, "tr", "td|th"],
+ [table, "thead", "tr", "th"],
+ [table, "tbody", "tr", "td"],
+ [table, "table", "tbody|thead|tr", "tr", "td"]
+ ];
+ var replacements = [];
+ // Some tags can't contain text. So we wrap the text in tags that they can have.
+ for(var i = 0, pair; pair = pairs[i]; i++){
+ if(!pair[0]){
+ continue;
+ }
+ if(text.indexOf("<" + pair[1]) != -1){
+ var selectRe = new RegExp("<" + pair[1] + "(?:.|\n)*?>((?:.|\n)+?)</" + pair[1] + ">", "ig");
+ tagLoop: while(match = selectRe.exec(text)){
+ // Do it like this to make sure we don't double-wrap
+ var inners = pair[2].split("|");
+ var innerRe = [];
+ for(var j = 0, inner; inner = inners[j]; j++){
+ innerRe.push("<" + inner + "(?:.|\n)*?>(?:.|\n)*?</" + inner + ">");
+ }
+ var tags = [];
+ var tokens = dojox.string.tokenize(match[1], new RegExp("(" + innerRe.join("|") + ")", "ig"), function(data){
+ var tag = /<(\w+)/.exec(data)[1];
+ if(!tags[tag]){
+ tags[tag] = true;
+ tags.push(tag);
+ }
+ return {data: data};
+ });
+ if(tags.length){
+ var tag = (tags.length == 1) ? tags[0] : pair[2].split("|")[0];
+
+ var replace = [];
+ for(var j = 0, jl = tokens.length; j < jl; j++) {
+ var token = tokens[j];
+ if(dojo.isObject(token)){
+ replace.push(token.data);
+ }else{
+ var stripped = token.replace(this._reTrim, "");
+ if(!stripped){ continue; }
+ token = stripped.split(this._reSplit);
+ for(var k = 0, kl = token.length; k < kl; k++){
+ var replacement = "";
+ for(var p = 2, pl = pair.length; p < pl; p++){
+ if(p == 2){
+ replacement += "<" + tag + ' dtlinstruction="{% ' + token[k].replace('"', '\\"') + ' %}">';
+ }else if(tag == pair[p]) {
+ continue;
+ }else{
+ replacement += "<" + pair[p] + ">";
+ }
+ }
+ replacement += "DTL";
+ for(var p = pair.length - 1; p > 1; p--){
+ if(p == 2){
+ replacement += "</" + tag + ">";
+ }else if(tag == pair[p]) {
+ continue;
+ }else{
+ replacement += "</" + pair[p] + ">";
+ }
+ }
+ replace.push("\xFF" + replacements.length);
+ replacements.push(replacement);
+ }
+ }
+ }
+ text = text.replace(match[1], replace.join(""));
+ }
+ }
+ }
+ }
+
+ for(var i=replacements.length; i--;){
+ text = text.replace("\xFF" + i, replacements[i]);
+ }
+
+ var re = /\b([a-zA-Z_:][a-zA-Z0-9_\-\.:]*)=['"]/g;
+ while(match = re.exec(text)){
+ var lower = match[1].toLowerCase();
+ if(lower == "dtlinstruction"){ continue; }
+ if(lower != match[1]){
+ this._uppers[lower] = match[1];
+ }
+ this._attributes[lower] = true;
+ }
+ var div = document.createElement("div");
+ div.innerHTML = text;
+ var output = {nodes: []};
+ while(div.childNodes.length){
+ output.nodes.push(div.removeChild(div.childNodes[0]))
+ }
+
+ return output;
+ },
+ tokenize: function(/*Node*/ nodes){
+ var tokens = [];
+
+ for(var i = 0, node; node = nodes[i++];){
+ if(node.nodeType != 1){
+ this.__tokenize(node, tokens);
+ }else{
+ this._tokenize(node, tokens);
+ }
+ }
+
+ return tokens;
+ },
+ _swallowed: [],
+ _tokenize: function(/*Node*/ node, /*Array*/ tokens){
+ var first = false;
+ var swallowed = this._swallowed;
+ var i, j, tag, child;
+
+ if(!tokens.first){
+ // Try to efficiently associate tags that use an attribute to
+ // remove the node from DOM (eg dojoType) so that we can efficiently
+ // locate them later in the tokenizing.
+ first = tokens.first = true;
+ var tags = dd.register.getAttributeTags();
+ for(i = 0; tag = tags[i]; i++){
+ try{
+ (tag[2])({ swallowNode: function(){ throw 1; }}, new dd.Token(dd.TOKEN_ATTR, ""));
+ }catch(e){
+ swallowed.push(tag);
+ }
+ }
+ }
+
+ for(i = 0; tag = swallowed[i]; i++){
+ var text = node.getAttribute(tag[0]);
+ if(text){
+ var swallowed = false;
+ var custom = (tag[2])({ swallowNode: function(){ swallowed = true; return node; }}, new dd.Token(dd.TOKEN_ATTR, tag[0] + " " + text));
+ if(swallowed){
+ if(node.parentNode && node.parentNode.removeChild){
+ node.parentNode.removeChild(node);
+ }
+ tokens.push([dd.TOKEN_CUSTOM, custom]);
+ return;
+ }
+ }
+ }
+
+ var children = [];
+ if(dojo.isIE && node.tagName == "SCRIPT"){
+ children.push({
+ nodeType: 3,
+ data: node.text
+ });
+ node.text = "";
+ }else{
+ for(i = 0; child = node.childNodes[i]; i++){
+ children.push(child);
+ }
+ }
+
+ tokens.push([dd.TOKEN_NODE, node]);
+
+ var change = false;
+ if(children.length){
+ // Only do a change request if we need to
+ tokens.push([dd.TOKEN_CHANGE, node]);
+ change = true;
+ }
+
+ for(var key in this._attributes){
+ var clear = false;
+
+ var value = "";
+ if(key == "class"){
+ value = node.className || value;
+ }else if(key == "for"){
+ value = node.htmlFor || value;
+ }else if(key == "value" && node.value == node.innerHTML){
+ // Sometimes .value is set the same as the contents of the item (button)
+ continue;
+ }else if(node.getAttribute){
+ value = node.getAttribute(key, 2) || value;
+ if(key == "href" || key == "src"){
+ if(dojo.isIE){
+ var hash = location.href.lastIndexOf(location.hash);
+ var href = location.href.substring(0, hash).split("/");
+ href.pop();
+ href = href.join("/") + "/";
+ if(value.indexOf(href) == 0){
+ value = value.replace(href, "");
+ }
+ value = decodeURIComponent(value);
+ }
+ }else if(key == "tstyle"){
+ clear = key; // Placeholder because we can't use style
+ key = "style";
+ }else if(dd.BOOLS[key.slice(1)] && dojo.trim(value)){
+ key = key.slice(1);
+ }else if(this._uppers[key] && dojo.trim(value)){
+ clear = this._uppers[key]; // Replaced by lowercase
+ }
+ }
+
+ if(clear){
+ // Clear out values that are different than will
+ // be used in plugins
+ node.setAttribute(clear, "");
+ node.removeAttribute(clear);
+ }
+
+ if(typeof value == "function"){
+ value = value.toString().replace(this._re4, "$1");
+ }
+
+ if(!change){
+ // Only do a change request if we need to
+ tokens.push([dd.TOKEN_CHANGE, node]);
+ change = true;
+ }
+
+ // We'll have to resolve attributes during parsing (some ref plugins)
+
+ tokens.push([dd.TOKEN_ATTR, node, key, value]);
+ }
+
+ for(i = 0, child; child = children[i]; i++){
+ if(child.nodeType == 1){
+ var instruction = child.getAttribute("dtlinstruction");
+ if(instruction){
+ child.parentNode.removeChild(child);
+ child = {
+ nodeType: 8,
+ data: instruction
+ };
+ }
+ }
+ this.__tokenize(child, tokens);
+ }
+
+ if(!first && node.parentNode && node.parentNode.tagName){
+ if(change){
+ tokens.push([dd.TOKEN_CHANGE, node, true]);
+ }
+ tokens.push([dd.TOKEN_CHANGE, node.parentNode]);
+ node.parentNode.removeChild(node);
+ }else{
+ // If this node is parentless, it's a base node, so we have to "up" change to itself
+ // and note that it's a top-level to watch for errors
+ tokens.push([dd.TOKEN_CHANGE, node, true, true]);
+ }
+ },
+ __tokenize: function(child, tokens){
+ var data = child.data;
+ switch(child.nodeType){
+ case 1:
+ this._tokenize(child, tokens);
+ return;
+ case 3:
+ if(data.match(/[^\s\n]/) && (data.indexOf("{{") != -1 || data.indexOf("{%") != -1)){
+ var texts = ddt.tokenize(data);
+ for(var j = 0, text; text = texts[j]; j++){
+ if(typeof text == "string"){
+ tokens.push([dd.TOKEN_TEXT, text]);
+ }else{
+ tokens.push(text);
+ }
+ }
+ }else{
+ tokens.push([child.nodeType, child]);
+ }
+ if(child.parentNode) child.parentNode.removeChild(child);
+ return;
+ case 8:
+ if(data.indexOf("{%") == 0){
+ var text = dojo.trim(data.slice(2, -2));
+ if(text.substr(0, 5) == "load "){
+ var parts = dojo.trim(text).split(/\s+/g);
+ for(var i = 1, part; part = parts[i]; i++){
+ dojo["require"](part);
+ }
+ }
+ tokens.push([dd.TOKEN_BLOCK, text]);
+ }
+ if(data.indexOf("{{") == 0){
+ tokens.push([dd.TOKEN_VAR, dojo.trim(data.slice(2, -2))]);
+ }
+ if(child.parentNode) child.parentNode.removeChild(child);
+ return;
+ }
+ }
+ };
+
+ dd.DomTemplate = dojo.extend(function(/*String|DOMNode|dojo._Url*/ obj){
+ // summary: Use this object for DOM templating
+ if(!obj.nodes){
+ var node = dojo.byId(obj);
+ if(node && node.nodeType == 1){
+ dojo.forEach(["class", "src", "href", "name", "value"], function(item){
+ ddh._attributes[item] = true;
+ });
+ obj = {
+ nodes: [node]
+ };
+ }else{
+ if(typeof obj == "object"){
+ obj = ddt.getTemplateString(obj);
+ }
+ obj = ddh.getTemplate(obj);
+ }
+ }
+
+ var tokens = ddh.tokenize(obj.nodes);
+ if(dd.tests){
+ this.tokens = tokens.slice(0);
+ }
+
+ var parser = new dd._DomParser(tokens);
+ this.nodelist = parser.parse();
+ },
+ {
+ _count: 0,
+ _re: /\bdojo:([a-zA-Z0-9_]+)\b/g,
+ setClass: function(str){
+ this.getRootNode().className = str;
+ },
+ getRootNode: function(){
+ return this.buffer.rootNode;
+ },
+ getBuffer: function(){
+ return new dd.DomBuffer();
+ },
+ render: function(context, buffer){
+ buffer = this.buffer = buffer || this.getBuffer();
+ this.rootNode = null;
+ var output = this.nodelist.render(context || new dd.Context({}), buffer);
+ for(var i = 0, node; node = buffer._cache[i]; i++){
+ if(node._cache){
+ node._cache.length = 0;
+ }
+ }
+ return output;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ }
+ });
+
+ dd.DomBuffer = dojo.extend(function(/*Node*/ parent){
+ // summary: Allows the manipulation of DOM
+ // description:
+ // Use this to append a child, change the parent, or
+ // change the attribute of the current node.
+ this._parent = parent;
+ this._cache = [];
+ },
+ {
+ concat: function(/*DOMNode*/ node){
+ var parent = this._parent;
+ if(parent && node.parentNode && node.parentNode === parent && !parent._dirty){
+ return this;
+ }
+
+ if(node.nodeType == 1 && !this.rootNode){
+ this.rootNode = node || true;
+ return this;
+ }
+
+ if(!parent){
+ if(node.nodeType == 3 && dojo.trim(node.data)){
+ throw new Error("Text should not exist outside of the root node in template");
+ }
+ return this;
+ }
+ if(this._closed){
+ if(node.nodeType == 3 && !dojo.trim(node.data)){
+ return this;
+ }else{
+ throw new Error("Content should not exist outside of the root node in template");
+ }
+ }
+ if(parent._dirty){
+ if(node._drawn && node.parentNode == parent){
+ var caches = parent._cache;
+ if(caches){
+ for(var i = 0, cache; cache = caches[i]; i++){
+ this.onAddNode && this.onAddNode(cache);
+ parent.insertBefore(cache, node);
+ this.onAddNodeComplete && this.onAddNodeComplete(cache);
+ }
+ caches.length = 0;
+ }
+ }
+ parent._dirty = false;
+ }
+ if(!parent._cache){
+ parent._cache = [];
+ this._cache.push(parent);
+ }
+ parent._dirty = true;
+ parent._cache.push(node);
+ return this;
+ },
+ remove: function(obj){
+ if(typeof obj == "string"){
+ if(this._parent){
+ this._parent.removeAttribute(obj);
+ }
+ }else{
+ if(obj.nodeType == 1 && !this.getRootNode() && !this._removed){
+ this._removed = true;
+ return this;
+ }
+ if(obj.parentNode){
+ this.onRemoveNode && this.onRemoveNode(obj);
+ if(obj.parentNode){
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+ return this;
+ },
+ setAttribute: function(key, value){
+ var old = dojo.attr(this._parent, key);
+ if(this.onChangeAttribute && old != value){
+ this.onChangeAttribute(this._parent, key, old, value);
+ }
+ if(key == "style"){
+ //console.log(value);
+ this._parent.style.cssText = value;
+ }else{
+ dojo.attr(this._parent, key, value);
+ //console.log(this._parent, key, value);
+ }
+ return this;
+ },
+ addEvent: function(context, type, fn, /*Array|Function*/ args){
+ if(!context.getThis()){ throw new Error("You must use Context.setObject(instance)"); }
+ this.onAddEvent && this.onAddEvent(this.getParent(), type, fn);
+ var resolved = fn;
+ if(dojo.isArray(args)){
+ resolved = function(e){
+ this[fn].apply(this, [e].concat(args));
+ }
+ }
+ return dojo.connect(this.getParent(), type, context.getThis(), resolved);
+ },
+ setParent: function(node, /*Boolean?*/ up, /*Boolean?*/ root){
+ if(!this._parent) this._parent = this._first = node;
+
+ if(up && root && node === this._first){
+ this._closed = true;
+ }
+
+ if(up){
+ var parent = this._parent;
+ var script = "";
+ var ie = dojo.isIE && parent.tagName == "SCRIPT";
+ if(ie){
+ parent.text = "";
+ }
+ if(parent._dirty){
+ var caches = parent._cache;
+ var select = (parent.tagName == "SELECT" && !parent.options.length);
+ for(var i = 0, cache; cache = caches[i]; i++){
+ if(cache !== parent){
+ this.onAddNode && this.onAddNode(cache);
+ if(ie){
+ script += cache.data;
+ }else{
+ parent.appendChild(cache);
+ if(select && cache.defaultSelected && i){
+ select = i;
+ }
+ }
+ this.onAddNodeComplete && this.onAddNodeComplete(cache);
+ }
+ }
+ if(select){
+ parent.options.selectedIndex = (typeof select == "number") ? select : 0;
+ }
+ caches.length = 0;
+ parent._dirty = false;
+ }
+ if(ie){
+ parent.text = script;
+ }
+ }
+
+ this._parent = node;
+ this.onSetParent && this.onSetParent(node, up, root);
+ return this;
+ },
+ getParent: function(){
+ return this._parent;
+ },
+ getRootNode: function(){
+ return this.rootNode;
+ }
+ /*=====
+ ,
+ onSetParent: function(node, up){
+ // summary: Stub called when setParent is used.
+ },
+ onAddNode: function(node){
+ // summary: Stub called before new nodes are added
+ },
+ onAddNodeComplete: function(node){
+ // summary: Stub called after new nodes are added
+ },
+ onRemoveNode: function(node){
+ // summary: Stub called when nodes are removed
+ },
+ onChangeAttribute: function(node, attribute, old, updated){
+ // summary: Stub called when an attribute is changed
+ },
+ onChangeData: function(node, old, updated){
+ // summary: Stub called when a data in a node is changed
+ },
+ onClone: function(from, to){
+ // summary: Stub called when a node is duplicated
+ // from: DOMNode
+ // to: DOMNode
+ },
+ onAddEvent: function(node, type, description){
+ // summary: Stub to call when you're adding an event
+ // node: DOMNode
+ // type: String
+ // description: String
+ }
+ =====*/
+ });
+
+ dd._DomNode = dojo.extend(function(node){
+ // summary: Places a node into DOM
+ this.contents = node;
+ },
+ {
+ render: function(context, buffer){
+ this._rendered = true;
+ return buffer.concat(this.contents);
+ },
+ unrender: function(context, buffer){
+ if(!this._rendered){
+ return buffer;
+ }
+ this._rendered = false;
+ return buffer.remove(this.contents);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.contents);
+ }
+ });
+
+ dd._DomNodeList = dojo.extend(function(/*Node[]*/ nodes){
+ // summary: A list of any DOM-specific node objects
+ // description:
+ // Any object that's used in the constructor or added
+ // through the push function much implement the
+ // render, unrender, and clone functions.
+ this.contents = nodes || [];
+ },
+ {
+ push: function(node){
+ this.contents.push(node);
+ },
+ unshift: function(node){
+ this.contents.unshift(node);
+ },
+ render: function(context, buffer, /*Node*/ instance){
+ buffer = buffer || dd.DomTemplate.prototype.getBuffer();
+
+ if(instance){
+ var parent = buffer.getParent();
+ }
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].render(context, buffer);
+ if(!buffer) throw new Error("Template node render functions must return their buffer");
+ }
+ if(parent){
+ buffer.setParent(parent);
+ }
+ return buffer;
+ },
+ dummyRender: function(context, buffer, asNode){
+ // summary: A really expensive way of checking to see how a rendering will look.
+ // Used in the ifchanged tag
+ var div = document.createElement("div");
+
+ var parent = buffer.getParent();
+ var old = parent._clone;
+ // Tell the clone system to attach itself to our new div
+ parent._clone = div;
+ var nodelist = this.clone(buffer, div);
+ if(old){
+ // Restore state if there was a previous clone
+ parent._clone = old;
+ }else{
+ // Remove if there was no clone
+ parent._clone = null;
+ }
+
+ buffer = dd.DomTemplate.prototype.getBuffer();
+ nodelist.unshift(new dd.ChangeNode(div));
+ nodelist.unshift(new dd._DomNode(div));
+ nodelist.push(new dd.ChangeNode(div, true));
+ nodelist.render(context, buffer);
+
+ if(asNode){
+ return buffer.getRootNode();
+ }
+
+ var html = div.innerHTML;
+ return (dojo.isIE) ? html.replace(/\s*_(dirty|clone)="[^"]*"/g, "") : html;
+ },
+ unrender: function(context, buffer, instance){
+ if(instance){
+ var parent = buffer.getParent();
+ }
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].unrender(context, buffer);
+ if(!buffer) throw new Error("Template node render functions must return their buffer");
+ }
+ if(parent){
+ buffer.setParent(parent);
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ // summary:
+ // Used to create an identical copy of a NodeList, useful for things like the for tag.
+ var parent = buffer.getParent();
+ var contents = this.contents;
+ var nodelist = new dd._DomNodeList();
+ var cloned = [];
+ for(var i = 0; i < contents.length; i++){
+ var clone = contents[i].clone(buffer);
+ if(clone instanceof dd.ChangeNode || clone instanceof dd._DomNode){
+ var item = clone.contents._clone;
+ if(item){
+ clone.contents = item;
+ }else if(parent != clone.contents && clone instanceof dd._DomNode){
+ var node = clone.contents;
+ clone.contents = clone.contents.cloneNode(false);
+ buffer.onClone && buffer.onClone(node, clone.contents);
+ cloned.push(node);
+ node._clone = clone.contents;
+ }
+ }
+ nodelist.push(clone);
+ }
+
+ for(var i = 0, clone; clone = cloned[i]; i++){
+ clone._clone = null;
+ }
+
+ return nodelist;
+ },
+ rtrim: function(){
+ while(1){
+ var i = this.contents.length - 1;
+ if(this.contents[i] instanceof dd._DomTextNode && this.contents[i].isEmpty()){
+ this.contents.pop();
+ }else{
+ break;
+ }
+ }
+
+ return this;
+ }
+ });
+
+ dd._DomVarNode = dojo.extend(function(str){
+ // summary: A node to be processed as a variable
+ // description:
+ // Will render an object that supports the render function
+ // and the getRootNode function
+ this.contents = new dd._Filter(str);
+ },
+ {
+ render: function(context, buffer){
+ var str = this.contents.resolve(context);
+
+ // What type of rendering?
+ var type = "text";
+ if(str){
+ if(str.render && str.getRootNode){
+ type = "injection";
+ }else if(str.safe){
+ if(str.nodeType){
+ type = "node";
+ }else if(str.toString){
+ str = str.toString();
+ type = "html";
+ }
+ }
+ }
+
+ // Has the typed changed?
+ if(this._type && type != this._type){
+ this.unrender(context, buffer);
+ }
+ this._type = type;
+
+ // Now render
+ switch(type){
+ case "text":
+ this._rendered = true;
+ this._txt = this._txt || document.createTextNode(str);
+ if(this._txt.data != str){
+ var old = this._txt.data;
+ this._txt.data = str;
+ buffer.onChangeData && buffer.onChangeData(this._txt, old, this._txt.data);
+ }
+ return buffer.concat(this._txt);
+ case "injection":
+ var root = str.getRootNode();
+
+ if(this._rendered && root != this._root){
+ buffer = this.unrender(context, buffer);
+ }
+ this._root = root;
+
+ var injected = this._injected = new dd._DomNodeList();
+ injected.push(new dd.ChangeNode(buffer.getParent()));
+ injected.push(new dd._DomNode(root));
+ injected.push(str);
+ injected.push(new dd.ChangeNode(buffer.getParent()));
+ this._rendered = true;
+
+ return injected.render(context, buffer);
+ case "node":
+ this._rendered = true;
+ if(this._node && this._node != str && this._node.parentNode && this._node.parentNode === buffer.getParent()){
+ this._node.parentNode.removeChild(this._node);
+ }
+ this._node = str;
+ return buffer.concat(str);
+ case "html":
+ if(this._rendered && this._src != str){
+ buffer = this.unrender(context, buffer);
+ }
+ this._src = str;
+
+ // This can get reset in the above tag
+ if(!this._rendered){
+ this._rendered = true;
+ this._html = this._html || [];
+ var div = (this._div = this._div || document.createElement("div"));
+ div.innerHTML = str;
+ var children = div.childNodes;
+ while(children.length){
+ var removed = div.removeChild(children[0]);
+ this._html.push(removed);
+ buffer = buffer.concat(removed);
+ }
+ }
+
+ return buffer;
+ default:
+ return buffer;
+ }
+ },
+ unrender: function(context, buffer){
+ if(!this._rendered){
+ return buffer;
+ }
+ this._rendered = false;
+
+ // Unrender injected nodes
+ switch(this._type){
+ case "text":
+ return buffer.remove(this._txt);
+ case "injection":
+ return this._injection.unrender(context, buffer);
+ case "node":
+ if(this._node.parentNode === buffer.getParent()){
+ return buffer.remove(this._node);
+ }
+ return buffer;
+ case "html":
+ for(var i=0, l=this._html.length; i<l; i++){
+ buffer = buffer.remove(this._html[i]);
+ }
+ return buffer;
+ default:
+ return buffer;
+ }
+ },
+ clone: function(){
+ return new this.constructor(this.contents.getExpression());
+ }
+ });
+
+ dd.ChangeNode = dojo.extend(function(node, /*Boolean?*/ up, /*Bookean*/ root){
+ // summary: Changes the parent during render/unrender
+ this.contents = node;
+ this.up = up;
+ this.root = root;
+ },
+ {
+ render: function(context, buffer){
+ return buffer.setParent(this.contents, this.up, this.root);
+ },
+ unrender: function(context, buffer){
+ if(!buffer.getParent()){
+ return buffer;
+ }
+ return buffer.setParent(this.contents);
+ },
+ clone: function(){
+ return new this.constructor(this.contents, this.up, this.root);
+ }
+ });
+
+ dd.AttributeNode = dojo.extend(function(key, value){
+ // summary: Works on attributes
+ this.key = key;
+ this.value = value;
+ this.contents = value;
+ if(this._pool[value]){
+ this.nodelist = this._pool[value];
+ }else{
+ if(!(this.nodelist = dd.quickFilter(value))){
+ this.nodelist = (new dd.Template(value, true)).nodelist;
+ }
+ this._pool[value] = this.nodelist;
+ }
+
+ this.contents = "";
+ },
+ {
+ _pool: {},
+ render: function(context, buffer){
+ var key = this.key;
+ var value = this.nodelist.dummyRender(context);
+ if(dd.BOOLS[key]){
+ value = !(value == "false" || value == "undefined" || !value);
+ }
+ if(value !== this.contents){
+ this.contents = value;
+ return buffer.setAttribute(key, value);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ this.contents = "";
+ return buffer.remove(this.key);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.key, this.value);
+ }
+ });
+
+ dd._DomTextNode = dojo.extend(function(str){
+ // summary: Adds a straight text node without any processing
+ this.contents = document.createTextNode(str);
+ this.upcoming = str;
+ },
+ {
+ set: function(data){
+ this.upcoming = data;
+ return this;
+ },
+ render: function(context, buffer){
+ if(this.contents.data != this.upcoming){
+ var old = this.contents.data;
+ this.contents.data = this.upcoming;
+ buffer.onChangeData && buffer.onChangeData(this.contents, old, this.upcoming);
+ }
+ return buffer.concat(this.contents);
+ },
+ unrender: function(context, buffer){
+ return buffer.remove(this.contents);
+ },
+ isEmpty: function(){
+ return !dojo.trim(this.contents.data);
+ },
+ clone: function(){
+ return new this.constructor(this.contents.data);
+ }
+ });
+
+ dd._DomParser = dojo.extend(function(tokens){
+ // summary: Turn a simple array into a set of objects
+ // description:
+ // This is also used by all tags to move through
+ // the list of nodes.
+ this.contents = tokens;
+ },
+ {
+ i: 0,
+ parse: function(/*Array?*/ stop_at){
+ var terminators = {};
+ var tokens = this.contents;
+ if(!stop_at){
+ stop_at = [];
+ }
+ for(var i = 0; i < stop_at.length; i++){
+ terminators[stop_at[i]] = true;
+ }
+ var nodelist = new dd._DomNodeList();
+ while(this.i < tokens.length){
+ var token = tokens[this.i++];
+ var type = token[0];
+ var value = token[1];
+ if(type == dd.TOKEN_CUSTOM){
+ nodelist.push(value);
+ }else if(type == dd.TOKEN_CHANGE){
+ var changeNode = new dd.ChangeNode(value, token[2], token[3]);
+ value[changeNode.attr] = changeNode;
+ nodelist.push(changeNode);
+ }else if(type == dd.TOKEN_ATTR){
+ var fn = ddt.getTag("attr:" + token[2], true);
+ if(fn && token[3]){
+ if (token[3].indexOf("{%") != -1 || token[3].indexOf("{{") != -1) {
+ value.setAttribute(token[2], "");
+ }
+ nodelist.push(fn(null, new dd.Token(type, token[2] + " " + token[3])));
+ }else if(dojo.isString(token[3])){
+ if(token[2] == "style" || token[3].indexOf("{%") != -1 || token[3].indexOf("{{") != -1){
+ nodelist.push(new dd.AttributeNode(token[2], token[3]));
+ }else if(dojo.trim(token[3])){
+ try{
+ dojo.attr(value, token[2], token[3]);
+ }catch(e){}
+ }
+ }
+ }else if(type == dd.TOKEN_NODE){
+ var fn = ddt.getTag("node:" + value.tagName.toLowerCase(), true);
+ if(fn){
+ // TODO: We need to move this to tokenization so that it's before the
+ // node and the parser can be passed here instead of null
+ nodelist.push(fn(null, new dd.Token(type, value), value.tagName.toLowerCase()));
+ }
+ nodelist.push(new dd._DomNode(value));
+ }else if(type == dd.TOKEN_VAR){
+ nodelist.push(new dd._DomVarNode(value));
+ }else if(type == dd.TOKEN_TEXT){
+ nodelist.push(new dd._DomTextNode(value.data || value));
+ }else if(type == dd.TOKEN_BLOCK){
+ if(terminators[value]){
+ --this.i;
+ return nodelist;
+ }
+ var cmd = value.split(/\s+/g);
+ if(cmd.length){
+ cmd = cmd[0];
+ var fn = ddt.getTag(cmd);
+ if(typeof fn != "function"){
+ throw new Error("Function not found for " + cmd);
+ }
+ var tpl = fn(this, new dd.Token(type, value));
+ if(tpl){
+ nodelist.push(tpl);
+ }
+ }
+ }
+ }
+
+ if(stop_at.length){
+ throw new Error("Could not find closing tag(s): " + stop_at.toString());
+ }
+
+ return nodelist;
+ },
+ next_token: function(){
+ // summary: Returns the next token in the list.
+ var token = this.contents[this.i++];
+ return new dd.Token(token[0], token[1]);
+ },
+ delete_first_token: function(){
+ this.i++;
+ },
+ skip_past: function(endtag){
+ return dd._Parser.prototype.skip_past.call(this, endtag);
+ },
+ create_variable_node: function(expr){
+ return new dd._DomVarNode(expr);
+ },
+ create_text_node: function(expr){
+ return new dd._DomTextNode(expr || "");
+ },
+ getTemplate: function(/*String*/ loc){
+ return new dd.DomTemplate(ddh.getTemplate(loc));
+ }
+ });
+
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/dom.xd.js b/js/dojo-1.6/dojox/dtl/dom.xd.js new file mode 100644 index 0000000..f142796 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/dom.xd.js @@ -0,0 +1,1048 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.dom"],
+["require", "dojox.dtl._base"],
+["require", "dojox.dtl.Context"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.dom"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.dom"] = true;
+dojo.provide("dojox.dtl.dom");
+
+dojo.require("dojox.dtl._base");
+dojo.require("dojox.dtl.Context");
+
+(function(){
+ var dd = dojox.dtl;
+
+ dd.BOOLS = {checked: 1, disabled: 1, readonly: 1};
+ dd.TOKEN_CHANGE = -11;
+ dd.TOKEN_ATTR = -12;
+ dd.TOKEN_CUSTOM = -13;
+ dd.TOKEN_NODE = 1;
+
+ var ddt = dd.text;
+ var ddh = dd.dom = {
+ _attributes: {},
+ _uppers: {},
+ _re4: /^function anonymous\(\)\s*{\s*(.*)\s*}$/,
+ _reTrim: /(?:^[\n\s]*(\{%)?\s*|\s*(%\})?[\n\s]*$)/g,
+ _reSplit: /\s*%\}[\n\s]*\{%\s*/g,
+ getTemplate: function(text){
+ if(typeof this._commentable == "undefined"){
+ // Check to see if the browser can handle comments
+ this._commentable = false;
+ var div = document.createElement("div");
+ div.innerHTML = "<!--Test comment handling, and long comments, using comments whenever possible.-->";
+ if(div.childNodes.length && div.childNodes[0].nodeType == 8 && div.childNodes[0].data == "comment"){
+ this._commentable = true;
+ }
+ }
+
+ if(!this._commentable){
+ // Strip comments
+ text = text.replace(/<!--({({|%).*?(%|})})-->/g, "$1");
+ }
+
+ if(dojo.isIE){
+ text = text.replace(/\b(checked|disabled|readonly|style)="/g, 't$1="');
+ }
+ text = text.replace(/\bstyle="/g, 'tstyle="');
+
+ var match;
+ var table = dojo.isWebKit;
+ var pairs = [ // Format: [enable, parent, allowed children (first for nesting), nestings]
+ [true, "select", "option"],
+ [table, "tr", "td|th"],
+ [table, "thead", "tr", "th"],
+ [table, "tbody", "tr", "td"],
+ [table, "table", "tbody|thead|tr", "tr", "td"]
+ ];
+ var replacements = [];
+ // Some tags can't contain text. So we wrap the text in tags that they can have.
+ for(var i = 0, pair; pair = pairs[i]; i++){
+ if(!pair[0]){
+ continue;
+ }
+ if(text.indexOf("<" + pair[1]) != -1){
+ var selectRe = new RegExp("<" + pair[1] + "(?:.|\n)*?>((?:.|\n)+?)</" + pair[1] + ">", "ig");
+ tagLoop: while(match = selectRe.exec(text)){
+ // Do it like this to make sure we don't double-wrap
+ var inners = pair[2].split("|");
+ var innerRe = [];
+ for(var j = 0, inner; inner = inners[j]; j++){
+ innerRe.push("<" + inner + "(?:.|\n)*?>(?:.|\n)*?</" + inner + ">");
+ }
+ var tags = [];
+ var tokens = dojox.string.tokenize(match[1], new RegExp("(" + innerRe.join("|") + ")", "ig"), function(data){
+ var tag = /<(\w+)/.exec(data)[1];
+ if(!tags[tag]){
+ tags[tag] = true;
+ tags.push(tag);
+ }
+ return {data: data};
+ });
+ if(tags.length){
+ var tag = (tags.length == 1) ? tags[0] : pair[2].split("|")[0];
+
+ var replace = [];
+ for(var j = 0, jl = tokens.length; j < jl; j++) {
+ var token = tokens[j];
+ if(dojo.isObject(token)){
+ replace.push(token.data);
+ }else{
+ var stripped = token.replace(this._reTrim, "");
+ if(!stripped){ continue; }
+ token = stripped.split(this._reSplit);
+ for(var k = 0, kl = token.length; k < kl; k++){
+ var replacement = "";
+ for(var p = 2, pl = pair.length; p < pl; p++){
+ if(p == 2){
+ replacement += "<" + tag + ' dtlinstruction="{% ' + token[k].replace('"', '\\"') + ' %}">';
+ }else if(tag == pair[p]) {
+ continue;
+ }else{
+ replacement += "<" + pair[p] + ">";
+ }
+ }
+ replacement += "DTL";
+ for(var p = pair.length - 1; p > 1; p--){
+ if(p == 2){
+ replacement += "</" + tag + ">";
+ }else if(tag == pair[p]) {
+ continue;
+ }else{
+ replacement += "</" + pair[p] + ">";
+ }
+ }
+ replace.push("\xFF" + replacements.length);
+ replacements.push(replacement);
+ }
+ }
+ }
+ text = text.replace(match[1], replace.join(""));
+ }
+ }
+ }
+ }
+
+ for(var i=replacements.length; i--;){
+ text = text.replace("\xFF" + i, replacements[i]);
+ }
+
+ var re = /\b([a-zA-Z_:][a-zA-Z0-9_\-\.:]*)=['"]/g;
+ while(match = re.exec(text)){
+ var lower = match[1].toLowerCase();
+ if(lower == "dtlinstruction"){ continue; }
+ if(lower != match[1]){
+ this._uppers[lower] = match[1];
+ }
+ this._attributes[lower] = true;
+ }
+ var div = document.createElement("div");
+ div.innerHTML = text;
+ var output = {nodes: []};
+ while(div.childNodes.length){
+ output.nodes.push(div.removeChild(div.childNodes[0]))
+ }
+
+ return output;
+ },
+ tokenize: function(/*Node*/ nodes){
+ var tokens = [];
+
+ for(var i = 0, node; node = nodes[i++];){
+ if(node.nodeType != 1){
+ this.__tokenize(node, tokens);
+ }else{
+ this._tokenize(node, tokens);
+ }
+ }
+
+ return tokens;
+ },
+ _swallowed: [],
+ _tokenize: function(/*Node*/ node, /*Array*/ tokens){
+ var first = false;
+ var swallowed = this._swallowed;
+ var i, j, tag, child;
+
+ if(!tokens.first){
+ // Try to efficiently associate tags that use an attribute to
+ // remove the node from DOM (eg dojoType) so that we can efficiently
+ // locate them later in the tokenizing.
+ first = tokens.first = true;
+ var tags = dd.register.getAttributeTags();
+ for(i = 0; tag = tags[i]; i++){
+ try{
+ (tag[2])({ swallowNode: function(){ throw 1; }}, new dd.Token(dd.TOKEN_ATTR, ""));
+ }catch(e){
+ swallowed.push(tag);
+ }
+ }
+ }
+
+ for(i = 0; tag = swallowed[i]; i++){
+ var text = node.getAttribute(tag[0]);
+ if(text){
+ var swallowed = false;
+ var custom = (tag[2])({ swallowNode: function(){ swallowed = true; return node; }}, new dd.Token(dd.TOKEN_ATTR, tag[0] + " " + text));
+ if(swallowed){
+ if(node.parentNode && node.parentNode.removeChild){
+ node.parentNode.removeChild(node);
+ }
+ tokens.push([dd.TOKEN_CUSTOM, custom]);
+ return;
+ }
+ }
+ }
+
+ var children = [];
+ if(dojo.isIE && node.tagName == "SCRIPT"){
+ children.push({
+ nodeType: 3,
+ data: node.text
+ });
+ node.text = "";
+ }else{
+ for(i = 0; child = node.childNodes[i]; i++){
+ children.push(child);
+ }
+ }
+
+ tokens.push([dd.TOKEN_NODE, node]);
+
+ var change = false;
+ if(children.length){
+ // Only do a change request if we need to
+ tokens.push([dd.TOKEN_CHANGE, node]);
+ change = true;
+ }
+
+ for(var key in this._attributes){
+ var clear = false;
+
+ var value = "";
+ if(key == "class"){
+ value = node.className || value;
+ }else if(key == "for"){
+ value = node.htmlFor || value;
+ }else if(key == "value" && node.value == node.innerHTML){
+ // Sometimes .value is set the same as the contents of the item (button)
+ continue;
+ }else if(node.getAttribute){
+ value = node.getAttribute(key, 2) || value;
+ if(key == "href" || key == "src"){
+ if(dojo.isIE){
+ var hash = location.href.lastIndexOf(location.hash);
+ var href = location.href.substring(0, hash).split("/");
+ href.pop();
+ href = href.join("/") + "/";
+ if(value.indexOf(href) == 0){
+ value = value.replace(href, "");
+ }
+ value = decodeURIComponent(value);
+ }
+ }else if(key == "tstyle"){
+ clear = key; // Placeholder because we can't use style
+ key = "style";
+ }else if(dd.BOOLS[key.slice(1)] && dojo.trim(value)){
+ key = key.slice(1);
+ }else if(this._uppers[key] && dojo.trim(value)){
+ clear = this._uppers[key]; // Replaced by lowercase
+ }
+ }
+
+ if(clear){
+ // Clear out values that are different than will
+ // be used in plugins
+ node.setAttribute(clear, "");
+ node.removeAttribute(clear);
+ }
+
+ if(typeof value == "function"){
+ value = value.toString().replace(this._re4, "$1");
+ }
+
+ if(!change){
+ // Only do a change request if we need to
+ tokens.push([dd.TOKEN_CHANGE, node]);
+ change = true;
+ }
+
+ // We'll have to resolve attributes during parsing (some ref plugins)
+
+ tokens.push([dd.TOKEN_ATTR, node, key, value]);
+ }
+
+ for(i = 0, child; child = children[i]; i++){
+ if(child.nodeType == 1){
+ var instruction = child.getAttribute("dtlinstruction");
+ if(instruction){
+ child.parentNode.removeChild(child);
+ child = {
+ nodeType: 8,
+ data: instruction
+ };
+ }
+ }
+ this.__tokenize(child, tokens);
+ }
+
+ if(!first && node.parentNode && node.parentNode.tagName){
+ if(change){
+ tokens.push([dd.TOKEN_CHANGE, node, true]);
+ }
+ tokens.push([dd.TOKEN_CHANGE, node.parentNode]);
+ node.parentNode.removeChild(node);
+ }else{
+ // If this node is parentless, it's a base node, so we have to "up" change to itself
+ // and note that it's a top-level to watch for errors
+ tokens.push([dd.TOKEN_CHANGE, node, true, true]);
+ }
+ },
+ __tokenize: function(child, tokens){
+ var data = child.data;
+ switch(child.nodeType){
+ case 1:
+ this._tokenize(child, tokens);
+ return;
+ case 3:
+ if(data.match(/[^\s\n]/) && (data.indexOf("{{") != -1 || data.indexOf("{%") != -1)){
+ var texts = ddt.tokenize(data);
+ for(var j = 0, text; text = texts[j]; j++){
+ if(typeof text == "string"){
+ tokens.push([dd.TOKEN_TEXT, text]);
+ }else{
+ tokens.push(text);
+ }
+ }
+ }else{
+ tokens.push([child.nodeType, child]);
+ }
+ if(child.parentNode) child.parentNode.removeChild(child);
+ return;
+ case 8:
+ if(data.indexOf("{%") == 0){
+ var text = dojo.trim(data.slice(2, -2));
+ if(text.substr(0, 5) == "load "){
+ var parts = dojo.trim(text).split(/\s+/g);
+ for(var i = 1, part; part = parts[i]; i++){
+ dojo["require"](part);
+ }
+ }
+ tokens.push([dd.TOKEN_BLOCK, text]);
+ }
+ if(data.indexOf("{{") == 0){
+ tokens.push([dd.TOKEN_VAR, dojo.trim(data.slice(2, -2))]);
+ }
+ if(child.parentNode) child.parentNode.removeChild(child);
+ return;
+ }
+ }
+ };
+
+ dd.DomTemplate = dojo.extend(function(/*String|DOMNode|dojo._Url*/ obj){
+ // summary: Use this object for DOM templating
+ if(!obj.nodes){
+ var node = dojo.byId(obj);
+ if(node && node.nodeType == 1){
+ dojo.forEach(["class", "src", "href", "name", "value"], function(item){
+ ddh._attributes[item] = true;
+ });
+ obj = {
+ nodes: [node]
+ };
+ }else{
+ if(typeof obj == "object"){
+ obj = ddt.getTemplateString(obj);
+ }
+ obj = ddh.getTemplate(obj);
+ }
+ }
+
+ var tokens = ddh.tokenize(obj.nodes);
+ if(dd.tests){
+ this.tokens = tokens.slice(0);
+ }
+
+ var parser = new dd._DomParser(tokens);
+ this.nodelist = parser.parse();
+ },
+ {
+ _count: 0,
+ _re: /\bdojo:([a-zA-Z0-9_]+)\b/g,
+ setClass: function(str){
+ this.getRootNode().className = str;
+ },
+ getRootNode: function(){
+ return this.buffer.rootNode;
+ },
+ getBuffer: function(){
+ return new dd.DomBuffer();
+ },
+ render: function(context, buffer){
+ buffer = this.buffer = buffer || this.getBuffer();
+ this.rootNode = null;
+ var output = this.nodelist.render(context || new dd.Context({}), buffer);
+ for(var i = 0, node; node = buffer._cache[i]; i++){
+ if(node._cache){
+ node._cache.length = 0;
+ }
+ }
+ return output;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ }
+ });
+
+ dd.DomBuffer = dojo.extend(function(/*Node*/ parent){
+ // summary: Allows the manipulation of DOM
+ // description:
+ // Use this to append a child, change the parent, or
+ // change the attribute of the current node.
+ this._parent = parent;
+ this._cache = [];
+ },
+ {
+ concat: function(/*DOMNode*/ node){
+ var parent = this._parent;
+ if(parent && node.parentNode && node.parentNode === parent && !parent._dirty){
+ return this;
+ }
+
+ if(node.nodeType == 1 && !this.rootNode){
+ this.rootNode = node || true;
+ return this;
+ }
+
+ if(!parent){
+ if(node.nodeType == 3 && dojo.trim(node.data)){
+ throw new Error("Text should not exist outside of the root node in template");
+ }
+ return this;
+ }
+ if(this._closed){
+ if(node.nodeType == 3 && !dojo.trim(node.data)){
+ return this;
+ }else{
+ throw new Error("Content should not exist outside of the root node in template");
+ }
+ }
+ if(parent._dirty){
+ if(node._drawn && node.parentNode == parent){
+ var caches = parent._cache;
+ if(caches){
+ for(var i = 0, cache; cache = caches[i]; i++){
+ this.onAddNode && this.onAddNode(cache);
+ parent.insertBefore(cache, node);
+ this.onAddNodeComplete && this.onAddNodeComplete(cache);
+ }
+ caches.length = 0;
+ }
+ }
+ parent._dirty = false;
+ }
+ if(!parent._cache){
+ parent._cache = [];
+ this._cache.push(parent);
+ }
+ parent._dirty = true;
+ parent._cache.push(node);
+ return this;
+ },
+ remove: function(obj){
+ if(typeof obj == "string"){
+ if(this._parent){
+ this._parent.removeAttribute(obj);
+ }
+ }else{
+ if(obj.nodeType == 1 && !this.getRootNode() && !this._removed){
+ this._removed = true;
+ return this;
+ }
+ if(obj.parentNode){
+ this.onRemoveNode && this.onRemoveNode(obj);
+ if(obj.parentNode){
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+ return this;
+ },
+ setAttribute: function(key, value){
+ var old = dojo.attr(this._parent, key);
+ if(this.onChangeAttribute && old != value){
+ this.onChangeAttribute(this._parent, key, old, value);
+ }
+ if(key == "style"){
+ //console.log(value);
+ this._parent.style.cssText = value;
+ }else{
+ dojo.attr(this._parent, key, value);
+ //console.log(this._parent, key, value);
+ }
+ return this;
+ },
+ addEvent: function(context, type, fn, /*Array|Function*/ args){
+ if(!context.getThis()){ throw new Error("You must use Context.setObject(instance)"); }
+ this.onAddEvent && this.onAddEvent(this.getParent(), type, fn);
+ var resolved = fn;
+ if(dojo.isArray(args)){
+ resolved = function(e){
+ this[fn].apply(this, [e].concat(args));
+ }
+ }
+ return dojo.connect(this.getParent(), type, context.getThis(), resolved);
+ },
+ setParent: function(node, /*Boolean?*/ up, /*Boolean?*/ root){
+ if(!this._parent) this._parent = this._first = node;
+
+ if(up && root && node === this._first){
+ this._closed = true;
+ }
+
+ if(up){
+ var parent = this._parent;
+ var script = "";
+ var ie = dojo.isIE && parent.tagName == "SCRIPT";
+ if(ie){
+ parent.text = "";
+ }
+ if(parent._dirty){
+ var caches = parent._cache;
+ var select = (parent.tagName == "SELECT" && !parent.options.length);
+ for(var i = 0, cache; cache = caches[i]; i++){
+ if(cache !== parent){
+ this.onAddNode && this.onAddNode(cache);
+ if(ie){
+ script += cache.data;
+ }else{
+ parent.appendChild(cache);
+ if(select && cache.defaultSelected && i){
+ select = i;
+ }
+ }
+ this.onAddNodeComplete && this.onAddNodeComplete(cache);
+ }
+ }
+ if(select){
+ parent.options.selectedIndex = (typeof select == "number") ? select : 0;
+ }
+ caches.length = 0;
+ parent._dirty = false;
+ }
+ if(ie){
+ parent.text = script;
+ }
+ }
+
+ this._parent = node;
+ this.onSetParent && this.onSetParent(node, up, root);
+ return this;
+ },
+ getParent: function(){
+ return this._parent;
+ },
+ getRootNode: function(){
+ return this.rootNode;
+ }
+ /*=====
+ ,
+ onSetParent: function(node, up){
+ // summary: Stub called when setParent is used.
+ },
+ onAddNode: function(node){
+ // summary: Stub called before new nodes are added
+ },
+ onAddNodeComplete: function(node){
+ // summary: Stub called after new nodes are added
+ },
+ onRemoveNode: function(node){
+ // summary: Stub called when nodes are removed
+ },
+ onChangeAttribute: function(node, attribute, old, updated){
+ // summary: Stub called when an attribute is changed
+ },
+ onChangeData: function(node, old, updated){
+ // summary: Stub called when a data in a node is changed
+ },
+ onClone: function(from, to){
+ // summary: Stub called when a node is duplicated
+ // from: DOMNode
+ // to: DOMNode
+ },
+ onAddEvent: function(node, type, description){
+ // summary: Stub to call when you're adding an event
+ // node: DOMNode
+ // type: String
+ // description: String
+ }
+ =====*/
+ });
+
+ dd._DomNode = dojo.extend(function(node){
+ // summary: Places a node into DOM
+ this.contents = node;
+ },
+ {
+ render: function(context, buffer){
+ this._rendered = true;
+ return buffer.concat(this.contents);
+ },
+ unrender: function(context, buffer){
+ if(!this._rendered){
+ return buffer;
+ }
+ this._rendered = false;
+ return buffer.remove(this.contents);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.contents);
+ }
+ });
+
+ dd._DomNodeList = dojo.extend(function(/*Node[]*/ nodes){
+ // summary: A list of any DOM-specific node objects
+ // description:
+ // Any object that's used in the constructor or added
+ // through the push function much implement the
+ // render, unrender, and clone functions.
+ this.contents = nodes || [];
+ },
+ {
+ push: function(node){
+ this.contents.push(node);
+ },
+ unshift: function(node){
+ this.contents.unshift(node);
+ },
+ render: function(context, buffer, /*Node*/ instance){
+ buffer = buffer || dd.DomTemplate.prototype.getBuffer();
+
+ if(instance){
+ var parent = buffer.getParent();
+ }
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].render(context, buffer);
+ if(!buffer) throw new Error("Template node render functions must return their buffer");
+ }
+ if(parent){
+ buffer.setParent(parent);
+ }
+ return buffer;
+ },
+ dummyRender: function(context, buffer, asNode){
+ // summary: A really expensive way of checking to see how a rendering will look.
+ // Used in the ifchanged tag
+ var div = document.createElement("div");
+
+ var parent = buffer.getParent();
+ var old = parent._clone;
+ // Tell the clone system to attach itself to our new div
+ parent._clone = div;
+ var nodelist = this.clone(buffer, div);
+ if(old){
+ // Restore state if there was a previous clone
+ parent._clone = old;
+ }else{
+ // Remove if there was no clone
+ parent._clone = null;
+ }
+
+ buffer = dd.DomTemplate.prototype.getBuffer();
+ nodelist.unshift(new dd.ChangeNode(div));
+ nodelist.unshift(new dd._DomNode(div));
+ nodelist.push(new dd.ChangeNode(div, true));
+ nodelist.render(context, buffer);
+
+ if(asNode){
+ return buffer.getRootNode();
+ }
+
+ var html = div.innerHTML;
+ return (dojo.isIE) ? html.replace(/\s*_(dirty|clone)="[^"]*"/g, "") : html;
+ },
+ unrender: function(context, buffer, instance){
+ if(instance){
+ var parent = buffer.getParent();
+ }
+ for(var i = 0; i < this.contents.length; i++){
+ buffer = this.contents[i].unrender(context, buffer);
+ if(!buffer) throw new Error("Template node render functions must return their buffer");
+ }
+ if(parent){
+ buffer.setParent(parent);
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ // summary:
+ // Used to create an identical copy of a NodeList, useful for things like the for tag.
+ var parent = buffer.getParent();
+ var contents = this.contents;
+ var nodelist = new dd._DomNodeList();
+ var cloned = [];
+ for(var i = 0; i < contents.length; i++){
+ var clone = contents[i].clone(buffer);
+ if(clone instanceof dd.ChangeNode || clone instanceof dd._DomNode){
+ var item = clone.contents._clone;
+ if(item){
+ clone.contents = item;
+ }else if(parent != clone.contents && clone instanceof dd._DomNode){
+ var node = clone.contents;
+ clone.contents = clone.contents.cloneNode(false);
+ buffer.onClone && buffer.onClone(node, clone.contents);
+ cloned.push(node);
+ node._clone = clone.contents;
+ }
+ }
+ nodelist.push(clone);
+ }
+
+ for(var i = 0, clone; clone = cloned[i]; i++){
+ clone._clone = null;
+ }
+
+ return nodelist;
+ },
+ rtrim: function(){
+ while(1){
+ var i = this.contents.length - 1;
+ if(this.contents[i] instanceof dd._DomTextNode && this.contents[i].isEmpty()){
+ this.contents.pop();
+ }else{
+ break;
+ }
+ }
+
+ return this;
+ }
+ });
+
+ dd._DomVarNode = dojo.extend(function(str){
+ // summary: A node to be processed as a variable
+ // description:
+ // Will render an object that supports the render function
+ // and the getRootNode function
+ this.contents = new dd._Filter(str);
+ },
+ {
+ render: function(context, buffer){
+ var str = this.contents.resolve(context);
+
+ // What type of rendering?
+ var type = "text";
+ if(str){
+ if(str.render && str.getRootNode){
+ type = "injection";
+ }else if(str.safe){
+ if(str.nodeType){
+ type = "node";
+ }else if(str.toString){
+ str = str.toString();
+ type = "html";
+ }
+ }
+ }
+
+ // Has the typed changed?
+ if(this._type && type != this._type){
+ this.unrender(context, buffer);
+ }
+ this._type = type;
+
+ // Now render
+ switch(type){
+ case "text":
+ this._rendered = true;
+ this._txt = this._txt || document.createTextNode(str);
+ if(this._txt.data != str){
+ var old = this._txt.data;
+ this._txt.data = str;
+ buffer.onChangeData && buffer.onChangeData(this._txt, old, this._txt.data);
+ }
+ return buffer.concat(this._txt);
+ case "injection":
+ var root = str.getRootNode();
+
+ if(this._rendered && root != this._root){
+ buffer = this.unrender(context, buffer);
+ }
+ this._root = root;
+
+ var injected = this._injected = new dd._DomNodeList();
+ injected.push(new dd.ChangeNode(buffer.getParent()));
+ injected.push(new dd._DomNode(root));
+ injected.push(str);
+ injected.push(new dd.ChangeNode(buffer.getParent()));
+ this._rendered = true;
+
+ return injected.render(context, buffer);
+ case "node":
+ this._rendered = true;
+ if(this._node && this._node != str && this._node.parentNode && this._node.parentNode === buffer.getParent()){
+ this._node.parentNode.removeChild(this._node);
+ }
+ this._node = str;
+ return buffer.concat(str);
+ case "html":
+ if(this._rendered && this._src != str){
+ buffer = this.unrender(context, buffer);
+ }
+ this._src = str;
+
+ // This can get reset in the above tag
+ if(!this._rendered){
+ this._rendered = true;
+ this._html = this._html || [];
+ var div = (this._div = this._div || document.createElement("div"));
+ div.innerHTML = str;
+ var children = div.childNodes;
+ while(children.length){
+ var removed = div.removeChild(children[0]);
+ this._html.push(removed);
+ buffer = buffer.concat(removed);
+ }
+ }
+
+ return buffer;
+ default:
+ return buffer;
+ }
+ },
+ unrender: function(context, buffer){
+ if(!this._rendered){
+ return buffer;
+ }
+ this._rendered = false;
+
+ // Unrender injected nodes
+ switch(this._type){
+ case "text":
+ return buffer.remove(this._txt);
+ case "injection":
+ return this._injection.unrender(context, buffer);
+ case "node":
+ if(this._node.parentNode === buffer.getParent()){
+ return buffer.remove(this._node);
+ }
+ return buffer;
+ case "html":
+ for(var i=0, l=this._html.length; i<l; i++){
+ buffer = buffer.remove(this._html[i]);
+ }
+ return buffer;
+ default:
+ return buffer;
+ }
+ },
+ clone: function(){
+ return new this.constructor(this.contents.getExpression());
+ }
+ });
+
+ dd.ChangeNode = dojo.extend(function(node, /*Boolean?*/ up, /*Bookean*/ root){
+ // summary: Changes the parent during render/unrender
+ this.contents = node;
+ this.up = up;
+ this.root = root;
+ },
+ {
+ render: function(context, buffer){
+ return buffer.setParent(this.contents, this.up, this.root);
+ },
+ unrender: function(context, buffer){
+ if(!buffer.getParent()){
+ return buffer;
+ }
+ return buffer.setParent(this.contents);
+ },
+ clone: function(){
+ return new this.constructor(this.contents, this.up, this.root);
+ }
+ });
+
+ dd.AttributeNode = dojo.extend(function(key, value){
+ // summary: Works on attributes
+ this.key = key;
+ this.value = value;
+ this.contents = value;
+ if(this._pool[value]){
+ this.nodelist = this._pool[value];
+ }else{
+ if(!(this.nodelist = dd.quickFilter(value))){
+ this.nodelist = (new dd.Template(value, true)).nodelist;
+ }
+ this._pool[value] = this.nodelist;
+ }
+
+ this.contents = "";
+ },
+ {
+ _pool: {},
+ render: function(context, buffer){
+ var key = this.key;
+ var value = this.nodelist.dummyRender(context);
+ if(dd.BOOLS[key]){
+ value = !(value == "false" || value == "undefined" || !value);
+ }
+ if(value !== this.contents){
+ this.contents = value;
+ return buffer.setAttribute(key, value);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ this.contents = "";
+ return buffer.remove(this.key);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.key, this.value);
+ }
+ });
+
+ dd._DomTextNode = dojo.extend(function(str){
+ // summary: Adds a straight text node without any processing
+ this.contents = document.createTextNode(str);
+ this.upcoming = str;
+ },
+ {
+ set: function(data){
+ this.upcoming = data;
+ return this;
+ },
+ render: function(context, buffer){
+ if(this.contents.data != this.upcoming){
+ var old = this.contents.data;
+ this.contents.data = this.upcoming;
+ buffer.onChangeData && buffer.onChangeData(this.contents, old, this.upcoming);
+ }
+ return buffer.concat(this.contents);
+ },
+ unrender: function(context, buffer){
+ return buffer.remove(this.contents);
+ },
+ isEmpty: function(){
+ return !dojo.trim(this.contents.data);
+ },
+ clone: function(){
+ return new this.constructor(this.contents.data);
+ }
+ });
+
+ dd._DomParser = dojo.extend(function(tokens){
+ // summary: Turn a simple array into a set of objects
+ // description:
+ // This is also used by all tags to move through
+ // the list of nodes.
+ this.contents = tokens;
+ },
+ {
+ i: 0,
+ parse: function(/*Array?*/ stop_at){
+ var terminators = {};
+ var tokens = this.contents;
+ if(!stop_at){
+ stop_at = [];
+ }
+ for(var i = 0; i < stop_at.length; i++){
+ terminators[stop_at[i]] = true;
+ }
+ var nodelist = new dd._DomNodeList();
+ while(this.i < tokens.length){
+ var token = tokens[this.i++];
+ var type = token[0];
+ var value = token[1];
+ if(type == dd.TOKEN_CUSTOM){
+ nodelist.push(value);
+ }else if(type == dd.TOKEN_CHANGE){
+ var changeNode = new dd.ChangeNode(value, token[2], token[3]);
+ value[changeNode.attr] = changeNode;
+ nodelist.push(changeNode);
+ }else if(type == dd.TOKEN_ATTR){
+ var fn = ddt.getTag("attr:" + token[2], true);
+ if(fn && token[3]){
+ if (token[3].indexOf("{%") != -1 || token[3].indexOf("{{") != -1) {
+ value.setAttribute(token[2], "");
+ }
+ nodelist.push(fn(null, new dd.Token(type, token[2] + " " + token[3])));
+ }else if(dojo.isString(token[3])){
+ if(token[2] == "style" || token[3].indexOf("{%") != -1 || token[3].indexOf("{{") != -1){
+ nodelist.push(new dd.AttributeNode(token[2], token[3]));
+ }else if(dojo.trim(token[3])){
+ try{
+ dojo.attr(value, token[2], token[3]);
+ }catch(e){}
+ }
+ }
+ }else if(type == dd.TOKEN_NODE){
+ var fn = ddt.getTag("node:" + value.tagName.toLowerCase(), true);
+ if(fn){
+ // TODO: We need to move this to tokenization so that it's before the
+ // node and the parser can be passed here instead of null
+ nodelist.push(fn(null, new dd.Token(type, value), value.tagName.toLowerCase()));
+ }
+ nodelist.push(new dd._DomNode(value));
+ }else if(type == dd.TOKEN_VAR){
+ nodelist.push(new dd._DomVarNode(value));
+ }else if(type == dd.TOKEN_TEXT){
+ nodelist.push(new dd._DomTextNode(value.data || value));
+ }else if(type == dd.TOKEN_BLOCK){
+ if(terminators[value]){
+ --this.i;
+ return nodelist;
+ }
+ var cmd = value.split(/\s+/g);
+ if(cmd.length){
+ cmd = cmd[0];
+ var fn = ddt.getTag(cmd);
+ if(typeof fn != "function"){
+ throw new Error("Function not found for " + cmd);
+ }
+ var tpl = fn(this, new dd.Token(type, value));
+ if(tpl){
+ nodelist.push(tpl);
+ }
+ }
+ }
+ }
+
+ if(stop_at.length){
+ throw new Error("Could not find closing tag(s): " + stop_at.toString());
+ }
+
+ return nodelist;
+ },
+ next_token: function(){
+ // summary: Returns the next token in the list.
+ var token = this.contents[this.i++];
+ return new dd.Token(token[0], token[1]);
+ },
+ delete_first_token: function(){
+ this.i++;
+ },
+ skip_past: function(endtag){
+ return dd._Parser.prototype.skip_past.call(this, endtag);
+ },
+ create_variable_node: function(expr){
+ return new dd._DomVarNode(expr);
+ },
+ create_text_node: function(expr){
+ return new dd._DomTextNode(expr || "");
+ },
+ getTemplate: function(/*String*/ loc){
+ return new dd.DomTemplate(ddh.getTemplate(loc));
+ }
+ });
+
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js b/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js new file mode 100644 index 0000000..e4e78ed --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js @@ -0,0 +1,40 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.ext-dojo.NodeList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.ext-dojo.NodeList"] = true;
+dojo.provide("dojox.dtl.ext-dojo.NodeList");
+dojo.require("dojox.dtl._base");
+
+dojo.extend(dojo.NodeList, {
+ dtl: function(template, context){
+ // template: dojox.dtl.__StringArgs|String
+ // The template string or location
+ // context: dojox.dtl.__ObjectArgs|Object
+ // The context object or location
+ var d = dojox.dtl;
+
+ var self = this;
+ var render = function(template, context){
+ var content = template.render(new d._Context(context));
+ self.forEach(function(node){
+ node.innerHTML = content;
+ });
+ }
+
+ d.text._resolveTemplateArg(template).addCallback(function(templateString){
+ template = new d.Template(templateString);
+ d.text._resolveContextArg(context).addCallback(function(context){
+ render(template, context);
+ });
+ });
+
+ return this;
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.xd.js b/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.xd.js new file mode 100644 index 0000000..8d51179 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.xd.js @@ -0,0 +1,45 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.ext-dojo.NodeList"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.ext-dojo.NodeList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.ext-dojo.NodeList"] = true;
+dojo.provide("dojox.dtl.ext-dojo.NodeList");
+dojo.require("dojox.dtl._base");
+
+dojo.extend(dojo.NodeList, {
+ dtl: function(template, context){
+ // template: dojox.dtl.__StringArgs|String
+ // The template string or location
+ // context: dojox.dtl.__ObjectArgs|Object
+ // The context object or location
+ var d = dojox.dtl;
+
+ var self = this;
+ var render = function(template, context){
+ var content = template.render(new d._Context(context));
+ self.forEach(function(node){
+ node.innerHTML = content;
+ });
+ }
+
+ d.text._resolveTemplateArg(template).addCallback(function(templateString){
+ template = new d.Template(templateString);
+ d.text._resolveContextArg(context).addCallback(function(context){
+ render(template, context);
+ });
+ });
+
+ return this;
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/filter/dates.js b/js/dojo-1.6/dojox/dtl/filter/dates.js new file mode 100644 index 0000000..2b8101a --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/dates.js @@ -0,0 +1,73 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.filter.dates"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.dates"] = true;
+dojo.provide("dojox.dtl.filter.dates");
+
+dojo.require("dojox.dtl.utils.date");
+
+(function(){
+ var ddfd = dojox.dtl.filter.dates;
+
+ dojo.mixin(ddfd, {
+ _toDate: function(value){
+ if(value instanceof Date){
+ return value;
+ }
+ value = new Date(value);
+ if(value.getTime() == new Date(0).getTime()){
+ return "";
+ }
+ return value;
+ },
+ date: function(value, arg){
+ // summary: Formats a date according to the given format
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ arg = arg || "N j, Y";
+ return dojox.dtl.utils.date.format(value, arg);
+ },
+ time: function(value, arg){
+ // summary: Formats a time according to the given format
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ arg = arg || "P";
+ return dojox.dtl.utils.date.format(value, arg);
+ },
+ timesince: function(value, arg){
+ // summary: Formats a date as the time since that date (i.e. "4 days, 6 hours")
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ var timesince = dojox.dtl.utils.date.timesince;
+ if(arg){
+ return timesince(arg, value);
+ }
+ return timesince(value);
+ },
+ timeuntil: function(value, arg){
+ // summary: Formats a date as the time until that date (i.e. "4 days, 6 hours")
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ var timesince = dojox.dtl.utils.date.timesince;
+ if(arg){
+ return timesince(arg, value);
+ }
+ return timesince(new Date(), value);
+ }
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/filter/dates.xd.js b/js/dojo-1.6/dojox/dtl/filter/dates.xd.js new file mode 100644 index 0000000..15559c1 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/dates.xd.js @@ -0,0 +1,78 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.filter.dates"],
+["require", "dojox.dtl.utils.date"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.filter.dates"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.dates"] = true;
+dojo.provide("dojox.dtl.filter.dates");
+
+dojo.require("dojox.dtl.utils.date");
+
+(function(){
+ var ddfd = dojox.dtl.filter.dates;
+
+ dojo.mixin(ddfd, {
+ _toDate: function(value){
+ if(value instanceof Date){
+ return value;
+ }
+ value = new Date(value);
+ if(value.getTime() == new Date(0).getTime()){
+ return "";
+ }
+ return value;
+ },
+ date: function(value, arg){
+ // summary: Formats a date according to the given format
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ arg = arg || "N j, Y";
+ return dojox.dtl.utils.date.format(value, arg);
+ },
+ time: function(value, arg){
+ // summary: Formats a time according to the given format
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ arg = arg || "P";
+ return dojox.dtl.utils.date.format(value, arg);
+ },
+ timesince: function(value, arg){
+ // summary: Formats a date as the time since that date (i.e. "4 days, 6 hours")
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ var timesince = dojox.dtl.utils.date.timesince;
+ if(arg){
+ return timesince(arg, value);
+ }
+ return timesince(value);
+ },
+ timeuntil: function(value, arg){
+ // summary: Formats a date as the time until that date (i.e. "4 days, 6 hours")
+ value = ddfd._toDate(value);
+ if(!value){
+ return "";
+ }
+ var timesince = dojox.dtl.utils.date.timesince;
+ if(arg){
+ return timesince(arg, value);
+ }
+ return timesince(new Date(), value);
+ }
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/filter/htmlstrings.js b/js/dojo-1.6/dojox/dtl/filter/htmlstrings.js new file mode 100644 index 0000000..658df5b --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/htmlstrings.js @@ -0,0 +1,56 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.filter.htmlstrings"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.htmlstrings"] = true;
+dojo.provide("dojox.dtl.filter.htmlstrings");
+
+dojo.require("dojox.dtl._base");
+
+dojo.mixin(dojox.dtl.filter.htmlstrings, {
+ _linebreaksrn: /(\r\n|\n\r)/g,
+ _linebreaksn: /\n{2,}/g,
+ _linebreakss: /(^\s+|\s+$)/g,
+ _linebreaksbr: /\n/g,
+ _removetagsfind: /[a-z0-9]+/g,
+ _striptags: /<[^>]*?>/g,
+ linebreaks: function(value){
+ // summary: Converts newlines into <p> and <br />s
+ var output = [];
+ var dh = dojox.dtl.filter.htmlstrings;
+ value = value.replace(dh._linebreaksrn, "\n");
+ var parts = value.split(dh._linebreaksn);
+ for(var i = 0; i < parts.length; i++){
+ var part = parts[i].replace(dh._linebreakss, "").replace(dh._linebreaksbr, "<br />");
+ output.push("<p>" + part + "</p>");
+ }
+
+ return output.join("\n\n");
+ },
+ linebreaksbr: function(value){
+ // summary: Converts newlines into <br />s
+ var dh = dojox.dtl.filter.htmlstrings;
+ return value.replace(dh._linebreaksrn, "\n").replace(dh._linebreaksbr, "<br />");
+ },
+ removetags: function(value, arg){
+ // summary: Removes a space separated list of [X]HTML tags from the output"
+ var dh = dojox.dtl.filter.htmlstrings;
+ var tags = [];
+ var group;
+ while(group = dh._removetagsfind.exec(arg)){
+ tags.push(group[0]);
+ }
+ tags = "(" + tags.join("|") + ")";
+ return value.replace(new RegExp("</?\s*" + tags + "\s*[^>]*>", "gi"), "");
+ },
+ striptags: function(value){
+ // summary: Strips all [X]HTML tags
+ return value.replace(dojox.dtl.filter.htmlstrings._striptags, "");
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/filter/htmlstrings.xd.js b/js/dojo-1.6/dojox/dtl/filter/htmlstrings.xd.js new file mode 100644 index 0000000..e262973 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/htmlstrings.xd.js @@ -0,0 +1,61 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.filter.htmlstrings"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.filter.htmlstrings"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.htmlstrings"] = true;
+dojo.provide("dojox.dtl.filter.htmlstrings");
+
+dojo.require("dojox.dtl._base");
+
+dojo.mixin(dojox.dtl.filter.htmlstrings, {
+ _linebreaksrn: /(\r\n|\n\r)/g,
+ _linebreaksn: /\n{2,}/g,
+ _linebreakss: /(^\s+|\s+$)/g,
+ _linebreaksbr: /\n/g,
+ _removetagsfind: /[a-z0-9]+/g,
+ _striptags: /<[^>]*?>/g,
+ linebreaks: function(value){
+ // summary: Converts newlines into <p> and <br />s
+ var output = [];
+ var dh = dojox.dtl.filter.htmlstrings;
+ value = value.replace(dh._linebreaksrn, "\n");
+ var parts = value.split(dh._linebreaksn);
+ for(var i = 0; i < parts.length; i++){
+ var part = parts[i].replace(dh._linebreakss, "").replace(dh._linebreaksbr, "<br />");
+ output.push("<p>" + part + "</p>");
+ }
+
+ return output.join("\n\n");
+ },
+ linebreaksbr: function(value){
+ // summary: Converts newlines into <br />s
+ var dh = dojox.dtl.filter.htmlstrings;
+ return value.replace(dh._linebreaksrn, "\n").replace(dh._linebreaksbr, "<br />");
+ },
+ removetags: function(value, arg){
+ // summary: Removes a space separated list of [X]HTML tags from the output"
+ var dh = dojox.dtl.filter.htmlstrings;
+ var tags = [];
+ var group;
+ while(group = dh._removetagsfind.exec(arg)){
+ tags.push(group[0]);
+ }
+ tags = "(" + tags.join("|") + ")";
+ return value.replace(new RegExp("</?\s*" + tags + "\s*[^>]*>", "gi"), "");
+ },
+ striptags: function(value){
+ // summary: Strips all [X]HTML tags
+ return value.replace(dojox.dtl.filter.htmlstrings._striptags, "");
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/filter/integers.js b/js/dojo-1.6/dojox/dtl/filter/integers.js new file mode 100644 index 0000000..9ff5659 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/integers.js @@ -0,0 +1,39 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.filter.integers"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.integers"] = true;
+dojo.provide("dojox.dtl.filter.integers");
+
+dojo.mixin(dojox.dtl.filter.integers, {
+ add: function(value, arg){
+ value = parseInt(value, 10);
+ arg = parseInt(arg, 10);
+ return isNaN(arg) ? value : value + arg;
+ },
+ get_digit: function(value, arg){
+ // summary:
+ // Given a whole number, returns the 1-based requested digit of it
+ // desciprtion:
+ // 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the
+ // original value for invalid input (if input or argument is not an integer,
+ // or if argument is less than 1). Otherwise, output is always an integer.
+ value = parseInt(value, 10);
+ arg = parseInt(arg, 10) - 1;
+ if(arg >= 0){
+ value += "";
+ if(arg < value.length){
+ value = parseInt(value.charAt(arg), 10);
+ }else{
+ value = 0;
+ }
+ }
+ return (isNaN(value) ? 0 : value);
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/filter/integers.xd.js b/js/dojo-1.6/dojox/dtl/filter/integers.xd.js new file mode 100644 index 0000000..dec205d --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/integers.xd.js @@ -0,0 +1,43 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.filter.integers"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.filter.integers"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.integers"] = true;
+dojo.provide("dojox.dtl.filter.integers");
+
+dojo.mixin(dojox.dtl.filter.integers, {
+ add: function(value, arg){
+ value = parseInt(value, 10);
+ arg = parseInt(arg, 10);
+ return isNaN(arg) ? value : value + arg;
+ },
+ get_digit: function(value, arg){
+ // summary:
+ // Given a whole number, returns the 1-based requested digit of it
+ // desciprtion:
+ // 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the
+ // original value for invalid input (if input or argument is not an integer,
+ // or if argument is less than 1). Otherwise, output is always an integer.
+ value = parseInt(value, 10);
+ arg = parseInt(arg, 10) - 1;
+ if(arg >= 0){
+ value += "";
+ if(arg < value.length){
+ value = parseInt(value.charAt(arg), 10);
+ }else{
+ value = 0;
+ }
+ }
+ return (isNaN(value) ? 0 : value);
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/filter/lists.js b/js/dojo-1.6/dojox/dtl/filter/lists.js new file mode 100644 index 0000000..34d791d --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/lists.js @@ -0,0 +1,148 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.filter.lists"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.lists"] = true;
+dojo.provide("dojox.dtl.filter.lists");
+
+dojo.require("dojox.dtl._base");
+
+dojo.mixin(dojox.dtl.filter.lists, {
+ _dictsort: function(a, b){
+ if(a[0] == b[0]){
+ return 0;
+ }
+ return (a[0] < b[0]) ? -1 : 1;
+ },
+ dictsort: function(value, arg){
+ // summary: Takes a list of dicts, returns that list sorted by the property given in the argument.
+ if(!arg){
+ return value;
+ }
+
+ var i, item, items = [];
+ if(!dojo.isArray(value)){
+ var obj = value, value = [];
+ for(var key in obj){
+ value.push(obj[key]);
+ }
+ }
+ for(i = 0; i < value.length; i++){
+ items.push([new dojox.dtl._Filter('var.' + arg).resolve(new dojox.dtl._Context({ 'var' : value[i]})), value[i]]);
+ }
+ items.sort(dojox.dtl.filter.lists._dictsort);
+ var output = [];
+ for(i = 0; item = items[i]; i++){
+ output.push(item[1]);
+ }
+ return output;
+ },
+ dictsortreversed: function(value, arg){
+ // summary: Takes a list of dicts, returns that list sorted in reverse order by the property given in the argument.
+ if(!arg) return value;
+
+ var dictsort = dojox.dtl.filter.lists.dictsort(value, arg);
+ return dictsort.reverse();
+ },
+ first: function(value){
+ // summary: Returns the first item in a list
+ return (value.length) ? value[0] : "";
+ },
+ join: function(value, arg){
+ // summary: Joins a list with a string, like Python's ``str.join(list)``
+ // description:
+ // Django throws a compile error, but JS can't do arg checks
+ // so we're left with run time errors, which aren't wise for something
+ // as trivial here as an empty arg.
+ return value.join(arg || ",");
+ },
+ length: function(value){
+ // summary: Returns the length of the value - useful for lists
+ return (isNaN(value.length)) ? (value + "").length : value.length;
+ },
+ length_is: function(value, arg){
+ // summary: Returns a boolean of whether the value's length is the argument
+ return value.length == parseInt(arg);
+ },
+ random: function(value){
+ // summary: Returns a random item from the list
+ return value[Math.floor(Math.random() * value.length)];
+ },
+ slice: function(value, arg){
+ // summary: Returns a slice of the list.
+ // description:
+ // Uses the same syntax as Python's list slicing; see
+ // http://diveintopython.org/native_data_types/lists.html#odbchelper.list.slice
+ // for an introduction.
+ // Also uses the optional third value to denote every X item.
+ arg = arg || "";
+ var parts = arg.split(":");
+ var bits = [];
+ for(var i = 0; i < parts.length; i++){
+ if(!parts[i].length){
+ bits.push(null);
+ }else{
+ bits.push(parseInt(parts[i]));
+ }
+ }
+
+ if(bits[0] === null){
+ bits[0] = 0;
+ }
+ if(bits[0] < 0){
+ bits[0] = value.length + bits[0];
+ }
+ if(bits.length < 2 || bits[1] === null){
+ bits[1] = value.length;
+ }
+ if(bits[1] < 0){
+ bits[1] = value.length + bits[1];
+ }
+
+ return value.slice(bits[0], bits[1]);
+ },
+ _unordered_list: function(value, tabs){
+ var ddl = dojox.dtl.filter.lists;
+ var i, indent = "";
+ for(i = 0; i < tabs; i++){
+ indent += "\t";
+ }
+ if(value[1] && value[1].length){
+ var recurse = [];
+ for(i = 0; i < value[1].length; i++){
+ recurse.push(ddl._unordered_list(value[1][i], tabs + 1))
+ }
+ return indent + "<li>" + value[0] + "\n" + indent + "<ul>\n" + recurse.join("\n") + "\n" + indent + "</ul>\n" + indent + "</li>";
+ }else{
+ return indent + "<li>" + value[0] + "</li>";
+ }
+ },
+ unordered_list: function(value){
+ // summary:
+ // Recursively takes a self-nested list and returns an HTML unordered list --
+ // WITHOUT opening and closing <ul> tags.
+ // description:
+ // The list is assumed to be in the proper format. For example, if ``var`` contains
+ // ``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``,
+ // then ``{{ var|unordered_list }}`` would return::
+ //
+ // | <li>States
+ // | <ul>
+ // | <li>Kansas
+ // | <ul>
+ // | <li>Lawrence</li>
+ // | <li>Topeka</li>
+ // | </ul>
+ // | </li>
+ // | <li>Illinois</li>
+ // | </ul>
+ // | </li>
+ return dojox.dtl.filter.lists._unordered_list(value, 1);
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/filter/lists.xd.js b/js/dojo-1.6/dojox/dtl/filter/lists.xd.js new file mode 100644 index 0000000..52e0ecf --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/lists.xd.js @@ -0,0 +1,153 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.filter.lists"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.filter.lists"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.lists"] = true;
+dojo.provide("dojox.dtl.filter.lists");
+
+dojo.require("dojox.dtl._base");
+
+dojo.mixin(dojox.dtl.filter.lists, {
+ _dictsort: function(a, b){
+ if(a[0] == b[0]){
+ return 0;
+ }
+ return (a[0] < b[0]) ? -1 : 1;
+ },
+ dictsort: function(value, arg){
+ // summary: Takes a list of dicts, returns that list sorted by the property given in the argument.
+ if(!arg){
+ return value;
+ }
+
+ var i, item, items = [];
+ if(!dojo.isArray(value)){
+ var obj = value, value = [];
+ for(var key in obj){
+ value.push(obj[key]);
+ }
+ }
+ for(i = 0; i < value.length; i++){
+ items.push([new dojox.dtl._Filter('var.' + arg).resolve(new dojox.dtl._Context({ 'var' : value[i]})), value[i]]);
+ }
+ items.sort(dojox.dtl.filter.lists._dictsort);
+ var output = [];
+ for(i = 0; item = items[i]; i++){
+ output.push(item[1]);
+ }
+ return output;
+ },
+ dictsortreversed: function(value, arg){
+ // summary: Takes a list of dicts, returns that list sorted in reverse order by the property given in the argument.
+ if(!arg) return value;
+
+ var dictsort = dojox.dtl.filter.lists.dictsort(value, arg);
+ return dictsort.reverse();
+ },
+ first: function(value){
+ // summary: Returns the first item in a list
+ return (value.length) ? value[0] : "";
+ },
+ join: function(value, arg){
+ // summary: Joins a list with a string, like Python's ``str.join(list)``
+ // description:
+ // Django throws a compile error, but JS can't do arg checks
+ // so we're left with run time errors, which aren't wise for something
+ // as trivial here as an empty arg.
+ return value.join(arg || ",");
+ },
+ length: function(value){
+ // summary: Returns the length of the value - useful for lists
+ return (isNaN(value.length)) ? (value + "").length : value.length;
+ },
+ length_is: function(value, arg){
+ // summary: Returns a boolean of whether the value's length is the argument
+ return value.length == parseInt(arg);
+ },
+ random: function(value){
+ // summary: Returns a random item from the list
+ return value[Math.floor(Math.random() * value.length)];
+ },
+ slice: function(value, arg){
+ // summary: Returns a slice of the list.
+ // description:
+ // Uses the same syntax as Python's list slicing; see
+ // http://diveintopython.org/native_data_types/lists.html#odbchelper.list.slice
+ // for an introduction.
+ // Also uses the optional third value to denote every X item.
+ arg = arg || "";
+ var parts = arg.split(":");
+ var bits = [];
+ for(var i = 0; i < parts.length; i++){
+ if(!parts[i].length){
+ bits.push(null);
+ }else{
+ bits.push(parseInt(parts[i]));
+ }
+ }
+
+ if(bits[0] === null){
+ bits[0] = 0;
+ }
+ if(bits[0] < 0){
+ bits[0] = value.length + bits[0];
+ }
+ if(bits.length < 2 || bits[1] === null){
+ bits[1] = value.length;
+ }
+ if(bits[1] < 0){
+ bits[1] = value.length + bits[1];
+ }
+
+ return value.slice(bits[0], bits[1]);
+ },
+ _unordered_list: function(value, tabs){
+ var ddl = dojox.dtl.filter.lists;
+ var i, indent = "";
+ for(i = 0; i < tabs; i++){
+ indent += "\t";
+ }
+ if(value[1] && value[1].length){
+ var recurse = [];
+ for(i = 0; i < value[1].length; i++){
+ recurse.push(ddl._unordered_list(value[1][i], tabs + 1))
+ }
+ return indent + "<li>" + value[0] + "\n" + indent + "<ul>\n" + recurse.join("\n") + "\n" + indent + "</ul>\n" + indent + "</li>";
+ }else{
+ return indent + "<li>" + value[0] + "</li>";
+ }
+ },
+ unordered_list: function(value){
+ // summary:
+ // Recursively takes a self-nested list and returns an HTML unordered list --
+ // WITHOUT opening and closing <ul> tags.
+ // description:
+ // The list is assumed to be in the proper format. For example, if ``var`` contains
+ // ``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``,
+ // then ``{{ var|unordered_list }}`` would return::
+ //
+ // | <li>States
+ // | <ul>
+ // | <li>Kansas
+ // | <ul>
+ // | <li>Lawrence</li>
+ // | <li>Topeka</li>
+ // | </ul>
+ // | </li>
+ // | <li>Illinois</li>
+ // | </ul>
+ // | </li>
+ return dojox.dtl.filter.lists._unordered_list(value, 1);
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/filter/logic.js b/js/dojo-1.6/dojox/dtl/filter/logic.js new file mode 100644 index 0000000..53bd9b3 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/logic.js @@ -0,0 +1,47 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.filter.logic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.logic"] = true;
+dojo.provide("dojox.dtl.filter.logic");
+
+dojo.mixin(dojox.dtl.filter.logic, {
+ default_: function(value, arg){
+ // summary: If value is unavailable, use given default
+ return value || arg || "";
+ },
+ default_if_none: function(value, arg){
+ // summary: If value is null, use given default
+ return (value === null) ? arg || "" : value || "";
+ },
+ divisibleby: function(value, arg){
+ // summary: Returns true if the value is devisible by the argument"
+ return (parseInt(value, 10) % parseInt(arg, 10)) === 0;
+ },
+ _yesno: /\s*,\s*/g,
+ yesno: function(value, arg){
+ // summary:
+ // arg being a comma-delimited string, value of true/false/none
+ // chooses the appropriate item from the string
+ if(!arg){
+ arg = 'yes,no,maybe';
+ }
+ var parts = arg.split(dojox.dtl.filter.logic._yesno);
+ if(parts.length < 2){
+ return value;
+ }
+ if(value){
+ return parts[0];
+ }
+ if((!value && value !== null) || parts.length < 3){
+ return parts[1];
+ }
+ return parts[2];
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/filter/logic.xd.js b/js/dojo-1.6/dojox/dtl/filter/logic.xd.js new file mode 100644 index 0000000..ffe111a --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/logic.xd.js @@ -0,0 +1,51 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.filter.logic"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.filter.logic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.logic"] = true;
+dojo.provide("dojox.dtl.filter.logic");
+
+dojo.mixin(dojox.dtl.filter.logic, {
+ default_: function(value, arg){
+ // summary: If value is unavailable, use given default
+ return value || arg || "";
+ },
+ default_if_none: function(value, arg){
+ // summary: If value is null, use given default
+ return (value === null) ? arg || "" : value || "";
+ },
+ divisibleby: function(value, arg){
+ // summary: Returns true if the value is devisible by the argument"
+ return (parseInt(value, 10) % parseInt(arg, 10)) === 0;
+ },
+ _yesno: /\s*,\s*/g,
+ yesno: function(value, arg){
+ // summary:
+ // arg being a comma-delimited string, value of true/false/none
+ // chooses the appropriate item from the string
+ if(!arg){
+ arg = 'yes,no,maybe';
+ }
+ var parts = arg.split(dojox.dtl.filter.logic._yesno);
+ if(parts.length < 2){
+ return value;
+ }
+ if(value){
+ return parts[0];
+ }
+ if((!value && value !== null) || parts.length < 3){
+ return parts[1];
+ }
+ return parts[2];
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/filter/misc.js b/js/dojo-1.6/dojox/dtl/filter/misc.js new file mode 100644 index 0000000..583a98e --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/misc.js @@ -0,0 +1,66 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.filter.misc"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.misc"] = true;
+dojo.provide("dojox.dtl.filter.misc");
+
+dojo.mixin(dojox.dtl.filter.misc, {
+ filesizeformat: function(value){
+ // summary: Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102bytes, etc).
+ value = parseFloat(value);
+ if(value < 1024){
+ return (value == 1) ? value + " byte" : value + " bytes";
+ }else if(value < 1024 * 1024){
+ return (value / 1024).toFixed(1) + " KB";
+ }else if(value < 1024 * 1024 * 1024){
+ return (value / 1024 / 1024).toFixed(1) + " MB";
+ }
+ return (value / 1024 / 1024 / 1024).toFixed(1) + " GB";
+ },
+ pluralize: function(value, arg){
+ // summary:
+ // Returns a plural suffix if the value is not 1, for '1 vote' vs. '2 votes'
+ // description:
+ // By default, 's' is used as a suffix; if an argument is provided, that string
+ // is used instead. If the provided argument contains a comma, the text before
+ // the comma is used for the singular case.
+ arg = arg || 's';
+ if(arg.indexOf(",") == -1){
+ arg = "," + arg;
+ }
+ var parts = arg.split(",");
+ if(parts.length > 2){
+ return "";
+ }
+ var singular = parts[0];
+ var plural = parts[1];
+
+ if(parseInt(value, 10) != 1){
+ return plural;
+ }
+ return singular;
+ },
+ _phone2numeric: { a: 2, b: 2, c: 2, d: 3, e: 3, f: 3, g: 4, h: 4, i: 4, j: 5, k: 5, l: 5, m: 6, n: 6, o: 6, p: 7, r: 7, s: 7, t: 8, u: 8, v: 8, w: 9, x: 9, y: 9 },
+ phone2numeric: function(value){
+ // summary: Takes a phone number and converts it in to its numerical equivalent
+ var dm = dojox.dtl.filter.misc;
+ value = value + "";
+ var output = "";
+ for(var i = 0; i < value.length; i++){
+ var chr = value.charAt(i).toLowerCase();
+ (dm._phone2numeric[chr]) ? output += dm._phone2numeric[chr] : output += value.charAt(i);
+ }
+ return output;
+ },
+ pprint: function(value){
+ // summary: A wrapper around toJson unless something better comes along
+ return dojo.toJson(value);
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/filter/misc.xd.js b/js/dojo-1.6/dojox/dtl/filter/misc.xd.js new file mode 100644 index 0000000..9559837 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/misc.xd.js @@ -0,0 +1,70 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.filter.misc"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.filter.misc"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.misc"] = true;
+dojo.provide("dojox.dtl.filter.misc");
+
+dojo.mixin(dojox.dtl.filter.misc, {
+ filesizeformat: function(value){
+ // summary: Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102bytes, etc).
+ value = parseFloat(value);
+ if(value < 1024){
+ return (value == 1) ? value + " byte" : value + " bytes";
+ }else if(value < 1024 * 1024){
+ return (value / 1024).toFixed(1) + " KB";
+ }else if(value < 1024 * 1024 * 1024){
+ return (value / 1024 / 1024).toFixed(1) + " MB";
+ }
+ return (value / 1024 / 1024 / 1024).toFixed(1) + " GB";
+ },
+ pluralize: function(value, arg){
+ // summary:
+ // Returns a plural suffix if the value is not 1, for '1 vote' vs. '2 votes'
+ // description:
+ // By default, 's' is used as a suffix; if an argument is provided, that string
+ // is used instead. If the provided argument contains a comma, the text before
+ // the comma is used for the singular case.
+ arg = arg || 's';
+ if(arg.indexOf(",") == -1){
+ arg = "," + arg;
+ }
+ var parts = arg.split(",");
+ if(parts.length > 2){
+ return "";
+ }
+ var singular = parts[0];
+ var plural = parts[1];
+
+ if(parseInt(value, 10) != 1){
+ return plural;
+ }
+ return singular;
+ },
+ _phone2numeric: { a: 2, b: 2, c: 2, d: 3, e: 3, f: 3, g: 4, h: 4, i: 4, j: 5, k: 5, l: 5, m: 6, n: 6, o: 6, p: 7, r: 7, s: 7, t: 8, u: 8, v: 8, w: 9, x: 9, y: 9 },
+ phone2numeric: function(value){
+ // summary: Takes a phone number and converts it in to its numerical equivalent
+ var dm = dojox.dtl.filter.misc;
+ value = value + "";
+ var output = "";
+ for(var i = 0; i < value.length; i++){
+ var chr = value.charAt(i).toLowerCase();
+ (dm._phone2numeric[chr]) ? output += dm._phone2numeric[chr] : output += value.charAt(i);
+ }
+ return output;
+ },
+ pprint: function(value){
+ // summary: A wrapper around toJson unless something better comes along
+ return dojo.toJson(value);
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/filter/strings.js b/js/dojo-1.6/dojox/dtl/filter/strings.js new file mode 100644 index 0000000..59a2544 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/strings.js @@ -0,0 +1,336 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.filter.strings"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.strings"] = true;
+dojo.provide("dojox.dtl.filter.strings");
+
+dojo.require("dojox.dtl.filter.htmlstrings");
+dojo.require("dojox.string.sprintf");
+dojo.require("dojox.string.tokenize");
+
+dojo.mixin(dojox.dtl.filter.strings, {
+ _urlquote: function(/*String*/ url, /*String?*/ safe){
+ if(!safe){
+ safe = "/";
+ }
+ return dojox.string.tokenize(url, /([^\w-_.])/g, function(token){
+ if(safe.indexOf(token) == -1){
+ if(token == " "){
+ return "+";
+ }else{
+ return "%" + token.charCodeAt(0).toString(16).toUpperCase();
+ }
+ }
+ return token;
+ }).join("");
+ },
+ addslashes: function(value){
+ // summary: Adds slashes - useful for passing strings to JavaScript, for example.
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/'/g, "\\'");
+ },
+ capfirst: function(value){
+ // summary: Capitalizes the first character of the value
+ value = "" + value;
+ return value.charAt(0).toUpperCase() + value.substring(1);
+ },
+ center: function(value, arg){
+ // summary: Centers the value in a field of a given width
+ arg = arg || value.length;
+ value = value + "";
+ var diff = arg - value.length;
+ if(diff % 2){
+ value = value + " ";
+ diff -= 1;
+ }
+ for(var i = 0; i < diff; i += 2){
+ value = " " + value + " ";
+ }
+ return value;
+ },
+ cut: function(value, arg){
+ // summary: Removes all values of arg from the given string
+ arg = arg + "" || "";
+ value = value + "";
+ return value.replace(new RegExp(arg, "g"), "");
+ },
+ _fix_ampersands: /&(?!(\w+|#\d+);)/g,
+ fix_ampersands: function(value){
+ // summary: Replaces ampersands with ``&`` entities
+ return value.replace(dojox.dtl.filter.strings._fix_ampersands, "&");
+ },
+ floatformat: function(value, arg){
+ // summary: Format a number according to arg
+ // description:
+ // If called without an argument, displays a floating point
+ // number as 34.2 -- but only if there's a point to be displayed.
+ // With a positive numeric argument, it displays that many decimal places
+ // always.
+ // With a negative numeric argument, it will display that many decimal
+ // places -- but only if there's places to be displayed.
+ arg = parseInt(arg || -1, 10);
+ value = parseFloat(value);
+ var m = value - value.toFixed(0);
+ if(!m && arg < 0){
+ return value.toFixed();
+ }
+ value = value.toFixed(Math.abs(arg));
+ return (arg < 0) ? parseFloat(value) + "" : value;
+ },
+ iriencode: function(value){
+ return dojox.dtl.filter.strings._urlquote(value, "/#%[]=:;$&()+,!");
+ },
+ linenumbers: function(value){
+ // summary: Displays text with line numbers
+ var df = dojox.dtl.filter;
+ var lines = value.split("\n");
+ var output = [];
+ var width = (lines.length + "").length;
+ for(var i = 0, line; i < lines.length; i++){
+ line = lines[i];
+ output.push(df.strings.ljust(i + 1, width) + ". " + dojox.dtl._base.escape(line));
+ }
+ return output.join("\n");
+ },
+ ljust: function(value, arg){
+ value = value + "";
+ arg = parseInt(arg, 10);
+ while(value.length < arg){
+ value = value + " ";
+ }
+ return value;
+ },
+ lower: function(value){
+ // summary: Converts a string into all lowercase
+ return (value + "").toLowerCase();
+ },
+ make_list: function(value){
+ // summary:
+ // Returns the value turned into a list. For an integer, it's a list of
+ // digits. For a string, it's a list of characters.
+ var output = [];
+ if(typeof value == "number"){
+ value = value + "";
+ }
+ if(value.charAt){
+ for(var i = 0; i < value.length; i++){
+ output.push(value.charAt(i));
+ }
+ return output;
+ }
+ if(typeof value == "object"){
+ for(var key in value){
+ output.push(value[key]);
+ }
+ return output;
+ }
+ return [];
+ },
+ rjust: function(value, arg){
+ value = value + "";
+ arg = parseInt(arg, 10);
+ while(value.length < arg){
+ value = " " + value;
+ }
+ return value;
+ },
+ slugify: function(value){
+ // summary: Converts to lowercase, removes
+ // non-alpha chars and converts spaces to hyphens
+ value = value.replace(/[^\w\s-]/g, "").toLowerCase();
+ return value.replace(/[\-\s]+/g, "-");
+ },
+ _strings: {},
+ stringformat: function(value, arg){
+ // summary:
+ // Formats the variable according to the argument, a string formatting specifier.
+ // This specifier uses Python string formating syntax, with the exception that
+ // the leading "%" is dropped.
+ arg = "" + arg;
+ var strings = dojox.dtl.filter.strings._strings;
+ if(!strings[arg]){
+ strings[arg] = new dojox.string.sprintf.Formatter("%" + arg);
+ }
+ return strings[arg].format(value);
+ },
+ title: function(value){
+ // summary: Converts a string into titlecase
+ var last, title = "";
+ for(var i = 0, current; i < value.length; i++){
+ current = value.charAt(i);
+ if(last == " " || last == "\n" || last == "\t" || !last){
+ title += current.toUpperCase();
+ }else{
+ title += current.toLowerCase();
+ }
+ last = current;
+ }
+ return title;
+ },
+ _truncatewords: /[ \n\r\t]/,
+ truncatewords: function(value, arg){
+ // summary: Truncates a string after a certain number of words
+ // arg: Integer
+ // Number of words to truncate after
+ arg = parseInt(arg, 10);
+ if(!arg){
+ return value;
+ }
+
+ for(var i = 0, j = value.length, count = 0, current, last; i < value.length; i++){
+ current = value.charAt(i);
+ if(dojox.dtl.filter.strings._truncatewords.test(last)){
+ if(!dojox.dtl.filter.strings._truncatewords.test(current)){
+ ++count;
+ if(count == arg){
+ return value.substring(0, j + 1);
+ }
+ }
+ }else if(!dojox.dtl.filter.strings._truncatewords.test(current)){
+ j = i;
+ }
+ last = current;
+ }
+ return value;
+ },
+ _truncate_words: /(&.*?;|<.*?>|(\w[\w\-]*))/g,
+ _truncate_tag: /<(\/)?([^ ]+?)(?: (\/)| .*?)?>/,
+ _truncate_singlets: { br: true, col: true, link: true, base: true, img: true, param: true, area: true, hr: true, input: true },
+ truncatewords_html: function(value, arg){
+ arg = parseInt(arg, 10);
+
+ if(arg <= 0){
+ return "";
+ }
+
+ var strings = dojox.dtl.filter.strings;
+ var words = 0;
+ var open = [];
+
+ var output = dojox.string.tokenize(value, strings._truncate_words, function(all, word){
+ if(word){
+ // It's an actual non-HTML word
+ ++words;
+ if(words < arg){
+ return word;
+ }else if(words == arg){
+ return word + " ...";
+ }
+ }
+ // Check for tag
+ var tag = all.match(strings._truncate_tag);
+ if(!tag || words >= arg){
+ // Don't worry about non tags or tags after our truncate point
+ return;
+ }
+ var closing = tag[1];
+ var tagname = tag[2].toLowerCase();
+ var selfclosing = tag[3];
+ if(closing || strings._truncate_singlets[tagname]){
+ }else if(closing){
+ var i = dojo.indexOf(open, tagname);
+ if(i != -1){
+ open = open.slice(i + 1);
+ }
+ }else{
+ open.unshift(tagname);
+ }
+ return all;
+ }).join("");
+
+ output = output.replace(/\s+$/g, "");
+
+ for(var i = 0, tag; tag = open[i]; i++){
+ output += "</" + tag + ">";
+ }
+
+ return output;
+ },
+ upper: function(value){
+ return value.toUpperCase();
+ },
+ urlencode: function(value){
+ return dojox.dtl.filter.strings._urlquote(value);
+ },
+ _urlize: /^((?:[(>]|<)*)(.*?)((?:[.,)>\n]|>)*)$/,
+ _urlize2: /^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$/,
+ urlize: function(value){
+ return dojox.dtl.filter.strings.urlizetrunc(value);
+ },
+ urlizetrunc: function(value, arg){
+ arg = parseInt(arg);
+ return dojox.string.tokenize(value, /(\S+)/g, function(word){
+ var matches = dojox.dtl.filter.strings._urlize.exec(word);
+ if(!matches){
+ return word;
+ }
+ var lead = matches[1];
+ var middle = matches[2];
+ var trail = matches[3];
+
+ var startsWww = middle.indexOf("www.") == 0;
+ var hasAt = middle.indexOf("@") != -1;
+ var hasColon = middle.indexOf(":") != -1;
+ var startsHttp = middle.indexOf("http://") == 0;
+ var startsHttps = middle.indexOf("https://") == 0;
+ var firstAlpha = /[a-zA-Z0-9]/.test(middle.charAt(0));
+ var last4 = middle.substring(middle.length - 4);
+
+ var trimmed = middle;
+ if(arg > 3){
+ trimmed = trimmed.substring(0, arg - 3) + "...";
+ }
+
+ if(startsWww || (!hasAt && !startsHttp && middle.length && firstAlpha && (last4 == ".org" || last4 == ".net" || last4 == ".com"))){
+ return '<a href="http://' + middle + '" rel="nofollow">' + trimmed + '</a>';
+ }else if(startsHttp || startsHttps){
+ return '<a href="' + middle + '" rel="nofollow">' + trimmed + '</a>';
+ }else if(hasAt && !startsWww && !hasColon && dojox.dtl.filter.strings._urlize2.test(middle)){
+ return '<a href="mailto:' + middle + '">' + middle + '</a>';
+ }
+ return word;
+ }).join("");
+ },
+ wordcount: function(value){
+ value = dojo.trim(value);
+ if(!value){ return 0; }
+ return value.split(/\s+/g).length;
+ },
+ wordwrap: function(value, arg){
+ arg = parseInt(arg);
+ // summary: Wraps words at specified line length
+ var output = [];
+ var parts = value.split(/\s+/g);
+ if(parts.length){
+ var word = parts.shift();
+ output.push(word);
+ var pos = word.length - word.lastIndexOf("\n") - 1;
+ for(var i = 0; i < parts.length; i++){
+ word = parts[i];
+ if(word.indexOf("\n") != -1){
+ var lines = word.split(/\n/g);
+ }else{
+ var lines = [word];
+ }
+ pos += lines[0].length + 1;
+ if(arg && pos > arg){
+ output.push("\n");
+ pos = lines[lines.length - 1].length;
+ }else{
+ output.push(" ");
+ if(lines.length > 1){
+ pos = lines[lines.length - 1].length;
+ }
+ }
+ output.push(word);
+ }
+ }
+ return output.join("");
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/filter/strings.xd.js b/js/dojo-1.6/dojox/dtl/filter/strings.xd.js new file mode 100644 index 0000000..147910e --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/filter/strings.xd.js @@ -0,0 +1,343 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.filter.strings"],
+["require", "dojox.dtl.filter.htmlstrings"],
+["require", "dojox.string.sprintf"],
+["require", "dojox.string.tokenize"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.filter.strings"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.filter.strings"] = true;
+dojo.provide("dojox.dtl.filter.strings");
+
+dojo.require("dojox.dtl.filter.htmlstrings");
+dojo.require("dojox.string.sprintf");
+dojo.require("dojox.string.tokenize");
+
+dojo.mixin(dojox.dtl.filter.strings, {
+ _urlquote: function(/*String*/ url, /*String?*/ safe){
+ if(!safe){
+ safe = "/";
+ }
+ return dojox.string.tokenize(url, /([^\w-_.])/g, function(token){
+ if(safe.indexOf(token) == -1){
+ if(token == " "){
+ return "+";
+ }else{
+ return "%" + token.charCodeAt(0).toString(16).toUpperCase();
+ }
+ }
+ return token;
+ }).join("");
+ },
+ addslashes: function(value){
+ // summary: Adds slashes - useful for passing strings to JavaScript, for example.
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/'/g, "\\'");
+ },
+ capfirst: function(value){
+ // summary: Capitalizes the first character of the value
+ value = "" + value;
+ return value.charAt(0).toUpperCase() + value.substring(1);
+ },
+ center: function(value, arg){
+ // summary: Centers the value in a field of a given width
+ arg = arg || value.length;
+ value = value + "";
+ var diff = arg - value.length;
+ if(diff % 2){
+ value = value + " ";
+ diff -= 1;
+ }
+ for(var i = 0; i < diff; i += 2){
+ value = " " + value + " ";
+ }
+ return value;
+ },
+ cut: function(value, arg){
+ // summary: Removes all values of arg from the given string
+ arg = arg + "" || "";
+ value = value + "";
+ return value.replace(new RegExp(arg, "g"), "");
+ },
+ _fix_ampersands: /&(?!(\w+|#\d+);)/g,
+ fix_ampersands: function(value){
+ // summary: Replaces ampersands with ``&`` entities
+ return value.replace(dojox.dtl.filter.strings._fix_ampersands, "&");
+ },
+ floatformat: function(value, arg){
+ // summary: Format a number according to arg
+ // description:
+ // If called without an argument, displays a floating point
+ // number as 34.2 -- but only if there's a point to be displayed.
+ // With a positive numeric argument, it displays that many decimal places
+ // always.
+ // With a negative numeric argument, it will display that many decimal
+ // places -- but only if there's places to be displayed.
+ arg = parseInt(arg || -1, 10);
+ value = parseFloat(value);
+ var m = value - value.toFixed(0);
+ if(!m && arg < 0){
+ return value.toFixed();
+ }
+ value = value.toFixed(Math.abs(arg));
+ return (arg < 0) ? parseFloat(value) + "" : value;
+ },
+ iriencode: function(value){
+ return dojox.dtl.filter.strings._urlquote(value, "/#%[]=:;$&()+,!");
+ },
+ linenumbers: function(value){
+ // summary: Displays text with line numbers
+ var df = dojox.dtl.filter;
+ var lines = value.split("\n");
+ var output = [];
+ var width = (lines.length + "").length;
+ for(var i = 0, line; i < lines.length; i++){
+ line = lines[i];
+ output.push(df.strings.ljust(i + 1, width) + ". " + dojox.dtl._base.escape(line));
+ }
+ return output.join("\n");
+ },
+ ljust: function(value, arg){
+ value = value + "";
+ arg = parseInt(arg, 10);
+ while(value.length < arg){
+ value = value + " ";
+ }
+ return value;
+ },
+ lower: function(value){
+ // summary: Converts a string into all lowercase
+ return (value + "").toLowerCase();
+ },
+ make_list: function(value){
+ // summary:
+ // Returns the value turned into a list. For an integer, it's a list of
+ // digits. For a string, it's a list of characters.
+ var output = [];
+ if(typeof value == "number"){
+ value = value + "";
+ }
+ if(value.charAt){
+ for(var i = 0; i < value.length; i++){
+ output.push(value.charAt(i));
+ }
+ return output;
+ }
+ if(typeof value == "object"){
+ for(var key in value){
+ output.push(value[key]);
+ }
+ return output;
+ }
+ return [];
+ },
+ rjust: function(value, arg){
+ value = value + "";
+ arg = parseInt(arg, 10);
+ while(value.length < arg){
+ value = " " + value;
+ }
+ return value;
+ },
+ slugify: function(value){
+ // summary: Converts to lowercase, removes
+ // non-alpha chars and converts spaces to hyphens
+ value = value.replace(/[^\w\s-]/g, "").toLowerCase();
+ return value.replace(/[\-\s]+/g, "-");
+ },
+ _strings: {},
+ stringformat: function(value, arg){
+ // summary:
+ // Formats the variable according to the argument, a string formatting specifier.
+ // This specifier uses Python string formating syntax, with the exception that
+ // the leading "%" is dropped.
+ arg = "" + arg;
+ var strings = dojox.dtl.filter.strings._strings;
+ if(!strings[arg]){
+ strings[arg] = new dojox.string.sprintf.Formatter("%" + arg);
+ }
+ return strings[arg].format(value);
+ },
+ title: function(value){
+ // summary: Converts a string into titlecase
+ var last, title = "";
+ for(var i = 0, current; i < value.length; i++){
+ current = value.charAt(i);
+ if(last == " " || last == "\n" || last == "\t" || !last){
+ title += current.toUpperCase();
+ }else{
+ title += current.toLowerCase();
+ }
+ last = current;
+ }
+ return title;
+ },
+ _truncatewords: /[ \n\r\t]/,
+ truncatewords: function(value, arg){
+ // summary: Truncates a string after a certain number of words
+ // arg: Integer
+ // Number of words to truncate after
+ arg = parseInt(arg, 10);
+ if(!arg){
+ return value;
+ }
+
+ for(var i = 0, j = value.length, count = 0, current, last; i < value.length; i++){
+ current = value.charAt(i);
+ if(dojox.dtl.filter.strings._truncatewords.test(last)){
+ if(!dojox.dtl.filter.strings._truncatewords.test(current)){
+ ++count;
+ if(count == arg){
+ return value.substring(0, j + 1);
+ }
+ }
+ }else if(!dojox.dtl.filter.strings._truncatewords.test(current)){
+ j = i;
+ }
+ last = current;
+ }
+ return value;
+ },
+ _truncate_words: /(&.*?;|<.*?>|(\w[\w\-]*))/g,
+ _truncate_tag: /<(\/)?([^ ]+?)(?: (\/)| .*?)?>/,
+ _truncate_singlets: { br: true, col: true, link: true, base: true, img: true, param: true, area: true, hr: true, input: true },
+ truncatewords_html: function(value, arg){
+ arg = parseInt(arg, 10);
+
+ if(arg <= 0){
+ return "";
+ }
+
+ var strings = dojox.dtl.filter.strings;
+ var words = 0;
+ var open = [];
+
+ var output = dojox.string.tokenize(value, strings._truncate_words, function(all, word){
+ if(word){
+ // It's an actual non-HTML word
+ ++words;
+ if(words < arg){
+ return word;
+ }else if(words == arg){
+ return word + " ...";
+ }
+ }
+ // Check for tag
+ var tag = all.match(strings._truncate_tag);
+ if(!tag || words >= arg){
+ // Don't worry about non tags or tags after our truncate point
+ return;
+ }
+ var closing = tag[1];
+ var tagname = tag[2].toLowerCase();
+ var selfclosing = tag[3];
+ if(closing || strings._truncate_singlets[tagname]){
+ }else if(closing){
+ var i = dojo.indexOf(open, tagname);
+ if(i != -1){
+ open = open.slice(i + 1);
+ }
+ }else{
+ open.unshift(tagname);
+ }
+ return all;
+ }).join("");
+
+ output = output.replace(/\s+$/g, "");
+
+ for(var i = 0, tag; tag = open[i]; i++){
+ output += "</" + tag + ">";
+ }
+
+ return output;
+ },
+ upper: function(value){
+ return value.toUpperCase();
+ },
+ urlencode: function(value){
+ return dojox.dtl.filter.strings._urlquote(value);
+ },
+ _urlize: /^((?:[(>]|<)*)(.*?)((?:[.,)>\n]|>)*)$/,
+ _urlize2: /^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$/,
+ urlize: function(value){
+ return dojox.dtl.filter.strings.urlizetrunc(value);
+ },
+ urlizetrunc: function(value, arg){
+ arg = parseInt(arg);
+ return dojox.string.tokenize(value, /(\S+)/g, function(word){
+ var matches = dojox.dtl.filter.strings._urlize.exec(word);
+ if(!matches){
+ return word;
+ }
+ var lead = matches[1];
+ var middle = matches[2];
+ var trail = matches[3];
+
+ var startsWww = middle.indexOf("www.") == 0;
+ var hasAt = middle.indexOf("@") != -1;
+ var hasColon = middle.indexOf(":") != -1;
+ var startsHttp = middle.indexOf("http://") == 0;
+ var startsHttps = middle.indexOf("https://") == 0;
+ var firstAlpha = /[a-zA-Z0-9]/.test(middle.charAt(0));
+ var last4 = middle.substring(middle.length - 4);
+
+ var trimmed = middle;
+ if(arg > 3){
+ trimmed = trimmed.substring(0, arg - 3) + "...";
+ }
+
+ if(startsWww || (!hasAt && !startsHttp && middle.length && firstAlpha && (last4 == ".org" || last4 == ".net" || last4 == ".com"))){
+ return '<a href="http://' + middle + '" rel="nofollow">' + trimmed + '</a>';
+ }else if(startsHttp || startsHttps){
+ return '<a href="' + middle + '" rel="nofollow">' + trimmed + '</a>';
+ }else if(hasAt && !startsWww && !hasColon && dojox.dtl.filter.strings._urlize2.test(middle)){
+ return '<a href="mailto:' + middle + '">' + middle + '</a>';
+ }
+ return word;
+ }).join("");
+ },
+ wordcount: function(value){
+ value = dojo.trim(value);
+ if(!value){ return 0; }
+ return value.split(/\s+/g).length;
+ },
+ wordwrap: function(value, arg){
+ arg = parseInt(arg);
+ // summary: Wraps words at specified line length
+ var output = [];
+ var parts = value.split(/\s+/g);
+ if(parts.length){
+ var word = parts.shift();
+ output.push(word);
+ var pos = word.length - word.lastIndexOf("\n") - 1;
+ for(var i = 0; i < parts.length; i++){
+ word = parts[i];
+ if(word.indexOf("\n") != -1){
+ var lines = word.split(/\n/g);
+ }else{
+ var lines = [word];
+ }
+ pos += lines[0].length + 1;
+ if(arg && pos > arg){
+ output.push("\n");
+ pos = lines[lines.length - 1].length;
+ }else{
+ output.push(" ");
+ if(lines.length > 1){
+ pos = lines[lines.length - 1].length;
+ }
+ }
+ output.push(word);
+ }
+ }
+ return output.join("");
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/html.js b/js/dojo-1.6/dojox/dtl/html.js new file mode 100644 index 0000000..5e0248e --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/html.js @@ -0,0 +1,15 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.html"] = true;
+dojo.provide("dojox.dtl.html");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+dojo.require("dojox.dtl.dom");
+dojox.dtl.HtmlTemplate = dojox.dtl.DomTemplate;
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/html.xd.js b/js/dojo-1.6/dojox/dtl/html.xd.js new file mode 100644 index 0000000..6a7c545 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/html.xd.js @@ -0,0 +1,20 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.html"],
+["require", "dojox.dtl.dom"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.html"] = true;
+dojo.provide("dojox.dtl.html");
+dojo.deprecated("dojox.dtl.html", "All packages and classes in dojox.dtl that start with Html or html have been renamed to Dom or dom");
+dojo.require("dojox.dtl.dom");
+dojox.dtl.HtmlTemplate = dojox.dtl.DomTemplate;
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/render/dom.js b/js/dojo-1.6/dojox/dtl/render/dom.js new file mode 100644 index 0000000..1d4b62a --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/render/dom.js @@ -0,0 +1,44 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.render.dom"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.render.dom"] = true;
+dojo.provide("dojox.dtl.render.dom");
+
+dojo.require("dojox.dtl.Context");
+dojo.require("dojox.dtl.dom");
+
+dojox.dtl.render.dom.Render = function(/*DOMNode?*/ attachPoint, /*dojox.dtl.DomTemplate?*/ tpl){
+ this._tpl = tpl;
+ this.domNode = dojo.byId(attachPoint);
+}
+dojo.extend(dojox.dtl.render.dom.Render, {
+ setAttachPoint: function(/*Node*/ node){
+ this.domNode = node;
+ },
+ render: function(/*Object*/ context, /*dojox.dtl.DomTemplate?*/ tpl, /*dojox.dtl.DomBuffer?*/ buffer){
+ if(!this.domNode){
+ throw new Error("You cannot use the Render object without specifying where you want to render it");
+ }
+
+ this._tpl = tpl = tpl || this._tpl;
+ buffer = buffer || tpl.getBuffer();
+ context = context || new dojox.dtl.Context();
+
+ var frag = tpl.render(context, buffer).getParent();
+ if(!frag){
+ throw new Error("Rendered template does not have a root node");
+ }
+
+ if(this.domNode !== frag){
+ this.domNode.parentNode.replaceChild(frag, this.domNode);
+ this.domNode = frag;
+ }
+ }
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/render/dom.xd.js b/js/dojo-1.6/dojox/dtl/render/dom.xd.js new file mode 100644 index 0000000..99df341 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/render/dom.xd.js @@ -0,0 +1,50 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.render.dom"],
+["require", "dojox.dtl.Context"],
+["require", "dojox.dtl.dom"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.render.dom"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.render.dom"] = true;
+dojo.provide("dojox.dtl.render.dom");
+
+dojo.require("dojox.dtl.Context");
+dojo.require("dojox.dtl.dom");
+
+dojox.dtl.render.dom.Render = function(/*DOMNode?*/ attachPoint, /*dojox.dtl.DomTemplate?*/ tpl){
+ this._tpl = tpl;
+ this.domNode = dojo.byId(attachPoint);
+}
+dojo.extend(dojox.dtl.render.dom.Render, {
+ setAttachPoint: function(/*Node*/ node){
+ this.domNode = node;
+ },
+ render: function(/*Object*/ context, /*dojox.dtl.DomTemplate?*/ tpl, /*dojox.dtl.DomBuffer?*/ buffer){
+ if(!this.domNode){
+ throw new Error("You cannot use the Render object without specifying where you want to render it");
+ }
+
+ this._tpl = tpl = tpl || this._tpl;
+ buffer = buffer || tpl.getBuffer();
+ context = context || new dojox.dtl.Context();
+
+ var frag = tpl.render(context, buffer).getParent();
+ if(!frag){
+ throw new Error("Rendered template does not have a root node");
+ }
+
+ if(this.domNode !== frag){
+ this.domNode.parentNode.replaceChild(frag, this.domNode);
+ this.domNode = frag;
+ }
+ }
+});
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/render/html.js b/js/dojo-1.6/dojox/dtl/render/html.js new file mode 100644 index 0000000..f77a1fe --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/render/html.js @@ -0,0 +1,14 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.render.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.render.html"] = true;
+dojo.provide("dojox.dtl.render.html");
+dojo.require("dojox.dtl.render.dom");
+dojox.dtl.render.html.Render = dojox.dtl.render.dom.Render;
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/render/html.xd.js b/js/dojo-1.6/dojox/dtl/render/html.xd.js new file mode 100644 index 0000000..a064bd3 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/render/html.xd.js @@ -0,0 +1,19 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.render.html"],
+["require", "dojox.dtl.render.dom"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.render.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.render.html"] = true;
+dojo.provide("dojox.dtl.render.html");
+dojo.require("dojox.dtl.render.dom");
+dojox.dtl.render.html.Render = dojox.dtl.render.dom.Render;
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/tag/date.js b/js/dojo-1.6/dojox/dtl/tag/date.js new file mode 100644 index 0000000..cda7d81 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/date.js @@ -0,0 +1,42 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.tag.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.date"] = true;
+dojo.provide("dojox.dtl.tag.date");
+
+dojo.require("dojox.dtl._base");
+dojo.require("dojox.dtl.utils.date");
+
+dojox.dtl.tag.date.NowNode = function(format, node){
+ this._format = format;
+ this.format = new dojox.dtl.utils.date.DateFormat(format);
+ this.contents = node;
+}
+dojo.extend(dojox.dtl.tag.date.NowNode, {
+ render: function(context, buffer){
+ this.contents.set(this.format.format(new Date()));
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._format, this.contents.clone(buffer));
+ }
+});
+
+dojox.dtl.tag.date.now = function(parser, token){
+ // Split by either :" or :'
+ var parts = token.split_contents();
+ if(parts.length != 2){
+ throw new Error("'now' statement takes one argument");
+ }
+ return new dojox.dtl.tag.date.NowNode(parts[1].slice(1, -1), parser.create_text_node());
+}
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/tag/date.xd.js b/js/dojo-1.6/dojox/dtl/tag/date.xd.js new file mode 100644 index 0000000..9e55e41 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/date.xd.js @@ -0,0 +1,48 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.tag.date"],
+["require", "dojox.dtl._base"],
+["require", "dojox.dtl.utils.date"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.tag.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.date"] = true;
+dojo.provide("dojox.dtl.tag.date");
+
+dojo.require("dojox.dtl._base");
+dojo.require("dojox.dtl.utils.date");
+
+dojox.dtl.tag.date.NowNode = function(format, node){
+ this._format = format;
+ this.format = new dojox.dtl.utils.date.DateFormat(format);
+ this.contents = node;
+}
+dojo.extend(dojox.dtl.tag.date.NowNode, {
+ render: function(context, buffer){
+ this.contents.set(this.format.format(new Date()));
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._format, this.contents.clone(buffer));
+ }
+});
+
+dojox.dtl.tag.date.now = function(parser, token){
+ // Split by either :" or :'
+ var parts = token.split_contents();
+ if(parts.length != 2){
+ throw new Error("'now' statement takes one argument");
+ }
+ return new dojox.dtl.tag.date.NowNode(parts[1].slice(1, -1), parser.create_text_node());
+}
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/tag/loader.js b/js/dojo-1.6/dojox/dtl/tag/loader.js new file mode 100644 index 0000000..b4c79e3 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/loader.js @@ -0,0 +1,308 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.tag.loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loader"] = true;
+dojo.provide("dojox.dtl.tag.loader");
+
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loader;
+
+ ddtl.BlockNode = dojo.extend(function(name, nodelist){
+ this.name = name;
+ this.nodelist = nodelist; // Can be overridden
+ },
+ {
+ "super": function(){
+ if(this.parent){
+ var html = this.parent.nodelist.dummyRender(this.context, null, true);
+ if(typeof html == "string"){
+ html = new String(html);
+ }
+ html.safe = true;
+ return html;
+ }
+ return '';
+ },
+ render: function(context, buffer){
+ var name = this.name;
+ var nodelist = this.nodelist;
+ var parent;
+ if(buffer.blocks){
+ var block = buffer.blocks[name];
+ if(block){
+ parent = block.parent;
+ nodelist = block.nodelist;
+ block.used = true;
+ }
+ }
+
+ this.rendered = nodelist;
+
+ context = context.push();
+ this.context = context;
+ this.parent = null;
+ if(nodelist != this.nodelist){
+ this.parent = this;
+ }
+ context.block = this;
+
+ if(buffer.getParent){
+ var bufferParent = buffer.getParent();
+ var setParent = dojo.connect(buffer, "onSetParent", function(node, up, root){
+ if(up && root){
+ buffer.setParent(bufferParent);
+ }
+ });
+ }
+ buffer = nodelist.render(context, buffer, this);
+ setParent && dojo.disconnect(setParent);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.name, this.nodelist.clone(buffer));
+ },
+ toString: function(){ return "dojox.dtl.tag.loader.BlockNode"; }
+ });
+
+ ddtl.ExtendsNode = dojo.extend(function(getTemplate, nodelist, shared, parent, key){
+ this.getTemplate = getTemplate;
+ this.nodelist = nodelist;
+ this.shared = shared;
+ this.parent = parent;
+ this.key = key;
+ },
+ {
+ parents: {},
+ getParent: function(context){
+ var parent = this.parent;
+ if(!parent){
+ var string;
+ parent = this.parent = context.get(this.key, false);
+ if(!parent){
+ throw new Error("extends tag used a variable that did not resolve");
+ }
+ if(typeof parent == "object"){
+ var url = parent.url || parent.templatePath;
+ if(parent.shared){
+ this.shared = true;
+ }
+ if(url){
+ parent = this.parent = url.toString();
+ }else if(parent.templateString){
+ // Allow the builder's string interning to work
+ string = parent.templateString;
+ parent = this.parent = " ";
+ }else{
+ parent = this.parent = this.parent.toString();
+ }
+ }
+ if(parent && parent.indexOf("shared:") === 0){
+ this.shared = true;
+ parent = this.parent = parent.substring(7, parent.length);
+ }
+ }
+ if(!parent){
+ throw new Error("Invalid template name in 'extends' tag.");
+ }
+ if(parent.render){
+ return parent;
+ }
+ if(this.parents[parent]){
+ return this.parents[parent];
+ }
+ this.parent = this.getTemplate(string || dojox.dtl.text.getTemplateString(parent));
+ if(this.shared){
+ this.parents[parent] = this.parent;
+ }
+ return this.parent;
+ },
+ render: function(context, buffer){
+ var parent = this.getParent(context);
+
+ parent.blocks = parent.blocks || {};
+ buffer.blocks = buffer.blocks || {};
+
+ for(var i = 0, node; node = this.nodelist.contents[i]; i++){
+ if(node instanceof dojox.dtl.tag.loader.BlockNode){
+ var old = parent.blocks[node.name];
+ if(old && old.nodelist != node.nodelist){
+ // In a shared template, the individual blocks might change
+ buffer = old.nodelist.unrender(context, buffer);
+ }
+ parent.blocks[node.name] = buffer.blocks[node.name] = {
+ shared: this.shared,
+ nodelist: node.nodelist,
+ used: false
+ }
+ }
+ }
+
+ this.rendered = parent;
+ return parent.nodelist.render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer, this);
+ },
+ toString: function(){ return "dojox.dtl.block.ExtendsNode"; }
+ });
+
+ ddtl.IncludeNode = dojo.extend(function(path, constant, getTemplate, text, parsed){
+ this._path = path;
+ this.constant = constant;
+ this.path = (constant) ? path : new dd._Filter(path);
+ this.getTemplate = getTemplate;
+ this.text = text;
+ this.parsed = (arguments.length == 5) ? parsed : true;
+ },
+ {
+ _cache: [{}, {}],
+ render: function(context, buffer){
+ var location = ((this.constant) ? this.path : this.path.resolve(context)).toString();
+ var parsed = Number(this.parsed);
+ var dirty = false;
+ if(location != this.last){
+ dirty = true;
+ if(this.last){
+ buffer = this.unrender(context, buffer);
+ }
+ this.last = location;
+ }
+
+ var cache = this._cache[parsed];
+
+ if(parsed){
+ if(!cache[location]){
+ cache[location] = dd.text._resolveTemplateArg(location, true);
+ }
+ if(dirty){
+ var template = this.getTemplate(cache[location]);
+ this.rendered = template.nodelist;
+ }
+ return this.rendered.render(context, buffer, this);
+ }else{
+ if(this.text instanceof dd._TextNode){
+ if(dirty){
+ this.rendered = this.text;
+ this.rendered.set(dd.text._resolveTemplateArg(location, true));
+ }
+ return this.rendered.render(context, buffer);
+ }else{
+ if(!cache[location]){
+ var nodelist = [];
+ var div = document.createElement("div");
+ div.innerHTML = dd.text._resolveTemplateArg(location, true);
+ var children = div.childNodes;
+ while(children.length){
+ var removed = div.removeChild(children[0]);
+ nodelist.push(removed);
+ }
+ cache[location] = nodelist;
+ }
+ if(dirty){
+ this.nodelist = [];
+ var exists = true;
+ for(var i = 0, child; child = cache[location][i]; i++){
+ this.nodelist.push(child.cloneNode(true));
+ }
+ }
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.concat(node);
+ }
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ if(this.rendered){
+ buffer = this.rendered.unrender(context, buffer);
+ }
+ if(this.nodelist){
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.remove(node);
+ }
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._path, this.constant, this.getTemplate, this.text.clone(buffer), this.parsed);
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ block: function(parser, token){
+ var parts = token.contents.split();
+ var name = parts[1];
+
+ parser._blocks = parser._blocks || {};
+ parser._blocks[name] = parser._blocks[name] || [];
+ parser._blocks[name].push(name);
+
+ var nodelist = parser.parse(["endblock", "endblock " + name]).rtrim();
+ parser.next_token();
+ return new dojox.dtl.tag.loader.BlockNode(name, nodelist);
+ },
+ extends_: function(parser, token){
+ var parts = token.contents.split();
+ var shared = false;
+ var parent = null;
+ var key = null;
+ if(parts[1].charAt(0) == '"' || parts[1].charAt(0) == "'"){
+ parent = parts[1].substring(1, parts[1].length - 1);
+ }else{
+ key = parts[1];
+ }
+ if(parent && parent.indexOf("shared:") == 0){
+ shared = true;
+ parent = parent.substring(7, parent.length);
+ }
+ var nodelist = parser.parse();
+ return new dojox.dtl.tag.loader.ExtendsNode(parser.getTemplate, nodelist, shared, parent, key);
+ },
+ include: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error(parts[0] + " tag takes one argument: the name of the template to be included");
+ }
+ var path = parts[1];
+ var constant = false;
+ if((path.charAt(0) == '"' || path.slice(-1) == "'") && path.charAt(0) == path.slice(-1)){
+ path = path.slice(1, -1);
+ constant = true;
+ }
+ return new ddtl.IncludeNode(path, constant, parser.getTemplate, parser.create_text_node());
+ },
+ ssi: function(parser, token){
+ // We're going to treat things a little differently here.
+ // First of all, this tag is *not* portable, so I'm not
+ // concerned about it being a "drop in" replacement.
+
+ // Instead, we'll just replicate the include tag, but with that
+ // optional "parsed" parameter.
+ var parts = token.contents.split();
+ var parsed = false;
+ if(parts.length == 3){
+ parsed = (parts.pop() == "parsed");
+ if(!parsed){
+ throw new Error("Second (optional) argument to ssi tag must be 'parsed'");
+ }
+ }
+ var node = ddtl.include(parser, new dd.Token(token.token_type, parts.join(" ")));
+ node.parsed = parsed;
+ return node;
+ }
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/tag/loader.xd.js b/js/dojo-1.6/dojox/dtl/tag/loader.xd.js new file mode 100644 index 0000000..811ad8b --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/loader.xd.js @@ -0,0 +1,313 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.tag.loader"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.tag.loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loader"] = true;
+dojo.provide("dojox.dtl.tag.loader");
+
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loader;
+
+ ddtl.BlockNode = dojo.extend(function(name, nodelist){
+ this.name = name;
+ this.nodelist = nodelist; // Can be overridden
+ },
+ {
+ "super": function(){
+ if(this.parent){
+ var html = this.parent.nodelist.dummyRender(this.context, null, true);
+ if(typeof html == "string"){
+ html = new String(html);
+ }
+ html.safe = true;
+ return html;
+ }
+ return '';
+ },
+ render: function(context, buffer){
+ var name = this.name;
+ var nodelist = this.nodelist;
+ var parent;
+ if(buffer.blocks){
+ var block = buffer.blocks[name];
+ if(block){
+ parent = block.parent;
+ nodelist = block.nodelist;
+ block.used = true;
+ }
+ }
+
+ this.rendered = nodelist;
+
+ context = context.push();
+ this.context = context;
+ this.parent = null;
+ if(nodelist != this.nodelist){
+ this.parent = this;
+ }
+ context.block = this;
+
+ if(buffer.getParent){
+ var bufferParent = buffer.getParent();
+ var setParent = dojo.connect(buffer, "onSetParent", function(node, up, root){
+ if(up && root){
+ buffer.setParent(bufferParent);
+ }
+ });
+ }
+ buffer = nodelist.render(context, buffer, this);
+ setParent && dojo.disconnect(setParent);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.name, this.nodelist.clone(buffer));
+ },
+ toString: function(){ return "dojox.dtl.tag.loader.BlockNode"; }
+ });
+
+ ddtl.ExtendsNode = dojo.extend(function(getTemplate, nodelist, shared, parent, key){
+ this.getTemplate = getTemplate;
+ this.nodelist = nodelist;
+ this.shared = shared;
+ this.parent = parent;
+ this.key = key;
+ },
+ {
+ parents: {},
+ getParent: function(context){
+ var parent = this.parent;
+ if(!parent){
+ var string;
+ parent = this.parent = context.get(this.key, false);
+ if(!parent){
+ throw new Error("extends tag used a variable that did not resolve");
+ }
+ if(typeof parent == "object"){
+ var url = parent.url || parent.templatePath;
+ if(parent.shared){
+ this.shared = true;
+ }
+ if(url){
+ parent = this.parent = url.toString();
+ }else if(parent.templateString){
+ // Allow the builder's string interning to work
+ string = parent.templateString;
+ parent = this.parent = " ";
+ }else{
+ parent = this.parent = this.parent.toString();
+ }
+ }
+ if(parent && parent.indexOf("shared:") === 0){
+ this.shared = true;
+ parent = this.parent = parent.substring(7, parent.length);
+ }
+ }
+ if(!parent){
+ throw new Error("Invalid template name in 'extends' tag.");
+ }
+ if(parent.render){
+ return parent;
+ }
+ if(this.parents[parent]){
+ return this.parents[parent];
+ }
+ this.parent = this.getTemplate(string || dojox.dtl.text.getTemplateString(parent));
+ if(this.shared){
+ this.parents[parent] = this.parent;
+ }
+ return this.parent;
+ },
+ render: function(context, buffer){
+ var parent = this.getParent(context);
+
+ parent.blocks = parent.blocks || {};
+ buffer.blocks = buffer.blocks || {};
+
+ for(var i = 0, node; node = this.nodelist.contents[i]; i++){
+ if(node instanceof dojox.dtl.tag.loader.BlockNode){
+ var old = parent.blocks[node.name];
+ if(old && old.nodelist != node.nodelist){
+ // In a shared template, the individual blocks might change
+ buffer = old.nodelist.unrender(context, buffer);
+ }
+ parent.blocks[node.name] = buffer.blocks[node.name] = {
+ shared: this.shared,
+ nodelist: node.nodelist,
+ used: false
+ }
+ }
+ }
+
+ this.rendered = parent;
+ return parent.nodelist.render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return this.rendered.unrender(context, buffer, this);
+ },
+ toString: function(){ return "dojox.dtl.block.ExtendsNode"; }
+ });
+
+ ddtl.IncludeNode = dojo.extend(function(path, constant, getTemplate, text, parsed){
+ this._path = path;
+ this.constant = constant;
+ this.path = (constant) ? path : new dd._Filter(path);
+ this.getTemplate = getTemplate;
+ this.text = text;
+ this.parsed = (arguments.length == 5) ? parsed : true;
+ },
+ {
+ _cache: [{}, {}],
+ render: function(context, buffer){
+ var location = ((this.constant) ? this.path : this.path.resolve(context)).toString();
+ var parsed = Number(this.parsed);
+ var dirty = false;
+ if(location != this.last){
+ dirty = true;
+ if(this.last){
+ buffer = this.unrender(context, buffer);
+ }
+ this.last = location;
+ }
+
+ var cache = this._cache[parsed];
+
+ if(parsed){
+ if(!cache[location]){
+ cache[location] = dd.text._resolveTemplateArg(location, true);
+ }
+ if(dirty){
+ var template = this.getTemplate(cache[location]);
+ this.rendered = template.nodelist;
+ }
+ return this.rendered.render(context, buffer, this);
+ }else{
+ if(this.text instanceof dd._TextNode){
+ if(dirty){
+ this.rendered = this.text;
+ this.rendered.set(dd.text._resolveTemplateArg(location, true));
+ }
+ return this.rendered.render(context, buffer);
+ }else{
+ if(!cache[location]){
+ var nodelist = [];
+ var div = document.createElement("div");
+ div.innerHTML = dd.text._resolveTemplateArg(location, true);
+ var children = div.childNodes;
+ while(children.length){
+ var removed = div.removeChild(children[0]);
+ nodelist.push(removed);
+ }
+ cache[location] = nodelist;
+ }
+ if(dirty){
+ this.nodelist = [];
+ var exists = true;
+ for(var i = 0, child; child = cache[location][i]; i++){
+ this.nodelist.push(child.cloneNode(true));
+ }
+ }
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.concat(node);
+ }
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ if(this.rendered){
+ buffer = this.rendered.unrender(context, buffer);
+ }
+ if(this.nodelist){
+ for(var i = 0, node; node = this.nodelist[i]; i++){
+ buffer = buffer.remove(node);
+ }
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._path, this.constant, this.getTemplate, this.text.clone(buffer), this.parsed);
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ block: function(parser, token){
+ var parts = token.contents.split();
+ var name = parts[1];
+
+ parser._blocks = parser._blocks || {};
+ parser._blocks[name] = parser._blocks[name] || [];
+ parser._blocks[name].push(name);
+
+ var nodelist = parser.parse(["endblock", "endblock " + name]).rtrim();
+ parser.next_token();
+ return new dojox.dtl.tag.loader.BlockNode(name, nodelist);
+ },
+ extends_: function(parser, token){
+ var parts = token.contents.split();
+ var shared = false;
+ var parent = null;
+ var key = null;
+ if(parts[1].charAt(0) == '"' || parts[1].charAt(0) == "'"){
+ parent = parts[1].substring(1, parts[1].length - 1);
+ }else{
+ key = parts[1];
+ }
+ if(parent && parent.indexOf("shared:") == 0){
+ shared = true;
+ parent = parent.substring(7, parent.length);
+ }
+ var nodelist = parser.parse();
+ return new dojox.dtl.tag.loader.ExtendsNode(parser.getTemplate, nodelist, shared, parent, key);
+ },
+ include: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error(parts[0] + " tag takes one argument: the name of the template to be included");
+ }
+ var path = parts[1];
+ var constant = false;
+ if((path.charAt(0) == '"' || path.slice(-1) == "'") && path.charAt(0) == path.slice(-1)){
+ path = path.slice(1, -1);
+ constant = true;
+ }
+ return new ddtl.IncludeNode(path, constant, parser.getTemplate, parser.create_text_node());
+ },
+ ssi: function(parser, token){
+ // We're going to treat things a little differently here.
+ // First of all, this tag is *not* portable, so I'm not
+ // concerned about it being a "drop in" replacement.
+
+ // Instead, we'll just replicate the include tag, but with that
+ // optional "parsed" parameter.
+ var parts = token.contents.split();
+ var parsed = false;
+ if(parts.length == 3){
+ parsed = (parts.pop() == "parsed");
+ if(!parsed){
+ throw new Error("Second (optional) argument to ssi tag must be 'parsed'");
+ }
+ }
+ var node = ddtl.include(parser, new dd.Token(token.token_type, parts.join(" ")));
+ node.parsed = parsed;
+ return node;
+ }
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/tag/logic.js b/js/dojo-1.6/dojox/dtl/tag/logic.js new file mode 100644 index 0000000..9b6a0d0 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/logic.js @@ -0,0 +1,287 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.tag.logic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.logic"] = true;
+dojo.provide("dojox.dtl.tag.logic");
+
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddt = dd.text;
+ var ddtl = dd.tag.logic;
+
+ ddtl.IfNode = dojo.extend(function(bools, trues, falses, type){
+ this.bools = bools;
+ this.trues = trues;
+ this.falses = falses;
+ this.type = type;
+ },
+ {
+ render: function(context, buffer){
+ var i, bool, ifnot, filter, value;
+ if(this.type == "or"){
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ if((value && !ifnot) || (ifnot && !value)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }else{
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ // If we ever encounter a false value
+ if(value == ifnot){
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ buffer = (this.trues) ? this.trues.unrender(context, buffer) : buffer;
+ buffer = (this.falses) ? this.falses.unrender(context, buffer) : buffer;
+ return buffer;
+ },
+ clone: function(buffer){
+ var trues = (this.trues) ? this.trues.clone(buffer) : null;
+ var falses = (this.falses) ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.bools, trues, falses, this.type);
+ }
+ });
+
+ ddtl.IfEqualNode = dojo.extend(function(var1, var2, trues, falses, negate){
+ this.var1 = new dd._Filter(var1);
+ this.var2 = new dd._Filter(var2);
+ this.trues = trues;
+ this.falses = falses;
+ this.negate = negate;
+ },
+ {
+ render: function(context, buffer){
+ var var1 = this.var1.resolve(context);
+ var var2 = this.var2.resolve(context);
+ var1 = (typeof var1 != "undefined") ? var1 : "";
+ var2 = (typeof var1 != "undefined") ? var2 : "";
+ if((this.negate && var1 != var2) || (!this.negate && var1 == var2)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer, this);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer, this);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ },
+ unrender: function(context, buffer){
+ return ddtl.IfNode.prototype.unrender.call(this, context, buffer);
+ },
+ clone: function(buffer){
+ var trues = this.trues ? this.trues.clone(buffer) : null;
+ var falses = this.falses ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.var1.getExpression(), this.var2.getExpression(), trues, falses, this.negate);
+ }
+ });
+
+ ddtl.ForNode = dojo.extend(function(assign, loop, reversed, nodelist){
+ this.assign = assign;
+ this.loop = new dd._Filter(loop);
+ this.reversed = reversed;
+ this.nodelist = nodelist;
+ this.pool = [];
+ },
+ {
+ render: function(context, buffer){
+ var i, j, k;
+ var dirty = false;
+ var assign = this.assign;
+
+ for(k = 0; k < assign.length; k++){
+ if(typeof context[assign[k]] != "undefined"){
+ dirty = true;
+ context = context.push();
+ break;
+ }
+ }
+ if(!dirty && context.forloop){
+ dirty = true;
+ context = context.push();
+ }
+
+ var items = this.loop.resolve(context) || [];
+ for(i = items.length; i < this.pool.length; i++){
+ this.pool[i].unrender(context, buffer, this);
+ }
+ if(this.reversed){
+ items = items.slice(0).reverse();
+ }
+
+ var isObject = dojo.isObject(items) && !dojo.isArrayLike(items);
+ var arred = [];
+ if(isObject){
+ for(var key in items){
+ arred.push(items[key]);
+ }
+ }else{
+ arred = items;
+ }
+
+ var forloop = context.forloop = {
+ parentloop: context.get("forloop", {})
+ };
+ var j = 0;
+ for(i = 0; i < arred.length; i++){
+ var item = arred[i];
+
+ forloop.counter0 = j;
+ forloop.counter = j + 1;
+ forloop.revcounter0 = arred.length - j - 1;
+ forloop.revcounter = arred.length - j;
+ forloop.first = !j;
+ forloop.last = (j == arred.length - 1);
+
+ if(assign.length > 1 && dojo.isArrayLike(item)){
+ if(!dirty){
+ dirty = true;
+ context = context.push();
+ }
+ var zipped = {};
+ for(k = 0; k < item.length && k < assign.length; k++){
+ zipped[assign[k]] = item[k];
+ }
+ dojo.mixin(context, zipped);
+ }else{
+ context[assign[0]] = item;
+ }
+
+ if(j + 1 > this.pool.length){
+ this.pool.push(this.nodelist.clone(buffer));
+ }
+ buffer = this.pool[j++].render(context, buffer, this);
+ }
+
+ delete context.forloop;
+ if(dirty){
+ context = context.pop();
+ }else{
+ for(k = 0; k < assign.length; k++){
+ delete context[assign[k]];
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ for(var i = 0, pool; pool = this.pool[i]; i++){
+ buffer = pool.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.assign, this.loop.getExpression(), this.reversed, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ if_: function(parser, token){
+ var i, part, type, bools = [], parts = token.contents.split();
+ parts.shift();
+ token = parts.join(" ");
+ parts = token.split(" and ");
+ if(parts.length == 1){
+ type = "or";
+ parts = token.split(" or ");
+ }else{
+ type = "and";
+ for(i = 0; i < parts.length; i++){
+ if(parts[i].indexOf(" or ") != -1){
+ // Note, since we split by and, this is the only place we need to error check
+ throw new Error("'if' tags can't mix 'and' and 'or'");
+ }
+ }
+ }
+ for(i = 0; part = parts[i]; i++){
+ var not = false;
+ if(part.indexOf("not ") == 0){
+ part = part.slice(4);
+ not = true;
+ }
+ bools.push([not, new dd._Filter(part)]);
+ }
+ var trues = parser.parse(["else", "endif"]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse(["endif"]);
+ parser.next_token();
+ }
+ return new ddtl.IfNode(bools, trues, falses, type);
+ },
+ _ifequal: function(parser, token, negate){
+ var parts = token.split_contents();
+ if(parts.length != 3){
+ throw new Error(parts[0] + " takes two arguments");
+ }
+ var end = 'end' + parts[0];
+ var trues = parser.parse(["else", end]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse([end]);
+ parser.next_token();
+ }
+ return new ddtl.IfEqualNode(parts[1], parts[2], trues, falses, negate);
+ },
+ ifequal: function(parser, token){
+ return ddtl._ifequal(parser, token);
+ },
+ ifnotequal: function(parser, token){
+ return ddtl._ifequal(parser, token, true);
+ },
+ for_: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length < 4){
+ throw new Error("'for' statements should have at least four words: " + token.contents);
+ }
+ var reversed = parts[parts.length - 1] == "reversed";
+ var index = (reversed) ? -3 : -2;
+ if(parts[parts.length + index] != "in"){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ var loopvars = parts.slice(1, index).join(" ").split(/ *, */);
+ for(var i = 0; i < loopvars.length; i++){
+ if(!loopvars[i] || loopvars[i].indexOf(" ") != -1){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ }
+ var nodelist = parser.parse(["endfor"]);
+ parser.next_token();
+ return new ddtl.ForNode(loopvars, parts[parts.length + index + 1], reversed, nodelist);
+ }
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/tag/logic.xd.js b/js/dojo-1.6/dojox/dtl/tag/logic.xd.js new file mode 100644 index 0000000..afa3928 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/logic.xd.js @@ -0,0 +1,292 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.tag.logic"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.tag.logic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.logic"] = true;
+dojo.provide("dojox.dtl.tag.logic");
+
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddt = dd.text;
+ var ddtl = dd.tag.logic;
+
+ ddtl.IfNode = dojo.extend(function(bools, trues, falses, type){
+ this.bools = bools;
+ this.trues = trues;
+ this.falses = falses;
+ this.type = type;
+ },
+ {
+ render: function(context, buffer){
+ var i, bool, ifnot, filter, value;
+ if(this.type == "or"){
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ if((value && !ifnot) || (ifnot && !value)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }else{
+ for(i = 0; bool = this.bools[i]; i++){
+ ifnot = bool[0];
+ filter = bool[1];
+ value = filter.resolve(context);
+ // If we ever encounter a false value
+ if(value == ifnot){
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ }
+ }
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ buffer = (this.trues) ? this.trues.unrender(context, buffer) : buffer;
+ buffer = (this.falses) ? this.falses.unrender(context, buffer) : buffer;
+ return buffer;
+ },
+ clone: function(buffer){
+ var trues = (this.trues) ? this.trues.clone(buffer) : null;
+ var falses = (this.falses) ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.bools, trues, falses, this.type);
+ }
+ });
+
+ ddtl.IfEqualNode = dojo.extend(function(var1, var2, trues, falses, negate){
+ this.var1 = new dd._Filter(var1);
+ this.var2 = new dd._Filter(var2);
+ this.trues = trues;
+ this.falses = falses;
+ this.negate = negate;
+ },
+ {
+ render: function(context, buffer){
+ var var1 = this.var1.resolve(context);
+ var var2 = this.var2.resolve(context);
+ var1 = (typeof var1 != "undefined") ? var1 : "";
+ var2 = (typeof var1 != "undefined") ? var2 : "";
+ if((this.negate && var1 != var2) || (!this.negate && var1 == var2)){
+ if(this.falses){
+ buffer = this.falses.unrender(context, buffer, this);
+ }
+ return (this.trues) ? this.trues.render(context, buffer, this) : buffer;
+ }
+ if(this.trues){
+ buffer = this.trues.unrender(context, buffer, this);
+ }
+ return (this.falses) ? this.falses.render(context, buffer, this) : buffer;
+ },
+ unrender: function(context, buffer){
+ return ddtl.IfNode.prototype.unrender.call(this, context, buffer);
+ },
+ clone: function(buffer){
+ var trues = this.trues ? this.trues.clone(buffer) : null;
+ var falses = this.falses ? this.falses.clone(buffer) : null;
+ return new this.constructor(this.var1.getExpression(), this.var2.getExpression(), trues, falses, this.negate);
+ }
+ });
+
+ ddtl.ForNode = dojo.extend(function(assign, loop, reversed, nodelist){
+ this.assign = assign;
+ this.loop = new dd._Filter(loop);
+ this.reversed = reversed;
+ this.nodelist = nodelist;
+ this.pool = [];
+ },
+ {
+ render: function(context, buffer){
+ var i, j, k;
+ var dirty = false;
+ var assign = this.assign;
+
+ for(k = 0; k < assign.length; k++){
+ if(typeof context[assign[k]] != "undefined"){
+ dirty = true;
+ context = context.push();
+ break;
+ }
+ }
+ if(!dirty && context.forloop){
+ dirty = true;
+ context = context.push();
+ }
+
+ var items = this.loop.resolve(context) || [];
+ for(i = items.length; i < this.pool.length; i++){
+ this.pool[i].unrender(context, buffer, this);
+ }
+ if(this.reversed){
+ items = items.slice(0).reverse();
+ }
+
+ var isObject = dojo.isObject(items) && !dojo.isArrayLike(items);
+ var arred = [];
+ if(isObject){
+ for(var key in items){
+ arred.push(items[key]);
+ }
+ }else{
+ arred = items;
+ }
+
+ var forloop = context.forloop = {
+ parentloop: context.get("forloop", {})
+ };
+ var j = 0;
+ for(i = 0; i < arred.length; i++){
+ var item = arred[i];
+
+ forloop.counter0 = j;
+ forloop.counter = j + 1;
+ forloop.revcounter0 = arred.length - j - 1;
+ forloop.revcounter = arred.length - j;
+ forloop.first = !j;
+ forloop.last = (j == arred.length - 1);
+
+ if(assign.length > 1 && dojo.isArrayLike(item)){
+ if(!dirty){
+ dirty = true;
+ context = context.push();
+ }
+ var zipped = {};
+ for(k = 0; k < item.length && k < assign.length; k++){
+ zipped[assign[k]] = item[k];
+ }
+ dojo.mixin(context, zipped);
+ }else{
+ context[assign[0]] = item;
+ }
+
+ if(j + 1 > this.pool.length){
+ this.pool.push(this.nodelist.clone(buffer));
+ }
+ buffer = this.pool[j++].render(context, buffer, this);
+ }
+
+ delete context.forloop;
+ if(dirty){
+ context = context.pop();
+ }else{
+ for(k = 0; k < assign.length; k++){
+ delete context[assign[k]];
+ }
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ for(var i = 0, pool; pool = this.pool[i]; i++){
+ buffer = pool.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.assign, this.loop.getExpression(), this.reversed, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ if_: function(parser, token){
+ var i, part, type, bools = [], parts = token.contents.split();
+ parts.shift();
+ token = parts.join(" ");
+ parts = token.split(" and ");
+ if(parts.length == 1){
+ type = "or";
+ parts = token.split(" or ");
+ }else{
+ type = "and";
+ for(i = 0; i < parts.length; i++){
+ if(parts[i].indexOf(" or ") != -1){
+ // Note, since we split by and, this is the only place we need to error check
+ throw new Error("'if' tags can't mix 'and' and 'or'");
+ }
+ }
+ }
+ for(i = 0; part = parts[i]; i++){
+ var not = false;
+ if(part.indexOf("not ") == 0){
+ part = part.slice(4);
+ not = true;
+ }
+ bools.push([not, new dd._Filter(part)]);
+ }
+ var trues = parser.parse(["else", "endif"]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse(["endif"]);
+ parser.next_token();
+ }
+ return new ddtl.IfNode(bools, trues, falses, type);
+ },
+ _ifequal: function(parser, token, negate){
+ var parts = token.split_contents();
+ if(parts.length != 3){
+ throw new Error(parts[0] + " takes two arguments");
+ }
+ var end = 'end' + parts[0];
+ var trues = parser.parse(["else", end]);
+ var falses = false;
+ var token = parser.next_token();
+ if(token.contents == "else"){
+ falses = parser.parse([end]);
+ parser.next_token();
+ }
+ return new ddtl.IfEqualNode(parts[1], parts[2], trues, falses, negate);
+ },
+ ifequal: function(parser, token){
+ return ddtl._ifequal(parser, token);
+ },
+ ifnotequal: function(parser, token){
+ return ddtl._ifequal(parser, token, true);
+ },
+ for_: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length < 4){
+ throw new Error("'for' statements should have at least four words: " + token.contents);
+ }
+ var reversed = parts[parts.length - 1] == "reversed";
+ var index = (reversed) ? -3 : -2;
+ if(parts[parts.length + index] != "in"){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ var loopvars = parts.slice(1, index).join(" ").split(/ *, */);
+ for(var i = 0; i < loopvars.length; i++){
+ if(!loopvars[i] || loopvars[i].indexOf(" ") != -1){
+ throw new Error("'for' tag received an invalid argument: " + token.contents);
+ }
+ }
+ var nodelist = parser.parse(["endfor"]);
+ parser.next_token();
+ return new ddtl.ForNode(loopvars, parts[parts.length + index + 1], reversed, nodelist);
+ }
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/tag/loop.js b/js/dojo-1.6/dojox/dtl/tag/loop.js new file mode 100644 index 0000000..6a6ff80 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/loop.js @@ -0,0 +1,205 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.tag.loop"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loop"] = true;
+dojo.provide("dojox.dtl.tag.loop");
+
+dojo.require("dojox.dtl._base");
+dojo.require("dojox.string.tokenize");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loop;
+
+ ddtl.CycleNode = dojo.extend(function(cyclevars, name, text, shared){
+ this.cyclevars = cyclevars;
+ this.name = name;
+ this.contents = text;
+ this.shared = shared || {counter: -1, map: {}};
+ },
+ {
+ render: function(context, buffer){
+ if(context.forloop && !context.forloop.counter0){
+ this.shared.counter = -1;
+ }
+
+ ++this.shared.counter;
+ var value = this.cyclevars[this.shared.counter % this.cyclevars.length];
+
+ var map = this.shared.map;
+ if(!map[value]){
+ map[value] = new dd._Filter(value);
+ }
+ value = map[value].resolve(context, buffer);
+
+ if(this.name){
+ context[this.name] = value;
+ }
+ this.contents.set(value);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.cyclevars, this.name, this.contents.clone(buffer), this.shared);
+ }
+ });
+
+ ddtl.IfChangedNode = dojo.extend(function(nodes, vars, shared){
+ this.nodes = nodes;
+ this._vars = vars;
+ this.shared = shared || {last: null, counter: 0};
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ }, {
+ render: function(context, buffer){
+ if(context.forloop){
+ if(context.forloop.counter <= this.shared.counter){
+ this.shared.last = null;
+ }
+ this.shared.counter = context.forloop.counter;
+ }
+
+ var change;
+ if(this.vars.length){
+ change = dojo.toJson(dojo.map(this.vars, function(item){
+ return item.resolve(context);
+ }));
+ }else{
+ change = this.nodes.dummyRender(context, buffer);
+ }
+
+ if(change != this.shared.last){
+ var firstloop = (this.shared.last === null);
+ this.shared.last = change;
+ context = context.push();
+ context.ifchanged = {firstloop: firstloop};
+ buffer = this.nodes.render(context, buffer);
+ context = context.pop();
+ }else{
+ buffer = this.nodes.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodes.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodes.clone(buffer), this._vars, this.shared);
+ }
+ });
+
+ ddtl.RegroupNode = dojo.extend(function(expression, key, alias){
+ this._expression = expression;
+ this.expression = new dd._Filter(expression);
+ this.key = key;
+ this.alias = alias;
+ },
+ {
+ _push: function(container, grouper, stack){
+ if(stack.length){
+ container.push({ grouper: grouper, list: stack });
+ }
+ },
+ render: function(context, buffer){
+ context[this.alias] = [];
+ var list = this.expression.resolve(context);
+ if(list){
+ var last = null;
+ var stack = [];
+ for(var i = 0; i < list.length; i++){
+ var id = list[i][this.key];
+ if(last !== id){
+ this._push(context[this.alias], last, stack);
+ last = id;
+ stack = [list[i]];
+ }else{
+ stack.push(list[i]);
+ }
+ }
+ this._push(context[this.alias], last, stack);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(context, buffer){
+ return this;
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ cycle: function(parser, token){
+ // summary: Cycle among the given strings each time this tag is encountered
+ var args = token.split_contents();
+
+ if(args.length < 2){
+ throw new Error("'cycle' tag requires at least two arguments");
+ }
+
+ if(args[1].indexOf(",") != -1){
+ var vars = args[1].split(",");
+ args = [args[0]];
+ for(var i = 0; i < vars.length; i++){
+ args.push('"' + vars[i] + '"');
+ }
+ }
+
+ if(args.length == 2){
+ var name = args[args.length - 1];
+
+ if(!parser._namedCycleNodes){
+ throw new Error("No named cycles in template: '" + name + "' is not defined");
+ }
+ if(!parser._namedCycleNodes[name]){
+ throw new Error("Named cycle '" + name + "' does not exist");
+ }
+
+ return parser._namedCycleNodes[name];
+ }
+
+ if(args.length > 4 && args[args.length - 2] == "as"){
+ var name = args[args.length - 1];
+
+ var node = new ddtl.CycleNode(args.slice(1, args.length - 2), name, parser.create_text_node());
+
+ if(!parser._namedCycleNodes){
+ parser._namedCycleNodes = {};
+ }
+ parser._namedCycleNodes[name] = node;
+ }else{
+ node = new ddtl.CycleNode(args.slice(1), null, parser.create_text_node());
+ }
+
+ return node;
+ },
+ ifchanged: function(parser, token){
+ var parts = token.contents.split();
+ var nodes = parser.parse(["endifchanged"]);
+ parser.delete_first_token();
+ return new ddtl.IfChangedNode(nodes, parts.slice(1));
+ },
+ regroup: function(parser, token){
+ var tokens = dojox.string.tokenize(token.contents, /(\s+)/g, function(spaces){
+ return spaces;
+ });
+ if(tokens.length < 11 || tokens[tokens.length - 3] != "as" || tokens[tokens.length - 7] != "by"){
+ throw new Error("Expected the format: regroup list by key as newList");
+ }
+ var expression = tokens.slice(2, -8).join("");
+ var key = tokens[tokens.length - 5];
+ var alias = tokens[tokens.length - 1];
+ return new ddtl.RegroupNode(expression, key, alias);
+ }
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/tag/loop.xd.js b/js/dojo-1.6/dojox/dtl/tag/loop.xd.js new file mode 100644 index 0000000..087e070 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/loop.xd.js @@ -0,0 +1,211 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.tag.loop"],
+["require", "dojox.dtl._base"],
+["require", "dojox.string.tokenize"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.tag.loop"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.loop"] = true;
+dojo.provide("dojox.dtl.tag.loop");
+
+dojo.require("dojox.dtl._base");
+dojo.require("dojox.string.tokenize");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtl = dd.tag.loop;
+
+ ddtl.CycleNode = dojo.extend(function(cyclevars, name, text, shared){
+ this.cyclevars = cyclevars;
+ this.name = name;
+ this.contents = text;
+ this.shared = shared || {counter: -1, map: {}};
+ },
+ {
+ render: function(context, buffer){
+ if(context.forloop && !context.forloop.counter0){
+ this.shared.counter = -1;
+ }
+
+ ++this.shared.counter;
+ var value = this.cyclevars[this.shared.counter % this.cyclevars.length];
+
+ var map = this.shared.map;
+ if(!map[value]){
+ map[value] = new dd._Filter(value);
+ }
+ value = map[value].resolve(context, buffer);
+
+ if(this.name){
+ context[this.name] = value;
+ }
+ this.contents.set(value);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.cyclevars, this.name, this.contents.clone(buffer), this.shared);
+ }
+ });
+
+ ddtl.IfChangedNode = dojo.extend(function(nodes, vars, shared){
+ this.nodes = nodes;
+ this._vars = vars;
+ this.shared = shared || {last: null, counter: 0};
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ }, {
+ render: function(context, buffer){
+ if(context.forloop){
+ if(context.forloop.counter <= this.shared.counter){
+ this.shared.last = null;
+ }
+ this.shared.counter = context.forloop.counter;
+ }
+
+ var change;
+ if(this.vars.length){
+ change = dojo.toJson(dojo.map(this.vars, function(item){
+ return item.resolve(context);
+ }));
+ }else{
+ change = this.nodes.dummyRender(context, buffer);
+ }
+
+ if(change != this.shared.last){
+ var firstloop = (this.shared.last === null);
+ this.shared.last = change;
+ context = context.push();
+ context.ifchanged = {firstloop: firstloop};
+ buffer = this.nodes.render(context, buffer);
+ context = context.pop();
+ }else{
+ buffer = this.nodes.unrender(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodes.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodes.clone(buffer), this._vars, this.shared);
+ }
+ });
+
+ ddtl.RegroupNode = dojo.extend(function(expression, key, alias){
+ this._expression = expression;
+ this.expression = new dd._Filter(expression);
+ this.key = key;
+ this.alias = alias;
+ },
+ {
+ _push: function(container, grouper, stack){
+ if(stack.length){
+ container.push({ grouper: grouper, list: stack });
+ }
+ },
+ render: function(context, buffer){
+ context[this.alias] = [];
+ var list = this.expression.resolve(context);
+ if(list){
+ var last = null;
+ var stack = [];
+ for(var i = 0; i < list.length; i++){
+ var id = list[i][this.key];
+ if(last !== id){
+ this._push(context[this.alias], last, stack);
+ last = id;
+ stack = [list[i]];
+ }else{
+ stack.push(list[i]);
+ }
+ }
+ this._push(context[this.alias], last, stack);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(context, buffer){
+ return this;
+ }
+ });
+
+ dojo.mixin(ddtl, {
+ cycle: function(parser, token){
+ // summary: Cycle among the given strings each time this tag is encountered
+ var args = token.split_contents();
+
+ if(args.length < 2){
+ throw new Error("'cycle' tag requires at least two arguments");
+ }
+
+ if(args[1].indexOf(",") != -1){
+ var vars = args[1].split(",");
+ args = [args[0]];
+ for(var i = 0; i < vars.length; i++){
+ args.push('"' + vars[i] + '"');
+ }
+ }
+
+ if(args.length == 2){
+ var name = args[args.length - 1];
+
+ if(!parser._namedCycleNodes){
+ throw new Error("No named cycles in template: '" + name + "' is not defined");
+ }
+ if(!parser._namedCycleNodes[name]){
+ throw new Error("Named cycle '" + name + "' does not exist");
+ }
+
+ return parser._namedCycleNodes[name];
+ }
+
+ if(args.length > 4 && args[args.length - 2] == "as"){
+ var name = args[args.length - 1];
+
+ var node = new ddtl.CycleNode(args.slice(1, args.length - 2), name, parser.create_text_node());
+
+ if(!parser._namedCycleNodes){
+ parser._namedCycleNodes = {};
+ }
+ parser._namedCycleNodes[name] = node;
+ }else{
+ node = new ddtl.CycleNode(args.slice(1), null, parser.create_text_node());
+ }
+
+ return node;
+ },
+ ifchanged: function(parser, token){
+ var parts = token.contents.split();
+ var nodes = parser.parse(["endifchanged"]);
+ parser.delete_first_token();
+ return new ddtl.IfChangedNode(nodes, parts.slice(1));
+ },
+ regroup: function(parser, token){
+ var tokens = dojox.string.tokenize(token.contents, /(\s+)/g, function(spaces){
+ return spaces;
+ });
+ if(tokens.length < 11 || tokens[tokens.length - 3] != "as" || tokens[tokens.length - 7] != "by"){
+ throw new Error("Expected the format: regroup list by key as newList");
+ }
+ var expression = tokens.slice(2, -8).join("");
+ var key = tokens[tokens.length - 5];
+ var alias = tokens[tokens.length - 1];
+ return new ddtl.RegroupNode(expression, key, alias);
+ }
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/tag/misc.js b/js/dojo-1.6/dojox/dtl/tag/misc.js new file mode 100644 index 0000000..01f6eed --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/misc.js @@ -0,0 +1,297 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.tag.misc"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.misc"] = true;
+dojo.provide("dojox.dtl.tag.misc");
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtm = dd.tag.misc;
+
+ ddtm.DebugNode = dojo.extend(function(text){
+ this.text = text;
+ },
+ {
+ render: function(context, buffer){
+ var keys = context.getKeys();
+ var debug = [];
+ var only = {};
+ for(var i = 0, key; key = keys[i]; i++){
+ only[key] = context[key];
+ debug += "[" + key + ": " + typeof context[key] + "]\n";
+ }
+ console.debug(only);
+ return this.text.set(debug).render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.text.clone(buffer));
+ },
+ toString: function(){ return "ddtm.DebugNode"; }
+ });
+
+ ddtm.FilterNode = dojo.extend(function(varnode, nodelist){
+ this._varnode = varnode;
+ this._nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ // Doing this in HTML requires a different buffer with a fake root node
+ var output = this._nodelist.render(context, new dojox.string.Builder());
+ context = context.update({ "var": output.toString() });
+ var filtered = this._varnode.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._expression, this._nodelist.clone(buffer));
+ }
+ });
+
+ ddtm.FirstOfNode = dojo.extend(function(vars, text){
+ this._vars = vars;
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ for(var i = 0, item; item = this.vars[i]; i++){
+ var resolved = item.resolve(context);
+ if(typeof resolved != "undefined"){
+ if(resolved === null){
+ resolved = "null";
+ }
+ this.contents.set(resolved);
+ return this.contents.render(context, buffer);
+ }
+ }
+ return this.contents.unrender(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._vars, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.SpacelessNode = dojo.extend(function(nodelist, text){
+ this.nodelist = nodelist;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ if(buffer.getParent){
+ // Unfortunately, we have to branch here
+ var watch = [
+ dojo.connect(buffer, "onAddNodeComplete", this, "_watch"),
+ dojo.connect(buffer, "onSetParent", this, "_watchParent")
+ ];
+ buffer = this.nodelist.render(context, buffer);
+ dojo.disconnect(watch[0]);
+ dojo.disconnect(watch[1]);
+ }else{
+ var value = this.nodelist.dummyRender(context);
+ this.contents.set(value.replace(/>\s+</g, '><'));
+ buffer = this.contents.render(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodelist.clone(buffer), this.contents.clone(buffer));
+ },
+ _isEmpty: function(node){
+ return (node.nodeType == 3 && !node.data.match(/[^\s\n]/));
+ },
+ _watch: function(node){
+ if(this._isEmpty(node)){
+ var remove = false;
+ if(node.parentNode.firstChild == node){
+ node.parentNode.removeChild(node);
+ }
+ }else{
+ var children = node.parentNode.childNodes;
+ if(node.nodeType == 1 && children.length > 2){
+ for(var i = 2, child; child = children[i]; i++){
+ if(children[i - 2].nodeType == 1 && this._isEmpty(children[i - 1])){
+ node.parentNode.removeChild(children[i - 1]);
+ return;
+ }
+ }
+ }
+ }
+ },
+ _watchParent: function(node){
+ var children = node.childNodes;
+ if(children.length){
+ while(node.childNodes.length){
+ var last = node.childNodes[node.childNodes.length - 1];
+ if(!this._isEmpty(last)){
+ return;
+ }
+ node.removeChild(last);
+ }
+ }
+ }
+ });
+
+ ddtm.TemplateTagNode = dojo.extend(function(tag, text){
+ this.tag = tag;
+ this.contents = text;
+ },
+ {
+ mapping: {
+ openblock: "{%",
+ closeblock: "%}",
+ openvariable: "{{",
+ closevariable: "}}",
+ openbrace: "{",
+ closebrace: "}",
+ opencomment: "{#",
+ closecomment: "#}"
+ },
+ render: function(context, buffer){
+ this.contents.set(this.mapping[this.tag]);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.tag, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WidthRatioNode = dojo.extend(function(current, max, width, text){
+ this.current = new dd._Filter(current);
+ this.max = new dd._Filter(max);
+ this.width = width;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ var current = +this.current.resolve(context);
+ var max = +this.max.resolve(context);
+ if(typeof current != "number" || typeof max != "number" || !max){
+ this.contents.set("");
+ }else{
+ this.contents.set("" + Math.round((current / max) * this.width));
+ }
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.current.getExpression(), this.max.getExpression(), this.width, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WithNode = dojo.extend(function(target, alias, nodelist){
+ this.target = new dd._Filter(target);
+ this.alias = alias;
+ this.nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ var target = this.target.resolve(context);
+ context = context.push();
+ context[this.alias] = target;
+ buffer = this.nodelist.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.target.getExpression(), this.alias, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtm, {
+ comment: function(parser, token){
+ // summary: Ignore everything between {% comment %} and {% endcomment %}
+ parser.skip_past("endcomment");
+ return dd._noOpNode;
+ },
+ debug: function(parser, token){
+ // summary: Output the current context, maybe add more stuff later.
+ return new ddtm.DebugNode(parser.create_text_node());
+ },
+ filter: function(parser, token){
+ // summary: Filter the contents of the blog through variable filters.
+ var rest = token.contents.split(null, 1)[1];
+ var varnode = parser.create_variable_node("var|" + rest);
+ var nodelist = parser.parse(["endfilter"]);
+ parser.next_token();
+ return new ddtm.FilterNode(varnode, nodelist);
+ },
+ firstof: function(parser, token){
+ var parts = token.split_contents().slice(1);
+ if(!parts.length){
+ throw new Error("'firstof' statement requires at least one argument");
+ }
+ return new ddtm.FirstOfNode(parts, parser.create_text_node());
+ },
+ spaceless: function(parser, token){
+ var nodelist = parser.parse(["endspaceless"]);
+ parser.delete_first_token();
+ return new ddtm.SpacelessNode(nodelist, parser.create_text_node());
+ },
+ templatetag: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error("'templatetag' statement takes one argument");
+ }
+ var tag = parts[1];
+ var mapping = ddtm.TemplateTagNode.prototype.mapping;
+ if(!mapping[tag]){
+ var keys = [];
+ for(var key in mapping){
+ keys.push(key);
+ }
+ throw new Error("Invalid templatetag argument: '" + tag + "'. Must be one of: " + keys.join(", "));
+ }
+ return new ddtm.TemplateTagNode(tag, parser.create_text_node());
+ },
+ widthratio: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 4){
+ throw new Error("widthratio takes three arguments");
+ }
+ var width = +parts[3];
+ if(typeof width != "number"){
+ throw new Error("widthratio final argument must be an integer");
+ }
+ return new ddtm.WidthRatioNode(parts[1], parts[2], width, parser.create_text_node());
+ },
+ with_: function(parser, token){
+ var parts = token.split_contents();
+ if(parts.length != 4 || parts[2] != "as"){
+ throw new Error("do_width expected format as 'with value as name'");
+ }
+ var nodelist = parser.parse(["endwith"]);
+ parser.next_token();
+ return new ddtm.WithNode(parts[1], parts[3], nodelist);
+ }
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/tag/misc.xd.js b/js/dojo-1.6/dojox/dtl/tag/misc.xd.js new file mode 100644 index 0000000..f8986c2 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/tag/misc.xd.js @@ -0,0 +1,302 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.tag.misc"],
+["require", "dojox.dtl._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.tag.misc"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.tag.misc"] = true;
+dojo.provide("dojox.dtl.tag.misc");
+dojo.require("dojox.dtl._base");
+
+(function(){
+ var dd = dojox.dtl;
+ var ddtm = dd.tag.misc;
+
+ ddtm.DebugNode = dojo.extend(function(text){
+ this.text = text;
+ },
+ {
+ render: function(context, buffer){
+ var keys = context.getKeys();
+ var debug = [];
+ var only = {};
+ for(var i = 0, key; key = keys[i]; i++){
+ only[key] = context[key];
+ debug += "[" + key + ": " + typeof context[key] + "]\n";
+ }
+ console.debug(only);
+ return this.text.set(debug).render(context, buffer, this);
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.text.clone(buffer));
+ },
+ toString: function(){ return "ddtm.DebugNode"; }
+ });
+
+ ddtm.FilterNode = dojo.extend(function(varnode, nodelist){
+ this._varnode = varnode;
+ this._nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ // Doing this in HTML requires a different buffer with a fake root node
+ var output = this._nodelist.render(context, new dojox.string.Builder());
+ context = context.update({ "var": output.toString() });
+ var filtered = this._varnode.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this._expression, this._nodelist.clone(buffer));
+ }
+ });
+
+ ddtm.FirstOfNode = dojo.extend(function(vars, text){
+ this._vars = vars;
+ this.vars = dojo.map(vars, function(item){
+ return new dojox.dtl._Filter(item);
+ });
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ for(var i = 0, item; item = this.vars[i]; i++){
+ var resolved = item.resolve(context);
+ if(typeof resolved != "undefined"){
+ if(resolved === null){
+ resolved = "null";
+ }
+ this.contents.set(resolved);
+ return this.contents.render(context, buffer);
+ }
+ }
+ return this.contents.unrender(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this._vars, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.SpacelessNode = dojo.extend(function(nodelist, text){
+ this.nodelist = nodelist;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ if(buffer.getParent){
+ // Unfortunately, we have to branch here
+ var watch = [
+ dojo.connect(buffer, "onAddNodeComplete", this, "_watch"),
+ dojo.connect(buffer, "onSetParent", this, "_watchParent")
+ ];
+ buffer = this.nodelist.render(context, buffer);
+ dojo.disconnect(watch[0]);
+ dojo.disconnect(watch[1]);
+ }else{
+ var value = this.nodelist.dummyRender(context);
+ this.contents.set(value.replace(/>\s+</g, '><'));
+ buffer = this.contents.render(context, buffer);
+ }
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return this.nodelist.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.nodelist.clone(buffer), this.contents.clone(buffer));
+ },
+ _isEmpty: function(node){
+ return (node.nodeType == 3 && !node.data.match(/[^\s\n]/));
+ },
+ _watch: function(node){
+ if(this._isEmpty(node)){
+ var remove = false;
+ if(node.parentNode.firstChild == node){
+ node.parentNode.removeChild(node);
+ }
+ }else{
+ var children = node.parentNode.childNodes;
+ if(node.nodeType == 1 && children.length > 2){
+ for(var i = 2, child; child = children[i]; i++){
+ if(children[i - 2].nodeType == 1 && this._isEmpty(children[i - 1])){
+ node.parentNode.removeChild(children[i - 1]);
+ return;
+ }
+ }
+ }
+ }
+ },
+ _watchParent: function(node){
+ var children = node.childNodes;
+ if(children.length){
+ while(node.childNodes.length){
+ var last = node.childNodes[node.childNodes.length - 1];
+ if(!this._isEmpty(last)){
+ return;
+ }
+ node.removeChild(last);
+ }
+ }
+ }
+ });
+
+ ddtm.TemplateTagNode = dojo.extend(function(tag, text){
+ this.tag = tag;
+ this.contents = text;
+ },
+ {
+ mapping: {
+ openblock: "{%",
+ closeblock: "%}",
+ openvariable: "{{",
+ closevariable: "}}",
+ openbrace: "{",
+ closebrace: "}",
+ opencomment: "{#",
+ closecomment: "#}"
+ },
+ render: function(context, buffer){
+ this.contents.set(this.mapping[this.tag]);
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.tag, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WidthRatioNode = dojo.extend(function(current, max, width, text){
+ this.current = new dd._Filter(current);
+ this.max = new dd._Filter(max);
+ this.width = width;
+ this.contents = text;
+ },
+ {
+ render: function(context, buffer){
+ var current = +this.current.resolve(context);
+ var max = +this.max.resolve(context);
+ if(typeof current != "number" || typeof max != "number" || !max){
+ this.contents.set("");
+ }else{
+ this.contents.set("" + Math.round((current / max) * this.width));
+ }
+ return this.contents.render(context, buffer);
+ },
+ unrender: function(context, buffer){
+ return this.contents.unrender(context, buffer);
+ },
+ clone: function(buffer){
+ return new this.constructor(this.current.getExpression(), this.max.getExpression(), this.width, this.contents.clone(buffer));
+ }
+ });
+
+ ddtm.WithNode = dojo.extend(function(target, alias, nodelist){
+ this.target = new dd._Filter(target);
+ this.alias = alias;
+ this.nodelist = nodelist;
+ },
+ {
+ render: function(context, buffer){
+ var target = this.target.resolve(context);
+ context = context.push();
+ context[this.alias] = target;
+ buffer = this.nodelist.render(context, buffer);
+ context = context.pop();
+ return buffer;
+ },
+ unrender: function(context, buffer){
+ return buffer;
+ },
+ clone: function(buffer){
+ return new this.constructor(this.target.getExpression(), this.alias, this.nodelist.clone(buffer));
+ }
+ });
+
+ dojo.mixin(ddtm, {
+ comment: function(parser, token){
+ // summary: Ignore everything between {% comment %} and {% endcomment %}
+ parser.skip_past("endcomment");
+ return dd._noOpNode;
+ },
+ debug: function(parser, token){
+ // summary: Output the current context, maybe add more stuff later.
+ return new ddtm.DebugNode(parser.create_text_node());
+ },
+ filter: function(parser, token){
+ // summary: Filter the contents of the blog through variable filters.
+ var rest = token.contents.split(null, 1)[1];
+ var varnode = parser.create_variable_node("var|" + rest);
+ var nodelist = parser.parse(["endfilter"]);
+ parser.next_token();
+ return new ddtm.FilterNode(varnode, nodelist);
+ },
+ firstof: function(parser, token){
+ var parts = token.split_contents().slice(1);
+ if(!parts.length){
+ throw new Error("'firstof' statement requires at least one argument");
+ }
+ return new ddtm.FirstOfNode(parts, parser.create_text_node());
+ },
+ spaceless: function(parser, token){
+ var nodelist = parser.parse(["endspaceless"]);
+ parser.delete_first_token();
+ return new ddtm.SpacelessNode(nodelist, parser.create_text_node());
+ },
+ templatetag: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 2){
+ throw new Error("'templatetag' statement takes one argument");
+ }
+ var tag = parts[1];
+ var mapping = ddtm.TemplateTagNode.prototype.mapping;
+ if(!mapping[tag]){
+ var keys = [];
+ for(var key in mapping){
+ keys.push(key);
+ }
+ throw new Error("Invalid templatetag argument: '" + tag + "'. Must be one of: " + keys.join(", "));
+ }
+ return new ddtm.TemplateTagNode(tag, parser.create_text_node());
+ },
+ widthratio: function(parser, token){
+ var parts = token.contents.split();
+ if(parts.length != 4){
+ throw new Error("widthratio takes three arguments");
+ }
+ var width = +parts[3];
+ if(typeof width != "number"){
+ throw new Error("widthratio final argument must be an integer");
+ }
+ return new ddtm.WidthRatioNode(parts[1], parts[2], width, parser.create_text_node());
+ },
+ with_: function(parser, token){
+ var parts = token.split_contents();
+ if(parts.length != 4 || parts[2] != "as"){
+ throw new Error("do_width expected format as 'with value as name'");
+ }
+ var nodelist = parser.parse(["endwith"]);
+ parser.next_token();
+ return new ddtm.WithNode(parts[1], parts[3], nodelist);
+ }
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/dtl/utils/date.js b/js/dojo-1.6/dojox/dtl/utils/date.js new file mode 100644 index 0000000..08f2fb5 --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/utils/date.js @@ -0,0 +1,83 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.utils.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.utils.date"] = true;
+dojo.provide("dojox.dtl.utils.date");
+
+dojo.require("dojox.date.php");
+
+dojox.dtl.utils.date.DateFormat = function(/*String*/ format){
+ dojox.date.php.DateFormat.call(this, format);
+}
+dojo.extend(dojox.dtl.utils.date.DateFormat, dojox.date.php.DateFormat.prototype, {
+ f: function(){
+ // summary:
+ // Time, in 12-hour hours and minutes, with minutes left off if they're zero.
+ // description:
+ // Examples: '1', '1:30', '2:05', '2'
+ // Proprietary extension.
+ return (!this.date.getMinutes()) ? this.g() : this.g() + ":" + this.i();
+ },
+ N: function(){
+ // summary: Month abbreviation in Associated Press style. Proprietary extension.
+ return dojox.dtl.utils.date._months_ap[this.date.getMonth()];
+ },
+ P: function(){
+ // summary:
+ // Time, in 12-hour hours, minutes and 'a.m.'/'p.m.', with minutes left off
+ // if they're zero and the strings 'midnight' and 'noon' if appropriate.
+ // description:
+ // Examples: '1 a.m.', '1:30 p.m.', 'midnight', 'noon', '12:30 p.m.'
+ // Proprietary extension.
+ if(!this.date.getMinutes() && !this.date.getHours()){
+ return 'midnight';
+ }
+ if(!this.date.getMinutes() && this.date.getHours() == 12){
+ return 'noon';
+ }
+ return this.f() + " " + this.a();
+ }
+});
+
+dojo.mixin(dojox.dtl.utils.date, {
+ format: function(/*Date*/ date, /*String*/ format){
+ var df = new dojox.dtl.utils.date.DateFormat(format);
+ return df.format(date);
+ },
+ timesince: function(d, now){
+ // summary:
+ // Takes two datetime objects and returns the time between then and now
+ // as a nicely formatted string, e.g "10 minutes"
+ // description:
+ // Adapted from http://blog.natbat.co.uk/archive/2003/Jun/14/time_since
+ if(!(d instanceof Date)){
+ d = new Date(d.year, d.month, d.day);
+ }
+ if(!now){
+ now = new Date();
+ }
+
+ var delta = Math.abs(now.getTime() - d.getTime());
+ for(var i = 0, chunk; chunk = dojox.dtl.utils.date._chunks[i]; i++){
+ var count = Math.floor(delta / chunk[0]);
+ if(count) break;
+ }
+ return count + " " + chunk[1](count);
+ },
+ _chunks: [
+ [60 * 60 * 24 * 365 * 1000, function(n){ return (n == 1) ? 'year' : 'years'; }],
+ [60 * 60 * 24 * 30 * 1000, function(n){ return (n == 1) ? 'month' : 'months'; }],
+ [60 * 60 * 24 * 7 * 1000, function(n){ return (n == 1) ? 'week' : 'weeks'; }],
+ [60 * 60 * 24 * 1000, function(n){ return (n == 1) ? 'day' : 'days'; }],
+ [60 * 60 * 1000, function(n){ return (n == 1) ? 'hour' : 'hours'; }],
+ [60 * 1000, function(n){ return (n == 1) ? 'minute' : 'minutes'; }]
+ ],
+ _months_ap: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."]
+});
+
+}
diff --git a/js/dojo-1.6/dojox/dtl/utils/date.xd.js b/js/dojo-1.6/dojox/dtl/utils/date.xd.js new file mode 100644 index 0000000..d728a7f --- /dev/null +++ b/js/dojo-1.6/dojox/dtl/utils/date.xd.js @@ -0,0 +1,88 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.dtl.utils.date"],
+["require", "dojox.date.php"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.dtl.utils.date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.utils.date"] = true;
+dojo.provide("dojox.dtl.utils.date");
+
+dojo.require("dojox.date.php");
+
+dojox.dtl.utils.date.DateFormat = function(/*String*/ format){
+ dojox.date.php.DateFormat.call(this, format);
+}
+dojo.extend(dojox.dtl.utils.date.DateFormat, dojox.date.php.DateFormat.prototype, {
+ f: function(){
+ // summary:
+ // Time, in 12-hour hours and minutes, with minutes left off if they're zero.
+ // description:
+ // Examples: '1', '1:30', '2:05', '2'
+ // Proprietary extension.
+ return (!this.date.getMinutes()) ? this.g() : this.g() + ":" + this.i();
+ },
+ N: function(){
+ // summary: Month abbreviation in Associated Press style. Proprietary extension.
+ return dojox.dtl.utils.date._months_ap[this.date.getMonth()];
+ },
+ P: function(){
+ // summary:
+ // Time, in 12-hour hours, minutes and 'a.m.'/'p.m.', with minutes left off
+ // if they're zero and the strings 'midnight' and 'noon' if appropriate.
+ // description:
+ // Examples: '1 a.m.', '1:30 p.m.', 'midnight', 'noon', '12:30 p.m.'
+ // Proprietary extension.
+ if(!this.date.getMinutes() && !this.date.getHours()){
+ return 'midnight';
+ }
+ if(!this.date.getMinutes() && this.date.getHours() == 12){
+ return 'noon';
+ }
+ return this.f() + " " + this.a();
+ }
+});
+
+dojo.mixin(dojox.dtl.utils.date, {
+ format: function(/*Date*/ date, /*String*/ format){
+ var df = new dojox.dtl.utils.date.DateFormat(format);
+ return df.format(date);
+ },
+ timesince: function(d, now){
+ // summary:
+ // Takes two datetime objects and returns the time between then and now
+ // as a nicely formatted string, e.g "10 minutes"
+ // description:
+ // Adapted from http://blog.natbat.co.uk/archive/2003/Jun/14/time_since
+ if(!(d instanceof Date)){
+ d = new Date(d.year, d.month, d.day);
+ }
+ if(!now){
+ now = new Date();
+ }
+
+ var delta = Math.abs(now.getTime() - d.getTime());
+ for(var i = 0, chunk; chunk = dojox.dtl.utils.date._chunks[i]; i++){
+ var count = Math.floor(delta / chunk[0]);
+ if(count) break;
+ }
+ return count + " " + chunk[1](count);
+ },
+ _chunks: [
+ [60 * 60 * 24 * 365 * 1000, function(n){ return (n == 1) ? 'year' : 'years'; }],
+ [60 * 60 * 24 * 30 * 1000, function(n){ return (n == 1) ? 'month' : 'months'; }],
+ [60 * 60 * 24 * 7 * 1000, function(n){ return (n == 1) ? 'week' : 'weeks'; }],
+ [60 * 60 * 24 * 1000, function(n){ return (n == 1) ? 'day' : 'days'; }],
+ [60 * 60 * 1000, function(n){ return (n == 1) ? 'hour' : 'hours'; }],
+ [60 * 1000, function(n){ return (n == 1) ? 'minute' : 'minutes'; }]
+ ],
+ _months_ap: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."]
+});
+
+}
+
+}};});
|
