From ce7d32104f9a2e9a13e1073aa9d4a1cfdc3a4d24 Mon Sep 17 00:00:00 2001 From: nbm Date: Thu, 26 May 2005 13:05:40 +0000 Subject: [PATCH] Don't allow the Name column to be removed from the browser. --- presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php b/presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php index 890d3d8..8f0826d 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php +++ b/presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php @@ -28,6 +28,16 @@ require_once("../../../../../config/dmsDefaults.php"); KTUtil::extractGPC('fAssign', 'fGroupID', 'browseNewLeft'); +class Verify_Error extends PEAR_Error { +} + +function verifyBrowse($aIDs) { + if (!in_array('-1', $aIDs)) { + return new Verify_Error("Browser must include Name column"); + } + return true; +} + /* * Update all Users/Group association * Return 1 if success @@ -71,12 +81,18 @@ if (checkSession()) { if (isset($fAssign)) { $aIDs = explode(",", $browseNewLeft); - // Add/Remove new users to group - $res = updateBrowse($aIDs); - if (($res === false) || (PEAR::isError($res))) { - $main->setErrorMessage("Some problems in updating browse settings. Please contact your administrator"); + // Verify that the browse list makes at least some sense + $res = verifyBrowse($aIDs); + if (PEAR::isError($res)) { + $main->setErrorMessage($res->getMessage()); } else { - redirect($_SERVER["PHP_SELF"]); + // Add/Remove new users to group + $res = updateBrowse($aIDs); + if (($res === false) || (PEAR::isError($res))) { + $main->setErrorMessage("Some problems in updating browse settings. Please contact your administrator"); + } else { + redirect($_SERVER["PHP_SELF"]); + } } } -- libgit2 0.21.4