From 2b5c1ae185f79f68edb47e6bd240c55c93a60cb3 Mon Sep 17 00:00:00 2001
From: Robert Anderson <randerson@lbsd.net>
Date: Thu, 7 May 2009 15:02:43 +0000
Subject: [PATCH] Admin remove group

---
 webgui/ajax.php                               |  6 ++++++
 webgui/include/ajax/functions/AdminGroups.php | 15 +++++++++++++++
 webgui/js/app/windows/AdminGroups.js          | 14 +++++++-------
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/webgui/ajax.php b/webgui/ajax.php
index 6ca51e0c..d7b85ea9 100644
--- a/webgui/ajax.php
+++ b/webgui/ajax.php
@@ -146,6 +146,12 @@
 	}
 
 	switch ($function) {
+		case "removeAdminGroup":
+
+			print_r($soapParams);
+			$res = removeAdminGroup($soapParams);
+			break;
+
 		case "getWiSPResellers":
 
 			$rawData = array (
diff --git a/webgui/include/ajax/functions/AdminGroups.php b/webgui/include/ajax/functions/AdminGroups.php
index b2cd8416..2b95bf14 100644
--- a/webgui/include/ajax/functions/AdminGroups.php
+++ b/webgui/include/ajax/functions/AdminGroups.php
@@ -42,4 +42,19 @@ function getAdminGroups($params) {
 	return array($resultArray,$numResults);
 }
 
+# Return list of users
+function removeAdminGroup($params) {
+	global $db;
+
+	$db->errorInfo();
+	$res = DBDo("DELETE FROM groups WHERE ID = ".$params[0]['id']);
+	print_r($params);
+	# If STH is blank, return the error back to whoever requested the data
+	if (!isset($res)) {
+		print_r($res->errorInfo());
+	}
+
+	return $res;
+}
+
 ?>
diff --git a/webgui/js/app/windows/AdminGroups.js b/webgui/js/app/windows/AdminGroups.js
index 13f4decb..5321562f 100644
--- a/webgui/js/app/windows/AdminGroups.js
+++ b/webgui/js/app/windows/AdminGroups.js
@@ -35,7 +35,7 @@ function showAdminGroupWindow() {
 						// Check if we have selected item
 						if (selectedItem) {
 							// If so display window
-							showAdminGroupRemoveWindow(WiSPUserWindow,selectedItem.data.ID);
+							showAdminGroupRemoveWindow(AdminGroupWindow,selectedItem.data.ID);
 						} else {
 							AdminGroupWindow.getEl().mask();
 
@@ -207,7 +207,7 @@ function showAdminGroupEditWindow(id) {
 		ID: id,
 		sortInfo: { field: "Name", direction: "ASC" },
 		baseParams: {
-			SOAPGroupname: globalConfig.soap.username,
+			SOAPUsername: globalConfig.soap.username,
 			SOAPPassword: globalConfig.soap.password,
 			SOAPAuthType: globalConfig.soap.authtype,
 			SOAPModule: 'AdminGroups',
@@ -233,7 +233,7 @@ function showAdminGroupEditWindow(id) {
 		{
 			labelWidth: 85,
 			baseParams: {
-				SOAPGroupname: globalConfig.soap.username,
+				SOAPUsername: globalConfig.soap.username,
 				SOAPPassword: globalConfig.soap.password,
 				SOAPAuthType: globalConfig.soap.authtype,
 				SOAPModule: 'AdminGroups'
@@ -264,7 +264,7 @@ function showAdminGroupEditWindow(id) {
 						ID: id,
 						sortInfo: { field: "Name", direction: "ASC" },
 						baseParams: {
-							SOAPGroupname: globalConfig.soap.username,
+							SOAPUsername: globalConfig.soap.username,
 							SOAPPassword: globalConfig.soap.password,
 							SOAPAuthType: globalConfig.soap.authtype,
 							SOAPModule: 'Agents',
@@ -381,7 +381,7 @@ function showAdminGroupEditWindow(id) {
 		wispGroupFormWindow.getComponent('formpanel').load({
 			params: {
 				id: id,
-				SOAPGroupname: globalConfig.soap.username,
+				SOAPUsername: globalConfig.soap.username,
 				SOAPPassword: globalConfig.soap.password,
 				SOAPAuthType: globalConfig.soap.authtype,
 				SOAPModule: 'AdminGroups',
@@ -403,7 +403,7 @@ function showAdminGroupRemoveWindow(parent,id) {
 	// Display remove confirm window
 	Ext.Msg.show({
 		title: "Confirm removal",
-		msg: "Are you very sure you wish to remove this user?",
+		msg: "Are you very sure you wish to remove this group?",
 		icon: Ext.MessageBox.ERROR,
 		buttons: Ext.Msg.YESNO,
 		modal: false,
@@ -415,7 +415,7 @@ function showAdminGroupRemoveWindow(parent,id) {
 				uxAjaxRequest(parent,{
 					params: {
 						id: id,
-						SOAPGroupname: globalConfig.soap.username,
+						SOAPUsername: globalConfig.soap.username,
 						SOAPPassword: globalConfig.soap.password,
 						SOAPAuthType: globalConfig.soap.authtype,
 						SOAPModule: 'AdminGroups',
-- 
GitLab