// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
-
-
-// register the module first
-Pman.on('beforeload', function()
-{
- Pman.register({
- part : ["Builder","Top"],
- modKey : '001-Pman.Tab.BuilderTop',
- module : Pman.Tab.BuilderTop,
- region : 'center',
- parent : Pman.Tab.BuilderTab,
- name : "Pman.Tab.BuilderTop",
- disabled : false,
- permname: ''
- });
-});
-
-Pman.Tab.BuilderTop = new Roo.util.Observable({
-
- panel : false,
- disabled : false,
- parentLayout: false,
-
- add : function(parentLayout, region)
+Pman.Tab.BuilderTop = new Roo.XComponent({
+ part : ["Builder","Top"],
+ order : '001-Pman.Tab.BuilderTop',
+ region : 'center',
+ parent : 'Pman.Tab.BuilderTab',
+ name : "Pman.Tab.BuilderTop",
+ disabled : false,
+ permname : '',
+ _tree : function()
{
-
var _this = this;
- this.parentLayout = parentLayout;
-
- this.panel = parentLayout.addxtype({
+ var MODULE = this;
+ return {
xtype: 'ContentPanel',
xns: Roo,
background : true,
xtype: 'Menu',
xns: Roo.menu,
items : [
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function (_self, e)
+ {
+ if (!_this.modsel.getValue()) {
+ Roo.MessageBox.alert("Error", "Select Module");
+ return false;
+ }
+ if (!_this.filesel.getValue()) {
+ Roo.MessageBox.alert("Error", "Select Part");
+ return false;
+ }
+ Pman.Dialog.BuilderPart.show( {
+ id : _this.filesel.getValue(),
+ module_id: _this.modsel.getValue()
+ } ,
+ function(data) {
+ //_this.filesel.reset();
+ if (!data.id) {
+ return;
+ }
+ _this.filesel.setFromData(data);
+ // set the part name on the json..
+
+
+ pt.loadBJS(_this.modsel.getValue(), _this.filesel.getValue())
+ });
+
+ }
+ },
+ text : "Rename",
+ icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+ },
+ {
+ xtype: 'Separator',
+ xns: Roo.menu
+ },
{
xtype: 'Item',
xns: Roo.menu,
{
xtype: 'Item',
xns: Roo.menu,
+ listeners : {
+ click : function (_self, e)
+ {
+ Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete it?", function(a) {
+ if (a != 'yes') {
+ return;
+ }
+
+
+ new Pman.Request({
+ url : baseURL + '/Roo/Builder_part',
+ method : 'POST',
+ params : {
+ _delete : _this.filesel.getValue()
+ },
+ success : function() {
+ _this.filesel.setValue('');
+ // unload stuff..
+ _this.filesel.fireEvent('select', false);
+ // Pman.Tab.BuilderTab.layout.getRegion('west').el.mask("select part");
+
+ }
+
+
+ });
+ });
+ }
+ },
text : "Delete"
+ },
+ {
+ xtype: 'Separator',
+ xns: Roo.menu
+ },
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function (_self, e)
+ {
+ if (!_this.modsel.getValue()) {
+ Roo.MessageBox.alert("Error", "Select Module");
+ return false;
+ }
+ if (!_this.filesel.getValue()) {
+ Roo.MessageBox.alert("Error", "Select Part");
+ return false;
+ }
+ Pman.Dialog.BuilderImport.show( {
+ id : _this.filesel.getValue(),
+ module_id: _this.modsel.getValue()
+ } ,
+ function(data) {
+ var bt = Pman.Tab.BuilderTree.tree;
+ var pt = Pman.Builder.Tree;
+
+
+ //bv.panel.el.unmask();
+ Pman.Tab.BuilderTab.layout.getRegion('west').el.unmask();
+ pt.loadBJS(_this.modsel.getValue(), _this.filesel.getValue())
+
+
+ });
+
+ }
+ },
+ text : "Import (by pasting)",
+ icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
}
]
}
pt.clearAll();
pt.setCurrentNode(bt.root,true);
// var bv = Pman.Tab.BuilderView;
- Pman.Tab.BuilderView.panel.clearAll();
+ Pman.Tab.BuilderView.panel.clearAll();
+ Pman.Tab.BuilderTab.layout.getRegion('west').el.mask("select part");
// bv.panel.el.mask("select Module / Part");
return;
}
//bv.panel.el.unmask();
-
+ Pman.Tab.BuilderTab.layout.getRegion('west').el.unmask();
pt.loadBJS(_this.modsel.getValue(), rec.data.id)
listeners : {
click : function (_self, e)
{
- this.save();
+ Pman.Builder.save();
},
render : function (_self)
{
cls : 'x-btn-text-icon',
text : "Save",
icon : rootURL + '/Pman/templates/images/save.gif',
- save : function() {
- // first see if first element has a name.. - we can not save otherwise..
- var t = Pman.Tab.BuilderTree.tree;
- if (!t.root.elConfig.name.length) {
- Roo.MessageBox.alert("Error", "No name set for form");
- return;
- }
-
- var sid = (typeof(sid) == 'undefined') ?
- (Pman.Tab.BuilderTop.filesel.lastData ? Pman.Tab.BuilderTop.filesel.lastData.id : 0) : sid;
-
-
- var js = Pman.Builder.Tree.toJS();
- var json = Roo.encode(js);
- // console.log(js);
- // console.log(json);
-
- // check the select box to see if that has been set... - save it with that id..
-
- //var _this = this;
-
- Pman.request({
- url: baseURL + '/Roo/Builder_part.php',
- method : 'POST',
- params : {
- json : json,
- name : js.name,
- module_id : _this.modsel.getValue(),
- id : sid
- },
- success : function(data) {
- // set the fileSel!!
- console.log(data);
- //if (data) {
- // _this.filesel.setFromData(data);
- // if (cb) {
- // cb.call(_this,data);
- // }
- // _this.postCode(data);
- // }
- }
- });
- },
menu : {
xtype: 'Menu',
xns: Roo.menu,
listeners : {
click : function (_self, e)
{
- _this.saveBtn.save(false,0);
+ Pman.Builder.save(false,0);
}
},
- icon : rootURL + '/Pman/templates/images/save.gif',
- text : "Save a copy as"
+ text : "Save a copy as",
+ icon : rootURL + '/Pman/templates/images/save.gif'
},
{
xtype: 'Item',
listeners : {
click : function (_self, e)
{
- _this.saveBtn.save(
- function() {
- Pman.Dialog.BuilderViewCode.show({ id : _this.filesel.getValue() } );
-
+ Pman.Builder.save(
+ function(data) {
+ Roo.log("JSON GOT");
+ Roo.log(data);
+ Pman.Dialog.BuilderViewCode.show(data );
+
- } );
+ } );
}
},
- text : "Show JSON"
+ text : "Show JSON / Javascript HTML"
}
]
}
}
]
}
+ },
+ {
+ xtype: 'Fill',
+ xns: Roo.Toolbar
+ },
+ {
+ xtype: 'ComboBox',
+ xns: Roo.form,
+ listeners : {
+ select : function (combo, record, index)
+ {
+ Pman.Builder.View.frameUpdateTheme(record.data.name);
+ }
+ },
+ allowBlank : false,
+ displayField : 'name',
+ editable : false,
+ emptyText : "Select Theme",
+ forceSelection : true,
+ hiddenName : 'name',
+ listWidth : 200,
+ loadingText : "Searching...",
+ minChars : 2,
+ name : 'name',
+ pageSize : 20,
+ qtip : "Select Theme",
+ queryParam : '',
+ selectOnFocus : true,
+ tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
+ triggerAction : 'all',
+ typeAhead : true,
+ valueField : 'name',
+ width : 200,
+ store : {
+ xtype: 'Store',
+ xns: Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ }
+ },
+ remoteSort : false,
+ sortInfo : { direction : 'ASC', field: 'name' },
+ proxy : {
+ xtype: 'HttpProxy',
+ xns: Roo.data,
+ method : 'GET',
+ url : baseURL + '/Builder/Themes'
+ },
+ reader : {
+ xtype: 'JsonReader',
+ xns: Roo.data,
+ id : 'name',
+ root : 'data',
+ totalProperty : 'total',
+ fields : ["name"]
+ }
+ }
}
]
}
- });
- this.layout = this.panel.layout;
-
+ };
}
});