Commit c8756e10952e3e5205fda06fb08aacd1f8df7a88

Authored by michael
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
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc
@@ -126,16 +126,14 @@ function renderTimePeriod($sHeading, $oTimePeriod = null) { @@ -126,16 +126,14 @@ function renderTimePeriod($sHeading, $oTimePeriod = null) {
126 * 126 *
127 * @param integer the archive settings to modify, null display an add form 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 global $default, $fDocumentID; 130 global $default, $fDocumentID;
131 131
132 - if (is_a($oDocumentArchiving, "DocumentArchiving")) { 132 + if ($oArchiveSettings) {
133 $sToRender .= "(in order to change the archiving type for this document, click the 'Remove' button and add new archiving settings)"; 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 $sArchivingType = lookupName($default->owl_archiving_type_lookup_table, $iArchivingTypeID); 137 $sArchivingType = lookupName($default->owl_archiving_type_lookup_table, $iArchivingTypeID);
140 138
141 $sToRender .= "<table border=\"0\">"; 139 $sToRender .= "<table border=\"0\">";
@@ -143,18 +141,14 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { @@ -143,18 +141,14 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) {
143 switch ($sArchivingType) { 141 switch ($sArchivingType) {
144 case "Date" : 142 case "Date" :
145 143
146 - if ($oDocumentArchiving) {  
147 - // get date settings from document archiving  
148 - $oDateArchivingSettings = ArchivingDateSettings::get($oDocumentArchiving->getArchivingSettingsID());  
149 - }  
150 $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Date</th></tr>"; 144 $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Date</th></tr>";
151 $sToRender .= "<tr><td>Expiration Date:</td></tr>"; 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 $sToRender .= "&nbsp;&nbsp;<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>"; 147 $sToRender .= "&nbsp;&nbsp;<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 $sToRender .= "&nbsp;&nbsp;<a href=\"javascript:void();\" onclick=\"document.MainForm.fExpirationDate.value=''\"><img src=\"$default->graphicsUrl/widgets/reset.gif\" border=\"0\"></a></td></tr>"; 148 $sToRender .= "&nbsp;&nbsp;<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 $sToRender .= renderTimePeriod("Expires after", $oTimePeriod); 152 $sToRender .= renderTimePeriod("Expires after", $oTimePeriod);
159 } else { 153 } else {
160 $sToRender .= renderTimePeriod("Expires after"); 154 $sToRender .= renderTimePeriod("Expires after");
@@ -162,26 +156,19 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { @@ -162,26 +156,19 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) {
162 $sToRender .= getDateArchivingJavascript(); 156 $sToRender .= getDateArchivingJavascript();
163 break; 157 break;
164 case "Utilisation" : 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 $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Utilisation</th></tr>"; 160 $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Utilisation</th></tr>";
172 $sToRender .= "<tr><td colspan=\"2\">Archive document </td></tr>"; 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 $sToRender .= renderTimePeriod("", $oTimePeriod); 164 $sToRender .= renderTimePeriod("", $oTimePeriod);
176 } else { 165 } else {
177 $sToRender .= renderTimePeriod(""); 166 $sToRender .= renderTimePeriod("");
178 } 167 }
  168 + if ($oArchiveSettings) {
  169 + $iDocumentTransactionID = $oArchiveSettings->getDocumentTransactionID();
  170 + }
179 $sToRender .= "<tr><td colspan=\"2\">after the last " . renderDocumentTransactionListBox($iDocumentTransactionID) . " transaction</td></tr>"; 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 $sToRender .= getUtilisationArchivingJavascript(); 172 $sToRender .= getUtilisationArchivingJavascript();
186 break; 173 break;
187 } 174 }
@@ -190,7 +177,7 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { @@ -190,7 +177,7 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) {
190 $sToRender .= "<input type=\"hidden\" name=\"fDocumentID\" value=\"$fDocumentID\">\n"; 177 $sToRender .= "<input type=\"hidden\" name=\"fDocumentID\" value=\"$fDocumentID\">\n";
191 $sToRender .= "<input type=\"hidden\" name=\"fArchivingTypeID\" value=\"$iArchivingTypeID\">\n"; 178 $sToRender .= "<input type=\"hidden\" name=\"fArchivingTypeID\" value=\"$iArchivingTypeID\">\n";
192 $sToRender .= "<input type=\"hidden\" name=\"fStore\" value=\"1\">\n"; 179 $sToRender .= "<input type=\"hidden\" name=\"fStore\" value=\"1\">\n";
193 - if ($oDocumentArchiving) { 180 + if ($oArchiveSettings) {
194 $sToRender .= "<tr><td colspan=\"2\"><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\">\n"; 181 $sToRender .= "<tr><td colspan=\"2\"><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\">\n";
195 $sToRender .= generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=$fDocumentID&fDelete=1", "<img src=\"$default->graphicsUrl/widgets/remove.gif\" border=\"0\"/>"); 182 $sToRender .= generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=$fDocumentID&fDelete=1", "<img src=\"$default->graphicsUrl/widgets/remove.gif\" border=\"0\"/>");
196 } else { 183 } else {
@@ -206,16 +193,16 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) { @@ -206,16 +193,16 @@ function renderArchiveSettingsForm($oDocumentArchiving = null) {
206 /** 193 /**
207 * Displays the edit document archive settings page 194 * Displays the edit document archive settings page
208 */ 195 */
209 -function renderEditArchiveSettingsPage($oDocumentArchiving, $sErrorMessage = "") { 196 +function renderEditArchiveSettingsPage($iDocumentID, $oArchiveSettings, $sErrorMessage = "") {
210 global $default; 197 global $default;
211 198
212 $sToRender .= renderHeading("Edit Document Archive Settings"); 199 $sToRender .= renderHeading("Edit Document Archive Settings");
213 - $sToRender .= displayDocumentPath($oDocumentArchiving->getDocumentID()); 200 + $sToRender .= displayDocumentPath($iDocumentID);
214 if (strlen($sErrorMessage) > 0) { 201 if (strlen($sErrorMessage) > 0) {
215 $sToRender .= renderErrorMessage($sErrorMessage); 202 $sToRender .= renderErrorMessage($sErrorMessage);
216 } 203 }
217 $sToRender .= "<table>\n"; 204 $sToRender .= "<table>\n";
218 - $sToRender .= renderArchiveSettingsForm($oDocumentArchiving); 205 + $sToRender .= renderArchiveSettingsForm($iDocumentID, $oArchiveSettings);
219 $sToRender .= "</table>\n"; 206 $sToRender .= "</table>\n";
220 return $sToRender; 207 return $sToRender;
221 } 208 }
@@ -233,7 +220,7 @@ function renderAddArchiveSettingsPage($iDocumentID, $iArchivingTypeID = false, $ @@ -233,7 +220,7 @@ function renderAddArchiveSettingsPage($iDocumentID, $iArchivingTypeID = false, $
233 } 220 }
234 $sToRender .= "<table>\n"; 221 $sToRender .= "<table>\n";
235 if ($iArchivingTypeID) { 222 if ($iArchivingTypeID) {
236 - $sToRender .= renderArchiveSettingsForm($iArchivingTypeID); 223 + $sToRender .= renderArchiveSettingsForm($iDocumentID, null, $iArchivingTypeID);
237 } else { 224 } else {
238 $sToRender .= renderChooseArchivingTypeForm(); 225 $sToRender .= renderChooseArchivingTypeForm();
239 } 226 }
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/modifyArchiveSettingsBL.php
@@ -14,6 +14,7 @@ require_once(&quot;../../../../../config/dmsDefaults.php&quot;); @@ -14,6 +14,7 @@ require_once(&quot;../../../../../config/dmsDefaults.php&quot;);
14 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); 14 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
15 15
16 require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc"); 16 require_once("$default->fileSystemRoot/lib/archiving/DocumentArchiveSettingsFactory.inc");
  17 +require_once("$default->fileSystemRoot/lib/archiving/ArchivingSettings.inc");
17 18
18 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); 19 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc");
19 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); 20 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
@@ -31,10 +32,12 @@ if (checkSession()) { @@ -31,10 +32,12 @@ if (checkSession()) {
31 32
32 if ($fDocumentID) { 33 if ($fDocumentID) {
33 // retrieve the appropriate settings given the document id 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 if ($fStore) { 39 if ($fStore) {
37 - $oDASFactory = new DocumentArchiveSettingsFactory($oDocumentArchiving->getArchivingTypeID()); 40 + $oDASFactory = new DocumentArchiveSettingsFactory();
38 41
39 if ($oDASFactory->update($oDocumentArchiving, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) { 42 if ($oDASFactory->update($oDocumentArchiving, $fExpirationDate, $fDocumentTransactionID, $fTimeUnitID, $fUnits)) {
40 $default->log->info("modifyArchiveSettingsBL.php successfully updated archive settings (documentID=$fDocumentID)"); 43 $default->log->info("modifyArchiveSettingsBL.php successfully updated archive settings (documentID=$fDocumentID)");
@@ -50,9 +53,9 @@ if (checkSession()) { @@ -50,9 +53,9 @@ if (checkSession()) {
50 } else { 53 } else {
51 $default->log->error("modifyArchiveSettingsBL.php error deleting archive settings (documentID=$fDocumentID)"); 54 $default->log->error("modifyArchiveSettingsBL.php error deleting archive settings (documentID=$fDocumentID)");
52 } 55 }
53 - } else { 56 + } else {
54 // display the edit page 57 // display the edit page
55 - $oContent->setHtml(renderEditArchiveSettingsPage($oDocumentArchiving)); 58 + $oContent->setHtml(renderEditArchiveSettingsPage($fDocumentID, $oArchiveSettings));
56 } 59 }
57 } else { 60 } else {
58 // no archiving settings for this document 61 // no archiving settings for this document