Commit c8756e10952e3e5205fda06fb08aacd1f8df7a88
1 parent
32d63c87
updates for merged archiving settings table
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2231 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
26 additions
and
36 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc
| ... | ... | @@ -126,16 +126,14 @@ function renderTimePeriod($sHeading, $oTimePeriod = null) { |
| 126 | 126 | * |
| 127 | 127 | * @param integer the archive settings to modify, null display an add form |
| 128 | 128 | */ |
| 129 | -function renderArchiveSettingsForm($oDocumentArchiving = null) { | |
| 129 | +function renderArchiveSettingsForm($iDocumentID, $oArchiveSettings, $iArchivingTypeID = -1) { | |
| 130 | 130 | global $default, $fDocumentID; |
| 131 | 131 | |
| 132 | - if (is_a($oDocumentArchiving, "DocumentArchiving")) { | |
| 132 | + if ($oArchiveSettings) { | |
| 133 | 133 | $sToRender .= "(in order to change the archiving type for this document, click the 'Remove' button and add new archiving settings)"; |
| 134 | - $iArchivingTypeID = $oDocumentArchiving->getArchivingTypeID(); | |
| 135 | - } else { | |
| 136 | - $iArchivingTypeID = (integer)$oDocumentArchiving; | |
| 137 | - unset($oDocumentArchiving); | |
| 134 | + $iArchivingTypeID = $oArchiveSettings->getArchivingTypeID(); | |
| 138 | 135 | } |
| 136 | + | |
| 139 | 137 | $sArchivingType = lookupName($default->owl_archiving_type_lookup_table, $iArchivingTypeID); |
| 140 | 138 | |
| 141 | 139 | $sToRender .= "<table border=\"0\">"; |
| ... | ... | @@ -143,18 +141,14 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { |
| 143 | 141 | switch ($sArchivingType) { |
| 144 | 142 | case "Date" : |
| 145 | 143 | |
| 146 | - if ($oDocumentArchiving) { | |
| 147 | - // get date settings from document archiving | |
| 148 | - $oDateArchivingSettings = ArchivingDateSettings::get($oDocumentArchiving->getArchivingSettingsID()); | |
| 149 | - } | |
| 150 | 144 | $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Date</th></tr>"; |
| 151 | 145 | $sToRender .= "<tr><td>Expiration Date:</td></tr>"; |
| 152 | - $sToRender .= "<tr><td valign=bottom><input type=\"text\" name=\"fExpirationDate\" size=\"11\" " . ($oDateArchivingSettings ? "value=\"" . ($oDateArchivingSettings->getExpirationDate() == "0000-00-00" ? "" : $oDateArchivingSettings->getExpirationDate()) : "") . "\">"; | |
| 146 | + $sToRender .= "<tr><td valign=bottom><input type=\"text\" name=\"fExpirationDate\" size=\"11\" " . ($oArchiveSettings ? "value=\"" . ($oArchiveSettings->getExpirationDate() == "0000-00-00" ? "" : $oArchiveSettings->getExpirationDate()) : "") . "\">"; | |
| 153 | 147 | $sToRender .= " <a href=\"javascript:show_calendar('MainForm.fExpirationDate',null,null,'YYYY-MM-DD');\" onmouseover=\"window.status='Date Picker';return true;\" onmouseout=\"window.status='';return true;\"><img src=\"$default->graphicsUrl/calendar/calendar.gif\" name=\"imgCalendar\" width=\"34\" height=\"21\" border=\"0\" alt=\"\"></a>"; |
| 154 | 148 | $sToRender .= " <a href=\"javascript:void();\" onclick=\"document.MainForm.fExpirationDate.value=''\"><img src=\"$default->graphicsUrl/widgets/reset.gif\" border=\"0\"></a></td></tr>"; |
| 155 | 149 | |
| 156 | - if ($oDateArchivingSettings) { | |
| 157 | - $oTimePeriod = TimePeriod::get($oDateArchivingSettings->getTimePeriodID()); | |
| 150 | + if ($oArchiveSettings) { | |
| 151 | + $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); | |
| 158 | 152 | $sToRender .= renderTimePeriod("Expires after", $oTimePeriod); |
| 159 | 153 | } else { |
| 160 | 154 | $sToRender .= renderTimePeriod("Expires after"); |
| ... | ... | @@ -162,26 +156,19 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { |
| 162 | 156 | $sToRender .= getDateArchivingJavascript(); |
| 163 | 157 | break; |
| 164 | 158 | case "Utilisation" : |
| 165 | - if ($oDocumentArchiving) { | |
| 166 | - // get date settings from document archiving | |
| 167 | - $oUtilisationArchivingSettings = ArchivingUtilisationSettings::get($oDocumentArchiving->getArchivingSettingsID()); | |
| 168 | - $iDocumentTransactionID = $oUtilisationArchivingSettings->getDocumentTransactionID(); | |
| 169 | - } | |
| 170 | - | |
| 159 | + | |
| 171 | 160 | $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Utilisation</th></tr>"; |
| 172 | 161 | $sToRender .= "<tr><td colspan=\"2\">Archive document </td></tr>"; |
| 173 | - if ($oUtilisationArchivingSettings) { | |
| 174 | - $oTimePeriod = TimePeriod::get($oUtilisationArchivingSettings->getTimePeriodID()); | |
| 162 | + if ($oArchiveSettings) { | |
| 163 | + $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); | |
| 175 | 164 | $sToRender .= renderTimePeriod("", $oTimePeriod); |
| 176 | 165 | } else { |
| 177 | 166 | $sToRender .= renderTimePeriod(""); |
| 178 | 167 | } |
| 168 | + if ($oArchiveSettings) { | |
| 169 | + $iDocumentTransactionID = $oArchiveSettings->getDocumentTransactionID(); | |
| 170 | + } | |
| 179 | 171 | $sToRender .= "<tr><td colspan=\"2\">after the last " . renderDocumentTransactionListBox($iDocumentTransactionID) . " transaction</td></tr>"; |
| 180 | - /* | |
| 181 | - $sToRender .= "<tr><td>Document Transaction:</td><td>" . | |
| 182 | - renderDocumentTransactionListBox($iDocumentTransactionID) . | |
| 183 | - "</td></tr>"; | |
| 184 | - */ | |
| 185 | 172 | $sToRender .= getUtilisationArchivingJavascript(); |
| 186 | 173 | break; |
| 187 | 174 | } |
| ... | ... | @@ -190,7 +177,7 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { |
| 190 | 177 | $sToRender .= "<input type=\"hidden\" name=\"fDocumentID\" value=\"$fDocumentID\">\n"; |
| 191 | 178 | $sToRender .= "<input type=\"hidden\" name=\"fArchivingTypeID\" value=\"$iArchivingTypeID\">\n"; |
| 192 | 179 | $sToRender .= "<input type=\"hidden\" name=\"fStore\" value=\"1\">\n"; |
| 193 | - if ($oDocumentArchiving) { | |
| 180 | + if ($oArchiveSettings) { | |
| 194 | 181 | $sToRender .= "<tr><td colspan=\"2\"><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\">\n"; |
| 195 | 182 | $sToRender .= generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=$fDocumentID&fDelete=1", "<img src=\"$default->graphicsUrl/widgets/remove.gif\" border=\"0\"/>"); |
| 196 | 183 | } else { |
| ... | ... | @@ -206,16 +193,16 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { |
| 206 | 193 | /** |
| 207 | 194 | * Displays the edit document archive settings page |
| 208 | 195 | */ |
| 209 | -function renderEditArchiveSettingsPage($oDocumentArchiving, $sErrorMessage = "") { | |
| 196 | +function renderEditArchiveSettingsPage($iDocumentID, $oArchiveSettings, $sErrorMessage = "") { | |
| 210 | 197 | global $default; |
| 211 | 198 | |
| 212 | 199 | $sToRender .= renderHeading("Edit Document Archive Settings"); |
| 213 | - $sToRender .= displayDocumentPath($oDocumentArchiving->getDocumentID()); | |
| 200 | + $sToRender .= displayDocumentPath($iDocumentID); | |
| 214 | 201 | if (strlen($sErrorMessage) > 0) { |
| 215 | 202 | $sToRender .= renderErrorMessage($sErrorMessage); |
| 216 | 203 | } |
| 217 | 204 | $sToRender .= "<table>\n"; |
| 218 | - $sToRender .= renderArchiveSettingsForm($oDocumentArchiving); | |
| 205 | + $sToRender .= renderArchiveSettingsForm($iDocumentID, $oArchiveSettings); | |
| 219 | 206 | $sToRender .= "</table>\n"; |
| 220 | 207 | return $sToRender; |
| 221 | 208 | } |
| ... | ... | @@ -233,7 +220,7 @@ function renderAddArchiveSettingsPage($iDocumentID, $iArchivingTypeID = false, $ |
| 233 | 220 | } |
| 234 | 221 | $sToRender .= "<table>\n"; |
| 235 | 222 | if ($iArchivingTypeID) { |
| 236 | - $sToRender .= renderArchiveSettingsForm($iArchivingTypeID); | |
| 223 | + $sToRender .= renderArchiveSettingsForm($iDocumentID, null, $iArchivingTypeID); | |
| 237 | 224 | } else { |
| 238 | 225 | $sToRender .= renderChooseArchivingTypeForm(); |
| 239 | 226 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php
| ... | ... | @@ -14,6 +14,7 @@ require_once("../../../../../config/dmsDefaults.php"); |
| 14 | 14 | require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); |
| 15 | 15 | |
| 16 | 16 | require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc"); |
| 17 | +require_once("$default->fileSystemRoot/lib/archiving/ArchivingSettings.inc"); | |
| 17 | 18 | |
| 18 | 19 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); |
| 19 | 20 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| ... | ... | @@ -31,10 +32,12 @@ if (checkSession()) { |
| 31 | 32 | |
| 32 | 33 | if ($fDocumentID) { |
| 33 | 34 | // retrieve the appropriate settings given the document id |
| 34 | - $oDocumentArchiving = DocumentArchiving::getFromDocumentID($fDocumentID); | |
| 35 | - if ($oDocumentArchiving) { | |
| 35 | + $oDocumentArchiving = DocumentArchiving::getFromDocumentID($fDocumentID); | |
| 36 | + // retrieve the settings | |
| 37 | + $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); | |
| 38 | + if ($oDocumentArchiving && $oArchiveSettings) { | |
| 36 | 39 | if ($fStore) { |
| 37 | - $oDASFactory = new DocumentArchiveSettingsFactory($oDocumentArchiving->getArchivingTypeID()); | |
| 40 | + $oDASFactory = new DocumentArchiveSettingsFactory(); | |
| 38 | 41 | |
| 39 | 42 | if ($oDASFactory->update($oDocumentArchiving, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) { |
| 40 | 43 | $default->log->info("modifyArchiveSettingsBL.php successfully updated archive settings (documentID=$fDocumentID)"); |
| ... | ... | @@ -50,9 +53,9 @@ if (checkSession()) { |
| 50 | 53 | } else { |
| 51 | 54 | $default->log->error("modifyArchiveSettingsBL.php error deleting archive settings (documentID=$fDocumentID)"); |
| 52 | 55 | } |
| 53 | - } else { | |
| 56 | + } else { | |
| 54 | 57 | // display the edit page |
| 55 | - $oContent->setHtml(renderEditArchiveSettingsPage($oDocumentArchiving)); | |
| 58 | + $oContent->setHtml(renderEditArchiveSettingsPage($fDocumentID, $oArchiveSettings)); | |
| 56 | 59 | } |
| 57 | 60 | } else { |
| 58 | 61 | // no archiving settings for this document | ... | ... |