--- loncom/interface/lonmsg.pm 2005/06/06 21:06:14 1.148 +++ loncom/interface/lonmsg.pm 2005/11/01 15:59:18 1.153 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.148 2005/06/06 21:06:14 www Exp $ +# $Id: lonmsg.pm,v 1.153 2005/11/01 15:59:18 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -114,6 +114,7 @@ use HTML::Entities(); use Mail::Send; use Apache::lonlocal; use Apache::loncommunicate; +use Apache::lonfeedback; # Querystring component with sorting type my $sqs; @@ -337,7 +338,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 +578,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 @@ -872,7 +887,8 @@ sub disnew { TABLEHEAD foreach my $msg (@newmsgs) { $r->print(<<"ENDLINK"); - + $lt{'op'} ENDLINK foreach ('sendtime','from','fromdom','shortsub') { @@ -999,13 +1015,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').''. @@ -1218,6 +1234,7 @@ ENDUPLOAD &discourse; } $r->print(''. + &Apache::lonfeedback::generate_preview_button('compemail','message'). &Apache::lonhtmlcommon::htmlareaselectactive('message')); } @@ -1795,16 +1812,14 @@ 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'}); + if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) && $symb) { $r->print(''); } - if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) { - my $symb=&Apache::lonnet::symbread($content{'baseurl'}); + 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').'
');