--- loncom/interface/lonprintout.pm 2012/12/28 16:19:10 1.627.2.2 +++ loncom/interface/lonprintout.pm 2013/05/30 05:04:22 1.631 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.627.2.2 2012/12/28 16:19:10 raeburn Exp $ +# $Id: lonprintout.pm,v 1.631 2013/05/30 05:04:22 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -149,8 +149,7 @@ sub printable_sequence { # Return: # XML that can be parsed by the helper to drive the state machine. # -sub create_incomplete_folder_selstud_helper($helper) -{ +sub create_incomplete_folder_selstud_helper { my ($helper, $map) = @_; @@ -721,7 +720,7 @@ sub incomplete { # print_resources. # sub master_seq_to_person_seq { - my ($map, $seq, $who, $code) = @_; + my ($map, $seq, $who, $code, $nohidemap) = @_; my ($username, $userdomain, $usersection) = split(/:/, $who); @@ -732,9 +731,14 @@ sub master_seq_to_person_seq { my %seq_hash = map {$_ => 1} @$seq; my @output_seq; + + my $unhidden; + if ($perm{'pav'} && $perm{'vgr'} && $nohidemap) { + $unhidden = &Apache::lonnet::clutter($map); + } my $navmap = Apache::lonnavmaps::navmap->new($username, $userdomain, - $code); + $code, $unhidden); my ($start,$finish); if ($map) { @@ -761,7 +765,6 @@ sub master_seq_to_person_seq { # Only process resources..that are not removed by randomout... # and are selected for printint as well. # - if (ref($curres) && ! $curres->randomout()) { my $currsymb = $curres->symb(); if (exists($seq_hash{$currsymb})) { @@ -1048,12 +1051,12 @@ sub printf_style_subst { # %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. - my $chars_per_line = int($width/2); # Character/textline. + my $chars_per_line = int($width/1.6); # Character/textline. # Default format? @@ -1069,38 +1072,34 @@ sub format_page_header { # - Allow the assignment to be 2 lines (wrapped). # - 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); - } 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 = "%$name_length".'n'; - } + if ($section) { + $format .= ' - Sec: '."%$sec_length".'s'; + } - return $format; + $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 @@ -1836,6 +1835,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; } @@ -1858,7 +1859,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); @@ -2165,7 +2165,7 @@ sub print_page_in_course { $form{'grade_target'} = 'tex'; $form{'textwidth'} = &get_textwidth($helper, $LaTeXwidth); - $form{'pdfFormFields'} = 'no'; # + $form{'pdfFormFields'} = $pdfFormFields; # $form{'showallfoils'} = $helper->{'VARS'}->{'showallfoils'}; $form{'problem_split'}=$parmhash{'problem_stream_switch'}; @@ -2701,7 +2701,7 @@ ENDPART my %form; $form{'grade_target'} = 'tex'; $form{'textwidth'} = &get_textwidth($helper, $LaTeXwidth); - $form{'pdfFormFields'} = 'no'; + $form{'pdfFormFields'} = $pdfFormFields; # If form.showallfoils is set, then request all foils be shown: # privilege will be enforced both by not allowing the @@ -3025,7 +3025,6 @@ ENDPART if (($selectionmade == 4) and ($assignment ne $prevassignment)) { my $name = &get_name(); my $courseidinfo = &get_course(); - if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } $prevassignment=$assignment; my $header_text = $parmhash{'print_header_format'}; $header_text = &format_page_header($textwidth, $header_text, @@ -3193,7 +3192,7 @@ ENDPART $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'}); } my $actual_seq = master_seq_to_person_seq($map, \@master_seq, - $person); + $person, undef, 1); my ($output,$fullname, $printed)=&print_resources($r,$helper, $person,$type, \%moreenv, $actual_seq, @@ -3314,7 +3313,7 @@ ENDPART $env{'form.CODE'} = $moreenv{'CODE'}; $actual_seq = master_seq_to_person_seq($map, \@master_seq, undef, - $moreenv{'CODE'}); + $moreenv{'CODE'}, 1); delete($env{'form.CODE'}); } my ($output,$fullname, $printed)= @@ -3612,8 +3611,6 @@ sub print_resources { my $current_assignment = ""; my $assignment; my $courseidinfo = &get_course(); - if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } - if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} foreach my $curresline (@{$master_seq}) { if (defined $page_breaks{$curresline}) { @@ -3737,7 +3734,7 @@ sub print_resources { if (($assignment ne $current_assignment) && ($assignment ne "")) { my $header_line = &format_page_header($LaTeXwidth, $parmhash{'print_header_format'}, $assignment, $courseidinfo, - $fullname); + $fullname, $usersection); my $header_start = ($columns_in_format == 1) ? '\lhead' : '\fancyhead[LO]'; $header_line = $header_start.'{'.$header_line.'}'; @@ -3769,7 +3766,7 @@ sub print_resources { 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.'}'; @@ -4665,8 +4662,9 @@ CHOOSE_FROM_ANY_SEQUENCE if (!$res_printable) { $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{MESSAGE_TEXT} = - &mt('[_1]Printing for current resource is only possible between [_2] and [_3]', - '

',$res_printstartdate, $res_printenddate.'

'); + '

' + .&mt('Printing for current resource is only possible between [_1] and [_2]', + $res_printstartdate, $res_printenddate).'

'; Apache::lonhelper::message->new(); } $paramHash = Apache::lonhelper::getParamHash(); @@ -4891,7 +4889,7 @@ FONT_SELECTION return "$helper->{VARS}->{'probstatus'}"; Homework Problem - Exam Problem + Bubblesheet Exam Problem Survey question ,choice computer="anonsurvey"Anonymous survey question @@ -5009,6 +5007,9 @@ sub render { my $PaperType=&mt('Paper type'); my $landscape=&mt('Landscape'); my $portrait=&mt('Portrait'); + my $pdfFormLabel=&mt('PDF-Formfields'); + my $with=&mt('with Formfields'); + my $without=&mt('without Formfields'); $result.='

'.&mt('Layout Options').'

' @@ -5017,6 +5018,7 @@ sub render { .''.$PageLayout.'' .''.$NumberOfColumns.'' .''.$PaperType.'' + .''.$pdfFormLabel.'' .&Apache::loncommon::end_data_table_header_row() .&Apache::loncommon::start_data_table_row() .'' @@ -5057,6 +5059,12 @@ sub render { $result .= < + + + HTML $result.=&Apache::loncommon::end_data_table_row() .&Apache::loncommon::end_data_table();