--- loncom/interface/longroup.pm 2008/05/01 16:26:29 1.16 +++ loncom/interface/longroup.pm 2008/12/19 20:10:11 1.17 @@ -643,38 +643,42 @@ sub get_bbfolder_url { sub get_group_bbinfo { my ($cdom,$cnum,$group,$boardurl) = @_; + my @groupboards = (); + my %boardshash = (); my $navmap = Apache::lonnavmaps::navmap->new(); - my @groupboards; - my %boardshash; - my $grpbbmap = &get_bbfolder_url($cdom,$cnum,$group); - if ($grpbbmap) { - my $bbfolderres = $navmap->getResourceByUrl($grpbbmap); - if ($bbfolderres) { - my @boards = $navmap->retrieveResources($bbfolderres,undef,0,0); - foreach my $res (@boards) { - my $url = $res->src(); - if ($url =~ m|^(/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard)|) { - if ($boardurl) { - if ($boardurl =~ /^\Q$1\E/) { - push(@groupboards,$res->symb()); - $boardshash{$res->symb()} = { + if (defined($navmap)) { + my $grpbbmap = &get_bbfolder_url($cdom,$cnum,$group); + if ($grpbbmap) { + my $bbfolderres = $navmap->getResourceByUrl($grpbbmap); + if ($bbfolderres) { + my @boards = $navmap->retrieveResources($bbfolderres,undef,0,0); + foreach my $res (@boards) { + my $url = $res->src(); + if ($url =~ m|^(/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard)|) { + if ($boardurl) { + if ($boardurl =~ /^\Q$1\E/) { + push(@groupboards,$res->symb()); + $boardshash{$res->symb()} = { title => $res->title(), url => $res->src(), - }; - last; - } - } else { - push(@groupboards,$res->symb()); - $boardshash{$res->symb()} = { + }; + last; + } + } else { + push(@groupboards,$res->symb()); + $boardshash{$res->symb()} = { title => $res->title(), url => $res->src(), - }; + }; + } } } } } + undef($navmap); + } else { + &Apache::lonnet::logthis('Retrieval of group boards failed - could not create navmap object for group: '.$group.' in course: '.$cdom.':'.$cnum); } - undef($navmap); return (\@groupboards,\%boardshash); }