--- loncom/interface/lonprintout.pm 2003/01/27 16:01:13 1.106 +++ loncom/interface/lonprintout.pm 2003/02/04 20:59:26 1.110 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.106 2003/01/27 16:01:13 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.110 2003/02/04 20:59:26 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -162,14 +162,14 @@ sub sequence_content_menu { my @titles_master_seq = &titles_coming_from_hash($primary_sequence,$sequence[0]); foreach my $entity (@titles_master_seq) {$entity=~/^(.*)&&/; $entity=$1} my @master_seq_view = @master_seq; - if (not $ENV{'request.role'}=~/^st\./) { + if ($ENV{'user.adv'}) { for (my $i=0;$i<=$#master_seq_view;$i++) { $master_seq_view[$i]=~/___\d+___(.+)$/; $master_seq_view[$i]='/'.$1; } } else { for (my $i=0;$i<=$#master_seq_view;$i++) { - $master_seq_view[$i]=' '; + $master_seq_view[$i]=' '; } } $r->print(<print(< +

+  +  ENDMENUOUT2 @@ -238,7 +240,8 @@ sub problem_choice_menu { @content_directory = &Apache::lonnet::dirlist($subdirtoprint, $domain, $user,''); } else { - @content_directory = &Apache::lonnet::dirlist($subdirtoprint); + #local library server res space (allows to print only from the own library server) + @content_directory = &Apache::lonnet::dirlist($subdirtoprint,$ENV{'user.domain'}, $ENV{'user.name'},''); } for (my $iy=0;$iy<=$#content_directory;$iy++) { my @tempo_array = split(/&/,$content_directory[$iy]); @@ -277,7 +280,8 @@ sub problem_choice_menu { }   - +  +

ENDMENUOUT1 my $i=0; @@ -287,10 +291,12 @@ ENDMENUOUT1 $i++; } $r->print(< +

+  +  ENDMENUOUT2 } @@ -464,7 +470,7 @@ ENDPART $LaTeXwidth = $1; } if ($choice eq 'Standard LaTeX output for current document') { - #-- single document - problem, page, html, xml + #-- single document - problem, page, html, xml, ... $selectionmade = 1; if ($ENV{'form.url'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { my %moreenv; @@ -611,7 +617,7 @@ ENDPART } if ($current_output=~/\\documentclass/) { my $courseidinfo = $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; - $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm}\\setlength{\\headheight}{1cm}\\setlength{\\headsep}{0.5cm}\\pagestyle{myheadings}\\markboth{}{{$courseidinfo - $assignment}}\\begin{document}\\noindent\\textit{\\textbf{$fullname}}\\vskip 3 mm /; + $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{$courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}} \\begin{document}\\noindent\\textit{\\textbf{$fullname}}\\vskip 3 mm /; } else { my $blanspages = ''; for (my $j=0;$j<$ENV{'form.addedpages'};$j++) {$blanspages.='\clearpage\strut\clearpage';} @@ -641,6 +647,8 @@ ENDPART &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); &Apache::lonnet::delenv('form.grade_target','form.textwidth'); @@ -1279,17 +1287,19 @@ sub page_format_transformation { } else { ($textwidth,$textheight,$oddoffset,$evenoffset) = ($ENV{'form.width'},$ENV{'form.height'},$ENV{'form.leftmargin'},$ENV{'form.leftmargin'}); } - my $courseidinfo = $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; - if ($layout eq 'CBI') { - $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}}} \\hfill $courseidinfo} \\vskip 5 mm /; - } elsif ($layout eq 'CAPA') { - if ($choice ne 'All class print') { - $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\setlength{\\topmargin}{1cm}\\setlength{\\headheight}{1cm}\\setlength{\\headsep}{0.5cm}\\markboth{}{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}} $courseidinfo - $assignment}\\pagestyle{myheadings}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1}/; - } else { + my $firstname = &special_character_corrections(&Apache::lonnet::unescape($ENV{'environment.firstname'})); + my $lastname = &special_character_corrections(&Apache::lonnet::unescape($ENV{'environment.lastname'})); + my $courseidinfo = &special_character_corrections(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'})); + if ($layout eq 'CBI') { + $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$firstname $lastname}} \\hfill $courseidinfo} \\vskip 5 mm /; + } elsif ($layout eq 'CAPA') { + if ($choice ne 'All class print') { + $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$firstname $lastname} - $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}/; + } else { $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1} \\vskip 5 mm /; - } } - return $text; + } + return $text; } @@ -1332,6 +1342,15 @@ sub details_for_menu { } +sub special_character_corrections { + my $argument = shift; + $argument =~ s/_/ /g; + $argument =~ s/\^/ /g; + $argument =~ s/&/\\&/g; + return $argument; +} + + sub latex_corrections { my ($number_of_columns,$result) = @_;