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 2098 additions and 351 deletions
<?php <?php
# JSON interface # JSON 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
...@@ -153,5 +153,37 @@ class json_response { ...@@ -153,5 +153,37 @@ class json_response {
} }
} }
function jsonSuccess($name = 'Result',$type = 'int',$value = 0) {
# Build response
$res = new json_response;
$res->addField($name,$type);
$res->parseHash(array(
$name => $value
));
# Export
echo json_encode($res->export());
}
function jsonError($code,$reason) {
# Build response
$res = new json_response;
$res->setStatus(-1);
$res->addField('ErrorCode','int');
$res->addField('ErrorReason','string');
$res->parseHash(array(
'ErrorCode' => $code,
'ErrorReason' => $reason
));
# Export
echo json_encode($res->export());
}
# vim: ts=4 # vim: ts=4
<?php <?php
# Web Admin UI Config # Web Admin 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
...@@ -74,9 +74,13 @@ function DBSelect($query,$args = array()) ...@@ -74,9 +74,13 @@ function DBSelect($query,$args = array())
{ {
global $db; global $db;
# Replace table prefix template
$result = ReplacePrefix($query, $args);
$rawQuery = $result[0]; $rawArgs = $result[1];
# Try prepare, and catch exceptions # Try prepare, and catch exceptions
try { try {
$stmt = $db->prepare($query); $stmt = $db->prepare($rawQuery);
} catch (PDOException $e) { } catch (PDOException $e) {
return $e->getMessage(); return $e->getMessage();
...@@ -84,7 +88,7 @@ function DBSelect($query,$args = array()) ...@@ -84,7 +88,7 @@ function DBSelect($query,$args = array())
} }
# Execute query # Execute query
$res = $stmt->execute($args); $res = $stmt->execute($rawArgs);
if ($res === FALSE) { if ($res === FALSE) {
return $stmt->errorInfo(); return $stmt->errorInfo();
} }
...@@ -104,9 +108,13 @@ function DBDo($command,$args = array()) ...@@ -104,9 +108,13 @@ function DBDo($command,$args = array())
{ {
global $db; global $db;
# Replace table prefix template
$result = ReplacePrefix($command, $args);
$rawCommand = $result[0]; $rawArgs = $result[1];
# Try prepare, and catch exceptions # Try prepare, and catch exceptions
try { try {
$stmt = $db->prepare($command); $stmt = $db->prepare($rawCommand);
} catch (PDOException $e) { } catch (PDOException $e) {
return $e->getMessage(); return $e->getMessage();
...@@ -114,7 +122,7 @@ function DBDo($command,$args = array()) ...@@ -114,7 +122,7 @@ function DBDo($command,$args = array())
} }
# Execute query # Execute query
$res = $stmt->execute($args); $res = $stmt->execute($rawArgs);
if ($res === FALSE) { if ($res === FALSE) {
return $stmt->errorInfo(); return $stmt->errorInfo();
} }
...@@ -134,7 +142,11 @@ function DBSelectNumResults($query,$args = array()) ...@@ -134,7 +142,11 @@ function DBSelectNumResults($query,$args = array())
global $db; global $db;
$res = DBSelect("SELECT COUNT(*) AS num_results $query",$args); # Replace table prefix template
$result = ReplacePrefix($query, $args);
$rawQuery = $result[0]; $rawArgs = $result[1];
$res = DBSelect("SELECT COUNT(*) AS num_results $rawQuery",$rawArgs);
if (!is_object($res)) { if (!is_object($res)) {
return $res; return $res;
} }
...@@ -373,6 +385,7 @@ function DBSelectSearch($query,$search,$filters,$sorts) { ...@@ -373,6 +385,7 @@ function DBSelectSearch($query,$search,$filters,$sorts) {
# Select row count, pull out "SELECT .... " as we replace this in the NumResults query # Select row count, pull out "SELECT .... " as we replace this in the NumResults query
$queryCount = $query; $queryCount = preg_replace("/^\s*SELECT\s.*\sFROM/is","FROM",$queryCount); $queryCount = $query; $queryCount = preg_replace("/^\s*SELECT\s.*\sFROM/is","FROM",$queryCount);
$numResults = DBSelectNumResults("$queryCount $sqlWhere"); $numResults = DBSelectNumResults("$queryCount $sqlWhere");
if (!isset($numResults)) { if (!isset($numResults)) {
return array(NULL,"Backend database query 1 failed"); return array(NULL,"Backend database query 1 failed");
...@@ -457,4 +470,32 @@ function DBRollback() ...@@ -457,4 +470,32 @@ function DBRollback()
$db = connect_db(); $db = connect_db();
## @fn ReplacePrefix($query,$args)
# Return raw query and args based on table prefix
#
# @param query Query string
# @param args Array of arguments
#
# @return string rawQuery, array rawArgs
function ReplacePrefix($query, $args = array())
{
global $DB_TABLE_PREFIX;
# Fetch table prefix from config
$table_prefix = isset($DB_TABLE_PREFIX) ? $DB_TABLE_PREFIX : "";
# Replace query
$rawQuery = preg_replace('/\@TP\@/', $table_prefix, $query);
# Replace args
$rawArgs = array();
foreach ($args as $argItem) {
$rawArgItem = preg_replace('/\@TP\@/', $table_prefix, $argItem);
array_push($rawArgs, $rawArgItem);
}
return array($rawQuery, $rawArgs);
}
# vim: ts=4 # vim: ts=4
<?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
# Utility functions
# Copyright (C) 2010-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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
## @fn isBoolean($param)
# Check if a variable is boolean
#
# @param var Variable to check
#
# @return 1, 0 or -1 on unknown
function isBoolean($param) {
# Check if we're set
if (!isset($param)) {
return -1;
}
# If it's already bool, just return it
if (is_bool($param)) {
return $param;
}
# If it's a string..
if (is_string($param)) {
# Nuke whitespaces
trim($param);
# Allow true, on, set, enabled, 1, false, off, unset, disabled, 0
if (preg_match('/^(?:true|on|set|enabled|1)$/i', $param)) {
return 1;
}
if (preg_match('/^(?:false|off|unset|disabled|0)$/i', $param)) {
return 0;
}
}
# Invalid or unknown
return -1;
}
# vim: ts=4
?>
<html> <!-- Index.html - load all our code
<head> Copyright (C) 2007-2015, AllWorldIT
<style type="text/css">
#loading { This program is free software; you can redistribute it and/or modify
position:absolute; it under the terms of the GNU General Public License as published by
left:45%; the Free Software Foundation; either version 2 of the License, or
top:40%; (at your option) any later version.
padding:2px;
z-index:20001; This program is distributed in the hope that it will be useful,
height:auto; but WITHOUT ANY WARRANTY; without even the implied warranty of
} MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#loading-msg { GNU General Public License for more details.
font: normal 10px arial,tahoma,sans-serif;
} You should have received a copy of the GNU General Public License along
</style> with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -->
<!DOCTYPE html
</head> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<body> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<div id="loading"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<div class="loading-indicator"> <head>
Loading: <span id="loading-msg"></span> <style type="text/css">
</div> #loading-mask{
<div> position:absolute;
left:0;
top:0;
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Stylesheets...';</script> width:100%;
height:100%;
<link rel="stylesheet" type="text/css" href="resources/extjs/css/ext-all.css" /> z-index:20000;
<link rel="stylesheet" type="text/css" href="styles.css" /> background-color:white;
<link rel="stylesheet" type="text/css" href="icons.css" /> }
<link rel="stylesheet" type="text/css" href="resources/extjs/css/examples.css" /> #loading{
position:absolute;
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Core API...';</script> left:45%;
<script type="text/javascript" src="js/extjs/ext-base.js"></script> top:40%;
<script type="text/javascript" src="js/extjs/ext-all.js"></script> padding:2px;
z-index:20001;
height:auto;
<!-- }
Our own libraries #loading a {
--> color:#225588;
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Libraries...';</script> }
<script type="text/javascript" src="js/custom/util.js"></script> #loading .loading-indicator{
<script type="text/javascript" src="js/custom/sprintf.js"></script> background:white;
<script type="text/javascript" src="js/custom/regexes.js"></script> color:#444;
<script type="text/javascript" src="js/custom/vtypes.js"></script> font:bold 13px tahoma,arial,helvetica;
<script type="text/javascript" src="js/custom/menu/EditableItem.js"></script> padding:10px;
<script type="text/javascript" src="js/custom/menu/RangeMenu.js"></script> margin:0;
<script type="text/javascript" src="js/custom/GridFilters.js"></script> height:auto;
<script type="text/javascript" src="js/custom/GridFilters/Filter.js"></script> }
<script type="text/javascript" src="js/custom/GridFilters/StringFilter.js"></script> #loading-msg {
<script type="text/javascript" src="js/custom/GridFilters/DateFilter.js"></script> font: normal 10px arial,tahoma,sans-serif;
<script type="text/javascript" src="js/custom/GridFilters/ListFilter.js"></script> }
<script type="text/javascript" src="js/custom/GridFilters/NumericFilter.js"></script> </style>
<script type="text/javascript" src="js/custom/GridFilters/BooleanFilter.js"></script> </head>
<script type="text/javascript" src="js/custom/ProgressFormPanel.js"></script> <body>
<script type="text/javascript" src="js/custom/common.js"></script> <div id="loading-mask" style=""></div>
<script type="text/javascript" src="js/custom/generic.js"></script> <div id="loading">
<div class="loading-indicator">
<!-- <img src="awitef/resources/extjs/images/extanim32.gif" width="32" height="32" style="margin-right:8px;float:left;vertical-align:top;"/>
Main application SMRadius WebGUI - <a href="http://smradius.org">smradius.org</a><br /><span id="loading-msg">Loading styles and images...</span>
--> </div>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Configuration...';</script> </div>
<script type="text/javascript" src="js/app/config.js"></script>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Menus...';</script> <script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Loading stylesheets...';</script>
<script type="text/javascript" src="js/app/menus.js"></script>
<link rel="stylesheet" type="text/css" href="awitef/resources/extjs/css/ext-all.css" />
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Windows...';</script> <link rel="stylesheet" type="text/css" href="styles.css" />
<script type="text/javascript" src="js/app/windows/WiSPUsers.js"></script> <link rel="stylesheet" type="text/css" href="awitef/resources/custom/css/silk-icons.css" />
<script type="text/javascript" src="js/app/windows/WiSPUserLogs.js"></script> <link rel="stylesheet" type="text/css" href="icons.css" />
<script type="text/javascript" src="js/app/windows/WiSPUserTopups.js"></script> <link rel="stylesheet" type="text/css" href="awitef/resources/extjs/css/examples.css" />
<script type="text/javascript" src="js/app/windows/WiSPLocations.js"></script> <link rel="stylesheet" type="text/css" href="awitef/js/custom/GridFilters/icons/style.css" />
<script type="text/javascript" src="js/app/windows/WiSPLocationMembers.js"></script>
<script type="text/javascript" src="js/app/windows/WiSPResellers.js"></script> <script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Loading core API...';</script>
<script type="text/javascript" src="awitef/js/extjs/ext-base.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUsers.js"></script> <script type="text/javascript" src="awitef/js/extjs/ext-all.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUserLogs.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUserAttributes.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUserGroups.js"></script> <!--
<script type="text/javascript" src="js/app/windows/AdminUserTopups.js"></script> Our own libraries
<script type="text/javascript" src="js/app/windows/AdminRealms.js"></script> -->
<script type="text/javascript" src="js/app/windows/AdminRealmAttributes.js"></script> <script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Loading libraries...';</script>
<script type="text/javascript" src="awitef/js/custom/util.js"></script>
<script type="text/javascript" src="js/app/windows/AdminGroups.js"></script> <script type="text/javascript" src="awitef/js/custom/sprintf.js"></script>
<script type="text/javascript" src="js/app/windows/AdminGroupAttributes.js"></script> <script type="text/javascript" src="awitef/js/custom/regexes.js"></script>
<script type="text/javascript" src="js/app/windows/AdminGroupMembers.js"></script> <script type="text/javascript" src="awitef/js/custom/vtypes.js"></script>
<script type="text/javascript" src="awitef/js/custom/GridFilters/GridFilters.js"></script>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Layout...';</script> <script type="text/javascript" src="awitef/js/custom/GridFilters/menu/EditableItem.js"></script>
<script type="text/javascript" src="js/app/main-layout.js"></script> <script type="text/javascript" src="awitef/js/custom/GridFilters/menu/RangeMenu.js"></script>
<script type="text/javascript" src="awitef/js/custom/GridFilters/filter/Filter.js"></script>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Starting...';</script> <script type="text/javascript" src="awitef/js/custom/GridFilters/filter/StringFilter.js"></script>
<script type="text/javascript" src="js/app/main.js"></script> <script type="text/javascript" src="awitef/js/custom/GridFilters/filter/DateFilter.js"></script>
<script type="text/javascript" src="awitef/js/custom/GridFilters/filter/ListFilter.js"></script>
</body> <script type="text/javascript" src="awitef/js/custom/GridFilters/filter/NumericFilter.js"></script>
</html> <script type="text/javascript" src="awitef/js/custom/GridFilters/filter/BooleanFilter.js"></script>
<script type="text/javascript" src="awitef/js/custom/ProgressFormPanel.js"></script>
<script type="text/javascript" src="awitef/js/custom/StatusBar.js"></script>
<script type="text/javascript" src="awitef/js/custom/common.js"></script>
<script type="text/javascript" src="awitef/js/custom/generic.js"></script>
<!--
Main application
-->
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Loading configuration...';</script>
<script type="text/javascript" src="js/app/config.js"></script>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Loading menus...';</script>
<script type="text/javascript" src="js/app/menus.js"></script>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Loading windows...';</script>
<script type="text/javascript" src="js/app/windows/WiSPUsers.js"></script>
<script type="text/javascript" src="js/app/windows/WiSPUserLogs.js"></script>
<script type="text/javascript" src="js/app/windows/WiSPUserTopups.js"></script>
<script type="text/javascript" src="js/app/windows/WiSPLocations.js"></script>
<script type="text/javascript" src="js/app/windows/WiSPLocationMembers.js"></script>
<script type="text/javascript" src="js/app/windows/WiSPResellers.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUsers.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUserLogs.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUserAttributes.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUserGroups.js"></script>
<script type="text/javascript" src="js/app/windows/AdminUserTopups.js"></script>
<script type="text/javascript" src="js/app/windows/AdminRealms.js"></script>
<script type="text/javascript" src="js/app/windows/AdminRealmAttributes.js"></script>
<script type="text/javascript" src="js/app/windows/AdminRealmMembers.js"></script>
<script type="text/javascript" src="js/app/windows/AdminClients.js"></script>
<script type="text/javascript" src="js/app/windows/AdminClientAttributes.js"></script>
<script type="text/javascript" src="js/app/windows/AdminClientRealms.js"></script>
<script type="text/javascript" src="js/app/windows/AdminGroups.js"></script>
<script type="text/javascript" src="js/app/windows/AdminGroupAttributes.js"></script>
<script type="text/javascript" src="js/app/windows/AdminGroupMembers.js"></script>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Loading layout...';</script>
<script type="text/javascript" src="js/app/main-layout.js"></script>
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = 'Starting...';</script>
<script type="text/javascript" src="js/app/main.js"></script>
</body>
</html>
/*
Webgui Global Config
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
var globalConfig = { var globalConfig = {
soap: { soap: {
username: 'admin', username: 'admin',
......
/*
Webgui Main Layout
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// Main viewport // Main viewport
function initViewport() { function initViewport() {
...@@ -40,11 +59,29 @@ function initViewport() { ...@@ -40,11 +59,29 @@ function initViewport() {
// mainWindow // mainWindow
// ] // ]
}, },
{ {
id: 'main-statusbar', id: 'main-statusbar',
xtype: 'statusbar', xtype: 'panel',
region: 'south', region: 'south',
border: true border: true,
height: 30,
bbar: new Ext.ux.StatusBar({
id: 'my-status',
// defaults to use when the status is cleared:
defaultText: 'Default status text',
defaultIconCls: 'default-icon',
// values to set initially:
text: 'Ready',
iconCls: 'ready-icon'
// any standard Toolbar items:
// items: [{
// text: 'A Button'
// }, '-', 'Plain Text']
})
} }
/* /*
{ {
......
/* /*
* Ext JS Library 2.1 * Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC. * Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com * licensing@extjs.com
* *
* http://extjs.com/license * http://extjs.com/license
*/ */
Ext.onReady(function(){ Ext.onReady(function(){
// Turn off the loading icon
document.getElementById('loading').style.visibility = 'hidden'; // Enable tips
Ext.QuickTips.init();
// this seems to save window states
// Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // Turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';
// Enable tips
Ext.QuickTips.init(); // Turn off the loading icon
var hideMask = function () {
// Turn on validation errors beside the field globally Ext.get('loading').remove();
Ext.form.Field.prototype.msgTarget = 'side'; Ext.fly('loading-mask').fadeOut({
remove: true,
// Range menu items, used on GridFilter callback: function() {
Ext.menu.RangeMenu.prototype.icons = { // Fire everything up
gt: 'resources/extjs/images/greater_then.png', initViewport();
lt: 'resources/extjs/images/less_then.png', }
eq: 'resources/extjs/images/equals.png' });
}; }
Ext.grid.filter.StringFilter.prototype.icon = 'resources/extjs/images/find.png';
hideMask.defer(250);
});
// Fire everything up
initViewport();
});
/*
Webgui Menus
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
var radiusMenu = new Ext.menu.Menu({ var radiusMenu = new Ext.menu.Menu({
items: [ items: [
{ {
text: 'Users', text: 'Users',
iconCls: 'silk-user',
handler: function() { handler: function() {
showAdminUserWindow(); showAdminUserWindow();
} }
...@@ -10,6 +30,7 @@ var radiusMenu = new Ext.menu.Menu({ ...@@ -10,6 +30,7 @@ var radiusMenu = new Ext.menu.Menu({
{ {
text: 'Groups', text: 'Groups',
iconCls: 'silk-group',
handler: function() { handler: function() {
showAdminGroupWindow(); showAdminGroupWindow();
} }
...@@ -17,11 +38,20 @@ var radiusMenu = new Ext.menu.Menu({ ...@@ -17,11 +38,20 @@ var radiusMenu = new Ext.menu.Menu({
{ {
text: 'Realms', text: 'Realms',
iconCls: 'silk-world',
handler: function() { handler: function() {
showAdminRealmWindow(); showAdminRealmWindow();
} }
} },
{
text: 'Clients',
iconCls: 'silk-server',
handler: function() {
showAdminClientWindow();
}
}
] ]
}); });
...@@ -31,20 +61,22 @@ var wispMenu = new Ext.menu.Menu({ ...@@ -31,20 +61,22 @@ var wispMenu = new Ext.menu.Menu({
{ {
text: 'Users', text: 'Users',
iconCls: 'silk-user',
handler: function() { handler: function() {
showWiSPUserWindow(); showWiSPUserWindow();
} }
}, },
{ // {
text: 'Resellers', // text: 'Resellers',
handler: function() { // handler: function() {
showWiSPResellersWindow(); // showWiSPResellersWindow();
} // }
}, // },
{ {
text: 'Locations', text: 'Locations',
iconCls: 'silk-map',
handler: function() { handler: function() {
showWiSPLocationWindow(); showWiSPLocationWindow();
} }
......
/*
Admin Client Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminClientAttributesWindow(clientID) {
var AdminClientAttributesWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Attributes",
iconCls: 'silk-table',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add attribute',
iconCls:'silk-table_add',
handler: function() {
showAdminClientAttributeAddEditWindow(AdminClientAttributesWindow,clientID);
}
},
'-',
{
text:'Edit',
tooltip:'Edit attribute',
iconCls:'silk-table_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAttributeAddEditWindow(AdminClientAttributesWindow,clientID,selectedItem.data.ID);
} else {
AdminClientAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientAttributesWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Remove',
tooltip:'Remove attribute',
iconCls:'silk-table_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAttributeRemoveWindow(AdminClientAttributesWindow,selectedItem.data.ID);
} else {
AdminClientAttributesWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No attribute selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientAttributesWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
},
{
header: "Operator",
sortable: true,
dataIndex: 'Operator'
},
{
header: "Value",
sortable: true,
dataIndex: 'Value'
},
{
header: "Disabled",
sortable: true,
dataIndex: 'Disabled'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: clientID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes',
SOAPFunction: 'getAdminClientAttributes',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'},
{type: 'string', dataIndex: 'Operator'},
{type: 'string', dataIndex: 'Value'},
{type: 'boolean', dataIndex: 'Disabled'}
]
}
);
AdminClientAttributesWindow.show();
}
// Display edit/add form
function showAdminClientAttributeAddEditWindow(AdminClientAttributesWindow,clientID,attrID) {
var submitAjaxConfig;
var icon;
// We doing an update
if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = {
params: {
ID: attrID,
SOAPFunction: 'updateAdminClientAttribute',
SOAPParams:
'0:ID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-table_add';
submitAjaxConfig = {
params: {
ClientID: clientID,
SOAPFunction: 'addAdminClientAttribute',
SOAPParams:
'0:ClientID,'+
'0:Name,'+
'0:Operator,'+
'0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminClientAttributesFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Attribute Information",
iconCls: icon,
width: 310,
height: 200,
minWidth: 310,
minHeight: 200
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
},
{
xtype: 'combo',
fieldLabel: 'Operator',
name: 'Operator',
allowBlank: false,
width: 157,
store: [
[ '=', '=' ],
[ ':=', ':=' ],
[ '==', '==' ],
[ '+=', '+=' ],
[ '!=', '!=' ],
[ '<', '<' ],
[ '>', '>' ],
[ '<=', '<=' ],
[ '>=', '>=' ],
[ '=~', '=~' ],
[ '!~', '!~' ],
[ '=*', '=*' ],
[ '!*', '!*' ],
[ '||==', '||==' ]
],
displayField: 'Operator',
valueField: 'Operator',
hiddenName: 'Operator',
forceSelection: false,
triggerAction: 'all',
editable: true
},
{
fieldLabel: "Value",
name: "Value",
allowBlank: false
},
{
xtype: 'checkbox',
fieldLabel: 'Disabled',
name: 'Disabled'
}
]
},
// Submit button config
submitAjaxConfig
);
adminClientAttributesFormWindow.show();
if (attrID) {
Ext.getCmp(adminClientAttributesFormWindow.formPanelID).load({
params: {
ID: attrID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes',
SOAPFunction: 'getAdminClientAttribute',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminClientAttributeRemoveWindow(AdminClientAttributesWindow,id) {
// Mask AdminClientAttributesWindow window
AdminClientAttributesWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this attribute?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminClientAttributesWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientAttributes',
SOAPFunction: 'removeAdminClientAttribute',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminClientAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminClientAttributesWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Client Realms
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminClientRealmsWindow(clientID) {
var AdminClientRealmsWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Realms",
iconCls: 'silk-world',
width: 400,
height: 335,
minWidth: 400,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add realm',
iconCls: 'silk-world_add',
handler: function() {
showAdminClientRealmAddWindow(AdminClientRealmsWindow,clientID);
}
},
'-',
{
text:'Remove',
tooltip:'Remove realm',
iconCls: 'silk-world_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientRealmRemoveWindow(AdminClientRealmsWindow,selectedItem.data.ID);
} else {
AdminClientRealmsWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No realm selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientRealmsWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: clientID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientRealms',
SOAPFunction: 'getAdminClientRealms',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'}
]
}
);
AdminClientRealmsWindow.show();
}
// Display edit/add form
function showAdminClientRealmAddWindow(AdminClientRealmsWindow,clientID,id) {
var submitAjaxConfig;
var icon;
// We doing an update
if (id) {
icon = 'silk-world_edit',
submitAjaxConfig = {
params: {
ID: id,
SOAPFunction: 'updateAdminRealm',
SOAPParams:
'0:ID,'+
'0:RealmID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-world_add',
submitAjaxConfig = {
params: {
ClientID: clientID,
SOAPFunction: 'addAdminClientRealm',
SOAPParams:
'0:ClientID,'+
'0:RealmID'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminRealmFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Realm Information",
iconCls: icon,
width: 310,
height: 113,
minWidth: 310,
minHeight: 113
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealms'
},
items: [
{
xtype: 'combo',
//id: 'combo',
fieldLabel: 'Realm',
name: 'Realm',
allowBlank: false,
width: 160,
store: new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientRealms',
SOAPFunction: 'getAdminRealms',
SOAPParams: '__null,__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'RealmID',
forceSelection: true,
triggerAction: 'all',
editable: false
}
]
},
// Submit button config
submitAjaxConfig
);
adminRealmFormWindow.show();
if (id) {
Ext.getCmp(adminRealmFormWindow.formPanelID).load({
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealms',
SOAPFunction: 'getAdminRealm',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminClientRealmRemoveWindow(AdminClientRealmsWindow,id) {
// Mask AdminClientRealmsWindow window
AdminClientRealmsWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to unlink this realm?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminClientRealmsWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClientRealms',
SOAPFunction: 'removeAdminClientRealm',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminClientRealmsWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminClientRealmsWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Clients
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminClientWindow() {
var AdminClientWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Clients",
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Add',
tooltip:'Add client',
iconCls:'silk-server_add',
handler: function() {
showAdminClientAddEditWindow(AdminClientWindow);
}
},
'-',
{
text:'Edit',
tooltip:'Edit client',
iconCls:'silk-server_edit',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAddEditWindow(AdminClientWindow,selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
},
{
text:'Remove',
tooltip:'Remove client',
iconCls:'silk-server_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientRemoveWindow(AdminClientWindow,selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Attributes',
tooltip:'Client attributes',
iconCls:'silk-table',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientAttributesWindow(selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Realms',
tooltip:'Realms',
iconCls:'silk-world',
handler: function() {
var selectedItem = Ext.getCmp(AdminClientWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminClientRealmsWindow(selectedItem.data.ID);
} else {
AdminClientWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No client selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminClientWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
},
{
header: "AccessList",
sortable: true,
dataIndex: 'AccessList'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients',
SOAPFunction: 'getAdminClients',
SOAPParams: '__null,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'},
{type: 'string', dataIndex: 'AccessList'}
]
}
);
AdminClientWindow.show();
}
// Display edit/add form
function showAdminClientAddEditWindow(AdminClientWindow,id) {
var submitAjaxConfig;
var icon;
// We doing an update
if (id) {
icon = 'silk-server_edit';
submitAjaxConfig = {
params: {
ID: id,
SOAPFunction: 'updateAdminClient',
SOAPParams:
'0:ID,'+
'0:Name,'+
'0:AccessList'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
// We doing an Add
} else {
icon = 'silk-server_add';
submitAjaxConfig = {
params: {
SOAPFunction: 'createAdminClient',
SOAPParams:
'0:Name,'+
'0:AccessList'
},
onSuccess: function() {
var store = Ext.getCmp(AdminClientWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
};
}
// Create window
var adminClientFormWindow = new Ext.ux.GenericFormWindow(
// Window config
{
title: "Client Information",
iconCls: icon,
width: 310,
height: 143,
minWidth: 310,
minHeight: 143
},
// Form panel config
{
labelWidth: 85,
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients'
},
items: [
{
fieldLabel: 'Name',
name: 'Name',
allowBlank: false
},
{
fieldLabel: 'AccessList',
name: 'AccessList',
allowBlank: true
}
]
},
// Submit button config
submitAjaxConfig
);
adminClientFormWindow.show();
if (id) {
Ext.getCmp(adminClientFormWindow.formPanelID).load({
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients',
SOAPFunction: 'getAdminClient',
SOAPParams: 'ID'
}
});
}
}
// Display remove form
function showAdminClientRemoveWindow(AdminClientWindow,id) {
// Mask AdminClientWindow window
AdminClientWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this client?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminClientWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminClients',
SOAPFunction: 'removeAdminClient',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminClientWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminClientWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Group Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminGroupAttributesWindow(groupID) { function showAdminGroupAttributesWindow(groupID) {
...@@ -6,12 +24,13 @@ function showAdminGroupAttributesWindow(groupID) { ...@@ -6,12 +24,13 @@ function showAdminGroupAttributesWindow(groupID) {
// Window config // Window config
{ {
title: "Attributes", title: "Attributes",
iconCls: 'silk-table',
width: 600, width: 600,
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -20,22 +39,22 @@ function showAdminGroupAttributesWindow(groupID) { ...@@ -20,22 +39,22 @@ function showAdminGroupAttributesWindow(groupID) {
{ {
text:'Add', text:'Add',
tooltip:'Add attribute', tooltip:'Add attribute',
iconCls:'add', iconCls:'silk-table_add',
handler: function() { handler: function() {
showAdminGroupAttributeAddEditWindow(groupID); showAdminGroupAttributeAddEditWindow(AdminGroupAttributesWindow,groupID);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit attribute', tooltip:'Edit attribute',
iconCls:'edit', iconCls:'silk-table_edit',
handler: function() { handler: function() {
var selectedItem = AdminGroupAttributesWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminGroupAttributesWindow.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
showAdminGroupAttributeAddEditWindow(groupID,selectedItem.data.ID); showAdminGroupAttributeAddEditWindow(AdminGroupAttributesWindow,groupID,selectedItem.data.ID);
} else { } else {
AdminGroupAttributesWindow.getEl().mask(); AdminGroupAttributesWindow.getEl().mask();
...@@ -57,9 +76,9 @@ function showAdminGroupAttributesWindow(groupID) { ...@@ -57,9 +76,9 @@ function showAdminGroupAttributesWindow(groupID) {
{ {
text:'Remove', text:'Remove',
tooltip:'Remove attribute', tooltip:'Remove attribute',
iconCls:'remove', iconCls:'silk-table_delete',
handler: function() { handler: function() {
var selectedItem = AdminGroupAttributesWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminGroupAttributesWindow.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
...@@ -142,35 +161,57 @@ function showAdminGroupAttributesWindow(groupID) { ...@@ -142,35 +161,57 @@ function showAdminGroupAttributesWindow(groupID) {
// Display edit/add form // Display edit/add form
function showAdminGroupAttributeAddEditWindow(groupID,attrID) { function showAdminGroupAttributeAddEditWindow(AdminGroupAttributesWindow,groupID,attrID) {
var submitAjaxConfig; var submitAjaxConfig;
var icon;
// We doing an update // We doing an update
if (attrID) { if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: attrID, params: {
SOAPFunction: 'updateAdminGroupAttribute', ID: attrID,
SOAPParams: SOAPFunction: 'updateAdminGroupAttribute',
'0:ID,'+ SOAPParams:
'0:Name,'+ '0:ID,'+
'0:Operator,'+ '0:Name,'+
'0:Value,'+ '0:Operator,'+
'0:Disabled:boolean' '0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-table_add';
submitAjaxConfig = { submitAjaxConfig = {
GroupID: groupID, params: {
SOAPFunction: 'addAdminGroupAttribute', GroupID: groupID,
SOAPParams: SOAPFunction: 'addAdminGroupAttribute',
'0:GroupID,'+ SOAPParams:
'0:Name,'+ '0:GroupID,'+
'0:Operator,'+ '0:Name,'+
'0:Value,'+ '0:Operator,'+
'0:Disabled:boolean' '0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -179,6 +220,7 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) { ...@@ -179,6 +220,7 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) {
// Window config // Window config
{ {
title: "Attribute Information", title: "Attribute Information",
iconCls: icon,
width: 310, width: 310,
height: 200, height: 200,
...@@ -226,9 +268,9 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) { ...@@ -226,9 +268,9 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) {
displayField: 'Operator', displayField: 'Operator',
valueField: 'Operator', valueField: 'Operator',
hiddenName: 'Operator', hiddenName: 'Operator',
forceSelection: true, forceSelection: false,
triggerAction: 'all', triggerAction: 'all',
editable: false editable: true
}, },
{ {
fieldLabel: "Value", fieldLabel: "Value",
...@@ -239,8 +281,8 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) { ...@@ -239,8 +281,8 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) {
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: 'Disabled', fieldLabel: 'Disabled',
name: 'Disabled' name: 'Disabled'
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -249,7 +291,7 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) { ...@@ -249,7 +291,7 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) {
adminGroupAttributesFormWindow.show(); adminGroupAttributesFormWindow.show();
if (attrID) { if (attrID) {
adminGroupAttributesFormWindow.getComponent('formpanel').load({ Ext.getCmp(adminGroupAttributesFormWindow.formPanelID).load({
params: { params: {
ID: attrID, ID: attrID,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -267,9 +309,9 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) { ...@@ -267,9 +309,9 @@ function showAdminGroupAttributeAddEditWindow(groupID,attrID) {
// Display remove form // Display remove form
function showAdminGroupAttributeRemoveWindow(parent,id) { function showAdminGroupAttributeRemoveWindow(AdminGroupAttributesWindow,id) {
// Mask parent window // Mask AdminGroupAttributesWindow window
parent.getEl().mask(); AdminGroupAttributesWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -283,7 +325,7 @@ function showAdminGroupAttributeRemoveWindow(parent,id) { ...@@ -283,7 +325,7 @@ function showAdminGroupAttributeRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminGroupAttributesWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -292,13 +334,21 @@ function showAdminGroupAttributeRemoveWindow(parent,id) { ...@@ -292,13 +334,21 @@ function showAdminGroupAttributeRemoveWindow(parent,id) {
SOAPModule: 'AdminGroupAttributes', SOAPModule: 'AdminGroupAttributes',
SOAPFunction: 'removeAdminGroupAttribute', SOAPFunction: 'removeAdminGroupAttribute',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminGroupAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminGroupAttributesWindow.getEl().unmask();
} }
} }
}); });
......
/*
Admin Group Members
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminGroupMembersWindow(groupID) { function showAdminGroupMembersWindow(groupID) {
...@@ -6,12 +24,13 @@ function showAdminGroupMembersWindow(groupID) { ...@@ -6,12 +24,13 @@ function showAdminGroupMembersWindow(groupID) {
// Window config // Window config
{ {
title: "Members", title: "Members",
iconCls: 'silk-user',
width: 600, width: 600,
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -20,9 +39,9 @@ function showAdminGroupMembersWindow(groupID) { ...@@ -20,9 +39,9 @@ function showAdminGroupMembersWindow(groupID) {
{ {
text:'Remove', text:'Remove',
tooltip:'Remove member', tooltip:'Remove member',
iconCls:'remove', iconCls:'silk-user_delete',
handler: function() { handler: function() {
var selectedItem = AdminGroupMembersWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminGroupMembersWindow.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
...@@ -93,9 +112,9 @@ function showAdminGroupMembersWindow(groupID) { ...@@ -93,9 +112,9 @@ function showAdminGroupMembersWindow(groupID) {
// Display remove form // Display remove form
function showAdminGroupMemberRemoveWindow(parent,id) { function showAdminGroupMemberRemoveWindow(AdminGroupMembersWindow,id) {
// Mask parent window // Mask AdminGroupMembersWindow window
parent.getEl().mask(); AdminGroupMembersWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -109,7 +128,7 @@ function showAdminGroupMemberRemoveWindow(parent,id) { ...@@ -109,7 +128,7 @@ function showAdminGroupMemberRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminGroupMembersWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -118,13 +137,21 @@ function showAdminGroupMemberRemoveWindow(parent,id) { ...@@ -118,13 +137,21 @@ function showAdminGroupMemberRemoveWindow(parent,id) {
SOAPModule: 'AdminGroupMembers', SOAPModule: 'AdminGroupMembers',
SOAPFunction: 'removeAdminGroupMember', SOAPFunction: 'removeAdminGroupMember',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminGroupMembersWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminGroupMembersWindow.getEl().unmask();
} }
} }
}); });
......
/*
Admin Groups
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminGroupWindow() { function showAdminGroupWindow() {
...@@ -6,12 +24,13 @@ function showAdminGroupWindow() { ...@@ -6,12 +24,13 @@ function showAdminGroupWindow() {
// Window config // Window config
{ {
title: "Groups", title: "Groups",
iconCls: 'silk-group',
width: 600, width: 600,
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -20,22 +39,22 @@ function showAdminGroupWindow() { ...@@ -20,22 +39,22 @@ function showAdminGroupWindow() {
{ {
text:'Add', text:'Add',
tooltip:'Add group', tooltip:'Add group',
iconCls:'add', iconCls:'silk-group_add',
handler: function() { handler: function() {
showAdminGroupAddEditWindow(); showAdminGroupAddEditWindow(AdminGroupWindow);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit group', tooltip:'Edit group',
iconCls:'edit', iconCls:'silk-group_edit',
handler: function() { handler: function() {
var selectedItem = AdminGroupWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminGroupWindow.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
showAdminGroupAddEditWindow(selectedItem.data.ID); showAdminGroupAddEditWindow(AdminGroupWindow,selectedItem.data.ID);
} else { } else {
AdminGroupWindow.getEl().mask(); AdminGroupWindow.getEl().mask();
...@@ -57,9 +76,9 @@ function showAdminGroupWindow() { ...@@ -57,9 +76,9 @@ function showAdminGroupWindow() {
{ {
text:'Remove', text:'Remove',
tooltip:'Remove group', tooltip:'Remove group',
iconCls:'remove', iconCls:'silk-group_delete',
handler: function() { handler: function() {
var selectedItem = AdminGroupWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminGroupWindow.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
...@@ -85,9 +104,9 @@ function showAdminGroupWindow() { ...@@ -85,9 +104,9 @@ function showAdminGroupWindow() {
{ {
text:'Attributes', text:'Attributes',
tooltip:'Group attributes', tooltip:'Group attributes',
iconCls:'attributes', iconCls:'silk-table',
handler: function() { handler: function() {
var selectedItem = AdminGroupWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminGroupWindow.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
...@@ -113,9 +132,9 @@ function showAdminGroupWindow() { ...@@ -113,9 +132,9 @@ function showAdminGroupWindow() {
{ {
text:'Members', text:'Members',
tooltip:'Group members', tooltip:'Group members',
iconCls:'groups', iconCls:'silk-group',
handler: function() { handler: function() {
var selectedItem = AdminGroupWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminGroupWindow.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
...@@ -197,27 +216,50 @@ function showAdminGroupWindow() { ...@@ -197,27 +216,50 @@ function showAdminGroupWindow() {
// Display edit/add form // Display edit/add form
function showAdminGroupAddEditWindow(id) { function showAdminGroupAddEditWindow(AdminGroupWindow,id) {
var submitAjaxConfig; var submitAjaxConfig;
var icon;
// We doing an update // We doing an update
if (id) { if (id) {
icon = 'silk-group_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: id, params: {
SOAPFunction: 'updateAdminGroup', ID: id,
SOAPParams: SOAPFunction: 'updateAdminGroup',
'0:ID,'+ SOAPParams:
'0:Name' '0:ID,'+
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-group_add';
submitAjaxConfig = { submitAjaxConfig = {
SOAPFunction: 'createAdminGroup', params: {
SOAPParams: SOAPFunction: 'createAdminGroup',
'0:Name' SOAPParams:
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminGroupWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -226,6 +268,7 @@ function showAdminGroupAddEditWindow(id) { ...@@ -226,6 +268,7 @@ function showAdminGroupAddEditWindow(id) {
// Window config // Window config
{ {
title: "Group Information", title: "Group Information",
iconCls: icon,
width: 310, width: 310,
height: 113, height: 113,
...@@ -246,11 +289,9 @@ function showAdminGroupAddEditWindow(id) { ...@@ -246,11 +289,9 @@ function showAdminGroupAddEditWindow(id) {
{ {
fieldLabel: 'Name', fieldLabel: 'Name',
name: 'Name', name: 'Name',
vtype: 'usernamePart',
maskRe: usernamePartRe,
allowBlank: false allowBlank: false
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -259,7 +300,7 @@ function showAdminGroupAddEditWindow(id) { ...@@ -259,7 +300,7 @@ function showAdminGroupAddEditWindow(id) {
adminGroupFormWindow.show(); adminGroupFormWindow.show();
if (id) { if (id) {
adminGroupFormWindow.getComponent('formpanel').load({ Ext.getCmp(adminGroupFormWindow.formPanelID).load({
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -276,10 +317,10 @@ function showAdminGroupAddEditWindow(id) { ...@@ -276,10 +317,10 @@ function showAdminGroupAddEditWindow(id) {
// Display edit/add form // Display remove form
function showAdminGroupRemoveWindow(parent,id) { function showAdminGroupRemoveWindow(AdminGroupWindow,id) {
// Mask parent window // Mask AdminGroupWindow window
parent.getEl().mask(); AdminGroupWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -293,7 +334,7 @@ function showAdminGroupRemoveWindow(parent,id) { ...@@ -293,7 +334,7 @@ function showAdminGroupRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminGroupWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -302,13 +343,21 @@ function showAdminGroupRemoveWindow(parent,id) { ...@@ -302,13 +343,21 @@ function showAdminGroupRemoveWindow(parent,id) {
SOAPModule: 'AdminGroups', SOAPModule: 'AdminGroups',
SOAPFunction: 'removeAdminGroup', SOAPFunction: 'removeAdminGroup',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminGroupWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminGroupWindow.getEl().unmask();
} }
} }
}); });
......
/*
Admin Realm Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminRealmAttributesWindow(realmID) { function showAdminRealmAttributesWindow(realmID) {
...@@ -6,12 +24,13 @@ function showAdminRealmAttributesWindow(realmID) { ...@@ -6,12 +24,13 @@ function showAdminRealmAttributesWindow(realmID) {
// Window config // Window config
{ {
title: "Attributes", title: "Attributes",
iconCls: 'silk-table',
width: 600, width: 600,
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -20,22 +39,22 @@ function showAdminRealmAttributesWindow(realmID) { ...@@ -20,22 +39,22 @@ function showAdminRealmAttributesWindow(realmID) {
{ {
text:'Add', text:'Add',
tooltip:'Add attribute', tooltip:'Add attribute',
iconCls:'add', iconCls:'silk-table_add',
handler: function() { handler: function() {
showAdminRealmAttributeAddEditWindow(realmID); showAdminRealmAttributeAddEditWindow(AdminRealmAttributesWindow,realmID);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit attribute', tooltip:'Edit attribute',
iconCls:'edit', iconCls:'silk-table_edit',
handler: function() { handler: function() {
var selectedItem = AdminRealmAttributesWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminRealmAttributesWindow.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
showAdminRealmAttributeAddEditWindow(realmID,selectedItem.data.ID); showAdminRealmAttributeAddEditWindow(AdminRealmAttributesWindow,realmID,selectedItem.data.ID);
} else { } else {
AdminRealmAttributesWindow.getEl().mask(); AdminRealmAttributesWindow.getEl().mask();
...@@ -57,9 +76,9 @@ function showAdminRealmAttributesWindow(realmID) { ...@@ -57,9 +76,9 @@ function showAdminRealmAttributesWindow(realmID) {
{ {
text:'Remove', text:'Remove',
tooltip:'Remove attribute', tooltip:'Remove attribute',
iconCls:'remove', iconCls:'silk-table_delete',
handler: function() { handler: function() {
var selectedItem = AdminRealmAttributesWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminRealmAttributesWindow.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
...@@ -142,35 +161,58 @@ function showAdminRealmAttributesWindow(realmID) { ...@@ -142,35 +161,58 @@ function showAdminRealmAttributesWindow(realmID) {
// Display edit/add form // Display edit/add form
function showAdminRealmAttributeAddEditWindow(realmID,attrID) { function showAdminRealmAttributeAddEditWindow(AdminRealmAttributesWindow,realmID,attrID) {
var submitAjaxConfig; var submitAjaxConfig;
var icon;
// We doing an update // We doing an update
if (attrID) { if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: attrID, params: {
SOAPFunction: 'updateAdminRealmAttribute', ID: attrID,
SOAPParams: SOAPFunction: 'updateAdminRealmAttribute',
'0:ID,'+ SOAPParams:
'0:Name,'+ '0:ID,'+
'0:Operator,'+ '0:Name,'+
'0:Value,'+ '0:Operator,'+
'0:Disabled:boolean' '0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-table_add';
submitAjaxConfig = { submitAjaxConfig = {
RealmID: realmID, params: {
SOAPFunction: 'addAdminRealmAttribute', RealmID: realmID,
SOAPParams: SOAPFunction: 'addAdminRealmAttribute',
'0:RealmID,'+ SOAPParams:
'0:Name,'+ '0:RealmID,'+
'0:Operator,'+ '0:Name,'+
'0:Value,'+ '0:Operator,'+
'0:Disabled:boolean' '0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -179,6 +221,7 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) { ...@@ -179,6 +221,7 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) {
// Window config // Window config
{ {
title: "Attribute Information", title: "Attribute Information",
iconCls: icon,
width: 310, width: 310,
height: 200, height: 200,
...@@ -226,9 +269,9 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) { ...@@ -226,9 +269,9 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) {
displayField: 'Operator', displayField: 'Operator',
valueField: 'Operator', valueField: 'Operator',
hiddenName: 'Operator', hiddenName: 'Operator',
forceSelection: true, forceSelection: false,
triggerAction: 'all', triggerAction: 'all',
editable: false editable: true
}, },
{ {
fieldLabel: "Value", fieldLabel: "Value",
...@@ -239,8 +282,8 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) { ...@@ -239,8 +282,8 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) {
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: 'Disabled', fieldLabel: 'Disabled',
name: 'Disabled' name: 'Disabled'
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -249,7 +292,7 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) { ...@@ -249,7 +292,7 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) {
adminRealmAttributesFormWindow.show(); adminRealmAttributesFormWindow.show();
if (attrID) { if (attrID) {
adminRealmAttributesFormWindow.getComponent('formpanel').load({ Ext.getCmp(adminRealmAttributesFormWindow.formPanelID).load({
params: { params: {
ID: attrID, ID: attrID,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -267,9 +310,9 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) { ...@@ -267,9 +310,9 @@ function showAdminRealmAttributeAddEditWindow(realmID,attrID) {
// Display remove form // Display remove form
function showAdminRealmAttributeRemoveWindow(parent,id) { function showAdminRealmAttributeRemoveWindow(AdminRealmAttributesWindow,id) {
// Mask parent window // Mask AdminRealmAttributesWindow window
parent.getEl().mask(); AdminRealmAttributesWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -283,7 +326,7 @@ function showAdminRealmAttributeRemoveWindow(parent,id) { ...@@ -283,7 +326,7 @@ function showAdminRealmAttributeRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminRealmAttributesWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -292,13 +335,21 @@ function showAdminRealmAttributeRemoveWindow(parent,id) { ...@@ -292,13 +335,21 @@ function showAdminRealmAttributeRemoveWindow(parent,id) {
SOAPModule: 'AdminRealmAttributes', SOAPModule: 'AdminRealmAttributes',
SOAPFunction: 'removeAdminRealmAttribute', SOAPFunction: 'removeAdminRealmAttribute',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminRealmAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminRealmAttributesWindow.getEl().unmask();
} }
} }
}); });
......
/*
Admin Realm Members
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminRealmMembersWindow(realmID) {
var AdminRealmMembersWindow = new Ext.ux.GenericGridWindow(
// Window config
{
title: "Members",
iconCls: 'silk-server',
width: 600,
height: 335,
minWidth: 600,
minHeight: 335
},
// Grid config
{
// Inline toolbars
tbar: [
{
text:'Remove',
tooltip:'Remove member',
iconCls:'silk-server_delete',
handler: function() {
var selectedItem = Ext.getCmp(AdminRealmMembersWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminRealmMemberRemoveWindow(AdminRealmMembersWindow,selectedItem.data.ID);
} else {
AdminRealmMembersWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No member selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminRealmMembersWindow.getEl().unmask();
}
});
}
}
}
],
// Column model
colModel: new Ext.grid.ColumnModel([
{
id: 'ID',
header: "ID",
sortable: true,
dataIndex: 'ID'
},
{
header: "Name",
sortable: true,
dataIndex: 'Name'
}
]),
autoExpandColumn: 'Name'
},
// Store config
{
baseParams: {
ID: realmID,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmMembers',
SOAPFunction: 'getAdminRealmMembers',
SOAPParams: 'ID,__search'
}
},
// Filter config
{
filters: [
{type: 'numeric', dataIndex: 'ID'},
{type: 'string', dataIndex: 'Name'}
]
}
);
AdminRealmMembersWindow.show();
}
// Display remove form
function showAdminRealmMemberRemoveWindow(AdminRealmMembersWindow,id) {
// Mask AdminRealmMembersWindow window
AdminRealmMembersWindow.getEl().mask();
// Display remove confirm window
Ext.Msg.show({
title: "Confirm removal",
msg: "Are you very sure you wish to remove this member?",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO,
modal: false,
fn: function(buttonId,text) {
// Check if user clicked on 'yes' button
if (buttonId == 'yes') {
// Do ajax request
uxAjaxRequest(AdminRealmMembersWindow,{
params: {
ID: id,
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminRealmMembers',
SOAPFunction: 'removeAdminRealmMember',
SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminRealmMembersWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
});
// Unmask if user answered no
} else {
AdminRealmMembersWindow.getEl().unmask();
}
}
});
}
// vim: ts=4
/*
Admin Realms
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminRealmWindow() { function showAdminRealmWindow() {
...@@ -6,12 +24,13 @@ function showAdminRealmWindow() { ...@@ -6,12 +24,13 @@ function showAdminRealmWindow() {
// Window config // Window config
{ {
title: "Realms", title: "Realms",
iconCls: 'silk-world',
width: 600, width: 600,
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -20,22 +39,22 @@ function showAdminRealmWindow() { ...@@ -20,22 +39,22 @@ function showAdminRealmWindow() {
{ {
text:'Add', text:'Add',
tooltip:'Add realm', tooltip:'Add realm',
iconCls:'add', iconCls:'silk-world_add',
handler: function() { handler: function() {
showAdminRealmAddEditWindow(); showAdminRealmAddEditWindow(AdminRealmWindow);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit realm', tooltip:'Edit realm',
iconCls:'edit', iconCls:'silk-world_edit',
handler: function() { handler: function() {
var selectedItem = AdminRealmWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminRealmWindow.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
showAdminRealmAddEditWindow(selectedItem.data.ID); showAdminRealmAddEditWindow(AdminRealmWindow,selectedItem.data.ID);
} else { } else {
AdminRealmWindow.getEl().mask(); AdminRealmWindow.getEl().mask();
...@@ -53,12 +72,13 @@ function showAdminRealmWindow() { ...@@ -53,12 +72,13 @@ function showAdminRealmWindow() {
} }
} }
}, },
'-',
{ {
text:'Remove', text:'Remove',
tooltip:'Remove realm', tooltip:'Remove realm',
iconCls:'remove', iconCls:'silk-world_delete',
handler: function() { handler: function() {
var selectedItem = AdminRealmWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminRealmWindow.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
...@@ -84,9 +104,9 @@ function showAdminRealmWindow() { ...@@ -84,9 +104,9 @@ function showAdminRealmWindow() {
{ {
text:'Attributes', text:'Attributes',
tooltip:'Realm attributes', tooltip:'Realm attributes',
iconCls:'attributes', iconCls:'silk-table',
handler: function() { handler: function() {
var selectedItem = AdminRealmWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminRealmWindow.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
...@@ -94,6 +114,34 @@ function showAdminRealmWindow() { ...@@ -94,6 +114,34 @@ function showAdminRealmWindow() {
} else { } else {
AdminRealmWindow.getEl().mask(); AdminRealmWindow.getEl().mask();
// Display error
Ext.Msg.show({
title: "Nothing selected",
msg: "No realm selected",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.CANCEL,
modal: false,
fn: function() {
AdminRealmWindow.getEl().unmask();
}
});
}
}
},
'-',
{
text:'Members',
tooltip:'Realm members',
iconCls:'silk-server',
handler: function() {
var selectedItem = Ext.getCmp(AdminRealmWindow.gridPanelID).getSelectionModel().getSelected();
// Check if we have selected item
if (selectedItem) {
// If so display window
showAdminRealmMembersWindow(selectedItem.data.ID);
} else {
AdminRealmWindow.getEl().mask();
// Display error // Display error
Ext.Msg.show({ Ext.Msg.show({
title: "Nothing selected", title: "Nothing selected",
...@@ -156,27 +204,50 @@ function showAdminRealmWindow() { ...@@ -156,27 +204,50 @@ function showAdminRealmWindow() {
// Display edit/add form // Display edit/add form
function showAdminRealmAddEditWindow(id) { function showAdminRealmAddEditWindow(AdminRealmWindow,id) {
var submitAjaxConfig; var submitAjaxConfig;
var icon;
// We doing an update // We doing an update
if (id) { if (id) {
icon = 'silk-world_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: id, params: {
SOAPFunction: 'updateAdminRealm', ID: id,
SOAPParams: SOAPFunction: 'updateAdminRealm',
'0:ID,'+ SOAPParams:
'0:Name' '0:ID,'+
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-world_add';
submitAjaxConfig = { submitAjaxConfig = {
SOAPFunction: 'createAdminRealm', params: {
SOAPParams: SOAPFunction: 'createAdminRealm',
'0:Name' SOAPParams:
'0:Name'
},
onSuccess: function() {
var store = Ext.getCmp(AdminRealmWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -185,6 +256,7 @@ function showAdminRealmAddEditWindow(id) { ...@@ -185,6 +256,7 @@ function showAdminRealmAddEditWindow(id) {
// Window config // Window config
{ {
title: "Realm Information", title: "Realm Information",
iconCls: icon,
width: 310, width: 310,
height: 113, height: 113,
...@@ -205,11 +277,9 @@ function showAdminRealmAddEditWindow(id) { ...@@ -205,11 +277,9 @@ function showAdminRealmAddEditWindow(id) {
{ {
fieldLabel: 'Name', fieldLabel: 'Name',
name: 'Name', name: 'Name',
vtype: 'usernamePart',
maskRe: usernamePartRe,
allowBlank: false allowBlank: false
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -218,7 +288,7 @@ function showAdminRealmAddEditWindow(id) { ...@@ -218,7 +288,7 @@ function showAdminRealmAddEditWindow(id) {
adminRealmFormWindow.show(); adminRealmFormWindow.show();
if (id) { if (id) {
adminRealmFormWindow.getComponent('formpanel').load({ Ext.getCmp(adminRealmFormWindow.formPanelID).load({
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -235,10 +305,10 @@ function showAdminRealmAddEditWindow(id) { ...@@ -235,10 +305,10 @@ function showAdminRealmAddEditWindow(id) {
// Display edit/add form // Display remove form
function showAdminRealmRemoveWindow(parent,id) { function showAdminRealmRemoveWindow(AdminRealmWindow,id) {
// Mask parent window // Mask AdminRealmWindow window
parent.getEl().mask(); AdminRealmWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -252,7 +322,7 @@ function showAdminRealmRemoveWindow(parent,id) { ...@@ -252,7 +322,7 @@ function showAdminRealmRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminRealmWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -261,13 +331,21 @@ function showAdminRealmRemoveWindow(parent,id) { ...@@ -261,13 +331,21 @@ function showAdminRealmRemoveWindow(parent,id) {
SOAPModule: 'AdminRealms', SOAPModule: 'AdminRealms',
SOAPFunction: 'removeAdminRealm', SOAPFunction: 'removeAdminRealm',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminRealmWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminRealmWindow.getEl().unmask();
} }
} }
}); });
......
/*
Admin User Attributes
Copyright (C) 2007-2011, AllWorldIT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function showAdminUserAttributesWindow(userID) { function showAdminUserAttributesWindow(userID) {
...@@ -6,12 +24,13 @@ function showAdminUserAttributesWindow(userID) { ...@@ -6,12 +24,13 @@ function showAdminUserAttributesWindow(userID) {
// Window config // Window config
{ {
title: "Attributes", title: "Attributes",
iconCls: 'silk-table',
width: 600, width: 600,
height: 335, height: 335,
minWidth: 600, minWidth: 600,
minHeight: 335, minHeight: 335
}, },
// Grid config // Grid config
{ {
...@@ -20,22 +39,22 @@ function showAdminUserAttributesWindow(userID) { ...@@ -20,22 +39,22 @@ function showAdminUserAttributesWindow(userID) {
{ {
text:'Add', text:'Add',
tooltip:'Add attribute', tooltip:'Add attribute',
iconCls:'add', iconCls:'silk-table_add',
handler: function() { handler: function() {
showAdminUserAttributeAddEditWindow(userID); showAdminUserAttributeAddEditWindow(AdminUserAttributesWindow,userID);
} }
}, },
'-', '-',
{ {
text:'Edit', text:'Edit',
tooltip:'Edit attribute', tooltip:'Edit attribute',
iconCls:'edit', iconCls:'silk-table_edit',
handler: function() { handler: function() {
var selectedItem = AdminUserAttributesWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminUserAttributesWindow.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
showAdminUserAttributeAddEditWindow(userID,selectedItem.data.ID); showAdminUserAttributeAddEditWindow(AdminUserAttributesWindow,userID,selectedItem.data.ID);
} else { } else {
AdminUserAttributesWindow.getEl().mask(); AdminUserAttributesWindow.getEl().mask();
...@@ -57,9 +76,9 @@ function showAdminUserAttributesWindow(userID) { ...@@ -57,9 +76,9 @@ function showAdminUserAttributesWindow(userID) {
{ {
text:'Remove', text:'Remove',
tooltip:'Remove attribute', tooltip:'Remove attribute',
iconCls:'remove', iconCls:'silk-table_delete',
handler: function() { handler: function() {
var selectedItem = AdminUserAttributesWindow.getComponent('gridpanel').getSelectionModel().getSelected(); var selectedItem = Ext.getCmp(AdminUserAttributesWindow.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
...@@ -142,35 +161,58 @@ function showAdminUserAttributesWindow(userID) { ...@@ -142,35 +161,58 @@ function showAdminUserAttributesWindow(userID) {
// Display edit/add form // Display edit/add form
function showAdminUserAttributeAddEditWindow(userID,attrID) { function showAdminUserAttributeAddEditWindow(AdminUserAttributesWindow,userID,attrID) {
var submitAjaxConfig; var submitAjaxConfig;
var icon;
// We doing an update // We doing an update
if (attrID) { if (attrID) {
icon = 'silk-table_edit';
submitAjaxConfig = { submitAjaxConfig = {
ID: attrID, params: {
SOAPFunction: 'updateAdminUserAttribute', ID: attrID,
SOAPParams: SOAPFunction: 'updateAdminUserAttribute',
'0:ID,'+ SOAPParams:
'0:Name,'+ '0:ID,'+
'0:Operator,'+ '0:Name,'+
'0:Value,'+ '0:Operator,'+
'0:Disabled:boolean' '0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
// We doing an Add // We doing an Add
} else { } else {
icon = 'silk-table_add';
submitAjaxConfig = { submitAjaxConfig = {
UserID: userID, params: {
SOAPFunction: 'addAdminUserAttribute', UserID: userID,
SOAPParams: SOAPFunction: 'addAdminUserAttribute',
'0:UserID,'+ SOAPParams:
'0:Name,'+ '0:UserID,'+
'0:Operator,'+ '0:Name,'+
'0:Value,'+ '0:Operator,'+
'0:Disabled:boolean' '0:Value,'+
'0:Disabled:boolean'
},
onSuccess: function() {
var store = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
}
}; };
} }
...@@ -179,6 +221,7 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) { ...@@ -179,6 +221,7 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) {
// Window config // Window config
{ {
title: "Attribute Information", title: "Attribute Information",
iconCls: icon,
width: 310, width: 310,
height: 200, height: 200,
...@@ -228,9 +271,9 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) { ...@@ -228,9 +271,9 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) {
displayField: 'Operator', displayField: 'Operator',
valueField: 'Operator', valueField: 'Operator',
hiddenName: 'Operator', hiddenName: 'Operator',
forceSelection: true, forceSelection: false,
triggerAction: 'all', triggerAction: 'all',
editable: false editable: true
}, },
{ {
fieldLabel: "Value", fieldLabel: "Value",
...@@ -241,8 +284,8 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) { ...@@ -241,8 +284,8 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) {
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: 'Disabled', fieldLabel: 'Disabled',
name: 'Disabled' name: 'Disabled'
}, }
], ]
}, },
// Submit button config // Submit button config
submitAjaxConfig submitAjaxConfig
...@@ -251,7 +294,7 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) { ...@@ -251,7 +294,7 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) {
adminGroupFormWindow.show(); adminGroupFormWindow.show();
if (attrID) { if (attrID) {
adminGroupFormWindow.getComponent('formpanel').load({ Ext.getCmp(adminGroupFormWindow.formPanelID).load({
params: { params: {
ID: attrID, ID: attrID,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -269,9 +312,9 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) { ...@@ -269,9 +312,9 @@ function showAdminUserAttributeAddEditWindow(userID,attrID) {
// Display remove form // Display remove form
function showAdminUserAttributeRemoveWindow(parent,id) { function showAdminUserAttributeRemoveWindow(AdminUserAttributesWindow,id) {
// Mask parent window // Mask AdminUserAttributesWindow window
parent.getEl().mask(); AdminUserAttributesWindow.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
...@@ -285,7 +328,7 @@ function showAdminUserAttributeRemoveWindow(parent,id) { ...@@ -285,7 +328,7 @@ function showAdminUserAttributeRemoveWindow(parent,id) {
if (buttonId == 'yes') { if (buttonId == 'yes') {
// Do ajax request // Do ajax request
uxAjaxRequest(parent,{ uxAjaxRequest(AdminUserAttributesWindow,{
params: { params: {
ID: id, ID: id,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
...@@ -294,13 +337,21 @@ function showAdminUserAttributeRemoveWindow(parent,id) { ...@@ -294,13 +337,21 @@ function showAdminUserAttributeRemoveWindow(parent,id) {
SOAPModule: 'AdminUserAttributes', SOAPModule: 'AdminUserAttributes',
SOAPFunction: 'removeAdminUserAttribute', SOAPFunction: 'removeAdminUserAttribute',
SOAPParams: 'ID' SOAPParams: 'ID'
},
customSuccess: function() {
var store = Ext.getCmp(AdminUserAttributesWindow.gridPanelID).getStore();
store.load({
params: {
limit: 25
}
});
} }
}); });
// Unmask if user answered no // Unmask if user answered no
} else { } else {
parent.getEl().unmask(); AdminUserAttributesWindow.getEl().unmask();
} }
} }
}); });
......