--- loncom/homework/lonhomework.pm 2003/05/23 06:25:53 1.131 +++ loncom/homework/lonhomework.pm 2003/06/30 20:10:01 1.137 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.131 2003/05/23 06:25:53 albertel Exp $ +# $Id: lonhomework.pm,v 1.137 2003/06/30 20:10:01 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,7 +50,7 @@ use Apache::essayresponse(); use Apache::externalresponse(); use Apache::rankresponse(); use Apache::matchresponse(); -#use Apache::chemresponse(); +use Apache::chemresponse(); use Apache::Constants qw(:common); use HTML::Entities(); use Apache::loncommon(); @@ -225,10 +225,10 @@ sub check_access { } } - if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && - (!$Apache::lonhomework::history{"resource.0.outtoken"})) { - return ('UNCHECKEDOUT','needs to be checked out'); - } + #if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && + # (!$Apache::lonhomework::history{"resource.0.outtoken"})) { + # return ('UNCHECKEDOUT','needs to be checked out'); + #} &Apache::lonxml::debug("sending back :$status:$datemsg:"); @@ -417,16 +417,18 @@ sub analyze { } &Apache::lonhtmlcommon::Update_PrgWin($request,\%prog_state, 'Analyzing Results'); - foreach my $part (keys(%allparts)) { + foreach my $part (sort(keys(%allparts))) { if (defined(@{ $overall{$part.'.answer'} })) { - $request->print(''); + my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] }); + $request->print('
Part '.$part.'
'); my %frequency; 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(''); + foreach my $answer (sort {(split("\0",$a))[0] <=> (split("\0",$b))[0]} (keys(%frequency))) { + $request->print(''); } @@ -467,15 +469,8 @@ sub editxmlmode { &renderpage($request,$file); } else { my ($rows,$cols) = &Apache::edit::textarea_sizes(\$problem); - my $xml_help = '
Part '.$part.'
'. - join('',split('\0',$answer)). + $request->print('
AnswerFrequency
'. + join('',split("\0",$answer)). '('.$frequency{$answer}. ')
'. - &Apache::loncommon::help_open_topic("Problem_Editor_XML_Index",'Problem Editing Help') - .''. - &Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols', - undef,undef,600) - .''. - &Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols', - undef,undef,600) - .'
'; + my $xml_help = Apache::loncommon::helpLatexCheatsheet("Problem_Editor_XML_Index", + "Problem Editing Help"); if ($cols > 80) { $cols = 80; } if ($cols < 70) { $cols = 70; } if ($rows < 20) { $rows = 20; } @@ -675,6 +670,8 @@ sub handler { } if ($ENV{'request.state'} eq "construct") { if ( -e $file ) { + &Apache::loncommon::get_unprocessed_cgi + ($ENV{'QUERY_STRING'},['problemmode']); if (!(defined $ENV{'form.problemmode'})) { #first visit to problem in construction space #&view_or_edit_menu($request);