--- loncom/interface/lonmsg.pm 2004/01/15 15:12:31 1.79
+++ loncom/interface/lonmsg.pm 2004/05/07 12:03:53 1.99
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.79 2004/01/15 15:12:31 www Exp $
+# $Id: lonmsg.pm,v 1.99 2004/05/07 12:03:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -101,6 +101,7 @@ use Apache::lontexconvert();
use HTML::Entities();
use Mail::Send;
use Apache::lonlocal;
+use Apache::loncommunicate;
# Querystring component with sorting type
my $sqs;
@@ -109,15 +110,15 @@ my $sqs;
sub packagemsg {
my ($subject,$message,$citation,$baseurl,$attachmenturl)=@_;
- $message =&HTML::Entities::encode($message);
- $citation=&HTML::Entities::encode($citation);
- $subject =&HTML::Entities::encode($subject);
+ $message =&HTML::Entities::encode($message,'<>&"');
+ $citation=&HTML::Entities::encode($citation,'<>&"');
+ $subject =&HTML::Entities::encode($subject,'<>&"');
#remove machine specification
$baseurl =~ s|^http://[^/]+/|/|;
- $baseurl =&HTML::Entities::encode($baseurl);
+ $baseurl =&HTML::Entities::encode($baseurl,'<>&"');
#remove machine specification
$attachmenturl =~ s|^http://[^/]+/|/|;
- $attachmenturl =&HTML::Entities::encode($attachmenturl);
+ $attachmenturl =&HTML::Entities::encode($attachmenturl,'<>&"');
my $now=time;
$msgcount++;
@@ -139,6 +140,7 @@ sub packagemsg {
'
'.&mt('Attachment').': '.$fname.'.'.$ft.''; } else { - $content{'message'}.='
'.&mt('Attachment').': '.$fname.'.'.$ft.''; + &Apache::lonnet::allowuploaded('/adm/msg', + $content{'attachmenturl'}); + $content{'message'}.='
'.&mt('Attachment'). + ': '. + $fname.'.'.$ft.''; } } return %content; @@ -203,7 +207,7 @@ sub sendemail { my $msg = new Mail::Send; $msg->to($to); $msg->subject('[LON-CAPA] '.$subject); - if (my $fh = $msg->open('smtp',Server => 'localhost')) { + if (my $fh = $msg->open()) { print $fh $body; $fh->close; } @@ -274,18 +278,13 @@ sub author_res_msg { sub retrieve_author_res_msg { my $url=shift; $url=&Apache::lonnet::declutter($url); - my ($domain,$author,$file)=($url=~/^(\w+)\/(\w+)\/(.+)$/); - my $listall=($file eq 'allbombs'); + my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//); my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$domain,$author); my $msgs=''; foreach (keys %errormsgs) { - if (($_=~/^\Q$url\E\_\d+$/) || ($listall)) { - my ($errurl)=($_=~/^(.+)\_(\d+)$/); + if ($_=~/^\Q$url\E\_\d+$/) { my %content=&unpackagemsg($errormsgs{$_}); $msgs.='
'.
- ($listall?"".
- $errurl.
- ' ':' ').
$content{'time'}.': '.$content{'message'}.
'
ENDDISHEADER
my %coursepersonnel=
@@ -604,7 +603,9 @@ $content{'sendername'}.'@'.
'
'.&mt('Subject').': '.$content{'subject'}.
'
'. &Apache::lontexconvert::msgtexconverted($content{'message'}). - ''. + ''. +&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox'). + '
'; - } - my %lt=&Apache::lonlocal::texthash( - 'to' => 'To', - 'sb' => 'Subject', - 'sr' => 'Send Reply', - 'ca' => 'Cancel' - ); - $r->print(<<"ENDREPLY"); -
-ENDREPLY -} - sub sortedmessages { my @messages = &Apache::lonnet::getkeys('nohist_email'); #unpack the varibles and repack into temp for sorting @@ -785,7 +741,7 @@ ENDDISHEADER } $r->print(''. ''. - ''. + ''. '