Hi
Im having the following problem:
when editors name an edition, they sometimes give it the same name as a previous edition (despite guidelines/naming conventions *sigh*).
This results in an old edition being deployed. (old content on the website -

)
Could anyone give me a perl-snippet to paste (marked in
red) into this script? :
(using TS 5.5.2 on win2k)
---------------------------------------------------------------------------
#!I:\INTERW~1\TeamSite/iw-perl/bin/iwperl
## File: custom_publish.ipl
## This script is invoked from the menu to make an edition. The script will
## create the edition and invoke OpenDeploy to do an deployment of the new
## edition.
## Usage:
## [iw-home]/etc/iw.cfg
## --------------------------------------------------
## [iwcgi]
## custom_menu_item_publish="File", "Publish", "custom_publish.ipl", "editor,admin,master", "scrollbars=yes,resizable=yes,width=640,height=545"
## --------------------------------------------------
use CGI;
use TeamSite::Config;
#----------------------------------------------------------------------------------
# Variables setup
#----------------------------------------------------------------------------------
$iwhome = TeamSite::Config::iwgethome();
$odhome = "i:/Interwoven/OpenDeploy/OpenDeployNG";
$odbin = $odhome . "/bin";
$odconf = $odhome . "/conf";
$odtemp = $odhome . "/tmp";
$odclient_cfg = "publish_deploy";
$page = new CGI();
$branch_path = $page->param('branch_path');
$branch_name = $page->param('branch_name');
$subbranch = lc($branch_name);
#----------------------------------------------------------------------------------
# Main program
#----------------------------------------------------------------------------------
# Generate HTTP reply header
header();
#
# Read configuration
#
open(CONFIG, $iwhome . "/local/config/deployment.cfg") || die "Unable to open configuration file";
@lines = <CONFIG>;
close(CONFIG);
eval("@lines");
die "Failed to eval() file.\n$@\n" if ($@);
page_top();
$submit = $page->param('publish');
if ($submit) {
# Done if the form was just submitted
$edition_name = $page->param('navn');
$edition_comment = $page->param('kommentar');
# Validate that an edition name was given!
if ($edition_name !~ /.+/) {
print "<p class=\"fontmain\" style=\"color: red;\">Edition name must be given!</p>\n";
publish_form($branch_name);
}
here I want to check if the edition name is used before
else {
# Make an edition and deploy with OD
$edition_name =~ s/ /_/g;
$cmd = qq($iwhome/bin/iwpublish $branch_path STAGING $edition_name "$edition_comment");
$rc = system($cmd);
my $targetarea = $paths{$subbranch} . "/publish";
my $targetnode = $deploy_nodes{$subbranch};
$cmd = qq($odbin/iwodstart $odclient_cfg -k "sourcearea=$branch_path\\EDITION\\$edition_name" -k "targetarea=$targetarea" -k "subbranch=$subbranch" -k "ddcfg=I:\\Interwoven\\DataDeploy\\conf\\$subbranch\\publish.xml" -k "targetnode=$targetnode");
$rc = (`$cmd`);
if ($rc =~ /Completed/) {
print "<p class=\"fontmain\">Publiceret og deployet staging som $edition_name.</p>\n";
} else {
print "<p class=\"fontmain\">Der opstod en fejl under publiceringen!</p>\n";
print "<pre>", $rc, "</pre>";
}
print "<form><input type=\"button\" value=\"Luk vindue\" onclick=\"window.close()\"/></form>\n";
}
} else {
# If the form hasnot been submitted show it
publish_form($branch_name);
}
page_bottom();
###################################################################################
# #
# Sub routines #
# #
###################################################################################
# Create HTTP headers
sub header {
print <<HEADER;
Content-type: text/html
HEADER
}
# Create page top
sub page_top {
print <<PAGETOP;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da" lang="da">
<head>
<link rel="stylesheet" type="text/css" href="/iw/webdesk/css/css_ie4_pc.css"/>
<title>Publish</title>
</head>
<body class="colortab">
<div class="colordark"><span class="fontbold">Publish</span></div>
PAGETOP
}
# Create page bottom
sub page_bottom {
print <<PAGEBOT;
</body>
</html>
PAGEBOT
}
# Create the publish form
sub publish_form {
print <<PUBFORM;
<p class="fontmain">Publicerer "$_[0]"</p>
<p class="fontmain">Udfyld formularen og tryk "Publiser".</p>
<form method="POST">
<input type="hidden" name="branch_path" value="$branch_path"/>
<input type="hidden" name="branch_name" value="$branch_name"/>
<table style="border: 0px; padding: 0px; margin: 0px; border-collapse: collapse;">
<tr>
<td class="fontmain">Edition navn:</td>
<td><input type="text" size="25" name="navn"/></td>
</tr>
<tr>
<td class="fontmain">Kommentar:</td>
<td><textarea cols="45" rows="5" name="kommentar"></textarea></td>
</tr>
<tr>
<td/>
<td><input type="submit" name="publish" value="Publicer"/> <input type="button" value="Annuller" onclick="window.close();"/></td>
</tr>
</table>
</form>
PUBFORM
}
---------------------------------------------------------------------------