--- loncom/interface/lonparmset.pm 2005/06/06 15:46:02 1.213
+++ loncom/interface/lonparmset.pm 2005/06/06 17:38:07 1.214
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.213 2005/06/06 15:46:02 www Exp $
+# $Id: lonparmset.pm,v 1.214 2005/06/06 17:38:07 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -972,6 +972,20 @@ sub keysindisplayorder {
} (keys %{$name});
}
+sub sortmenu {
+ my ($r,$sortorder)=@_;
+ $r->print('
print(' checked="on"');
+ }
+ $r->print(' />'.&mt('Sort by realm first, then student (group/section)'));
+ $r->print('
print(' checked="on"');
+ }
+ $r->print(' />'.&mt('Sort by student (group/section) first, then realm'));
+}
+
sub standardkeyorder {
return ('parameter_0_opendate' => 1,
'parameter_0_duedate' => 2,
@@ -2036,7 +2050,7 @@ sub extractuser {
}
sub listdata {
- my ($r,$resourcedata,$listdata)=@_;
+ my ($r,$resourcedata,$listdata,$sortorder)=@_;
# Start list output
my $oldsection='';
@@ -2045,7 +2059,15 @@ sub listdata {
my $pointer=0;
$tableopen=0;
my $foundkeys=0;
- foreach my $thiskey (sort keys %{$listdata}) {
+ foreach my $thiskey (sort {
+ if ($sortorder eq 'realmstudent') {
+ my ($astudent,$arealm)=($a=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/);
+ my ($bstudent,$brealm)=($b=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/);
+ ($arealm cmp $brealm) || ($astudent cmp $bstudent);
+ } else {
+ $a cmp $b;
+ }
+ } keys %{$listdata}) {
if ($$listdata{$thiskey.'.type'}) {
my $thistype=$$listdata{$thiskey.'.type'};
if ($$resourcedata{$thiskey.'.type'}) {
@@ -2072,19 +2094,32 @@ sub listdata {
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle);
$realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).'
('.$url.' in '.$map.' id: '.$id.')';
}
- if ($section ne $oldsection) {
- $r->print(&tableend()."\n
'. ($foundkeys?'':&mt('There are no parameters.')).'