version 1.130, 2003/05/19 21:05:23
|
version 1.132, 2003/05/23 06:45:45
|
Line 399 sub analyze {
|
Line 399 sub analyze {
|
my $subresult=&Apache::lonnet::ssi($request->uri, |
my $subresult=&Apache::lonnet::ssi($request->uri, |
('grade_target' => 'analyze'), |
('grade_target' => 'analyze'), |
('rndseed' => $i+$rndseed)); |
('rndseed' => $i+$rndseed)); |
&Apache::lonxml::debug(":$subresult:"); |
|
(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2); |
(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2); |
my %analyze=&Apache::lonnet::str2hash($subresult); |
my %analyze=&Apache::lonnet::str2hash($subresult); |
my @parts; |
my @parts; |
Line 420 sub analyze {
|
Line 419 sub analyze {
|
'Analyzing Results'); |
'Analyzing Results'); |
foreach my $part (keys(%allparts)) { |
foreach my $part (keys(%allparts)) { |
if (defined(@{ $overall{$part.'.answer'} })) { |
if (defined(@{ $overall{$part.'.answer'} })) { |
$request->print('<table><tr><td>Part '.$part.'</td></tr>'); |
my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] }); |
|
$request->print('<table><tr><td colspan="'.($num_cols+1).'">Part '.$part.'</td></tr>'); |
my %frequency; |
my %frequency; |
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { |
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { |
$frequency{join('\0',@{ $answer })}++; |
$frequency{join("\0",@{ $answer })}++; |
} |
} |
foreach my $answer (sort {(split('\0',$a))[0] <=> (split('\0',$b))[0]} (keys(%frequency))) { |
$request->print('<tr><td colspan="'.($num_cols).'">Answer</td><td>Frequency</td></tr>'); |
$request->print('<tr><td>'. |
foreach my $answer (sort {(split("\0",$a))[0] <=> (split("\0",$b))[0]} (keys(%frequency))) { |
join('</td><td>',split('\0',$answer)). |
$request->print('<tr><td align="right">'. |
|
join('</td><td align="right">',split("\0",$answer)). |
'</td><td>('.$frequency{$answer}. |
'</td><td>('.$frequency{$answer}. |
')</td></tr>'); |
')</td></tr>'); |
} |
} |
Line 572 sub newproblem {
|
Line 573 sub newproblem {
|
my $extension=$request->uri; |
my $extension=$request->uri; |
$extension=~s:^.*\.([\w]+)$:$1:; |
$extension=~s:^.*\.([\w]+)$:$1:; |
&Apache::lonxml::debug("Looking for :$extension:"); |
&Apache::lonxml::debug("Looking for :$extension:"); |
|
my $templatelist=&get_template_list('',$extension); |
if ($ENV{'form.template'} && |
if ($ENV{'form.template'} && |
$ENV{'form.template'} ne "Select a $extension template") { |
$ENV{'form.template'} ne "Select a $extension template") { |
use File::Copy; |
use File::Copy; |
Line 579 sub newproblem {
|
Line 581 sub newproblem {
|
my $dest = &Apache::lonnet::filelocation("",$request->uri); |
my $dest = &Apache::lonnet::filelocation("",$request->uri); |
copy($file,$dest); |
copy($file,$dest); |
&renderpage($request,$dest); |
&renderpage($request,$dest); |
|
} elsif($ENV{'form.newfile'} && !$templatelist) { |
|
# I don't like hard-coded filenames but for now, this will work. |
|
use File::Copy; |
|
my $templatefilename = |
|
$request->dir_config('lonIncludes').'/templates/blank.problem'; |
|
&Apache::lonxml::debug("$templatefilename"); |
|
my $dest = &Apache::lonnet::filelocation("",$request->uri); |
|
copy($templatefilename,$dest); |
|
&renderpage($request,$dest); |
} else { |
} else { |
my $templatelist=&get_template_list('',$extension); |
|
my $url=$request->uri; |
my $url=$request->uri; |
my $dest = &Apache::lonnet::filelocation("",$request->uri); |
my $dest = &Apache::lonnet::filelocation("",$request->uri); |
my $errormsg; |
my $errormsg; |