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)
generate DCR task
myr
I have built an index DCR that displays links to the five most recent news articles DCRs in chronological order. What I would like to do is add a task in the news article workflow that would also generate and deploy the index DCR each time a news story is added to the site. (so it will refresh to display the newest story) Thanks for any advice or ideas that people can offer.
Find more posts tagged with
Comments
Migrateduser
That's a common requirement and that approach is often taken by others. I assume your index DCR does the dirty work of actually listing the articles in chronological order? Then, have an externaltask in your workflow that (re)generates the index after each new article.
Dave
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
Adam Stoller
Another thing you *might* consider looking at is Interwoven's LiveSite.
I haven't had a chance to play with it yet - but I believe it provides this kind of functionality (in a different manner) OOTB - it looks like a really neat product and provides a lot of nifty functionality.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
shanon
myr,
Fish is correct; LiveSite would be a great option to do things like this and a whole lot more. LiveSite introduces xml-based components that are completely customizable by non-technical users. It provides a presentation layer via a Java Web Application that is tightly integrated with TeamSite. OOTB you get DCR Lists that allow you to select a directory in templatedata which is sucked up dynamically as DCRs are deployed and you can choose to sort by any of the data inside the DCR itself. Of course, this is a basic example; an interface is provided for back-end customization (e.g. retrieving information from a DB or via a SOAP call, etc).
If you want to see it in action, please talk to your AE to arrange a demo.
-shanon.
--------------------------
Sr. Solutions Engineer
Interwoven, Inc.
shanon@interwoven.com
examplereports.zip
Migrateduser
My way costs less
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
myr
Thanks for the suggestion. I discovered a script in the solutions directory that will generate (or regenerate) files from the DCRs attached to a task and added the following external task that points to this script (right before the deployment task). However I still can't get the script to work. Any ideas?
<!-- GenerateMainPage task -->
<externaltask name = "GenerateMainPage"
owner="__TAG__('iw_user');"
description="Generate Main Page">
__INSERT__("<areavpath v='$area_vpath'/>");
<successors>
<successorset>
<succ v="DeployToProduction"/>
</successorset>
</successors>
__INSERT__(get_cmd("iwtask_genfiles.ipl"));
<activation>
<pred v="SubmitPagesToStagingArea"/>
</activation>
</externaltask>
myr
I've got the script working now- it will generate the html page and attach the file to the workflow. However now I'm having a problem getting the generated file to save to another directory. (the out-of-the-box script saves the generated file in the same directory as the DCR). I've added the following variable to the external perl script -
my $generatedFile_dir = "/default/main/atmfs_dev/WORKAREA/content";
And then I try to pass this parameter to the output file name:
my $ofile = "$generatedFile_dir$dcr_name.shtml";
However nothing is happening? Can anyone suggest additional steps for debugging or have any examples that you can share with me? Thanks,
Myriam
Adam Stoller
I suggest you post more (all?) of the code - as your description of what is happening seems to indicate that your code is not doing what you think it is supposed to.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
myr
Here is the complete section of code that I'm trying to modify in the external perl script. Thanks for any help/suggestions.
-Myriam
#---------------------------------------------------------------------
# generateFiles
# Generate (or regenerate) files from a DCR.
#
# ARGUMENTS
# $dcr - The area relative path to a DCR.
# $areapath - The areapath.
# $ptref - Reference to a list of presentation templates.
# RETURNS
# A list of generate files as area relative paths.
#---------------------------------------------------------------------
sub generateFiles
{
my ($dcr, $areapath, $ptref) =
@_
;
my
@generatedFiles
= ();
my
@templates
=
@$ptref
;
my $dcr_path = "$areapath/$dcr";
my $generatedFile_dir = "/default/main/atmfs_dev/WORKAREA/content";
$dcr_path =~s|\\|/|g;
# Period followed by two to four characters.
my
@suffix_patterns
= ("\.\\w{2,4}");
my ($dcr_name, $dcr_dir, $dcr_ext) = fileparse($dcr_path);
# The DCR many not have any extension.
($dcr_name, $dcr_dir, $dcr_ext) = fileparse($dcr_path) unless $dcr_name;
use Cwd;
debug("You are in " . getcwd);
# A temporary file for the mainfest.
my $manifest = "$temp_dir/mainfest_$$.xml";
for my $pt (
@templates)
{
# XYZZY: Oh what shall we use as the output file name?
my ($pt_name, $pt_dir, $pt_ext) = fileparse($pt,
@suffix_patterns)
;
my $ofile = "$generatedFile_dir$dcr_name.shtml";
# XYZZY: If we use iwpt_compile.ipl instead of iwgen, we may want
# to set EAs on the generated files.
# NB: This may overwrite existing files.
my $task_cmd="$iwhome/bin/iwpt_compile.ipl -pt $pt -iw_pt-dcr $dcr_path -ofile $ofile -manifest $manifest -smartwrite";
debug("Gen command: $task_cmd");
# XYZZY: Check result, report any problems.
`$task_cmd`;
# Read the manifest into
@generatedFiles
.
if (-f $manifest) {
my $mani_node = TeamSite::XMLnode->new(slurp($manifest), "xml");
# Paths are relative to what?
for my $ofile ($mani_node->get_node_list('ofile')) {
debug("Generated file: " . $ofile->value());
# Ignore unmodified files.
next if $ofile->get_attrib('modified') eq 'f';
push
@generatedFiles
, $ofile->value();
}
unlink $manifest;
} else {
debug("No manifest was produced.");
}
}
return
@generatedFiles
;
}
# Slurp the contents of a file into a string.
sub slurp
{
my ($path) =
@_
;
open(SRC, "<$path") or die "Could not open file: $path";
local $/; # Temporarily undefs the record separator
my $data = <SRC>; # "slurp" in the whole file
close SRC;
return $data;
}
Adam Stoller
What does the output from:
debug("Gen command: $task_cmd");
look like?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com