--- loncom/interface/lonannounce.pm 2012/02/22 18:38:29 1.83 +++ loncom/interface/lonannounce.pm 2017/02/16 18:17:49 1.88 @@ -1,7 +1,7 @@ # The LearningOnline Network # Announce # -# $Id: lonannounce.pm,v 1.83 2012/02/22 18:38:29 bisitz Exp $ +# $Id: lonannounce.pm,v 1.88 2017/02/16 18:17:49 damieng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,14 +68,14 @@ sub editfield { $r->print(<$lt{'annon'} $help -
+
$lt{'start'}:$startdateform
$lt{'end'}:$enddateform

-

+

ENDFORM } @@ -117,7 +117,7 @@ sub readcalendar { foreach my $thiskey (keys(%$resourcedata)) { if ($resourcedata->{$thiskey.'.type'}=~/^date/) { my ($course,$middle,$part,$name)= - ($thiskey=~/^(\Q$courseid\E)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); + ($thiskey=~/^(\Q$courseid\E)\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/); my %data = ( 'section' => &mt('All Students')); if ($middle=~/^\[(.*)\]\./) { @@ -228,7 +228,7 @@ sub normalcell { && ($env{'form.pickdate'} ne 'yes') && (!$internalflag)) { $output.=''; + $end.'" />'; $showedcheck{$start.'_'.$end}=1; } } @@ -569,16 +569,30 @@ ENDDOCUMENT } # ------------------------------------------------------------ Process commands if ($serverpost) { - if ($env{'form.serveraction'}) { - foreach my $key (keys(%env)) { - if ($key=~/^form\.postto\_(\w+[\w|-]*)/) { - $r->print( - '
Posting '.$1.': '.&Apache::lonnet::postannounce - ($1,$env{'form.serverannnounce'})); - } - } - } - $r->print('' + 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').'
' .''.&mt('(leave blank to delete announcement)').'
' @@ -761,7 +775,7 @@ ENDDOCUMENT # ----------------------------------------------------------------- Check marks undef(%showedcheck); # --------------------------------------------------------------- Remove button - if ($allowed) { $r->print('
'. + if ($allowed) { $r->print('
'. &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'
'); } $r->print('

'. '