Merged in HOR-3700-RG (pull request #5960)

HOR-3700-RG

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Roly
2017-08-16 20:43:28 +00:00
committed by Julio Cesar Laura Avendaño
4 changed files with 176 additions and 207 deletions

View File

@@ -1,54 +1,7 @@
<?php
/**
* class.plugin.php
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
define('G_PLUGIN_CLASS', 1);
define('PM_CREATE_CASE', 1001);
define('PM_UPLOAD_DOCUMENT', 1002);
define('PM_CASE_DOCUMENT_LIST', 1003);
define('PM_BROWSE_CASE', 1004);
define('PM_NEW_PROCESS_LIST', 1005);
define('PM_NEW_PROCESS_SAVE', 1006);
define('PM_NEW_DYNAFORM_LIST', 1007);
define('PM_NEW_DYNAFORM_SAVE', 1008);
define('PM_EXTERNAL_STEP', 1009);
define('PM_CASE_DOCUMENT_LIST_ARR', 1010);
define('PM_LOGIN', 1011);
define('PM_UPLOAD_DOCUMENT_BEFORE', 1012);
define('PM_CREATE_NEW_DELEGATION', 1013);
define('PM_SINGLE_SIGN_ON', 1014);
define('PM_GET_CASES_AJAX_LISTENER', 1015);
define('PM_BEFORE_CREATE_USER', 1016);
define('PM_AFTER_LOGIN', 1017);
define('PM_HASH_PASSWORD', 1018);
define('PM_SCHEDULER_CREATE_CASE_BEFORE', 1019);
define('PM_SCHEDULER_CREATE_CASE_AFTER', 1020);
/**
* @package workflow.engine.classes
*/
@@ -71,10 +24,10 @@ class PMPlugin
*/
public function PMPlugin($sNamespace, $sFilename = null)
{
$this->sNamespace = $sNamespace;
$this->sClassName = $sNamespace . 'Plugin';
$this->sNamespace = $sNamespace;
$this->sClassName = $sNamespace . 'Plugin';
$this->sPluginFolder = $sNamespace;
$this->sFilename = $sFilename;
$this->sFilename = $sFilename;
}
/**
@@ -85,7 +38,7 @@ class PMPlugin
*/
public function registerMenu($menuId, $menuFilename)
{
$sMenuFilename = ($this->sClassName == 'enterprisePlugin') ? PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . $menuFilename : PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $menuFilename;
$sMenuFilename = ($this->sClassName == 'enterprisePlugin') ? PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . $menuFilename : PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $menuFilename;
PluginRegistry::loadSingleton()->registerMenu($this->sNamespace, $menuId, $sMenuFilename);
}
@@ -154,9 +107,9 @@ class PMPlugin
* param
* @return void
*/
public function registerStep($sStepId, $sStepName, $sStepTitle, $sSetupStepPage = '')
public function registerStep($sStepId, $sStepName, $sStepTitle, $sSetupStepPage = '')
{
PluginRegistry::loadSingleton()->registerStep( $this->sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage );
PluginRegistry::loadSingleton()->registerStep($this->sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage);
}
/**
@@ -236,7 +189,7 @@ class PMPlugin
public function registerBreakPageTemplate($pageId, $templateFilename)
{
$sPageFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $templateFilename;
PluginRegistry::loadSingleton()->registerBreakPageTemplate ($this->sNamespace, $pageId, $sPageFilename);
PluginRegistry::loadSingleton()->registerBreakPageTemplate($this->sNamespace, $pageId, $sPageFilename);
}
/**
@@ -257,7 +210,7 @@ class PMPlugin
*/
public function registerToolbarFile($sToolbarId, $filename)
{
$sFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $filename;
$sFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $filename;
PluginRegistry::loadSingleton()->registerToolbarFile($this->sNamespace, $sToolbarId, $sFilename);
}
@@ -266,15 +219,10 @@ class PMPlugin
* param
* @return void
*/
public function registerCaseSchedulerPlugin(
$sActionId,
$sActionForm,
$sActionSave,
$sActionExecute,
$sActionGetFields
) {
public function registerCaseSchedulerPlugin($sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields)
{
PluginRegistry::loadSingleton()->registerCaseSchedulerPlugin(
$this->sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields
$this->sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields
);
}
@@ -283,9 +231,9 @@ class PMPlugin
* @param string $sPage
* @return void
*/
public function registerTaskExtendedProperty($sPage, $sName, $sIcon="")
public function registerTaskExtendedProperty($sPage, $sName, $sIcon = "")
{
PluginRegistry::loadSingleton()->registerTaskExtendedProperty ( $this->sNamespace, $sPage, $sName, $sIcon );
PluginRegistry::loadSingleton()->registerTaskExtendedProperty($this->sNamespace, $sPage, $sName, $sIcon);
}
/**
@@ -294,7 +242,7 @@ class PMPlugin
* @param array/string $pluginJsFile
* @return void
*/
function registerJavascript($sCoreJsFile, $pluginJsFile)
public function registerJavascript($sCoreJsFile, $pluginJsFile)
{
PluginRegistry::loadSingleton()->registerJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
}
@@ -327,7 +275,7 @@ class PMPlugin
* @param array/string $pluginJsFile
* @return void
*/
function registerRestService()
public function registerRestService()
{
PluginRegistry::loadSingleton()->registerRestService($this->sNamespace);
}
@@ -337,7 +285,7 @@ class PMPlugin
*
* @param string $className that is name class to extends
*/
function registerExtendsRestService($className)
public function registerExtendsRestService($className)
{
PluginRegistry::loadSingleton()->registerExtendsRestService($this->sNamespace, $className);
}
@@ -347,7 +295,7 @@ class PMPlugin
*
* @param string $className that is name class to extends
*/
function disableExtendsRestService($className)
public function disableExtendsRestService($className)
{
PluginRegistry::loadSingleton()->disableExtendsRestService($this->sNamespace, $className);
}
@@ -360,7 +308,7 @@ class PMPlugin
* @param array/string $pluginJsFile
* @return void
*/
function unregisterRestService($classname, $path)
public function unregisterRestService($classname, $path)
{
PluginRegistry::loadSingleton()->unregisterRestService($this->sNamespace, $classname, $path);
}
@@ -375,7 +323,7 @@ class PMPlugin
PluginRegistry::loadSingleton()->registerCronFile($this->sNamespace, $cronFile);
}
function enableRestService($enable)
public function enableRestService($enable)
{
PluginRegistry::loadSingleton()->enableRestService($this->sNamespace, $enable);
}
@@ -487,7 +435,7 @@ class PMPlugin
}
}
}
/**
* Gets an array of plugins that are in the processmaker plugin directory.
* @param string $workspace
@@ -495,7 +443,7 @@ class PMPlugin
*/
public static function getListPluginsManager($workspace)
{
$items = Array();
$items = array();
$aPluginsPP = array();
if (is_file(PATH_PLUGINS . 'enterprise/data/data')) {
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/data')));
@@ -510,7 +458,7 @@ class PMPlugin
continue;
}
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file);
include_once(PATH_PLUGINS . $file);
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $pluginDetail */
$pluginDetail = $oPluginRegistry->getPluginDetails($file);
if ($pluginDetail === null) {
@@ -550,10 +498,10 @@ class PMPlugin
}
return $items;
}
/**
* Gets a general list of all plugins within processmaker per workspace.
*
*
* @param string $workspace
* @return array
*/
@@ -564,7 +512,7 @@ class PMPlugin
if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file);
include_once(PATH_PLUGINS . $file);
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $detail */
$detail = $oPluginRegistry->getPluginDetails($file);
if ($detail !== null) {
@@ -576,7 +524,6 @@ class PMPlugin
}
return $items;
}
}
class menuDetail
@@ -595,12 +542,11 @@ class menuDetail
public function __construct($sNamespace, $sMenuId, $sFilename)
{
$this->sNamespace = $sNamespace;
$this->sMenuId = $sMenuId;
$this->sFilename = $sFilename;
$this->sMenuId = $sMenuId;
$this->sFilename = $sFilename;
}
}
class toolbarDetail
{
public $sNamespace;
@@ -617,8 +563,8 @@ class toolbarDetail
public function __construct($sNamespace, $sToolbarId, $sFilename)
{
$this->sNamespace = $sNamespace;
$this->sToolbarId = $sToolbarId;
$this->sFilename = $sFilename;
$this->sToolbarId = $sToolbarId;
$this->sFilename = $sFilename;
}
}
@@ -636,7 +582,7 @@ class cssFile
public function __construct($sNamespace, $sCssFile)
{
$this->sNamespace = $sNamespace;
$this->sCssFile = $sCssFile;
$this->sCssFile = $sCssFile;
}
}
@@ -655,8 +601,8 @@ class triggerDetail
*/
public function __construct($sNamespace, $sTriggerId, $sTriggerName)
{
$this->sNamespace = $sNamespace;
$this->sTriggerId = $sTriggerId;
$this->sNamespace = $sNamespace;
$this->sTriggerId = $sTriggerId;
$this->sTriggerName = $sTriggerName;
}
}
@@ -676,8 +622,8 @@ class folderDetail
*/
public function __construct($sNamespace, $sFolderId, $sFolderName)
{
$this->sNamespace = $sNamespace;
$this->sFolderId = $sFolderId;
$this->sNamespace = $sNamespace;
$this->sFolderId = $sFolderId;
$this->sFolderName = $sFolderName;
}
}
@@ -701,10 +647,10 @@ class stepDetail
*/
public function __construct($sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage)
{
$this->sNamespace = $sNamespace;
$this->sStepId = $sStepId;
$this->sStepName = $sStepName;
$this->sStepTitle = $sStepTitle;
$this->sNamespace = $sNamespace;
$this->sStepId = $sStepId;
$this->sStepName = $sStepName;
$this->sStepTitle = $sStepTitle;
$this->sSetupStepPage = $sSetupStepPage;
}
}
@@ -724,8 +670,8 @@ class redirectDetail
*/
public function __construct($sNamespace, $sRoleCode, $sPathMethod)
{
$this->sNamespace = $sNamespace;
$this->sRoleCode = $sRoleCode;
$this->sNamespace = $sNamespace;
$this->sRoleCode = $sRoleCode;
$this->sPathMethod = $sPathMethod;
}
}
@@ -751,22 +697,15 @@ class folderData
* param string $sUserFullName
* @return void
*/
public function __construct(
$sProcessUid,
$sProcessTitle,
$sApplicationUid,
$sApplicationTitle,
$sUserUid,
$sUserLogin = '',
$sUserFullName =''
) {
$this->sProcessUid = $sProcessUid;
$this->sProcessTitle = $sProcessTitle;
$this->sApplicationUid = $sApplicationUid;
public function __construct($sProcessUid, $sProcessTitle, $sApplicationUid, $sApplicationTitle, $sUserUid, $sUserLogin = '', $sUserFullName = '')
{
$this->sProcessUid = $sProcessUid;
$this->sProcessTitle = $sProcessTitle;
$this->sApplicationUid = $sApplicationUid;
$this->sApplicationTitle = $sApplicationTitle;
$this->sUserUid = $sUserUid;
$this->sUserLogin = $sUserLogin;
$this->sUserFullName = $sUserFullName;
$this->sUserUid = $sUserUid;
$this->sUserLogin = $sUserLogin;
$this->sUserFullName = $sUserFullName;
}
}
@@ -793,12 +732,12 @@ class uploadDocumentData
public function __construct($sApplicationUid, $sUserUid, $sFilename, $sFileTitle, $sDocumentUid, $iVersion = 1)
{
$this->sApplicationUid = $sApplicationUid;
$this->sUserUid = $sUserUid;
$this->sFilename = $sFilename;
$this->sFileTitle = $sFileTitle;
$this->sDocumentUid = $sDocumentUid;
$this->sUserUid = $sUserUid;
$this->sFilename = $sFilename;
$this->sFileTitle = $sFileTitle;
$this->sDocumentUid = $sDocumentUid;
$this->bUseOutputFolder = false;
$this->iVersion = $iVersion;
$this->iVersion = $iVersion;
}
}
@@ -818,8 +757,8 @@ class loginInfo
public function __construct($lName, $lPassword, $lSession)
{
$this->lName = $lName;
$this->lPassword = $lPassword;
$this->lSession = $lSession;
$this->lPassword = $lPassword;
$this->lSession = $lSession;
}
}
@@ -844,11 +783,11 @@ class caseSchedulerPlugin
*/
public function __construct($sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields)
{
$this->sNamespace = $sNamespace;
$this->sActionId = $sActionId;
$this->sActionForm = $sActionForm;
$this->sActionSave = $sActionSave;
$this->sActionExecute = $sActionExecute;
$this->sNamespace = $sNamespace;
$this->sActionId = $sActionId;
$this->sActionForm = $sActionForm;
$this->sActionSave = $sActionSave;
$this->sActionExecute = $sActionExecute;
$this->sActionGetFields = $sActionGetFields;
}
}
@@ -871,9 +810,9 @@ class taskExtendedProperty
public function __construct($sNamespace, $sPage, $sName, $sIcon)
{
$this->sNamespace = $sNamespace;
$this->sPage = $sPage;
$this->sName = $sName;
$this->sIcon = $sIcon;
$this->sPage = $sPage;
$this->sName = $sName;
$this->sIcon = $sIcon;
}
}
@@ -893,9 +832,9 @@ class dashboardPage
public function __construct($sNamespace, $sPage, $sName, $sIcon)
{
$this->sNamespace = $sNamespace;
$this->sPage = $sPage;
$this->sName = $sName;
$this->sIcon = $sIcon;
$this->sPage = $sPage;
$this->sName = $sName;
$this->sIcon = $sIcon;
}
}
@@ -913,7 +852,7 @@ class cronFile
public function __construct($namespace, $cronFile)
{
$this->namespace = $namespace;
$this->cronFile = $cronFile;
$this->cronFile = $cronFile;
}
}
@@ -931,7 +870,7 @@ class importCallBack
public function __construct($namespace, $callBackFile)
{
$this->namespace = $namespace;
$this->callBackFile = $callBackFile;
$this->callBackFile = $callBackFile;
}
}
@@ -947,6 +886,7 @@ class OpenReassignCallback
*/
public function __construct($callBackFile)
{
$this->callBackFile = $callBackFile;
$this->callBackFile = $callBackFile;
}
}
}

