prepare sonia.group.js for localization

This commit is contained in:
Sebastian Sdorra
2011-03-05 12:14:27 +01:00
parent 3e6765922f
commit c635eb98b5
2 changed files with 58 additions and 28 deletions

View File

@@ -50,6 +50,14 @@ Sonia.group.DefaultPanel = {
// GroupGrid // GroupGrid
Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, { Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
colNameText: 'Name',
colDescriptionText: 'Description',
colMembersText: 'Members',
colCreationDateText: 'Creation date',
colTypeText: 'Type',
emptyGroupStoreText: 'No group is configured',
groupFormTitleText: 'Group Form',
initComponent: function(){ initComponent: function(){
var groupStore = new Sonia.rest.JsonStore({ var groupStore = new Sonia.rest.JsonStore({
proxy: new Ext.data.HttpProxy({ proxy: new Ext.data.HttpProxy({
@@ -69,11 +77,11 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
width: 125 width: 125
}, },
columns: [ columns: [
{id: 'name', header: 'Name', dataIndex: 'name'}, {id: 'name', header: this.colNameText, dataIndex: 'name'},
{id: 'description', header: 'Description', dataIndex: 'description', width: 300 }, {id: 'description', header: this.colDescriptionText, dataIndex: 'description', width: 300 },
{id: 'members', header: 'Members', dataIndex: 'members', renderer: this.renderMembers}, {id: 'members', header: this.colMembersText, dataIndex: 'members', renderer: this.renderMembers},
{id: 'creationDate', header: 'Creation date', dataIndex: 'creationDate'}, {id: 'creationDate', header: this.colCreationDateText, dataIndex: 'creationDate'},
{id: 'type', header: 'Type', dataIndex: 'type', width: 80} {id: 'type', header: this.colTypeText, dataIndex: 'type', width: 80}
] ]
}); });
@@ -81,7 +89,7 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
autoExpandColumn: 'members', autoExpandColumn: 'members',
store: groupStore, store: groupStore,
colModel: groupColModel, colModel: groupColModel,
emptyText: 'No group is configured' emptyText: this.emptyGroupStoreText
}; };
Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.apply(this, Ext.apply(this.initialConfig, config));
@@ -111,7 +119,7 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
var panel = new Sonia.group.FormPanel({ var panel = new Sonia.group.FormPanel({
item: group, item: group,
region: 'south', region: 'south',
title: 'Group Form', title:this.groupFormTitleText,
padding: 5, padding: 5,
onUpdate: { onUpdate: {
fn: this.reload, fn: this.reload,
@@ -133,6 +141,15 @@ Ext.reg('groupGrid', Sonia.group.Grid);
// GroupFormPanel // GroupFormPanel
Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
colMemberText: 'Member',
titleText: 'Settings',
nameText: 'Name',
descriptionText: 'Description',
membersText: 'Members',
errorTitleText: 'Error',
updateErrorMsgText: 'Group update failed',
createErrorMsgText: 'Group creation failed',
memberStore: null, memberStore: null,
initComponent: function(){ initComponent: function(){
@@ -150,7 +167,7 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
}, },
columns: [{ columns: [{
id: 'member', id: 'member',
header: 'Member', header: this.colMemberText,
dataIndex: 'member', dataIndex: 'member',
editor: new Ext.form.ComboBox({ editor: new Ext.form.ComboBox({
store: userSearchStore, store: userSearchStore,
@@ -185,7 +202,7 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
var items = [{ var items = [{
xtype : 'fieldset', xtype : 'fieldset',
checkboxToggle : false, checkboxToggle : false,
title : 'Settings', title : this.titleText,
collapsible : true, collapsible : true,
autoHeight : true, autoHeight : true,
autoWidth: true, autoWidth: true,
@@ -194,19 +211,19 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
defaultType: 'textfield', defaultType: 'textfield',
buttonAlign: 'center', buttonAlign: 'center',
items: [{ items: [{
fieldLabel: 'Name', fieldLabel: this.nameText,
name: 'name', name: 'name',
allowBlank: false, allowBlank: false,
readOnly: this.item != null readOnly: this.item != null
},{ },{
fieldLabel: 'Description', fieldLabel: this.descriptionText,
name: 'description', name: 'description',
xtype: 'textarea' xtype: 'textarea'
}] }]
},{ },{
id: 'memberGrid', id: 'memberGrid',
xtype: 'editorgrid', xtype: 'editorgrid',
title: 'Members', title: this.membersText,
clicksToEdit: 1, clicksToEdit: 1,
frame: true, frame: true,
width: '100%', width: '100%',
@@ -219,7 +236,7 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
forceFit:true forceFit:true
}, },
tbar: [{ tbar: [{
text: 'Add', text: this.addText,
scope: this, scope: this,
handler : function(){ handler : function(){
var Member = this.memberStore.recordType; var Member = this.memberStore.recordType;
@@ -229,7 +246,7 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
grid.startEditing(0, 0); grid.startEditing(0, 0);
} }
},{ },{
text: 'Remove', text: this.removeText,
scope: this, scope: this,
handler: function(){ handler: function(){
var grid = Ext.getCmp('memberGrid'); var grid = Ext.getCmp('memberGrid');
@@ -287,8 +304,8 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
clearTimeout(tid); clearTimeout(tid);
el.unmask(); el.unmask();
Ext.MessageBox.show({ Ext.MessageBox.show({
title: 'Error', title: this.errorTitleText,
msg: 'Group update failed', msg: this.updateErrorMsgText,
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
icon:Ext.MessageBox.ERROR icon:Ext.MessageBox.ERROR
}); });
@@ -327,8 +344,8 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
clearTimeout(tid); clearTimeout(tid);
el.unmask(); el.unmask();
Ext.MessageBox.show({ Ext.MessageBox.show({
title: 'Error', title: this.errorTitleText,
msg: 'Group creation failed', msg: this.createErrorMsgText,
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
icon:Ext.MessageBox.ERROR icon:Ext.MessageBox.ERROR
}); });
@@ -352,6 +369,16 @@ Ext.reg('groupFormPanel', Sonia.group.FormPanel);
// RepositoryPanel // RepositoryPanel
Sonia.group.Panel = Ext.extend(Ext.Panel, { Sonia.group.Panel = Ext.extend(Ext.Panel, {
addText: 'Add',
removeText: 'Remove',
reloadText: 'Reload',
titleText: 'Group Form',
emptyText: 'Add or select a Group',
removeTitleText: 'Remove Group',
removeMsgText: 'Remove Group "{0}"?',
errorTitleText: 'Error',
errorMsgText: 'Group deletion failed',
initComponent: function(){ initComponent: function(){
var config = { var config = {
layout: 'border', layout: 'border',
@@ -361,10 +388,10 @@ Sonia.group.Panel = Ext.extend(Ext.Panel, {
region:'center', region:'center',
autoScroll: true, autoScroll: true,
tbar: [ tbar: [
{xtype: 'tbbutton', text: 'Add', scope: this, handler: this.showAddForm}, {xtype: 'tbbutton', text: this.addText, scope: this, handler: this.showAddForm},
{xtype: 'tbbutton', id: 'groupRmButton', disabled: true, text: 'Remove', scope: this, handler: this.removeGroup}, {xtype: 'tbbutton', id: 'groupRmButton', disabled: true, text: this.removeText, scope: this, handler: this.removeGroup},
'-', '-',
{xtype: 'tbbutton', text: 'Reload', scope: this, handler: this.reload} {xtype: 'tbbutton', text: this.reloadText, scope: this, handler: this.reload}
], ],
items: [{ items: [{
id: 'groupGrid', id: 'groupGrid',
@@ -375,10 +402,10 @@ Sonia.group.Panel = Ext.extend(Ext.Panel, {
layout: 'fit', layout: 'fit',
items: [{ items: [{
region: 'south', region: 'south',
title: 'Group Form', title: this.titleText,
xtype: 'panel', xtype: 'panel',
padding: 5, padding: 5,
html: 'Add or select a Group' html: this.emptyText
}], }],
height: 250, height: 250,
split: true, split: true,
@@ -400,8 +427,8 @@ Sonia.group.Panel = Ext.extend(Ext.Panel, {
var url = restUrl + 'groups/' + item.name + '.json'; var url = restUrl + 'groups/' + item.name + '.json';
Ext.MessageBox.show({ Ext.MessageBox.show({
title: 'Remove Group', title: this.removeTitleText,
msg: 'Remove Group "' + item.name + '"?', msg: String.format( this.removeMsgText, item.name ),
buttons: Ext.MessageBox.OKCANCEL, buttons: Ext.MessageBox.OKCANCEL,
icon: Ext.MessageBox.QUESTION, icon: Ext.MessageBox.QUESTION,
fn: function(result){ fn: function(result){
@@ -421,8 +448,8 @@ Sonia.group.Panel = Ext.extend(Ext.Panel, {
}, },
failure: function(){ failure: function(){
Ext.MessageBox.show({ Ext.MessageBox.show({
title: 'Error', title: this.errorTitleText,
msg: 'Group deletion failed', msg: this.errorMsgText,
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
icon:Ext.MessageBox.ERROR icon:Ext.MessageBox.ERROR
}); });
@@ -443,7 +470,7 @@ Sonia.group.Panel = Ext.extend(Ext.Panel, {
Ext.getCmp('groupRmButton').setDisabled(true); Ext.getCmp('groupRmButton').setDisabled(true);
var panel = new Sonia.group.FormPanel({ var panel = new Sonia.group.FormPanel({
region: 'south', region: 'south',
title: 'Group Form', title: this.titleText,
padding: 5, padding: 5,
onUpdate: { onUpdate: {
fn: this.reload, fn: this.reload,

View File

@@ -155,6 +155,9 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{ Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{
addText: 'Add',
removeText: 'Remove',
item: null, item: null,
onUpdate: null, onUpdate: null,
onCreate: null, onCreate: null,