CODE STYLE, workflow/engine/methods/triggers/
FILES: triggersProperties.php triggersTree.php triggers_Ajax.php triggers_CreateWizard.php triggers_Delete.php triggers_Edit.php triggers_EditCustom.php triggers_EditWizard.php triggers_Save.php triggers_WizardSave.php triggers_WizardUpdate.php
This commit is contained in:
@@ -1,44 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* triggersProperties.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.
|
||||
*
|
||||
*/
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
require_once('classes/model/Triggers.php');
|
||||
|
||||
if (isset($_GET['TRI_UID']))
|
||||
{
|
||||
$oTrigger = new Triggers();
|
||||
$aFields = $oTrigger->load($_GET['TRI_UID']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
||||
//$aFields['PRO_UID'] = (isset($_SESSION['PROCESS']) ? $_SESSION['PROCESS'] : '');
|
||||
$aFields['TRI_TYPE'] = 'SCRIPT';
|
||||
}
|
||||
|
||||
G::LoadClass('xmlfield_InputPM');
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'triggers/triggersProperties', '', $aFields, '../triggers/triggers_Save');
|
||||
G::RenderPage('publish', 'raw');
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* triggersProperties.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.
|
||||
*/
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
require_once ('classes/model/Triggers.php');
|
||||
|
||||
if (isset( $_GET['TRI_UID'] )) {
|
||||
$oTrigger = new Triggers();
|
||||
$aFields = $oTrigger->load( $_GET['TRI_UID'] );
|
||||
} else {
|
||||
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
||||
//$aFields['PRO_UID'] = (isset($_SESSION['PROCESS']) ? $_SESSION['PROCESS'] : '');
|
||||
$aFields['TRI_TYPE'] = 'SCRIPT';
|
||||
}
|
||||
|
||||
G::LoadClass( 'xmlfield_InputPM' );
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'triggers/triggersProperties', '', $aFields, '../triggers/triggers_Save' );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
|
||||
|
||||
@@ -12,32 +12,29 @@
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
require_once('classes/model/Triggers.php');
|
||||
require_once('classes/model/Process.php');
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
require_once ('classes/model/Triggers.php');
|
||||
require_once ('classes/model/Process.php');
|
||||
|
||||
$sProcessUID = $_GET['PRO_UID'];
|
||||
|
||||
$oProcess = new Process();
|
||||
$aFields = $oProcess->load( $sProcessUID );
|
||||
|
||||
$sProcessUID=$_GET['PRO_UID'];
|
||||
$_SESSION['PROCESS'] = $sProcessUID;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'view', 'triggers/triggersTree' );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
|
||||
$oProcess = new Process ( );
|
||||
$aFields = $oProcess->load ( $sProcessUID );
|
||||
|
||||
$_SESSION['PROCESS'] = $sProcessUID;
|
||||
|
||||
|
||||
$G_PUBLISH = new Publisher ( );
|
||||
$G_PUBLISH->AddContent ( 'view', 'triggers/triggersTree' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
?>
|
||||
@@ -1,90 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* triggers_Delete.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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Triggers Ajax Request HAndler
|
||||
*
|
||||
* @author Erik A.O. <erik@colosa.com, aortiz.erik@gmail.com>
|
||||
* @date Apr 29th, 2010
|
||||
*/
|
||||
|
||||
$request = isset($_POST['request'])? $_POST['request']: '';
|
||||
|
||||
|
||||
switch($request){
|
||||
case 'verifyDependencies':
|
||||
require_once 'classes/model/Triggers.php';
|
||||
|
||||
if( !isset($_POST['TRI_UID']) ) {
|
||||
throw new Exception('Missing trigger ID for the request [verifyDependencies]');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$oTrigger = new Triggers;
|
||||
$oResult = $oTrigger->verifyDependecies($_POST['TRI_UID']);
|
||||
$oResult->passed = false;
|
||||
if($oResult->code == 0){
|
||||
$oResult->passed = true;
|
||||
$oResult->message = G::LoadTranslation('ID_TRIGGERS_VALIDATION'); //"No Dependencies were found for this trigger in Events definitions\n";
|
||||
} else {
|
||||
$oResult->message = '';
|
||||
foreach($oResult->dependencies as $Object=>$aDeps){
|
||||
$nDeps = count($aDeps);
|
||||
$message = str_replace('{N}', $nDeps, G::LoadTranslation('ID_TRIGGERS_VALIDATION_ERR2'));
|
||||
$message = str_replace('{Object}', $Object, $message);
|
||||
$oResult->message .= $message . "\n";
|
||||
foreach($aDeps as $dep){
|
||||
if( substr($Object, -1) == 's') $Object = substr($Object, 0, strlen($Object)-1);
|
||||
$message = str_replace('{Object}', $Object, G::LoadTranslation('ID_TRIGGERS_VALIDATION_ERR3'));
|
||||
$message = str_replace('{Description}', '"'.$dep['DESCRIPTION'].'"', $message);
|
||||
$oResult->message .= $message . "\n";
|
||||
}
|
||||
$oResult->message .= "\n";
|
||||
}
|
||||
}
|
||||
$oResult->success = true;
|
||||
//print_r($oResult);
|
||||
print G::json_encode($oResult);
|
||||
break;
|
||||
default: echo 'default';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
/**
|
||||
* triggers_Delete.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Triggers Ajax Request HAndler
|
||||
*
|
||||
* @author Erik A.O. <erik@colosa.com, aortiz.erik@gmail.com>
|
||||
* @date Apr 29th, 2010
|
||||
*/
|
||||
|
||||
$request = isset( $_POST['request'] ) ? $_POST['request'] : '';
|
||||
|
||||
switch ($request) {
|
||||
case 'verifyDependencies':
|
||||
require_once 'classes/model/Triggers.php';
|
||||
|
||||
if (! isset( $_POST['TRI_UID'] )) {
|
||||
throw new Exception( 'Missing trigger ID for the request [verifyDependencies]' );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
$oTrigger = new Triggers();
|
||||
$oResult = $oTrigger->verifyDependecies( $_POST['TRI_UID'] );
|
||||
$oResult->passed = false;
|
||||
if ($oResult->code == 0) {
|
||||
$oResult->passed = true;
|
||||
$oResult->message = G::LoadTranslation( 'ID_TRIGGERS_VALIDATION' ); //"No Dependencies were found for this trigger in Events definitions\n";
|
||||
} else {
|
||||
$oResult->message = '';
|
||||
foreach ($oResult->dependencies as $Object => $aDeps) {
|
||||
$nDeps = count( $aDeps );
|
||||
$message = str_replace( '{N}', $nDeps, G::LoadTranslation( 'ID_TRIGGERS_VALIDATION_ERR2' ) );
|
||||
$message = str_replace( '{Object}', $Object, $message );
|
||||
$oResult->message .= $message . "\n";
|
||||
foreach ($aDeps as $dep) {
|
||||
if (substr( $Object, - 1 ) == 's') {
|
||||
$Object = substr( $Object, 0, strlen( $Object ) - 1 );
|
||||
}
|
||||
$message = str_replace( '{Object}', $Object, G::LoadTranslation( 'ID_TRIGGERS_VALIDATION_ERR3' ) );
|
||||
$message = str_replace( '{Description}', '"' . $dep['DESCRIPTION'] . '"', $message );
|
||||
$oResult->message .= $message . "\n";
|
||||
}
|
||||
$oResult->message .= "\n";
|
||||
}
|
||||
}
|
||||
$oResult->success = true;
|
||||
//print_r($oResult);
|
||||
print G::json_encode( $oResult );
|
||||
break;
|
||||
default:
|
||||
echo 'default';
|
||||
}
|
||||
|
||||
|
||||
@@ -12,81 +12,84 @@
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
require_once('classes/model/Triggers.php');
|
||||
|
||||
$G_PUBLISH = new Publisher ( );
|
||||
$G_PUBLISH->AddContent ( 'view', 'triggers/triggers_CreateWizard', '', '', $_GET, '' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
require_once ('classes/model/Triggers.php');
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'view', 'triggers/triggers_CreateWizard', '', '', $_GET, '' );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
var _oVarsPanel_;
|
||||
|
||||
|
||||
var _oVarsPanel_;
|
||||
var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol) {
|
||||
//sFieldName = document.getElementById('TRI_ANSWER');
|
||||
_oVarsPanel_ = new leimnud.module.panel();
|
||||
_oVarsPanel_.options = {
|
||||
limit : true,
|
||||
size : {w:550,h:675},
|
||||
position : {x:0,y:0,center:true},
|
||||
title : '',
|
||||
theme : 'processmaker',
|
||||
statusBar: false,
|
||||
control : {drag:false,resize:true,close:true},
|
||||
fx : {opacity:true,rolled:false,modal:true}
|
||||
};
|
||||
_oVarsPanel_.make();
|
||||
_oVarsPanel_.events = {
|
||||
remove:function() {
|
||||
delete _oVarsPanel_;
|
||||
}.extend(this)
|
||||
};
|
||||
_oVarsPanel_.loader.show();
|
||||
oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : sAjaxServer,
|
||||
method: 'POST',
|
||||
args : 'sFieldName=' + sFieldName + '&sProcess=' + sProcess + '&sSymbol=' + sSymbol
|
||||
});
|
||||
oRPC.callback = function(oRPC) {
|
||||
_oVarsPanel_.loader.hide();
|
||||
var scs = oRPC.xmlhttp.responseText.extractScript();
|
||||
_oVarsPanel_.addContent(oRPC.xmlhttp.responseText);
|
||||
scs.evalScript();
|
||||
}.extend(this);
|
||||
oRPC.make();
|
||||
//sFieldName = document.getElementById('TRI_ANSWER');
|
||||
_oVarsPanel_ = new leimnud.module.panel();
|
||||
_oVarsPanel_.options = {
|
||||
limit : true,
|
||||
size : {w:550,h:675},
|
||||
position : {x:0,y:0,center:true},
|
||||
title : '',
|
||||
theme : 'processmaker',
|
||||
statusBar: false,
|
||||
control : {drag:false,resize:true,close:true},
|
||||
fx : {opacity:true,rolled:false,modal:true}
|
||||
};
|
||||
_oVarsPanel_.make();
|
||||
_oVarsPanel_.events = {
|
||||
remove:function() {
|
||||
delete _oVarsPanel_;
|
||||
}.extend(this)
|
||||
};
|
||||
_oVarsPanel_.loader.show();
|
||||
oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : sAjaxServer,
|
||||
method: 'POST',
|
||||
args : 'sFieldName=' + sFieldName + '&sProcess=' + sProcess + '&sSymbol=' + sSymbol
|
||||
});
|
||||
oRPC.callback = function(oRPC) {
|
||||
_oVarsPanel_.loader.hide();
|
||||
var scs = oRPC.xmlhttp.responseText.extractScript();
|
||||
_oVarsPanel_.addContent(oRPC.xmlhttp.responseText);
|
||||
scs.evalScript();
|
||||
}.extend(this);
|
||||
oRPC.make();
|
||||
};
|
||||
|
||||
var insertFormVar = function(sFieldName, sValue) {
|
||||
oAux = document.getElementById(sFieldName);
|
||||
if (oAux.setSelectionRange) {
|
||||
var rangeStart = oAux.selectionStart;
|
||||
var rangeEnd = oAux.selectionEnd;
|
||||
var tempStr1 = oAux.value.substring(0,rangeStart);
|
||||
var tempStr2 = oAux.value.substring(rangeEnd);
|
||||
oAux.value = tempStr1 + sValue + tempStr2;
|
||||
}
|
||||
else {
|
||||
if (document.selection) {
|
||||
oAux.focus();
|
||||
document.selection.createRange().text = sValue;
|
||||
}
|
||||
}
|
||||
_oVarsPanel_.remove();
|
||||
var insertFormVar = function(sFieldName, sValue) {
|
||||
oAux = document.getElementById(sFieldName);
|
||||
if (oAux.setSelectionRange) {
|
||||
var rangeStart = oAux.selectionStart;
|
||||
var rangeEnd = oAux.selectionEnd;
|
||||
var tempStr1 = oAux.value.substring(0,rangeStart);
|
||||
var tempStr2 = oAux.value.substring(rangeEnd);
|
||||
oAux.value = tempStr1 + sValue + tempStr2;
|
||||
}
|
||||
else {
|
||||
if (document.selection) {
|
||||
oAux.focus();
|
||||
document.selection.createRange().text = sValue;
|
||||
}
|
||||
}
|
||||
_oVarsPanel_.remove();
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* triggers_Delete.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
|
||||
@@ -12,37 +12,35 @@
|
||||
*
|
||||
* 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
|
||||
* 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.,
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
try{
|
||||
require_once('classes/model/Triggers.php');
|
||||
|
||||
$oTrigger = new Triggers();
|
||||
$triggerObj=$oTrigger->load($_POST['TRI_UID']);
|
||||
|
||||
|
||||
$oTrigger->remove($_POST['TRI_UID']);
|
||||
require_once('classes/model/StepTrigger.php');
|
||||
$oStepTrigger = new StepTrigger();
|
||||
$oStepTrigger->removeTrigger($_POST['TRI_UID']);
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = G::LoadTranslation('ID_TRIGGERS_REMOVED');
|
||||
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
try {
|
||||
require_once ('classes/model/Triggers.php');
|
||||
|
||||
$oTrigger = new Triggers();
|
||||
$triggerObj = $oTrigger->load( $_POST['TRI_UID'] );
|
||||
|
||||
$oTrigger->remove( $_POST['TRI_UID'] );
|
||||
require_once ('classes/model/StepTrigger.php');
|
||||
$oStepTrigger = new StepTrigger();
|
||||
$oStepTrigger->removeTrigger( $_POST['TRI_UID'] );
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = G::LoadTranslation( 'ID_TRIGGERS_REMOVED' );
|
||||
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
print G::json_encode($result);
|
||||
}
|
||||
print G::json_encode( $result );
|
||||
|
||||
?>
|
||||
@@ -12,62 +12,60 @@
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
require_once('classes/model/Triggers.php');
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
require_once ('classes/model/Triggers.php');
|
||||
|
||||
if (isset($_GET['TRI_UID']))
|
||||
{
|
||||
$oTrigger = new Triggers();
|
||||
// check if its necessary bypass the wizard editor
|
||||
if (isset($_GET['BYPASS'])&&$_GET['BYPASS']=='1'){
|
||||
$editWizardSource = true;
|
||||
} else {
|
||||
$editWizardSource = false;
|
||||
}
|
||||
$aFields = $oTrigger->load($_GET['TRI_UID']);
|
||||
$aTriggerData = unserialize($aFields['TRI_PARAM']);
|
||||
// if trigger has been created with the wizard the TRI_PARAM field cant be empty
|
||||
if($aFields['TRI_PARAM']!=''&&!$editWizardSource){
|
||||
$aTriggerData = unserialize($aFields['TRI_PARAM']);
|
||||
// if the trigger has been modified manually, it cant be edited with the wizard.
|
||||
if (md5($aFields['TRI_WEBBOT'])==$aTriggerData['hash']){
|
||||
$triUid = $_GET['TRI_UID'];
|
||||
$_GET = $aTriggerData['params'];
|
||||
$_GET['TRI_UID'] = $triUid;
|
||||
require_once('triggers_EditWizard.php');
|
||||
die;
|
||||
} else {
|
||||
// custom trigger edit
|
||||
$xmlform = 'triggers/triggers_Edit';
|
||||
$xmlform_action = '../triggers/triggers_Save';
|
||||
}
|
||||
}else{
|
||||
if (isset( $_GET['TRI_UID'] )) {
|
||||
$oTrigger = new Triggers();
|
||||
// check if its necessary bypass the wizard editor
|
||||
if (isset( $_GET['BYPASS'] ) && $_GET['BYPASS'] == '1') {
|
||||
$editWizardSource = true;
|
||||
} else {
|
||||
$editWizardSource = false;
|
||||
}
|
||||
$aFields = $oTrigger->load( $_GET['TRI_UID'] );
|
||||
$aTriggerData = unserialize( $aFields['TRI_PARAM'] );
|
||||
// if trigger has been created with the wizard the TRI_PARAM field cant be empty
|
||||
if ($aFields['TRI_PARAM'] != '' && ! $editWizardSource) {
|
||||
$aTriggerData = unserialize( $aFields['TRI_PARAM'] );
|
||||
// if the trigger has been modified manually, it cant be edited with the wizard.
|
||||
if (md5( $aFields['TRI_WEBBOT'] ) == $aTriggerData['hash']) {
|
||||
$triUid = $_GET['TRI_UID'];
|
||||
$_GET = $aTriggerData['params'];
|
||||
$_GET['TRI_UID'] = $triUid;
|
||||
require_once ('triggers_EditWizard.php');
|
||||
die();
|
||||
} else {
|
||||
// custom trigger edit
|
||||
$xmlform = 'triggers/triggers_Edit';
|
||||
$xmlform_action = '../triggers/triggers_Save';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if its a new trigger
|
||||
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
||||
$aFields['TRI_TYPE'] = 'SCRIPT';
|
||||
$xmlform = 'triggers/triggersProperties';
|
||||
} else {
|
||||
// custom trigger edit
|
||||
$xmlform = 'triggers/triggers_Edit';
|
||||
$xmlform_action = '../triggers/triggers_Save';
|
||||
}
|
||||
} else {
|
||||
//if its a new trigger
|
||||
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
||||
$aFields['TRI_TYPE'] = 'SCRIPT';
|
||||
$xmlform = 'triggers/triggersProperties';
|
||||
$xmlform_action = '../triggers/triggers_Save';
|
||||
}
|
||||
|
||||
G::LoadClass('xmlfield_InputPM');
|
||||
G::LoadClass( 'xmlfield_InputPM' );
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform , '', $aFields, $xmlform_action);
|
||||
G::RenderPage('publish', 'raw');
|
||||
?>
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, $xmlform_action );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
|
||||
|
||||
@@ -12,29 +12,30 @@
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
require_once('classes/model/Triggers.php');
|
||||
|
||||
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
||||
$aFields['TRI_TYPE'] = 'SCRIPT';
|
||||
if(isset($_GET['TRI_UID'])&&($_GET['TRI_UID']!="")){
|
||||
$oTrigger = new Triggers();
|
||||
$aFields = $oTrigger->load($_GET['TRI_UID']);
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
$xmlform = 'triggers/triggersCustom';
|
||||
require_once ('classes/model/Triggers.php');
|
||||
|
||||
G::LoadClass('xmlfield_InputPM');
|
||||
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
||||
$aFields['TRI_TYPE'] = 'SCRIPT';
|
||||
if (isset( $_GET['TRI_UID'] ) && ($_GET['TRI_UID'] != "")) {
|
||||
$oTrigger = new Triggers();
|
||||
$aFields = $oTrigger->load( $_GET['TRI_UID'] );
|
||||
}
|
||||
$xmlform = 'triggers/triggersCustom';
|
||||
|
||||
G::LoadClass( 'xmlfield_InputPM' );
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform , '', $aFields, '../triggers/triggers_Save');
|
||||
G::RenderPage('publish', 'raw');
|
||||
?>
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../triggers/triggers_Save' );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
|
||||
|
||||
@@ -12,26 +12,29 @@
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// this script calls the template that constructs the wizard form for a trigger
|
||||
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
if (!class_exists('Triggers')){
|
||||
require_once('classes/model/Triggers.php');
|
||||
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
$G_PUBLISH = new Publisher ( );
|
||||
$G_PUBLISH->AddContent ( 'view', 'triggers/triggers_EditWizard', '', '', $_GET, '' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
if (! class_exists( 'Triggers' )) {
|
||||
require_once ('classes/model/Triggers.php');
|
||||
}
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'view', 'triggers/triggers_EditWizard', '', '', $_GET, '' );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -92,4 +95,5 @@ var insertFormVar = function(sFieldName, sValue) {
|
||||
_oVarsPanel_.remove();
|
||||
};
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* triggers_Save.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
|
||||
@@ -12,88 +12,89 @@
|
||||
*
|
||||
* 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
|
||||
* 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.,
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
||||
require_once('classes/model/Triggers.php');
|
||||
require_once('classes/model/Content.php');
|
||||
|
||||
if( isset($_POST['function']) )
|
||||
$sfunction = $_POST['function']; //for old processmap
|
||||
else if( isset($_POST['functions']) )
|
||||
$sfunction = $_POST['functions']; //for extjs
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
require_once ('classes/model/Triggers.php');
|
||||
require_once ('classes/model/Content.php');
|
||||
|
||||
if(isset($sfunction) && $sfunction=='lookforNameTrigger'){
|
||||
$snameTrigger=urldecode($_POST['NAMETRIGGER']);
|
||||
$sPRO_UID=urldecode($_POST['proUid']);
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn ( TriggersPeer::TRI_UID );
|
||||
$oCriteria->add(TriggersPeer::PRO_UID, $sPRO_UID);
|
||||
$oDataset = TriggersPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$flag=true;
|
||||
if (isset( $_POST['function'] )) {
|
||||
$sfunction = $_POST['function']; //for old processmap
|
||||
} elseif (isset( $_POST['functions'] )) {
|
||||
$sfunction = $_POST['functions']; //for extjs
|
||||
}
|
||||
|
||||
if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') {
|
||||
$snameTrigger = urldecode( $_POST['NAMETRIGGER'] );
|
||||
$sPRO_UID = urldecode( $_POST['proUid'] );
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( TriggersPeer::TRI_UID );
|
||||
$oCriteria->add( TriggersPeer::PRO_UID, $sPRO_UID );
|
||||
$oDataset = TriggersPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$flag = true;
|
||||
while ($oDataset->next() && $flag) {
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
$oCriteria1 = new Criteria('workflow');
|
||||
$oCriteria1->addSelectColumn('COUNT(*) AS TRIGGERS');
|
||||
$oCriteria1->add(ContentPeer::CON_CATEGORY, 'TRI_TITLE');
|
||||
$oCriteria1->add(ContentPeer::CON_ID, $aRow['TRI_UID']);
|
||||
$oCriteria1->add(ContentPeer::CON_VALUE, $snameTrigger);
|
||||
$oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG);
|
||||
$oDataset1 = ContentPeer::doSelectRS($oCriteria1);
|
||||
$oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset1->next();
|
||||
$aRow1 = $oDataset1->getRow();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
$oCriteria1 = new Criteria( 'workflow' );
|
||||
$oCriteria1->addSelectColumn( 'COUNT(*) AS TRIGGERS' );
|
||||
$oCriteria1->add( ContentPeer::CON_CATEGORY, 'TRI_TITLE' );
|
||||
$oCriteria1->add( ContentPeer::CON_ID, $aRow['TRI_UID'] );
|
||||
$oCriteria1->add( ContentPeer::CON_VALUE, $snameTrigger );
|
||||
$oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG );
|
||||
$oDataset1 = ContentPeer::doSelectRS( $oCriteria1 );
|
||||
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset1->next();
|
||||
$aRow1 = $oDataset1->getRow();
|
||||
|
||||
if ($aRow1['TRIGGERS']) {
|
||||
$flag = false;
|
||||
}
|
||||
|
||||
if($aRow1['TRIGGERS']) $flag=false;
|
||||
|
||||
|
||||
}
|
||||
print $flag;
|
||||
//print'krlos';return ;
|
||||
//print'krlos';return ;
|
||||
} else {
|
||||
try {
|
||||
$oTrigger = new Triggers();
|
||||
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection);
|
||||
if(isset ($_POST['form']))
|
||||
$value = $_POST['form'];
|
||||
else
|
||||
$value = $_POST;
|
||||
|
||||
if ($value['TRI_UID'] != '')
|
||||
{
|
||||
$oTrigger->load($value['TRI_UID']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oTrigger->create($value);
|
||||
$value['TRI_UID']=$oTrigger->getTriUid();
|
||||
}
|
||||
//print_r($_POST['form']);die;
|
||||
$oTrigger->update($value);
|
||||
try {
|
||||
$oTrigger = new Triggers();
|
||||
|
||||
if(!isset($_POST['mode']))
|
||||
$oProcessMap->triggersList($value['PRO_UID']);
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new processMap( new DBConnection() );
|
||||
if (isset( $_POST['form'] )) {
|
||||
$value = $_POST['form'];
|
||||
} else {
|
||||
$value = $_POST;
|
||||
}
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = G::LoadTranslation('ID_TRIGGERS_SAVED');
|
||||
} catch (Exception $e) {
|
||||
if ($value['TRI_UID'] != '') {
|
||||
$oTrigger->load( $value['TRI_UID'] );
|
||||
} else {
|
||||
$oTrigger->create( $value );
|
||||
$value['TRI_UID'] = $oTrigger->getTriUid();
|
||||
}
|
||||
//print_r($_POST['form']);die;
|
||||
$oTrigger->update( $value );
|
||||
|
||||
if (! isset( $_POST['mode'] )) {
|
||||
$oProcessMap->triggersList( $value['PRO_UID'] );
|
||||
}
|
||||
$result->success = true;
|
||||
$result->msg = G::LoadTranslation( 'ID_TRIGGERS_SAVED' );
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
print G::json_encode($result);
|
||||
}
|
||||
print G::json_encode( $result );
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,99 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* triggers_WizardSave.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.
|
||||
*
|
||||
*/
|
||||
|
||||
if (($RBAC_Response = $RBAC->userCanAccess ( "PM_FACTORY" )) != 1)
|
||||
return $RBAC_Response;
|
||||
require_once ('classes/model/Triggers.php');
|
||||
$oTrigger = new Triggers ( );
|
||||
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection);
|
||||
|
||||
$aDataTriggers = $_POST;
|
||||
|
||||
$aInfoFunction = explode ( ",", $aDataTriggers ['ALLFUNCTION'] );
|
||||
|
||||
$sPMfunction = "
|
||||
/***************************************************
|
||||
*
|
||||
* Generated by ProcessMaker Trigger Wizard
|
||||
* Library: " . $aDataTriggers ['LIBRARY_NAME'] . "
|
||||
* Method: " . $aDataTriggers ['PMFUNTION_LABEL'] . "
|
||||
* Date: " . date ( "Y-m-d H:i:s" ) . "
|
||||
*
|
||||
* ProcessMaker " . date ( "Y" ) . "
|
||||
*
|
||||
****************************************************/
|
||||
|
||||
";
|
||||
|
||||
$methodParamsFinal = array ();
|
||||
//Generate params to send
|
||||
foreach ( $aInfoFunction as $k => $v ) {
|
||||
if ($v != '') {
|
||||
|
||||
$sOptionTrigger = trim ( str_replace ( "$", "", $v ) );
|
||||
if (strstr ( $sOptionTrigger, "=" )) {
|
||||
$aOptionParameters = explode ( "=", $sOptionTrigger );
|
||||
$sOptionTrigger = trim ( $aOptionParameters [0] );
|
||||
}
|
||||
if ($aDataTriggers [$sOptionTrigger] != '') {
|
||||
|
||||
if ((strstr ( $aDataTriggers [$sOptionTrigger], "@@" ))) {
|
||||
$option = trim($aDataTriggers [$sOptionTrigger]);
|
||||
} else {
|
||||
$aDataTriggers [$sOptionTrigger] =(strstr($aDataTriggers[$sOptionTrigger],'array'))?
|
||||
str_replace("'", '"', $aDataTriggers[$sOptionTrigger]):str_replace("'", "\'", $aDataTriggers [$sOptionTrigger]);
|
||||
$option = (is_numeric($aDataTriggers [$sOptionTrigger]))?trim($aDataTriggers [$sOptionTrigger]):
|
||||
(strstr($aDataTriggers [$sOptionTrigger],"array") )?trim($aDataTriggers [$sOptionTrigger]):"'" . trim($aDataTriggers [$sOptionTrigger]) . "'";
|
||||
}
|
||||
} else {
|
||||
$option = "''";
|
||||
}
|
||||
$methodParamsFinal [] = $option;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//G::pr($methodParamsFinal);die;
|
||||
$sPMfunction .= (isset ( $aDataTriggers ['TRI_ANSWER'] ) && $aDataTriggers ['TRI_ANSWER'] != '') ? $aDataTriggers ['TRI_ANSWER'] . " = " : "";
|
||||
$sPMfunction .= $aDataTriggers ['PMFUNTION_NAME'] . " (" . implode ( ",", $methodParamsFinal ) . ");";
|
||||
|
||||
//Create Trigger
|
||||
$aDataTriggers ['TRI_WEBBOT'] = $sPMfunction;
|
||||
$aDataTriggersParams = array();
|
||||
$aDataTriggersParams['hash'] = md5 ($sPMfunction);
|
||||
$aDataTriggersParams['params'] = $aDataTriggers;
|
||||
|
||||
$aDataTriggers ['TRI_PARAM'] = serialize($aDataTriggersParams);
|
||||
$oTrigger->create ( $aDataTriggers );
|
||||
|
||||
//Update Info
|
||||
$aDataTriggers ['TRI_UID'] = $oTrigger->getTriUid ();
|
||||
$oTrigger->update ( $aDataTriggers );
|
||||
|
||||
//Update Trigger Array
|
||||
$oProcessMap->triggersList($aDataTriggers['PRO_UID']);
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* triggers_WizardSave.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.
|
||||
*/
|
||||
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
require_once ('classes/model/Triggers.php');
|
||||
$oTrigger = new Triggers();
|
||||
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new processMap( new DBConnection() );
|
||||
|
||||
$aDataTriggers = $_POST;
|
||||
|
||||
$aInfoFunction = explode( ",", $aDataTriggers['ALLFUNCTION'] );
|
||||
|
||||
$sPMfunction = "
|
||||
/***************************************************
|
||||
*
|
||||
* Generated by ProcessMaker Trigger Wizard
|
||||
* Library: " . $aDataTriggers['LIBRARY_NAME'] . "
|
||||
* Method: " . $aDataTriggers['PMFUNTION_LABEL'] . "
|
||||
* Date: " . date( "Y-m-d H:i:s" ) . "
|
||||
*
|
||||
* ProcessMaker " . date( "Y" ) . "
|
||||
*
|
||||
****************************************************/
|
||||
|
||||
";
|
||||
|
||||
$methodParamsFinal = array ();
|
||||
//Generate params to send
|
||||
foreach ($aInfoFunction as $k => $v) {
|
||||
if ($v != '') {
|
||||
|
||||
$sOptionTrigger = trim( str_replace( "$", "", $v ) );
|
||||
if (strstr( $sOptionTrigger, "=" )) {
|
||||
$aOptionParameters = explode( "=", $sOptionTrigger );
|
||||
$sOptionTrigger = trim( $aOptionParameters[0] );
|
||||
}
|
||||
if ($aDataTriggers[$sOptionTrigger] != '') {
|
||||
|
||||
if ((strstr( $aDataTriggers[$sOptionTrigger], "@@" ))) {
|
||||
$option = trim( $aDataTriggers[$sOptionTrigger] );
|
||||
} else {
|
||||
$aDataTriggers[$sOptionTrigger] = (strstr( $aDataTriggers[$sOptionTrigger], 'array' )) ? str_replace( "'", '"', $aDataTriggers[$sOptionTrigger] ) : str_replace( "'", "\'", $aDataTriggers[$sOptionTrigger] );
|
||||
$option = (is_numeric( $aDataTriggers[$sOptionTrigger] )) ? trim( $aDataTriggers[$sOptionTrigger] ) : (strstr( $aDataTriggers[$sOptionTrigger], "array" )) ? trim( $aDataTriggers[$sOptionTrigger] ) : "'" . trim( $aDataTriggers[$sOptionTrigger] ) . "'";
|
||||
}
|
||||
} else {
|
||||
$option = "''";
|
||||
}
|
||||
$methodParamsFinal[] = $option;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//G::pr($methodParamsFinal);die;
|
||||
$sPMfunction .= (isset( $aDataTriggers['TRI_ANSWER'] ) && $aDataTriggers['TRI_ANSWER'] != '') ? $aDataTriggers['TRI_ANSWER'] . " = " : "";
|
||||
$sPMfunction .= $aDataTriggers['PMFUNTION_NAME'] . " (" . implode( ",", $methodParamsFinal ) . ");";
|
||||
|
||||
//Create Trigger
|
||||
$aDataTriggers['TRI_WEBBOT'] = $sPMfunction;
|
||||
$aDataTriggersParams = array ();
|
||||
$aDataTriggersParams['hash'] = md5( $sPMfunction );
|
||||
$aDataTriggersParams['params'] = $aDataTriggers;
|
||||
|
||||
$aDataTriggers['TRI_PARAM'] = serialize( $aDataTriggersParams );
|
||||
$oTrigger->create( $aDataTriggers );
|
||||
|
||||
//Update Info
|
||||
$aDataTriggers['TRI_UID'] = $oTrigger->getTriUid();
|
||||
$oTrigger->update( $aDataTriggers );
|
||||
|
||||
//Update Trigger Array
|
||||
$oProcessMap->triggersList( $aDataTriggers['PRO_UID'] );
|
||||
|
||||
|
||||
@@ -12,41 +12,41 @@
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
if (($RBAC_Response = $RBAC->userCanAccess ( "PM_FACTORY" )) != 1)
|
||||
return $RBAC_Response;
|
||||
if (!class_exists('Triggers')){
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
if (! class_exists( 'Triggers' )) {
|
||||
require_once ('classes/model/Triggers.php');
|
||||
}
|
||||
$oTrigger = new Triggers ( );
|
||||
$oTrigger = new Triggers();
|
||||
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection);
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new processMap( new DBConnection() );
|
||||
|
||||
$aDataTriggers = $_POST;
|
||||
$triUid = $_POST['TRI_UID'];
|
||||
|
||||
$aInfoFunction = explode ( ",", $aDataTriggers ['ALLFUNCTION'] );
|
||||
$aInfoFunction = explode( ",", $aDataTriggers['ALLFUNCTION'] );
|
||||
|
||||
$sPMfunction = "
|
||||
/***************************************************
|
||||
*
|
||||
* Generated by ProcessMaker Trigger Wizard
|
||||
* Library: " . $aDataTriggers ['LIBRARY_NAME'] . "
|
||||
* Method: " . $aDataTriggers ['PMFUNTION_LABEL'] . "
|
||||
* Date: " . date ( "Y-m-d H:i:s" ) . "
|
||||
* Library: " . $aDataTriggers['LIBRARY_NAME'] . "
|
||||
* Method: " . $aDataTriggers['PMFUNTION_LABEL'] . "
|
||||
* Date: " . date( "Y-m-d H:i:s" ) . "
|
||||
*
|
||||
* ProcessMaker " . date ( "Y" ) . "
|
||||
* ProcessMaker " . date( "Y" ) . "
|
||||
*
|
||||
****************************************************/
|
||||
|
||||
@@ -54,53 +54,51 @@ $sPMfunction = "
|
||||
|
||||
$methodParamsFinal = array ();
|
||||
//Generate params to send
|
||||
foreach ( $aInfoFunction as $k => $v ) {
|
||||
if ($v != '') {
|
||||
foreach ($aInfoFunction as $k => $v) {
|
||||
if ($v != '') {
|
||||
|
||||
$sOptionTrigger = trim ( str_replace ( "$", "", $v ) );
|
||||
if (strstr ( $sOptionTrigger, "=" )) {
|
||||
$aOptionParameters = explode ( "=", $sOptionTrigger );
|
||||
$sOptionTrigger = trim ( $aOptionParameters [0] );
|
||||
}
|
||||
if ($aDataTriggers [$sOptionTrigger] != '') {
|
||||
$sOptionTrigger = trim( str_replace( "$", "", $v ) );
|
||||
if (strstr( $sOptionTrigger, "=" )) {
|
||||
$aOptionParameters = explode( "=", $sOptionTrigger );
|
||||
$sOptionTrigger = trim( $aOptionParameters[0] );
|
||||
}
|
||||
if ($aDataTriggers[$sOptionTrigger] != '') {
|
||||
|
||||
if ((strstr ( $aDataTriggers [$sOptionTrigger], "@@" ))) {
|
||||
$option = $aDataTriggers [$sOptionTrigger];
|
||||
} else {
|
||||
|
||||
$aDataTriggers [$sOptionTrigger] =(strstr($aDataTriggers[$sOptionTrigger],'array'))?
|
||||
str_replace("'", '"', $aDataTriggers[$sOptionTrigger]):str_replace("'", "\'", $aDataTriggers [$sOptionTrigger]);
|
||||
if ((strstr( $aDataTriggers[$sOptionTrigger], "@@" ))) {
|
||||
$option = $aDataTriggers[$sOptionTrigger];
|
||||
} else {
|
||||
|
||||
$option = (is_numeric($aDataTriggers [$sOptionTrigger]))?trim($aDataTriggers [$sOptionTrigger]):
|
||||
(strstr($aDataTriggers [$sOptionTrigger],"array") )?trim($aDataTriggers [$sOptionTrigger]):"'" . trim($aDataTriggers [$sOptionTrigger]) . "'";
|
||||
}
|
||||
} else {
|
||||
$option = "' '";
|
||||
}
|
||||
$methodParamsFinal [] = $option;
|
||||
$aDataTriggers[$sOptionTrigger] = (strstr( $aDataTriggers[$sOptionTrigger], 'array' )) ? str_replace( "'", '"', $aDataTriggers[$sOptionTrigger] ) : str_replace( "'", "\'", $aDataTriggers[$sOptionTrigger] );
|
||||
|
||||
}
|
||||
$option = (is_numeric( $aDataTriggers[$sOptionTrigger] )) ? trim( $aDataTriggers[$sOptionTrigger] ) : (strstr( $aDataTriggers[$sOptionTrigger], "array" )) ? trim( $aDataTriggers[$sOptionTrigger] ) : "'" . trim( $aDataTriggers[$sOptionTrigger] ) . "'";
|
||||
}
|
||||
} else {
|
||||
$option = "' '";
|
||||
}
|
||||
$methodParamsFinal[] = $option;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$sPMfunction .= (isset ( $aDataTriggers ['TRI_ANSWER'] ) && $aDataTriggers ['TRI_ANSWER'] != '') ? $aDataTriggers ['TRI_ANSWER'] . " = " : "";
|
||||
$sPMfunction .= $aDataTriggers ['PMFUNTION_NAME'] . " (" . implode ( ",", $methodParamsFinal ) . ");";
|
||||
$sPMfunction .= (isset( $aDataTriggers['TRI_ANSWER'] ) && $aDataTriggers['TRI_ANSWER'] != '') ? $aDataTriggers['TRI_ANSWER'] . " = " : "";
|
||||
$sPMfunction .= $aDataTriggers['PMFUNTION_NAME'] . " (" . implode( ",", $methodParamsFinal ) . ");";
|
||||
|
||||
//Create Trigger
|
||||
$aDataTriggers ['TRI_WEBBOT'] = $sPMfunction;
|
||||
$aDataTriggersParams = array();
|
||||
$aDataTriggersParams['hash'] = md5 ($sPMfunction);
|
||||
$aDataTriggers['TRI_WEBBOT'] = $sPMfunction;
|
||||
$aDataTriggersParams = array ();
|
||||
$aDataTriggersParams['hash'] = md5( $sPMfunction );
|
||||
$aDataTriggersParams['params'] = $aDataTriggers;
|
||||
|
||||
$aDataTriggers ['TRI_PARAM'] = serialize($aDataTriggersParams);
|
||||
$aDataTriggers['TRI_PARAM'] = serialize( $aDataTriggersParams );
|
||||
//$oTrigger->create ( $aDataTriggers );
|
||||
$aDataTriggerLoaded = $oTrigger->load($triUid);
|
||||
$aDataTriggerLoaded = $oTrigger->load( $triUid );
|
||||
//var_dump($aDataTriggerLoaded);
|
||||
//die;
|
||||
//Update Info
|
||||
$aDataTriggers ['TRI_UID'] = $oTrigger->getTriUid ();
|
||||
$oTrigger->update ( $aDataTriggers );
|
||||
$aDataTriggers['TRI_UID'] = $oTrigger->getTriUid();
|
||||
$oTrigger->update( $aDataTriggers );
|
||||
|
||||
//Update Trigger Array
|
||||
$oProcessMap->triggersList($aDataTriggers['PRO_UID']);
|
||||
?>
|
||||
$oProcessMap->triggersList( $aDataTriggers['PRO_UID'] );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user