--- loncom/homework/grades.pm 2007/06/15 21:21:16 1.405
+++ loncom/homework/grades.pm 2007/06/15 22:00:42 1.406
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.405 2007/06/15 21:21:16 www Exp $
+# $Id: grades.pm,v 1.406 2007/06/15 22:00:42 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6311,17 +6311,22 @@ sub process_clicker_file {
$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 %responses=();
+ my @questiontitles=();
my $errormsg='';
my $number=0;
if ($env{'form.upfiletype'} eq 'iclicker') {
- ($errormsg,$number,%contents)=&iclicker_eval();
- $result.=$errormsg;
+ ($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses);
+ }
+ $result.='
'.&mt('Found [_1] questions',$number).'
';
+ foreach my $id (keys %responses) {
+ $result.='
'.$id.' - '.$responses{$id};
}
return $result.&show_grading_menu_form($symb);
}
sub iclicker_eval {
+ my ($questiontitles,$responses)=@_;
my $number=0;
my $errormsg='';
foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) {
@@ -6335,10 +6340,20 @@ sub iclicker_eval {
my @entries=split(/\,/,$line);
if ($entries[0] eq 'Question') {
for (my $i=3;$i<$#entries;$i+=6) {
+ $$questiontitles[$number]=$entries[$i];
$number++;
- $errormsg.='
'.$entries[$i];
}
}
+ if ($entries[0]=~/^\#/) {
+ my $id=$entries[0];
+ my @idresponses=();
+ $id=~s/^[\#0]+//;
+ for (my $i=0;$i<$number;$i++) {
+ my $idx=3+$i*6;
+ push(@idresponses,$entries[$idx]);
+ }
+ $$responses{$id}=join(',',@idresponses);
+ }
}
return ($errormsg,$number);
}