Commit d15c4c88f9d2110504b1eb3c8f6858b1d7b8d39b

Authored by Neil Blakey-Milner
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
lib/actions/documentaction.inc.php
@@ -13,9 +13,6 @@ class KTDocumentAction extends KTStandardDispatcher { @@ -13,9 +13,6 @@ class KTDocumentAction extends KTStandardDispatcher {
13 var $_sShowPermission = "ktcore.permissions.read"; 13 var $_sShowPermission = "ktcore.permissions.read";
14 var $_sDisablePermission; 14 var $_sDisablePermission;
15 15
16 - var $_bDisabled;  
17 - var $_sDisabledText = null;  
18 -  
19 var $sSection = "view_details"; 16 var $sSection = "view_details";
20 var $aBreadcrumbs = array( 17 var $aBreadcrumbs = array(
21 array('action' => 'browse', 'name' => 'Browse'), 18 array('action' => 'browse', 'name' => 'Browse'),
@@ -46,29 +43,10 @@ class KTDocumentAction extends KTStandardDispatcher { @@ -46,29 +43,10 @@ class KTDocumentAction extends KTStandardDispatcher {
46 if (PEAR::isError($oPermission)) { 43 if (PEAR::isError($oPermission)) {
47 return true; 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 if (!KTWorkflowUtil::actionEnabledForDocument($this->oDocument, $this->sName)) { 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 return false; 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 function getURL() { 52 function getURL() {
@@ -92,11 +70,9 @@ class KTDocumentAction extends KTStandardDispatcher { @@ -92,11 +70,9 @@ class KTDocumentAction extends KTStandardDispatcher {
92 $url = $this->getURL(); 70 $url = $this->getURL();
93 71
94 $aInfo = array( 72 $aInfo = array(
95 - 'disabled' => $this->_disable(),  
96 'description' => $this->sDescription, 73 'description' => $this->sDescription,
97 'name' => $this->sDisplayName, 74 'name' => $this->sDisplayName,
98 'url' => $url, 75 'url' => $url,
99 - 'disabled_text' => $this->_sDisabledText,  
100 ); 76 );
101 return $this->customiseInfo($aInfo); 77 return $this->customiseInfo($aInfo);
102 } 78 }
@@ -130,7 +106,6 @@ class KTDocumentAction extends KTStandardDispatcher { @@ -130,7 +106,6 @@ class KTDocumentAction extends KTStandardDispatcher {
130 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, 106 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs,
131 KTBrowseUtil::breadcrumbsForDocument($this->oDocument, $aOptions)); 107 KTBrowseUtil::breadcrumbsForDocument($this->oDocument, $aOptions));
132 108
133 -  
134 $actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); 109 $actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser);
135 $oPortlet = new KTActionPortlet(_("Document Actions")); 110 $oPortlet = new KTActionPortlet(_("Document Actions"));
136 $oPortlet->setActions($actions, $this->sName); 111 $oPortlet->setActions($actions, $this->sName);
lib/actions/folderaction.inc.php
@@ -14,9 +14,6 @@ class KTFolderAction extends KTStandardDispatcher { @@ -14,9 +14,6 @@ class KTFolderAction extends KTStandardDispatcher {
14 14
15 var $_bAdminAlwaysAvailable = false; 15 var $_bAdminAlwaysAvailable = false;
16 16
17 - var $_bDisabled;  
18 - var $_sDisabledText = null;  
19 -  
20 var $sSection = "browse"; 17 var $sSection = "browse";
21 var $aBreadcrumbs = array( 18 var $aBreadcrumbs = array(
22 array('action' => 'browse', 'name' => 'Browse'), 19 array('action' => 'browse', 'name' => 'Browse'),
@@ -59,24 +56,6 @@ class KTFolderAction extends KTStandardDispatcher { @@ -59,24 +56,6 @@ class KTFolderAction extends KTStandardDispatcher {
59 return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder); 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 function getURL() { 59 function getURL() {
81 $oKTConfig =& KTConfig::getSingleton(); 60 $oKTConfig =& KTConfig::getSingleton();
82 $sExt = ".php"; 61 $sExt = ".php";
@@ -96,11 +75,9 @@ class KTFolderAction extends KTStandardDispatcher { @@ -96,11 +75,9 @@ class KTFolderAction extends KTStandardDispatcher {
96 } 75 }
97 76
98 $aInfo = array( 77 $aInfo = array(
99 - 'disabled' => $this->_disable(),  
100 'description' => $this->sDescription, 78 'description' => $this->sDescription,
101 'name' => $this->sDisplayName, 79 'name' => $this->sDisplayName,
102 'url' => $this->getURL(), 80 'url' => $this->getURL(),
103 - 'disabled_text' => $this->_sDisabledText,  
104 ); 81 );
105 return $this->customiseInfo($aInfo); 82 return $this->customiseInfo($aInfo);
106 } 83 }