Commit b52863dd3d73c892de6324d946b75b1a4a3e5c11
1 parent
6a8ebfd5
#3265 added code to display the archiving settings on the document details screen.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2761 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
37 additions
and
38 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
| @@ -50,7 +50,9 @@ require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | @@ -50,7 +50,9 @@ require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | ||
| 50 | require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentInstance.inc"); | 50 | require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentInstance.inc"); |
| 51 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentCollaboration.inc"); | 51 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentCollaboration.inc"); |
| 52 | 52 | ||
| 53 | +require_once("$default->fileSystemRoot/lib/archiving/ArchivingSettings.inc"); | ||
| 53 | require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiving.inc"); | 54 | require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiving.inc"); |
| 55 | +require_once("$default->fileSystemRoot/lib/archiving/TimePeriod.inc"); | ||
| 54 | 56 | ||
| 55 | require_once("$default->fileSystemRoot/lib/foldermanagement/FolderCollaboration.inc"); | 57 | require_once("$default->fileSystemRoot/lib/foldermanagement/FolderCollaboration.inc"); |
| 56 | require_once("$default->fileSystemRoot/lib/foldermanagement/FolderUserRole.inc"); | 58 | require_once("$default->fileSystemRoot/lib/foldermanagement/FolderUserRole.inc"); |
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
| @@ -139,44 +139,40 @@ function renderTypeSpecificMetaData($oDocument, $bEditable) { | @@ -139,44 +139,40 @@ function renderTypeSpecificMetaData($oDocument, $bEditable) { | ||
| 139 | $sToRender .= "\t</table>\n"; | 139 | $sToRender .= "\t</table>\n"; |
| 140 | return $sToRender; | 140 | return $sToRender; |
| 141 | } | 141 | } |
| 142 | - | ||
| 143 | -function renderEditableDocumentArchiveSettings($oDocument) { | 142 | +function renderDocumentArchiveSettingsDetails($oDocument, $bEditable) { |
| 144 | global $default; | 143 | global $default; |
| 145 | - $sQuery = "SELECT d.id, atl.name, 'Edit' AS edit FROM $default->document_archiving_table AS da " . | ||
| 146 | - "INNER JOIN $default->archiving_settings_table AS ast ON da.archiving_settings_id=ast.id " . | ||
| 147 | - "INNER JOIN $default->archiving_type_lookup_table AS atl ON ast.archiving_type_id=atl.id " . | ||
| 148 | - "INNER JOIN $default->documents_table AS d ON da.document_id=d.id " . | ||
| 149 | - "WHERE d.id = " . $oDocument->getID(); | ||
| 150 | - | ||
| 151 | - $aColumns = array("name", "edit"); | ||
| 152 | - $aColumnHeaders = array("Archiving Type"); | ||
| 153 | - $aColumnTypes = array(1,3); | ||
| 154 | - $aDBColumnArray = array("id"); | ||
| 155 | - $aQueryStringVariableNames = array("fDocumentID"); | ||
| 156 | - $aLinkURLs = array(1=>"$default->rootUrl/control.php?action=modifyDocumentArchiveSettings"); | ||
| 157 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs ,$aDBColumnArray,$aQueryStringVariableNames); | ||
| 158 | - $oPatternTableSqlQuery->setTableHeading("Archiving Settings"); | ||
| 159 | - $oPatternTableSqlQuery->setEmptyTableMessage("No archiving settings"); | ||
| 160 | - $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | ||
| 161 | - return $oPatternTableSqlQuery->render(); | ||
| 162 | -} | ||
| 163 | - | ||
| 164 | -function renderNonEditableDocumentArchiveSettings($oDocument) { | ||
| 165 | - global $default; | ||
| 166 | - $sQuery = "SELECT d.id, atl.name FROM $default->document_archiving_table AS da " . | ||
| 167 | - "INNER JOIN $default->archiving_settings_table AS ast ON da.archiving_settings_id=ast.id " . | ||
| 168 | - "INNER JOIN $default->archiving_type_lookup_table AS atl ON ast.archiving_type_id=atl.id " . | ||
| 169 | - "INNER JOIN $default->documents_table AS d ON da.document_id=d.id " . | ||
| 170 | - "WHERE d.id = " . $oDocument->getID(); | ||
| 171 | - | ||
| 172 | - $aColumns = array("name"); | ||
| 173 | - $aColumnHeaders = array("Archiving Type"); | ||
| 174 | - $aColumnTypes = array(1); | ||
| 175 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs ,$aDBColumnArray,$aQueryStringVariableNames); | ||
| 176 | - $oPatternTableSqlQuery->setTableHeading("Archiving Settings"); | ||
| 177 | - $oPatternTableSqlQuery->setEmptyTableMessage("No archiving settings"); | ||
| 178 | - $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | ||
| 179 | - return $oPatternTableSqlQuery->render(); | 144 | + |
| 145 | + // retrieve the appropriate settings given the document id | ||
| 146 | + $oDocumentArchiving = DocumentArchiving::getFromDocumentID($oDocument->getID()); | ||
| 147 | + // retrieve the settings | ||
| 148 | + $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); | ||
| 149 | + // switch on archiving type | ||
| 150 | + $sArchivingType = lookupName($default->archiving_type_lookup_table, $oArchiveSettings->getArchivingTypeID()); | ||
| 151 | + $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); | ||
| 152 | + | ||
| 153 | + switch ($sArchivingType) { | ||
| 154 | + case "Date" : | ||
| 155 | + $sDisplayText = "Expiration Date: " . $oArchiveSettings->getExpirationDate(); | ||
| 156 | + if ($oTimePeriod) { | ||
| 157 | + $sDisplayText .= "<br/>Expires after " . $oTimePeriod->getUnits() . " "; | ||
| 158 | + $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()) . " from document creation date"; | ||
| 159 | + } | ||
| 160 | + break; | ||
| 161 | + case "Utilisation" : | ||
| 162 | + $sDisplayText .= "Archive document " . $oTimePeriod->getUnits() . " "; | ||
| 163 | + $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()); | ||
| 164 | + $sDisplayText .= " after the last " . lookupName($default->transaction_types_table, $oArchiveSettings->getDocumentTransactionID()) . " transaction"; | ||
| 165 | + break; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + $sToRender = "<table cellpadding=\"5\" border=\"0\" width=\"500\">"; | ||
| 169 | + $sToRender .= "<caption align=\"top\" colspan=\"2\" align=\"left\"><b>Archiving Settings</b></caption>"; | ||
| 170 | + $sToRender .= "<th align=\"left\">Archiving Type: $sArchivingType</th>"; | ||
| 171 | + $sToRender .= "<tr bgcolor=\"F5F6EE\">"; | ||
| 172 | + $sToRender .= "<td>$sDisplayText</td>" . ($bEditable ? "<td>" . generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=" . $oDocument->getID(), "Edit") . "</td>" : ""); | ||
| 173 | + $sToRender .= "</tr>"; | ||
| 174 | + $sToRender .= "</table>"; | ||
| 175 | + return $sToRender; | ||
| 180 | } | 176 | } |
| 181 | 177 | ||
| 182 | function renderDocumentArchiveSettings($oDocument, $bEditable) { | 178 | function renderDocumentArchiveSettings($oDocument, $bEditable) { |
| @@ -184,7 +180,8 @@ function renderDocumentArchiveSettings($oDocument, $bEditable) { | @@ -184,7 +180,8 @@ function renderDocumentArchiveSettings($oDocument, $bEditable) { | ||
| 184 | 180 | ||
| 185 | $sToRender .= "\t<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n"; | 181 | $sToRender .= "\t<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n"; |
| 186 | $sToRender .= "\t<tr>\n"; | 182 | $sToRender .= "\t<tr>\n"; |
| 187 | - $sToRender .= "\t\t<td>" . ($bEditable ? renderEditableDocumentArchiveSettings($oDocument) : renderNonEditableDocumentArchiveSettings($oDocument)) . "</td>\n"; | 183 | + |
| 184 | + $sToRender .= "\t\t<td>" . renderDocumentArchiveSettingsDetails($oDocument, $bEditable) . "</td>\n"; | ||
| 188 | $sToRender .= "\t</tr>"; | 185 | $sToRender .= "\t</tr>"; |
| 189 | if ($bEditable) { | 186 | if ($bEditable) { |
| 190 | $sToRender .= "\t<tr>\n"; | 187 | $sToRender .= "\t<tr>\n"; |