Merged in feature/HOR-3629 (pull request #5900)

Feature/HOR-3629

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Ronald Quenta
2017-08-11 03:48:37 +00:00
committed by Julio Cesar Laura Avendaño
127 changed files with 7914 additions and 1103 deletions

View File

@@ -1,5 +1,8 @@
<?php
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
use ProcessMaker\Plugins\PluginRegistry;
register_shutdown_function(
create_function(
'',
@@ -145,12 +148,6 @@ try {
eprintln('WARNING! No server info found!', 'red');
}
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
if (file_exists($sSerializedFile)) {
$pluginRegistry = PMPluginRegistry::loadSingleton($sSerializedFile);
}
//DB
$phpCode = '';
@@ -225,9 +222,6 @@ try {
define('TIME_ZONE', ini_get('date.timezone'));
//Enable Monolog
//Processing
eprintln('Processing workspace: ' . $workspace, 'green');
@@ -282,11 +276,7 @@ try {
function processWorkspace()
{
try {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if (file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
$oPluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . 'plugin.singleton'));
}
$oPluginRegistry = PluginRegistry::loadSingleton();
global $sObject;
global $sLastExecution;
@@ -326,7 +316,6 @@ function resendEmails()
setExecutionMessage("Resending emails");
try {
$dateResend = $sNow;
if ($sNow == $dateSystem) {
@@ -391,8 +380,6 @@ function unpauseApplications()
setExecutionMessage("Unpausing applications");
try {
$oCases = new Cases();
$oCases->ThrowUnpauseDaemon($sNow, 1);
@@ -436,7 +423,7 @@ function executePlugins()
// Executing registered cron files
// -> Get registered cron files
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$cronFiles = $oPluginRegistry->getCronFiles();
// -> Execute functions

View File

@@ -56,13 +56,7 @@ function run_addon_core_install($args)
define("DB_ADAPTER", $args[3]);
}
$sSerializedFile = PATH_DATA_SITE . "plugin.singleton";
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if (file_exists($sSerializedFile)) {
$oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
}
///////
//echo "** Installation starting... (workspace: $workspace, store: $storeId, id: $addonName)\n";
$ws = new workspaceTools($workspace);
$ws->initPropel(false);

View File

@@ -25,6 +25,8 @@
*/
use ProcessMaker\Util\System;
CLI::taskName('flush-cache');
CLI::taskDescription(<<<EOT
Flush cache of all workspaces of a given workspace
@@ -72,7 +74,7 @@ function flush_cache($workspace)
echo " Update singleton in workspace " . $workspace->name . " ... ";
echo PHP_EOL;
echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL;
$status = \ProcessMaker\Util\System::flushCache($workspace);
System::flushCache($workspace);
echo "DONE" . PHP_EOL;
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;

View File

@@ -303,6 +303,19 @@ CLI::taskArg('workspace', true, true);
CLI::taskOpt("lang", "Specify the language to migrate the content data. If not specified, then 'en' (English) will be used by default.\n Ex: -lfr (French) Ex: --lang=zh-CN (Mainland Chinese)", "l:","lang=");
CLI::taskRun("run_migrate_content");
CLI::taskName('migrate-plugins-singleton-information');
CLI::taskDescription(<<<EOT
Migrating the content schema to match the latest version
  Specify the WORKSPACE to migrate from an existing workspace.
If no workspace is specified, then the tables schema will be upgraded or
migrated to all available workspaces.
EOT
);
CLI::taskArg('workspace', true, true);
CLI::taskRun("run_migrate_plugin");
CLI::taskName('migrate-self-service-value');
CLI::taskDescription(<<<EOT
Migrate the Self-Service values to a new related table APP_ASSIGN_SELF_SERVICE_VALUE_GROUPS
@@ -330,7 +343,7 @@ CLI::taskArg('workspace');
CLI::taskRun("cliListIds");
/**
*
*
*/
CLI::taskName('regenerate-pmtable-classes');
CLI::taskDescription(<<<EOT
@@ -1098,12 +1111,31 @@ function run_migrate_indexing_acv($args, $opts) {
CLI::logging("<*> Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n");
}
function run_migrate_plugin($args, $opts) {
$workspaces = get_workspaces_from_args($args);
//Check if the command is executed by a specific workspace
/** @var workspaceTools $workspace */
if (count($workspaces) === 1) {
$workspace = array_shift($workspaces);
CLI::logging('Regenerating Singleton in: ' . pakeColor::colorize($workspace->name, 'INFO') . "\n");
$workspace->migrateSingleton($workspace->name);
CLI::logging("-> Regenerating Singleton \n");
} else {
CLI::logging("> Migrating and populating data...\n");
$start = microtime(true);
foreach ($workspaces as $workspace) {
passthru('./processmaker migrate-plugins-singleton-information '.$workspace->name);
}
$stop = microtime(true);
CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n");
}
}
/**
* This method recursively finds all PHP files that reference the path PATH_DATA
* incorrectly, which is caused by importing processes where the data directory
* of ProcessMaker has different routes. Modified files are backed up with the
* This method recursively finds all PHP files that reference the path PATH_DATA
* incorrectly, which is caused by importing processes where the data directory
* of ProcessMaker has different routes. Modified files are backed up with the
* extension '.backup' in the same directory.
*
*
* @param array $args
* @param array $opts
* @throws Exception

View File

@@ -84,7 +84,7 @@ class PmInstaller
* @param string $name Default value "workflow"
* @return string file_exists(PATH_DATA."sites/".$name);
*/
public function isset_site($name = "workflow")
public static function isset_site($name = "workflow")
{
$pathSites = PATH_DATA . 'sites/'. '*';
$directories = glob($pathSites, GLOB_ONLYDIR);

View File

@@ -24,6 +24,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
*
* @package workflow.engine.ProcessMaker
@@ -368,12 +371,13 @@ class ProcessMap
$oPM->derivation = array('Sequential', 'Evaluate (manual)', 'Evaluate (auto)', 'Parallel (fork)', 'Parallel by evaluation (fork)', 'Parallel (sequential join)', 'Parallel (sequential main join)' );
//Load extended task properties from plugin. By JHL Jan 18, 2011
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\TaskExtendedProperty[] $activePluginsForTaskProperties */
$activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();
$oPM->taskOptions = array();
foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) {
$taskOption['title'] = $taskPropertiesInfo->sName;
$taskOption['id'] = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName;
foreach ($activePluginsForTaskProperties as $taskPropertiesInfo) {
$taskOption['title'] = $taskPropertiesInfo->getName();
$taskOption['id'] = $taskPropertiesInfo->getNamespace() . "--" . $taskPropertiesInfo->getName();
$oPM->taskOptions[] = $taskOption;
}
@@ -745,7 +749,8 @@ class ProcessMap
{
try {
//call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
$aSteps = array();
@@ -795,9 +800,9 @@ class ProcessMap
case 'EXTERNAL':
$sTitle = 'unknown ' . $aRow['STEP_UID'];
foreach ($externalSteps as $key => $val) {
if ($val->sStepId == $aRow['STEP_UID_OBJ']) {
$sTitle = $val->sStepTitle;
if (trim($val->sSetupStepPage) != '') {
if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) {
$sTitle = $val->getStepTitle();
if (trim($val->getSetupStepPage()) != '') {
$urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');";
$linkEditValue = 'Edit';
} else {
@@ -929,11 +934,17 @@ class ProcessMap
}
//call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $stepVar) {
$aBB[] = array('STEP_UID' => $stepVar->sStepId, 'STEP_TITLE' => $stepVar->sStepTitle, 'STEP_TYPE_OBJ' => 'EXTERNAL', 'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->sStepId . '">' );
$aBB[] = array(
'STEP_UID' => $stepVar->getStepId(),
'STEP_TITLE' => $stepVar->getStepTitle(),
'STEP_TYPE_OBJ' => 'EXTERNAL',
'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->getStepId() . '">'
);
}
}
global $_DBArray;
@@ -1363,12 +1374,13 @@ class ProcessMap
break;
default:
//if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\TaskExtendedProperty[] $activePluginsForTaskProperties */
$activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();
foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) {
$id = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName;
$id = $taskPropertiesInfo->getNamespace() . "--" . $taskPropertiesInfo->getName();
if ($id == $iForm) {
$sFilename = $taskPropertiesInfo->sPage;
$sFilename = $taskPropertiesInfo->getPage();
$sw_template = true;
}
}
@@ -4697,10 +4709,6 @@ class ProcessMap
public function getDynaformList($sTaskUID = '')
{
try {
//call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$aSteps = array();
//$aSteps [] = array ('STEP_TITLE' => 'char', 'STEP_UID' => 'char', 'STEP_TYPE_OBJ' => 'char', 'STEP_CONDITION' => 'char', 'STEP_POSITION' => 'integer' );
$oCriteria = new Criteria('workflow');
@@ -5131,11 +5139,17 @@ class ProcessMap
}
//call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $stepVar) {
$aBB[] = array('STEP_UID' => $stepVar->sStepId, 'STEP_TITLE' => $stepVar->sStepTitle, 'STEP_TYPE_OBJ' => 'EXTERNAL', 'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->sStepId . '">' );
$aBB[] = array(
'STEP_UID' => $stepVar->getStepId(),
'STEP_TITLE' => $stepVar->getStepTitle(),
'STEP_TYPE_OBJ' => 'EXTERNAL',
'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->getStepId() . '">'
);
}
}
@@ -5180,7 +5194,8 @@ class ProcessMap
{
try {
//call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
$aSteps = array();
@@ -5239,10 +5254,10 @@ class ProcessMap
case 'EXTERNAL':
$sTitle = 'unknown ' . $aRow['STEP_UID'];
foreach ($externalSteps as $key => $val) {
if ($val->sStepId == $aRow['STEP_UID_OBJ']) {
$sTitle = $val->sStepTitle;
if (trim($val->sSetupStepPage) != '') {
$urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');";
if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) {
$sTitle = $val->getStepTitle();
if (trim($val->getSetupStepPage()) != '') {
$urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->getSetupStepPage() . "');";
$linkEditValue = 'Edit';
} else {
$urlEdit = "";

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
class Applications
{
/**
@@ -1125,12 +1128,12 @@ class Applications
$caseSteps = $step->getAllCaseSteps( $proUid, $tasUid, $appUid );
//getting externals steps
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$eSteps = $oPluginRegistry->getSteps();
$externalSteps = array ();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail $externalStep */
foreach ($eSteps as $externalStep) {
$externalSteps[$externalStep->sStepId] = $externalStep;
$externalSteps[$externalStep->getStepId()] = $externalStep;
}
//getting the case record
@@ -1187,11 +1190,11 @@ class Applications
break;
case 'EXTERNAL':
$stepTitle = 'unknown ' . $caseStep->getStepUidObj();
$oPluginRegistry = PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$externalStep = $externalSteps[$caseStep->getStepUidObj()];
$stepItem['id'] = $externalStep->sStepId;
$stepItem['title'] = $externalStep->sStepTitle;
$stepItem['url'] = "cases/cases_Step?UID={$externalStep->sStepId}&TYPE=EXTERNAL&POSITION=$stepPosition&ACTION=EDIT";
$stepItem['id'] = $externalStep->getStepId();
$stepItem['title'] = $externalStep->getStepTitle();
$stepItem['url'] = "cases/cases_Step?UID={$externalStep->getStepId()}&TYPE=EXTERNAL&POSITION=$stepPosition&ACTION=EDIT";
break;
}

View File

@@ -27,6 +27,7 @@ use \ProcessMaker\BusinessModel\WebEntryEvent;
*
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
* A Cases object where you can do start, load, update, refresh about cases
@@ -2278,7 +2279,7 @@ class Cases
$newValues['APP_TITLE'],
$sUsrUid
);
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
}
$this->getExecuteTriggerProcess($sAppUid, 'CREATE');
@@ -3550,7 +3551,7 @@ class Cases
$_SESSION['PROCESS'], $sApplicationUID, $_SESSION['TASK'], $_SESSION['USER_LOGGED'], $ACTION = 'DELETE'
);
$listing = false;
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new folderData(null, null, $sApplicationUID, null, $_SESSION['USER_LOGGED']);
$folderData->PMType = "INPUT";
@@ -3891,7 +3892,7 @@ class Cases
}
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$triggerDetail = $pluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
@@ -4648,12 +4649,11 @@ class Cases
$confEnvSetting = $conf->getFormats();
$listing = false;
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "INPUT";
$folderData->returnList = true;
//$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
@@ -4955,12 +4955,11 @@ class Cases
$confEnvSetting = $conf->getFormats();
$listing = false;
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "OUTPUT";
$folderData->returnList = true;
//$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}

View File

@@ -23,6 +23,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
require_once 'class.pluginRegistry.php';
define('G_PLUGIN_CLASS', 1);
@@ -84,9 +86,8 @@ class PMPlugin
*/
public function registerMenu($menuId, $menuFilename)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$sMenuFilename = ($this->sClassName == 'enterprisePlugin') ? PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . $menuFilename : PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $menuFilename;
$oPluginRegistry->registerMenu($this->sNamespace, $menuId, $sMenuFilename);
PluginRegistry::loadSingleton()->registerMenu($this->sNamespace, $menuId, $sMenuFilename);
}
/**
@@ -96,8 +97,7 @@ class PMPlugin
*/
public function registerDashlets()
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerDashlets($this->sNamespace);
PluginRegistry::loadSingleton()->registerDashlets($this->sNamespace);
}
/**
@@ -107,8 +107,7 @@ class PMPlugin
*/
public function registerReport()
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerReport($this->sNamespace);
PluginRegistry::loadSingleton()->registerReport($this->sNamespace);
}
/**
@@ -118,8 +117,7 @@ class PMPlugin
*/
public function registerPmFunction()
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerPmFunction($this->sNamespace);
PluginRegistry::loadSingleton()->registerPmFunction($this->sNamespace);
}
/**
@@ -129,8 +127,7 @@ class PMPlugin
*/
public function setCompanyLogo($filename)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->setCompanyLogo($this->sNamespace, $filename);
PluginRegistry::loadSingleton()->setCompanyLogo($this->sNamespace, $filename);
}
/**
@@ -140,8 +137,7 @@ class PMPlugin
*/
public function redirectLogin($role, $pathMethod)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerRedirectLogin($this->sNamespace, $role, $pathMethod);
PluginRegistry::loadSingleton()->registerRedirectLogin($this->sNamespace, $role, $pathMethod);
}
/**
@@ -151,8 +147,7 @@ class PMPlugin
*/
public function registerFolder($sFolderId, $sFolderName)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerFolder($this->sNamespace, $sFolderId, $sFolderName);
PluginRegistry::loadSingleton()->registerFolder($this->sNamespace, $sFolderId, $sFolderName);
}
/**
@@ -162,8 +157,7 @@ class PMPlugin
*/
public function registerStep($sStepId, $sStepName, $sStepTitle, $sSetupStepPage = '')
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerStep( $this->sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage );
PluginRegistry::loadSingleton()->registerStep( $this->sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage );
}
/**
@@ -174,8 +168,7 @@ class PMPlugin
*/
public function registerTrigger($sTriggerId, $sTriggerName)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerTrigger($this->sNamespace, $sTriggerId, $sTriggerName);
PluginRegistry::loadSingleton()->registerTrigger($this->sNamespace, $sTriggerId, $sTriggerName);
}
/**
@@ -243,9 +236,8 @@ class PMPlugin
*/
public function registerBreakPageTemplate($pageId, $templateFilename)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$sPageFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $templateFilename;
$oPluginRegistry->registerBreakPageTemplate ($this->sNamespace, $pageId, $sPageFilename);
PluginRegistry::loadSingleton()->registerBreakPageTemplate ($this->sNamespace, $pageId, $sPageFilename);
}
/**
@@ -255,8 +247,7 @@ class PMPlugin
*/
public function registerCss($sCssFile)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerCss($this->sNamespace, $sCssFile);
PluginRegistry::loadSingleton()->registerCss($this->sNamespace, $sCssFile);
}
/**
@@ -267,9 +258,8 @@ class PMPlugin
*/
public function registerToolbarFile($sToolbarId, $filename)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$sFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $filename;
$oPluginRegistry->registerToolbarFile($this->sNamespace, $sToolbarId, $sFilename);
PluginRegistry::loadSingleton()->registerToolbarFile($this->sNamespace, $sToolbarId, $sFilename);
}
/**
@@ -284,8 +274,7 @@ class PMPlugin
$sActionExecute,
$sActionGetFields
) {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerCaseSchedulerPlugin(
PluginRegistry::loadSingleton()->registerCaseSchedulerPlugin(
$this->sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields
);
}
@@ -297,8 +286,7 @@ class PMPlugin
*/
public function registerTaskExtendedProperty($sPage, $sName, $sIcon="")
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerTaskExtendedProperty ( $this->sNamespace, $sPage, $sName, $sIcon );
PluginRegistry::loadSingleton()->registerTaskExtendedProperty ( $this->sNamespace, $sPage, $sName, $sIcon );
}
/**
@@ -309,8 +297,7 @@ class PMPlugin
*/
function registerJavascript($sCoreJsFile, $pluginJsFile)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
PluginRegistry::loadSingleton()->registerJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
}
/**
@@ -321,8 +308,7 @@ class PMPlugin
*/
public function unregisterJavascript($sCoreJsFile, $pluginJsFile)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->unregisterJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
PluginRegistry::loadSingleton()->unregisterJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
}
public function registerDashboard()
@@ -331,8 +317,7 @@ class PMPlugin
public function getExternalStepAction()
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
return $oPluginRegistry->getSteps();
return PluginRegistry::loadSingleton()->getSteps();
}
/**
@@ -345,8 +330,7 @@ class PMPlugin
*/
function registerRestService()
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerRestService($this->sNamespace);
PluginRegistry::loadSingleton()->registerRestService($this->sNamespace);
}
/**
@@ -356,8 +340,7 @@ class PMPlugin
*/
function registerExtendsRestService($className)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerExtendsRestService($this->sNamespace, $className);
PluginRegistry::loadSingleton()->registerExtendsRestService($this->sNamespace, $className);
}
/**
@@ -367,8 +350,7 @@ class PMPlugin
*/
function disableExtendsRestService($className)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->disableExtendsRestService($this->sNamespace, $className);
PluginRegistry::loadSingleton()->disableExtendsRestService($this->sNamespace, $className);
}
/**
@@ -381,8 +363,7 @@ class PMPlugin
*/
function unregisterRestService($classname, $path)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->unregisterRestService($this->sNamespace, $classname, $path);
PluginRegistry::loadSingleton()->unregisterRestService($this->sNamespace, $classname, $path);
}
/**
@@ -392,14 +373,12 @@ class PMPlugin
*/
public function registerCronFile($cronFile)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerCronFile($this->sNamespace, $cronFile);
PluginRegistry::loadSingleton()->registerCronFile($this->sNamespace, $cronFile);
}
function enableRestService($enable)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->enableRestService($this->sNamespace, $enable);
PluginRegistry::loadSingleton()->enableRestService($this->sNamespace, $enable);
}
/**
@@ -412,8 +391,7 @@ class PMPlugin
public function registerDesignerMenu($file)
{
try {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry->registerDesignerMenu($this->sNamespace, $file);
PluginRegistry::loadSingleton()->registerDesignerMenu($this->sNamespace, $file);
} catch (Exception $e) {
throw $e;
}
@@ -431,8 +409,7 @@ class PMPlugin
public function registerMenuOptionsToReplace($from = array(), $options = array())
{
try {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerMenuOptionsToReplace($this->sNamespace, $from, $options);
PluginRegistry::loadSingleton()->registerMenuOptionsToReplace($this->sNamespace, $from, $options);
} catch (Exception $e) {
throw $e;
}
@@ -448,8 +425,7 @@ class PMPlugin
public function registerImportProcessCallback($callBackFile = '')
{
try {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerImportProcessCallback($this->sNamespace, $callBackFile);
PluginRegistry::loadSingleton()->registerImportProcessCallback($this->sNamespace, $callBackFile);
} catch (Exception $e) {
throw $e;
}
@@ -465,8 +441,7 @@ class PMPlugin
public function registerOpenReassignCallback($callBackFile = '')
{
try {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerOpenReassignCallback($callBackFile);
PluginRegistry::loadSingleton()->registerOpenReassignCallback($callBackFile);
} catch (Exception $e) {
throw $e;
}
@@ -484,8 +459,7 @@ class PMPlugin
$scope = '/plugin/' . $this->sNamespace . '/';
}
try {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry->registerDesignerSourcePath($this->sNamespace, $scope . $pathFile);
PluginRegistry::loadSingleton()->registerDesignerSourcePath($this->sNamespace, $scope . $pathFile);
} catch (Exception $e) {
throw $e;
}
@@ -530,7 +504,7 @@ class PMPlugin
$aPluginsPP[] = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')) . '.php';
}
}
$oPluginRegistry = PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) {
if (in_array($file, $aPluginsPP)) {
@@ -538,23 +512,24 @@ class PMPlugin
}
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file);
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $pluginDetail */
$pluginDetail = $oPluginRegistry->getPluginDetails($file);
if ($pluginDetail === null) {
continue;
}
$status_label = $pluginDetail->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
$status = $pluginDetail->enabled ? 1 : 0;
if (isset($pluginDetail->aWorkspaces)) {
if (!is_array($pluginDetail->aWorkspaces)) {
$pluginDetail->aWorkspaces = array();
$status_label = $pluginDetail->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
$status = $pluginDetail->isEnabled() ? 1 : 0;
if ($pluginDetail->getWorkspaces()) {
if (!is_array($pluginDetail->getWorkspaces())) {
$pluginDetail->setWorkspaces(array());
}
if (!in_array($workspace, $pluginDetail->aWorkspaces)) {
if (!in_array($workspace, $pluginDetail->getWorkspaces())) {
continue;
}
}
$setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0';
$setup = $pluginDetail->getSetupPage() != '' && $pluginDetail->isEnabled() ? '1' : '0';
if (isset($pluginDetail) && !$pluginDetail->bPrivate) {
if (isset($pluginDetail) && !$pluginDetail->isPrivate()) {
$items[] = [
'id' => (count($items) + 1),
'namespace' => $pluginDetail->sNamespace,
@@ -585,14 +560,13 @@ class PMPlugin
*/
public static function getListAllPlugins($workspace)
{
PMPluginRegistry::saveState();
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP . "plugin.singleton";
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
$oPluginRegistry = PluginRegistry::loadSingleton();
$items = [];
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);
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $detail */
$detail = $oPluginRegistry->getPluginDetails($file);
if ($detail !== null) {
$items[] = $detail;
@@ -601,7 +575,6 @@ class PMPlugin
}
closedir($handle);
}
PMPluginRegistry::restoreState();
return $items;
}

View File

@@ -25,6 +25,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
*
* @package workflow.engine.classes
@@ -140,30 +142,21 @@ class PMPluginRegistry
*
* @return object
*/
public static function getSingleton ()
public static function getSingleton()
{
if (self::$instance == null) {
self::$instance = new PMPluginRegistry();
}
return self::$instance;
return PluginRegistry::loadSingleton();
}
/**
* Load the singleton instance from a serialized stored file
*
* @param $file
* @return PMPluginRegistry
* @return object
* @throws Exception
*/
public static function loadSingleton($file)
{
self::$instance = unserialize(file_get_contents($file));
if (! is_object(self::$instance) || get_class(self::$instance) != "PMPluginRegistry") {
throw new Exception("Can't load main PMPluginRegistry object.");
}
return self::$instance;
return PluginRegistry::loadSingleton();
}
/**
@@ -1935,7 +1928,7 @@ class PMPluginRegistry
}
/**
* Saves the state of instance, in the private property 'stateSaved'.
* Saves the state of instance, in the private property 'stateSaved'.
* Use the 'restoreState()' method to put the instance in the saved state.
*/
public static function saveState()
@@ -1945,8 +1938,8 @@ class PMPluginRegistry
}
/**
* Restores the state of the instance that is in the private variable 'stateSaved'.
* You must save the state of the instacia with the method 'saveState()'
* Restores the state of the instance that is in the private variable 'stateSaved'.
* You must save the state of the instacia with the method 'saveState()'
* before being called.
*/
public static function restoreState()
@@ -1958,4 +1951,16 @@ class PMPluginRegistry
}
}
/**
* Get all variables of object
* @return array
*/
public function iterateVisible()
{
$response = array();
foreach ($this as $key => $value) {
$response[$key] = $value;
}
return $response;
}
}

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/interfaces/dashletInterface.php';
require_once 'classes/model/Dashlet.php';
require_once 'classes/model/DashletInstance.php';
@@ -361,7 +363,7 @@ class PMDashlet extends DashletInstance implements DashletInterface
//---- verify the name plugin of the class
$pluginName = '';
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$pluginsDashlets = $oPluginRegistry->getDashlets();
foreach ($pluginsDashlets as $pluginDashlet) {
@@ -381,12 +383,8 @@ class PMDashlet extends DashletInstance implements DashletInterface
if (strpos( $file, '.php', 1 ) && is_file( PATH_PLUGINS . $file )) {
include_once (PATH_PLUGINS . $file);
$pluginDetail = $oPluginRegistry->getPluginDetails( $file );
if ($pluginDetail->sNamespace == $pluginName) {
if ($pluginDetail->enabled == '1') {
return true;
} else {
return false;
}
if ($pluginDetail->getNamespace() == $pluginName) {
return $pluginDetail->isEnabled();
}
}
}
@@ -398,7 +396,7 @@ class PMDashlet extends DashletInstance implements DashletInterface
private static function setIncludePath ()
{
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$pluginsDashlets = $oPluginRegistry->getDashlets();
foreach ($pluginsDashlets as $pluginDashlet) {
set_include_path( get_include_path() . PATH_SEPARATOR . PATH_PLUGINS . $pluginDashlet . PATH_SEP );

View File

@@ -28,6 +28,7 @@
//
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Util\ElementTranslation;
@@ -248,9 +249,6 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
((isset($blackList['tables']))? $blackList['tables'] : '') .
((isset($blackList['pmtables']))? $blackList['pmtables'] : '')
);
if (!class_exists('PHPSQLParser')) {
}
$parseSqlStm = new PHPSQLParser($SqlStatement);
try {
//Parsing queries and check the blacklist
@@ -1840,10 +1838,11 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
/** @var \ProcessMaker\Plugins\Interfaces\TriggerDetail $triggerDetail */
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->getNamespace();
$oAppDocument1 = new AppDocument();
$oAppDocument1->update( $aFields );

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.enterpriseUtils.php';
/**
@@ -133,20 +136,20 @@ class pmLicenseManager
if ($this->result=="OK") {
//Disable
if (file_exists ( PATH_PLUGINS . 'enterprise/data/data' )) {
$oPluginRegistry = & PMPluginRegistry::getSingleton ();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_PLUGINS . 'enterprise/data/data' ) ) );
foreach ($aPlugins as $aPlugin) {
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
$oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
$oPluginRegistry->disablePlugin ( $oDetails->getNamespace() );
$oPluginRegistry->savePlugin($oDetails->getNamespace());
}
unlink(PATH_PLUGINS . 'enterprise/data/data');
}
//Enable
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . "enterprise/data/default")));
foreach ($aPlugins as $aPlugin) {
@@ -154,8 +157,8 @@ class pmLicenseManager
$sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-"));
require_once (PATH_PLUGINS . $sClassName . ".php");
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . ".php");
$oPluginRegistry->enablePlugin($oDetails->sNamespace);
file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
$oPluginRegistry->enablePlugin($oDetails->getNamespace());
$oPluginRegistry->savePlugin($oDetails->getNamespace());
}
}
@@ -168,9 +171,9 @@ class pmLicenseManager
if (file_exists(PATH_PLUGINS . $sClassName . '.php')) {
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
$oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
$aDenied[]=$oDetails->sNamespace;
$oPluginRegistry->disablePlugin($oDetails->getNamespace());
$oPluginRegistry->savePlugin($oDetails->getNamespace());
$aDenied[]=$oDetails->getNamespace();
}
}
}
@@ -182,7 +185,7 @@ class pmLicenseManager
}
} else {
//Disable
$oPluginRegistry = & PMPluginRegistry::getSingleton ();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_PLUGINS . 'enterprise/data/default' ) ) );
foreach ($aPlugins as $aPlugin) {
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
@@ -190,13 +193,14 @@ class pmLicenseManager
if (($sClassName != "pmLicenseManager") && ($sClassName != "pmTrial") && ($sClassName != "enterprise")) {
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
$oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
$oPluginRegistry->disablePlugin($oDetails->getNamespace());
} else {
//Enable default and required plugins
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
$oPluginRegistry->enablePlugin ( $oDetails->sNamespace );
$oPluginRegistry->enablePlugin($oDetails->getNamespace());
}
$oPluginRegistry->savePlugin($oDetails->getNamespace());
}
if (file_exists(PATH_DATA_SITE.'ee')) {
@@ -210,12 +214,12 @@ class pmLicenseManager
}
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
if ($oDetails) {
$oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
$oPluginRegistry->disablePlugin($oDetails->getNamespace());
$oPluginRegistry->savePlugin($oDetails->getNamespace());
}
}
}
}
file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
}
}
}
@@ -265,7 +269,7 @@ class pmLicenseManager
public function unSerializeInstance($serialized)
{
if (self::$instance == null) {
self::$instance = new PMPluginRegistry ();
self::$instance = new PluginRegistry();
}
$instance = unserialize ( $serialized );
self::$instance = $instance;

View File

@@ -33,6 +33,7 @@
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
use ProcessMaker\Plugins\PluginRegistry;
/**
* PMScript - PMScript class
@@ -59,7 +60,7 @@ if (defined('SYS_SYS') && (!defined('PATH_DATA_SITE') || !defined('PATH_WORKSPAC
//call plugin
if (class_exists( 'folderData' )) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
foreach ($aAvailablePmFunctions as $key => $class) {
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';

View File

@@ -25,6 +25,8 @@
*
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
* Class pagedTable
*
@@ -581,7 +583,7 @@ class propelTable
$time = $time_end - $time_start;
// verify if there are templates folders registered, template and method folders are the same
$folderTemplate = explode( '/', $this->template );
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) {
$templateFile = PATH_PLUGINS . $this->template . '.html';
} else {

View File

@@ -6,7 +6,7 @@
* This class Helps registering and implementing Wizard for Triggers
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
*
@@ -33,7 +33,7 @@ class triggerLibrary
//Register all registered PLugin Functions
if (class_exists( 'folderData' )) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
$oPluginRegistry->setupPlugins(); //Get and setup enabled plugins
foreach ($aAvailablePmFunctions as $key => $class) {
@@ -93,7 +93,7 @@ class triggerLibrary
function unSerializeInstance ($serialized)
{
if (self::$instance == NULL) {
self::$instance = new PMPluginRegistry();
self::$instance = new PluginRegistry();
}
$instance = unserialize( $serialized );

View File

@@ -1,6 +1,7 @@
<?php
use ProcessMaker\Util\FixReferencePath;
use ProcessMaker\Plugins\Adapters\PluginAdapter;
/**
* class workspaceTools.
@@ -205,6 +206,12 @@ class workspaceTools
$this->updateFrameworkPaths($workSpace);
$stop = microtime(true);
CLI::logging("<*> Update framework paths took " . ($stop - $start) . " seconds.\n");
$start = microtime(true);
CLI::logging("> Migrating and populating plugin singleton data...\n");
$this->migrateSingleton($workSpace);
$stop = microtime(true);
CLI::logging("<*> Migrating and populating plugin singleton data took " . ($stop - $start) . " seconds.\n");
}
/**
@@ -1644,7 +1651,7 @@ class workspaceTools
if (count($metaFiles) > 1 && (!isset($srcWorkspace))) {
throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
}
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(BASENAME, $metaFiles))) {
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map('basename', $metaFiles))) {
throw new Exception("Workspace $srcWorkspace not found in backup");
}
@@ -1890,8 +1897,6 @@ class workspaceTools
}
if ($swv == 1) {
//Extract
$tar = new Archive_Tar($f);
@@ -2870,7 +2875,6 @@ class workspaceTools
{
CLI::logging("-> Verifying roles permissions in RBAC \n");
//Update table RBAC permissions
$RBAC = &RBAC::getSingleton();
$RBAC->initRBAC();
$result = $RBAC->verifyPermissions();
@@ -3884,7 +3888,32 @@ class workspaceTools
$this->initPropel(true);
$this->upgradeTriggersOfTables($flagRecreate, $lang);
}
/**
* @param $workspace
*/
public function migrateSingleton($workspace)
{
if ((!class_exists('Memcache') || !class_exists('Memcached')) && !defined('MEMCACHED_ENABLED')) {
define('MEMCACHED_ENABLED', false);
}
$this->initPropel(true);
$conf = new Configuration();
if (!$bExist = $conf->exists('MIGRATED_PLUGIN', 'singleton')) {
$pathSingleton = PATH_DATA . 'sites' . PATH_SEP . $workspace . PATH_SEP . 'plugin.singleton';
$oPluginRegistry = unserialize(file_get_contents($pathSingleton));
$pluginAdapter = new PluginAdapter();
$pluginAdapter->migrate($oPluginRegistry);
$data["CFG_UID"] = 'MIGRATED_PLUGIN';
$data["OBJ_UID"] = 'singleton';
$data["CFG_VALUE"] = 'true';
$data["PRO_UID"] = '';
$data["USR_UID"] = '';
$data["APP_UID"] = '';
$conf->create($data);
}
}
/**
* This method finds all recursively PHP files that have the path PATH_DATA,
* poorly referenced, this is caused by the import of processes where the data

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/om/BaseAddonsManager.php';
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.enterpriseUtils.php';
@@ -113,9 +116,8 @@ class AddonsManager extends BaseAddonsManager
if (!$this->isInstalled()) {
return false;
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$status = $oPluginRegistry->getStatusPlugin($this->getAddonName());
return (strcmp($status, "enabled") == 0);
$oPluginRegistry = PluginRegistry::loadSingleton();
return $oPluginRegistry->isEnable($this->getAddonName());
} else {
throw new Exception("Addon type '{$this->getAddonType()}' unsupported");
}
@@ -130,7 +132,7 @@ class AddonsManager extends BaseAddonsManager
return false;
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$filter = new InputFilter();
@@ -139,19 +141,12 @@ class AddonsManager extends BaseAddonsManager
require_once ($requiredPath);
if ($enable) {
//$oDetails = $oPluginRegistry->getPluginDetails($this->getAddonName());
//$oPluginRegistry->enablePlugin($oDetails->sNamespace);
//require_once (PATH_PLUGINS . $this->getAddonName() . ".php"); //ok
$oPluginRegistry->enablePlugin($this->getAddonName());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
} else {
//$oDetails = $oPluginRegistry->getPluginDetails($this->getAddonName());
//$oPluginRegistry->disablePlugin($oDetails->sNamespace);
$oPluginRegistry->disablePlugin($this->getAddonName());
}
//$oPluginRegistry->setupPlugins();
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
$oPluginRegistry->savePlugin($this->getAddonName());
return true;
}
@@ -170,9 +165,9 @@ class AddonsManager extends BaseAddonsManager
return (null);
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails($this->getAddonName() . ".php");
$v = (!($details == null))? $details->iVersion : null;
$v = (!($details == null))? $details->getVersion() : null;
if ($v != "") {
return ($v);
@@ -387,7 +382,7 @@ class AddonsManager extends BaseAddonsManager
$_SESSION["__ENTERPRISE_INSTALL__"] = 1;
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->installPluginArchive($filename, $this->getAddonName());
$this->setState();
@@ -410,7 +405,7 @@ class AddonsManager extends BaseAddonsManager
return false;
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->uninstallPlugin($this->getAddonName());
return true;

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/om/BaseAddonsStore.php';
define("STORE_VERSION", 1);
@@ -348,7 +351,7 @@ class AddonsStore extends BaseAddonsStore
//Fill with local information
//List all plugins installed
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aPluginsPP = array();
if (file_exists(PATH_DATA_SITE . 'ee')) {
@@ -368,10 +371,10 @@ class AddonsStore extends BaseAddonsStore
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
if ($oDetails) {
$sStatus = $oDetails->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
$sStatus = $oDetails->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
if (isset($oDetails->aWorkspaces)) {
if (!in_array(SYS_SYS, $oDetails->aWorkspaces)) {
if ($oDetails->getWorkspaces()) {
if (!in_array(SYS_SYS, $oDetails->getWorkspaces())) {
continue;
}
}
@@ -380,16 +383,16 @@ class AddonsStore extends BaseAddonsStore
continue;
}
$sEdit = (($oDetails->sSetupPage != '') && ($oDetails->enabled)? G::LoadTranslation('ID_SETUP') : ' ');
$sEdit = (($oDetails->getSetupPage() != '') && ($oDetails->isEnabled())? G::LoadTranslation('ID_SETUP') : ' ');
$aPlugin = array();
$aPluginId = $sClassName;
$aPluginTitle = $oDetails->sFriendlyName;
$aPluginDescription = $oDetails->sDescription;
$aPluginVersion = $oDetails->iVersion;
$aPluginTitle = $oDetails->getFriendlyName();
$aPluginDescription = $oDetails->getDescription();
$aPluginVersion = $oDetails->getVersion();
if (@in_array($sClassName, $pmLicenseManagerO->features)) {
$aPluginStatus = $sStatus;
$aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->enabled;
$aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->isEnabled();
$aPluginEdit = $sEdit;
$aPluginLinkEdit = 'pluginsSetup?id=' . $sClassName . '.php';
$aPluginStatusA = $sStatus == "Enabled" ? "installed" : 'disabled';

View File

@@ -25,6 +25,8 @@
*
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
* Skeleton subclass for representing a row from the 'APP_DELEGATION' table.
*
@@ -292,7 +294,7 @@ class AppDelegation extends BaseAppDelegation
}
if ($flagActionsByEmail) {
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
}
}

View File

@@ -5,8 +5,7 @@
* @package workflow.engine.classes.model
*/
//require_once 'classes/model/om/BaseAppFolder.php';
//require_once 'classes/model/Application.php';
use ProcessMaker\Plugins\PluginRegistry;
/**
* Skeleton subclass for representing a row from the 'APP_FOLDER' table.
@@ -724,7 +723,7 @@ class AppFolder extends BaseAppFolder
}
if (! empty( $row1["APP_DOC_PLUGIN"] )) {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$pluginName = $row1["APP_DOC_PLUGIN"];
$fieldValue = "";
@@ -732,7 +731,7 @@ class AppFolder extends BaseAppFolder
$pluginDetail = $pluginRegistry->getPluginDetails( $pluginName . ".php" );
if ($pluginDetail) {
if ($pluginDetail->enabled) {
if ($pluginDetail->isEnabled()) {
require_once (PATH_PLUGINS . $pluginName . ".php");
$pluginNameClass = $pluginName . "Plugin";
$objPluginClass = new $pluginNameClass( $pluginName );

View File

@@ -5,10 +5,7 @@
* @package workflow.engine.classes.model
*/
//require_once 'classes/model/om/BaseCaseScheduler.php';
//require_once 'classes/model/Process.php';
//require_once 'classes/model/Task.php';
use ProcessMaker\Plugins\PluginRegistry;
/**
* Skeleton subclass for representing a row from the 'CASE_SCHEDULER' table.
@@ -448,6 +445,8 @@ class CaseScheduler extends BaseCaseScheduler
$params = array("sessionId" => $sessionId, "processId" => $processId, "taskId" => $taskId, "variables" => array());
//Here we are loading all plugins registered
$oPluginRegistry = PluginRegistry::loadSingleton();
//If this Job was was registered to be performed by a plugin
if (isset($row["CASE_SH_PLUGIN_UID"]) && $row["CASE_SH_PLUGIN_UID"] != "") {
//Check if the plugin is active
@@ -455,18 +454,7 @@ class CaseScheduler extends BaseCaseScheduler
if (count($pluginParts) == 2) {
//Here we are loading all plugins registered
//The singleton has a list of enabled plugins
$sSerializedFile = PATH_DATA_SITE . "plugin.singleton";
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if (file_exists($sSerializedFile)) {
$oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPlugin) {
if (isset($caseSchedulerPlugin->sNamespace) && $caseSchedulerPlugin->sNamespace == $pluginParts[0] && isset($caseSchedulerPlugin->sActionId) && $caseSchedulerPlugin->sActionId == $pluginParts[1]) {
$caseSchedulerSelected = $caseSchedulerPlugin;
@@ -498,8 +486,6 @@ class CaseScheduler extends BaseCaseScheduler
$paramsAux = $params;
$paramsAux["executeTriggers"] = 1;
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_SCHEDULER_CREATE_CASE_BEFORE)) {
$oPluginRegistry->executeTriggers(PM_SCHEDULER_CREATE_CASE_BEFORE, $paramsAux);
}

View File

@@ -0,0 +1,247 @@
<?php
require_once 'classes/model/om/BasePluginsRegistry.php';
/**
* Skeleton subclass for representing a row from the 'PLUGINS_REGISTRY' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class PluginsRegistry extends BasePluginsRegistry
{
/**
* Load all Plugins
* @param string $keyType
* @return array
* @throws \Exception
*/
public static function loadPlugins($keyType = BasePeer::TYPE_FIELDNAME)
{
$criteria = new Criteria();
$dataSet = PluginsRegistryPeer::doSelect($criteria);
$plugins = [];
/** @var PluginsRegistry $row */
foreach ($dataSet as $row) {
$plugins[] = $row->toArray($keyType);
}
return $plugins;
}
/**
* Get all Plugins Enabled
* @param string $keyType
* @return array
*/
public static function getPluginsEnabled($keyType = BasePeer::TYPE_FIELDNAME)
{
$criteria = new Criteria();
$criteria->add(PluginsRegistryPeer::PLUGIN_ENABLE, true);
$dataSet = PluginsRegistryPeer::doSelect($criteria);
$plugins = [];
/** @var PluginsRegistry $row */
foreach ($dataSet as $row) {
$plugins[] = $row->toArray($keyType);
}
return $plugins;
}
/**
* Load plugin with Uid
* @param string $prUid
* @return array
* @throws Exception
*/
public static function load($prUid)
{
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPK($prUid);
if ($oPluginsRegistry) {
/** @var array $aFields */
$aFields = $oPluginsRegistry->toArray(BasePeer::TYPE_FIELDNAME);
return $aFields;
} else {
throw new Exception("Plugin does not exist!");
}
}
/**
* Check if there is a plugin uid
* @param $prUid
* @return mixed|bool
*/
public static function exists($prUid)
{
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPk($prUid);
if ($oPluginsRegistry) {
return true;
} else {
return false;
}
}
/**
* Load or creates if the record does not exist
* Load and makes a union with the data sent
*
* @param string $prUid
* @param array $pluginData
* @return array
*/
public static function loadOrCreateIfNotExists($prUid, $pluginData = [])
{
if (!self::exists($prUid)) {
$pluginData['PR_UID'] = $prUid;
self::create($pluginData);
} else {
$fields = self::load($prUid);
$pluginData = array_merge($fields, $pluginData);
}
return $pluginData;
}
/**
* Creates a record in the PLUGINS_REGISTRY table
* @param array $aData
* @return bool
* @throws Exception
*/
public static function create($aData)
{
$oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
try {
$oPluginsRegistry = new PluginsRegistry();
$oPluginsRegistry->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oPluginsRegistry->validate()) {
$oConnection->begin();
$oPluginsRegistry->save();
$oConnection->commit();
return true;
} else {
$sMessage = '';
$aValidationFailures = $oPluginsRegistry->getValidationFailures();
/** @var ValidationFailed $oValidationFailure */
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception('The registry cannot be created!<br />' . $sMessage));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
* Modifies a record in the PLUGINS_REGISTRY table
* @param array $aData
* @return int
* @throws Exception
*/
public static function update($aData)
{
$oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
try {
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPK($aData['PR_UID']);
if ($oPluginsRegistry) {
$oPluginsRegistry->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oPluginsRegistry->validate()) {
$oConnection->begin();
$iResult = $oPluginsRegistry->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oPluginsRegistry->getValidationFailures();
/** @var ValidationFailed $oValidationFailure */
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception('The registry cannot be updated!<br />' . $sMessage));
}
} else {
throw (new Exception('This row doesn\'t exist!'));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
* Activate a plugin with your name
* @param string $Namespace
* @return int
* @throws Exception
*/
public static function enable($Namespace)
{
$oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
try {
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPK(md5($Namespace));
if ($oPluginsRegistry) {
$oPluginsRegistry->fromArray(['PLUGIN_ENABLE' => true], BasePeer::TYPE_FIELDNAME);
if ($oPluginsRegistry->validate()) {
$oConnection->begin();
$iResult = $oPluginsRegistry->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oPluginsRegistry->getValidationFailures();
/** @var ValidationFailed $oValidationFailure */
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception('The registry cannot be updated!<br />' . $sMessage));
}
} else {
throw (new Exception('This Plugin doesn\'t exist!'));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
* Disable a plugin with your name
* @param string $Namespace
* @return int
* @throws Exception
*/
public static function disable($Namespace)
{
$oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
try {
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPK(md5($Namespace));
if ($oPluginsRegistry) {
$oPluginsRegistry->fromArray(['PLUGIN_ENABLE' => false], BasePeer::TYPE_FIELDNAME);
if ($oPluginsRegistry->validate()) {
$oConnection->begin();
$iResult = $oPluginsRegistry->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oPluginsRegistry->getValidationFailures();
/** @var ValidationFailed $oValidationFailure */
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception('The registry cannot be updated!<br />' . $sMessage));
}
} else {
throw (new Exception('This Plugin doesn\'t exist!'));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
}

View File

@@ -0,0 +1,23 @@
<?php
// include base peer class
require_once 'classes/model/om/BasePluginsRegistryPeer.php';
// include object class
include_once 'classes/model/PluginsRegistry.php';
/**
* Skeleton subclass for performing query and update operations on the 'PLUGINS_REGISTRY' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class PluginsRegistryPeer extends BasePluginsRegistryPeer {
} // PluginsRegistryPeer

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/om/BaseUsersProperties.php';
/**
@@ -320,15 +322,17 @@ class UsersProperties extends BaseUsersProperties
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset( $aRedirectLogin ) && is_array( $aRedirectLogin )) {
foreach ($aRedirectLogin as $key => $detail) {
if (isset( $detail->sPathMethod ) && $detail->sRoleCode == $userRole) {
if (isset($aRedirectLogin) && is_array($aRedirectLogin)) {
/** @var \ProcessMaker\Plugins\Interfaces\RedirectDetail $detail */
foreach ($aRedirectLogin as $detail) {
$pathMethod = $detail->getPathMethod();
if (isset($pathMethod) && $detail->equalRoleCodeTo($userRole)) {
if (isset($_COOKIE['workspaceSkin'])) {
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $detail->sPathMethod;
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $pathMethod;
} else {
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/' . $detail->sPathMethod;
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/' . $pathMethod;
}
}
}

View File

@@ -0,0 +1,118 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'PLUGINS_REGISTRY' table to 'workflow' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package workflow.classes.model.map
*/
class PluginsRegistryMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.PluginsRegistryMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('PLUGINS_REGISTRY');
$tMap->setPhpName('PluginsRegistry');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addPrimaryKey('PR_UID', 'PrUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('PLUGIN_NAMESPACE', 'PluginNamespace', 'string', CreoleTypes::VARCHAR, true, 100);
$tMap->addColumn('PLUGIN_DESCRIPTION', 'PluginDescription', 'string', CreoleTypes::VARCHAR, false, 200);
$tMap->addColumn('PLUGIN_CLASS_NAME', 'PluginClassName', 'string', CreoleTypes::VARCHAR, true, 100);
$tMap->addColumn('PLUGIN_FRIENDLY_NAME', 'PluginFriendlyName', 'string', CreoleTypes::VARCHAR, false, 150);
$tMap->addColumn('PLUGIN_FILE', 'PluginFile', 'string', CreoleTypes::VARCHAR, true, 250);
$tMap->addColumn('PLUGIN_FOLDER', 'PluginFolder', 'string', CreoleTypes::VARCHAR, true, 100);
$tMap->addColumn('PLUGIN_SETUP_PAGE', 'PluginSetupPage', 'string', CreoleTypes::VARCHAR, false, 100);
$tMap->addColumn('PLUGIN_COMPANY_LOGO', 'PluginCompanyLogo', 'string', CreoleTypes::VARCHAR, false, 100);
$tMap->addColumn('PLUGIN_WORKSPACES', 'PluginWorkspaces', 'string', CreoleTypes::VARCHAR, false, 100);
$tMap->addColumn('PLUGIN_VERSION', 'PluginVersion', 'string', CreoleTypes::VARCHAR, false, 50);
$tMap->addColumn('PLUGIN_ENABLE', 'PluginEnable', 'boolean', CreoleTypes::BOOLEAN, false, null);
$tMap->addColumn('PLUGIN_PRIVATE', 'PluginPrivate', 'boolean', CreoleTypes::BOOLEAN, false, null);
$tMap->addColumn('PLUGIN_MENUS', 'PluginMenus', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_FOLDERS', 'PluginFolders', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_TRIGGERS', 'PluginTriggers', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_PM_FUNCTIONS', 'PluginPmFunctions', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_REDIRECT_LOGIN', 'PluginRedirectLogin', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_STEPS', 'PluginSteps', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_CSS', 'PluginCss', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_JS', 'PluginJs', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_REST_SERVICE', 'PluginRestService', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_ATTRIBUTES', 'PluginAttributes', 'string', CreoleTypes::LONGVARCHAR, false, null);
} // doBuild()
} // PluginsRegistryMapBuilder

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,682 @@
<?php
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by PluginsRegistryPeer::getOMClass()
include_once 'classes/model/PluginsRegistry.php';
/**
* Base static class for performing query and update operations on the 'PLUGINS_REGISTRY' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BasePluginsRegistryPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
/** the table name for this class */
const TABLE_NAME = 'PLUGINS_REGISTRY';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'classes.model.PluginsRegistry';
/** The total number of columns. */
const NUM_COLUMNS = 24;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'PLUGINS_REGISTRY.ID';
/** the column name for the PR_UID field */
const PR_UID = 'PLUGINS_REGISTRY.PR_UID';
/** the column name for the PLUGIN_NAMESPACE field */
const PLUGIN_NAMESPACE = 'PLUGINS_REGISTRY.PLUGIN_NAMESPACE';
/** the column name for the PLUGIN_DESCRIPTION field */
const PLUGIN_DESCRIPTION = 'PLUGINS_REGISTRY.PLUGIN_DESCRIPTION';
/** the column name for the PLUGIN_CLASS_NAME field */
const PLUGIN_CLASS_NAME = 'PLUGINS_REGISTRY.PLUGIN_CLASS_NAME';
/** the column name for the PLUGIN_FRIENDLY_NAME field */
const PLUGIN_FRIENDLY_NAME = 'PLUGINS_REGISTRY.PLUGIN_FRIENDLY_NAME';
/** the column name for the PLUGIN_FILE field */
const PLUGIN_FILE = 'PLUGINS_REGISTRY.PLUGIN_FILE';
/** the column name for the PLUGIN_FOLDER field */
const PLUGIN_FOLDER = 'PLUGINS_REGISTRY.PLUGIN_FOLDER';
/** the column name for the PLUGIN_SETUP_PAGE field */
const PLUGIN_SETUP_PAGE = 'PLUGINS_REGISTRY.PLUGIN_SETUP_PAGE';
/** the column name for the PLUGIN_COMPANY_LOGO field */
const PLUGIN_COMPANY_LOGO = 'PLUGINS_REGISTRY.PLUGIN_COMPANY_LOGO';
/** the column name for the PLUGIN_WORKSPACES field */
const PLUGIN_WORKSPACES = 'PLUGINS_REGISTRY.PLUGIN_WORKSPACES';
/** the column name for the PLUGIN_VERSION field */
const PLUGIN_VERSION = 'PLUGINS_REGISTRY.PLUGIN_VERSION';
/** the column name for the PLUGIN_ENABLE field */
const PLUGIN_ENABLE = 'PLUGINS_REGISTRY.PLUGIN_ENABLE';
/** the column name for the PLUGIN_PRIVATE field */
const PLUGIN_PRIVATE = 'PLUGINS_REGISTRY.PLUGIN_PRIVATE';
/** the column name for the PLUGIN_MENUS field */
const PLUGIN_MENUS = 'PLUGINS_REGISTRY.PLUGIN_MENUS';
/** the column name for the PLUGIN_FOLDERS field */
const PLUGIN_FOLDERS = 'PLUGINS_REGISTRY.PLUGIN_FOLDERS';
/** the column name for the PLUGIN_TRIGGERS field */
const PLUGIN_TRIGGERS = 'PLUGINS_REGISTRY.PLUGIN_TRIGGERS';
/** the column name for the PLUGIN_PM_FUNCTIONS field */
const PLUGIN_PM_FUNCTIONS = 'PLUGINS_REGISTRY.PLUGIN_PM_FUNCTIONS';
/** the column name for the PLUGIN_REDIRECT_LOGIN field */
const PLUGIN_REDIRECT_LOGIN = 'PLUGINS_REGISTRY.PLUGIN_REDIRECT_LOGIN';
/** the column name for the PLUGIN_STEPS field */
const PLUGIN_STEPS = 'PLUGINS_REGISTRY.PLUGIN_STEPS';
/** the column name for the PLUGIN_CSS field */
const PLUGIN_CSS = 'PLUGINS_REGISTRY.PLUGIN_CSS';
/** the column name for the PLUGIN_JS field */
const PLUGIN_JS = 'PLUGINS_REGISTRY.PLUGIN_JS';
/** the column name for the PLUGIN_REST_SERVICE field */
const PLUGIN_REST_SERVICE = 'PLUGINS_REGISTRY.PLUGIN_REST_SERVICE';
/** the column name for the PLUGIN_ATTRIBUTES field */
const PLUGIN_ATTRIBUTES = 'PLUGINS_REGISTRY.PLUGIN_ATTRIBUTES';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'PrUid', 'PluginNamespace', 'PluginDescription', 'PluginClassName', 'PluginFriendlyName', 'PluginFile', 'PluginFolder', 'PluginSetupPage', 'PluginCompanyLogo', 'PluginWorkspaces', 'PluginVersion', 'PluginEnable', 'PluginPrivate', 'PluginMenus', 'PluginFolders', 'PluginTriggers', 'PluginPmFunctions', 'PluginRedirectLogin', 'PluginSteps', 'PluginCss', 'PluginJs', 'PluginRestService', 'PluginAttributes', ),
BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::ID, PluginsRegistryPeer::PR_UID, PluginsRegistryPeer::PLUGIN_NAMESPACE, PluginsRegistryPeer::PLUGIN_DESCRIPTION, PluginsRegistryPeer::PLUGIN_CLASS_NAME, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME, PluginsRegistryPeer::PLUGIN_FILE, PluginsRegistryPeer::PLUGIN_FOLDER, PluginsRegistryPeer::PLUGIN_SETUP_PAGE, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO, PluginsRegistryPeer::PLUGIN_WORKSPACES, PluginsRegistryPeer::PLUGIN_VERSION, PluginsRegistryPeer::PLUGIN_ENABLE, PluginsRegistryPeer::PLUGIN_PRIVATE, PluginsRegistryPeer::PLUGIN_MENUS, PluginsRegistryPeer::PLUGIN_FOLDERS, PluginsRegistryPeer::PLUGIN_TRIGGERS, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN, PluginsRegistryPeer::PLUGIN_STEPS, PluginsRegistryPeer::PLUGIN_CSS, PluginsRegistryPeer::PLUGIN_JS, PluginsRegistryPeer::PLUGIN_REST_SERVICE, PluginsRegistryPeer::PLUGIN_ATTRIBUTES, ),
BasePeer::TYPE_FIELDNAME => array ('ID', 'PR_UID', 'PLUGIN_NAMESPACE', 'PLUGIN_DESCRIPTION', 'PLUGIN_CLASS_NAME', 'PLUGIN_FRIENDLY_NAME', 'PLUGIN_FILE', 'PLUGIN_FOLDER', 'PLUGIN_SETUP_PAGE', 'PLUGIN_COMPANY_LOGO', 'PLUGIN_WORKSPACES', 'PLUGIN_VERSION', 'PLUGIN_ENABLE', 'PLUGIN_PRIVATE', 'PLUGIN_MENUS', 'PLUGIN_FOLDERS', 'PLUGIN_TRIGGERS', 'PLUGIN_PM_FUNCTIONS', 'PLUGIN_REDIRECT_LOGIN', 'PLUGIN_STEPS', 'PLUGIN_CSS', 'PLUGIN_JS', 'PLUGIN_REST_SERVICE', 'PLUGIN_ATTRIBUTES', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'PrUid' => 1, 'PluginNamespace' => 2, 'PluginDescription' => 3, 'PluginClassName' => 4, 'PluginFriendlyName' => 5, 'PluginFile' => 6, 'PluginFolder' => 7, 'PluginSetupPage' => 8, 'PluginCompanyLogo' => 9, 'PluginWorkspaces' => 10, 'PluginVersion' => 11, 'PluginEnable' => 12, 'PluginPrivate' => 13, 'PluginMenus' => 14, 'PluginFolders' => 15, 'PluginTriggers' => 16, 'PluginPmFunctions' => 17, 'PluginRedirectLogin' => 18, 'PluginSteps' => 19, 'PluginCss' => 20, 'PluginJs' => 21, 'PluginRestService' => 22, 'PluginAttributes' => 23, ),
BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::ID => 0, PluginsRegistryPeer::PR_UID => 1, PluginsRegistryPeer::PLUGIN_NAMESPACE => 2, PluginsRegistryPeer::PLUGIN_DESCRIPTION => 3, PluginsRegistryPeer::PLUGIN_CLASS_NAME => 4, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME => 5, PluginsRegistryPeer::PLUGIN_FILE => 6, PluginsRegistryPeer::PLUGIN_FOLDER => 7, PluginsRegistryPeer::PLUGIN_SETUP_PAGE => 8, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO => 9, PluginsRegistryPeer::PLUGIN_WORKSPACES => 10, PluginsRegistryPeer::PLUGIN_VERSION => 11, PluginsRegistryPeer::PLUGIN_ENABLE => 12, PluginsRegistryPeer::PLUGIN_PRIVATE => 13, PluginsRegistryPeer::PLUGIN_MENUS => 14, PluginsRegistryPeer::PLUGIN_FOLDERS => 15, PluginsRegistryPeer::PLUGIN_TRIGGERS => 16, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS => 17, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN => 18, PluginsRegistryPeer::PLUGIN_STEPS => 19, PluginsRegistryPeer::PLUGIN_CSS => 20, PluginsRegistryPeer::PLUGIN_JS => 21, PluginsRegistryPeer::PLUGIN_REST_SERVICE => 22, PluginsRegistryPeer::PLUGIN_ATTRIBUTES => 23, ),
BasePeer::TYPE_FIELDNAME => array ('ID' => 0, 'PR_UID' => 1, 'PLUGIN_NAMESPACE' => 2, 'PLUGIN_DESCRIPTION' => 3, 'PLUGIN_CLASS_NAME' => 4, 'PLUGIN_FRIENDLY_NAME' => 5, 'PLUGIN_FILE' => 6, 'PLUGIN_FOLDER' => 7, 'PLUGIN_SETUP_PAGE' => 8, 'PLUGIN_COMPANY_LOGO' => 9, 'PLUGIN_WORKSPACES' => 10, 'PLUGIN_VERSION' => 11, 'PLUGIN_ENABLE' => 12, 'PLUGIN_PRIVATE' => 13, 'PLUGIN_MENUS' => 14, 'PLUGIN_FOLDERS' => 15, 'PLUGIN_TRIGGERS' => 16, 'PLUGIN_PM_FUNCTIONS' => 17, 'PLUGIN_REDIRECT_LOGIN' => 18, 'PLUGIN_STEPS' => 19, 'PLUGIN_CSS' => 20, 'PLUGIN_JS' => 21, 'PLUGIN_REST_SERVICE' => 22, 'PLUGIN_ATTRIBUTES' => 23, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, )
);
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
include_once 'classes/model/map/PluginsRegistryMapBuilder.php';
return BasePeer::getMapBuilder('classes.model.map.PluginsRegistryMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = PluginsRegistryPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. PluginsRegistryPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(PluginsRegistryPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(PluginsRegistryPeer::ID);
$criteria->addSelectColumn(PluginsRegistryPeer::PR_UID);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_NAMESPACE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_DESCRIPTION);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_CLASS_NAME);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FILE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FOLDER);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_SETUP_PAGE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_COMPANY_LOGO);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_WORKSPACES);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_VERSION);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_ENABLE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_PRIVATE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_MENUS);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FOLDERS);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_TRIGGERS);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_STEPS);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_CSS);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_JS);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_REST_SERVICE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_ATTRIBUTES);
}
const COUNT = 'COUNT(PLUGINS_REGISTRY.PR_UID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT PLUGINS_REGISTRY.PR_UID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(PluginsRegistryPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(PluginsRegistryPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = PluginsRegistryPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return PluginsRegistry
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = PluginsRegistryPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return PluginsRegistryPeer::populateObjects(PluginsRegistryPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
PluginsRegistryPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
return BasePeer::doSelect($criteria, $con);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = PluginsRegistryPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while ($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = $obj;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return PluginsRegistryPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a PluginsRegistry or Criteria object.
*
* @param mixed $values Criteria or PluginsRegistry object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from PluginsRegistry object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a PluginsRegistry or Criteria object.
*
* @param mixed $values Criteria or PluginsRegistry object containing data create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(PluginsRegistryPeer::PR_UID);
$selectCriteria->add(PluginsRegistryPeer::PR_UID, $criteria->remove(PluginsRegistryPeer::PR_UID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the PLUGINS_REGISTRY table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(PluginsRegistryPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a PluginsRegistry or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or PluginsRegistry object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof PluginsRegistry) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(PluginsRegistryPeer::PR_UID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given PluginsRegistry object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param PluginsRegistry $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(PluginsRegistry $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(PluginsRegistryPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(PluginsRegistryPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(PluginsRegistryPeer::DATABASE_NAME, PluginsRegistryPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return PluginsRegistry
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(PluginsRegistryPeer::DATABASE_NAME);
$criteria->add(PluginsRegistryPeer::PR_UID, $pk);
$v = PluginsRegistryPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(PluginsRegistryPeer::PR_UID, $pks, Criteria::IN);
$objs = PluginsRegistryPeer::doSelect($criteria, $con);
}
return $objs;
}
}
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BasePluginsRegistryPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/PluginsRegistryMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.PluginsRegistryMapBuilder');
}

View File

@@ -5639,4 +5639,35 @@
<index-column name="NOT_STATUS"/>
</index>
</table>
<table name="PLUGINS_REGISTRY" idMethod="native">
<!--PluginDetails-->
<column name="ID" type="INTEGER" required="true" autoIncrement="true" unique="true"/>
<column name="PR_UID" type="VARCHAR" size="32" required="true" primaryKey="true" default=""/>
<column name="PLUGIN_NAMESPACE" type="VARCHAR" size="100" required="true"/>
<column name="PLUGIN_DESCRIPTION" type="VARCHAR" size="200" default=""/>
<column name="PLUGIN_CLASS_NAME" type="VARCHAR" size="100" required="true"/>
<column name="PLUGIN_FRIENDLY_NAME" type="VARCHAR" size="150" default=""/>
<column name="PLUGIN_FILE" type="VARCHAR" size="250" required="true"/>
<column name="PLUGIN_FOLDER" type="VARCHAR" size="100" required="true"/>
<column name="PLUGIN_SETUP_PAGE" type="VARCHAR" size="100" default=""/>
<column name="PLUGIN_COMPANY_LOGO" type="VARCHAR" size="100" default=""/>
<column name="PLUGIN_WORKSPACES" type="VARCHAR" size="100" default=""/>
<column name="PLUGIN_VERSION" type="VARCHAR" size="50" default=""/>
<column name="PLUGIN_ENABLE" type="BOOLEAN" default="0"/>
<column name="PLUGIN_PRIVATE" type="BOOLEAN" default="0"/>
<!--PluginProperties-->
<column name="PLUGIN_MENUS" type="LONGVARCHAR"/>
<column name="PLUGIN_FOLDERS" type="LONGVARCHAR"/>
<column name="PLUGIN_TRIGGERS" type="LONGVARCHAR"/>
<column name="PLUGIN_PM_FUNCTIONS" type="LONGVARCHAR"/>
<column name="PLUGIN_REDIRECT_LOGIN" type="LONGVARCHAR"/>
<column name="PLUGIN_STEPS" type="LONGVARCHAR"/>
<column name="PLUGIN_CSS" type="LONGVARCHAR"/>
<column name="PLUGIN_JS" type="LONGVARCHAR"/>
<column name="PLUGIN_REST_SERVICE" type="LONGVARCHAR"/>
<column name="PLUGIN_ATTRIBUTES" type="LONGVARCHAR"/>
<unique name="INDEX_PLUGINS_REGISTRY_ID">
<unique-column name="ID" />
</unique>
</table>
</database>

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
/**
* adminProxy.php
*
@@ -1382,7 +1385,7 @@ class adminProxy extends HttpProxyController
$params = array ();
$oServerConf = &serverConf::getSingleton();
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$licenseManager = &pmLicenseManager::getSingleton();
//License Information:
@@ -1455,10 +1458,10 @@ class adminProxy extends HttpProxyController
if (file_exists( PATH_PLUGINS . $sFileName . ".php" )) {
$plugin = array();
$addonDetails = $pluginRegistry->getPluginDetails( $sFileName . ".php" );
$plugin['name'] = $addonDetails->sNamespace;
$plugin['description'] = $addonDetails->sDescription;
$plugin['version'] = $addonDetails->iVersion;
$plugin['enable'] = $addonDetails->enabled;
$plugin['name'] = $addonDetails->getNamespace();
$plugin['description'] = $addonDetails->getDescription();
$plugin['version'] = $addonDetails->getVersion();
$plugin['enable'] = $addonDetails->isEnabled();
$plugins[] = $plugin;
}
}

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
class caseSchedulerProxy extends HttpProxyController
{
@@ -507,11 +509,11 @@ class caseSchedulerProxy extends HttpProxyController
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
$params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] );
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
/** @var \ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin $caseSchedulerPluginDetail */
foreach ($activePluginsForCaseScheduler as $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->equalNamespaceTo($params[0])) && ($caseSchedulerPluginDetail->equalActionIdTo($params[1]))) {
$caseSchedulerSelected = $caseSchedulerPluginDetail;
}
}
@@ -519,7 +521,7 @@ class caseSchedulerProxy extends HttpProxyController
//Save the form
$oData = $_POST['pluginFields'];
$oData['SCH_UID'] = $aData['SCH_UID'];
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData );
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->getNamespace(), $caseSchedulerPluginDetail->getActionSave(), $oData );
}
}

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
/**
* Designer Controller
*
@@ -134,10 +136,10 @@ class Designer extends Controller
$sourceCss = array();
$sourceJs = array();
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$srcPath = $pluginRegistry->getDesignerSourcePath();
foreach ($srcPath as $key => $value) {
foreach ($srcPath as $value) {
$ext = pathinfo($value->pathFile, PATHINFO_EXTENSION);
if ($ext === "css") {
$sourceCss[] = $value->pathFile;

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
/**
* Main Controller for processMaker v2.1
* @date Jul 17, 2011
@@ -156,7 +158,7 @@ class Main extends Controller
$this->memcache->delete( 'rbacSession' . session_id() );
} else {
// Execute SSO trigger
$pluginRegistry = & PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
if (defined( 'PM_SINGLE_SIGN_ON' )) {
if ($pluginRegistry->existsTrigger( PM_SINGLE_SIGN_ON )) {
if ($pluginRegistry->executeTriggers( PM_SINGLE_SIGN_ON, null )) {
@@ -472,8 +474,8 @@ class Main extends Controller
$sWspaceSelect = trim( $aFotoSelect['WORKSPACE_LOGO_NAME'] );
}
}
if (class_exists( 'PMPluginRegistry' )) {
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if (class_exists( 'ProcessMaker\Plugins\PluginRegistry' )) {
$oPluginRegistry = PluginRegistry::loadSingleton();
$logoPlugin = $oPluginRegistry->getCompanyLogo( $sCompanyLogo );
if ($logoPlugin != '/images/processmaker2.logo2.png') {
$sCompanyLogo = $logoPlugin;

View File

@@ -3144,5 +3144,41 @@ CREATE TABLE `NOTIFICATION_QUEUE`
PRIMARY KEY (`NOT_UID`),
KEY `indexNotStatus`(`NOT_STATUS`)
)ENGINE=InnoDB ;
#-----------------------------------------------------------------------------
#-- PLUGINS_REGISTRY
#-----------------------------------------------------------------------------
DROP TABLE IF EXISTS `PLUGINS_REGISTRY`;
CREATE TABLE `PLUGINS_REGISTRY`
(
`ID` INTEGER NOT NULL AUTO_INCREMENT,
`PR_UID` VARCHAR(32) default '' NOT NULL,
`PLUGIN_NAMESPACE` VARCHAR(100) NOT NULL,
`PLUGIN_DESCRIPTION` VARCHAR(200) default '',
`PLUGIN_CLASS_NAME` VARCHAR(100) NOT NULL,
`PLUGIN_FRIENDLY_NAME` VARCHAR(150) default '',
`PLUGIN_FILE` VARCHAR(250) NOT NULL,
`PLUGIN_FOLDER` VARCHAR(100) NOT NULL,
`PLUGIN_SETUP_PAGE` VARCHAR(100) default '',
`PLUGIN_COMPANY_LOGO` VARCHAR(100) default '',
`PLUGIN_WORKSPACES` VARCHAR(100) default '',
`PLUGIN_VERSION` VARCHAR(50) default '',
`PLUGIN_ENABLE` INTEGER default 0,
`PLUGIN_PRIVATE` INTEGER default 0,
`PLUGIN_MENUS` MEDIUMTEXT,
`PLUGIN_FOLDERS` MEDIUMTEXT,
`PLUGIN_TRIGGERS` MEDIUMTEXT,
`PLUGIN_PM_FUNCTIONS` MEDIUMTEXT,
`PLUGIN_REDIRECT_LOGIN` MEDIUMTEXT,
`PLUGIN_STEPS` MEDIUMTEXT,
`PLUGIN_CSS` MEDIUMTEXT,
`PLUGIN_JS` MEDIUMTEXT,
`PLUGIN_REST_SERVICE` MEDIUMTEXT,
`PLUGIN_ATTRIBUTES` MEDIUMTEXT,
PRIMARY KEY (`PR_UID`),
UNIQUE KEY `INDEX_PLUGINS_REGISTRY_ID` (`ID`)
)ENGINE=InnoDB ;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -22,7 +22,12 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
/** @var RBAC $RBAC */
global $RBAC;
/** @var Menu $G_TMP_MENU */
global $G_TMP_MENU;
$G_TMP_MENU->AddIdRawOption('FOLDERS', '', G::LoadTranslation('ID_CASES_MENU_FOLDERS'), '', '', 'blockHeader');
@@ -48,10 +53,6 @@ $G_TMP_MENU->AddIdRawOption('CASES_SELFSERVICE', 'casesListExtJs?action=selfserv
$G_TMP_MENU->AddIdRawOption('CASES_PAUSED', 'casesListExtJs?action=paused', G::LoadTranslation('ID_PAUSED'),
'mail-queue.png');
if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
//$G_TMP_MENU->AddIdRawOption('CASES_GRAL', 'casesListExtJs?action=gral', G::LoadTranslation('ID_GENERAL'));
}
$G_TMP_MENU->AddIdRawOption('SEARCHS', '', G::LoadTranslation('ID_CASES_MENU_SEARCH'), '', '', 'blockHeader');
if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
@@ -77,14 +78,15 @@ if ($RBAC->userCanAccess('PM_FOLDERS_VIEW') == 1) {
//Load Other registered Dashboards (From plugins)
$oPluginRegistry = & PMPluginRegistry::getSingleton ();
$oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\DashboardPage[] $dashBoardPages */
$dashBoardPages = $oPluginRegistry->getDashboardPages ();
if (count($dashBoardPages)>0) {
$G_TMP_MENU->AddIdRawOption('PLUGINS', '', G::LoadTranslation('ID_PLUGINS'), '', '', 'blockHeader');
foreach ($dashBoardPages as $key => $tabInfo) {
$tabNameSpace=$tabInfo->sNamespace;
$tabName=$tabInfo->sName;
$tabIcon=str_replace("ICON_","",$tabInfo->sIcon);
$tabNameSpace=$tabInfo->getNamespace();
$tabName=$tabInfo->getName();
$tabIcon=str_replace("ICON_","",$tabInfo->getIcon());
if ($tabName!= "") {
$G_TMP_MENU->AddIdRawOption($tabIcon, 'casesStartPage?action='.$tabNameSpace.'-'.$tabName,
ucwords(strtolower($tabName)), '');

View File

@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
global $G_TMP_MENU;
global $RBAC;
$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false;
@@ -288,7 +291,7 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) {
}
/*----------------------------------********---------------------------------*/
$pluginRegistry = &PMPluginRegistry::getSingleton(); //lsl
$pluginRegistry = PluginRegistry::loadSingleton();
$status = $pluginRegistry->getStatusPlugin('actionsByEmail');
if ((string)($status) !== 'enabled' &&

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$_GET = $filter->xssFilterHard($_GET);
@@ -1621,7 +1623,7 @@ function uploadExternalDocument()
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) {
$oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData (

View File

@@ -23,6 +23,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
try {
$docUid = $_POST['form']['DOC_UID'];
$appDocUid = $_POST['form']['APP_DOC_UID'];
@@ -124,7 +127,7 @@ try {
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$oData['APP_UID'] = $appId;

View File

@@ -21,6 +21,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
try {
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
@@ -153,7 +156,7 @@ try {
}
break;
case 'authSourcesNew':
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$arr = Array ();
$oDirectory = dir( PATH_RBAC . 'plugins' . PATH_SEP );

View File

@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
*
* @author Erik Amaru Ortiz <erik@colosa.com>
@@ -1022,7 +1024,7 @@ class Ajax
}
}
$pluginRegistry = & PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_GET_CASES_AJAX_LISTENER)) {
$ajax = $pluginRegistry->executeTriggers(PM_GET_CASES_AJAX_LISTENER, null);
} else {

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
unset($_SESSION['APPLICATION']);
//get the action from GET or POST, default is todo
@@ -194,12 +197,13 @@ $oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState());
$oHeadPublisher->assign('isIE', Bootstrap::isIE());
$oHeadPublisher->assign('__OPEN_APPLICATION_UID__', $openApplicationUid);
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$fromPlugin = $oPluginRegistry->getOpenReassignCallback();
$jsFunction = false;
if(sizeof($fromPlugin)) {
foreach($fromPlugin as $key => $jsFile) {
$jsFile = $jsFile->callBackFile;
/** @var \ProcessMaker\Plugins\Interfaces\OpenReassignCallback $jsFile */
foreach($fromPlugin as $jsFile) {
$jsFile = $jsFile->getCallBackFile();
if(is_file($jsFile)) {
$jsFile = file_get_contents($jsFile);
if(!empty($jsFile)) {

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$_REQUEST = $filter->xssFilterHard($_REQUEST);
@@ -306,7 +308,7 @@ function getSimpleDashboardData ()
function getRegisteredDashboards ()
{
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$dashBoardPages = $oPluginRegistry->getDashboardPages();
print_r( G::json_encode( $dashBoardPages ) );
}

View File

@@ -23,6 +23,8 @@
*/
//validate the data post
use ProcessMaker\Plugins\PluginRegistry;
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
$flagDynaFormNewVersion = !is_null($dynaForm) && $dynaForm->getDynVersion() == 2;
@@ -178,7 +180,7 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
@@ -186,7 +188,7 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
if (! isset( $aFields["APP_DOC_UID"] )) {
$aFields["APP_DOC_UID"] = $sAppDocUid;

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
if (! isset( $_REQUEST['action'] )) {
$return['success'] = 'failure';
$return['message'] = 'You may request an action';
@@ -25,7 +27,7 @@ function searchSavedJob ($schUid)
function pluginsList ()
{
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
$selectedPlugin = "";
if ((isset( $_REQUEST['plg_uid'] )) && ($_REQUEST['plg_uid'] != "")) {
@@ -56,11 +58,12 @@ function pluginCaseSchedulerForm ()
}
$G_PUBLISH = new Publisher();
$params = explode( "--", $_REQUEST['selectedOption'] );
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
/** @var \ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin $caseSchedulerPluginDetail */
foreach ($activePluginsForCaseScheduler as $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->equalNamespaceTo($params[0])) &&
($caseSchedulerPluginDetail->equalActionIdTo($params[1]))) {
$caseSchedulerSelected = $caseSchedulerPluginDetail;
}
}
@@ -74,7 +77,7 @@ function pluginCaseSchedulerForm ()
$oData = array ("PRO_UID" => $_REQUEST['pro_uid']
);
}
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionForm, $oData );
$oPluginRegistry->executeMethod($caseSchedulerPluginDetail->getNamespace(), $caseSchedulerPluginDetail->getActionForm(), $oData);
}
}

View File

@@ -27,6 +27,8 @@
* @author David Callizaya <davidsantos@colosa.com>
*/
use ProcessMaker\Plugins\PluginRegistry;
if (isset($_REQUEST['actionAjax']) && $_REQUEST['actionAjax'] == "verifySession" ) {
if (!isset($_SESSION['USER_LOGGED'])) {
if ((isset( $_POST['request'] )) && ($_POST['request'] == true)) {
@@ -107,7 +109,7 @@ if (file_exists( $realPath )) {
if (!$sw_file_exists) {
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT )) {
$error_message = G::LoadTranslation( 'ID_ERROR_FILE_NOT_EXIST', SYS_LANG, array('filename' => $info['basename'] . $ver . '.' . $ext) ) . ' ' . G::LoadTranslation('ID_CONTACT_ADMIN');
} else {

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
$filter = new InputFilter();
list($_GET['UID'], $_GET['TYPE'], $_GET['POSITION'], $_GET['ACTION']) = $filter->xssRegexFilter(
@@ -386,7 +389,7 @@ try {
$Fields['MESSAGE1'] = G::LoadTranslation( 'ID_PLEASE_ENTER_COMMENTS' );
$Fields['MESSAGE2'] = G::LoadTranslation( 'ID_PLEASE_SELECT_FILE' );
//START: If there is a Break Step registered from Plugin Similar as a Trigger debug
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT_BEFORE )) {
//If a Plugin has registered a Break Page Evaluator
$oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT_BEFORE, array ('USR_UID' => $_SESSION['USER_LOGGED']) );
@@ -395,18 +398,6 @@ try {
$G_PUBLISH->AddContent( 'propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList', $oCase->getInputDocumentsCriteria( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['UID'] ), array_merge( array ('DOC_UID' => $_GET['UID']
), $Fields ) ); //$aFields
//call plugin
//if ( $oPluginRegistry->existsTrigger ( PM_CASE_DOCUMENT_LIST ) ) {
// $folderData = new folderData (null, null, $_SESSION['APPLICATION'], null, $_SESSION['USER_LOGGED'] );
// $oPluginRegistry =& PMPluginRegistry::getSingleton();
// $oPluginRegistry->executeTriggers ( PM_CASE_DOCUMENT_LIST , $folderData );
// //end plugin
//}
//else
// $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['UID']), array_merge(array('DOC_UID'=>$_GET['UID']),$Fields));//$aFields
$oHeadPublisher = & headPublisher::getSingleton();
$titleDocument = "<h3>" . htmlspecialchars($Fields['INP_DOC_TITLE'], ENT_QUOTES) . "<br><small>" . G::LoadTranslation('ID_INPUT_DOCUMENT') . "</small></h3>";
if ($Fields['INP_DOC_DESCRIPTION']) {
@@ -458,7 +449,7 @@ try {
switch ($_GET['ACTION']) {
case 'GENERATE':
//START: If there is a Break Step registered from Plugin Similar as a Trigger debug
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT_BEFORE )) {
//If a Plugin has registered a Break Page Evaluator
$oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT_BEFORE, array ('USR_UID' => $_SESSION['USER_LOGGED']) );
@@ -650,7 +641,7 @@ try {
//Save data - End
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
@@ -667,7 +658,7 @@ try {
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
//Only delete if the file was saved correctly
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->getNamespace();
//$oAppDocument = new AppDocument();
//$oAppDocument->update($aFields);
unlink( $pathOutput . $sFilename . '.pdf' );
@@ -722,7 +713,7 @@ try {
$lastVersion = $oAppDocument->getLastAppDocVersion( $_GET['DOC'], $_SESSION['APPLICATION'] );
$aFields = $oAppDocument->load( $_GET['DOC'], $lastVersion );
$listing = false;
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST )) {
$folderData = new folderData( null, null, $_SESSION['APPLICATION'], null, $_SESSION['USER_LOGGED'] );
$folderData->PMType = "OUTPUT";
@@ -1144,7 +1135,7 @@ try {
if ($noShowTitle == 0) {
$G_PUBLISH->AddContent( 'smarty', 'cases/cases_title', '', '', $array );
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$sNamespace = '';

View File

@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
try {
$oAppDocument = new AppDocument();
@@ -52,7 +54,7 @@ try {
G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$oData['APP_UID'] = $_GET['APP_UID'];
$documentData = new uploadDocumentData( $_GET['APP_UID'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid );

View File

@@ -22,11 +22,6 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//call plugin
// $oPluginRegistry = &PMPluginRegistry::getSingleton();
// $existsDynaforms = $oPluginRegistry->existsTrigger(PM_NEW_DYNAFORM_LIST );
//for now, we are going with the default list, because the plugin is not complete
include ('dynaforms_Edit.php');
die();

View File

@@ -4,6 +4,8 @@ require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php';
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AddonsManagerPeer.php';
use ProcessMaker\Plugins\PluginRegistry;
function runBgProcessmaker($task, $log)
{
require_once (PATH_CORE . "bin/tasks/cliAddons.php");
@@ -79,39 +81,15 @@ try {
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
///////
//$licenseManager = &pmLicenseManager::getSingleton();
//plugin.singleton //are all the plugins that are enabled in the SYS_SYS
$pluginRegistry = &PMPluginRegistry::getSingleton();
$arrayAddon = array();
//ee //all plugins enterprise installed in /processmaker/workflow/engine/plugins (no matter if they are enabled/disabled)
if (file_exists(PATH_DATA_SITE . "ee")) {
$arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
}
foreach ($arrayAddon as $addon) {
$sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-"));
if (file_exists(PATH_PLUGINS . $sFileName . ".php")) {
$addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php");
$enabled = 0;
if ($addonDetails) {
$enabled = ($addonDetails->enabled)? 1 : 0;
}
if ($enabled == 1 && !in_array($sFileName, $licenseManager->features)) {
require_once (PATH_PLUGINS . $sFileName . ".php");
$pluginRegistry->disablePlugin($sFileName);
}
//are all the plugins that are enabled in the workspace
$pluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
$pluginRegistry->disablePlugin($plugin->getNamespace());
$pluginRegistry->savePlugin($plugin->getNamespace());
}
}
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
}
}
break;
@@ -207,10 +185,6 @@ try {
break;
}
//$logContents = file_get_contents("$log.log", false, NULL, 0, 10);
//if (!empty($logContents))
// break;
$retries += 1;
if ($retries > $max_retries) {
@@ -219,11 +193,6 @@ try {
}
}
//if ($failed) {
// //$addon->clearState(); //clearState no found
// $result["success"] = false;
//}
$result["status"] = "OK";
} catch (Exception $e) {
$result["message"] = $e->getMessage();
@@ -355,4 +324,3 @@ try {
))
);
}

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
if (!defined("PATH_PM_ENTERPRISE")) {
define("PATH_PM_ENTERPRISE", PATH_CORE . "enterprise/");
}
@@ -103,10 +105,10 @@ class enterprisePlugin extends PMPlugin
public function install()
{
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails("enterprise.php");
$pluginRegistry->enablePlugin($pluginDetail->sNamespace);
$pluginRegistry->enablePlugin($pluginDetail->getNamespace());
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
}
@@ -117,11 +119,11 @@ class enterprisePlugin extends PMPlugin
public function setup()
{
if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) {
$pluginRegistry = &PMPluginRegistry::getSingleton();
if (!PluginsRegistryPeer::retrieveByPK(md5('enterprise'))) {
$pluginRegistry = PluginRegistry::loadSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails("enterprise.php");
$pluginRegistry->enablePlugin($pluginDetail->sNamespace);
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
$pluginRegistry->enablePlugin($pluginDetail->getNamespace());
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
}
@@ -176,16 +178,17 @@ class enterprisePlugin extends PMPlugin
if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php")) {
require_once (PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php");
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails($pluginName . ".php");
if ($pluginDetail) {
$pluginRegistry->enablePlugin($pluginDetail->sNamespace);
$pluginRegistry->disablePlugin($pluginDetail->sNamespace);
$pluginRegistry->enablePlugin($pluginDetail->getNamespace());
$pluginRegistry->disablePlugin($pluginDetail->getNamespace());
///////
$plugin = new $pluginDetail->sClassName($pluginDetail->sNamespace, $pluginDetail->sFilename);
$className = $pluginDetail->getClassName();
$plugin = new $className($pluginDetail->getNamespace(), $pluginDetail->getFile());
//$this->_aPlugins[$pluginDetail->sNamespace] = $plugin;
if (method_exists($plugin, "uninstall")) {
@@ -193,7 +196,7 @@ class enterprisePlugin extends PMPlugin
}
///////
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
///////
@@ -323,7 +326,7 @@ class enterprisePlugin extends PMPlugin
}
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->registerPlugin('enterprise', __FILE__); //<- enterprise string must be in single quote, otherwise generate error
//since we are placing pmLicenseManager and EE together.. after register EE, we need to require_once the pmLicenseManager

View File

@@ -26,6 +26,8 @@
global $RBAC;
use ProcessMaker\Plugins\PluginRegistry;
$RBAC->requirePermissions("PM_SETUP_ADVANCE");
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
@@ -75,7 +77,7 @@ try {
throw (new Exception($str));
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if ($bMainFile && $bClassFile) {
@@ -136,9 +138,9 @@ try {
$details = $oPluginRegistry->getPluginDetails($pluginFile);
$oPluginRegistry->installPlugin($details->sNamespace);
$oPluginRegistry->installPlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
$oPluginRegistry->savePlugin($details->getNamespace());
//G::header("Location: pluginsList");
//die;

View File

@@ -1,11 +1,14 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
$pluginFile = $_GET['id'];
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$xmlform = isset($details->sPluginFolder) ? $details->sPluginFolder . '/' . $details->sSetupPage : '';
$folder = $details->getFolder();
$xmlform = (isset($folder)) ? $folder . '/' . $details->getSetupPage() : '';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
@@ -23,7 +26,7 @@ try {
throw ( new Exception ('setup .xml file is not defined for this plugin') );
}
$Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace );
$Fields = $oPluginRegistry->getFieldsForPageSetup( $details->getNamespace() );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '',$Fields ,'pluginsSetupSave?id='.$pluginFile );
} catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage();

View File

@@ -21,6 +21,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
$inst = new PmInstaller();
$oProcess = new Processes();
@@ -57,7 +60,7 @@ foreach ($availablePlugins as $filename) {
}
//print "change to ENABLED";
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) {
@@ -67,10 +70,10 @@ foreach ($availablePlugins as $filename) {
require_once (PATH_PLUGINS . $pluginFile);
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->installPlugin( $details->sNamespace );
$oPluginRegistry->enablePlugin( $details->sNamespace );
$oPluginRegistry->installPlugin($details->getNamespace());
$oPluginRegistry->enablePlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
$oPluginRegistry->savePlugin($details->getNamespace());
$message .= "$filename - OK<br>";

View File

@@ -23,6 +23,8 @@
*
*/
use ProcessMaker\Plugins\PluginRegistry;
try {
$usr = '';
$pwd = '';
@@ -172,7 +174,7 @@ try {
}
//Execute the SSO Script from plugin
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$lSession="";
$loginInfo = new loginInfo ($usr, $pwd, $lSession );
if ($oPluginRegistry->existsTrigger ( PM_LOGIN )) {
@@ -425,7 +427,7 @@ try {
setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
}
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger ( PM_AFTER_LOGIN )) {
$oPluginRegistry->executeTriggers ( PM_AFTER_LOGIN , $_SESSION['USER_LOGGED'] );
}

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/Users.php';
$oUser = new Users();
$aUser = $oUser->load($_SESSION['USER_LOGGED']);
@@ -50,15 +53,19 @@ if (class_exists('redirectDetail')) {
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset($aRedirectLogin)) {
if (is_array($aRedirectLogin)) {
foreach ($aRedirectLogin as $key => $detail) {
/** @var \ProcessMaker\Plugins\Interfaces\RedirectDetail $detail */
foreach ($aRedirectLogin as $detail) {
if (isset($detail->sPathMethod)) {
if ($detail->sRoleCode == $userRole) {
G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod );
if ($detail->equalRoleCodeTo($userRole)) {
G::header(
'location: /sys' . SYS_TEMP . '/' . SYS_LANG .
'/' . SYS_SKIN . '/' . $detail->getPathMethod()
);
die;
}
}

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
$aInfoLoadFile = array();
$aInfoLoadFile['name'] = $_FILES['form']['name']['licenseFile'];
$aInfoLoadFile['tmp_name'] = $_FILES['form']['tmp_name']['licenseFile'];
@@ -36,36 +38,16 @@ if ($aux['extension'] != 'dat') {
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
//plugin.singleton //are all the plugins that are enabled in the SYS_SYS
$pluginRegistry = &PMPluginRegistry::getSingleton();
$arrayAddon = array();
//ee //all plugins enterprise installed in /processmaker/workflow/engine/plugins (no matter if they are enabled/disabled)
if (file_exists(PATH_DATA_SITE . "ee")) {
$arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
}
foreach ($arrayAddon as $addon) {
$sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-"));
if (file_exists(PATH_PLUGINS . $sFileName . ".php")) {
$addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php");
$enabled = 0;
if ($addonDetails) {
$enabled = ($addonDetails->enabled)? 1 : 0;
}
if ($enabled == 1 && !in_array($sFileName, $licenseManager->features)) {
require_once (PATH_PLUGINS . $sFileName . ".php");
$pluginRegistry->disablePlugin($sFileName);
}
//are all the plugins that are enabled in the workspace
$pluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
$pluginRegistry->disablePlugin($plugin->getNamespace());
$pluginRegistry->savePlugin($plugin->getNamespace());
}
}
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
G::SendTemporalMessage('ID_NLIC', 'info');
} else {
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG', 'warning');

View File

@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
/*----------------------------------********---------------------------------*/
//Browser Compatibility
$browserSupported = G::checkBrowserCompatibility();
@@ -122,7 +125,7 @@ if (isset ($_SESSION['USER_LOGGED'])) {
}
} else {
// Execute SSO trigger
$pluginRegistry =& PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
if (defined('PM_SINGLE_SIGN_ON')) {
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();

View File

@@ -23,6 +23,9 @@
*/
global $RBAC;
use ProcessMaker\Plugins\PluginRegistry;
$resultRbac = $RBAC->requirePermissions('PM_SETUP_ADVANCE', 'PM_SETUP_LOGS');
if (!$resultRbac) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
@@ -47,9 +50,8 @@ $status = array(
array("pending", G::LoadTranslation('ID_PENDING'))
);
$pluginRegistry = PMPluginRegistry::getSingleton();
$statusER = $pluginRegistry->getStatusPlugin('externalRegistration');
$flagER = (preg_match('/^enabled$/', $statusER))? 1 : 0;
$pluginRegistry = PluginRegistry::loadSingleton();
$flagER = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
$processes = getProcessArray($userUid);

View File

@@ -1,5 +1,6 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Exception\RBACException;
$req = (isset($_REQUEST['request']) ? $_REQUEST['request'] : '');
@@ -46,10 +47,8 @@ switch ($req) {
$arrayType = [];
$pluginRegistry = PMPluginRegistry::getSingleton();
$statusEr = $pluginRegistry->getStatusPlugin('externalRegistration');
$flagEr = (preg_match('/^enabled$/', $statusEr)) ? 1 : 0;
$pluginRegistry = PluginRegistry::loadSingleton();
$flagEr = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
if ($flagEr == 0) {
$arrayType[] = 'EXTERNAL_REGISTRATION';

View File

@@ -22,6 +22,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
*
* @author Erik Amaru Ortiz <erik@colosa.com>
@@ -112,7 +115,7 @@ class Ajax
$oData['PRO_TEMPLATE'] = (isset($_POST['PRO_TEMPLATE']) && $_POST['PRO_TEMPLATE'] != '') ? $_POST['form']['PRO_TEMPLATE'] : '';
$oData['PROCESSMAP'] = $oProcessMap;
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $oData);
} else {
//$oProcessMap->updateProcess($_POST['form']);

View File

@@ -21,6 +21,7 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
//$oHeadPublisher = & headPublisher::getSingleton();
global $RBAC;
@@ -47,12 +48,12 @@ if ($pmVersion != "") {
$arrayFlagMenuNewOption = (version_compare($pmVersion . "", "3", ">="))? array("bpmn" => true) : array("pm" => true);
}
$pluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$arrayMenuNewOptionPlugin = array();
$arrayContextMenuOptionPlugin = array();
foreach ($pluginRegistry->getDesignerMenu() as $value) {
foreach ($oPluginRegistry->getDesignerMenu() as $value) {
if (file_exists($value->file)) {
require_once($value->file);
@@ -102,11 +103,11 @@ if($RBAC->userCanAccess('PM_DELETE_PROCESS_CASES') === 1) {
}
$oHeadPublisher->assign('deleteCasesFlag', $deleteCasesFlag);
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$callBackFile = $oPluginRegistry->getImportProcessCallback();
$file = false;
if(sizeof($callBackFile)) {
$file = $callBackFile[0]->callBackFile != "" ? $callBackFile[0]->callBackFile : false;
$file = $callBackFile[0]->getCallBackFile() != "" ? $callBackFile[0]->getCallBackFile() : false;
}
$oHeadPublisher->assign("importProcessCallbackFile", $file);

View File

@@ -21,6 +21,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
$access = $RBAC->userCanAccess( 'PM_FACTORY' );
if ($access != 1) {
switch ($access) {
@@ -43,7 +46,7 @@ if ($access != 1) {
}
//call plugins
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_LIST, NULL );
$aFields['MESSAGE1'] = G::LoadTranslation( 'ID_MSG_ERROR_PRO_TITLE' );

View File

@@ -29,6 +29,8 @@
use ProcessMaker\Plugins\PluginRegistry;
$function = isset( $_POST['function'] ) ? $_POST['function'] : '';
$infoProcess = new Process();
$resultProcessOld = $infoProcess->load($_POST['form']['PRO_UID']);
@@ -68,7 +70,7 @@ switch ($function) {
$oData['PRO_TEMPLATE'] = (isset( $_POST['form']['PRO_TEMPLATE'] ) && $_POST['form']['PRO_TEMPLATE'] != '') ? $_POST['form']['PRO_TEMPLATE'] : '';
$oData['PROCESSMAP'] = $oProcessMap;
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData );
G::header( 'location: processes_Map?PRO_UID=' . $sProUid );

View File

@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
use ProcessMaker\Plugins\PluginRegistry;
switch ($RBAC->userCanAccess( 'PM_REPORTS' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
@@ -74,7 +77,7 @@ $reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => 5,'RPT_TITLE'
'RPT_TITLE' => "Report 9",//G::LoadTranslation('ID_REPORT6'),
'VIEW' => G::LoadTranslation('ID_VIEW'));*/
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
//$aReports = array();

View File

@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
* Report - Report view
*
@@ -210,7 +212,7 @@ try {
break;
default:
$foundReport = false;
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
foreach ($aAvailableReports as $sReportClass) {

View File

@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
* @Updated Dec 14, 2009 by Erik <erik@colosa.com>
*
@@ -138,7 +140,7 @@ if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
@@ -146,7 +148,7 @@ if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
if (! isset( $aFields["APP_DOC_UID"] )) {
$aFields["APP_DOC_UID"] = $sAppDocUid;

View File

@@ -23,6 +23,8 @@
*/
// lets display the items
use ProcessMaker\Plugins\PluginRegistry;
$pluginFile = $_GET['id'];
$pluginStatus = $_GET['status'];
@@ -32,36 +34,38 @@ $filter = new InputFilter();
$path = PATH_PLUGINS . $pluginFile;
$path = $filter->validateInput($path, 'path');
$oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($handle = opendir( PATH_PLUGINS )) {
while (false !== ($file = readdir( $handle ))) {
if (strpos( $file, '.php', 1 ) && $file == $pluginFile) {
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file, '.php', 1) && $file == $pluginFile) {
if ($pluginStatus == '1') {
//print "change to disable";
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->disablePlugin( $details->sNamespace );
$size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
G::auditLog("DisablePlugin", "Plugin Name: ".$details->sNamespace);
//print "size saved : $size <br>";
// change to disable
$details = $oPluginRegistry->getPluginDetails($pluginFile);
$oPluginRegistry->disablePlugin($details->getNamespace());
$oPluginRegistry->savePlugin($details->getNamespace());
G::auditLog("DisablePlugin", "Plugin Name: " . $details->getNamespace());
} else {
$pluginName = str_replace(".php", "", $pluginFile);
if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) {
/*----------------------------------********---------------------------------*/
if (!$oPluginRegistry->isEnterprisePlugin($pluginName) &&
PMLicensedFeatures::getSingleton()->verifyfeature('B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=')
PMLicensedFeatures::getSingleton()
->verifyfeature('B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=')
) {
//Check disabled code
$cs = new CodeScanner(SYS_SYS);
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName));
$arrayFoundDisabledCode = array_merge(
$cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"),
$cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName)
);
if (!empty($arrayFoundDisabledCode)) {
$response = array();
$response["status"] = "DISABLED-CODE";
$response["status"] = "DISABLED-CODE";
$response["message"] = G::LoadTranslation("ID_DISABLED_CODE_PLUGIN");
echo G::json_encode($response);
@@ -70,21 +74,16 @@ if ($handle = opendir( PATH_PLUGINS )) {
}
/*----------------------------------********---------------------------------*/
//print "change to ENABLED";
// change to ENABLED
require_once($path);
$details = $oPluginRegistry->getPluginDetails($pluginFile);
$oPluginRegistry->enablePlugin($details->sNamespace);
$oPluginRegistry->enablePlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
G::auditLog("EnablePlugin", "Plugin Name: " . $details->sNamespace);
//print "size saved : $size <br>";
$oPluginRegistry->savePlugin($details->getNamespace());
G::auditLog("EnablePlugin", "Plugin Name: " . $details->getNamespace());
}
}
}
}
closedir( $handle );
closedir($handle);
}
//$oPluginRegistry->showArrays();
//G::Header('location: pluginsList');

View File

@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
use ProcessMaker\Plugins\PluginRegistry;
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
if ($access != 1) {
switch ($access) {
@@ -43,7 +46,7 @@ if ($access != 1) {
}
}
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';

View File

@@ -23,6 +23,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
@@ -67,7 +68,7 @@ try {
$tar->extractList( $listFiles, PATH_PLUGINS . 'data');
$tar->extractList( $licenseName, PATH_PLUGINS);
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$autoPlugins = glob(PATH_PLUGINS . "data/enterprise/data/*.tar");
$autoPluginsA = array();
@@ -91,10 +92,9 @@ try {
}
$pluginDetail = $pluginRegistry->getPluginDetails($sClassName . ".php");
$pluginRegistry->installPlugin($pluginDetail->sNamespace); //error
$pluginRegistry->installPlugin($pluginDetail->getNamespace()); //error
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
$licfile = glob(PATH_PLUGINS . "*.dat");
if ((isset($licfile[0])) && ( is_file($licfile[0]) )) {
@@ -141,7 +141,7 @@ try {
$tar->extractList( $listFiles, PATH_PLUGINS . 'data');
$tar->extractList( $licenseName, PATH_PLUGINS);
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$autoPlugins = glob(PATH_PLUGINS . "data/plugins/*.tar");
$autoPluginsA = array();
@@ -165,11 +165,10 @@ try {
}
$pluginDetail = $pluginRegistry->getPluginDetails($sClassName . ".php");
$pluginRegistry->installPlugin($pluginDetail->sNamespace); //error
$pluginRegistry->installPlugin($pluginDetail->getNamespace()); //error
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
$licfile = glob(PATH_PLUGINS . "*.dat");
if ((isset($licfile[0])) && ( is_file($licfile[0]) )) {
@@ -222,7 +221,7 @@ try {
file_put_contents($pathFileFlag, 'New Enterprise');
}
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if ($bMainFile && $bClassFile) {
@@ -323,17 +322,16 @@ try {
require_once (PATH_PLUGINS . $pluginFile);
$oPluginRegistry->registerPlugin( $sClassName, PATH_PLUGINS . $sClassName . ".php" );
$size = file_put_contents( PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance() );
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->installPlugin( $details->sNamespace );
$oPluginRegistry->installPlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents( PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance() );
$oPluginRegistry->savePlugin($details->getNamespace());
$response = $oPluginRegistry->verifyTranslation( $details->sNamespace);
G::auditLog("InstallPlugin", "Plugin Name: ".$details->sNamespace );
$response = $oPluginRegistry->verifyTranslation($details->getNamespace());
G::auditLog("InstallPlugin", "Plugin Name: " . $details->getNamespace());
//if ($response->recordsCountSuccess <= 0) {
//throw (new Exception( 'The plugin ' . $details->sNamespace . ' couldn\'t verify any translation item. Verified Records:' . $response->recordsCountSuccess));

View File

@@ -21,6 +21,10 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
/** @var RBAC $RBAC */
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
@@ -29,7 +33,7 @@ $headPublisher->addExtJsScript( 'setup/pluginsMain', false );
$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN );
$headPublisher->assign( "SYS_SKIN", SYS_SKIN );
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') && $oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') == "enabled") {
$headPublisher = $oPluginRegistry->executeMethod('pmWorkspaceManagement', 'disableButtonsPluginMain', $headPublisher);
}

View File

@@ -22,33 +22,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
/*
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}*/
use ProcessMaker\Plugins\PluginRegistry;
$filter = new InputFilter();
$pluginName = $_REQUEST['pluginUid'];
$pluginName = $filter->xssFilterHard($pluginName);
if (file_exists( PATH_PLUGINS . $pluginName . '.php' )) {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$pluginRegistry->uninstallPlugin($pluginName);
$pluginRegistry->uninstallPlugin( $pluginName );
$path = $filter->validateInput(PATH_DATA_SITE . 'plugin.singleton', 'path');
$pluginRegistry->unSerializeInstance( file_get_contents( $path ) );
}
G::auditLog('RemovePlugin','Plugin Name: '.$pluginName);
echo $pluginName . ' ' . nl2br( $filter->xssFilterHard(G::LoadTranslation( 'ID_MSG_REMOVE_PLUGIN_SUCCESS' )) );
G::auditLog('RemovePlugin', 'Plugin Name: ' . $pluginName);
echo $pluginName . ' ' . nl2br($filter->xssFilterHard(G::LoadTranslation('ID_MSG_REMOVE_PLUGIN_SUCCESS')));

View File

@@ -22,12 +22,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
$pluginFile = $_GET['id'];
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$xmlform = isset( $details->sPluginFolder ) ? $details->sPluginFolder . '/' . $details->sSetupPage : '';
$folder = $details->getFolder();
$xmlform = isset($folder) ? $folder . '/' . $details->getSetupPage() : '';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
@@ -45,7 +48,7 @@ try {
if (! file_exists( PATH_PLUGINS . $xmlform . '.xml' ))
throw (new Exception( 'setup .xml file is not defined for this plugin' ));
$Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace );
$Fields = $oPluginRegistry->getFieldsForPageSetup( $details->getNamespace() );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $Fields, 'pluginsSetupSave?id=' . $pluginFile );
} catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage();

View File

@@ -22,13 +22,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
$pluginFile = $_GET['id'];
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
try {
$Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->sNamespace, $_POST );
$Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->getNamespace(), $_POST );
$str = "$Fields fields saved successfully!";
G::SendTemporalMessage( $str, 'info', 'string', 3, 100 );
G::Header( "location: pluginsSetup?id=$pluginFile" );

View File

@@ -1,462 +1,464 @@
<?php
/**
* trackerAjax.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* 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.
*/
try {
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
if (isset( $_POST['form']['action'] )) {
$_POST['action'] = $_POST['form']['action'];
}
switch ($_POST['action']) {
case 'availableCaseTrackerObjects':
$oProcessMap = new ProcessMap();
$oProcessMap->availableCaseTrackerObjects( $_POST['PRO_UID'] );
break;
case 'assignCaseTrackerObject':
$oProcessMap = new ProcessMap();
$cto_UID = $oProcessMap->assignCaseTrackerObject( $_POST['PRO_UID'], $_POST['OBJECT_TYPE'], $_POST['OBJECT_UID'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Assign Case Tracker Object ('.$cto_UID.' - '.$_POST['OBJECT_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
echo $cto_UID;
break;
case 'removeCaseTrackerObject':
$oProcessMap = new ProcessMap();
$oProcessMap->removeCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Remove Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
break;
case 'upCaseTrackerObject':
$oProcessMap = new ProcessMap();
$oProcessMap->upCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Move Up Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
break;
case 'downCaseTrackerObject':
$oProcessMap = new ProcessMap();
$oProcessMap->downCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Move Down Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
break;
case 'editStagesMap':
$oTemplatePower = new TemplatePower( PATH_TPL . 'tracker/stages_Map.html' );
$oTemplatePower->prepare();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptCode( '
var pb=leimnud.dom.capture("tag.body 0");
Sm=new stagesmap();
Sm.options = {
target : "sm_target",
dataServer: "../tracker/tracker_Ajax",
uid : "' . $_POST['PRO_UID'] . '",
lang : "' . SYS_LANG . '",
theme : "processmaker",
size : {w:"780",h:"540"},
images_dir: "/jscore/processmap/core/images/",
rw : true,
hideMenu : false
};
Sm.make();' );
G::RenderPage( 'publish', 'raw' );
break;
case 'showUploadedDocumentTracker':
require_once 'classes/model/AppDocument.php';
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/InputDocument.php';
require_once 'classes/model/Users.php';
$oAppDocument = new AppDocument();
$oAppDocument->Fields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
$oInputDocument = new InputDocument();
if ($oAppDocument->Fields['DOC_UID'] != - 1) {
$Fields = $oInputDocument->load( $oAppDocument->Fields['DOC_UID'] );
} else {
$Fields = array ('INP_DOC_FORM_NEEDED' => '','FILENAME' => $oAppDocument->Fields['APP_DOC_FILENAME']);
}
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $oAppDocument->Fields['DEL_INDEX'] );
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$oTask = new Task();
$aTask = $oTask->load( $aRow['TAS_UID'] );
$Fields['ORIGIN'] = $aTask['TAS_TITLE'];
$oUser = new Users();
$aUser = $oUser->load( $oAppDocument->Fields['USR_UID'] );
$Fields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
switch ($Fields['INP_DOC_FORM_NEEDED']) {
case 'REAL':
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument2';
break;
case 'VIRTUAL':
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument1';
break;
case 'VREAL':
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument3';
break;
default:
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument';
break;
}
$oAppDocument->Fields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
$oAppDocument->Fields['FILE'] = 'tracker_ShowDocument?a=' . $_POST['APP_DOC_UID'] . '&r=' . rand();
//If plugin and trigger are defined for listing
if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $_SESSION['APPLICATION'] );
//Now search for the file, if exists the change the download URL
foreach ($filesPluginArray as $file) {
if ($file->filename == $_POST['APP_DOC_UID']) {
$oAppDocument->Fields['FILE'] = $file->downloadScript;
}
}
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', G::array_merges( $Fields, $oAppDocument->Fields ), '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'showGeneratedDocumentTracker':
require_once 'classes/model/AppDocument.php';
require_once 'classes/model/AppDelegation.php';
$oAppDocument = new AppDocument();
$aFields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$aOD = $oOutputDocument->load( $aFields['DOC_UID'] );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $aFields['APP_UID'] );
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $aFields['DEL_INDEX'] );
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$oTask = new Task();
$aTask = $oTask->load( $aRow['TAS_UID'] );
$aFields['ORIGIN'] = $aTask['TAS_TITLE'];
require_once 'classes/model/Users.php';
$oUser = new Users();
$aUser = $oUser->load( $aFields['USR_UID'] );
$aFields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
$aFields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
$aFields['FILE1'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand();
$aFields['FILE2'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand();
//If plugin and trigger are defined for listing
if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $aFields['APP_UID'] );
//Now search for the file, if exists the change the download URL
foreach ($filesPluginArray as $file) {
if ($file->filename == $_POST['APP_DOC_UID']) {
$aFields['FILE2'] = $file->downloadScript; // The PDF is the only one uploaded to KT
}
}
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_ViewAnyOutputDocument', '', G::array_merges( $aOD, $aFields ), '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'load':
$oConnection = Propel::getConnection( 'workflow' );
$oStatement = $oConnection->prepareStatement( "CREATE TABLE IF NOT EXISTS `STAGE` (
`STG_UID` VARCHAR( 32 ) NOT NULL ,
`PRO_UID` VARCHAR( 32 ) NOT NULL ,
`STG_POSX` INT( 11 ) NOT NULL DEFAULT '0',
`STG_POSY` INT( 11 ) NOT NULL DEFAULT '0',
`STG_INDEX` INT( 11 ) NOT NULL DEFAULT '0',
PRIMARY KEY ( `STG_UID` )
);" );
$oStatement->executeQuery();
/**
* ************************************************************************************************************
*/
require_once 'classes/model/Stage.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
require_once 'classes/model/AppDelegation.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oProcess = new Process();
$aRow = $oProcess->load( $oData->uid );
$oSM = new stdclass();
$oSM->title = new stdclass();
$oSM->title->label = strip_tags( $aRow['PRO_TITLE'] );
//$oSM->title->position->x = $aRow['PRO_TITLE_X'];
//$oSM->title->position->y = $aRow['PRO_TITLE_Y'];
$oSM->title->position = new stdclass();
$oSM->title->position->x = 10;
$oSM->title->position->y = 10;
$oSM->stages = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( StagePeer::STG_UID );
$oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
$oCriteria->addSelectColumn( StagePeer::STG_POSX );
$oCriteria->addSelectColumn( StagePeer::STG_POSY );
$aConditions = array ();
$aConditions[] = array (0 => StagePeer::STG_UID,1 => ContentPeer::CON_ID);
$aConditions[] = array (0 => ContentPeer::CON_CATEGORY,1 => DBAdapter::getStringDelimiter() . 'STG_TITLE' . DBAdapter::getStringDelimiter());
$aConditions[] = array (0 => ContentPeer::CON_LANG,1 => DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$oCriteria->add( StagePeer::PRO_UID, $oData->uid );
$oCriteria->addAscendingOrderByColumn( StagePeer::STG_INDEX );
$oDataset = StagePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow1 = $oDataset->getRow()) {
$oStage = new stdclass();
$oStage->uid = $aRow1['STG_UID'];
$oStage->label = strip_tags( $aRow1['CON_VALUE'] );
$oStage->position = new stdclass();
$oStage->position->x = (int) $aRow1['STG_POSX'];
$oStage->position->y = (int) $aRow1['STG_POSY'];
$oStage->derivation = new stdclass();
$oStage->derivation->to = array ();
if (! $oData->mode) {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( TaskPeer::STG_UID, $aRow1['STG_UID'] );
$oDataset1 = TaskPeer::doSelectRS( $oCriteria );
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset1->next();
$aTasks = array ();
while ($aRow2 = $oDataset1->getRow()) {
$aTasks[] = $aRow2['TAS_UID'];
$oDataset1->next();
}
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
$oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
$oCriteria->add( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL )->addOr( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, '' ) ) );
if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
$oStage->color = '#FF0000';
} else {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
$oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
$oCriteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED' );
if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
$oStage->color = '#006633';
} else {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
$oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
if (AppDelegationPeer::doCount( $oCriteria ) == 0) {
$oStage->color = '#939598';
}
}
}
}
$oSM->stages[] = $oStage;
$oDataset->next();
}
foreach ($oSM->stages as $iKey => $oStage) {
if (isset( $oSM->stages[$iKey + 1] )) {
$oDerivation = new stdclass();
$oDerivation->stage = $oSM->stages[$iKey + 1]->uid;
$oSM->stages[$iKey]->derivation->to = array ($oDerivation);
$oSM->stages[$iKey]->derivation->type = 0;
}
}
//$oJSON = new Services_JSON();
echo Bootstrap::json_encode( $oSM );
break;
case 'addStage':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'STG_UID' );
$oCriteria->add( StagePeer::PRO_UID, $oData->uid );
$oDataset = StagePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aStages = array ();
$iStageNumber = 0;
while ($aRow = $oDataset->getRow()) {
$aStages[] = $aRow['STG_UID'];
$iStageNumber ++;
$oDataset->next();
}
if ($iStageNumber == 0) {
$iStageNumber = 1;
}
$iIndex = $iStageNumber + 1;
$bContinue = false;
while (! $bContinue) {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'COUNT(*) AS TIMES' );
$oCriteria->add( ContentPeer::CON_ID, $aStages, Criteria::IN );
$oCriteria->add( ContentPeer::CON_CATEGORY, 'STG_TITLE' );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
$oCriteria->add( ContentPeer::CON_VALUE, G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber );
$oDataset = ContentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
if ((int) $aRow['TIMES'] > 0) {
$iStageNumber += 1;
} else {
$bContinue = true;
}
}
$oStage = new Stage();
$oNewStage = new stdclass();
$oNewStage->label = G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber;
if ($oData->position->x < 0)
$oData->position->x *= - 1;
if ($oData->position->y < 0)
$oData->position->y *= - 1;
$oNewStage->uid = $oStage->create( array ('PRO_UID' => $oData->uid,'STG_TITLE' => $oNewStage->label,'STG_POSX' => $oData->position->x,'STG_POSY' => $oData->position->y,'STG_INDEX' => $iIndex) );
//$oJSON = new Services_JSON();
echo Bootstrap::json_encode( $oNewStage );
break;
case 'saveStagePosition':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->uid );
$aFields['STG_UID'] = $oData->uid;
$aFields['STG_POSX'] = $oData->position->x;
$aFields['STG_POSY'] = $oData->position->y;
$oStage->update( $aFields );
break;
case 'deleteStage':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->stg_uid );
$oStage->remove( $oData->stg_uid );
$oStage->reorderPositions( $aFields['PRO_UID'], $aFields['STG_INDEX'] );
require_once 'classes/model/Task.php';
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( TaskPeer::STG_UID, $oData->stg_uid );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( TaskPeer::STG_UID, '' );
BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
break;
case 'editStage':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->stg_uid );
$aFields['THEINDEX'] = $oData->theindex;
$aFields['action'] = 'updateStage';
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_StageEdit', '', $aFields, '../tracker/tracker_Ajax' );
G::RenderPage( 'publish', 'raw' );
break;
case 'updateStage':
require_once 'classes/model/Stage.php';
$oStage = new Stage();
$aFields = $oStage->load( $_POST['form']['STG_UID'] );
$aFields['STG_TITLE'] = $_POST['form']['STG_TITLE'];
$oStage->update( $aFields );
break;
case 'tasksAssigned':
require_once 'classes/model/Stage.php';
require_once 'classes/model/Task.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
$oCriteria->add( TaskPeer::STG_UID, $oData->stg_uid );
$oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_StageTasks', $oCriteria, array ('PRO_UID' => $oData->pro_uid,'STG_UID' => $oData->stg_uid) );
G::RenderPage( 'publish', 'raw' );
break;
case 'availableTasksForTheStage':
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
$oCriteria->add( TaskPeer::PRO_UID, $_POST['PRO_UID'] );
$oCriteria->add( TaskPeer::STG_UID, '' );
$oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_AvailableStageTasks', $oCriteria, array ('STG_UID' => $_POST['STG_UID']) );
G::RenderPage( 'publish', 'raw' );
break;
case 'assignTaskToStage':
require_once 'classes/model/Task.php';
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( TaskPeer::STG_UID, $_POST['STG_UID'] );
BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
break;
case 'removeTaskFromTheStage':
require_once 'classes/model/Task.php';
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( TaskPeer::STG_UID, '' );
BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
break;
case "processMapLegend":
$arrayField = array ();
$arrayField["sLabel1"] = G::LoadTranslation( "ID_TASK_IN_PROGRESS" );
$arrayField["sLabel2"] = G::LoadTranslation( "ID_COMPLETED_TASK" );
$arrayField["sLabel3"] = G::LoadTranslation( "ID_PENDING_TASK" );
$arrayField["sLabel4"] = G::LoadTranslation( "ID_PARALLEL_TASK" );
$arrayField["tracker"] = 1;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( "smarty", "cases/cases_Leyends", "", "", $arrayField );
G::RenderPage( "publish", "raw" );
break;
}
} catch (Exception $oException) {
$token = strtotime("now");
PMException::registerErrorLog($oException, $token);
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
die;
}
<?php
/**
* trackerAjax.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* 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;
try {
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
if (isset( $_POST['form']['action'] )) {
$_POST['action'] = $_POST['form']['action'];
}
switch ($_POST['action']) {
case 'availableCaseTrackerObjects':
$oProcessMap = new ProcessMap();
$oProcessMap->availableCaseTrackerObjects( $_POST['PRO_UID'] );
break;
case 'assignCaseTrackerObject':
$oProcessMap = new ProcessMap();
$cto_UID = $oProcessMap->assignCaseTrackerObject( $_POST['PRO_UID'], $_POST['OBJECT_TYPE'], $_POST['OBJECT_UID'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Assign Case Tracker Object ('.$cto_UID.' - '.$_POST['OBJECT_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
echo $cto_UID;
break;
case 'removeCaseTrackerObject':
$oProcessMap = new ProcessMap();
$oProcessMap->removeCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Remove Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
break;
case 'upCaseTrackerObject':
$oProcessMap = new ProcessMap();
$oProcessMap->upCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Move Up Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
break;
case 'downCaseTrackerObject':
$oProcessMap = new ProcessMap();
$oProcessMap->downCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
$oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
$infoProcess = new Process();
$resultProcess = $infoProcess->load($_POST['PRO_UID']);
G::auditLog('CaseTrackers','Move Down Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
break;
case 'editStagesMap':
$oTemplatePower = new TemplatePower( PATH_TPL . 'tracker/stages_Map.html' );
$oTemplatePower->prepare();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptCode( '
var pb=leimnud.dom.capture("tag.body 0");
Sm=new stagesmap();
Sm.options = {
target : "sm_target",
dataServer: "../tracker/tracker_Ajax",
uid : "' . $_POST['PRO_UID'] . '",
lang : "' . SYS_LANG . '",
theme : "processmaker",
size : {w:"780",h:"540"},
images_dir: "/jscore/processmap/core/images/",
rw : true,
hideMenu : false
};
Sm.make();' );
G::RenderPage( 'publish', 'raw' );
break;
case 'showUploadedDocumentTracker':
require_once 'classes/model/AppDocument.php';
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/InputDocument.php';
require_once 'classes/model/Users.php';
$oAppDocument = new AppDocument();
$oAppDocument->Fields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
$oInputDocument = new InputDocument();
if ($oAppDocument->Fields['DOC_UID'] != - 1) {
$Fields = $oInputDocument->load( $oAppDocument->Fields['DOC_UID'] );
} else {
$Fields = array ('INP_DOC_FORM_NEEDED' => '','FILENAME' => $oAppDocument->Fields['APP_DOC_FILENAME']);
}
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $oAppDocument->Fields['DEL_INDEX'] );
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$oTask = new Task();
$aTask = $oTask->load( $aRow['TAS_UID'] );
$Fields['ORIGIN'] = $aTask['TAS_TITLE'];
$oUser = new Users();
$aUser = $oUser->load( $oAppDocument->Fields['USR_UID'] );
$Fields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
switch ($Fields['INP_DOC_FORM_NEEDED']) {
case 'REAL':
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument2';
break;
case 'VIRTUAL':
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument1';
break;
case 'VREAL':
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument3';
break;
default:
$sXmlForm = 'tracker/tracker_ViewAnyInputDocument';
break;
}
$oAppDocument->Fields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
$oAppDocument->Fields['FILE'] = 'tracker_ShowDocument?a=' . $_POST['APP_DOC_UID'] . '&r=' . rand();
//If plugin and trigger are defined for listing
if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
$oPluginRegistry = PluginRegistry::loadSingleton();
$filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $_SESSION['APPLICATION'] );
//Now search for the file, if exists the change the download URL
foreach ($filesPluginArray as $file) {
if ($file->filename == $_POST['APP_DOC_UID']) {
$oAppDocument->Fields['FILE'] = $file->downloadScript;
}
}
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', G::array_merges( $Fields, $oAppDocument->Fields ), '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'showGeneratedDocumentTracker':
require_once 'classes/model/AppDocument.php';
require_once 'classes/model/AppDelegation.php';
$oAppDocument = new AppDocument();
$aFields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$aOD = $oOutputDocument->load( $aFields['DOC_UID'] );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $aFields['APP_UID'] );
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $aFields['DEL_INDEX'] );
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$oTask = new Task();
$aTask = $oTask->load( $aRow['TAS_UID'] );
$aFields['ORIGIN'] = $aTask['TAS_TITLE'];
require_once 'classes/model/Users.php';
$oUser = new Users();
$aUser = $oUser->load( $aFields['USR_UID'] );
$aFields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
$aFields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
$aFields['FILE1'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand();
$aFields['FILE2'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand();
//If plugin and trigger are defined for listing
if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
$oPluginRegistry = PluginRegistry::loadSingleton();
$filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $aFields['APP_UID'] );
//Now search for the file, if exists the change the download URL
foreach ($filesPluginArray as $file) {
if ($file->filename == $_POST['APP_DOC_UID']) {
$aFields['FILE2'] = $file->downloadScript; // The PDF is the only one uploaded to KT
}
}
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_ViewAnyOutputDocument', '', G::array_merges( $aOD, $aFields ), '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'load':
$oConnection = Propel::getConnection( 'workflow' );
$oStatement = $oConnection->prepareStatement( "CREATE TABLE IF NOT EXISTS `STAGE` (
`STG_UID` VARCHAR( 32 ) NOT NULL ,
`PRO_UID` VARCHAR( 32 ) NOT NULL ,
`STG_POSX` INT( 11 ) NOT NULL DEFAULT '0',
`STG_POSY` INT( 11 ) NOT NULL DEFAULT '0',
`STG_INDEX` INT( 11 ) NOT NULL DEFAULT '0',
PRIMARY KEY ( `STG_UID` )
);" );
$oStatement->executeQuery();
/**
* ************************************************************************************************************
*/
require_once 'classes/model/Stage.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
require_once 'classes/model/AppDelegation.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oProcess = new Process();
$aRow = $oProcess->load( $oData->uid );
$oSM = new stdclass();
$oSM->title = new stdclass();
$oSM->title->label = strip_tags( $aRow['PRO_TITLE'] );
//$oSM->title->position->x = $aRow['PRO_TITLE_X'];
//$oSM->title->position->y = $aRow['PRO_TITLE_Y'];
$oSM->title->position = new stdclass();
$oSM->title->position->x = 10;
$oSM->title->position->y = 10;
$oSM->stages = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( StagePeer::STG_UID );
$oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
$oCriteria->addSelectColumn( StagePeer::STG_POSX );
$oCriteria->addSelectColumn( StagePeer::STG_POSY );
$aConditions = array ();
$aConditions[] = array (0 => StagePeer::STG_UID,1 => ContentPeer::CON_ID);
$aConditions[] = array (0 => ContentPeer::CON_CATEGORY,1 => DBAdapter::getStringDelimiter() . 'STG_TITLE' . DBAdapter::getStringDelimiter());
$aConditions[] = array (0 => ContentPeer::CON_LANG,1 => DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$oCriteria->add( StagePeer::PRO_UID, $oData->uid );
$oCriteria->addAscendingOrderByColumn( StagePeer::STG_INDEX );
$oDataset = StagePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow1 = $oDataset->getRow()) {
$oStage = new stdclass();
$oStage->uid = $aRow1['STG_UID'];
$oStage->label = strip_tags( $aRow1['CON_VALUE'] );
$oStage->position = new stdclass();
$oStage->position->x = (int) $aRow1['STG_POSX'];
$oStage->position->y = (int) $aRow1['STG_POSY'];
$oStage->derivation = new stdclass();
$oStage->derivation->to = array ();
if (! $oData->mode) {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( TaskPeer::STG_UID, $aRow1['STG_UID'] );
$oDataset1 = TaskPeer::doSelectRS( $oCriteria );
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset1->next();
$aTasks = array ();
while ($aRow2 = $oDataset1->getRow()) {
$aTasks[] = $aRow2['TAS_UID'];
$oDataset1->next();
}
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
$oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
$oCriteria->add( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL )->addOr( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, '' ) ) );
if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
$oStage->color = '#FF0000';
} else {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
$oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
$oCriteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED' );
if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
$oStage->color = '#006633';
} else {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
$oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
if (AppDelegationPeer::doCount( $oCriteria ) == 0) {
$oStage->color = '#939598';
}
}
}
}
$oSM->stages[] = $oStage;
$oDataset->next();
}
foreach ($oSM->stages as $iKey => $oStage) {
if (isset( $oSM->stages[$iKey + 1] )) {
$oDerivation = new stdclass();
$oDerivation->stage = $oSM->stages[$iKey + 1]->uid;
$oSM->stages[$iKey]->derivation->to = array ($oDerivation);
$oSM->stages[$iKey]->derivation->type = 0;
}
}
//$oJSON = new Services_JSON();
echo Bootstrap::json_encode( $oSM );
break;
case 'addStage':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'STG_UID' );
$oCriteria->add( StagePeer::PRO_UID, $oData->uid );
$oDataset = StagePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aStages = array ();
$iStageNumber = 0;
while ($aRow = $oDataset->getRow()) {
$aStages[] = $aRow['STG_UID'];
$iStageNumber ++;
$oDataset->next();
}
if ($iStageNumber == 0) {
$iStageNumber = 1;
}
$iIndex = $iStageNumber + 1;
$bContinue = false;
while (! $bContinue) {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'COUNT(*) AS TIMES' );
$oCriteria->add( ContentPeer::CON_ID, $aStages, Criteria::IN );
$oCriteria->add( ContentPeer::CON_CATEGORY, 'STG_TITLE' );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
$oCriteria->add( ContentPeer::CON_VALUE, G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber );
$oDataset = ContentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
if ((int) $aRow['TIMES'] > 0) {
$iStageNumber += 1;
} else {
$bContinue = true;
}
}
$oStage = new Stage();
$oNewStage = new stdclass();
$oNewStage->label = G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber;
if ($oData->position->x < 0)
$oData->position->x *= - 1;
if ($oData->position->y < 0)
$oData->position->y *= - 1;
$oNewStage->uid = $oStage->create( array ('PRO_UID' => $oData->uid,'STG_TITLE' => $oNewStage->label,'STG_POSX' => $oData->position->x,'STG_POSY' => $oData->position->y,'STG_INDEX' => $iIndex) );
//$oJSON = new Services_JSON();
echo Bootstrap::json_encode( $oNewStage );
break;
case 'saveStagePosition':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->uid );
$aFields['STG_UID'] = $oData->uid;
$aFields['STG_POSX'] = $oData->position->x;
$aFields['STG_POSY'] = $oData->position->y;
$oStage->update( $aFields );
break;
case 'deleteStage':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->stg_uid );
$oStage->remove( $oData->stg_uid );
$oStage->reorderPositions( $aFields['PRO_UID'], $aFields['STG_INDEX'] );
require_once 'classes/model/Task.php';
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( TaskPeer::STG_UID, $oData->stg_uid );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( TaskPeer::STG_UID, '' );
BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
break;
case 'editStage':
require_once 'classes/model/Stage.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->stg_uid );
$aFields['THEINDEX'] = $oData->theindex;
$aFields['action'] = 'updateStage';
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_StageEdit', '', $aFields, '../tracker/tracker_Ajax' );
G::RenderPage( 'publish', 'raw' );
break;
case 'updateStage':
require_once 'classes/model/Stage.php';
$oStage = new Stage();
$aFields = $oStage->load( $_POST['form']['STG_UID'] );
$aFields['STG_TITLE'] = $_POST['form']['STG_TITLE'];
$oStage->update( $aFields );
break;
case 'tasksAssigned':
require_once 'classes/model/Stage.php';
require_once 'classes/model/Task.php';
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
$oCriteria->add( TaskPeer::STG_UID, $oData->stg_uid );
$oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_StageTasks', $oCriteria, array ('PRO_UID' => $oData->pro_uid,'STG_UID' => $oData->stg_uid) );
G::RenderPage( 'publish', 'raw' );
break;
case 'availableTasksForTheStage':
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
$oCriteria->add( TaskPeer::PRO_UID, $_POST['PRO_UID'] );
$oCriteria->add( TaskPeer::STG_UID, '' );
$oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_AvailableStageTasks', $oCriteria, array ('STG_UID' => $_POST['STG_UID']) );
G::RenderPage( 'publish', 'raw' );
break;
case 'assignTaskToStage':
require_once 'classes/model/Task.php';
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( TaskPeer::STG_UID, $_POST['STG_UID'] );
BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
break;
case 'removeTaskFromTheStage':
require_once 'classes/model/Task.php';
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( TaskPeer::STG_UID, '' );
BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
break;
case "processMapLegend":
$arrayField = array ();
$arrayField["sLabel1"] = G::LoadTranslation( "ID_TASK_IN_PROGRESS" );
$arrayField["sLabel2"] = G::LoadTranslation( "ID_COMPLETED_TASK" );
$arrayField["sLabel3"] = G::LoadTranslation( "ID_PENDING_TASK" );
$arrayField["sLabel4"] = G::LoadTranslation( "ID_PARALLEL_TASK" );
$arrayField["tracker"] = 1;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( "smarty", "cases/cases_Leyends", "", "", $arrayField );
G::RenderPage( "publish", "raw" );
break;
}
} catch (Exception $oException) {
$token = strtotime("now");
PMException::registerErrorLog($oException, $token);
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
die;
}

View File

@@ -11,6 +11,7 @@
$this->sSetupPage = 'setupPage';
$this->aWorkspaces = array ( );
$this->iVersion = 0.45;
$this->bPrivate = true;
return $res;
}

View File

@@ -7,6 +7,8 @@
* @author Hugo Loza
*/
use ProcessMaker\Plugins\PluginRegistry;
define('SE_LAYOUT_NOT_FOUND', 6);
class SkinEngine
@@ -449,8 +451,8 @@ class SkinEngine
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html');
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html');
if (class_exists('PMPluginRegistry')) {
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
$oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
}
else {
@@ -533,8 +535,8 @@ class SkinEngine
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html' );
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html' );
if (class_exists('PMPluginRegistry')) {
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
$oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo ( '/images/processmaker.logo.jpg' );
}
else
@@ -790,8 +792,8 @@ class SkinEngine
$sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']);
}
}
if (class_exists('PMPluginRegistry')) {
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined("SYS_SYS")) {
$oPluginRegistry = PluginRegistry::loadSingleton();
if ( isset($sFotoSelect) && $sFotoSelect!='' && !(strcmp($sWspaceSelect, SYS_SYS)) ){
$sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect);
$sCompanyLogo = "/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/setup/showLogoFile.php?id=".base64_encode($sCompanyLogo);

View File

@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
use ProcessMaker\Plugins\PluginRegistry;
/**
* Description of ActionsByEmailService
*
@@ -688,7 +690,7 @@ class ActionsByEmail
/*----------------------------------********---------------------------------*/
if (defined('PM_SINGLE_SIGN_ON')) {
$pluginRegistry = &\PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_SINGLE_SIGN_ON)) {
if ($pluginRegistry->executeTriggers(PM_SINGLE_SIGN_ON, null)) {

View File

@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
use \G;
use ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin;
use ProcessMaker\Plugins\PluginRegistry;
class CaseScheduler
{
@@ -1115,13 +1117,13 @@ class CaseScheduler
//Plugin
if (isset($arrayData["CASE_SH_PLUGIN_UID"]) && $arrayData["CASE_SH_PLUGIN_UID"] != "") {
$oPluginRegistry = &\PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
$params = explode("--", $arrayData["CASE_SH_PLUGIN_UID"]);
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
if ($caseSchedulerPluginDetail->sNamespace == $params[0] && $caseSchedulerPluginDetail->sActionId == $params[1]) {
/** @var CaseSchedulerPlugin $caseSchedulerPluginDetail */
foreach ($activePluginsForCaseScheduler as $caseSchedulerPluginDetail) {
if ($caseSchedulerPluginDetail->equalNamespaceTo($params[0]) && $caseSchedulerPluginDetail->equalActionIdTo($params[1])) {
$caseSchedulerSelected = $caseSchedulerPluginDetail;
}
}
@@ -1129,7 +1131,7 @@ class CaseScheduler
if (isset($caseSchedulerSelected) && is_object($caseSchedulerSelected)) {
//Save the form
$arrayDataPlugin["SCH_UID"] = $arrayCaseSchedulerData["SCH_UID"];
$oPluginRegistry->executeMethod($caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $arrayDataPlugin);
$oPluginRegistry->executeMethod($caseSchedulerPluginDetail->getNamespace(), $caseSchedulerPluginDetail->getActionSave(), $arrayDataPlugin);
}
}
} catch (\Exception $e) {

View File

@@ -5,6 +5,7 @@ use G;
use UsersPeer;
use CasesPeer;
use AppDelegation;
use ProcessMaker\Plugins\PluginRegistry;
use Exception;
use wsBase;
use RBAC;
@@ -1108,12 +1109,11 @@ class Cases
$cases = new \cases();
$listing = false;
$oPluginRegistry = & \PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new \folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "INPUT";
$folderData->returnList = true;
//$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
$aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);
@@ -1406,12 +1406,11 @@ class Cases
$cases = new \cases();
$listing = false;
$oPluginRegistry = & \PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new \folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "OUTPUT";
$folderData->returnList = true;
//$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
$aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);

View File

@@ -1,6 +1,8 @@
<?php
namespace ProcessMaker\BusinessModel\Cases;
use ProcessMaker\Plugins\PluginRegistry;
class InputDocument
{
/**
@@ -1006,7 +1008,7 @@ class InputDocument
$caseInstance->updateCase($appUid, $aData);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &\PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
@@ -1014,7 +1016,7 @@ class InputDocument
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
if (!isset($aFields["APP_DOC_UID"])) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
}

View File

@@ -1,6 +1,8 @@
<?php
namespace ProcessMaker\BusinessModel\Cases;
use ProcessMaker\Plugins\PluginRegistry;
class OutputDocument
{
/**
@@ -200,7 +202,6 @@ class OutputDocument
public function getCasesOutputDocuments($applicationUid, $userUid)
{
try {
$oCase = new \Cases();
$fields = $oCase->loadCase( $applicationUid );
$sProcessUID = $fields['PRO_UID'];
@@ -244,7 +245,6 @@ class OutputDocument
try {
$sApplicationUID = $applicationUid;
$sUserUID = $userUid;
$oCase = new \Cases();
$fields = $oCase->loadCase( $sApplicationUID );
$sProcessUID = $fields['PRO_UID'];
@@ -442,7 +442,6 @@ class OutputDocument
$outputID = $outputDocumentUid;
$g = new \G();
$g->sessionVarSave();
$oCase = new \Cases();
$oCase->thisIsTheCurrentUser( $sApplication, $index, $sUserLogged, '', 'casesListExtJs' );
//require_once 'classes/model/OutputDocument.php';
@@ -526,11 +525,10 @@ class OutputDocument
$this->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties , $applicationUid);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & \PMPluginRegistry::getSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->getNamespace();
$oAppDocument1 = new \AppDocument();
$oAppDocument1->update( $aFields );
$sPathName = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP;

View File

@@ -1,6 +1,8 @@
<?php
namespace ProcessMaker\BusinessModel\Migrator;
use ProcessMaker\Plugins\PluginRegistry;
class ExportObjects
{
/**
@@ -78,7 +80,7 @@ class ExportObjects
public function processMigrablePlugins()
{
$plugins = array();
$registry = \PMPluginRegistry::getSingleton();
$registry = PluginRegistry::loadSingleton();
$data = $registry->getPluginsData();
foreach ($data as $detail) {
$detail = (array)$detail;

View File

@@ -1,6 +1,8 @@
<?php
namespace ProcessMaker\BusinessModel\Migrator;
use ProcessMaker\Plugins\PluginRegistry;
/**
* Class PluginMigratorAdapter
* @package ProcessMaker\BusinessModel\Migrator
@@ -15,7 +17,7 @@ class PluginMigratorAdapter implements Exportable, Importable
*/
public function __construct($pluginName)
{
$registry = \PMPluginRegistry::getSingleton();
$registry = PluginRegistry::loadSingleton();
$plugin = $registry->getPluginByCode($pluginName);
require_once (
PATH_PLUGINS.PATH_SEP.

View File

@@ -795,16 +795,6 @@ class Process
switch ($option) {
case "CREATE":
$processUid = $process->create($arrayProcessData, false);
//Call plugins
//$arrayData = array(
// "PRO_UID" => $processUid,
// "PRO_TEMPLATE" => (isset($arrayProcessData["PRO_TEMPLATE"]) && $arrayProcessData["PRO_TEMPLATE"] != "")? $arrayProcessData["PRO_TEMPLATE"] : "",
// "PROCESSMAP" => $this //?
//);
//
//$oPluginRegistry = &PMPluginRegistry::getSingleton();
//$oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $arrayData);
break;
case "UPDATE":
$result = $process->update($arrayProcessData);

View File

@@ -1,6 +1,9 @@
<?php
namespace ProcessMaker\BusinessModel;
use ProcessMaker\Plugins\Interfaces\StepDetail;
use ProcessMaker\Plugins\PluginRegistry;
class Step
{
private $formatFieldNameInUppercase = true;
@@ -528,7 +531,7 @@ class Step
//Get data
//Call plugin
$pluginRegistry = &\PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$externalSteps = $pluginRegistry->getSteps();
$criteria = new \Criteria("workflow");
@@ -579,9 +582,10 @@ class Step
$titleObj = "unknown " . $row["STEP_UID"];
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $value) {
if ($value->sStepId == $row["STEP_UID_OBJ"]) {
$titleObj = $value->sStepTitle;
/** @var StepDetail $value */
foreach ($externalSteps as $value) {
if ($value->equalStepIdTo($row["STEP_UID_OBJ"])) {
$titleObj = $value->getStepTitle();
}
}
}

View File

@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
use \G;
use ProcessMaker\Plugins\Interfaces\StepDetail;
use ProcessMaker\Plugins\PluginRegistry;
use \ProcessMaker\Util;
class Task
@@ -627,14 +629,15 @@ class Task
}
//Call plugin
$pluginRegistry = &\PMPluginRegistry::getSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
$externalSteps = $pluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $value) {
/** @var StepDetail $value */
foreach ($externalSteps as $value) {
$arraydbStep[] = array(
$this->getFieldNameByFormatFieldName("OBJ_UID") => $value->sStepId,
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $value->sStepTitle,
$this->getFieldNameByFormatFieldName("OBJ_UID") => $value->getStepId(),
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $value->getStepTitle(),
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => "",
$this->getFieldNameByFormatFieldName("OBJ_TYPE") => "EXTERNAL"
);

View File

@@ -22,7 +22,7 @@ use IsoLocationPeer;
use IsoSubdivisionPeer;
use ListParticipatedLast;
use PMmemcached;
use PMPluginRegistry;
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Util\DateTime;
use ProcessMaker\Util\System;
use Propel;
@@ -869,8 +869,8 @@ class User
public function createUser($userData)
{
$this->userObj = new RbacUsers();
if (class_exists('PMPluginRegistry')) {
$pluginRegistry = &PMPluginRegistry::getSingleton();
if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
$pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {
try {
$pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null);

View File

@@ -0,0 +1,241 @@
<?php
namespace ProcessMaker\Plugins\Adapters;
use G;
use PluginsRegistry;
use PMPluginRegistry;
/**
* Adapts the plugin singleton file and converts it to table
* Class PluginAdapter
* @package ProcessMaker\Plugins\Adapters
*/
class PluginAdapter
{
/**
* This array is a map to change the old key to the new, corresponding of each class
* @var array
*/
private $keyNames = [
'sNamespace' => 'Namespace',
//MenuDetail
'sMenuId' => 'MenuId',
'sFilename' => 'Filename',
//FolderDetail
'sFolderId' => 'FolderId',
'sFolderName' => 'FolderName',
//TriggerDetail
'sTriggerId' => 'TriggerId',
'sTriggerName' => 'TriggerName',
//RedirectDetail
'sRoleCode' => 'RoleCode',
'sPathMethod' => 'PathMethod',
//StepDetail
'sStepId' => 'StepId',
'sStepName' => 'StepName',
'sStepTitle' => 'StepTitle',
'sSetupStepPage' => 'SetupStepPage',
//CssFile->_aCSSStyleSheets
'sCssFile' => 'CssFile',
//ToolbarDetail->_aToolbarFiles
'sToolbarId' => 'ToolbarId',
//CaseSchedulerPlugin->_aCaseSchedulerPlugin
'sActionId' => 'ActionId',
'sActionForm' => 'ActionForm',
'sActionSave' => 'ActionSave',
'sActionExecute' => 'ActionExecute',
'sActionGetFields' => 'ActionGetFields',
//TaskExtendedProperty->_aTaskExtendedProperties
//DashboardPage->_aDashboardPages
'sPage' => 'Page',
'sName' => 'Name',
'sIcon' => 'Icon',
//CronFile->_aCronFiles
'namespace' => 'Namespace',
'cronFile' => 'CronFile',
//ImportCallBack->_aImportProcessCallbackFile
//OpenReassignCallback->_aOpenReassignCallback
'callBackFile' => 'CallBackFile',
//JsFile->_aJavascripts
'sCoreJsFile' => 'CoreJsFile',
'pluginJsFile' => 'PluginJsFile',
];
/**
* Map the fields of the table with their type
* @var array $attributes
*/
private $attributes = [
'sNamespace' => ['name' => 'PLUGIN_NAMESPACE', 'type' => 'string'],
'sDescription' => ['name' => 'PLUGIN_DESCRIPTION', 'type' => 'string'],
'sClassName' => ['name' => 'PLUGIN_CLASS_NAME', 'type' => 'string'],
'sFriendlyName' => ['name' => 'PLUGIN_FRIENDLY_NAME', 'type' => 'string'],
'sFilename' => ['name' => 'PLUGIN_FILE', 'type' => 'string'],
'sPluginFolder' => ['name' => 'PLUGIN_FOLDER', 'type' => 'string'],
'sSetupPage' => ['name' => 'PLUGIN_SETUP_PAGE', 'type' => 'string'],
'aWorkspaces' => ['name' => 'PLUGIN_WORKSPACES', 'type' => 'array'],
'sCompanyLogo' => ['name' => 'PLUGIN_COMPANY_LOGO', 'type' => 'string'],
'iVersion' => ['name' => 'PLUGIN_VERSION', 'type' => 'int'],
'enabled' => ['name' => 'PLUGIN_ENABLE', 'type' => 'bool'],
'bPrivate' => ['name' => 'PLUGIN_PRIVATE', 'type' => 'bool'],
'_aMenus' => ['name' => 'PLUGIN_MENUS', 'type' => 'array'],
'_aFolders' => ['name' => 'PLUGIN_FOLDERS', 'type' => 'array'],
'_aTriggers' => ['name' => 'PLUGIN_TRIGGERS', 'type' => 'array'],
'_aPmFunctions' => ['name' => 'PLUGIN_PM_FUNCTIONS', 'type' => 'array'],
'_aRedirectLogin' => ['name' => 'PLUGIN_REDIRECT_LOGIN', 'type' => 'array'],
'_aSteps' => ['name' => 'PLUGIN_STEPS', 'type' => 'array'],
'_aCSSStyleSheets' => ['name' => 'PLUGIN_CSS', 'type' => 'array'],
'_aCss' => ['name' => 'PLUGIN_CSS', 'type' => 'array'],
'_aJavascripts' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
'_aJs' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
'_restServices' => ['name' => 'PLUGIN_REST_SERVICE', 'type' => 'array'],
];
/**
* Data of the plugin singleton in array structure
* @var array $PMPluginRegistry
*/
private $PMPluginRegistry;
/**
* Returns the structure of the table in attributes
* @return array
*/
public function getAttributes()
{
return $this->attributes;
}
/**
* Migrate the singleton plugin to tables
* @param PMPluginRegistry $PMPluginsSingleton
*/
public function migrate($PMPluginsSingleton)
{
$this->PMPluginRegistry = G::json_decode(G::json_encode($PMPluginsSingleton->getAttributes()), true);
$this->parserNameKey();
foreach ($this->PMPluginRegistry['_aPluginDetails'] as $nameSpace => $value) {
$this->saveInTable($nameSpace, $this->PMPluginRegistry);
}
}
/**
* Change to new key property $keyNames
* @return mixed
*/
private function parserNameKey()
{
$aPluginDetails = $this->PMPluginRegistry['_aPluginDetails'];
unset($this->PMPluginRegistry['_aPluginDetails']);
$aPlugins = $this->PMPluginRegistry['_aPlugins'];
unset($this->PMPluginRegistry['_aPlugins']);
foreach ($this->PMPluginRegistry as $propertyKey => $propertyValue) {
foreach ($propertyValue as $attKey => $attributes) {
if (is_array($attributes)) {
foreach ($attributes as $index => $attribute) {
if (array_key_exists($index, $this->keyNames)) {
$newKey = $this->keyNames[$index];
$value = $this->PMPluginRegistry[$propertyKey][$attKey][$index];
$this->PMPluginRegistry[$propertyKey][$attKey][$newKey] = $value;
unset($this->PMPluginRegistry[$propertyKey][$attKey][$index]);
}
}
}
}
}
$this->PMPluginRegistry['_aPluginDetails'] = $aPluginDetails;
$this->PMPluginRegistry['_aPlugins'] = $aPlugins;
return $this->PMPluginRegistry;
}
/**
* Save plugin in table PLUGINS_REGISTRY
* @param string $Namespace Name of plugin
* @param array $PMPluginRegistry
*/
public function saveInTable($Namespace, $PMPluginRegistry)
{
$newStructurePlugin = $this->getAllAttributes($Namespace, $PMPluginRegistry);
$plugin = $this->convertFieldTable($newStructurePlugin);
if ($plugin['PLUGIN_NAMESPACE'] && $plugin['PLUGIN_CLASS_NAME'] && $plugin['PLUGIN_FILE']) {
$fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
PluginsRegistry::update($fieldPlugin);
}
}
/**
* Extracts all attributes corresponding to a plugin
* @param string $Namespace Name Plugin
* @param array $PMPluginRegistry
* @return array
*/
private function getAllAttributes($Namespace, $PMPluginRegistry)
{
$PluginDetails = $PMPluginRegistry['_aPluginDetails'][$Namespace];
unset($PMPluginRegistry['_aPluginDetails']);
$Plugin = isset($PMPluginRegistry['_aPlugins'][$Namespace]) ? $PMPluginRegistry['_aPlugins'][$Namespace] : [];
unset($PMPluginRegistry['_aPlugins']);
$newStructurePlugin = array_merge($PluginDetails, $Plugin);
foreach ($PMPluginRegistry as $propertyName => $propertyValue) {
foreach ($propertyValue as $key => $plugin) {
if (is_array($plugin) &&
(array_key_exists('Namespace', $plugin) && $plugin['Namespace'] == $Namespace)
) {
$newStructurePlugin[$propertyName][] = $plugin;
} elseif (is_array($plugin) &&
array_key_exists('pluginName', $plugin) &&
$plugin['pluginName'] == $Namespace
) {
$newStructurePlugin[$propertyName][] = $plugin;
} elseif (!is_int($key) && $key == $Namespace) {
$newStructurePlugin[$propertyName][$key] = $plugin;
} elseif (is_string($plugin) && $plugin == $Namespace) {
$newStructurePlugin[$propertyName][] = $plugin;
}
}
}
return $newStructurePlugin;
}
/**
* Convert de attributes to field of table PLUGINS_REGISTRY
* @param array $plugin
* @return array
*/
private function convertFieldTable($plugin)
{
$fields = [];
$extraAttributes = array_diff_key($plugin, $this->attributes);
$fieldsInTable = array_intersect_key($plugin, $this->attributes);
foreach ($this->attributes as $name => $property) {
switch ($property['type']) {
case 'string':
$valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : '';
break;
case 'array':
$valueField = (array_key_exists($name, $fieldsInTable) && $fieldsInTable[$name]) ?
$fieldsInTable[$name] :
[];
$valueField = G::json_encode($valueField);
break;
case 'int':
$valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : 0;
break;
case 'bool':
$valueField = array_key_exists($name, $fieldsInTable) ?
($fieldsInTable[$name] ? true : false) :
false;
break;
default:
$valueField = array_key_exists($name, $fieldsInTable) ?
$fieldsInTable[$name] :
[];
break;
}
$fields[$property['name']] = $valueField;
}
$fields['PLUGIN_ATTRIBUTES'] = G::json_encode($extraAttributes);
return $fields;
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class CaseSchedulerPlugin
* @package ProcessMaker\Plugins\Interfaces
*/
class CaseSchedulerPlugin
{
use Attributes;
private $Namespace;
private $ActionId;
private $ActionForm;
private $ActionSave;
private $ActionExecute;
private $ActionGetFields;
/**
* This function is the constructor of the CaseSchedulerPlugin class
* @param string $Namespace
* @param string $ActionId
* @param string $ActionForm
* @param string $ActionSave
* @param string $ActionExecute
* @param string $ActionGetFields
*/
public function __construct($Namespace, $ActionId, $ActionForm, $ActionSave, $ActionExecute, $ActionGetFields)
{
$this->Namespace = $Namespace;
$this->ActionId = $ActionId;
$this->ActionForm = $ActionForm;
$this->ActionSave = $ActionSave;
$this->ActionExecute = $ActionExecute;
$this->ActionGetFields = $ActionGetFields;
}
/**
* Get name of plugin
* @return string
*/
public function getNamespace()
{
return $this->Namespace;
}
/**
* Get action Id
* @return string
*/
public function getActionId()
{
return $this->ActionId;
}
/**
* Get action form
* @return string
*/
public function getActionForm()
{
return $this->ActionForm;
}
/**
* Get action Save
* @return string
*/
public function getActionSave()
{
return $this->ActionSave;
}
/**
* Get action execute
* @return string
*/
public function getActionExecute()
{
return $this->ActionExecute;
}
/**
* Get action fields
* @return string
*/
public function getActionGetFields()
{
return $this->ActionGetFields;
}
/**
* Check if CaseSchedulerPlugin name of plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
/**
* Check if CaseSchedulerPlugin Action Id is equal to params
* @param string $ActionId
* @return bool
*/
public function equalActionIdTo($ActionId)
{
return $ActionId == $this->ActionId;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class CronFile
* @package ProcessMaker\Plugins\Interfaces
*/
class CronFile
{
use Attributes;
private $Namespace;
private $CronFile;
/**
* This function is the constructor of the CronFile class
* @param string $Namespace
* @param string $CronFile
*/
public function __construct($Namespace, $CronFile)
{
$this->Namespace = $Namespace;
$this->CronFile = $CronFile;
}
/**
* Set value to cron file
* @param string $CronFile
*/
public function setCronFile($CronFile)
{
$this->CronFile = $CronFile;
}
/**
* Check if name of plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
/**
* Check if cron file is equal to params
* @param string $CronFile
* @return bool
*/
public function equalCronFileTo($CronFile)
{
return $CronFile == $this->CronFile;
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class CssFile
* @package ProcessMaker\Plugins\Interfaces
*/
class CssFile
{
use Attributes;
private $Namespace;
private $CssFile;
/**
* This function is the constructor of the CssFile class
* @param string $Namespace
* @param string $CssFile
*/
public function __construct($Namespace, $CssFile)
{
$this->Namespace = $Namespace;
$this->CssFile = $CssFile;
}
/**
* Get css file
* @return string
*/
public function getCssFile()
{
return $this->CssFile;
}
/**
* Set css file
* @param string $CssFile
*/
public function setCssFile($CssFile)
{
$this->CssFile = $CssFile;
}
/**
* Check if css file is equal to params
* @param string $CssFile
* @return bool
*/
public function equalCssFileTo($CssFile)
{
return $CssFile == $this->CssFile;
}
/**
* Check if name plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
}

View File

@@ -0,0 +1,126 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class DashboardPage
* @package ProcessMaker\Plugins\Interfaces
*/
class DashboardPage
{
use Attributes;
private $Namespace;
private $Page;
private $Name;
private $Icon;
/**
* This function is the constructor of the DashboardPage class
* @param string $Namespace
* @param string $Page
* @param string $Name
* @param string $Icon
*/
public function __construct($Namespace, $Page, $Name, $Icon)
{
$this->Namespace = $Namespace;
$this->Page = $Page;
$this->Name = $Name;
$this->Icon = $Icon;
}
/**
* Get name of plugin
* @return string
*/
public function getNamespace()
{
return $this->Namespace;
}
/**
* Set name of plugin
* @param string $Namespace
*/
public function setNamespace($Namespace)
{
$this->Namespace = $Namespace;
}
/**
* Get page of Dashboard
* @return string
*/
public function getPage()
{
return $this->Page;
}
/**
* Set page of Dashboard
* @param string $Page
*/
public function setPage($Page)
{
$this->Page = $Page;
}
/**
* Get name of Dashboard
* @return string
*/
public function getName()
{
return $this->Name;
}
/**
* Set name of Dashboard
* @param string $Name
*/
public function setName($Name)
{
$this->Name = $Name;
}
/**
* Get icon of Dashboard
* @return string
*/
public function getIcon()
{
return $this->Icon;
}
/**
* Set icon of Dashboard
* @param string $Icon
*/
public function setIcon($Icon)
{
$this->Icon = $Icon;
}
/**
* Check if name plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
/**
* Check if dashboard page is equal to params
* @param string $Page
* @return bool
*/
public function equalPageTo($Page)
{
return $Page == $this->Page;
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class FolderDetail
* @package ProcessMaker\Plugins\Interfaces
*/
class FolderDetail
{
use Attributes;
private $Namespace;
private $FolderId;
private $FolderName;
/**
* This function is the constructor of the FolderDetail class
* @param string $Namespace
* @param string $FolderId
* @param string $FolderName
*/
public function __construct($Namespace, $FolderId, $FolderName)
{
$this->Namespace = $Namespace;
$this->FolderId = $FolderId;
$this->FolderName = $FolderName;
}
/**
* Get folder name
* @return string
*/
public function getFolderName()
{
return $this->FolderName;
}
/**
* Set folder name
* @param string $FolderName
*/
public function setFolderName($FolderName)
{
$this->FolderName = $FolderName;
}
/**
* Get name of plugin
* @return string
*/
public function getNamespace()
{
return $this->Namespace;
}
/**
* Set name of plugin
* @param string $Namespace
*/
public function setNamespace($Namespace)
{
$this->Namespace = $Namespace;
}
/**
* Check if folder id is equal to params
* @param string $folderId
* @return bool
*/
public function equalFolderIdTo($folderId)
{
return $folderId == $this->FolderId;
}
/**
* Check if name plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
class ImportCallBack
{
use Attributes;
private $Namespace;
private $CallBackFile;
/**
* This function is the constructor of the ImportCallBack class
* @param string $Namespace
* @param string $CallBackFile
*/
public function __construct($Namespace, $CallBackFile)
{
$this->Namespace = $Namespace;
$this->CallBackFile = $CallBackFile;
}
/**
* Get name of plugin
* @return string
*/
public function getNamespace()
{
return $this->Namespace;
}
/**
* Set name of plugin
* @param string $Namespace
*/
public function setNamespace($Namespace)
{
$this->Namespace = $Namespace;
}
/**
* Get callback file
* @return string
*/
public function getCallBackFile()
{
return $this->CallBackFile;
}
/**
* Set callback file
* @param string $CallBackFile
*/
public function setCallBackFile($CallBackFile)
{
$this->CallBackFile = $CallBackFile;
}
/**
* Check if name of plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
/**
* Check if callback file is equal to params
* @param string $CallBackFile
* @return bool
*/
public function equalCallBackFileTo($CallBackFile)
{
return $CallBackFile == $this->CallBackFile;
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use Exception;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class JsFile
* @package ProcessMaker\Plugins\Interfaces
*/
class JsFile
{
use Attributes;
private $Namespace;
private $CoreJsFile;
private $PluginJsFile;
/**
* This function is the constructor of the JsFile class
* @param string $Namespace
* @param string $CoreJsFile
* @param array $PluginJsFile
*/
public function __construct($Namespace, $CoreJsFile, $PluginJsFile)
{
$this->Namespace = $Namespace;
$this->CoreJsFile = $CoreJsFile;
$this->PluginJsFile = $PluginJsFile;
}
/**
* Get js files
* @return array
*/
public function getPluginJsFile()
{
return $this->PluginJsFile;
}
/**
* Check if core js file is equal to params
* @param string $CoreJsFile
* @return bool
*/
public function equalCoreJsFile($CoreJsFile)
{
return $CoreJsFile == $this->CoreJsFile;
}
/**
* Check if name of plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
/**
* Push one or more elements onto the PluginJsFile
* @param string|array $PluginJsFile
* @throws Exception
*/
public function pushPluginJsFile($PluginJsFile)
{
if (is_string($PluginJsFile)) {
if (!in_array($PluginJsFile, $this->PluginJsFile)) {
$this->PluginJsFile[] = $PluginJsFile;
}
} elseif (is_array($PluginJsFile)) {
$this->PluginJsFile = array_unique(
array_merge($PluginJsFile, $this->PluginJsFile)
);
} else {
throw new Exception(
'Invalid third param, $pluginJsFile should be a string or array - ' .
gettype($PluginJsFile) .
' given.'
);
}
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class MenuDetail
* @package ProcessMaker\Plugins\Interfaces
*/
class MenuDetail
{
use Attributes;
private $Namespace;
private $MenuId;
private $Filename;
/**
* This function is the constructor of the MenuDetail class
* @param string $Namespace
* @param string $MenuId
* @param string $Filename
*/
public function __construct($Namespace, $MenuId, $Filename)
{
$this->Namespace = $Namespace;
$this->MenuId = $MenuId;
$this->Filename = $Filename;
}
/**
* Check if menu id is equal to params
* @param string $menuId
* @return bool
*/
public function equalMenuIdTo($menuId)
{
return $menuId == $this->MenuId;
}
/**
* Check if nmae of plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
/**
* Check if file exists
* @return bool
*/
public function exitsFile()
{
return file_exists($this->Filename);
}
/**
* Include file
* @return bool
*/
public function includeFileMenu()
{
include($this->Filename);
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class OpenReassignCallback
* @package ProcessMaker\Plugins\Interfaces
*/
class OpenReassignCallback
{
use Attributes;
private $CallBackFile;
/**
* This function is the constructor of the OpenReassignCallback class
* @param string $CallBackFile
*/
public function __construct($CallBackFile)
{
$this->CallBackFile = $CallBackFile;
}
/**
* Get callback file
* @return string
*/
public function getCallBackFile()
{
return $this->CallBackFile;
}
/**
* Set callback file
* @param string $CallBackFile
*/
public function setCallBackFile($CallBackFile)
{
$this->CallBackFile = $CallBackFile;
}
/**
* Check if callback file is equal to params
* @param string $CallBackFile
* @return bool
*/
public function equalCallBackFileTo($CallBackFile)
{
return $CallBackFile == $this->CallBackFile;
}
}

View File

@@ -0,0 +1,301 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class PluginDetail
* @package ProcessMaker\Plugins\Interfaces
*/
class PluginDetail
{
use Attributes;
/** @var string */
public $sNamespace;
/** @var string */
public $sDescription = '';
/** @var string */
public $sClassName;
/** @var string */
public $sFriendlyName = '';
/** @var string */
public $sFilename;
/** @var string */
public $sPluginFolder = '';
/** @var string */
public $sSetupPage = '';
/** @var string */
public $sCompanyLogo = '';
/** @var array */
public $aWorkspaces = [];
/** @var bool */
public $enabled = false;
/** @var bool */
public $bPrivate = false;
/** @var int */
public $iVersion = 0;
/**
* This function is the constructor of the pluginDetail class
* @param string $sNamespace
* @param string $sClassName
* @param string $sFilename
* @param string $sFriendlyName
* @param string $sPluginFolder
* @param string $sDescription
* @param string $sSetupPage
* @param string $sCompanyLogo
* @param array $aWorkspaces
* @param bool $enable
* @param bool $bPrivate
* @param integer $iVersion
*/
public function __construct(
$sNamespace,
$sClassName,
$sFilename,
$sFriendlyName = '',
$sPluginFolder = '',
$sDescription = '',
$sSetupPage = '',
$iVersion = 0,
$sCompanyLogo = '',
$aWorkspaces = [],
$enable = false,
$bPrivate = false
) {
$this->sNamespace = $sNamespace;
$this->sDescription = $sDescription;
$this->sClassName = $sClassName;
$this->sFriendlyName = $sFriendlyName;
$this->sFilename = $sFilename;
$this->sPluginFolder = $sNamespace;
if ($sPluginFolder) {
$this->sPluginFolder = $sPluginFolder;
}
$this->sSetupPage = $sSetupPage;
$this->sCompanyLogo = $sCompanyLogo;
$this->aWorkspaces = $aWorkspaces;
$this->enabled = $enable;
$this->bPrivate = $bPrivate;
$this->iVersion = $iVersion;
}
/**
* Get name of plugin
* @return string
*/
public function getNamespace()
{
return $this->sNamespace;
}
/**
* Set name of plugin
* @param string $PluginNamespace
*/
public function setNamespace($PluginNamespace)
{
$this->sNamespace = $PluginNamespace;
}
/**
* Get description
* @return string
*/
public function getDescription()
{
return $this->sDescription;
}
/**
* Set description
* @param string $PluginDescription
*/
public function setDescription($PluginDescription)
{
$this->sDescription = $PluginDescription;
}
/**
* Get class name
* @return string
*/
public function getClassName()
{
return $this->sClassName;
}
/**
* Set class name
* @param string $PluginClassName
*/
public function setClassName($PluginClassName)
{
$this->sClassName = $PluginClassName;
}
/**
* Get friendly name
* @return string
*/
public function getFriendlyName()
{
return $this->sFriendlyName;
}
/**
* Set friendly name
* @param string $PluginFriendlyName
*/
public function setFriendlyName($PluginFriendlyName)
{
$this->sFriendlyName = $PluginFriendlyName;
}
/**
* Get path file
* @return string
*/
public function getFile()
{
return $this->sFilename;
}
/**
* Set path file
* @param string $PluginFile
*/
public function setFile($PluginFile)
{
$this->sFilename = $PluginFile;
}
/**
* Get name folder
* @return string
*/
public function getFolder()
{
return $this->sPluginFolder;
}
/**
* Set name folder
* @param string $PluginFolder
*/
public function setFolder($PluginFolder)
{
$this->sPluginFolder = $PluginFolder;
}
/**
* Get setup page
* @return string
*/
public function getSetupPage()
{
return $this->sSetupPage;
}
/**
* Set setup page
* @param string $PluginSetupPage
*/
public function setSetupPage($PluginSetupPage)
{
$this->sSetupPage = $PluginSetupPage;
}
/**
* Get company logo
* @return string
*/
public function getCompanyLogo()
{
return $this->sCompanyLogo;
}
/**
* Set company logo
* @param string $PluginCompanyLogo
*/
public function setCompanyLogo($PluginCompanyLogo)
{
$this->sCompanyLogo = $PluginCompanyLogo;
}
/**
* Get workspace allowed
* @return array
*/
public function getWorkspaces()
{
return $this->aWorkspaces;
}
/**
* Set workspace allowed
* @param array $PluginWorkspaces
*/
public function setWorkspaces($PluginWorkspaces)
{
$this->aWorkspaces = $PluginWorkspaces;
}
/**
* Get plugin is enable
* @return bool
*/
public function isEnabled()
{
return $this->enabled;
}
/**
* Set status plugin
* @param bool $PluginEnable
*/
public function setEnabled($PluginEnable)
{
$this->enabled = $PluginEnable;
}
/**
* Get if plugin is private
* @return bool
*/
public function isPrivate()
{
return $this->bPrivate;
}
/**
* Set status private
* @param bool $PluginPrivate
*/
public function setPrivate($PluginPrivate)
{
$this->bPrivate = $PluginPrivate;
}
/**
* Get version of plugin
* @return int
*/
public function getVersion()
{
return $this->iVersion;
}
/**
* Set version of plugin
* @param int $PluginVersion
*/
public function setVersion($PluginVersion)
{
$this->iVersion = $PluginVersion;
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class RedirectDetail
* @package ProcessMaker\Plugins\Interfaces
*/
class RedirectDetail
{
use Attributes;
private $Namespace;
private $RoleCode;
private $PathMethod;
/**
* This function is the constructor of the RedirectDetail class
* @param string $Namespace
* @param string $RoleCode
* @param string $PathMethod
*/
public function __construct($Namespace, $RoleCode, $PathMethod)
{
$this->Namespace = $Namespace;
$this->RoleCode = $RoleCode;
$this->PathMethod = $PathMethod;
}
/**
* Get name of plugin
* @return string
*/
public function getNamespace()
{
return $this->Namespace;
}
/**
* Get role code
* @return string
*/
public function getRoleCode()
{
return $this->RoleCode;
}
/**
* Get path method
* @return string
*/
public function getPathMethod()
{
return $this->PathMethod;
}
/**
* Check if name of plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
/**
* Check if role code is equal to params
* @param string $RoleCode
* @return bool
*/
public function equalRoleCodeTo($RoleCode)
{
return $RoleCode == $this->RoleCode;
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace ProcessMaker\Plugins\Interfaces;
use ProcessMaker\Plugins\Traits\Attributes;
/**
* Class StepDetail
* @package ProcessMaker\Plugins\Interfaces
*/
class StepDetail
{
use Attributes;
private $Namespace;
private $StepId;
private $StepName;
private $StepTitle;
private $SetupStepPage;
/**
* This function is the constructor of the StepDetail class
* @param string $Namespace
* @param string $StepId
* @param string $StepName
* @param string $StepTitle
* @param string $SetupStepPage
*/
public function __construct($Namespace, $StepId, $StepName, $StepTitle, $SetupStepPage)
{
$this->Namespace = $Namespace;
$this->StepId = $StepId;
$this->StepName = $StepName;
$this->StepTitle = $StepTitle;
$this->SetupStepPage = $SetupStepPage;
}
/**
* Get name of plugin
* @return string
*/
public function getNamespace()
{
return $this->Namespace;
}
/**
* Get step id
* @return string
*/
public function getStepId()
{
return $this->StepId;
}
/**
* Get step Title
* @return string
*/
public function getStepTitle()
{
return $this->StepTitle;
}
/**
* Get step name
* @return string
*/
public function getStepName()
{
return $this->StepName;
}
/**
* Get setup step page
* @return string
*/
public function getSetupStepPage()
{
return $this->SetupStepPage;
}
/**
* Check if step id is equal to params
* @param string $StepId
* @return bool
*/
public function equalStepIdTo($StepId)
{
return $StepId == $this->StepId;
}
/**
* Check if name of plugin is equal to params
* @param string $Namespace
* @return bool
*/
public function equalNamespaceTo($Namespace)
{
return $Namespace == $this->Namespace;
}
}

Some files were not shown because too many files have changed in this diff Show More