version 1.129, 2003/05/16 19:01:27
|
version 1.134, 2003/06/13 20:50:57
|
Line 225 sub check_access {
|
Line 225 sub check_access {
|
} |
} |
} |
} |
|
|
if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && |
#if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && |
(!$Apache::lonhomework::history{"resource.0.outtoken"})) { |
# (!$Apache::lonhomework::history{"resource.0.outtoken"})) { |
return ('UNCHECKEDOUT','needs to be checked out'); |
# return ('UNCHECKEDOUT','needs to be checked out'); |
} |
#} |
|
|
|
|
&Apache::lonxml::debug("sending back :$status:$datemsg:"); |
&Apache::lonxml::debug("sending back :$status:$datemsg:"); |
Line 398 sub analyze {
|
Line 398 sub analyze {
|
'last problem'); |
'last problem'); |
my $subresult=&Apache::lonnet::ssi($request->uri, |
my $subresult=&Apache::lonnet::ssi($request->uri, |
('grade_target' => 'analyze'), |
('grade_target' => 'analyze'), |
('rndseed' => $i)); |
('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 418 sub analyze {
|
Line 417 sub analyze {
|
} |
} |
&Apache::lonhtmlcommon::Update_PrgWin($request,\%prog_state, |
&Apache::lonhtmlcommon::Update_PrgWin($request,\%prog_state, |
'Analyzing Results'); |
'Analyzing Results'); |
foreach my $part (keys(%allparts)) { |
foreach my $part (sort(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; |
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { |
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { |
$request->print('<tr><td>'.join('</td><td>',@{ $answer }). |
$frequency{join("\0",@{ $answer })}++; |
'</td></tr>'); |
} |
|
$request->print('<tr><td colspan="'.($num_cols).'">Answer</td><td>Frequency</td></tr>'); |
|
foreach my $answer (sort {(split("\0",$a))[0] <=> (split("\0",$b))[0]} (keys(%frequency))) { |
|
$request->print('<tr><td align="right">'. |
|
join('</td><td align="right">',split("\0",$answer)). |
|
'</td><td>('.$frequency{$answer}. |
|
')</td></tr>'); |
} |
} |
$request->print('</table>'); |
$request->print('</table>'); |
} else { |
} else { |
$request->print('<p>Part '.$part. |
$request->print('<p>Part '.$part. |
' is not analyzabale at this time</p>'); |
' is not analyzable at this time</p>'); |
} |
} |
} |
} |
|
if (scalar(keys(%allparts)) == 0 ) { |
|
$request->print('<p>Found no analyzable parts in this problem, |
|
currently only Numerical, Formula and String response |
|
styles are supported.</p>'); |
|
} |
&Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); |
&analyze_footer($request); |
&analyze_footer($request); |
&Apache::lonhomework::showhash(%overall); |
&Apache::lonhomework::showhash(%overall); |
Line 561 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 568 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; |
Line 663 sub handler {
|
Line 684 sub handler {
|
&renderpage($request,$file); |
&renderpage($request,$file); |
} elsif ($ENV{'form.problemmode'} eq 'EditXML') { |
} elsif ($ENV{'form.problemmode'} eq 'EditXML') { |
&editxmlmode($request,$file); |
&editxmlmode($request,$file); |
} elsif ($ENV{'form.problemmode'} eq 'Answer Distribution') { |
} elsif ($ENV{'form.problemmode'} eq 'Calculate answers') { |
&analyze($request,$file); |
&analyze($request,$file); |
} else { |
} else { |
&renderpage($request,$file); |
&renderpage($request,$file); |