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)
two questions about presentation template
FrankX
1) How to using presentation generate file without file extension? I'm going to using presentation template generate a file (NOT xml or html, our internal legacy format) base on DCR and it's EA.
2) How to get the EA of DCR in presentation template? Using <iw_system> call iwextattr?
Thanks in advance.
Find more posts tagged with
Comments
Adam Stoller
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
FrankX
thanks ghoti. I am a newer to Teamsite. Could you inform me how to get the attribute and ext attribute of DCR in <iw_perl>?
Joshua
this will return all the extended attributes, if you want a particular one, you could definetly dumb this down. put this inside a iw-perl tag and then pass it the vpath to the file you want to return extended attributes off of.
#=====================================================================
# Name: return_ext_attr_hash
# Args: $path_value
# Usage: %list = return_ext_attr_hash($path_value);
# Purpose:
# Returns a hash of TeamSite extended attributes.
#
# Returns: None
#=====================================================================
sub return_ext_attr_hash {
my ($path_value) =
@_
;
my %currAttrHash;
my $attrList = `$iwhome/bin/iwextattr -l $path_value`;
my
@attrArray
= split /\n/, $attrList;
foreach my $attrPair (
@attrArray)
{
my $key = $attrPair;
$key =~ s/([^=]*)=.*/$1/;
my $value = $attrPair;
$value =~ s/.*=(.*)/$1/;
$currAttrHash{$key} = $value;
}
return %currAttrHash;
}
Migrateduser
Currently, there is no iw-perl method of getting this information. It'd be great if there were but you'll need to either write your own or retrieve it via backticks or equivalent.
Dave
Current Environments:
(1,2) TS 6.5 on W2K3
(3) Vignette V7 Portal on Solaris 9
Adam Stoller
I believe the following is a bit better rendition of the code
#=====================================================================
# Name: return_ext_attr_hash
# Args: $path_value
# Usage:
$
list = return_ext_attr_hash($path_value);
# foreach(keys(%$list)){...}
# if ($list->{"TeamSite/Metadata/foobar"} eq "mumble"){...}
# etc.
# Purpose:
#
Retrieve a list of all TeamSite extended attributes for a given file
# Returns:
# Returns a
reference to a
hash of TeamSite extended attributes.
#=====================================================================
sub return_ext_attr_hash {
my $path_value =
shift
;
my %currAttrHash;
my $attrList =
qx(
$iwhome/bin/iwextattr -l $path_value
)
;
$attrList =~ s|\r\n|x_newline_x|gsm; # newlines in textareas tend to be \r\n
my
@attrArray
= split /\n/, $attrList;
foreach my $attrPair (
@attrArray)
{
my($key, $value) = split(/=/, $attrPair, 2);
$value =~ s|x_newline_x|\n|gsm;
$currAttrHash{$key} = $value;
}
return
\
%currAttrHash;
}
It's generally better to pass references to lists and hashes than to pass the actual structure, which would entail a copy operation internally.
I also prefer using
qx(...)
over
`...`
as the latter can occasionally get confused with
'...'
(single-quotes instead of back-tics) depending on what font one is viewing the code with.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com