diff --git a/workflow/engine/classes/class.plugin.php b/workflow/engine/classes/class.plugin.php index 6bc8052f6..7cd304cf2 100755 --- a/workflow/engine/classes/class.plugin.php +++ b/workflow/engine/classes/class.plugin.php @@ -415,6 +415,23 @@ class PMPlugin throw $e; } } + + /** + * callBack File after import process + * + * @param string $callBackFile + * + * @return void + */ + public function registerImportProcessCallback($callBackFile = '') + { + try { + $oPluginRegistry =& PMPluginRegistry::getSingleton(); + $oPluginRegistry->registerImportProcessCallback($this->sNamespace, $callBackFile); + } catch (Exception $e) { + throw $e; + } + } } class menuDetail @@ -754,3 +771,21 @@ class cronFile $this->cronFile = $cronFile; } } + +class importCallBack +{ + public $namespace; + public $callBackFile; + + /** + * This function is the constructor of the cronFile class + * param string $namespace + * param string $callBackFile + * @return void + */ + public function __construct($namespace, $callBackFile) + { + $this->namespace = $namespace; + $this->callBackFile = $callBackFile; + } +} \ No newline at end of file diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index 8cd899128..efb6baba8 100755 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -103,6 +103,7 @@ class PMPluginRegistry private $_aCronFiles = array (); private $_arrayDesignerMenu = array(); private $_aMenuOptionsToReplace = array (); + private $_aImportProcessCallbackFile = array (); /** * Registry a plugin javascript to include with js core at same runtime @@ -409,6 +410,10 @@ class PMPluginRegistry unset( $this->_aMenuOptionsToReplace ); } + if(sizeof( $this->_aImportProcessCallbackFile )){ + unset( $this->_aImportProcessCallbackFile ); + } + //unregistering javascripts from this plugin $this->unregisterJavascripts( $sNamespace ); //unregistering rest services from this plugin @@ -1702,5 +1707,43 @@ class PMPluginRegistry } } } + + /** + * Register a callBackFile in the singleton + * + * @param unknown_type $namespace + * + * @param string $callBackFile + * + * @return void + */ + public function registerImportProcessCallback ($namespace, $callBackFile) + { + try { + $found = false; + foreach ($this->_aImportProcessCallbackFile as $row => $detail) { + if ($callBackFile == $detail->callBackFile && $namespace == $detail->namespace) { + $detail->callBackFile = $callBackFile; + $found = true; + } + } + if (!$found) { + $callBackFile = new importCallBack( $namespace, $callBackFile ); + $this->_aImportProcessCallbackFile[] = $callBackFile; + } + } catch(Excepton $e) { + throw $e; + } + } + + /** + * Return all callBackFiles registered + * + * @return array + */ + public function getImportProcessCallback() + { + return $this->_aImportProcessCallbackFile; + } } diff --git a/workflow/engine/methods/processes/mainInit.php b/workflow/engine/methods/processes/mainInit.php index de1355300..13ee39b79 100755 --- a/workflow/engine/methods/processes/mainInit.php +++ b/workflow/engine/methods/processes/mainInit.php @@ -79,5 +79,13 @@ $oHeadPublisher->assign("arrayFlagMenuNewOption", $arrayFlagMenuNewOption); $oHeadPublisher->assign("arrayMenuNewOptionPlugin", $arrayMenuNewOptionPlugin); $oHeadPublisher->assign("arrayContextMenuOptionPlugin", $arrayContextMenuOptionPlugin); +$oPluginRegistry = & PMPluginRegistry::getSingleton(); +$callBackFile = $oPluginRegistry->getImportProcessCallback(); +$file = false; +if(sizeof($callBackFile)) { + $file = $callBackFile[0]->callBackFile != "" ? $callBackFile[0]->callBackFile : false; +} +$oHeadPublisher->assign("importProcessCallbackFile", $file); + G::RenderPage( 'publish', 'extJs' ); diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 1dc906eb5..db0011549 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -1025,7 +1025,8 @@ importProcessExistGroup = function() var sNewProUid = resp_.sNewProUid; if (typeof(resp_.project_type) != "undefined" && resp_.project_type == "bpmn") { - openWindowIfIE("../designer?prj_uid=" + sNewProUid); + var goTo = importProcessCallbackFile ? importProcessCallbackFile : "../designer?prj_uid="; + openWindowIfIE(goTo + sNewProUid); } else { window.location.href = "processes_Map?PRO_UID=" + sNewProUid; } @@ -1169,7 +1170,8 @@ importProcessExistProcess = function() if (resp_.ExistGroupsInDatabase == 0) { if (typeof(resp_.project_type) != "undefined" && resp_.project_type == "bpmn") { - openWindowIfIE("../designer?prj_uid=" + sNewProUid); + var goTo = importProcessCallbackFile ? importProcessCallbackFile : "../designer?prj_uid="; + openWindowIfIE(goTo + sNewProUid); } else { window.location.href = "processes_Map?PRO_UID=" + sNewProUid; } @@ -1312,7 +1314,8 @@ importProcess = function() var sNewProUid = resp_.sNewProUid; if (typeof(resp_.project_type) != "undefined" && resp_.project_type == "bpmn") { - openWindowIfIE("../designer?prj_uid=" + sNewProUid); + var goTo = importProcessCallbackFile ? importProcessCallbackFile : "../designer?prj_uid="; + openWindowIfIE(goTo + sNewProUid); } else { window.location.href = "processes_Map?PRO_UID=" + sNewProUid; } @@ -1456,7 +1459,8 @@ importProcessBpmnSubmit = function () { } Ext.getCmp('importProcessWindow').close(); if (typeof(importProcessGlobal.processFileType) != "undefined" && importProcessGlobal.processFileType == "bpmn") { - openWindowIfIE("../designer?prj_uid=" + resp_.prj_uid); + var goTo = importProcessCallbackFile ? importProcessCallbackFile : "../designer?prj_uid="; + openWindowIfIE(goTo + resp_.prj_uid); } else { window.location.href = "processes_Map?PRO_UID=" + resp_.prj_uid; }