version 1.159, 2005/11/29 22:41:30
|
version 1.162, 2005/12/09 20:54:26
|
Line 97 Right now, this document will cover just
|
Line 97 Right now, this document will cover just
|
it is likely you will not need to programmatically read messages, |
it is likely you will not need to programmatically read messages, |
since lonmsg already implements that functionality. |
since lonmsg already implements that functionality. |
|
|
|
The routines used to package messages and unpackage messages are not |
|
only used by lonmsg when creating/extracting messages for LON-CAPA's |
|
internal messaging system, but also by lonnotify.pm which is available |
|
for use by Domain Coordinators to broadcast standard e-mail to specified |
|
users in their domain. The XML packaging used in the two cases is very |
|
similar. The differences are the use of <recuser>$uname</recuser> and |
|
<recdomain>$udom</recdomain> in stored internal messages, compared |
|
with <recipient username="$uname:$udom">$email</recipient> in stored |
|
Domain Coordinator e-mail for teh storage of information about |
|
recipients of the message/e-mail. |
|
|
=head1 FUNCTIONS |
=head1 FUNCTIONS |
|
|
=over 4 |
=over 4 |
Line 126 my $interdis;
|
Line 137 my $interdis;
|
|
|
sub packagemsg { |
sub packagemsg { |
my ($subject,$message,$citation,$baseurl,$attachmenturl, |
my ($subject,$message,$citation,$baseurl,$attachmenturl, |
$recuser,$recdomain,$msgid)=@_; |
$recuser,$recdomain,$msgid,$type)=@_; |
$message =&HTML::Entities::encode($message,'<>&"'); |
$message =&HTML::Entities::encode($message,'<>&"'); |
$citation=&HTML::Entities::encode($citation,'<>&"'); |
$citation=&HTML::Entities::encode($citation,'<>&"'); |
$subject =&HTML::Entities::encode($subject,'<>&"'); |
$subject =&HTML::Entities::encode($subject,'<>&"'); |
Line 142 sub packagemsg {
|
Line 153 sub packagemsg {
|
split(/\:/,&Apache::lonnet::unescape($env{'form.replyid'})); |
split(/\:/,&Apache::lonnet::unescape($env{'form.replyid'})); |
$course_context = $origcid; |
$course_context = $origcid; |
} |
} |
|
foreach my $key (keys(%env)) { |
|
if ($key=~/^form\.(rep)?rec\_(.*)$/) { |
|
my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$origcid) = |
|
split(/\:/,&Apache::lonnet::unescape($2)); |
|
$course_context = $origcid; |
|
last; |
|
} |
|
} |
unless(defined($course_context)) { |
unless(defined($course_context)) { |
$course_context = $env{'request.course.id'}; |
$course_context = $env{'request.course.id'}; |
} |
} |
Line 170 sub packagemsg {
|
Line 189 sub packagemsg {
|
'<msgid>'.$msgid.'</msgid>'; |
'<msgid>'.$msgid.'</msgid>'; |
if (ref($recuser) eq 'ARRAY') { |
if (ref($recuser) eq 'ARRAY') { |
for (my $i=0; $i<@{$recuser}; $i++) { |
for (my $i=0; $i<@{$recuser}; $i++) { |
$result .= '<recuser>'.$$recuser[$i].'</recuser>'. |
if ($type eq 'dcmail') { |
'<recdomain>'.$$recdomain[$i].'</recdomain>'; |
my ($username,$email) = split(/:/,$$recuser[$i]); |
|
$username = &Apache::lonnet::unescape($username); |
|
$email = &Apache::lonnet::unescape($email); |
|
$username = &HTML::Entities::encode($username,'<>&"'); |
|
$email = &HTML::Entities::encode($email,'<>&"'); |
|
$result .= '<recipient username="'.$username.'">'. |
|
$email.'</recipient>'; |
|
} else { |
|
$result .= '<recuser>'.$$recuser[$i].'</recuser>'. |
|
'<recdomain>'.$$recdomain[$i].'</recdomain>'; |
|
} |
} |
} |
} else { |
} else { |
$result .= '<recuser>'.$recuser.'</recuser>'. |
$result .= '<recuser>'.$recuser.'</recuser>'. |
Line 203 sub unpackagemsg {
|
Line 232 sub unpackagemsg {
|
my $value=$parser->get_text('/'.$entry); |
my $value=$parser->get_text('/'.$entry); |
if (($entry eq 'recuser') || ($entry eq 'recdomain')) { |
if (($entry eq 'recuser') || ($entry eq 'recdomain')) { |
push(@{$content{$entry}},$value); |
push(@{$content{$entry}},$value); |
|
} elsif ($entry eq 'recipient') { |
|
my $username = $token->[2]{'username'}; |
|
$username = &HTML::Entities::decode($username,'<>&"'); |
|
$content{$entry}{$username} = $value; |
} else { |
} else { |
$content{$entry}=$value; |
$content{$entry}=$value; |
} |
} |
Line 1181 sub compout {
|
Line 1214 sub compout {
|
&mt('and return receipt') . '</label>' . $crithelp . |
&mt('and return receipt') . '</label>' . $crithelp . |
'</p><p><label><input type="checkbox" name="permanent" /> '. |
'</p><p><label><input type="checkbox" name="permanent" /> '. |
&mt('Send copy to permanent email address (if known)').'</label></p>'. |
&mt('Send copy to permanent email address (if known)').'</label></p>'. |
'<p><label><input type="checkbox" name="rsspost" /> '. |
'<!-- <p><label><input type="checkbox" name="rsspost" /> '. |
&mt('Include in course RSS newsfeed').'</label></p>'; } |
&mt('Include in course RSS newsfeed').'</label></p>-->'; } |
my %message; |
my %message; |
my %content; |
my %content; |
my $defdom=$env{'user.domain'}; |
my $defdom=$env{'user.domain'}; |