On TS 6.1/Solaris, I'm trying to filter the branch list created by make_branchpathlist so that it only shows the branches a user can access. Is there a function to do this already? Has anyone implemented it?
I copied make_branchpathlist from Usertask.pm and modfied it as a function inside my wft. The output I get in my debug file appears to be in the same format as with make_branchpathlist, but I get a "malformed header from script. Bad header=globalhelp: /opt/teamsite/iw-home/httpd/iw-bin/iw_cgi_wrapper.cgi" 500 error when I try to run it. "globalhelp" is the first branch in the list being returned.
Here's the code:
sub make_userbranchpathlist{
my $s_user = __VALUE__('iw_user');
my $iwhome = TeamSite::Config::iwgethome();
my
@UTF8_bstores = `$iwhome/bin/iwstoreadm -i`;
@UTF8_bstores = map {s/[\n\r]*$//; $_}
@UTF8_bstores;
my
@paths;
foreach $UTF8_bstore (
@UTF8_bstores){ my $Native_bstore = UTF8ToNative_2($UTF8_bstore);
my
@pathlist = get_paths($iwhome,"/$Native_bstore/main","branch");
@pathlist = map { s/^\s*//gs; s/\s*$//gs; NativeToUTF8_2($_); }
@pathlist;
@pathlist = sort
@pathlist;
unshift
@pathlist, "/$UTF8_bstore/main";
push
@paths,
@pathlist;
}
if ( $] ge "5.008") {
@paths = map { Encode::decode_utf8($_); }
@paths }
my(
@paths2);
foreach $s_path(
@paths){ chomp($s_path);
$cmd = "/opt/teamsite/iw-home/bin/iwlist -m -u $s_user $s_path";
$retcode = system("/opt/teamsite/iw-home/bin/iwlist -m -u $s_user $s_path");
if ($retcode == "0"){
chomp($s_path);
push (
@paths2, $s_path);
}
}
@paths2 = map { " <option>$_</option>\n" } sort
@paths2;
unshift
@paths2, "<select size=1>\n";
push
@paths2, "</select>\n";
my $pathlist_html = join('',
@paths2);
return $pathlist_html;
}
Could there be an encoding problem with the second array? Should I try to do the tests with the original array?
Any help is appreciated...