]> git.proxmox.com Git - pmg-gui.git/blob - js/ObjectGroupConfiguration.js
rename WhoConfiguration.js to ObjectGroupConfiguration.js
[pmg-gui.git] / js / ObjectGroupConfiguration.js
1 Ext.define('PMG.ObjectGroupConfiguration', {
2 extend: 'Ext.panel.Panel',
3
4 ogclass: undefined, // who, when, what
5 otype_list: [],
6
7 layout: { type: 'hbox', align: 'stretch' },
8 border: false,
9
10 initComponent : function() {
11 var me = this;
12
13 if (me.ogclass === undefined) {
14 throw "undefined object group class"
15 }
16
17 if (!(me.title = PMG.Utils.oclass_text[me.ogclass])) {
18 throw "unknown object group class";
19 }
20
21 var left = Ext.create('PMG.ObjectGroupList', {
22 width: 250,
23 ogclass: me.ogclass,
24 subject: me.title,
25 border: false
26 });
27
28 var right = Ext.create('PMG.ObjectGroup', {
29 otype_list: me.otype_list,
30 border: false,
31 flex: 1,
32 listeners: {
33 dblclickOGInfo: function(w, e, t, ogdata) {
34 // test if the correct groups is selected (just to be sure)
35 var rec = left.selModel.getSelection()[0];
36 if (rec && rec.data && rec.data.id === ogdata.id) {
37 left.run_editor();
38 return;
39 }
40 }
41 }
42 });
43
44 me.mon(left.selModel, "selectionchange", function() {
45 var rec = left.selModel.getSelection()[0];
46 if (!(rec && rec.data && rec.data.id)) {
47 return;
48 }
49 right.setObjectInfo(rec.data);
50 var baseurl = '/config/ruledb/' + me.ogclass + '/' + rec.data.id;
51 right.setBaseUrl(baseurl);
52 });
53
54 me.items = [ left, { xtype: 'splitter' }, right ];
55
56 me.callParent();
57 }
58 });
59
60 Ext.define('PMG.WhoConfiguration', {
61 extend: 'PMG.ObjectGroupConfiguration',
62 alias: 'widget.pmgWhoConfiguration',
63
64 ogclass: 'who',
65 otype_list: [1000, 1001, 1002, 1003, 1004]
66 });
67
68 Ext.define('PMG.WhenConfiguration', {
69 extend: 'PMG.ObjectGroupConfiguration',
70 alias: 'widget.pmgWhenConfiguration',
71
72 ogclass: 'when',
73 otype_list: []
74 });
75
76 Ext.define('PMG.WhatConfiguration', {
77 extend: 'PMG.ObjectGroupConfiguration',
78 alias: 'widget.pmgWhatConfiguration',
79
80 ogclass: 'what',
81 otype_list: []
82 });
83
84 Ext.define('PMG.ActionConfiguration', {
85 extend: 'PMG.ObjectGroupConfiguration',
86 alias: 'widget.pmgActionConfiguration',
87
88 ogclass: 'action',
89 otype_list: []
90 });
91