--- loncom/interface/lonmsgdisplay.pm 2007/05/03 12:13:35 1.75 +++ loncom/interface/lonmsgdisplay.pm 2007/07/17 18:35:54 1.81 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.75 2007/05/03 12:13:35 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.81 2007/07/17 18:35:54 albertel 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 '') { @@ -885,8 +892,7 @@ sub get_course_desc { sub disall { my ($r,$folder,$msgstatus)=@_; - my %saveable = ('folder' => 'scalar', - 'msgstatus' => 'scalar', + my %saveable = ('msgstatus' => 'scalar', 'sortedby' => 'scalar', 'interdis' => 'scalar', ); @@ -1217,6 +1223,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 +1335,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 +1417,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,22 +1496,30 @@ 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:'); my $bcc = &mt('Bcc:'); my $output = <<"ENDADD"; $lt->{'ad'} :
username:domain,username:domain, ... - $cc -
-$bcc $cc +
+$bcc ENDADD return $output; } @@ -1494,7 +1537,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 +2078,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 +2127,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 +2150,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 +2591,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; @@ -2645,14 +2709,15 @@ sub handler { my $replying = 0; foreach my $envkey (keys(%env)) { if ($envkey=~/^form\.(rep)?rec\_(.*)$/) { + my $repchk = $1; my $msgid = $2; $r->print(''.&mt('Confirming Receipt').': '); my $result = &Apache::lonmsg::user_crit_received($msgid); if ($result =~ /trans:\s+ok/) { &statuschange($msgid,'read'); } - $r->print($result.'
'); - if ($1 eq 'rep') { + $r->print($result.'
'); + if ($repchk eq 'rep') { &compout($r,'','','',$msgid); $replying = 1; }
'.&mt('Functions').':'.&mt('Reply').'
'.&mt('Functions').':'.&mt('Reply').''.&mt('Forward').''.&mt('Mark Unread').'