X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=blobdiff_plain;f=Builder%2FProvider%2FFile%2FRoo.js;h=db0d28da91201423e04412daaad5a45b8f2f6569;hp=cf79bbf8b7a55637a24f6e61a72e1d9bc9ea5bb0;hb=ae36594d7a193ff1b695cf2fc09a66e4e34f8a6b;hpb=677ea2893ae39c42ba820532992b7d7e868318c2 diff --git a/Builder/Provider/File/Roo.js b/Builder/Provider/File/Roo.js old mode 100755 new mode 100644 index cf79bbf8b..db0d28da9 --- a/Builder/Provider/File/Roo.js +++ b/Builder/Provider/File/Roo.js @@ -28,8 +28,9 @@ Roo = XObject.define( //console.dump(cfg); if (!cfg.name || !cfg.fullname ) { - cfg.name = cfg.path.split('/').pop().replace(/\.js$/, ''); - cfg.fullname = (cfg.parent && cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name; + cfg.name = cfg.path.split('/').pop().replace(/\.bjs$/, ''); + //cfg.fullname = (cfg.parent && cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name; + cfg.fullname = cfg.name; } @@ -64,12 +65,21 @@ Roo = XObject.define( }, Base, { - + doubleStringProps : [ + 'title', + 'legend', + 'loadingText', + 'emptyText', + 'qtip', + 'value', + 'text' + ], modOrder : '001', /// sequence id that this uses. region : 'center', parent : '', title : '', // the title on displayed when loading. disable : '', // use a function to that returns false to disable this.. + permname: '', /// permission name setNSID : function(id) { @@ -103,9 +113,10 @@ Roo = XObject.define( var cfg = JSON.parse(src); print("loaded data"); console.dump(cfg); - - _this.name = cfg.name; + _this.modOrder = cfg.modOrder || '001'; + _this.name = cfg.name.replace(/\.bjs/, ''); // BC! _this.parent = cfg.parent; + _this.permname = cfg.permname || ''; _this.title = cfg.title; _this.items = cfg.items || []; @@ -220,7 +231,10 @@ Roo = XObject.define( Base.prototype.save.call(this); // now write the js file.. var js = this.path.replace(/\.bjs$/, '.js'); - File.write(js, this.toSource()); + var d = new Date(); + var js_src = this.toSource(); + print("TO SOURCE in " + ((new Date()) - d) + "ms"); + File.write(js, js_src); @@ -280,10 +294,11 @@ Roo = XObject.define( }, // a standard dialog module. + // fixme - this could be alot neater.. toSourceDialog : function() { - - var o = this.mungeToString(this.items[0], false, ' '); + var items = JSON.parse(JSON.stringify(this.items[0])); + var o = this.mungeToString(items, false, ' '); return [ this.outputHeader(), this.name + " = {", @@ -299,7 +314,7 @@ Roo = XObject.define( "", " this.callback = cb;", " this.data = data;", - " this.dialog.show();", + " this.dialog.show(this.data._el);", " if (this.form) {", " this.form.reset();", " this.form.setValues(data);", @@ -324,51 +339,80 @@ Roo = XObject.define( // a layout compoent toSourceLayout : function() { - - var o = this.mungeToString(this.items[0], false, ' '); - + 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', '-'); + if (this.name.match(/^Pman/)) { + + + // old BC way we did things.. + return [ + this.outputHeader(), + "", + "", + "// register the module first", + "Pman.on('beforeload', function()", + "{", + " Pman.register({", + " modKey : '" +modkey+"',", + " module : " + this.name + ",", + " moduleName : '" + 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"); + } + + return [ this.outputHeader(), - "", - "", - "// register the module first", - "Pman.on('beforeload', function()", - "{", - " Pman.register({", - " modKey : '" +modkey+"',", - " module : " + this.name + ",", - " region : '" + this.region +"',", - " parent : " + (this.parent || 'false') + ",", - " name : \"" + (this.title || "unnamed module") + "\"", - " disabled : " + (this.disabled || 'false') +" ", - " });", - "});", - "", - this.name + " = new Roo.util.Observable({", - "", - " panel : false,", - " disabled : false,", - " parentLayout: false,", - "", - " add : function(parentLayout, region)", + this.name + " = new Roo.XComponent({", + " order : '" +modkey+"',", + " region : '" + this.region +"',", + " parent : "+ (this.parent ? "'" + this.parent + "'" : 'false') + ",", + " name : " + JSON.stringify(this.title || "unnamed module") + ",", + " disabled : " + (this.disabled || 'false') +", ", + " tree : function()", " {", - "", - " var _this = this;", // standard avaialbe.. - " this.parentLayout = parentLayout;", - "", - " this.panel = parentLayout.addxtype(" + o + ");", - " this.layout = this.panel.layout;", - "", + " var _this = this;", // bc + " var MODULE = this;", /// this looks like a better name. + " return " + o + ';', " }", "});", "" - ].join("\n"); + }, guessName : function(ar) // turns the object into full name.