Commit 72e479c93158ea15865a54100dec4dc5aed118d5
1 parent
a5b06ff3
added list deleted documents admin pages
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2133 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
97 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/listDeletedDocumentsBL.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once("../../../../../config/dmsDefaults.php"); | ||
| 4 | +require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | ||
| 5 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | ||
| 6 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 7 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | ||
| 8 | +require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); | ||
| 9 | + | ||
| 10 | +require_once("listDeletedDocumentsUI.inc"); | ||
| 11 | +require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * $Id$ | ||
| 15 | + * | ||
| 16 | + * Business logic for listing deleted documents. | ||
| 17 | + * | ||
| 18 | + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING. | ||
| 19 | + * | ||
| 20 | + * @version $Revision$ | ||
| 21 | + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 22 | + * @package presentation.lookAndFeel.knowledgeTree.administration.documentmanagement | ||
| 23 | + */ | ||
| 24 | + | ||
| 25 | +if (checkSession()) { | ||
| 26 | + global $default; | ||
| 27 | + | ||
| 28 | + $oContent = new PatternCustom(); | ||
| 29 | + | ||
| 30 | + if ($fDocumentIDs) { | ||
| 31 | + // tack on POSTed document ids and redirect to the expunge deleted documents page | ||
| 32 | + foreach ($fDocumentIDs as $fDocumentID) { | ||
| 33 | + $sQueryString .= "fDocumentIDs[]=$fDocumentID&"; | ||
| 34 | + } | ||
| 35 | + controllerRedirect("expungeDeletedDocuments", $sQueryString); | ||
| 36 | + } else { | ||
| 37 | + $oContent->setHtml(renderListDeletedDocumentsPage(Document::getList("status_id=" . DELETED))); | ||
| 38 | + } | ||
| 39 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 40 | + $main->setCentralPayload($oContent); | ||
| 41 | + $main->setFormAction($_SERVER["PHP_SELF"]); | ||
| 42 | + $main->render(); | ||
| 43 | +} | ||
| 44 | +?> | ||
| 0 | \ No newline at end of file | 45 | \ No newline at end of file |
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/listDeletedDocumentsUI.inc
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * $Id$ | ||
| 5 | + * | ||
| 6 | + * This page holds all presentation code for displaying deleted documents management pages. | ||
| 7 | + * | ||
| 8 | + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING. | ||
| 9 | + * | ||
| 10 | + * @version $Revision$ | ||
| 11 | + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 12 | + * @package presentation.lookAndFeel.knowledgeTree.administration.documentmanagement | ||
| 13 | + */ | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * Lists all deleted documents | ||
| 17 | + */ | ||
| 18 | +function renderListDeletedDocumentsPage($aDocuments) { | ||
| 19 | + global $default; | ||
| 20 | + | ||
| 21 | + $sToRender = renderHeading("Expunge Deleted Documents"); | ||
| 22 | + $sToRender .= "<table>"; | ||
| 23 | + if (count($aDocuments) > 0) { | ||
| 24 | + $sToRender .= "<tr><td>The following documents have been deleted from the DMS.</td></tr>\n"; | ||
| 25 | + $sToRender .= "<tr><td>Select the documents you would like to completely remove and click 'Expunge', or click on the document name link to restore the document.</td></tr>\n"; | ||
| 26 | + $sToRender .= "<tr/><tr/>"; | ||
| 27 | + // loop through them | ||
| 28 | + for ($i = 0; $i < count($aDocuments); $i++) { | ||
| 29 | + $sToRender .= "\t<tr>\n"; | ||
| 30 | + $sToRender .= "\t\t<td bgcolor=\"" . getColour($i) . "\">\n"; | ||
| 31 | + $sToRender .= "<input type=\"checkbox\" name=\"fDocumentIDs[]\" value=\"" . $aDocuments[$i]->getID() . "\"/>\n"; | ||
| 32 | + // get an existing folder to restore the document to | ||
| 33 | + $oFolder = Folder::get($aDocuments[$i]->getFolderID()); | ||
| 34 | + // if the folder no longer exists, use the root folder to start browsing from | ||
| 35 | + $iFolderID = ($oFolder ? $aDocuments[$i]->getFolderID() : User::getUserRootFolderID()); | ||
| 36 | + $sToRender .= generateControllerLink("restoreDeletedDocument", | ||
| 37 | + "fDocumentID=" . $aDocuments[$i]->getID() . "&fFolderID=$iFolderID", | ||
| 38 | + ($aDocuments[$i]->getFolderID() == $iFolderID) ? $aDocuments[$i]->getDisplayPath(true) : $aDocuments[$i]->getIcon() . $aDocuments[$i]->getName()) . "\n"; | ||
| 39 | + $sToRender .= "\t\t</td>\n"; | ||
| 40 | + $sToRender .= "\t</tr>\n"; | ||
| 41 | + } | ||
| 42 | + $sToRender .= "<tr/><tr/>"; | ||
| 43 | + $sToRender .= "<tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/expunge.gif\" border=\"0\"/></td></tr>\n"; | ||
| 44 | + } else { | ||
| 45 | + $sToRender .= "<tr><td>There are currently no deleted documents in the system</td></tr>"; | ||
| 46 | + $sToRender .= "<tr/><tr/>"; | ||
| 47 | + $sToRender .= "<tr><td><a href=\"javascript:history.go(-1)\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"/></a></td></tr>\n"; | ||
| 48 | + | ||
| 49 | + } | ||
| 50 | + $sToRender .= "</table>"; | ||
| 51 | + return $sToRender; | ||
| 52 | +} | ||
| 53 | +?> | ||
| 0 | \ No newline at end of file | 54 | \ No newline at end of file |