--- loncom/homework/grades.pm 2007/06/13 15:22:38 1.402
+++ loncom/homework/grades.pm 2007/06/15 21:21:16 1.405
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.402 2007/06/13 15:22:38 www Exp $
+# $Id: grades.pm,v 1.405 2007/06/15 21:21:16 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1959,8 +1959,8 @@ KEYWORDS
($env{'form.lastSub'} eq 'hdgrade' &&
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
my $display_part=&get_display_part($partid,$symb);
- $lastsubonly.='
Debug -'.'Part: '.
- $display_part.' ( hhhh ID '.$respid.
+ $lastsubonly.='Part: '.
+ $display_part.' ( ID '.$respid.
' ) ';
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
if (@$files) {
@@ -6078,9 +6078,9 @@ GRADINGMENUJS
''.
' '.&mt('scores from file').' | '."\n";
-# $result.=''.
-# ''.
-# ' '.&mt('clicker file').' | '."\n";
+ $result.=''.
+ ''.
+ ' '.&mt('clicker file').' | '."\n";
$result.=''.
' 'iClicker'));
+ ('iclicker' => 'i>clicker'));
$result.=<
@@ -6268,12 +6270,77 @@ sub process_clicker_file {
my ($symb)=&get_symb($r);
if (!$symb) {return '';}
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
- $result.=&show_grading_menu_form($symb);
+ if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) {
+ $result.=''.&mt('You need to specify a clicker ID for the correct answer').'';
+ return $result.&show_grading_menu_form($symb);
+ }
my %clickerids=&gather_clicker_ids();
- foreach my $key (keys %clickerids) {
- $result.=' '.$key.' - '.$clickerids{$key};
+ my %correctids=();
+ if ($env{'form.gradingmechanism'} eq 'personnel') {
+ %correctids=&gather_adv_clicker_ids();
+ }
+ if ($env{'form.gradingmechanism'} eq 'specific') {
+ my $correctid=$env{'form.specificid'};
+ $correctid=~tr/a-z/A-Z/;
+ $correctid=~s/\s//gs;
+ $correctid=~s/^0+//;
+ $correctids{$correctid}='specified';
}
- return $result;
+ if ($env{'form.gradingmechanism'} eq 'attendance') {
+ $result.=&mt('Score based on attendance only');
+ } else {
+ my $number=0;
+ $result.=''.&mt('Correctness determined by the following IDs').'';
+ foreach my $id (sort(keys(%correctids))) {
+ $result.=''.$id.' - ';
+ if ($correctids{$id} eq 'specified') {
+ $result.=&mt('specified');
+ } else {
+ my ($uname,$udom)=split(/\:/,$correctids{$id});
+ $result.=&Apache::loncommon::plainname($uname,$udom);
+ }
+ $result.=' ';
+ $number++;
+ }
+ if ($number==0) {
+ $result.=''.&mt('No IDs found to determine correct answer').'';
+ return $result.&show_grading_menu_form($symb);
+ }
+ }
+ if (length($env{'form.upfile'}) < 2) {
+ $result.="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.";
+ return $result.&show_grading_menu_form($symb);
+ }
+ my %contents=();
+ my $errormsg='';
+ my $number=0;
+ if ($env{'form.upfiletype'} eq 'iclicker') {
+ ($errormsg,$number,%contents)=&iclicker_eval();
+ $result.=$errormsg;
+ }
+ return $result.&show_grading_menu_form($symb);
+}
+
+sub iclicker_eval {
+ my $number=0;
+ my $errormsg='';
+ foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) {
+ chomp($line);
+ foreach my $quoted ($line=~/\,\s*\"([^\"]*)\"\s*\,/g) {
+ my $replace=$quoted;
+ $replace=~s/\,//g;
+ &Apache::lonnet::logthis($quoted.' - '.$replace.' ');
+ $line=~s/\,\s*\"\Q$quoted\E\"\s*\,/,$replace,/gs;
+ }
+ my @entries=split(/\,/,$line);
+ if ($entries[0] eq 'Question') {
+ for (my $i=3;$i<$#entries;$i+=6) {
+ $number++;
+ $errormsg.=' '.$entries[$i];
+ }
+ }
+ }
+ return ($errormsg,$number);
}
sub handler {
| |