--- loncom/interface/lonprintout.pm 2002/12/23 19:11:33 1.100 +++ loncom/interface/lonprintout.pm 2003/01/23 20:19:38 1.105 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.100 2002/12/23 19:11:33 albertel Exp $ +# $Id: lonprintout.pm,v 1.105 2003/01/23 20:19:38 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -153,11 +153,14 @@ ENDMENUOUT5 sub sequence_content_menu { my ($key_to,$r) = @_; + my $primary_sequence; my $symbolic = &Apache::lonnet::symbread($ENV{'form.url'}); my @sequence = split('___',$symbolic); - my $primary_sequence = '/res/'.$sequence[0]; + if ($sequence[0]=~/^uploaded/) {$primary_sequence = '/'.$sequence[0];} + else {$primary_sequence = '/res/'.$sequence[0];} my @master_seq = &coming_from_hash($primary_sequence,$sequence[0]); my @master_seq_view = @master_seq; + @master_seq = @master_seq; for (my $i=0;$i<=$#master_seq_view;$i++) { $master_seq_view[$i]=~/\/([^\/]+)$/; $master_seq_view[$i]=$1; @@ -270,7 +273,7 @@ sub problem_choice_menu {
ENDMENUOUT1
my $i=0;
- foreach my $file (@list_of_files) {
+ foreach my $file (sort @list_of_files) {
$r->print('
'.
$file);
$i++;
@@ -442,8 +445,11 @@ ENDPART
my $number_of_columns = 1; #used only for pages to determine the width of the cell
my $selectionmade = '';
my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);
- my $LaTeXwidth;
-
+ if ($numberofcolumns == 1) {
+ $textwidth=$ENV{'form.width'};
+ $textheight=$ENV{'form.height'};
+ }
+ my $LaTeXwidth;
if ($textwidth=~/(\d+\s*cm)/) {
$LaTeXwidth = $1*10;
} elsif ($textwidth=~/(\d+\s*mm)/) {
@@ -490,7 +496,7 @@ ENDPART
my $flag_latex_header_remove = 'NO';
my $flag_page_in_sequence = 'NO';
for (my $i=0;$i<=$#master_seq;$i++) {
- my ($urlp,$symb) = split /&&/, $master_seq[$i];
+ my ($urlp,$symb) = split /&&/, $master_seq[$i];
if ($choice eq 'Standard LaTeX output for the primary sequence') {
$selectionmade = 2;
} elsif ($choice eq 'Standard LaTeX output for whole primary sequence') {
@@ -523,14 +529,20 @@ ENDPART
} elsif ($choice eq 'Standard LaTeX output for the top level sequence') {
# where is the main sequence of the course?
$selectionmade = 4;
- my $main_seq = '/res/'.$ENV{'request.course.uri'};
+ my $main_seq;
+ if ($ENV{'request.course.uri'}=~/\/?uploaded\//) {
+ $main_seq = $ENV{'request.course.uri'};
+ } else {
+ $main_seq = '/res/'.$ENV{'request.course.uri'};
+ }
my @file_seq = &coming_from_hash_whole($main_seq);
my $flag_latex_header_remove = 'NO';
#-- produce an output string
for (my $i=0;$i<=$#file_seq;$i++) {
- my ($urlp,$symb) = split /&&/, $file_seq[$i];
- $urlp=~s/\/home\/httpd\/html//;
- if ($urlp=~m/\.(problem|exam|quiz|assess|survey|form|library)/) {
+ if (not $file_seq[$i]=~/^&&/) {
+ my ($urlp,$symb) = split /&&/, $file_seq[$i];
+ $urlp=~s/\/home\/httpd\/html//;
+ if ($urlp=~m/\.(problem|exam|quiz|assess|survey|form|library)/) {
my %moreenv;
$moreenv{'form.grade_target'}='tex';
$moreenv{'form.textwidth'}=$LaTeXwidth;
@@ -544,7 +556,8 @@ ENDPART
}
$result .= $texversion;
$flag_latex_header_remove = 'YES';
- }
+ }
+ }
}
$result .= '\end{document}';
} elsif ($choice eq 'All class print') {
@@ -695,10 +708,11 @@ sub coming_from_hash_whole {
if ($hash{'src_'.$current_resource}=~/\.sequence$/) {
push @resourcelist,&coming_from_hash_whole($hash{'src_'.$current_resource});
} else {
- $mainsequence =~ /\/res\/(.*)$/;
- my $presymb = $1;
+ my $presymb;
+ if ($mainsequence =~ /\/res\/(.*)$/) {$presymb = $1;}
+ elsif ($mainsequence =~ /\/?(uploaded\/(.*))$/) {$presymb = $1;}
my $rid = $hash{'ids_'.$hash{'src_'.$current_resource}};
- if ($rid=~/,/) {
+ if ($rid=~/,/) {
my @rid = split /,/, $rid;
foreach my $rid_element (@rid) {
if ($rid_element =~ m/^$mapid\.(\d*)/) {
@@ -707,7 +721,7 @@ sub coming_from_hash_whole {
}
}
} else {
- $rid =~ m/^$mapid\.(\d*)/;
+ $rid =~ m/^$mapid\.(\d*)/;
$rid = $1;
}
$hash{'src_'.$current_resource} =~ m/\/res\/(.*)$/;
@@ -1186,8 +1200,14 @@ sub character_chart {
sub page_format_transformation {
- my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment) = @_;
- my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);
+ my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment) = @_;
+ my ($textwidth,$textheight,$oddoffset,$evenoffset);
+ $assignment=~s/_/ /g;
+ if ($numberofcolumns != 1) {
+ ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);
+ } else {
+ ($textwidth,$textheight,$oddoffset,$evenoffset) = ($ENV{'form.width'},$ENV{'form.height'},$ENV{'form.leftmargin'},$ENV{'form.leftmargin'});
+ }
my $courseidinfo = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
if ($layout eq 'CBI') {
$text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}}} \\hfill $courseidinfo} \\vskip 5 mm /;
@@ -1195,7 +1215,7 @@ sub page_format_transformation {
if ($choice ne 'All class print') {
$text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\setlength{\\topmargin}{1cm}\\setlength{\\headheight}{1cm}\\setlength{\\headsep}{0.5cm}\\markboth{}{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}} $courseidinfo - $assignment}\\pagestyle{myheadings}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1}/;
} else {
- $text =~ s/\\begin{document}/\\setlength{\\textheight}{$textheight}\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\textwidth}{$textwidth}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1} \\vskip 5 mm /;
+ $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1} \\vskip 5 mm /;
}
}
return $text;
@@ -1221,9 +1241,14 @@ sub details_for_menu {
my $name_of_resourse = $hash{'title_'.$hash{'ids_'.$ENV{'form.postdata'}}};
my $symbolic = &Apache::lonnet::symbread($ENV{'form.postdata'});
my ($map,$id,$resource)=split(/___/,$symbolic);
- my $name_of_sequence = $hash{'title_'.$hash{'ids_/res/'.$map}};
+ my $name_of_sequence;
+ if ($map=~/^uploaded/) {
+ $name_of_sequence = $hash{'title_'.$hash{'ids_/'.$map}};
+ } else {
+ $name_of_sequence = $hash{'title_'.$hash{'ids_/res/'.$map}};
+ }
if ($name_of_sequence =~ /^\s*$/) {
- $map =~ m|([^/]+)$|;
+ $map =~ m|([^/]+)$|;
$name_of_sequence = $1;
}
my $name_of_map = $hash{'title_'.$hash{'ids_/res/'.$ENV{'request.course.uri'}}};