[LON-CAPA-cvs] cvs: loncom /interface longroup.pm
raeburn
raeburn@source.lon-capa.org
Fri, 19 Dec 2008 20:10:12 -0000
raeburn Fri Dec 19 20:10:12 2008 EDT
Modified files:
/loncom/interface longroup.pm
Log:
- Check that navmap object could be created to avoid ISE.
- Display error message and log to lonnet.log if navmap object undefined.
Index: loncom/interface/longroup.pm
diff -u loncom/interface/longroup.pm:1.16 loncom/interface/longroup.pm:1.17
--- loncom/interface/longroup.pm:1.16 Thu May 1 16:26:29 2008
+++ loncom/interface/longroup.pm Fri Dec 19 20:10:11 2008
@@ -643,38 +643,42 @@
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);
}