php7 fixes
[Pman.Builder] / Pman.Builder.Tree.js
index 35406bf..33170c2 100644 (file)
@@ -30,8 +30,9 @@ Pman.Builder.Tree = {
         }
         
         var config = this.cloneConfig(inConfig);
-        config['builder.hidden'] = config['builder.hidden'] || 0;
         
+        var hidden =  config['builder.hidden'] || false;
+         
         if (!parent) {
             parent = tree.root;
         }
@@ -71,7 +72,7 @@ Pman.Builder.Tree = {
                 break;
         }
         
-        newNode.ui.ctNode.style.display = config['builder.hidden'] ? 'none' : '';
+        newNode.ui.ctNode.style.display = hidden ? 'none' : '';
         
         if (items.length) {
             Roo.each(items, function(i) {
@@ -118,6 +119,9 @@ Pman.Builder.Tree = {
         var newConfig = {};
         
         for (var i in config) {
+            if (i.match(/^builder\./)) {
+                continue;
+            }
             if (typeof config[i] == 'object') {
                  newConfig[i] = this.cloneConfig(config[i]);
             } else if (typeof config[i] != 'function') { // should this happen?
@@ -131,7 +135,9 @@ Pman.Builder.Tree = {
         var txt = [];
         c = c || {};
               var sr = (typeof(c['+buildershow']) != 'undefined') &&  !c['+buildershow'] ? true : false;
-            if (sr) txt.push('<s>');
+            if (sr) {
+                txt.push('<s>');
+            }
             if (typeof(c['*prop']) != 'undefined')   { txt.push(c['*prop']+ ':'); }
         if (c.xtype)      { txt.push(c.xtype); }
         if (c.fieldLabel) { txt.push('[' + c.fieldLabel + ']'); }
@@ -146,7 +152,9 @@ Pman.Builder.Tree = {
             if (c.name)       { txt.push('<b>' + c.name+ '</b>'); }
         if (c.region)     { txt.push('<i>(' + c.region + ')</i>'); }
             if (c.dataIndex) { txt.push('[' + c.dataIndex+ ']'); }
-            if (sr) txt.push('</s>');
+            if (sr) {
+                txt.push('</s>');
+            }
         return (txt.length == 0 ? "Element" : txt.join(" "));
         
         
@@ -182,7 +190,7 @@ Pman.Builder.Tree = {
         pn.removeChild(this.currentNode);
           
         if (!pn.childNodes.length) {
-            this.appendNode(pn, cfg, 'append')
+            this.appendNode(pn, cfg, 'append');
             return true;
         }
         if (!ix) {
@@ -207,10 +215,15 @@ Pman.Builder.Tree = {
         }
         var cfg = this.currentNode.elConfig;
         // things that can not be deleted...
+        var hidden = cfg['builder.hidden'] || 0;
+        if (hidden) {
+            delete cfg['builder.hidden'];
+        } else {
+            cfg['builder.hidden'] = 1;
+        }
+         
         
-        cfg['builder.hidden'] = !(cfg['builder.hidden'] || 0);
-        
-        this.currentNode.ui.ctNode.style.display = cfg['builder.hidden']  ? 'none' : '';
+        this.currentNode.ui.ctNode.style.display = !hidden ? 'none' : '';
          
          
         //this.setCurrentNode(pn.childNodes.length ? pn.childNodes[ix] : pn  ,true);