Commit f84b84d754befcc822ff50f2541c20058a153af0
1 parent
ffc1dbb3
These files have been re-implemented using the Admin and Dispatcher
systems. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4323 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
6 changed files
with
0 additions
and
551 deletions
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/expungeDeletedDocumentsBL.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 4 | - | |
| 5 | -KTUtil::extractGPC('fConfirm', 'fDocumentIDs'); | |
| 6 | - | |
| 7 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 8 | -require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); | |
| 9 | -require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); | |
| 10 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | |
| 11 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 12 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | |
| 13 | -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); | |
| 14 | -require_once("expungeDeletedDocumentsUI.inc"); | |
| 15 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 16 | -/** | |
| 17 | - * $Id$ | |
| 18 | - * | |
| 19 | - * Business logic for expunging deleted documents. | |
| 20 | - * | |
| 21 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 22 | - * | |
| 23 | - * This program is free software; you can redistribute it and/or modify | |
| 24 | - * it under the terms of the GNU General Public License as published by | |
| 25 | - * the Free Software Foundation; either version 2 of the License, or | |
| 26 | - * (at your option) any later version. | |
| 27 | - * | |
| 28 | - * This program is distributed in the hope that it will be useful, | |
| 29 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 30 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 31 | - * GNU General Public License for more details. | |
| 32 | - * | |
| 33 | - * You should have received a copy of the GNU General Public License | |
| 34 | - * along with this program; if not, write to the Free Software | |
| 35 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 36 | - * | |
| 37 | - * @version $Revision$ | |
| 38 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 39 | - * @package administration.documentmanagement | |
| 40 | - */ | |
| 41 | - | |
| 42 | -if (checkSession()) { | |
| 43 | - global $default; | |
| 44 | - | |
| 45 | - $oContent = new PatternCustom(); | |
| 46 | - | |
| 47 | - if ($fDocumentIDs) { | |
| 48 | - // got some documents to expunge | |
| 49 | - | |
| 50 | - // instantiate document objects | |
| 51 | - $aDocuments = array(); | |
| 52 | - for ($i = 0; $i < count($fDocumentIDs); $i++) { | |
| 53 | - $aDocuments[] = & Document::get($fDocumentIDs[$i]); | |
| 54 | - } | |
| 55 | - | |
| 56 | - if ($fConfirm) { | |
| 57 | - $aErrorDocuments = array(); | |
| 58 | - $aSuccessDocuments = array(); | |
| 59 | - // delete the specified documents | |
| 60 | - for ($i=0; $i<count($aDocuments); $i++) { | |
| 61 | - if (PhysicalDocumentManager::expunge($aDocuments[$i])) { | |
| 62 | - | |
| 63 | - // store an expunge transaction | |
| 64 | - $oDocumentTransaction = & new DocumentTransaction($fDocumentIDs[$i], "Document expunged", EXPUNGE); | |
| 65 | - $oDocumentTransaction->create(); | |
| 66 | - | |
| 67 | - // delete this from the db now | |
| 68 | - if ($aDocuments[$i]->delete()) { | |
| 69 | - // removed succesfully | |
| 70 | - $aSuccessDocuments[] = $aDocuments[$i]->getDisplayPath(); | |
| 71 | - | |
| 72 | - // remove any document data | |
| 73 | - $aDocuments[$i]->cleanupDocumentData($fDocumentIDs[$i]); | |
| 74 | - | |
| 75 | - } else { | |
| 76 | - $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $fDocumentIDs[$i] . " from the db"); | |
| 77 | - $aErrorDocuments[] = $aDocuments[$i]->getDisplayPath(); | |
| 78 | - } | |
| 79 | - } else { | |
| 80 | - $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $fDocumentIDs[$i] . " from the filesystem"); | |
| 81 | - $aErrorDocuments[] = $aDocuments[$i]->getDisplayPath(); | |
| 82 | - } | |
| 83 | - } | |
| 84 | - // display results page | |
| 85 | - $oContent->setHtml(renderStatusPage($aSuccessDocuments, $aErrorDocuments)); | |
| 86 | - } else { | |
| 87 | - // ask for confirmation | |
| 88 | - $oContent->setHtml(renderConfirmDocuments($aDocuments)); | |
| 89 | - } | |
| 90 | - } else { | |
| 91 | - // redirect to list deleted documents page | |
| 92 | - controllerRedirect("deletedDocuments", ""); | |
| 93 | - } | |
| 94 | - | |
| 95 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 96 | - $main->setCentralPayload($oContent); | |
| 97 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 98 | - $main->render(); | |
| 99 | -} | |
| 100 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/listDeletedDocumentsBL.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 4 | - | |
| 5 | -KTUtil::extractGPC('fDocumentID', 'fDocumentIDs'); | |
| 6 | - | |
| 7 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 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->uiDirectory/documentmanagement/documentUI.inc"); | |
| 12 | - | |
| 13 | -require_once("listDeletedDocumentsUI.inc"); | |
| 14 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 15 | -/** | |
| 16 | - * $Id$ | |
| 17 | - * | |
| 18 | - * Business logic for listing deleted documents. | |
| 19 | - * | |
| 20 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 21 | - * | |
| 22 | - * This program is free software; you can redistribute it and/or modify | |
| 23 | - * it under the terms of the GNU General Public License as published by | |
| 24 | - * the Free Software Foundation; either version 2 of the License, or | |
| 25 | - * (at your option) any later version. | |
| 26 | - * | |
| 27 | - * This program is distributed in the hope that it will be useful, | |
| 28 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 29 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 30 | - * GNU General Public License for more details. | |
| 31 | - * | |
| 32 | - * You should have received a copy of the GNU General Public License | |
| 33 | - * along with this program; if not, write to the Free Software | |
| 34 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 35 | - * | |
| 36 | - * @version $Revision$ | |
| 37 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 38 | - * @package administration.documentmanagement | |
| 39 | - */ | |
| 40 | - | |
| 41 | -if (checkSession()) { | |
| 42 | - global $default; | |
| 43 | - | |
| 44 | - $oContent = new PatternCustom(); | |
| 45 | - | |
| 46 | - if ($fDocumentIDs) { | |
| 47 | - // tack on POSTed document ids and redirect to the expunge deleted documents page | |
| 48 | - foreach ($fDocumentIDs as $fDocumentID) { | |
| 49 | - $sQueryString .= "fDocumentIDs[]=$fDocumentID&"; | |
| 50 | - } | |
| 51 | - controllerRedirect("expungeDeletedDocuments", $sQueryString); | |
| 52 | - } else { | |
| 53 | - $oContent->setHtml(renderListDeletedDocumentsPage(Document::getList("status_id=" . DELETED)));/*ok*/ | |
| 54 | - } | |
| 55 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 56 | - $main->setCentralPayload($oContent); | |
| 57 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 58 | - $main->render(); | |
| 59 | -} | |
| 60 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 4 | - | |
| 5 | -KTUtil::extractGPC('fConfirmed', 'fDocumentID', 'fFolderID', 'fForMove'); | |
| 6 | - | |
| 7 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 8 | -require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); | |
| 9 | -require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); | |
| 10 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | |
| 11 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 12 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | |
| 13 | -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); | |
| 14 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 15 | -require_once("restoreDeletedDocumentsUI.inc"); | |
| 16 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 17 | -/** | |
| 18 | - * $Id$ | |
| 19 | - * | |
| 20 | - * Business logic for restoring deleted documents. | |
| 21 | - * | |
| 22 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 23 | - * | |
| 24 | - * This program is free software; you can redistribute it and/or modify | |
| 25 | - * it under the terms of the GNU General Public License as published by | |
| 26 | - * the Free Software Foundation; either version 2 of the License, or | |
| 27 | - * (at your option) any later version. | |
| 28 | - * | |
| 29 | - * This program is distributed in the hope that it will be useful, | |
| 30 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 31 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 32 | - * GNU General Public License for more details. | |
| 33 | - * | |
| 34 | - * You should have received a copy of the GNU General Public License | |
| 35 | - * along with this program; if not, write to the Free Software | |
| 36 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 37 | - * | |
| 38 | - * @version $Revision$ | |
| 39 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 40 | - * @package administration.documentmanagement | |
| 41 | - */ | |
| 42 | - | |
| 43 | -if (checkSession()) { | |
| 44 | - global $default; | |
| 45 | - | |
| 46 | - $oContent = new PatternCustom(); | |
| 47 | - | |
| 48 | - if ($fDocumentID && $fFolderID) { | |
| 49 | - if (isset($fForMove)) { | |
| 50 | - $oDocument = Document::get($fDocumentID); | |
| 51 | - $oFolder = Folder::get($fFolderID); | |
| 52 | - if ($oDocument && $oFolder) { | |
| 53 | - if ($fConfirmed) { | |
| 54 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 55 | - // restore the document | |
| 56 | - $oDocument->setStatusID(LIVE); | |
| 57 | - $oDocument->setFolderID($oFolder->getID()); | |
| 58 | - | |
| 59 | - // first try moving the document on the filesystem | |
| 60 | - if (PhysicalDocumentManager::restore($oDocument)) { | |
| 61 | - // now update the db | |
| 62 | - if ($oDocument->update(true)) { | |
| 63 | - // display confirmation page | |
| 64 | - $oContent->setHtml(renderStatusPage($oDocument)); | |
| 65 | - } else { | |
| 66 | - $default->log->error("restoreDeletedDocumentBL.php couldn't update db for " . arrayToString($oDocument)); | |
| 67 | - // TODO: display error | |
| 68 | - $oContent->setHtml(renderErrorPage(_("The document could not be restored. Please try again later"))); | |
| 69 | - } | |
| 70 | - } else { | |
| 71 | - $default->log->error("restoreDeletedDocumentBL.php filesystem restore failed for " . arrayToString($oDocument)); | |
| 72 | - // TODO: display error | |
| 73 | - $oContent->setHtml(renderErrorPage(_("The document could not be restored. Please try again later"))); | |
| 74 | - } | |
| 75 | - } else { | |
| 76 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 77 | - // check if the selected folder has the same document type as the document we're moving | |
| 78 | - if (Folder::folderIsLinkedToDocType($fFolderID, $oDocument->getDocumentTypeID())) { | |
| 79 | - if (!Document::documentExists($oDocument->getFileName(), $fFolderID)) { | |
| 80 | - $oContent->setHtml(renderConfirmationPage($fDocumentID, $fFolderID)); | |
| 81 | - } else { | |
| 82 | - // there is already a document with that filename here | |
| 83 | - $oContent->setHtml(statusPage(_("Restore Deleted Document"), "", | |
| 84 | - sprintf(_("A document with this file name (%s) already exists in that folder."), $oDocument->getFileName()), "restoreDeletedDocument", "fDocumentID=$fDocumentID&fFolderID=$fFolderID")); | |
| 85 | - } | |
| 86 | - } else { | |
| 87 | - // the right document type isn't mapped | |
| 88 | - $oContent->setHtml(statusPage(_("Restored Deleted Document"), "", _("You can't restore the document to this folder because it cannot store the document type of your document. Please choose another directory."), "restoreDeletedDocument", "fDocumentID=$fDocumentID&fFolderID=$fFolderID")); | |
| 89 | - } | |
| 90 | - } | |
| 91 | - } else { | |
| 92 | - // no document | |
| 93 | - $default->log->error("restoreDeletedDocumentBL.php documentID=$fDocumentID folderID=$fFolderID instantiation failed"); | |
| 94 | - // TODO: redirect to list page with error | |
| 95 | - controllerRedirect("deletedDocuments", ""); | |
| 96 | - } | |
| 97 | - } else { | |
| 98 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 99 | - // display browse page | |
| 100 | - $oContent->setHtml(renderFolderBrowsePage($fDocumentID, $fFolderID)); | |
| 101 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForMove=1&fDocumentID=$fDocumentID&fFolderID=$fFolderID"); | |
| 102 | - } | |
| 103 | - } else { | |
| 104 | - // no document | |
| 105 | - $default->log->error("restoreDeletedDocumentBL.php no document ID supplied"); | |
| 106 | - // TODO: redirect to list page with error | |
| 107 | - controllerRedirect("deletedDocuments", ""); | |
| 108 | - } | |
| 109 | - | |
| 110 | - $main->setCentralPayload($oContent); | |
| 111 | - if ($main->getFormAction() == "") { | |
| 112 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 113 | - } | |
| 114 | - $main->render(); | |
| 115 | -} | |
| 116 | -?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/addArchiveSettingsBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Business logic for setting document archive settings. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package documentmanagement.archiving | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fArchivingTypeID', 'fDocumentID', 'fDocumentTransactionID', 'fExpirationDate', 'fStore', 'fTimeUnitID', 'fUnits'); | |
| 31 | - | |
| 32 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 33 | - | |
| 34 | -require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc"); | |
| 35 | - | |
| 36 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | |
| 37 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 38 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | |
| 39 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 40 | -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); | |
| 41 | -require_once("$default->uiDirectory/documentmanagement/archiving/archiveSettingsUI.inc"); | |
| 42 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 43 | - | |
| 44 | -if (checkSession()) { | |
| 45 | - global $default; | |
| 46 | - | |
| 47 | - // instantiate my content pattern | |
| 48 | - $oContent = new PatternCustom(); | |
| 49 | - | |
| 50 | - if ($fStore) { | |
| 51 | - $oDASFactory = new DocumentArchiveSettingsFactory($fArchivingTypeID); | |
| 52 | - if ($oDASFactory->validateDate($fExpirationDate)) { | |
| 53 | - if ($oDASFactory->create($fArchivingTypeID, $fDocumentID, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) { | |
| 54 | - // created, redirect to view page | |
| 55 | - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings"); | |
| 56 | - } else { | |
| 57 | - // error | |
| 58 | - $default->log->error("addArchiveSettingsBL.php error adding archive settings"); | |
| 59 | - // display form with error | |
| 60 | - $oContent->setHtml(renderAddArchiveSettingsPage(null, _("The archive settings for this document could not be added"))); | |
| 61 | - } | |
| 62 | - } else { | |
| 63 | - $oContent->setHtml(renderAddArchiveSettingsPage($fDocumentID, $fArchivingTypeID, _("You cannot select an expiration date in the past. Please try again."))); | |
| 64 | - } | |
| 65 | - } elseif (isset($fArchivingTypeID)) { | |
| 66 | - // the archiving type has been chosen, so display the correct form | |
| 67 | - $oContent->setHtml(renderAddArchiveSettingsPage($fDocumentID, $fArchivingTypeID)); | |
| 68 | - } else { | |
| 69 | - // display the select archiving type page | |
| 70 | - $oContent->setHtml(renderAddArchiveSettingsPage($fDocumentID)); | |
| 71 | - } | |
| 72 | - | |
| 73 | - // build the page | |
| 74 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 75 | - $main->setCentralPayload($oContent); | |
| 76 | - $main->setFormAction($_SERVER['PHP_SELF']); | |
| 77 | - $main->setSubmitMethod("GET"); | |
| 78 | - $main->setHasRequiredFields(true); | |
| 79 | - $main->render(); | |
| 80 | -} | |
| 81 | -?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Business logic for setting document archive settings. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package documentmanagement.archiving | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fDelete', 'fDocumentID', 'fDocumentTransactionID', 'fExpirationDate', 'fStore', 'fTimeUnitID', 'fUnits'); | |
| 31 | - | |
| 32 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 33 | - | |
| 34 | -require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc"); | |
| 35 | -require_once("$default->fileSystemRoot/lib/archiving/ArchivingSettings.inc"); | |
| 36 | - | |
| 37 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | |
| 38 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 39 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | |
| 40 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 41 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 42 | -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); | |
| 43 | -require_once("$default->uiDirectory/documentmanagement/archiving/archiveSettingsUI.inc"); | |
| 44 | - | |
| 45 | -if (checkSession()) { | |
| 46 | - global $default; | |
| 47 | - | |
| 48 | - // instantiate my content pattern | |
| 49 | - $oContent = new PatternCustom(); | |
| 50 | - | |
| 51 | - if ($fDocumentID) { | |
| 52 | - // retrieve the appropriate settings given the document id | |
| 53 | - $oDocumentArchiving = DocumentArchiving::getFromDocumentID($fDocumentID); | |
| 54 | - // retrieve the settings | |
| 55 | - $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); | |
| 56 | - if ($oDocumentArchiving && $oArchiveSettings) { | |
| 57 | - if ($fStore) { | |
| 58 | - $oDASFactory = new DocumentArchiveSettingsFactory(); | |
| 59 | - if ($oDASFactory->validateDate($fExpirationDate)) { | |
| 60 | - if ($oDASFactory->update($oDocumentArchiving, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) { | |
| 61 | - $default->log->info("modifyArchiveSettingsBL.php successfully updated archive settings (documentID=$fDocumentID)"); | |
| 62 | - // created, redirect to view page | |
| 63 | - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings"); | |
| 64 | - } else { | |
| 65 | - $default->log->error("modifyArchiveSettingsBL.php error updating archive settings (documentID=$fDocumentID)"); | |
| 66 | - } | |
| 67 | - } else { | |
| 68 | - $oContent->setHtml(renderEditArchiveSettingsPage($fDocumentID, $oArchiveSettings, _("You cannot select an expiration date in the past. Please try again."))); | |
| 69 | - } | |
| 70 | - } elseif ($fDelete) { | |
| 71 | - if ($oDocumentArchiving->delete()) { | |
| 72 | - $default->log->info("modifyArchiveSettingsBL.php successfully deleted archive settings (documentID=$fDocumentID)"); | |
| 73 | - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings"); | |
| 74 | - } else { | |
| 75 | - $default->log->error("modifyArchiveSettingsBL.php error deleting archive settings (documentID=$fDocumentID)"); | |
| 76 | - } | |
| 77 | - } else { | |
| 78 | - // display the edit page | |
| 79 | - $oContent->setHtml(renderEditArchiveSettingsPage($fDocumentID, $oArchiveSettings)); | |
| 80 | - } | |
| 81 | - } else { | |
| 82 | - // no archiving settings for this document | |
| 83 | - $oContent->setHtml(renderEditArchiveSettingsPage(null, null, _("No document has been selected."))); | |
| 84 | - } | |
| 85 | - } else { | |
| 86 | - // document id missing | |
| 87 | - $oContent->setHtml(renderEditArchiveSettingsPage(null, null, _("No document has been selected."))); | |
| 88 | - } | |
| 89 | - | |
| 90 | - // build the page | |
| 91 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 92 | - $main->setCentralPayload($oContent); | |
| 93 | - $main->setFormAction($_SERVER['PHP_SELF']); | |
| 94 | - $main->setHasRequiredFields(true); | |
| 95 | - $main->render(); | |
| 96 | -} | |
| 97 | -?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/requestDocumentRestoreBL.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 4 | - | |
| 5 | -KTUtil::extractGPC('fDocumentID'); | |
| 6 | - | |
| 7 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 8 | -require_once("$default->fileSystemRoot/lib/archiving/ArchiveRestorationRequest.inc"); | |
| 9 | -require_once("$default->fileSystemRoot/lib/email/Email.inc"); | |
| 10 | -require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 11 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | |
| 12 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 13 | -require_once("restoreArchivedDocumentUI.inc"); | |
| 14 | -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); | |
| 15 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 16 | -/** | |
| 17 | - * $Id$ | |
| 18 | - * | |
| 19 | - * Business logic for requesting the restoration of an archived document. | |
| 20 | - * | |
| 21 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 22 | - * | |
| 23 | - * This program is free software; you can redistribute it and/or modify | |
| 24 | - * it under the terms of the GNU General Public License as published by | |
| 25 | - * the Free Software Foundation; either version 2 of the License, or | |
| 26 | - * (at your option) any later version. | |
| 27 | - * | |
| 28 | - * This program is distributed in the hope that it will be useful, | |
| 29 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 30 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 31 | - * GNU General Public License for more details. | |
| 32 | - * | |
| 33 | - * You should have received a copy of the GNU General Public License | |
| 34 | - * along with this program; if not, write to the Free Software | |
| 35 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 36 | - * | |
| 37 | - * @version $Revision$ | |
| 38 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 39 | - * @package documentmanagement.archiving | |
| 40 | - */ | |
| 41 | - | |
| 42 | -if (checkSession()) { | |
| 43 | - global $default; | |
| 44 | - | |
| 45 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 46 | - | |
| 47 | - // instantiate my content pattern | |
| 48 | - $oContent = new PatternCustom(); | |
| 49 | - | |
| 50 | - if ($fDocumentID) { | |
| 51 | - // instantiate the document | |
| 52 | - $oDocument = Document::get($fDocumentID); | |
| 53 | - if ($oDocument) { | |
| 54 | - | |
| 55 | - // lookup the unit admin | |
| 56 | - $oUnitAdminUser = User::getUnitAdminUser(); | |
| 57 | - | |
| 58 | - // FIXME: what if i can't find a unit administrator?? | |
| 59 | - // presumably find a system administrator then? | |
| 60 | - | |
| 61 | - // create the request | |
| 62 | - $oRestoreRequest = new ArchiveRestorationRequest($fDocumentID, $_SESSION["userID"], $oUnitAdminUser->getID()); | |
| 63 | - if ($oRestoreRequest->create()) { | |
| 64 | - // FIXME: refactor notification | |
| 65 | - // send the email requesting the restoration of an archived document | |
| 66 | - $oUser = User::get($_SESSION["userID"]); | |
| 67 | - | |
| 68 | - $sBody = $oUnitAdmin->getName() . ",<br><br> The user " . $oUser->getName() . " has requested that document "; | |
| 69 | - $sBody .= "'" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), $oDocument->getName()) . "'"; | |
| 70 | - $sBody .= " be restored from the archive."; | |
| 71 | - $oEmail = & new Email(); | |
| 72 | - $oEmail->send($oUnitAdmin->getEmail(), "Archived Document Restoration Request", $sBody); | |
| 73 | - | |
| 74 | - // display a confirmation message | |
| 75 | - $oContent->setHtml(renderRequestSuccessPage($oDocument)); | |
| 76 | - } else { | |
| 77 | - // error creating the request | |
| 78 | - $oContent->setHtml(renderRequestFailurePage($oDocument)); | |
| 79 | - } | |
| 80 | - } else { | |
| 81 | - // error retrieving document | |
| 82 | - $default->log->error("requestDocumentRestoreBL.php there was an error retrieving document id=$fDocumentID from the db"); | |
| 83 | - // TODO: generic error page | |
| 84 | - } | |
| 85 | - | |
| 86 | - } else { | |
| 87 | - // display the select archiving type page | |
| 88 | - $oContent->setHtml(renderAddArchiveSettingsPage(null)); | |
| 89 | - } | |
| 90 | - | |
| 91 | - // build the page | |
| 92 | - $main->setCentralPayload($oContent); | |
| 93 | - $main->setFormAction($_SERVER['PHP_SELF']); | |
| 94 | - $main->setHasRequiredFields(true); | |
| 95 | - $main->render(); | |
| 96 | -} | |
| 97 | -?> |