Commit d759f1b2086cf1574150f0ea1bf52a727f3a8daa
1 parent
d8aa49cb
don't allow folder deletion if there are archived documents in it
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2471 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
9 additions
and
17 deletions
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php
| ... | ... | @@ -110,13 +110,17 @@ if (checkSession()) { |
| 110 | 110 | |
| 111 | 111 | // get folders descended from this one |
| 112 | 112 | $aFolderArray = Folder::getList("parent_id=$fFolderID"); |
| 113 | - // get documents in this folder | |
| 114 | - $aDocumentArray = Document::getList("folder_id=$fFolderID AND status_id=" . LIVE); | |
| 113 | + // get live documents in this folder | |
| 114 | + $aLiveDocuments = Document::getList("folder_id=$fFolderID AND status_id=" . LIVE); | |
| 115 | + // get archived documents in this folder | |
| 116 | + $aArchivedDocuments = Document::getList("folder_id=$fFolderID AND status_id=" . ARCHIVED); | |
| 115 | 117 | |
| 116 | 118 | if (count($aFolderArray) > 0) { |
| 117 | 119 | $oPatternCustom->setHtml(getFolderNotEmptyPage($fFolderID, count($aFolderArray), "folder(s)")); |
| 118 | - } else if (count($aDocumentArray) > 0) { | |
| 119 | - $oPatternCustom->setHtml(getFolderNotEmptyPage($fFolderID, count($aDocumentArray), "document(s)")); | |
| 120 | + } else if (count($aLiveDocuments) > 0) { | |
| 121 | + $oPatternCustom->setHtml(getFolderNotEmptyPage($fFolderID, count($aDocumentArray), "document(s)")); | |
| 122 | + } else if (count($aArchivedDocuments) > 0) { | |
| 123 | + $oPatternCustom->setHtml(getFolderNotEmptyPage($fFolderID, "", " archived documents")); | |
| 120 | 124 | } else { |
| 121 | 125 | // get confirmation first |
| 122 | 126 | $oFolder = Folder::get($fFolderID); | ... | ... |
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderUI.inc
| ... | ... | @@ -10,18 +10,6 @@ |
| 10 | 10 | * @package presentation.lookAndFeel.knowledgeTree.foldermanagement |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | - /*function renderHeading($sHeading) { | |
| 14 | - global $default; | |
| 15 | - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); | |
| 16 | - $sColor = $default->siteMap->getSectionColour($sSectionName, "th"); | |
| 17 | - $sToRender = "<table border=\"0\" width=\"600\">\n"; | |
| 18 | - $sToRender .= "<tr align=\"left\"><th class=\"sectionHeading\" bgcolor=\"$sColor\">$sHeading</th></tr>\n"; | |
| 19 | - $sToRender .= "<tr/>\n"; | |
| 20 | - $sToRender .= "<tr/>\n"; | |
| 21 | - $sToRender .= "</table>\n"; | |
| 22 | - return $sToRender; | |
| 23 | -}*/ | |
| 24 | - | |
| 25 | 13 | function getFolderPath($iFolderID) { |
| 26 | 14 | global $default; |
| 27 | 15 | $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); |
| ... | ... | @@ -36,7 +24,7 @@ function getFolderNotEmptyPage($iFolderID, $iObjectCount, $sObjectType) { |
| 36 | 24 | $sToRender .= getFolderPath($iFolderID) . "<br>\n"; |
| 37 | 25 | $sToRender .= "<table border=\"0\">\n"; |
| 38 | 26 | $sToRender .= "<tr>\n"; |
| 39 | - $sToRender .= "<td>There are still $iObjectCount $sObjectType in this folder</td>\n"; | |
| 27 | + $sToRender .= "<td>This folder cannot be deleted because there are still $iObjectCount $sObjectType in it.</td>\n"; | |
| 40 | 28 | $sToRender .= "<tr>\n"; |
| 41 | 29 | $sToRender .= "<td>Select 'Cancel' to return to the browse page.</td>\n"; |
| 42 | 30 | $sToRender .= "<tr>\n"; | ... | ... |