--- loncom/interface/lonprintout.pm 2007/10/02 00:30:57 1.506.2.1 +++ loncom/interface/lonprintout.pm 2007/08/29 00:55:37 1.507 @@ -2,7 +2,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.506.2.1 2007/10/02 00:30:57 albertel Exp $ +# $Id: lonprintout.pm,v 1.507 2007/08/29 00:55:37 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2222,6 +2222,28 @@ sub init_perm { } } +sub get_randomly_ordered_warning { + my ($helper,$map) = @_; + + my $message; + + my $postdata = $env{'form.postdata'} || $helper->{VARS}{'postdata'}; + my $navmap = Apache::lonnavmaps::navmap->new(); + my $res = $navmap->getResourceByUrl($map); + if ($res) { + my $func = + sub { return ($_[0]->is_map() && $_[0]->randomorder); }; + my @matches = $navmap->retrieveResources($res, $func,1,1,1); + if (@matches) { + $message = "Some folders are set to be randomly ordered. When printing the contents of these folders will be printed in the original order for all students."; + } + } + if ($message) { + return ''.$message.''; + } + return; +} + sub printHelper { my $r = shift; @@ -2448,8 +2470,8 @@ HELPERFRAGMENT if ($perm{'pfo'} && !$is_published && ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { - push @{$printChoices}, [&mtn('Selected Problems from entire course'), 'all_problems', 'ALL_PROBLEMS']; - push @{$printChoices}, [&mtn('Selected Resources from entire course'), 'all_resources', 'ALL_RESOURCES']; + 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', < Problems from folder [_1] for CODEd assignments",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1']; } + my $randomly_ordered_warning = + &get_randomly_ordered_warning($helper,$map); + # resource_selector will hold a few states that: # - Allow resources to be selected for printing. # - Determine pagination between assignments. @@ -2488,6 +2513,8 @@ ALL_PROBLEMS # my $resource_selector=< + $randomly_ordered_warning + PRINT_FORMATTING
Select resources for the assignment
+ $randomly_ordered_warning + PRINT_FORMATTING
Select resources for the assignment
{VARS}->{'construction'} && !$is_published) { - push @$printChoices, [&mtn("Selected Resources from selected folder in course"), + push @$printChoices, ["Selected Resources from selected folder in course", 'select_sequences', 'CHOOSE_SEQUENCE']; my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'}; #Escape apostrophes and backslashes for Perl