--- loncom/homework/grades.pm 2003/08/06 19:32:18 1.130
+++ loncom/homework/grades.pm 2003/11/04 19:38:09 1.146
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.130 2003/08/06 19:32:18 albertel Exp $
+# $Id: grades.pm,v 1.146 2003/11/04 19:38:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -55,17 +55,35 @@ my %perm=();
# ----- These first few routines are general use routines.----
#
-# --- Retrieve the parts that matches stores_\d+ from the metadata file.---
+# --- Retrieve the parts from the metadata file.---
sub getpartlist {
- my ($url) = @_;
- my @parts =();
- my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys'));
- foreach my $key (@metakeys) {
- if ( $key =~ m/stores_(\w+)_.*/) {
- push(@parts,$key);
+ my ($url,$symb) = @_;
+ my $partorder = &Apache::lonnet::metadata($url, 'partorder');
+ my @parts;
+ if ($partorder) {
+ for my $part (split (/,/,$partorder)) {
+ if (!&Apache::loncommon::check_if_partid_hidden($part,$symb)) {
+ push(@parts, $part);
+ }
+ }
+ } else {
+ my $metadata = &Apache::lonnet::metadata($url, 'packages');
+ foreach (split(/\,/,$metadata)) {
+ if ($_ =~ /^part_(.*)$/) {
+ if (!&Apache::loncommon::check_if_partid_hidden($1,$symb)) {
+ push(@parts, $1);
+ }
+ }
+ }
+ }
+ my @stores;
+ foreach my $part (@parts) {
+ my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys'));
+ foreach my $key (@metakeys) {
+ if ($key =~ m/^stores_\Q$part\E_/) { push(@stores,$key); }
}
}
- return @parts;
+ return @stores;
}
# --- Get the symbolic name of a problem and the url
@@ -120,6 +138,9 @@ sub response_type {
if (/^\w+response_\w+.*/) {
my ($responsetype,$part) = split(/_/,$_,2);
my ($partid,$respid) = split(/_/,$part);
+ if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) {
+ next;
+ }
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!!
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb);
$handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no');
@@ -185,7 +206,7 @@ sub cleanRecord {
$ENV{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
$ENV{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob.
}
- return '
'.&keywords_highlight($answer).'
';
+ return '
'.&keywords_highlight($answer).'
';
}
return $answer;
}
@@ -218,7 +239,8 @@ sub commonJSfunctions {
}
}
} else {
- if (selectOne.selected) return selectOne.value;
+ // only one value it must be the selected one
+ return selectOne.value;
}
}
@@ -506,9 +528,12 @@ LISTJAVASCRIPT
my $checkhdgrade = ($ENV{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked' : '';
my $checklastsub = $checkhdgrade eq '' ? 'checked' : '';
my $gradeTable='