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 910 additions and 551 deletions
/* /*
Admin User Groups Admin User Groups
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -30,7 +30,7 @@ function showAdminUserGroupsWindow(userID) { ...@@ -30,7 +30,7 @@ function showAdminUserGroupsWindow(userID) {
height: 335, height: 335,
minWidth: 400, minWidth: 400,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -41,7 +41,7 @@ function showAdminUserGroupsWindow(userID) { ...@@ -41,7 +41,7 @@ function showAdminUserGroupsWindow(userID) {
tooltip:'Add group', tooltip:'Add group',
iconCls:'silk-group_add', iconCls:'silk-group_add',
handler: function() { handler: function() {
showAdminUserGroupAddWindow(userID); showAdminUserGroupAddWindow(AdminUserGroupsWindow,userID);
} }
}, },
'-', '-',
...@@ -115,7 +115,7 @@ function showAdminUserGroupsWindow(userID) { ...@@ -115,7 +115,7 @@ function showAdminUserGroupsWindow(userID) {
// Display edit/add form // Display edit/add form
function showAdminUserGroupAddWindow(userID,id) { function showAdminUserGroupAddWindow(AdminUserGroupsWindow,userID,id) {
var submitAjaxConfig; var submitAjaxConfig;
var icon; var icon;
...@@ -125,22 +125,42 @@ function showAdminUserGroupAddWindow(userID,id) { ...@@ -125,22 +125,42 @@ function showAdminUserGroupAddWindow(userID,id) {
if (id) { if (id) {
icon = 'silk-group_edit'; icon = 'silk-group_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: id, params: {
SOAPFunction: 'updateAdminGroup', ID: id,
SOAPParams: SOAPFunction: 'updateAdminGroup',
'0:ID,'+ SOAPParams:
'0:GroupID' '0:ID,'+
'0:GroupID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserGroupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-group_add'; icon = 'silk-group_add';
submitAjaxConfig = { submitAjaxConfig = {
UserID: userID, params: {
SOAPFunction: 'addAdminUserGroup', UserID: userID,
SOAPParams: SOAPFunction: 'addAdminUserGroup',
'0:UserID,'+ SOAPParams:
'0:GroupID' '0:UserID,'+
'0:GroupID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserGroupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -192,8 +212,8 @@ function showAdminUserGroupAddWindow(userID,id) { ...@@ -192,8 +212,8 @@ function showAdminUserGroupAddWindow(userID,id) {
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
editable: false editable: false
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -220,9 +240,9 @@ function showAdminUserGroupAddWindow(userID,id) { ...@@ -220,9 +240,9 @@ function showAdminUserGroupAddWindow(userID,id) {
// Display edit/add form // Display edit/add form
function showAdminUserGroupRemoveWindow(parent,id) { function showAdminUserGroupRemoveWindow(AdminUserGroupsWindow,id) {
// Mask parent window // Mask AdminUserGroupsWindow window
parent.getEl().mask(); AdminUserGroupsWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -236,7 +256,7 @@ function showAdminUserGroupRemoveWindow(parent,id) { ...@@ -236,7 +256,7 @@ function showAdminUserGroupRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminUserGroupsWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -245,13 +265,21 @@ function showAdminUserGroupRemoveWindow(parent,id) { ...@@ -245,13 +265,21 @@ function showAdminUserGroupRemoveWindow(parent,id) {
SOAPModule: 'AdminUserGroups', SOAPModule: 'AdminUserGroups',
SOAPFunction: 'removeAdminUserGroup', SOAPFunction: 'removeAdminUserGroup',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminUserGroupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminUserGroupsWindow.getEl().unmask();
} }
} }
}); });
......
/* /*
Admin User Logs Admin User Logs
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -24,11 +24,20 @@ function showAdminUserLogsWindow(id) { ...@@ -24,11 +24,20 @@ function showAdminUserLogsWindow(id) {
var firstOfMonth = today.getFirstDateOfMonth(); var firstOfMonth = today.getFirstDateOfMonth();
var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1); var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1);
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( var adminUserLogsWindow = new Ext.ux.GenericGridWindow(
// Window config // Window config
{ {
title: 'Logs', title: 'Logs',
iconCls: 'logs', iconCls: 'silk-page_white_text',
layout:'border', layout:'border',
height: 480, height: 480,
width: 700, width: 700,
...@@ -39,46 +48,34 @@ function showAdminUserLogsWindow(id) { ...@@ -39,46 +48,34 @@ function showAdminUserLogsWindow(id) {
uxItems: [ uxItems: [
{ {
xtype: 'form', xtype: 'form',
id: 'search-form', id: formID,
title: 'Search', title: 'Search',
region: 'west', region: 'west',
border: true, border: true,
frame: true, frame: true,
defaultType: 'datefield',
height: 180, height: 180,
width: 320, width: 320,
labelWidth: 100, labelWidth: 100,
items: [ items: [
{ {
id: 'after', id: formPeriodKeyID,
name: 'after', xtype: 'textfield',
width: 180, name: 'periodkey',
fieldLabel: 'From', regex: /^\d{4}\-(0[1-9]|1(0|1|2))$/,
vtype: 'daterange', regexText: 'Please enter month in the format: YYYY-MM',
format: 'Y-m-d', height: 25,
value: firstOfMonth, width: 100,
endDateField: 'before' fieldLabel: 'Period',
}, value: currentPeriod
{
id: 'before',
name: 'before',
width: 180,
fieldLabel: 'To',
vtype: 'daterange',
format: 'Y-m-d',
value: firstOfNext,
startDateField: 'after'
} }
], ],
buttons: [ buttons: [
{ {
text: 'Search', text: 'Search',
id: 'formbtn', id: formSearchButtonID,
handler: function() { handler: function() {
// Pull in window, grid & form // Pull in window, grid & form
var mainWindow = this.ownerCt.ownerCt; var grid = Ext.getCmp(adminUserLogsWindow.gridPanelID);
var grid = Ext.getCmp(mainWindow.gridPanelID);
var form = mainWindow.getComponent('search-form');
// Grab store // Grab store
var store = grid.getStore(); var store = grid.getStore();
...@@ -87,18 +84,24 @@ function showAdminUserLogsWindow(id) { ...@@ -87,18 +84,24 @@ function showAdminUserLogsWindow(id) {
var gridFilters = grid.filters; var gridFilters = grid.filters;
var timestampFilter = gridFilters.getFilter('EventTimestamp'); var timestampFilter = gridFilters.getFilter('EventTimestamp');
// Grab form fields // Grab form field
var afterField = form.getForm().findField('after'); var periodKeyField = Ext.getCmp(formPeriodKeyID);
var beforeField = form.getForm().findField('before'); if (periodKeyField.isValid()) {
var periodKeyValue = periodKeyField.getValue();
// 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 // Set filter values from form
timestampFilter.setValue({ timestampFilter.setValue({
after: afterField.getValue(), after: dtSearchStart,
before: beforeField.getValue() before: dtSearchEnd
}); });
// Trigger store reload // Trigger store reload
store.reload(); store.reload();
}
} }
} }
], ],
...@@ -106,23 +109,24 @@ function showAdminUserLogsWindow(id) { ...@@ -106,23 +109,24 @@ function showAdminUserLogsWindow(id) {
}, },
{ {
xtype: 'form', xtype: 'form',
id: 'summary-form', id: summaryFormID,
region: 'center', region: 'center',
split: true, split: true,
border: true, border: false,
autoScroll: true, autoScroll: true,
defaultType: 'textarea', defaultType: 'textarea',
height: 180, height: 300,
width: 400, width: 400,
labelWidth: 80, labelWidth: 0,
items: [ items: [
{ {
id: 'summaryTotal', id: summaryTotalID,
name: 'summaryTotal', name: 'summaryTotal',
readOnly: true, readOnly: true,
height: 139, height: 300,
width: 275, width: 400,
fieldLabel: 'Summary', fieldLabel: 'Summary',
hideLabel: true,
fieldClass: 'font-family: monospace; font-size: 10px;', fieldClass: 'font-family: monospace; font-size: 10px;',
value: '' value: ''
} }
...@@ -190,11 +194,13 @@ function showAdminUserLogsWindow(id) { ...@@ -190,11 +194,13 @@ function showAdminUserLogsWindow(id) {
}, },
{ {
header: "Input Mbyte", header: "Input Mbyte",
dataIndex: 'AcctInputMbyte' dataIndex: 'AcctInput',
renderer: renderUsageFloat
}, },
{ {
header: "Output Mbyte", header: "Output Mbyte",
dataIndex: 'AcctOutputMbyte' dataIndex: 'AcctOutput',
renderer: renderUsageFloat
}, },
{ {
header: "Session Uptime", header: "Session Uptime",
...@@ -240,8 +246,8 @@ function showAdminUserLogsWindow(id) { ...@@ -240,8 +246,8 @@ function showAdminUserLogsWindow(id) {
{type: 'string', dataIndex: 'CalledStationID'}, {type: 'string', dataIndex: 'CalledStationID'},
{type: 'string', dataIndex: 'AcctSessionID'}, {type: 'string', dataIndex: 'AcctSessionID'},
{type: 'string', dataIndex: 'FramedIPAddress'}, {type: 'string', dataIndex: 'FramedIPAddress'},
{type: 'numeric', dataIndex: 'AcctInputMbyte'}, {type: 'numeric', dataIndex: 'AcctInput'},
{type: 'numeric', dataIndex: 'AcctOutputMbyte'}, {type: 'numeric', dataIndex: 'AcctOutput'},
{type: 'numeric', dataIndex: 'AcctSessionTime'}, {type: 'numeric', dataIndex: 'AcctSessionTime'},
{type: 'string', dataIndex: 'ConnectTermReason'} {type: 'string', dataIndex: 'ConnectTermReason'}
] ]
...@@ -251,13 +257,9 @@ function showAdminUserLogsWindow(id) { ...@@ -251,13 +257,9 @@ function showAdminUserLogsWindow(id) {
var store = Ext.getCmp(adminUserLogsWindow.gridPanelID).getStore(); var store = Ext.getCmp(adminUserLogsWindow.gridPanelID).getStore();
store.on('load',function() { store.on('load',function() {
var inputTotal = store.sum('AcctInputMbyte');
var outputTotal = store.sum('AcctOutputMbyte');
var uptimeTotal = store.sum('AcctSessionTime');
var searchForm = adminUserLogsWindow.getComponent('search-form'); // Fetch periodKey from form
var afterField = (searchForm.getForm().findField('after')).getValue(); var periodKeyField = (Ext.getCmp(formPeriodKeyID)).getValue();
var beforeField = (searchForm.getForm().findField('before')).getValue();
// Mask parent window // Mask parent window
adminUserLogsWindow.getEl().mask(); adminUserLogsWindow.getEl().mask();
...@@ -266,90 +268,53 @@ function showAdminUserLogsWindow(id) { ...@@ -266,90 +268,53 @@ function showAdminUserLogsWindow(id) {
adminUserLogsWindow, adminUserLogsWindow,
{ {
params: { params: {
From: afterField, PeriodKey: periodKeyField,
To: beforeField,
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password, SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype, SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserLogs', SOAPModule: 'AdminUserLogs',
SOAPFunction: 'getAdminUserLogsSummary', SOAPFunction: 'getAdminUserLogsSummary',
SOAPParams: '0:ID,0:From,0:To' SOAPParams: '0:ID,0:PeriodKey'
}, },
customSuccess: function (result) { customSuccess: function (result) {
response = Ext.decode(result.responseText); response = Ext.decode(result.responseText);
// Traffic variables // Caps
var trafficCap = response.data.trafficCap; // value of -1: prepaid var trafficCap = response.data.trafficCap; // value of -1: prepaid
var trafficCurrentTopupUsed = response.data.trafficCurrentTopupUsed; // value of -1: no current topup
var trafficCurrentTopupCap = response.data.trafficCurrentTopupCap; // value of -1: no current topup
var trafficTopupRemaining = response.data.trafficTopupRemaining;
// Uptime variables
var uptimeCap = response.data.uptimeCap; // value of -1: prepaid var uptimeCap = response.data.uptimeCap; // value of -1: prepaid
// Usage
var trafficUsage = response.data.trafficUsage;
var uptimeUsage = response.data.uptimeUsage;
var uptimeCurrentTopupUsed = response.data.uptimeCurrentTopupUsed; // value of -1: no current topup // Topups
var uptimeCurrentTopupCap = response.data.uptimeCurrentTopupCap; // value of -1: no current topup var trafficTopups = response.data.trafficTopups;
var uptimeTopupRemaining = response.data.uptimeTopupRemaining; var uptimeTopups = response.data.uptimeTopups;
var totalTrafficTopups = response.data.TotalTrafficTopups;
// Total up traffic var totalUptimeTopups = response.data.TotalUptimeTopups;
var trafficTotalAllowed;
var validTrafficTopups;
if (trafficCurrentTopupCap > 0) {
validTrafficTopups = trafficCurrentTopupCap;
validTrafficTopups += trafficTopupRemaining;
} else {
validTrafficTopups = trafficTopupRemaining;
}
if (trafficCap < 0) {
trafficTotalAllowed = validTrafficTopups;
} else {
trafficTotalAllowed = trafficCap + validTrafficTopups;
}
// Traffic usage
var trafficUsage = inputTotal + outputTotal;
// Total up uptime
var uptimeTotalAllowed;
var validUptimeTopups;
if (uptimeCurrentTopupCap > 0) {
validUptimeTopups = uptimeCurrentTopupCap;
validUptimeTopups += uptimeTopupRemaining;
} else {
validUptimeTopups = uptimeTopupRemaining;
}
if (uptimeCap < 0) {
uptimeTotalAllowed = validUptimeTopups;
} else {
uptimeTotalAllowed = uptimeCap + validUptimeTopups;
}
// Get summary field
var form = adminUserLogsWindow.getComponent('summary-form');
var summaryTotal = form.getForm().findField('summaryTotal');
// Format string before printing // Format string before printing
var trafficString = ''; var trafficString = '';
// Prepaid traffic // Prepaid traffic
if (trafficCap == -1) { if (trafficCap == -1) {
trafficCap = 'Prepaid'; trafficCap = 'Prepaid';
trafficString += sprintf(' Traffic\nCap: %s MB Topup: %d MB\n'+ trafficString += sprintf('Traffic:\nCap: %s \nTopup balance for current month: %d MB\nTotal Topups: %d MB\nUsage: %d/%d MB\n',
'Usage: %d/%d MB\n=====================================\n', trafficCap,trafficTopups,totalTrafficTopups,trafficUsage,trafficTopups);
trafficCap,validTrafficTopups,trafficUsage,trafficTotalAllowed); trafficString += '---\n';
// Uncapped traffic // Uncapped traffic
} else if (trafficCap == 0) { } else if (trafficCap == 0) {
trafficString += sprintf(' Traffic\nCap: Uncapped Used: %d\n=====================================n', trafficString += sprintf('Traffic:\nCap: Uncapped\nUsage: %d MB\n',
trafficUsage); trafficUsage);
trafficString += '---\n';
// Capped traffic // Capped traffic
} else { } else {
trafficString += sprintf(' Traffic\nCap: %d MB Topup: %d MB\n'+ var combinedTrafficCap = trafficCap + trafficTopups;
'Usage: %d/%d MB\n=====================================\n', trafficString += sprintf('Traffic:\nCap: %d MB\nTopup balance for current month: %d MB\nTotal Topups: %d MB\n'+
trafficCap,validTrafficTopups,trafficUsage,trafficTotalAllowed); 'Usage: %d/%d MB\n',
trafficCap,trafficTopups,totalTrafficTopups,trafficUsage,combinedTrafficCap);
trafficString += '---\n';
} }
// Format string before printing // Format string before printing
...@@ -357,29 +322,64 @@ function showAdminUserLogsWindow(id) { ...@@ -357,29 +322,64 @@ function showAdminUserLogsWindow(id) {
// Prepaid uptime // Prepaid uptime
if (uptimeCap == -1) { if (uptimeCap == -1) {
uptimeCap = 'Prepaid'; uptimeCap = 'Prepaid';
uptimeString += sprintf(' Uptime\nCap: %s MB Topup: %d MB\n'+ uptimeString += sprintf('Uptime:\nCap: %s \nTopup balance for current month: %d Min\nTotal Topups: %d Min\n'+
'Usage: %d/%d MB', 'Usage: %d/%d Min\n',
uptimeCap,validUptimeTopups,uptimeTotal,uptimeTotalAllowed); uptimeCap,uptimeTopups,totalUptimeTopups,uptimeUsage,uptimeTopups);
uptimeString += '---\n';
// Uncapped uptime // Uncapped uptime
} else if (uptimeCap == 0) { } else if (uptimeCap == 0) {
uptimeString += sprintf(' Uptime\nCap: Uncapped Used: %d', uptimeString += sprintf('Uptime:\nCap: Uncapped\nUsage: %d Min\n',
uptimeTotal); uptimeUsage);
uptimeString += '---\n';
// Capped uptime // Capped uptime
} else { } else {
uptimeString += sprintf(' Uptime\nCap: %d MB Topup: %d MB\n'+ var combinedUptimeCap = uptimeCap + uptimeTopups;
'Usage: %d/%d MB', uptimeString += sprintf('Uptime:\nCap: %d Min\nTopup balance for current month: %d Min\nTotal Topups: %d Min\n'+
uptimeCap,validUptimeTopups,uptimeTotal,uptimeTotalAllowed); 'Usage: %d/%d Min\n',
uptimeCap,uptimeTopups,totalUptimeTopups,uptimeUsage,combinedUptimeCap);
uptimeString += '---\n';
} }
summaryTotal.setValue(trafficString+uptimeString); // Topup breakdown
var tTopups = response.data.AllTrafficTopups;
var uTopups = response.data.AllUptimeTopups;
// 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);
}
// Get summary field
var form = Ext.getCmp(summaryFormID);
var summaryField = Ext.getCmp(summaryTotalID);
summaryField.setValue(trafficString+uptimeString+topupString);
}, },
failure: function (result) { failure: function (result) {
Ext.MessageBox.alert('Failed', 'Couldn\'t fetch data: '+result.date); Ext.MessageBox.alert('Failed', 'Couldn\'t fetch data: '+result.date);
}, }
} }
); );
}); });
adminUserLogsWindow.show(); adminUserLogsWindow.show();
} }
// vim: ts=4 // vim: ts=4
/* /*
Admin User Topups Admin User Topups
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -24,12 +24,12 @@ function showAdminUserTopupsWindow(userID) { ...@@ -24,12 +24,12 @@ function showAdminUserTopupsWindow(userID) {
// Window config // Window config
{ {
title: "User Topups", title: "User Topups",
iconCls: 'silk-building', iconCls: 'silk-chart_bar',
width: 500, width: 500,
height: 335, height: 335,
minWidth: 500, minWidth: 500,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -38,22 +38,22 @@ function showAdminUserTopupsWindow(userID) { ...@@ -38,22 +38,22 @@ function showAdminUserTopupsWindow(userID) {
{ {
text:'Add', text:'Add',
tooltip:'Add topup', tooltip:'Add topup',
iconCls:'silk-building_add', iconCls:'silk-chart_bar_add',
handler: function() { handler: function() {
showAdminUserTopupAddEditWindow(userID,0); showAdminUserTopupAddEditWindow(adminUserTopupsWindow,userID,0);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit topup', tooltip:'Edit topup',
iconCls:'silk-building_edit', iconCls:'silk-chart_bar_edit',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
if (selectedItem) { if (selectedItem) {
// If so display window // If so display window
showAdminUserTopupAddEditWindow(userID,selectedItem.data.ID); showAdminUserTopupAddEditWindow(adminUserTopupsWindow,userID,selectedItem.data.ID);
} else { } else {
adminUserTopupsWindow.getEl().mask(); adminUserTopupsWindow.getEl().mask();
...@@ -75,7 +75,7 @@ function showAdminUserTopupsWindow(userID) { ...@@ -75,7 +75,7 @@ function showAdminUserTopupsWindow(userID) {
{ {
text:'Remove', text:'Remove',
tooltip:'Remove topup', tooltip:'Remove topup',
iconCls:'silk-building_delete', iconCls:'silk-chart_bar_delete',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
...@@ -135,7 +135,7 @@ function showAdminUserTopupsWindow(userID) { ...@@ -135,7 +135,7 @@ function showAdminUserTopupsWindow(userID) {
sortable: true, sortable: true,
dataIndex: 'ValidTo' dataIndex: 'ValidTo'
} }
]), ])
}, },
// Store config // Store config
{ {
...@@ -166,7 +166,7 @@ function showAdminUserTopupsWindow(userID) { ...@@ -166,7 +166,7 @@ function showAdminUserTopupsWindow(userID) {
// Display edit/add form // Display edit/add form
function showAdminUserTopupAddEditWindow(userID,topupID) { function showAdminUserTopupAddEditWindow(adminUserTopupsWindow,userID,topupID) {
var today = new Date(); var today = new Date();
var firstOfMonth = today.getFirstDateOfMonth(); var firstOfMonth = today.getFirstDateOfMonth();
var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1); var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1);
...@@ -176,23 +176,43 @@ function showAdminUserTopupAddEditWindow(userID,topupID) { ...@@ -176,23 +176,43 @@ function showAdminUserTopupAddEditWindow(userID,topupID) {
// We doing an update // We doing an update
if (topupID) { if (topupID) {
icon = 'silk-building_edit'; icon = 'silk-chart_bar_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: topupID, params: {
SOAPFunction: 'updateAdminUserTopup', ID: topupID,
SOAPParams: SOAPFunction: 'updateAdminUserTopup',
'0:ID,0:Value,0:Type,'+ SOAPParams:
'0:ValidFrom,0:ValidTo' '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 // We doing an Add
} else { } else {
icon = 'silk-building_add'; icon = 'silk-chart_bar_add';
submitAjaxConfig = { submitAjaxConfig = {
UserID: userID, params: {
SOAPFunction: 'createAdminUserTopup', UserID: userID,
SOAPParams: SOAPFunction: 'createAdminUserTopup',
'0:UserID,0:Value,0:Type,'+ SOAPParams:
'0:ValidFrom,0:ValidTo' '0:UserID,0:Value,0:Type,'+
'0:ValidFrom,0:ValidTo'
},
onSuccess: function() {
var store = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -248,6 +268,7 @@ function showAdminUserTopupAddEditWindow(userID,topupID) { ...@@ -248,6 +268,7 @@ function showAdminUserTopupAddEditWindow(userID,topupID) {
name: 'ValidFrom', name: 'ValidFrom',
id: 'ValidFrom', id: 'ValidFrom',
vtype: 'daterange', vtype: 'daterange',
disabledDates: ["(0(2|3|4|5|6|7|8|9)|1[0-9]|2[0-9]|3[0-1])$"],
value: firstOfMonth, value: firstOfMonth,
format: 'Y-m-d', format: 'Y-m-d',
endDateField: 'ValidTo' endDateField: 'ValidTo'
...@@ -258,11 +279,12 @@ function showAdminUserTopupAddEditWindow(userID,topupID) { ...@@ -258,11 +279,12 @@ function showAdminUserTopupAddEditWindow(userID,topupID) {
name: 'ValidTo', name: 'ValidTo',
id: 'ValidTo', id: 'ValidTo',
vtype: 'daterange', vtype: 'daterange',
disabledDates: ["(0(2|3|4|5|6|7|8|9)|1[0-9]|2[0-9]|3[0-1])$"],
value: firstOfNext, value: firstOfNext,
format: 'Y-m-d', format: 'Y-m-d',
startDateField: 'ValidFrom' startDateField: 'ValidFrom'
} }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -289,9 +311,9 @@ function showAdminUserTopupAddEditWindow(userID,topupID) { ...@@ -289,9 +311,9 @@ function showAdminUserTopupAddEditWindow(userID,topupID) {
// Display edit/add form // Display edit/add form
function showAdminUserTopupRemoveWindow(parent,id) { function showAdminUserTopupRemoveWindow(adminUserTopupsWindow,id) {
// Mask parent window // Mask adminUserTopupsWindow window
parent.getEl().mask(); adminUserTopupsWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -305,7 +327,7 @@ function showAdminUserTopupRemoveWindow(parent,id) { ...@@ -305,7 +327,7 @@ function showAdminUserTopupRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(adminUserTopupsWindow,{
params: { params: {
id: id, id: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -314,13 +336,21 @@ function showAdminUserTopupRemoveWindow(parent,id) { ...@@ -314,13 +336,21 @@ function showAdminUserTopupRemoveWindow(parent,id) {
SOAPModule: 'AdminUsers', SOAPModule: 'AdminUsers',
SOAPFunction: 'removeAdminUserTopup', SOAPFunction: 'removeAdminUserTopup',
SOAPParams: 'id' SOAPParams: 'id'
},
customSuccess: function() {
var store = Ext.getCmp(adminUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); adminUserTopupsWindow.getEl().unmask();
} }
} }
}); });
......
/* /*
Admin Users Admin Users
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -30,7 +30,7 @@ function showAdminUserWindow() { ...@@ -30,7 +30,7 @@ function showAdminUserWindow() {
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -41,7 +41,7 @@ function showAdminUserWindow() { ...@@ -41,7 +41,7 @@ function showAdminUserWindow() {
tooltip:'Add user', tooltip:'Add user',
iconCls:'silk-user_add', iconCls:'silk-user_add',
handler: function() { handler: function() {
showAdminUserAddEditWindow(); showAdminUserAddEditWindow(AdminUserWindow);
} }
}, },
'-', '-',
...@@ -54,7 +54,7 @@ function showAdminUserWindow() { ...@@ -54,7 +54,7 @@ function showAdminUserWindow() {
// Check if we have selected item // Check if we have selected item
if (selectedItem) { if (selectedItem) {
// If so display window // If so display window
showAdminUserAddEditWindow(selectedItem.data.ID); showAdminUserAddEditWindow(AdminUserWindow,selectedItem.data.ID);
} else { } else {
AdminUserWindow.getEl().mask(); AdminUserWindow.getEl().mask();
...@@ -132,7 +132,7 @@ function showAdminUserWindow() { ...@@ -132,7 +132,7 @@ function showAdminUserWindow() {
{ {
text:'Logs', text:'Logs',
tooltip:'User logs', tooltip:'User logs',
iconCls:'logs', iconCls: 'silk-page_white_text',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
...@@ -188,7 +188,7 @@ function showAdminUserWindow() { ...@@ -188,7 +188,7 @@ function showAdminUserWindow() {
{ {
text:'Topups', text:'Topups',
tooltip:'User topups', tooltip:'User topups',
iconCls:'silk-building', iconCls:'silk-chart_bar',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
...@@ -260,7 +260,7 @@ function showAdminUserWindow() { ...@@ -260,7 +260,7 @@ function showAdminUserWindow() {
// Display edit/add form // Display edit/add form
function showAdminUserAddEditWindow(id) { function showAdminUserAddEditWindow(AdminUserWindow,id) {
var submitAjaxConfig; var submitAjaxConfig;
var icon; var icon;
...@@ -269,20 +269,42 @@ function showAdminUserAddEditWindow(id) { ...@@ -269,20 +269,42 @@ function showAdminUserAddEditWindow(id) {
if (id) { if (id) {
icon = 'silk-user_edit'; icon = 'silk-user_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: id, params: {
SOAPFunction: 'updateAdminUser', ID: id,
SOAPParams: SOAPFunction: 'updateAdminUser',
'0:ID,'+ SOAPParams:
'0:Username' '0:ID,'+
'0:Username,'+
'0:Disabled'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-user_add'; icon = 'silk-user_add';
submitAjaxConfig = { submitAjaxConfig = {
SOAPFunction: 'createAdminUser', params: {
SOAPParams: SOAPFunction: 'createAdminUser',
'0:Username' SOAPParams:
'0:Username,'+
'0:Disabled'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -294,10 +316,10 @@ function showAdminUserAddEditWindow(id) { ...@@ -294,10 +316,10 @@ function showAdminUserAddEditWindow(id) {
iconCls: icon, iconCls: icon,
width: 310, width: 310,
height: 113, height: 133,
minWidth: 310, minWidth: 310,
minHeight: 113 minHeight: 133
}, },
// Form panel config // Form panel config
{ {
...@@ -314,9 +336,15 @@ function showAdminUserAddEditWindow(id) { ...@@ -314,9 +336,15 @@ function showAdminUserAddEditWindow(id) {
name: 'Username', name: 'Username',
vtype: 'usernameRadius', vtype: 'usernameRadius',
maskRe: usernameRadiusPartRe, maskRe: usernameRadiusPartRe,
allowBlank: false, allowBlank: false
}, },
], {
fieldLabel: 'Disabled',
name: 'Disabled',
xtype: 'checkbox',
inputValue: '1'
}
]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -343,9 +371,9 @@ function showAdminUserAddEditWindow(id) { ...@@ -343,9 +371,9 @@ function showAdminUserAddEditWindow(id) {
// Display edit/add form // Display edit/add form
function showAdminUserRemoveWindow(parent,id) { function showAdminUserRemoveWindow(AdminUserWindow,id) {
// Mask parent window // Mask AdminUserWindow window
parent.getEl().mask(); AdminUserWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -359,7 +387,7 @@ function showAdminUserRemoveWindow(parent,id) { ...@@ -359,7 +387,7 @@ function showAdminUserRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminUserWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -368,13 +396,21 @@ function showAdminUserRemoveWindow(parent,id) { ...@@ -368,13 +396,21 @@ function showAdminUserRemoveWindow(parent,id) {
SOAPModule: 'AdminUsers', SOAPModule: 'AdminUsers',
SOAPFunction: 'removeAdminUser', 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 // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminUserWindow.getEl().unmask();
} }
} }
}); });
......
/* /*
WiSP Location Members WiSP Location Members
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -29,7 +29,7 @@ function showWiSPLocationMembersWindow(locationID) { ...@@ -29,7 +29,7 @@ function showWiSPLocationMembersWindow(locationID) {
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -105,9 +105,9 @@ function showWiSPLocationMembersWindow(locationID) { ...@@ -105,9 +105,9 @@ function showWiSPLocationMembersWindow(locationID) {
// Display remove form // Display remove form
function showWiSPLocationMemberRemoveWindow(parent,id) { function showWiSPLocationMemberRemoveWindow(WiSPLocationMembersWindow,id) {
// Mask parent window // Mask WiSPLocationMembersWindow window
parent.getEl().mask(); WiSPLocationMembersWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -121,7 +121,7 @@ function showWiSPLocationMemberRemoveWindow(parent,id) { ...@@ -121,7 +121,7 @@ function showWiSPLocationMemberRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(WiSPLocationMembersWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -130,13 +130,21 @@ function showWiSPLocationMemberRemoveWindow(parent,id) { ...@@ -130,13 +130,21 @@ function showWiSPLocationMemberRemoveWindow(parent,id) {
SOAPModule: 'WiSPLocationMembers', SOAPModule: 'WiSPLocationMembers',
SOAPFunction: 'removeWiSPLocationMember', SOAPFunction: 'removeWiSPLocationMember',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(WiSPLocationMembersWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); WiSPLocationMembersWindow.getEl().unmask();
} }
} }
}); });
......
/* /*
WiSP Locations WiSP Locations
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -30,7 +30,7 @@ function showWiSPLocationWindow() { ...@@ -30,7 +30,7 @@ function showWiSPLocationWindow() {
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -41,7 +41,7 @@ function showWiSPLocationWindow() { ...@@ -41,7 +41,7 @@ function showWiSPLocationWindow() {
tooltip:'Add location', tooltip:'Add location',
iconCls:'silk-map_add', iconCls:'silk-map_add',
handler: function() { handler: function() {
showWiSPLocationAddEditWindow(); showWiSPLocationAddEditWindow(WiSPLocationWindow);
} }
}, },
'-', '-',
...@@ -54,7 +54,7 @@ function showWiSPLocationWindow() { ...@@ -54,7 +54,7 @@ function showWiSPLocationWindow() {
// Check if we have selected item // Check if we have selected item
if (selectedItem) { if (selectedItem) {
// If so display window // If so display window
showWiSPLocationAddEditWindow(selectedItem.data.ID); showWiSPLocationAddEditWindow(WiSPLocationWindow,selectedItem.data.ID);
} else { } else {
WiSPLocationWindow.getEl().mask(); WiSPLocationWindow.getEl().mask();
...@@ -170,7 +170,7 @@ function showWiSPLocationWindow() { ...@@ -170,7 +170,7 @@ function showWiSPLocationWindow() {
// Display edit/add form // Display edit/add form
function showWiSPLocationAddEditWindow(id) { function showWiSPLocationAddEditWindow(WiSPLocationWindow,id) {
var submitAjaxConfig; var submitAjaxConfig;
var icon; var icon;
...@@ -179,20 +179,40 @@ function showWiSPLocationAddEditWindow(id) { ...@@ -179,20 +179,40 @@ function showWiSPLocationAddEditWindow(id) {
if (id) { if (id) {
icon = 'silk-map_edit'; icon = 'silk-map_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: id, params: {
SOAPFunction: 'updateWiSPLocation', ID: id,
SOAPParams: SOAPFunction: 'updateWiSPLocation',
'0:ID,'+ SOAPParams:
'0:Name' '0:ID,'+
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(WiSPLocationWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-map_add'; icon = 'silk-map_add';
submitAjaxConfig = { submitAjaxConfig = {
SOAPFunction: 'createWiSPLocation', params: {
SOAPParams: SOAPFunction: 'createWiSPLocation',
'0:Name' SOAPParams:
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(WiSPLocationWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -223,8 +243,8 @@ function showWiSPLocationAddEditWindow(id) { ...@@ -223,8 +243,8 @@ function showWiSPLocationAddEditWindow(id) {
fieldLabel: 'Name', fieldLabel: 'Name',
name: 'Name', name: 'Name',
allowBlank: false allowBlank: false
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -249,9 +269,9 @@ function showWiSPLocationAddEditWindow(id) { ...@@ -249,9 +269,9 @@ function showWiSPLocationAddEditWindow(id) {
// Display remove form // Display remove form
function showWiSPLocationRemoveWindow(parent,id) { function showWiSPLocationRemoveWindow(WiSPLocationWindow,id) {
// Mask parent window // Mask WiSPLocationWindow window
parent.getEl().mask(); WiSPLocationWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -265,7 +285,7 @@ function showWiSPLocationRemoveWindow(parent,id) { ...@@ -265,7 +285,7 @@ function showWiSPLocationRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(WiSPLocationWindow,{
params: { params: {
id: id, id: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -274,13 +294,21 @@ function showWiSPLocationRemoveWindow(parent,id) { ...@@ -274,13 +294,21 @@ function showWiSPLocationRemoveWindow(parent,id) {
SOAPModule: 'WiSPLocations', SOAPModule: 'WiSPLocations',
SOAPFunction: 'removeWiSPLocation', SOAPFunction: 'removeWiSPLocation',
SOAPParams: 'id' SOAPParams: 'id'
},
customSuccess: function() {
var store = Ext.getCmp(WiSPLocationWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); WiSPLocationWindow.getEl().unmask();
} }
} }
}); });
......
/* /*
WiSP Resellers WiSP Resellers
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -29,7 +29,7 @@ function showWiSPResellersWindow() { ...@@ -29,7 +29,7 @@ function showWiSPResellersWindow() {
height: 335, height: 335,
minWidth: 400, minWidth: 400,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -272,7 +272,7 @@ function showWiSPResellerEditWindow(id) { ...@@ -272,7 +272,7 @@ function showWiSPResellerEditWindow(id) {
} }
] ]
} }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
......
/* /*
WiSP User Logs WiSP User Logs
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -24,11 +24,20 @@ function showWiSPUserLogsWindow(id) { ...@@ -24,11 +24,20 @@ function showWiSPUserLogsWindow(id) {
var firstOfMonth = today.getFirstDateOfMonth(); var firstOfMonth = today.getFirstDateOfMonth();
var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1); var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1);
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 wispUserLogsWindow = new Ext.ux.GenericGridWindow( var wispUserLogsWindow = new Ext.ux.GenericGridWindow(
// Window config // Window config
{ {
title: 'Logs', title: 'Logs',
iconCls: 'logs', iconCls: 'silk-page_white_text',
layout:'border', layout:'border',
height: 480, height: 480,
width: 700, width: 700,
...@@ -39,46 +48,34 @@ function showWiSPUserLogsWindow(id) { ...@@ -39,46 +48,34 @@ function showWiSPUserLogsWindow(id) {
uxItems: [ uxItems: [
{ {
xtype: 'form', xtype: 'form',
id: 'search-form', id: formID,
title: 'Search', title: 'Search',
region: 'west', region: 'west',
border: true, border: true,
frame: true, frame: true,
defaultType: 'datefield',
height: 180, height: 180,
width: 320, width: 320,
labelWidth: 100, labelWidth: 100,
items: [ items: [
{ {
id: 'after', id: formPeriodKeyID,
name: 'after', xtype: 'textfield',
width: 180, name: 'periodkey',
fieldLabel: 'From', regex: /^\d{4}\-(0[1-9]|1(0|1|2))$/,
vtype: 'daterange', regexText: 'Please enter month in the format: YYYY-MM',
format: 'Y-m-d', height: 25,
value: firstOfMonth, width: 100,
endDateField: 'before' fieldLabel: 'Period',
}, value: currentPeriod
{
id: 'before',
name: 'before',
width: 180,
fieldLabel: 'To',
vtype: 'daterange',
format: 'Y-m-d',
value: firstOfNext,
startDateField: 'after'
} }
], ],
buttons: [ buttons: [
{ {
text: 'Search', text: 'Search',
id: 'formbtn', id: formSearchButtonID,
handler: function() { handler: function() {
// Pull in window, grid & form // Pull in window, grid & form
var mainWindow = this.ownerCt.ownerCt; var grid = Ext.getCmp(wispUserLogsWindow.gridPanelID);
var grid = Ext.getCmp(mainWindow.gridPanelID);
var form = mainWindow.getComponent('search-form');
// Grab store // Grab store
var store = grid.getStore(); var store = grid.getStore();
...@@ -87,18 +84,24 @@ function showWiSPUserLogsWindow(id) { ...@@ -87,18 +84,24 @@ function showWiSPUserLogsWindow(id) {
var gridFilters = grid.filters; var gridFilters = grid.filters;
var timestampFilter = gridFilters.getFilter('EventTimestamp'); var timestampFilter = gridFilters.getFilter('EventTimestamp');
// Grab form fields // Grab form field
var afterField = form.getForm().findField('after'); var periodKeyField = Ext.getCmp(formPeriodKeyID);
var beforeField = form.getForm().findField('before'); if (periodKeyField.isValid()) {
var periodKeyValue = periodKeyField.getValue();
// 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 // Set filter values from form
timestampFilter.setValue({ timestampFilter.setValue({
after: afterField.getValue(), after: dtSearchStart,
before: beforeField.getValue() before: dtSearchEnd
}); });
// Trigger store reload // Trigger store reload
store.reload(); store.reload();
}
} }
} }
], ],
...@@ -106,23 +109,24 @@ function showWiSPUserLogsWindow(id) { ...@@ -106,23 +109,24 @@ function showWiSPUserLogsWindow(id) {
}, },
{ {
xtype: 'form', xtype: 'form',
id: 'summary-form', id: summaryFormID,
region: 'center', region: 'center',
split: true, split: true,
border: true, border: false,
autoScroll: true, autoScroll: true,
defaultType: 'textarea', defaultType: 'textarea',
height: 180, height: 300,
width: 400, width: 400,
labelWidth: 80, labelWidth: 0,
items: [ items: [
{ {
id: 'summaryTotal', id: summaryTotalID,
name: 'summaryTotal', name: 'summaryTotal',
readOnly: true, readOnly: true,
height: 139, height: 300,
width: 275, width: 400,
fieldLabel: 'Summary', fieldLabel: 'Summary',
hideLabel: true,
fieldClass: 'font-family: monospace; font-size: 10px;', fieldClass: 'font-family: monospace; font-size: 10px;',
value: '' value: ''
} }
...@@ -190,11 +194,13 @@ function showWiSPUserLogsWindow(id) { ...@@ -190,11 +194,13 @@ function showWiSPUserLogsWindow(id) {
}, },
{ {
header: "Input Mbyte", header: "Input Mbyte",
dataIndex: 'AcctInputMbyte' dataIndex: 'AcctInput',
renderer: renderUsageFloat
}, },
{ {
header: "Output Mbyte", header: "Output Mbyte",
dataIndex: 'AcctOutputMbyte' dataIndex: 'AcctOutput',
renderer: renderUsageFloat
}, },
{ {
header: "Session Uptime", header: "Session Uptime",
...@@ -223,9 +229,9 @@ function showWiSPUserLogsWindow(id) { ...@@ -223,9 +229,9 @@ function showWiSPUserLogsWindow(id) {
filters: [ filters: [
{type: 'numeric', dataIndex: 'ID'}, {type: 'numeric', dataIndex: 'ID'},
{ {
type: 'date', type: 'date',
format: 'Y-m-d H:i:s', format: 'Y-m-d H:i:s',
dataIndex: 'EventTimestamp', dataIndex: 'EventTimestamp',
value: { value: {
after: firstOfMonth, after: firstOfMonth,
before: firstOfNext before: firstOfNext
...@@ -240,8 +246,8 @@ function showWiSPUserLogsWindow(id) { ...@@ -240,8 +246,8 @@ function showWiSPUserLogsWindow(id) {
{type: 'string', dataIndex: 'CalledStationID'}, {type: 'string', dataIndex: 'CalledStationID'},
{type: 'string', dataIndex: 'AcctSessionID'}, {type: 'string', dataIndex: 'AcctSessionID'},
{type: 'string', dataIndex: 'FramedIPAddress'}, {type: 'string', dataIndex: 'FramedIPAddress'},
{type: 'numeric', dataIndex: 'AcctInputMbyte'}, {type: 'numeric', dataIndex: 'AcctInput'},
{type: 'numeric', dataIndex: 'AcctOutputMbyte'}, {type: 'numeric', dataIndex: 'AcctOutput'},
{type: 'numeric', dataIndex: 'AcctSessionTime'}, {type: 'numeric', dataIndex: 'AcctSessionTime'},
{type: 'string', dataIndex: 'ConnectTermReason'} {type: 'string', dataIndex: 'ConnectTermReason'}
] ]
...@@ -251,13 +257,9 @@ function showWiSPUserLogsWindow(id) { ...@@ -251,13 +257,9 @@ function showWiSPUserLogsWindow(id) {
var store = Ext.getCmp(wispUserLogsWindow.gridPanelID).getStore(); var store = Ext.getCmp(wispUserLogsWindow.gridPanelID).getStore();
store.on('load',function() { store.on('load',function() {
var inputTotal = store.sum('AcctInputMbyte');
var outputTotal = store.sum('AcctOutputMbyte');
var uptimeTotal = store.sum('AcctSessionTime');
var searchForm = wispUserLogsWindow.getComponent('search-form'); // Fetch periodKey from form
var afterField = (searchForm.getForm().findField('after')).getValue(); var periodKeyField = (Ext.getCmp(formPeriodKeyID)).getValue();
var beforeField = (searchForm.getForm().findField('before')).getValue();
// Mask parent window // Mask parent window
wispUserLogsWindow.getEl().mask(); wispUserLogsWindow.getEl().mask();
...@@ -266,90 +268,53 @@ function showWiSPUserLogsWindow(id) { ...@@ -266,90 +268,53 @@ function showWiSPUserLogsWindow(id) {
wispUserLogsWindow, wispUserLogsWindow,
{ {
params: { params: {
From: afterField, PeriodKey: periodKeyField,
To: beforeField,
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password, SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype, SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPUserLogs', SOAPModule: 'WiSPUserLogs',
SOAPFunction: 'getWiSPUserLogsSummary', SOAPFunction: 'getWiSPUserLogsSummary',
SOAPParams: '0:ID,0:From,0:To' SOAPParams: '0:ID,0:PeriodKey'
}, },
customSuccess: function (result) { customSuccess: function (result) {
response = Ext.decode(result.responseText); response = Ext.decode(result.responseText);
// Traffic variables // Caps
var trafficCap = response.data.trafficCap; // value of -1: prepaid var trafficCap = response.data.trafficCap; // value of -1: prepaid
var trafficCurrentTopupUsed = response.data.trafficCurrentTopupUsed; // value of -1: no current topup
var trafficCurrentTopupCap = response.data.trafficCurrentTopupCap; // value of -1: no current topup
var trafficTopupRemaining = response.data.trafficTopupRemaining;
// Uptime variables
var uptimeCap = response.data.uptimeCap; // value of -1: prepaid var uptimeCap = response.data.uptimeCap; // value of -1: prepaid
// Usage
var trafficUsage = response.data.trafficUsage;
var uptimeUsage = response.data.uptimeUsage;
var uptimeCurrentTopupUsed = response.data.uptimeCurrentTopupUsed; // value of -1: no current topup // Topups
var uptimeCurrentTopupCap = response.data.uptimeCurrentTopupCap; // value of -1: no current topup var trafficTopups = response.data.trafficTopups;
var uptimeTopupRemaining = response.data.uptimeTopupRemaining; var uptimeTopups = response.data.uptimeTopups;
var totalTrafficTopups = response.data.TotalTrafficTopups;
// Total up traffic var totalUptimeTopups = response.data.TotalUptimeTopups;
var trafficTotalAllowed;
var validTrafficTopups;
if (trafficCurrentTopupCap > 0) {
validTrafficTopups = trafficCurrentTopupCap;
validTrafficTopups += trafficTopupRemaining;
} else {
validTrafficTopups = trafficTopupRemaining;
}
if (trafficCap < 0) {
trafficTotalAllowed = validTrafficTopups;
} else {
trafficTotalAllowed = trafficCap + validTrafficTopups;
}
// Traffic usage
var trafficUsage = inputTotal + outputTotal;
// Total up uptime
var uptimeTotalAllowed;
var validUptimeTopups;
if (uptimeCurrentTopupCap > 0) {
validUptimeTopups = uptimeCurrentTopupCap;
validUptimeTopups += uptimeTopupRemaining;
} else {
validUptimeTopups = uptimeTopupRemaining;
}
if (uptimeCap < 0) {
uptimeTotalAllowed = validUptimeTopups;
} else {
uptimeTotalAllowed = uptimeCap + validUptimeTopups;
}
// Get summary field
var form = wispUserLogsWindow.getComponent('summary-form');
var summaryTotal = form.getForm().findField('summaryTotal');
// Format string before printing // Format string before printing
var trafficString = ''; var trafficString = '';
// Prepaid traffic // Prepaid traffic
if (trafficCap == -1) { if (trafficCap == -1) {
trafficCap = 'Prepaid'; trafficCap = 'Prepaid';
trafficString += sprintf(' Traffic\nCap: %s MB Topup: %d MB\n'+ trafficString += sprintf('Traffic:\nCap: %s \nTopup balance for current month: %d MB\nTotal Topups: %d MB\nUsage: %d/%d MB\n',
'Usage: %d/%d MB\n=====================================\n', trafficCap,trafficTopups,totalTrafficTopups,trafficUsage,trafficTopups);
trafficCap,validTrafficTopups,trafficUsage,trafficTotalAllowed); trafficString += '---\n';
// Uncapped traffic // Uncapped traffic
} else if (trafficCap == 0) { } else if (trafficCap == 0) {
trafficString += sprintf(' Traffic\nCap: Uncapped Used: %d\n=====================================n', trafficString += sprintf('Traffic:\nCap: Uncapped\nUsage: %d MB\n',
trafficUsage); trafficUsage);
trafficString += '---\n';
// Capped traffic // Capped traffic
} else { } else {
trafficString += sprintf(' Traffic\nCap: %d MB Topup: %d MB\n'+ var combinedTrafficCap = trafficCap + trafficTopups;
'Usage: %d/%d MB\n=====================================\n', trafficString += sprintf('Traffic:\nCap: %d MB\nTopup balance for current month: %d MB\nTotal Topups: %d MB\n'+
trafficCap,validTrafficTopups,trafficUsage,trafficTotalAllowed); 'Usage: %d/%d MB\n',
trafficCap,trafficTopups,totalTrafficTopups,trafficUsage,combinedTrafficCap);
trafficString += '---\n';
} }
// Format string before printing // Format string before printing
...@@ -357,29 +322,64 @@ function showWiSPUserLogsWindow(id) { ...@@ -357,29 +322,64 @@ function showWiSPUserLogsWindow(id) {
// Prepaid uptime // Prepaid uptime
if (uptimeCap == -1) { if (uptimeCap == -1) {
uptimeCap = 'Prepaid'; uptimeCap = 'Prepaid';
uptimeString += sprintf(' Uptime\nCap: %s MB Topup: %d MB\n'+ uptimeString += sprintf('Uptime:\nCap: %s \nTopup balance for current month: %d Min\nTotal Topups: %d Min\n'+
'Usage: %d/%d MB', 'Usage: %d/%d Min\n',
uptimeCap,validUptimeTopups,uptimeTotal,uptimeTotalAllowed); uptimeCap,uptimeTopups,totalUptimeTopups,uptimeUsage,uptimeTopups);
uptimeString += '---\n';
// Uncapped uptime // Uncapped uptime
} else if (uptimeCap == 0) { } else if (uptimeCap == 0) {
uptimeString += sprintf(' Uptime\nCap: Uncapped Used: %d', uptimeString += sprintf('Uptime:\nCap: Uncapped\nUsage: %d Min\n',
uptimeTotal); uptimeUsage);
uptimeString += '---\n';
// Capped uptime // Capped uptime
} else { } else {
uptimeString += sprintf(' Uptime\nCap: %d MB Topup: %d MB\n'+ var combinedUptimeCap = uptimeCap + uptimeTopups;
'Usage: %d/%d MB', uptimeString += sprintf('Uptime:\nCap: %d Min\nTopup balance for current month: %d Min\nTotal Topups: %d Min\n'+
uptimeCap,validUptimeTopups,uptimeTotal,uptimeTotalAllowed); 'Usage: %d/%d Min\n',
uptimeCap,uptimeTopups,totalUptimeTopups,uptimeUsage,combinedUptimeCap);
uptimeString += '---\n';
} }
summaryTotal.setValue(trafficString+uptimeString); // Topup breakdown
var tTopups = response.data.AllTrafficTopups;
var uTopups = response.data.AllUptimeTopups;
// 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);
}
// Get summary field
var form = Ext.getCmp(summaryFormID);
var summaryField = Ext.getCmp(summaryTotalID);
summaryField.setValue(trafficString+uptimeString+topupString);
}, },
failure: function (result) { failure: function (result) {
Ext.MessageBox.alert('Failed', 'Couldn\'t fetch data: '+result.date); Ext.MessageBox.alert('Failed', 'Couldn\'t fetch data: '+result.date);
}, }
} }
); );
}); });
wispUserLogsWindow.show(); wispUserLogsWindow.show();
} }
// vim: ts=4 // vim: ts=4
/* /*
WiSP User Topups WiSP User Topups
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -24,12 +24,12 @@ function showWiSPUserTopupsWindow(userID) { ...@@ -24,12 +24,12 @@ function showWiSPUserTopupsWindow(userID) {
// Window config // Window config
{ {
title: "User Topups", title: "User Topups",
iconCls: 'silk-building', iconCls: 'silk-chart_bar',
width: 500, width: 500,
height: 335, height: 335,
minWidth: 500, minWidth: 500,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -38,22 +38,22 @@ function showWiSPUserTopupsWindow(userID) { ...@@ -38,22 +38,22 @@ function showWiSPUserTopupsWindow(userID) {
{ {
text:'Add', text:'Add',
tooltip:'Add topup', tooltip:'Add topup',
iconCls:'silk-building_add', iconCls:'silk-chart_bar_add',
handler: function() { handler: function() {
showWiSPUserTopupAddEditWindow(userID,0); showWiSPUserTopupAddEditWindow(wispUserTopupsWindow,userID,0);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit topup', tooltip:'Edit topup',
iconCls:'silk-building_edit', iconCls:'silk-chart_bar_edit',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(wispUserTopupsWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(wispUserTopupsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
if (selectedItem) { if (selectedItem) {
// If so display window // If so display window
showWiSPUserTopupAddEditWindow(userID,selectedItem.data.ID); showWiSPUserTopupAddEditWindow(wispUserTopupsWindow,userID,selectedItem.data.ID);
} else { } else {
wispUserTopupsWindow.getEl().mask(); wispUserTopupsWindow.getEl().mask();
...@@ -75,7 +75,7 @@ function showWiSPUserTopupsWindow(userID) { ...@@ -75,7 +75,7 @@ function showWiSPUserTopupsWindow(userID) {
{ {
text:'Remove', text:'Remove',
tooltip:'Remove topup', tooltip:'Remove topup',
iconCls:'silk-building_delete', iconCls:'silk-chart_bar_delete',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(wispUserTopupsWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(wispUserTopupsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
...@@ -135,7 +135,7 @@ function showWiSPUserTopupsWindow(userID) { ...@@ -135,7 +135,7 @@ function showWiSPUserTopupsWindow(userID) {
sortable: true, sortable: true,
dataIndex: 'ValidTo' dataIndex: 'ValidTo'
} }
]), ])
}, },
// Store config // Store config
{ {
...@@ -166,7 +166,7 @@ function showWiSPUserTopupsWindow(userID) { ...@@ -166,7 +166,7 @@ function showWiSPUserTopupsWindow(userID) {
// Display edit/add form // Display edit/add form
function showWiSPUserTopupAddEditWindow(userID,topupID) { function showWiSPUserTopupAddEditWindow(wispUserTopupsWindow,userID,topupID) {
var today = new Date(); var today = new Date();
var firstOfMonth = today.getFirstDateOfMonth(); var firstOfMonth = today.getFirstDateOfMonth();
var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1); var firstOfNext = today.getLastDateOfMonth().add(Date.DAY, 1);
...@@ -176,23 +176,43 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) { ...@@ -176,23 +176,43 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) {
// We doing an update // We doing an update
if (topupID) { if (topupID) {
icon = 'silk-building_edit'; icon = 'silk-chart_bar_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: topupID, params: {
SOAPFunction: 'updateWiSPUserTopup', ID: topupID,
SOAPParams: SOAPFunction: 'updateWiSPUserTopup',
'0:ID,0:Value,0:Type,'+ SOAPParams:
'0:ValidFrom,0:ValidTo' '0:ID,0:Value,0:Type,'+
'0:ValidFrom,0:ValidTo'
},
onSuccess: function() {
var store = Ext.getCmp(wispUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-building_add'; icon = 'silk-chart_bar_add';
submitAjaxConfig = { submitAjaxConfig = {
UserID: userID, params: {
SOAPFunction: 'createWiSPUserTopup', UserID: userID,
SOAPParams: SOAPFunction: 'createWiSPUserTopup',
'0:UserID,0:Value,0:Type,'+ SOAPParams:
'0:ValidFrom,0:ValidTo' '0:UserID,0:Value,0:Type,'+
'0:ValidFrom,0:ValidTo'
},
onSuccess: function() {
var store = Ext.getCmp(wispUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -248,6 +268,7 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) { ...@@ -248,6 +268,7 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) {
name: 'ValidFrom', name: 'ValidFrom',
id: 'ValidFrom', id: 'ValidFrom',
vtype: 'daterange', vtype: 'daterange',
disabledDates: ["(0(2|3|4|5|6|7|8|9)|1[0-9]|2[0-9]|3[0-1])$"],
value: firstOfMonth, value: firstOfMonth,
format: 'Y-m-d', format: 'Y-m-d',
endDateField: 'ValidTo' endDateField: 'ValidTo'
...@@ -258,11 +279,12 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) { ...@@ -258,11 +279,12 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) {
name: 'ValidTo', name: 'ValidTo',
id: 'ValidTo', id: 'ValidTo',
vtype: 'daterange', vtype: 'daterange',
disabledDates: ["(0(2|3|4|5|6|7|8|9)|1[0-9]|2[0-9]|3[0-1])$"],
value: firstOfNext, value: firstOfNext,
format: 'Y-m-d', format: 'Y-m-d',
startDateField: 'ValidFrom' startDateField: 'ValidFrom'
} }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -288,10 +310,10 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) { ...@@ -288,10 +310,10 @@ function showWiSPUserTopupAddEditWindow(userID,topupID) {
// Display edit/add form // Display remove form
function showWiSPUserTopupRemoveWindow(parent,id) { function showWiSPUserTopupRemoveWindow(wispUserTopupsWindow,id) {
// Mask parent window // Mask wispUserTopupsWindow window
parent.getEl().mask(); wispUserTopupsWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -305,7 +327,7 @@ function showWiSPUserTopupRemoveWindow(parent,id) { ...@@ -305,7 +327,7 @@ function showWiSPUserTopupRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(wispUserTopupsWindow,{
params: { params: {
id: id, id: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -314,13 +336,21 @@ function showWiSPUserTopupRemoveWindow(parent,id) { ...@@ -314,13 +336,21 @@ function showWiSPUserTopupRemoveWindow(parent,id) {
SOAPModule: 'WiSPUsers', SOAPModule: 'WiSPUsers',
SOAPFunction: 'removeWiSPUserTopup', SOAPFunction: 'removeWiSPUserTopup',
SOAPParams: 'id' SOAPParams: 'id'
},
customSuccess: function() {
var store = Ext.getCmp(wispUserTopupsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); wispUserTopupsWindow.getEl().unmask();
} }
} }
}); });
......
/* /*
WiSP Users WiSP Users
Copyright (C) 2007-2009, AllWorldIT Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -25,12 +25,12 @@ function showWiSPUserWindow() { ...@@ -25,12 +25,12 @@ function showWiSPUserWindow() {
{ {
title: "Users", title: "Users",
iconCls: 'silk-user', iconCls: 'silk-user',
width: 600, width: 600,
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -41,10 +41,10 @@ function showWiSPUserWindow() { ...@@ -41,10 +41,10 @@ function showWiSPUserWindow() {
tooltip:'Add user', tooltip:'Add user',
iconCls:'silk-user_add', iconCls:'silk-user_add',
handler: function() { handler: function() {
showWiSPUserAddEditWindow(); showWiSPUserAddEditWindow(WiSPUserWindow);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit user', tooltip:'Edit user',
...@@ -54,7 +54,7 @@ function showWiSPUserWindow() { ...@@ -54,7 +54,7 @@ function showWiSPUserWindow() {
// Check if we have selected item // Check if we have selected item
if (selectedItem) { if (selectedItem) {
// If so display window // If so display window
showWiSPUserAddEditWindow(selectedItem.data.ID); showWiSPUserAddEditWindow(WiSPUserWindow,selectedItem.data.ID);
} else { } else {
WiSPUserWindow.getEl().mask(); WiSPUserWindow.getEl().mask();
...@@ -104,7 +104,7 @@ function showWiSPUserWindow() { ...@@ -104,7 +104,7 @@ function showWiSPUserWindow() {
{ {
text:'Logs', text:'Logs',
tooltip:'User logs', tooltip:'User logs',
iconCls:'logs', iconCls: 'silk-page_white_text',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(WiSPUserWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(WiSPUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
...@@ -132,7 +132,7 @@ function showWiSPUserWindow() { ...@@ -132,7 +132,7 @@ function showWiSPUserWindow() {
{ {
text:'Topups', text:'Topups',
tooltip:'User topups', tooltip:'User topups',
iconCls:'silk-building', iconCls:'silk-chart_bar',
handler: function() { handler: function() {
var selectedItem = Ext.getCmp(WiSPUserWindow.gridPanelID).getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(WiSPUserWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item // Check if we have selected item
...@@ -170,11 +170,6 @@ function showWiSPUserWindow() { ...@@ -170,11 +170,6 @@ function showWiSPUserWindow() {
sortable: true, sortable: true,
dataIndex: 'Username' dataIndex: 'Username'
}, },
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
},
{ {
header: "First Name", header: "First Name",
sortable: true, sortable: true,
...@@ -194,6 +189,11 @@ function showWiSPUserWindow() { ...@@ -194,6 +189,11 @@ function showWiSPUserWindow() {
header: "Phone", header: "Phone",
sortable: true, sortable: true,
dataIndex: 'Phone' dataIndex: 'Phone'
},
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
} }
]), ]),
autoExpandColumn: 'Username' autoExpandColumn: 'Username'
...@@ -228,64 +228,177 @@ function showWiSPUserWindow() { ...@@ -228,64 +228,177 @@ function showWiSPUserWindow() {
// Display edit/add form // Display edit/add form
function showWiSPUserAddEditWindow(id) { function showWiSPUserAddEditWindow(WiSPUserWindow,id) {
var submitAjaxConfig; var submitAjaxConfig;
var editMode; var editMode;
var icon; var icon;
// Arrays for removed items
var RemovedAttributes = new Array();
var RemovedGroups = new Array();
// To identify newly inserted rows
var attributeInsertID = -1;
var groupInsertID = -1;
// Attribute record that can be added to below store
var attributeRecord = Ext.data.Record.create([
{name: 'ID'},
{name: 'Name'},
{name: 'Operator'},
{name: 'Value'},
{name: 'Modifier'}
]);
// Attribute store // Attribute store
var attributeStore; var attributeStore;
attributeStore = new Ext.data.SimpleStore({ // If this is an update we need to pull in record
fields: [ if (id) {
'name', 'operator', 'value', 'modifier' attributeStore = new Ext.ux.JsonStore({
], pruneModifiedRecords: true,
}); baseParams: {
// Attribute record that can be added to above store ID: id,
var attributeRecord = Ext.data.Record.create([ SOAPUsername: globalConfig.soap.username,
{name: 'name'}, SOAPPassword: globalConfig.soap.password,
{name: 'operator'}, SOAPAuthType: globalConfig.soap.authtype,
{name: 'value'}, SOAPModule: 'WiSPUsers',
{name: 'modifier'} SOAPFunction: 'getWiSPUserAttributes',
SOAPParams: 'ID'
}
});
} else {
attributeStore = new Ext.data.SimpleStore({
pruneModifiedRecords: true,
fields: ['ID', 'Name', 'Operator', 'Value', 'Modifer']
});
}
// Group record that can be added to below store
var groupRecord = Ext.data.Record.create([
{name: 'Name'}
]); ]);
// Group store // Group store
var groupStore; var groupStore;
groupStore = new Ext.data.SimpleStore({ // If this is an update we need to pull in record
fields: [ if (id) {
'name' groupStore = new Ext.ux.JsonStore({
], pruneModifiedRecords: true,
}); baseParams: {
// Group record that can be added to above store ID: id,
var groupRecord = Ext.data.Record.create([ SOAPUsername: globalConfig.soap.username,
{name: 'name'} SOAPPassword: globalConfig.soap.password,
]); SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPUsers',
SOAPFunction: 'getWiSPUserGroups',
SOAPParams: 'ID'
}
});
} else {
groupStore = new Ext.data.SimpleStore({
pruneModifiedRecords: true,
fields: [
'Name'
]
});
}
// We doing an update // We doing an update
if (id) { if (id) {
icon = 'silk-user_edit'; icon = 'silk-user_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: id, params: {
SOAPFunction: 'updateWiSPUser', ID: id,
SOAPParams: SOAPFunction: 'updateWiSPUser',
'0:ID,'+ SOAPParams:
'0:Username,'+ '0:ID,'+
'0:Password,'+ '0:Username,'+
'0:Firstname,'+ '0:Password,'+
'0:Lastname,'+ '0:Disabled,'+
'0:Phone,'+ '0:Firstname,'+
'0:LocationID,'+ '0:Lastname,'+
'0:Email' '0:Phone,'+
}; '0:LocationID,'+
'0:Attributes,'+
'0:Groups,'+
'0:Email,'+
'0:RGroups,'+
'0:RAttributes'
},
onSuccess: function() {
var store = Ext.getCmp(WiSPUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
},
hook: function() {
// Get modified attribute records
var attributes = attributeStore.getModifiedRecords();
// Get modified group records
var groups = groupStore.getModifiedRecords();
var ret = { };
// Set attributes we will be adding
for (var i = 0, len = attributes.length; i < len; i++) {
var attribute = attributes[i];
// Safe to add this attribute
ret['Attributes['+i+'][ID]'] = attribute.get('ID');
ret['Attributes['+i+'][Name]'] = attribute.get('Name');
ret['Attributes['+i+'][Operator]'] = attribute.get('Operator');
ret['Attributes['+i+'][Value]'] = attribute.get('Value');
ret['Attributes['+i+'][Modifier]'] = attribute.get('Modifier');
}
// Set groups we will be adding
for (var i = 0, len = groups.length; i < len; i++) {
var group = groups[i];
// Safe to add this attribute
ret['Groups['+i+'][Name]'] = group.get('Name');
}
// Add removed attributes
if ((id) && (RemovedAttributes.length > 0)) {
var c = 0;
var len = RemovedAttributes.length;
for (var i = 0; i < len; i++) {
// If this is a new add then the user has no attributes
if (RemovedAttributes[i] >= 0) {
ret['RAttributes['+c+']'] = RemovedAttributes[i];
c++;
}
}
}
// Add removed groups
if ((id) && (RemovedGroups.length > 0)) {
var c = 0;
var len = RemovedGroups.length;
for (var i = 0; i < len; i++) {
// If this is a new add then the user has no attributes
if (RemovedGroups[i] >= 0) {
ret['RGroups['+c+']'] = RemovedGroups[i];
c++;
}
}
}
return ret;
}
};
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-user_add'; icon = 'silk-user_add';
submitAjaxConfig = { submitAjaxConfig = {
params: { params: {
SOAPFunction: 'createWiSPUser', SOAPFunction: 'createWiSPUser',
SOAPParams: SOAPParams:
'0:Username,'+ '0:Username,'+
'0:Disabled,'+
'0:Password,'+ '0:Password,'+
'0:Firstname,'+ '0:Firstname,'+
'0:Lastname,'+ '0:Lastname,'+
...@@ -297,6 +410,14 @@ function showWiSPUserAddEditWindow(id) { ...@@ -297,6 +410,14 @@ function showWiSPUserAddEditWindow(id) {
'0:Number,'+ '0:Number,'+
'0:Prefix' '0:Prefix'
}, },
onSuccess: function() {
var store = Ext.getCmp(WiSPUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
},
hook: function() { hook: function() {
// Get modified attribute records // Get modified attribute records
...@@ -305,20 +426,24 @@ function showWiSPUserAddEditWindow(id) { ...@@ -305,20 +426,24 @@ function showWiSPUserAddEditWindow(id) {
var groups = groupStore.getModifiedRecords(); var groups = groupStore.getModifiedRecords();
var ret = { }; var ret = { };
// Loop and add to our hash // Set attributes we will be adding
for(var i = 0, len = attributes.length; i < len; i++){ for (var i = 0, len = attributes.length; i < len; i++) {
var attribute = attributes[i]; var attribute = attributes[i];
ret['Attributes['+i+'][Name]'] = attribute.get('name');
ret['Attributes['+i+'][Operator]'] = attribute.get('operator'); // Safe to add this attribute
ret['Attributes['+i+'][Value]'] = attribute.get('value'); ret['Attributes['+i+'][ID]'] = attribute.get('ID');
ret['Attributes['+i+'][Modifier]'] = attribute.get('modifier'); ret['Attributes['+i+'][Name]'] = attribute.get('Name');
} ret['Attributes['+i+'][Operator]'] = attribute.get('Operator');
// Loop and add to our hash ret['Attributes['+i+'][Value]'] = attribute.get('Value');
for(var i = 0, len = groups.length; i < len; i++){ ret['Attributes['+i+'][Modifier]'] = attribute.get('Modifier');
}
// Set groups we will be adding
for (var i = 0, len = groups.length; i < len; i++) {
var group = groups[i]; var group = groups[i];
ret['Groups['+i+'][Name]'] = group.get('name');
}
// Safe to add this attribute
ret['Groups['+i+'][Name]'] = group.get('Name');
}
return ret; return ret;
} }
}; };
...@@ -328,14 +453,13 @@ function showWiSPUserAddEditWindow(id) { ...@@ -328,14 +453,13 @@ function showWiSPUserAddEditWindow(id) {
// Build the attribute editor grid // Build the attribute editor grid
var attributeEditor = new Ext.grid.EditorGridPanel({ var attributeEditor = new Ext.grid.EditorGridPanel({
plain: true, plain: true,
height: 120, autoHeight: true,
autoScroll: true,
// Set row selection model // Set row selection model
selModel: new Ext.grid.RowSelectionModel({ selModel: new Ext.grid.RowSelectionModel({
singleSelect: true singleSelect: true
}), }),
// Inline toolbars // Inline toolbars
tbar: [ tbar: [
{ {
...@@ -344,15 +468,17 @@ function showWiSPUserAddEditWindow(id) { ...@@ -344,15 +468,17 @@ function showWiSPUserAddEditWindow(id) {
iconCls:'silk-table_add', iconCls:'silk-table_add',
handler: function() { handler: function() {
var newAttrStoreRecord = new attributeRecord({ var newAttrStoreRecord = new attributeRecord({
name: '', ID: attributeInsertID,
operator: '', Name: '',
value: '', Operator: '',
modifier: '' Value: '',
Modifier: ''
}); });
attributeStore.insert(0,newAttrStoreRecord); attributeStore.insert(0,newAttrStoreRecord);
attributeInsertID -= 1;
} }
}, },
'-', '-',
{ {
text:'Remove', text:'Remove',
tooltip:'Remove attribute', tooltip:'Remove attribute',
...@@ -362,9 +488,14 @@ function showWiSPUserAddEditWindow(id) { ...@@ -362,9 +488,14 @@ function showWiSPUserAddEditWindow(id) {
// Check if we have selected item // Check if we have selected item
if (selectedItem) { if (selectedItem) {
// If so remove // Get selected item value
var attributeID = selectedItem.get('ID');
// Remove selected
attributeStore.remove(selectedItem); attributeStore.remove(selectedItem);
// Add to list of removed attributes
RemovedAttributes.push(attributeID);
} else { } else {
wispUserFormWindow.getEl().mask(); wispUserFormWindow.getEl().mask();
...@@ -381,40 +512,47 @@ function showWiSPUserAddEditWindow(id) { ...@@ -381,40 +512,47 @@ function showWiSPUserAddEditWindow(id) {
}); });
} }
} }
}, }
], ],
cm: new Ext.grid.ColumnModel([ cm: new Ext.grid.ColumnModel([
{ {
id: 'name', id: 'ID',
header: 'ID',
dataIndex: 'ID',
hidden: true,
width: 30
},
{
id: 'Name',
header: 'Name', header: 'Name',
dataIndex: 'name', dataIndex: 'Name',
width: 150, width: 150,
editor: new Ext.form.ComboBox({ editor: new Ext.form.ComboBox({
allowBlank: false, allowBlank: false,
mode: 'local', mode: 'local',
store: [ store: [
[ 'SMRadius-Capping-Traffic-Limit', 'Traffic Limit' ], [ 'SMRadius-Capping-Traffic-Limit', 'Traffic Limit' ],
[ 'SMRadius-Capping-Uptime-Limit', 'Uptime Limit' ], [ 'SMRadius-Capping-Uptime-Limit', 'Uptime Limit' ],
[ 'Framed-IP-Address', 'IP Address' ], [ 'Framed-IP-Address', 'IP Address' ],
[ 'Calling-Station-Id', 'MAC Address' ] [ 'Calling-Station-Id', 'MAC Address' ]
], ],
triggerAction: 'all', triggerAction: 'all',
editable: false, editable: false
}) })
}, },
{ {
id: 'operator', id: 'Operator',
header: 'Operator', header: 'Operator',
dataIndex: 'operator', dataIndex: 'Operator',
width: 300, width: 300,
editor: new Ext.form.ComboBox({ editor: new Ext.form.ComboBox({
allowBlank: false, allowBlank: false,
mode: 'local', mode: 'local',
store: [ store: [
[ '=', 'Add as reply if unique' ], [ '=', 'Add as reply if unique' ],
[ ':=', 'Set configuration value' ], [ ':=', 'Set configuration value' ],
[ '==', 'Match value in request' ], [ '==', 'Match value in request' ],
[ '+=', 'Add reply and set configuration' ], [ '+=', 'Add reply and set configuration' ],
[ '!=', 'Inverse match value in request' ], [ '!=', 'Inverse match value in request' ],
[ '<', 'Match less-than value in request' ], [ '<', 'Match less-than value in request' ],
...@@ -428,28 +566,28 @@ function showWiSPUserAddEditWindow(id) { ...@@ -428,28 +566,28 @@ function showWiSPUserAddEditWindow(id) {
[ '||==', 'Match any of these values in request' ] [ '||==', 'Match any of these values in request' ]
], ],
triggerAction: 'all', triggerAction: 'all',
editable: true, editable: true
}) })
}, },
{ {
id: 'value', id: 'Value',
header: 'Value', header: 'Value',
dataIndex: 'value', dataIndex: 'Value',
width: 100, width: 100,
editor: new Ext.form.TextField({ editor: new Ext.form.TextField({
allowBlank: false, allowBlank: false
}) })
}, },
{ {
id: 'modifier', id: 'Modifier',
header: 'Modifier', header: 'Modifier',
dataIndex: 'modifier', dataIndex: 'Modifier',
width: 80, width: 80,
editor: new Ext.form.ComboBox({ editor: new Ext.form.ComboBox({
allowBlank: false, allowBlank: false,
mode: 'local', mode: 'local',
store: [ store: [
[ 'Seconds', 'Seconds' ], [ 'Seconds', 'Seconds' ],
[ 'Minutes', 'Minutes' ], [ 'Minutes', 'Minutes' ],
[ 'Hours', 'Hours' ], [ 'Hours', 'Hours' ],
[ 'Days', 'Days' ], [ 'Days', 'Days' ],
...@@ -457,21 +595,32 @@ function showWiSPUserAddEditWindow(id) { ...@@ -457,21 +595,32 @@ function showWiSPUserAddEditWindow(id) {
[ 'Months', 'Months' ], [ 'Months', 'Months' ],
[ 'MBytes', 'MBytes' ], [ 'MBytes', 'MBytes' ],
[ 'GBytes', 'GBytes' ], [ 'GBytes', 'GBytes' ],
[ 'TBytes', 'TBytes' ], [ 'TBytes', 'TBytes' ]
], ],
triggerAction: 'all', triggerAction: 'all',
editable: true, editable: true
}) })
}, }
]), ]),
store: attributeStore store: attributeStore
}); });
// Editor combobox ID
var editorComboBoxID = Ext.id();
// Render display value
editorComboBoxRenderer = function(editorComboBoxID) {
var combo = Ext.getCmp(editorComboBoxID);
return function(value){
var record = combo.findRecord(combo.valueField, value);
return record ? record.get(combo.displayField) : value;
}
}
// Build the group editor grid // Build the group editor grid
var groupEditor = new Ext.grid.EditorGridPanel({ var groupEditor = new Ext.grid.EditorGridPanel({
plain: true, plain: true,
height: 120, autoHeight: true,
autoScroll: true,
// Set row selection model // Set row selection model
selModel: new Ext.grid.RowSelectionModel({ selModel: new Ext.grid.RowSelectionModel({
...@@ -486,12 +635,14 @@ function showWiSPUserAddEditWindow(id) { ...@@ -486,12 +635,14 @@ function showWiSPUserAddEditWindow(id) {
iconCls:'silk-group_add', iconCls:'silk-group_add',
handler: function() { handler: function() {
var newGroupStoreRecord = new groupRecord({ var newGroupStoreRecord = new groupRecord({
name: '' ID: groupInsertID,
Name: ''
}); });
groupStore.insert(0,newGroupStoreRecord); groupStore.insert(0,newGroupStoreRecord);
groupInsertID -= 1;
} }
}, },
'-', '-',
{ {
text:'Remove', text:'Remove',
tooltip:'Remove group', tooltip:'Remove group',
...@@ -501,9 +652,14 @@ function showWiSPUserAddEditWindow(id) { ...@@ -501,9 +652,14 @@ function showWiSPUserAddEditWindow(id) {
// Check if we have selected item // Check if we have selected item
if (selectedItem) { if (selectedItem) {
// If so remove // Get selected item value
var groupID = selectedItem.get('ID');
// Remove selected
groupStore.remove(selectedItem); groupStore.remove(selectedItem);
// Add to our removed groups hash
RemovedGroups.push(groupID);
} else { } else {
wispUserFormWindow.getEl().mask(); wispUserFormWindow.getEl().mask();
...@@ -520,16 +676,24 @@ function showWiSPUserAddEditWindow(id) { ...@@ -520,16 +676,24 @@ function showWiSPUserAddEditWindow(id) {
}); });
} }
} }
}, }
], ],
cm: new Ext.grid.ColumnModel([ cm: new Ext.grid.ColumnModel([
{ {
id: 'name', id: 'ID',
header: 'ID',
dataIndex: 'ID',
hidden: true,
width: 30
},
{
id: 'Name',
header: 'Name', header: 'Name',
dataIndex: 'name', dataIndex: 'Name',
width: 150, width: 150,
editor: new Ext.form.ComboBox({ editor: new Ext.form.ComboBox({
id: editorComboBoxID,
allowBlank: false, allowBlank: false,
store: new Ext.ux.JsonStore({ store: new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" }, sortInfo: { field: "Name", direction: "ASC" },
...@@ -547,12 +711,25 @@ function showWiSPUserAddEditWindow(id) { ...@@ -547,12 +711,25 @@ function showWiSPUserAddEditWindow(id) {
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
editable: false editable: false
}) }),
}, renderer: editorComboBoxRenderer(editorComboBoxID)
}
]), ]),
store: groupStore store: groupStore
}); });
var locationStore = new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPUsers',
SOAPFunction: 'getWiSPLocations',
SOAPParams: '__null,__search'
}
})
// Create window // Create window
var wispUserFormWindow = new Ext.ux.GenericFormWindow( var wispUserFormWindow = new Ext.ux.GenericFormWindow(
// Window config // Window config
...@@ -561,10 +738,10 @@ function showWiSPUserAddEditWindow(id) { ...@@ -561,10 +738,10 @@ function showWiSPUserAddEditWindow(id) {
iconCls: icon, iconCls: icon,
width: 700, width: 700,
height: 342, height: 362,
minWidth: 700, minWidth: 700,
minHeight: 342 minHeight: 362
}, },
// Form panel config // Form panel config
{ {
...@@ -579,16 +756,20 @@ function showWiSPUserAddEditWindow(id) { ...@@ -579,16 +756,20 @@ function showWiSPUserAddEditWindow(id) {
{ {
fieldLabel: 'Username', fieldLabel: 'Username',
name: 'Username', name: 'Username',
vtype: 'usernamePart', vtype: 'usernameRadius',
maskRe: usernamePartRe, maskRe: usernameRadiusPartRe,
allowBlank: true, allowBlank: true
}, },
{ {
fieldLabel: 'Password', fieldLabel: 'Password',
name: 'Password', name: 'Password',
vtype: 'usernamePart', allowBlank: true
maskRe: usernamePartRe, },
allowBlank: true, {
fieldLabel: 'Disabled',
name: 'Disabled',
xtype: 'checkbox',
inputValue: '1'
}, },
{ {
xtype: 'tabpanel', xtype: 'tabpanel',
...@@ -596,11 +777,12 @@ function showWiSPUserAddEditWindow(id) { ...@@ -596,11 +777,12 @@ function showWiSPUserAddEditWindow(id) {
deferredRender: false, // Load all panels! deferredRender: false, // Load all panels!
activeTab: 0, activeTab: 0,
height: 200, height: 200,
maxHeight: 200,
defaults: { defaults: {
layout: 'form', layout: 'form',
bodyStyle: 'padding: 10px;' bodyStyle: 'padding: 10px;'
}, },
items: [ items: [
{ {
title: 'Personal', title: 'Personal',
...@@ -611,13 +793,11 @@ function showWiSPUserAddEditWindow(id) { ...@@ -611,13 +793,11 @@ function showWiSPUserAddEditWindow(id) {
{ {
fieldLabel: 'First Name', fieldLabel: 'First Name',
name: 'Firstname', name: 'Firstname',
vtype: 'usernamePart',
allowBlank: true allowBlank: true
}, },
{ {
fieldLabel: 'Last Name', fieldLabel: 'Last Name',
name: 'Lastname', name: 'Lastname',
vtype: 'usernamePart',
allowBlank: true allowBlank: true
}, },
{ {
...@@ -638,30 +818,21 @@ function showWiSPUserAddEditWindow(id) { ...@@ -638,30 +818,21 @@ function showWiSPUserAddEditWindow(id) {
allowBlank: true, allowBlank: true,
width: 140, width: 140,
store: new Ext.ux.JsonStore({ store: locationStore,
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'WiSPUsers',
SOAPFunction: 'getWiSPLocations',
SOAPParams: '__null,__search'
}
}),
displayField: 'Name', displayField: 'Name',
valueField: 'ID', valueField: 'ID',
hiddenName: 'LocationID', hiddenName: 'LocationID',
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
editable: false editable: false
}, }
] ]
}, },
{ {
title: 'Groups', title: 'Groups',
iconCls: 'silk-group', iconCls: 'silk-group',
layout: 'form', layout: 'form',
autoScroll: true,
defaultType: 'textfield', defaultType: 'textfield',
items: [ items: [
groupEditor groupEditor
...@@ -671,6 +842,7 @@ function showWiSPUserAddEditWindow(id) { ...@@ -671,6 +842,7 @@ function showWiSPUserAddEditWindow(id) {
title: 'Attributes', title: 'Attributes',
iconCls: 'silk-table', iconCls: 'silk-table',
layout: 'form', layout: 'form',
autoScroll: true,
defaultType: 'textfield', defaultType: 'textfield',
items: [ items: [
attributeEditor attributeEditor
...@@ -685,19 +857,19 @@ function showWiSPUserAddEditWindow(id) { ...@@ -685,19 +857,19 @@ function showWiSPUserAddEditWindow(id) {
{ {
fieldLabel: 'Prefix', fieldLabel: 'Prefix',
name: 'Prefix', name: 'Prefix',
allowBlank: true, allowBlank: true
}, },
{ {
fieldLabel: 'Number', fieldLabel: 'Number',
name: 'Number', name: 'Number',
vtype: 'number', vtype: 'number',
allowBlank: true, allowBlank: true
}, }
] ]
}, }
] ]
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -716,16 +888,19 @@ function showWiSPUserAddEditWindow(id) { ...@@ -716,16 +888,19 @@ function showWiSPUserAddEditWindow(id) {
SOAPParams: 'ID' SOAPParams: 'ID'
} }
}); });
locationStore.load();
attributeStore.load();
groupStore.load();
} }
} }
// Display edit/add form // Display remove form
function showWiSPUserRemoveWindow(parent,id) { function showWiSPUserRemoveWindow(WiSPUserWindow,id) {
// Mask parent window // Mask WiSPUserWindow window
parent.getEl().mask(); WiSPUserWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -739,7 +914,7 @@ function showWiSPUserRemoveWindow(parent,id) { ...@@ -739,7 +914,7 @@ function showWiSPUserRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(WiSPUserWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -748,13 +923,21 @@ function showWiSPUserRemoveWindow(parent,id) { ...@@ -748,13 +923,21 @@ function showWiSPUserRemoveWindow(parent,id) {
SOAPModule: 'WiSPUsers', SOAPModule: 'WiSPUsers',
SOAPFunction: 'removeWiSPUser', SOAPFunction: 'removeWiSPUser',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(WiSPUserWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); WiSPUserWindow.getEl().unmask();
} }
} }
}); });
......
...@@ -56,6 +56,6 @@ ...@@ -56,6 +56,6 @@
background-image: url(details.gif); background-image: url(details.gif);
} }
.x-resizable-pinned .x-resizable-handle-south{ .x-resizable-pinned .x-resizable-handle-south{
background:url(resources/extjs/images/default/sizer/s-handle-dark.gif); background:url(awitef/resources/extjs/images/default/sizer/s-handle-dark.gif);
background-position: top; background-position: top;
} }
<?php <?php
# Authentication class # Authentication class
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
......
<?php <?php
# User Control Panel UI Config # User Control Panel UI Config
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
......
<?php <?php
# Database Interface # Database Interface
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
......
<?php <?php
# Footer of page # Footer of page
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
?> ?>
<div class="copyright">SMRadius - Copyright &copy; 2007-2009, <a href="http://www.allworldit.com" ?>AllWorldIT</a></div> <div class="copyright">SMRadius - Copyright &copy; 2007-2011, <a href="http://www.allworldit.com" ?>AllWorldIT</a></div>
<br /> <br />
</body> </body>
......
<?php <?php
# Top part of radius control panel # Top part of radius control panel
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
......
<?php <?php
# Misc functions we can use # Misc functions we can use
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
......
<?php <?php
# Web User UI PRE # Web User UI PRE
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
......
<?php <?php
# Radius term code mappings # Radius term code mappings
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -23,38 +23,54 @@ ...@@ -23,38 +23,54 @@
function strRadiusTermCode($errCode) { function strRadiusTermCode($errCode) {
if (is_numeric($errCode)) { if (is_numeric($errCode)) {
# Terminate codes RFC 2866
switch ($errCode) { switch ($errCode) {
case 0:
return "Still logged in";
case 45: # Unknown
case 46: # Unknown
case 63: # Unknown
case 1: case 1:
return "User request"; return "User Request";
case 2: case 2:
case 816: # TCP connection reset? unknown return "Lost Carrier";
return "Carrier loss"; case 3:
return "Lost Service";
case 4:
return "Idle Timeout";
case 5: case 5:
return "Session timeout"; return "Session Timeout";
case 6: # Admin reset case 6:
case 10: # NAS request return "Admin Reset";
case 11: # NAS reboot case 7:
case 831: # NAS request? unknown return "Admin Reboot";
case 841: # NAS request? unknown case 8:
return "Router reset/reboot"; return "Port Error";
case 8: # Port error case 9:
return "Port error"; return "NAS Error";
case 180: # Unknown case 10:
return "Local hangup"; return "NAS Request";
case 827: # Unknown case 11:
return "Service unavailable"; return "NAS Reboot";
case 12:
return "Port Unneeded";
case 13:
return "Port Preempted";
case 14:
return "Port Suspended";
case 15:
return "Service Unavailable";
case 16:
return "Callback";
case 17:
return "User Error";
case 18:
return "Host Request";
default: default:
return "Unkown"; return "Unkown";
} }
} else { } else {
return "Unknown"; switch ($errCode) {
case NULL:
return "Still logged in";
default:
return "Unkown";
}
} }
} }
......
<?php <?php
# Versioning for this interface # Versioning for this interface
# Copyright (C) 2007-2009, AllWorldIT # Copyright (C) 2007-2015, AllWorldIT
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
$VERSION = "0.4.0b1"; $VERSION = "0.0.3a";
# vim: ts=4 # vim: ts=4
?> ?>