removing ProcessMaker Library #26

This commit is contained in:
Fernando Ontiveros
2025-04-08 14:56:55 +00:00
parent 6a4534efd3
commit 95174257f4
11 changed files with 1 additions and 450 deletions

View File

@@ -6081,202 +6081,6 @@ class Processes
return $oTask->getStartingTaskForUser($sProUid, $sUsrUid);
}
/**
* ***********************************************
* functions to enable open ProcessMaker Library
* ***********************************************
*/
/**
* Open a WebService connection
*
* @param $user username for pm
* @param $pass password for the user
* @return 1 integer.
*/
public function ws_open($user, $pass)
{
global $sessionId;
global $client;
$endpoint = PML_WSDL_URL;
$sessionId = '';
$proxy = array();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
if ($sysConf['proxy_port'] != '') {
$proxy['proxy_port'] = $sysConf['proxy_port'];
}
if ($sysConf['proxy_user'] != '') {
$proxy['proxy_login'] = $sysConf['proxy_user'];
}
if ($sysConf['proxy_pass'] != '') {
$proxy['proxy_password'] = $sysConf['proxy_pass'];
}
}
$client = new SoapClient($endpoint, $proxy);
$params = array('userid' => $user, 'password' => $pass
);
$result = $client->__SoapCall('login', array($params
));
if ($result->status_code == 0) {
$sessionId = $result->message;
return 1;
}
throw (new Exception($result->message));
return 1;
}
/**
* Open a WebService public connection
*
* @param $user username for pm
* @param $pass password for the user
* @return 1 integer.
*/
public function ws_open_public()
{
global $sessionId;
global $client;
$endpoint = PML_WSDL_URL;
$sessionId = '';
ini_set("soap.wsdl_cache_enabled", "0"); // enabling WSDL cache
try {
$proxy = array();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
if ($sysConf['proxy_port'] != '') {
$proxy['proxy_port'] = $sysConf['proxy_port'];
}
if ($sysConf['proxy_user'] != '') {
$proxy['proxy_login'] = $sysConf['proxy_user'];
}
if ($sysConf['proxy_pass'] != '') {
$proxy['proxy_password'] = $sysConf['proxy_pass'];
}
}
$client = @new SoapClient($endpoint, $proxy);
} catch (Exception $e) {
throw (new Exception($e->getMessage()));
}
return 1;
}
/**
* Consume the processList WebService
*
* @return $result process list.
*/
public function ws_processList()
{
global $sessionId;
global $client;
$endpoint = PML_WSDL_URL;
$proxy = array();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
if ($sysConf['proxy_port'] != '') {
$proxy['proxy_port'] = $sysConf['proxy_port'];
}
if ($sysConf['proxy_user'] != '') {
$proxy['proxy_login'] = $sysConf['proxy_user'];
}
if ($sysConf['proxy_pass'] != '') {
$proxy['proxy_password'] = $sysConf['proxy_pass'];
}
}
$client = new SoapClient($endpoint, $proxy);
$sessionId = '';
$params = array('sessionId' => $sessionId
);
$result = $client->__SoapCall('processList', array($params
));
if ($result->status_code == 0) {
return $result;
}
throw (new Exception($result->message));
}
/**
* download a File
*
* @param $file file to download
* @param $local_path path of the file
* @param $newfilename
* @return $errorMsg process list.
*/
public function downloadFile($file, $local_path, $newfilename)
{
$err_msg = '';
$out = fopen($local_path . $newfilename, 'wb');
if ($out == false) {
throw (new Exception("File $newfilename not opened"));
}
if (!function_exists('curl_init')) {
G::SendTemporalMessage('ID_CURLFUN_ISUNDEFINED', "warning", 'LABEL', '', '100%', '');
G::header('location: ../processes/processes_Library');
die();
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_FILE, $out);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $file);
curl_exec($ch);
$errorMsg = curl_error($ch);
fclose($out);
curl_close($ch);
return $errorMsg;
} //end function
/**
* get the process Data from a process
*
* @param $proId process Uid
* @return $result
*/
public function ws_processGetData($proId)
{
global $sessionId;
global $client;
$endpoint = PML_WSDL_URL;
$proxy = array();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
if ($sysConf['proxy_port'] != '') {
$proxy['proxy_port'] = $sysConf['proxy_port'];
}
if ($sysConf['proxy_user'] != '') {
$proxy['proxy_login'] = $sysConf['proxy_user'];
}
if ($sysConf['proxy_pass'] != '') {
$proxy['proxy_password'] = $sysConf['proxy_pass'];
}
}
$client = new SoapClient($endpoint, $proxy);
$sessionId = '';
$params = array('sessionId' => $sessionId, 'processId' => $proId
);
$result = $client->__SoapCall('processGetData', array($params
));
if ($result->status_code == 0) {
return $result;
}
throw (new Exception($result->message));
}
/**
* parse an array of Items
*

View File

@@ -136,10 +136,4 @@
// Number of files per folder at PATH_UPLOAD (cases documents)
define('APPLICATION_DOCUMENTS_PER_FOLDER', 1000);
// Server of ProcessMaker Library
define('PML_SERVER' , 'http://library.processmaker.com');
define('PML_WSDL_URL' , PML_SERVER . '/syspmLibrary/en/green/services/wsdl');
define('PML_UPLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/uploadProcess');
define('PML_DOWNLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/download');
G::defineConstants();

File diff suppressed because one or more lines are too long

View File

@@ -11459,12 +11459,6 @@ msgstr "Login"
msgid "You have lost your session and you have to login again."
msgstr "You have lost your session and you have to login again."
# TRANSLATION
# LABEL/ID_LOGIN_LIBRARY
#: LABEL/ID_LOGIN_LIBRARY
msgid "Login into ProcessMaker Library"
msgstr "Login into ProcessMaker Library"
# TRANSLATION
# LABEL/ID_LOGIN_SETTINGS
#: LABEL/ID_LOGIN_SETTINGS
@@ -42465,12 +42459,6 @@ msgstr "First Name"
msgid "[processes/processes_viewreassignCase.xml?USR_LASTNAME] Last Name"
msgstr "Last Name"
# processes/registerPML.xml?TITLE
# processes/registerPML.xml
#: title - TITLE
msgid "[processes/registerPML.xml?TITLE] Login into ProcessMaker Library"
msgstr "Login into ProcessMaker Library"
# processes/registerPML.xml?PML_USER
# processes/registerPML.xml
#: text - PML_USER

View File

@@ -58776,7 +58776,6 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_LOGGED','en','Logged on','2014-01-15') ,
( 'LABEL','ID_LOGIN','en','Login','2014-01-15') ,
( 'LABEL','ID_LOGIN_AGAIN','en','You have lost your session and you have to login again.','2014-01-15') ,
( 'LABEL','ID_LOGIN_LIBRARY','en','Login into ProcessMaker Library','2014-01-15') ,
( 'LABEL','ID_LOGIN_SETTINGS','en','Login Settings','2014-01-15') ,
( 'LABEL','ID_LOGIN_TITLE','en','Please enter your credentials below','2015-12-07') ,
( 'LABEL','ID_LOGIN_TO_SEE_OUTPUTDOCS','en','You must be logged to see the documents','2020-07-17') ,

View File

@@ -1,70 +0,0 @@
<?php
$ipaddress = $_SERVER['REMOTE_ADDR'];
try {
$aux = explode( '|', $_GET['id'] );
$index = 0;
$ObjUid = str_replace( '"', '', $aux[$index ++] );
if (isset( $_GET['v'] ))
$versionReq = $_GET['v'];
//downloading the file
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP;
G::mk_dir( $localPath );
$newfilename = G::GenerateUniqueId() . '.pm';
$downloadUrl = PML_DOWNLOAD_URL . '?id=' . $ObjUid . (isset( $_GET['s'] ) ? '&s=' . $_GET['s'] : '');
//print "<hr>$downloadUrl<hr>";die;
$oProcess = new Processes();
$oProcess->downloadFile( $downloadUrl, $localPath, $newfilename );
//getting the ProUid from the file recently downloaded
$oData = $oProcess->getProcessData( $localPath . $newfilename );
if (is_null( $oData )) {
throw new Exception( G::LoadTranslation( 'ID_ERROR' ) );
}
$Fields['IMPORT_OPTION'] = 2;
$Fields['PRO_FILENAME'] = $newfilename;
$Fields['OBJ_UID'] = $ObjUid;
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD'] = $sProUid;
//print $sProUid;die;
//if the process exists, we need to ask what kind of re-import the user wants,
if ($oProcess->processExists( $sProUid )) {
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'downloadPML_ImportExisting' );
G::RenderPage( 'publish', 'blank' );
die();
}
//creating the process
$oProcess->createProcessFromData( $oData, $localPath . $newfilename );
//show the info after the imported process
$oProcess = new Processes();
$oProcess->ws_open_public();
$processData = $oProcess->ws_processGetData( $ObjUid );
$Fields['pro_title'] = $processData->title;
$Fields['installSteps'] = nl2br( $processData->installSteps );
$Fields['category'] = (isset( $processData->category ) ? $processData->category : '');
$Fields['version'] = $processData->version;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$Fields['PRO_UID'] = $sProUid;
$processmapLink = "processes_Map?PRO_UID=$sProUid";
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportSucessful', '', $Fields, $processmapLink );
G::RenderPage( 'publish', 'blank' );
die();
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}

View File

@@ -1,97 +0,0 @@
<?php
/**
* processes_ImportFileExisting.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 {
//load the variables
$oProcess = new Processes();
if (! isset( $_POST['form']['IMPORT_OPTION'] )) {
throw (new Exception( 'Please select an option before to continue' ));
}
$option = $_POST['form']['IMPORT_OPTION'];
$filename = $_POST['form']['PRO_FILENAME'];
$ObjUid = $_POST['form']['OBJ_UID'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
$oData = $oProcess->getProcessData( $path . $filename );
$Fields['PRO_FILENAME'] = $filename;
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD'] = $sProUid;
//Update the current Process, overwriting all tasks and steps
if ($option == 1) {
$oProcess->updateProcessFromData( $oData, $path . $filename );
if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) {
$oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid );
while ($sObjectName = $oDirectory->read()) {
if (($sObjectName != '.') && ($sObjectName != '..')) {
unlink( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName );
}
}
$oDirectory->close();
}
$sNewProUid = $sProUid;
}
//Disable current Process and create a new version of the Process
if ($option == 2) {
$oProcess->disablePreviousProcesses( $sProUid );
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid( $oData, $sNewProUid );
$oProcess->setProcessParent( $oData, $sProUid );
$oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
$oProcess->renewAllTaskGuid( $oData );
$oProcess->renewAllDynaformGuid( $oData );
$oProcess->renewAllInputGuid( $oData );
$oProcess->renewAllOutputGuid( $oData );
$oProcess->renewAllStepGuid( $oData );
$oProcess->renewAllTriggerGuid( $oData );
$oProcess->renewAllSubProcessGuid( $oData );
$oProcess->createProcessFromData( $oData, $path . $filename );
}
//Create a completely new Process without change the current Process
if ($option == 3) {
//krumo ($oData);
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid( $oData, $sNewProUid );
$oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
$oProcess->renewAllTaskGuid( $oData );
$oProcess->renewAllDynaformGuid( $oData );
$oProcess->renewAllInputGuid( $oData );
$oProcess->renewAllOutputGuid( $oData );
$oProcess->renewAllStepGuid( $oData );
$oProcess->renewAllTriggerGuid( $oData );
$oProcess->renewAllSubProcessGuid( $oData );
$oProcess->createProcessFromData( $oData, $path . $filename );
}
G::header( 'Location: processes_Map?PRO_UID=' . $sNewProUid );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}

View File

@@ -1,35 +0,0 @@
<form id="{$form_id}" name="{$form_name}" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit='return validateForm("{$form_objectRequiredFields}".parseJSON());'> <div class="borderForm" style="width:{$form_width}; padding-left:0; padding-right:0; border-width:{$form_border};">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="height:{$form_height};" >
<table width="99%">
<tr>
<td valign='top'>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr style="display: none">
<td colspan="2">{$form.pro_uid}</td>
</tr>
<tr>
<td class='FormTitle' colspan="2" align="">{$form.TITLE}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$PML_USER}</td>
<td class='FormFieldContent' >{$form.PML_USER}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$PML_PASSWORD}</td>
<td class='FormFieldContent' >{$form.PML_PASSWORD}</td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center">{$form.PML_LOGIN}</td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center">{$form.link2}</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="FormRequiredTextMessage"><font color="red">* </font>{php}echo (G::LoadTranslation('ID_REQUIRED_FIELD'));{/php}</div> </div>
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
</div>
</form>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="registerPMLForm" width="100%" enableTemplate="1" labelWidth="50%">
<pro_uid type="hidden"/>
<TITLE type="title">
<en><![CDATA[Login into ProcessMaker Library]]></en>
</TITLE>
<PML_USER type="text" size="25" maxlength="50" validate="Any" required="1">
<en><![CDATA[Username (or Live Workspace)]]></en>
</PML_USER>
<PML_PASSWORD type="password" size="25" maxlength="32" required="1">
<en><![CDATA[Password]]></en>
</PML_PASSWORD>
<PML_LOGIN type="button" onclick="loginPML('@#pro_uid');">
<en><![CDATA[Login]]></en>
</PML_LOGIN>
<link_create_account type="private"/>
<link2 type="link" value="Create a New Account" link="@#link_create_account" target="_blank">
<en><![CDATA[]]></en>
</link2>
</dynaForm>