[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
foxr
foxr@source.lon-capa.org
Tue, 27 Oct 2009 10:17:18 -0000
foxr Tue Oct 27 10:17:18 2009 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Fix error in printing while browsing resource space .. was calling methods
on an undefined navmap.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.562 loncom/interface/lonprintout.pm:1.563
--- loncom/interface/lonprintout.pm:1.562 Mon Oct 26 10:16:56 2009
+++ loncom/interface/lonprintout.pm Tue Oct 27 10:17:18 2009
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.562 2009/10/26 10:16:56 foxr Exp $
+# $Id: lonprintout.pm,v 1.563 2009/10/27 10:17:18 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3193,22 +3193,23 @@
my $varspostdata = $helper->{VARS}->{'postdata'};
my $varsassignment = $helper->{VARS}->{'assignment'};
my $page_navmap = Apache::lonnavmaps::navmap->new();
- my @page_resources = $page_navmap->retrieveResources($url);
- if(defined($page_resources[0])) {
- $page_ispage = $page_resources[0]->is_page();
- $page_title = $page_resources[0]->title();
- my $resourcesymb = $page_resources[0]->symb();
- my ($pagemap, $pageid, $pageurl) = &Apache::lonnet::decode_symb($symb);
- if ($page_ispage) {
- push @{$printChoices},
- [&mt('Selected [_1]Problems[_2] from page [_3]', '<b>', '</b>', '<b><i>'.$page_title.'</i></b>'),
- 'map_problems_in_page',
- 'CHOOSE_PROBLEMS_PAGE'];
- push @{$printChoices},
- [&mt('Selected [_1]Resources[_2] from page [_3]', '<b>', '</b>', '<b><i>'.$page_title.'</i></b>'),
- 'map_resources_in_page',
- 'CHOOSE_RESOURCES_PAGE'];
- }
+ if (defined($page_navmap)) {
+ my @page_resources = $page_navmap->retrieveResources($url);
+ if(defined($page_resources[0])) {
+ $page_ispage = $page_resources[0]->is_page();
+ $page_title = $page_resources[0]->title();
+ my $resourcesymb = $page_resources[0]->symb();
+ my ($pagemap, $pageid, $pageurl) = &Apache::lonnet::decode_symb($symb);
+ if ($page_ispage) {
+ push @{$printChoices},
+ [&mt('Selected [_1]Problems[_2] from page [_3]', '<b>', '</b>', '<b><i>'.$page_title.'</i></b>'),
+ 'map_problems_in_page',
+ 'CHOOSE_PROBLEMS_PAGE'];
+ push @{$printChoices},
+ [&mt('Selected [_1]Resources[_2] from page [_3]', '<b>', '</b>', '<b><i>'.$page_title.'</i></b>'),
+ 'map_resources_in_page',
+ 'CHOOSE_RESOURCES_PAGE'];
+ }
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE',
'Select Problem(s) to print',
"multichoice='1' toponly='1' addstatus='1' closeallpages='1'",
@@ -3234,7 +3235,8 @@
&Apache::lonxml::xmlparse($r, 'helper', $helperFragment);
- }
+ }
+ }
}
if (($helper->{'VAR'}->{'construction'} ne '1' ) &&