--- loncom/homework/grades.pm 2007/06/17 02:11:44 1.416 +++ loncom/homework/grades.pm 2007/07/04 20:28:44 1.420 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.416 2007/06/17 02:11:44 www Exp $ +# $Id: grades.pm,v 1.420 2007/07/04 20:28:44 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -93,6 +93,7 @@ sub get_symb { return (); } } + &Apache::lonenc::check_decrypt(\$symb); return ($symb); } @@ -492,7 +493,7 @@ sub jscriptNform { ' }'."\n". ''."\n"; $jscript.= '
'."\n"; + 'onClick="javascript:submit();" target="_self" />'."\n"; if (scalar(%$fullname) eq 0) { my $colspan=3+scalar(@parts); $result='There are no students in section "'.$env{'form.section'}. @@ -3107,7 +3093,7 @@ sub viewstudentgrade { ''. "\n".$ctr.'
@@ -6370,6 +6360,9 @@ ENDHEADER
if ($env{'form.upfiletype'} eq 'iclicker') {
($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses);
}
+ if ($env{'form.upfiletype'} eq 'interwrite') {
+ ($errormsg,$number)=&interwrite_eval(\@questiontitles,\%responses);
+ }
$result.=' '.&mt('Found [_1] question(s)',$number).' '. ''. &mt('Awarding [_1] percent for correct and [_2] percent for incorrect responses', @@ -6449,6 +6442,35 @@ sub iclicker_eval { return ($errormsg,$number); } +sub interwrite_eval { + my ($questiontitles,$responses)=@_; + my $number=0; + my $errormsg=''; + my $skipline=1; + my $questionnumber=0; + my %idresponses=(); + foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { + my %components=&Apache::loncommon::record_sep($line); + my @entries=map {$components{$_}} (sort(keys(%components))); + if ($entries[1] eq 'Time') { $skipline=0; next; } + if ($entries[1] eq 'Response') { $skipline=1; } + next if $skipline; + if ($entries[0]!=$questionnumber) { + $questionnumber=$entries[0]; + $$questiontitles[$number]=&mt('Question [_1]',$questionnumber); + $number++; + } + my $id=$entries[4]; + $id=~s/^[\#0]+//; + $idresponses{$id}[$number]=$entries[6]; + } + foreach my $id (keys %idresponses) { + $$responses{$id}=join(',',@{$idresponses{$id}}); + $$responses{$id}=~s/^\s*\,//; + } + return ($errormsg,$number); +} + sub assign_clicker_grades { my ($r)=@_; my ($symb)=&get_symb($r); @@ -6501,8 +6523,17 @@ ENDHEADER my $pincorrect=$env{'form.pincorrect'}; my $storecount=0; foreach my $key (keys(%env)) { + my $user=''; if ($key=~/^form\.student\:(.*)$/) { - my $user=$1; + $user=$1; + } + if ($key=~/^form\.unknown\:(.*)$/) { + my $id=$1; + if (($env{'form.uname'.$id}) && ($env{'form.udom'.$id})) { + $user=$env{'form.uname'.$id}.':'.$env{'form.udom'.$id}; + } + } + if ($user) { my @answer=split(/\,/,$env{$key}); my $sum=0; for (my $i=0;$i<$number;$i++) { |