From 4a751f266babc0a71a67bb0fc0dc3317881643b6 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 27 Jun 2016 15:50:44 +0800 Subject: [PATCH] Pman.Tab.AdminContactsGroupRight.bjs Pman.Tab.AdminContactsGroupRight.js --- Pman.Tab.AdminContactsGroupRight.bjs | 360 ++++++------ Pman.Tab.AdminContactsGroupRight.js | 829 ++++++++++++++------------- 2 files changed, 619 insertions(+), 570 deletions(-) diff --git a/Pman.Tab.AdminContactsGroupRight.bjs b/Pman.Tab.AdminContactsGroupRight.bjs index ef6f7b2..5540e4f 100644 --- a/Pman.Tab.AdminContactsGroupRight.bjs +++ b/Pman.Tab.AdminContactsGroupRight.bjs @@ -1,177 +1,191 @@ { - "id": "roo-file-147", - "name": "Pman.Tab.AdminContactsGroupRight", - "parent": "Pman.Tab.AdminContactsManager", - "title": "", - "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminContactsGroupRight.bjs", - "items": [ + "name" : "Pman.Tab.AdminContactsGroupRight", + "parent" : "Pman.Tab.AdminContactsManager", + "title" : "", + "path" : "/home/alan/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, + "background" : true, + "fitToframe" : true, + "region" : "center", + "title" : "Rights", + "xtype" : "GridPanel", + "fitContainer" : true, + "$ xns" : "Roo", + "tableName" : "Person", + "items" : [ + { + "listeners" : { + "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}", + "|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}" + }, + "xtype" : "Grid", + "enableDrag" : true, + "ddGroup" : "groupDD", + "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" : [ { - "listeners": { - "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" - }, - "autoScroll": true, - "background": true, - "fitContainer": true, - "fitToframe": true, - "region": "center", - "tableName": "Person", - "title": "Rights", - "xtype": "GridPanel", - "|xns": "Roo", - "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}" - }, - "*prop": "grid", - "ddGroup": "groupDD", - "enableDrag": true, - "loadMask": true, - "xtype": "Grid", - "|xns": "Roo.grid", - "items": [ - { - "listeners": { - "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}", - "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}", - "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}" - }, - "*prop": "dataSource", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ field : 'id', direction: 'ASC' }", - "|xns": "Roo.data", - "items": [ - { - "*prop": "proxy", - "method": "GET", - "xtype": "HttpProxy", - "|url": "baseURL + '/Admin/GroupRights.php'", - "|xns": "Roo.data" - }, - { - "*prop": "reader", - "id": "id", - "root": "data", - "totalProperty": "total", - "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": "footer", - "xtype": "PagingToolbar", - "pageSize": 25, - "displayInfo": true, - "displayMsg": "Displaying Person{0} - {1} of {2}", - "emptyMsg": "No Person found", - "|xns": "Roo", - "items": [ - { - "text": "Drag person to add or remove from group", - "xtype": "TextItem", - "|xns": "Roo.Toolbar" - } - ] - }, - { - "*prop": "toolbar", - "xtype": "Toolbar", - "|xns": "Roo", - "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" - } - ] - }, - { - "*prop": "colModel[]", - "dataIndex": "accessmask_AA", - "header": "All", - "sortable": false, - "width": 50, - "xtype": "ColumnModel", - "|renderer": "function(v,x,r) {\n \n var state = v> 0 ? '-checked' : '';\n\n return '';\n}", - "|xns": "Roo.grid" - }, - { - "*prop": "colModel[]", - "dataIndex": "rightname", - "header": "Module", - "sortable": false, - "width": 150, - "xtype": "ColumnModel", - "|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": "descript", - "header": "Permission", - "sortable": false, - "width": 300, - "xtype": "ColumnModel", - "|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": "accessmask_A", - "header": "Add", - "width": 75, - "xtype": "ColumnModel", - "|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", - "header": "Edit", - "width": 75, - "xtype": "ColumnModel", - "|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", - "header": "Delete", - "width": 75, - "xtype": "ColumnModel", - "|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_S", - "header": "List/View", - "width": 75, - "xtype": "ColumnModel", - "|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_P", - "header": "Print/Export", - "width": 75, - "xtype": "ColumnModel", - "|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" - } - ] - } - ] + "$ url" : "baseURL + '/Admin/GroupRights.php'", + "xtype" : "HttpProxy", + "method" : "GET", + "$ 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" } - ], - "permname": "", - "modOrder": "001" + ] + }, + { + "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", + "header" : "Add", + "width" : 75, + "$ 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", + "header" : "Edit", + "width" : 75, + "$ 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", + "header" : "Delete", + "width" : 75, + "$ 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", + "header" : "List/View", + "width" : 75, + "$ 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", + "header" : "Print/Export", + "width" : 75, + "$ 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" + } + ] + } + ] + } + ] } \ No newline at end of file diff --git a/Pman.Tab.AdminContactsGroupRight.js b/Pman.Tab.AdminContactsGroupRight.js index 8d8aeba..f9b635a 100644 --- a/Pman.Tab.AdminContactsGroupRight.js +++ b/Pman.Tab.AdminContactsGroupRight.js @@ -2,402 +2,437 @@ // Auto generated file - created by app.Builder.js- do not edit directly (at present!) +Roo.namespace('Pman.Tab'); + Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({ - part : ["Admin","ContactsGroupRight"], - order : '001-Pman.Tab.AdminContactsGroupRight', - region : 'center', - parent : 'Pman.Tab.AdminContactsManager', - name : "unnamed module", - disabled : false, - permname : '', - _tree : function() - { - var _this = this; - var MODULE = this; - return { - xtype: 'GridPanel', - xns: Roo, - listeners : { - activate : function() { - _this.panel = this; - if (_this.grid) { - _this.grid.footer.onClick('first'); - } - } - }, - autoScroll : true, - background : true, - fitContainer : true, - fitToframe : true, - region : 'center', - tableName : 'Person', - title : "Rights", - grid : { - xtype: 'Grid', - xns: Roo.grid, - listeners : { - render : function() - { - _this.grid = this; - if (!_this.dialog) { - _this.dialog = Pman.Dialog.PersonEdit; - - } - //_this.dialog = Pman.Dialog.FILL_IN - if (_this.panel.active) { - this.footer.onClick('first'); - } - }, - cellclick : function (_self, rowIndex, columnIndex, e) - { - _this.dataUpdate = typeof(_this.dataUpdate) =='undefined' ? {} : _this.dataUpdate; - - var di = this.colModel.getDataIndex(columnIndex); - var i = di.split('_').shift(); - var k = di.split('_').pop(); - if (i != 'accessmask') { - return; - } - var rec = _this.grid.ds.getAt(rowIndex); - var fm = rec.data.FullMask.split(''); - if(k == 'AA'){ - - Roo.each(fm, function(e){ - rec.set(i+'_'+e, rec.data[i+'_'+k] ? 0 : 1); - }); - } - rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1); - - var newmask = ''; - Roo.each(fm, function(e) { - if (rec.data[i+'_'+e] === 1) { - - newmask += e; - } - - }); - - //rec.data.accessmask = rec.data.accessmask + rec - //Roo.log(rec); - _this.dataUpdate[rec.data.id] = newmask; - - //rec.commit(); - - - } - }, - ddGroup : 'groupDD', - enableDrag : true, - loadMask : true, - dataSource : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o) - { - if (!o.params) { - o.params = {} - } - _this.group_id = -1; - var s = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelections(); - - if (!s.length) { - o.params.group_id = -1; - } else { - o.params.group_id = s[0].data.id; - } - if (o.params.group_id < 0) { - _this.grid.getView().el.mask("You can not set permissions for that group"); - return false; - } - _this.group_id = o.params.group_id; - _this.grid.getView().el.unmask(); - return true; - - }, - update : function (_self, record, operation) - { - if (operation != 'commit') { - return; - } - // only used to change active status. - - new Pman.Request({ - url : baseURL + '/Roo/GroupRights.php', - method :'POST', - params : { - id : record.data.id, - active: record.data.active - - }, - success : function() { - // do nothing - - _this.grid.ds.remove(record); - - }, - failure : function() - { - Roo.MessageBox.alert("Error", "saving failed", function() { - _this.grid.footer.onClick('first'); - }); - } - }); - }, - load : function (_self, records, options) - { - _this.dataUpdate = {}; - var full = 'ADEPS'.split(''); - - Roo.each(records, function(e){ - _this.dataUpdate[e.id] = e.data.accessmask; - - var k = e.data.accessmask.split(''); - var rm = e.data.FullMask.split(''); - - Roo.each(full, function(ee){ - if (rm.indexOf(ee) < 0) { - e.set('accessmask_'+ee, -1); - return; - } - - e.set('accessmask_'+ee, (k.indexOf(ee) < 0) ? 0 : 1); - }); - - if(e.data.accessmask == e.data.FullMask){ - e.set('accessmask_AA', 1); - } - }); - } - }, - remoteSort : true, - sortInfo : { field : 'id', direction: 'ASC' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Admin/GroupRights.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [ - { - 'name': 'id', - 'type': 'int' - }, - { - 'name': 'rightname', - 'type': 'string' - }, - { - 'name': 'descript', - 'type': 'string' - }, - { - 'name': 'accessmask', - 'type': 'string' - }, - { - 'name': 'FullMask', - 'type': 'string' - }, - { - 'name': 'group_id', - 'type': 'int' - } - ] - } - }, - footer : { - xtype: 'PagingToolbar', - xns: Roo, - pageSize : 25, - displayInfo : true, - displayMsg : "Displaying Person{0} - {1} of {2}", - emptyMsg : "No Person found", - items : [ - { - xtype: 'TextItem', - xns: Roo.Toolbar, - text : "Drag person to add or remove from group" - } - ] - }, - toolbar : { - xtype: 'Toolbar', - xns: Roo, - items : [ - { - xtype: 'Button', - xns: Roo.Toolbar, - listeners : { - click : function (_self, e) - { - - var params = { group_id : _this.group_id }; - for(var i in _this.dataUpdate) { - params['dataUpdate[' + i + ']'] = _this.dataUpdate[i]; - } - //Roo.log(params);return; - - new Pman.Request({ - url : baseURL + '/Admin/GroupRights.php', - method :'POST', - mask: "Saving", - params : params, - success : function() { - // do nothing - - //_this.grid.ds.remove(record); - - }, - failure : function() - { - Roo.MessageBox.alert("Error", "saving failed", function() { - _this.grid.footer.onClick('first'); - }); - } - }); - } - }, - text : "Save" - } - ] - }, - colModel : [ - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'accessmask_AA', - header : 'All', - sortable : false, - width : 50, - renderer : function(v,x,r) { - - var state = v> 0 ? '-checked' : ''; - - return ''; - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'rightname', - header : 'Module', - sortable : false, - width : 150, - renderer : function(v,x,r) { - if(!v){ - return; - } - return String.format('{0}', v.split('.').shift(), v); - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'descript', - header : 'Permission', - sortable : false, - width : 300, - renderer : function(v,x,r) - { - if (r.json.descript && r.json.descript.length) { - return String.format('{0}',r.json.descript); - } - - return '???' + v; - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'accessmask_A', - header : 'Add', - width : 75, - renderer : function(v) { - if (v < 0) { - return ''; - } - var state = v> 0 ? '-checked' : ''; - - return ''; - - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'accessmask_E', - header : 'Edit', - width : 75, - renderer : function(v) { - if (v < 0) { - return ''; - } - var state = v> 0 ? '-checked' : ''; - - return ''; - - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'accessmask_D', - header : 'Delete', - width : 75, - renderer : function(v) { - if (v < 0) { - return ''; - } - var state = v> 0 ? '-checked' : ''; - - return ''; - - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'accessmask_S', - header : 'List/View', - width : 75, - renderer : function(v) { - - if (v < 0) { - return ''; - } - var state = v> 0 ? '-checked' : ''; - - return ''; - - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'accessmask_P', - header : 'Print/Export', - width : 75, - renderer : function(v,x,r) { - - - if (v < 0) { - return ''; - } - var state = v> 0 ? '-checked' : ''; - - return ''; - - } - } - ] - } - }; - } + + _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" + }, + + part : ["Admin", "ContactsGroupRight" ], + order : '001-Pman.Tab.AdminContactsGroupRight', + region : 'center', + parent : 'Pman.Tab.AdminContactsManager', + name : "unnamed module", + disabled : false, + permname : '', + _tree : function() + { + var _this = this; + var MODULE = this; + return { + xtype : 'GridPanel', + autoScroll : true, + background : true, + fitContainer : true, + fitToframe : true, + region : 'center', + tableName : 'Person', + title : _this._strings['72670177480da92f72dc55e4aaff219b'] /* Rights */, + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } + } + }, + xns : Roo, + '|xns' : 'Roo', + grid : { + xtype : 'Grid', + ddGroup : 'groupDD', + enableDrag : true, + loadMask : true, + listeners : { + cellclick : function (_self, rowIndex, columnIndex, e) + { + _this.dataUpdate = typeof(_this.dataUpdate) =='undefined' ? {} : _this.dataUpdate; + + var di = this.colModel.getDataIndex(columnIndex); + var i = di.split('_').shift(); + var k = di.split('_').pop(); + if (i != 'accessmask') { + return; + } + var rec = _this.grid.ds.getAt(rowIndex); + var fm = rec.data.FullMask.split(''); + if(k == 'AA'){ + + Roo.each(fm, function(e){ + rec.set(i+'_'+e, rec.data[i+'_'+k] ? 0 : 1); + }); + } + rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1); + + var newmask = ''; + Roo.each(fm, function(e) { + if (rec.data[i+'_'+e] === 1) { + + newmask += e; + } + + }); + + //rec.data.accessmask = rec.data.accessmask + rec + //Roo.log(rec); + _this.dataUpdate[rec.data.id] = newmask; + + //rec.commit(); + + + }, + render : function() + { + _this.grid = this; + if (!_this.dialog) { + _this.dialog = Pman.Dialog.PersonEdit; + + } + //_this.dialog = Pman.Dialog.FILL_IN + if (_this.panel.active) { + this.footer.onClick('first'); + } + } + }, + xns : Roo.grid, + '|xns' : 'Roo.grid', + footer : { + xtype : 'PagingToolbar', + displayInfo : true, + displayMsg : _this._strings['8444e81d652b084d70c71cd7d19ac0cf'] /* Displaying Person{0} - {1} of {2} */, + emptyMsg : _this._strings['f1174ecbbc232f948717979daf04cf08'] /* No Person found */, + pageSize : 25, + xns : Roo, + '|xns' : 'Roo', + items : [ + { + xtype : 'TextItem', + text : _this._strings['4110db87ce3ac86d603d03d691616b1e'] /* Drag person to add or remove from group */, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar' + } + ] + }, + toolbar : { + xtype : 'Toolbar', + xns : Roo, + '|xns' : 'Roo', + items : [ + { + xtype : 'Button', + text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */, + listeners : { + click : function (_self, e) + { + + var params = { group_id : _this.group_id }; + for(var i in _this.dataUpdate) { + params['dataUpdate[' + i + ']'] = _this.dataUpdate[i]; + } + //Roo.log(params);return; + + new Pman.Request({ + url : baseURL + '/Admin/GroupRights.php', + method :'POST', + mask: "Saving", + params : params, + success : function() { + // do nothing + + //_this.grid.ds.remove(record); + + }, + failure : function() + { + Roo.MessageBox.alert("Error", "saving failed", function() { + _this.grid.footer.onClick('first'); + }); + } + }); + } + }, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar' + } + ] + }, + dataSource : { + xtype : 'Store', + remoteSort : true, + sortInfo : { field : 'id', direction: 'ASC' }, + listeners : { + beforeload : function (_self, o) + { + if (!o.params) { + o.params = {} + } + _this.group_id = -1; + var s = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelections(); + + if (!s.length) { + o.params.group_id = -1; + } else { + o.params.group_id = s[0].data.id; + } + if (o.params.group_id < 0) { + _this.grid.getView().el.mask("You can not set permissions for that group"); + return false; + } + _this.group_id = o.params.group_id; + _this.grid.getView().el.unmask(); + return true; + + }, + load : function (_self, records, options) + { + _this.dataUpdate = {}; + var full = 'ADEPS'.split(''); + + Roo.each(records, function(e){ + _this.dataUpdate[e.id] = e.data.accessmask; + + var k = e.data.accessmask.split(''); + var rm = e.data.FullMask.split(''); + + Roo.each(full, function(ee){ + if (rm.indexOf(ee) < 0) { + e.set('accessmask_'+ee, -1); + return; + } + + e.set('accessmask_'+ee, (k.indexOf(ee) < 0) ? 0 : 1); + }); + + if(e.data.accessmask == e.data.FullMask){ + e.set('accessmask_AA', 1); + } + }); + }, + update : function (_self, record, operation) + { + if (operation != 'commit') { + return; + } + // only used to change active status. + + new Pman.Request({ + url : baseURL + '/Roo/GroupRights.php', + method :'POST', + params : { + id : record.data.id, + active: record.data.active + + }, + success : function() { + // do nothing + + _this.grid.ds.remove(record); + + }, + failure : function() + { + Roo.MessageBox.alert("Error", "saving failed", function() { + _this.grid.footer.onClick('first'); + }); + } + }); + } + }, + xns : Roo.data, + '|xns' : 'Roo.data', + proxy : { + xtype : 'HttpProxy', + method : 'GET', + url : baseURL + '/Admin/GroupRights.php', + xns : Roo.data, + '|xns' : 'Roo.data' + }, + reader : { + xtype : 'JsonReader', + fields : [ + { + 'name': 'id', + 'type': 'int' + }, + { + 'name': 'rightname', + 'type': 'string' + }, + { + 'name': 'descript', + 'type': 'string' + }, + { + 'name': 'accessmask', + 'type': 'string' + }, + { + 'name': 'FullMask', + 'type': 'string' + }, + { + 'name': 'group_id', + 'type': 'int' + } + ], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + '|xns' : 'Roo.data' + } + }, + colModel : [ + { + xtype : 'ColumnModel', + dataIndex : 'accessmask_AA', + header : _this._strings['b1c94ca2fbc3e78fc30069c8d0f01680'] /* All */, + renderer : function(v,x,r) { + + var state = v> 0 ? '-checked' : ''; + + return ''; + }, + sortable : false, + width : 50, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'rightname', + header : _this._strings['e55f75a29310d7b60f7ac1d390c8ae42'] /* Module */, + renderer : function(v,x,r) { + if(!v){ + return; + } + return String.format('{0}', v.split('.').shift(), v); + }, + sortable : false, + width : 150, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'descript', + header : _this._strings['ed5dea09095f671b801bee34ea28a319'] /* Permission */, + renderer : function(v,x,r) + { + if (r.json.descript && r.json.descript.length) { + return String.format('{0}',r.json.descript); + } + + return '???' + v; + }, + sortable : false, + width : 300, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'accessmask_A', + header : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */, + renderer : function(v) { + if (v < 0) { + return ''; + } + var state = v> 0 ? '-checked' : ''; + + return ''; + + }, + width : 75, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'accessmask_E', + header : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */, + renderer : function(v) { + if (v < 0) { + return ''; + } + var state = v> 0 ? '-checked' : ''; + + return ''; + + }, + width : 75, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'accessmask_D', + header : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */, + renderer : function(v) { + if (v < 0) { + return ''; + } + var state = v> 0 ? '-checked' : ''; + + return ''; + + }, + width : 75, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'accessmask_S', + header : _this._strings['4d2d6b41cd520fa711073fffbfe81076'] /* List/View */, + renderer : function(v) { + + if (v < 0) { + return ''; + } + var state = v> 0 ? '-checked' : ''; + + return ''; + + }, + width : 75, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'accessmask_P', + header : _this._strings['6a0483c116671f74ffb653d4c85c4f55'] /* Print/Export */, + renderer : function(v,x,r) { + + + if (v < 0) { + return ''; + } + var state = v> 0 ? '-checked' : ''; + + return ''; + + }, + width : 75, + xns : Roo.grid, + '|xns' : 'Roo.grid' + } + ] + } + }; } }); -- 2.39.2