]> git.proxmox.com Git - pmg-gui.git/blob - js/ObjectGroupSelector.js
ObjectGroupSelector.js: new widget to simplify code
[pmg-gui.git] / js / ObjectGroupSelector.js
1 Ext.define('PMG.ObjectGroupSelector', {
2 extend: 'Ext.window.Window',
3 alias: 'widget.pmgObjectGroupSelector',
4
5 width: 600,
6 layout: 'auto',
7 modal: true,
8 bodyPadding: 5,
9
10 rulegroup: undefined,
11
12 initComponent : function() {
13 var me = this;
14
15 if (!me.rulegroup) {
16 throw "undefined rulegroup";
17 }
18
19 var ogclass;
20
21 if (me.rulegroup === 'from') {
22 ogclass = 'who';
23 me.title = gettext('From');
24 } else if (me.rulegroup === 'to') {
25 ogclass = 'who';
26 me.title = gettext('To');
27 } else if (me.rulegroup === 'when') {
28 ogclass = 'when';
29 me.title = gettext('When');
30 } else if (me.rulegroup === 'what') {
31 ogclass = 'what';
32 me.title = gettext('What');
33 } else if (me.rulegroup === 'action') {
34 ogclass = 'action';
35 me.title = gettext('Action');
36 } else {
37 throw "unknown rulegroup";
38 }
39
40 me.items = {
41 xtype: 'pmgObjectGroupList',
42 enableButtons: false,
43 ogclass: ogclass,
44 listeners: {
45 itemdblclick: function(view, rec) {
46 me.fireEvent('selectObjectGroup', me, rec);
47 }
48 }
49 };
50
51 me.callParent();
52 }
53 });