View File

@@ -1,5 +1,10 @@
<?php
use Illuminate\Foundation\Http\Kernel;
use Maveriks\WebApplication;
use Maveriks\Http\Response;
use Maveriks\Pattern\Mvc\PhtmlView;
use ProcessMaker\Exception\RBACException;
// Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used.
require_once __DIR__ . '/../../gulliver/system/class.g.php';
@@ -27,47 +32,45 @@ if (isset($_SERVER['UNENCODED_URL'])) {
try {
$rootDir = realpath(__DIR__ . "/../../") . DIRECTORY_SEPARATOR;
$app = new Maveriks\WebApplication();
$app = new WebApplication();
$app->setRootDir($rootDir);
$app->setRequestUri($_SERVER['REQUEST_URI']);
$stat = $app->route();
switch ($stat)
{
case Maveriks\WebApplication::RUNNING_WORKFLOW:
switch ($stat) {
case WebApplication::RUNNING_WORKFLOW:
include "sysGeneric.php";
break;
case Maveriks\WebApplication::RUNNING_API:
$app->run(Maveriks\WebApplication::SERVICE_API);
case WebApplication::RUNNING_API:
$app->run(WebApplication::SERVICE_API);
break;
case Maveriks\WebApplication::RUNNING_OAUTH2:
$app->run(Maveriks\WebApplication::SERVICE_OAUTH2);
case WebApplication::RUNNING_OAUTH2:
$app->run(WebApplication::SERVICE_OAUTH2);
break;
case Maveriks\WebApplication::RUNNING_INDEX:
$response = new Maveriks\Http\Response(file_get_contents("index.html"), 302);
case WebApplication::RUNNING_INDEX:
$response = new Response(file_get_contents("index.html"), 302);
$response->send();
break;
case Maveriks\WebApplication::RUNNING_DEFAULT:
$response = new Maveriks\Http\Response("", 302);
case WebApplication::RUNNING_DEFAULT:
$response = new Response("", 302);
//TODO compose this def url with configuration data from env.ini
$response->setHeader("location", "/sys/en/neoclassic/login/login");
$response->send();
break;
}
} catch (ProcessMaker\Exception\RBACException $e) {
} catch (RBACException $e) {
G::header('location: ' . $e->getPath());
} catch (Exception $e) {
$view = new Maveriks\Pattern\Mvc\PhtmlView($rootDir . "framework/src/templates/Exception.phtml");
$view = new PhtmlView($rootDir . "framework/src/templates/Exception.phtml");
$view->set("message", $e->getMessage());
$view->set("exception", $e);
$response = new Maveriks\Http\Response($view->getOutput(), 503);
$response = new Response($view->getOutput(), 503);
$response->send();
}