version 1.409, 2007/06/15 22:16:13
|
version 1.410, 2007/06/16 01:37:44
|
Line 6313 sub process_clicker_file {
|
Line 6313 sub process_clicker_file {
|
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'); |
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'); |
return $result.&show_grading_menu_form($symb); |
return $result.&show_grading_menu_form($symb); |
} |
} |
|
|
|
# Were able to get all the info needed, now analyze the file |
|
|
|
my $heading=&mt('Scanning clicker file'); |
|
$result.=(<<ENDHEADER); |
|
<br /><table width="100%" border="0"><tr><td bgcolor="#777777"> |
|
<table width="100%" border="0"><tr bgcolor="#e6ffff"><td> |
|
<b>$heading</b></td></tr><tr bgcolor=#ffffe6><td> |
|
<form method="post" action="/adm/grades" name="clickeranalysis"> |
|
<input type="hidden" name="symb" value="$symb" /> |
|
<input type="hidden" name="command" value="assignclickergrades" /> |
|
<input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> |
|
<input type="hidden" name="saveState" value="$env{'form.saveState'}" /> |
|
ENDHEADER |
my %responses; |
my %responses; |
my @questiontitles; |
my @questiontitles; |
my $errormsg=''; |
my $errormsg=''; |
Line 6320 sub process_clicker_file {
|
Line 6334 sub process_clicker_file {
|
if ($env{'form.upfiletype'} eq 'iclicker') { |
if ($env{'form.upfiletype'} eq 'iclicker') { |
($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses); |
($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses); |
} |
} |
$result.='<br />'.&mt('Found [_1] questions',$number).'<br />'; |
$result.='<br />'.&mt('Found [_1] question(s)',$number).'<br />'; |
|
my $found_correct_flag=0; |
foreach my $id (keys(%responses)) { |
foreach my $id (keys(%responses)) { |
$result.='<br />'.$id.' - '.$responses{$id}; |
if ($correct_ids{$id}) { |
|
$result.="\n".'<input type="hidden" name="correct:'.$correct_ids{$id}.'" value="'.$responses{$id}.'" />'; |
|
$found_correct_flag++; |
|
} elsif ($clicker_ids{$id}) { |
|
$result.="\n".'<input type="hidden" name="student:'.$clicker_ids{$id}.'" value="'.$responses{$id}.'" />'; |
|
} else { |
|
$result.="\n<br />Unknown: ".$id." - ".$responses{$id}; |
|
} |
} |
} |
|
$result.='</form>'; |
|
$result.='</td></tr></table>'."\n". |
|
'</td></tr></table><br /><br />'."\n"; |
return $result.&show_grading_menu_form($symb); |
return $result.&show_grading_menu_form($symb); |
} |
} |
|
|
Line 6332 sub iclicker_eval {
|
Line 6357 sub iclicker_eval {
|
my $number=0; |
my $number=0; |
my $errormsg=''; |
my $errormsg=''; |
foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { |
foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { |
chomp($line); |
my %components=&Apache::loncommon::record_sep($line); |
foreach my $quoted ($line=~/\,\s*\"([^\"]*)\"\s*\,/g) { |
my @entries=map {$components{$_}} (sort(keys(%components))); |
my $replace=$quoted; |
|
$replace=~s/\,//g; |
|
&Apache::lonnet::logthis($quoted.' - '.$replace.'<br />'); |
|
$line=~s/\,\s*\"\Q$quoted\E\"\s*\,/,$replace,/gs; |
|
} |
|
my @entries=split(/\,/,$line); |
|
if ($entries[0] eq 'Question') { |
if ($entries[0] eq 'Question') { |
for (my $i=3;$i<$#entries;$i+=6) { |
for (my $i=3;$i<$#entries;$i+=6) { |
$$questiontitles[$number]=$entries[$i]; |
$$questiontitles[$number]=$entries[$i]; |