From c8756e10952e3e5205fda06fb08aacd1f8df7a88 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 23 Jun 2003 14:41:26 +0000 Subject: [PATCH] updates for merged archiving settings table --- presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc | 49 ++++++++++++++++++------------------------------- presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php | 13 ++++++++----- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc index 1320058..9be73ac 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc @@ -126,16 +126,14 @@ function renderTimePeriod($sHeading, $oTimePeriod = null) { * * @param integer the archive settings to modify, null display an add form */ -function renderArchiveSettingsForm($oDocumentArchiving = null) { +function renderArchiveSettingsForm($iDocumentID, $oArchiveSettings, $iArchivingTypeID = -1) { global $default, $fDocumentID; - if (is_a($oDocumentArchiving, "DocumentArchiving")) { + if ($oArchiveSettings) { $sToRender .= "(in order to change the archiving type for this document, click the 'Remove' button and add new archiving settings)"; - $iArchivingTypeID = $oDocumentArchiving->getArchivingTypeID(); - } else { - $iArchivingTypeID = (integer)$oDocumentArchiving; - unset($oDocumentArchiving); + $iArchivingTypeID = $oArchiveSettings->getArchivingTypeID(); } + $sArchivingType = lookupName($default->owl_archiving_type_lookup_table, $iArchivingTypeID); $sToRender .= ""; @@ -143,18 +141,14 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { switch ($sArchivingType) { case "Date" : - if ($oDocumentArchiving) { - // get date settings from document archiving - $oDateArchivingSettings = ArchivingDateSettings::get($oDocumentArchiving->getArchivingSettingsID()); - } $sToRender .= ""; $sToRender .= ""; - $sToRender .= ""; - if ($oDateArchivingSettings) { - $oTimePeriod = TimePeriod::get($oDateArchivingSettings->getTimePeriodID()); + if ($oArchiveSettings) { + $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); $sToRender .= renderTimePeriod("Expires after", $oTimePeriod); } else { $sToRender .= renderTimePeriod("Expires after"); @@ -162,26 +156,19 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { $sToRender .= getDateArchivingJavascript(); break; case "Utilisation" : - if ($oDocumentArchiving) { - // get date settings from document archiving - $oUtilisationArchivingSettings = ArchivingUtilisationSettings::get($oDocumentArchiving->getArchivingSettingsID()); - $iDocumentTransactionID = $oUtilisationArchivingSettings->getDocumentTransactionID(); - } - + $sToRender .= ""; $sToRender .= ""; - if ($oUtilisationArchivingSettings) { - $oTimePeriod = TimePeriod::get($oUtilisationArchivingSettings->getTimePeriodID()); + if ($oArchiveSettings) { + $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); $sToRender .= renderTimePeriod("", $oTimePeriod); } else { $sToRender .= renderTimePeriod(""); } + if ($oArchiveSettings) { + $iDocumentTransactionID = $oArchiveSettings->getDocumentTransactionID(); + } $sToRender .= ""; - /* - $sToRender .= ""; - */ $sToRender .= getUtilisationArchivingJavascript(); break; } @@ -190,7 +177,7 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; - if ($oDocumentArchiving) { + if ($oArchiveSettings) { $sToRender .= "
Archive By Date
Expiration Date:
getExpirationDate() == "0000-00-00" ? "" : $oDateArchivingSettings->getExpirationDate()) : "") . "\">"; + $sToRender .= "
getExpirationDate() == "0000-00-00" ? "" : $oArchiveSettings->getExpirationDate()) : "") . "\">"; $sToRender .= "  graphicsUrl/calendar/calendar.gif\" name=\"imgCalendar\" width=\"34\" height=\"21\" border=\"0\" alt=\"\">"; $sToRender .= "  graphicsUrl/widgets/reset.gif\" border=\"0\">
Archive By Utilisation
Archive document
after the last " . renderDocumentTransactionListBox($iDocumentTransactionID) . " transaction
Document Transaction:" . - renderDocumentTransactionListBox($iDocumentTransactionID) . - "
graphicsUrl/widgets/update.gif\" border=\"0\">\n"; $sToRender .= generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=$fDocumentID&fDelete=1", "graphicsUrl/widgets/remove.gif\" border=\"0\"/>"); } else { @@ -206,16 +193,16 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { /** * Displays the edit document archive settings page */ -function renderEditArchiveSettingsPage($oDocumentArchiving, $sErrorMessage = "") { +function renderEditArchiveSettingsPage($iDocumentID, $oArchiveSettings, $sErrorMessage = "") { global $default; $sToRender .= renderHeading("Edit Document Archive Settings"); - $sToRender .= displayDocumentPath($oDocumentArchiving->getDocumentID()); + $sToRender .= displayDocumentPath($iDocumentID); if (strlen($sErrorMessage) > 0) { $sToRender .= renderErrorMessage($sErrorMessage); } $sToRender .= "\n"; - $sToRender .= renderArchiveSettingsForm($oDocumentArchiving); + $sToRender .= renderArchiveSettingsForm($iDocumentID, $oArchiveSettings); $sToRender .= "
\n"; return $sToRender; } @@ -233,7 +220,7 @@ function renderAddArchiveSettingsPage($iDocumentID, $iArchivingTypeID = false, $ } $sToRender .= "\n"; if ($iArchivingTypeID) { - $sToRender .= renderArchiveSettingsForm($iArchivingTypeID); + $sToRender .= renderArchiveSettingsForm($iDocumentID, null, $iArchivingTypeID); } else { $sToRender .= renderChooseArchivingTypeForm(); } diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php index 8008c72..de73a6a 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php @@ -14,6 +14,7 @@ require_once("../../../../../config/dmsDefaults.php"); 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"); @@ -31,10 +32,12 @@ if (checkSession()) { if ($fDocumentID) { // retrieve the appropriate settings given the document id - $oDocumentArchiving = DocumentArchiving::getFromDocumentID($fDocumentID); - if ($oDocumentArchiving) { + $oDocumentArchiving = DocumentArchiving::getFromDocumentID($fDocumentID); + // retrieve the settings + $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); + if ($oDocumentArchiving && $oArchiveSettings) { if ($fStore) { - $oDASFactory = new DocumentArchiveSettingsFactory($oDocumentArchiving->getArchivingTypeID()); + $oDASFactory = new DocumentArchiveSettingsFactory(); if ($oDASFactory->update($oDocumentArchiving, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) { $default->log->info("modifyArchiveSettingsBL.php successfully updated archive settings (documentID=$fDocumentID)"); @@ -50,9 +53,9 @@ if (checkSession()) { } else { $default->log->error("modifyArchiveSettingsBL.php error deleting archive settings (documentID=$fDocumentID)"); } - } else { + } else { // display the edit page - $oContent->setHtml(renderEditArchiveSettingsPage($oDocumentArchiving)); + $oContent->setHtml(renderEditArchiveSettingsPage($fDocumentID, $oArchiveSettings)); } } else { // no archiving settings for this document -- libgit2 0.21.4