[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface loncoursedata.pm lonquickgrades.pm lonstatistics.pm /interface/statistics lonproblemstatistics.pm lonstathelpers.pm lonstudentassessment.pm
raeburn
raeburn at source.lon-capa.org
Mon Dec 18 18:51:25 EST 2017
raeburn Mon Dec 18 23:51:25 2017 EDT
Modified files:
/loncom/interface loncoursedata.pm lonquickgrades.pm
lonstatistics.pm
/loncom/interface/statistics lonproblemstatistics.pm
lonstathelpers.pm
lonstudentassessment.pm
/loncom/homework grades.pm
Log:
- Bug 6754 LON-CAPA as LTI Consumer
- Grading screens can be used to display passback transactions, and
for override of scores etc., for external tools set to be "gradable".
-------------- next part --------------
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.201 loncom/interface/loncoursedata.pm:1.202
--- loncom/interface/loncoursedata.pm:1.201 Tue Aug 16 00:46:58 2016
+++ loncom/interface/loncoursedata.pm Mon Dec 18 23:51:14 2017
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.201 2016/08/16 00:46:58 raeburn Exp $
+# $Id: loncoursedata.pm,v 1.202 2017/12/18 23:51:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1775,7 +1775,7 @@
my @resources;
foreach my $seq (@sequences) {
push(@resources,$navmap->retrieveResources($seq,
- sub {shift->is_problem();},
+ sub {shift->is_gradable();},
0,0,0));
}
if (! scalar(@resources)) {
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.111 loncom/interface/lonquickgrades.pm:1.112
--- loncom/interface/lonquickgrades.pm:1.111 Thu Nov 16 13:41:56 2017
+++ loncom/interface/lonquickgrades.pm Mon Dec 18 23:51:14 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.111 2017/11/16 13:41:56 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.112 2017/12/18 23:51:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -444,7 +444,7 @@
if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
if ($curRes == $iterator->END_MAP()) { $depth--; }
- if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout)
+ if (ref($curRes) && $curRes->is_gradable() && !$curRes->randomout)
{
# Get number of correct, incorrect parts
my $parts = $curRes->parts();
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.163 loncom/interface/lonstatistics.pm:1.164
--- loncom/interface/lonstatistics.pm:1.163 Sun Aug 14 16:13:22 2016
+++ loncom/interface/lonstatistics.pm Mon Dec 18 23:51:14 2017
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstatistics.pm,v 1.163 2016/08/14 16:13:22 raeburn Exp $
+# $Id: lonstatistics.pm,v 1.164 2017/12/18 23:51:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -466,7 +466,7 @@
my @sequences_with_assessments;
foreach my $sequence (@sequences) {
- if ($navmap->hasResource($sequence,sub { shift->is_problem(); },0,1)){
+ if ($navmap->hasResource($sequence,sub { shift->is_gradable(); },0,1)){
push(@sequences_with_assessments,$sequence);
}
}
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.126 loncom/interface/statistics/lonproblemstatistics.pm:1.127
--- loncom/interface/statistics/lonproblemstatistics.pm:1.126 Fri Feb 28 19:20:17 2014
+++ loncom/interface/statistics/lonproblemstatistics.pm Mon Dec 18 23:51:19 2017
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemstatistics.pm,v 1.126 2014/02/28 19:20:17 bisitz Exp $
+# $Id: lonproblemstatistics.pm,v 1.127 2017/12/18 23:51:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -759,9 +759,10 @@
&Apache::lonstatistics::section_and_enrollment_description().
'</p>');
my $count = 0;
+ my $include_tools = 1;
foreach my $seq (@sequences) {
my @resources =
- &Apache::lonstathelpers::get_resources($navmap,$seq);
+ &Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools);
$count += scalar(@resources);
}
if ($count > 10) {
@@ -1469,8 +1470,9 @@
##################################################
sub compute_statistics_on_sequence {
my ($seq) = @_;
+ my $include_tools = 1;
my @Data;
- foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
+ foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools)) {
foreach my $part (@{$res->parts}) {
next if (($res->is_survey($part)) || ($res->is_anonsurvey($part))) ;
#
@@ -1648,9 +1650,10 @@
###############################################
sub compute_discrimination_factor {
my ($resource,$part,$seq) = @_;
+ my $include_tools = 1;
my $symb = $resource->symb;
my @Resources;
- foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)){
+ foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools)){
next if ($res->symb eq $symb);
push (@Resources,$res->symb);
}
@@ -1714,10 +1717,11 @@
###############################################
sub compute_sequence_statistics {
my ($seq) = @_;
+ my $include_tools = 1;
my $symb = $seq->symb;
my @Resources;
my $part_count;
- foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
+ foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools)) {
push (@Resources,$res->symb);
$part_count += scalar(@{$res->parts});
}
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.74 loncom/interface/statistics/lonstathelpers.pm:1.75
--- loncom/interface/statistics/lonstathelpers.pm:1.74 Tue Jun 9 21:23:02 2015
+++ loncom/interface/statistics/lonstathelpers.pm Mon Dec 18 23:51:19 2017
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstathelpers.pm,v 1.74 2015/06/09 21:23:02 damieng Exp $
+# $Id: lonstathelpers.pm,v 1.75 2017/12/18 23:51:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -108,10 +108,17 @@
####################################################
####################################################
sub get_resources {
- my ($navmap,$sequence) = @_;
- my @resources = $navmap->retrieveResources($sequence,
- sub { shift->is_problem(); },
- 0,0,0);
+ my ($navmap,$sequence,$include_tools) = @_;
+ my @resources;
+ if ($include_tools) {
+ @resources = $navmap->retrieveResources($sequence,
+ sub { shift->is_gradable(); },
+ 0,0,0);
+ } else {
+ @resources = $navmap->retrieveResources($sequence,
+ sub { shift->is_problem(); },
+ 0,0,0);
+ }
return @resources;
}
@@ -135,7 +142,8 @@
####################################################
####################################################
sub problem_selector {
- my ($AcceptedResponseTypes,$sequence_addendum,$symbmode,$all,$prefix,$smallbox,$onclick) = @_;
+ my ($AcceptedResponseTypes,$sequence_addendum,$symbmode,$all,$prefix,$smallbox,$onclick,
+ $include_tools) = @_;
# all: also make sequences selectable
# prefix: prefix for all form names
# smallbox: use smaller box
@@ -155,10 +163,16 @@
return $navmap if (! ref($navmap)); # error
foreach my $seq (@sequences) {
my $seq_str = '';
- foreach my $res (&get_resources($navmap,$seq)) {
+ foreach my $res (&get_resources($navmap,$seq,$include_tools)) {
foreach my $part (@{$res->parts}) {
- my @response_ids = $res->responseIds($part);
- my @response_types = $res->responseType($part);
+ my (@response_ids, at response_types);
+ if ($res->is_tool) {
+ @response_ids = ();
+ @response_types = ('tool');
+ } else {
+ @response_ids = $res->responseIds($part);
+ @response_types = $res->responseType($part);
+ }
for (my $i=0;$i<scalar(@response_types);$i++){
my $respid = $response_ids[$i];
my $resptype = $response_types[$i];
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.174 loncom/interface/statistics/lonstudentassessment.pm:1.175
--- loncom/interface/statistics/lonstudentassessment.pm:1.174 Fri Mar 28 14:43:26 2014
+++ loncom/interface/statistics/lonstudentassessment.pm Mon Dec 18 23:51:19 2017
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentassessment.pm,v 1.174 2014/03/28 14:43:26 bisitz Exp $
+# $Id: lonstudentassessment.pm,v 1.175 2017/12/18 23:51:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -605,7 +605,7 @@
sub get_resources {
my ($navmap,$sequence) = @_;
my @resources = $navmap->retrieveResources($sequence,
- sub { shift->is_problem(); },
+ sub { shift->is_gradable(); },
0,0,0);
return @resources;
}
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.744 loncom/homework/grades.pm:1.745
--- loncom/homework/grades.pm:1.744 Mon Dec 18 14:46:10 2017
+++ loncom/homework/grades.pm Mon Dec 18 23:51:24 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.744 2017/12/18 14:46:10 raeburn Exp $
+# $Id: grades.pm,v 1.745 2017/12/18 23:51:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -116,7 +116,11 @@
my $res = $navmap->getBySymb($symb);
my $partlist = $res->parts();
my $url = $res->src();
- my @metakeys = split(/,/,&Apache::lonnet::metadata($url,'keys'));
+ my $toolsymb;
+ if ($url =~ /ext\.tool$/) {
+ $toolsymb = $symb;
+ }
+ my @metakeys = split(/,/,&Apache::lonnet::metadata($url,'keys',$toolsymb));
my @stores;
foreach my $part (@{ $partlist }) {
@@ -852,6 +856,7 @@
sub listStudents {
my ($request,$symb,$submitonly) = @_;
+ my ($is_tool) = ($symb =~ /ext\.tool$/);
my $cdom = $env{"course.$env{'request.course.id'}.domain"};
my $cnum = $env{"course.$env{'request.course.id'}.num"};
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'};
@@ -907,38 +912,66 @@
"\n";
$gradeTable .= &Apache::lonhtmlcommon::start_pick_box();
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Problem Text'))
- .'<label><input type="radio" name="vProb" value="no" checked="checked" /> '.&mt('no').' </label>'."\n"
- .'<label><input type="radio" name="vProb" value="yes" /> '.&mt('one student').' </label>'."\n"
- .'<label><input type="radio" name="vProb" value="all" /> '.&mt('all students').' </label><br />'."\n"
- .&Apache::lonhtmlcommon::row_closure();
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Answer'))
- .'<label><input type="radio" name="vAns" value="no" /> '.&mt('no').' </label>'."\n"
- .'<label><input type="radio" name="vAns" value="yes" /> '.&mt('one student').' </label>'."\n"
- .'<label><input type="radio" name="vAns" value="all" checked="checked" /> '.&mt('all students').' </label><br />'."\n"
- .&Apache::lonhtmlcommon::row_closure();
+ unless ($is_tool) {
+ $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Problem Text'))
+ .'<label><input type="radio" name="vProb" value="no" checked="checked" /> '.&mt('no').' </label>'."\n"
+ .'<label><input type="radio" name="vProb" value="yes" /> '.&mt('one student').' </label>'."\n"
+ .'<label><input type="radio" name="vProb" value="all" /> '.&mt('all students').' </label><br />'."\n"
+ .&Apache::lonhtmlcommon::row_closure();
+ $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Answer'))
+ .'<label><input type="radio" name="vAns" value="no" /> '.&mt('no').' </label>'."\n"
+ .'<label><input type="radio" name="vAns" value="yes" /> '.&mt('one student').' </label>'."\n"
+ .'<label><input type="radio" name="vAns" value="all" checked="checked" /> '.&mt('all students').' </label><br />'."\n"
+ .&Apache::lonhtmlcommon::row_closure();
+ }
my $submission_options;
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status;
$env{'form.Status'} = $saveStatus;
+ my %optiontext;
+ if ($is_tool) {
+ %optiontext = &Apache::lonlocal::texthash (
+ lastonly => 'last transaction',
+ last => 'last transaction with details',
+ datesub => 'all transactions',
+ all => 'all transactions with details',
+ );
+ } else {
+ %optiontext = &Apache::lonlocal::texthash (
+ lastonly => 'last submission',
+ last => 'last submission with details',
+ datesub => 'all submissions',
+ all => 'all submissions with details',
+ );
+ }
$submission_options.=
'<span class="LC_nobreak">'.
'<label><input type="radio" name="lastSub" value="lastonly" /> '.
- &mt('last submission').' </label></span>'."\n".
+ $optiontext{'lastonly'}.' </label></span>'."\n".
'<span class="LC_nobreak">'.
'<label><input type="radio" name="lastSub" value="last" /> '.
- &mt('last submission with details').' </label></span>'."\n".
+ $optiontext{'last'}.' </label></span>'."\n".
'<span class="LC_nobreak">'.
'<label><input type="radio" name="lastSub" value="datesub" checked="checked" /> '.
- &mt('all submissions').'</label></span>'."\n".
+ $optiontext{'datesub'}.'</label></span>'."\n".
'<span class="LC_nobreak">'.
'<label><input type="radio" name="lastSub" value="all" /> '.
- &mt('all submissions with details').'</label></span>';
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Submissions'))
+ $optiontext{'all'}.'</label></span>';
+ my $viewtitle;
+ if ($is_tool) {
+ $viewtitle = &mt('View Transactions');
+ } else {
+ $viewtitle = &mt('View Submissions');
+ }
+ $gradeTable .= &Apache::lonhtmlcommon::row_title($viewtitle)
.$submission_options
.&Apache::lonhtmlcommon::row_closure();
+ my $closure;
+ if (($is_tool) && (exists($env{'form.Status'}))) {
+ $closure = 1;
+ }
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Grading Increments'))
.'<select name="increment">'
.'<option value="1">'.&mt('Whole Points').'</option>'
@@ -946,7 +979,7 @@
.'<option value=".25">'.&mt('Quarter Points').'</option>'
.'<option value=".1">'.&mt('Tenths of a Point').'</option>'
.'</select>'
- .&Apache::lonhtmlcommon::row_closure();
+ .&Apache::lonhtmlcommon::row_closure($closure);
$gradeTable .=
&build_section_inputs().
@@ -957,19 +990,30 @@
if (exists($env{'form.Status'})) {
$gradeTable .= '<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n";
} else {
+ if ($is_tool) {
+ $closure = 1;
+ }
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status'))
.&Apache::lonhtmlcommon::StatusOptions(
$saveStatus,undef,1,'javascript:reLoadList(this.form);')
- .&Apache::lonhtmlcommon::row_closure();
+ .&Apache::lonhtmlcommon::row_closure($closure);
}
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Check For Plagiarism'))
- .'<input type="checkbox" name="checkPlag" checked="checked" />'
- .&Apache::lonhtmlcommon::row_closure(1)
- .&Apache::lonhtmlcommon::end_pick_box();
-
+ unless ($is_tool) {
+ $closure = 1;
+ $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Check For Plagiarism'))
+ .'<input type="checkbox" name="checkPlag" checked="checked" />'
+ .&Apache::lonhtmlcommon::row_closure($closure);
+ }
+ $gradeTable .= &Apache::lonhtmlcommon::end_pick_box();
+ my $regrademsg;
+ if ($is_tool) {
+ $regrademsg =&mt("To view/grade/regrade, click on the check box(es) next to the student's name(s). Then click on the Next button.");
+ } else {
+ $regrademsg = &mt("To view/grade/regrade a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.");
+ }
$gradeTable .= '<p>'
- .&mt("To view/grade/regrade a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n"
+ .$regrademsg."\n"
.'<input type="hidden" name="command" value="processGroup" />'
.'</p>';
@@ -1977,6 +2021,7 @@
my $probtitle=&Apache::lonnet::gettitle($symb);
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; }
+ my ($is_tool) = ($symb =~ /ext\.tool$/);
if (!&canview($usec)) {
$request->print(
@@ -1989,8 +2034,10 @@
}
if (!$env{'form.lastSub'}) { $env{'form.lastSub'} = 'datesub'; }
- if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; }
- if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; }
+ unless ($is_tool) {
+ if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; }
+ if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; }
+ }
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : '');
my $checkIcon = '<img alt="'.&mt('Check Mark').
'" src="'.$request->dir_config('lonIconsURL').
@@ -2078,7 +2125,7 @@
$request->print($prnmsg);
# if ($env{'form.handgrade'} eq 'yes') {
- if (1) {
+ unless ($is_tool) {
my %lt = &Apache::lonlocal::texthash(
keyh => 'Keyword Highlighting for Essays',
@@ -2163,12 +2210,16 @@
# Display student info
$request->print(($counter == 0 ? '' : '<br />'));
+ my $boxtitle = &mt('Submissions');
+ if ($is_tool) {
+ $boxtitle = &mt('Transactions')
+ }
my $result='<div class="LC_Box">'
- .'<h3 class="LC_hcell">'.&mt('Submissions').'</h3>';
+ .'<h3 class="LC_hcell">'.$boxtitle.'</h3>';
$result.='<input type="hidden" name="name'.$counter.
'" value="'.$env{'form.fullname'}.'" />'."\n";
# if ($env{'form.handgrade'} eq 'no') {
- if (1) {
+ unless ($is_tool) {
$result.='<p class="LC_info">'
.&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon)
."</p>\n";
@@ -2178,7 +2229,7 @@
my $fullname;
my $col_fullnames = [];
# if ($env{'form.handgrade'} eq 'yes') {
- if (1) {
+ unless ($is_tool) {
(my $sub_result,$fullname,$col_fullnames)=
&check_collaborators($symb,$uname,$udom,\%record,$handgrade,
$counter);
@@ -2193,12 +2244,16 @@
# (3) Last submission plus the parts info
# (4) The whole record for this student
- my ($string,$timestamp)= &get_last_submission(\%record);
+ my ($string,$timestamp)= &get_last_submission(\%record,$is_tool);
my $lastsubonly;
if ($$timestamp eq '') {
$lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>';
+ } elsif ($is_tool) {
+ $lastsubonly =
+ '<div class="LC_grade_submissions_body">'
+ .'<b>'.&mt('Date Grade Passed Back:').'</b> '.$$timestamp."</div>\n";
} else {
$lastsubonly =
'<div class="LC_grade_submissions_body">'
@@ -2381,7 +2436,12 @@
my %seen = ();
my @partlist;
my @gradePartRespid;
- my @part_response_id = &flatten_responseType($responseType);
+ my @part_response_id;
+ if ($is_tool) {
+ @part_response_id = ([0,'']);
+ } else {
+ @part_response_id = &flatten_responseType($responseType);
+ }
$request->print(
'<div class="LC_Box">'
.'<h3 class="LC_hcell">'.&mt('Assign Grades').'</h3>'
@@ -2507,7 +2567,7 @@
#--- Retrieve the last submission for all the parts
sub get_last_submission {
- my ($returnhash)=@_;
+ my ($returnhash,$is_tool)=@_;
my (@string,$timestamp,%lasthidden);
if ($$returnhash{'version'}) {
my %lasthash=();
@@ -2573,8 +2633,14 @@
}
}
if (!@string) {
+ my $msg;
+ if ($is_tool) {
+ $msg = &mt('Nothing passed back - no attempts.');
+ } else {
+ $msg = &mt('Nothing submitted - no attempts.');
+ }
$string[0] =
- '<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span>';
+ '<span class="LC_warning">'.$msg.'</span>';
}
return (\@string,\$timestamp);
}
@@ -3561,6 +3627,11 @@
#--- show scores for a section or whole class w/ option to change/update a score
sub viewgrades {
my ($request,$symb) = @_;
+ my ($is_tool,$toolsymb);
+ if ($symb =~ /ext\.tool$/) {
+ $is_tool = 1;
+ $toolsymb = $symb;
+ }
&viewgrades_js($request);
#need to make sure we have the correct data for later EXT calls,
@@ -3641,7 +3712,13 @@
if ($env{'form.submitonly'} eq 'all') {
$result.= '<h3>'.$common_header.'</h3>';
} else {
- $result.= '<h3>'.$common_header.' '.&mt('(submission status: "[_1]")',$submission_status).'</h3>';
+ my $text;
+ if ($is_tool) {
+ $text = &mt('(transaction status: "[_1]")',$submission_status);
+ } else {
+ $text = &mt('(submission status: "[_1]")',$submission_status);
+ }
+ $result.= '<h3>'.$common_header.' '.$text.'</h3>';
}
$result .= &Apache::loncommon::start_data_table();
#radio buttons/text box for assigning points for a section or class.
@@ -3654,7 +3731,12 @@
my %weight = ();
my $ctsparts = 0;
my %seen = ();
- my @part_response_id = &flatten_responseType($responseType);
+ my @part_response_id;
+ if ($is_tool) {
+ @part_response_id = ([0,'']);
+ } else {
+ @part_response_id = &flatten_responseType($responseType);
+ }
foreach my $part_response_id (@part_response_id) {
my ($partid,$respid) = @{ $part_response_id };
my $part_resp = join('_',@{ $part_response_id });
@@ -3709,7 +3791,13 @@
if ($env{'form.submitonly'} eq 'all') {
$result.= '<h3>'.$specific_header.'</h3>';
} else {
- $result.= '<h3>'.$specific_header.' '.&mt('(submission status: "[_1]")',$submission_status).'</h3>';
+ my $text;
+ if ($is_tool) {
+ $text = &mt('(transaction status: "[_1]")',$submission_status);
+ } else {
+ $text = &mt('(submission status: "[_1]")',$submission_status);
+ }
+ $result.= '<h3>'.$specific_header.' '.$text.'</h3>';
}
$result.= &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
@@ -3723,10 +3811,10 @@
my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
my @partids = ();
foreach my $part (@parts) {
- my $display=&Apache::lonnet::metadata($url,$part.'.display');
+ my $display=&Apache::lonnet::metadata($url,$part.'.display',$toolsymb);
my $narrowtext = &mt('Tries');
$display =~ s|^Number of Attempts|$narrowtext <br />|; # makes the column narrower
- if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
+ if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name',$toolsymb); }
my ($partid) = &split_part_type($part);
push(@partids,$partid);
#
@@ -3767,7 +3855,7 @@
return $a cmp $b;
} (keys(%$fullname))) {
$result.=&viewstudentgrade($symb,$env{'request.course.id'},
- $_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets);
+ $_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets,$is_tool);
}
$result.=&Apache::loncommon::end_data_table();
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";
@@ -3855,7 +3943,7 @@
#--- call by previous routine to display each student who satisfies submission filter.
sub viewstudentgrade {
- my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_;
+ my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets,$is_tool) = @_;
my ($uname,$udom) = split(/:/,$student);
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my $submitonly = $env{'form.submitonly'};
@@ -3961,6 +4049,10 @@
# record does not get update if unchanged
sub editgrades {
my ($request,$symb) = @_;
+ my $toolsymb;
+ if ($symb =~ /ext\.tool$/) {
+ $toolsymb = $symb;
+ }
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
my $title='<h2>'.&mt('Current Grade Status').'</h2>';
@@ -4006,7 +4098,7 @@
my ($part,$type) = &split_part_type($stores);
if ($part !~ m/^\Q$partid\E/) { next;}
if ($type eq 'awarded' || $type eq 'solved') { next; }
- my $display=&Apache::lonnet::metadata($url,$stores.'.display');
+ my $display=&Apache::lonnet::metadata($url,$stores.'.display',$toolsymb);
$display =~ s/\[Part: \Q$part\E\]//;
my $narrowtext = &mt('Tries');
$display =~ s/Number of Attempts/$narrowtext/;
@@ -4257,7 +4349,7 @@
tw=eval('vf.f'+i+'.selectedIndex');
if (tw==1) { foundID=1; }
if (tw==2) { founduname=1; }
- if (tw==3) { foundclicker=1; }
+ if (tw==3) { foundclicker=1; }
if (tw>4) { foundsomething=1; }
}
if (founduname==0 && foundID==0 && Æoundclicker==0) {
@@ -4318,6 +4410,10 @@
sub csvupload_fields {
my ($symb,$errorref) = @_;
+ my $toolsymb;
+ if ($symb =~ /ext\.tool$/) {
+ $toolsymb = $symb;
+ }
my (@parts) = &getpartlist($symb,$errorref);
if (ref($errorref)) {
if ($$errorref) {
@@ -4332,9 +4428,9 @@
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
foreach my $part (sort(@parts)) {
my @datum;
- my $display=&Apache::lonnet::metadata($url,$part.'.display');
+ my $display=&Apache::lonnet::metadata($url,$part.'.display',$toolsymb);
my $name=$part;
- if (!$display) { $display = $name; }
+ if (!$display) { $display = $name; }
@datum=($name,$display);
if ($name=~/^stores_(.*)_awarded/) {
push(@fields,['stores_'.$1.'_points',"Points [Part: $1]"]);
@@ -4824,7 +4920,7 @@
my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); },
1,0,1);
for my $sequence ($navmap->getById('0.0'), @sequences) {
- if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
+ if ($navmap->hasResource($sequence, sub { shift->is_gradable(); }, 0) ) {
my $title = $minder.'.'.
&HTML::Entities::encode($sequence->compTitle(),'"\'&');
push(@titles, $title); # minder in case two titles are identical
@@ -4921,10 +5017,11 @@
if($curRes == $iterator->BEGIN_MAP) { $depth++; }
if($curRes == $iterator->END_MAP) { $depth--; }
- if (ref($curRes) && $curRes->is_problem()) {
+ if (ref($curRes) && $curRes->is_gradable()) {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
+ my ($is_tool) = ($symbx =~ /ext\.tool$/);
$studentTable.=
&Apache::loncommon::start_data_table_row().
'<td align="center" valign="top" >'.$prob.
@@ -4935,26 +5032,32 @@
'</td>';
$studentTable.='<td valign="top">';
my %form = ('CODE' => $env{'form.CODE'},);
- if ($env{'form.vProb'} eq 'yes' ) {
- $studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
- undef,'both',\%form);
- } else {
- my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form);
- $companswer =~ s|<form(.*?)>||g;
- $companswer =~ s|</form>||g;
-# while ($companswer =~ /(<a href\=\"javascript:newWindow.*?Script Vars<\/a>)/s) { #<a href="javascript:newWindow</a>
-# $companswer =~ s/$1/ /ms;
-# $request->print('match='.$1."<br />\n");
-# }
-# $companswer =~ s|<table border=\"1\">|<table border=\"0\">|g;
- $studentTable.=' <b>'.$title.'</b> <br /> <b>'.&mt('Correct answer').':</b><br />'.$companswer;
+ unless ($is_tool) {
+ if ($env{'form.vProb'} eq 'yes' ) {
+ $studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
+ undef,'both',\%form);
+ } else {
+ my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form);
+ $companswer =~ s|<form(.*?)>||g;
+ $companswer =~ s|</form>||g;
+# while ($companswer =~ /(<a href\=\"javascript:newWindow.*?Script Vars<\/a>)/s) { #<a href="javascript:newWindow</a>
+# $companswer =~ s/$1/ /ms;
+# $request->print('match='.$1."<br />\n");
+# }
+# $companswer =~ s|<table border=\"1\">|<table border=\"0\">|g;
+ $studentTable.=' <b>'.$title.'</b> <br /> <b>'.&mt('Correct answer').':</b><br />'.$companswer;
+ }
}
my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'},$udom,$uname);
if ($env{'form.lastSub'} eq 'datesub') {
if ($record{'version'} eq '') {
- $studentTable.='<br /> <span class="LC_warning">'.&mt('No recorded submission for this problem.').'</span><br />';
+ my $msg = &mt('No recorded submission for this problem.');
+ if ($is_tool) {
+ $msg = &mt('No recorded transactions for this external tool');
+ }
+ $studentTable.='<br /> <span class="LC_warning">'.$msg.'</span><br />';
} else {
my %responseType = ();
foreach my $partid (@{$parts}) {
@@ -4967,7 +5070,6 @@
$responseType{$partid} = \%responseIds;
}
$studentTable.= &displaySubByDates($symbx,\%record,$parts,\%responseType,$checkIcon,$uname,$udom);
-
}
} elsif ($env{'form.lastSub'} eq 'all') {
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : '');
@@ -9658,12 +9760,13 @@
my ($request,$symb) = @_;
if (!$symb) {return '';}
&commonJSfunctions($request);
+ my ($is_tool) = ($symb =~ /ext\.tool$/);
my $result;
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
- $result.=&selectfield(1).
+ $result.=&selectfield(1,$is_tool).
'<input type="hidden" name="command" value="viewgrades" />
<div>
<input type="submit" value="'.&mt('Next').' →" />
@@ -9677,6 +9780,7 @@
my ($request,$symb) = @_;
if (!$symb) {return '';}
+ my ($is_tool) = ($symb =~ /ext\.tool$/);
&commonJSfunctions($request);
my $result='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
@@ -9684,7 +9788,7 @@
$result.='
<h2>
'.&mt('Select Students for Which to Download Submissions').'
-</h2>'.&selectfield(1).'
+</h2>'.&selectfield(1,$is_tool).'
<input type="hidden" name="command" value="downloadfileslink" />
<input type="submit" value="'.&mt('Next').' →" />
</div>
@@ -9700,12 +9804,13 @@
my ($request,$symb) = @_;
if (!$symb) {return '';}
+ my ($is_tool) = ($symb =~ /ext\.tool$/);
&commonJSfunctions($request);
my $result;
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
- $result.=&selectfield(1).'
+ $result.=&selectfield(1,$is_tool).'
<input type="hidden" name="command" value="submission" />
<input type="submit" value="'.&mt('Next').' →" />
</div>
@@ -9717,10 +9822,17 @@
}
sub selectfield {
- my ($full)=@_;
- my %options =
- (&substatus_options,
- 'select_form_order' => ['yes','queued','graded','incorrect','all']);
+ my ($full,$is_tool)=@_;
+ my %options;
+ if ($is_tool) {
+ %options =
+ (&transtatus_options,
+ 'select_form_order' => ['yes','incorrect','all']);
+ } else {
+ %options =
+ (&substatus_options,
+ 'select_form_order' => ['yes','queued','graded','incorrect','all']);
+ }
my $result='<div class="LC_columnSection">
<fieldset>
@@ -9744,10 +9856,14 @@
'.&Apache::lonhtmlcommon::StatusOptions(undef,undef,5,undef,'mult').'
</fieldset>';
if ($full) {
- $result.='
+ my $heading = &mt('Submission Status');
+ if ($is_tool) {
+ $heading = &mt('Transaction Status');
+ }
+ $result.='
<fieldset>
<legend>
- '.&mt('Submission Status').'
+ '.$heading.'
</legend>'.
&Apache::loncommon::select_form('all','submitonly',\%options).
'</fieldset>';
@@ -9766,6 +9882,14 @@
);
}
+sub transtatus_options {
+ return &Apache::lonlocal::texthash(
+ 'yes' => 'with score transactions',
+ 'incorrect' => 'with less than full credit',
+ 'all' => 'with any status',
+ );
+}
+
sub reset_perm {
undef(%perm);
}
@@ -10396,7 +10520,7 @@
sub select_problem {
my ($r)=@_;
$r->print('<h3>'.&mt('Select the problem or one of the problems you want to grade').'</h3><form action="/adm/grades">');
- $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1));
+ $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1,undef,undef,undef,undef,1));
$r->print('<input type="hidden" name="command" value="gradingmenu" />');
$r->print('<input type="submit" value="'.&mt('Next').' →" /></form>');
}
More information about the LON-CAPA-cvs
mailing list