version 1.419, 2007/07/04 18:37:30
|
version 1.420, 2007/07/04 20:28:44
|
Line 6446 sub interwrite_eval {
|
Line 6446 sub interwrite_eval {
|
my ($questiontitles,$responses)=@_; |
my ($questiontitles,$responses)=@_; |
my $number=0; |
my $number=0; |
my $errormsg=''; |
my $errormsg=''; |
|
my $skipline=1; |
|
my $questionnumber=0; |
|
my %idresponses=(); |
foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { |
foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { |
my %components=&Apache::loncommon::record_sep($line); |
my %components=&Apache::loncommon::record_sep($line); |
my @entries=map {$components{$_}} (sort(keys(%components))); |
my @entries=map {$components{$_}} (sort(keys(%components))); |
if ($entries[0] eq 'Question') { |
if ($entries[1] eq 'Time') { $skipline=0; next; } |
for (my $i=3;$i<$#entries;$i+=6) { |
if ($entries[1] eq 'Response') { $skipline=1; } |
$$questiontitles[$number]=$entries[$i]; |
next if $skipline; |
$number++; |
if ($entries[0]!=$questionnumber) { |
} |
$questionnumber=$entries[0]; |
} |
$$questiontitles[$number]=&mt('Question [_1]',$questionnumber); |
if ($entries[0]=~/^\#/) { |
$number++; |
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); |
|
} |
} |
|
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); |
return ($errormsg,$number); |
} |
} |
Line 6521 ENDHEADER
|
Line 6523 ENDHEADER
|
my $pincorrect=$env{'form.pincorrect'}; |
my $pincorrect=$env{'form.pincorrect'}; |
my $storecount=0; |
my $storecount=0; |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
|
my $user=''; |
if ($key=~/^form\.student\:(.*)$/) { |
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 @answer=split(/\,/,$env{$key}); |
my $sum=0; |
my $sum=0; |
for (my $i=0;$i<$number;$i++) { |
for (my $i=0;$i<$number;$i++) { |