1#!/usr/local/bin/perl
2# list_pack.cgi
3# List all the files in some package
4
5require './software-lib.pl';
6&ReadParse();
7&ui_print_header(undef, $text{'list_title'}, "", "list_pack");
8
9print &ui_subheading(&text('list_files', "<tt>$in{'package'}</tt>"));
10print &ui_columns_start([
11	$text{'list_path'},
12	$text{'list_owner'},
13	$text{'list_group'},
14	$text{'list_type'},
15	$text{'list_size'},
16	$text{'list_status'} ], 100);
17$n = &check_files($in{'package'}, $in{'version'});
18@tds = ( "valign=top", "valign=top", "valign=top",
19	 "valign=top", "valign=top", "valign=top" );
20for($i=0; $i<$n; $i++) {
21	$sz = $files{$i,'size'};
22	$ty = $files{$i,'type'};
23	local @cols;
24	$ls = "file_info.cgi?file=".&urlize($files{$i,'path'});
25	$le = "</a>";
26	if ($ty == 3 || $ty == 4) {
27		# Hard or soft link
28		push(@cols, &ui_link($ls, &html_escape($files{$i,'path'}).
29		      " -> ".&html_escape($files{$i,'link'})) );
30		push(@cols, "", "");
31		}
32	else {
33		$table = "<table width=100% cellpadding=0 cellspacing=0><tr><td>".
34		      &ui_link($ls, &html_escape($files{$i,'path'}) ).
35              "</td><td align=right>\n";
36		if ($ty == 0 || $ty == 5) {
37			$table .= &ui_link("view.cgi".
38				&html_escape($files{$i,'path'}), $text{'list_view'});
39			}
40		$table .= "</td></tr></table>";
41		push(@cols, $table);
42		push(@cols, &html_escape($files{$i,'user'}));
43		push(@cols, &html_escape($files{$i,'group'}));
44		}
45	push(@cols, $type_map[$ty]);
46	push(@cols, $ty != 0 ? "" : &nice_size($sz));
47	$err = $files{$i,'error'};
48	if ($err) {
49		$err =~ s/</&lt;/g;
50		$err =~ s/>/&gt;/g;
51		$err =~ s/\n/<br>/g;
52		push(@cols, "<font color=#ff0000>$err</font>");
53		}
54	else {
55		push(@cols, $text{'list_ok'});
56		}
57	print &ui_columns_row(\@cols, \@tds);
58	}
59print &ui_columns_end();
60
61&ui_print_footer("edit_pack.cgi?package=".&urlize($in{'package'}).
62	"&version=".&urlize($in{'version'}), $text{'edit_return'},
63	"tree.cgi", $text{'index_treturn'});
64
65