--- loncom/interface/lonprintout.pm 2004/04/07 18:01:19 1.290
+++ loncom/interface/lonprintout.pm 2004/04/20 06:11:49 1.292
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.290 2004/04/07 18:01:19 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.292 2004/04/20 06:11:49 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1002,20 +1002,36 @@ ENDPART
$result .= $print_array[0].' \end{document}';
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon') ||
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon') ) {
+ my $cdom =$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
+ my $cnum =$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};
my $code_name=$helper->{'VARS'}->{'ANON_CODE_STORAGE_NAME'};
- if ($helper->{'VARS'}->{'REMEBER_ANON_CODES'} != 1) {
- $code_name=undef;
- }
+ my $old_name=$helper->{'VARS'}->{'REUSE_OLD_CODES'};
my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'});
my $flag_latex_header_remove = 'NO';
my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth));
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$num_todo,'inline');
my $seed=time+($$<<16)+($$);
- my %allcodes;
- for (my $i=0;$i<$num_todo;$i++) {
- $moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,'6');
+ my @allcodes;
+ if ($old_name) {
+ my %result=&Apache::lonnet::get('CODEs',[$old_name],$cdom,$cnum);
+ @allcodes=split(',',$result{$old_name});
+ } else {
+ my %allcodes;
+ for (my $i=0;$i<$num_todo;$i++) {
+ $moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,'6');
+ }
+ if ($code_name) {
+ &Apache::lonnet::put('CODEs',
+ {$code_name =>join(',',keys(%allcodes))},
+ $cdom,$cnum);
+ }
+ @allcodes=keys(%allcodes);
+ }
+ my $i=0;
+ foreach my $code (sort(@allcodes)) {
+ $moreenv{'CODE'}=&num_to_letters($code);
my ($output,$fullname)=
&print_resources($r,$helper,'anonymous',$type,\%moreenv,
\@master_seq,$flag_latex_header_remove);
@@ -1023,13 +1039,7 @@ ENDPART
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
&mt('last assignment').' '.$fullname);
$flag_latex_header_remove = 'YES';
- }
- if ($code_name) {
- my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
- my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
- &Apache::lonnet::put('CODEs',
- { $code_name => join(',',keys(%allcodes)) },
- $cdom,$cnum);
+ $i++;
}
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
$result .= $print_array[0].' \end{document}';
@@ -1466,11 +1476,9 @@ sub printHelper {
my $paramHash;
if ($resourceTitle) {
- push @{$printChoices}, ["$resourceTitle (what you just saw on the screen)", 'current_document', 'PAGESIZE'];
+ push @{$printChoices}, ["$resourceTitle (".&mt('what you just saw on the screen').")", 'current_document', 'PAGESIZE'];
}
-# $r->print($helper->{VARS}->{'postdata'});
-
# Useful filter strings
my $isProblem = '($res->is_problem()||$res->contains_problem) ';
$isProblem .= ' && !$res->randomout()' if !$userCanSeeHidden;
@@ -1492,9 +1500,9 @@ sub printHelper {
$helper->{VARS}->{'postdata'} &&
$helper->{VARS}->{'assignment'}) {
# Allow problems from sequence
- push @{$printChoices}, ["Problems in $sequenceTitle", 'map_problems', 'CHOOSE_PROBLEMS'];
+ push @{$printChoices}, ["".&mt('Problems')." ".&mt('in')." $sequenceTitle", 'map_problems', 'CHOOSE_PROBLEMS'];
# Allow all resources from sequence
- push @{$printChoices}, ["Resources in $sequenceTitle", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
+ push @{$printChoices}, ["".&mt('Resources')." ".&mt('in')." $sequenceTitle", 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
my $helperFragment = <
@@ -1541,8 +1549,8 @@ HELPERFRAGMENT
ALL_PROBLEMS
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, ["Problems from $sequenceTitle for selected students", 'problems_for_students', 'CHOOSE_STUDENTS'];
- push @{$printChoices}, ["Problems from $sequenceTitle for anonymous students", 'problems_for_anon', 'CHOOSE_ANON1'];
+ push @{$printChoices}, ["".&mt('Problems')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('selected students')."", 'problems_for_students', 'CHOOSE_STUDENTS'];
+ push @{$printChoices}, ["".&mt('Problems')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('anonymous students')."", 'problems_for_anon', 'CHOOSE_ANON1'];
}
my $resource_selector=<
Select resources for the assignment
@@ -1569,27 +1577,35 @@ RESOURCE_SELECTOR
$resource_selector
CHOOSE_STUDENTS
+
+ my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
+ my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
+ my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum);
+ my $namechoice='';
+ foreach my $name (@names) {
+ $namechoice.=''.$name.'';
+ }
&Apache::lonxml::xmlparse($r, 'helper', <
PAGESIZE
Number of anonymous assignments to print?
-
-
- Should the CODEs used on this printing be remebered for later?
-
-
- Names to store the CODEs under for later:
+
Names to store the CODEs under for later:
+ Reprint a set of saved CODEs:
+
+ $namechoice
+
+
$resource_selector
CHOOSE_ANON1
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, ["Resources from $sequenceTitle for selected students", 'resources_for_students', 'CHOOSE_STUDENTS1'];
- push @{$printChoices}, ["Resources from $sequenceTitle for anonymous students", 'resources_for_anon', 'CHOOSE_ANON2'];
+ push @{$printChoices}, ["".&mt('Resources')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('selected students')."", 'resources_for_students', 'CHOOSE_STUDENTS1'];
+ push @{$printChoices}, ["".&mt('Resources')." ".&mt('from')." $sequenceTitle ".&mt('for')." ".&mt('anonymous students')."", 'resources_for_anon', 'CHOOSE_ANON2'];
}
@@ -1631,7 +1647,7 @@ CHOOSE_ANON2
# 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'}) and $ENV{'request.role.adv'} and $subdir ne '/home/httpd/html/res/') {
- push @{$printChoices}, ["Problems from current subdirectory $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
+ push @{$printChoices}, ["".&mt('Problems')." ".&mt('from current subdirectory')." $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
my $f = '$filename';
my $xmlfrag = <