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)
Use the extended attributes on the DCR
vinylrecord
Use the extended attributes on the DCR to determine the category and type and set up XPath queries based on that.
can anyone please elaborate on the usage of extended attributes to find out category n type of a DCR.It would be a gr8 help if u cud provide pointers as to where i can get details on how to actually use extended attributes.
Thanks
Find more posts tagged with
Comments
mogoo
vinylrecord-
What exactly are you trying to accomplish?
This will return the current DCR being used...
$dcr_path = iwpt_get_dcr_name();
($null,$templatedata,$category,$type,$dcr_name) = split /\/, $dcr_path;
Or, if you're looking at the HTML, and trying to figure out the DCR path, you can use this subroutine. It can be changed to return PrimaryPT and PrimaryDCR..
---------------------------------------------------
$category_and_type = getEA('/default/main/PATH/TO/HTML','TeamSite/Templating/PrimaryDocumentType');
---------------------------------------------------
sub getEA
{
my $file = shift;
my $eaname = shift;
my $eacmd;
my $value;
my $eaargs;
if ($eaname)
{
$eaargs = "-g \"$eaname\" \"$file\"";
}
else
{
$eaargs = "$file";
}
$eacmd = "$iwhome/bin/iwextattr $eaargs";
$value = `$eacmd`;
return $value;
}
...Hope that helps?
maureen
vinylrecord
hi
Thnaks a lot for ur the help. please can you help us a little more.
what we want is when the generated html page, is opened in the edit mode,the cooresponding dcr open.
we want to make changes in this dcr and save it, then on save we want to call a workflow, we need this output file/htm page path.
like you pointed out the variable to capture the dcr path , is there any way to capture the outfile file pathi.e the htm..
it would be a great help if you could reply back..
thanks..
vinylrecord
one thing, i want these values in the workflow, and not in the tpl.. i hope there is a confusion... so want to clarify that i need the name of the dcr from within the workflow..
mogoo
OK, you could definately use the 2nd example I gave in a workflow, it should work. Not sure about the first, it's listed under <iw_perl> in the templating manual. But maybe you could insert a "use" statement into the workflow, and still have access to these calls? Not sure, you'll have to play around with it.
Another call is iwpt_get_ofile_name(), which will return the name of the outputted html page. Again, not sure if this will work inside a workflow...
What we do, thanks to someone else's nifty idea on this forum, is tag the DCRs with an extended attribute. Then it can be accessed easily in a workflow via a command line call...
1. add this chunk to the bottom of your tpl, between iw_perl tags. This will add an extendend attribute to your DCR.
=====================================================
#associates the DCR with the most recent htm generated from it
#in workflow, automatically attaches htm to dcr
use TeamSite::Config;
(my $iwhome = TeamSite::Config::iwgethome()) =~ tr|\\|/|;
my $outputName = iwpt_get_ofile_name();
my $dcrName = iwpt_get_dcr_name();
my $param = iwpt_get_flag_param('-oprefix');
if($param eq ''){
updateDCR($outputName,$dcrName);
}
sub updateDCR {
my $htmlname = shift;
my $dcrname = shift;
$dcrname =~ s/\.iwmnt/iwmnt/;
$htmlname =~ s/\.iwmnt/iwmnt/;
my $cmd;
$cmd = "$iwhome/bin/iwextattr -s HtmlLocation=$htmlname $dcrname";
`$cmd`;
}
=====================================================
2. access this ea in the workflow...
=====================================================
my $iwmount = TeamSite::Config::iwgetmount();
my $workarea = __VALUE__('iw_workarea');
my $dcr = __VALUE__('iw_file');
my $generated_file = "$iwhome/bin/iwextattr -g HtmlLocation $iwmount$workarea$dcr";
=====================================================
vinylrecord
hi
i tried out ur suggested way...
but things are not working right...
these arugemnts have null value..
so.. right now, things are not working
mogoo
what exactly are you trying and what exactly is returning null? it might help if you attached the relevant files...
maureen
vinylrecord
hi..
waht i did was added the code in the tpl, and other part of code as u had mentioned in the workflow..
i assumed that in the workflow.. the corres.variables wil have the values. but when i used these variables later in the workflow, there valuesa re null...