--- loncom/interface/lonprintout.pm 2006/08/22 14:44:39 1.482 +++ loncom/interface/lonprintout.pm 2006/08/28 11:11:49 1.483 @@ -2,7 +2,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.482 2006/08/22 14:44:39 albertel Exp $ +# $Id: lonprintout.pm,v 1.483 2006/08/28 11:11:49 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2126,6 +2126,7 @@ sub printHelper { $helper->declareVar('FINISHPAGE'); $helper->declareVar('PRINT_TYPE'); $helper->declareVar("showallfoils"); + $helper->declareVar("STUDENTS"); # The page breaks can get loaded initially from the course environment: # But we only do this in the initial state so that they are allowed to change. @@ -2137,6 +2138,8 @@ sub printHelper { {'pagebreaks' => 'scalar', 'lastprinttype' => 'scalar'}); + # This will persistently load in the data we want from the + # very first screen. if($helper->{VARS}->{PRINT_TYPE} eq $env{'form.lastprinttype'}) { if (!defined ($env{"form.CURRENT_STATE"})) { @@ -2151,9 +2154,7 @@ sub printHelper { } - - # This will persistently load in the data we want from the - # very first screen. + # Detect whether we're coming from construction space if ($env{'form.postdata'}=~/^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/) { $helper->{VARS}->{'filename'} = "~$1/$2"; @@ -2191,6 +2192,7 @@ sub printHelper { my $symb = $helper->{VARS}->{'symb'}; my ($map, $id, $url); my $subdir; + my $is_published=0; # True when printing from resource space. # Get the resource name from construction space if ($helper->{VARS}->{'construction'}) { @@ -2205,6 +2207,7 @@ sub printHelper { &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url)); } else { $url = $helper->{VARS}->{'postdata'}; + $is_published=1; # From resource space. } $url = &Apache::lonnet::clutter($url); @@ -2267,7 +2270,7 @@ sub printHelper { "' variable='FINISHPAGE' />"; } - if (($helper->{'VARS'}->{'construction'} ne '1') && + if (($helper->{'VARS'}->{'construction'} ne '1' ) && $helper->{VARS}->{'postdata'} && $helper->{VARS}->{'assignment'}) { @@ -2305,7 +2308,7 @@ 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'} && + if ($perm{'pfo'} && !$is_published && ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { push @{$printChoices}, ['Selected Problems from entire course', 'all_problems', 'ALL_PROBLEMS']; @@ -2333,7 +2336,7 @@ HELPERFRAGMENT ALL_PROBLEMS if ($helper->{VARS}->{'assignment'}) { - push @{$printChoices}, [&mt("Selected Problems from folder [_1] for selected students",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS']; + push @{$printChoices}, [&mt("Selected Problems from folder [_1] for selected people",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS']; push @{$printChoices}, [&mt("Selected Problems from folder [_1] for CODEd assignments",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1']; } @@ -2508,7 +2511,7 @@ CHOOSE_ANON1 if ($helper->{VARS}->{'assignment'}) { - push @{$printChoices}, [&mt("Selected Resources from folder [_1] for selected students",$sequenceTitle), 'resources_for_students', 'CHOOSE_STUDENTS1']; + push @{$printChoices}, [&mt("Selected Resources from folder [_1] for selected people",$sequenceTitle), 'resources_for_students', 'CHOOSE_STUDENTS1']; push @{$printChoices}, [&mt("Selected Resources from folder [_1] for CODEd assignments",$sequenceTitle), 'resources_for_anon', 'CHOOSE_ANON2']; } @@ -2618,14 +2621,15 @@ CHOOSE_ANON2 } # FIXME: That RE should come from a library somewhere. - if ($perm{'pav'} + if (($perm{'pav'} && $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/' && (defined($helper->{'VARS'}->{'construction'}) || (&Apache::lonnet::allowed('bre',$subdir) eq 'F' && $helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/) - ) + )) + && $helper->{VARS}->{'assignment'} eq "" ) { my $pretty_dir = &Apache::lonnet::hreflocation($subdir); @@ -2652,7 +2656,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'} && !$is_published) { push @$printChoices, ["Selected Resources from selected folder in course", 'select_sequences', 'CHOOSE_SEQUENCE']; my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'};