roojs-core.js
[roojs1] / Roo / Login.js
index b70eadd..b5a2f89 100644 (file)
@@ -2,50 +2,60 @@
 
 
 /**
-* A generic Login Dialog..... - only one needed in theory!?!?
-*
-* Fires XComponent builder on success...
-* 
-* Sends 
-*    username,password, lang = for login actions.
-*    check = for periodic checking that sesion is valid.
-* 
-* Usage: 
-*    
-* 
-* Myapp.login = Roo.Login({
-    url: xxxx,
-  
-    realm : 'Myapp', 
-    
-    
-    method : 'POST',
-    
-    
-    * 
-})
-* 
-* 
-* 
-* Ext.apply(_T, _T[lang]);
-* 
-**/
+ * @class Roo.Login
+ * @extends Roo.LayoutDialog
+ * A generic Login Dialog..... - only one needed in theory!?!?
+ *
+ * Fires XComponent builder on success...
+ * 
+ * Sends 
+ *    username,password, lang = for login actions.
+ *    check = 1 for periodic checking that sesion is valid.
+ *    passwordRequest = email request password
+ *    logout = 1 = to logout
+ * 
+ * Affects: (this id="????" elements)
+ *   loading  (removed) (used to indicate application is loading)
+ *   loading-mask (hides) (used to hide application when it's building loading)
+ *   
+ * 
+ * Usage: 
+ *    
+ * 
+ * Myapp.login = Roo.Login({
+     url: xxxx,
+   
+     realm : 'Myapp', 
+     
+     
+     method : 'POST',
+     
+     
+     * 
+ })
+ * 
+ * 
+ * 
+ **/
  
 Roo.Login = function(cfg)
 {
     this.addEvents({
-        'refreshed' : true,
+        'refreshed' : true
     });
     
     Roo.apply(this,cfg);
-    Roo.each(this.items, function(e) {
-        this.addxtype(e);
-    }, this);
-    Roo.Document.on('ready', function() {
+    
+    Roo.onReady(function() {
         this.onLoad();
     }, this);
     // call parent..
-    Roo.Login.superclass.constructor.call(this);
+    
+   
+    Roo.Login.superclass.constructor.call(this, this);
+    //this.addxtype(this.items[0]);
+    
+    
 }
 
 
@@ -57,12 +67,32 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
      */
     
     method : 'POST',
-       /**
+    /**
      * @cfg {String} url
      * URL to query login data. - eg. baseURL + '/Login.php'
      */
     url : '',
     
+    /**
+     * @property user
+     * The user data - if user.id < 0 then login will be bypassed. (used for inital setup situation.
+     * @type {Object} 
+     */
+    user : false,
+    /**
+     * @property checkFails
+     * Number of times we have attempted to get authentication check, and failed.
+     * @type {Number} 
+     */
+    checkFails : 0,
+      /**
+     * @property intervalID
+     * The window interval that does the constant login checking.
+     * @type {Number} 
+     */
+    intervalID : 0,
+    
+    
     onLoad : function() // called on page load...
     {
         // load 
@@ -71,12 +101,12 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
             Roo.get('loading').remove();
         }
         
-        this.switchLang('en'); // set the language to english..
+        //this.switchLang('en'); // set the language to english..
        
         this.check({
             success:  function(response, opts)  {  // check successfull...
             
-                var res = Pman.processResponse(response);
+                var res = this.processResponse(response);
                 this.checkFails =0;
                 if (!res.success) { // error!
                     this.checkFails = 5;
@@ -85,7 +115,7 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
                 }
                 
                 if (!res.data.id) { // id=0 == login failure.
-                    return this.show(true);
+                    return this.show();
                 }
                 
                               
@@ -137,10 +167,58 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
     }, 
     
     
+    logout: function()
+    {
+        window.onbeforeunload = function() { }; // false does not work for IE..
+        this.user = false;
+        var _this = this;
+        
+        Roo.Ajax.request({  
+            url: this.url,
+            params: {
+                logout: 1
+            },  
+            method: 'GET',
+            failure : function() {
+                Roo.MessageBox.alert("Error", "Error logging out. - continuing anyway.", function() {
+                    document.location = document.location.toString() + '?ts=' + Math.random();
+                });
+                
+            },
+            success : function() {
+                _this.user = false;
+                this.checkFails =0;
+                // fixme..
+                document.location = document.location.toString() + '?ts=' + Math.random();
+            }
+              
+              
+        }); 
+    },
+    
+    processResponse : function (response)
+    {
+        var res = '';
+        try {
+            res = Roo.decode(response.responseText);
+            // oops...
+            if (typeof(res) != 'object') {
+                res = { success : false, errorMsg : res, errors : true };
+            }
+            if (typeof(res.success) == 'undefined') {
+                res.success = false;
+            }
+            
+        } catch(e) {
+            res = { success : false,  errorMsg : response.responseText, errors : true };
+        }
+        return res;
+    },
+    
     success : function(response, opts)  // check successfull...
     {  
         this.sending = false;
-        var res = Pman.processResponse(response);
+        var res = this.processResponse(response);
         if (!res.success) {
             return this.failure(response, opts);
         }
@@ -151,7 +229,7 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
         this.fillAuth(res.data);
         
         this.checkFails =0;
-        Pman.onload();
+        
     },
     
     
@@ -159,9 +237,9 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
     {
         this.authUser = -1;
         this.sending = false;
-        var res = Pman.processResponse(response);
+        var res = this.processResponse(response);
         //console.log(res);
-        if ( Pman.Login.checkFails > 2) {
+        if ( this.checkFails > 2) {
         
             Roo.MessageBox.alert("Error", res.errorMsg ? res.errorMsg : 
                 "Error getting authentication status. - try reloading"); 
@@ -182,10 +260,10 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
         this.fireEvent('refreshed', au);
         //Pman.Tab.FaxQueue.newMaxId(au.faxMax);
         //Pman.Tab.FaxTab.setTitle(au.faxNumPending);
-        
+        au.lang = au.lang || 'en';
         //this.switchLang(Roo.state.Manager.get('Pman.Login.lang', 'en'));
         Roo.state.Manager.set( this.realm + 'lang' , au.lang);
-        this.switchLang(au.lang);
+        this.switchLang(au.lang );
         
      
         // open system... - -on setyp..
@@ -201,21 +279,70 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
     
     startAuthCheck : function() // starter for timeout checking..
     {
-        if (Pman.Login.intervalID) { // timer already in place...
+        if (this.intervalID) { // timer already in place...
             return false;
         }
+        var _this = this;
+        this.intervalID =  window.setInterval(function() {
+              _this.check(false);
+            }, 120000); // every 120 secs = 2mins..
         
-        Pman.Login.intervalID =  window.setInterval(function() {
-                  Pman.Login.check(false);
-                }, 120000); // every 120 secs = 2mins..
+        
+    },
+         
+    
+    switchLang : function (lang) 
+    {
+        _T = typeof(_T) == 'undefined' ? false : _T;
+          if (!_T || !lang.length) {
+            return;
+        }
+        
+        if (!_T && lang != 'en') {
+            Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')');
+            return;
+        }
+        
+        if (typeof(_T.en) == 'undefined') {
+            _T.en = {};
+            Roo.apply(_T.en, _T);
+        }
+        
+        if (typeof(_T[lang]) == 'undefined') {
+            Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')');
+            return;
+        }
+        
+        
+        Roo.apply(_T, _T[lang]);
+        // just need to set the text values for everything...
+        var _this = this;
+        /* this will not work ...
+        if (this.form) { 
+            
+               
+            function formLabel(name, val) {
+                _this.form.findField(name).fieldEl.child('label').dom.innerHTML  = val;
+            }
+            
+            formLabel('password', "Password"+':');
+            formLabel('username', "Email Address"+':');
+            formLabel('lang', "Language"+':');
+            this.dialog.setTitle("Login");
+            this.dialog.buttons[0].setText("Forgot Password");
+            this.dialog.buttons[1].setText("Login");
+        }
+        */
         
         
     },
-    autoCreated: true,
+    
+    
     title: "Login",
     modal: true,
     width:  350,
-    height: 230,
+    //height: 230,
+    height: 180,
     shadow: true,
     minWidth:200,
     minHeight:180,
@@ -224,7 +351,7 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
     draggable: false,
     collapsible: false,
     resizable: false,
-    center: {
+    center: {  // needed??
         autoScroll:false,
         titlebar: false,
        // tabPosition: 'top',
@@ -232,480 +359,253 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, {
         closeOnTab: true,
         alwaysShowTabs: false
     } ,
-    listeners : 
-        rendered : function(dlg) {
-            this.form = this.items[0];
+    listeners : {
+        
+        show  : function(dlg)
+        {
+            //console.log(this);
+            this.form = this.layout.getRegion('center').activePanel.form;
             this.form.dialog = dlg;
-            this.buttons[0].form = this.form
-            this.buttons[1].form = this.form
+            this.buttons[0].form = this.form;
+            this.buttons[0].dialog = dlg;
+            this.buttons[1].form = this.form;
+            this.buttons[1].dialog = dlg;
+           
+           //this.resizeToLogo.defer(1000,this);
+            // this is all related to resizing for logos..
+            //var sz = Roo.get(Pman.Login.form.el.query('img')[0]).getSize();
+           //// if (!sz) {
+             //   this.resizeToLogo.defer(1000,this);
+             //   return;
+           // }
+            //var w = Ext.lib.Dom.getViewWidth() - 100;
+            //var h = Ext.lib.Dom.getViewHeight() - 100;
+            //this.resizeTo(Math.max(350, Math.min(sz.width + 30, w)),Math.min(sz.height+200, h));
+            //this.center();
+            if (this.disabled) {
+                this.hide();
+                return;
+            }
+            
+            if (this.user.id < 0) { // used for inital setup situations.
+                return;
+            }
+            
+            if (this.intervalID) {
+                // remove the timer
+                window.clearInterval(this.intervalID);
+                this.intervalID = false;
+            }
+            
+            
+            if (Roo.get('loading')) {
+                Roo.get('loading').remove();
+            }
+            if (Roo.get('loading-mask')) {
+                Roo.get('loading-mask').hide();
+            }
             
+            //incomming._node = tnode;
+            this.form.reset();
+            //this.dialog.modal = !modal;
+            //this.dialog.show();
+            this.el.unmask(); 
+            
+            
+            this.form.setValues({
+                'username' : Roo.state.Manager.get(this.realm + '.username', ''),
+                'lang' : Roo.state.Manager.get(this.realm + '.lang', 'en')
+            });
+            
+            this.switchLang(Roo.state.Manager.get(this.realm + '.lang', 'en'));
+            if (this.form.findField('username').getValue().length > 0 ){
+                this.form.findField('password').focus();
+            } else {
+               this.form.findField('username').focus();
+            }
+    
         }
     },
     items : [
-        {
+         {
        
-            xtype : 'Form',
-            xns : Roo.form,
-            labelWidth: 100,
+            xtype : 'ContentPanel',
+            xns : Roo,
+            region: 'center',
+            fitToFrame : true,
             
-            listeners : {
-                actionfailed : function(f, act) {
-                    // form can return { errors: .... }
-                        
-                    //act.result.errors // invalid form element list...
-                    //act.result.errorMsg// invalid form element list...
-                    
-                    this.dialog.el.unmask();
-                    Roo.MessageBox.alert("Error", act.result.errorMsg ? act.result.errorMsg : 
-                                "Login failed - communication error - try again.");
-                              
-                },
-                actioncomplete: function(re, act) {
-                     
-                    Roo.state.Manager.set(
-                        this.dialog.realm + '.' + this.dialog.params.username,  
-                            this.form.findField(this.dialog.params.username).getValue() 
-                    );
-                    Roo.state.Manager.set(
-                        this.dialog.realm + '.lang',  
-                        Pman.Login.form.findField('lang').getValue() 
-                    );
-                    
-                    this.dialog.fillAuth(act.result.data);
-                      
-                    this.dialog.hide();
-                    
-                    if (Roo.get('loading-mask')) {
-                        Roo.get('loading-mask').show();
-                    }
-                    Roo.XComponent.build();
-                    
-                     
-                    
-                }
-            },
             items : [
+    
                 {
-                    xtype : 'TextField',
-                    xns : Roo.form,
-                    fieldLabel: "Email Address",
-                    name: 'username',
-                    width:200,
-                    autoCreate : {tag: "input", type: "text", size: "20"}
-                },
-                {
-                    xtype : 'TextField',
+               
+                    xtype : 'Form',
                     xns : Roo.form,
-                    fieldLabel: "Password",
-                    inputType: 'password',
-                    name: 'password',
-                    width:200,
-                    autoCreate : {tag: "input", type: "text", size: "20"},
+                    labelWidth: 100,
+                    style : 'margin: 10px;',
+                    
                     listeners : {
-                        specialkey : function(e,ev) {
-                            if (ev.keyCode == 13) {
-                                this.form.dialog.el.mask("Logging in");
-                                this.form.doAction('submit', {
-                                    url: this.form.dialog.url,
-                                    method: this.form.dialog.method,
-                                });
+                        actionfailed : function(f, act) {
+                            // form can return { errors: .... }
+                                
+                            //act.result.errors // invalid form element list...
+                            //act.result.errorMsg// invalid form element list...
+                            
+                            this.dialog.el.unmask();
+                            Roo.MessageBox.alert("Error", act.result.errorMsg ? act.result.errorMsg : 
+                                        "Login failed - communication error - try again.");
+                                      
+                        },
+                        actioncomplete: function(re, act) {
+                             
+                            Roo.state.Manager.set(
+                                this.dialog.realm + '.username',  
+                                    this.findField('username').getValue()
+                            );
+                            Roo.state.Manager.set(
+                                this.dialog.realm + '.lang',  
+                                this.findField('lang').getValue() 
+                            );
+                            
+                            this.dialog.fillAuth(act.result.data);
+                              
+                            this.dialog.hide();
+                            
+                            if (Roo.get('loading-mask')) {
+                                Roo.get('loading-mask').show();
                             }
+                            Roo.XComponent.build();
+                            
+                             
+                            
                         }
-                    }  
-                },
-                {
-                    xtype : 'ComboBox',
-                    xns : Roo.form,
-                    fieldLabel: "Language",
-                    name : 'langdisp',
-                    store: {
-                        xtype : 'SimpleStore',
-                        fields: ['lang', 'ldisp'],
-                        data : [
-                            [ 'en', 'English' ],
-                            [ 'zh_HK' , '\u7E41\u4E2D' ],
-                            [ 'zh_CN', '\u7C21\u4E2D' ]
-                        ]
                     },
-                    
-                    valueField : 'lang',
-                    hiddenName:  'lang',
-                    width: 200,
-                    displayField:'ldisp',
-                    typeAhead: false,
-                    editable: false,
-                    mode: 'local',
-                    triggerAction: 'all',
-                    emptyText:'Select a Language...',
-                    selectOnFocus:true,
-                    listeners : {
-                        select :  function(cb, rec, ix) {
-                            this.form.switchLang(rec.data.lang);
+                    items : [
+                        {
+                            xtype : 'TextField',
+                            xns : Roo.form,
+                            fieldLabel: "Email Address",
+                            name: 'username',
+                            width:200,
+                            autoCreate : {tag: "input", type: "text", size: "20"}
+                        },
+                        {
+                            xtype : 'TextField',
+                            xns : Roo.form,
+                            fieldLabel: "Password",
+                            inputType: 'password',
+                            name: 'password',
+                            width:200,
+                            autoCreate : {tag: "input", type: "text", size: "20"},
+                            listeners : {
+                                specialkey : function(e,ev) {
+                                    if (ev.keyCode == 13) {
+                                        this.form.dialog.el.mask("Logging in");
+                                        this.form.doAction('submit', {
+                                            url: this.form.dialog.url,
+                                            method: this.form.dialog.method
+                                        });
+                                    }
+                                }
+                            }  
+                        },
+                        {
+                            xtype : 'ComboBox',
+                            xns : Roo.form,
+                            fieldLabel: "Language",
+                            name : 'langdisp',
+                            store: {
+                                xtype : 'SimpleStore',
+                                fields: ['lang', 'ldisp'],
+                                data : [
+                                    [ 'en', 'English' ],
+                                    [ 'zh_HK' , '\u7E41\u4E2D' ],
+                                    [ 'zh_CN', '\u7C21\u4E2D' ]
+                                ]
+                            },
+                            
+                            valueField : 'lang',
+                            hiddenName:  'lang',
+                            width: 200,
+                            displayField:'ldisp',
+                            typeAhead: false,
+                            editable: false,
+                            mode: 'local',
+                            triggerAction: 'all',
+                            emptyText:'Select a Language...',
+                            selectOnFocus:true,
+                            listeners : {
+                                select :  function(cb, rec, ix) {
+                                    this.form.switchLang(rec.data.lang);
+                                }
+                            }
+                        
                         }
-                    }
-                
+                    ]
                 }
+                  
+                
             ]
-        },
-          
-        
+        }
     ],
     buttons : [
         {
             xtype : 'Button',
             xns : 'Roo',
-            label : "Forgot Password",
+            text : "Forgot Password",
             listeners : {
                 click : function() {
-            
-                    var n = _this.form.findField('username').getValue();
+                    //console.log(this);
+                    var n = this.form.findField('username').getValue();
                     if (!n.length) {
                         Roo.MessageBox.alert("Error", "Fill in your email address");
                         return;
                     }
                     Roo.Ajax.request({
-                        url: baseURL + '/Login.js',  
+                        url: this.dialog.url,
                         params: {
                             passwordRequest: n
                         },
-                        method: 'POST',  
+                        method: this.dialog.method,
                         success:  function(response, opts)  {  // check successfull...
                         
-                            var res = Pman.processResponse(response);
+                            var res = this.dialog.processResponse(response);
                             if (!res.success) { // error!
-                               Roo.MessageBox.alert("Error" , res.errorMsg ? res.errorMsg  : "Problem Requesting Password Reset");
+                               Roo.MessageBox.alert("Error" ,
+                                    res.errorMsg ? res.errorMsg  : "Problem Requesting Password Reset");
                                return;
                             }
-                            Roo.MessageBox.alert("Notice" , "Please check you email for the Password Reset message");
+                            Roo.MessageBox.alert("Notice" ,
+                                "Please check you email for the Password Reset message");
                         },
                         failure : function() {
                             Roo.MessageBox.alert("Error" , "Problem Requesting Password Reset");
                         }
                         
                     });
-                });
-            }
-         
-}
-
-Pman.Login =  new Roo.util.Observable({
-    
-    events : {
-        
-        'render' : true
-    },
-    disabled : false,
-    
-    dialog : false,
-    form: false,
-    haslogo : false,
-    
-    authUserId: 0,
-    authUser: { id : false },
-       
-    checkFails : 0,
-    versionWarn: false,
-    sending : false,
-    
-    
-     
-    
-    
-    intervalID : false,   /// the login refresher...
-    
-    lastChecked : false,
-    
-     
-        
-        
-        
-        this.dialog.addButton("Forgot Password", function()
-        {
-            
-            var n = _this.form.findField('username').getValue();
-            if (!n.length) {
-                Roo.MessageBox.alert("Error", "Fill in your email address");
-                return;
-            }
-            Roo.Ajax.request({
-                url: baseURL + '/Login.js',  
-                params: {
-                    passwordRequest: n
-                },
-                method: 'POST',  
-                success:  function(response, opts)  {  // check successfull...
-                
-                    var res = Pman.processResponse(response);
-                    if (!res.success) { // error!
-                       Roo.MessageBox.alert("Error" , res.errorMsg ? res.errorMsg  : "Problem Requesting Password Reset");
-                       return;
-                    }
-                    Roo.MessageBox.alert("Notice" , "Please check you email for the Password Reset message");
-                },
-                failure : function() {
-                    Roo.MessageBox.alert("Error" , "Problem Requesting Password Reset");
                 }
-                
-            });
-        });
-        
-        this.dialog.addButton("Login", function()
+            }
+        },
         {
-            Pman.Login.dialog.el.mask("Logging in");
-            Pman.Login.form.doAction('submit', {
-                    url: baseURL + '/Login',
-                    method: 'POST'
-            });
-        });
-        this.layout = this.dialog.getLayout();
-        this.layout.beginUpdate();
-        
-        //layout.add('center', new Roo.ContentPanel('center', {title: 'The First Tab'}));
-        // generate some other tabs
-        this.form = new Roo.form.Form({
-            labelWidth: 100 ,
-            
+            xtype : 'Button',
+            xns : 'Roo',
+            text : "Login",
             listeners : {
-                actionfailed : function(f, act) {
-                    // form can return { errors: .... }
+                
+                click : function () {
                         
-                    //act.result.errors // invalid form element list...
-                    //act.result.errorMsg// invalid form element list...
-                    
-                    Pman.Login.dialog.el.unmask();
-                    Roo.MessageBox.alert("Error", act.result.errorMsg ? act.result.errorMsg : 
-                                "Login failed - communication error - try again.");
-                              
-                },
-                actioncomplete: function(re, act) {
-                     
-                    Roo.state.Manager.set('Pman.Login.username.'+appNameShort,  Pman.Login.form.findField('username').getValue() );
-                    Roo.state.Manager.set('Pman.Login.lang.'+appNameShort,  Pman.Login.form.findField('lang').getValue() );
-                    Pman.Login.fillAuth(act.result.data);
-                      
-                    Pman.Login.dialog.hide();
-                    if (Roo.get('loading-mask')) {
-                        //Roo.get('loading').show();
-                        Roo.get('loading-mask').show();
-                    }
-                   
-                    Pman.onload();
-                    
-                     
-                    
+                    this.dialog.el.mask("Logging in");
+                    this.form.doAction('submit', {
+                            url: this.dialog.url,
+                            method: this.dialog.method
+                    });
                 }
             }
-        
-            
-            
-             
-        });
-          
-        
-        
-        this.form.add( 
-       
-           
-
-        );
-         
-        
-        var ef = this.dialog.getLayout().getEl().createChild({tag: 'div'});
-        ef.dom.style.margin = 10;
-          
-        this.form.render(ef.dom);
-         // logoprefix comes from base config.
-        Pman.Login.form.el.createChild({
-                tag: 'img', 
-                src: rootURL + '/Pman/'+appNameShort + '/templates/images/logo.gif',
-                style: 'margin-bottom: 10px;'
-            },
-            Pman.Login.form.el.dom.firstChild 
-        );
-       
-        var vp = this.dialog.getLayout().add('center', new Roo.ContentPanel(ef, {
-            autoCreate : true,
-            //title: 'Org Details',
-            //toolbar: this.tb,
-            width: 250,
-            maxWidth: 250,
-            fitToFrame:true
-        }));
-        
-        this.layout.endUpdate();
-        
-        this.fireEvent('render', this);
-        
-        
-        
-        
-        
-    },
-    resizeToLogo : function()
-    {
-        var sz = Roo.get(Pman.Login.form.el.query('img')[0]).getSize();
-        if (!sz) {
-            this.resizeToLogo.defer(1000,this);
-            return;
         }
-        var w = Ext.lib.Dom.getViewWidth() - 100;
-        var h = Ext.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) 
-    {
-        if (this.disabled) {
-            return;
-        }
-        modal = modal || false;
-        if (Pman.Login.authUserId < 0) { // logout!?
-            return;
-        }
-        
-        if (Pman.Login.intervalID) {
-            // remove the timer
-            window.clearInterval(Pman.Login.intervalID);
-            Pman.Login.intervalID = false;
-        }
-        
-        this.create();
-        
-        
-        
-        if (Roo.get('loading')) {
-            Roo.get('loading').remove();
-        }
-        if (Roo.get('loading-mask')) {
-            Roo.get('loading-mask').hide();
-        }
-        
-        //incomming._node = tnode;
-        this.form.reset();
-        this.dialog.modal = !modal;
-        this.dialog.show();
-        this.dialog.el.unmask(); 
-        this.resizeToLogo.defer(1000,this);
-        
-         
-        this.form.setValues({
-            'username' : Roo.state.Manager.get('Pman.Login.username.'+appNameShort, ''),
-            'lang' : Roo.state.Manager.get('Pman.Login.lang.'+appNameShort, 'en')
-        });
-        Pman.Login.switchLang(Roo.state.Manager.get('Pman.Login.lang.'+appNameShort, ''));
-        if (this.form.findField('username').getValue().length > 0 ){
-            this.form.findField('password').focus();
-        } else {
-           this.form.findField('username').focus();
-        }
-        
-        
-    },
+    ]
+  
+  
+})
  
-    
-     
-    logout: function()
-    {
-        window.onbeforeunload = function() { }; // false does not work for IE..
-        Pman.Login.authUserId = -1;
-        Roo.Ajax.request({  
-            url: baseURL + '/Login.html',  
-            params: {
-                logout: 1
-            },  
-            method: 'GET',
-            failure : function() {
-                Roo.MessageBox.alert("Error", "Error logging out. - continuing anyway.", function() {
-                    document.location = baseURL + '?ts=' + Math.random();
-                });
-                
-            },
-            success : function() {
-                Pman.Login.authUserId = -1;
-                Pman.Login.checkFails =0;
-                // remove the 
-                document.location = baseURL + '?ts=' + Math.random();
-            }
-              
-              
-        }); 
-    },
-    switchLang : function (lang) {
-        if (!lang.length) {
-            return;
-        }
-        if (typeof(_T.en) == 'undefined') {
-            _T.en = {};
-            Roo.apply(_T.en, _T);
-        }
-        
-        if (typeof(_T[lang]) == 'undefined') {
-            Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')');
-            return;
-        }
-        
-        
-        Roo.apply(_T, _T[lang]);
-        // just need to set the text values for everything...
-        if (this.form) {
-            
-               
-            function formLabel(name, val) {
-                
-                var lbl = Pman.Login.form.findField( name ).el.dom.parentNode.parentNode;
-                if (lbl.getElementsByTagName('label').length) {
-                    lbl = lbl.getElementsByTagName('label')[0];
-                } else  {
-                    lbl = lbl.parentNode.getElementsByTagName('label')[0];
-                }
-                   
-                lbl.innerHTML = val;
-            }
-            
-            formLabel('password', "Password"+':');
-            formLabel('username', "Email Address"+':');
-            formLabel('lang', "Language"+':');
-            this.dialog.setTitle("Login");
-            this.dialog.buttons[0].setText("Forgot Password");
-            this.dialog.buttons[1].setText("Login");
-        }
-        
-        
-    },
-    
-    inGroup : function(g)
-    {
-        return this.authUser && this.authUser.groups && 
-            this.authUser.groups.indexOf(g) > -1;
-    },
-    isOwner : function()
-    {
-        return this.authUser && this.authUser.company_id_comptype && 
-            this.authUser.company_id_comptype == 'OWNER';
-    },
-    
-    /**
-     * Depreciated = use Pman.I18n
-     */
-    
-    i18nList: function (type, codes)
-    {
-        
-        return Pman.I18n.listToNames(type, codes);
-    },
-    i18n: function(type, code) 
-    {
-        return Pman.I18n.toName(type, code);
-        
-    }
-    
-    
-});
-
-
 
 
    
\ No newline at end of file