[LON-CAPA-cvs] cvs: loncom(version_2_8_X) /interface lonprintout.pm
raeburn
raeburn@source.lon-capa.org
Sun, 21 Dec 2008 16:29:56 -0000
raeburn Sun Dec 21 16:29:56 2008 EDT
Modified files: (Branch: version_2_8_X)
/loncom/interface lonprintout.pm
Log:
- Backport 1.547.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.545.2.1 loncom/interface/lonprintout.pm:1.545.2.2
--- loncom/interface/lonprintout.pm:1.545.2.1 Mon Dec 15 23:12:26 2008
+++ loncom/interface/lonprintout.pm Sun Dec 21 16:29:56 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.545.2.1 2008/12/15 23:12:26 raeburn Exp $
+# $Id: lonprintout.pm,v 1.545.2.2 2008/12/21 16:29:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2486,17 +2486,23 @@
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 of the items below are in folders set to be randomly ordered. However, when printing the contents of these folders, they will be printed in the original order for all students, not the randomized order.";
- }
- }
- if ($message) {
- return '<message type="warning">'.$message.'</message>';
+ if (defined($navmap)) {
+ 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 of the items below are in folders set to be randomly ordered. However, when printing the contents of these folders, they will be printed in the original order for all students, not the randomized order.";
+ }
+ }
+ if ($message) {
+ return '<message type="warning">'.$message.'</message>';
+ }
+ } else {
+ &Apache::lonnet::logthis('Retrieval of resources to check for folders set to be randomly ordered failed - could not create navmap object');
+ $message = "Retrieval of information about ordering of resources failed.";
+ return '<message type="warning">'.$message.'</message>';
}
return;
}