php7 fixes
[Pman.Builder] / Pman.Builder.JsRender.js
index 0ed2dbc..0394d34 100644 (file)
@@ -22,6 +22,8 @@
  * @cfg {String}  disable? function call to disable it?
  * @cfg {String} permname
  * @cfg {Number} modOrder
+  * @cfg {Number} modkey ???
+ * 
  *
  */ 
 Pman.Builder.JsRender = function(cfg) {
@@ -147,7 +149,6 @@ Pman.Builder.JsRender.prototype =  {
             }
             
         }
-        
          
         
         //if (isArray) { print(JSON.stringify(keys, null,4)); }
@@ -275,7 +276,7 @@ Pman.Builder.JsRender.prototype =  {
     },
     
     
-  setNSID : function(id)
+    setNSID : function(id)
     {
         
         this.items[0]['|module'] = id;
@@ -387,10 +388,11 @@ Pman.Builder.JsRender.prototype =  {
         // we have 2 types = dialogs and components
         // 
         var top = this.guessName(this.items[0]);
+        
         if (!top) {
             return false;
         }
-        if (top.match(/Dialog/)) {
+        if (top.match(/Dialog/) || top.match(/Modal/)) {
             return this.toSourceDialog();
         }
         return this.toSourceLayout();
@@ -418,7 +420,8 @@ Pman.Builder.JsRender.prototype =  {
     toSourceDialog : function() 
     {
         var items = JSON.parse(JSON.stringify(this.items[0]));
-        var o = this.mungeToString(items, false, '            ');   
+        var o = this.mungeToString(items, false, '            ');
+        
         return [
             this.outputHeader(),
             this.name + " = {",
@@ -485,61 +488,15 @@ Pman.Builder.JsRender.prototype =  {
         var items = JSON.parse(JSON.stringify(this.items[0]));
         var o = this.mungeToString(items, false, '            ');   
          
-        var modkey = this.modOrder + '-' + this.name.replace(/[^A-Z.]+/ig, '-');
-        
+        var modkey = this.modkey + '-' + this.name.replace(/[^A-Z.]+/ig, '-');
         
-        if (this.name.match(/^Pman/)) {
-            
-             
-            // old BC way we did things..
-            return [
-                this.outputHeader(),
-                "",
-                "",
-                "// register the module first",
-                "Pman.on('beforeload', function()",
-                "{",
-                "    Pman.register({",
-                "        part :  "+ JSON.stringify(this.pathToPart()) + ",", /// critical used by builder to associate modules/parts/persm
-                "        modKey : '" +modkey+"',",
-                "        module : " + this.name + ",",
-                "        region : '" + this.region   +"',",
-                "        parent : " + (this.parent ||  'false') + ",",
-                "        name : " + JSON.stringify(this.title  || "unnamed module") + ",",
-                "        disabled : " + (this.disabled || 'false') +", ",
-                "        permname: '" + (this.permname|| '') +"' ",
-                "    });",
-                "});",
-                "",
-                
-                this.name  +  " = new Roo.util.Observable({",
-                "",
-                "    panel : false,",
-                "    disabled : false,",
-                "    parentLayout:  false,",
-                "",
-                "    add : function(parentLayout, region)",
-                "    {",
-                "",
-                "        var _this = this;", // standard avaialbe..
-                "        this.parentLayout = parentLayout;",
-                "",
-                "        this.panel = parentLayout.addxtype(" + o +  ");",
-                "        this.layout = this.panel.layout;",
-                "",
-                "    }",
-                "});",
-                ""
-                 
-                
-             ].join("\n");
-        }
+        var name = this.name.replace(/[^a-z_]+/i, '_');
         
     
         return [
             this.outputHeader(),
             
-            this.name  +  " = new Roo.XComponent({",
+            name  +  " = new Roo.XComponent({",
             "    order    : '" +modkey+"',",
             "    region   : '" + this.region   +"',",
             "    parent   : "+ (this.parent ?  "'" + this.parent + "'" :  'false') + ",",
@@ -586,7 +543,7 @@ Pman.Builder.JsRender.prototype =  {
          
                         
                              
-    },
+    }
    
     
 };