--- loncom/interface/lonprintout.pm 2007/04/26 09:32:23 1.500
+++ loncom/interface/lonprintout.pm 2007/09/08 23:41:49 1.509
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.500 2007/04/26 09:32:23 foxr Exp $
+# $Id: lonprintout.pm,v 1.509 2007/09/08 23:41:49 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -867,7 +867,11 @@ sub page_format_transformation {
my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin);
if ($selectionmade eq '4') {
- $assignment='Problems from the Whole Course';
+ if ($choice eq 'all_problems') {
+ $assignment='Problems from the Whole Course';
+ } else {
+ $assignment='Resources from the Whole Course';
+ }
} else {
$assignment=&Apache::lonxml::latex_special_symbols($assignment,'header');
}
@@ -1367,6 +1371,14 @@ ENDPART
if ($helper->{'VARS'}->{'showallfoils'} eq "1") {
$form{'showallfoils'} = $helper->{'VARS'}->{'showallfoils'};
}
+
+ if ($helper->{'VARS'}->{'style_file'}=~/\w/) {
+ &Apache::lonnet::appenv('construct.style' =>
+ $helper->{'VARS'}->{'style_file'});
+ } elsif ($env{'construct.style'}) {
+ &Apache::lonnet::delenv('construct\\.style');
+ }
+
if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
#-- single document - problem, page, html, xml, ...
@@ -1390,12 +1402,6 @@ ENDPART
if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
my %moreenv;
$moreenv{'request.filename'}=$cleanURL;
- if ($helper->{'VARS'}->{'style_file'}=~/\w/) {
- $moreenv{'construct.style'}=$helper->{'VARS'}->{'style_file'};
- my $dom = $env{'user.domain'};
- my $user = $env{'user.name'};
- my $put_result = &Apache::lonnet::put('environment',{'construct.style'=>$helper->{'VARS'}->{'style_file'}},$dom,$user);
- }
if ($helper->{'VARS'}->{'probstatus'} eq 'exam') {$form{'problemtype'}='exam';}
$form{'problem_split'}=$parmhash{'problem_stream_switch'};
$form{'suppress_tries'}=$parmhash{'suppress_tries'};
@@ -1444,7 +1450,7 @@ ENDPART
$texversion.='\vskip 0 mm \noindent\textbf{Prints from construction space - there is no title.}\vskip 0 mm ';
my $URLpath=$cleanURL;
$URLpath=~s/~([^\/]+)/public_html\/$1\/$1/;
- $texversion.=&path_to_problem ($URLpath,$LaTeXwidth);
+ $texversion.=&path_to_problem($URLpath,$LaTeXwidth);
}
$texversion.='\vskip 1 mm '.$answer.'\end{document}';
}
@@ -2216,6 +2222,28 @@ sub init_perm {
}
}
+sub get_randomly_ordered_warning {
+ my ($helper,$map) = @_;
+
+ my $message;
+
+ my $postdata = $env{'form.postdata'} || $helper->{VARS}{'postdata'};
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my $res = $navmap->getResourceByUrl($map);
+ if ($res) {
+ my $func =
+ sub { return ($_[0]->is_map() && $_[0]->randomorder); };
+ my @matches = $navmap->retrieveResources($res, $func,1,1,1);
+ if (@matches) {
+ $message = "Some of the items below are in folders set to be randomly ordered. However, when printing the contents of these folders, they will be printed in the original order for all students, not the randomized order.";
+ }
+ }
+ if ($message) {
+ return ''.$message.'';
+ }
+ return;
+}
+
sub printHelper {
my $r = shift;
@@ -2442,8 +2470,8 @@ HELPERFRAGMENT
if ($perm{'pfo'} && !$is_published &&
($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) {
- push @{$printChoices}, ['Selected Problems from entire course', 'all_problems', 'ALL_PROBLEMS'];
- push @{$printChoices}, ['Selected Resources from entire course', 'all_resources', 'ALL_RESOURCES'];
+ push @{$printChoices}, [&mtn('Selected Problems from entire course'), 'all_problems', 'ALL_PROBLEMS'];
+ push @{$printChoices}, [&mtn('Selected Resources from entire course'), 'all_resources', 'ALL_RESOURCES'];
&Apache::lonxml::xmlparse($r, 'helper', <Problems from folder [_1] for CODEd assignments",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1'];
}
+ my $randomly_ordered_warning =
+ &get_randomly_ordered_warning($helper,$map);
+
# resource_selector will hold a few states that:
# - Allow resources to be selected for printing.
# - Determine pagination between assignments.
@@ -2482,6 +2513,8 @@ ALL_PROBLEMS
#
my $resource_selector=<
+ $randomly_ordered_warning
+
PRINT_FORMATTING Select resources for the assignment