--- loncom/interface/lonmsg.pm 2005/05/20 17:00:40 1.143 +++ loncom/interface/lonmsg.pm 2005/11/18 13:35:30 1.155 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.143 2005/05/20 17:00:40 albertel Exp $ +# $Id: lonmsg.pm,v 1.155 2005/11/18 13:35:30 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -114,6 +114,8 @@ use HTML::Entities(); use Mail::Send; use Apache::lonlocal; use Apache::loncommunicate; +use Apache::lonfeedback; +use Apache::lonrss(); # Querystring component with sorting type my $sqs; @@ -337,7 +339,20 @@ sub del_url_author_res_msg { } return &Apache::lonnet::del('nohist_res_msgs',\@delmsgs,$domain,$author); } +# =================================== Clear out all author messages in URL path +sub clear_author_res_msg { + my $url=shift; + $url=&Apache::lonnet::declutter($url); + my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//); + my @delmsgs=(); + foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) { + if ($_=~/^\Q$url\E/) { + push (@delmsgs,$_); + } + } + return &Apache::lonnet::del('nohist_res_msgs',\@delmsgs,$domain,$author); +} # ================= Return hash with URLs for which there is a resource message sub all_url_author_res_msg { @@ -564,13 +579,14 @@ sub scrollbuttons { my ($start,$maxdis,$first,$finish,$total)=@_; unless ($total>0) { return ''; } $start++; $maxdis++;$first++;$finish++; - return + return + &mt('Page').': '. ''. ''. ' of '.$maxdis. ''. '
'. - &mt('Messages [_1] through [_2] of [_3]',$first,$finish,$total).''; + &mt('Showing messages [_1] through [_2] of [_3]',$first,$finish,$total).''; } # =============================================================== Folder suffix @@ -596,6 +612,9 @@ sub statuschange { if (($newstatus eq 'deleted') || ($newstatus eq 'new')) { &Apache::lonnet::put('email_status'.$suffix,{$msgid => $newstatus}); } + if ($newstatus eq 'deleted') { + &movemsg(&Apache::lonnet::unescape($msgid),$folder,'trash'); + } } # ============================================================= Make new folder @@ -869,7 +888,8 @@ sub disnew { TABLEHEAD foreach my $msg (@newmsgs) { $r->print(<<"ENDLINK"); - + $lt{'op'} ENDLINK foreach ('sendtime','from','fromdom','shortsub') { @@ -996,13 +1016,13 @@ ENDDISHEADER my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$origID)= @{$temp[$n]}; if (($status ne 'deleted') && defined($sendtime) && $sendtime!~/error/) { if ($status eq 'new') { - $r->print(''); + $r->print(''); } elsif ($status eq 'read') { - $r->print(''); + $r->print(''); } elsif ($status eq 'replied') { - $r->print(''); + $r->print(''); } else { - $r->print(''); + $r->print(''); } $r->print(''.&mt('Open').''. @@ -1095,8 +1115,9 @@ sub compout { '' . $crithelp . '

'; - } +&mt('Send copy to permanent email address (if known)').'

'. +'

'; } my %message; my %content; my $defdom=$env{'user.domain'}; @@ -1173,7 +1194,7 @@ ENDREC $lt{'sb'}: $latexHelp -


$dispcrit $disbase @@ -1192,7 +1213,7 @@ ENDCOMP Subject:

General message text
-

The file format for the uploaded portion of the message is: @@ -1214,7 +1235,9 @@ ENDUPLOAD if ($broadcast eq 'group') { &discourse; } - $r->print(''); + $r->print(''. + &Apache::lonfeedback::generate_preview_button('compemail','message'). + &Apache::lonhtmlcommon::htmlareaselectactive('message')); } # ---------------------------------------------------- Display all face to face @@ -1235,8 +1258,8 @@ sub retrieve_instructor_comments { my %content=&unpackagemsg($records{$_}); next if ($content{'senderdomain'} eq ''); next if ($content{'subject'} !~ /^Record/); - # $content{'message'}=~s/\n/\/g; - $result.='Recorded by '. + # &Apache::lonfeedback::newline_to_br(\$content{'message'}); + $result.='Recorded by '. $content{'sendername'}.'@'.$content{'senderdomain'}."\n"; $result.= &Apache::lontexconvert::msgtexconverted($content{'message'})."\n"; @@ -1259,7 +1282,7 @@ sub disfacetoface { foreach (sort keys %records) { my %content=&unpackagemsg($records{$_}); next if ($content{'senderdomain'} eq ''); - $content{'message'}=~s/\n/\/g; + &Apache::lonfeedback::newline_to_br(\$content{'message'}); if ($content{'subject'}=~/^Record/) { $result.='

'.&mt('Record').'

'; } elsif ($content{'subject'}=~/^Broadcast/) { @@ -1776,7 +1799,7 @@ sub displaymessage { ''.&mt('Mark Unread').''. 'Delete'. + '">'.&mt('Delete').''. ''.&mt('Back to Folder Display').''); @@ -1789,6 +1812,20 @@ sub displaymessage { '">'.&mt('Next').''); } $r->print(''); + if ($env{'user.adv'}) { + $r->print(''); + my $symb=&Apache::lonnet::symbread($content{'baseurl'}); + if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) { + $r->print(''); + } + if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) && $symb) { + $r->print(''); + } + if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}) && $symb) { + $r->print(''); + } + $r->print('
'.&mt('Currently available actions (will open extra window)').':'.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').''.&Apache::loncommon::pprmlink(&mt('Set/Change parameters'),$content{'sendername'},$content{'senderdomain'},$symb,'check').''.&Apache::loncommon::pgrdlink(&mt('Set/Change grades'),$content{'sendername'},$content{'senderdomain'},$symb,'check').'
'); + } $r->print('
'.&mt('Subject').': '.$content{'subject'}. ($folder ne 'sent'?'
'.&mt('From').': '. &Apache::loncommon::aboutmewrapper( @@ -1852,7 +1889,8 @@ sub header { my ($r,$title,$baseurl)=@_; $r->print(&Apache::lonxml::xmlbegin(). ''.&Apache::lonxml::fontsettings(). - 'Communication and Messages'); + 'Communication and Messages'. + &Apache::lonhtmlcommon::htmlareaheaders()); if ($baseurl) { $r->print(""); } @@ -2159,6 +2197,13 @@ sub handler { if ($env{'form.storebasecomment'}) { &storecomment($r); } + if (($env{'form.rsspost'}) && ($env{'request.course.id'})) { + &Apache::lonrss::addentry($env{'course.'.$env{'request.course.id'}.'.num'}, + $env{'course.'.$env{'request.course.id'}.'.domain'}, + 'Course_Announcements', + $env{'form.subject'}, + $env{'form.message'},'/adm/communicate','public'); + } &disall($r,($folder?$folder:$dismode)); } elsif ($env{'form.newfolder'}) { &printheader($r,'','New Folder');