--- loncom/interface/lonprintout.pm 2003/05/08 19:16:42 1.160 +++ loncom/interface/lonprintout.pm 2003/05/13 15:28:32 1.164 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.160 2003/05/08 19:16:42 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.164 2003/05/13 15:28:32 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1381,6 +1381,18 @@ ENDPART &Apache::lonnet::appenv(%moreenv); my $texversion=&Apache::lonnet::ssi($currentURL); &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter'); + if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { + $moreenv{'form.grade_target'}='answer'; + $moreenv{'form.print_answer'}='yes'; + &Apache::lonnet::appenv(%moreenv); + my $answer=&Apache::lonnet::ssi($currentURL); + &Apache::lonnet::delenv('form.grade_target','form.print_answer'); + my $start=index($answer,'\vskip 0 mm',0); + my $finish=rindex $answer,'\vskip 0 mm' ; + if ($start!=-1 && $finish!=-1) {$answer=substr($answer,$start,$finish-$start+12);} +# $r->print('
'.$answer.'
'); return OK; + $texversion=~s/(\\end{document})/$answer$1/; + } $result .= $texversion; if ($currentURL=~m/\.page\s*$/) { ($result,$number_of_columns) = &page_cleanup($result); @@ -1582,10 +1594,11 @@ sub handler { $helper = $result; -# my $key; -# foreach $key (keys %{$helper->{'VARS'}}) { -# $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-
'); -# } + + my $key; + foreach $key (keys %{$helper->{'VARS'}}) { + $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-
'); + } # return OK; @@ -1883,6 +1896,20 @@ CHOOSE_FROM_SUBDIR $helper->declareVar('PRINT_TYPE'); $paramHash->{CHOICES} = $printChoices; Apache::lonhelper::choices->new(); + + if ($ENV{'request.role.adv'}) { + $paramHash = Apache::lonhelper::getParamHash(); + $paramHash->{MESSAGE_TEXT} = "
Next option is available only for advanced users:
"; + Apache::lonhelper::message->new(); + $paramHash = Apache::lonhelper::getParamHash(); + $paramHash->{'variable'} = 'ANSWER_TYPE'; + $helper->declareVar('ANSWER_TYPE'); + $paramHash->{CHOICES} = [ + ['Print without answer', 'yes'], + ['Print with answers', 'no'] ]; + Apache::lonhelper::choices->new(); + } + Apache::lonprintout::page_format_state->new("FORMAT"); # Generate the PAGESIZE state which will offer the user the margin