Roo.form.DisplayField - add x-for-displayfield css class
authorAlan Knowles <alan@akbkhome.com>
Wed, 15 Jun 2011 04:42:52 +0000 (04:42 +0000)
committerAlan Knowles <alan@akbkhome.com>
Wed, 7 Sep 2011 02:01:15 +0000 (10:01 +0800)
Roo/form/DisplayField.js
css/form.css
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 672841d..8b77ac0 100644 (file)
@@ -76,7 +76,7 @@ Roo.extend(Roo.form.DisplayField, Roo.form.TextField,  {
         //if(this.inputValue !== undefined){
         this.wrap = this.el.wrap();
         
-        this.viewEl = this.wrap.createChild({ tag: 'div'});
+        this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
         
         if (this.bodyStyle) {
             this.viewEl.applyStyles(this.bodyStyle);
index eeba77c..a161845 100644 (file)
@@ -18,7 +18,9 @@
     position: relative;
     z-index: 2;
 }
-
+.x-form-displayfield { 
+    padding-top: 3px;
+}
 .x-form-label-right label
 {
     text-align: right;
index a351040..c61e772 100644 (file)
@@ -773,7 +773,7 @@ Roo.form.GridField=function(A){Roo.form.GridField.superclass.constructor.call(th
 this.grid=new Roo.grid[this.xgrid.xtype](this.viewEl,this.xgrid);this.grid.render();this.grid.getDataSource().on('remove',this.refreshValue,this);this.grid.getDataSource().on('update',this.refreshValue,this);this.grid.on('afteredit',this.refreshValue,this);},setValue:function(v){v=v||[];if(this.grid&&this.grid.getDataSource()&&typeof(v)!='undefined'){var ds=this.grid.getDataSource();var A={}
 A[ds.reader.meta.root]=typeof(v)=='string'?Roo.decode(v):v;ds.loadData(A);}
 Roo.form.GridField.superclass.setValue.call(this,v);this.refreshValue();},refreshValue:function(){var A=[];this.grid.getDataSource().each(function(r){A.push(r.data);});this.el.dom.value=Roo.encode(A);}});
-Roo.form.DisplayField=function(A){Roo.form.DisplayField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DisplayField,Roo.form.TextField,{inputType:'hidden',allowBlank:true,readOnly:true,focusClass:undefined,fieldClass:'x-form-field',valueRenderer:undefined,width:100,onResize:function(){Roo.form.DisplayField.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.DisplayField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap();this.viewEl=this.wrap.createChild({tag:'div'});if(this.bodyStyle){this.viewEl.applyStyles(this.bodyStyle);}
+Roo.form.DisplayField=function(A){Roo.form.DisplayField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DisplayField,Roo.form.TextField,{inputType:'hidden',allowBlank:true,readOnly:true,focusClass:undefined,fieldClass:'x-form-field',valueRenderer:undefined,width:100,onResize:function(){Roo.form.DisplayField.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.DisplayField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap();this.viewEl=this.wrap.createChild({tag:'div',cls:'x-form-displayfield'});if(this.bodyStyle){this.viewEl.applyStyles(this.bodyStyle);}
 this.setValue(this.value);},onClick:function(){},setValue:function(v){this.value=v;var A=this.valueRenderer?this.valueRenderer(v):String.format('{0}',v);if(!this.viewEl){return;}
 this.viewEl.dom.innerHTML=A;Roo.form.DisplayField.superclass.setValue.call(this,v);}});
 Roo.form.DayPicker=function(A){Roo.form.DayPicker.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DayPicker,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},actionMode:'viewEl',inputType:'hidden',inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-form-daypick-item '});var r1='<table><tr>';var r2='<tr class="x-form-daypick-icons">';for(var i=0;i<7;i++){r1+='<td><div>'+Date.dayNames[i].substring(0,3)+'</div></td>';r2+='<td><img class="x-menu-item-icon" src="'+Roo.BLANK_IMAGE_URL+'"></td>';}var B=this.wrap.createChild(r1+'</tr>'+r2+'</tr></table>');B.select('img').on('click',this.onClick,this);this.viewEl=B;this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);},initValue:Roo.emptyFn,getValue:function(){return this.el.dom.value;},onClick:function(e){Roo.get(e.target).toggleClass('x-menu-item-checked');this.refreshValue();},refreshValue:function(){var A='';this.viewEl.select('img',true).each(function(e,i,n){A+=e.is(".x-menu-item-checked")?String(n):'';});this.setValue(A,true);},setValue:function(v,A){if(!this.el.dom){return;}var B=this.el.dom.value;this.el.dom.value=v;if(A){return;}
@@ -952,12 +952,11 @@ Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,argumen
 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;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,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(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);return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});var s=this.subs;},apply:function(){return this.applyTemplate.apply(this,arguments);},compile:function(){return this;}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
 Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true,'buildcomplete':true});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,items:false});Roo.apply(Roo.XComponent,{buildCompleted:false,topModule:false,modules:[],register:function(A){this.modules.push(A);},toObject:function(A){if(!A||typeof(A)=='object'){return A;}var ar=A.split('.');var rt,o;rt=ar.shift();eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');if(o===false){throw "Module not found : "+A;}
+Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,items:false});Roo.apply(Roo.XComponent,{buildCompleted:false,topModule:false,modules:[],elmodules:[],register:function(A){this.modules.push(A);},toObject:function(A){if(!A||typeof(A)=='object'){return A;}if(A[0]=='#'){return A;}var ar=A.split('.');var rt,o;rt=ar.shift();eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');if(o===false){throw "Module not found : "+A;}
 Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+A;}
-o=o[e];});return o;},preBuild:function(){Roo.each(this.modules,function(A){A.parent=this.toObject(A.parent);if(!A.parent){this.topModule=A;return;}if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}
-A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if(!this.topModule||!this.topModule.modules){throw "No top level modules to build";}var C=[this.topModule];var D=function(m){C.push(m);if(m.modules){m.modules.keySort('ASC',B);m.modules.each(D);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}}
-this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);return C;},build:function(){this.preBuild();var A=this.buildOrder();if(!A.length){throw "NO modules!!!";}
-Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();C.topModule.fireEvent('buildcomplete',C.topModule);return;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();}if(!m.parent){var F=new Ext.BorderLayout(document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:true,minTabWidth:140}});var G=m.tree();G.region='center';m.el=F.addxtype(G);m.panel=m.el;m.layout=m.panel.layout;return D.defer(10,C);}var G=m.tree();G.region=G.region||m.region;m.el=m.parent.el.addxtype(G);m.fireEvent('built',m);m.panel=m.el;m.layout=m.panel.layout;D.defer(10,C);}
+o=o[e];});return o;},preBuild:function(){Roo.each(this.modules,function(A){A.parent=this.toObject(A.parent);if(!A.parent){this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}
+A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if((!this.topModule||!this.topModule.modules)&&!this.elmodules.length){throw "No top level modules to build";}var C=this.topModule?[this.topModule]:[];Roo.each(this.elmodules,function(e){C.push(e)});var D=function(m){C.push(m);if(m.modules){m.modules.keySort('ASC',B);m.modules.each(D);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule){this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);}return C;},build:function(){this.preBuild();var A=this.buildOrder();if(!A.length){throw "NO modules!!!";}
+Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();if(C.topModule){C.topModule.fireEvent('buildcomplete',C.topModule);}return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();}if(!m.parent||(typeof(m.parent)=='string'&&m.parent[0]=='#')){var F=m.parent?Roo.get(m.parent.substr(1)):document.body;if(!F){Roo.log("not rendering module "+m.name+" "+m.parent+" no found");return D.defer(10,C);}var G=new Ext.BorderLayout(m.parent?Roo.get(m.parent.substr(1)):document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:m.parent?false:true,hideTabs:m.parent?true:false,minTabWidth:140}});var H=m.tree();H.region='center';m.el=G.addxtype(H);m.panel=m.el;m.layout=m.panel.layout;return D.defer(10,C);}var H=m.tree();H.region=H.region||m.region;m.el=m.parent.el.addxtype(H);m.fireEvent('built',m);m.panel=m.el;m.layout=m.panel.layout;return D.defer(10,C);}
 D.defer(1,C);}});
 Roo.Login=function(A){this.addEvents({'refreshed':true});Roo.apply(this,A);Roo.onReady(function(){this.onLoad();},this);Roo.Login.superclass.constructor.call(this,this);}
 Roo.extend(Roo.Login,Roo.LayoutDialog,{method:'POST',url:'',user:false,checkFails:0,intervalID:0,onLoad:function(){if(Roo.get('loading')){Roo.get('loading').remove();}
index eb2005f..62e7fa1 100644 (file)
@@ -42670,7 +42670,7 @@ Roo.extend(Roo.form.DisplayField, Roo.form.TextField,  {
         //if(this.inputValue !== undefined){
         this.wrap = this.el.wrap();
         
-        this.viewEl = this.wrap.createChild({ tag: 'div'});
+        this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
         
         if (this.bodyStyle) {
             this.viewEl.applyStyles(this.bodyStyle);
@@ -51199,6 +51199,11 @@ Roo.XTemplate.from = function(el){
         }
      ]
  *})
+ *
+ * Roo.onReady(function() {
+    Roo.XComponent.build();
+ })
+ *
  * @extends Roo.util.Observable
  * @constructor
  * @param cfg {Object} configuration of component
@@ -51280,8 +51285,6 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
      */
     items : false
      
-     
-    
 });
 
 Roo.apply(Roo.XComponent, {
@@ -51304,12 +51307,18 @@ Roo.apply(Roo.XComponent, {
     /**
      * @property  modules
      * array of modules to be created by registration system.
-     * @type Roo.XComponent
+     * @type {Array} of Roo.XComponent
      */
     
     modules : [],
       
+     /**
+     * @property  elmodules
+     * array of modules to be created by which use #ID 
+     * @type {Array} of Roo.XComponent
+     */
     
+    elmodules : [],
     /**
      * Register components to be built later.
      *
@@ -51337,6 +51346,7 @@ Roo.apply(Roo.XComponent, {
     },
     /**
      * convert a string to an object..
+     * eg. 'AAA.BBB' -> finds AAA.BBB
      * 
      */
     
@@ -51345,12 +51355,18 @@ Roo.apply(Roo.XComponent, {
         if (!str || typeof(str) == 'object') {
             return str;
         }
+        if (str[0]=='#') {
+            return str;
+        }
         var ar = str.split('.');
         var rt, o;
         rt = ar.shift();
             /** eval:var:o */
         eval('if (typeof ' + rt + ' == "undefined"){ o = false;} o = ' + rt + ';');
         if (o === false) {
+             
+            
+            
             throw "Module not found : " + str;
         }
         Roo.each(ar, function(e) {
@@ -51379,6 +51395,10 @@ Roo.apply(Roo.XComponent, {
                 this.topModule = obj;
                 return;
             }
+            if (typeof(obj.parent) == 'string') {
+                this.elmodules.push(obj);
+                return;
+            }
             
             if (!obj.parent.modules) {
                 obj.parent.modules = new Roo.util.MixedCollection(false, 
@@ -51402,12 +51422,13 @@ Roo.apply(Roo.XComponent, {
             return String(a).toUpperCase() > String(b).toUpperCase() ? 1 : -1;
         };
         
-        if (!this.topModule || !this.topModule.modules) {
+        if ((!this.topModule || !this.topModule.modules) && !this.elmodules.length) {
             throw "No top level modules to build";
         }
-       
+        
         // make a flat list in order of modules to build.
-        var mods = [ this.topModule ];
+        var mods = this.topModule ? [ this.topModule ] : [];
+        Roo.each(this.elmodules,function(e) { mods.push(e) });
         
         
         // add modules to their parents..
@@ -51426,8 +51447,10 @@ Roo.apply(Roo.XComponent, {
             }
             
         }
-        this.topModule.modules.keySort('ASC',  cmp );
-        this.topModule.modules.each(addMod);
+        if (this.topModule) { 
+            this.topModule.modules.keySort('ASC',  cmp );
+            this.topModule.modules.each(addMod);
+        }
         return mods;
     },
     
@@ -51471,8 +51494,11 @@ Roo.apply(Roo.XComponent, {
             if (!mods.length) {
                 Roo.debug && Roo.log('hide?');
                 Roo.MessageBox.hide();
-                _this.topModule.fireEvent('buildcomplete', _this.topModule);
-                return;    
+                if (_this.topModule) { 
+                    _this.topModule.fireEvent('buildcomplete', _this.topModule);
+                }
+                // THE END...
+                return false;    
             }
             
             var m = mods.shift();
@@ -51498,19 +51524,29 @@ Roo.apply(Roo.XComponent, {
                 return progressRun(); // we do not update the display!
             }
             
-            if (!m.parent) {
+            if (!m.parent || (typeof(m.parent) == 'string' && m.parent[0] == '#')) {
                 // it's a top level one..
-                var layoutbase = new Ext.BorderLayout(document.body, {
-               
-                    center: {
-                         titlebar: false,
-                         autoScroll:false,
-                         closeOnTab: true,
-                         tabPosition: 'top',
-                         //resizeTabs: true,
-                         alwaysShowTabs: true,
-                         minTabWidth: 140
-                    }
+                var ctr = m.parent ? Roo.get(m.parent.substr(1)) : document.body;
+                if (!ctr) {
+                    Roo.log("not rendering module " + m.name + " " + m.parent + " no found");
+                     return progressRun.defer(10, _this);
+                    
+                }
+                
+                
+                var layoutbase = new Ext.BorderLayout(
+                    m.parent ? Roo.get(m.parent.substr(1)) : document.body,
+                    {
+                        center: {
+                             titlebar: false,
+                             autoScroll:false,
+                             closeOnTab: true,
+                             tabPosition: 'top',
+                             //resizeTabs: true,
+                             alwaysShowTabs: m.parent ? false : true,
+                             hideTabs : m.parent ? true : false,
+                             minTabWidth: 140
+                        }
                 });
                 var tree = m.tree();
                 tree.region = 'center';
@@ -51526,8 +51562,8 @@ Roo.apply(Roo.XComponent, {
             m.fireEvent('built', m);
             m.panel = m.el;
             m.layout = m.panel.layout;    
-            progressRun.defer(10, _this); 
-            
+            return progressRun.defer(10, _this); 
+             
         }
         progressRun.defer(1, _this);
      
index d4485e7..574e69d 100644 (file)
@@ -28225,7 +28225,7 @@ Roo.extend(Roo.form.DisplayField, Roo.form.TextField,  {
         //if(this.inputValue !== undefined){
         this.wrap = this.el.wrap();
         
-        this.viewEl = this.wrap.createChild({ tag: 'div'});
+        this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
         
         if (this.bodyStyle) {
             this.viewEl.applyStyles(this.bodyStyle);
@@ -36754,6 +36754,11 @@ Roo.XTemplate.from = function(el){
         }
      ]
  *})
+ *
+ * Roo.onReady(function() {
+    Roo.XComponent.build();
+ })
+ *
  * @extends Roo.util.Observable
  * @constructor
  * @param cfg {Object} configuration of component
@@ -36835,8 +36840,6 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
      */
     items : false
      
-     
-    
 });
 
 Roo.apply(Roo.XComponent, {
@@ -36859,12 +36862,18 @@ Roo.apply(Roo.XComponent, {
     /**
      * @property  modules
      * array of modules to be created by registration system.
-     * @type Roo.XComponent
+     * @type {Array} of Roo.XComponent
      */
     
     modules : [],
       
+     /**
+     * @property  elmodules
+     * array of modules to be created by which use #ID 
+     * @type {Array} of Roo.XComponent
+     */
     
+    elmodules : [],
     /**
      * Register components to be built later.
      *
@@ -36892,6 +36901,7 @@ Roo.apply(Roo.XComponent, {
     },
     /**
      * convert a string to an object..
+     * eg. 'AAA.BBB' -> finds AAA.BBB
      * 
      */
     
@@ -36900,12 +36910,18 @@ Roo.apply(Roo.XComponent, {
         if (!str || typeof(str) == 'object') {
             return str;
         }
+        if (str[0]=='#') {
+            return str;
+        }
         var ar = str.split('.');
         var rt, o;
         rt = ar.shift();
             /** eval:var:o */
         eval('if (typeof ' + rt + ' == "undefined"){ o = false;} o = ' + rt + ';');
         if (o === false) {
+             
+            
+            
             throw "Module not found : " + str;
         }
         Roo.each(ar, function(e) {
@@ -36934,6 +36950,10 @@ Roo.apply(Roo.XComponent, {
                 this.topModule = obj;
                 return;
             }
+            if (typeof(obj.parent) == 'string') {
+                this.elmodules.push(obj);
+                return;
+            }
             
             if (!obj.parent.modules) {
                 obj.parent.modules = new Roo.util.MixedCollection(false, 
@@ -36957,12 +36977,13 @@ Roo.apply(Roo.XComponent, {
             return String(a).toUpperCase() > String(b).toUpperCase() ? 1 : -1;
         };
         
-        if (!this.topModule || !this.topModule.modules) {
+        if ((!this.topModule || !this.topModule.modules) && !this.elmodules.length) {
             throw "No top level modules to build";
         }
-       
+        
         // make a flat list in order of modules to build.
-        var mods = [ this.topModule ];
+        var mods = this.topModule ? [ this.topModule ] : [];
+        Roo.each(this.elmodules,function(e) { mods.push(e) });
         
         
         // add modules to their parents..
@@ -36981,8 +37002,10 @@ Roo.apply(Roo.XComponent, {
             }
             
         }
-        this.topModule.modules.keySort('ASC',  cmp );
-        this.topModule.modules.each(addMod);
+        if (this.topModule) { 
+            this.topModule.modules.keySort('ASC',  cmp );
+            this.topModule.modules.each(addMod);
+        }
         return mods;
     },
     
@@ -37026,8 +37049,11 @@ Roo.apply(Roo.XComponent, {
             if (!mods.length) {
                 Roo.debug && Roo.log('hide?');
                 Roo.MessageBox.hide();
-                _this.topModule.fireEvent('buildcomplete', _this.topModule);
-                return;    
+                if (_this.topModule) { 
+                    _this.topModule.fireEvent('buildcomplete', _this.topModule);
+                }
+                // THE END...
+                return false;    
             }
             
             var m = mods.shift();
@@ -37053,19 +37079,29 @@ Roo.apply(Roo.XComponent, {
                 return progressRun(); // we do not update the display!
             }
             
-            if (!m.parent) {
+            if (!m.parent || (typeof(m.parent) == 'string' && m.parent[0] == '#')) {
                 // it's a top level one..
-                var layoutbase = new Ext.BorderLayout(document.body, {
-               
-                    center: {
-                         titlebar: false,
-                         autoScroll:false,
-                         closeOnTab: true,
-                         tabPosition: 'top',
-                         //resizeTabs: true,
-                         alwaysShowTabs: true,
-                         minTabWidth: 140
-                    }
+                var ctr = m.parent ? Roo.get(m.parent.substr(1)) : document.body;
+                if (!ctr) {
+                    Roo.log("not rendering module " + m.name + " " + m.parent + " no found");
+                     return progressRun.defer(10, _this);
+                    
+                }
+                
+                
+                var layoutbase = new Ext.BorderLayout(
+                    m.parent ? Roo.get(m.parent.substr(1)) : document.body,
+                    {
+                        center: {
+                             titlebar: false,
+                             autoScroll:false,
+                             closeOnTab: true,
+                             tabPosition: 'top',
+                             //resizeTabs: true,
+                             alwaysShowTabs: m.parent ? false : true,
+                             hideTabs : m.parent ? true : false,
+                             minTabWidth: 140
+                        }
                 });
                 var tree = m.tree();
                 tree.region = 'center';
@@ -37081,8 +37117,8 @@ Roo.apply(Roo.XComponent, {
             m.fireEvent('built', m);
             m.panel = m.el;
             m.layout = m.panel.layout;    
-            progressRun.defer(10, _this); 
-            
+            return progressRun.defer(10, _this); 
+             
         }
         progressRun.defer(1, _this);
      
index 2f61af5..0d63566 100644 (file)
@@ -530,7 +530,7 @@ Roo.form.GridField=function(A){Roo.form.GridField.superclass.constructor.call(th
 this.grid=new Roo.grid[this.xgrid.xtype](this.viewEl,this.xgrid);this.grid.render();this.grid.getDataSource().on('remove',this.refreshValue,this);this.grid.getDataSource().on('update',this.refreshValue,this);this.grid.on('afteredit',this.refreshValue,this);},setValue:function(v){v=v||[];if(this.grid&&this.grid.getDataSource()&&typeof(v)!='undefined'){var ds=this.grid.getDataSource();var A={}
 A[ds.reader.meta.root]=typeof(v)=='string'?Roo.decode(v):v;ds.loadData(A);}
 Roo.form.GridField.superclass.setValue.call(this,v);this.refreshValue();},refreshValue:function(){var A=[];this.grid.getDataSource().each(function(r){A.push(r.data);});this.el.dom.value=Roo.encode(A);}});
-Roo.form.DisplayField=function(A){Roo.form.DisplayField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DisplayField,Roo.form.TextField,{inputType:'hidden',allowBlank:true,readOnly:true,focusClass:undefined,fieldClass:'x-form-field',valueRenderer:undefined,width:100,onResize:function(){Roo.form.DisplayField.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.DisplayField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap();this.viewEl=this.wrap.createChild({tag:'div'});if(this.bodyStyle){this.viewEl.applyStyles(this.bodyStyle);}
+Roo.form.DisplayField=function(A){Roo.form.DisplayField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DisplayField,Roo.form.TextField,{inputType:'hidden',allowBlank:true,readOnly:true,focusClass:undefined,fieldClass:'x-form-field',valueRenderer:undefined,width:100,onResize:function(){Roo.form.DisplayField.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.DisplayField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap();this.viewEl=this.wrap.createChild({tag:'div',cls:'x-form-displayfield'});if(this.bodyStyle){this.viewEl.applyStyles(this.bodyStyle);}
 this.setValue(this.value);},onClick:function(){},setValue:function(v){this.value=v;var A=this.valueRenderer?this.valueRenderer(v):String.format('{0}',v);if(!this.viewEl){return;}
 this.viewEl.dom.innerHTML=A;Roo.form.DisplayField.superclass.setValue.call(this,v);}});
 Roo.form.DayPicker=function(A){Roo.form.DayPicker.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DayPicker,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},actionMode:'viewEl',inputType:'hidden',inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-form-daypick-item '});var r1='<table><tr>';var r2='<tr class="x-form-daypick-icons">';for(var i=0;i<7;i++){r1+='<td><div>'+Date.dayNames[i].substring(0,3)+'</div></td>';r2+='<td><img class="x-menu-item-icon" src="'+Roo.BLANK_IMAGE_URL+'"></td>';}var B=this.wrap.createChild(r1+'</tr>'+r2+'</tr></table>');B.select('img').on('click',this.onClick,this);this.viewEl=B;this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);},initValue:Roo.emptyFn,getValue:function(){return this.el.dom.value;},onClick:function(e){Roo.get(e.target).toggleClass('x-menu-item-checked');this.refreshValue();},refreshValue:function(){var A='';this.viewEl.select('img',true).each(function(e,i,n){A+=e.is(".x-menu-item-checked")?String(n):'';});this.setValue(A,true);},setValue:function(v,A){if(!this.el.dom){return;}var B=this.el.dom.value;this.el.dom.value=v;if(A){return;}
@@ -709,12 +709,11 @@ Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,argumen
 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;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,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(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);return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});var s=this.subs;},apply:function(){return this.applyTemplate.apply(this,arguments);},compile:function(){return this;}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
 Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true,'buildcomplete':true});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,items:false});Roo.apply(Roo.XComponent,{buildCompleted:false,topModule:false,modules:[],register:function(A){this.modules.push(A);},toObject:function(A){if(!A||typeof(A)=='object'){return A;}var ar=A.split('.');var rt,o;rt=ar.shift();eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');if(o===false){throw "Module not found : "+A;}
+Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,items:false});Roo.apply(Roo.XComponent,{buildCompleted:false,topModule:false,modules:[],elmodules:[],register:function(A){this.modules.push(A);},toObject:function(A){if(!A||typeof(A)=='object'){return A;}if(A[0]=='#'){return A;}var ar=A.split('.');var rt,o;rt=ar.shift();eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');if(o===false){throw "Module not found : "+A;}
 Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+A;}
-o=o[e];});return o;},preBuild:function(){Roo.each(this.modules,function(A){A.parent=this.toObject(A.parent);if(!A.parent){this.topModule=A;return;}if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}
-A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if(!this.topModule||!this.topModule.modules){throw "No top level modules to build";}var C=[this.topModule];var D=function(m){C.push(m);if(m.modules){m.modules.keySort('ASC',B);m.modules.each(D);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}}
-this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);return C;},build:function(){this.preBuild();var A=this.buildOrder();if(!A.length){throw "NO modules!!!";}
-Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();C.topModule.fireEvent('buildcomplete',C.topModule);return;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();}if(!m.parent){var F=new Ext.BorderLayout(document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:true,minTabWidth:140}});var G=m.tree();G.region='center';m.el=F.addxtype(G);m.panel=m.el;m.layout=m.panel.layout;return D.defer(10,C);}var G=m.tree();G.region=G.region||m.region;m.el=m.parent.el.addxtype(G);m.fireEvent('built',m);m.panel=m.el;m.layout=m.panel.layout;D.defer(10,C);}
+o=o[e];});return o;},preBuild:function(){Roo.each(this.modules,function(A){A.parent=this.toObject(A.parent);if(!A.parent){this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}
+A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if((!this.topModule||!this.topModule.modules)&&!this.elmodules.length){throw "No top level modules to build";}var C=this.topModule?[this.topModule]:[];Roo.each(this.elmodules,function(e){C.push(e)});var D=function(m){C.push(m);if(m.modules){m.modules.keySort('ASC',B);m.modules.each(D);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule){this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);}return C;},build:function(){this.preBuild();var A=this.buildOrder();if(!A.length){throw "NO modules!!!";}
+Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();if(C.topModule){C.topModule.fireEvent('buildcomplete',C.topModule);}return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();}if(!m.parent||(typeof(m.parent)=='string'&&m.parent[0]=='#')){var F=m.parent?Roo.get(m.parent.substr(1)):document.body;if(!F){Roo.log("not rendering module "+m.name+" "+m.parent+" no found");return D.defer(10,C);}var G=new Ext.BorderLayout(m.parent?Roo.get(m.parent.substr(1)):document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:m.parent?false:true,hideTabs:m.parent?true:false,minTabWidth:140}});var H=m.tree();H.region='center';m.el=G.addxtype(H);m.panel=m.el;m.layout=m.panel.layout;return D.defer(10,C);}var H=m.tree();H.region=H.region||m.region;m.el=m.parent.el.addxtype(H);m.fireEvent('built',m);m.panel=m.el;m.layout=m.panel.layout;return D.defer(10,C);}
 D.defer(1,C);}});
 Roo.Login=function(A){this.addEvents({'refreshed':true});Roo.apply(this,A);Roo.onReady(function(){this.onLoad();},this);Roo.Login.superclass.constructor.call(this,this);}
 Roo.extend(Roo.Login,Roo.LayoutDialog,{method:'POST',url:'',user:false,checkFails:0,intervalID:0,onLoad:function(){if(Roo.get('loading')){Roo.get('loading').remove();}