--- loncom/interface/lonmsg.pm 2003/10/18 16:33:44 1.70
+++ loncom/interface/lonmsg.pm 2004/05/10 22:39:51 1.100
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.70 2003/10/18 16:33:44 www Exp $
+# $Id: lonmsg.pm,v 1.100 2004/05/10 22:39:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,23 +25,8 @@
#
# http://www.lon-capa.org/
#
-#
-# (Routines to control the menu
-#
-# (TeX Conversion Module
-#
-# 05/29/00,05/30 Gerd Kortemeyer)
-#
-# 10/05 Gerd Kortemeyer)
-#
-# 10/19,10/20,10/30,
-# 02/06/01 Gerd Kortemeyer
-# 07/27 Guy Albertelli
-# 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15,
-# 10/1,11/5 Gerd Kortemeyer
-# YEAR=2002
-# 1/1,3/18 Gerd Kortemeyer
-#
+
+
package Apache::lonmsg;
=pod
@@ -116,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;
@@ -124,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++;
@@ -154,6 +140,7 @@ sub packagemsg {
'
'.&mt('Attachment').': '.$fname.'.'.$ft.''; + $content{'message'}.='
'.&mt('Attachment').': '.$fname.''; } else { - $content{'message'}.='
'.&mt('Attachment').': '.$fname.'.'.$ft.''; + &Apache::lonnet::allowuploaded('/adm/msg', + $content{'attachmenturl'}); + $content{'message'}.='
'.&mt('Attachment'). + ': '. + $fname.''; } } return %content; @@ -218,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; } @@ -284,6 +273,53 @@ sub author_res_msg { return 'no_host'; } +# =========================================== Retrieve author resource messages + +sub retrieve_author_res_msg { + my $url=shift; + $url=&Apache::lonnet::declutter($url); + 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+$/) { + my %content=&unpackagemsg($errormsgs{$_}); + $msgs.='
'.
+ $content{'time'}.': '.$content{'message'}.
+ '
ENDDISHEADER
my %coursepersonnel=
@@ -567,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 @@ -748,7 +741,7 @@ ENDDISHEADER } $r->print(''. ''. - ''. + ''. '