--- loncom/homework/grades.pm 2002/10/17 14:35:34 1.57
+++ loncom/homework/grades.pm 2003/03/23 07:22:58 1.74
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.57 2002/10/17 14:35:34 matthew Exp $
+# $Id: grades.pm,v 1.74 2003/03/23 07:22:58 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,6 +31,8 @@
# 8/20 Gerd Kortemeyer
# Year 2002
# June-August H.K. Ng
+# Year 2003
+# February, March H.K. Ng
#
package Apache::grades;
@@ -39,12 +41,13 @@ use Apache::style;
use Apache::lonxml;
use Apache::lonnet;
use Apache::loncommon;
+use Apache::lonnavmaps;
use Apache::lonhomework;
use Apache::loncoursedata;
use Apache::lonmsg qw(:user_normal_msg);
use Apache::Constants qw(:common);
-# ----- These first few routines are general use routines.-----
+# ----- These first few routines are general use routines.----
#
# --- Retrieve the parts that matches stores_\d+ from the metadata file.---
sub getpartlist {
@@ -206,6 +209,9 @@ sub jscriptNform {
$jscript.= '
");
@@ -794,44 +884,114 @@ function displaySavedMsg(ctr,msg,shwsel)
SUBJAVASCRIPT
}
+#--- displays the grading box, used in essay type problem and grading by page/sequence
+sub gradeBox {
+ my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
+
+ my $checkIcon = '';
+
+ my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
+ my $wgtmsg = ($wgt > 0 ? '(problem weight)' :
+ 'problem weight assigned by computer');
+ $wgt = ($wgt > 0 ? $wgt : '1');
+ my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ?
+ '' : $$record{'resource.'.$partid.'.awarded'}*$wgt);
+ my $result=''."\n";
+
+ $result.='
'.
+ 'Part '.$partid.' Points:
'."\n";
+
+ my $ctr = 0;
+ $result.='
'."\n"; # display radio buttons in a nice table 10 across
+ while ($ctr<=$wgt) {
+ $result.= '
';
+ return $result;
+}
# --------------------------- show submissions of a student, option to grade
sub submission {
my ($request,$counter,$total) = @_;
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
-# if ($ENV{'form.student'} eq '') { &moreinfo($request,'Need student login id'); return ''; }
my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'});
($uname,$udom) = &finduser($uname) if $udom eq '';
$ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq '';
-# if ($uname eq '') { &moreinfo($request,'Unable to find student'); return ''; }
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
- $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes';
# header info
if ($counter == 0) {
&sub_page_js($request);
+ &sub_page_kw_js($request);
$request->print('
Submission Record
'."\n".
- ' Resource: '.$url.''."\n");
+ ' Problem: '.$ENV{'form.probTitle'}.''."\n");
# option to display problem, only once else it cause problems
# with the form later since the problem has a form.
- if ($ENV{'form.vProb'} eq 'yes') {
- my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
- $ENV{'request.course.id'});
- my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
- $ENV{'request.course.id'});
- my $result.='
';
- $result.='
';
- $result.=' View of the problem - '.$ENV{'form.fullname'}.
- '
') if ($counter > 0);
+ $request->print(&show_problem($request,$symb,$uname,$udom,1,1));
+ }
+
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
my ($partlist,$handgrade) = &response_type($url);
@@ -987,7 +1155,7 @@ KEYWORDS
} else {
my ($string,$timestamp)=
&get_last_submission (%record);
- my $lastsubonly.=''.
+ my $lastsubonly=''.
($$timestamp eq '' ? '' : 'Date Submitted: '.
$$timestamp).'';
if ($$timestamp eq '') {
@@ -1000,7 +1168,12 @@ KEYWORDS
my ($ressub,$subval) = split(/:/,$_,2);
$lastsubonly.='
Part '.
$partid.' ( ID '.$respid.
- ' ) Answer: '.
+ ' ) '.
+ ($record{"resource.$partid.$respid.uploadedurl"}?
+ ' File uploaded by student Like all files provided by users, this file may contain virusses ':'').
+ 'Answer: '.
&keywords_highlight($subval).'
'."\n"
if ($ENV{'form.lastSub'} eq 'lastonly' ||
($ENV{'form.lastSub'} eq 'hdgrade' &&
@@ -1022,6 +1195,9 @@ KEYWORDS
# return if view submission with no grading option
if ($ENV{'form.showgrading'} eq '') {
$request->print('