Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Retrieving DCR Path in FORMAPI
jamesk
Using formapi im using callserver to run a perl script. I need to know in this perl script the path of the dcr. Is there a way of retrieving the path in formapi? or even the name of the dcr so i can work it out?
thanks
James
Find more posts tagged with
Comments
meikel
Hi James,
I use in PT-templates this:
$entire_name = iwpt_get_dcr_name();
$directory = iwpt_get_dcr_name('dirname');
$only_dcrname = iwpt_get_dcr_name('basename');
May be it helps
regards
meikel
jamesk
yeah thanks
i was trying to work out how to do it from with the dct using formapi. any other ideas?
Smeeta
James,
I have the same issue. did you find a solution to your problem?
Smeeta
here is something you can do. You can register a handler for the event onSaveNameSpecified. The function that you invoke on this handler receives a parameter that will give you the entire path to the dcr.
here is the code
IWEventRegistry.addFormHandler("onSaveName Specified", SetDocEA);
function SetDocEA(vpath) {
alert(vpath);
return true;
you will notice that vpath provides the entire path to the dcr.
}
jamesk
thanks again.
ive tried what uve suggested and it works!!
GoldenState
Does this code have to be in TPL file?
meikel
yes
PaulD
I made a small perl script called inline from the datacapture.cfg to do this. Here's the code:
#!/usr/interwoven/iw-home/iw-perl/bin/iwperl -w
my ($iwbranch, $iwworkarea) = ($ENV{'IW_WORKAREA'} =~ /(.+)\/WORKAREA\/([^\/]+)/);
my $iwdct = $ENV{'IW_DCT'};
my $iwrole = $ENV{'IW_ROLE'};
my $iwuser = $ENV{'IW_USER'};
print << "EOT";
<?xml version="1.0" encoding="UTF-8"?>
<substitution>
<script language="JavaScript">
<![CDATA[
var iw_dct = "$iwdct";
var iw_role = "$iwrole";
var iw_user = "$iwuser";
var iw_workarea = "$iwworkarea";
var iw_branch = "$iwbranch";
]]>
</script>
</substitution>
EOT
#
# IW_DCT: The file system path to the datacapture.cfg in use (for example, /iwmnt/
# default/main/development/WORKAREA/maudlin/templatedata/press/events/
# datacapture.cfg).
# IW_ROLE: The role of the current data capture user (for example, editor).
# IW_USER: The full user name of the current templating user (for example, andre).
# IW_WORKAREA: The vpath to the current workarea (for example, /default/main/
# development/WORKAREA/chris).
Current role is already available via formapi but i implemented it here anyway.
enjoy, Paul