[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 15 Oct 2003 21:10:24 -0000
This is a MIME encoded message
--www1066252224
Content-Type: text/plain
www Wed Oct 15 17:10:24 2003 EDT
Modified files:
/loncom/interface lonmsg.pm
Log:
Bug #2171: Cancel button on send and send reply
--www1066252224
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20031015171024.txt"
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.68 loncom/interface/lonmsg.pm:1.69
--- loncom/interface/lonmsg.pm:1.68 Wed Oct 15 16:34:37 2003
+++ loncom/interface/lonmsg.pm Wed Oct 15 17:10:24 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.68 2003/10/15 20:34:37 www Exp $
+# $Id: lonmsg.pm,v 1.69 2003/10/15 21:10:24 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -607,16 +607,23 @@
'<input type=checkbox name=sendbck> '.&mt('Send as critical message').' ' .
&mt('and return receipt') . $crithelp . '<p>';
}
+ my %lt=&Apache::lonlocal::texthash(
+ 'to' => 'To',
+ 'sb' => 'Subject',
+ 'sr' => 'Send Reply',
+ 'ca' => 'Cancel'
+ );
$r->print(<<"ENDREPLY");
-<form action="/adm/email" method=post>
-<input type=hidden name=sendreply value="$msgid">
-To: $torepl<br />
-Subject: <input type=text size=50 name=subject value="$subject"><p>
-<textarea name=message cols=84 rows=10 wrap=hard>
+<form action="/adm/email" method="post">
+<input type="hidden" name="sendreply" value="$msgid">
+$lt{'to'}: $torepl<br />
+$lt{'sb'}: <input type="text" size=50 name="subject" value="$subject"><p>
+<textarea name="message" cols="84" rows="10" wrap="hard">
$quotemsg
-</textarea><p>
+</textarea></p><br />
$dispcrit
-<input type=submit value="Send Reply">
+<input type="submit" name="send" value="$lt{'sr'}" />
+<input type="submit" name="cancel" value="$lt{'ca'}"/ >
</form>
ENDREPLY
}
@@ -764,16 +771,23 @@
my $dissub='';
my $dismsg='';
my $func=&mt('Send New');
- if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
+ my %lt=&Apache::lonlocal::texthash('us' => 'Username',
+ 'do' => 'Domain',
+ 'ad' => 'Additional Recipients',
+ 'sb' => 'Subject',
+ 'ca' => 'Cancel',
+ 'ma' => 'Mail');
+
+ if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message");
$dispcrit=
- '<input type=checkbox name=critmsg> '.&mt('Send as critical message').' ' . $crithelp .
+ '<input type="checkbox" name="critmsg"> '.&mt('Send as critical message').' ' . $crithelp .
'<br>'.
- '<input type=checkbox name=sendbck> '.&mt('Send as critical message').' ' .
+ '<input type="checkbox" name="sendbck"> '.&mt('Send as critical message').' ' .
&mt('and return receipt') . $crithelp . '<p>';
}
if ($forwarding) {
- $dispcrit.='<input type=hidden name=forwid value="'.
+ $dispcrit.='<input type="hidden" name="forwid" value="'.
$forwarding.'">';
$func=&mt('Forward');
my %message=&Apache::lonnet::get('nohist_email',[$forwarding]);
@@ -796,24 +810,25 @@
('compemail','recuname','recdomain');
$r->print(<<"ENDREC");
<table>
-<tr><td>Username:</td><td><input type=text size=12 name=recuname value="$ENV{'form.recname'}"></td><td rowspan="2">$selectlink</td></tr>
-<tr><td>Domain:</td>
+<tr><td>$lt{'us'}:</td><td><input type="text" size="12" name="recuname" value="$ENV{'form.recname'}"></td><td rowspan="2">$selectlink</td></tr>
+<tr><td>$lt{'do'}:</td>
<td>$domform</td></tr>
ENDREC
}
my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
if ($broadcast ne 'upload') {
$r->print(<<"ENDCOMP");
-<tr><td>Additional Recipients<br><tt>username\@domain,username\@domain, ...
+<tr><td>$lt{'ad'}<br /><tt>username\@domain,username\@domain, ...
</tt></td><td>
-<input type=text size=50 name=additionalrec></td></tr>
-<tr><td>Subject:</td><td><input type=text size=50 name=subject value="$dissub">
+<input type="text" size="50" name="additionalrec"></td></tr>
+<tr><td>$lt{'sb'}:</td><td><input type="text" size="50" name="subject" value="$dissub">
</td></tr></table>
$latexHelp
-<textarea name=message cols=80 rows=10 wrap=hard>$dismsg
-</textarea><p>
+<textarea name="message" cols="80" rows="10" wrap="hard">$dismsg
+</textarea></p><br />
$dispcrit
-<input type=submit value="$func Mail">
+<input type="submit" name="send" value="$func $lt{'ma'}" />
+<input type="submit" name="cancel" value="$lt{'ca'}" />
ENDCOMP
} else { # $broadcast is 'upload'
$r->print(<<ENDUPLOAD);
@@ -866,15 +881,15 @@
next if ($content{'senderdomain'} eq '');
$content{'message'}=~s/\n/\<br\>/g;
if ($content{'subject'}=~/^Record/) {
- $result.='<h3>Record</h3>';
+ $result.='<h3>'.&mt('Record').'</h3>';
} else {
- $result.='<h3>Sent Message</h3>';
+ $result.='<h3>'.&mt('Sent Message').'</h3>';
%content=&unpackagemsg($content{'message'});
$content{'message'}=
'<b>Subject: '.$content{'subject'}.'</b><br />'.
$content{'message'};
}
- $result.='By: <b>'.
+ $result.=&mt('By').': <b>'.
&Apache::loncommon::aboutmewrapper(
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('.
$content{'sendername'}.'@'.
@@ -1038,23 +1053,25 @@
} elsif ($ENV{'form.replyto'}) {
&comprep($r,$ENV{'form.replyto'});
} elsif ($ENV{'form.sendreply'}) {
- my $msgid=$ENV{'form.sendreply'};
- my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
- my %content=&unpackagemsg($message{$msgid},1);
- &statuschange($msgid,'replied');
- if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&
- (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
- $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(&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'})));
+ if ($ENV{'form.send'}) {
+ my $msgid=$ENV{'form.sendreply'};
+ my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
+ my %content=&unpackagemsg($message{$msgid},1);
+ &statuschange($msgid,'replied');
+ if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&
+ (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
+ $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(&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'})));
+ }
}
if ($ENV{'form.displayedcrit'}) {
&discrit($r);
@@ -1101,60 +1118,62 @@
} elsif ($ENV{'form.recordftf'}) {
&facetoface($r,$ENV{'form.recordftf'});
} elsif ($ENV{'form.sendmail'}) {
- my %content=();
- undef %content;
- if ($ENV{'form.forwid'}) {
- my $msgid=$ENV{'form.forwid'};
- my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
- %content=&unpackagemsg($message{$msgid},1);
- &statuschange($msgid,'forwarded');
- $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".
- $content{'message'};
- }
- my %toaddr=();
- undef %toaddr;
- if ($ENV{'form.sendmode'} eq 'group') {
- foreach (keys %ENV) {
- if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
- $toaddr{$1}='';
- }
- }
- } elsif ($ENV{'form.sendmode'} eq 'upload') {
- foreach (split(/[\n\r\f]+/,$ENV{'form.upfile'})) {
- my ($rec,$txt)=split(/\s*\:\s*/,$_);
- if ($txt) {
- $rec=~s/\@/\:/;
- $toaddr{$rec}.=$txt."\n";
- }
- }
- } else {
- $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';
- }
- if ($ENV{'form.additionalrec'}) {
- foreach (split(/\,/,$ENV{'form.additionalrec'})) {
- my ($auname,$audom)=split(/\@/,$_);
- $toaddr{$auname.':'.$audom}='';
- }
- }
- foreach (keys %toaddr) {
- my ($recuname,$recdomain)=split(/\:/,$_);
- my $msgtxt=&Apache::lonfeedback::clear_out_html($ENV{'form.message'});
- if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; }
- if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&
- (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
- $r->print('Sending critical: '.
- &user_crit_msg($recuname,$recdomain,
- &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
- $msgtxt,
- $ENV{'form.sendbck'}));
- } else {
- $r->print('Sending: '.&user_normal_msg($recuname,$recdomain,
- &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
- $msgtxt,
- $content{'citation'}));
+ if ($ENV{'form.send'}) {
+ my %content=();
+ undef %content;
+ if ($ENV{'form.forwid'}) {
+ my $msgid=$ENV{'form.forwid'};
+ my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
+ %content=&unpackagemsg($message{$msgid},1);
+ &statuschange($msgid,'forwarded');
+ $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".
+ $content{'message'};
+ }
+ my %toaddr=();
+ undef %toaddr;
+ if ($ENV{'form.sendmode'} eq 'group') {
+ foreach (keys %ENV) {
+ if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
+ $toaddr{$1}='';
+ }
+ }
+ } elsif ($ENV{'form.sendmode'} eq 'upload') {
+ foreach (split(/[\n\r\f]+/,$ENV{'form.upfile'})) {
+ my ($rec,$txt)=split(/\s*\:\s*/,$_);
+ if ($txt) {
+ $rec=~s/\@/\:/;
+ $toaddr{$rec}.=$txt."\n";
+ }
+ }
+ } else {
+ $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';
+ }
+ if ($ENV{'form.additionalrec'}) {
+ foreach (split(/\,/,$ENV{'form.additionalrec'})) {
+ my ($auname,$audom)=split(/\@/,$_);
+ $toaddr{$auname.':'.$audom}='';
+ }
+ }
+ foreach (keys %toaddr) {
+ my ($recuname,$recdomain)=split(/\:/,$_);
+ my $msgtxt=&Apache::lonfeedback::clear_out_html($ENV{'form.message'});
+ if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; }
+ if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&
+ (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
+ $r->print('Sending critical: '.
+ &user_crit_msg($recuname,$recdomain,
+ &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
+ $msgtxt,
+ $ENV{'form.sendbck'}));
+ } else {
+ $r->print('Sending: '.&user_normal_msg($recuname,$recdomain,
+ &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
+ $msgtxt,
+ $content{'citation'}));
+ }
+ $r->print('<br />');
+ }
}
- $r->print('<br>');
- }
if ($ENV{'form.displayedcrit'}) {
&discrit($r);
} else {
--www1066252224--