--- loncom/interface/lonmsgdisplay.pm 2007/05/05 02:50:27 1.77 +++ loncom/interface/lonmsgdisplay.pm 2007/05/05 03:14:21 1.78 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.77 2007/05/05 02:50:27 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.78 2007/05/05 03:14:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -738,19 +738,26 @@ $content{'sendername'}.':'. '
'.
               &Apache::lontexconvert::msgtexconverted($content{'message'}).
             '
'; - my $rec_button = &mt('Move to Inbox'); - my $reprec_button = &mt('Move to Inbox/Compose reply'); + my ($rec_button,$reprec_button); + $rec_button = &mt('Move to Inbox'); + if (!$content{'noreplies'}) { + $reprec_button = &mt('Move to Inbox/Compose reply'); + } if ($content{'sendback'}) { $rec_button = &mt('Confirm Receipt'); - $reprec_button = &mt('Confirm Receipt and Reply'); + if (!$content{'noreplies'}) { + $reprec_button = &mt('Confirm Receipt and Reply'); + } $result .= &mt('You have to confirm that you have received this message before you can view other pages. After confirmation, this message will be moved to your regular inbox'); } else { - $result .= &mt('Click one of the buttons below to move the message to your inbox').' '.&mt('Access to other pages will be prevented until you have done this.'); + $result .= &mt('Access to other pages will be prevented until you have moved the message to your inbox.'); } $result .= '
'. - ''. - ''; + if (!$content{'noreplies'}) { + $result .= ''; + } } # Check to see if there were any messages. if ($result eq '') { @@ -1217,6 +1224,8 @@ will be forwarded to the recipient(s) yo my %lt=&Apache::lonlocal::texthash('us' => 'Username', 'do' => 'Domain', 'ad' => 'Additional Recipients', + 'rt' => 'Reply to', + 'ar' => 'Allow replies', 'sb' => 'Subject', 'ca' => 'Cancel', 'ma' => 'Mail', @@ -1327,14 +1336,36 @@ ENDREPSCRIPT } if (($broadcast ne 'group') && ($broadcast ne 'upload')) { if ($replying) { - $r->print(''.&mt('Replying to').' '. - &Apache::loncommon::aboutmewrapper( + if ($content{'noreplies'}) { + $r->print(''.&mt('This message was designated by the sender not to allow replies.').''); + return; + } + $r->print(''.&mt('Replying to').' '); + if ($content{'replytoaddr'}) { + my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'}); + if ($replytoname ne '' && $replytodom ne '') { + $r->print(&Apache::loncommon::plainname($replytoname, + $replytodom).' ('.$replytoname.':'. + $replytodom.')'); + $r->print(''. + ''); + + } else { + $r->print(&mt('The sender did not designate a reply to address for this message.').''); + return; + } + } else { + $r->print(&Apache::loncommon::aboutmewrapper( &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. $content{'sendername'}.':'. - $content{'senderdomain'}.')'. - ''. - ''. - ''); + $content{'senderdomain'}.')'); + $r->print(''. + ''); + } if ($content{'recipid'}) { my @ccs = &retrieve_cc_recips('replying',%content); if (@ccs > 0) { @@ -1387,6 +1418,11 @@ $latexHelp. } elsif ($broadcast ne 'upload') { $subj_size = '50'; $r->print(&additional_rec_row(\%lt)); + if (&Apache::lonnet::allowed('srm',$env{'request.course.id'}) + || &Apache::lonnet::allowed('srm',$env{'request.course.id'}. + '/'.$env{'request.course.sec'})) { + $r->print(&reply_to_row(\%lt)); + } $r->print(&msg_subject_row($dissub,\%lt,$subj_size)); $r->print(<<"ENDCOMP"); @@ -1461,13 +1497,21 @@ sub recipient_input_row { &Apache::loncommon::selectstudent_link('compemail','recuname', 'recdomain'); my $output = <<"ENDREC"; -$lt{'us'}:$selectlink -$lt{'do'}: -$domform +$lt{'us'}:  $lt{'do'}: $domform  $selectlink ENDREC return $output; } +sub reply_to_row { + my ($lt) = @_; + my $radioyes = &mt('Yes'); + my $radiono = &mt('No'); + my $output = <<"ENDREP"; +$lt->{'ar'}:      $lt->{'rt'}:  +ENDREP + return $output; +} + sub additional_rec_row { my ($lt) = @_; my $cc = &mt('Cc:'); @@ -1475,8 +1519,8 @@ sub additional_rec_row { my $output = <<"ENDADD"; $lt->{'ad'} :
username:domain,username:domain, ...  $cc -
-$bcc +
+$bcc ENDADD return $output; } @@ -1494,7 +1538,7 @@ sub submit_button_row { sub msg_subject_row { my ($dissub,$lt,$subj_size,$extra) = @_; - my $output = ''.$lt->{'sb'}.':'.$lt->{'sb'}.': '.$extra. ''; return $output; @@ -2035,10 +2079,12 @@ sub displaymessage { &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'}); my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'}); # Functions - $r->print(''. - ''. - ''); + if (!$content{'noreplies'}) { + $r->print(''); + } + $r->print(''. ''. @@ -2082,7 +2128,7 @@ sub displaymessage { &Apache::loncommon::plainname($content{'recuser'}[$i], $content{'recdomain'}[$i]), $content{'recuser'}[$i],$content{'recdomain'}[$i]). - ' ('.$content{'recuser'}[$i].' at '.$content{'recdomain'}[$i].') '; + ' ('.$content{'recuser'}[$i].' '.&mt('at').' '.$content{'recdomain'}[$i].') '; } } $tolist = join(', ',@recipients); @@ -2105,16 +2151,35 @@ sub displaymessage { $r->print('
'.&mt('Subject').': '.$content{'subject'}); if ($folder eq 'sent') { $r->print('
'.&mt('To').': '.$tolist); + if ($content{'replytoaddr'}) { + my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'}); + if ($replytoname ne '' && $replytodom ne '') { + $r->print('
'.&mt('Reply To').': '. + $replytoname.' '.&mt('at').' '.$replytodom); + } + } } else { $r->print('
'.&mt('From').': '. &Apache::loncommon::aboutmewrapper( &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}), - $content{'sendername'},$content{'senderdomain'}).' ('. - $content{'sendername'}.' at '. - $content{'senderdomain'}.') '); - if ($cclist) { - $r->print('
'.&mt('Cc').': '.$cclist); - } + $content{'sendername'},$content{'senderdomain'})); + if ($content{'noreplies'}) { + $r->print(' ('.&mt('No replies to sender').')'); + } else { + if ($content{'replytoaddr'}) { + my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'}); + if ($replytoname ne '' && $replytodom ne '') { + $r->print('
'.&mt('Reply To').': '. + $replytoname.' '.&mt('at').' '.$replytodom); + } + } else { + $r->print(' ('.$content{'sendername'}.' '&mt('at').' '. + $content{'senderdomain'}.') '); + } + if ($cclist) { + $r->print('
'.&mt('Cc').': '.$cclist); + } + } } if ($content{'courseid'}) { $r->print('
'.&mt($crstype).': '.$courseinfo{'description'}); @@ -2527,7 +2592,7 @@ sub sendoffmail { \@recudoms); } } else { - &Apache::lonnet::logthis('Failed to create record of critical, broadcast or archived message in '.$env{'course.'.$env{'request.course.id'}.'.num'}.' at '.$env{'course.'.$env{'request.course.id'}.'.domain'}.' - no msgid generated'); + &Apache::lonnet::logthis('Failed to create record of critical, broadcast or archived message in '.$env{'course.'.$env{'request.course.id'}.'.num'}.' '&mt('at').' '.$env{'course.'.$env{'request.course.id'}.'.domain'}.' - no msgid generated'); } } else { my $stamp = time;
'.&mt('Functions').':'.&mt('Reply').'
'.&mt('Functions').':'.&mt('Reply').''.&mt('Forward').''.&mt('Mark Unread').'