Newer
Older
var AdminUserGroupsWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Groups",
width: 600,
height: 335,
minWidth: 600,
minHeight: 335,
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add group',
iconCls:'add',
handler: function() {
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
}
},
'-',
{
text:'Remove',
tooltip:'Remove group',
iconCls:'remove',
handler: function() {
var selectedItem = AdminUserGroupsWindow.getComponent('gridpanel').getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminUserGroupRemoveWindow(AdminUserGroupsWindow,selectedItem.data.ID);
} else {
AdminUserGroupsWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No group selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminUserGroupsWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'getAdminUserGroups',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'}
]
}
);
AdminUserGroupsWindow.show();
}
// Display edit/add form
function showAdminUserGroupAddWindow(userID,id) {
var submitAjaxConfig;
// We doing an update
if (id) {
submitAjaxConfig = {
ID: id,
SOAPFunction: 'updateAdminGroup',
SOAPParams:
'0:ID,'+
};
// We doing an Add
} else {
submitAjaxConfig = {
UserID: userID,
SOAPFunction: 'addAdminUserGroup',
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
};
}
// Create window
var adminGroupFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Group Information",
width: 475,
height: 260,
minWidth: 475,
minHeight: 260
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups'
},
items: [
{
xtype: 'combo',
//id: 'combo',
fieldLabel: 'Group',
name: 'Group',
allowBlank: false,
width: 160,
store: new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'getAdminGroups',
SOAPParams: '__null,__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'GroupID',
forceSelection: true,
triggerAction: 'all',
editable: false
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
},
],
},
// Submit button config
submitAjaxConfig
);
adminGroupFormWindow.show();
if (id) {
adminGroupFormWindow.getComponent('formpanel').load({
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups',
SOAPFunction: 'getAdminGroup',
SOAPParams: 'ID'
}
});
}
}
// Display edit/add form
function showAdminUserGroupRemoveWindow(parent,id) {
// Mask parent window
parent.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to unlink this group?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(parent,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'removeAdminUserGroup',