--- loncom/interface/groupboards.pm 2006/06/30 08:14:31 1.1 +++ loncom/interface/groupboards.pm 2006/06/30 14:08:35 1.2 @@ -25,7 +25,7 @@ # package Apache::groupboards; - + use strict; use Apache::Constants qw(:common :http); use Apache::loncommon; @@ -73,9 +73,8 @@ sub handler { if (defined($env{'form.newbul'})) { if (($can_create) || (&Apache::lonnet::allowed('mdg',$env{'request.course.id'}))) { $r->print(&Apache::loncommon::start_page($bodytitle)); - my ($outcome,$symb,$newurl,$bbtitle) = &create_board($cdom,$cnum, - $group, - $env{'form.newbul'}); + my ($outcome,$symb,$newurl,$bbtitle) = + &create_board($cdom,$cnum,$group,$env{'form.newbul'}); if ($outcome eq 'ok') { my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); $r->print(&mt('The new discussion board was added successfully.
')); @@ -88,7 +87,7 @@ sub handler { &mt('View all group discussion boards'). ''); } else { - $r->print(&mt('There was a problem creating the new discussion board - [_1]',$outcome).'
'. + $r->print(&mt('There was a problem creating the new discussion board - [_1]',''.$outcome.'').'
'. &mt('Return to discussion boards').''); } $r->print(&Apache::loncommon::end_page()); @@ -125,14 +124,12 @@ function makebulboard() { my @boards = $navmap->retrieveResources($bbfolderres,undef,0,0); foreach my $res (@boards) { my $url = $res->src(); - my $title = $res->title(); - my $symb = $res->symb(); if ($url =~ m|^/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard|) { - push(@groupboards,$symb); - %{$boards{$symb}} = ( - title => $title, - url => $url, - ); + push(@groupboards,$res->symb()); + $boards{$res->symb()} = { + title => $res->title(), + url => $res->src(), + }; } } } @@ -148,7 +145,7 @@ function makebulboard() { } if (@groupboards) { foreach my $board (@groupboards) { - $r->print(''.$boards{$board}{'title'}.'
'); + $r->print(''.$boards{$board}{'title'}.'
'); } } else { $r->print(&mt('There are currently no discussion boards in this [_1].', @@ -171,19 +168,19 @@ sub create_board { my $newidx=&Apache::lonratedt::getresidx($newurl); $Apache::lonratedt::resources[$newidx]=$bbtitle.':'.$newurl. ':false:normal:res'; - $Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; + push(@Apache::lonratedt::order,$newidx); my ($errtext,$fatal)=&Apache::lonratedt::storemap($allbbsmap,1); if ($fatal) { - $outcome = "Error: failed to store discussion boards map - $errtext\n"; + $outcome = "error: failed to store discussion boards map - $errtext\n"; } else { $outcome = 'ok'; $symb = &Apache::lonnet::encode_symb($allbbsmap,$newidx,$newurl); } } else { - $outcome = "Error: failed to read all discussion boards map - $errtext\n"; + $outcome = "error: failed to read all discussion boards map - $errtext\n"; } } else { - $outcome = 'Error: discussion boards folder absent, '. + $outcome = 'error: discussion boards folder absent, '. 'or in unexpected location - '.$allbbsmap."\n"; } return ($outcome,$symb,$newurl,$bbtitle);