[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Thu, 24 Oct 2002 19:03:55 -0000
sakharuk Thu Oct 24 15:03:55 2002 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
1. Prints sequence name;
2. Does not print number of tries if printing goes from the construction space;
3. Prints First, Last names, Sequence name, and name of the course on every page;
4. Font for printing path to problem and number of tries was changed.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.82 loncom/interface/lonprintout.pm:1.83
--- loncom/interface/lonprintout.pm:1.82 Wed Oct 23 13:38:03 2002
+++ loncom/interface/lonprintout.pm Thu Oct 24 15:03:55 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.82 2002/10/23 17:38:03 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.83 2002/10/24 19:03:55 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -77,6 +77,7 @@
sub menu_for_output {
my $r = shift;
my ($title_for_single_resource,$title_for_sequence,$title_for_main_map) = &details_for_menu;
+ my $assignment = $title_for_sequence;
if ($title_for_single_resource ne '') {$title_for_single_resource = '"'.$title_for_single_resource.'"';}
if ($title_for_sequence ne '') {$title_for_sequence = '"'.$title_for_sequence.'"';}
if ($title_for_main_map ne '') {$title_for_main_map = '"'.$title_for_main_map.'"';}
@@ -87,6 +88,7 @@
<h1>What do you want to print? Make a choice.</h1><br />
<input type="hidden" name="phase" value="two">
<input type="hidden" name="url" value="$ENV{'form.postdata'}">
+<input type="hidden" name="assignment" value="$assignment">
<input type="radio" name="choice" value="Standard LaTeX output for current document" checked> Current document <b>$title_for_single_resource</b>
(prints what you just saw on the screen)<br />
ENDMENUOUT1
@@ -225,6 +227,7 @@
<input type="hidden" name="choice" value="$ENV{'form.choice'}">
<input type="hidden" name="layout" value="$ENV{'form.layout'}">
<input type="hidden" name="numberofcolumns" value="$ENV{'form.numberofcolumns'}">
+<input type="hidden" name="assignment" value="$ENV{'form.assignment'}">
<h1>Select student(s) whose assignment you want to print</h1>
ENDMENUOUT1
my %courselist=&Apache::lonnet::dump(
@@ -318,6 +321,7 @@
<input type="hidden" name="numberofstudents" value="$ENV{'form.numberofstudents'}">
<input type="hidden" name="numberofproblems" value="$ENV{'form.numberofproblems'}">
<input type="hidden" name="numberofcolumns" value="$ENV{'form.numberofcolumns'}">
+<input type="hidden" name="assignment" value="$ENV{'form.assignment'}">
Define one column layout parameters: <br />
<b>Width</b>: <input type="text" name="width" width="8" value="9cm"> <br />
<b>Height</b>: <input type="text" name="height" width="8" value="25.9cm"> <br />
@@ -347,6 +351,7 @@
my $numberofcolumns = $ENV{'form.numberofcolumns'};
my $papersize = $ENV{'form.papersize'};
my $laystyle = 'book';
+ my $assignment = $ENV{'form.assignment'};
if ($choice eq 'Subdirectory print') {
$layout = 'CAPA';
$papersize = 'Letter [8 1/2x11 in]';
@@ -543,7 +548,26 @@
}
my $texversion=&Apache::lonnet::ssi($urlp);
&Apache::lonnet::delenv('form.grade_target','form.textwidth');
- $texversion =~ s/(\\begin{document})/$1 {\\tiny\\begin{verbatim}$urlp\\end{verbatim}}/;
+ #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 {
@@ -556,7 +580,7 @@
$result .= '\end{document}';
}
#-------------------------------------------------------- corrections for the different page formats
- $result = &page_format_transformation($papersize,$layout,$numberofcolumns,$choice,$result);
+ $result = &page_format_transformation($papersize,$layout,$numberofcolumns,$choice,$result,$assignment);
if ($layout eq 'CBI') {
$laystyle = 'album';
}
@@ -1081,14 +1105,15 @@
sub page_format_transformation {
- my ($papersize,$layout,$numberofcolumns,$choice,$text) = @_;
+ my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment) = @_;
my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);
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\}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}}} \\hfill $courseidinfo} \\vskip 5 mm /;
+# $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}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}}} \\hfill $courseidinfo} \\vskip 5 mm /;
+ $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'}} - \\textbf{$assignment} from \\textbf{$courseidinfo}}\\pagestyle{myheadings}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1}/;
} else {
$text =~ s/\\begin{document}/\\setlength{\\textheight}{$textheight}\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\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 /;
}
@@ -1125,7 +1150,7 @@
if ($name_of_map =~ /^\s*$/) {
$ENV{'request.course.uri'} =~ m|([^/]+)$|;
$name_of_map = $1;
- }
+ }
return ($name_of_resourse,$name_of_sequence,$name_of_map);
}