diff --git a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/archivedDocumentsUI.inc b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/archivedDocumentsUI.inc
new file mode 100644
index 0000000..4b82125
--- /dev/null
+++ b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/archivedDocumentsUI.inc
@@ -0,0 +1,149 @@
+, Jam Warehouse (Pty) Ltd, South Africa
+ * @package presentation.lookAndFeel.knowledgeTree.administration.dopcumentmanagement
+ */
+
+/**
+ * Displays the status of restored documents
+ */
+function renderStatusPage($aSuccessDocuments, $aErrorDocuments) {
+ global $default;
+
+ $sToRender = renderHeading("Archived Documents Restoration Status");
+ $sToRender .= "
";
+ if (count($aSuccessDocuments) > 0) {
+ $sToRender .= "| The following documents were successfully restored: |
\n";
+ $sToRender .= "|
";
+ for ($i=0; $igetDisplayPath() . "\n";
+ }
+ }
+ if (count($aErrorDocuments) > 0) {
+ $sToRender .= "| There were errors restoring the following documents: |
\n";
+ $sToRender .= "|
";
+ for ($i=0; $igetDisplayPath() . "\n";
+ }
+ }
+ $sToRender .= "|
";
+ $sToRender .= "" . generateControllerLink("archivedDocuments", "", " graphicsUrl/widgets/back.gif\" border=\"0\"> |
");
+ $sToRender .= "
";
+ return $sToRender;
+}
+
+/**
+ * Gives the user a last chance to bail out before restoring the documents
+ */
+function renderRestoreConfirmationPage($aDocuments) {
+ global $default;
+
+ $sToRender = renderHeading("Restore Archived Documents");
+ $sToRender .= "";
+ return $sToRender;
+}
+
+/**
+ * Displays the archived document search form
+ */
+function renderSearchPage() {
+ global $default;
+ $sToRender = renderHeading("Archived Documents Search");
+ $sToRender .= "\n";
+
+ $sToRender .= "\n\n\n\n";
+
+ return $sToRender;
+}
+
+/**
+ * Performs the search and displays the results
+ */
+function renderArchivedDocumentsResultsPage($sKeywords, $iStartIndex) {
+ global $default;
+ $sQuery = "SELECT DISTINCT D.id AS document_id, D.name AS document_name " .
+ "FROM search_document_user_link AS SDUL " .
+ "INNER JOIN documents AS D ON D.id = SDUL.document_id " .
+ "INNER JOIN status_lookup AS SL ON D.status_id = SL.id " .
+ "WHERE SDUL.user_id = " . $_SESSION["userID"] . " " .
+ "AND SL.name='Archived' " .
+ "AND (D.name like '%$sKeywords%' " .
+ "OR D.filename like '%$sKeywords%')";
+
+ $sToRender = renderHeading("Archived Documents Search Results");
+ $sToRender .= "";
+
+ return $sToRender;
+}
+?>
\ No newline at end of file
diff --git a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/manageArchivedDocumentsBL.php b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/manageArchivedDocumentsBL.php
new file mode 100644
index 0000000..a5158f8
--- /dev/null
+++ b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/manageArchivedDocumentsBL.php
@@ -0,0 +1,86 @@
+fileSystemRoot/lib/documentmanagement/Document.inc");
+
+require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc");
+require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
+require_once("$default->fileSystemRoot/lib/visualpatterns/PatternBrowsableSearchResults.inc");
+require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
+require_once("$default->uiDirectory/documentmanagement/documentUI.inc");
+require_once("archivedDocumentsUI.inc");
+require_once("$default->fileSystemRoot/presentation/Html.inc");
+
+/**
+ * $Id$
+ *
+ * Business logic for searching archived documents
+ *
+ * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
+ *
+ * @version $Revision$
+ * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa
+ * @package presentation.lookAndFeel.knowledgeTree.administration.documentmanagement
+ */
+
+if (checkSession()) {
+ global $default;
+
+ // instantiate my content pattern
+ $oContent = new PatternCustom();
+
+ if (strlen($fSearchString) > 0) {
+ // perform the search and display the results
+ $fStartIndex = isset($fStartIndex) ? $fStartIndex : 0;
+ $oContent->setHtml(renderArchivedDocumentsResultsPage($fSearchString, $fStartIndex));
+ } else if ($fDocumentIDs) {
+ // got some documents to restore
+
+ // instantiate document objects
+ $aDocuments = array();
+ for ($i = 0; $i < count($fDocumentIDs); $i++) {
+ $aDocuments[] = & Document::get($fDocumentIDs[$i]);
+ }
+
+ if ($fConfirm) {
+ // restore the specified documents
+
+ $aErrorDocuments = array();
+ $aSuccessDocuments = array();
+ for ($i = 0; $i < count($aDocuments); $i++) {
+ if ($aDocuments[$i]) {
+ // set the status to live
+ $aDocuments[$i]->setStatusID(lookupStatusID("Live"));
+ if ($aDocuments[$i]->update()) {
+ // success
+ $default->log->info("manageArchivedDocumentsBL.php set status for document id=" . $fDocumentIDs[$i]);
+ $aSuccessDocuments[] = $aDocuments[$i];
+ } else{
+ // error updating status change
+ $default->log->error("manageArchivedDocumentsBL.php couldn't retrieve document id=" . $fDocumentIDs[$i]);
+ $aErrorDocuments[] = $aDocuments[$i];
+ }
+ } else {
+ // error retrieving document object
+ $default->log->error("manageArchivedDocumentsBL.php couldn't retrieve document id=" . $fDocumentIDs[$i]);
+ }
+ }
+ // display status page.
+ $oContent->setHtml(renderStatusPage($aSuccessDocuments, $aErrorDocuments));
+ } else {
+ // ask for confirmation before restoring the documents
+ $oContent->setHtml(renderRestoreConfirmationPage($aDocuments));
+ }
+ } else {
+ // display the search form
+ $oContent->setHtml(renderSearchPage());
+ }
+
+ // build the page
+ require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
+ $main->setCentralPayload($oContent);
+ $main->setFormAction($_SERVER['PHP_SELF']);
+ $main->setHasRequiredFields(true);
+ $main->render();
+}
+?>
\ No newline at end of file