Commit a6e28e40b7366ffbc48852bb2ce859e6bb0c2fd2

Authored by Michael Joseph
1 parent 892ecb80

tidied and added sysadmin access overrides for document routing and publishing buttons


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2406 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
@@ -207,13 +207,20 @@ function renderEditableDocumentRouting($oDocument) { @@ -207,13 +207,20 @@ function renderEditableDocumentRouting($oDocument) {
207 $sToRender .= "\t\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n"; 207 $sToRender .= "\t\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n";
208 $sToRender .= "\t</tr>"; 208 $sToRender .= "\t</tr>";
209 $sToRender .= "\t<tr>\n"; 209 $sToRender .= "\t<tr>\n";
210 - // FIXME display messages instead of just not displaying button  
211 - // collaboration cannot be started or approved/rejected unless the document is not checked out  
212 - if (!$oDocument->getIsCheckedOut() && $oDocument->hasCollaboration() && (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID())) && ($_SESSION["userID"] == $oDocument->getCreatorID())) { 210 + // display the begin collaboration button if:
  211 + // collaboration cannot be started or approved/rejected unless the document is not checked out
  212 + // the document has collaboration
  213 + // collaboration hasn't started
  214 + // the current user created the document, or is a system adminstrator
  215 + if (!$oDocument->getIsCheckedOut() &&
  216 + $oDocument->hasCollaboration() &&
  217 + (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID())) &&
  218 + ( ($_SESSION["userID"] == $oDocument->getCreatorID()) || Permission::userIsSystemAdministrator() ) ) {
213 //if not all collaboration steps have been set, then you cannot start the collaboration process 219 //if not all collaboration steps have been set, then you cannot start the collaboration process
214 //only the creator of the document can start the collaboration process 220 //only the creator of the document can start the collaboration process
215 $sToRender .= "\t\t<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fBeginCollaboration=1><img src=\"$default->graphicsUrl/widgets/begin.gif\" border=\"0\"/></a>"; 221 $sToRender .= "\t\t<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fBeginCollaboration=1><img src=\"$default->graphicsUrl/widgets/begin.gif\" border=\"0\"/></a>";
216 $sToRender .= "</td>\n"; 222 $sToRender .= "</td>\n";
  223 + // else if collboration has started and the current user has been assigned this step, display the approve/reject buttons
217 } else if (DocumentCollaboration::userIsPerformingCurrentCollaborationStep($oDocument->getID())) { 224 } else if (DocumentCollaboration::userIsPerformingCurrentCollaborationStep($oDocument->getID())) {
218 //if the current user is responsible for an active step in the collaboration process 225 //if the current user is responsible for an active step in the collaboration process
219 $sToRender .= "\t\t<td><table border=\"0\"><tr>\n"; 226 $sToRender .= "\t\t<td><table border=\"0\"><tr>\n";
@@ -224,18 +231,19 @@ function renderEditableDocumentRouting($oDocument) { @@ -224,18 +231,19 @@ function renderEditableDocumentRouting($oDocument) {
224 $sToRender .= "\t\t<td align=\"center\"><a href=\"$default->rootUrl/control.php?action=collaborationStepReject&fDocumentID=" . $oDocument->getID() . "\"><img src=\"$default->graphicsUrl/widgets/reject.gif\" border=\"0\"/></a></td>\n"; 231 $sToRender .= "\t\t<td align=\"center\"><a href=\"$default->rootUrl/control.php?action=collaborationStepReject&fDocumentID=" . $oDocument->getID() . "\"><img src=\"$default->graphicsUrl/widgets/reject.gif\" border=\"0\"/></a></td>\n";
225 } 232 }
226 $sToRender .= "\t\t</tr></table></td>\n"; 233 $sToRender .= "\t\t</tr></table></td>\n";
227 - }  
228 - if (!DocumentCollaboration::documentIsPendingWebPublishing($oDocument->getID())) {  
229 - // only display for unpublished documents 234 + }
  235 +
  236 + // only display the publish button for unpublished documents
  237 + if (!DocumentCollaboration::documentIsPendingWebPublishing($oDocument->getID())) {
230 // if there is collaboration 238 // if there is collaboration
231 if ($oDocument->hasCollaboration()) { 239 if ($oDocument->hasCollaboration()) {
232 - // only display publish button if collaboration is complete and you're the last user in the collaboration process  
233 - if (DocumentCollaboration::documentCollaborationDone($oDocument->getID()) && ($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($oDocument->getID()))) { 240 + // only display publish button if collaboration is complete and you're the last user in the collaboration process (or a sysadmin)
  241 + if (DocumentCollaboration::documentCollaborationDone($oDocument->getID()) &&
  242 + ( ($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($oDocument->getID())) || Permission::userIsSystemAdministrator() ) ) {
234 $sToRender .= "<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fForPublish=1><img src=\"$default->graphicsUrl/widgets/publish.gif\" border=\"0\"/></a></td>\n"; 243 $sToRender .= "<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fForPublish=1><img src=\"$default->graphicsUrl/widgets/publish.gif\" border=\"0\"/></a></td>\n";
235 } 244 }
236 - } else if ($_SESSION["userID"] == $oDocument->getCreatorID()) {  
237 - // no collaboration for this folder, so only the creator can request publication  
238 - // ??: or an administrator? 245 + } else if ( ($_SESSION["userID"] == $oDocument->getCreatorID()) || Permission::userIsSystemAdministrator() ) {
  246 + // no collaboration for this folder, so only the creator (or an administrator) can request publication
239 $sToRender .= "<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fForPublish=1><img src=\"$default->graphicsUrl/widgets/publish.gif\" border=\"0\"/></a></td>\n"; 247 $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 } 248 }
241 } 249 }