--- loncom/interface/lonprintout.pm 2006/09/06 21:56:30 1.477.2.1 +++ loncom/interface/lonprintout.pm 2006/08/14 22:20:20 1.479 @@ -2,7 +2,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.477.2.1 2006/09/06 21:56:30 albertel Exp $ +# $Id: lonprintout.pm,v 1.479 2006/08/14 22:20:20 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -628,8 +628,8 @@ my %page_formats= '2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm'] }, 'album' => { - '1' => [ '8.8 in', '6.8 in','-0.55 in', '-0.55 in','1 cm'], - '2' => [ '4.8 in', '6.8 in','-0.5 in', '-1.0 in','3.5 in'] + '1' => [ '8.8 in', '6.8 in','-0.55 in', '-0.83 in','1 cm'], + '2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in'] }, }, 'legal' => { @@ -1110,7 +1110,10 @@ sub print_construction_sequence { $answerform{'answer_output_mode'}='tex'; $answerform{'rndseed'}=$rndseed; $answerform{'problem_split'}=$parmhash{'problem_stream_switch'}; - if ($urlp=~/\/res\//) {$env{'request.state'}='published';} + if ($urlp=~/\/res\//) { + $env{'request.state'}='published'; + } + $resources_printed .= $urlp.':'; my $answer=&Apache::lonnet::ssi($urlp,%answerform); if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { @@ -1198,6 +1201,8 @@ ENDPART my $start_page = &Apache::loncommon::start_page('Preparing Printout',$js); my $msg = &mt('Please stand by while processing your print request, this may take some time ...'); + + $r->print($start_page."\n

\n$msg\n

\n"); # fetch the pagebreaks and store them in the course environment @@ -1249,6 +1254,7 @@ ENDPART } if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') { + #-- single document - problem, page, html, xml, ... my ($currentURL,$cleanURL); @@ -2156,7 +2162,7 @@ sub printHelper { if ($env{'form.postdata'}=~/^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/) { $helper->{VARS}->{'filename'} = "~$1/$2"; $helper->{VARS}->{'construction'} = 1; - } else { + } elsif ($env{'form.postdata'}) { if ($env{'form.postdata'}) { $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($env{'form.postdata'}); } @@ -2168,7 +2174,6 @@ sub printHelper { } } - if ($env{'form.symb'}) { $helper->{VARS}->{'symb'} = $env{'form.symb'}; } @@ -2180,7 +2185,6 @@ sub printHelper { &Apache::lonenc::check_encrypt($helper->{VARS}->{'symb'}); my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu($helper); if ($sequenceTitle ne '') {$helper->{VARS}->{'assignment'}=$sequenceTitle;} - # Extract map my $symb = $helper->{VARS}->{'symb'}; @@ -2188,16 +2192,19 @@ sub printHelper { my $subdir; # Get the resource name from construction space + if ($helper->{VARS}->{'construction'}) { $resourceTitle = substr($helper->{VARS}->{'filename'}, rindex($helper->{VARS}->{'filename'}, '/')+1); $subdir = substr($helper->{VARS}->{'filename'}, 0, rindex($helper->{VARS}->{'filename'}, '/') + 1); - } else { + } elsif ($env{'form.postdata'} =~ /^\/res\//) { # Get resource name from res space. + $helper->{VARS}->{'postdata'} = $env{'form.postdata'}; + + } elsif (!$helper->{VARS}->{'postdata'}) { ($map, $id, $url) = &Apache::lonnet::decode_symb($symb); $helper->{VARS}->{'postdata'} = &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url)); - if (!$resourceTitle) { # if the resource doesn't have a title, use the filename my $postdata = $helper->{VARS}->{'postdata'}; $resourceTitle = substr($postdata, rindex($postdata, '/') + 1); @@ -2265,6 +2272,7 @@ sub printHelper { if (($helper->{'VARS'}->{'construction'} ne '1') && $helper->{VARS}->{'postdata'} && + ($helper->{VARS}->{'postdata'} !~ /^\/res\//) && $helper->{VARS}->{'assignment'}) { # Allow problems from sequence push @{$printChoices}, [&mt('Selected Problems in folder [_1]',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS']; @@ -2301,8 +2309,8 @@ HELPERFRAGMENT # If the user has pfo (print for otheres) allow them to print all # problems and resources in the entier course, optionally for selected students if ($perm{'pfo'} && - ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { - + $helper->{VARS}->{'postdata'} !~/^\/res\// && + $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/) { push @{$printChoices}, ['Selected Problems from entire course', 'all_problems', 'ALL_PROBLEMS']; push @{$printChoices}, ['Selected Resources from entire course', 'all_resources', 'ALL_RESOURCES']; &Apache::lonxml::xmlparse($r, 'helper', < $resource_selector 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 $perm{'pav'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') { + 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 $perm{'pav'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') { push @{$printChoices}, [&mt("Selected Problems from current subdirectory [_1]",$subdir), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; my $f = '$filename'; @@ -2639,7 +2649,7 @@ CHOOSE_FROM_SUBDIR # Allow the user to select any sequence in the course, feed it to # another resource selector for that sequence - if (!$helper->{VARS}->{'construction'}) { + if (!$helper->{VARS}->{'construction'} && ($helper->{VARS}->{'postdata'} !~ /^\/res\//)) { push @$printChoices, ["Selected Resources from selected folder in course", 'select_sequences', 'CHOOSE_SEQUENCE']; my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'}; @@ -2670,7 +2680,6 @@ CHOOSE_FROM_SUBDIR CHOOSE_FROM_ANY_SEQUENCE } - # Generate the first state, to select which resources get printed. Apache::lonhelper::state->new("START", "Select Printing Options:"); $paramHash = Apache::lonhelper::getParamHash();