From 89924cb5210a6876b10c1bea3d9a0c4982c0a5a7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 5 Mar 2011 11:40:42 +0100 Subject: [PATCH] prepare sonia.action.js for localization --- .../main/webapp/resources/js/sonia.action.js | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.action.js b/scm-webapp/src/main/webapp/resources/js/sonia.action.js index da064fd70e..82fe3befb1 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.action.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.action.js @@ -33,6 +33,16 @@ Ext.ns('Sonia.action'); Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{ + titleText: 'Change Password', + oldPasswordText: 'Old Password', + newPasswordText: 'New Password', + confirmPasswordText: 'Confirm Password', + okText: 'Ok', + cancelText: 'Cancel', + connectingText: 'Connecting', + failedText: 'change password failed!', + waitMsgText: 'Sending data...', + initComponent: function(){ var config = { @@ -47,14 +57,14 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{ items: [{ id: 'changePasswordForm', url: restUrl + 'action/change-password.json', - title: 'Change Password', + title: this.titleText, frame: true, xtype: 'form', monitorValid: true, defaultType: 'textfield', items: [{ name: 'old-password', - fieldLabel: 'Old Password', + fieldLabel: this.oldPasswordText, inputType: 'password', allowBlank: false, minLength: 6, @@ -62,14 +72,14 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{ },{ id: 'new-password', name: 'new-password', - fieldLabel: 'New Password', + fieldLabel: this.newPasswordText, inputType: 'password', allowBlank: false, minLength: 6, maxLength: 32 },{ name: 'confirm-password', - fieldLabel: 'Confirm Password', + fieldLabel: this.confirmPasswordText, inputType: 'password', allowBlank: false, minLength: 6, @@ -78,12 +88,12 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{ initialPassField: 'new-password' }], buttons: [{ - text: 'Ok', + text: this.okText, formBind: true, scope: this, handler: this.changePassword },{ - text: 'Cancel', + text: this.cancelText, scope: this, handler: this.cancel }] @@ -95,25 +105,25 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{ }, changePassword: function(){ - var win = this; var form = Ext.getCmp('changePasswordForm').getForm(); form.submit({ + scope: this, method:'POST', - waitTitle:'Connecting', - waitMsg:'Sending data...', + waitTitle: this.connectingText, + waitMsg: this.waitMsgText, - success: function(form, action){ + success: function(){ if ( debug ){ console.debug( 'change password success' ); } - win.close(); + this.close(); }, - failure: function(form, action){ + failure: function(){ if ( debug ){ console.debug( 'change password failed' ); } - Ext.Msg.alert('change password failed!'); + Ext.Msg.alert( this.failedText ); } }); },