--- loncom/homework/grades.pm 2008/05/14 16:36:31 1.520
+++ loncom/homework/grades.pm 2008/05/23 22:14:25 1.521
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.520 2008/05/14 16:36:31 www Exp $
+# $Id: grades.pm,v 1.521 2008/05/23 22:14:25 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -8226,7 +8226,7 @@ sub process_clicker {
if (!$env{'form.upfiletype'}) { $env{'form.upfiletype'}='iclicker'; }
my %checked;
- foreach my $gradingmechanism ('attendance','personnel','specific') {
+ foreach my $gradingmechanism ('attendance','personnel','specific','given') {
if ($env{'form.gradingmechanism'} eq $gradingmechanism) {
$checked{$gradingmechanism}="checked='checked'";
}
@@ -8237,6 +8237,8 @@ sub process_clicker {
my $attendance=&mt("Award points just for participation");
my $personnel=&mt("Correctness determined from response by course personnel");
my $specific=&mt("Correctness determined from response with clicker ID(s)");
+ my $given=&mt("Correctness determined from given list of answers").' '.
+ '('.&mt("Provide comma-separated list. Use '*' for any answer correct, '-' for skip").')';
my $pcorrect=&mt("Percentage points for correct solution");
my $pincorrect=&mt("Percentage points for incorrect solution");
my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype',
@@ -8294,6 +8296,9 @@ function sanitycheck() {
+
+
+
@@ -8320,6 +8325,16 @@ sub process_clicker_file {
$result.=''.&mt('You need to specify a clicker ID for the correct answer').'';
return $result.&show_grading_menu_form($symb);
}
+ if (($env{'form.gradingmechanism'} eq 'given') && ($env{'form.givenanswer'}!~/\w/)) {
+ $result.=''.&mt('You need to specify the correct answer').'';
+ return $result.&show_grading_menu_form($symb);
+ }
+ if ($env{'form.gradingmechanism'} eq 'given') {
+ $env{'form.givenanswer'}=~s/^\s*//gs;
+ $env{'form.givenanswer'}=~s/\s*$//gs;
+ $env{'form.givenanswer'}=~s/[^a-zA-Z0-9\.\*\-]+/\,/g;
+ $env{'form.givenanswer'}=uc($env{'form.givenanswer'});
+ }
my %clicker_ids=&gather_clicker_ids();
my %correct_ids;
if ($env{'form.gradingmechanism'} eq 'personnel') {
@@ -8338,6 +8353,8 @@ sub process_clicker_file {
}
if ($env{'form.gradingmechanism'} eq 'attendance') {
$result.=&mt('Score based on attendance only');
+ } elsif ($env{'form.gradingmechanism'} eq 'given') {
+ $result.=&mt('Score based on [_1]',''.$env{'form.givenanswer'}.'');
} else {
my $number=0;
$result.='
'.&mt('Correctness determined by the following IDs').''; @@ -8380,6 +8397,7 @@ sub process_clicker_file { + ENDHEADER @@ -8441,7 +8459,7 @@ ENDHEADER } $result.='