From c790d2ab3ab0fb6a709f635cb072dca37c41549c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 2 Mar 2017 15:50:16 +0100 Subject: [PATCH] rename WhoConfiguration.js to ObjectGroupConfiguration.js --- js/Makefile | 2 +- ...uration.js => ObjectGroupConfiguration.js} | 55 ++++++++++++++++--- js/Utils.js | 7 +++ js/Workspace.js | 16 +++--- 4 files changed, 63 insertions(+), 17 deletions(-) rename js/{WhoConfiguration.js => ObjectGroupConfiguration.js} (51%) diff --git a/js/Makefile b/js/Makefile index 2e55fc2..6b8b003 100644 --- a/js/Makefile +++ b/js/Makefile @@ -4,7 +4,7 @@ JSSRC= \ ServerAdministration.js \ ObjectGroupList.js \ ObjectGroup.js \ - WhoConfiguration.js \ + ObjectGroupConfiguration.js \ RuleConfiguration.js \ SystemConfiguration.js \ MailProxyRelaying.js \ diff --git a/js/WhoConfiguration.js b/js/ObjectGroupConfiguration.js similarity index 51% rename from js/WhoConfiguration.js rename to js/ObjectGroupConfiguration.js index fba0e49..7b26350 100644 --- a/js/WhoConfiguration.js +++ b/js/ObjectGroupConfiguration.js @@ -1,17 +1,23 @@ -Ext.define('PMG.WhoConfiguration', { +Ext.define('PMG.ObjectGroupConfiguration', { extend: 'Ext.panel.Panel', - alias: 'widget.pmgWhoConfiguration', - - ogclass: 'who', - - title: gettext('Who Objects'), + ogclass: undefined, // who, when, what + otype_list: [], + layout: { type: 'hbox', align: 'stretch' }, border: false, initComponent : function() { var me = this; + if (me.ogclass === undefined) { + throw "undefined object group class" + } + + if (!(me.title = PMG.Utils.oclass_text[me.ogclass])) { + throw "unknown object group class"; + } + var left = Ext.create('PMG.ObjectGroupList', { width: 250, ogclass: me.ogclass, @@ -20,7 +26,7 @@ Ext.define('PMG.WhoConfiguration', { }); var right = Ext.create('PMG.ObjectGroup', { - otype_list: [1000, 1001, 1002, 1003, 1004], + otype_list: me.otype_list, border: false, flex: 1, listeners: { @@ -41,7 +47,7 @@ Ext.define('PMG.WhoConfiguration', { return; } right.setObjectInfo(rec.data); - var baseurl = '/config/ruledb/who/' + rec.data.id; + var baseurl = '/config/ruledb/' + me.ogclass + '/' + rec.data.id; right.setBaseUrl(baseurl); }); @@ -50,3 +56,36 @@ Ext.define('PMG.WhoConfiguration', { me.callParent(); } }); + +Ext.define('PMG.WhoConfiguration', { + extend: 'PMG.ObjectGroupConfiguration', + alias: 'widget.pmgWhoConfiguration', + + ogclass: 'who', + otype_list: [1000, 1001, 1002, 1003, 1004] +}); + +Ext.define('PMG.WhenConfiguration', { + extend: 'PMG.ObjectGroupConfiguration', + alias: 'widget.pmgWhenConfiguration', + + ogclass: 'when', + otype_list: [] +}); + +Ext.define('PMG.WhatConfiguration', { + extend: 'PMG.ObjectGroupConfiguration', + alias: 'widget.pmgWhatConfiguration', + + ogclass: 'what', + otype_list: [] +}); + +Ext.define('PMG.ActionConfiguration', { + extend: 'PMG.ObjectGroupConfiguration', + alias: 'widget.pmgActionConfiguration', + + ogclass: 'action', + otype_list: [] +}); + diff --git a/js/Utils.js b/js/Utils.js index 027d8d7..4c4a76b 100644 --- a/js/Utils.js +++ b/js/Utils.js @@ -11,6 +11,13 @@ Ext.define('PMG.Utils', { senderText: gettext('Sender'), receiverText: gettext('Receiver'), + oclass_text: { + who: gettext('Who Objects'), + what: gettext('What Objects'), + when: gettext('When Objects'), + action: gettext('Action Objects') + }, + format_otype: function(otype) { var editor = PMG.Utils.object_editors[otype]; if (editor) { diff --git a/js/Workspace.js b/js/Workspace.js index b6b8187..4f00aba 100644 --- a/js/Workspace.js +++ b/js/Workspace.js @@ -226,32 +226,32 @@ Ext.define('PMG.StdWorkspace', { { xtype: 'panel', groups: ['filter'], - title: 'Actions', + title: PMG.Utils.oclass_text['action'], itemId: 'filter-actions', - html: "Actions" + items: [{ xtype: 'pmgActionConfiguration' }] }, { xtype: 'panel', groups: ['filter'], - title: 'Who', + title: PMG.Utils.oclass_text['who'], itemId: 'filter-who', items: [{ xtype: 'pmgWhoConfiguration' }] }, { xtype: 'panel', groups: ['filter'], - title: 'What', + title: PMG.Utils.oclass_text['what'], itemId: 'filter-what', - html: "What" + items: [{ xtype: 'pmgWhatConfiguration' }] + }, { xtype: 'panel', groups: ['filter'], - title: 'When', + title: PMG.Utils.oclass_text['when'], itemId: 'filter-when', - html: "When" + items: [{ xtype: 'pmgWhenConfiguration' }] }, - { xtype: 'panel', title: 'Configuration',