[LON-CAPA-cvs] cvs: loncom(version_2_8_X) /interface lonhelper.pm
raeburn
raeburn@source.lon-capa.org
Sun, 21 Dec 2008 16:24:49 -0000
raeburn Sun Dec 21 16:24:49 2008 EDT
Modified files: (Branch: version_2_8_X)
/loncom/interface lonhelper.pm
Log:
- Backport 1.169.
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.166.2.1 loncom/interface/lonhelper.pm:1.166.2.2
--- loncom/interface/lonhelper.pm:1.166.2.1 Sat Dec 13 04:36:28 2008
+++ loncom/interface/lonhelper.pm Sun Dec 21 16:24:49 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.166.2.1 2008/12/13 04:36:28 raeburn Exp $
+# $Id: lonhelper.pm,v 1.166.2.2 2008/12/21 16:24:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3648,10 +3648,16 @@
$paramlevel = 'general';
} elsif ($vars->{GRANULARITY} eq 'map') {
my $navmap = Apache::lonnavmaps::navmap->new();
- my $res = $navmap->getByMapPc($vars->{RESOURCE_ID});
- my $title = $res->compTitle();
- $symb = $res->symb();
- $resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>';
+ if (defined($navmap)) {
+ my $res = $navmap->getByMapPc($vars->{RESOURCE_ID});
+ my $title = $res->compTitle();
+ $symb = $res->symb();
+ $resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>';
+ } else {
+ $resourceString .= '<li>'.&mt('for the map ID [_1] (name unavailable)','<b>'.$vars->{RESOURCE_ID}.'</b>').'</li>';
+ &Apache::lonnet::logthis('Retrieval of map title failed in lonhelper.pm - could not create navmap object for course.');
+
+ }
if ($vars->{TARGETS} eq 'course') {
$level = 13; # general course, see lonparmset.pm perldoc
} elsif ($vars->{TARGETS} eq 'section') {
@@ -3664,13 +3670,18 @@
$affectedResourceId = $vars->{RESOURCE_ID};
$paramlevel = 'map';
} else {
- my $navmap = Apache::lonnavmaps::navmap->new();
- my $res = $navmap->getById($vars->{RESOURCE_ID});
my $part = $vars->{RESOURCE_ID_part};
if ($part ne 'All Parts' && $part) { $parm_name=~s/^0/$part/; } else { $part=&mt('All Parts'); }
- $symb = $res->symb();
- my $title = $res->compTitle();
- $resourceString .= '<li>'.&mt('for the resource named [_1] part [_2]',"<b>$title</b>","<b>$part</b>").'</li>';
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (defined($navmap)) {
+ my $res = $navmap->getById($vars->{RESOURCE_ID});
+ $symb = $res->symb();
+ my $title = $res->compTitle();
+ $resourceString .= '<li>'.&mt('for the resource named [_1] part [_2]',"<b>$title</b>","<b>$part</b>").'</li>';
+ } else {
+ $resourceString .= '<li>'.&mt('for the resource ID [_1] (name unavailable) part [_2]','<b>'.$vars->{RESOURCE_ID}.'</b>',"<b>$part</b>").'</li>';
+ &Apache::lonnet::logthis('Retrieval of resource title failed in lonhelper.pm - could not create navmap object for course.');
+ }
if ($vars->{TARGETS} eq 'course') {
$level = 10; # general course, see lonparmset.pm perldoc
} elsif ($vars->{TARGETS} eq 'section') {