[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Mon, 23 Jun 2003 19:22:00 -0000
sakharuk Mon Jun 23 15:22:00 2003 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Ed's desire to have a different assignments (namely maps) names for problems from different assignments is implemented. I added a \newpage command just to see how it looks like but I can remove it in case if somebody will not like to waste somepaper space.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.192 loncom/interface/lonprintout.pm:1.193
--- loncom/interface/lonprintout.pm:1.192 Thu Jun 19 16:15:30 2003
+++ loncom/interface/lonprintout.pm Mon Jun 23 15:22:00 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.192 2003/06/19 20:15:30 bowersj2 Exp $
+# $Id: lonprintout.pm,v 1.193 2003/06/23 19:22:00 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -583,9 +583,14 @@
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')) {
#-- produce an output string
+ my %form=();
+ $form{'grade_target'}='tex';
+ $form{'textwidth'}=$LaTeXwidth;
+ $form{'problem_split'}=$parmhash{'problem_stream_switch'};
my $flag_latex_header_remove = 'NO';
my $flag_page_in_sequence = 'NO';
my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
+ my $prevassignment='';
for (my $i=0;$i<=$#master_seq;$i++) {
$master_seq[$i]=~/___\d+___(.*)$/;
my $urlp='/res/'.$1;
@@ -596,11 +601,9 @@
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') {
$selectionmade = 4;
}
- my %form;
- $form{'grade_target'}='tex';
- $form{'textwidth'}=$LaTeXwidth;
$form{'symb'}=$master_seq[$i];
- $form{'problem_split'}=$parmhash{'problem_stream_switch'};
+ $master_seq[$i]=~/\/([^\/]+)\.sequence_/;
+ my $assignment=' '.$1.' ';
#&Apache::lonnet::logthis("Trying to get $urlp with symb $master_seq[$i]");
my $texversion=&Apache::lonnet::ssi($urlp,%form);
if ($urlp=~/\.page$/) {
@@ -621,7 +624,18 @@
my $answer=&Apache::lonnet::ssi($urlp,%form);
$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
}
- $result .= $texversion;
+# $result .= $texversion;
+ if (($selectionmade == 4) and ($assignment ne $prevassignment) and ($i>1)) {
+ my $name = &get_name();
+ if ($name =~ /^\s*$/) {
+ $name=&Apache::lonxml::latex_special_symbols($ENV{'user.name'},undef,
+ undef,'header');
+ }
+ my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'','','header');
+ $prevassignment=$assignment;
+ $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$name.'}} - '.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip -5 mm ';
+ }
+ $result .= $texversion;
$flag_latex_header_remove = 'YES';
}
&Apache::lonnet::delenv('form.counter');
@@ -658,8 +672,7 @@
if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
my %form;
$form{'answer_output_mode'}='tex';
- my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,
- $ENV{'request.course.id'},%form);
+ my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$ENV{'request.course.id'},%form);
$rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;
}
$current_output .= $rendered;
@@ -1001,9 +1014,9 @@
</resource>
<message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>
<choices variable="EMPTY_PAGES">
- <choice computer='0'>Start each student's assignment on a new page (add a pagefeed after each assignment)</choice>
- <choice computer='1'>Add one empty page after each student's assignment</choice>
- <choice computer='2'>Add two empty pages after each student's assignment</choice>
+ <choice computer='0'>Start each student\'s assignment on a new page (add a pagefeed after each assignment)</choice>
+ <choice computer='1'>Add one empty page after each student\'s assignment</choice>
+ <choice computer='2'>Add two empty pages after each student\'s assignment</choice>
</choices>
</state>
CHOOSE_STUDENTS