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 fmask = 'ADEPS'.split('');
145 Roo.each(records, function(e){
146 _this.dataUpdate[e.id] = e.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 url : baseURL + '/GroupRights.php',
238 dataUpdate : _this.dataUpdate,
239 dataAdd : _this.dataAdd
241 success : function() {
244 //_this.grid.ds.remove(record);
249 Roo.MessageBox.alert("Error", "saving failed", function() {
250 _this.grid.footer.onClick('first');
262 xtype: 'ColumnModel',
264 dataIndex : 'accessmask_AA',
268 renderer : function(v,x,r) {
270 var state = v> 0 ? '-checked' : '';
272 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
276 xtype: 'ColumnModel',
278 dataIndex : 'rightname',
282 renderer : function(v,x,r) {
286 return String.format('<span qtip="{1}">{0}</span>', v.split('.').shift(), v);
290 xtype: 'ColumnModel',
292 dataIndex : 'descript',
293 header : 'Permission',
296 renderer : function(v,x,r)
298 if (r.json.descript && r.json.descript.length) {
299 return String.format('{0}',r.json.descript);
306 xtype: 'ColumnModel',
308 dataIndex : 'accessmask_A',
311 renderer : function(v) {
315 var state = v> 0 ? '-checked' : '';
317 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
322 xtype: 'ColumnModel',
324 dataIndex : 'accessmask_E',
327 renderer : function(v) {
331 var state = v> 0 ? '-checked' : '';
333 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
338 xtype: 'ColumnModel',
340 dataIndex : 'accessmask_D',
343 renderer : function(v) {
344 var state = v> 0 ? '-checked' : '';
346 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
351 xtype: 'ColumnModel',
353 dataIndex : 'accessmask_S',
354 header : 'List/View',
356 renderer : function(v) {
357 var state = v> 0 ? '-checked' : '';
359 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
364 xtype: 'ColumnModel',
366 dataIndex : 'accessmask_P',
367 header : 'Print/Export',
369 renderer : function(v,x,r) {
371 var state = v> 0 ? '-checked' : '';
373 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';