X-Git-Url: http://git.roojs.org/?p=Pman.Admin;a=blobdiff_plain;f=Pman.Tab.AdminContactsGroupRight.bjs;h=2e38b5614121a88e088d65a85f6afbfc2de7e791;hp=2993955ce20a3fdc46bdd2cc7825ec09be217c2d;hb=HEAD;hpb=aa6cac5a2aca41f14eaa5fce5d526d10634b7e1c diff --git a/Pman.Tab.AdminContactsGroupRight.bjs b/Pman.Tab.AdminContactsGroupRight.bjs index 2993955..2e38b56 100644 --- a/Pman.Tab.AdminContactsGroupRight.bjs +++ b/Pman.Tab.AdminContactsGroupRight.bjs @@ -1,178 +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/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" : [ { - "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}", - "|rowdblclick": "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n _this.grid.footer.onClick('first');\n }); \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 if(k == 'AA'){\n var fm = rec.data.FullMask.split('');\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 //rec.data.accessmask = rec.data.accessmask + rec\n //Roo.log(rec);\n _this.dataUpdate[rec.data.id] = rec.data.accessmask;\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 var s = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelections();\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.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 fmask = 'ADEPS'.split('');\n \n Roo.each(records, function(e){\n _this.dataUpdate[e.id] = e.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 new Pman.Request({\n url : baseURL + '/GroupRights.php',\n method :'POST',\n params : {\n dataUpdate : _this.dataUpdate,\n dataAdd : _this.dataAdd\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}" - }, - "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 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 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 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 var state = v> 0 ? '-checked' : '';\n\n return '';\n \n }", - "|xns": "Roo.grid" - } - ] - } - ] + "$ 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" } - ], - "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", + "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" + } + ] + } + ] + } + ] } \ No newline at end of file