--- loncom/interface/lonmsgdisplay.pm 2007/05/01 18:40:57 1.71 +++ loncom/interface/lonmsgdisplay.pm 2008/06/06 17:46:15 1.87 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.71 2007/05/01 18:40:57 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.87 2008/06/06 17:46:15 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -390,6 +390,9 @@ sub renamefolder { if ($env{'form.renamed'} eq '') { return &mt('The folder "[_1]" may not be renamed to "[_2]" as the new name you requested is an invalid name.',$folder,$newname); } + if (defined($permfolders{$folder})) { + return &mt('The folder "[_1]" may not be renamed as it is a folder provided by the system.',$folder); + } if (defined($permfolders{$newname})) { return &mt('The folder "[_1]" may not be renamed to "[_2]" as the new name you requested is reserved for folders provided automatically by the system.',$folder,$newname); } @@ -510,22 +513,34 @@ sub discourse { $result .= ''."\n"; - $result .= &Apache::lonselstudent::render_student_list($current_members, - "compemail", - "current", - \%defaultUsers, - 1,"selectedusers",1); - - $result .= &Apache::lonselstudent::render_student_list($expired_members, - "compemail", - "expired", - \%defaultUsers, - 1, "selectedusers",0); - $result .= &Apache::lonselstudent::render_student_list($future_members, - "compemail", - "future", - \%defaultUsers, - 1, "selectedusers", 0); + my $tmptext; + if ($tmptext = &Apache::lonselstudent::render_student_list($current_members, + "compemail", + "current", + \%defaultUsers, + 1,"selectedusers",1) + ) { + $result .= '

'.&mt('Course members with current access').'

'; + $result .= $tmptext; + } + if ($tmptext = &Apache::lonselstudent::render_student_list($expired_members, + "compemail", + "expired", + \%defaultUsers, + 1, "selectedusers",0) + ) { + $result .= '

'.&mt('Course members with expired access').'

'; + $result .= $tmptext; + } + if ($tmptext = &Apache::lonselstudent::render_student_list($future_members, + "compemail", + "future", + \%defaultUsers, + 1, "selectedusers", 0) + ) { + $result .= '

'.&mt('Course members with future access').'

'; + $result .= $tmptext; + } return $result; } @@ -552,7 +567,7 @@ sub disgroup { 'recipients to select.'); return $result; } else { - $result = &mt('Select message recipients from the group members listed below.
'); + $result = &mt('Select message recipients from the group members listed below.').'
'; my %Sortby = ( active => {}, previous => {}, @@ -734,12 +749,27 @@ $content{'sendername'}.':'. '
'.&mt('Subject').': '.$content{'subject'}. '
'.
               &Apache::lontexconvert::msgtexconverted($content{'message'}).
-            '
'. -&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox'). - '
'. - ''. - ''; + '
'; + 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'); + 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('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 '') { @@ -874,8 +904,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', ); @@ -912,16 +941,6 @@ sub disfolder { +ENDREPSCRIPT } my $citation=&displayresource(%content); my ($can_grp_broadcast,$viewgrps,$editgrps); @@ -1310,14 +1347,52 @@ will be forwarded to the recipient(s) yo } 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) { + my $replyall = qq| + + +    + + +|; + my $cclist = join(' ',@ccs); + $r->print(''.&mt('Reply to other recipients').':
'.$replyall.''.$cclist.''); + } + } } else { $r->print(&recipient_input_row($defdom,%lt)); } @@ -1354,12 +1429,20 @@ $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"); $latexHelp


+ +$attachrow +

+
$dispcrit $disbase ENDCOMP @@ -1428,19 +1511,31 @@ 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 $exmpl = &mt('username:domain,username:domain,...'); my $output = <<"ENDADD"; -$lt->{'ad'}:
username:domain,username:domain, ... - - +$lt->{'ad'} :
($exmpl) + $cc +
+$bcc ENDADD return $output; } @@ -1458,7 +1553,7 @@ sub submit_button_row { sub msg_subject_row { my ($dissub,$lt,$subj_size,$extra) = @_; - my $output = ''.$lt->{'sb'}.':'.$lt->{'sb'}.': '.$extra. ''; return $output; @@ -1680,8 +1775,8 @@ sub examblock { 'cbds' => 'Communication blocking during scheduled exams', 'desc' => "You can use communication blocking to prevent $usertype enrolled in this course from displaying LON-CAPA messages sent by other $usertype during an online exam. As blocking of communication could potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA course, please be careful that you select the correct start and end times for your scheduled exam when setting or modifying these parameters.", 'mecb' => 'Modify existing communication blocking periods', - 'ncbc' => 'No communication blocks currently stored', - 'stor' => 'Store', + 'ncbc' => 'No communication blocks currently saved', + 'stor' => 'Save', ); my %ltext = &Apache::lonlocal::texthash( @@ -1984,7 +2079,6 @@ sub displaymessage { } my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]); my %content=&Apache::lonmsg::unpackagemsg($message{$msgid}); - my $counter=0; $r->print('
');
     my $escmsgid=&escape($msgid);
@@ -1995,15 +2089,33 @@ sub displaymessage {
 	$counter++;
     }
     $r->print('
'); + + my $see_anonymous; + my $from_student = 0; + if ($env{'request.course.id'} eq $content{'courseid'}) { + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $username = $content{'sendername'}.':'.$content{'senderdomain'}; + my %classlist_entry = + &Apache::lonnet::get('classlist',[$username],$cdom,$cnum); + if (exists($classlist_entry{$username})) { + $from_student = 1; + $see_anonymous = &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')); + } + } + + my $number_of_messages = scalar(@messages); #subtract 1 for last index # start output &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(''. ''. @@ -2027,6 +2139,7 @@ sub displaymessage { $symb=&Apache::lonnet::symbread($content{'baseurl'}); } if ($env{'user.adv'}) { + my $adv_actions; $r->print('
'.&mt('Functions').':'.&mt('Reply').'
'.&mt('Functions').':'.&mt('Reply').''.&mt('Forward').''.&mt('Mark Unread').'
'); if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) { $r->print(''); @@ -2039,16 +2152,22 @@ sub displaymessage { } $r->print('
'.&mt('Currently available actions (will open extra window)').':'.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').'
'); } - my $tolist; - my @recipients = (); - for (my $i=0; $i<@{$content{'recuser'}}; $i++) { - $recipients[$i] = &Apache::loncommon::aboutmewrapper( - &Apache::loncommon::plainname($content{'recuser'}[$i], + my ($tolist,$cclist); + my (@recipients,@ccs); + if (ref($content{'recuser'}) eq 'ARRAY') { + for (my $i=0; $i<@{$content{'recuser'}}; $i++) { + $recipients[$i] = &Apache::loncommon::aboutmewrapper( + &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],$content{'recdomain'}[$i]). + ' ('.$content{'recuser'}[$i].' '.&mt('at').' '.$content{'recdomain'}[$i].') '; + } } $tolist = join(', ',@recipients); + if ($content{'recipid'}) { + @ccs = &retrieve_cc_recips('display',%content); + $cclist = join(', ',@ccs); + } my ($restitle,$baseurl,$refers_to); if (defined($content{'resource_title'})) { $restitle = $content{'resource_title'}; @@ -2060,18 +2179,50 @@ sub displaymessage { if (defined($content{'baseurl'})) { $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'}); } - $r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'})); - $r->print('
'.&mt('Subject').': '.$content{'subject'}. - ($folder ne 'sent'?'
'.&mt('From').': '. + if ($from_student && $see_anonymous ) { + $r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'})); + } + + $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'}.') ':'
'.&mt('To').': '. - $tolist). - ($content{'courseid'}?'
'.&mt($crstype).': '.$courseinfo{'description'}. - ($content{'coursesec'}?' ('.&mt('Section').': '.$content{'coursesec'}.')':''):''). - '
'.&mt('Time').': '.$content{'time'}); + $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'}); + if ($content{'coursesec'}) { + $r->print(' ('.&mt('Section').': '.$content{'coursesec'}.')'); + } + } + $r->print('
'.&mt('Time').': '.$content{'time'}); if ($baseurl) { if (defined($content{'courseid'}) && defined($env{'request.course.id'})) { if ($content{'courseid'} eq $env{'request.course.id'}) { @@ -2124,6 +2275,38 @@ sub displaymessage { return; } +sub retrieve_cc_recips { + my ($context,%content) = @_; + my %reciphash = + &Apache::lonnet::get('nohist_emailrecip',[$content{'recipid'}], + $content{'senderdomain'},$content{'sendername'}); + my $recipinfo = $reciphash{$content{'recipid'}}; + my @ccs; + if (ref($recipinfo) eq 'HASH') { + if (ref($recipinfo->{'cc'}) eq 'HASH') { + foreach my $cc (sort(keys(%{$recipinfo->{'cc'}}))) { + my ($ccname,$ccdom) = split(/:/,$cc); + if (!(($ccname eq $env{'user.name'}) && + ($ccdom eq $env{'user.domain'}))) { + my $showcc =''; + if ($context eq 'replying') { + $showcc = ''; + } + $showcc .= ''; + push(@ccs,$showcc); + } + } + } + } + return @ccs; +} + # =========================================================== Show the citation sub displayresource { @@ -2208,10 +2391,10 @@ sub storedcommentlisting { my ($r)=@_; my %msgs=&Apache::lonnet::dump('nohist_stored_comments',undef,undef, '^'.&escape(&escape($env{'form.showcommentbaseurl'}))); - $r->print(&Apache::loncommon::start_page('Stored Comment Listing',undef, + $r->print(&Apache::loncommon::start_page('Saved Comment Listing',undef, {'onlybody' => 1})); if ((keys %msgs)[0]=~/^error\:/) { - $r->print(&mt('No stored comments yet.')); + $r->print(&mt('No saved comments yet.')); } else { my $found=0; foreach my $key (sort(keys(%msgs))) { @@ -2219,7 +2402,7 @@ sub storedcommentlisting { $found=1; } unless ($found) { - $r->print(&mt('No stored comments yet for this resource.')); + $r->print(&mt('No saved comments yet for this resource.')); } } } @@ -2233,6 +2416,8 @@ sub sendoffmail { my %msg_status; my $numsent = 0; my $nosentstore = 1; + my $attachmenturl; + my $now = time; my ($cdom,$cnum,$group); if (exists($env{'form.group'})) { $group = $env{'form.group'}; @@ -2255,10 +2440,13 @@ sub sendoffmail { if ($env{'form.forwid'}) { my $msgid=$env{'form.forwid'}; my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]); - %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1); + %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1,1); &statuschange($msgid,'forwarded',$folder); - $env{'form.message'}.="\n\n-- Forwarded message --\n\n". - $content{'message'}; + if ($content{'attachmenturl'} ne '') { + $attachmenturl = $content{'attachmenturl'}; + } + $env{'form.message'} .= "\n\n-- Forwarded message --\n\n". + $content{'message'}; } if ($env{'form.replyid'}) { my $msgid=$env{'form.replyid'}; @@ -2271,7 +2459,7 @@ sub sendoffmail { &Apache::loncommon::get_env_multiple('form.selectedusers_forminput'); my $mode = $env{'form.sendmode'}; - my %toaddr; + my (%toaddr,$cc,$bcc); if (@to) { foreach my $dest (@to) { my ($user,$domain) = split(/:/, $dest); @@ -2301,17 +2489,38 @@ sub sendoffmail { } else { if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) { $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; + $cc->{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; } } - if ($env{'form.additionalrec'}) { - foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec'})) { + if ($env{'form.additionalrec_cc'}) { + foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_cc'})) { my ($auname,$audom)=split(/:/,$rec); if (($auname ne "") && ($audom ne "")) { - $toaddr{$auname.':'.$audom}=''; + $toaddr{$auname.':'.$audom}=''; + $cc->{$auname.':'.$audom}=''; } } } - + if ($env{'form.additionalrec_bcc'}) { + foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_bcc'})) { + my ($auname,$audom)=split(/:/,$rec); + if (($auname ne "") && ($audom ne "")) { + $toaddr{$auname.':'.$audom}=''; + $bcc->{$auname.':'.$audom}=''; + } + } + } + if ($env{'form.replying_cc'}) { + my @ccreplies = + &Apache::loncommon::get_env_multiple('form.replying_cc'); + foreach my $rec (@ccreplies) { + my ($auname,$audom)=split(/:/,$rec); + if (($auname ne "") && ($audom ne "")) { + $toaddr{$auname.':'.$audom}=''; + $cc->{$auname.':'.$audom}=''; + } + } + } my $savemsg; my $msgtype; my %sentmessage; @@ -2327,12 +2536,35 @@ sub sendoffmail { } else { $savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); } + my %reciphash = ( + cc => $cc, + bcc => $bcc, + ); + my ($recipid,$recipstatus) = + &Apache::lonmsg::store_recipients($msgsubj,$env{'user.name'}, + $env{'user.domain'},\%reciphash); + if ($recipstatus ne 'ok') { + &Apache::lonnet::logthis('Failed to store Bcc and Cc recipients for '.$env{'user.name'}.':'.$env{'user.domain'}); + } + if ($env{'form.attachment'}) { + if (length($env{'form.attachment'})<131072) { + $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now); + } else { + $r->print('

'.&mt('Attachment not included - exceeded permitted length').'

'); + } + } elsif ($env{'form.multiforward'}) { + if ($env{'form.attachmenturl'} ne '') { + $attachmenturl = $env{'form.attachmenturl'}; + } + } my @recusers; my @recudoms; foreach my $address (sort(keys(%toaddr))) { my ($recuname,$recdomain)=split(/\:/,$address); my $msgtxt = $savemsg; - if ($toaddr{$address}) { $msgtxt.='
'.$toaddr{$address}; } + if ($toaddr{$address}) { + $msgtxt.='
'.$toaddr{$address}; + } my @thismsg; if ($msgtype eq 'critical') { $r->print(&mt('Sending critical message').' '. @@ -2343,18 +2575,18 @@ sub sendoffmail { $env{'form.sendbck'}, $env{'form.permanent'}, \$sentmessage{$address}, - $nosentstore); + $nosentstore,$recipid); } else { $r->print(&mt('Sending').' '.$recuname.':'.$recdomain.': '); @thismsg= &Apache::lonmsg::user_normal_msg($recuname,$recdomain, $msgsubj,$msgtxt, $content{'citation'}, - undef,undef, + undef,$attachmenturl, $env{'form.permanent'}, \$sentmessage{$address}, undef,undef,undef, - $nosentstore); + $nosentstore,$recipid); } $msg_status{$recuname.':'.$recdomain}=join(' ',@thismsg); if ($msg_status{$recuname.':'.$recdomain} =~ /(ok|con_delayed)/) { @@ -2383,7 +2615,7 @@ sub sendoffmail { $specialresult = &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom, $subj_prefix.' '.$course_str,$savemsg,undef,undef, - undef,undef,undef,\$specialmsgid,undef,undef,undef, + $attachmenturl,undef,undef,\$specialmsgid,undef,undef,undef, undef,undef,1); $specialmsgid = &unescape($specialmsgid); if ($specialresult eq 'ok') { @@ -2400,7 +2632,7 @@ sub sendoffmail { $pid); &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom, $subj_prefix.' ['.$recipient.']',$msgsubj, - undef,undef,undef,undef,$usermsgid,undef, + undef,undef,$attachmenturl,undef,$usermsgid,undef, undef,$specialmsgid,undef,undef,undef,1); } } @@ -2408,10 +2640,10 @@ sub sendoffmail { &Apache::lonmsg::process_sent_mail($msgsubj, $subj_prefix,$numsent,$stamp,$msgname,$msgdom, $msgcount,$context,$pid,$savemsg,\@recusers, - \@recudoms); + \@recudoms,undef,$attachmenturl); } } 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; @@ -2420,7 +2652,7 @@ sub sendoffmail { &Apache::lonmsg::process_sent_mail($msgsubj,$subj_prefix, $numsent,$stamp,$env{'user.name'}, $env{'user.domain'},$msgcount,$context, - $$,$savemsg,\@recusers,\@recudoms); + $$,$savemsg,\@recusers,\@recudoms,undef,$attachmenturl); } } if (!$env{'form.multiforward'}) { @@ -2437,7 +2669,7 @@ sub sendoffmail { } } else { $r->print('

'.&mt('Could not deliver message').' '. - &mt('Please use the browser "Back" button and correct the recipient addresses '."($sendstatus)").'

'); + &mt('Please use the browser "Back" button and correct the recipient addresses ([_1]).',$sendstatus).'

'); } } } @@ -2528,16 +2760,19 @@ sub handler { &printheader($r,'','Confirmed Receipt'); my $replying = 0; foreach my $envkey (keys(%env)) { - if ($envkey=~/^form\.rec\_(.*)$/) { - $r->print(''.&mt('Confirming Receipt').': '. - &Apache::lonmsg::user_crit_received($1).'
'); - } - if ($envkey=~/^form\.reprec\_(.*)$/) { - my $msgid=$1; - $r->print(''.&mt('Confirming Receipt').': '. - &Apache::lonmsg::user_crit_received($msgid).'
'); - &compout($r,'','','',$msgid); - $replying = 1; + 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 ($repchk eq 'rep') { + &compout($r,'','','',$msgid); + $replying = 1; + } } } if (!$replying) { @@ -2669,7 +2904,7 @@ sub handler { foreach my $item (@to_forward) { my $msgid=&unescape($item); my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]); - my %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1); + my %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1,1); if ($env{'form.showorigsubj'}) { $env{'form.subject'} = $fixed_subj.$content{'subject'}; } else { @@ -2683,8 +2918,10 @@ sub handler { &Apache::loncommon::plainname($uname,$udom).' ('. $uname.':'.$udom.')'; } - $env{'form.message'} .= "\n\n-- Forwarded message --\n\n". - $content{'message'}; + $env{'form.message'}.="\n\n-- Forwarded message --\n\n". + $content{'message'}; + $env{'form.attachmenturl'} = $content{'attachmenturl'}; + $env{'form.multiforwid'} = $item; $fwdcount ++; $r->print($fwdcount.': '); $sendresult{$msgid} = &sendoffmail($r,$folder);