1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
6 part : ["Admin","ContactsGroupRight"],
7 order : '001-Pman.Tab.AdminContactsGroupRight',
9 parent : 'Pman.Tab.AdminContactsManager',
10 name : "unnamed module",
21 activate : function() {
24 _this.grid.footer.onClick('first');
43 _this.dialog = Pman.Dialog.PersonEdit;
46 //_this.dialog = Pman.Dialog.FILL_IN
47 if (_this.panel.active) {
48 this.footer.onClick('first');
51 rowdblclick : function (_self, rowIndex, e)
53 if (!_this.dialog) return;
54 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
55 _this.grid.footer.onClick('first');
58 cellclick : function (_self, rowIndex, columnIndex, e)
60 _this.dataUpdate = typeof(_this.dataUpdate) =='undefined' ? {} : _this.dataUpdate;
62 var di = this.colModel.getDataIndex(columnIndex);
63 var i = di.split('_').shift();
64 var k = di.split('_').pop();
65 if (i != 'accessmask') {
68 var rec = _this.grid.ds.getAt(rowIndex);
70 var fm = rec.data.FullMask.split('');
71 Roo.each(fm, function(e){
72 rec.set(i+'_'+e, rec.data[i+'_'+k] ? 0 : 1);
75 rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1);
76 //rec.data.accessmask = rec.data.accessmask + rec
78 _this.dataUpdate[rec.data.id] = rec.data.accessmask;
92 beforeload : function (_self, o)
97 var s = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelections();
99 o.params.group_id = -1;
101 o.params.group_id = s[0].data.id;
103 if (o.params.group_id < 0) {
104 _this.grid.getView().el.mask("You can not set permissions for that group");
107 _this.grid.getView().el.unmask();
111 update : function (_self, record, operation)
113 if (operation != 'commit') {
116 // only used to change active status.
119 url : baseURL + '/Roo/GroupRights.php',
123 active: record.data.active
126 success : function() {
129 _this.grid.ds.remove(record);
134 Roo.MessageBox.alert("Error", "saving failed", function() {
135 _this.grid.footer.onClick('first');
140 load : function (_self, records, options)
142 _this.dataUpdate = {};
143 var full = 'ADEPS'.split('');
145 Roo.each(records, function(e){
146 _this.dataUpdate[e.id] = e.data.accessmask;
148 var k = e.data.accessmask.split('');
149 var rm = e.data.FullMask.split('');
151 Roo.each(full, function(ee){
152 if (rm.indexOf(ee) < 0) {
153 e.set('accessmask_'+ee, -1);
157 e.set('accessmask_'+ee, (k.indexOf(ee) < 0) ? 0 : 1);
160 if(e.data.accessmask == e.data.FullMask){
161 e.set('accessmask_AA', 1);
167 sortInfo : { field : 'id', direction: 'ASC' },
172 url : baseURL + '/Admin/GroupRights.php'
179 totalProperty : 'total',
194 'name': 'accessmask',
209 xtype: 'PagingToolbar',
213 displayMsg : "Displaying Person{0} - {1} of {2}",
214 emptyMsg : "No Person found",
219 text : "Drag person to add or remove from group"
231 click : function (_self, e)
235 for(var i in _this.dataUpdate) {
236 params['dataUpdate[' + i + ']'] = _this.dataUpdate[i];
241 url : baseURL + '/GroupRights.php',
244 success : function() {
247 //_this.grid.ds.remove(record);
252 Roo.MessageBox.alert("Error", "saving failed", function() {
253 _this.grid.footer.onClick('first');
265 xtype: 'ColumnModel',
267 dataIndex : 'accessmask_AA',
271 renderer : function(v,x,r) {
273 var state = v> 0 ? '-checked' : '';
275 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
279 xtype: 'ColumnModel',
281 dataIndex : 'rightname',
285 renderer : function(v,x,r) {
289 return String.format('<span qtip="{1}">{0}</span>', v.split('.').shift(), v);
293 xtype: 'ColumnModel',
295 dataIndex : 'descript',
296 header : 'Permission',
299 renderer : function(v,x,r)
301 if (r.json.descript && r.json.descript.length) {
302 return String.format('{0}',r.json.descript);
309 xtype: 'ColumnModel',
311 dataIndex : 'accessmask_A',
314 renderer : function(v) {
318 var state = v> 0 ? '-checked' : '';
320 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
325 xtype: 'ColumnModel',
327 dataIndex : 'accessmask_E',
330 renderer : function(v) {
334 var state = v> 0 ? '-checked' : '';
336 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
341 xtype: 'ColumnModel',
343 dataIndex : 'accessmask_D',
346 renderer : function(v) {
350 var state = v> 0 ? '-checked' : '';
352 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
357 xtype: 'ColumnModel',
359 dataIndex : 'accessmask_S',
360 header : 'List/View',
362 renderer : function(v) {
367 var state = v> 0 ? '-checked' : '';
369 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
374 xtype: 'ColumnModel',
376 dataIndex : 'accessmask_P',
377 header : 'Print/Export',
379 renderer : function(v,x,r) {
385 var state = v> 0 ? '-checked' : '';
387 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';