--- loncom/interface/lonmsg.pm 2005/06/06 19:51:05 1.146 +++ 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.146 2005/06/06 19:51:05 www 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'}; @@ -1215,6 +1236,7 @@ ENDUPLOAD &discourse; } $r->print(''. + &Apache::lonfeedback::generate_preview_button('compemail','message'). &Apache::lonhtmlcommon::htmlareaselectactive('message')); } @@ -1777,7 +1799,7 @@ sub displaymessage { ''.&mt('Mark Unread').''. 'Delete'. + '">'.&mt('Delete').''. ''.&mt('Back to Folder Display').''); @@ -1792,17 +1814,15 @@ sub displaymessage { $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'})) { - my $symb=&Apache::lonnet::symbread($content{'baseurl'}); - $r->print(''); - } - if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) { - my $symb=&Apache::lonnet::symbread($content{'baseurl'}); - $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::parm_direct_link(&mt('Set/Change parameters'),$content{'sendername'},$content{'senderdomain'},$symb,'check').''.&Apache::loncommon::grds_direct_link(&mt('Set/Change grades'),$content{'sendername'},$content{'senderdomain'},$symb,'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').'
'); } @@ -2177,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');