Pman.Tab.PersonList.js
authorAlan Knowles <alan@akbkhome.com>
Thu, 16 Dec 2010 02:22:47 +0000 (10:22 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 16 Dec 2010 02:22:47 +0000 (10:22 +0800)
Pman.Tab.PersonList.js

index 43298e7..500613c 100644 (file)
@@ -216,7 +216,36 @@ Pman.Tab.PersonList.prototype = {
                         }
                         
                         
-                    } 
+                    },
+                    cellclick : function (_self, rowIndex, columnIndex, e)
+                    {
+                        var id = this.colModel.getDataIndex(colIndex);
+                        if (columnIndex > 0 ) {
+                            return;
+                        }
+                        var sel = _this.panel.tree.getSelectionModel().getSelectedNode();
+                        if (!sel || isNaN(parseInt(sel.id))) {
+                             
+                            return  ;
+                        }
+                        
+                        var rec = _this.grid.ds.getAt(rowIndex);
+                        if (rec.data.has_perm) {
+                            if (rec.data.has_perm != sel.id) {
+                                Roo.MessageBox.alert("Error", "This is an inherited permission, Remove permission for parent category");
+                                return;
+                            }
+                            Roo.log('setting perm to 0');
+                            rec.set('has_perm', 0);
+                            rec.commit();
+                            // remove it only if it's the same..
+                            return;
+                        }
+                        rec.set('has_perm', sel.id);
+                        rec.commit();
+                        
+                        
+                    }
                     
                 }