From b5bad6c207ed749d1dc8ef4b94586a23353cde2d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 5 Mar 2011 12:42:36 +0100 Subject: [PATCH] prepare sonia.login.js for localization --- .../main/webapp/resources/js/sonia.login.js | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.login.js b/scm-webapp/src/main/webapp/resources/js/sonia.login.js index 086d55027b..670b88c9a1 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.login.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.login.js @@ -33,13 +33,22 @@ Ext.ns('Sonia.login'); Sonia.login.Form = Ext.extend(Ext.FormPanel,{ + usernameText: 'Username', + passwordText: 'Password', + loginText: 'Login', + cancelText: 'Cancel', + titleText: 'Please Login', + waitTitleText: 'Connecting', + WaitMsgText: 'Sending data...', + failedMsgText: 'Login failed!', + initComponent: function(){ var config = { labelWidth: 80, url: restUrl + "authentication/login.json", frame: true, - title: 'Please Login', + title: this.titleText, defaultType: 'textfield', monitorValid: true, listeners: { @@ -49,7 +58,7 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ }, items:[{ id: 'username', - fieldLabel:'Username', + fieldLabel: this.usernameText, name: 'username', allowBlank:false, listeners: { @@ -59,7 +68,7 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ } } },{ - fieldLabel:'Password', + fieldLabel: this.passwordText, name: 'password', inputType: 'password', allowBlank: false, @@ -71,11 +80,11 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ } }], buttons:[{ - text: 'Cancel', + text: this.cancelText, scope: this, handler: this.cancel },{ - text: 'Login', + text: this.loginText, formBind: true, scope: this, handler: this.authenticate @@ -96,9 +105,10 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ authenticate: function(){ var form = this.getForm(); form.submit({ - method:'POST', - waitTitle:'Connecting', - waitMsg:'Sending data...', + scope: this, + method: 'POST', + waitTitle: this.waitTitleText, + waitMsg: this.WaitMsgText, success: function(form, action){ if ( debug ){ @@ -107,11 +117,11 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ loadState( action.result ); }, - failure: function(form, action){ + failure: function(form){ if ( debug ){ console.debug( 'login failed' ); } - Ext.Msg.alert('Login failed!'); + Ext.Msg.alert(this.failedMsgText); form.reset(); } });