--- loncom/interface/lonmsg.pm 2003/10/04 20:49:40 1.66
+++ loncom/interface/lonmsg.pm 2003/10/18 16:33:44 1.70
@@ -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.70 2003/10/18 16:33:44 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='
Attachment: '.$fname.'.'.$ft.''; + $content{'message'}.='
'.&mt('Attachment').': '.$fname.'.'.$ft.''; } else { - $content{'message'}.='
Attachment: '.$fname.'.'.$ft.'';
}
@@ -212,14 +213,15 @@ 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);
- my $fh = $msg->open('smtp',Server => 'localhost');
- print $fh $body;
- $fh->close;
+ if (my $fh = $msg->open('smtp',Server => 'localhost')) {
+ print $fh $body;
+ $fh->close;
+ }
}
# ==================================================== Send notification emails
@@ -362,10 +364,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 +471,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 +550,7 @@ ENDDISHEADER
sub discrit {
my $r=shift;
- my $header = ' '.
- 'Check All '.
- 'Uncheck All '.
+ ''.&mt('Check All').' '.
+ ''.&mt('Uncheck All').' '.
''.
- ''.
+ ''.
'Critical Messages
'.
+ my $header = ''.&mt('Critical Messages').'
'.
'
ENDREPLY
}
@@ -688,37 +700,37 @@ sub disall {
}
ENDDISHEADER
- $r->print('Display All Messages
'.&mt('Display All Messages').'
');
my @temp=sortedmessages();
@@ -735,8 +747,8 @@ ENDDISHEADER
$r->print('  ');
if ($ENV{'form.sortedby'} eq "revdate") {
- $r->print('Date ');
+ $r->print(''.&mt('Date').'');
} else {
- $r->print('Date');
+ $r->print(''.&mt('Date').'');
}
$r->print('');
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 ');
+ $r->print(''.&mt('Status').'');
} else {
- $r->print('Status');
+ $r->print(''.&mt('Status').'');
}
$r->print('');
}
$r->print(' Open Delete '.
+ '">'.&mt('Open').''.&mt('Delete').' '.
''.&Apache::lonlocal::locallocaltime($sendtime).' '.
$fromname.' '.$fromdomain.' '.
&Apache::lonnet::unescape($shortsubj).' '.
@@ -744,10 +756,10 @@ ENDDISHEADER
}
}
$r->print('