]>
git.proxmox.com Git - pmg-gui.git/blob - js/QuarantineList.js
1 Ext
.define('PMG.QuarantineList', {
2 extend
: 'Ext.grid.GridPanel',
3 xtype
: 'pmgQuarantineList',
5 emptyText
: gettext('No E-Mail address selected'),
11 emailSelection
: false,
12 notFoundText
: gettext('No data in database.')
17 xclass
: 'Ext.app.ViewController',
19 init: function(view
) {
21 if (PMG
.view
=== 'quarantineview') {
22 view
.emailSelection
= false;
25 var emailCombobox
= me
.lookupReference('email');
26 emailCombobox
.setVisible(view
.emailSelection
);
27 emailCombobox
.setDisabled(!view
.emailSelection
);
29 // we to this to trigger the change event of those fields
30 var today
= new Date();
31 me
.lookupReference('from').setValue(today
);
32 me
.lookupReference('to').setValue(today
);
36 view
.setSelection(view
.getStore().getById(view
.cselect
));
40 // extjs has no method to dynamically change the emptytext on
41 // grids, so we have to do it this way
42 setEmptyText: function(emptyText
) {
44 var view
= me
.getView();
45 var tableview
= view
.getView();
46 tableview
.emptyText
= '<div class="x-grid-empty">'+ (emptyText
|| view
.notFoundText
) + '</div>';
49 load: function(callback
) {
51 var view
= me
.getView();
52 if (view
.emailSelection
) {
53 if (!me
.lookupReference('email').getSelection()) {
54 // if the combobox has no selection we do not reload
59 view
.getStore().load(callback
);
62 setFrom: function(from) {
63 var me
= this.getView();
64 var params
= me
.getStore().getProxy().getExtraParams();
65 params
.starttime
= from;
66 me
.getStore().getProxy().setExtraParams(params
);
70 var me
= this.getView();
71 var params
= me
.getStore().getProxy().getExtraParams();
73 me
.getStore().getProxy().setExtraParams(params
);
76 setUser: function(user
) {
77 var me
= this.getView();
78 var params
= me
.getStore().getProxy().getExtraParams();
80 me
.getStore().getProxy().setExtraParams(params
);
84 changeTime: function(field
, value
) {
86 var list
= me
.getView();
92 var val
= value
.getTime()/1000;
93 var combobox
= me
.lookupReference('email');
94 var params
= combobox
.getStore().getProxy().getExtraParams();
96 var to
= me
.lookupReference('to');
97 var from = me
.lookupReference('from');
99 if (field
.name
=== 'from') {
101 params
.starttime
= val
;
102 to
.setMinValue(value
);
104 } else if (field
.name
=== 'to') {
105 me
.setTo(val
+ 24*60*60);
106 params
.endtime
= val
+ 24*60*60;
107 from.setMaxValue(value
);
112 // the combobox does not know anything about the extraparams
113 // so we disable queryCaching until we expand (and query) again
114 combobox
.queryCaching
= false;
115 combobox
.getStore().getProxy().setExtraParams(params
);
120 resetEmail: function() {
122 var view
= me
.getView();
123 if (view
.emailSelection
) {
124 me
.setUser(undefined);
128 changeEmail: function(tb
, value
) {
134 setQueryCaching: function() {
135 this.lookupReference('email').queryCaching
= true;
140 beforedestroy
: 'resetEmail',
142 'combobox[reference=email]': {
147 expand
: 'setQueryCaching'
161 groupHeaderTpl
: '{columnName}: {name} ({children.length})'
175 fieldLabel
: gettext('From'),
182 fieldLabel
: gettext('To'),
191 displayField
: 'mail',
196 url
: '/api2/json/quarantine/spamusers'