Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
unlock both generated file and DCR
syim
I am having problem to use FormAPI to unlock both DCR and generated files if the DCR is not modified. I am making 2 system calls in the CGI to invoke iwunlock. It seems only the first system call can get called successfully. I am not sure if I can make system call twice in a CGI. Anyone, can spot what's wrong with my CGI?
=====================================================================================
Followings is the js file that calls the cgi to unlock both the generated file and DCR if the DCR is not modified:
function init() {
IWEventRegistry.addFormHandler("onClose", handle_close);
}
function handle_close()
{
var isModified = IWDCRInfo.isModifiedInWA();
if (!isModified)
{
unlockDCR();
}
return true;
}
function unlockDCR()
{
var parameters = new Object();
parameters.dcr_vpath = IWDatacapture.getDCRPath();
var workarea = IWDatacapture.getWorkarea();
var outputFile = IWPageGeneration.getOutputFile();
parameters.out_vpath = workarea + "/" + outputFile;
var server = window.location.hostname;
var url = "https://"+server+"/iw-bin/unlockdcr.cgi";
IWDatacapture.callServer(url, parameters, true);
}
init();
=========================================================================
The cgi file contains following lines to get the param and calling iwunlock to unlock both files:
use CGI qw(:all);
use TeamSite::Config;
$|=1;
my $iwhome = TeamSite::Config::iwgethome();
my $cgi = new CGI;
print "Content-type:text/html\n\n";
my $dcr_vpath = $cgi->param('dcr_vpath');
my $out_vpath = $cgi->param('out_vpath');
system "$iwhome/bin/iwunlock", "$dcr_vpath";
system "$iwhome/bin/iwunlock", "$out_vpath";
print <<HTML;
<html>
<head>
</head>
<body>
</body>
</html>
HTML
exit;
Find more posts tagged with
Comments
Adam Stoller
I'd suggest adding debugging code to your CGI to print out the actual values of the variables and perhaps redirect the output from the command into a log file (or switch from using system() to using qx() or something like that) so that you can see what iwunlock is potentially trying to tell you.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
syim
By doing more testing on the same FormAPI and CGI, I notice sometime none of the files (DCR and generated file) get unlock. sometime only one file get unlock, and sometime both files get unlock.
Looks like calling the CGI using FormAPI having predictable results. By looking into the debug output file, I can see the CGI get terminated before the iwunlock get called or only one iwunlock get called, that's why files did not get unlock. But I have no idea why the CGI stopped halfway.
Do you think it is the FormAPI rather the CGI is causing problem? Do I need to add some sort of delay in the FormAPI to allow the CGI get executed properly before closing the template?
Thanks
Adam Stoller
The CallServer function is asynchronous - as such the CGI should use a callback to the FormAPI code to complete the closing of the DCR and the basic routine for handling the close of the DCR should return false.
If you're not doing that, that might account for the problem you are seeing.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
syim
Is there an example available on how to use a callback to the FormAPI inside the CGI? Thanks.
syim
I am able to find some examples about the making callback from CGI, and I am able to fix my code to get it working now. Thanks.
KTReddy
We are also facing similar issue, Could you pls provide me some info. such as location of examples on server. I would appreciate, if you can attach examples or your fixed code.
Thanks.
syim
It's been a while, so I don't remember where I got the examples... However, the attached code is working on my system. Feel free to use it as an example.
Edited by syim on 03/23/05 09:03 AM (server time).