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