Pman.Tab.AdminContactsGroupRight.bjs
[Pman.Admin] / Pman.Tab.AdminContactsGroupRight.js
index 04eb13e..9c32ac4 100644 (file)
@@ -57,7 +57,8 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                     },
                     cellclick : function (_self, rowIndex, columnIndex, e)
                     {
-                    
+                            _this.dataUpdate = typeof(_this.dataUpdate) =='undefined' ?  {} : _this.dataUpdate;
+                            
                             var di = this.colModel.getDataIndex(columnIndex);
                             var i = di.split('_').shift();
                             var k = di.split('_').pop();
@@ -72,7 +73,10 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                                 });
                             } 
                             rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1);
+                            //rec.data.accessmask = rec.data.accessmask + rec
+                            //Roo.log(rec);
                             _this.dataUpdate[rec.data.id] = rec.data.accessmask;
+                    
                             //rec.commit();
                              
                             
@@ -90,7 +94,7 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                             if (!o.params) {
                                 o.params = {}
                             }
-                            var s = Pman.Tab.Groups.grid.getSelectionModel().getSelections();
+                            var s = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelections();
                             if (!s.length) {
                                 o.params.group_id = -1;
                             } else {
@@ -135,11 +139,24 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                         },
                         load : function (_self, records, options)
                         {
+                            _this.dataUpdate = {};
+                            var fmask = 'ADEPS'.split('');
+                            
                             Roo.each(records, function(e){
+                                _this.dataUpdate[e.id] = e.accessmask;
+                            
                                 var k = e.data.accessmask.split('');
-                                Roo.each(k, function(ee){
-                                    e.set('accessmask_'+ee, 1);
+                                var rm = e.data.FullMask.split('');
+                                
+                                Roo.each(full, function(ee){
+                                    if (rm.indexOf(ee) < 0) {
+                                        e.set('accessmask_'+ee, -1);          
+                                        return;
+                                    }
+                                    
+                                    e.set('accessmask_'+ee, (k.indexOf(ee) < 0) ? 0 : 1);
                                 });
+                                
                                 if(e.data.accessmask == e.data.FullMask){
                                     e.set('accessmask_AA', 1);
                                 }
@@ -215,13 +232,16 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                                 {
                                     
                                     new Pman.Request({
-                                        url : baseURL + '/Roo/GroupRights.php',
+                                        url : baseURL + '/GroupRights.php',
                                         method :'POST',
-                                        params : _this.dataUpdate,
+                                        params : {
+                                            dataUpdate : _this.dataUpdate,
+                                            dataAdd : _this.dataAdd
+                                        },
                                         success : function() {
                                             // do nothing
                                             
-                                            _this.grid.ds.remove(record);
+                                            //_this.grid.ds.remove(record);
                                             
                                         },
                                         failure : function()