prepare sonia.action.js for localization

This commit is contained in:
Sebastian Sdorra
2011-03-05 11:40:42 +01:00
parent b2f99258e0
commit 89924cb521

View File

@@ -33,6 +33,16 @@ Ext.ns('Sonia.action');
Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{ 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(){ initComponent: function(){
var config = { var config = {
@@ -47,14 +57,14 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{
items: [{ items: [{
id: 'changePasswordForm', id: 'changePasswordForm',
url: restUrl + 'action/change-password.json', url: restUrl + 'action/change-password.json',
title: 'Change Password', title: this.titleText,
frame: true, frame: true,
xtype: 'form', xtype: 'form',
monitorValid: true, monitorValid: true,
defaultType: 'textfield', defaultType: 'textfield',
items: [{ items: [{
name: 'old-password', name: 'old-password',
fieldLabel: 'Old Password', fieldLabel: this.oldPasswordText,
inputType: 'password', inputType: 'password',
allowBlank: false, allowBlank: false,
minLength: 6, minLength: 6,
@@ -62,14 +72,14 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{
},{ },{
id: 'new-password', id: 'new-password',
name: 'new-password', name: 'new-password',
fieldLabel: 'New Password', fieldLabel: this.newPasswordText,
inputType: 'password', inputType: 'password',
allowBlank: false, allowBlank: false,
minLength: 6, minLength: 6,
maxLength: 32 maxLength: 32
},{ },{
name: 'confirm-password', name: 'confirm-password',
fieldLabel: 'Confirm Password', fieldLabel: this.confirmPasswordText,
inputType: 'password', inputType: 'password',
allowBlank: false, allowBlank: false,
minLength: 6, minLength: 6,
@@ -78,12 +88,12 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{
initialPassField: 'new-password' initialPassField: 'new-password'
}], }],
buttons: [{ buttons: [{
text: 'Ok', text: this.okText,
formBind: true, formBind: true,
scope: this, scope: this,
handler: this.changePassword handler: this.changePassword
},{ },{
text: 'Cancel', text: this.cancelText,
scope: this, scope: this,
handler: this.cancel handler: this.cancel
}] }]
@@ -95,25 +105,25 @@ Sonia.action.ChangePasswordWindow = Ext.extend(Ext.Window,{
}, },
changePassword: function(){ changePassword: function(){
var win = this;
var form = Ext.getCmp('changePasswordForm').getForm(); var form = Ext.getCmp('changePasswordForm').getForm();
form.submit({ form.submit({
scope: this,
method:'POST', method:'POST',
waitTitle:'Connecting', waitTitle: this.connectingText,
waitMsg:'Sending data...', waitMsg: this.waitMsgText,
success: function(form, action){ success: function(){
if ( debug ){ if ( debug ){
console.debug( 'change password success' ); console.debug( 'change password success' );
} }
win.close(); this.close();
}, },
failure: function(form, action){ failure: function(){
if ( debug ){ if ( debug ){
console.debug( 'change password failed' ); console.debug( 'change password failed' );
} }
Ext.Msg.alert('change password failed!'); Ext.Msg.alert( this.failedText );
} }
}); });
}, },