hello,
im very close to successfully migrating a 5.5.2 teamsite install to 6.5 on windows but am stuck when trying to migrate custom menu items (well, one in particular)
ive managed to incorporate the new_content.ipl (code found below) into a cc pro menu item but the window sizing is all screwed up when i try to run the functionality. any suggestions on trying to fix this?
#!e:\iw-home/iw-perl/bin/iwperl
use strict;
use CGI;
use File:

ath;
use Rogers::Utils qw(write_metadata);
my $iwdd = 'd:\\iw-home\\DataDeploy\\bin\\iwdd.ipl';
my $cfg = '"d:\\iw-home\\local\\config\\ea_dd.cfg"';
main();
exit(0);
### MAIN ROUTINE
sub main
{
print "Content-type: text/html\n\n";
my $query = new CGI();
# ### DEBUG: uncomment to print the environment
# dump_CGI($query);
my $area_path = $query->param('area_path');
if (!$area_path)
{
print "You should be in a workarea to perform this operation\<br>\n";
return;
}
$area_path =~ tr|\\|/|; # ... and make it POSIX compliant
### ENVIRONMENT IS OK
### CARRY ON WITH THE PROCESSING
my $ctype = $query->param('ctype');
my $zone = $query->param('zone');
my $user_name = $query->param('user_name');
if ($ctype)
{
my $file_path = $area_path."/templatedata/content/".$ctype."/data/".
generate_file_path($user_name);
invoke_DCT($file_path, $ctype, $zone, $user_name);
}
else
{
display_ct_form($area_path, $user_name);
}
return;
}
### SUBROUTINES
sub dump_CGI
{
my $query = shift;
my
@params = $query->param();
if (
@params) {
foreach my $key (
@params) {
print $key." = ".$query->param($key)."\<br>\n";
}
}
print "\<br>\<br>\n";
}
sub invoke_DCT
{
my $file_path = shift;
my $ctype = shift;
my $zone = shift;
my $user_name = shift;
create_stub_DCR($file_path);
# set the extended attributes to tell Interwoven
# to which datatype this DCR belongs, set the creation date
# and creator's username
my ($sec, $min, $hour, $mday, $mon,
$year, $wday, $yday, $isdst) = get_localtime();
my $created = sprintf("%u/%02u/%02u:%02u%02u",
$year, $mon, $mday, $hour, $min);
my $metadata_hash_ref = {
'TeamSite/Templating/DCR/Type' => "content/$ctype",
'TeamSite/Metadata/Username' => $user_name,
'TeamSite/Metadata/Created' => $created,
};
write_metadata($file_path, $metadata_hash_ref);
# chop off the drive letter
$file_path =~ s/^..//;
# synchronize metadata DB
# sync_db($file_path);
# now print the invocation Java Script code
print <<"ENDJS";
<script>
location = '/iw/webdesk/edit?vpath=$file_path';
</script>
ENDJS
}
sub display_ct_form
{
my $area_path = shift;
my $user_name = shift;
print <<"ENDFORM";
<script>
function triggerClose()
{
setTimeout("window.close()", 20000);
return true;
}
</script>
<form name="contentType"
action="new_content.ipl"
method="post"
target="loader"
onSubmit="triggerClose()">
<input type="hidden" name="area_path" value="$area_path">
<input type="hidden" name="user_name" value="$user_name">
<select name="ctype">
<option value="">SELECT CONTENT TYPE</option>
<option value="archive">Archive</option>
<option value="article">Article</option>
<option value="html">HTML</option>
<option value="newsletter">Newsletter</option>
<option value="photogallery">Photo Gallery</option>
<option value="songlist">Song List</option>
<option value="bio">Bio page</option>
<option value="interview">Interview and review</option>
<option value="showpage">Radio show info and event page</option>
<option value="contest">Contest</option>
<option value="radionews">Radio news item</option>
<option value="song_requests">Request Song List</option>
</select>
<br><br>
<input type="submit" name="submit" value="Submit">
<input type="reset" value="Clear">
<br>
</form>
<iframe name="loader" frameborder="0" src="/iw/blank.html">
</iframe>
ENDFORM
}
# this one should really be moved to Utils.pm
sub generate_file_path
{
my $user_name = shift;
my ($sec, $min, $hour, $mday, $mon,
$year, $wday, $yday, $isdst) = localtime(time);
$mon++;
$year += 1900;
$user_name =~ s/^\w+\\//;
#my $file_path = sprintf("%u/%02u/%u%02u%02u_%02u%02u%02u_%s",
# $year, $mon, $year, $mon, $mday, $hour, $min, $sec, $user_name);
# use PID instead of the name
my $file_path = sprintf("%u/%02u/%u%02u%02u_%02u%02u%02u_%s",
$year, $mon, $year, $mon, $mday, $hour, $min, $sec, $$);
return $file_path;
}
sub get_localtime
{
my
@array = localtime(time);
$array[4]++; # adjust month
$array[5] += 1900; # adjust year
return (
@array);
}
# move this to Utils.pm too
sub create_stub_DCR
{
my $file_path = shift;
my $ctype = shift;
my $user_name = shift;
$file_path =~ /(.+)\/(\w+)$/;
my $dir_name =$1;
my $file_name = $2;
# create the directory if required
if (! -d $dir_name)
{
# print "path does not exist\<br>\n";
mkpath($dir_name);
}
if (!open(FH, ">$file_path"))
{
print "ERROR: cannot create stub DCR\n$file_path\n$!";
die "ERROR: cannot create stub DCR\n$file_path\n$!";
}
print FH <<"ENDDCR";
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE record SYSTEM "dcr4.5.dtd">
<record name="$file_name" type="content"></record>
ENDDCR
close(FH);
}
# synchronize metadata DB
sub sync_db($)
{
my $file_path = shift;
$file_path =~ /(.+?(?

?

ublishing)|(?:radio))[\\\/](\w+)[\\\/](\w+)[\\\/].*?WORKAREA[\\\/]\w+)([\\\/].+)$/;
my $basearea = $1;
my $basetable = $2."_".$3;
my $dcr_file = $4;
run("$iwdd deployment=metadata cfg=$cfg "
."mybasearea=$basearea mybasetable=$basetable "
."mytemplatepath=$dcr_file");
}
# run an external command and log the output
sub run
{
my $cmd = shift;
my $errno = 0;
# the stupid thing does not read metadata if paths have back slashes
# duh!
$cmd =~ tr|\\|/|;
my $out = `$cmd 2>&1`;
if ($?)
{
my $errno = $?;
}
return $errno;
}
also, iwov support have suggested the following but being a non-programmer im struggling to work out what needs to be done. any suggestions would be greatly appreciated:
Looking through your script, these items look like they will need to be tweaked:
1. Check all your passed in parameters, those may not work anymore.
2. location = '/iw/webdesk/edit?vpath=$file_path';
the above still works since legacy CCI urls have been redirected internal to work. But you may want to look at upgrading the URL, here is a KB article about the new link formats:
https://support.interwoven.com/kb/kb_show_article2.asp?ArticleID=505283. /iw/blank.html: this is no longer available in 6.5, you can either add this file from your old system or change the following lines:
<iframe name="loader" frameborder="0" src="/iw/blank.html"> </iframe>
4. <!DOCTYPE record SYSTEM "dcr4.5.dtd"> ==> you may want to upgrade this to the new datacapture6.0.dtd if you want to use newer features.