Home
TeamSite
Unlock DCR with FormAPI?
syim
Can I unlock the DCR using FormAPI onClose if the DCR is not modified?
I wrote a CGI to unlock speicifed DCR. The CGI can be invoked from a browser. On my javascript for the FormAPI, I registred an event on close. If the DCR is not modified, I'll make a server call to unlock the DCR. However, the DCR is still locked after DCR closed. Would it be the DCR was still open while the call is made, thus I cannot unlock the DCR?
Find more posts tagged with
Comments
nipper
You may need to make iwui an administrator or master on the system, since that is what formapi runs as. Did you log any of your output ?
syim
I found out that the CGI never got called by the FormAPI.
After many trial and error, I found out the following statement in my javascript caused the problem:
IWDatacapture.callServer(url, parameters);
After I put "true" as the third parameters like following and it worked.
IWDatacapture.callServer(url, parameters, true);
Still not sure why... because some of my other java scripts invoke callServer without specifying "true" as the third parameter and those java script worked...
phbillard
Hi
Could you share with me your code because I can't trigger the onClose event with the formapi, nothing appends.
My need is exactly the same as yours, unlocking DCR once they're closed.
phbillard@airfrance.Fr
Thanks
Philippe Billard
Air France
Interwoven Administrator
syim
I wrote a cgi to invoke iwunlock to unlock the DCR. Following is the FormAPI invoking the cgi when the Close button is clicked. It pass the vpath, dcr path and dcr filename to the cgi to unlock the DCR.
==================================
function unlockDCR()
{
var parameters = new Object();
parameters.area_path = parent.gWorkarea;
parameters.dcr_path = "/templatedata/Content/Main/data/";
parameters.dcr_name = IWDCRInfo.getDCRName();
var server = window.location.hostname;
var url = "http://"+server+"/iw-bin/unlock.cgi";
IWDatacapture.callServer(url, parameters, true);
}
function handle_close()
{
var isModified = IWDCRInfo.isModifiedInWA();
if (!isModified)
{
unlockDCR();
}
return true;
}
function init()
{
IWEventRegistry.addFormHandler("onClose", handle_close);
}
init();
phbillard
Thanks for your code it pretty much look like what I had.
What about your CGI, in the formapi, I pass the 3 variables to the callout :
var parameters = new Object();
parameters.workarea = parent.gWorkarea;
parameters.dcrname = IWDCRInfo.getDCRName();
parameters.dcrtdt = parent.gTDT;
var serveur = window.location.hostname;
IWDatacapture.callServer("http://"+serveur+"/iw-bin/af_unlockDcr.cgi", parameters, true);
And here is my cgi
#---------------------------------
#!/IW/iw-home/iw-perl/bin/iwperl
#-----------------------------------------------------------------------------
# File af_unlockDcr.cgi
#
# Author Philippe Billard
#
#-----------------------------------------------------------------------------
use CGI;
use Getopt:
td;
use TeamSite::Config
require Term::Cap;
#Turn buffering off.
$| = 1;
my $in = new CGI;
my $workarea = $in->param('workarea');
my $dcrname = $in->param('dcrname');
my $dcrtdt = $in->param('dcrtdt');
unlockDCR($workarea,$dcrtdt,$dcrname);
sub unlockDCR($workarea,$dcrtdt,$dcrname) {
open (LOGFIC, ">/tmp/af_unlock_dcr.log");
my $dcrPath = "/iwmnt$workarea/templatedata/$dcrtdt/data/$dcrname";
print LOGFIC "/iwmnt$workarea/templatedata/$dcrtdt/data/$dcrname\n";
my $unlock_cmd = "/IW/iw-home/bin/iwunlock $dcrPath";
print LOGFIC "/IW/iw-home/bin/iwunlock $dcrPath\n";
my $vu_Cr = system(unlock_cmd);
print LOGFIC "$vu_Cr\n";
close(LOGFIC);
The return code of the system call for iwunlock is 65280, and the DCR is still locked.
Any idea ?
Philippe Billard
Air France
Interwoven administrator
syim
My CGI is about the same... Not sure what's that error code mean. Did you try if you can issue iwunlock from a console and see if you are getting the same error msg?
fbas
Salut Philippe,
tu as essayé de l'appeler avec iw_cgi_wrapper.cgi ???
http://server/iw-bin/iw_cgi_wrapper/unlock.cgi
!!!!
kash kash