Commit ce7d32104f9a2e9a13e1073aa9d4a1cfdc3a4d24
1 parent
90cad63e
Don't allow the Name column to be removed from the browser.
Submitted by: 1119191 SF Tracker: Nicolas Quienot (nquienot) git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3308 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
21 additions
and
5 deletions
presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php
| @@ -28,6 +28,16 @@ require_once("../../../../../config/dmsDefaults.php"); | @@ -28,6 +28,16 @@ require_once("../../../../../config/dmsDefaults.php"); | ||
| 28 | 28 | ||
| 29 | KTUtil::extractGPC('fAssign', 'fGroupID', 'browseNewLeft'); | 29 | KTUtil::extractGPC('fAssign', 'fGroupID', 'browseNewLeft'); |
| 30 | 30 | ||
| 31 | +class Verify_Error extends PEAR_Error { | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +function verifyBrowse($aIDs) { | ||
| 35 | + if (!in_array('-1', $aIDs)) { | ||
| 36 | + return new Verify_Error("Browser must include Name column"); | ||
| 37 | + } | ||
| 38 | + return true; | ||
| 39 | +} | ||
| 40 | + | ||
| 31 | /* | 41 | /* |
| 32 | * Update all Users/Group association | 42 | * Update all Users/Group association |
| 33 | * Return 1 if success | 43 | * Return 1 if success |
| @@ -71,12 +81,18 @@ if (checkSession()) { | @@ -71,12 +81,18 @@ if (checkSession()) { | ||
| 71 | if (isset($fAssign)) { | 81 | if (isset($fAssign)) { |
| 72 | $aIDs = explode(",", $browseNewLeft); | 82 | $aIDs = explode(",", $browseNewLeft); |
| 73 | 83 | ||
| 74 | - // Add/Remove new users to group | ||
| 75 | - $res = updateBrowse($aIDs); | ||
| 76 | - if (($res === false) || (PEAR::isError($res))) { | ||
| 77 | - $main->setErrorMessage("Some problems in updating browse settings. Please contact your administrator"); | 84 | + // Verify that the browse list makes at least some sense |
| 85 | + $res = verifyBrowse($aIDs); | ||
| 86 | + if (PEAR::isError($res)) { | ||
| 87 | + $main->setErrorMessage($res->getMessage()); | ||
| 78 | } else { | 88 | } else { |
| 79 | - redirect($_SERVER["PHP_SELF"]); | 89 | + // Add/Remove new users to group |
| 90 | + $res = updateBrowse($aIDs); | ||
| 91 | + if (($res === false) || (PEAR::isError($res))) { | ||
| 92 | + $main->setErrorMessage("Some problems in updating browse settings. Please contact your administrator"); | ||
| 93 | + } else { | ||
| 94 | + redirect($_SERVER["PHP_SELF"]); | ||
| 95 | + } | ||
| 80 | } | 96 | } |
| 81 | } | 97 | } |
| 82 | 98 |