version 1.405, 2007/06/15 21:21:16
|
version 1.406, 2007/06/15 22:00:42
|
Line 6311 sub process_clicker_file {
|
Line 6311 sub process_clicker_file {
|
$result.="<span class=\"LC_error\">Error:</span> The file you attempted to upload, <tt>".&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."; |
$result.="<span class=\"LC_error\">Error:</span> The file you attempted to upload, <tt>".&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."; |
return $result.&show_grading_menu_form($symb); |
return $result.&show_grading_menu_form($symb); |
} |
} |
my %contents=(); |
my %responses=(); |
|
my @questiontitles=(); |
my $errormsg=''; |
my $errormsg=''; |
my $number=0; |
my $number=0; |
if ($env{'form.upfiletype'} eq 'iclicker') { |
if ($env{'form.upfiletype'} eq 'iclicker') { |
($errormsg,$number,%contents)=&iclicker_eval(); |
($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses); |
$result.=$errormsg; |
} |
|
$result.='<br />'.&mt('Found [_1] questions',$number).'<br />'; |
|
foreach my $id (keys %responses) { |
|
$result.='<br />'.$id.' - '.$responses{$id}; |
} |
} |
return $result.&show_grading_menu_form($symb); |
return $result.&show_grading_menu_form($symb); |
} |
} |
|
|
sub iclicker_eval { |
sub iclicker_eval { |
|
my ($questiontitles,$responses)=@_; |
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'})) { |
Line 6335 sub iclicker_eval {
|
Line 6340 sub iclicker_eval {
|
my @entries=split(/\,/,$line); |
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]; |
$number++; |
$number++; |
$errormsg.='<br />'.$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); |
return ($errormsg,$number); |
} |
} |