X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FLogin.js;h=b5a2f896cc11fae93a2a150f62301d1617c7c200;hb=61bc45258e16a779856dd2ad0862630b489e4583;hp=f3a32aa2446d9f99d2dee0abec57323ecfdf6913;hpb=376d76c2b46635c7243864289eee816873821d86;p=roojs1 diff --git a/Roo/Login.js b/Roo/Login.js index f3a32aa244..b5a2f896cc 100644 --- a/Roo/Login.js +++ b/Roo/Login.js @@ -2,46 +2,46 @@ /** -* 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', - - - * -}) -* -* -* -* 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); @@ -260,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.. @@ -293,11 +293,13 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { switchLang : function (lang) { - if (!_T && lang != 'en') { - Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')'); + _T = typeof(_T) == 'undefined' ? false : _T; + if (!_T || !lang.length) { return; } - if (!_T || !lang.length) { + + if (!_T && lang != 'en') { + Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')'); return; } @@ -339,7 +341,8 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { title: "Login", modal: true, width: 350, - height: 230, + //height: 230, + height: 180, shadow: true, minWidth:200, minHeight:180, @@ -360,10 +363,11 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { show : function(dlg) { - this.form = this.items[0].form; + //console.log(this); + this.form = this.layout.getRegion('center').activePanel.form; this.form.dialog = dlg; this.buttons[0].form = this.form; - this.buttons[0].dialog = dlg + this.buttons[0].dialog = dlg; this.buttons[1].form = this.form; this.buttons[1].dialog = dlg; @@ -413,7 +417,7 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { 'lang' : Roo.state.Manager.get(this.realm + '.lang', 'en') }); - this.switchLang(Roo.state.Manager.get(this.realm + '.lang', '')); + this.switchLang(Roo.state.Manager.get(this.realm + '.lang', 'en')); if (this.form.findField('username').getValue().length > 0 ){ this.form.findField('password').focus(); } else { @@ -429,6 +433,7 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { xns : Roo, region: 'center', fitToFrame : true, + items : [ { @@ -436,7 +441,8 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { xtype : 'Form', xns : Roo.form, labelWidth: 100, - style : 'margin : 10px;', + style : 'margin: 10px;', + listeners : { actionfailed : function(f, act) { // form can return { errors: .... } @@ -496,7 +502,7 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { this.form.dialog.el.mask("Logging in"); this.form.doAction('submit', { url: this.form.dialog.url, - method: this.form.dialog.method, + method: this.form.dialog.method }); } } @@ -548,7 +554,7 @@ Roo.extend(Roo.Login, Roo.LayoutDialog, { text : "Forgot Password", listeners : { click : function() { - console.log(this); + //console.log(this); var n = this.form.findField('username').getValue(); if (!n.length) { Roo.MessageBox.alert("Error", "Fill in your email address");