roojs-core.js
authorAlan Knowles <alan@akbkhome.com>
Fri, 6 Apr 2012 16:18:08 +0000 (00:18 +0800)
committerAlan Knowles <alan@akbkhome.com>
Fri, 6 Apr 2012 16:18:08 +0000 (00:18 +0800)
roojs-core-debug.js
roojs-ui.js
roojs-ui-debug.js
roojs-all.js
roojs-debug.js

roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index aa12560..00e2e1a 100644 (file)
@@ -1142,7 +1142,7 @@ this.el.unmask(this.removeMask);},onLoad:function(){this.el.unmask(this.removeMa
 //Roo/XTemplate.js
 Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,arguments);if(this.html){this.preCompile();}};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var s=this.html;s=['<tpl>',s,'</tpl>'].join('');var re=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var A=/^<tpl\b[^>]*?for="(.*?)"/;var B=/^<tpl\b[^>]*?if="(.*?)"/;var C=/^<tpl\b[^>]*?exec="(.*?)"/;var m,id=0;var D=[];while(true==!!(m=s.match(re))){var m2=m[0].match(A);var m3=m[0].match(B);var m4=m[0].match(C);var E=null,fn=null,F=null;var G=m2&&m2[1]?m2[1]:'';if(m3){E=m3&&m3[1]?m3[1]:null;if(E){fn=new Function('values','parent','with(values){ return '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(m4){E=m4&&m4[1]?m4[1]:null;if(E){F=new Function('values','parent','with(values){ '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(G){switch(G){case '.':G=new Function('values','parent','with(values){ return values; }');break;case '..':G=new Function('values','parent','with(values){ return parent; }');break;default:G=new Function('values','parent','with(values){ return '+G+'; }');}}
 D.push({id:id,target:G,exec:F,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}for(var i=D.length-1;i>=0;--i){this.compileTpl(D[i]);}
-this.master=D[D.length-1];this.tpls=D;return this;},applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){C[C.length]=t.compiled.call(this,vs[i],B);}return C.join('');}return t.compiled.call(this,vs,B);},compileTpl:function(A){var fm=Roo.util.Format;var B=this.disableFormats!==true;var C=Roo.isGecko?"+":",";var fn=function(m,E,F,G){if(!F){F='htmlEncode';}if(F=='raw'){F=false;}if(E.substr(0,4)=='xtpl'){return "'"+C+'this.applySubTemplate('+E.substr(4)+', values, parent)'+C+"'";}var v;if(E.indexOf('.')!=-1){v=E;}else {v="values['"+E+"']";}if(F&&B){G=G?','+G:"";if(F.substr(0,5)!="this."){F="fm."+F+'(';}else {F='this.call("'+F.substr(5)+'", ';G=", values";}}else {G='';F="("+v+" === undefined ? '' : ";}return "'"+C+F+v+G+")"+C+"'";};var D;if(Roo.isGecko){D="tpl.compiled = function(values, parent){ return '"+A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {D=["tpl.compiled = function(values, parent){ return ['"];D.push(A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));D.push("'].join('');};");D=D.join('');}eval(D);Roo.log(D.replace(/\\n/,'\n'));return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});},apply:function(){return this.applyTemplate.apply(this,arguments);}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
+this.master=D[D.length-1];this.tpls=D;return this;},applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){C[C.length]=t.compiled.call(this,vs[i],B);}return C.join('');}return t.compiled.call(this,vs,B);},compileTpl:function(A){var fm=Roo.util.Format;var B=this.disableFormats!==true;var C=Roo.isGecko?"+":",";var fn=function(m,E,F,G){if(!F){F='htmlEncode';}if(F=='raw'){F=false;}if(E.substr(0,4)=='xtpl'){return "'"+C+'this.applySubTemplate('+E.substr(4)+', values, parent)'+C+"'";}var v;v=E;if(F&&B){G=G?','+G:"";if(F.substr(0,5)!="this."){F="fm."+F+'(';}else {F='this.call("'+F.substr(5)+'", ';G=", values";}}else {G='';F="("+v+" === undefined ? '' : ";}return "'"+C+F+v+G+")"+C+"'";};var D;if(Roo.isGecko){D="tpl.compiled = function(values, parent){ with(values) { return '"+A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};};";}else {D=["tpl.compiled = function(values, parent){ with (values) { return ['"];D.push(A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));D.push("'].join('');};};");D=D.join('');}eval(D);Roo.log(D.replace(/\\n/,'\n'));return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});},apply:function(){return this.applyTemplate.apply(this,arguments);}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
 //Roo/XComponent.js
 Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;}
 Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;var hp=this.parent?1:0;if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1)
