diff --git a/lib/actions/documentaction.inc.php b/lib/actions/documentaction.inc.php index d8643ae..e587ad8 100644 --- a/lib/actions/documentaction.inc.php +++ b/lib/actions/documentaction.inc.php @@ -37,6 +37,7 @@ class KTDocumentAction extends KTStandardDispatcher { var $_sShowPermission = "ktcore.permissions.read"; var $_sDisablePermission; + var $bAllowInAdminMode = false; var $sHelpPage = 'ktcore/browse.html'; var $sSection = "view_details"; @@ -63,7 +64,8 @@ class KTDocumentAction extends KTStandardDispatcher { function _show() { if (is_null($this->_sShowPermission)) { return true; - } + } + if ($this->_bAdminAlwaysAvailable) { if (Permission::userIsSystemAdministrator($this->oUser->getId())) { return true; @@ -82,6 +84,13 @@ class KTDocumentAction extends KTStandardDispatcher { // be nasty in archive/delete status. $status = $this->oDocument->getStatusID(); if (($status == DELETED) || ($status == ARCHIVED)) { return false; } + if ($this->bAllowInAdminMode) { + // check if this user is in admin mode + $oFolder = Folder::get($this->oDocument->getFolderId()); + if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) { + return true; + } + } return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument); } @@ -149,7 +158,7 @@ class KTDocumentAction extends KTStandardDispatcher { $oPortlet->setActions($actions, $this->sName); $this->oPage->addPortlet($oPortlet); - $this->oPage->setSecondaryTitle($this->oDocument->getName()); + $this->oPage->setSecondaryTitle($this->oDocument->getName()); return true; } diff --git a/plugins/ktcore/KTDocumentActions.php b/plugins/ktcore/KTDocumentActions.php index e58dd45..7a76364 100644 --- a/plugins/ktcore/KTDocumentActions.php +++ b/plugins/ktcore/KTDocumentActions.php @@ -269,6 +269,8 @@ class KTDocumentCancelCheckOutAction extends KTDocumentAction { var $sName = 'ktcore.actions.document.cancelcheckout'; var $_sShowPermission = "ktcore.permissions.write"; + var $bAllowInAdminMode = true; + var $bInAdminMode = null; function getDisplayName() { return _kt('Cancel Checkout'); @@ -278,7 +280,15 @@ class KTDocumentCancelCheckOutAction extends KTDocumentAction { if (!$this->oDocument->getIsCheckedOut()) { return null; } - + if (is_null($this->bInAdminMode)) { + $oFolder = Folder::get($this->oDocument->getFolderId()); + if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) { + $this->bAdminMode = true; + return parent::getInfo(); + } + } else if ($this->bInAdminMode == true) { + return parent::getInfo(); + } if ($this->oDocument->getCheckedOutUserID() != $this->oUser->getId()) { return null; } @@ -287,6 +297,7 @@ class KTDocumentCancelCheckOutAction extends KTDocumentAction { function check() { $res = parent::check(); + if ($res !== true) { return $res; } @@ -295,6 +306,16 @@ class KTDocumentCancelCheckOutAction extends KTDocumentAction { controllerRedirect('viewDocument', 'fDocumentId=' . $this->oDocument->getId()); exit(0); } + // hard override if we're in admin mode for this doc. + if (is_null($this->bInAdminMode)) { + $oFolder = Folder::get($this->oDocument->getFolderId()); + if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) { + $this->bAdminMode = true; + return true; + } + } else if ($this->bInAdminMode == true) { + return true; + } if ($this->oDocument->getCheckedOutUserID() != $this->oUser->getId()) { $_SESSION['KTErrorMessage'][] = _kt("This document is checked out, but not by you"); controllerRedirect('viewDocument', 'fDocumentId=' . $this->oDocument->getId()); diff --git a/templates/kt3/view_document.smarty b/templates/kt3/view_document.smarty index 2350ef0..773faa0 100644 --- a/templates/kt3/view_document.smarty +++ b/templates/kt3/view_document.smarty @@ -12,12 +12,20 @@ this is incorrect, or you no longer need to make changes to it, please cancel the checkout.{/i18n}
{else} +{if ($canCheckin)} +{i18n arg_checkoutuser=$checkout_user}This document is currently checked out by #checkoutuser#, but you +have sufficient priviledges to cancel their checkout.{/i18n}
+{i18n arg_checkoutuser=$checkout_user}This document is currently checked out by #checkoutuser#. You cannot make changes until that user checks it in. If you have urgent modifications to make, please contact your KnowledgeTree Administrator.{/i18n}