DataObjects/Core_domain.php
[Pman.Core] / Pman.Tab.PersonList.js
index 18a4ef0..6e6b8c8 100644 (file)
@@ -3,6 +3,8 @@
 /**
  * 
  * generic person list - used by perms. and staff lists.
+ *
+ * -- this is probably depreciated now..
  * 
  */
 
@@ -10,7 +12,7 @@
 
 Pman.Tab.PersonList = function(config)
 {
-    Ext.apply(this, config);
+    Roo.apply(this, config);
 }
 
 Pman.Tab.PersonList.prototype = {
@@ -31,6 +33,7 @@ Pman.Tab.PersonList.prototype = {
         // teams!?!
         alert('person list not configured');
         return false;
+        /*
         var tms = _this.getLeftSelections();
         
         if (tms.length) {
@@ -40,6 +43,7 @@ Pman.Tab.PersonList.prototype = {
         o.params['query[type]'] = this.type; // group type..
         o.params['query[person_internal_only_all]'] = 1;
         o.params['query[person_inactive]'] = this.showInActive ? 0  : 1;
+        */
         
     },
     
@@ -135,12 +139,12 @@ Pman.Tab.PersonList.prototype = {
         }
         this.parentLayout = parentLayout;
         
-        this.layout = new Ext.BorderLayout(
+        this.layout = new Roo.BorderLayout(
             parentLayout.getEl().createChild({tag:'div'}),
             {
                
                 center: {
-                    autoScroll:true,
+                    autoScroll:false,
                     hideTabs: true
                 }
             }
@@ -148,8 +152,13 @@ Pman.Tab.PersonList.prototype = {
 
 
 
-        this.tab = parentLayout.add(region,  new Ext.NestedLayoutPanel(
-            this.layout, {title: this.title, background: true, controller : this}));
+        this.tab = parentLayout.add(region,
+            new Roo.NestedLayoutPanel(
+                this.layout, {
+                    title: this.title,
+                    background: true,
+                    controller : this
+        }));
 
         this.tab.on('activate', function() {
             _this.delayedCreate();
@@ -170,15 +179,15 @@ Pman.Tab.PersonList.prototype = {
         this.layout.beginUpdate();
         
         var frm = this.layout.getRegion('center').getEl().createChild({tag:'div'});
-        //this.grid = new Ext.grid.EditorGrid(frm,  {
-        this.grid = new Ext.grid.Grid(frm,  {
+        //this.grid = new Roo.grid.EditorGrid(frm,  {
+        this.grid = new Roo.grid.Grid(frm,  {
                 ddGroup: 'groupDD',
                 //enableDrag: true,
                 enableDrag: true,
                 id: this.id + '-grid',
-                ds:   new Ext.data.Store({
+                ds:   new Roo.data.Store({
                     // load using HTTP
-                    proxy: new Ext.data.HttpProxy({
+                    proxy: new Roo.data.HttpProxy({
                         url: baseURL + '/Roo/Person.html',
                         method: 'GET'
                     }),
@@ -229,10 +238,10 @@ Pman.Tab.PersonList.prototype = {
                         field: 'name', direction: 'ASC'
                     }
                 }),
-                cm: new Ext.grid.ColumnModel(
+                cm: new Roo.grid.ColumnModel(
                     this.columns()
                 ),
-                autoExpandColumn: _this.id + '-name' , // fixme!!!!
+                autoExpandColumn:  'name', // fixme!!!!
                 clicksToEdit : 1,
                 
                 loadMask: true,
@@ -257,8 +266,12 @@ Pman.Tab.PersonList.prototype = {
                         
                         rec.set('active', rec.data.active ? 0 : 1);
                         rec.commit();
-                         
-                        
+
+                        var el = Roo.select('.x-grid-row-selected').item(3);
+                        el.addClass('x-grid-row-fadeout');
+                        el.on('transitionend',function(){
+                            _this.grid.ds.remove(rec);
+                        },this,{single:true});
                         
                     }
                     
@@ -266,9 +279,10 @@ Pman.Tab.PersonList.prototype = {
                  
                  
         });
-        this.panel  = this.layout.add('center',  new Ext.GridPanel(this.grid , {
+        this.panel  = this.layout.add('center',  new Roo.GridPanel(this.grid , {
                 fitToframe: true,
-                fitContainer: true, 
+                fitContainer: true,
+                //background : false,
                 id: this.id, 
                 title: this.title || "Staff", 
                 controller : this 
@@ -286,7 +300,7 @@ Pman.Tab.PersonList.prototype = {
 
         
         var gridFoot = this.grid.getView().getFooterPanel(true);
-        this.paging = new Ext.PagingToolbar(gridFoot, this.grid.getDataSource(), {
+        this.paging = new Roo.PagingToolbar(gridFoot, this.grid.getDataSource(), {
             pageSize: 25,
             displayInfo: true,
             displayMsg: "Displaying " + (this.itemDisplayName || "Staff") + " {0} - {1} of {2}",
@@ -295,7 +309,7 @@ Pman.Tab.PersonList.prototype = {
         var grid = this.grid;
  
     
-        this.toolbar = new Ext.Toolbar(this.grid.getView().getHeaderPanel(true));
+        this.toolbar = new Roo.Toolbar(this.grid.getView().getHeaderPanel(true));
         
         var tb = this.toolbar;
         
@@ -333,7 +347,7 @@ Pman.Tab.PersonList.prototype = {
         //}
         
      
-        this.searchBox = new Ext.form.TextField({
+        this.searchBox = new Roo.form.TextField({
             name: 'search',
             width:135,
             listeners : {
@@ -355,7 +369,7 @@ Pman.Tab.PersonList.prototype = {
             {
                 text: "Add",
                 cls: 'x-btn-text-icon',
-                icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
+                icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
                 hidden :  !dg || (_this.newDefaults() === false) || !Pman.hasPerm(this.permName, 'A'),  
                 handler : function(){
                     dg.show(  _this.newDefaults(), refreshPager );  
@@ -364,7 +378,7 @@ Pman.Tab.PersonList.prototype = {
              { ///... for contacts stuff...
                 text: "Bulk Add",
                 cls: 'x-btn-text-icon',
-                icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
+                icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
                 hidden : !this.bulkAdd() || !Pman.hasPerm(this.permName, 'A'),    
                 handler : function(){
                     
@@ -376,12 +390,12 @@ Pman.Tab.PersonList.prototype = {
             {
                 text: "Edit",
                 cls: 'x-btn-text-icon',
-                icon: Ext.rootURL + 'images/default/tree/leaf.gif',
+                icon: Roo.rootURL + 'images/default/tree/leaf.gif',
                 hidden : !dg || !Pman.hasPerm(this.permName, 'E'),    
                 handler : function(){
                     var s = grid.getSelectionModel().getSelections();
                     if (!s.length || (s.length > 1))  {
-                        Ext.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                        Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
                         return;
                     }
                     dg.show( s[0].data,refreshPager);
@@ -396,7 +410,7 @@ Pman.Tab.PersonList.prototype = {
                  
                     var s = grid.getSelectionModel().getSelections();
                     if (!s.length  )  {
-                        Ext.MessageBox.alert("Error",  "Select People Row");
+                        Roo.MessageBox.alert("Error",  "Select People Row");
                         return;
                     }
                     var r = [];
@@ -409,7 +423,7 @@ Pman.Tab.PersonList.prototype = {
                     grid.getView().mainWrap.mask("Sending");
 
                     
-                    Ext.Ajax.request({
+                    Roo.Ajax.request({
                         url: baseURL + '/Roo/Person.html',
                         method: 'GET',
                         params: {
@@ -419,7 +433,7 @@ Pman.Tab.PersonList.prototype = {
                             var res = Pman.processResponse(resp);
                             grid.getView().mainWrap.unmask();
                             if (!res.success) {
-                                Ext.MessageBox.alert("Error", res.errorMsg ? res.errorMsg  : "Error Sending");
+                                Roo.MessageBox.alert("Error", res.errorMsg ? res.errorMsg  : "Error Sending");
                                 return;
                             }
                             refreshPager();
@@ -427,7 +441,7 @@ Pman.Tab.PersonList.prototype = {
                         },
                         failure: function(act) {
                             grid.getView().mainWrap.unmask();
-                            Ext.MessageBox.alert("Error", "Error Sending");
+                            Roo.MessageBox.alert("Error", "Error Sending");
                         }
                         
                     });
@@ -476,10 +490,11 @@ Pman.Tab.PersonList.prototype = {
                     refreshPager();
                 }
             },
-            '->',
+            '-',
              {
                
-               
+                xtype : 'Button',
+                xns : Roo.Toolbar,
                
                 text: "Switch to Selected User",
                 hidden : _this.permName != 'Core.Staff' || !Pman.hasPerm('Core.Staff', 'E'),
@@ -487,12 +502,12 @@ Pman.Tab.PersonList.prototype = {
                     click : function () { 
                         var s = grid.getSelectionModel().getSelections();
                         if (s.length != 1)  {
-                            Ext.MessageBox.alert("Error",  "Select a Person");
+                            Roo.MessageBox.alert("Error",  "Select a Person");
                             return;
                         }
                         new Pman.Request({
                             url : baseURL+ '/Login.php',
-                            params {
+                            params  :{
                                 'switch' : s[0].data.id
                             },
                             
@@ -500,6 +515,10 @@ Pman.Tab.PersonList.prototype = {
                             success : function() {
                                 document.location = baseURL + '?ts=' + Math.random();
                                 
+                            }, 
+                            failure : function(d) {
+                                Roo.log(d);
+                                Roo.MessageBox.alert("Error",  d);
                             }
                         });
                         
@@ -508,7 +527,7 @@ Pman.Tab.PersonList.prototype = {
                 }
             
                      
-            },
+            }
             
 
         );
@@ -557,11 +576,17 @@ Pman.Tab.PersonList.prototype = {
     c_name : function(cfg) {
         cfg = cfg || {};
         return Roo.apply({
-            id : this.id + '-name',
+         //   id : (this.id + '-name').toLowerCase(),
             header : "Name",
             dataIndex : 'name',
             sortable : true,
-            width : 150  
+            renderer : function(v,p,r) { 
+                if(r.data.active != 1){
+                    return String.format('<div style="text-decoration:line-through">{0}</div>', v); 
+                }
+                return String.format('{0}', v); 
+            }
+          //  width : 150  
         }, cfg);
     },
      c_company_id_comptype : function(cfg) {
@@ -657,7 +682,7 @@ Pman.Tab.PersonList.prototype = {
                 
                 var state = v> 0 ?  '-checked' : '';
 
-                return '<img class="x-grid-check-icon' + state + '" src="' + Ext.BLANK_IMAGE_URL + '"/>';
+                return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
                 
                 
             }