prepare sonia.config.js for localization

This commit is contained in:
Sebastian Sdorra
2011-03-05 11:52:52 +01:00
parent 89924cb521
commit 3e6765922f

View File

@@ -87,20 +87,35 @@ Ext.reg("repositoryConfig", Sonia.config.RepositoryConfig);
Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
titleText: 'General Settings',
servnameText: 'Servername',
enableForwardingText: 'Enable forwarding (mod_proxy)',
forwardPortText: 'Forward Port',
pluginRepositoryText: 'Plugin repository',
allowAnonymousAccessText: 'Allow Anonymous Access',
enableSSLText: 'Enable SSL',
sslPortText: 'SSL Port',
adminGroupsText: 'Admin Groups',
adminUsersText: 'Admin Users',
submitText: 'Submit ...',
loadingText: 'Loading ...',
errorTitleText: 'Error',
errorMsgText: 'Could not load config.',
initComponent: function(){ initComponent: function(){
var config = { var config = {
panels: [{ panels: [{
xtype: 'configForm', xtype: 'configForm',
title: 'General Settings', title: this.titleText,
items: [{ items: [{
xtype: 'textfield', xtype: 'textfield',
fieldLabel: 'Servername', fieldLabel: this.servnameText,
name: 'servername', name: 'servername',
allowBlank: false allowBlank: false
},{ },{
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: 'Enable forwarding (mod_proxy)', fieldLabel: this.enableForwardingText,
name: 'enablePortForward', name: 'enablePortForward',
inputValue: 'true', inputValue: 'true',
listeners: { listeners: {
@@ -111,24 +126,24 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
},{ },{
id: 'serverport', id: 'serverport',
xtype: 'numberfield', xtype: 'numberfield',
fieldLabel: 'Forward Port', fieldLabel: this.forwardPortText,
name: 'forwardPort', name: 'forwardPort',
disabled: true, disabled: true,
allowBlank: false allowBlank: false
},{ },{
xtype: 'textfield', xtype: 'textfield',
fieldLabel: 'Plugin repository', fieldLabel: this.pluginRepositoryText,
name: 'plugin-url', name: 'plugin-url',
vtype: 'url', vtype: 'url',
allowBlank: false allowBlank: false
},{ },{
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: 'Allow Anonymous Access', fieldLabel: this.allowAnonymousAccessText,
name: 'anonymousAccessEnabled', name: 'anonymousAccessEnabled',
inputValue: 'true' inputValue: 'true'
},{ },{
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: 'Enable SSL', fieldLabel: this.enableSSLText,
name: 'enableSSL', name: 'enableSSL',
inputValue: 'true', inputValue: 'true',
listeners: { listeners: {
@@ -139,18 +154,18 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
},{ },{
id: 'sslPort', id: 'sslPort',
xtype: 'numberfield', xtype: 'numberfield',
fieldLabel: 'SSL Port', fieldLabel: this.sslPortText,
name: 'sslPort', name: 'sslPort',
disabled: true, disabled: true,
allowBlank: false allowBlank: false
},{ },{
xtype : 'textfield', xtype : 'textfield',
fieldLabel : 'Admin Groups', fieldLabel : this.adminGroupsText,
name : 'admin-groups', name : 'admin-groups',
allowBlank : true allowBlank : true
},{ },{
xtype : 'textfield', xtype : 'textfield',
fieldLabel : 'Admin Users', fieldLabel : this.adminUsersText,
name : 'admin-users', name : 'admin-users',
allowBlank : true allowBlank : true
}], }],
@@ -162,14 +177,14 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
if ( ! values.enablePortForward ){ if ( ! values.enablePortForward ){
values.forwardPort = Ext.getCmp('serverport').getValue(); values.forwardPort = Ext.getCmp('serverport').getValue();
} }
this.el.mask('Submit ...'); this.el.mask(this.submitText);
Ext.Ajax.request({ Ext.Ajax.request({
url: restUrl + 'config.json', url: restUrl + 'config.json',
method: 'POST', method: 'POST',
jsonData: values, jsonData: values,
scope: this, scope: this,
disableCaching: true, disableCaching: true,
success: function(response){ success: function(){
this.el.unmask(); this.el.unmask();
}, },
failure: function(){ failure: function(){
@@ -179,7 +194,7 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
}, },
onLoad: function(el){ onLoad: function(el){
var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); var tid = setTimeout( function(){ el.mask(this.loadingText); }, 100);
Ext.Ajax.request({ Ext.Ajax.request({
url: restUrl + 'config.json', url: restUrl + 'config.json',
method: 'GET', method: 'GET',
@@ -201,8 +216,9 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
el.unmask(); el.unmask();
clearTimeout(tid); clearTimeout(tid);
Ext.MessageBox.show({ Ext.MessageBox.show({
title: 'Error', title: this.errorTitleText,
msg: 'Could not load config.', msg: this.errorMsgText,
scope: this,
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
icon:Ext.MessageBox.ERROR icon:Ext.MessageBox.ERROR
}); });
@@ -223,6 +239,8 @@ Ext.reg("scmConfig", Sonia.config.ScmConfigPanel);
Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, { Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
title: 'Config Form', title: 'Config Form',
saveButtonText: 'Save',
resetButtontext: 'Reset',
items: null, items: null,
onSubmit: null, onSubmit: null,
getValues: null, getValues: null,
@@ -265,12 +283,12 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
}, },
items: this.items, items: this.items,
buttons: [{ buttons: [{
text: 'Save', text: this.saveButtonText,
scope: this, scope: this,
formBind: true, formBind: true,
handler: this.submitForm handler: this.submitForm
},{ },{
text: 'Reset', text: this.resetButtontext,
scope: this, scope: this,
handler: function(){ handler: function(){
this.getForm().reset(); this.getForm().reset();
@@ -304,6 +322,8 @@ Ext.reg("configForm", Sonia.config.ConfigForm);
Sonia.config.SimpleConfigForm = Ext.extend(Sonia.config.ConfigForm,{ Sonia.config.SimpleConfigForm = Ext.extend(Sonia.config.ConfigForm,{
submitText: 'Submit ...',
loadingText: 'Loading ...',
configUrl: null, configUrl: null,
loadMethod: 'GET', loadMethod: 'GET',
submitMethod: 'POST', submitMethod: 'POST',
@@ -314,7 +334,7 @@ Sonia.config.SimpleConfigForm = Ext.extend(Sonia.config.ConfigForm,{
}, },
onSubmit: function(values){ onSubmit: function(values){
this.el.mask('Submit ...'); this.el.mask(this.submitText);
Ext.Ajax.request({ Ext.Ajax.request({
url: this.configUrl, url: this.configUrl,
method: this.submitMethod, method: this.submitMethod,
@@ -331,7 +351,7 @@ Sonia.config.SimpleConfigForm = Ext.extend(Sonia.config.ConfigForm,{
}, },
onLoad: function(el){ onLoad: function(el){
var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); var tid = setTimeout( function(){ el.mask(this.loadingText); }, 100);
Ext.Ajax.request({ Ext.Ajax.request({
url: this.configUrl, url: this.configUrl,
method: this.loadMethod, method: this.loadMethod,