{
"name" : "Pman.Tab.AdminEnum",
"parent" : "Pman.Tab.Admin",
"title" : "Pman.Tab.AdminEnum",
"path" : "/home/benny/gitlive/web.MediaOutreach/Pman/Admin/Pman.Tab.AdminEnum.bjs",
"permname" : "",
"modOrder" : "500",
"strings" : {
"2df80d5febcde0c10a66818488622b7c" : "Pulldown Options",
"13348442cc6a27032d2b4aa28b75a5d3" : "Search",
"d1228f5476d15142b1358ae4b5fa2454" : "Order #",
"fdff10eac021dfbb69e9c38204237fdc" : "Add new pulldown list",
"1206eb8aea05be4625371c9c12818785" : "Pulldown",
"801ab24683a4a8c433c6eb40c48bcd9d" : "Download",
"7af54708cf5a4286cf0cfa58ff5148a8" : "Internal #",
"be53a0541a6d36f6ecb879fa2c584b08" : "Image",
"1a87a3d29199e3435b8fb314624c008f" : "Merge Option",
"b48968e1c912da07df5e8d6d246291ec" : "Display Name",
"510bc6e58593b2b8002c9fe0c21f3fde" : "Displaying core_enum{0} - {1} of {2}",
"1ba4d808fc7b27a7f60ce2ff75a8af3a" : "No core_enum found",
"c550aeed26e71a81a88360c1889245ab" : "Upload Values",
"d9ec74f5aa29ceef6bf7b45f7fec5d0f" : "Add Value",
"b9c49611cfda3259a2b837b39489e650" : "Add Image",
"4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
"f2a6c498fb90ee345d997f888fce3b18" : "Delete",
"49ee3087348e8d44e1feda1917443987" : "Name",
"d41d8cd98f00b204e9800998ecf8427e" : " "
},
"items" : [
{
"xtype" : "NestedLayoutPanel",
"String region" : "center",
"$ xns" : "Roo",
"String title" : "Pulldown Options",
"items" : [
{
"xtype" : "BorderLayout",
"$ xns" : "Roo",
"* prop" : "layout",
"items" : [
{
"Number width" : 200,
"xtype" : "LayoutRegion",
"$ xns" : "Roo",
"* prop" : "west",
"Boolean split" : true
},
{
"xtype" : "LayoutRegion",
"$ xns" : "Roo",
"* prop" : "center"
},
{
"listeners" : {
"|activate" : "function() {\n _this.epanel = this;\n //if (_this.egrid) {\n // _this.egrid.footer.onClick('first');\n //}\n}"
},
"background" : false,
"region" : "west",
"title" : "Pulldown Options",
"xtype" : "GridPanel",
"$ xns" : "Roo",
"tableName" : "core_enum",
"items" : [
{
"listeners" : {
"beforeedit" : "function (e)\n{\n if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n return false;\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}",
"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}",
"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",
"xtype" : "EditorGrid",
"loadMask" : true,
"clicksToEdit" : 1,
"$ xns" : "Roo.grid",
"* prop" : "grid",
"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.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,
"$ sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
"$ xns" : "Roo.data",
"* prop" : "dataSource",
"items" : [
{
"$ url" : "baseURL + '/Roo/core_enum.php'",
"method" : "GET",
"xtype" : "HttpProxy",
"$ xns" : "Roo.data",
"* prop" : "proxy"
},
{
"id" : "id",
"root" : "data",
"xtype" : "JsonReader",
"$ xns" : "Roo.data",
"$ fields" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'etype',\n 'type': 'string'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'active',\n 'type': 'int'\n },\n {\n 'name': 'seqid',\n 'type': 'int'\n }\n]",
"* prop" : "reader",
"totalProperty" : "total"
}
]
},
{
"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" : false,
"displayMsg" : " ",
"* prop" : "footer"
},
{
"xtype" : "Toolbar",
"$ xns" : "Roo",
"* prop" : "toolbar",
"items" : [
{
"listeners" : {
"|click" : "function()\n{\n \n var data = {\n active:1,\n display_name:'',\n etype:'',\n name:''\n };\n Pman.Dialog.AdminEnumType.show(data,function(){\n \n _this.egrid.footer.onClick('first');\n });\n \n \n\n}\n"
},
"text" : "Add new pulldown list",
"xtype" : "Button",
"cls" : "x-btn-text-icon",
"$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
"$ xns" : "Roo.Toolbar"
}
]
},
{
"xtype" : "ColumnModel",
"width" : 200,
"header" : "Pulldown",
"$ renderer" : "function(v,x,r) { \n\n\n return String.format('{0}', (''+v).length ? v : r.data.name, r.data.name); \n}",
"$ xns" : "Roo.grid",
"* prop" : "colModel[]",
"dataIndex" : "display_name"
},
{
"xtype" : "ColumnModel",
"width" : 50,
"header" : "Active",
"$ renderer" : "function(v) { \n var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }",
"$ xns" : "Roo.grid",
"* prop" : "colModel[]",
"dataIndex" : "active"
}
]
}
]
},
{
"listeners" : {
"|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
},
"fitToframe" : true,
"background" : false,
"region" : "center",
"title" : "Pulldown Options",
"xtype" : "GridPanel",
"$ xns" : "Roo",
"tableName" : "core_enum",
"items" : [
{
"listeners" : {
"keypress" : "function (e)\n{\n if(e.keyCode == 13){\n _this.grid.footer.onClick('first');\n }\n}",
"beforeedit" : "function (e)\n{\n if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n return false;\n }\n}",
"|render" : "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}",
"cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n var di = this.colModel.getDataIndex(columnIndex);\n var rec = _this.grid.ds.getAt(rowIndex);\n \n if (di == 'active') {\n \n rec.set('active', rec.data.active ? 0 : 1);\n rec.commit();\n return;\n }\n if (di == 'id' ) {\n \n if (!e.ctrlKey && !e.shiftKey) { // shift or control not pressed -clear selection.\n \n this.dataSource.each(function(rr) {\n rr.selected = 0;\n rr.set('sel', 0);\n });\n }\n \n if (this.last_selected && e.shiftKey) {\n // the highlight all the lines between the one last selected, and this one.\n var s = this.dataSource.indexOf(this.last_selected);\n var e = this.dataSource.indexOf(rec);\n var ss = Math.min(s,e);\n var ee = Math.max(s,e) +1;\n for(var i = ss; i < ee; i++) {\n var rr = this.dataSource.getAt(i);\n rr.selected = 1;\n rr.set('sel', 1);\n }\n this.last_selected = rec;\n return;\n\n }\n \n rec.selected = rec.selected ? 0 : 1;\n this.last_selected = rec.selected ? rec : false;\n rec.set('sel', rec.data.sel ? 0 : 1);\n }\n \n\n \n \n}",
"afteredit" : "function (e)\n{\n e.record.commit(); \n}"
},
"autoExpandColumn" : "display_name",
"xtype" : "EditorGrid",
"loadMask" : true,
"clicksToEdit" : 1,
"$ xns" : "Roo.grid",
"* prop" : "grid",
"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.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 options.params['query[search]'] = _this.searchBox.getValue();\n if (!options.params.etype.length) {\n return false;\n }\n}"
},
"xtype" : "Store",
"remoteSort" : true,
"$ sortInfo" : "{ field : 'etype', direction: 'ASC' }",
"$ xns" : "Roo.data",
"* prop" : "dataSource",
"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" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'etype',\n 'type': 'string'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'active',\n 'type': 'int'\n },\n {\n 'name': 'seqid',\n 'type': 'int'\n }\n]",
"* prop" : "reader",
"totalProperty" : "total"
}
]
},
{
"pageSize" : 25,
"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\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+'/Admin/Import/Enum?' + Roo.urlEncode({'etype' : etype})\n \n },\n function () {\n _this.grid.footer.onClick('first');\n }\n );\n}"
},
"text" : "Upload Values",
"xtype" : "Button",
"$ xns" : "Roo.Toolbar"
}
]
},
{
"xtype" : "Toolbar",
"$ xns" : "Roo",
"* prop" : "toolbar",
"items" : [
{
"listeners" : {
"|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\n ds.insert(0 , add); \n \n _this.grid.startEditing(0, _this.grid.colModel.findColumnIndex('name')); // name... \n}\n"
},
"text" : "Add Value",
"xtype" : "Button",
"cls" : "x-btn-text-icon",
"$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
"$ xns" : "Roo.Toolbar"
},
{
"listeners" : {
"|click" : "function()\n{\n \n // if we do not have a selected type... - what should we show..?\n /*\n var et = _this.etypeCombo.getValue();\n \n if (!et) {\n Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n return;\n }\n */\n \n var sc = _this.egrid.getSelectionModel().getSelectedCell();\n \n if (!sc) {\n Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n return;\n }\n \n var ds = _this.egrid.ds.getAt(sc[0]);\n \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 Image",
"xtype" : "Button",
"cls" : "x-btn-text-icon",
"$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
"$ xns" : "Roo.Toolbar"
},
{
"listeners" : {
"render" : "function (_self)\n{\n _this.searchBox = this;\n}"
},
"String name" : "search",
"xtype" : "TextField",
"String fieldLabel" : "Search",
"$ xns" : "Roo.form"
},
{
"listeners" : {
"click" : "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}"
},
"String cls" : "x-btn-icon",
"xtype" : "Button",
"$ xns" : "Roo.Toolbar",
"$ icon" : "rootURL + '/Pman/templates/images/search.gif'"
},
{
"listeners" : {
"click" : "function (_self, e)\n{\n _this.searchBox.setValue('');\n _this.grid.footer.onClick('first');\n}"
},
"String cls" : "x-btn-icon",
"xtype" : "Button",
"$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
"$ xns" : "Roo.Toolbar"
},
{
"xtype" : "Fill",
"$ xns" : "Roo.Toolbar"
},
{
"listeners" : {
"|click" : "function()\n{\n var ids = [];\n _this.grid.dataSource.each(function(rr) {\n if (rr.selected) {\n ids.push(rr.data.id);\n }\n }); \n if (!ids.length) {\n Roo.MessageBox.alert(\"Error\", \"Select rows by clicking on the Internal# column\");\n return;\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\", \n \"Confirm Deletion of selected rows (some rows can not be deleted if they are referenced elsewhere\", \n function(res) {\n if(res != 'yes') {\n return;\n }\n new Pman.Request({\n method : 'POST',\n url : baseURL + '/Roo/Core_enum',\n params : {\n _delete : ids.join(',')\n },\n success : function() {\n _this.grid.footer.onClick('refresh');\n }\n });\n }\n );\n \n \n}\n\n "
},
"text" : "Delete",
"xtype" : "Button",
"cls" : "x-btn-text-icon",
"$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
"$ xns" : "Roo.Toolbar"
},
{
"xtype" : "Separator",
"$ xns" : "Roo.Toolbar"
},
{
"listeners" : {
"|click" : "function()\n{\n\n var s = _this.grid.getSelectionModel().getSelectedCell();\n\n if (!s.length) {\n Roo.MessageBox.alert(\"Error\", \"Select a Row\");\n return;\n }\n \n var d = _this.grid.ds.getAt(s[0]);\n console.log(Pman.Dialog);\n Pman.Dialog.AdminEnumMerge.show(d.data, function() {\n _this.grid.footer.onClick('refresh');\n }); \n \n}\n"
},
"text" : "Merge Option",
"xtype" : "Button",
"cls" : "x-btn-text-icon",
"$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
"$ xns" : "Roo.Toolbar"
}
]
},
{
"xtype" : "ColumnModel",
"header" : "Internal #",
"width" : 75,
"$ renderer" : "function(v,x,r) { \n var fmt = '{0}';\n if (r.selected) {\n fmt = '{0}';\n }\n return String.format(fmt, v); }",
"$ xns" : "Roo.grid",
"Boolean sortable" : true,
"* prop" : "colModel[]",
"dataIndex" : "id"
},
{
"xtype" : "ColumnModel",
"header" : "Image",
"width" : 75,
"$ renderer" : "function(v,x,r) { return String.format('', baseURL, v, r.data.images_id_filename); }",
"$ xns" : "Roo.grid",
"* prop" : "colModel[]",
"dataIndex" : "images_id_id"
},
{
"xtype" : "ColumnModel",
"width" : 200,
"header" : "Name",
"$ renderer" : "function(v) { return String.format('{0}', v); }",
"$ xns" : "Roo.grid",
"Boolean sortable" : true,
"* prop" : "colModel[]",
"dataIndex" : "name",
"items" : [
{
"xtype" : "GridEditor",
"$ xns" : "Roo.grid",
"* prop" : "editor",
"items" : [
{
"xtype" : "TextField",
"$ xns" : "Roo.form",
"* prop" : "field"
}
]
}
]
},
{
"xtype" : "ColumnModel",
"header" : "Display Name",
"width" : 200,
"$ renderer" : "function(v) { return String.format('{0}', v); }",
"$ xns" : "Roo.grid",
"Boolean sortable" : true,
"* prop" : "colModel[]",
"dataIndex" : "display_name",
"items" : [
{
"xtype" : "GridEditor",
"$ xns" : "Roo.grid",
"* prop" : "editor",
"items" : [
{
"xtype" : "TextField",
"$ xns" : "Roo.form",
"* prop" : "field"
}
]
}
]
},
{
"xtype" : "ColumnModel",
"header" : "Active",
"width" : 75,
"$ renderer" : "function(v) { \n var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }",
"$ xns" : "Roo.grid",
"Boolean sortable" : true,
"* prop" : "colModel[]",
"dataIndex" : "active"
},
{
"xtype" : "ColumnModel",
"sortable" : true,
"header" : "Order #",
"width" : 75,
"$ renderer" : "function(v) { return String.format('{0}', v); }",
"$ xns" : "Roo.grid",
"Boolean sortable" : true,
"* prop" : "colModel[]",
"dataIndex" : "seqid",
"items" : [
{
"xtype" : "GridEditor",
"$ xns" : "Roo.grid",
"* prop" : "editor",
"items" : [
{
"allowNegative" : true,
"xtype" : "NumberField",
"allowDecimals" : false,
"decimalPrecision" : 0,
"$ xns" : "Roo.form",
"* prop" : "field"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}