I'm trying to create a workflow starting with an immediate cgitask. I want to have it post some form data to the cgi program and also have a button to do a callback to a successor. It works except for when the post has occurred to my own cgi. After that the callback doesn't happen and the window doesn't close.
I'm using TeamSite 5.5.2 on Windows and ie 5.0 for a browser.
I've tried several things including using iw_cgi_wrapper.cgi, but it comes down to the javascript that posts to iwcallback.cgi doesn't cause the window to close or the next task to activate.
Here's my wft and the cgi program it is calling.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE workflow SYSTEM "../iwwf.dtd">
<!-- ============================================================ -->
<workflow name="CGITest"
owner="__TAG__('iw_user');"
creator="__TAG__('iw_user');"
description="Try to post to cgi, then do a callback to successor">
<template_script><
|;
$wapath =~ s|/\s*$||;
return("$wapath", "$iwbpath", "$wapath", "TRUE");
}
($bpath, $wapath, $avpath) = cleanup_paths(__VALUE__("$btag"),
__VALUE__("$watag"));
return("$avpath", "$bpath", "$wapath", "FALSE");
}
my($area_vpath, $branch_path, $work_area, $skip_branch) =
set_area("branch_path", "work_area");
#======================================================================
# JOB FORM DATA CAPTURE
#---------------------------------------------------------------------
# This section capture the necessary data on the job creation form in
# order to dynamically assemble a workflow.
#======================================================================
sub debug{
TAG_info(
iw_output_file => "<input type='text' value='/tmp/foo.xml'>",
iw_debug_mode =>
"<input type='radio' value='true'>True</input>" .
"<input type='radio' value='false'>False</input>",
);
}
#======================================================================
# Uncomment following line if you wish to enable workflow debugging.
#======================================================================
#&debug;
#=====================================================================
# XML JOB SPECIFICATION SKELETON
#=====================================================================
# This XML section is used to generate the job specification files based on
# input provided by the end-user in the job creation form.
]]></template_script>
<cgitask name="CreateCGIForm"
owner="__TAG__('iw_user');"
description="Create a form to post to" start="t" immediate="t">
<areavpath v='__INSERT__($area_vpath);'/>
<successors>
<successorset description="_Done">
<succ v='End'/>
</successorset>
</successors>
<command v="cgitest.cgi"/>
</cgitask>
<!-- =========================== End ============================= -->
<endtask name='End'>
</endtask>
<!-- ============================================================= -->
</workflow>
#!c:\teamsite\iw-perl\bin\iwperl
use TeamSite::CGI_lite;
use TeamSite:

CRparser;
use TeamSite::WFtask;
use strict;
my $cgi = TeamSite::CGI_lite->new();
$cgi->parse_data();
my $testfield1 = $cgi->{form}{testfield1};
my $testfield2 = $cgi->{form}{testfield2};
my $branch;
if (! ref $cgi->{form}{area_path}) {
$branch = $cgi->escape_html_data($cgi->{form}{area_path});
}
else {
$branch = TeamSite::CGI_lite->escape_html_data($cgi->{form}{area_path}[0]);
}
my
@exclude = ('testfield1','testfield2'); # this is emitted explicitly by our CGI
# grab everything else and html-tunnelize it
my $other_tunneled_data = $cgi->get_implicit_data_tunnel_html(
@exclude);
my ($task_id,$task);
if (defined $cgi->{form}{done}) {
$cgi->iwcallback("_Done","End of test");
}
else {
print<<"END";
Content-type: text/html
<html><head><title>Test CGI Post</title></head>
<form name="MyForm" method="POST" action="/iw-bin/iw_cgi_wrapper.cgi/cgitest.cgi">
<center>Branch: $branch</center>
field1: <input type="text" name="testfield1" value="$testfield1" /><br>
field2: <input type="text" name="testfield2" value="$testfield2" /><br>
END
print $other_tunneled_data;
if ( $testfield1 ne "" && $testfield2 ne "") {
print "Data posted: " . $testfield1 . " " . $testfield2 . "<br>";
}
print "<center><input type=\"submit\" value=\"Post Form\" name=\"submit\">";
print "</form><form name=\"mainform\" method=\"POST\" action=\"/iw-bin/iw_cgi_wrapper.cgi/cgitest.cgi\">";
print $other_tunneled_data;
print "<center><input type=\"submit\" value=\"Done\" name=\"done\">";
print<<"END";
</form>
</body>
</html>
END
}