--- loncom/interface/lonparmset.pm 2000/11/28 02:53:40 1.16
+++ loncom/interface/lonparmset.pm 2000/11/28 11:23:15 1.17
@@ -9,7 +9,7 @@
#
# 10/11,10/12,10/16 Gerd Kortemeyer)
#
-# 11/20,11/21,11/22,11/23,11/24,11/25,11/27 Gerd Kortemeyer
+# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28 Gerd Kortemeyer
package Apache::lonparmset;
@@ -31,6 +31,7 @@ my %symbp;
my %mapp;
my %typep;
my %keyp;
+my %defp;
my %allkeys;
@@ -123,16 +124,6 @@ sub parmval {
return $result;
}
-# ---------------------------------------------------------------- Sort routine
-
-sub bycat {
- if ($fcat eq '') {
- $a<=>$b;
- } else {
- &parmval($fcat,$a)<=>&parmval($fcat,$b);
- }
-}
-
# ------------------------------------------------------------ Output for value
sub valout {
@@ -179,6 +170,8 @@ sub handler {
$csec=$ENV{'form.csec'};
$udom=$ENV{'form.udom'};
+ unless ($udom) { $udom=$r->dir_config('lonDefDomain'); }
+
my $id=$ENV{'form.id'};
if (($id) && ($udom)) {
$uname=(&Apache::lonnet::idget($udom,$id))[1];
@@ -186,7 +179,7 @@ sub handler {
$id='';
} else {
$message=
- "
Unknown ID '$id' at domain '$udom'
";
+ "Unknown ID '$id' at domain '$udom'";
}
} else {
$uname=$ENV{'form.uname'};
@@ -198,14 +191,14 @@ sub handler {
if ($uhome eq 'no_host') {
$message=
- "Unknown user '$uname' at domain '$udom'
";
+ "Unknown user '$uname' at domain '$udom'";
$uname='';
} else {
$csec=&Apache::lonnet::usection(
$udom,$uname,$ENV{'request.course.id'});
if ($csec eq '-1') {
- $message="".
- "User '$uname' at domain '$udom' not in this course
";
+ $message="".
+ "User '$uname' at domain '$udom' not in this course";
$uname='';
$csec=$ENV{'form.csec'};
} else {
@@ -232,7 +225,7 @@ sub handler {
# --------------------------------------------------------- Get all assessments
%allkeys=();
-
+ %defp=();
map {
if ($_=~/^src\_(\d+)\.(\d+)$/) {
my $mapid=$1;
@@ -247,6 +240,7 @@ sub handler {
if ($_=~/^parameter\_(.*)/) {
my $key=$_;
my $allkey=$1;
+ $allkey=~s/\_/\./;
my $display=
&Apache::lonnet::metadata($srcf,$key.'.display');
unless ($display) {
@@ -254,6 +248,10 @@ sub handler {
&Apache::lonnet::metadata($srcf,$key.'.name');
}
$allkeys{$allkey}=$display;
+ if ($allkey eq $fcat) {
+ $defp{$id}=
+ &Apache::lonnet::metadata($srcf,$key.'.default');
+ }
if ($keyp{$id}) {
$keyp{$id}.=','.$key;
} else {
@@ -325,7 +323,7 @@ sub handler {
}
if ($reply=~/^error\:(.*)/) {
- $message.="Write Error: $1
";
+ $message.="Write Error: $1";
}
# ---------------------------------------------------------------- Done storing
}
@@ -355,7 +353,15 @@ sub handler {
}
# ------------------------------------------------------------------- Sort this
- @ids=sort bycat @ids;
+
+ @ids=sort {
+ if ($fcat eq '') {
+ $a<=>$b;
+ } else {
+ $outpar[&parmval($fcat,$a,$defp{$a})]<=>
+ $outpar[&parmval($fcat,$b,$defp{$b})];
+ }
+ } @ids;
# ------------------------------------------------------------------ Start page
$r->content_type('text/html');
$r->send_http_header;
@@ -414,8 +420,8 @@ at Domain
ENDHEAD
-
- $r->print($message.'Sort list by ');
+
+ $r->print('
'.$message.'
Sort list by ');
$r->print('