ENV: win2k/TS61
http://www.treeview.net js navigation menu downloaded in TS workarea.
I have a perl question in relation to a dynamic navigation bar that is configured via perl to work with a DCR. Here is the code in the presentation template:
<iw_pt name="lpg_menu Presentation Template">
<iw_perl>
<![CDATA[
use File::Basename qw/fileparse/ ;
my $filename = iwpt_get_ofile_name() ;
$filename =~ s/\\/\//g ;
my $pos = index("$filename","work") + 4 ;
my $dir = substr("$filename",0,$pos) ;
$filename = substr("$filename",$pos) ;
$pos = index("$filename",".html") ;
my $jsfile = substr("$filename",0,$pos) ;
$jsfile = "${jsfile}.js" ;
]]>
</iw_perl>
<![CDATA[
<link rel="stylesheet" href="/style/LpgIntranet.css" type="text/css">
<meta name="Content File" content="<iw_value name='$jsfile' />" />
<script src="/javascript/ua.js"></script>
<script src="/javascript/ftiens4.js"></script>
<script src="<iw_value name='$jsfile' />"></script>
<!--#include virtual="/logo-and-search.html" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images/template/de_clear.gif" width="10" height="1"></td>
<td align="center">
<table border=0><tr><td><font size=-2><a style="font-size:7pt;text-decoration:none;color:silver" href=
http://www.treeview.net/treemenu/userhelp.asp target=_top>Tree Menu Help</a></font></td></table>
<script>initializeDocument()</script>
<noscript>A tree for site navigation will open here if you enable JavaScript in your browser.</noscript>
</td>
</tr>
<script language="JavaScript">
var leftCookie = new Cookie(document,"contentEdit",365,"/") ;
if (leftCookie.load()) {
document.write('<tr><td colspan="2" align="center"><a href="
http://CATORDEV/iw-cc/command/iw.group.ccstd.edit?done_page=/iw-cc/command/iw.ccstd.list_directory?vpath=//CATORDEV/default/main/Intranet/LPG+Intranet/WORKAREA/work/content&full_redirect=true&vpath=//CATORDEV/default/main/Intranet/LPG+Intranet/WORKAREA/work<iw_value name='$filename' />" target="_blank" title="Click here to edit this left hand menu"><img src="/editor/edit-menu.gif" width="99" height="25" border="0"></a></td></tr>') ;
}
</script>
</table>
]]>
#
# Open the Javascript file and write the initial lines of code.
#
<iw_perl>
<![CDATA[
my $menuicons = iwpt_dcr_value('dcr.MenuIcons') ;
my $menutitle = iwpt_dcr_value('dcr.MenuTitle') ;
my $menutitleurl = iwpt_dcr_value('dcr.MenuTitleURL');
my $useicons = "0" ;
if ($menuicons eq "true") {
$useicons = "1" ;
}
my $title = "" ;
my $url = "" ;
my
@jsfile1 = new IO::File(">$dir.%jsfile");
#use IO::File;
#$jsfile1 = new IO::File;
#if ($jsfile1->open(">$dir.%jsfile")) {
print $jsfile1 qq{
USETEXTLINKS = 1
STARTALLOPEN = 0
USEFRAMES = 0
USEICONS = $useicons
WRAPTEXT = 1
PERSERVESTATE = 1
HIGHLIGHT = 1
ICONPATH = "/images/template/"
foldersTree = gFld("<b>$menutitle</b>", "$menutitleurl")
};
};
]]>
</iw_perl>
<iw_iterate list="dcr.Menu" var="menu">
<iw_perl>
<![CDATA[
$title = iwpt_dcr_value('menu.Title');
$url = iwpt_dcr_value('menu.URL');
print $jsfile1 qq{aux2 = insFld(foldersTree, gFld("$title", "$url"))};
]]>
</iw_perl>
<iw_iterate list="menu.MenuItem" var="menuitem">
<iw_perl>
<![CDATA[
$title = iwpt_dcr_value('menuitem.Title');
$url = iwpt_dcr_value('menuitem.URL');
print $jsfile1 qq{insDoc(aux2, gLnk("S", "$title", "$url"))
};
]]>
</iw_perl>
</iw_iterate>
</iw_iterate>
<iw_perl>
<![CDATA[
print $jsfile1 qq{foldersTree.treeID = "t2"};
close $jsfile1;
]]>
</iw_perl>
</iw_pt>
The problem is that I can not get the line my
@jsfile1 = new IO::File(">$dir.%jsfile"); working. If I use the commented code, then the js file is not generated, but the js file can be saved. There is nothing recorded in the js file however.
I attached the tpl, datacapture.cfg, a dcr and the js file that is used in a zip to this case. It would be nice to have this functionality working for reference to other customers.
kindest regards,
boix