--- loncom/interface/lonprintout.pm 2003/07/10 20:39:08 1.202 +++ loncom/interface/lonprintout.pm 2003/08/13 19:52:05 1.208.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.202 2003/07/10 20:39:08 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.208.2.1 2003/08/13 19:52:05 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -465,7 +465,7 @@ sub page_format { sub get_name { my ($uname,$udom)=@_; if (!defined($uname)) { $uname=$ENV{'user.name'}; } - if (!defined($udom)) { $uname=$ENV{'user.domain'}; } + if (!defined($udom)) { $udom=$ENV{'user.domain'}; } my $plainname=&Apache::loncommon::plainname($uname,$udom); if ($plainname=~/^\s*$/) { $plainname=$uname; } return &Apache::lonxml::latex_special_symbols($plainname,undef,undef, @@ -619,6 +619,7 @@ ENDPART $currentURL=$helper->{'VARS'}->{'filename'}; $currentURL=~s/\/home\//\/~/; $currentURL=~s/public_html\///; + if ($currentURL=~/([^?]+)/) {$currentURL=$1;} } $selectionmade = 1; if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { @@ -627,7 +628,8 @@ ENDPART my %form; $form{'grade_target'}='tex'; $form{'textwidth'}=$LaTeXwidth; - $form{'problem_split'}=$parmhash{'problem_stream_switch'}; + $form{'problem_split'}=$parmhash{'problem_stream_switch'}; + $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; my $rndseed=time; $form{'rndseed'}=$rndseed; &Apache::lonnet::appenv(%moreenv); @@ -649,13 +651,15 @@ ENDPART ($result,$number_of_columns) = &page_cleanup($result); } } else { -# $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: '; -# if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) { -# $result.=$1; -# } else { -# $result.=$ENV{'form.url'}; -# } -# $result.=' \end{document}' + $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: '; + if ($currentURL=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) { + $result.=$1; + } elsif ($currentURL=~/\/ext\//) { + $result.=' \strut \\\\ THIS IS EXTERNAL RESOURCE WITH URL \strut \\\\ '.$currentURL.' '; + } else { + $result.=$currentURL; + } + $result.=' \end{document}' } } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or @@ -665,6 +669,7 @@ ENDPART $form{'grade_target'}='tex'; $form{'textwidth'}=$LaTeXwidth; $form{'problem_split'}=$parmhash{'problem_stream_switch'}; + $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; my $flag_latex_header_remove = 'NO'; my $flag_page_in_sequence = 'NO'; my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'}; @@ -756,6 +761,7 @@ ENDPART if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { my %form; $form{'answer_output_mode'}='tex'; + $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$ENV{'request.course.id'},%form); $rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/; } @@ -805,6 +811,7 @@ ENDPART my %form; $form{'grade_target'}='answer'; $form{'answer_output_mode'}='tex'; + $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; $form{'rndseed'}=$rndseed; my $answer=&Apache::lonnet::ssi($urlp,%form); $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/; @@ -896,7 +903,7 @@ sub handler { my %parmhash=&Apache::lonnet::coursedescription($ENV{'request.course.id'}); - my $key; +# my $key; # foreach $key (keys %parmhash) { # $r->print(' '.$key.'->'.$parmhash{$key}.'<-
'); # } @@ -951,8 +958,7 @@ sub printHelper { # This will persistently load in the data we want from the # very first screen. # Detect whether we're coming from construction space - if ($ENV{'form.postdata'} =~ /http:\/\// ) { - $ENV{'form.postdata'} =~ /http:\/\/[^\/]+\/~([^\/]+)\/(.*)/; + if ($ENV{'form.postdata'}=~/^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/) { $helper->{VARS}->{'filename'} = "/home/$1/public_html/$2"; $helper->{VARS}->{'construction'} = 1; } else { @@ -1103,9 +1109,10 @@ HELPERFRAGMENT
How should the results be printed?
- Start each student\'s assignment on a new page (add a pagefeed after each assignment) - Add one empty page after each student\'s assignment - Add two empty pages after each student\'s assignment + Start each student\'s assignment on a new page/column (add a pagefeed after each assignment) + Add one empty page/column after each student\'s assignment + Add two empty pages/column after each student\'s assignment + Add three empty pages/column after each student\'s assignment CHOOSE_STUDENTS @@ -1126,7 +1133,7 @@ CHOOSE_FROM_SUBDIR $xmlfrag .= <<'CHOOSE_FROM_SUBDIR'; return $filename =~ - m/^[^\.]+\.(problem|exam|quiz|assess|survey|form|library)$/; + m/\.(problem|exam|quiz|assess|survey|form|library)$/; @@ -1158,6 +1165,24 @@ CHOOSE_FROM_SUBDIR ['Print with answers', 'no'] ]; Apache::lonhelper::choices->new(); } + if ($ENV{'request.role.adv'}) { + $paramHash = Apache::lonhelper::getParamHash(); + $paramHash->{MESSAGE_TEXT} = "
Another option available only for advanced users:
"; + Apache::lonhelper::message->new(); + $paramHash = Apache::lonhelper::getParamHash(); + $paramHash->{'variable'} = 'LATEX_TYPE'; + $helper->declareVar('LATEX_TYPE'); + if ($helper->{VARS}->{'construction'} eq '1') { + $paramHash->{CHOICES} = [ + ['Print in standard LaTeX mode', 'standard'], + ['Print in LaTeX batchmode', 'batchmode'], ]; + } else { + $paramHash->{CHOICES} = [ + ['Print in LaTeX batchmode', 'batchmode'], + ['Print in standard LaTeX mode', 'standard'] ]; + } + Apache::lonhelper::choices->new(); + } Apache::lonprintout::page_format_state->new("FORMAT");