--- loncom/interface/lonprintout.pm 2003/06/19 20:15:30 1.192
+++ loncom/interface/lonprintout.pm 2003/06/24 20:54:06 1.197
@@ -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.197 2003/06/24 20:54:06 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -583,9 +583,14 @@ ENDPART
($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 @@ ENDPART
} 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 @@ ENDPART
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');
@@ -643,6 +657,8 @@ ENDPART
# my ($usersection,$username,$userdomain) = split /:/,$person;
my ($username,$userdomain) = split /:/,$person;
my $fullname = &get_name($username,$userdomain);
+
+ if ($parmhash{'anonymous_quiz'}=~/yes/) {$fullname=' ';} #put here something reasonable for anonymous exams or quiz
#goes through all resources, checks if they are available for current student, and produces output
foreach my $curresline (@master_seq) {
if ($curresline=~ m/\.(problem|exam|quiz|assess|survey|form|library)$/) {
@@ -658,8 +674,7 @@ ENDPART
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;
@@ -748,12 +763,12 @@ ENDPART
$result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'});
$result = &latex_corrections($number_of_columns,$result);
#changes page's parameters for the one column output
-# if ($numberofcolumns == 1) {
-# $result =~ s/\\textwidth= 9cm/\\textwidth= $ENV{'form.width'}/;
-# $result =~ s/\\textheight 25\.9cm/\\textheight $ENV{'form.height'}/;
-# $result =~ s/\\evensidemargin = -0\.57in/\\evensidemargin= $ENV{'form.leftmargin'}/;
-# $result =~ s/\\oddsidemargin = -0\.57in/\\oddsidemargin= $ENV{'form.leftmargin'}/;
-# }
+ if ($numberofcolumns == 1) {
+ $result =~ s/\\textwidth= 9cm/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
+ $result =~ s/\\textheight 25\.9cm/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
+ $result =~ s/\\evensidemargin = -0\.57in/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
+ $result =~ s/\\oddsidemargin = -0\.57in/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
+ }
#-- writing .tex file in prtspool
my $temp_file;
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".time."_".rand(10000000).".tex";
@@ -1001,16 +1016,16 @@ 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 (add a pagefeed after each assignment)
+ Add one empty page after each student\'s assignment
+ Add two empty pages after each student\'s 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)/)) or defined $helper->{'VARS'}->{'construction'}) {
+ 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'}) and $ENV{'request.role.adv'}) {
push @{$printChoices}, ["Problems from current subdirectory $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
my $f = '$filename';