+/*global Proxmox*/
Ext.define('PMG.QuarantineNavigationTree', {
extend: 'Ext.list.Tree',
xtype: 'quarantinenavigationtree',
},
store: {
- xcalss: 'Ext.data.TreeStore',
root: {
expanded: true,
children: [
children: [
{
text: gettext('Whitelist'),
- //iconCls: 'fa fa-cubes',
+ iconCls: 'fa fa-file-o',
path: 'pmgUserWhitelist',
- leaf: true,
+ leaf: true
},
{
text: gettext('Blacklist'),
- //iconCls: 'fa fa-cubes',
+ iconCls: 'fa fa-file',
path: 'pmgUserBlacklist',
- leaf: true,
+ leaf: true
}
]
}
action: 'changePath',
before: 'beforeChangePath',
conditions : {
- ':path' : '(?:([%a-zA-Z0-9\-\_\s,]+))',
- ':subpath' : '(?:(?::)([%a-zA-Z0-9\-\_\s,]+))?'
+ ':path' : '(?:([%a-zA-Z0-9\\-\\_\\s,]+))',
+ ':subpath' : '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?'
}
}
},
subpath = subpath || 0;
if (lastpanel.getActiveTab) {
// we assume lastpanel is a tabpanel
- if (lastpanel.getActiveTab().getItemId() === subpath) {
- // we are already there
- } else {
+ if (lastpanel.getActiveTab().getItemId() !== subpath) {
// set the active tab
lastpanel.setActiveTab(subpath);
}
+ // else we are already there
}
action.stop();
return;
var contentpanel = me.lookupReference('contentpanel');
var lastpanel = contentpanel.getLayout().getActiveItem();
- var obj = contentpanel.add({ xtype: path });
+ var obj = contentpanel.add({ xtype: path, cselect: subpath });
var treelist = me.lookupReference('navtree');
treelist.suspendEvents();
},
execQuarantineAction: function(qa) {
- Proxmox.Utils.API2Request({
- url: '/api2/extjs/quarantine/content',
- params: {
- id: qa.cselect,
- action: qa.action
- },
- method: 'POST',
- success: function(response) {
- Ext.Msg.alert(gettext('Info'), "Action " + qa.action + ' ' +
- qa.cselect + ' successful');
- },
- failure: function(response, opts) {
- Ext.Msg.alert(gettext('Error'), response.htmlStatus);
- }
- });
+ PMG.Utils.doQuarantineAction(qa.action, qa.cselect);
},
control: {
var me = this;
// load username
- me.lookupReference('usernameinfo').update({username:Proxmox.UserName});
+ var username = Proxmox.UserName.replace(/\@quarantine$/, '');
+ me.lookupReference('usernameinfo').update({username: username});
// show login on requestexception
// fixme: what about other errors
});
var qa = PMG.Utils.extractQuarantineAction();
+ var token;
if (qa) {
- var token = 'pmgSpamQuarantine';
+ token = 'pmgSpamQuarantine';
if (qa.action === 'blacklist') { token = 'pmgUserBlacklist'; }
if (qa.action === 'whitelist') { token = 'pmgUserWhitelist'; }
+ if (qa.cselect) {
+ token += ':' + qa.cselect;
+ }
this.redirectTo(token, true);
- me.execQuarantineAction(qa);
+ if (qa.action) {
+ me.execQuarantineAction(qa);
+ }
} else {
// select treeitem and load page from url fragment
- var token = Ext.util.History.getToken() || 'pmgSpamQuarantine';
+
+ token = Ext.util.History.getToken() || 'pmgSpamQuarantine';
this.redirectTo(token, true);
}
}
plugins: 'viewport',
- layout: 'border',
+ layout: {
+ type: 'border'
+ },
items: [
{
},
{
xtype: 'panel',
- layout: 'card',
+ layout: {
+ type: 'card'
+ },
region: 'center',
border: false,
- reference: 'contentpanel',
+ reference: 'contentpanel'
}
]
});