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)
EAs being set inconsistently
Amanda_J_0204
Using Interwoven TeamSite 6.7.2 Service Pack 2, Windows 2003
We have a template that calls a cgi on save to set an EA for the DCR if an inline image has been saved in the template WYSIWYG.
The following gets called on save:
function getInlineImages()
{
var parameters = new Object();
top.hiddenFrameRunning = true;
var server = window.location.hostname;
parameters.DCRName = "/pathToTemplate/" + IWDCRInfo.getDCRName();
parameters.Content = IWDatacapture.getItem("/" + contentType + "/Content Main/ContentMain/Content").getValue();
IWDatacapture.callServer("/iw-bin/getInlineCommonImages.cgi", parameters, true);
}
The cgi writes results to a log file and sets an EA for the DCR. This works just fine in one environment, but it only works intermitently in the production environment. When it doesn't work, nothing gets saved to the log file.
The datacapture.cfg, .js, and cgi are the same on both environments, and none of these contain references that are specific to one environment.
Aside from mass diffing of files on one environment vs the other, is there anything that should be searched for that might prevent EAs from being written?
Find more posts tagged with
Comments
ACheethayil
Can you please provide the CGI details how EA is being set.
Amanda_J_0204
Can you please provide the CGI details how EA is being set.
Sure. Below is a snippet from the cgi:
my $host = hostname;
my $in = new CGI;
my $DCRName = $in->param("DCRName") || 0;
my $Content = $in->param("Content") || 0;
my $extor = HTML:
impleLinkExtor->new();
$extor->parse($Content);
#extract the img links
@img_srcs
= $extor->img;
print FILEHANDLE_log "
@img_srcs"
;
print FILEHANDLE_log "\n";
print FILEHANDLE_log "\n";
my $count = 0;
# LOOP THROUGH THE ARRAY FOR INDIVIDUAL IMAGES
foreach my $imagePath (
@img_srcs)
{
$imagePath = substr($imagePath, 1, length($imagePath));
my $dd_cmd = "iwextattr -s TeamSite/Metadata/inlineasset_$count=$imagePath $DCRName";
my $result = system($dd_cmd);
$count = $count + 1;
}
print FILEHANDLE_log "DCRName is: $DCRName";
print FILEHANDLE_log "\n";
print FILEHANDLE_log "\n";
print FILEHANDLE_log "Content is: $Content";
print FILEHANDLE_log "\n";
print FILEHANDLE_log "\n";
close(FILEHANDLE_log);
Adam Stoller
Do yourself a favor, rewrite that loop so that it creates an EA XML data file and runs iwextattr once per file rather than N times per file processed.
If any of your potential EA values have spaces in them - since you aren't quoting the key / value for the iwextattr command you're using, that will cause issues with the command line argument parsing. This is another reason to switch to the XML mode of iwextattr, white-space within EA values doesn't cause any issues there (including newlines).
So - more efficient, less prone to errors due to questionable data ... I'd rewrite the code and then see if you can reproduce the problem rather than trying to fix it within the existing code.
rwinterpacht
Question then, what does the command look like to set the EA from the xml? I'm trying to do something similar, where the EAs are output to a file along with a command, and then the file can be executed as a script to have the EA set. Here's the snippet:
$attr_xml = `iwextattr -l -x $cur_dir/$orig_filename`;
$attr_xml =~ s/\n//g;
print SCRIPTFILE "iwextattr -s -x '$attr_xml' $cur_dir/$orig_filename\n";
Here's an example of a line from the generated script, which may or may not have an EA:
[HTML]iwextattr -s -x '' /teamsite/iwmnt/default/main/WORKAREA/test/images/9237536_1.jpg [/HTML]
But when I run the script, it gives me this output, which appears to be breaking because of the xml format:
[HTML]ERROR:02006: Error locating [/HTML]
Any thoughts there?
nipper
iwextattr expects to receive the XML via STDIN, check out
this thread
from a number of years ago