//----------------------- our roo verison
Base = imports.Builder.Provider.File.Base.Base;
Gio = imports.gi.Gio;
-
+File = imports.File.File;
-JSDOC = imports['JSDOC.js'];
+//JSDOC = imports['JSDOC.js'];
//----------------------- our roo verison
var rid = 0;
//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;
}
},
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)
{
print("loaded data");
console.dump(cfg);
- _this.name = cfg.name;
+ _this.name = cfg.name.replace(/\.bjs/, ''); // BC!
_this.parent = cfg.parent;
_this.title = cfg.title;
_this.items = cfg.items || [];
{
Base.prototype.save.call(this);
// now write the js file..
- print(this.toSource());
+ var js = this.path.replace(/\.bjs$/, '.js');
+ File.write(js, this.toSource());
+
},
// we have 2 types = dialogs and components
//
var top = this.guessName(this.items[0]);
+ if (!top) {
+ return false;
+ }
if (top.match(/Dialog/)) {
return this.toSourceDialog();
}
return [
"//<script type=\"text/javascript\">",
"",
- "// Auto generated file - created by app.Builder.js- do not edit directly",
+ "// Auto generated file - created by app.Builder.js- do not edit directly (at present!)",
""
].join("\n");
},
// a standard dialog module.
+ // fixme - this could be alot neater..
toSourceDialog : function()
{
- var b = this.items[0];
- var o = this.mungePropObj(this.items[0]);
+ var items = JSON.parse(JSON.stringify(this.items[0]));
+ var o = this.mungeToString(items, false, ' ');
return [
this.outputHeader(),
- b['|module'] + " = {",
+ this.name + " = {",
"",
" dialog : false,",
" callback: false,",
"",
" 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);",
" create : function()",
" {",
" var _this = this;",
- " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
+ " this.dialog = Roo.factory(" + o + ");",
" }",
"};",
""
// a layout compoent
toSourceLayout : function()
{
- var b = this.items[0];
- 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 + ",",
+ " 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 : \"" + (b.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.
{
// eg. xns: Roo, xtype: XXX -> Roo.xxx
+ if (!ar) {
+ return false;
+ }
var ret = [];
ret.push(typeof( ar['|xns'] ) == 'undefined' ? 'Roo' : ar['|xns'] );