diff --git a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/expungeDeletedDocumentsBL.php b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/expungeDeletedDocumentsBL.php deleted file mode 100644 index 48ec595..0000000 --- a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/expungeDeletedDocumentsBL.php +++ /dev/null @@ -1,100 +0,0 @@ -fileSystemRoot/lib/documentmanagement/Document.inc"); -require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); -require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); -require_once("expungeDeletedDocumentsUI.inc"); -require_once("$default->fileSystemRoot/presentation/Html.inc"); -/** - * $Id$ - * - * Business logic for expunging deleted documents. - * - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * @package administration.documentmanagement - */ - -if (checkSession()) { - global $default; - - $oContent = new PatternCustom(); - - if ($fDocumentIDs) { - // got some documents to expunge - - // instantiate document objects - $aDocuments = array(); - for ($i = 0; $i < count($fDocumentIDs); $i++) { - $aDocuments[] = & Document::get($fDocumentIDs[$i]); - } - - if ($fConfirm) { - $aErrorDocuments = array(); - $aSuccessDocuments = array(); - // delete the specified documents - for ($i=0; $icreate(); - - // delete this from the db now - if ($aDocuments[$i]->delete()) { - // removed succesfully - $aSuccessDocuments[] = $aDocuments[$i]->getDisplayPath(); - - // remove any document data - $aDocuments[$i]->cleanupDocumentData($fDocumentIDs[$i]); - - } else { - $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $fDocumentIDs[$i] . " from the db"); - $aErrorDocuments[] = $aDocuments[$i]->getDisplayPath(); - } - } else { - $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $fDocumentIDs[$i] . " from the filesystem"); - $aErrorDocuments[] = $aDocuments[$i]->getDisplayPath(); - } - } - // display results page - $oContent->setHtml(renderStatusPage($aSuccessDocuments, $aErrorDocuments)); - } else { - // ask for confirmation - $oContent->setHtml(renderConfirmDocuments($aDocuments)); - } - } else { - // redirect to list deleted documents page - controllerRedirect("deletedDocuments", ""); - } - - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $main->setCentralPayload($oContent); - $main->setFormAction($_SERVER["PHP_SELF"]); - $main->render(); -} -?> diff --git a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/listDeletedDocumentsBL.php b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/listDeletedDocumentsBL.php deleted file mode 100644 index 6b47b57..0000000 --- a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/listDeletedDocumentsBL.php +++ /dev/null @@ -1,60 +0,0 @@ -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/PatternTableSqlQuery.inc"); -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); - -require_once("listDeletedDocumentsUI.inc"); -require_once("$default->fileSystemRoot/presentation/Html.inc"); -/** - * $Id$ - * - * Business logic for listing deleted documents. - * - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * @package administration.documentmanagement - */ - -if (checkSession()) { - global $default; - - $oContent = new PatternCustom(); - - if ($fDocumentIDs) { - // tack on POSTed document ids and redirect to the expunge deleted documents page - foreach ($fDocumentIDs as $fDocumentID) { - $sQueryString .= "fDocumentIDs[]=$fDocumentID&"; - } - controllerRedirect("expungeDeletedDocuments", $sQueryString); - } else { - $oContent->setHtml(renderListDeletedDocumentsPage(Document::getList("status_id=" . DELETED)));/*ok*/ - } - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $main->setCentralPayload($oContent); - $main->setFormAction($_SERVER["PHP_SELF"]); - $main->render(); -} -?> diff --git a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php deleted file mode 100644 index 85887d9..0000000 --- a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php +++ /dev/null @@ -1,116 +0,0 @@ -fileSystemRoot/lib/documentmanagement/Document.inc"); -require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); -require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); -require_once("restoreDeletedDocumentsUI.inc"); -require_once("$default->fileSystemRoot/presentation/Html.inc"); -/** - * $Id$ - * - * Business logic for restoring deleted documents. - * - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * @package administration.documentmanagement - */ - -if (checkSession()) { - global $default; - - $oContent = new PatternCustom(); - - if ($fDocumentID && $fFolderID) { - if (isset($fForMove)) { - $oDocument = Document::get($fDocumentID); - $oFolder = Folder::get($fFolderID); - if ($oDocument && $oFolder) { - if ($fConfirmed) { - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - // restore the document - $oDocument->setStatusID(LIVE); - $oDocument->setFolderID($oFolder->getID()); - - // first try moving the document on the filesystem - if (PhysicalDocumentManager::restore($oDocument)) { - // now update the db - if ($oDocument->update(true)) { - // display confirmation page - $oContent->setHtml(renderStatusPage($oDocument)); - } else { - $default->log->error("restoreDeletedDocumentBL.php couldn't update db for " . arrayToString($oDocument)); - // TODO: display error - $oContent->setHtml(renderErrorPage(_("The document could not be restored. Please try again later"))); - } - } else { - $default->log->error("restoreDeletedDocumentBL.php filesystem restore failed for " . arrayToString($oDocument)); - // TODO: display error - $oContent->setHtml(renderErrorPage(_("The document could not be restored. Please try again later"))); - } - } else { - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - // check if the selected folder has the same document type as the document we're moving - if (Folder::folderIsLinkedToDocType($fFolderID, $oDocument->getDocumentTypeID())) { - if (!Document::documentExists($oDocument->getFileName(), $fFolderID)) { - $oContent->setHtml(renderConfirmationPage($fDocumentID, $fFolderID)); - } else { - // there is already a document with that filename here - $oContent->setHtml(statusPage(_("Restore Deleted Document"), "", - sprintf(_("A document with this file name (%s) already exists in that folder."), $oDocument->getFileName()), "restoreDeletedDocument", "fDocumentID=$fDocumentID&fFolderID=$fFolderID")); - } - } else { - // the right document type isn't mapped - $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")); - } - } - } else { - // no document - $default->log->error("restoreDeletedDocumentBL.php documentID=$fDocumentID folderID=$fFolderID instantiation failed"); - // TODO: redirect to list page with error - controllerRedirect("deletedDocuments", ""); - } - } else { - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - // display browse page - $oContent->setHtml(renderFolderBrowsePage($fDocumentID, $fFolderID)); - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForMove=1&fDocumentID=$fDocumentID&fFolderID=$fFolderID"); - } - } else { - // no document - $default->log->error("restoreDeletedDocumentBL.php no document ID supplied"); - // TODO: redirect to list page with error - controllerRedirect("deletedDocuments", ""); - } - - $main->setCentralPayload($oContent); - if ($main->getFormAction() == "") { - $main->setFormAction($_SERVER["PHP_SELF"]); - } - $main->render(); -} -?> diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/addArchiveSettingsBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/addArchiveSettingsBL.php deleted file mode 100644 index d5492e4..0000000 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/addArchiveSettingsBL.php +++ /dev/null @@ -1,81 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package documentmanagement.archiving - */ - -require_once("../../../../../config/dmsDefaults.php"); - -KTUtil::extractGPC('fArchivingTypeID', 'fDocumentID', 'fDocumentTransactionID', 'fExpirationDate', 'fStore', 'fTimeUnitID', 'fUnits'); - -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); - -require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc"); - -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); -require_once("$default->uiDirectory/documentmanagement/archiving/archiveSettingsUI.inc"); -require_once("$default->fileSystemRoot/presentation/Html.inc"); - -if (checkSession()) { - global $default; - - // instantiate my content pattern - $oContent = new PatternCustom(); - - if ($fStore) { - $oDASFactory = new DocumentArchiveSettingsFactory($fArchivingTypeID); - if ($oDASFactory->validateDate($fExpirationDate)) { - if ($oDASFactory->create($fArchivingTypeID, $fDocumentID, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) { - // created, redirect to view page - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings"); - } else { - // error - $default->log->error("addArchiveSettingsBL.php error adding archive settings"); - // display form with error - $oContent->setHtml(renderAddArchiveSettingsPage(null, _("The archive settings for this document could not be added"))); - } - } else { - $oContent->setHtml(renderAddArchiveSettingsPage($fDocumentID, $fArchivingTypeID, _("You cannot select an expiration date in the past. Please try again."))); - } - } elseif (isset($fArchivingTypeID)) { - // the archiving type has been chosen, so display the correct form - $oContent->setHtml(renderAddArchiveSettingsPage($fDocumentID, $fArchivingTypeID)); - } else { - // display the select archiving type page - $oContent->setHtml(renderAddArchiveSettingsPage($fDocumentID)); - } - - // build the page - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $main->setCentralPayload($oContent); - $main->setFormAction($_SERVER['PHP_SELF']); - $main->setSubmitMethod("GET"); - $main->setHasRequiredFields(true); - $main->render(); -} -?> diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php deleted file mode 100644 index d0903a1..0000000 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php +++ /dev/null @@ -1,97 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package documentmanagement.archiving - */ - -require_once("../../../../../config/dmsDefaults.php"); - -KTUtil::extractGPC('fDelete', 'fDocumentID', 'fDocumentTransactionID', 'fExpirationDate', 'fStore', 'fTimeUnitID', 'fUnits'); - -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); - -require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc"); -require_once("$default->fileSystemRoot/lib/archiving/ArchivingSettings.inc"); - -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); -require_once("$default->fileSystemRoot/presentation/Html.inc"); -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); -require_once("$default->uiDirectory/documentmanagement/archiving/archiveSettingsUI.inc"); - -if (checkSession()) { - global $default; - - // instantiate my content pattern - $oContent = new PatternCustom(); - - if ($fDocumentID) { - // retrieve the appropriate settings given the document id - $oDocumentArchiving = DocumentArchiving::getFromDocumentID($fDocumentID); - // retrieve the settings - $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); - if ($oDocumentArchiving && $oArchiveSettings) { - if ($fStore) { - $oDASFactory = new DocumentArchiveSettingsFactory(); - if ($oDASFactory->validateDate($fExpirationDate)) { - if ($oDASFactory->update($oDocumentArchiving, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) { - $default->log->info("modifyArchiveSettingsBL.php successfully updated archive settings (documentID=$fDocumentID)"); - // created, redirect to view page - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings"); - } else { - $default->log->error("modifyArchiveSettingsBL.php error updating archive settings (documentID=$fDocumentID)"); - } - } else { - $oContent->setHtml(renderEditArchiveSettingsPage($fDocumentID, $oArchiveSettings, _("You cannot select an expiration date in the past. Please try again."))); - } - } elseif ($fDelete) { - if ($oDocumentArchiving->delete()) { - $default->log->info("modifyArchiveSettingsBL.php successfully deleted archive settings (documentID=$fDocumentID)"); - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings"); - } else { - $default->log->error("modifyArchiveSettingsBL.php error deleting archive settings (documentID=$fDocumentID)"); - } - } else { - // display the edit page - $oContent->setHtml(renderEditArchiveSettingsPage($fDocumentID, $oArchiveSettings)); - } - } else { - // no archiving settings for this document - $oContent->setHtml(renderEditArchiveSettingsPage(null, null, _("No document has been selected."))); - } - } else { - // document id missing - $oContent->setHtml(renderEditArchiveSettingsPage(null, null, _("No document has been selected."))); - } - - // build the page - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $main->setCentralPayload($oContent); - $main->setFormAction($_SERVER['PHP_SELF']); - $main->setHasRequiredFields(true); - $main->render(); -} -?> diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/requestDocumentRestoreBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/requestDocumentRestoreBL.php deleted file mode 100644 index ae7b912..0000000 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/requestDocumentRestoreBL.php +++ /dev/null @@ -1,97 +0,0 @@ -fileSystemRoot/lib/documentmanagement/Document.inc"); -require_once("$default->fileSystemRoot/lib/archiving/ArchiveRestorationRequest.inc"); -require_once("$default->fileSystemRoot/lib/email/Email.inc"); -require_once("$default->fileSystemRoot/lib/users/User.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); -require_once("restoreArchivedDocumentUI.inc"); -require_once("$default->uiDirectory/documentmanagement/documentUI.inc"); -require_once("$default->fileSystemRoot/presentation/Html.inc"); -/** - * $Id$ - * - * Business logic for requesting the restoration of an archived document. - * - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * @package documentmanagement.archiving - */ - -if (checkSession()) { - global $default; - - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - - // instantiate my content pattern - $oContent = new PatternCustom(); - - if ($fDocumentID) { - // instantiate the document - $oDocument = Document::get($fDocumentID); - if ($oDocument) { - - // lookup the unit admin - $oUnitAdminUser = User::getUnitAdminUser(); - - // FIXME: what if i can't find a unit administrator?? - // presumably find a system administrator then? - - // create the request - $oRestoreRequest = new ArchiveRestorationRequest($fDocumentID, $_SESSION["userID"], $oUnitAdminUser->getID()); - if ($oRestoreRequest->create()) { - // FIXME: refactor notification - // send the email requesting the restoration of an archived document - $oUser = User::get($_SESSION["userID"]); - - $sBody = $oUnitAdmin->getName() . ",

The user " . $oUser->getName() . " has requested that document "; - $sBody .= "'" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), $oDocument->getName()) . "'"; - $sBody .= " be restored from the archive."; - $oEmail = & new Email(); - $oEmail->send($oUnitAdmin->getEmail(), "Archived Document Restoration Request", $sBody); - - // display a confirmation message - $oContent->setHtml(renderRequestSuccessPage($oDocument)); - } else { - // error creating the request - $oContent->setHtml(renderRequestFailurePage($oDocument)); - } - } else { - // error retrieving document - $default->log->error("requestDocumentRestoreBL.php there was an error retrieving document id=$fDocumentID from the db"); - // TODO: generic error page - } - - } else { - // display the select archiving type page - $oContent->setHtml(renderAddArchiveSettingsPage(null)); - } - - // build the page - $main->setCentralPayload($oContent); - $main->setFormAction($_SERVER['PHP_SELF']); - $main->setHasRequiredFields(true); - $main->render(); -} -?>