Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • smradius/smradius
  • centiva-shail/smradius
  • nkukard/smradius
3 results
Show changes
Showing
with 4102 additions and 847 deletions
/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.onReady(function(){
// Turn off the loading icon
document.getElementById('loading').style.visibility = 'hidden';
// this seems to save window states
// Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
// Enable tips
Ext.QuickTips.init();
// Turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';
// Range menu items, used on GridFilter
Ext.menu.RangeMenu.prototype.icons = {
gt: 'resources/extjs/images/greater_then.png',
lt: 'resources/extjs/images/less_then.png',
eq: 'resources/extjs/images/equals.png'
};
Ext.grid.filter.StringFilter.prototype.icon = 'resources/extjs/images/find.png';
// Fire everything up
initViewport();
});
/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.onReady(function(){
// Enable tips
Ext.QuickTips.init();
// Turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';
// Turn off the loading icon
var hideMask = function () {
Ext.get('loading').remove();
Ext.fly('loading-mask').fadeOut({
remove: true,
callback: function() {
// Fire everything up
initViewport();
}
});
}
hideMask.defer(250);
});
/*
Webgui Menus
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
var radiusMenu = new Ext.menu.Menu({
items: [
{
text: 'Users',
iconCls: 'silk-user',
handler: function() {
showAdminUserWindow();
}
......@@ -10,6 +30,7 @@ var radiusMenu = new Ext.menu.Menu({
{
text: 'Groups',
iconCls: 'silk-group',
handler: function() {
showAdminGroupWindow();
}
......@@ -17,11 +38,20 @@ var radiusMenu = new Ext.menu.Menu({
{
text: 'Realms',
iconCls: 'silk-world',
handler: function() {
showAdminRealmWindow();
}
}
},
{
text: 'Clients',
iconCls: 'silk-server',
handler: function() {
showAdminClientWindow();
}
}
]
});
......@@ -31,20 +61,22 @@ var wispMenu = new Ext.menu.Menu({
{
text: 'Users',
iconCls: 'silk-user',
handler: function() {
showWiSPUserWindow();
}
},
{
text: 'Resellers',
handler: function() {
showWiSPResellersWindow();
}
},
// {
// text: 'Resellers',
// handler: function() {
// showWiSPResellersWindow();
// }
// },
{
text: 'Locations',
iconCls: 'silk-map',
handler: function() {
showWiSPLocationWindow();
}
......
/**
* sprintf() for JavaScript v.0.4
*
* Copyright (c) 2007 Alexandru Marasteanu <http://alexei.417.ro/>
* Thanks to David Baird (unit test and patch).
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
function str_repeat(i, m) { for (var o = []; m > 0; o[--m] = i); return(o.join('')); }
function sprintf () {
var i = 0, a, f = arguments[i++], o = [], m, p, c, x;
while (f) {
if (m = /^[^\x25]+/.exec(f)) o.push(m[0]);
else if (m = /^\x25{2}/.exec(f)) o.push('%');
else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) {
if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) throw("Too few arguments.");
if (/[^s]/.test(m[7]) && (typeof(a) != 'number'))
throw("Expecting number but found " + typeof(a));
switch (m[7]) {
case 'b': a = a.toString(2); break;
case 'c': a = String.fromCharCode(a); break;
case 'd': a = parseInt(a); break;
case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break;
case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break;
case 'o': a = a.toString(8); break;
case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break;
case 'u': a = Math.abs(a); break;
case 'x': a = a.toString(16); break;
case 'X': a = a.toString(16).toUpperCase(); break;
}
a = (/[def]/.test(m[7]) && m[2] && a > 0 ? '+' + a : a);
c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' ';
x = m[5] - String(a).length;
p = m[5] ? str_repeat(c, x) : '';
o.push(m[4] ? a + p : p + a);
}
else throw ("Huh ?!");
f = f.substring(m[0].length);
}
return o.join('');
}
/* Generate a random password */
function getRandomPass(len) {
var keylist="abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"
var ret=''
for (i = 0; i < len; i++)
ret += keylist.charAt( Math.floor(Math.random() * keylist.length) )
return ret
}
/*
Admin Client Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminClientAttributesWindow(clientID) {
var AdminClientAttributesWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Attributes",
iconCls: 'silk-table',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add attribute',
iconCls:'silk-table_add',
handler: function() {
showAdminClientAttributeAddEditWindow(AdminClientAttributesWindow,clientID);
}
},
'-',
{
text:'Edit',
tooltip:'Edit attribute',
iconCls:'silk-table_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAttributeAddEditWindow(AdminClientAttributesWindow,clientID,selectedItem.data.ID);
} else {
AdminClientAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientAttributesWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove attribute',
iconCls:'silk-table_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAttributeRemoveWindow(AdminClientAttributesWindow,selectedItem.data.ID);
} else {
AdminClientAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientAttributesWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
},
{
header: "Operator",
sortable: true,
dataIndex: 'Operator'
},
{
header: "Value",
sortable: true,
dataIndex: 'Value'
},
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: clientID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes',
SOAPFunction: 'getAdminClientAttributes',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'},
{type: 'string', dataIndex: 'Operator'},
{type: 'string', dataIndex: 'Value'},
{type: 'boolean', dataIndex: 'Disabled'}
]
}
);
AdminClientAttributesWindow.show();
}
// Display edit/add form
function showAdminClientAttributeAddEditWindow(AdminClientAttributesWindow,clientID,attrID) {
var submitAjaxConfig;
var icon;
// We doing an update
if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = {
params: {
ID: attrID,
SOAPFunction: 'updateAdminClientAttribute',
SOAPParams:
'0:ID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-table_add';
submitAjaxConfig = {
params: {
ClientID: clientID,
SOAPFunction: 'addAdminClientAttribute',
SOAPParams:
'0:ClientID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminClientAttributesFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Attribute Information",
iconCls: icon,
width: 310,
height: 200,
minWidth: 310,
minHeight: 200
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
},
{
xtype: 'combo',
fieldLabel: 'Operator',
name: 'Operator',
allowBlank: false,
width: 157,
store: [
[ '=', '=' ],
[ ':=', ':=' ],
[ '==', '==' ],
[ '+=', '+=' ],
[ '!=', '!=' ],
[ '<', '<' ],
[ '>', '>' ],
[ '<=', '<=' ],
[ '>=', '>=' ],
[ '=~', '=~' ],
[ '!~', '!~' ],
[ '=*', '=*' ],
[ '!*', '!*' ],
[ '||==', '||==' ]
],
displayField: 'Operator',
valueField: 'Operator',
hiddenName: 'Operator',
forceSelection: false,
triggerAction: 'all',
editable: true
},
{
fieldLabel: "Value",
name: "Value",
allowBlank: false
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'Disabled'
}
]
},
// Submit button config
submitAjaxConfig
);
adminClientAttributesFormWindow.show();
if (attrID) {
Ext.getCmp(adminClientAttributesFormWindow.formPanelID).load({
params: {
ID: attrID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes',
SOAPFunction: 'getAdminClientAttribute',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminClientAttributeRemoveWindow(AdminClientAttributesWindow,id) {
// Mask AdminClientAttributesWindow window
AdminClientAttributesWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this attribute?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminClientAttributesWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes',
SOAPFunction: 'removeAdminClientAttribute',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminClientAttributesWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Client Realms
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminClientRealmsWindow(clientID) {
var AdminClientRealmsWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Realms",
iconCls: 'silk-world',
width: 400,
height: 335,
minWidth: 400,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add realm',
iconCls: 'silk-world_add',
handler: function() {
showAdminClientRealmAddWindow(AdminClientRealmsWindow,clientID);
}
},
'-',
{
text:'Remove',
tooltip:'Remove realm',
iconCls: 'silk-world_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientRealmRemoveWindow(AdminClientRealmsWindow,selectedItem.data.ID);
} else {
AdminClientRealmsWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No realm selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientRealmsWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: clientID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientRealms',
SOAPFunction: 'getAdminClientRealms',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'}
]
}
);
AdminClientRealmsWindow.show();
}
// Display edit/add form
function showAdminClientRealmAddWindow(AdminClientRealmsWindow,clientID,id) {
var submitAjaxConfig;
var icon;
// We doing an update
if (id) {
icon = 'silk-world_edit',
submitAjaxConfig = {
params: {
ID: id,
SOAPFunction: 'updateAdminRealm',
SOAPParams:
'0:ID,'+
'0:RealmID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-world_add',
submitAjaxConfig = {
params: {
ClientID: clientID,
SOAPFunction: 'addAdminClientRealm',
SOAPParams:
'0:ClientID,'+
'0:RealmID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminRealmFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Realm Information",
iconCls: icon,
width: 310,
height: 113,
minWidth: 310,
minHeight: 113
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealms'
},
items: [
{
xtype: 'combo',
//id: 'combo',
fieldLabel: 'Realm',
name: 'Realm',
allowBlank: false,
width: 160,
store: new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientRealms',
SOAPFunction: 'getAdminRealms',
SOAPParams: '__null,__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'RealmID',
forceSelection: true,
triggerAction: 'all',
editable: false
}
]
},
// Submit button config
submitAjaxConfig
);
adminRealmFormWindow.show();
if (id) {
Ext.getCmp(adminRealmFormWindow.formPanelID).load({
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealms',
SOAPFunction: 'getAdminRealm',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminClientRealmRemoveWindow(AdminClientRealmsWindow,id) {
// Mask AdminClientRealmsWindow window
AdminClientRealmsWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to unlink this realm?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminClientRealmsWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientRealms',
SOAPFunction: 'removeAdminClientRealm',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminClientRealmsWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Clients
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminClientWindow() {
var AdminClientWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Clients",
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add client',
iconCls:'silk-server_add',
handler: function() {
showAdminClientAddEditWindow(AdminClientWindow);
}
},
'-',
{
text:'Edit',
tooltip:'Edit client',
iconCls:'silk-server_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAddEditWindow(AdminClientWindow,selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
},
{
text:'Remove',
tooltip:'Remove client',
iconCls:'silk-server_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientRemoveWindow(AdminClientWindow,selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Attributes',
tooltip:'Client attributes',
iconCls:'silk-table',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAttributesWindow(selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Realms',
tooltip:'Realms',
iconCls:'silk-world',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientRealmsWindow(selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
},
{
header: "AccessList",
sortable: true,
dataIndex: 'AccessList'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients',
SOAPFunction: 'getAdminClients',
SOAPParams: '__null,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'},
{type: 'string', dataIndex: 'AccessList'}
]
}
);
AdminClientWindow.show();
}
// Display edit/add form
function showAdminClientAddEditWindow(AdminClientWindow,id) {
var submitAjaxConfig;
var icon;
// We doing an update
if (id) {
icon = 'silk-server_edit';
submitAjaxConfig = {
params: {
ID: id,
SOAPFunction: 'updateAdminClient',
SOAPParams:
'0:ID,'+
'0:Name,'+
'0:AccessList'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-server_add';
submitAjaxConfig = {
params: {
SOAPFunction: 'createAdminClient',
SOAPParams:
'0:Name,'+
'0:AccessList'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminClientFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Client Information",
iconCls: icon,
width: 310,
height: 143,
minWidth: 310,
minHeight: 143
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
},
{
fieldLabel: 'AccessList',
name: 'AccessList',
allowBlank: true
}
]
},
// Submit button config
submitAjaxConfig
);
adminClientFormWindow.show();
if (id) {
Ext.getCmp(adminClientFormWindow.formPanelID).load({
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients',
SOAPFunction: 'getAdminClient',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminClientRemoveWindow(AdminClientWindow,id) {
// Mask AdminClientWindow window
AdminClientWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this client?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminClientWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients',
SOAPFunction: 'removeAdminClient',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminClientWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminClientWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Group Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminGroupAttributesWindow(groupID) {
var AdminGroupAttributesWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Attributes",
iconCls: 'silk-table',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add attribute',
iconCls:'silk-table_add',
handler: function() {
showAdminGroupAttributeAddEditWindow(AdminGroupAttributesWindow,groupID);
}
},
'-',
{
text:'Edit',
tooltip:'Edit attribute',
iconCls:'silk-table_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminGroupAttributeAddEditWindow(AdminGroupAttributesWindow,groupID,selectedItem.data.ID);
} else {
AdminGroupAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminGroupAttributesWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove attribute',
iconCls:'silk-table_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminGroupAttributeRemoveWindow(AdminGroupAttributesWindow,selectedItem.data.ID);
} else {
AdminGroupAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminGroupAttributesWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
},
{
header: "Operator",
sortable: true,
dataIndex: 'Operator'
},
{
header: "Value",
sortable: true,
dataIndex: 'Value'
},
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: groupID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroupAttributes',
SOAPFunction: 'getAdminGroupAttributes',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'},
{type: 'string', dataIndex: 'Operator'},
{type: 'string', dataIndex: 'Value'},
{type: 'boolean', dataIndex: 'Disabled'}
]
}
);
AdminGroupAttributesWindow.show();
}
// Display edit/add form
function showAdminGroupAttributeAddEditWindow(AdminGroupAttributesWindow,groupID,attrID) {
var submitAjaxConfig;
var icon;
// We doing an update
if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = {
params: {
ID: attrID,
SOAPFunction: 'updateAdminGroupAttribute',
SOAPParams:
'0:ID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-table_add';
submitAjaxConfig = {
params: {
GroupID: groupID,
SOAPFunction: 'addAdminGroupAttribute',
SOAPParams:
'0:GroupID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminGroupAttributesFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Attribute Information",
iconCls: icon,
width: 310,
height: 200,
minWidth: 310,
minHeight: 200
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroupAttributes'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
},
{
xtype: 'combo',
fieldLabel: 'Operator',
name: 'Operator',
allowBlank: false,
width: 157,
store: [
[ '=', '=' ],
[ ':=', ':=' ],
[ '==', '==' ],
[ '+=', '+=' ],
[ '!=', '!=' ],
[ '<', '<' ],
[ '>', '>' ],
[ '<=', '<=' ],
[ '>=', '>=' ],
[ '=~', '=~' ],
[ '!~', '!~' ],
[ '=*', '=*' ],
[ '!*', '!*' ],
[ '||==', '||==' ]
],
displayField: 'Operator',
valueField: 'Operator',
hiddenName: 'Operator',
forceSelection: false,
triggerAction: 'all',
editable: true
},
{
fieldLabel: "Value",
name: "Value",
allowBlank: false
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'Disabled'
}
]
},
// Submit button config
submitAjaxConfig
);
adminGroupAttributesFormWindow.show();
if (attrID) {
Ext.getCmp(adminGroupAttributesFormWindow.formPanelID).load({
params: {
ID: attrID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroupAttributes',
SOAPFunction: 'getAdminGroupAttribute',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminGroupAttributeRemoveWindow(AdminGroupAttributesWindow,id) {
// Mask AdminGroupAttributesWindow window
AdminGroupAttributesWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this attribute?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminGroupAttributesWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroupAttributes',
SOAPFunction: 'removeAdminGroupAttribute',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminGroupAttributesWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Group Members
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminGroupMembersWindow(groupID) {
var AdminGroupMembersWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Members",
iconCls: 'silk-user',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Remove',
tooltip:'Remove member',
iconCls:'silk-user_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminGroupMembersWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminGroupMemberRemoveWindow(AdminGroupMembersWindow,selectedItem.data.ID);
} else {
AdminGroupMembersWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No member selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminGroupMembersWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Username",
sortable: true,
dataIndex: 'Username'
},
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Username'
},
// Store config
{
baseParams: {
ID: groupID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroupMembers',
SOAPFunction: 'getAdminGroupMembers',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Username'},
{type: 'boolean', dataIndex: 'Disabled'}
]
}
);
AdminGroupMembersWindow.show();
}
// Display remove form
function showAdminGroupMemberRemoveWindow(AdminGroupMembersWindow,id) {
// Mask AdminGroupMembersWindow window
AdminGroupMembersWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this member?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminGroupMembersWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroupMembers',
SOAPFunction: 'removeAdminGroupMember',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminGroupMembersWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminGroupMembersWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Groups
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminGroupWindow() {
......@@ -6,12 +24,13 @@ function showAdminGroupWindow() {
// Window config
{
title: "Groups",
iconCls: 'silk-group',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335,
minHeight: 335
},
// Grid config
{
......@@ -20,22 +39,50 @@ function showAdminGroupWindow() {
{
text:'Add',
tooltip:'Add group',
iconCls:'add',
iconCls:'silk-group_add',
handler: function() {
showAdminGroupEditWindow();
showAdminGroupAddEditWindow(AdminGroupWindow);
}
},
'-',
{
text:'Edit',
tooltip:'Edit group',
iconCls:'silk-group_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminGroupWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminGroupAddEditWindow(AdminGroupWindow,selectedItem.data.ID);
} else {
AdminGroupWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No group selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminGroupWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove group',
iconCls:'remove',
iconCls:'silk-group_delete',
handler: function() {
var selectedItem = AdminGroupWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminGroupWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminGroupRemoveWindow(WiSPUserWindow,selectedItem.data.ID);
showAdminGroupRemoveWindow(AdminGroupWindow,selectedItem.data.ID);
} else {
AdminGroupWindow.getEl().mask();
......@@ -57,9 +104,9 @@ function showAdminGroupWindow() {
{
text:'Attributes',
tooltip:'Group attributes',
iconCls:'logs',
iconCls:'silk-table',
handler: function() {
var selectedItem = AdminGroupWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminGroupWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -85,9 +132,9 @@ function showAdminGroupWindow() {
{
text:'Members',
tooltip:'Group members',
iconCls:'topups',
iconCls:'silk-group',
handler: function() {
var selectedItem = AdminGroupWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminGroupWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -169,224 +216,99 @@ function showAdminGroupWindow() {
// Display edit/add form
function showAdminGroupEditWindow(id) {
function showAdminGroupAddEditWindow(AdminGroupWindow,id) {
var submitAjaxConfig;
var editMode;
var icon;
// We doing an update
if (id) {
icon = 'silk-group_edit';
submitAjaxConfig = {
ID: id,
SOAPFunction: 'updateAdminGroup',
SOAPParams:
'0:ID,'+
'0:UsageCap,'+
'0:AgentRef,'+
'0:AgentDisabled:boolean'
params: {
ID: id,
SOAPFunction: 'updateAdminGroup',
SOAPParams:
'0:ID,'+
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
editMode = true;
// We doing an Add
} else {
icon = 'silk-group_add';
submitAjaxConfig = {
SOAPFunction: 'createAdminGroup',
SOAPParams:
'0:AgentID,'+
'0:GroupName,'+
'0:UsageCap,'+
'0:AgentRef,'+
'0:AgentDisabled:boolean'
params: {
SOAPFunction: 'createAdminGroup',
SOAPParams:
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
editMode = false;
}
// Service store
var serviceStore = new Ext.ux.JsonStore({
ID: id,
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPGroupname: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups',
SOAPFunction: 'getClasses',
AgentID: 1,
SOAPParams: '0:AgentID,__search'
}
});
// Create window
var wispGroupFormWindow = new Ext.ux.GenericFormWindow(
var adminGroupFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Group Information",
iconCls: icon,
width: 475,
height: 260,
width: 310,
height: 113,
minWidth: 475,
minHeight: 260
minWidth: 310,
minHeight: 113
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPGroupname: globalConfig.soap.username,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups'
},
items: [
{
fieldLabel: 'Groupname',
name: 'Groupname',
vtype: 'usernamePart',
maskRe: usernamePartRe,
allowBlank: false,
disabled: editMode
},
{
xtype: 'combo',
// We use an ID so we can get the box later
id: 'agent_combobox',
fieldLabel: 'Agent',
name: 'Agent',
allowBlank: false,
width: 225,
store: new Ext.ux.JsonStore({
ID: id,
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPGroupname: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'Agents',
SOAPFunction: 'getAgents',
SOAPParams: '__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'AgentID',
forceSelection: false,
triggerAction: 'all',
editable: false,
disabled: editMode
},
{
xtype: 'combo',
// We use an ID so we can get the box later
id: 'service_combobox',
fieldLabel: 'Service',
name: 'Service',
allowBlank: false,
width: 340,
store: serviceStore,
displayField: 'Service',
valueField: 'ID',
hiddenName: 'ClassID',
forceSelection: false,
triggerAction: 'all',
editable: false,
disabled: true
},
{
fieldLabel: 'Usage Cap',
name: 'UsageCap',
},
{
fieldLabel: 'Agent Ref',
name: 'AgentRef'
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'AgentDisabled'
}/*,
{
xtype: 'tabpanel',
plain: 'true',
deferredRender: false, // Load all panels!
activeTab: 0,
height: 100,
defaults: {
layout: 'form',
bodyStyle: 'padding: 10px;'
},
items: [
{
title: 'Policy Settings',
layout: 'form',
defaultType: 'textfield',
items: [
{
fieldLabel: 'Transport Policy',
name: 'Policy',
vtype: 'number',
value: '1'
}
]
}
]
}*/
],
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
}
]
},
// Submit button config
submitAjaxConfig
);
// Events
if (!id) {
wispGroupFormWindow.findById('agent_combobox').on({
select: {
fn: function() {
var tb = this.ownerCt.findById('service_combobox');
if (this.getValue()) {
tb.reset();
serviceStore.baseParams.AgentID = this.getValue();
serviceStore.reload();
tb.enable();
} else {
tb.reset();
tb.disable();
}
}
},
});
}
wispGroupFormWindow.show();
adminGroupFormWindow.show();
if (id) {
wispGroupFormWindow.getComponent('formpanel').load({
Ext.getCmp(adminGroupFormWindow.formPanelID).load({
params: {
id: id,
SOAPGroupname: globalConfig.soap.username,
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups',
SOAPFunction: 'getAdminGroups',
SOAPParams: 'id'
SOAPFunction: 'getAdminGroup',
SOAPParams: 'ID'
}
});
}
......@@ -395,15 +317,15 @@ function showAdminGroupEditWindow(id) {
// Display edit/add form
function showAdminGroupRemoveWindow(parent,id) {
// Mask parent window
parent.getEl().mask();
// Display remove form
function showAdminGroupRemoveWindow(AdminGroupWindow,id) {
// Mask AdminGroupWindow window
AdminGroupWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this user?",
msg: "Are you very sure you wish to remove this group?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
......@@ -412,33 +334,34 @@ function showAdminGroupRemoveWindow(parent,id) {
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(parent,{
uxAjaxRequest(AdminGroupWindow,{
params: {
id: id,
SOAPGroupname: globalConfig.soap.username,
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups',
SOAPFunction: 'removeAdminGroup',
SOAPParams: 'id'
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminGroupWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
parent.getEl().unmask();
AdminGroupWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Realm Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminRealmAttributesWindow(realmID) {
var AdminRealmAttributesWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Attributes",
iconCls: 'silk-table',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add attribute',
iconCls:'silk-table_add',
handler: function() {
showAdminRealmAttributeAddEditWindow(AdminRealmAttributesWindow,realmID);
}
},
'-',
{
text:'Edit',
tooltip:'Edit attribute',
iconCls:'silk-table_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminRealmAttributeAddEditWindow(AdminRealmAttributesWindow,realmID,selectedItem.data.ID);
} else {
AdminRealmAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminRealmAttributesWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove attribute',
iconCls:'silk-table_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminRealmAttributeRemoveWindow(AdminRealmAttributesWindow,selectedItem.data.ID);
} else {
AdminRealmAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminRealmAttributesWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
},
{
header: "Operator",
sortable: true,
dataIndex: 'Operator'
},
{
header: "Value",
sortable: true,
dataIndex: 'Value'
},
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: realmID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmAttributes',
SOAPFunction: 'getAdminRealmAttributes',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'},
{type: 'string', dataIndex: 'Operator'},
{type: 'string', dataIndex: 'Value'},
{type: 'boolean', dataIndex: 'Disabled'}
]
}
);
AdminRealmAttributesWindow.show();
}
// Display edit/add form
function showAdminRealmAttributeAddEditWindow(AdminRealmAttributesWindow,realmID,attrID) {
var submitAjaxConfig;
var icon;
// We doing an update
if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = {
params: {
ID: attrID,
SOAPFunction: 'updateAdminRealmAttribute',
SOAPParams:
'0:ID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-table_add';
submitAjaxConfig = {
params: {
RealmID: realmID,
SOAPFunction: 'addAdminRealmAttribute',
SOAPParams:
'0:RealmID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminRealmAttributesFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Attribute Information",
iconCls: icon,
width: 310,
height: 200,
minWidth: 310,
minHeight: 200
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmAttributes'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
},
{
xtype: 'combo',
fieldLabel: 'Operator',
name: 'Operator',
allowBlank: false,
width: 157,
store: [
[ '=', '=' ],
[ ':=', ':=' ],
[ '==', '==' ],
[ '+=', '+=' ],
[ '!=', '!=' ],
[ '<', '<' ],
[ '>', '>' ],
[ '<=', '<=' ],
[ '>=', '>=' ],
[ '=~', '=~' ],
[ '!~', '!~' ],
[ '=*', '=*' ],
[ '!*', '!*' ],
[ '||==', '||==' ]
],
displayField: 'Operator',
valueField: 'Operator',
hiddenName: 'Operator',
forceSelection: false,
triggerAction: 'all',
editable: true
},
{
fieldLabel: "Value",
name: "Value",
allowBlank: false
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'Disabled'
}
]
},
// Submit button config
submitAjaxConfig
);
adminRealmAttributesFormWindow.show();
if (attrID) {
Ext.getCmp(adminRealmAttributesFormWindow.formPanelID).load({
params: {
ID: attrID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmAttributes',
SOAPFunction: 'getAdminRealmAttribute',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminRealmAttributeRemoveWindow(AdminRealmAttributesWindow,id) {
// Mask AdminRealmAttributesWindow window
AdminRealmAttributesWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this attribute?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminRealmAttributesWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmAttributes',
SOAPFunction: 'removeAdminRealmAttribute',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminRealmAttributesWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Realm Members
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminRealmMembersWindow(realmID) {
var AdminRealmMembersWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Members",
iconCls: 'silk-server',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Remove',
tooltip:'Remove member',
iconCls:'silk-server_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminRealmMembersWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminRealmMemberRemoveWindow(AdminRealmMembersWindow,selectedItem.data.ID);
} else {
AdminRealmMembersWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No member selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminRealmMembersWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: realmID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmMembers',
SOAPFunction: 'getAdminRealmMembers',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'}
]
}
);
AdminRealmMembersWindow.show();
}
// Display remove form
function showAdminRealmMemberRemoveWindow(AdminRealmMembersWindow,id) {
// Mask AdminRealmMembersWindow window
AdminRealmMembersWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this member?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminRealmMembersWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmMembers',
SOAPFunction: 'removeAdminRealmMember',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminRealmMembersWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminRealmMembersWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Realms
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminRealmWindow() {
......@@ -6,12 +24,13 @@ function showAdminRealmWindow() {
// Window config
{
title: "Realms",
iconCls: 'silk-world',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335,
minHeight: 335
},
// Grid config
{
......@@ -20,18 +39,46 @@ function showAdminRealmWindow() {
{
text:'Add',
tooltip:'Add realm',
iconCls:'add',
iconCls:'silk-world_add',
handler: function() {
showAdminRealmAddWindow();
showAdminRealmAddEditWindow(AdminRealmWindow);
}
},
'-',
{
text:'Edit',
tooltip:'Edit realm',
iconCls:'silk-world_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminRealmWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminRealmAddEditWindow(AdminRealmWindow,selectedItem.data.ID);
} else {
AdminRealmWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No realm selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminRealmWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove realm',
iconCls:'remove',
iconCls:'silk-world_delete',
handler: function() {
var selectedItem = AdminRealmWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminRealmWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -54,12 +101,40 @@ function showAdminRealmWindow() {
}
},
'-',
{
text:'Attributes',
tooltip:'Realm attributes',
iconCls:'silk-table',
handler: function() {
var selectedItem = Ext.getCmp(AdminRealmWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminRealmAttributesWindow(selectedItem.data.ID);
} else {
AdminRealmWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No realm selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminRealmWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Members',
tooltip:'Realm members',
iconCls:'logs',
iconCls:'silk-server',
handler: function() {
var selectedItem = AdminRealmWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminRealmWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -101,7 +176,7 @@ function showAdminRealmWindow() {
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Service'
autoExpandColumn: 'Name'
},
// Store config
{
......@@ -118,7 +193,7 @@ function showAdminRealmWindow() {
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Realmname'},
{type: 'string', dataIndex: 'Name'},
{type: 'boolean', dataIndex: 'Disabled'}
]
}
......@@ -129,65 +204,65 @@ function showAdminRealmWindow() {
// Display edit/add form
function showAdminRealmEditWindow(id) {
function showAdminRealmAddEditWindow(AdminRealmWindow,id) {
var submitAjaxConfig;
var editMode;
var icon;
// We doing an update
if (id) {
icon = 'silk-world_edit';
submitAjaxConfig = {
ID: id,
SOAPFunction: 'updateAdminRealm',
SOAPParams:
'0:ID,'+
'0:UsageCap,'+
'0:AgentRef,'+
'0:AgentDisabled:boolean'
params: {
ID: id,
SOAPFunction: 'updateAdminRealm',
SOAPParams:
'0:ID,'+
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
editMode = true;
// We doing an Add
} else {
icon = 'silk-world_add';
submitAjaxConfig = {
SOAPFunction: 'createAdminRealm',
SOAPParams:
'0:AgentID,'+
'0:RealmName,'+
'0:UsageCap,'+
'0:AgentRef,'+
'0:AgentDisabled:boolean'
params: {
SOAPFunction: 'createAdminRealm',
SOAPParams:
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
editMode = false;
}
// Service store
var serviceStore = new Ext.ux.JsonStore({
ID: id,
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealms',
SOAPFunction: 'getClasses',
AgentID: 1,
SOAPParams: '0:AgentID,__search'
}
});
// Create window
var adminRealmFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Realm Information",
iconCls: icon,
width: 475,
height: 260,
width: 310,
height: 113,
minWidth: 475,
minHeight: 260
minWidth: 310,
minHeight: 113
},
// Form panel config
{
......@@ -200,153 +275,28 @@ function showAdminRealmEditWindow(id) {
},
items: [
{
fieldLabel: 'Realmname',
name: 'Realmname',
vtype: 'usernamePart',
maskRe: usernamePartRe,
allowBlank: false,
disabled: editMode
},
{
xtype: 'combo',
// We use an ID so we can get the box later
id: 'agent_combobox',
fieldLabel: 'Agent',
name: 'Agent',
allowBlank: false,
width: 225,
store: new Ext.ux.JsonStore({
ID: id,
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'Agents',
SOAPFunction: 'getAgents',
SOAPParams: '__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'AgentID',
forceSelection: false,
triggerAction: 'all',
editable: false,
disabled: editMode
},
{
xtype: 'combo',
// We use an ID so we can get the box later
id: 'service_combobox',
fieldLabel: 'Service',
name: 'Service',
allowBlank: false,
width: 340,
store: serviceStore,
displayField: 'Service',
valueField: 'ID',
hiddenName: 'ClassID',
forceSelection: false,
triggerAction: 'all',
editable: false,
disabled: true
},
{
fieldLabel: 'Usage Cap',
name: 'UsageCap',
},
{
fieldLabel: 'Agent Ref',
name: 'AgentRef'
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'AgentDisabled'
}/*,
{
xtype: 'tabpanel',
plain: 'true',
deferredRender: false, // Load all panels!
activeTab: 0,
height: 100,
defaults: {
layout: 'form',
bodyStyle: 'padding: 10px;'
},
items: [
{
title: 'Policy Settings',
layout: 'form',
defaultType: 'textfield',
items: [
{
fieldLabel: 'Transport Policy',
name: 'Policy',
vtype: 'number',
value: '1'
}
]
}
]
}*/
],
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
}
]
},
// Submit button config
submitAjaxConfig
);
// Events
if (!id) {
adminRealmFormWindow.findById('agent_combobox').on({
select: {
fn: function() {
var tb = this.ownerCt.findById('service_combobox');
if (this.getValue()) {
tb.reset();
serviceStore.baseParams.AgentID = this.getValue();
serviceStore.reload();
tb.enable();
} else {
tb.reset();
tb.disable();
}
}
},
});
}
adminRealmFormWindow.show();
if (id) {
adminRealmFormWindow.getComponent('formpanel').load({
Ext.getCmp(adminRealmFormWindow.formPanelID).load({
params: {
id: id,
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealms',
SOAPFunction: 'getAdminRealm',
SOAPParams: 'id'
SOAPParams: 'ID'
}
});
}
......@@ -355,15 +305,15 @@ function showAdminRealmEditWindow(id) {
// Display edit/add form
function showAdminRealmRemoveWindow(parent,id) {
// Mask parent window
parent.getEl().mask();
// Display remove form
function showAdminRealmRemoveWindow(AdminRealmWindow,id) {
// Mask AdminRealmWindow window
AdminRealmWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this user?",
msg: "Are you very sure you wish to remove this realm?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
......@@ -372,22 +322,30 @@ function showAdminRealmRemoveWindow(parent,id) {
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(parent,{
uxAjaxRequest(AdminRealmWindow,{
params: {
id: id,
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealms',
SOAPFunction: 'removeAdminRealm',
SOAPParams: 'id'
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminRealmWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
parent.getEl().unmask();
AdminRealmWindow.getEl().unmask();
}
}
});
......@@ -402,3 +360,5 @@ function showAdminRealmRemoveWindow(parent,id) {
// vim: ts=4
/*
Admin User Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminUserAttributesWindow(userID) {
var AdminUserAttributesWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Attributes",
iconCls: 'silk-table',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add attribute',
iconCls:'silk-table_add',
handler: function() {
showAdminUserAttributeAddEditWindow(AdminUserAttributesWindow,userID);
}
},
'-',
{
text:'Edit',
tooltip:'Edit attribute',
iconCls:'silk-table_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserAttributeAddEditWindow(AdminUserAttributesWindow,userID,selectedItem.data.ID);
} else {
AdminUserAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminUserAttributesWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove attribute',
iconCls:'silk-table_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserAttributeRemoveWindow(AdminUserAttributesWindow,selectedItem.data.ID);
} else {
AdminUserAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminUserAttributesWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
},
{
header: "Operator",
sortable: true,
dataIndex: 'Operator'
},
{
header: "Value",
sortable: true,
dataIndex: 'Value'
},
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: userID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserAttributes',
SOAPFunction: 'getAdminUserAttributes',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'},
{type: 'string', dataIndex: 'Operator'},
{type: 'string', dataIndex: 'Value'},
{type: 'boolean', dataIndex: 'Disabled'}
]
}
);
AdminUserAttributesWindow.show();
}
// Display edit/add form
function showAdminUserAttributeAddEditWindow(AdminUserAttributesWindow,userID,attrID) {
var submitAjaxConfig;
var icon;
// We doing an update
if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = {
params: {
ID: attrID,
SOAPFunction: 'updateAdminUserAttribute',
SOAPParams:
'0:ID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-table_add';
submitAjaxConfig = {
params: {
UserID: userID,
SOAPFunction: 'addAdminUserAttribute',
SOAPParams:
'0:UserID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminGroupFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Attribute Information",
iconCls: icon,
width: 310,
height: 200,
minWidth: 310,
minHeight: 200
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserAttributes'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
//vtype: 'usernamePart',
//maskRe: usernamePartRe,
allowBlank: false
},
{
xtype: 'combo',
fieldLabel: 'Operator',
name: 'Operator',
allowBlank: false,
width: 157,
store: [
[ '=', '=' ],
[ ':=', ':=' ],
[ '==', '==' ],
[ '+=', '+=' ],
[ '!=', '!=' ],
[ '<', '<' ],
[ '>', '>' ],
[ '<=', '<=' ],
[ '>=', '>=' ],
[ '=~', '=~' ],
[ '!~', '!~' ],
[ '=*', '=*' ],
[ '!*', '!*' ],
[ '||==', '||==' ]
],
displayField: 'Operator',
valueField: 'Operator',
hiddenName: 'Operator',
forceSelection: false,
triggerAction: 'all',
editable: true
},
{
fieldLabel: "Value",
name: "Value",
allowBlank: false
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'Disabled'
}
]
},
// Submit button config
submitAjaxConfig
);
adminGroupFormWindow.show();
if (attrID) {
Ext.getCmp(adminGroupFormWindow.formPanelID).load({
params: {
ID: attrID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserAttributes',
SOAPFunction: 'getAdminUserAttribute',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminUserAttributeRemoveWindow(AdminUserAttributesWindow,id) {
// Mask AdminUserAttributesWindow window
AdminUserAttributesWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this attribute?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminUserAttributesWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserAttributes',
SOAPFunction: 'removeAdminUserAttribute',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminUserAttributesWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin User Groups
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminUserGroupsWindow(userID) {
var AdminUserGroupsWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Groups",
iconCls: 'silk-group',
width: 400,
height: 335,
minWidth: 400,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add group',
iconCls:'silk-group_add',
handler: function() {
showAdminUserGroupAddWindow(AdminUserGroupsWindow,userID);
}
},
'-',
{
text:'Remove',
tooltip:'Remove group',
iconCls:'silk-group_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminUserGroupsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserGroupRemoveWindow(AdminUserGroupsWindow,selectedItem.data.ID);
} else {
AdminUserGroupsWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No group selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminUserGroupsWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: userID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'getAdminUserGroups',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'}
]
}
);
AdminUserGroupsWindow.show();
}
// Display edit/add form
function showAdminUserGroupAddWindow(AdminUserGroupsWindow,userID,id) {
var submitAjaxConfig;
var icon;
// We doing an update
if (id) {
icon = 'silk-group_edit';
submitAjaxConfig = {
params: {
ID: id,
SOAPFunction: 'updateAdminGroup',
SOAPParams:
'0:ID,'+
'0:GroupID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserGroupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-group_add';
submitAjaxConfig = {
params: {
UserID: userID,
SOAPFunction: 'addAdminUserGroup',
SOAPParams:
'0:UserID,'+
'0:GroupID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserGroupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminGroupFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Group Information",
iconCls: icon,
width: 310,
height: 113,
minWidth: 310,
minHeight: 113
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups'
},
items: [
{
xtype: 'combo',
//id: 'combo',
fieldLabel: 'Group',
name: 'Group',
allowBlank: false,
width: 160,
store: new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'getAdminGroups',
SOAPParams: '__null,__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'GroupID',
forceSelection: true,
triggerAction: 'all',
editable: false
}
]
},
// Submit button config
submitAjaxConfig
);
adminGroupFormWindow.show();
if (id) {
Ext.getCmp(adminGroupFormWindow.formPanelID).load({
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups',
SOAPFunction: 'getAdminGroup',
SOAPParams: 'ID'
}
});
}
}
// Display edit/add form
function showAdminUserGroupRemoveWindow(AdminUserGroupsWindow,id) {
// Mask AdminUserGroupsWindow window
AdminUserGroupsWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to unlink this group?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminUserGroupsWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'removeAdminUserGroup',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminUserGroupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminUserGroupsWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin User Logs
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
function showWiSPUserLogsWindow(wispUserID) {
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminUserLogsWindow(id) {
// Calculate dates we going to need
var today = new Date();
var firstOfMonth = today.getFirstDateOfMonth();
var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1);
var wispUserLogsWindow = new Ext.ux.GenericGridWindow(
var formID = Ext.id();
var formPeriodKeyID = Ext.id();
var formSearchButtonID = Ext.id();
var summaryFormID = Ext.id();
var summaryTotalID = Ext.id();
var currentPeriod = today.format('Y-m');
var adminUserLogsWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: 'User Logs',
title: 'Logs',
iconCls: 'silk-page_white_text',
layout:'border',
height: 480,
width: 700,
......@@ -20,66 +48,60 @@ function showWiSPUserLogsWindow(wispUserID) {
uxItems: [
{
xtype: 'form',
id: 'search-form',
id: formID,
title: 'Search',
region: 'west',
border: true,
frame: true,
defaultType: 'datefield',
height: 180,
width: 300,
width: 320,
labelWidth: 100,
items: [
{
id: 'after',
name: 'after',
width: 180,
fieldLabel: 'From',
vtype: 'daterange',
format: 'Y-m-d',
value: firstOfMonth,
endDateField: 'before',
},
{
id: 'before',
name: 'before',
width: 180,
fieldLabel: 'To',
vtype: 'daterange',
format: 'Y-m-d',
value: firstOfNext,
startDateField: 'after'
id: formPeriodKeyID,
xtype: 'textfield',
name: 'periodkey',
regex: /^\d{4}\-(0[1-9]|1(0|1|2))$/,
regexText: 'Please enter month in the format: YYYY-MM',
height: 25,
width: 100,
fieldLabel: 'Period',
value: currentPeriod
}
],
buttons: [
{
text: 'Search',
id: 'formbtn',
id: formSearchButtonID,
handler: function() {
// Pull in window, grid & form
var mainWindow = this.ownerCt.ownerCt;
var grid = mainWindow.getComponent('gridpanel');
var form = mainWindow.getComponent('search-form');
var grid = Ext.getCmp(adminUserLogsWindow.gridPanelID);
// Grab store
var store = grid.getStore();
// Grab timestamp filter
var gridFilters = grid.filters;
var timestampFilter = gridFilters.getFilter('Timestamp');
var timestampFilter = gridFilters.getFilter('EventTimestamp');
// Grab form field
var periodKeyField = Ext.getCmp(formPeriodKeyID);
if (periodKeyField.isValid()) {
var periodKeyValue = periodKeyField.getValue();
// Grab form fields
var afterField = form.getForm().findField('after');
var beforeField = form.getForm().findField('before');
// Convert our periodKey into DateTime values
var dtSearchStart = Date.parseDate(periodKeyValue+'-01','Y-m-d');
var dtSearchEnd = dtSearchStart.add(Date.MONTH,1);
// Set filter values from form
timestampFilter.setValue({
after: afterField.getValue(),
before: beforeField.getValue()
});
// Set filter values from form
timestampFilter.setValue({
after: dtSearchStart,
before: dtSearchEnd
});
// Trigger store reload
store.reload();
// Trigger store reload
store.reload();
}
}
}
],
......@@ -87,23 +109,24 @@ function showWiSPUserLogsWindow(wispUserID) {
},
{
xtype: 'form',
id: 'summary-form',
id: summaryFormID,
region: 'center',
split: true,
border: true,
border: false,
autoScroll: true,
defaultType: 'textarea',
height: 180,
height: 300,
width: 400,
labelWidth: 80,
labelWidth: 0,
items: [
{
id: 'summaryTotal',
id: summaryTotalID,
name: 'summaryTotal',
readOnly: true,
height: 135,
width: 200,
height: 300,
width: 400,
fieldLabel: 'Summary',
hideLabel: true,
fieldClass: 'font-family: monospace; font-size: 10px;',
value: ''
}
......@@ -116,78 +139,53 @@ function showWiSPUserLogsWindow(wispUserID) {
region: 'south',
width: 700,
border: true,
tbar: [
{
text: 'Add Port Lock',
tooltip: 'Add port lock',
iconCls: 'add'
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
hidden: true,
dataIndex: 'ID'
},
{
header: "Username",
hidden: true,
dataIndex: 'Username'
header: "Timestamp",
sortable: true,
dataIndex: 'EventTimestamp'
},
{
header: "Status",
sortable: true,
hidden: true,
dataIndex: 'Status'
dataIndex: 'AcctStatusType'
},
{
header: "Timestamp",
header: "Service Type",
sortable: true,
dataIndex: 'Timestamp'
},
{
header: "Session ID",
hidden: true,
dataIndex: 'AcctSessionID'
dataIndex: 'ServiceType'
},
{
header: "Session Time",
dataIndex: 'AcctSessionTime'
},
{
header: "NAS IP",
hidden: true,
dataIndex: 'NASIPAddress'
header: "Framed Protocol",
sortable: true,
dataIndex: 'FramedProtocol'
},
{
header: "Port Type",
header: "NAS Port Type",
hidden: true,
dataIndex: 'NASPortType'
},
{
header: "NAS Port",
dataIndex: 'NASPort'
},
{
header: "Called Station",
hidden: true,
dataIndex: 'CalledStationID'
},
{
header: "Calling Station",
sortable: true,
dataIndex: 'CallingStationID'
},
{
header: "NAS Xmit Rate",
dataIndex: 'NASTransmitRate'
header: "Called Station",
hidden: true,
dataIndex: 'CalledStationID'
},
{
header: "NAS Recv Rate",
header: "Session ID",
hidden: true,
dataIndex: 'NASReceiveRate'
dataIndex: 'AcctSessionID'
},
{
header: "IP Address",
......@@ -196,16 +194,17 @@ function showWiSPUserLogsWindow(wispUserID) {
},
{
header: "Input Mbyte",
dataIndex: 'AcctInputMbyte'
dataIndex: 'AcctInput',
renderer: renderUsageFloat
},
{
header: "Output Mbyte",
dataIndex: 'AcctOutputMbyte'
dataIndex: 'AcctOutput',
renderer: renderUsageFloat
},
{
header: "Last Update",
hidden: true,
dataIndex: 'LastAcctUpdate'
header: "Session Uptime",
dataIndex: 'AcctSessionTime'
},
{
header: "Term. Reason",
......@@ -216,72 +215,171 @@ function showWiSPUserLogsWindow(wispUserID) {
// Store config
{
baseParams: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPUsers',
SOAPFunction: 'getWiSPUserLogs',
SOAPParams: '0:UserID,__search',
UserID: wispUserID
SOAPModule: 'AdminUserLogs',
SOAPFunction: 'getAdminUserLogs',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Username'},
{type: 'numeric', dataIndex: 'Status'},
{type: 'numeric', dataIndex: 'ID'},
{
type: 'date',
dataIndex: 'Timestamp',
type: 'date',
format: 'Y-m-d H:i:s',
dataIndex: 'EventTimestamp',
value: {
after: firstOfMonth,
before: firstOfNext
}
},
{type: 'string', dataIndex: 'AcctSessionID'},
{type: 'numeric', dataIndex: 'AcctSessionTime'},
{type: 'string', dataIndex: 'NASIPAddress'},
{type: 'string', dataIndex: 'NASPortType'},
{type: 'string', dataIndex: 'NASPort'},
{type: 'string', dataIndex: 'CalledStationID'},
{type: 'numeric', dataIndex: 'AcctStatusType'},
{type: 'numeric', dataIndex: 'ServiceType'},
{type: 'numeric', dataIndex: 'FramedProtocol'},
{type: 'numeric', dataIndex: 'NASPortType'},
{type: 'string', dataIndex: 'NASPortID'},
{type: 'string', dataIndex: 'CallingStationID'},
{type: 'string', dataIndex: 'NASTransmitRate'},
{type: 'string', dataIndex: 'NASReceiveRate'},
{type: 'string', dataIndex: 'CalledStationID'},
{type: 'string', dataIndex: 'AcctSessionID'},
{type: 'string', dataIndex: 'FramedIPAddress'},
{type: 'date', dataIndex: 'LastAcctUpdate'},
{type: 'numeric', dataIndex: 'AcctInput'},
{type: 'numeric', dataIndex: 'AcctOutput'},
{type: 'numeric', dataIndex: 'AcctSessionTime'},
{type: 'string', dataIndex: 'ConnectTermReason'}
]
}
);
// Grab store
var store = wispUserLogsWindow.getComponent('gridpanel').getStore();
var store = Ext.getCmp(adminUserLogsWindow.gridPanelID).getStore();
store.on('load',function() {
var inputTotal = store.sum('AcctInputMbyte');
var outputTotal = store.sum('AcctOutputMbyte');
var userCap = 3000;
var userTopups = 1000;
// Total up into this ...
var userTotalAllowed = userCap + userTopups;
var userUsage = inputTotal + outputTotal;
var userLeft = userTotalAllowed - userUsage;
// Fetch periodKey from form
var periodKeyField = (Ext.getCmp(formPeriodKeyID)).getValue();
// Mask parent window
adminUserLogsWindow.getEl().mask();
uxAjaxRequest(
adminUserLogsWindow,
{
params: {
PeriodKey: periodKeyField,
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserLogs',
SOAPFunction: 'getAdminUserLogsSummary',
SOAPParams: '0:ID,0:PeriodKey'
},
customSuccess: function (result) {
response = Ext.decode(result.responseText);
// Caps
var trafficCap = response.data.trafficCap; // value of -1: prepaid
var uptimeCap = response.data.uptimeCap; // value of -1: prepaid
// Usage
var trafficUsage = response.data.trafficUsage;
var uptimeUsage = response.data.uptimeUsage;
// Topups
var trafficTopups = response.data.trafficTopups;
var uptimeTopups = response.data.uptimeTopups;
var totalTrafficTopups = response.data.TotalTrafficTopups;
var totalUptimeTopups = response.data.TotalUptimeTopups;
// Format string before printing
var trafficString = '';
// Prepaid traffic
if (trafficCap == -1) {
trafficCap = 'Prepaid';
trafficString += sprintf('Traffic:\nCap: %s \nTopup balance for current month: %d MB\nTotal Topups: %d MB\nUsage: %d/%d MB\n',
trafficCap,trafficTopups,totalTrafficTopups,trafficUsage,trafficTopups);
trafficString += '---\n';
// Uncapped traffic
} else if (trafficCap == 0) {
trafficString += sprintf('Traffic:\nCap: Uncapped\nUsage: %d MB\n',
trafficUsage);
trafficString += '---\n';
// Capped traffic
} else {
var combinedTrafficCap = trafficCap + trafficTopups;
trafficString += sprintf('Traffic:\nCap: %d MB\nTopup balance for current month: %d MB\nTotal Topups: %d MB\n'+
'Usage: %d/%d MB\n',
trafficCap,trafficTopups,totalTrafficTopups,trafficUsage,combinedTrafficCap);
trafficString += '---\n';
}
// Format string before printing
var uptimeString = '';
// Prepaid uptime
if (uptimeCap == -1) {
uptimeCap = 'Prepaid';
uptimeString += sprintf('Uptime:\nCap: %s \nTopup balance for current month: %d Min\nTotal Topups: %d Min\n'+
'Usage: %d/%d Min\n',
uptimeCap,uptimeTopups,totalUptimeTopups,uptimeUsage,uptimeTopups);
uptimeString += '---\n';
// Uncapped uptime
} else if (uptimeCap == 0) {
uptimeString += sprintf('Uptime:\nCap: Uncapped\nUsage: %d Min\n',
uptimeUsage);
uptimeString += '---\n';
// Capped uptime
} else {
var combinedUptimeCap = uptimeCap + uptimeTopups;
uptimeString += sprintf('Uptime:\nCap: %d Min\nTopup balance for current month: %d Min\nTotal Topups: %d Min\n'+
'Usage: %d/%d Min\n',
uptimeCap,uptimeTopups,totalUptimeTopups,uptimeUsage,combinedUptimeCap);
uptimeString += '---\n';
}
// Topup breakdown
var tTopups = response.data.AllTrafficTopups;
var uTopups = response.data.AllUptimeTopups;
var form = wispUserLogsWindow.getComponent('summary-form');
var summaryTotal = form.getForm().findField('summaryTotal');
// Format topups string
var topupString = '';
if (tTopups.length > 0) {
topupString += 'Valid Traffic Topups:';
}
for (var i = 0; i < tTopups.length; i++) {
var id = tTopups[i].ID;
var used = tTopups[i].Used;
var cap = tTopups[i].Cap;
var validTo = tTopups[i].ValidTo;
topupString += sprintf('\nID: %s\nUsage: %d/%d MB\nValid Until: %s\n--',id,used,cap,validTo);
}
if (uTopups.length > 0) {
topupString += 'Valid Uptime Topups:';
}
for (var i = 0; i < uTopups.length; i++) {
var id = uTopups[i].ID;
var used = uTopups[i].Used;
var cap = uTopups[i].Cap;
var validTo = uTopups[i].ValidTo;
topupString += sprintf('\nID: %s\nUsage: %d/%d MB\nValid Until: %s\n--',id,used,cap,validTo);
}
summaryTotal.setValue(
sprintf('Cap Total: %6d\nTopups : %6d\n-----------------\n %6d\n-----------------\nUsage : %6d\n=================\nAvailable: %6d',userCap,userTopups,userTotalAllowed,userUsage,userLeft)
// Get summary field
var form = Ext.getCmp(summaryFormID);
var summaryField = Ext.getCmp(summaryTotalID);
summaryField.setValue(trafficString+uptimeString+topupString);
},
failure: function (result) {
Ext.MessageBox.alert('Failed', 'Couldn\'t fetch data: '+result.date);
}
}
);
});
wispUserLogsWindow.show();
adminUserLogsWindow.show();
}
// vim: ts=4
/*
Admin User Topups
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminUserTopupsWindow(userID) {
var adminUserTopupsWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "User Topups",
iconCls: 'silk-chart_bar',
width: 500,
height: 335,
minWidth: 500,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add topup',
iconCls:'silk-chart_bar_add',
handler: function() {
showAdminUserTopupAddEditWindow(adminUserTopupsWindow,userID,0);
}
},
'-',
{
text:'Edit',
tooltip:'Edit topup',
iconCls:'silk-chart_bar_edit',
handler: function() {
var selectedItem = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserTopupAddEditWindow(adminUserTopupsWindow,userID,selectedItem.data.ID);
} else {
adminUserTopupsWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No topup selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
adminUserTopupsWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove topup',
iconCls:'silk-chart_bar_delete',
handler: function() {
var selectedItem = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserTopupRemoveWindow(adminUserTopupsWindow,selectedItem.data.ID);
} else {
adminUserTopupsWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No topup selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
adminUserTopupsWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
hidden: true,
dataIndex: 'ID'
},
{
header: "Type",
sortable: true,
dataIndex: 'Type'
},
{
header: "Value",
sortable: true,
dataIndex: 'Value'
},
{
header: "Timestamp",
sortable: true,
hidden: true,
dataIndex: 'Timestamp'
},
{
header: "ValidFrom",
sortable: true,
dataIndex: 'ValidFrom'
},
{
header: "ValidTo",
sortable: true,
dataIndex: 'ValidTo'
}
])
},
// Store config
{
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUsers',
SOAPFunction: 'getAdminUserTopups',
SOAPParams: '0:UserID,__search',
UserID: userID
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'date', dataIndex: 'Timestamp'},
{type: 'numeric', dataIndex: 'Value'},
{type: 'date', dataIndex: 'ValidFrom'},
{type: 'date', dataIndex: 'ValidTo'}
]
}
);
adminUserTopupsWindow.show();
}
// Display edit/add form
function showAdminUserTopupAddEditWindow(adminUserTopupsWindow,userID,topupID) {
var today = new Date();
var firstOfMonth = today.getFirstDateOfMonth();
var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1);
var submitAjaxConfig;
var icon;
// We doing an update
if (topupID) {
icon = 'silk-chart_bar_edit';
submitAjaxConfig = {
params: {
ID: topupID,
SOAPFunction: 'updateAdminUserTopup',
SOAPParams:
'0:ID,0:Value,0:Type,'+
'0:ValidFrom,0:ValidTo'
},
onSuccess: function() {
var store = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-chart_bar_add';
submitAjaxConfig = {
params: {
UserID: userID,
SOAPFunction: 'createAdminUserTopup',
SOAPParams:
'0:UserID,0:Value,0:Type,'+
'0:ValidFrom,0:ValidTo'
},
onSuccess: function() {
var store = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminUserTopupFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Topup Information",
iconCls: icon,
width: 400,
height: 200,
minWidth: 400,
minHeight: 200
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUsers'
},
items: [
{
xtype: 'combo',
fieldLabel: 'Type',
name: 'Type',
allowBlank: false,
width: 157,
store: [
[ '1', 'Traffic' ],
[ '2', 'Uptime' ]
],
displayField: 'Type',
valueField: 'Type',
hiddenName: 'Type',
forceSelection: true,
triggerAction: 'all',
editable: false
},
{
xtype: 'numberfield',
fieldLabel: 'Value',
name: 'Value',
minValue: 1,
allowBlank: false
},
{
xtype: 'datefield',
fieldLabel: 'ValidFrom',
name: 'ValidFrom',
id: 'ValidFrom',
vtype: 'daterange',
disabledDates: ["(0(2|3|4|5|6|7|8|9)|1[0-9]|2[0-9]|3[0-1])$"],
value: firstOfMonth,
format: 'Y-m-d',
endDateField: 'ValidTo'
},
{
xtype: 'datefield',
fieldLabel: 'ValidTo',
name: 'ValidTo',
id: 'ValidTo',
vtype: 'daterange',
disabledDates: ["(0(2|3|4|5|6|7|8|9)|1[0-9]|2[0-9]|3[0-1])$"],
value: firstOfNext,
format: 'Y-m-d',
startDateField: 'ValidFrom'
}
]
},
// Submit button config
submitAjaxConfig
);
adminUserTopupFormWindow.show();
if (topupID) {
Ext.getCmp(adminUserTopupFormWindow.formPanelID).load({
params: {
id: topupID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUsers',
SOAPFunction: 'getAdminUserTopup',
SOAPParams: 'id'
}
});
}
}
// Display edit/add form
function showAdminUserTopupRemoveWindow(adminUserTopupsWindow,id) {
// Mask adminUserTopupsWindow window
adminUserTopupsWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this topup?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(adminUserTopupsWindow,{
params: {
id: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUsers',
SOAPFunction: 'removeAdminUserTopup',
SOAPParams: 'id'
},
customSuccess: function() {
var store = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
adminUserTopupsWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Users
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminUserWindow() {
......@@ -6,12 +24,13 @@ function showAdminUserWindow() {
// Window config
{
title: "Users",
iconCls: 'silk-user',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335,
minHeight: 335
},
// Grid config
{
......@@ -20,22 +39,22 @@ function showAdminUserWindow() {
{
text:'Add',
tooltip:'Add user',
iconCls:'add',
iconCls:'silk-user_add',
handler: function() {
showAdminUserEditWindow();
showAdminUserAddEditWindow(AdminUserWindow);
}
},
'-',
{
text:'Edit',
tooltip:'Edit user',
iconCls:'option',
iconCls:'silk-user_edit',
handler: function() {
var selectedItem = AdminUserWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserEditWindow(selectedItem.data.ID);
showAdminUserAddEditWindow(AdminUserWindow,selectedItem.data.ID);
} else {
AdminUserWindow.getEl().mask();
......@@ -57,9 +76,9 @@ function showAdminUserWindow() {
{
text:'Remove',
tooltip:'Remove user',
iconCls:'remove',
iconCls:'silk-user_delete',
handler: function() {
var selectedItem = AdminUserWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -82,12 +101,40 @@ function showAdminUserWindow() {
}
},
'-',
{
text:'Attributes',
tooltip:'User attributes',
iconCls:'silk-table',
handler: function() {
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserAttributesWindow(selectedItem.data.ID);
} else {
AdminUserWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No user selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminUserWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Logs',
tooltip:'User logs',
iconCls:'logs',
iconCls: 'silk-page_white_text',
handler: function() {
var selectedItem = AdminUserWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -113,9 +160,9 @@ function showAdminUserWindow() {
{
text:'Groups',
tooltip:'User groups',
iconCls:'topups',
iconCls:'silk-group',
handler: function() {
var selectedItem = AdminUserWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -123,6 +170,34 @@ function showAdminUserWindow() {
} else {
AdminUserWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No user selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminUserWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Topups',
tooltip:'User topups',
iconCls:'silk-chart_bar',
handler: function() {
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserTopupsWindow(selectedItem.data.ID);
} else {
AdminUserWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
......@@ -153,11 +228,11 @@ function showAdminUserWindow() {
},
{
header: "Disabled",
sortable: false,
sortable: true,
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Service'
autoExpandColumn: 'Username'
},
// Store config
{
......@@ -185,65 +260,66 @@ function showAdminUserWindow() {
// Display edit/add form
function showAdminUserEditWindow(id) {
function showAdminUserAddEditWindow(AdminUserWindow,id) {
var submitAjaxConfig;
var editMode;
var icon;
// We doing an update
if (id) {
icon = 'silk-user_edit';
submitAjaxConfig = {
ID: id,
SOAPFunction: 'updateAdminUser',
SOAPParams:
'0:ID,'+
'0:UsageCap,'+
'0:AgentRef,'+
'0:AgentDisabled:boolean'
params: {
ID: id,
SOAPFunction: 'updateAdminUser',
SOAPParams:
'0:ID,'+
'0:Username,'+
'0:Disabled'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
editMode = true;
// We doing an Add
} else {
icon = 'silk-user_add';
submitAjaxConfig = {
SOAPFunction: 'createAdminUser',
SOAPParams:
'0:AgentID,'+
'0:UserName,'+
'0:UsageCap,'+
'0:AgentRef,'+
'0:AgentDisabled:boolean'
params: {
SOAPFunction: 'createAdminUser',
SOAPParams:
'0:Username,'+
'0:Disabled'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
editMode = false;
}
// Service store
var serviceStore = new Ext.ux.JsonStore({
ID: id,
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUsers',
SOAPFunction: 'getClasses',
AgentID: 1,
SOAPParams: '0:AgentID,__search'
}
});
// Create window
var adminUserFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "User Information",
iconCls: icon,
width: 475,
height: 260,
width: 310,
height: 133,
minWidth: 475,
minHeight: 260
minWidth: 310,
minHeight: 133
},
// Form panel config
{
......@@ -258,151 +334,34 @@ function showAdminUserEditWindow(id) {
{
fieldLabel: 'Username',
name: 'Username',
vtype: 'usernamePart',
maskRe: usernamePartRe,
allowBlank: false,
disabled: editMode
},
{
xtype: 'combo',
// We use an ID so we can get the box later
id: 'agent_combobox',
fieldLabel: 'Agent',
name: 'Agent',
allowBlank: false,
width: 225,
store: new Ext.ux.JsonStore({
ID: id,
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'Agents',
SOAPFunction: 'getAgents',
SOAPParams: '__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'AgentID',
forceSelection: false,
triggerAction: 'all',
editable: false,
disabled: editMode
},
{
xtype: 'combo',
// We use an ID so we can get the box later
id: 'service_combobox',
fieldLabel: 'Service',
name: 'Service',
allowBlank: false,
width: 340,
store: serviceStore,
displayField: 'Service',
valueField: 'ID',
hiddenName: 'ClassID',
forceSelection: false,
triggerAction: 'all',
editable: false,
disabled: true
},
{
fieldLabel: 'Usage Cap',
name: 'UsageCap',
},
{
fieldLabel: 'Agent Ref',
name: 'AgentRef'
vtype: 'usernameRadius',
maskRe: usernameRadiusPartRe,
allowBlank: false
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'AgentDisabled'
}/*,
{
xtype: 'tabpanel',
plain: 'true',
deferredRender: false, // Load all panels!
activeTab: 0,
height: 100,
defaults: {
layout: 'form',
bodyStyle: 'padding: 10px;'
},
items: [
{
title: 'Policy Settings',
layout: 'form',
defaultType: 'textfield',
items: [
{
fieldLabel: 'Transport Policy',
name: 'Policy',
vtype: 'number',
value: '1'
}
]
}
]
}*/
],
name: 'Disabled',
xtype: 'checkbox',
inputValue: '1'
}
]
},
// Submit button config
submitAjaxConfig
);
// Events
if (!id) {
adminUserFormWindow.findById('agent_combobox').on({
select: {
fn: function() {
var tb = this.ownerCt.findById('service_combobox');
if (this.getValue()) {
tb.reset();
serviceStore.baseParams.AgentID = this.getValue();
serviceStore.reload();
tb.enable();
} else {
tb.reset();
tb.disable();
}
}
},
});
}
adminUserFormWindow.show();
if (id) {
adminUserFormWindow.getComponent('formpanel').load({
Ext.getCmp(adminUserFormWindow.formPanelID).load({
params: {
id: id,
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUsers',
SOAPFunction: 'getAdminUser',
SOAPParams: 'id'
SOAPParams: 'ID'
}
});
}
......@@ -412,9 +371,9 @@ function showAdminUserEditWindow(id) {
// Display edit/add form
function showAdminUserRemoveWindow(parent,id) {
// Mask parent window
parent.getEl().mask();
function showAdminUserRemoveWindow(AdminUserWindow,id) {
// Mask AdminUserWindow window
AdminUserWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
......@@ -428,22 +387,30 @@ function showAdminUserRemoveWindow(parent,id) {
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(parent,{
uxAjaxRequest(AdminUserWindow,{
params: {
id: id,
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUsers',
SOAPFunction: 'removeAdminUser',
SOAPParams: 'id'
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
parent.getEl().unmask();
AdminUserWindow.getEl().unmask();
}
}
});
......@@ -458,3 +425,5 @@ function showAdminUserRemoveWindow(parent,id) {
// vim: ts=4
/*
WiSP Location Members
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showWiSPLocationMembersWindow(locationID) {
var WiSPLocationMembersWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Members",
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Remove',
tooltip:'Remove member',
iconCls:'remove',
handler: function() {
var selectedItem = Ext.getCmp(WiSPLocationMembersWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showWiSPLocationMemberRemoveWindow(WiSPLocationMembersWindow,selectedItem.data.ID);
} else {
WiSPLocationMembersWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No member selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
WiSPLocationMembersWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Username",
sortable: true,
dataIndex: 'Username'
}
]),
autoExpandColumn: 'Username'
},
// Store config
{
baseParams: {
ID: locationID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPLocationMembers',
SOAPFunction: 'getWiSPLocationMembers',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Username'}
]
}
);
WiSPLocationMembersWindow.show();
}
// Display remove form
function showWiSPLocationMemberRemoveWindow(WiSPLocationMembersWindow,id) {
// Mask WiSPLocationMembersWindow window
WiSPLocationMembersWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this member?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(WiSPLocationMembersWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPLocationMembers',
SOAPFunction: 'removeWiSPLocationMember',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(WiSPLocationMembersWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
WiSPLocationMembersWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
WiSP Locations
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showWiSPLocationWindow() {
......@@ -6,12 +24,13 @@ function showWiSPLocationWindow() {
// Window config
{
title: "Locations",
iconCls: 'silk-map',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335,
minHeight: 335
},
// Grid config
{
......@@ -20,18 +39,46 @@ function showWiSPLocationWindow() {
{
text:'Add',
tooltip:'Add location',
iconCls:'add',
iconCls:'silk-map_add',
handler: function() {
showWiSPLocationEditWindow();
showWiSPLocationAddEditWindow(WiSPLocationWindow);
}
},
'-',
{
text:'Edit',
tooltip:'Edit location',
iconCls:'silk-map_edit',
handler: function() {
var selectedItem = Ext.getCmp(WiSPLocationWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showWiSPLocationAddEditWindow(WiSPLocationWindow,selectedItem.data.ID);
} else {
WiSPLocationWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No location selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
WiSPLocationWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove location',
iconCls:'remove',
iconCls:'silk-map_delete',
handler: function() {
var selectedItem = WiSPLocationWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(WiSPLocationWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
......@@ -57,20 +104,20 @@ function showWiSPLocationWindow() {
{
text:'Members',
tooltip:'List members',
iconCls:'remove',
iconCls:'silk-user',
handler: function() {
var selectedItem = WiSPLocationWindow.getComponent('gridpanel').getSelectionModel().getSelected();
var selectedItem = Ext.getCmp(WiSPLocationWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showWiSPLocationMembersWindow(WiSPLocationWindow,selectedItem.data.ID);
showWiSPLocationMembersWindow(selectedItem.data.ID);
} else {
WiSPLocationWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No user selected",
msg: "No location selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
......@@ -105,7 +152,7 @@ function showWiSPLocationWindow() {
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPLocations',
SOAPFunction: 'getLocations',
SOAPFunction: 'getWiSPLocations',
SOAPParams: '__null,__search'
}
},
......@@ -122,19 +169,114 @@ function showWiSPLocationWindow() {
}
// Display edit/add form
function showWiSPLocationAddEditWindow(WiSPLocationWindow,id) {
var submitAjaxConfig;
var icon;
// We doing an update
if (id) {
icon = 'silk-map_edit';
submitAjaxConfig = {
params: {
ID: id,
SOAPFunction: 'updateWiSPLocation',
SOAPParams:
'0:ID,'+
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(WiSPLocationWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-map_add';
submitAjaxConfig = {
params: {
SOAPFunction: 'createWiSPLocation',
SOAPParams:
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(WiSPLocationWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var wispLocationFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Location Information",
iconCls: icon,
width: 310,
height: 113,
minWidth: 310,
minHeight: 113
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPLocations'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
}
]
},
// Submit button config
submitAjaxConfig
);
wispLocationFormWindow.show();
if (id) {
Ext.getCmp(wispLocationFormWindow.formPanelID).load({
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPLocations',
SOAPFunction: 'getWiSPLocation',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showWiSPLocationRemoveWindow(parent,id) {
// Mask parent window
parent.getEl().mask();
function showWiSPLocationRemoveWindow(WiSPLocationWindow,id) {
// Mask WiSPLocationWindow window
WiSPLocationWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this user?",
msg: "Are you very sure you wish to remove this location?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
......@@ -143,33 +285,34 @@ function showWiSPLocationRemoveWindow(parent,id) {
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(parent,{
uxAjaxRequest(WiSPLocationWindow,{
params: {
id: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPUsers',
SOAPFunction: 'removeWiSPUser',
SOAPModule: 'WiSPLocations',
SOAPFunction: 'removeWiSPLocation',
SOAPParams: 'id'
},
customSuccess: function() {
var store = Ext.getCmp(WiSPLocationWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
parent.getEl().unmask();
WiSPLocationWindow.getEl().unmask();
}
}
});
}
// vim: ts=4