3 # Display the package tree
5 require './software-lib.pl';
6 &ui_print_header(undef, $text{'index_tree'}, "");
10 # work out the package heirarchy..
11 $n = &list_packages();
12 for($i=0; $i<$n; $i++) {
13 push(@pack, $packages{$i,'name'});
14 push(@vers, $packages{$i,'version'});
15 push(@svers, $packages{$i,'shortversion'} ||
16 $packages{$i,'version'});
17 push(@class, $packages{$i,'class'});
18 push(@desc, $packages{$i,'desc'});
20 @order = sort { lc($pack[$a]) cmp lc($pack[$b]) } (0 .. $n-1);
22 foreach $c (sort { $a cmp $b } &unique(@class)) {
25 $p = join('/', @w[0..$#w-1]); # parent class
26 if (!defined($heir{$p})) {
27 $pp = join('/', @w[0..$#w-2]); # grandparent class
29 $ppp = join('/', @w[0..$#w-3]); # great-grandparent class
31 $heir{$ppp} .= "$pp\0";
38 # get the current open list
39 %heiropen = map { $_, 1 } &get_heiropen();
42 # traverse the heirarchy
43 print "<table width=100%>\n";
47 print "<a href=closeall.cgi>$text{'index_close'}</a>\n";
48 print "<a href=openall.cgi>$text{'index_open'}</a><p>\n";
51 &ui_print_footer("", $text{'index_return'});
57 # Show the icon and class name
58 print "<tr> <td>", $spacer x $_[1];
60 print "<a name=\"$_[0]\"></a>\n";
61 $act = $heiropen{$_[0]} ? "close" : "open";
62 print "<a href=\"$act.cgi?what=",&urlize($_[0]),"\">";
64 print "<img border=0 src=images/$act.gif></a> $1</td>\n";
67 print "<img src=images/close.gif> <i>$text{'index_all'}</i></td>\n";
70 print "<td><br></td> </tr>\n";
71 if ($heiropen{$_[0]}) {
72 # print packages followed by sub-folders
74 if ($class[$i] eq $_[0]) {
75 print "<tr> <td nowrap>", $spacer x ($_[1]+1);
76 print "<img border=0 src=images/pack.gif></a> \n";
77 print "<a href=\"edit_pack.cgi?package=",
78 &urlize($pack[$i]),"&version=",
79 &urlize($vers[$i]),"\">",&html_escape($pack[$i].
80 ($svers[$i] ? " $svers[$i]" : "")),"</a></td>\n";
81 print "<td>",&html_escape($desc[$i]),"</td>\n";
85 foreach $s (&unique(split(/\0+/, $heir{$_[0]}))) {
86 &traverse($s, $_[1]+1);