--- loncom/interface/lonprintout.pm 2007/05/02 01:33:49 1.501
+++ loncom/interface/lonprintout.pm 2009/01/23 16:00:46 1.548
@@ -1,8 +1,7 @@
-#
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.501 2007/05/02 01:33:49 albertel Exp $
+# $Id: lonprintout.pm,v 1.548 2009/01/23 16:00:46 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -38,6 +37,12 @@ use Apache::grades;
use Apache::edit;
use Apache::File();
use Apache::lonnavmaps;
+use Apache::admannotations;
+use Apache::lonenc;
+use Apache::entities;
+
+use HTTP::Response;
+
use LONCAPA::map();
use POSIX qw(strftime);
use Apache::lonlocal;
@@ -48,6 +53,21 @@ my %perm;
my %parmhash;
my $resources_printed;
+# Global variables that describe errors in ssi calls detected by ssi_with_retries.
+#
+
+my $ssi_error; # True if there was an ssi error.
+my $ssi_last_error_resource; # The resource URI that could not be fetched.
+my $ssi_last_error; # The error text from the server. (e.g. 500 Server timed out).
+
+#
+# Our ssi max retry count.
+#
+
+my $ssi_retry_count = 5; # Some arbitrary value.
+
+
+
# Fetch the contents of a resource, uninterpreted.
# This is used here to fetch a latex file to be included
# verbatim into the printout<
@@ -70,6 +90,91 @@ sub fetch_raw_resource {
}
+# Fetch the annotations associated with a URL and
+# put a centered 'annotations:' title.
+# This is all suppressed if the annotations are empty.
+#
+sub annotate {
+ my ($symb) = @_;
+
+ my $annotation_text = &Apache::admannotations::get_annotation($symb, 1);
+
+
+ my $result = "";
+
+ if (length($annotation_text) > 0) {
+ $result .= '\\hspace*{\\fill} \\\\[\\baselineskip] \textbf{Annotations:} \\\\ ';
+ $result .= "\n";
+ $result .= &Apache::lonxml::latex_special_symbols($annotation_text,""); # Escape latex.
+ $result .= "\n\n";
+ }
+ return $result;
+}
+
+
+#
+# ssi_with_retries - Does the server side include of a resource.
+# if the ssi call returns an error we'll retry it up to
+# the number of times requested by the caller.
+# If we still have a proble, no text is appended to the
+# output and we set some global variables.
+# to indicate to the caller an SSI error occurred.
+# All of this is supposed to deal with the issues described
+# in LonCAPA BZ 5631 see:
+# http://bugs.lon-capa.org/show_bug.cgi?id=5631
+# by informing the user that this happened.
+#
+# Parameters:
+# resource - The resource to include. This is passed directly, without
+# interpretation to lonnet::ssi.
+# form - The form hash parameters that guide the interpretation of the resource
+#
+# retries - Number of retries allowed before giving up completely.
+# Returns:
+# On success, returns the rendered resource identified by the resource parameter.
+# Side Effects:
+# The following global variables can be set:
+# ssi_error - If an unrecoverable error occurred this becomes true.
+# It is up to the caller to initialize this to false
+# if desired.
+# ssi_last_error_resource - If an unrecoverable error occurred, this is the value
+# of the resource that could not be rendered by the ssi
+# call.
+# ssi_last_error - The error string fetched from the ssi response
+# in the event of an error.
+#
+sub ssi_with_retries {
+ my ($resource, $retries, %form) = @_;
+
+
+ my ($content, $response) = &Apache::loncommon::ssi_with_retries($resource, $retries, %form);
+ if (!$response->is_success) {
+ $ssi_error = 1;
+ $ssi_last_error_resource = $resource;
+ $ssi_last_error = $response->code . " " . $response->message;
+ $content='\section*{!!! An error occurred !!!}';
+ &Apache::lonnet::logthis("Error in SSI resource: $resource Error: $ssi_last_error");
+ }
+
+ return $content;
+
+}
+
+sub get_student_view_with_retries {
+ my ($curresline,$retries,$username,$userdomain,$courseid,$target,$moreenv)=@_;
+
+ my ($content, $response) = &Apache::loncommon::get_student_view_with_retries($curresline,$retries,$username,$userdomain,$courseid,$target,$moreenv);
+ if (!$response->is_success) {
+ $ssi_error = 1;
+ $ssi_last_error_resource = $curresline.' for user '.$username.':'.$userdomain;
+ $ssi_last_error = $response->code . " " . $response->message;
+ $content='\section*{!!! An error occurred !!!}';
+ &Apache::lonnet::logthis("Error in SSI (student view) resource: $curresline Error: $ssi_last_error User: $username:$userdomain");
+ }
+ return $content;
+
+}
+
#
# printf_style_subst item format_string repl
#
@@ -124,9 +229,11 @@ sub printf_style_subst {
# %a - Assignment name.
# %c - Course name.
# %n - Student name.
+# %s - The section if it is supplied.
#
sub format_page_header {
- my ($width, $format, $assignment, $course, $student) = @_;
+ my ($width, $format, $assignment, $course, $student, $section) = @_;
+
$width = &recalcto_mm($width); # Get width in mm.
# Default format?
@@ -143,38 +250,43 @@ sub format_page_header {
# - Allow the assignment to be 2 lines (wrapped).
#
my $chars_per_line = $width/2; # Character/textline.
+
- my $firstline = "$student $course";
- if (length($firstline) > $chars_per_line) {
- my $lastchar = $chars_per_line - length($student) - 1;
- if ($lastchar > 0) {
- $course = substr($course, 0, $lastchar);
- } else { # Nothing left of course:
- $course = '';
- }
- }
- if (length($assignment) > $chars_per_line) {
- $assignment = substr($assignment, 0, $chars_per_line);
+ my $name_length = int($chars_per_line *3 /4);
+ my $sec_length = int($chars_per_line / 5);
+
+ $format = "%$name_length".'n';
+
+ if ($section) {
+ $format .= ' - Sec: '."%$sec_length".'s';
}
-
- $format = "\\textbf{$student} $course \\hfill \\thepage \\\\ \\textit{$assignment}";
-
- } else {
- # An open question is how to handle long user formatted page headers...
- # A possible future is to support e.g. %na so that the user can control
- # the truncation of the elements that can appear in the header.
- #
- $format = &printf_style_subst("a", $format, $assignment);
- $format = &printf_style_subst("c", $format, $course);
- $format = &printf_style_subst("n", $format, $student);
-
- # If the user put %'s in the format string, they must be escaped
- # to \% else LaTeX will think they are comments and terminate
- # the line.. which is bad!!!
+ $format .= '\\\\%c \\\\ %a';
+
}
+ # An open question is how to handle long user formatted page headers...
+ # A possible future is to support e.g. %na so that the user can control
+ # the truncation of the elements that can appear in the header.
+ #
+ $format = &printf_style_subst("a", $format, $assignment);
+ $format = &printf_style_subst("c", $format, $course);
+ $format = &printf_style_subst("n", $format, $student);
+ $format = &printf_style_subst("s", $format, $section);
+
+
+ # If the user put %'s in the format string, they must be escaped
+ # to \% else LaTeX will think they are comments and terminate
+ # the line.. which is bad!!!
+
+ # If the user has role author, $course and $assignment are empty so
+ # there is '\\ \\ ' in the page header. That's cause a error in LaTeX
+ if($format =~ /\\\\\s\\\\\s/) {
+ #TODO find sensible caption for page header
+ my $testPrintout = '\\\\'.&mt('Construction Space').' \\\\'.&mt('Test-Printout ');
+ $format =~ s/\\\\\s\\\\\s/$testPrintout/;
+ }
return $format;
@@ -280,8 +392,8 @@ sub is_valid_alpha_code {
sub is_code_valid {
my ($code_value, $code_option) = @_;
my ($code_type, $code_length) = ('letter', 6); # defaults.
- open(FG, $Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
- foreach my $line () {
+ my @lines = &Apache::grades::get_scantronformat_file();
+ foreach my $line (@lines) {
my ($name, $type, $length) = (split(/:/, $line))[0,2,4];
if($name eq $code_option) {
$code_length = $length;
@@ -399,12 +511,19 @@ sub adjust_number_to_print {
# Unmodified.
} else {
# Error!!!!
-
+
croak "bad SPLIT_PDFS: $split_pdf in lonprintout::adjust_number_to_print";
+
}
}
+
sub character_chart {
+ my $result = shift;
+ return &Apache::entities::replace_entities($result);
+}
+
+sub old_character_chart {
my $result = shift;
$result =~ s/&\#0?0?(7|9);//g;
$result =~ s/&\#0?(10|13);//g;
@@ -526,7 +645,7 @@ sub character_chart {
$result =~ s/&(\#165|yen);/\\textyen /g;
$result =~ s/&(\#166|brvbar);/\\textbrokenbar /g;
$result =~ s/&(\#167|sect);/\\textsection /g;
- $result =~ s/&(\#168|uml);/\\texthighdieresis /g;
+ $result =~ s/&(\#168|uml);/\\"\{\} /g;
$result =~ s/&(\#169|copy);/\\copyright /g;
$result =~ s/&(\#170|ordf);/\\textordfeminine /g;
$result =~ s/&(\#172|not);/\\ensuremath\{\\neg\}/g;
@@ -537,7 +656,7 @@ sub character_chart {
$result =~ s/&(\#177|plusmn);/\\ensuremath\{\\pm\}/g;
$result =~ s/&(\#178|sup2);/\\ensuremath\{^2\}/g;
$result =~ s/&(\#179|sup3);/\\ensuremath\{^3\}/g;
- $result =~ s/&(\#180|acute);/\\textacute /g;
+ $result =~ s/&(\#180|acute);/\\'\{\} /g;
$result =~ s/&(\#181|micro);/\\ensuremath\{\\mu\}/g;
$result =~ s/&(\#182|para);/\\P/g;
$result =~ s/&(\#183|middot);/\\ensuremath\{\\cdot\}/g;
@@ -720,6 +839,7 @@ sub character_chart {
$result =~ s/&(hearts|\#9829);/\\ensuremath\{\\heartsuit\}/g;
$result =~ s/&(diams|\#9830);/\\ensuremath\{\\diamondsuit\}/g;
# Chemically useful 'things' contributed by Hon Kie (bug 4652).
+
$result =~ s/&\#8636;/\\ensuremath\{\\leftharpoonup\}/g;
$result =~ s/&\#8637;/\\ensuremath\{\\leftharpoondown\}/g;
$result =~ s/&\#8640;/\\ensuremath\{\\rightharpoonup\}/g;
@@ -733,6 +853,13 @@ sub character_chart {
$result =~ s/&\#8600;/\\ensuremath\{\\searrow\}/g;
$result =~ s/&\#8601;/\\ensuremath\{\\swarrow\}/g;
$result =~ s/&\#8598;/\\ensuremath\{\\nwarrow\}/g;
+
+ # Left/right quotations:
+
+ $result =~ s/&(ldquo|#8220);/\`\`/g;
+ $result =~ s/&(rdquo|#8221);/\'\'/g;
+
+
return $result;
}
@@ -752,7 +879,7 @@ my %page_formats=
'legal' => {
'book' => {
'1' => ['7.1 in','13 in',,'-0.57 in','-0.57 in','-0.5 in'],
- '2' => ['3.16 in','13 in','-0.57 in','-0.57 in','-0.5 in']
+ '2' => ['3.66 in','13 in','-0.57 in','-0.57 in','-0.5 in']
},
'album' => {
'1' => ['12 in','7.1 in',,'-0.57 in','-0.57 in','-0.5 in'],
@@ -858,6 +985,8 @@ sub get_course {
my $courseidinfo;
if (defined($env{'request.course.id'})) {
$courseidinfo = &Apache::lonxml::latex_special_symbols(&unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header');
+ my $sec = $env{'request.course.sec'};
+
}
return $courseidinfo;
}
@@ -867,7 +996,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');
}
@@ -876,7 +1009,6 @@ sub page_format_transformation {
my $name = &get_name();
my $courseidinfo = &get_course();
- if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }
my $header_text = $parmhash{'print_header_format'};
$header_text = &format_page_header($textwidth, $header_text, $assignment,
$courseidinfo, $name);
@@ -1027,6 +1159,17 @@ sub print_latex_header {
'\usepackage[dvips]{graphicx}\usepackage{epsfig}'."\n".
'\usepackage{wrapfig}'.
'\usepackage{picins}\usepackage{calc}'."\n".
+ '\usepackage[T1]{fontenc}'."\n".
+ '\usepackage{lmodern}'."\n".
+ '\usepackage[postscript]{ucs}'."\n".
+ '\usepackage[utf8x]{inputenc}'."\n".
+ '\usepackage{pifont}' . "\n".
+ '\usepackage{latexsym}'."\n".
+ '\usepackage{amsmath}'.
+ '\usepackage{amssymb}'.
+ '\usepackage{amsfonts}'.
+ '\usepackage{amsthm}'.
+ '\usepackage{amscd}'.
'\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}'."\n".
'\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}'."\n".
'\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}'."\n".
@@ -1138,20 +1281,43 @@ sub recently_generated {
$cuid,$cgid,$crdev,$csize,
$catime,$cmtime,$cctime,
$cblksize,$cblocks)=stat($prtspool.'/'.$filename);
- my $result="".
- &mt('Generated [_1] ([_2] bytes)',
- &Apache::lonlocal::locallocaltime($cctime),$csize).
- ' ';
+ my $ext_text = 'pdf' ? &mt('PDF File'):&mt('Zip File');
+ my $result=&Apache::loncommon::start_data_table_row()
+ .'
'.
+ &mt('At least one of the resources you chose to print could not be rendered due to an unrecoverable error when communicating with a server:').
+ ' '.$ssi_last_error_resource.' '.$ssi_last_error.
+ '
'.&mt('You can continue using the link provided below, but make sure to carefully inspect your output file! The errors will be marked in the file.').' '.
+ &mt('You may be able to reprint the individual resources for which this error occurred, as the issue may be temporary.').
+ ' '.&mt('If the error persists, please contact the [_1] for assistance.',$helpurl).'
'.
+ &mt('We apologize for the inconvenience.').'
'.
+ ''.$continue_text.''.$end_page);
+ } else {
+ $r->print(<
-Continue
+$continue_text
$end_page
FINALEND
+ } # endif ssi errors.
}
@@ -2055,6 +2307,7 @@ sub print_resources {
# postscript. Each ENDOFSTUDENTSTAMP will go on a line by itself.
#
+
foreach my $curresline (@{$master_seq}) {
if (defined $page_breaks{$curresline}) {
if($i != 0) {
@@ -2062,6 +2315,7 @@ sub print_resources {
}
}
$i++;
+
if ( !($type eq 'problems' &&
($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library)$/)) ) {
my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
@@ -2072,7 +2326,7 @@ sub print_resources {
&Apache::lonxml::remember_problem_counter();
- my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
+ my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
@@ -2100,6 +2354,12 @@ sub print_resources {
$rendered = $header.$body;
}
}
+
+ if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') {
+ my $url = &Apache::lonnet::clutter($res_url);
+ my $annotation = &annotate($url);
+ $rendered =~ s/(\\keephidden{ENDOFPROBLEM})/$annotation$1/;
+ }
if ($remove_latex_header eq 'YES') {
$rendered = &latex_header_footer_remove($rendered);
} else {
@@ -2108,8 +2368,12 @@ sub print_resources {
$current_output .= $rendered;
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$printed .= $curresline.':';
- my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
-
+ my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
+ if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') {
+ my $url = &Apache::lonnet::clutter($res_url);
+ my $annotation = &annotate($url);
+ $annotation =~ s/(\\end{document})/$annotation$1/;
+ }
if ($remove_latex_header eq 'YES') {
$rendered = &latex_header_footer_remove($rendered);
} else {
@@ -2132,12 +2396,10 @@ sub print_resources {
if (&Apache::loncommon::connection_aborted($r)) { last; }
}
my $courseidinfo = &get_course();
- if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }
- if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection}
my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');
my $header_line =
&format_page_header($LaTeXwidth, $parmhash{'print_header_format'},
- $currentassignment, $courseidinfo, $fullname);
+ $currentassignment, $courseidinfo, $fullname, $usersection);
my $header_start = ($columns_in_format == 1) ? '\lhead'
: '\fancyhead[LO]';
$header_line = $header_start.'{'.$header_line.'}';
@@ -2187,6 +2449,8 @@ sub handler {
if(-e $conversion_queuefile) {
unlink $conversion_queuefile;
}
+
+
&output_data($r,$helper,\%parmhash);
return OK;
}
@@ -2216,6 +2480,34 @@ 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();
+ if (defined($navmap)) {
+ 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.'';
+ }
+ } else {
+ &Apache::lonnet::logthis('Retrieval of resources to check for folders set to be randomly ordered failed - could not create navmap object');
+ $message = "Retrieval of information about ordering of resources failed.";
+ return ''.$message.'';
+ }
+ return;
+}
+
sub printHelper {
my $r = shift;
@@ -2259,6 +2551,10 @@ sub printHelper {
$helper->declareVar("showallfoils");
$helper->declareVar("STUDENTS");
+
+
+
+
# The page breaks can get loaded initially from the course environment:
# But we only do this in the initial state so that they are allowed to change.
#
@@ -2352,7 +2648,7 @@ sub printHelper {
$helper->{VARS}->{'curseed'}=$env{'form.curseed'};
}
if (!$helper->{VARS}->{'probstatus'} && $env{'form.problemtype'}) {
- $helper->{VARS}->{'probstatus'}=$env{'form.problemtype'};
+ $helper->{VARS}->{'probstatus'}=$env{'form.problemstatus'};
}
my $userCanSeeHidden = Apache::lonnavmaps::advancedUser();
@@ -2381,9 +2677,9 @@ sub printHelper {
}
# Useful filter strings
- my $isProblem = '($res->is_problem()||$res->contains_problem) ';
+ my $isProblem = '($res->is_problem()||$res->contains_problem||$res->is_practice()) ';
$isProblem .= ' && !$res->randomout()' if !$userCanSeeHidden;
- my $isProblemOrMap = '$res->is_problem() || $res->contains_problem() || $res->is_sequence()';
+ my $isProblemOrMap = '$res->is_problem() || $res->contains_problem() || $res->is_sequence() || $res->is_practice()';
my $isNotMap = '!$res->is_sequence()';
$isNotMap .= ' && !$res->randomout()' if !$userCanSeeHidden;
my $isMap = '$res->is_map()';
@@ -2406,9 +2702,9 @@ sub printHelper {
$helper->{VARS}->{'postdata'} &&
$helper->{VARS}->{'assignment'}) {
# Allow problems from sequence
- push @{$printChoices}, [&mt('Selected Problems in folder [_1]',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS'];
+ push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from folder [_3]','','',''.$sequenceTitle.''), 'map_problems', 'CHOOSE_PROBLEMS'];
# Allow all resources from sequence
- push @{$printChoices}, [&mt('Selected Resources in folder [_1]',$sequenceTitle), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
+ push @{$printChoices}, [&mt('Selected [_1]Resources[_2] from folder [_3]','','',''.$sequenceTitle.''), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
my $helperFragment = <
@@ -2437,13 +2733,14 @@ HELPERFRAGMENT
&Apache::lonxml::xmlparse($r, 'helper', $helperFragment);
}
- # If the user has pfo (print for otheres) allow them to print all
- # problems and resources in the entier course, optionally for selected students
+ # If the user has pfo (print for others) allow them to print all
+ # problems and resources in the entire course, optionally for selected students
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'];
+ push @{$printChoices}, [&mtn('Selected Problems from entire course for selected people'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS'];
&Apache::lonxml::xmlparse($r, 'helper', <
+
+
+ STUDENTS1
+ return $isProblemOrMap;
+ return $isNotMap;
+ return $symbFilter;
+ $start_new_option
+
+
+
+ Select sorting order of printout
+
+ Sort by section then student
+ Sort by students across sections.
+
+
+
+
+
ALL_PROBLEMS
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, [&mt("Selected Problems from folder [_1] for selected people",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS'];
- push @{$printChoices}, [&mt("Selected Problems from folder [_1] for CODEd assignments",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1'];
+ push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from folder [_3] for [_4]selected people[_5]','','',''.$sequenceTitle.'','',''), 'problems_for_students', 'CHOOSE_STUDENTS'];
+ push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from folder [_3] for [_4]CODEd assignments[_5]','','',''.$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 +2802,8 @@ ALL_PROBLEMS
#
my $resource_selector=<
+ $randomly_ordered_warning
+
PRINT_FORMATTING Select resources for the assignment ) {
+ foreach my $line (@lines) {
my ($name,$description,$code_type,$code_length)=
(split(/:/,$line))[0,1,2,4];
if ($code_length > 0 &&
@@ -2642,13 +2963,15 @@ CHOOSE_ANON1
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, [&mt("Selected Resources from folder [_1] for selected people",$sequenceTitle), 'resources_for_students', 'CHOOSE_STUDENTS1'];
- push @{$printChoices}, [&mt("Selected Resources from folder [_1] for CODEd assignments",$sequenceTitle), 'resources_for_anon', 'CHOOSE_ANON2'];
+ push @{$printChoices}, [&mt('Selected [_1]Resources[_2] from folder [_3] for [_4]selected people[_5]','','',''.$sequenceTitle.'','',''), 'resources_for_students', 'CHOOSE_STUDENTS1'];
+ push @{$printChoices}, [&mt('Selected [_1]Resources[_2] from folder [_3] for [_4]CODEd assignments[_5]','','',''.$sequenceTitle.'','',''), 'resources_for_anon', 'CHOOSE_ANON2'];
}
$resource_selector=<
+ $randomly_ordered_warning
+
PRINT_FORMATTING Select resources for the assignment Problems from current subdirectory [_1]",$pretty_dir), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
+ push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from current subdirectory [_3]','','',''.$pretty_dir.'','',''), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
my $xmlfrag = <
@@ -2788,7 +3111,7 @@ CHOOSE_FROM_SUBDIR
# Allow the user to select any sequence in the course, feed it to
# another resource selector for that sequence
if (!$helper->{VARS}->{'construction'} && !$is_published) {
- push @$printChoices, ["Selected Resources from selected folder in course",
+ push @$printChoices, [&mtn("Selected Resources from selected folder in course"),
'select_sequences', 'CHOOSE_SEQUENCE'];
my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'};
#Escape apostrophes and backslashes for Perl
@@ -2834,10 +3157,18 @@ CHOOSE_FROM_ANY_SEQUENCE
if (($perm{'pav'} and &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) or
($helper->{VARS}->{'construction'} eq '1')) {
- addMessage("