Commit d15c4c88f9d2110504b1eb3c8f6858b1d7b8d39b
1 parent
d36dfa11
Remove the concept of "disabled" actions - they're either available or
not available at the moment, and this is not likely to change, and maintaining both "disabled" and "available" code is confusing. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4871 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
1 additions
and
49 deletions
lib/actions/documentaction.inc.php
| ... | ... | @@ -13,9 +13,6 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 13 | 13 | var $_sShowPermission = "ktcore.permissions.read"; |
| 14 | 14 | var $_sDisablePermission; |
| 15 | 15 | |
| 16 | - var $_bDisabled; | |
| 17 | - var $_sDisabledText = null; | |
| 18 | - | |
| 19 | 16 | var $sSection = "view_details"; |
| 20 | 17 | var $aBreadcrumbs = array( |
| 21 | 18 | array('action' => 'browse', 'name' => 'Browse'), |
| ... | ... | @@ -46,29 +43,10 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 46 | 43 | if (PEAR::isError($oPermission)) { |
| 47 | 44 | return true; |
| 48 | 45 | } |
| 49 | - return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument); | |
| 50 | - } | |
| 51 | - | |
| 52 | - function _disable() { | |
| 53 | - if ($this->_bDisabled === true) { | |
| 54 | - return true; | |
| 55 | - } | |
| 56 | 46 | if (!KTWorkflowUtil::actionEnabledForDocument($this->oDocument, $this->sName)) { |
| 57 | - $this->_sDisabledText = "Workflow does not allow this action at this time"; | |
| 58 | - return true; | |
| 59 | - } | |
| 60 | - if (is_null($this->_sDisablePermission)) { | |
| 61 | - return false; | |
| 62 | - } | |
| 63 | - $oPermission =& KTPermission::getByName($this->_sDisablePermission); | |
| 64 | - if (PEAR::isError($oPermission)) { | |
| 65 | 47 | return false; |
| 66 | 48 | } |
| 67 | - $bResult = KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument); | |
| 68 | - if ($bResult === false) { | |
| 69 | - $this->_sDisabledText = "Insufficient privileges"; | |
| 70 | - } | |
| 71 | - return !$bResult; | |
| 49 | + return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument); | |
| 72 | 50 | } |
| 73 | 51 | |
| 74 | 52 | function getURL() { |
| ... | ... | @@ -92,11 +70,9 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 92 | 70 | $url = $this->getURL(); |
| 93 | 71 | |
| 94 | 72 | $aInfo = array( |
| 95 | - 'disabled' => $this->_disable(), | |
| 96 | 73 | 'description' => $this->sDescription, |
| 97 | 74 | 'name' => $this->sDisplayName, |
| 98 | 75 | 'url' => $url, |
| 99 | - 'disabled_text' => $this->_sDisabledText, | |
| 100 | 76 | ); |
| 101 | 77 | return $this->customiseInfo($aInfo); |
| 102 | 78 | } |
| ... | ... | @@ -130,7 +106,6 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 130 | 106 | $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, |
| 131 | 107 | KTBrowseUtil::breadcrumbsForDocument($this->oDocument, $aOptions)); |
| 132 | 108 | |
| 133 | - | |
| 134 | 109 | $actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); |
| 135 | 110 | $oPortlet = new KTActionPortlet(_("Document Actions")); |
| 136 | 111 | $oPortlet->setActions($actions, $this->sName); | ... | ... |
lib/actions/folderaction.inc.php
| ... | ... | @@ -14,9 +14,6 @@ class KTFolderAction extends KTStandardDispatcher { |
| 14 | 14 | |
| 15 | 15 | var $_bAdminAlwaysAvailable = false; |
| 16 | 16 | |
| 17 | - var $_bDisabled; | |
| 18 | - var $_sDisabledText = null; | |
| 19 | - | |
| 20 | 17 | var $sSection = "browse"; |
| 21 | 18 | var $aBreadcrumbs = array( |
| 22 | 19 | array('action' => 'browse', 'name' => 'Browse'), |
| ... | ... | @@ -59,24 +56,6 @@ class KTFolderAction extends KTStandardDispatcher { |
| 59 | 56 | return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder); |
| 60 | 57 | } |
| 61 | 58 | |
| 62 | - function _disable() { | |
| 63 | - if ($this->_bDisabled === true) { | |
| 64 | - return true; | |
| 65 | - } | |
| 66 | - if (is_null($this->_sDisablePermission)) { | |
| 67 | - return false; | |
| 68 | - } | |
| 69 | - $oPermission =& KTPermission::getByName($this->_sDisablePermission); | |
| 70 | - if (PEAR::isError($oPermission)) { | |
| 71 | - return false; | |
| 72 | - } | |
| 73 | - $bResult = KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder); | |
| 74 | - if ($bResult === false) { | |
| 75 | - $this->_sDisabledText = "Insufficient privileges"; | |
| 76 | - } | |
| 77 | - return !$bResult; | |
| 78 | - } | |
| 79 | - | |
| 80 | 59 | function getURL() { |
| 81 | 60 | $oKTConfig =& KTConfig::getSingleton(); |
| 82 | 61 | $sExt = ".php"; |
| ... | ... | @@ -96,11 +75,9 @@ class KTFolderAction extends KTStandardDispatcher { |
| 96 | 75 | } |
| 97 | 76 | |
| 98 | 77 | $aInfo = array( |
| 99 | - 'disabled' => $this->_disable(), | |
| 100 | 78 | 'description' => $this->sDescription, |
| 101 | 79 | 'name' => $this->sDisplayName, |
| 102 | 80 | 'url' => $this->getURL(), |
| 103 | - 'disabled_text' => $this->_sDisabledText, | |
| 104 | 81 | ); |
| 105 | 82 | return $this->customiseInfo($aInfo); |
| 106 | 83 | } | ... | ... |