Commit 1dd8ef05a86d403bf0d27edb55d140c02cbaf075
1 parent
9fafb241
Allow plugins to register notification handlers
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5660 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
11 additions
and
0 deletions
lib/plugins/plugin.inc.php
| ... | ... | @@ -54,6 +54,7 @@ class KTPlugin { |
| 54 | 54 | var $_aWFTriggers = array(); |
| 55 | 55 | var $_aColumns = array(); |
| 56 | 56 | var $_aViews = array(); |
| 57 | + var $_aNotificationHandlers = array(); | |
| 57 | 58 | |
| 58 | 59 | function KTPlugin($sFilename = null) { |
| 59 | 60 | $this->sFilename = $sFilename; |
| ... | ... | @@ -152,6 +153,11 @@ class KTPlugin { |
| 152 | 153 | $this->_aViews[$sNamespace] = array($sName, $sNamespace); |
| 153 | 154 | } |
| 154 | 155 | |
| 156 | + function registerNotificationHandler($sName, $sNamespace, $sPath) { | |
| 157 | + $sPath = $this->_fixFilename($sPath); | |
| 158 | + $this->_aNotificationHandlers[$sNamespace] = array($sNamespace, $sName, $sPath); | |
| 159 | + } | |
| 160 | + | |
| 155 | 161 | function _fixFilename($sFilename) { |
| 156 | 162 | if (empty($sFilename)) { |
| 157 | 163 | $sFilename = $this->sFilename; |
| ... | ... | @@ -222,6 +228,7 @@ class KTPlugin { |
| 222 | 228 | $oKTHelpRegistry =& KTHelpRegistry::getSingleton(); |
| 223 | 229 | $oWFTriggerRegistry =& KTWorkflowTriggerRegistry::getSingleton(); |
| 224 | 230 | $oColumnRegistry =& KTColumnRegistry::getSingleton(); |
| 231 | + $oNotificationHandlerRegistry =& KTNotificationRegistry::getSingleton(); | |
| 225 | 232 | |
| 226 | 233 | foreach ($this->_aPortlets as $k => $v) { |
| 227 | 234 | call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $v); |
| ... | ... | @@ -282,6 +289,10 @@ class KTPlugin { |
| 282 | 289 | foreach ($this->_aViews as $k => $v) { |
| 283 | 290 | call_user_func_array(array(&$oColumnRegistry, 'registerView'), $v); |
| 284 | 291 | } |
| 292 | + | |
| 293 | + foreach ($this->_aNotificationHandlers as $k => $v) { | |
| 294 | + call_user_func_array(array(&$oNotificationHandlerRegistry, 'registerNotificationHandler'), $v); | |
| 295 | + } | |
| 285 | 296 | } |
| 286 | 297 | |
| 287 | 298 | function setup() { | ... | ... |