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