--- loncom/interface/lonprintout.pm 2008/10/02 17:12:18 1.543
+++ loncom/interface/lonprintout.pm 2008/12/22 22:28:18 1.545.2.3
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.543 2008/10/02 17:12:18 raeburn Exp $
+# $Id: lonprintout.pm,v 1.545.2.3 2008/12/22 22:28:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -229,11 +229,9 @@ 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, $section) = @_;
-
+ my ($width, $format, $assignment, $course, $student) = @_;
$width = &recalcto_mm($width); # Get width in mm.
# Default format?
@@ -251,34 +249,34 @@ sub format_page_header {
#
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);
+ }
+ $format = "\\textbf{$student} $course \\hfill \\thepage \\\\ \\textit{$assignment}";
- 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 .= '\\\\%c \\\\ %a';
-
-
+ } 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!!!
}
- # 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
@@ -985,8 +983,6 @@ 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;
}
@@ -1009,6 +1005,7 @@ 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);
@@ -1281,20 +1278,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()
+ .'
". - ': | ");
+ &addMessage(' ' + .' '.&mt('Print Options').'' + .&Apache::lonhtmlcommon::start_pick_box() +# .&Apache::lonhtmlcommon::row_headline() +# .''.&mt('Print Options').'' +# .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title( + '' + ) + ); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'ANSWER_TYPE'; $helper->declareVar('ANSWER_TYPE'); @@ -3141,7 +3177,7 @@ CHOOSE_FROM_ANY_SEQUENCE ['Only Answers', 'only'] ]; Apache::lonhelper::dropdown->new(); - addMessage(" | "); $startedTable = 1; } else { - addMessage(" |
". - ': | "); + &addMessage(&Apache::lonhtmlcommon::row_title( + '' + ) + ); } $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'LATEX_TYPE'; @@ -3172,10 +3210,13 @@ CHOOSE_FROM_ANY_SEQUENCE } Apache::lonhelper::dropdown->new(); - addMessage(" |
". - ': | "); + &addMessage(&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title( + '' + ) + ); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'TABLE_CONTENTS'; $helper->declareVar('TABLE_CONTENTS'); @@ -3183,13 +3224,15 @@ CHOOSE_FROM_ANY_SEQUENCE ['No', 'no'], ['Yes', 'yes'] ]; Apache::lonhelper::dropdown->new(); - addMessage(" |
". - ': | "); + &addMessage(&Apache::lonhtmlcommon::row_title( + '' + ) + ); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'TABLE_INDEX'; $helper->declareVar('TABLE_INDEX'); @@ -3197,11 +3240,13 @@ CHOOSE_FROM_ANY_SEQUENCE ['No', 'no'], ['Yes', 'yes'] ]; Apache::lonhelper::dropdown->new(); - addMessage(" |
". - ': | "); + &addMessage(&Apache::lonhtmlcommon::row_closure()); + &addMessage(&Apache::lonhtmlcommon::row_title( + '' + ) + ); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'PRINT_DISCUSSIONS'; $helper->declareVar('PRINT_DISCUSSIONS'); @@ -3209,14 +3254,16 @@ CHOOSE_FROM_ANY_SEQUENCE ['No', 'no'], ['Yes', 'yes'] ]; Apache::lonhelper::dropdown->new(); - addMessage(" |
". - ': | "); + &addMessage(&Apache::lonhtmlcommon::row_title( + '' + ) + ); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = "PRINT_ANNOTATIONS"; $helper->declareVar("PRINT_ANNOTATIONS"); @@ -3224,16 +3271,16 @@ CHOOSE_FROM_ANY_SEQUENCE ['No', 'no'], ['Yes', 'yes']]; Apache::lonhelper::dropdown->new(); - addMessage(" |
"); + &addMessage(&Apache::lonhtmlcommon::row_title(&mt('Foils'))); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'multichoice'} = "true"; $paramHash->{'allowempty'} = "true"; $paramHash->{'variable'} = "showallfoils"; $paramHash->{'CHOICES'} = [ ["Show all foils", "1"] ]; Apache::lonhelper::choices->new(); - addMessage(" | |
- : - |
- |
- : - |
+ my $xmlfrag .= ' |
+ | |
Problem Type: | "); + &addMessage(&Apache::lonhtmlcommon::row_title(&mt('Problem Type'))); # # Initial value from construction space: # @@ -3286,16 +3345,16 @@ RNDSEED PROBTYPE &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag); - addMessage(" |
$PageLayout | -$NumberOfColumns | -$PaperType | -$pdfFormLabel | -
- - - |
- - |