//>>built define("dojox/dtl/dom",["dojo/_base/lang","./_base","dojox/string/tokenize","./Context","dojo/dom","dojo/dom-construct","dojo/_base/html","dojo/_base/array","dojo/_base/connect","dojo/_base/sniff"],function(_1,dd,_2,_3,_4,_5,_6,_7,_8,_9){ 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 _a=dd.text; var _b=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(_c){ if(typeof this._commentable=="undefined"){ this._commentable=false; var _d=document.createElement("div"),_e="Test comment handling, and long comments, using comments whenever possible."; _d.innerHTML=""; if(_d.childNodes.length&&_d.firstChild.nodeType==8&&_d.firstChild.data==_e){ this._commentable=true; } } if(!this._commentable){ _c=_c.replace(//g,"$1"); } if(_9("ie")){ _c=_c.replace(/\b(checked|disabled|readonly|style)="/g,"t$1=\""); } _c=_c.replace(/\bstyle="/g,"tstyle=\""); var _f; var _10=_9("webkit"); var _11=[[true,"select","option"],[_10,"tr","td|th"],[_10,"thead","tr","th"],[_10,"tbody","tr","td"],[_10,"table","tbody|thead|tr","tr","td"]]; var _12=[]; for(var i=0,_13;_13=_11[i];i++){ if(!_13[0]){ continue; } if(_c.indexOf("<"+_13[1])!=-1){ var _14=new RegExp("<"+_13[1]+"(?:.|\n)*?>((?:.|\n)+?)","ig"); tagLoop: while(_f=_14.exec(_c)){ var _15=_13[2].split("|"); var _16=[]; for(var j=0,_17;_17=_15[j];j++){ _16.push("<"+_17+"(?:.|\n)*?>(?:.|\n)*?"); } var _18=[]; var _19=_2(_f[1],new RegExp("("+_16.join("|")+")","ig"),function(_1a){ var tag=/<(\w+)/.exec(_1a)[1]; if(!_18[tag]){ _18[tag]=true; _18.push(tag); } return {data:_1a}; }); if(_18.length){ var tag=(_18.length==1)?_18[0]:_13[2].split("|")[0]; var _1b=[]; for(var j=0,jl=_19.length;j"; }else{ if(tag==_13[p]){ continue; }else{ _1e+="<"+_13[p]+">"; } } } _1e+="DTL"; for(var p=_13.length-1;p>1;p--){ if(p==2){ _1e+=""; }else{ if(tag==_13[p]){ continue; }else{ _1e+=""; } } } _1b.push("ÿ"+_12.length); _12.push(_1e); } } } _c=_c.replace(_f[1],_1b.join("")); } } } } for(var i=_12.length;i--;){ _c=_c.replace("ÿ"+i,_12[i]); } var re=/\b([a-zA-Z_:][a-zA-Z0-9_\-\.:]*)=['"]/g; while(_f=re.exec(_c)){ var _1f=_f[1].toLowerCase(); if(_1f=="dtlinstruction"){ continue; } if(_1f!=_f[1]){ this._uppers[_1f]=_f[1]; } this._attributes[_1f]=true; } var _d=document.createElement("div"); _d.innerHTML=_c; var _20={nodes:[]}; while(_d.childNodes.length){ _20.nodes.push(_d.removeChild(_d.childNodes[0])); } return _20; },tokenize:function(_21){ var _22=[]; for(var i=0,_23;_23=_21[i++];){ if(_23.nodeType!=1){ this.__tokenize(_23,_22); }else{ this._tokenize(_23,_22); } } return _22; },_swallowed:[],_tokenize:function(_24,_25){ var _26=false; var _27=this._swallowed; var i,j,tag,_28; if(!_25.first){ _26=_25.first=true; var _29=dd.register.getAttributeTags(); for(i=0;tag=_29[i];i++){ try{ (tag[2])({swallowNode:function(){ throw 1; }},new dd.Token(dd.TOKEN_ATTR,"")); } catch(e){ _27.push(tag); } } } for(i=0;tag=_27[i];i++){ var _2a=_24.getAttribute(tag[0]); if(_2a){ var _27=false; var _2b=(tag[2])({swallowNode:function(){ _27=true; return _24; }},new dd.Token(dd.TOKEN_ATTR,tag[0]+" "+_2a)); if(_27){ if(_24.parentNode&&_24.parentNode.removeChild){ _24.parentNode.removeChild(_24); } _25.push([dd.TOKEN_CUSTOM,_2b]); return; } } } var _2c=[]; if(_9("ie")&&_24.tagName=="SCRIPT"){ _2c.push({nodeType:3,data:_24.text}); _24.text=""; }else{ for(i=0;_28=_24.childNodes[i];i++){ _2c.push(_28); } } _25.push([dd.TOKEN_NODE,_24]); var _2d=false; if(_2c.length){ _25.push([dd.TOKEN_CHANGE,_24]); _2d=true; } for(var key in this._attributes){ var _2e=false; var _2f=""; if(key=="class"){ _2f=_24.className||_2f; }else{ if(key=="for"){ _2f=_24.htmlFor||_2f; }else{ if(key=="value"&&_24.value==_24.innerHTML){ continue; }else{ if(_24.getAttribute){ _2f=_24.getAttribute(key,2)||_2f; if(key=="href"||key=="src"){ if(_9("ie")){ var _30=location.href.lastIndexOf(location.hash); var _31=location.href.substring(0,_30).split("/"); _31.pop(); _31=_31.join("/")+"/"; if(_2f.indexOf(_31)==0){ _2f=_2f.replace(_31,""); } _2f=decodeURIComponent(_2f); } }else{ if(key=="tstyle"){ _2e=key; key="style"; }else{ if(dd.BOOLS[key.slice(1)]&&_1.trim(_2f)){ key=key.slice(1); }else{ if(this._uppers[key]&&_1.trim(_2f)){ _2e=this._uppers[key]; } } } } } } } } if(_2e){ _24.setAttribute(_2e,""); _24.removeAttribute(_2e); } if(typeof _2f=="function"){ _2f=_2f.toString().replace(this._re4,"$1"); } if(!_2d){ _25.push([dd.TOKEN_CHANGE,_24]); _2d=true; } _25.push([dd.TOKEN_ATTR,_24,key,_2f]); } for(i=0,_28;_28=_2c[i];i++){ if(_28.nodeType==1){ var _32=_28.getAttribute("dtlinstruction"); if(_32){ _28.parentNode.removeChild(_28); _28={nodeType:8,data:_32}; } } this.__tokenize(_28,_25); } if(!_26&&_24.parentNode&&_24.parentNode.tagName){ if(_2d){ _25.push([dd.TOKEN_CHANGE,_24,true]); } _25.push([dd.TOKEN_CHANGE,_24.parentNode]); _24.parentNode.removeChild(_24); }else{ _25.push([dd.TOKEN_CHANGE,_24,true,true]); } },__tokenize:function(_33,_34){ var _35=_33.data; switch(_33.nodeType){ case 1: this._tokenize(_33,_34); return; case 3: if(_35.match(/[^\s\n]/)&&(_35.indexOf("{{")!=-1||_35.indexOf("{%")!=-1)){ var _36=_a.tokenize(_35); for(var j=0,_37;_37=_36[j];j++){ if(typeof _37=="string"){ _34.push([dd.TOKEN_TEXT,_37]); }else{ _34.push(_37); } } }else{ _34.push([_33.nodeType,_33]); } if(_33.parentNode){ _33.parentNode.removeChild(_33); } return; case 8: if(_35.indexOf("{%")==0){ var _37=_1.trim(_35.slice(2,-2)); if(_37.substr(0,5)=="load "){ var _38=_1.trim(_37).split(/\s+/g); for(var i=1,_39;_39=_38[i];i++){ if(/\./.test(_39)){ _39=_39.replace(/\./g,"/"); } require([_39]); } } _34.push([dd.TOKEN_BLOCK,_37]); } if(_35.indexOf("{{")==0){ _34.push([dd.TOKEN_VAR,_1.trim(_35.slice(2,-2))]); } if(_33.parentNode){ _33.parentNode.removeChild(_33); } return; } }}; dd.DomTemplate=_1.extend(function(obj){ if(!obj.nodes){ var _3a=_4.byId(obj); if(_3a&&_3a.nodeType==1){ _7.forEach(["class","src","href","name","value"],function(_3b){ _b._attributes[_3b]=true; }); obj={nodes:[_3a]}; }else{ if(typeof obj=="object"){ obj=_a.getTemplateString(obj); } obj=_b.getTemplate(obj); } } var _3c=_b.tokenize(obj.nodes); if(dd.tests){ this.tokens=_3c.slice(0); } var _3d=new dd._DomParser(_3c); this.nodelist=_3d.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(_3e,_3f){ _3f=this.buffer=_3f||this.getBuffer(); this.rootNode=null; var _40=this.nodelist.render(_3e||new dd.Context({}),_3f); for(var i=0,_41;_41=_3f._cache[i];i++){ if(_41._cache){ _41._cache.length=0; } } return _40; },unrender:function(_42,_43){ return this.nodelist.unrender(_42,_43); }}); dd.DomBuffer=_1.extend(function(_44){ this._parent=_44; this._cache=[]; },{concat:function(_45){ var _46=this._parent; if(_46&&_45.parentNode&&_45.parentNode===_46&&!_46._dirty){ return this; } if(_45.nodeType==1&&!this.rootNode){ this.rootNode=_45||true; return this; } if(!_46){ if(_45.nodeType==3&&_1.trim(_45.data)){ throw new Error("Text should not exist outside of the root node in template"); } return this; } if(this._closed){ if(_45.nodeType==3&&!_1.trim(_45.data)){ return this; }else{ throw new Error("Content should not exist outside of the root node in template"); } } if(_46._dirty){ if(_45._drawn&&_45.parentNode==_46){ var _47=_46._cache; if(_47){ for(var i=0,_48;_48=_47[i];i++){ this.onAddNode&&this.onAddNode(_48); _46.insertBefore(_48,_45); this.onAddNodeComplete&&this.onAddNodeComplete(_48); } _47.length=0; } } _46._dirty=false; } if(!_46._cache){ _46._cache=[]; this._cache.push(_46); } _46._dirty=true; _46._cache.push(_45); 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,_49){ var old=_6.attr(this._parent,key); if(this.onChangeAttribute&&old!=_49){ this.onChangeAttribute(this._parent,key,old,_49); } if(key=="style"){ this._parent.style.cssText=_49; }else{ _6.attr(this._parent,key,_49); if(key=="value"){ this._parent.setAttribute(key,_49); } } return this; },addEvent:function(_4a,_4b,fn,_4c){ if(!_4a.getThis()){ throw new Error("You must use Context.setObject(instance)"); } this.onAddEvent&&this.onAddEvent(this.getParent(),_4b,fn); var _4d=fn; if(_1.isArray(_4c)){ _4d=function(e){ this[fn].apply(this,[e].concat(_4c)); }; } return _8.connect(this.getParent(),_4b,_4a.getThis(),_4d); },setParent:function(_4e,up,_4f){ if(!this._parent){ this._parent=this._first=_4e; } if(up&&_4f&&_4e===this._first){ this._closed=true; } if(up){ var _50=this._parent; var _51=""; var ie=_9("ie")&&_50.tagName=="SCRIPT"; if(ie){ _50.text=""; } if(_50._dirty){ var _52=_50._cache; var _53=(_50.tagName=="SELECT"&&!_50.options.length); for(var i=0,_54;_54=_52[i];i++){ if(_54!==_50){ this.onAddNode&&this.onAddNode(_54); if(ie){ _51+=_54.data; }else{ _50.appendChild(_54); if(_53&&_54.defaultSelected&&i){ _53=i; } } this.onAddNodeComplete&&this.onAddNodeComplete(_54); } } if(_53){ _50.options.selectedIndex=(typeof _53=="number")?_53:0; } _52.length=0; _50._dirty=false; } if(ie){ _50.text=_51; } } this._parent=_4e; this.onSetParent&&this.onSetParent(_4e,up,_4f); return this; },getParent:function(){ return this._parent; },getRootNode:function(){ return this.rootNode; }}); dd._DomNode=_1.extend(function(_55){ this.contents=_55; },{render:function(_56,_57){ this._rendered=true; return _57.concat(this.contents); },unrender:function(_58,_59){ if(!this._rendered){ return _59; } this._rendered=false; return _59.remove(this.contents); },clone:function(_5a){ return new this.constructor(this.contents); }}); dd._DomNodeList=_1.extend(function(_5b){ this.contents=_5b||[]; },{push:function(_5c){ this.contents.push(_5c); },unshift:function(_5d){ this.contents.unshift(_5d); },render:function(_5e,_5f,_60){ _5f=_5f||dd.DomTemplate.prototype.getBuffer(); if(_60){ var _61=_5f.getParent(); } for(var i=0;i