--- loncom/interface/lonmsg.pm 2004/03/01 20:57:47 1.91 +++ loncom/interface/lonmsg.pm 2004/03/02 02:51:09 1.92 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.91 2004/03/01 20:57:47 www Exp $ +# $Id: lonmsg.pm,v 1.92 2004/03/02 02:51:09 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -508,7 +508,7 @@ sub discourse { 'cfs' => 'Check for Section/Group', 'cfn' => 'Check for None'); $r->print(< + -  - -  - +  + +  +

ENDDISHEADER my %coursepersonnel= @@ -618,51 +618,6 @@ $content{'sendername'}.'@'. $r->print(''); } -# =============================================================== Compose reply - -sub comprep { - my ($r,$msgid)=@_; - my %message=&Apache::lonnet::get('nohist_email',[$msgid]); - my %content=&unpackagemsg($message{$msgid},1); - my $quotemsg='> '.$content{'message'}; - $quotemsg=~s/\r/\n/g; - $quotemsg=~s/\f/\n/g; - $quotemsg=~s/\n+/\n\> /g; - my $torepl=&Apache::loncommon::aboutmewrapper( - &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. -$content{'sendername'}.'@'. - $content{'senderdomain'}.')'; - my $subject=&mt('Re').': '.$content{'subject'}; - my $dispcrit=''; - if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { - my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message"); - $dispcrit= - ' '.&mt('Send as critical message').' ' . $crithelp . - '
'. - ' '.&mt('Send as critical message').' ' . - &mt('and return receipt') . $crithelp . '

'; - } - my %lt=&Apache::lonlocal::texthash( - 'to' => 'To', - 'sb' => 'Subject', - 'sr' => 'Send Reply', - 'ca' => 'Cancel' - ); - $r->print(<<"ENDREPLY"); -

- -$lt{'to'}: $torepl
-$lt{'sb'}:

-


