--- loncom/interface/lonannounce.pm 2010/02/13 16:47:38 1.81 +++ loncom/interface/lonannounce.pm 2012/08/21 14:36:27 1.85 @@ -1,7 +1,7 @@ # The LearningOnline Network # Announce # -# $Id: lonannounce.pm,v 1.81 2010/02/13 16:47:38 raeburn Exp $ +# $Id: lonannounce.pm,v 1.85 2012/08/21 14:36:27 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,7 +62,7 @@ sub editfield { 'end' => 'Ending date', 'incrss' => 'Include in course RSS newsfeed'); if ($crstype eq 'Community') { - $lt{'anon'} = &mt('Community Announcements'); + $lt{'annon'} = &mt('Community Announcements'); $lt{'incrss'} = &mt('Include in community RSS newsfeed'); } @@ -569,15 +569,29 @@ ENDDOCUMENT } # ------------------------------------------------------------ Process commands if ($serverpost) { - if ($env{'form.serveraction'}) { - foreach my $key (keys(%env)) { - if ($key=~/^form\.postto\_(\w+)/) { - $r->print( - '
Posting '.$1.': '.&Apache::lonnet::postannounce - ($1,$env{'form.serverannnounce'})); - } - } - } + if ($env{'form.serveraction'}) { + my $rc; + my $message; + foreach my $key (keys(%env)) { + if ($key=~/^form\.postto\_(\w+[\w\-]*)/) { + $rc = &Apache::lonnet::postannounce + ($1,$env{'form.serverannnounce'}); + if ($rc eq 'ok') { + $message .= + &Apache::lonhtmlcommon::confirm_success( + &mt('Announcement posted to [_1]',$1)) + .'
'; + } else { + $message .= + &Apache::lonhtmlcommon::confirm_success( + &mt('Posting announcement to [_1] failed: [_2]' + ,$1,$rc), 1) + .'
'; + } + } + } + $r->print(&Apache::loncommon::confirmwrapper($message)); + } $r->print('
' .'

'.&mt('Post Server Announcements').'

' .&mt('Post announcements to the system login and roles screen').'
'