Pman.Tab.AdminContactsGroupRight.bjs
[Pman.Admin] / Pman.Tab.AdminContactsGroupRight.js
index b34fe2c..e650c30 100644 (file)
@@ -59,19 +59,22 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                     {
                     
                             var di = this.colModel.getDataIndex(columnIndex);
-                            if (di != 'active') {
+                            var i = di.split('_').shift();
+                            var k = di.split('_').pop();
+                            
+                            if (i != 'accessmask') {
                                 return;
                             }
-                             
+                    
                             var rec = _this.grid.ds.getAt(rowIndex);
-                            
-                            rec.set('active', rec.data.active ? 0 : 1);
-                            rec.commit();
+                            Roo.log(di);
+                            Roo.log(rec);
+                            rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1);
+                            //rec.commit();
                              
                             
                     }
                 },
-                autoExpandColumn : 'name',
                 ddGroup : 'groupDD',
                 enableDrag : true,
                 loadMask : true,
@@ -555,139 +558,9 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                                 }
                             }
                         },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function (_self, e)
-                                {
-                                _this.grid.footer.onClick('first');
-                                }
-                            },
-                            cls : 'x-btn-icon',
-                            icon : rootURL + '/Pman/templates/images/search.gif'
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function (_self, e)
-                                {
-                                _this.searchBox.setValue('');
-                                    _this.grid.footer.onClick('first');
-                                }
-                            },
-                            cls : 'x-btn-icon',
-                            icon : rootURL + '/Pman/templates/images/edit-clear.gif'
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                toggle : function (_self, pressed)
-                                {
-                                   _this.grid.footer.onClick('first');
-                                   this.setText(pressed ? "Show Active" : "Show Removed");
-                                   
-                                   
-                                },
-                                render : function (_self)
-                                {
-                                  _this.activeButton = _self;
-                                }
-                            },
-                            enableToggle : true,
-                            text : "Show Removed"
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                toggle : function (_self, pressed)
-                                {
-                                   _this.grid.footer.onClick('first');
-                                   this.setText(pressed ? "Show Company" : "Show No Company");
-                                   
-                                   
-                                },
-                                render : function (_self)
-                                {
-                                  _this.active_company_button = _self;
-                                }
-                            },
-                            enableToggle : true,
-                            text : "Show No Company"
-                        },
                         {
                             xtype: 'Fill',
                             xns: Roo.Toolbar
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function()
-                                {
-                                    
-                                    _this.dialog.show( { id : 0 } , function() {
-                                        _this.grid.footer.onClick('first');
-                                   }); 
-                                }
-                            },
-                            cls : 'x-btn-text-icon',
-                            text : "Add",
-                            icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function()
-                                {
-                                    
-                                    Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
-                                        _this.grid.footer.onClick('first');
-                                   }); 
-                                }
-                            },
-                            cls : 'x-btn-text-icon',
-                            text : "Bulk Add",
-                            icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function()
-                                {
-                                    var s = _this.grid.getSelectionModel().getSelections();
-                                    if (!s.length || (s.length > 1))  {
-                                        Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
-                                        return;
-                                    }
-                                  
-                                    _this.dialog.show(s[0].data, function() {
-                                        _this.grid.footer.onClick('first');
-                                    }); 
-                                    
-                                }
-                            },
-                            cls : 'x-btn-text-icon',
-                            text : "Edit",
-                            icon : Roo.rootURL + 'images/default/tree/leaf.gif'
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function()
-                                {
-                                     Pman.genericDelete(_this, 'Person'); 
-                                }
-                            },
-                            cls : 'x-btn-text-icon',
-                            text : "Delete",
-                            icon : rootURL + '/Pman/templates/images/trash.gif'
                         }
                     ]
                 },
@@ -695,15 +568,13 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
-                        dataIndex : 'accessmask',
+                        dataIndex : 'accessmask_AA',
                         header : 'All',
                         sortable : false,
                         width : 50,
                         renderer : function(v,x,r) {
+                            var state = v> 0 ?  '-checked' : '';
                         
-                            state = (v == fm) ? '-checked' : '';
-                        
-                            
                             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
                         }
                     },
@@ -715,59 +586,85 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({
                         sortable : false,
                         width : 150,
                         renderer : function(v,x,r) {
+                            if(!v){
+                                return;
+                            }
                             return String.format('<span qtip="{1}">{0}</span>', v.split('.').shift(), v);
                         }
                     },
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
-                        dataIndex : 'rightname',
+                        dataIndex : 'descript',
                         header : 'Permission',
-                        sortable : true,
-                        width : 200,
-                        renderer : function(v) { return String.format('{0}', v); }
+                        sortable : false,
+                        width : 300,
+                        renderer : function(v,x,r)
+                        {
+                            if (r.json.descript && r.json.descript.length) {
+                                return String.format('{0}',r.json.descript);
+                            }
+                            
+                            return '???' + v;
+                        }
                     },
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
-                        dataIndex : 'role',
-                        header : 'Role',
-                        width : 100,
-                        renderer : function(v) { return String.format('{0}', v); }
+                        dataIndex : 'accessmask_A',
+                        header : 'Add',
+                        width : 75,
+                        renderer : function(v) {  
+                            var state = v> 0 ?  '-checked' : '';
+                        
+                            return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                        
+                         }
                     },
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
-                        dataIndex : 'phone',
-                        header : 'Phone',
-                        width : 100,
-                        renderer : function(v) { return String.format('{0}', v); }
+                        dataIndex : 'accessmask_E',
+                        header : 'Edit',
+                        width : 75,
+                        renderer : function(v) {  
+                            var state = v> 0 ?  '-checked' : '';
+                        
+                            return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                        
+                         }
                     },
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
-                        dataIndex : 'fax',
-                        header : 'Fax',
-                        width : 100,
-                        renderer : function(v) { return String.format('{0}', v); }
+                        dataIndex : 'accessmask_D',
+                        header : 'Delete',
+                        width : 75,
+                        renderer : function(v) {  
+                            var state = v> 0 ?  '-checked' : '';
+                        
+                            return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                        
+                         }
                     },
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
-                        dataIndex : 'email',
-                        header : 'Email',
-                        sortable : true,
-                        width : 200,
-                        renderer : function(v) {
-                           return (v.length && v.indexOf('@') > 0 ) ? 
-                                            String.format('<a href="mailto:{0}">{0}</a>',v) : v;
+                        dataIndex : 'accessmask_S',
+                        header : 'List/View',
+                        width : 75,
+                        renderer : function(v) {  
+                            var state = v> 0 ?  '-checked' : '';
+                        
+                            return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                        
                          }
                     },
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
-                        dataIndex : 'active',
-                        header : 'Active',
+                        dataIndex : 'accessmask_P',
+                        header : 'Print/Export',
                         width : 75,
                         renderer : function(v) {  
                             var state = v> 0 ?  '-checked' : '';