Pman.Tab.AdminContactsGroupRight.bjs
[Pman.Admin] / Pman.Tab.AdminContactsGroupRight.bjs
1 {
2     "id": "roo-file-161",
3     "name": "Pman.Tab.AdminContactsGroupRight",
4     "parent": "Pman.Tab.AdminContactsManager",
5     "title": "",
6     "path": "/home/chris/gitlive/Pman.Admin/Pman.Tab.AdminContactsGroupRight.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
11             },
12             "autoScroll": true,
13             "background": true,
14             "fitContainer": true,
15             "fitToframe": true,
16             "region": "center",
17             "tableName": "Person",
18             "title": "Rights",
19             "xtype": "GridPanel",
20             "|xns": "Roo",
21             "items": [
22                 {
23                     "listeners": {
24                         "|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}",
25                         "|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",
26                         "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\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        \n        //rec.commit();\n         \n        \n}"
27                     },
28                     "*prop": "grid",
29                     "ddGroup": "groupDD",
30                     "enableDrag": true,
31                     "loadMask": true,
32                     "xtype": "Grid",
33                     "|xns": "Roo.grid",
34                     "items": [
35                         {
36                             "listeners": {
37                                 "beforeload": "function (_self, o)\n{\n    if (!o.params) {\n        o.params = {}\n    }\n    var s = Pman.Tab.Groups.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}",
38                                 "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}",
39                                 "load": "function (_self, records, options)\n{\n    Roo.each(records, function(e){\n        var k = e.data.accessmask.split('');\n        Roo.each(k, function(ee){\n            e.data.set('accessmask_'+ee, 1);\n        });\n    });\n}"
40                             },
41                             "*prop": "dataSource",
42                             "remoteSort": true,
43                             "xtype": "Store",
44                             "|sortInfo": "{ field : 'id', direction: 'ASC' }",
45                             "|xns": "Roo.data",
46                             "items": [
47                                 {
48                                     "*prop": "proxy",
49                                     "method": "GET",
50                                     "xtype": "HttpProxy",
51                                     "|url": "baseURL + '/Admin/GroupRights.php'",
52                                     "|xns": "Roo.data"
53                                 },
54                                 {
55                                     "*prop": "reader",
56                                     "id": "id",
57                                     "root": "data",
58                                     "totalProperty": "total",
59                                     "xtype": "JsonReader",
60                                     "|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]",
61                                     "|xns": "Roo.data"
62                                 }
63                             ]
64                         },
65                         {
66                             "*prop": "footer",
67                             "xtype": "PagingToolbar",
68                             "pageSize": 25,
69                             "displayInfo": true,
70                             "displayMsg": "Displaying Person{0} - {1} of {2}",
71                             "emptyMsg": "No Person found",
72                             "|xns": "Roo",
73                             "items": [
74                                 {
75                                     "text": "Drag person to add or remove from group",
76                                     "xtype": "TextItem",
77                                     "|xns": "Roo.Toolbar"
78                                 }
79                             ]
80                         },
81                         {
82                             "*prop": "toolbar",
83                             "xtype": "Toolbar",
84                             "|xns": "Roo",
85                             "items": [
86                                 {
87                                     "text": "Search",
88                                     "xtype": "TextItem",
89                                     "|xns": "Roo.Toolbar"
90                                 },
91                                 {
92                                     "listeners": {
93                                         "render": "function (_self)\n{\n    _this.searchBox = _self;\n}",
94                                         "show": "function (_self,e)\n{\n    if (e.getCharCode() != 13) {\n        return;\n    }\n    _this.grid.footer.onClick('first');\n}",
95                                         "specialkey": "function (_self, e)\n{\n  if (e.getKey() == 13) {\n    _this.grid.footer.onClick('first');\n  }\n}"
96                                     },
97                                     "xtype": "TextField",
98                                     "|xns": "Roo.form"
99                                 },
100                                 {
101                                     "listeners": {
102                                         "render": "function (_self)\n{\n  _this.companyCombo = _self;\n}",
103                                         "select": "function (combo, record, index)\n{\n   _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );\n}"
104                                     },
105                                     "displayField": "name",
106                                     "editable": true,
107                                     "emptyText": "Select Company",
108                                     "forceSelection": true,
109                                     "hiddenName": "company_id",
110                                     "listWidth": 400,
111                                     "loadingText": "Searching...",
112                                     "minChars": 2,
113                                     "name": "company_name",
114                                     "pageSize": 20,
115                                     "qtip": "Select Companies",
116                                     "queryParam": "query[name]",
117                                     "selectOnFocus": true,
118                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
119                                     "triggerAction": "all",
120                                     "typeAhead": true,
121                                     "valueField": "id",
122                                     "width": 150,
123                                     "xtype": "ComboBox",
124                                     "|xns": "Roo.form",
125                                     "items": [
126                                         {
127                                             "listeners": {
128                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
129                                             },
130                                             "*prop": "store",
131                                             "remoteSort": true,
132                                             "xtype": "Store",
133                                             "|sortInfo": "{ direction : 'ASC', field: 'name' }",
134                                             "|xns": "Roo.data",
135                                             "items": [
136                                                 {
137                                                     "*prop": "proxy",
138                                                     "xtype": "HttpProxy",
139                                                     "method": "GET",
140                                                     "|xns": "Roo.data",
141                                                     "|url": "baseURL + '/Roo/Companies.php'"
142                                                 },
143                                                 {
144                                                     "*prop": "reader",
145                                                     "xtype": "JsonReader",
146                                                     "|xns": "Roo.data",
147                                                     "id": "id",
148                                                     "root": "data",
149                                                     "totalProperty": "total",
150                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"code\",\"type\":\"string\"}]"
151                                                 }
152                                             ]
153                                         }
154                                     ]
155                                 },
156                                 {
157                                     "|xns": "Roo.Toolbar",
158                                     "xtype": "Fill"
159                                 }
160                             ]
161                         },
162                         {
163                             "*prop": "colModel[]",
164                             "dataIndex": "accessmask_AA",
165                             "header": "All",
166                             "sortable": false,
167                             "width": 50,
168                             "xtype": "ColumnModel",
169                             "|renderer": "function(v,x,r) {\n     \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
170                             "|xns": "Roo.grid"
171                         },
172                         {
173                             "*prop": "colModel[]",
174                             "dataIndex": "rightname",
175                             "header": "Module",
176                             "sortable": false,
177                             "width": 150,
178                             "xtype": "ColumnModel",
179                             "|renderer": "function(v,x,r) {\n    if(!v){\n        return;\n    }\n    return String.format('<span qtip=\"{1}\">{0}</span>', v.split('.').shift(), v);\n}",
180                             "|xns": "Roo.grid"
181                         },
182                         {
183                             "*prop": "colModel[]",
184                             "dataIndex": "descript",
185                             "header": "Permission",
186                             "sortable": false,
187                             "width": 300,
188                             "xtype": "ColumnModel",
189                             "|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}",
190                             "|xns": "Roo.grid"
191                         },
192                         {
193                             "*prop": "colModel[]",
194                             "dataIndex": "accessmask_A",
195                             "header": "Add",
196                             "width": 75,
197                             "xtype": "ColumnModel",
198                             "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
199                             "|xns": "Roo.grid"
200                         },
201                         {
202                             "*prop": "colModel[]",
203                             "dataIndex": "accessmask_E",
204                             "header": "Edit",
205                             "width": 75,
206                             "xtype": "ColumnModel",
207                             "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
208                             "|xns": "Roo.grid"
209                         },
210                         {
211                             "*prop": "colModel[]",
212                             "dataIndex": "accessmask_D",
213                             "header": "Delete",
214                             "width": 75,
215                             "xtype": "ColumnModel",
216                             "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
217                             "|xns": "Roo.grid"
218                         },
219                         {
220                             "*prop": "colModel[]",
221                             "dataIndex": "accessmask_S",
222                             "header": "List/View",
223                             "width": 75,
224                             "xtype": "ColumnModel",
225                             "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
226                             "|xns": "Roo.grid"
227                         },
228                         {
229                             "*prop": "colModel[]",
230                             "dataIndex": "accessmask_P",
231                             "header": "Print/Export",
232                             "width": 75,
233                             "xtype": "ColumnModel",
234                             "|renderer": "function(v,x,r) {  \n    \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
235                             "|xns": "Roo.grid"
236                         }
237                     ]
238                 }
239             ]
240         }
241     ],
242     "permname": "",
243     "modOrder": "001"
244 }