--- loncom/interface/lonhelper.pm 2008/12/13 04:36:28 1.166.2.1
+++ loncom/interface/lonhelper.pm 2008/12/19 20:51:35 1.169
@@ -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.169 2008/12/19 20:51:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3633,7 +3633,7 @@ sub render {
# Print the granularity, depending on the action
if ($vars->{GRANULARITY} eq 'whole_course') {
- $resourceString .= '
'.&mt('for all resources in the course').'';
+ $resourceString .= ''.&mt('for [_1]all resources in the course[_2]','','').'';
if ($vars->{TARGETS} eq 'course') {
$level = 14; # general course, see lonparmset.pm perldoc
} elsif ($vars->{TARGETS} eq 'section') {
@@ -3648,10 +3648,16 @@ sub render {
$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 .= ''.&mt('for the map named [_1]',"$title").'';
+ if (defined($navmap)) {
+ my $res = $navmap->getByMapPc($vars->{RESOURCE_ID});
+ my $title = $res->compTitle();
+ $symb = $res->symb();
+ $resourceString .= ''.&mt('for the map named [_1]',"$title").'';
+ } else {
+ $resourceString .= ''.&mt('for the map ID [_1] (name unavailable)',''.$vars->{RESOURCE_ID}.'').'';
+ &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 @@ sub render {
$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 .= ''.&mt('for the resource named [_1] part [_2]',"$title","$part").'';
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (defined($navmap)) {
+ my $res = $navmap->getById($vars->{RESOURCE_ID});
+ $symb = $res->symb();
+ my $title = $res->compTitle();
+ $resourceString .= ''.&mt('for the resource named [_1] part [_2]',"$title","$part").'';
+ } else {
+ $resourceString .= ''.&mt('for the resource ID [_1] (name unavailable) part [_2]',''.$vars->{RESOURCE_ID}.'',"$part").'';
+ &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') {
@@ -3749,7 +3760,7 @@ sub render {
# Print targets
if ($vars->{TARGETS} eq 'course') {
- $result .= ''.&mt('for all students in course').'';
+ $result .= ''.&mt('for [_1]all students in course[_2]','','').'';
} elsif ($vars->{TARGETS} eq 'section') {
my $section = $vars->{SECTION_NAME};
$result .= ''.&mt('for section [_1]',"$section").'';