Merged in mcuiza/processmaker/PM-4170 (pull request #3278)

PM-4170
This commit is contained in:
Julio Cesar Laura Avendaño
2015-11-30 18:11:11 -04:00
4 changed files with 94 additions and 4 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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' );

View File

@@ -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;
}