function nf_logMessage($taskid, $processID) { $nfclass = new nexflow($processID); $nfclass->set_currentTaskid($taskid); $logfileMsg = $nfclass->get_taskOptionalParm(); nf_changeLog($logfileMsg); return true; }
function nf_testsuite_setvar1_posthandler($processid, $taskid, $userid, $projectid) { if ($processid > 0 and $taskid > 0) { $nfclass = new nexflow($processid, $userid); $nfclass->set_currentTaskid($taskid); $msg = $nfclass->get_taskOptionalParm(); $var1 = COM_applyFilter($_POST['var1'], true); $nfclass->set_processVariable('VAR1', $var1); $nfclass->complete_task($taskid); nf_changeLog("You set VAR1 to {$var1}. Verify the following messages line up!"); } }
switch ($action) { case 'Accept': // Attach to workflow instance - pass in process to attach to and the complete the current task $nfclass = new nexflow($processid); $nfclass->complete_task($taskid); // Normal completion status - accept nf_changeLog("Manual Web Task, Process: {$processid}, Workflow Queue ID: {$taskid}. Accept Status Set"); echo COM_refresh($_CONF['site_url'] . '/nexflow/index.php'); exit; break; case 'Reject': // Attach to workflow instance - pass in process to attach to and the complete the current task $nfclass = new nexflow($processid); $nfclass->cancel_task($taskid); // Cancel completion status - reject nf_changeLog("Manual Web Task, Process: {$processid}, Workflow Queue ID: {$taskid}. Reject Status Set"); echo COM_refresh($_CONF['site_url'] . '/nexflow/index.php'); exit; break; } echo COM_siteHeader(); echo COM_startBlock('Test suite basic handler script'); echo '<div class="pluginInfo" style="padding:20px;border:1px solid #CCC;"><fieldset><legend>Test suite Handler Script</legend>'; echo '<div><p>Test of a script used as extenal workflow handler. A basic form prompts the user with a question with two choices<ul style="margin-bottom:5px;margin-top:5px;"><li>accept or reject</ul></p><p>The workflow will then execute a different series of steps depending on the button pressed.</p><p>The external handler script can be a basic script or a complex application that returns control upon completion to the workflow engine. The next task can be basic conditional task like in this workflow example or someother task type like a batch task that checks external information or database query to determine the next task path to perform</p><p>A trace of the execution and the workflow path followed is captured in the error.log file<center>'; echo '<form method="get" action="' . $_CONF['site_url'] . '/nexflow/testsuite/yes-no.php"><br><br> <input type="submit" name="action" value="Reject"> <input type="submit" name="action" value="Accept"> <input type="hidden" name="taskid" value="' . $taskid . '"> <input type="hidden" name="processid" value="' . $processid . '"> </form></fieldset></center></p></div>'; echo COM_endBlock();
// +---------------------------------------------------------------------------+ // | | // | This program is free software; you can redistribute it and/or | // | modify it under the terms of the GNU General Public License | // | as published by the Free Software Foundation; either version 2 | // | 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 General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +---------------------------------------------------------------------------+ // require_once '../lib-common.php'; if (isset($_USER['uid'])) { $userid = $_USER['uid']; } else { $userid = 1; } $taskid = COM_applyFilter($_GET['taskid'], true); $processid = COM_applyFilter($_GET['processid'], true); nf_changeLog("Auto Batch test - Process id: {$processid}, Task id: {$taskid}"); $nfclass = new nexflow($processid, $userid); $nfclass->complete_task($taskid); echo COM_refresh($_CONF['site_url'] . '/nexflow/taskconsole.php'); exit;
$sql = "SELECT related_processes from {$_TABLES['nf_projects']}"; $res = DB_query($sql); while ($B = DB_fetchArray($res)) { if ($B['related_processes'] != '') { if ($relatedProcesses == '') { $relatedProcesses = $B['related_processes']; } else { $relatedProcesses .= ',' . $B['related_processes']; } } } if ($relatedProcesses != '') { $sql = "SELECT id FROM {$_TABLES['nf_queue']} WHERE archived is NULL and nf_processID in ({$relatedProcesses}) "; $query = DB_query($sql); while (list($qid) = DB_fetchArray($query)) { nf_changeLog("Nexflow delete project related process queue record:{$qid}"); DB_query("DELETE FROM {$_TABLES['nf_queue']} WHERE id={$qid}"); } } $nfclass->delete_process($pid); DB_query("DELETE FROM {$_TABLES['nf_projectforms']} WHERE project_id={$project_id}"); DB_query("DELETE FROM {$_TABLES['nf_projecttimestamps']} WHERE project_id={$project_id}"); DB_query("DELETE FROM {$_TABLES['nf_projectcomments']} WHERE project_id={$project_id}"); DB_query("DELETE FROM {$_TABLES['nf_projecttaskhistory']} WHERE project_id={$project_id}"); DB_query("DELETE FROM {$_TABLES['nf_projects']} WHERE id={$project_id} "); $html = '<div class="pluginAlert" style="margin:5px 20px 5px 20px ;padding:10px;">Project has been deleted'; $html .= ' - <a href="' . $CONF_NF['TaskConsole_URL'] . '?op=allprojects">refresh</a> the page.</div>'; $html = htmlentities($html); header("Cache-Control: no-store, no-cache, must-revalidate"); header("content-type: text/xml"); $XML = "<result>";