--- loncom/interface/lonprintout.pm 2004/11/13 09:18:52 1.335
+++ loncom/interface/lonprintout.pm 2004/11/19 21:48:41 1.339
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.335 2004/11/13 09:18:52 albertel Exp $
+# $Id: lonprintout.pm,v 1.339 2004/11/19 21:48:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -374,11 +374,11 @@ sub character_chart {
my %page_formats=
('letter' => {
'book' => {
- '1' => [ '7.1 in','10.2 in', '-0.57 in','-0.57 in','0 in'],
- '2' => ['3.66 in','10.2 in', '-0.57 in','-0.57 in','0 in']
+ '1' => [ '7.1 in','10.2 in', '-0.57 in','-0.57 in','1 cm'],
+ '2' => ['3.66 in','10.2 in', '-0.57 in','-0.57 in','1 cm']
},
'album' => {
- '1' => [ '8.8 in', '6.8 in','-40 pt in', '-60 pt','0 in'],
+ '1' => [ '8.8 in', '6.8 in','-40 pt in', '-60 pt','1 cm'],
'2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in']
},
},
@@ -688,11 +688,11 @@ sub path_to_problem {
sub recalcto_mm {
my $textwidth=shift;
my $LaTeXwidth;
- if ($textwidth=~/(\d+\.?\d*)\s*cm/) {
+ if ($textwidth=~/(-?\d+\.?\d*)\s*cm/) {
$LaTeXwidth = $1*10;
- } elsif ($textwidth=~/(\d+\.?\d*)\s*mm/) {
+ } elsif ($textwidth=~/(-?\d+\.?\d*)\s*mm/) {
$LaTeXwidth = $1;
- } elsif ($textwidth=~/(\d+\.?\d*)\s*in/) {
+ } elsif ($textwidth=~/(-?\d+\.?\d*)\s*in/) {
$LaTeXwidth = $1*25.4;
}
$LaTeXwidth.=' mm';
@@ -1096,20 +1096,13 @@ ENDPART
my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};
my $code_name=$helper->{'VARS'}->{'ANON_CODE_STORAGE_NAME'};
my $old_name=$helper->{'VARS'}->{'REUSE_OLD_CODES'};
- my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
- my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'});
- my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'};
- if ($number_per_page eq '0' || $number_per_page eq 'all') {
- $number_per_page=$num_todo;
- }
- 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','75');
my $seed=time+($$<<16)+($$);
my @allcodes;
if ($old_name) {
my %result=&Apache::lonnet::get('CODEs',[$old_name],$cdom,$cnum);
@allcodes=split(',',$result{$old_name});
+ $num_todo=scalar(@allcodes);
} else {
my %allcodes;
srand($seed);
@@ -1123,6 +1116,14 @@ ENDPART
}
@allcodes=keys(%allcodes);
}
+ my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
+ my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'});
+ my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'};
+ if ($number_per_page eq '0' || $number_per_page eq 'all') {
+ $number_per_page=$num_todo;
+ }
+ my $flag_latex_header_remove = 'NO';
+ my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$num_todo,'inline','75');
my $count=0;
foreach my $code (sort(@allcodes)) {
my $file_num=int($count/$number_per_page);
@@ -1217,10 +1218,10 @@ ENDPART
for (my $i=1;$i<=$#print_array;$i++) {$print_array[$i] = &latex_corrections($number_of_columns,$print_array[$i],$selectionmade);}
#changes page's parameters for the one column output
if ($numberofcolumns == 1) {
- $result =~ s/\\textwidth\s*=\s*\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
- $result =~ s/\\textheight\s*=\s*\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
- $result =~ s/\\evensidemargin\s*=\s*\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
- $result =~ s/\\oddsidemargin\s*=\s*\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
+ $result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
+ $result =~ s/\\textheight\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
+ $result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
+ $result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
}
#-- writing .tex file in prtspool
my $temp_file;
@@ -1702,7 +1703,7 @@ CHOOSE_STUDENTS
my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum);
my $namechoice='';
- foreach my $name (@names) {
+ foreach my $name (sort {uc($a) cmp uc($b)} @names) {
if ($name =~ /^error: 2 /) { next; }
$namechoice.=''.$name.'';
}