Commit 0e22c9718bb70b99ee08ce0b43f27c639506cf15
1 parent
b827a23d
Make it possible for plugins to register admin categories and admin
pages git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4155 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
35 additions
and
0 deletions
lib/plugins/plugin.inc.php
| @@ -8,6 +8,9 @@ class KTPlugin { | @@ -8,6 +8,9 @@ class KTPlugin { | ||
| 8 | var $_aTriggers = array(); | 8 | var $_aTriggers = array(); |
| 9 | var $_aActions = array(); | 9 | var $_aActions = array(); |
| 10 | var $_aPages = array(); | 10 | var $_aPages = array(); |
| 11 | + var $_aAuthenticationProviders = array(); | ||
| 12 | + var $_aAdminCategories = array(); | ||
| 13 | + var $_aAdminPages = array(); | ||
| 11 | 14 | ||
| 12 | function KTPlugin($sFilename = null) { | 15 | function KTPlugin($sFilename = null) { |
| 13 | $this->sFilename = $sFilename; | 16 | $this->sFilename = $sFilename; |
| @@ -42,6 +45,22 @@ class KTPlugin { | @@ -42,6 +45,22 @@ class KTPlugin { | ||
| 42 | return sprintf('/plugin.php/%s/%s', $this->sNamespace, $sPath); | 45 | return sprintf('/plugin.php/%s/%s', $this->sNamespace, $sPath); |
| 43 | } | 46 | } |
| 44 | 47 | ||
| 48 | + function registerAuthenticationProvider($sClass, $sNamespace, $sFilename = null) { | ||
| 49 | + $sFilename = $this->_fixFilename($sFilename); | ||
| 50 | + $this->_aAuthenticationProviders[$sNamespace] = array($sClass, $sNamespace, $sFilename, $this->sNamespace); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | +//registerLocation($sName, $sClass, $sCategory, $sTitle, $sDescription, $sDispatcherFilePath = null, $sURL = null) | ||
| 54 | + function registerAdminPage($sName, $sClass, $sCategory, $sTitle, $sDescription, $sFilename) { | ||
| 55 | + $sFullname = $sCategory . '/' . $sName; | ||
| 56 | + $sFilename = $this->_fixFilename($sFilename); | ||
| 57 | + $this->_aAdminPages[$sFullname] = array($sName, $sClass, $sCategory, $sTitle, $sDescription, $sFilename, null, $this->sNamespace); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + function registerAdminCategories($sPath, $sName, $sDescription) { | ||
| 61 | + $this->_aAdminCategories[$sPath] = array($sPath, $sName, $sDescription); | ||
| 62 | + } | ||
| 63 | + | ||
| 45 | function _fixFilename($sFilename) { | 64 | function _fixFilename($sFilename) { |
| 46 | if (empty($sFilename)) { | 65 | if (empty($sFilename)) { |
| 47 | $sFilename = $this->sFilename; | 66 | $sFilename = $this->sFilename; |
| @@ -59,11 +78,15 @@ class KTPlugin { | @@ -59,11 +78,15 @@ class KTPlugin { | ||
| 59 | require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php'); | 78 | require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php'); |
| 60 | require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php'); | 79 | require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php'); |
| 61 | require_once(KT_LIB_DIR . '/plugins/pageregistry.inc.php'); | 80 | require_once(KT_LIB_DIR . '/plugins/pageregistry.inc.php'); |
| 81 | + require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php'); | ||
| 82 | + require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); | ||
| 62 | 83 | ||
| 63 | $oPRegistry =& KTPortletRegistry::getSingleton(); | 84 | $oPRegistry =& KTPortletRegistry::getSingleton(); |
| 64 | $oTRegistry =& KTTriggerRegistry::getSingleton(); | 85 | $oTRegistry =& KTTriggerRegistry::getSingleton(); |
| 65 | $oARegistry =& KTActionRegistry::getSingleton(); | 86 | $oARegistry =& KTActionRegistry::getSingleton(); |
| 66 | $oPageRegistry =& KTPageRegistry::getSingleton(); | 87 | $oPageRegistry =& KTPageRegistry::getSingleton(); |
| 88 | + $oAPRegistry =& KTAuthenticationProviderRegistry::getSingleton(); | ||
| 89 | + $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton(); | ||
| 67 | 90 | ||
| 68 | foreach ($this->_aPortlets as $k => $v) { | 91 | foreach ($this->_aPortlets as $k => $v) { |
| 69 | call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $v); | 92 | call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $v); |
| @@ -80,6 +103,18 @@ class KTPlugin { | @@ -80,6 +103,18 @@ class KTPlugin { | ||
| 80 | foreach ($this->_aPages as $k => $v) { | 103 | foreach ($this->_aPages as $k => $v) { |
| 81 | call_user_func_array(array(&$oPageRegistry, 'registerPage'), $v); | 104 | call_user_func_array(array(&$oPageRegistry, 'registerPage'), $v); |
| 82 | } | 105 | } |
| 106 | + | ||
| 107 | + foreach ($this->_aAuthenticationProviders as $k => $v) { | ||
| 108 | + call_user_func_array(array(&$oAPRegistry, 'registerAuthenticationProvider'), $v); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + foreach ($this->_aAdminCategories as $k => $v) { | ||
| 112 | + call_user_func_array(array(&$oAdminRegistry, 'registerCategory'), $v); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + foreach ($this->_aAdminPages as $k => $v) { | ||
| 116 | + call_user_func_array(array(&$oAdminRegistry, 'registerLocation'), $v); | ||
| 117 | + } | ||
| 83 | } | 118 | } |
| 84 | } | 119 | } |
| 85 | 120 |