Pman.Login.js
[Pman.Core] / Pman.Login.js
index c9f00e5..5cc90d7 100644 (file)
@@ -153,7 +153,16 @@ Pman.Login =  new Roo.util.Observable({
         this.fillAuth(res.data);
         
         this.checkFails =0;
-        Pman.onload();
+        
+        
+        if (Pman.onload) { 
+            Pman.onload();
+        }
+        if (Pman.Login.callback) {
+            Pman.Login.callback();
+            
+        }
+        return false;
     },
     
     fillAuth: function(au) {
@@ -161,7 +170,8 @@ Pman.Login =  new Roo.util.Observable({
         this.authUserId = au.id;
         this.authUser = au;
         this.lastChecked = new Date();
-        Pman.fireEvent('authrefreshed', au);
+        // if login is used on other applicaitons..
+        if (Pman.fireEvent) { Pman.fireEvent('authrefreshed', au); }
         
         
         //Pman.Tab.FaxQueue.newMaxId(au.faxMax);
@@ -197,7 +207,7 @@ Pman.Login =  new Roo.util.Observable({
         Pman.Login.intervalID =  window.setInterval(function() {
                   Pman.Login.check(false);
                 }, 120000); // every 120 secs = 2mins..
-        
+        return true;
         
     },
     
@@ -341,7 +351,7 @@ Pman.Login =  new Roo.util.Observable({
                         if (ev.keyCode == 13) {
                             Pman.Login.dialog.el.mask("Logging in");
                             Pman.Login.form.doAction('submit', {
-                                    url: baseURL + '/Login.json',
+                                    url: baseURL + '/Login',
                                     method: 'POST'
                             });
                         }
@@ -423,19 +433,20 @@ Pman.Login =  new Roo.util.Observable({
             this.resizeToLogo.defer(1000,this);
             return;
         }
-        var w = Ext.lib.Dom.getViewWidth() - 100;
-        var h = Ext.lib.Dom.getViewHeight() - 100;
+        var w = Roo.lib.Dom.getViewWidth() - 100;
+        var h = Roo.lib.Dom.getViewHeight() - 100;
         Pman.Login.dialog.resizeTo(Math.max(350, Math.min(sz.width + 30, w)),Math.min(sz.height+200, h));
         Pman.Login.dialog.center();
     },
     
      
     
-    show: function (modal) 
+    show: function (modal, cb
     {
         if (this.disabled) {
             return;
         }
+        this.callback = cb; // used for non-pman usage..
         modal = modal || false;
         if (Pman.Login.authUserId < 0) { // logout!?
             return;
@@ -459,6 +470,7 @@ Pman.Login =  new Roo.util.Observable({
         }
         
         //incomming._node = tnode;
+        // why we want this non-modal????
         this.form.reset();
         this.dialog.modal = !modal;
         this.dialog.show();