version 1.5, 2014/07/31 15:57:24
|
version 1.6, 2014/08/05 19:32:19
|
Line 101 sub main {
|
Line 101 sub main {
|
$crstype = $params{'type'}; |
$crstype = $params{'type'}; |
} |
} |
if ($params{'fixeddom'}) { $reqdom = $params{'fixeddom'} } |
if ($params{'fixeddom'}) { $reqdom = $params{'fixeddom'} } |
|
unless ($params{'sortby'}) { $params{'sortby'} = 'cdesc'; } |
} |
} |
if (($reqdom eq '') && ($ENV{'QUERY_STRING'})) { |
if (($reqdom eq '') && ($ENV{'QUERY_STRING'})) { |
&LONCAPA::loncgi::cgi_getitems($ENV{'QUERY_STRING'},\%gets); |
&LONCAPA::loncgi::cgi_getitems($ENV{'QUERY_STRING'},\%gets); |
Line 246 sub print_usage {
|
Line 247 sub print_usage {
|
} |
} |
|
|
if (@showcourses) { |
if (@showcourses) { |
print(&Apache::loncommon::start_data_table(). |
# Order in which columns are displayed from left to right |
&Apache::loncommon::start_data_table_header_row() |
my @order = ('quotatype','cdesc','instcode','quota', |
.'<th><a href="javascript:changeSort('."'quotatype'".')">' |
'current_disk_usage','percent'); |
.&Apache::lonlocal::mt('Course Type') |
|
.'<span class="LC_fontsize_small"> ▼</span></a></th>' |
# Up and down arrows to indicate sort order |
.'<th><a href="javascript:changeSort('."'cdesc'".')">' |
my @arrows = (' ▲',' ▼',''); |
.&Apache::lonlocal::mt('Course Title') |
|
.'<span class="LC_fontsize_small"> ▼</span></a></th>' |
# Default sort order and column title |
.'<th><a href="javascript:changeSort('."'instcode'".')">' |
my %columns = ( |
.&Apache::lonlocal::mt('Institutional Code') |
quotatype => { |
.'<span class="LC_fontsize_small"> ▼</span></a></th>' |
order => 'ascending', |
.'<th><a href="javascript:changeSort('."'quota'".')">' |
text => &Apache::lonlocal::mt('Course Type'), |
.&Apache::lonlocal::mt('Quota (MB)') |
}, |
.'<span class="LC_fontsize_small"> ▼</span></a></th>' |
cdesc => { |
.'<th><a href="javascript:changeSort('."'current_disk_usage'".')">' |
order => 'ascending', |
.&Apache::lonlocal::mt('Usage (MB)') |
text => &Apache::lonlocal::mt('Course Title'), |
.'<span class="LC_fontsize_small"> ▼</span></a></th>' |
}, |
.'<th><a href="javascript:changeSort('."'percent'".')">' |
instcode => { |
.&Apache::lonlocal::mt('Percent usage') |
order => 'ascending', |
.'<span class="LC_fontsize_small"> ▼</span></a></th>' |
text => &Apache::lonlocal::mt('Institutional Code'), |
|
}, |
|
quota => { |
|
order => 'descending', |
|
text => &Apache::lonlocal::mt('Quota (MB)'), |
|
}, |
|
current_disk_usage => { |
|
order => 'descending', |
|
text => &Apache::lonlocal::mt('Usage (MB)'), |
|
}, |
|
percent => { |
|
order => 'descending', |
|
text => &Apache::lonlocal::mt('Percent usage'), |
|
}, |
|
); |
|
|
|
# Print column headers |
|
my $output = ''; |
|
foreach my $key (@order) { |
|
my $idx; |
|
# Append an up or down arrow to sorted column |
|
if ($sortby eq $key) { |
|
$idx = ($columns{$key}{order} eq 'ascending') ? 0:1; |
|
if ($sortorder eq 'rev') { $idx ++; } |
|
$idx = $idx%2; |
|
} else { $idx = 2; } # No arrow if column not sorted |
|
$output .= '<th><a href="javascript:changeSort(' |
|
."'$key'".');">'.$columns{$key}{text} |
|
.$arrows[$idx].'</a></th>'; |
|
} |
|
print(&Apache::loncommon::start_data_table() |
|
.&Apache::loncommon::start_data_table_header_row().$output |
.&Apache::loncommon::end_data_table_header_row()); |
.&Apache::loncommon::end_data_table_header_row()); |
|
|
my $usagehash = {}; # Sortable hash of courses |
my $usagehash = {}; # Sortable hash of courses |