--- loncom/interface/lonprintout.pm 2003/05/05 20:14:32 1.151 +++ loncom/interface/lonprintout.pm 2003/05/06 19:23:49 1.153 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.151 2003/05/05 20:14:32 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.153 2003/05/06 19:23:49 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1377,15 +1377,15 @@ ENDPART $LaTeXwidth = $1*25.4; } $LaTeXwidth.=' mm'; - - + + if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') { #-- single document - problem, page, html, xml, ... my $currentURL; - if (defined $helper->{'VARS'}->{'url'}) { - $currentURL=$helper->{'VARS'}->{'url'}; - } else { + if (not defined $helper->{'VARS'}->{'construction'}) { $currentURL=$helper->{'VARS'}->{'postdata'}; + } else { + $currentURL=$helper->{'VARS'}->{'construction'}; } $selectionmade = 1; if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { @@ -1511,49 +1511,49 @@ ENDPART my @list_of_files=split /\|\|\|/, $helper->{'VARS'}->{'FILES'}; my $flag_latex_header_remove = 'NO'; for (my $i=0;$i<=$#list_of_files;$i++) { -# my $urlp = $list_of_files[$i]; -# if ($urlp=~/\//) { + my $urlp = $list_of_files[$i]; + if ($urlp=~/\//) { my %moreenv; $moreenv{'form.grade_target'}='tex'; $moreenv{'form.textwidth'}=$LaTeXwidth; &Apache::lonnet::appenv(%moreenv); -# if ($urlp =~ m|/home/([^/]+)/public_html|) { -# $urlp =~ s|/home/([^/]*)/public_html|/~$1|; -# } else { -# $urlp =~ s|^/home/httpd/html||; -# } -# my $texversion=&Apache::lonnet::ssi($urlp); + if ($urlp =~ m|/home/([^/]+)/public_html|) { + $urlp =~ s|/home/([^/]*)/public_html|/~$1|; + } else { + $urlp =~ s|^/home/httpd/html||; + } + my $texversion=&Apache::lonnet::ssi($urlp); &Apache::lonnet::delenv('form.grade_target','form.textwidth'); #this chunck is responsible for printing the path to problem -# my $newurlp = ''; -# my $HowMany = length($urlp)*2; -# if ($HowMany > $LaTeXwidth) { -# my @temporrary = split '/',$urlp; -# my $HowManyNew = 0; -# for (my $ii=0;$ii<=$#temporrary;$ii++) { -# if ($temporrary[$ii] ne '') { -# $HowManyNew += length($temporrary[$ii])*2; -# if ($HowManyNew < $LaTeXwidth ) { -# $newurlp .= '/'.$temporrary[$ii]; -# } else { -# $HowManyNew = 0; -# $newurlp .= '|\vskip -1 mm \noindent \verb|'; -# $ii--; -# } -# } -# } -# } -# $texversion =~ s/(\\begin{minipage}{\\textwidth})/$1 {\\small\\noindent\\verb|$newurlp\|\\vskip 0 mm}/; -# if ($flag_latex_header_remove ne 'NO') { -# $texversion = &latex_header_footer_remove($texversion); -# } else { -# $texversion =~ s/\\end{document}//; -# } -# $result .= $texversion; -# } -# $flag_latex_header_remove = 'YES'; + my $newurlp = ''; + my $HowMany = length($urlp)*2; + if ($HowMany > $LaTeXwidth) { + my @temporrary = split '/',$urlp; + my $HowManyNew = 0; + for (my $ii=0;$ii<=$#temporrary;$ii++) { + if ($temporrary[$ii] ne '') { + $HowManyNew += length($temporrary[$ii])*2; + if ($HowManyNew < $LaTeXwidth ) { + $newurlp .= '/'.$temporrary[$ii]; + } else { + $HowManyNew = 0; + $newurlp .= '|\vskip -1 mm \noindent \verb|'; + $ii--; + } + } + } + } + $texversion =~ s/(\\begin{minipage}{\\textwidth})/$1 {\\small\\noindent\\verb|$newurlp\|\\vskip 0 mm}/; + if ($flag_latex_header_remove ne 'NO') { + $texversion = &latex_header_footer_remove($texversion); + } else { + $texversion =~ s/\\end{document}//; + } + $result .= $texversion; + } + $flag_latex_header_remove = 'YES'; } -# $result .= '\end{document}'; + $result .= '\end{document}'; } #-------------------------------------------------------- corrections for the different page formats $result = &page_format_transformation_new($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'}); @@ -1599,12 +1599,12 @@ sub handler { return $result; } $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; @@ -1712,6 +1712,7 @@ sub printHelper { # This will persistently load in the data we want from the # very first screen. if ($ENV{'form.postdata'}) { + if ($ENV{'form.postdata'}!~/\/res\//) {$helper->{VARS}->{'construction'} = $ENV{'form.postdata'};} $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($ENV{'form.postdata'}); } if ($ENV{'form.symb'}) { @@ -1719,6 +1720,7 @@ sub printHelper { } if ($ENV{'form.url'}) { $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'}); + } @@ -1741,7 +1743,17 @@ sub printHelper { # "Delete everything after the last slash." $subdir =~ s|/[^/]+$||; - $subdir = '/home/httpd/html/res'.$subdir.'/'; + if (not defined $helper->{VARS}->{'construction'}) { + $subdir = '/home/httpd/html/res'.$subdir; + } else { + $helper->{VARS}->{'construction'}=~/^([^\/]+)\/\/([^\/]+)(.*)\/[^\/]*$/; + $subdir = $3; + $subdir=~/\/~([^\/]+)\/(.*)$/; + $subdir = '/home/'.$1.'/public_html/'.$2; + } +#### $r->print('Dir: '.$subdir.' '); +#### return OK; + # What can be printed is a very dynamic decision based on # lots of factors. So we need to dynamically build this list. @@ -1761,7 +1773,7 @@ sub printHelper { push @{$printChoices}, ["$resourceTitle (exactly what was on the screen)", 'current_document', 'PAGESIZE']; # If we're in a sequence... - if ($helper->{VARS}->{'postdata'} =~ /\/res\//) { + if (not defined $helper->{'VARS'}->{'construction'}) { # Allow problems from sequence push @{$printChoices}, ["Problems from $sequenceTitle", 'map_problems', 'CHOOSE_PROBLEMS']; # Allow all resources from sequence @@ -1826,17 +1838,17 @@ HELPERFRAGMENT How should the results be printed? - Print all problems with no blank space between them - Put each student's problems on a new page (add pagefeed after each student) - Seperate each student's problems with a full blank page - Seperate each student's problems with two full blank pages + Print students assignments without separations (as uniform flow) + Start student assignment from new page (add pagefeed after each student) + Add one emty page after each student assignment + Add two emty page after each student assignment CHOOSE_STUDENTS } # FIXME: That RE should come from a library somewhere. - if ((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) { + if (((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) { push @{$printChoices}, ["Problems from $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; my $f = '$filename';