Pman.js
[Pman.Core] / Pman.js
diff --git a/Pman.js b/Pman.js
index 7047a30..32c76fc 100644 (file)
--- a/Pman.js
+++ b/Pman.js
@@ -358,7 +358,7 @@ Pman = new Roo.Document(
                 Pman.Dialog.PersonStaff.show( 
                     { 
                         id : 0, 
-                        company_id : Pman.Login.authUser.company_id_id * 1, 
+                        company_id : Pman.Login.authUser.company_id * 1, 
                         company_id_name : Pman.Login.authUser.company_id_name
                     }, function(data) {
                         forceAdmin(data);
@@ -366,6 +366,7 @@ Pman = new Roo.Document(
                 );
                 return;
             }
+            
             Roo.state.Manager.set('Pman.Login.username', data.email),
             window.onbeforeunload = false;
             document.location = baseURL + '?ts=' + Math.random();
@@ -393,7 +394,7 @@ Pman = new Roo.Document(
         
         if (Pman.Login.authUser.id < 0) {
             // admin company has been created - create the user..
-            if (Pman.Login.authUser.company_id_id* 1 > 0) {
+            if (Pman.Login.authUser.company_id* 1 > 0) {
                 forceAdmin();
                 return;
             }
@@ -547,67 +548,9 @@ Pman = new Roo.Document(
         }
         return res;
     },
-    genericDelete : function(tab,tbl) {
-        
-        var r = [];
-        
-            
-        var s = tab.grid.getSelectionModel().getSelections();
-        if (!s.length)  {
-            Roo.MessageBox.alert("Error", "Select at least one Row to delete" );
-            return '';
-        }
-        var reader = tab.grid.reader || tab.grid.ds.reader;
-        for(var i = 0; i < s.length; i++) {
-            r.push(reader.getId(s[i].json));
-        }
-    
-        Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
-            function(btn) {
-                if (btn != 'yes') {
-                    return;
-                }
-                // what about the toolbar??
-                tab.grid.getView().mainWrap.mask("Deleting");
-                new Pman.Request({
-                    url: baseURL + '/Roo/'+tbl+'.php',
-                    method: 'POST',
-                    params: {
-                        _delete : r.join(',')
-                    },
-                    success: function(response) {
-                        tab.grid.getView().mainWrap.unmask();
-                        if ( tab.paging ) {
-                            tab.paging.onClick('refresh');   
-                        } else if (tab.grid.footer && tab.grid.footer.onClick) {
-                            // new xtype built grids
-                            tab.grid.footer.onClick('refresh');   
-                        } else if (tab.refresh) {
-                            tab.refresh(); // this might cause problems as panels have a refresh method?
-                        } else {
-                            tab.grid.getDataSource().load();
-                        }
-                        
-                        
-                        
-                    },
-                    failure: function(act) {
-                        Roo.log(act);
-                        var msg = '';
-                        try {
-                            msg = act.errorMsg;
-                        } catch(e) {
-                            msg = "Error deleting";
-                        }
-                        tab.grid.getView().mainWrap.unmask();
-                        Roo.MessageBox.alert("Error",  msg);
-                    }
-                    
-                });
-            }
-            
-        );
-        return '';
+    genericDelete : function(tab,tbl)
+    {
+        Pman.Delete.progress(tab,tbl) 
     },
     
     
@@ -896,7 +839,7 @@ Pman = new Roo.Document(
      */
     register : function(obj)
     {
-        Roo.log(obj);
+        
         //this.xregister(obj);
         
         
@@ -955,7 +898,7 @@ Pman = new Roo.Document(
          
         
         // Roo.log("CALLING XComponent register with : " + obj.name);
-        
+        Roo.log(obj);
         // this will call xregister as it's the on.register handler..
         Roo.XComponent.register(obj.isTop ? obj : Roo.apply(obj.module, obj));