3 # List all filesystems for which some user has quotas
5 require './quota-lib.pl';
8 $u =~ /\S/ || &error($text{'ufilesys_enone'});
10 &error(&text('ufilesys_ecannot', $u));
11 &ui_print_header(undef, $text{'ufilesys_title'}, "", "user_filesys");
13 foreach $f (&list_filesystems()) {
14 if ($f->[4]%2 && $f->[5] && &can_edit_filesys($f->[0])) {
15 push(@fslist, $f->[0]);
20 # Make sure all block sizes are the same
21 $n = &user_filesystems($u);
22 for($i=0; $i<$n; $i++) {
23 $bsize = &block_size($filesys{$i,'filesys'});
24 if ($last_bsize && $last_bsize != $bsize) {
30 print &ui_subheading(&text('ufilesys_all', &html_escape($u)));
32 # Generate top header (showing blocks/files)
33 @hcols = ( undef, $variable_bsize ? $text{'ufilesys_blocks'}
34 : $text{'ufilesys_space'},
35 $config{'show_grace'} ? ( undef ) : ( ),
36 $text{'ufilesys_files'},
37 $config{'show_grace'} ? ( undef ) : ( ) );
38 print &ui_columns_start(\@hcols, 100, 0,
39 [ undef, "colspan=3 align=center", "colspan=3 align=center" ]);
41 # Generate second header
42 @hcols = ( $text{'ufilesys_fs'}, $text{'ufilesys_used'},
43 $text{'ufilesys_soft'}, $text{'ufilesys_hard'},
44 $config{'show_grace'} ? ( $text{'ufilesys_grace'} ) : ( ),
45 $text{'ufilesys_used'},
46 $text{'ufilesys_soft'}, $text{'ufilesys_hard'},
47 $config{'show_grace'} ? ( $text{'ufilesys_grace'} ) : ( ),
49 print &ui_columns_header(\@hcols);
51 # Generate one row per filesystem the user has quota on
52 for($i=0; $i<$n; $i++) {
53 $f = $filesys{$i,'filesys'};
54 $bsize = &block_size($f);
56 if ($fslist{$f} && !$access{'ro'}) {
57 push(@cols, "<a href=\"edit_user_quota.cgi?filesys=$f&user=$u&source=1\">$f</a>");
63 push(@cols, &nice_size($filesys{$i,'ublocks'}*$bsize));
66 push(@cols, $filesys{$i,'ublocks'});
68 push(@cols, &nice_limit($filesys{$i,'sblocks'}, $bsize));
69 push(@cols, &nice_limit($filesys{$i,'hblocks'}, $bsize));
70 push(@cols, $filesys{$i,'gblocks'}) if ($config{'show_grace'});
71 push(@cols, $filesys{$i,'ufiles'});
72 push(@cols, &nice_limit($filesys{$i,'sfiles'}, $bsize, 1));
73 push(@cols, &nice_limit($filesys{$i,'hfiles'}, $bsize, 1));
74 push(@cols, $filesys{$i,'gfiles'}) if ($config{'show_grace'});
75 print &ui_columns_row(\@cols);
77 print &ui_columns_end();
80 print "<b>",&text('ufilesys_nouquota', $u),"</b><p>\n";
85 print &ui_buttons_start();
87 # Form to edit quota on other filesystems
88 print &ui_buttons_row("edit_user_quota.cgi",
89 $text{'ufilesys_edit'},
90 $text{'ufilesys_editdesc'},
91 &ui_hidden("user", $u).&ui_hidden("source", 1),
92 &ui_select("filesys", undef, \@fslist)
95 if ($access{'filesys'} eq "*") {
96 # Button to copy quotas
97 print &ui_buttons_row("copy_user_form.cgi",
98 $text{'ufilesys_copy'},
99 $text{'ufilesys_copydesc'},
100 &ui_hidden("user", $u));
103 print &ui_buttons_end();
106 &ui_print_footer("", $text{'ufilesys_return'});