"name" : "Pman.Tab.AdminEnum",
"parent" : "Pman.Tab.Admin",
"title" : "Pman.Tab.AdminEnum",
- "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminEnum.bjs",
+ "path" : "/home/michael/gitlive/Pman.Admin/Pman.Tab.AdminEnum.bjs",
"permname" : "",
"modOrder" : "500",
"items" : [
{
"xtype" : "NestedLayoutPanel",
"$ xns" : "Roo",
+ "String region" : "center",
"String title" : "Pulldown Options",
"items" : [
{
},
"background" : false,
"region" : "west",
- "fitToframe" : true,
"title" : "Pulldown Options",
"xtype" : "GridPanel",
- "fitContainer" : true,
"$ xns" : "Roo",
"tableName" : "core_enum",
"items" : [
"beforeedit" : "function (e)\n{\n if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n return false;\n }\n}",
"cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n var di = this.colModel.getDataIndex(columnIndex);\n if (di != 'active') {\n return;\n }\n \n var rec = _this.grid.ds.getAt(rowIndex);\n \n rec.set('active', rec.data.active ? 0 : 1);\n rec.commit();\n \n \n}",
"|render" : "function() \n{\n _this.egrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.epanel.active) {\n this.footer.onClick('first');\n }\n}",
+ "celldblclick" : "function (_self, rowIndex, columnIndex, e)\n{\n var rec = _this.egrid.ds.getAt(rowIndex);\n Pman.Dialog.AdminEnumType.show(rec.data,function(){\n \n _this.egrid.footer.onClick('first');\n });\n}",
"afteredit" : "function (e)\n{\n e.record.commit(); \n}"
},
"autoExpandColumn" : "display_name",
"items" : [
{
"listeners" : {
- "update" : "function (_self, record, operation)\n{\n if (operation != Roo.data.Record.COMMIT) {\n return;\n }\n // got commit..\n new Pman.Request({\n url : baseURL + '/Roo/Core_enum.php',\n method : 'POST',\n params : {\n id : record.data.id,\n etype : _this.etypeCombo.getValue(),\n name : record.data.name,\n active : record.data.active,\n seqid : record.data.seqid,\n display_name : record.data.display_name\n }, \n success : function(res) {\n //Roo.log(data);\n // update the ID if it's not set..\n if (record.data.id * 1 < 1) {\n record.set('id', res.data.id);\n }\n }\n });\n \n}",
- "beforeload" : "function (_self, options)\n{\n if (!_this.etypeCombo) {\n return false;\n }\n options.params.etype = _this.etypeCombo.getValue();\n if (!options.params.etype.length) {\n return false;\n }\n}"
+ "update" : "function (_self, record, operation)\n{\n if (operation != Roo.data.Record.COMMIT) {\n return;\n }\n // got commit..\n new Pman.Request({\n url : baseURL + '/Roo/Core_enum.php',\n method : 'POST',\n params : {\n id : record.data.id,\n etype : _this.grid.ds.getById(record.id).data.etype,\n name : record.data.name,\n active : record.data.active,\n seqid : record.data.seqid,\n display_name : record.data.display_name\n }, \n success : function(res) {\n //Roo.log(data);\n // update the ID if it's not set..\n if (record.data.id * 1 < 1) {\n record.set('id', res.data.id);\n }\n }\n });\n \n}",
+ "beforeload" : "function (_self, o)\n{\n o.params['query[empty_etype]'] = 1; \n \n}"
},
"xtype" : "Store",
"remoteSort" : true,
]
},
{
- "pageSize" : 25,
+ "listeners" : {
+ "selectionchange" : "function (_self, selection)\n{\n _this.grid.footer.onClick('first');\n}"
+ },
+ "xtype" : "CellSelectionModel",
+ "$ xns" : "Roo.grid",
+ "* prop" : "sm"
+ },
+ {
+ "pageSize" : 100,
"xtype" : "PagingToolbar",
"emptyMsg" : "No core_enum found",
"$ xns" : "Roo",
- "displayInfo" : true,
- "displayMsg" : "Displaying core_enum{0} - {1} of {2}",
- "* prop" : "footer",
- "items" : [
- {
- "listeners" : {
- "click" : "function (_self, e)\n{\n new Pman.Download({\n grid : _this.grid\n });\n Roo.MessageBox.alert(\"Downloading\", \"File is downloading\");\n}"
- },
- "text" : "Download",
- "xtype" : "Button",
- "$ xns" : "Roo.Toolbar"
- },
- {
- "listeners" : {
- "click" : "function (_self, e)\n{\n var etype = _this.etypeCombo.getValue();\n \n if(!etype.length){\n Roo.MessageBox.alert('Error', 'Please select a pulldown');\n return;\n }\n \n Pman.Dialog.Image.show(\n {\n _url : baseURL+'/Xtuple/Import/Enum?' + Roo.urlEncode({'etype' : etype})\n \n },\n function () {\n _this.grid.footer.onClick('first');\n }\n );\n}"
- },
- "text" : "Upload Value",
- "xtype" : "Button",
- "$ xns" : "Roo.Toolbar"
- }
- ]
+ "displayInfo" : false,
+ "displayMsg" : " ",
+ "* prop" : "footer"
},
{
"xtype" : "Toolbar",
"xtype" : "ColumnModel",
"header" : "Pulldown",
"width" : 200,
- "$ renderer" : "function(v,x,r) { \n\n\n return String.format('<span tip=\"{1}\">{0}</span>', v, r.data.name); \n}",
+ "$ renderer" : "function(v,x,r) { \n\n\n return String.format('<span qtip=\"{1}\">{0}</span>', (''+v).length ? v : r.data.name, r.data.name); \n}",
"$ xns" : "Roo.grid",
"* prop" : "colModel[]",
"dataIndex" : "display_name"
"region" : "center",
"title" : "Pulldown Options",
"xtype" : "GridPanel",
- "fitContainer" : true,
"$ xns" : "Roo",
"tableName" : "core_enum",
"items" : [
"items" : [
{
"listeners" : {
- "update" : "function (_self, record, operation)\n{\n if (operation != Roo.data.Record.COMMIT) {\n return;\n }\n // got commit..\n new Pman.Request({\n url : baseURL + '/Roo/Core_enum.php',\n method : 'POST',\n params : {\n id : record.data.id,\n etype : _this.etypeCombo.getValue(),\n name : record.data.name,\n active : record.data.active,\n seqid : record.data.seqid,\n display_name : record.data.display_name\n }, \n success : function(res) {\n //Roo.log(data);\n // update the ID if it's not set..\n if (record.data.id * 1 < 1) {\n record.set('id', res.data.id);\n }\n }\n });\n \n}",
- "beforeload" : "function (_self, options)\n{\n if (!_this.etypeCombo) {\n return false;\n }\n options.params.etype = _this.etypeCombo.getValue();\n if (!options.params.etype.length) {\n return false;\n }\n}"
+ "update" : "function (_self, record, operation)\n{\n if (operation != Roo.data.Record.COMMIT) {\n return;\n }\n // got commit..\n new Pman.Request({\n url : baseURL + '/Roo/Core_enum.php',\n method : 'POST',\n params : {\n id : record.data.id,\n etype : _this.grid.ds.getById(record.id).data.etype,\n name : record.data.name,\n active : record.data.active,\n seqid : record.data.seqid,\n display_name : record.data.display_name\n }, \n success : function(res) {\n //Roo.log(data);\n // update the ID if it's not set..\n if (record.data.id * 1 < 1) {\n record.set('id', res.data.id);\n }\n }\n });\n \n}",
+ "beforeload" : "function (_self, options)\n{\n\n var s = _this.egrid.getSelectionModel().getSelectedCell();\n \n\n if (!s) {\n return false;\n }\n var d = _this.egrid.dataSource.getAt(s[0]);\n \n options.params.etype = d.data.name;\n if (!options.params.etype.length) {\n return false;\n }\n}"
},
"xtype" : "Store",
"remoteSort" : true,
},
{
"listeners" : {
- "click" : "function (_self, e)\n{\n var etype = _this.etypeCombo.getValue();\n \n if(!etype.length){\n Roo.MessageBox.alert('Error', 'Please select a pulldown');\n return;\n }\n \n Pman.Dialog.Image.show(\n {\n _url : baseURL+'/Xtuple/Import/Enum?' + Roo.urlEncode({'etype' : etype})\n \n },\n function () {\n _this.grid.footer.onClick('first');\n }\n );\n}"
+ "click" : "function (_self, e)\n{\n\n var s = _this.egrid.getSelectionModel().getSelectedCell();\n \n\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n }\n \n var d = _this.egrid.dataSource.getAt(s[0]);\n \n\n var etype = d.data.name;\n \n if(!etype.length){\n Roo.MessageBox.alert('Error', 'Please select a pulldown');\n return;\n }\n \n Pman.Dialog.Image.show(\n {\n _url : baseURL+'/Xtuple/Import/Enum?' + Roo.urlEncode({'etype' : etype})\n \n },\n function () {\n _this.grid.footer.onClick('first');\n }\n );\n}"
},
"text" : "Upload Value",
"xtype" : "Button",
"$ xns" : "Roo",
"* prop" : "toolbar",
"items" : [
- {
- "text" : "Pulldown Name:",
- "xtype" : "TextItem",
- "$ xns" : "Roo.Toolbar"
- },
{
"listeners" : {
- "render" : "function (_self)\n{\n _this.etypeCombo = _self;\n}",
- "select" : "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
- },
- "alwaysQuery" : true,
- "listWidth" : 400,
- "triggerAction" : "all",
- "fieldLabel" : "core_enum",
- "forceSelection" : true,
- "selectOnFocus" : true,
- "pageSize" : 50,
- "displayField" : "name",
- "emptyText" : "Select pulldown",
- "minChars" : 2,
- "valueField" : "name",
- "xtype" : "ComboBox",
- "typeAhead" : false,
- "editable" : false,
- "width" : 300,
- "$ xns" : "Roo.form",
- "qtip" : "Select type",
- "queryParam" : "query[name]",
- "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> - {name} </div>",
- "loadingText" : "Searching...",
- "items" : [
- {
- "listeners" : {
- "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params['query[empty_etype]'] = 1; \n}\n"
- },
- "xtype" : "Store",
- "remoteSort" : true,
- "$ sortInfo" : "{ direction : 'ASC', field: 'display_name' }",
- "$ xns" : "Roo.data",
- "* prop" : "store",
- "items" : [
- {
- "$ url" : "baseURL + '/Roo/core_enum.php'",
- "xtype" : "HttpProxy",
- "method" : "GET",
- "$ xns" : "Roo.data",
- "* prop" : "proxy"
- },
- {
- "id" : "id",
- "root" : "data",
- "xtype" : "JsonReader",
- "$ xns" : "Roo.data",
- "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]",
- "* prop" : "reader",
- "totalProperty" : "total"
- }
- ]
- }
- ]
- },
- {
- "listeners" : {
- "|click" : "function()\n{\n \n // if we do not have a selected type... - what should we show..?\n var et = _this.etypeCombo.getValue();\n var ds = _this.grid.getDataSource();\n if (!et) {\n Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n return;\n }\n\n var add = ds.reader.newRow({ \n id: 0, \n display_name : '', \n name : '', \n etype: et, \n active: 1, \n seqid: 0\n });\n var r = ds.data.length;\n ds.insert(r , add); \n _this.grid.startEditing(r, 1); // name... \n}\n"
+ "|click" : "function()\n{\n \n // if we do not have a selected type... - what should we show..?\n \n \n var s = _this.egrid.getSelectionModel().getSelectedCell();\n \n\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n }\n \n var d = _this.egrid.dataSource.getAt(s[0]);\n \n\n var ds = _this.grid.getDataSource();\n\n var add = ds.reader.newRow({ \n id: 0, \n display_name : '', \n name : '', \n etype: d.data.name, \n active: 1, \n seqid: 0\n });\n var r = ds.data.length;\n ds.insert(r , add); \n _this.grid.startEditing(r, 1); // name... \n}\n"
},
"text" : "Add Value",
"xtype" : "Button",
"listeners" : {
"|click" : "function()\n{\n \n // if we do not have a selected type... - what should we show..?\n var et = _this.etypeCombo.getValue();\n \n if (!et) {\n Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n return;\n }\n var sc = _this.grid.getSelectionModel().getSelectedCell();\n Roo.log(sc);\n var ds = _this.grid.ds.getAt(sc[0]);\n if (!ds) {\n Roo.MessageBox.alert(\"Error\", \"Select enum\");\n return;\n }\n \n Roo.log(ds);\n Pman.Dialog.AdminEnumImages.show({onid:ds.data.id}, function(){\n _this.grid.footer.onClick('first');\n });\n \n}\n"
},
- "text" : "Add Images",
- "xtype" : "Button",
- "cls" : "x-btn-text-icon",
- "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
- "$ xns" : "Roo.Toolbar"
- },
- {
- "xtype" : "Fill",
- "$ xns" : "Roo.Toolbar"
- },
- {
- "listeners" : {
- "|click" : "function()\n{\n \n Roo.MessageBox.prompt (\"Create a new Enum type\",\n \"Enter the name for a new enum type, \" + \n \"this is only relivant if you know how it is going to be used\",\n function(btn,txt) {\n if (btn != 'ok') {\n return; \n }\n new Pman.Request({\n url : baseURL + '/Roo/Core_enum.php',\n method : 'POST',\n params : {\n etype : '',\n name : txt,\n active : 1\n }, \n success : function() {\n Roo.MessageBox.alert(\"Created\", \"You can now select it from the type list on the left\");\n }\n });\n \n \n \n \n }\n ); \n \n \n\n}\n"
- },
- "text" : "Add new pulldown list",
+ "text" : "Add Image",
"xtype" : "Button",
"cls" : "x-btn-text-icon",
"$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",