-$dispcrit - - -
-ENDREPLY -} - sub sortedmessages { my @messages = &Apache::lonnet::getkeys('nohist_email'); #unpack the varibles and repack into temp for sorting @@ -783,7 +738,7 @@ ENDDISHEADER } $r->print(''.&mt('Open').''.&mt('Delete').''. + '">'.&mt('Delete').''. ''.&Apache::lonlocal::locallocaltime($sendtime).''. $fromname.''.$fromdomain.''. &Apache::lonnet::unescape($shortsubj).''. @@ -794,16 +749,38 @@ ENDDISHEADER ''.&mt('Check All').' '. ''.&mt('Uncheck All').'

'. ''. - ''. + ''. ''); } # ============================================================== Compose output sub compout { - my ($r,$forwarding,$broadcast)=@_; - &printheader($r,'/adm/email?compose=upload', - 'Distribute from uploaded file'); + my ($r,$forwarding,$replying,$broadcast)=@_; + + if ($broadcast eq 'individual') { + &printheader($r,'/adm/email?compose=individual', + 'Send a Message'); + } elsif ($broadcast) { + &printheader($r,'/adm/email?compose=group', + 'Broadcast Message'); + } elsif ($forwarding) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"/adm/email?display=".&Apache::lonnet::escape($forwarding), + text=>"Display Message"}); + &printheader($r,'/adm/email?forward='.&Apache::lonnet::escape($forwarding), + 'Forwarding a Message'); + } elsif ($replying) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"/adm/email?display=".&Apache::lonnet::escape($replying), + text=>"Display Message"}); + &printheader($r,'/adm/email?replyto='.&Apache::lonnet::escape($replying), + 'Replying to a Message'); + } else { + &printheader($r,'/adm/email?compose=upload', + 'Distribute from Uploaded File'); + } + my $dispcrit=''; my $dissub=''; my $dismsg=''; @@ -818,39 +795,64 @@ sub compout { if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message"); $dispcrit= - ' '.&mt('Send as critical message').' ' . $crithelp . + ' '.&mt('Send as critical message').' ' . $crithelp . '
'. - ' '.&mt('Send as critical message').' ' . + ' '.&mt('Send as critical message').' ' . &mt('and return receipt') . $crithelp . '

'; - } + } + my %message; + my %content; + my $defdom=$ENV{'user.domain'}; if ($forwarding) { - $dispcrit.=''; - $func=&mt('Forward'); - my %message=&Apache::lonnet::get('nohist_email',[$forwarding]); - my %content=&unpackagemsg($message{$forwarding}); - - $dissub=&mt('Forwarding').': '.$content{'subject'}; - $dismsg=&mt('Forwarded message from').' '. - $content{'sendername'}.' '.&mt('at').' '.$content{'senderdomain'}; + %message=&Apache::lonnet::get('nohist_email',[$forwarding]); + %content=&unpackagemsg($message{$forwarding}); + $dispcrit.=''; + $func=&mt('Forward'); + + $dissub=&mt('Forwarding').': '.$content{'subject'}; + $dismsg=&mt('Forwarded message from').' '. + $content{'sendername'}.' '.&mt('at').' '.$content{'senderdomain'}; + } + if ($replying) { + %message=&Apache::lonnet::get('nohist_email',[$replying]); + %content=&unpackagemsg($message{$replying}); + $dispcrit.=''; + $func=&mt('Replying to'); + + $dissub=&mt('Reply').': '.$content{'subject'}; + $dismsg='> '.$content{'message'}; + $dismsg=~s/\r/\n/g; + $dismsg=~s/\f/\n/g; + $dismsg=~s/\n+/\n\> /g; } - my $defdom=$ENV{'user.domain'}; if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; } $r->print( '

'."\n". - ''."\n". + ''."\n". ''); unless (($broadcast eq 'group') || ($broadcast eq 'upload')) { - my $domform = &Apache::loncommon::select_dom_form($defdom,'recdomain'); - my $selectlink=&Apache::loncommon::selectstudent_link + if ($replying) { + $r->print(''); + } else { + my $domform = &Apache::loncommon::select_dom_form($defdom,'recdomain'); + my $selectlink=&Apache::loncommon::selectstudent_link ('compemail','recuname','recdomain'); - $r->print(<<"ENDREC"); -
'.&mt('Replying to').' '. + &Apache::loncommon::aboutmewrapper( + &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. + $content{'sendername'}.'@'. + $content{'senderdomain'}.')'. + ''. + ''. + '
+ $r->print(<<"ENDREC"); ENDREC + } } my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); if ($broadcast ne 'upload') { @@ -861,7 +863,7 @@ ENDREC
$lt{'us'}:$selectlink
$lt{'do'}: $domform
$lt{'sb'}:
$latexHelp -


$dispcrit @@ -892,7 +894,7 @@ The messages will be assembled from all

$dispcrit -

+

ENDUPLOAD } if ($broadcast eq 'group') { @@ -924,7 +926,7 @@ sub disfacetoface { $result.='

'.&mt('Sent Message').'

'; %content=&unpackagemsg($content{'message'}); $content{'message'}= - 'Subject: '.$content{'subject'}.'
'. + ''.&mt('Subject').': '.$content{'subject'}.'
'. $content{'message'}; } $result.=&mt('By').': '. @@ -932,13 +934,13 @@ sub disfacetoface { &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. $content{'sendername'}.'@'. $content{'senderdomain'}.') '.$content{'time'}. - '
'. + '
'. &Apache::lontexconvert::msgtexconverted($content{'message'}). '
'; } # Check to see if there were any messages. if ($result eq '') { - $r->print("

No notes, face-to-face discussion records, or critical messages in this course.

"); + $r->print("

".&mt("No notes, face-to-face discussion records, or critical messages in this course.")."

"); } else { $r->print($result); } @@ -1017,14 +1019,6 @@ ENDBFORM } } -# ----------------------------------------------- Generate the text input field - -sub textinputarea { - my ($r,$name,$quote)=@_; - $r->print(''); -} - # ----------------------------------------------------------- Display a message sub displaymessage { @@ -1046,7 +1040,7 @@ sub displaymessage { $r->print(''); my $number_of_messages = scalar(@messages); #subtract 1 for last index # start output - &printheader($r,'/adm/email?display='.$msgid,'Display a Message','',$content{'baseurl'}); + &printheader($r,'/adm/email?display='.&Apache::lonnet::escape($msgid),'Display a Message','',$content{'baseurl'}); my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'}); # Functions $r->print(''. @@ -1145,53 +1139,29 @@ sub handler { if ($ENV{'form.display'}) { &displaymessage($r,$ENV{'form.display'}); } elsif ($ENV{'form.replyto'}) { - &comprep($r,$ENV{'form.replyto'}); - } elsif ($ENV{'form.sendreply'}) { - if ($ENV{'form.send'}) { - my $msgid=$ENV{'form.sendreply'}; - my %message=&Apache::lonnet::get('nohist_email',[$msgid]); - my %content=&unpackagemsg($message{$msgid},1); - &statuschange($msgid,'replied'); - if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && - (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { - $r->print(&mt('Sending critical message').': '. - &user_crit_msg($content{'sendername'}, - $content{'senderdomain'}, - &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), - &Apache::lonfeedback::clear_out_html($ENV{'form.message'}), - $ENV{'form.sendbck'})); - } else { - $r->print(&mt('Sending').': '.&user_normal_msg($content{'sendername'}, - $content{'senderdomain'}, - &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), - &Apache::lonfeedback::clear_out_html($ENV{'form.message'}))); - } - } - if ($ENV{'form.displayedcrit'}) { - &discrit($r); - } else { - &disall($r); - } + &compout($r,'',$ENV{'form.replyto'}); } elsif ($ENV{'form.confirm'}) { + &printheader($r,'','Confirmed Receipt'); foreach (keys %ENV) { if ($_=~/^form\.rec\_(.*)$/) { - $r->print('Confirming Receipt: '. + $r->print(''.&mt('Confirming Receipt').': '. &user_crit_received($1).'
'); } if ($_=~/^form\.reprec\_(.*)$/) { my $msgid=$1; - $r->print('Confirming Receipt: '. + $r->print(''.&mt('Confirming Receipt').': '. &user_crit_received($msgid).'
'); &comprep($r,$msgid); } } &discrit($r); } elsif ($ENV{'form.critical'}) { + &printheader($r,'','Displaying Critical Messages'); &discrit($r); } elsif ($ENV{'form.forward'}) { &compout($r,$ENV{'form.forward'}); - } elsif ($ENV{'form.markread'}) { } elsif ($ENV{'form.markdel'}) { + &printheader($r,'','Deleted Message'); &statuschange($ENV{'form.markdel'},'deleted'); &disall($r); } elsif ($ENV{'form.markeddel'}) { @@ -1202,18 +1172,22 @@ sub handler { $total++; } } + &printheader($r,'','Deleted Messages'); $r->print('Deleted '.$total.' message(s)

'); &disall($r); } elsif ($ENV{'form.markunread'}) { + &printheader($r,'','Marked Message as Unread'); &statuschange($ENV{'form.markunread'},'new'); &disall($r); } elsif ($ENV{'form.compose'}) { - &compout($r,'',$ENV{'form.compose'}); + &compout($r,'','',$ENV{'form.compose'}); } elsif ($ENV{'form.recordftf'}) { &facetoface($r,$ENV{'form.recordftf'}); } elsif ($ENV{'form.sendmail'}) { my $sendstatus=''; if ($ENV{'form.send'}) { + &printheader($r,'','Messages being sent.'); + $r->rflush(); my %content=(); undef %content; if ($ENV{'form.forwid'}) { @@ -1249,25 +1223,28 @@ sub handler { $toaddr{$auname.':'.$audom}=''; } } + foreach (keys %toaddr) { my ($recuname,$recdomain)=split(/\:/,$_); my $msgtxt=&Apache::lonfeedback::clear_out_html($ENV{'form.message'}); - if ($toaddr{$_}) { $msgtxt.='


'.$toaddr{$_}; } + if ($toaddr{$_}) { $msgtxt.='
'.$toaddr{$_}; } + my $thismsg; if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { - $r->print(&mt('Sending critical message').' ...'); - $sendstatus.=' '.&user_crit_msg($recuname,$recdomain, + $r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': '); + $thismsg=&user_crit_msg($recuname,$recdomain, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, $ENV{'form.sendbck'}); } else { - $r->print(&mt('Sending').' ...'); - $sendstatus.=' '.&user_normal_msg($recuname,$recdomain, + $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); + $thismsg=&user_normal_msg($recuname,$recdomain, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, $content{'citation'}); } - $r->print('
'); + $r->print($thismsg.'
'); + $sendstatus.=' '.$thismsg; } } if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) { @@ -1284,6 +1261,7 @@ sub handler { ); } } else { + &printheader($r,'','Display All Messages'); &disall($r); } $r->print('');
'.&mt('Functions').':