--- loncom/interface/lonmsg.pm 2003/10/04 20:49:40 1.66 +++ loncom/interface/lonmsg.pm 2003/10/15 18:01:10 1.67 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.66 2003/10/04 20:49:40 www Exp $ +# $Id: lonmsg.pm,v 1.67 2003/10/15 18:01:10 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -115,6 +115,7 @@ use Apache::loncommon(); use Apache::lontexconvert(); use HTML::Entities(); use Mail::Send; +use Apache::lonlocal; # Querystring component with sorting type my $sqs; @@ -143,7 +144,7 @@ sub packagemsg { my $result=''.$ENV{'user.name'}.''. ''.$ENV{'user.domain'}.''. ''.$subject.''. - ''. + ''. ''.$ENV{'SERVER_NAME'}.''. ''.$ENV{'HTTP_HOST'}.''. ''.$ENV{'REMOTE_ADDR'}.''. @@ -186,9 +187,9 @@ sub unpackagemsg { if ($content{'attachmenturl'}) { my ($fname,$ft)=($content{'attachmenturl'}=~/\/(\w+)\.(\w+)$/); if ($notoken) { - $content{'message'}.='

Attachment: '.$fname.'.'.$ft.''; + $content{'message'}.='

'.&mt('Attachment').': '.$fname.'.'.$ft.''; } else { - $content{'message'}.='

Attachment: '.$fname.'.'.$ft.''; } @@ -212,8 +213,8 @@ sub unpackmsgid { sub sendemail { my ($to,$subject,$body)=@_; $body= - "*** This is an automatic message generated by the LON-CAPA system.\n". - "*** Please do not reply to this address.\n\n".$body; + "*** ".&mt('This is an automatic message generated by the LON-CAPA system.')."\n". + "*** ".&mt('Please do not reply to this address.')."\n\n".$body; my $msg = new Mail::Send; $msg->to($to); $msg->subject('[LON-CAPA] '.$subject); @@ -362,10 +363,10 @@ sub user_crit_received { my %contents=&unpackagemsg($message{$msgid},1); my $status='rec: '.($contents{'sendback'}? &user_normal_msg($contents{'sendername'},$contents{'senderdomain'}, - 'Receipt: '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}, - 'User '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}. + &mt('Receipt').': '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}, + &mt('User').' '.$ENV{'user.name'}.' '.&mt('at').' '.$ENV{'user.domain'}. ' acknowledged receipt of message'."\n".' "'. - $contents{'subject'}.'"'."\n".'dated '. + $contents{'subject'}.'"'."\n".&mt('dated').' '. $contents{'time'}.".\n" ):'no msg req'); $status.=' trans: '. @@ -469,6 +470,9 @@ sub discourse { $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); my $now=time; + my %lt=&Apache::lonlocal::texthash('cfa' => 'Check for All', + 'cfs' => 'Check for Section/Group', + 'cfn' => 'Check for None'); $r->print(< -  - +  +   - +

ENDDISHEADER my %coursepersonnel= @@ -545,7 +549,7 @@ ENDDISHEADER sub discrit { my $r=shift; - my $header = '

Critical Messages

'. + my $header = '

'.&mt('Critical Messages').'

'. '
'. ''; my %what=&Apache::lonnet::dump('critical'); @@ -554,23 +558,23 @@ sub discrit { my %content=&unpackagemsg($what{$_}); next if ($content{'senderdomain'} eq ''); $content{'message'}=~s/\n/\/g; - $result.='
From: '. + $result.='
'.&mt('From').': '. &Apache::loncommon::aboutmewrapper( &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. $content{'sendername'}.'@'. $content{'senderdomain'}.') '.$content{'time'}. - '
Subject: '.$content{'subject'}. + '
'.&mt('Subject').': '.$content{'subject'}. '
'. &Apache::lontexconvert::msgtexconverted($content{'message'}). '
'. - ''. + ''. ''; + 'value="'.&mt('Confirm Receipt and Reply').'">'; } # Check to see if there were any messages. if ($result eq '') { - $result = "

You have no critical messages.

". - 'Select a course'; + $result = "

".&mt('You have no critical messages.')."

". + ''.&mt('Select a course').''; } else { $r->print($header); } @@ -592,15 +596,15 @@ sub comprep { &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. $content{'sendername'}.'@'. $content{'senderdomain'}.')'; - my $subject='Re: '.$content{'subject'}; + 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= - ' Send as critical message ' . $crithelp . + ' '.&mt('Send as critical message').' ' . $crithelp . '
'. - ' Send as critical message ' . - ' and return receipt' . $crithelp . '

'; + ' '.&mt('Send as critical message').' ' . + &mt('and return receipt') . $crithelp . '

'; } $r->print(<<"ENDREPLY"); @@ -688,37 +692,37 @@ sub disall { } ENDDISHEADER - $r->print('

