Commit 4beaf82dd69ed706d8b135b307c5ab7e44280b8d

Authored by Michael Joseph
1 parent 93a3c593

added commented archiving ui

only allow collaboration if the document is not checked out
added confirmation message for document approval


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1872 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
... ... @@ -72,7 +72,6 @@ function renderGenericMetaData($oDocument) {
72 72  
73 73 }
74 74  
75   -
76 75 function renderTypeSpecificMetaData($oDocument) {
77 76 $sQuery = "SELECT DF.name AS name, DFL.value AS value " .
78 77 "FROM documents AS D INNER JOIN document_fields_link AS DFL ON D.id = DFL.document_id " .
... ... @@ -133,6 +132,24 @@ function renderNonEditableDocumentRouting($oDocument) {
133 132  
134 133 }
135 134  
  135 +function renderDocumentArchiveSettings($oDocument) {
  136 + global $default;
  137 + $sQuery = "SELECT d.id, expiration_date, utilisation_threshold, 'Edit' as edit FROM $default->owl_archive_settings_table AS a " .
  138 + "INNER JOIN $default->owl_documents_table as d on a.document_id=d.id " .
  139 + "WHERE d.id = " . $oDocument->getID();
  140 +
  141 + $aColumns = array("expiration_date", "utilisation_threshold", "edit");
  142 + $aColumnHeaders = array("Expiration Date", "Utilisation Threshold");
  143 + $aColumnTypes = array(1,1,3);
  144 + $aDBColumnArray = array("id");
  145 + $aQueryStringVariableNames = array("fDocumentID");
  146 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", "$default->rootUrl/control.php?action=modifyDocumentArchiveSettings",$aDBColumnArray,$aQueryStringVariableNames);
  147 + $oPatternTableSqlQuery->setTableHeading("Archiving Settings");
  148 + $oPatternTableSqlQuery->setEmptyTableMessage("No archiving settings");
  149 + $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
  150 + return $oPatternTableSqlQuery->render();
  151 +}
  152 +
136 153 function displayActionButtons($oDocument, $bEdit) {
137 154 global $default;
138 155 if ($bEdit) {
... ... @@ -163,6 +180,7 @@ function displayActionButtons($oDocument, $bEdit) {
163 180 }
164 181 $sToRender .= "<td><a onClick=\"alert('This will download a copy of the document and is not the same as Checking Out a document- changes to this downloaded file will not be managed in the DMS.'); return true;\" href=\"" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForDownload=1") . "\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a></td>\n";
165 182 $sToRender .= "<td><a href=\"" . generateControllerLink("viewDiscussion", "fDocumentID=" . $oDocument->getID() . "&fForDiscussion=1") . "\"><img src=\"$default->graphicsUrl/widgets/discussion.gif\" border=\"0\" /></a></td>\n";
  183 + //$sToRender .= "<td><a href=\"" . generateControllerLink("archiveDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/archive.gif\" border=\"0\" /></a></td>\n";
166 184  
167 185 return $sToRender;
168 186 }
... ... @@ -206,12 +224,27 @@ function getEditPage($oDocument) {
206 224 $sToRender .= "</td>\n";
207 225 $sToRender .= "<td valign=top>\n";
208 226  
209   - $sToRender .= "\t<table border = 0>\n";
  227 + $sToRender .= "\t<table border=\"0\">\n";
  228 + /*
  229 + $sToRender .= "\t<tr>\n";
  230 + $sToRender .= "\t\t<td>" . renderDocumentArchiveSettings($oDocument) . "</td>\n";
  231 + $sToRender .= "\t</tr>";
  232 + // if there are no archiving settings then allow their addition
  233 + $oArchiveSettings = ArchiveSettings::getFromDocumentID($iDocumentID);
  234 + if (!$oArchiveSettings) {
  235 + $sToRender .= "\t<tr>\n";
  236 + $sToRender .= "\t\t<td><a href=\"$default->rootUrl/control.php?action=modifyDocumentArchiveSettings&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/edit.gif\" border=\"0\"/></a></td>\n";
  237 + $sToRender .= "\t</tr>";
  238 + }
  239 + */
210 240 $sToRender .= "\t<tr>\n";
211 241 $sToRender .= "\t\t<td>" . renderEditableDocumentRouting($oDocument) . "</td>\n";
212 242 $sToRender .= "\t</tr>";
  243 +
213 244 $sToRender .= "\t<tr>\n";
214   - if ($oDocument->hasCollaboration() && (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID())) && ($_SESSION["userID"] == $oDocument->getCreatorID())) {
  245 +
  246 + // collaboration cannot be started or approved/rejected unless the document is not checked out
  247 + if (!$oDocument->getIsCheckedOut() && $oDocument->hasCollaboration() && (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID())) && ($_SESSION["userID"] == $oDocument->getCreatorID())) {
215 248 //if not all collaboration steps have been set, then you cannot start the collaboration process
216 249 //only the creator of the document can start the collaboration process
217 250 $sToRender .= "\t\t<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fBeginCollaboration=1><img src=\"$default->graphicsUrl/widgets/begin.gif\" border=\"0\"/></a>";
... ... @@ -219,9 +252,12 @@ function getEditPage($oDocument) {
219 252 } else if (DocumentCollaboration::userIsPerformingCurrentCollaborationStep($oDocument->getID())) {
220 253 //if the current user is responsible for an active step in the collaboration process
221 254 $sToRender .= "\t\t<td><table border=\"0\"><tr>\n";
222   - $sToRender .= "\t\t<td><b>You currently have an active role<br> in the collaboration process</b></td>\n";
223   - $sToRender .= "\t\t<td align=\"center\"><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fCollaborationStepComplete=1><img src=\"$default->graphicsUrl/widgets/approve.gif\" border=\"0\"/></a></td>\n";
224   - $sToRender .= "\t\t<td align=\"center\"><a href=\"$default->rootUrl/control.php?action=collaborationStepReject&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/reject.gif\" border=\"0\"/></a></td>\n";
  255 + $sToRender .= "\t\t<td><b>You currently have an active role<br> in the collaboration process</b></td>\n";
  256 + // collaboration cannot be started or approved/rejected unless the document is not checked out
  257 + if (!$oDocument->getIsCheckedOut()) {
  258 + $sToRender .= "\t\t<td align=\"center\"><a onClick=\"return confirm('Are you sure you want to approve? You will not have access to this document until the collaboration process is complete (unless the document is rejected in a subsequent step)');\" href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fCollaborationStepComplete=1><img src=\"$default->graphicsUrl/widgets/approve.gif\" border=\"0\"/></a></td>\n";
  259 + $sToRender .= "\t\t<td align=\"center\"><a href=\"$default->rootUrl/control.php?action=collaborationStepReject&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/reject.gif\" border=\"0\"/></a></td>\n";
  260 + }
225 261 $sToRender .= "\t\t</tr></table></td>\n";
226 262 }
227 263  
... ... @@ -239,7 +275,7 @@ function getEditPage($oDocument) {
239 275 $sToRender .= "<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fForPublish=1><img src=\"$default->graphicsUrl/widgets/publish.gif\" border=\"0\"/></a></td>\n";
240 276 }
241 277 }
242   - $sToRender .= "\t</tr>";
  278 + $sToRender .= "\t</tr>";
243 279 $sToRender .= "\t</table>";
244 280 $sToRender .= "</td>\n";
245 281 $sToRender .= "</tr>\n";
... ...