Files
luos/workflow/engine/methods/processes/mainInit.php
Victor Saisa Lopez e6ddb81319 PM-3193 "Prepare integration of new Valeo simplified designer in process list" SOLVED
Issue:
    Prepare integration of new Valeo simplified designer in process list
Cause:
    Nuevo requerimiento de funciones
Solution:
    > Se a implementado "DESIGNER: New options in menu" para los plugins; para lo cual se define
      en el archivo principal del plugin, lo siguiente (ejemplo):
          public function setup()
          {   ...
              $this->registerDesignerMenu(PATH_PLUGINS . "DemoDesignerMenu/classes/DesignerMenuDemoDesignerMenu.php");
              ...
          }
      El archivo "DesignerMenuDemoDesignerMenu.php" es una clase donde se define las nuevas opciones
      para el "Menu New" y "Context Menu"
    > Se a implementado "DESIGNER: Edit process" para los plugins; en el listado de procesos (esto en DESIGNER)
      al hacer doble-click en un proceso, se inicia el modulo para la edicion del proceso, esto tambien
      puede ser customizado en el plugin, para lo cual se debera realizar lo siguiente:
          - Cambiar en la Base de Datos el valor del campo PROCESS.PRO_TYPE por un nuevo tipo:
                * Ejemplo: PRO_TYPE = 'CPF_STANDARD_TPL'
          - Registrar un archivo JavaScript para el plugin, esto se define en el archivo principal del
            plugin (ejemplo):
                public function setup()
                {   ...
                    $this->registerJavascript("processes/main", "DemoDesignerMenu/MyJavaScript.js");
                    ...
                }
          - En el archivo "MyJavaScript.js" se debe definir la siguiente funcion:
                function CPF_STANDARD_TPLDesignerGridRowDblClick(...)
                {   ...
                }
          - Ejemplos de "PROCESS.PRO_TYPE" y la funcion "DesignerGridRowDblClick":
                * Ejemplo: PRO_TYPE = 'CPF-STANDARD-TPL' => function CPF_STANDARD_TPLDesignerGridRowDblClick(...)
                * Ejemplo: PRO_TYPE = 'CPF STANDARD TPL' => function CPF_STANDARD_TPLDesignerGridRowDblClick(...)
    > Se adjunta el plugin "DemoDesignerMenu-1.tar" como ejmplo
2015-09-21 10:18:44 -04:00

84 lines
3.4 KiB
PHP
Executable File

<?php
/**
* main.php Cases List main processor
*
* 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.
*/
//$oHeadPublisher = & headPublisher::getSingleton();
global $RBAC;
$RBAC->requirePermissions( 'PM_FACTORY' );
G::loadClass( 'configuration' );
$conf = new Configurations();
$pmVersion = (preg_match("/^([\d\.]+).*$/", System::getVersion(), $arrayMatch))? $arrayMatch[1] : ""; //Otherwise: Branch master
$arrayFlagImportFileExtension = array("pm", "pmx", "bpmn");
$arrayFlagMenuNewOption = array("pm" => true, "bpmn" => true);
if ($pmVersion != "") {
$arrayFlagImportFileExtension = (version_compare($pmVersion . "", "3", ">="))? $arrayFlagImportFileExtension : array("pm");
$arrayFlagMenuNewOption = (version_compare($pmVersion . "", "3", ">="))? array("bpmn" => true) : array("pm" => true);
}
$pluginRegistry = &PMPluginRegistry::getSingleton();
$arrayMenuNewOptionPlugin = array();
$arrayContextMenuOptionPlugin = array();
foreach ($pluginRegistry->getDesignerMenu() as $value) {
if (file_exists($value->file)) {
require_once($value->file);
$className = "DesignerMenu" . $value->pluginName;
if (class_exists($className)) {
$obj = new $className();
if (method_exists($obj, "getDesignerMenu")) {
$arrayDesignerMenuData = $obj->getDesignerMenu();
if (isset($arrayDesignerMenuData["MENU_NEW_OPTION"]) && is_array($arrayDesignerMenuData["MENU_NEW_OPTION"])) {
$arrayMenuNewOptionPlugin = array_merge($arrayMenuNewOptionPlugin, $arrayDesignerMenuData["MENU_NEW_OPTION"]);
}
if (isset($arrayDesignerMenuData["CONTEXT_MENU_OPTION"]) && is_array($arrayDesignerMenuData["CONTEXT_MENU_OPTION"])) {
$arrayContextMenuOptionPlugin = array_merge($arrayContextMenuOptionPlugin, $arrayDesignerMenuData["CONTEXT_MENU_OPTION"]);
}
}
}
}
}
$oHeadPublisher->addExtJsScript( 'processes/main', true ); //adding a javascript file .js
$oHeadPublisher->addContent( 'processes/main' ); //adding a html file .html.
$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false;
$oHeadPublisher->assign( 'PARTNER_FLAG', $partnerFlag );
$oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) );
$oHeadPublisher->assign("arrayFlagImportFileExtension", $arrayFlagImportFileExtension);
$oHeadPublisher->assign("arrayFlagMenuNewOption", $arrayFlagMenuNewOption);
$oHeadPublisher->assign("arrayMenuNewOptionPlugin", $arrayMenuNewOptionPlugin);
$oHeadPublisher->assign("arrayContextMenuOptionPlugin", $arrayContextMenuOptionPlugin);
G::RenderPage( 'publish', 'extJs' );