diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc index 5ec3085..f91a919 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc @@ -234,20 +234,6 @@ function renderEditableDocumentRouting($oDocument) { $sToRender .= "\t\t\n"; } - // only display the publish button for unpublished documents - if (!DocumentCollaboration::documentIsPendingWebPublishing($oDocument->getID())) { - // if there is collaboration - if ($oDocument->hasCollaboration()) { - // only display publish button if collaboration is complete and you're the last user in the collaboration process (or a sysadmin) - if (DocumentCollaboration::documentCollaborationDone($oDocument->getID()) && - ( ($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($oDocument->getID())) || Permission::userIsSystemAdministrator() ) ) { - $sToRender .= "graphicsUrl/widgets/publish.gif\" border=\"0\"/>\n"; - } - } else if ( ($_SESSION["userID"] == $oDocument->getCreatorID()) || Permission::userIsSystemAdministrator() ) { - // no collaboration for this folder, so only the creator (or an administrator) can request publication - $sToRender .= "graphicsUrl/widgets/publish.gif\" border=\"0\"/>\n"; - } - } $sToRender .= "\t"; $sToRender .= "\t\n"; @@ -370,23 +356,23 @@ function displayViewButton($oDocument, $bEdit) { } function displayCheckInOutButton($oDocument, $bEdit) { - if ($bEdit) { - $sQueryString = "fDocumentID=" . $oDocument->getID(); - // display the check in button if the document is checked out and you checked the document out - if ($oDocument->getIsCheckedOut()) { - if ($oDocument->getCheckedOutUserID() == $_SESSION["userID"]) { - $sAction = "checkInDocument"; - $sImageName = "checkin"; - } else { - $oUser = User::get($oDocument->getCheckedOutUserID()); - $sDisabledText = "The document can only be checked back in by " . $oUser->getName(); - } - // otherwise display the check out button - } else { - $sAction = "checkOutDocument"; - $sImageName = "checkout"; - } - } else { + + $sQueryString = "fDocumentID=" . $oDocument->getID(); + // display the check in button if the document is checked out and you checked the document out + if ($oDocument->getIsCheckedOut()) { + if ($oDocument->getCheckedOutUserID() == $_SESSION["userID"]) { + $sAction = "checkInDocument"; + $sImageName = "checkin"; + } else { + $oUser = User::get($oDocument->getCheckedOutUserID()); + $sDisabledText = "The document can only be checked back in by " . $oUser->getName(); + } + // otherwise display the check out button + } else { + $sAction = "checkOutDocument"; + $sImageName = "checkout"; + } + if (!$bEdit) { $sDisabledText = "You do not have write access to this document"; } return "" . displayButton($sAction, $sQueryString, $sImageName, $sDisabledText) . "\n"; @@ -470,28 +456,30 @@ function displayDependantDocumentButton($oDocument, $bEdit) { return "graphicsUrl/widgets/docactions/dependentdoc.gif\" border=\"0\" />\n"; } -/* function displayPublishButton($oDocument, $bEdit) { - // only display the publish button for unpublished documents + // only display the publish button for unpublished documents if (!DocumentCollaboration::documentIsPendingWebPublishing($oDocument->getID())) { // if there is collaboration if ($oDocument->hasCollaboration()) { // only display publish button if collaboration is complete and you're the last user in the collaboration process (or a sysadmin) - if (DocumentCollaboration::documentCollaborationDone($oDocument->getID()) && - ( ($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($oDocument->getID())) || Permission::userIsSystemAdministrator() ) ) { - $sToRender .= "graphicsUrl/widgets/publish.gif\" border=\"0\"/>\n"; + if (DocumentCollaboration::documentCollaborationDone($oDocument->getID())) { + if ( !($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($oDocument->getID())) && !Permission::userIsSystemAdministrator() ) { + $sDisabledText = "You are not the last collaborator and hence cannot publish this document"; + } + } else { + $sDisabledText = "You cannot publish this document until collaboration is complete"; } - } else if ( ($_SESSION["userID"] == $oDocument->getCreatorID()) || Permission::userIsSystemAdministrator() ) { - // no collaboration for this folder, so only the creator (or an administrator) can request publication - $sToRender .= "graphicsUrl/widgets/publish.gif\" border=\"0\"/>\n"; + } else { + // no collaboration, check the user permissions + if ( !($_SESSION["userID"] == $oDocument->getCreatorID()) && !Permission::userIsSystemAdministrator() ) { + $sDisabledText = "You do not have permission to publish this document."; + } } } else { $sDisabledText = "This document is already published."; } - // FIXME: need to disabled publish button - return "" . displayButton("archiveDocument", "fDocumentID=" . $oDocument->getID(), "archive", $sDisabledText) . "\n"; + return "" . displayButton("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForPublish=1", "publish", $sDisabledText) . "\n"; } -*/ function displayActionButtons($oDocument, $bEdit) { $sToRender .= displayViewButton($oDocument, $bEdit); @@ -504,14 +492,8 @@ function displayActionButtons($oDocument, $bEdit) { $sToRender .= displayDiscussionButton($oDocument, $bEdit); $sToRender .= displayArchiveButton($oDocument, $bEdit); $sToRender .= displayDependantDocumentButton($oDocument, $bEdit); - // FIXME: need disabled publish button - //$sToRender .= displayPublishButton($oDocument, $bEdit); + $sToRender .= displayPublishButton($oDocument, $bEdit); - $iDummyButtons = 1; - // spacing hack - for ($i=0; $i<$iDummyButtons; $i++) { - $sToRender .= " \n"; - } return $sToRender; }