]>
Commit | Line | Data |
---|---|---|
f71626c2 DM |
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 | ||
c87d46fb | 12 | initComponent: function() { |
f71626c2 DM |
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 | } | |
39700611 DM |
39 | |
40 | if (me.rulegroup === 'action') { | |
41 | me.items = { | |
42 | xtype: 'pmgActionList', | |
43 | title: undefined, | |
44 | enableButtons: false, | |
f2ca0a1a | 45 | border: true, |
39700611 DM |
46 | listeners: { |
47 | itemdblclick: function(view, rec) { | |
48 | me.fireEvent('selectObjectGroup', me, rec); | |
c87d46fb TL |
49 | }, |
50 | }, | |
39700611 DM |
51 | }; |
52 | } else { | |
53 | me.items = { | |
54 | xtype: 'pmgObjectGroupList', | |
55 | enableButtons: false, | |
56 | ogclass: ogclass, | |
57 | listeners: { | |
58 | itemdblclick: function(view, rec) { | |
59 | me.fireEvent('selectObjectGroup', me, rec); | |
c87d46fb TL |
60 | }, |
61 | }, | |
39700611 DM |
62 | }; |
63 | } | |
f71626c2 DM |
64 | |
65 | me.callParent(); | |
c87d46fb | 66 | }, |
f71626c2 | 67 | }); |