--- loncom/homework/grades.pm 2004/12/04 00:03:24 1.204.2.10
+++ loncom/homework/grades.pm 2004/09/27 20:59:21 1.216
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.204.2.10 2004/12/04 00:03:24 albertel Exp $
+# $Id: grades.pm,v 1.216 2004/09/27 20:59:21 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,16 +25,7 @@
#
# http://www.lon-capa.org/
#
-# 2/9,2/13 Guy Albertelli
-# 6/8 Gerd Kortemeyer
-# 7/26 H.K. Ng
-# 8/20 Gerd Kortemeyer
-# Year 2002
-# June-August H.K. Ng
-# Year 2003
-# February, March H.K. Ng
-# July, H. K. Ng
-#
+###
package Apache::grades;
use strict;
@@ -174,7 +165,6 @@ sub get_display_part {
if ($symb eq '') { $symb=&Apache::lonnet::symbread($url) }
}
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb);
- &Apache::lonnet::logthis("\nsymb $symb\n url $url\npartID $partID\ndisplay $display \n");
if (defined($display) and $display ne '') {
$display.= " (id $partID)";
} else {
@@ -365,27 +355,36 @@ sub getclasslist {
#
my %sections;
my %fullnames;
- foreach (keys(%$classlist)) {
- # the following undefs are for 'domain', and 'username' respectively.
- my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
- @{$classlist->{$_}};
+ foreach my $student (keys(%$classlist)) {
+ my $end =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_END()];
+ my $start =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_START()];
+ my $id =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_ID()];
+ my $section =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_SECTION()];
+ my $fullname =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_FULLNAME()];
+ my $status =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_STATUS()];
# filter students according to status selected
if ($filterlist && $ENV{'form.Status'} ne 'Any') {
if ($ENV{'form.Status'} ne $status) {
- delete ($classlist->{$_});
+ delete ($classlist->{$student});
next;
}
}
- $section = ($section ne '' ? $section : 'no');
+ $section = ($section ne '' ? $section : 'none');
if (&canview($section)) {
if ($getsec eq 'all' || $getsec eq $section) {
$sections{$section}++;
- $fullnames{$_}=$fullname;
+ $fullnames{$student}=$fullname;
} else {
- delete($classlist->{$_});
+ delete($classlist->{$student});
}
} else {
- delete($classlist->{$_});
+ delete($classlist->{$student});
}
}
my %seen = ();
@@ -993,6 +992,7 @@ sub sub_page_kw_js {
my $request = shift;
my $iconpath = $request->dir_config('lonIconsURL');
&commonJSfunctions($request);
+ my $nothing= &Apache::lonhtmlcommon::javascript_nothing();
$request->print(<
@@ -1105,7 +1105,7 @@ sub sub_page_kw_js {
pWin = window.open('', 'MessageCenter', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height);
pWin.focus();
pDoc = pWin.document;
- pDoc.open('text/html','replace');
+ pDoc.open($nothing,'replace');
pDoc.write("");
pDoc.write("Message Central");
@@ -1236,7 +1236,7 @@ sub sub_page_kw_js {
hwdWin = window.open('', 'KeywordHighlightCentral', 'resizeable=yes,toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos);
hwdWin.focus();
var hDoc = hwdWin.document;
- hDoc.open('text/html','replace');
+ hDoc.open($nothing,'replace');
hDoc.write("");
hDoc.write("Highlight Central");
@@ -2320,7 +2320,7 @@ sub viewgrades {
my $sectionClass;
if ($ENV{'form.section'} eq 'all') {
$sectionClass='Class ';
- } elsif ($ENV{'form.section'} eq 'no') {
+ } elsif ($ENV{'form.section'} eq 'none') {
$sectionClass='Students in no Section ';
} else {
$sectionClass='Students in Section '.$ENV{'form.section'}.'';
@@ -3219,12 +3219,9 @@ sub displayPage {
sub displaySubByDates {
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_;
- my $isCODE=0;
- if (exists($record->{'resource.CODE'})) { $isCODE=1; }
my $studentTable='
'.
'
'.
'
Date/Time
'.
- ($isCODE?'
CODE
':'').
'
Submission
'.
'
Status
';
my ($version);
@@ -3237,9 +3234,6 @@ sub displaySubByDates {
for ($version=1;$version<=$$record{'version'};$version++) {
my $timestamp = scalar(localtime($$record{$version.':timestamp'}));
$studentTable.='
'.$timestamp.'
';
- if ($isCODE) {
- $studentTable.='
'.$record->{$version.':resource.CODE'}.'
';
- }
my @versionKeys = split(/\:/,$$record{$version.':keys'});
my @displaySub = ();
foreach my $partid (@{$parts}) {
@@ -4006,7 +4000,7 @@ sub scantron_form_start {
-
+
@@ -4326,8 +4320,8 @@ sub scantron_get_correction {
} elsif ($error eq 'duplicateCODE') {
$r->print("
The encoded CODE has also been used by a previous paper ".join(', ',@{$arg}).", and CODEs are supposed to be unique
\n");
}
- $r->print("
The CODE on the form is '".
- $$scan_record{'scantron.CODE'}."' \n");
+ $r->print("
The CODE on the form is ".
+ $$scan_record{'scantron.CODE'}." \n");
$r->print("
The ID on the form is ".
$$scan_record{'scantron.ID'}." \n");
$r->print("The name on the paper is ".
@@ -4473,14 +4467,7 @@ sub scantron_validate_CODE {
$scan_data);
my $CODE=$$scan_record{'scantron.CODE'};
my $error=0;
- if (!&Apache::lonnet::validCODE($CODE)) {
- &scantron_get_correction($r,$i,$scan_record,
- \%scantron_config,
- $line,'incorrectCODE',\%allcodes);
- return(1,$currentphase);
- }
- if (%allcodes && !exists($allcodes{$CODE})
- && !$$scan_record{'scantron.useCODE'}) {
+ if (!exists($allcodes{$CODE}) && !$$scan_record{'scantron.useCODE'}) {
&scantron_get_correction($r,$i,$scan_record,
\%scantron_config,
$line,'incorrectCODE',\%allcodes);
@@ -4535,7 +4522,7 @@ sub scantron_get_maxbubble {
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
&Apache::lonnet::delenv('form.counter');
foreach my $resource (@resources) {
- my $result=&Apache::lonnet::ssi($resource->src().'?symb='.&Apache::lonnet::escape($resource->symb()));
+ my $result=&Apache::lonnet::ssi($resource->src());
}
&Apache::lonnet::delenv('scantron\.');
my $envfile=$ENV{'user.environment'};
@@ -4652,8 +4639,6 @@ SCANTRONFORM
if (exists($scan_record->{'scantron.CODE'}) &&
$scan_record->{'scantron.CODE'}) {
$form{'CODE'}=$scan_record->{'scantron.CODE'};
- } else {
- $form{'CODE'}='';
}
my $result=&Apache::lonnet::ssi($resource->src(),%form);
if (&Apache::loncommon::connection_aborted($r)) { last; }
@@ -4729,7 +4714,8 @@ sub scantron_upload_scantron_data_save {
}
return '';
}
-# $r->print("Doing upload to ".$ENV{'form.courseid'}." ");
+ my %coursedata=&Apache::lonnet::coursedescription($ENV{'form.domainid'}.'_'.$ENV{'form.courseid'});
+ $r->print("Doing upload to ".$coursedata{'description'}." ");
my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'},
$ENV{'form.domainid'});
my $fname=$ENV{'form.upfile.filename'};
@@ -4752,17 +4738,14 @@ sub scantron_upload_scantron_data_save {
$r->print("Error: The file you attempted to upload, ".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"').", contained no information. Please check that you entered the correct filename.");
} else {
my $result=&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},$ENV{'form.domainid'},$home,'upfile',$fname);
-# if ($result =~ m|^/uploaded/|) {
- if ($result !~ m|^/uploaded/|) {
-# $r->print("Success: Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location ".$result."");
-# } else {
+ if ($result =~ m|^/uploaded/|) {
+ $r->print("Success: Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location ".$result."");
+ } else {
$r->print("Error: An error (".$result.") occurred when attempting to upload the file, ".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."");
}
}
if ($symb) {
-# $r->print(&show_grading_menu_form($symb,$url));
$r->print(&scantron_selectphase($r,$uploadedfile));
-
} else {
$r->print($doanotherupload);
}
@@ -4927,9 +4910,6 @@ GRADINGMENUJS
$result.=&mt('Student Status').':'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef);
- if (ref($sections) && (grep /no/,@$sections)) {
- $result.=' (Section "no" implies the students were not assigned a section.) ';
- }
$result.='