Commit aaa5e69024e58cd638ca5ebe082c67f9668239fa

Authored by michael
1 parent ca10e4ba

added archive document page


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1934 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveDocumentBL.php 0 → 100644
  1 +<?php
  2 +
  3 +require_once("../../../../../config/dmsDefaults.php");
  4 +require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
  5 +
  6 +require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc");
  7 +
  8 +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc");
  9 +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
  10 +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
  11 +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
  12 +require_once("$default->uiDirectory/documentmanagement/documentUI.inc");
  13 +require_once("$default->uiDirectory/foldermanagement/folderUI.inc");
  14 +require_once("$default->uiDirectory/documentmanagement/archiving/archiveSettingsUI.inc");
  15 +
  16 +/**
  17 + * $Id$
  18 + *
  19 + * Business logic for archiving a document.
  20 + *
  21 + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  22 + *
  23 + * @version $Revision$
  24 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package presentation.lookAndFeel.knowledgeTree.documentmanagement.archiving
  26 + */
  27 +
  28 +if (checkSession()) {
  29 + global $default;
  30 +
  31 + // instantiate my content pattern
  32 + $oContent = new PatternCustom();
  33 +
  34 + if ($fDocumentID) {
  35 + if ($fConfirmed) {
  36 + $oDocument = Document::get($fDocumentID);
  37 + if ($oDocument) {
  38 + // change the document status to archived
  39 + $oDocument->setStatusID(lookupStatusID("Archived"));
  40 +
  41 + if ($oDocument->update()) {
  42 + // redirect to folder browse
  43 + $default->log->info("archiveDocumentBL.php successfully archived document id $fDocumentID");
  44 + redirect("$default->rootUrl/control.php?action=browse&fBrowseType=folder&fFolderID=" . $oDocument->getFolderID());
  45 + } else {
  46 + // error
  47 + $default->log->error("archiveDocumentBL.php error archiving document id $fDocumentID");
  48 + // display form with error
  49 + $oContent->setHtml(renderArchiveDocumentPage(null, "The archive settings for this document could not be updated"));
  50 + }
  51 + } else {
  52 + $default->log->error("archiveDocumentBL.php couldn't retrieve document id $fDocumentID from the db");
  53 + // display page with error?
  54 + }
  55 + } else {
  56 + // display the confirmation form
  57 + $oContent->setHtml(renderArchiveConfirmationPage($fDocumentID));
  58 + }
  59 + } else {
  60 + // error- no document reference
  61 + $oContent->setHtml(renderArchiveConfirmationPage(null, "No document supplied for archiving"));
  62 + }
  63 +
  64 + // build the page
  65 + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
  66 + $main->setCentralPayload($oContent);
  67 + $main->setFormAction($_SERVER['PHP_SELF']);
  68 + $main->setHasRequiredFields(true);
  69 + $main->render();
  70 +}
  71 +?>
0 72 \ No newline at end of file
... ...
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc
... ... @@ -252,39 +252,31 @@ function renderAddArchiveSettingsPage($iArchivingTypeID, $sErrorMessage = &quot;&quot;) {
252 252 return $sToRender;
253 253 }
254 254  
255   -function wrap($html) {
256   - global $default;
257   -
258   - return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
259   -<html>
260   -<head>
261   - <basefont size=\"2\" face=\"Arial,Helvetica,sans-serif\" color=\"#000000\">
262   - <title>Javascript Calendar Example by Lea Smart</title>
263   - <link rel=\"STYLESHEET\" type=\"text/css\" href=\"$default->uiUrl/calendar.css\">
264   - <script language=\"JavaScript\" src=\"$default->uiUrl/js/simplecalendar.js\" type=\"text/javascript\"></script>
265   - <style>
266   - td{
267   - font-family : Arial,Helvetica,Sans-serif;
268   - font-size : 12px;
269   - color : #000000;
270   - }
271   - input{
272   - font-family : Arial,Helvetica,Sans-serif;
273   - font-size : 12px;
274   - color : #000000;
275   - width : 90px;
276   - }
277   - </style>
278   -</head>
279   -<body bgcolor=\"#FFFFFF\">" . $html . "</form>
280   -</body>
281   -</html>";
282   -}
283   -
284 255  
285 256 /**
286 257 * Display the confirmation page for manual archiving of a document
287 258 */
288   -function renderArchiveConfirmationPage() {
  259 +function renderArchiveConfirmationPage($iDocumentID, $sErrorMessage = "") {
  260 + global $default;
  261 +
  262 + $sToRender .= renderHeading("Archive Document");
  263 + if (strlen($sErrorMessage) > 0) {
  264 + $sToRender .= renderErrorMessage($sErrorMessage);
  265 + }
  266 +
  267 + $sToRender .= "<table>\n";
  268 + $sToRender .= "<tr>\n";
  269 + $sToRender .= "<td>You have chosen to archive the document entitled </td></tr><tr><td>'" . Document::getDocumentName($iDocumentID) . "'.</td>\n";
  270 + $sToRender .= "<tr>\n<tr>\n";
  271 + $sToRender .= "<td>Select 'Archive' to confirm, or 'Cancel' to cancel.</td>\n";
  272 + $sToRender .= "<tr>\n";
  273 + $sToRender .= "<tr>\n";
  274 + $sToRender .= "<td>&nbsp</td>\n";
  275 + $sToRender .= "<tr>\n";
  276 + $sToRender .= "<td><table><tr><td><a href=\"" . $_SERVER["PHP_SELF"] . "?fDocumentID=$iDocumentID&fConfirmed=1\"><img src=\"$default->graphicsUrl/widgets/archive.gif\" border=\"0\"></a></td> <td><a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $iDocumentID . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"></a></td></tr></table></td>";
  277 + $sToRender .= "</tr>";
  278 + $sToRender .= "</table>\n";
  279 +
  280 + return $sToRender;
289 281 }
290 282 ?>
291 283 \ No newline at end of file
... ...