{ "name" : "Pman.Tab.AdminContactsGroupRight", "parent" : "Pman.Tab.AdminContactsManager", "title" : "", "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminContactsGroupRight.bjs", "permname" : "", "modOrder" : "001", "strings" : { "8444e81d652b084d70c71cd7d19ac0cf" : "Displaying Person{0} - {1} of {2}", "72670177480da92f72dc55e4aaff219b" : "Rights", "ec211f7c20af43e742bf2570c3cb84f9" : "Add", "7dce122004969d56ae2e0245cb754d35" : "Edit", "4110db87ce3ac86d603d03d691616b1e" : "Drag person to add or remove from group", "4d2d6b41cd520fa711073fffbfe81076" : "List/View", "6a0483c116671f74ffb653d4c85c4f55" : "Print/Export", "f1174ecbbc232f948717979daf04cf08" : "No Person found", "c9cc8cce247e49bae79f15173ce97354" : "Save", "b1c94ca2fbc3e78fc30069c8d0f01680" : "All", "e55f75a29310d7b60f7ac1d390c8ae42" : "Module", "ed5dea09095f671b801bee34ea28a319" : "Permission", "f2a6c498fb90ee345d997f888fce3b18" : "Delete" }, "items" : [ { "listeners" : { "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, "autoScroll" : true, "fitToframe" : true, "background" : true, "region" : "center", "title" : "Rights", "xtype" : "GridPanel", "fitContainer" : true, "$ xns" : "Roo", "tableName" : "Person", "items" : [ { "listeners" : { "|render" : "function() \n{\n _this.grid = this; \n if (!_this.dialog) {\n _this.dialog = Pman.Dialog.PersonEdit;\n \n }\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 _this.dataUpdate = typeof(_this.dataUpdate) =='undefined' ? {} : _this.dataUpdate;\n \n var di = this.colModel.getDataIndex(columnIndex);\n var i = di.split('_').shift();\n var k = di.split('_').pop();\n if (i != 'accessmask') {\n return;\n }\n var rec = _this.grid.ds.getAt(rowIndex);\n var fm = rec.data.FullMask.split(''); \n if(k == 'AA'){\n\n Roo.each(fm, function(e){\n rec.set(i+'_'+e, rec.data[i+'_'+k] ? 0 : 1);\n });\n } \n rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1);\n \n var newmask = '';\n Roo.each(fm, function(e) {\n if (rec.data[i+'_'+e] === 1) {\n \n newmask += e;\n }\n \n }); \n \n //rec.data.accessmask = rec.data.accessmask + rec\n //Roo.log(rec);\n _this.dataUpdate[rec.data.id] = newmask;\n\n //rec.commit();\n \n \n}" }, "xtype" : "Grid", "ddGroup" : "groupDD", "enableDrag" : true, "loadMask" : true, "$ xns" : "Roo.grid", "* prop" : "grid", "items" : [ { "listeners" : { "update" : "function (_self, record, operation)\n{\n if (operation != 'commit') {\n return;\n }\n // only used to change active status.\n \n new Pman.Request({\n url : baseURL + '/Roo/GroupRights.php',\n method :'POST',\n params : {\n id : record.data.id,\n active: record.data.active\n \n },\n success : function() {\n // do nothing\n \n _this.grid.ds.remove(record);\n \n },\n failure : function() \n {\n Roo.MessageBox.alert(\"Error\", \"saving failed\", function() {\n _this.grid.footer.onClick('first');\n });\n }\n });\n}", "beforeload" : "function (_self, o)\n{\n if (!o.params) {\n o.params = {}\n }\n _this.group_id = -1;\n var s = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelections();\n\n if (!s.length) {\n o.params.group_id = -1;\n } else {\n o.params.group_id = s[0].data.id;\n }\n if (o.params.group_id < 0) {\n _this.grid.getView().el.mask(\"You can not set permissions for that group\");\n return false;\n }\n _this.group_id = o.params.group_id;\n _this.grid.getView().el.unmask();\n return true;\n \n}", "load" : "function (_self, records, options)\n{\n _this.dataUpdate = {};\n var full = 'ADEPS'.split('');\n \n Roo.each(records, function(e){\n _this.dataUpdate[e.id] = e.data.accessmask;\n \n var k = e.data.accessmask.split('');\n var rm = e.data.FullMask.split('');\n \n Roo.each(full, function(ee){\n if (rm.indexOf(ee) < 0) {\n e.set('accessmask_'+ee, -1); \n return;\n }\n \n e.set('accessmask_'+ee, (k.indexOf(ee) < 0) ? 0 : 1);\n });\n \n if(e.data.accessmask == e.data.FullMask){\n e.set('accessmask_AA', 1);\n }\n });\n}" }, "xtype" : "Store", "remoteSort" : true, "$ sortInfo" : "{ field : 'id', direction: 'ASC' }", "$ xns" : "Roo.data", "* prop" : "dataSource", "items" : [ { "$ url" : "baseURL + '/Admin/GroupRights.php'", "method" : "GET", "xtype" : "HttpProxy", "$ xns" : "Roo.data", "* prop" : "proxy" }, { "id" : "id", "root" : "data", "xtype" : "JsonReader", "$ fields" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'rightname',\n 'type': 'string'\n },\n {\n 'name': 'descript',\n 'type': 'string'\n },\n {\n 'name': 'accessmask',\n 'type': 'string'\n },\n {\n 'name': 'FullMask',\n 'type': 'string'\n },\n {\n 'name': 'group_id',\n 'type': 'int'\n }\n]", "$ xns" : "Roo.data", "* prop" : "reader", "totalProperty" : "total" } ] }, { "pageSize" : 25, "xtype" : "PagingToolbar", "emptyMsg" : "No Person found", "$ xns" : "Roo", "displayInfo" : true, "displayMsg" : "Displaying Person{0} - {1} of {2}", "* prop" : "footer", "items" : [ { "text" : "Drag person to add or remove from group", "xtype" : "TextItem", "$ xns" : "Roo.Toolbar" } ] }, { "xtype" : "Toolbar", "$ xns" : "Roo", "* prop" : "toolbar", "items" : [ { "listeners" : { "click" : "function (_self, e)\n{\n \n var params = { group_id : _this.group_id };\n for(var i in _this.dataUpdate) {\n params['dataUpdate[' + i + ']'] = _this.dataUpdate[i];\n }\n //Roo.log(params);return;\n \n new Pman.Request({\n url : baseURL + '/Admin/GroupRights.php',\n method :'POST',\n mask: \"Saving\",\n params : params,\n success : function() {\n // do nothing\n \n //_this.grid.ds.remove(record);\n \n },\n failure : function() \n {\n Roo.MessageBox.alert(\"Error\", \"saving failed\", function() {\n _this.grid.footer.onClick('first');\n });\n }\n });\n}" }, "text" : "Save", "xtype" : "Button", "$ xns" : "Roo.Toolbar" } ] }, { "xtype" : "ColumnModel", "sortable" : false, "header" : "All", "width" : 50, "$ renderer" : "function(v,x,r) {\n \n var state = v> 0 ? '-checked' : '';\n\n return '';\n}", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "accessmask_AA" }, { "xtype" : "ColumnModel", "sortable" : false, "header" : "Module", "width" : 150, "$ renderer" : "function(v,x,r) {\n if(!v){\n return;\n }\n return String.format('{0}', v.split('.').shift(), v);\n}", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "rightname" }, { "xtype" : "ColumnModel", "sortable" : false, "header" : "Permission", "width" : 300, "$ renderer" : "function(v,x,r)\n{\n if (r.json.descript && r.json.descript.length) {\n return String.format('{0}',r.json.descript);\n }\n \n return '???' + v;\n}", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "descript" }, { "xtype" : "ColumnModel", "width" : 75, "header" : "Add", "$ renderer" : "function(v) { \n if (v < 0) {\n return '';\n }\n var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "accessmask_A" }, { "xtype" : "ColumnModel", "width" : 75, "header" : "Edit", "$ renderer" : "function(v) { \n if (v < 0) {\n return '';\n }\n var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "accessmask_E" }, { "xtype" : "ColumnModel", "width" : 75, "header" : "Delete", "$ renderer" : "function(v) { \n if (v < 0) {\n return '';\n }\n var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "accessmask_D" }, { "xtype" : "ColumnModel", "width" : 75, "header" : "List/View", "$ renderer" : "function(v) { \n \n if (v < 0) {\n return '';\n }\n var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "accessmask_S" }, { "xtype" : "ColumnModel", "width" : 75, "header" : "Print/Export", "$ renderer" : "function(v,x,r) { \n \n \n if (v < 0) {\n return '';\n }\n var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "accessmask_P" } ] } ] } ] }