"path": "/home/alan/gitlive/Pman.Admin/Pman.Dialog.AdminCoreEnum.bjs",
"items": [
{
+ "listeners": {
+ "show": "function (_self)\n{\n var name_hidden = false;\n\n if (typeof(_this.data._hide_name) != 'undefined') {\n name_hidden = true;\n \n }\n \n _this.grid.colModel.setHidden(1,name_hidden);\n _this.grid.footer.onClick('first');\n}"
+ },
+ "closable": false,
"height": 400,
+ "modal": true,
+ "resizable": false,
"title": "Pulldown Options",
"width": 950,
"xtype": "LayoutDialog",
"items": [
{
"listeners": {
- "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.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\n options.params.etype = _this.data.etype;\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 \n var name = record.data.name;\n if (typeof(_this.data._hide_name) != 'undefined') {\n name = record.data.display_name;\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.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}"
},
"*prop": "dataSource",
"remoteSort": true,
"displayInfo": true,
"displayMsg": "Displaying core_enum{0} - {1} of {2}",
"emptyMsg": "No core_enum found",
- "|xns": "Roo",
- "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"
- }
- ]
+ "|xns": "Roo"
},
{
"*prop": "toolbar",
"xtype": "Toolbar",
"|xns": "Roo",
"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,
- "displayField": "name",
- "editable": "false",
- "emptyText": "Select pulldown",
- "fieldLabel": "core_enum",
- "forceSelection": true,
- "listWidth": 400,
- "loadingText": "Searching...",
- "minChars": 2,
- "pageSize": 50,
- "qtip": "Select type",
- "queryParam": "query[name]",
- "selectOnFocus": true,
- "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> - {name} </div>",
- "triggerAction": "all",
- "typeAhead": false,
- "valueField": "name",
- "width": 300,
- "xtype": "ComboBox",
- "|xns": "Roo.form",
- "items": [
- {
- "listeners": {
- "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params['query[empty_etype]'] = 1; \n}\n"
- },
- "*prop": "store",
- "remoteSort": true,
- "xtype": "Store",
- "|sortInfo": "{ direction : 'ASC', field: 'display_name' }",
- "|xns": "Roo.data",
- "items": [
- {
- "*prop": "proxy",
- "xtype": "HttpProxy",
- "method": "GET",
- "|xns": "Roo.data",
- "|url": "baseURL + '/Roo/core_enum.php'"
- },
- {
- "*prop": "reader",
- "xtype": "JsonReader",
- "|xns": "Roo.data",
- "id": "id",
- "root": "data",
- "totalProperty": "total",
- "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]"
- }
- ]
- }
- ]
- },
- {
- "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 var et = _this.data.etype;\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"
},
"cls": "x-btn-text-icon",
"text": "Add Value",
"|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
"|xns": "Roo.Toolbar"
},
- {
- "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"
- },
- "cls": "x-btn-text-icon",
- "text": "Add Images",
- "xtype": "Button",
- "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
- "|xns": "Roo.Toolbar"
- },
{
"|xns": "Roo.Toolbar",
"xtype": "Fill"
- },
- {
- "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"
- },
- "cls": "x-btn-text-icon",
- "text": "Add new pulldown list",
- "xtype": "Button",
- "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
- "|xns": "Roo.Toolbar"
}
]
},
"|renderer": "function(v) { return String.format('{0}', v); }",
"|xns": "Roo.grid"
},
- {
- "*prop": "colModel[]",
- "dataIndex": "images_id_id",
- "header": "Image",
- "width": 75,
- "xtype": "ColumnModel",
- "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/25/{1}/{2}\" width=\"25\" height=\"25\">', baseURL, v, r.data.images_id_filename); }",
- "|xns": "Roo.grid"
- },
{
"xtype": "ColumnModel",
"header": "Name",
]
},
{
- "|xns": "Roo",
+ "listeners": {
+ "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
+ },
+ "*prop": "buttons[]",
+ "text": "Cancel",
+ "xtype": "Button",
+ "|xns": "Roo"
+ },
+ {
+ "listeners": {
+ "click": "function (_self, e)\n{\n var sel = _this.grid.selModel.getSelectedCell();\n if (!sel && _this.callback) {\n Roo.MessageBox.alert(\"Error\", \"Select an item\");\n return;\n }\n \n\n if (_this.callback) {\n var rec = _this.grid.ds.getAt(sel[0]);\n _this.callback(rec.data);\n }\n _this.dialog.hide();\n}"
+ },
+ "*prop": "buttons[]",
+ "text": "OK",
"xtype": "Button",
- "*prop": "buttons[]"
+ "|xns": "Roo"
}
]
}