Display All Messages

print('

'.&mt('Display All Messages').'

'. ''); + $r->print(''.&mt('Date').''); } else { - $r->print('Date'); + $r->print(''.&mt('Date').''); } $r->print(''); + $r->print(''.&mt('Status').''); } else { - $r->print('Status'); + $r->print(''.&mt('Status').''); } $r->print(''); my @temp=sortedmessages(); @@ -735,8 +739,8 @@ ENDDISHEADER $r->print(''); } $r->print(''. + '">'.&mt('Open').''. '
 '); if ($ENV{'form.sortedby'} eq "revdate") { - $r->print('Date'); if ($ENV{'form.sortedby'} eq "revuser") { - $r->print('Username'); + $r->print(''.&mt('Username').''); } else { - $r->print('Username'); + $r->print(''.&mt('Username').''); } $r->print(''); if ($ENV{'form.sortedby'} eq "revdomain") { - $r->print('Domain'); + $r->print(''.&mt('Domain').''); } else { - $r->print('Domain'); + $r->print(''.&mt('Domain').''); } $r->print(''); if ($ENV{'form.sortedby'} eq "revsubject") { - $r->print('Subject'); + $r->print(''.&mt('Subject').''); } else { - $r->print('Subject'); + $r->print(''.&mt('Subject').''); } $r->print(''); if ($ENV{'form.sortedby'} eq "revstatus") { - $r->print('Status
OpenDelete'.&mt('Delete').''.&Apache::lonlocal::locallocaltime($sendtime).''. $fromname.''.$fromdomain.''. &Apache::lonnet::unescape($shortsubj).''. @@ -744,10 +748,10 @@ ENDDISHEADER } } $r->print('

'. - 'Check All '. - 'Uncheck All

'. + ''.&mt('Check All').' '. + ''.&mt('Uncheck All').'

'. ''. - ''. + ''. '

'); } @@ -758,25 +762,25 @@ sub compout { my $dispcrit=''; my $dissub=''; my $dismsg=''; - my $func='Send New'; + my $func=&mt('Send New'); if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message"); $dispcrit= - ' Send as critical message ' . $crithelp . + ' '.&mt('Send as critical message').' ' . $crithelp . '
'. - ' Send as critical message ' . - ' and return receipt' . $crithelp . '

'; + ' '.&mt('Send as critical message').' ' . + &mt('and return receipt') . $crithelp . '

'; } if ($forwarding) { $dispcrit.=''; - $func='Forward'; + $func=&mt('Forward'); my %message=&Apache::lonnet::get('nohist_email',[$forwarding]); my %content=&unpackagemsg($message{$forwarding}); - $dissub='Forwarding: '.$content{'subject'}; - $dismsg='Forwarded message from '. - $content{'sendername'}.' at '.$content{'senderdomain'}; + $dissub=&mt('Forwarding').': '.$content{'subject'}; + $dismsg=&mt('Forwarded message from').' '. + $content{'sendername'}.' '.&mt('at').' '.$content{'senderdomain'}; } my $defdom=$ENV{'user.domain'}; if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; } @@ -955,7 +959,7 @@ sub handler { # ----------------------------------------------------------- Set document type - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; @@ -1000,32 +1004,32 @@ sub handler { $r->print(&Apache::loncommon::studentbrowser_javascript(). ''. &Apache::loncommon::bodytag('EMail and Messages')); - $r->print('Subject: '.$content{'subject'}. - '
From: '. + $r->print(''.&mt('Subject').': '.$content{'subject'}. + '
'.&mt('From').': '. &Apache::loncommon::aboutmewrapper( &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}), $content{'sendername'},$content{'senderdomain'}).' ('. $content{'sendername'}.' at '. $content{'senderdomain'}.') '. - '
Time: '.$content{'time'}.'

'. - ''. + '
'.&mt('Time').': '.$content{'time'}.'

'. + '

Functions:
'. ''. + '">'.&mt('Reply').''. ''. + '">'.&mt('Forward').''. ''. + '">'.&mt('Mark Unread').''. ''. ''); + '">'.&mt('Display all Messages').''); if ($counter > 0){ $r->print(''); + '">'.&mt('Previous').''); } if ($counter < $number_of_messages - 1){ $r->print(''); + '">'.&mt('Next').''); } $r->print('
'.&mt('Functions').':ReplyForwardMark UnreadDeleteDisplay all MessagesPreviousNext

'.
              &Apache::lontexconvert::msgtexconverted($content{'message'}).
@@ -1039,14 +1043,14 @@ $content{'sendername'},$content{'senderd
       &statuschange($msgid,'replied');
       if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
           (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
-         $r->print('Sending critical: '.
+         $r->print(&mt('Sending critical').': '.
                 &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('Sending: '.&user_normal_msg($content{'sendername'},
+         $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'})));