index 0abd129..af0a794 100644 (file)
@@ -52353,21 +52353,26 @@ Roo.extend(Roo.XTemplate, Roo.Template, {
            var m2 = m[0].match(nameRe);
            var m3 = m[0].match(ifRe);
            var m4 = m[0].match(execRe);
-           var exp = null, fn = null, exec = null;
+           var exp = null,
+                fn = null,
+                exec = null;
            var name = m2 && m2[1] ? m2[1] : '';
            if(m3){
-               exp = m3 && m3[1] ? m3[1] : null;
-               if(exp){
+                // if - puts fn into test..
+                exp = m3 && m3[1] ? m3[1] : null;
+                if(exp){
                    fn = new Function('values', 'parent', 'with(values){ return '+(Roo.util.Format.htmlDecode(exp))+'; }');
-               }
+                }
            }
            if(m4){
+                // exec - calls a function... returns empty if true is  returned.
                exp = m4 && m4[1] ? m4[1] : null;
                if(exp){
                    exec = new Function('values', 'parent', 'with(values){ '+(Roo.util.Format.htmlDecode(exp))+'; }');
                }
            }
            if(name){
+                // for = 
                switch(name){
                    case '.':  name = new Function('values', 'parent', 'with(values){ return values; }'); break;
                    case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break;
@@ -52429,12 +52434,13 @@ Roo.extend(Roo.XTemplate, Roo.Template, {
             if(name.substr(0, 4) == 'xtpl'){
                 return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent)'+sep+"'";
             }
+            
             var v;
-            if(name.indexOf('.') != -1){
+            //if(name.indexOf('.') != -1){
                 v = name;
-            }else{
-                v = "values['" + name + "']";
-            }
+            //}else{
+            //    v = "values['" + name + "']";
+            //}
             if(format && useF){
                 args = args ? ',' + args : "";
                 if(format.substr(0, 5) != "this."){
@@ -52452,13 +52458,13 @@ Roo.extend(Roo.XTemplate, Roo.Template, {
         var body;
         // branched to use + in gecko and [].join() in others
         if(Roo.isGecko){
-            body = "tpl.compiled = function(values, parent){ return '" +
+            body = "tpl.compiled = function(values, parent){ with(values) { return '" +
                    tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
-                    "';};";
+                    "';};};";
         }else{
-            body = ["tpl.compiled = function(values, parent){ return ['"];
+            body = ["tpl.compiled = function(values, parent){ with (values) { return ['"];
             body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
-            body.push("'].join('');};");
+            body.push("'].join('');};};");
             body = body.join('');
         }
         
index 0784056..1af1336 100644 (file)
@@ -37851,21 +37851,26 @@ Roo.extend(Roo.XTemplate, Roo.Template, {
            var m2 = m[0].match(nameRe);
            var m3 = m[0].match(ifRe);
            var m4 = m[0].match(execRe);
-           var exp = null, fn = null, exec = null;
+           var exp = null,
+                fn = null,
+                exec = null;
            var name = m2 && m2[1] ? m2[1] : '';
            if(m3){
-               exp = m3 && m3[1] ? m3[1] : null;
-               if(exp){
+                // if - puts fn into test..
+                exp = m3 && m3[1] ? m3[1] : null;
+                if(exp){
                    fn = new Function('values', 'parent', 'with(values){ return '+(Roo.util.Format.htmlDecode(exp))+'; }');
-               }
+                }
            }
            if(m4){
+                // exec - calls a function... returns empty if true is  returned.
                exp = m4 && m4[1] ? m4[1] : null;
                if(exp){
                    exec = new Function('values', 'parent', 'with(values){ '+(Roo.util.Format.htmlDecode(exp))+'; }');
                }
            }
            if(name){
+                // for = 
                switch(name){
                    case '.':  name = new Function('values', 'parent', 'with(values){ return values; }'); break;
                    case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break;
@@ -37927,12 +37932,13 @@ Roo.extend(Roo.XTemplate, Roo.Template, {
             if(name.substr(0, 4) == 'xtpl'){
                 return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent)'+sep+"'";
             }
+            
             var v;
-            if(name.indexOf('.') != -1){
+            //if(name.indexOf('.') != -1){
                 v = name;
-            }else{
-                v = "values['" + name + "']";
-            }
+            //}else{
+            //    v = "values['" + name + "']";
+            //}
             if(format && useF){
                 args = args ? ',' + args : "";
                 if(format.substr(0, 5) != "this."){
@@ -37950,13 +37956,13 @@ Roo.extend(Roo.XTemplate, Roo.Template, {
         var body;
         // branched to use + in gecko and [].join() in others
         if(Roo.isGecko){
-            body = "tpl.compiled = function(values, parent){ return '" +
+            body = "tpl.compiled = function(values, parent){ with(values) { return '" +
                    tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
-                    "';};";
+                    "';};};";
         }else{
-            body = ["tpl.compiled = function(values, parent){ return ['"];
+            body = ["tpl.compiled = function(values, parent){ with (values) { return ['"];
             body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
-            body.push("'].join('');};");
+            body.push("'].join('');};};");
             body = body.join('');
         }
         
index d3bf17a..9272f89 100644 (file)
@@ -849,7 +849,7 @@ this.el.unmask(this.removeMask);},onLoad:function(){this.el.unmask(this.removeMa
 //Roo/XTemplate.js
 Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,arguments);if(this.html){this.preCompile();}};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var s=this.html;s=['<tpl>',s,'</tpl>'].join('');var re=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var A=/^<tpl\b[^>]*?for="(.*?)"/;var B=/^<tpl\b[^>]*?if="(.*?)"/;var C=/^<tpl\b[^>]*?exec="(.*?)"/;var m,id=0;var D=[];while(true==!!(m=s.match(re))){var m2=m[0].match(A);var m3=m[0].match(B);var m4=m[0].match(C);var E=null,fn=null,F=null;var G=m2&&m2[1]?m2[1]:'';if(m3){E=m3&&m3[1]?m3[1]:null;if(E){fn=new Function('values','parent','with(values){ return '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(m4){E=m4&&m4[1]?m4[1]:null;if(E){F=new Function('values','parent','with(values){ '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(G){switch(G){case '.':G=new Function('values','parent','with(values){ return values; }');break;case '..':G=new Function('values','parent','with(values){ return parent; }');break;default:G=new Function('values','parent','with(values){ return '+G+'; }');}}
 D.push({id:id,target:G,exec:F,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}for(var i=D.length-1;i>=0;--i){this.compileTpl(D[i]);}
-this.master=D[D.length-1];this.tpls=D;return this;},applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){C[C.length]=t.compiled.call(this,vs[i],B);}return C.join('');}return t.compiled.call(this,vs,B);},compileTpl:function(A){var fm=Roo.util.Format;var B=this.disableFormats!==true;var C=Roo.isGecko?"+":",";var fn=function(m,E,F,G){if(!F){F='htmlEncode';}if(F=='raw'){F=false;}if(E.substr(0,4)=='xtpl'){return "'"+C+'this.applySubTemplate('+E.substr(4)+', values, parent)'+C+"'";}var v;if(E.indexOf('.')!=-1){v=E;}else {v="values['"+E+"']";}if(F&&B){G=G?','+G:"";if(F.substr(0,5)!="this."){F="fm."+F+'(';}else {F='this.call("'+F.substr(5)+'", ';G=", values";}}else {G='';F="("+v+" === undefined ? '' : ";}return "'"+C+F+v+G+")"+C+"'";};var D;if(Roo.isGecko){D="tpl.compiled = function(values, parent){ return '"+A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {D=["tpl.compiled = function(values, parent){ return ['"];D.push(A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));D.push("'].join('');};");D=D.join('');}eval(D);Roo.log(D.replace(/\\n/,'\n'));return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});},apply:function(){return this.applyTemplate.apply(this,arguments);}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
+this.master=D[D.length-1];this.tpls=D;return this;},applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){C[C.length]=t.compiled.call(this,vs[i],B);}return C.join('');}return t.compiled.call(this,vs,B);},compileTpl:function(A){var fm=Roo.util.Format;var B=this.disableFormats!==true;var C=Roo.isGecko?"+":",";var fn=function(m,E,F,G){if(!F){F='htmlEncode';}if(F=='raw'){F=false;}if(E.substr(0,4)=='xtpl'){return "'"+C+'this.applySubTemplate('+E.substr(4)+', values, parent)'+C+"'";}var v;v=E;if(F&&B){G=G?','+G:"";if(F.substr(0,5)!="this."){F="fm."+F+'(';}else {F='this.call("'+F.substr(5)+'", ';G=", values";}}else {G='';F="("+v+" === undefined ? '' : ";}return "'"+C+F+v+G+")"+C+"'";};var D;if(Roo.isGecko){D="tpl.compiled = function(values, parent){ with(values) { return '"+A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};};";}else {D=["tpl.compiled = function(values, parent){ with (values) { return ['"];D.push(A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));D.push("'].join('');};};");D=D.join('');}eval(D);Roo.log(D.replace(/\\n/,'\n'));return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});},apply:function(){return this.applyTemplate.apply(this,arguments);}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
 //Roo/XComponent.js
 Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;}
 Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;var hp=this.parent?1:0;if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1)