diff --git a/workflow/engine/methods/triggers/triggerCopy.php b/workflow/engine/methods/triggers/triggerCopy.php new file mode 100644 index 000000000..d4d1edbd8 --- /dev/null +++ b/workflow/engine/methods/triggers/triggerCopy.php @@ -0,0 +1,30 @@ +userCanAccess("PM_FACTORY")) != 1) { + return $RBAC_Response; +} + + + + + +require_once ("classes/model/Triggers.php"); + + + + + +$arrayField = array(); +$arrayField["LANG"] = SYS_LANG; +$arrayField["PRO_UID"] = $_GET["PRO_UID"]; +$arrayField["TRI_TYPE"] = "SCRIPT"; + +if (isset($_GET["TRI_UID"]) && !empty($_GET["TRI_UID"])) { + $oTrigger = new Triggers(); + $arrayField = $oTrigger->load($_GET["TRI_UID"]); +} + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent("xmlform", "xmlform", "triggers/triggerCopy", "", $arrayField, "../triggers/triggers_Save"); + +G::RenderPage("publish", "raw"); + diff --git a/workflow/engine/templates/triggers/triggersTree.php b/workflow/engine/templates/triggers/triggersTree.php index db2343fe9..b66657760 100755 --- a/workflow/engine/templates/triggers/triggersTree.php +++ b/workflow/engine/templates/triggers/triggersTree.php @@ -1,4 +1,4 @@ -getRegisteredClasses (); - $oTree = new Tree ( ); - $oTree->nodeType = 'blank'; - $oTree->name = 'Triggers'; - $oTree->showSign = false; - - $oNode = & $oTree->addChild ( 'TRI_CUSTOM', '  
' . "  " .G::LoadTranslation('ID_CUSTOM_TRIGGER') . " 
".G::LoadTranslation('ID_CUSTOM_TRIGGER_DESCRIPTION')."
", array ('nodeType' => 'parent' ) ); - - $triggerLibraryOCount=count($triggerLibraryO); - foreach ( $triggerLibraryO as $keyLibrary => $libraryObj ) { - $libraryName = $libraryObj->info ['name']; - $libraryIcon = isset ( $libraryObj->info ['icon'] ) && ($libraryObj->info ['icon'] != "") ? $libraryObj->info ['icon'] : "/images/browse.gif"; - $libraryDescription = trim ( str_replace ( "*", "", implode ( " ", $libraryObj->info ['description'] ) ) ); - $triggerCount = count ( $libraryObj->methods ); - if ($triggerCount > 0) { - //Sort alpha - ksort($libraryObj->methods,SORT_STRING); - //Now the Triggers - //Library Father (Name + Description) - $oNode = & $oTree->addChild ( $keyLibrary, '  
' . "  " . $libraryName . " ($triggerCount)
$libraryDescription
", array ('nodeType' => 'parent' ) ); - $oNode->contracted = $triggerLibraryOCount==1?false:true; - //Library Childs (available methods) - foreach ( $libraryObj->methods as $methodName => $methodObject ) { - - $methodName = $methodObject->info ['name']; - $methodLabel = $methodObject->info ['label']; - $methodDescription = trim ( str_replace ( "*", "", implode ( " ", $methodObject->info ['description'] ) ) ); - - $oAux1 = & $oNode->addChild ( $keyLibrary . "-" . $methodName, '
' . " " . $methodLabel . ' (' . $methodName . ')' . '
' . $methodDescription . '
', array ('nodeType' => 'child' ) ); - //$oAux1->plus = ""; - - - //$oAux2 =& $oAux1->addChild($keyLibrary."-".$methodName."-desc", "$methodParameters", array('nodeType'=>'parent')); - - - } - } - - } - echo $oTree->render (); - - -} catch ( Exception $oException ) { - die ( $oException->getMessage () ); -} -unset ( $_SESSION ['PROCESS'] ); -?> \ No newline at end of file + */ + +try { + G::LoadClass("tree"); + G::LoadClass("triggerLibrary"); + + $triggerLibrary = triggerLibrary::getSingleton(); + $triggerLibraryO = $triggerLibrary->getRegisteredClasses(); + + $oTree = new Tree(); + $oTree->nodeType = "blank"; + $oTree->name = "Triggers"; + $oTree->showSign = false; + + $div1Style = (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false)? " style=\"margin-top: 0.65em;\"" : null; + + $oNode = &$oTree->addChild("TRI_CUSTOM", "\"\"  " . G::LoadTranslation("ID_CUSTOM_TRIGGER") . "
" . G::LoadTranslation("ID_CUSTOM_TRIGGER_DESCRIPTION") . "", array("nodeType" => "parent")); + $oNode = &$oTree->addChild("TRI_COPY", "
\"\"  " . G::LoadTranslation("ID_TRIGGER_COPY_OPTION") . "
" . G::LoadTranslation("ID_TRIGGER_COPY_OPTION_DESCRIPTION") . "
", array("nodeType" => "parent")); + + $triggerLibraryOCount = count($triggerLibraryO); + + foreach ($triggerLibraryO as $keyLibrary => $libraryObj) { + $libraryName = $libraryObj->info["name"]; + $libraryIcon = (isset($libraryObj->info["icon"]) && ($libraryObj->info["icon"]!= ""))? $libraryObj->info["icon"] : "/images/browse.gif"; + $libraryDescription = trim(str_replace("*", "", implode(" ", $libraryObj->info["description"]))); + $triggerCount = count($libraryObj->methods); + + if ($triggerCount > 0) { + //Sort alpha + ksort($libraryObj->methods, SORT_STRING); + + //Now the Triggers + //Library Father (Name + Description) + $oNode = &$oTree->addChild($keyLibrary, "  
\"\"  " . $libraryName . " ($triggerCount)
$libraryDescription
", array("nodeType" => "parent")); + $oNode->contracted = ($triggerLibraryOCount == 1)? false : true; + + //Library Childs (available methods) + foreach ($libraryObj->methods as $methodName => $methodObject) { + $methodName = $methodObject->info["name"]; + $methodLabel = $methodObject->info["label"]; + $methodDescription = trim(str_replace("*", "", implode(" ", $methodObject->info["description"]))); + + $oAux1 = &$oNode->addChild($keyLibrary . "-" . $methodName, "
" . $methodLabel . " (" . $methodName . ")
" . $methodDescription . "
", array("nodeType" => "child")); + //$oAux1->plus = ""; + //$oAux2 =& $oAux1->addChild($keyLibrary."-".$methodName."-desc", "$methodParameters", array('nodeType'=>'parent')); + } + } + } + + error_log("\n*****\n", 3, "/home/victor/MyLog.log"); + error_log(print_r($oTree, true), 3, "/home/victor/MyLog.log"); + + echo $oTree->render(); +} catch (Exception $e) { + die($e->getMessage()); +} + +unset($_SESSION["PROCESS"]); + diff --git a/workflow/engine/xmlform/triggers/triggerCopy.html b/workflow/engine/xmlform/triggers/triggerCopy.html new file mode 100644 index 000000000..f4a39c4df --- /dev/null +++ b/workflow/engine/xmlform/triggers/triggerCopy.html @@ -0,0 +1,62 @@ +
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$form.PRO_UID}
{$form.TRI_UID}
{$form.TRI_PARAM}
{$form.TRI_TYPE}
{$form.FIELDS_REQUIRED}
{$form.LBLTITLE1}
{$PROCESS_UID}{$form.PROCESS_UID}
{$TRIGGER_UID}{$form.TRIGGER_UID}
* {$TRI_TITLE}{$form.TRI_TITLE}
{$TRI_DESCRIPTION}{$form.TRI_DESCRIPTION}
{$TRI_WEBBOT}{$form.TRI_WEBBOT}
{$form.BTNCOPYSAVE} {$form.BTNCANCEL}
+
+
* Required Field
+
+
+ +
+ diff --git a/workflow/engine/xmlform/triggers/triggerCopy.xml b/workflow/engine/xmlform/triggers/triggerCopy.xml new file mode 100644 index 000000000..a675c6229 --- /dev/null +++ b/workflow/engine/xmlform/triggers/triggerCopy.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + Trigger Information + + + + SELECT PRO.PRO_UID, CON.CON_VALUE + FROM PROCESS AS PRO, CONTENT AS CON + WHERE PRO.PRO_UID = CON.CON_ID AND CON.CON_CATEGORY = 'PRO_TITLE' AND CON.CON_LANG = '@#LANG' + ORDER BY CON.CON_VALUE ASC + + + Process + + + + + + SELECT TGR.TRI_UID, CON.CON_VALUE + FROM TRIGGERS AS TGR, CONTENT AS CON + WHERE TGR.PRO_UID = '@#PROCESS_UID' AND + TGR.TRI_UID = CON.CON_ID AND CON.CON_CATEGORY = 'TRI_TITLE' AND CON.CON_LANG = '@#LANG' + ORDER BY CON.CON_VALUE ASC + + + Trigger + + + + + + Title of the new trigger + + + + SELECT CON.CON_VALUE + FROM CONTENT AS CON + WHERE CON.CON_ID = '@#TRIGGER_UID' AND CON.CON_CATEGORY = 'TRI_DESCRIPTION' AND CON.CON_LANG = '@#LANG' + + Description of the new trigger + + + + SELECT TGR.TRI_WEBBOT + FROM TRIGGERS AS TGR + WHERE TGR.TRI_UID = '@#TRIGGER_UID' + + Script + + + + Copy/Import and Save + + + + Cancel + + + + + + + diff --git a/workflow/engine/xmlform/triggers/triggersCustom.html b/workflow/engine/xmlform/triggers/triggersCustom.html index 2fa8c4dc9..5a5760df5 100755 --- a/workflow/engine/xmlform/triggers/triggersCustom.html +++ b/workflow/engine/xmlform/triggers/triggersCustom.html @@ -19,7 +19,7 @@ {$TRI_TITLE} - {$form.TRI_TITLE} + {$form.TRI_TITLE} {$form.TRI_PARAM} @@ -30,17 +30,17 @@ {$TRI_DESCRIPTION} - {$form.TRI_DESCRIPTION} + {$form.TRI_DESCRIPTION} {$TRI_WEBBOT} - {$form.TRI_WEBBOT} + {$form.TRI_WEBBOT} - {$form.SAVE}{$form.BTN_CANCEL} + {$form.SAVE} {$form.BTN_CANCEL} - + diff --git a/workflow/engine/xmlform/triggers/triggersCustom.xml b/workflow/engine/xmlform/triggers/triggersCustom.xml index 0299d276b..a95773b5b 100755 --- a/workflow/engine/xmlform/triggers/triggersCustom.xml +++ b/workflow/engine/xmlform/triggers/triggersCustom.xml @@ -1,4 +1,4 @@ - + @@ -19,7 +19,7 @@ Description - + Save diff --git a/workflow/engine/xmlform/triggers/triggers_Options.xml b/workflow/engine/xmlform/triggers/triggers_Options.xml index 31f051377..f81235124 100755 --- a/workflow/engine/xmlform/triggers/triggers_Options.xml +++ b/workflow/engine/xmlform/triggers/triggers_Options.xml @@ -15,6 +15,8 @@ + + @@ -29,7 +31,7 @@ - + @@ -44,6 +46,9 @@ } } */ + var windowWidth = 600; + var windowHeight = 460; + function triggerEditWizardSource (sUID){ popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID=' + sUID +'&BYPASS=1' , 770, 510); } @@ -51,23 +56,30 @@ function triggerNew() { popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?PRO_UID=@%PRO_UID' , 600, 340); } - function triggerNewCustom() { - popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersEditCustom)?PRO_UID=@%PRO_UID' , 600, 460); + + function triggerNewCustom() + { + popupWindow("@G::LoadTranslation(ID_NEW_TRIGGERS)", "@G::encryptlink(@#triggersEditCustom)?PRO_UID=@%PRO_UID" , windowWidth, windowHeight); } - + + function triggerCopy() + { + popupWindow("@G::LoadTranslation(ID_TRIGGER_COPY_TITLE)", "@G::encryptlink(@#triggerCopy)?PRO_UID=@%PRO_UID" , windowWidth, windowHeight); + } + function triggerFromLibrary() { - popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersOptionList)?PRO_UID=@%PRO_UID' , 600, 400); + popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersOptionList)?PRO_UID=@%PRO_UID' , 600, 460); if (navigator.appName != "Microsoft Internet Explorer") { try { var oAllPs = document.querySelectorAll("div.panel_content___processmaker"); - oAllPs[3].style.height = "340px"; + oAllPs[3].style.height = "410px"; } catch(e) { // nothing to do } } } - + function triggerEdit(sUID) { popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID='+ sUID , 930, 600); } @@ -75,18 +87,18 @@ function triggerProperties( sUID ) { popupWindow('@G::LoadTranslation(ID_TRIGGERS)', '@G::encryptlink(@#triggersProperties)?TRI_UID='+ sUID , 600, 340); } - + function triggerPropertiesSave( form ) { - var doc = getField("OUT_DOC_FILENAME"); + var doc = getField("OUT_DOC_FILENAME"); if(doc.value=='') { alert(G_STRINGS.ID_FILEGENERATED); } - else + else { ajax_post( form.action, form, 'POST' ); currentPopupWindow.remove(); @#PAGED_TABLE_ID.refresh(); - } - } + } + } function triggerSave(form) { @@ -94,7 +106,7 @@ if(document.getElementById('TRI_UID')) { var triUid = document.getElementById('TRI_UID').value; } - var triTitle =document.getElementById('TRI_TITLE').value; + var triTitle =document.getElementById('TRI_TITLE').value; if(triTitle==''){ alert(G_STRINGS.ID_REQUIRED_NAME_TRIGGERS);return false; } @@ -109,7 +121,7 @@ } } if(triUid==''){ - reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(document.getElementById('PRO_UID').value),'POST') ; + reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(document.getElementById('PRO_UID').value),'POST') ; if(!reqName){ alert(G_STRINGS.ID_EXIST_TRIGGERS);return false; }else{ @@ -123,22 +135,22 @@ @#PAGED_TABLE_ID.refresh(); } } - //with this function, we are removing the spaces after and before of a string - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g, ""); + //with this function, we are removing the spaces after and before of a string + String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ""); }; //for trigger no wizard function triggerSave1(form) { - var triUid = ""; + var triUid = ""; if(getField('TRI_UID')) { var triUid = getField('TRI_UID').value; - } - if(triUid==''){ - var triTitle =getField('TRI_TITLE').value.trim(); + } + if(triUid==''){ + var triTitle =getField('TRI_TITLE').value.trim(); if(triTitle==''){ alert(G_STRINGS.ID_REQUIRED_NAME_TRIGGERS);return false; - } + } reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(getField('PRO_UID').value),'POST') ; if(!reqName){ alert(G_STRINGS.ID_EXIST_TRIGGERS);return false; @@ -157,7 +169,7 @@ function triggerDelete(sUID) { var validateResult; - + oRPC = XHRequest(); oRPC.options = { url : '../triggers/triggers_Ajax', @@ -184,11 +196,11 @@ }.extend(this); oRPC.make(); } - + function triggerNewWizard(nameFunction, library) {//alert('@G::encryptlink(@#triggerNewWizard)?PRO_UID=@%PRO_UID&NAME_FUN='+nameFunction+'& PARAMETERS_FUN='+parametersFunct+'&PAGED_TABLE_ID='+@#PAGED_TABLE_ID);return; popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggerNewWizard)?PRO_UID=@%PRO_UID&NAME_FUN='+nameFunction+'&LIBRARY='+library+'&PAGED_TABLE_ID='+@#PAGED_TABLE_ID , 600, 600); } - + ]]>