Skip to content
Snippets Groups Projects
Commit 1c068cf7 authored by Robert Anderson's avatar Robert Anderson
Browse files

Added grid panel for groups with groups dropdown menu

Added Add Many tab for later use
parent 4928fea3
No related branches found
No related tags found
No related merge requests found
...@@ -202,6 +202,18 @@ function showWiSPUserAddEditWindow(id) { ...@@ -202,6 +202,18 @@ function showWiSPUserAddEditWindow(id) {
{name: 'modifier'} {name: 'modifier'}
]); ]);
// 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'}
]);
// We doing an update // We doing an update
if (id) { if (id) {
submitAjaxConfig = { submitAjaxConfig = {
...@@ -214,11 +226,7 @@ function showWiSPUserAddEditWindow(id) { ...@@ -214,11 +226,7 @@ function showWiSPUserAddEditWindow(id) {
'0:Firstname,'+ '0:Firstname,'+
'0:Lastname,'+ '0:Lastname,'+
'0:Phone,'+ '0:Phone,'+
'0:Email,'+ '0:Email'
'0:MACAddress,'+
'0:IPAddress,'+
'0:Datalimit,'+
'0:Uptimelimit'
}; };
// We doing an Add // We doing an Add
...@@ -233,12 +241,15 @@ function showWiSPUserAddEditWindow(id) { ...@@ -233,12 +241,15 @@ function showWiSPUserAddEditWindow(id) {
'0:Lastname,'+ '0:Lastname,'+
'0:Phone,'+ '0:Phone,'+
'0:Email,'+ '0:Email,'+
'0:Attributes' '0:Attributes,'+
'0:Groups'
}, },
hook: function() { hook: function() {
// Get modified records // Get modified attribute records
var attributes = attributeStore.getModifiedRecords(); var attributes = attributeStore.getModifiedRecords();
// Get modified group records
var groups = groupStore.getModifiedRecords();
var ret = { }; var ret = { };
// Loop and add to our hash // Loop and add to our hash
...@@ -249,6 +260,11 @@ function showWiSPUserAddEditWindow(id) { ...@@ -249,6 +260,11 @@ function showWiSPUserAddEditWindow(id) {
ret['Attributes['+i+'][Value]'] = attribute.get('value'); ret['Attributes['+i+'][Value]'] = attribute.get('value');
ret['Attributes['+i+'][Modifier]'] = attribute.get('modifier'); ret['Attributes['+i+'][Modifier]'] = attribute.get('modifier');
} }
// Loop and add to our hash
for(var i = 0, len = groups.length; i < len; i++){
var group = groups[i];
ret['Groups['+i+'][Name]'] = group.get('name');
}
return ret; return ret;
} }
...@@ -398,6 +414,91 @@ function showWiSPUserAddEditWindow(id) { ...@@ -398,6 +414,91 @@ function showWiSPUserAddEditWindow(id) {
store: attributeStore store: attributeStore
}); });
// Build the attribute editor grid
var groupEditor = new Ext.grid.EditorGridPanel({
plain: true,
height: 150,
autoScroll: true,
// Set row selection model
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add group',
iconCls:'add',
handler: function() {
var newGroupStoreRecord = new groupRecord({
name: ''
});
groupStore.insert(0,newGroupStoreRecord);
}
},
'-',
{
text:'Remove',
tooltip:'Remove group',
iconCls:'remove',
handler: function() {
var selectedItem = groupEditor.getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so remove
groupStore.remove(selectedItem);
} else {
wispUserFormWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No group selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
wispUserFormWindow.getEl().unmask();
}
});
}
}
},
],
cm: new Ext.grid.ColumnModel([
{
id: 'name',
header: 'Name',
dataIndex: 'name',
width: 150,
editor: new Ext.form.ComboBox({
allowBlank: false,
store: new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'getAdminGroups',
SOAPParams: '__null,__search'
}
}),
displayField: 'Name',
valueField: 'ID',
forceSelection: true,
triggerAction: 'all',
editable: false
})
},
]),
store: groupStore
});
// Create window // Create window
var wispUserFormWindow = new Ext.ux.GenericFormWindow( var wispUserFormWindow = new Ext.ux.GenericFormWindow(
...@@ -477,6 +578,14 @@ function showWiSPUserAddEditWindow(id) { ...@@ -477,6 +578,14 @@ function showWiSPUserAddEditWindow(id) {
} }
] ]
}, },
{
title: 'Groups',
layout: 'form',
defaultType: 'textfield',
items: [
groupEditor
]
},
{ {
title: 'Attributes', title: 'Attributes',
layout: 'form', layout: 'form',
...@@ -485,6 +594,27 @@ function showWiSPUserAddEditWindow(id) { ...@@ -485,6 +594,27 @@ function showWiSPUserAddEditWindow(id) {
attributeEditor attributeEditor
] ]
}, },
{
title: 'Add Many',
layout: 'form',
defaultType: 'textfield',
items: [
{
fieldLabel: 'Prefix',
name: 'Prefix',
vtype: 'usernamePart',
maskRe: usernamePartRe,
allowBlank: true,
},
{
fieldLabel: 'Number',
name: 'Number',
vtype: 'usernamePart',
maskRe: usernamePartRe,
allowBlank: true,
},
]
},
] ]
}, },
], ],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment