version 1.16, 2006/04/10 21:40:08
|
version 1.19, 2006/05/30 12:46:09
|
Line 34 use Apache::lonlocal;
|
Line 34 use Apache::lonlocal;
|
use Mail::Send; |
use Mail::Send; |
use HTML::TokeParser; |
use HTML::TokeParser; |
use HTML::Entities; |
use HTML::Entities; |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
sub handler { |
sub handler { |
my ($r) = @_; |
my ($r) = @_; |
Line 109 sub start_page {
|
Line 111 sub start_page {
|
{'add_entries' => |
{'add_entries' => |
{'onload' => $loadcode,},}); |
{'onload' => $loadcode,},}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs(undef,$bread_title, |
&Apache::lonhtmlcommon::breadcrumbs($bread_title, |
'Broadcast_system_email'); |
'Broadcast_system_email'); |
my $output = <<"ENDONE"; |
my $output = <<"ENDONE"; |
$start_page |
$start_page |
Line 294 ENDSCRIPT
|
Line 296 ENDSCRIPT
|
$rowColor = $rowColor2; |
$rowColor = $rowColor2; |
} |
} |
my $recipients = ''; |
my $recipients = ''; |
my ($date,$subj,$sname,$sdom) = |
my ($date,undef,$sname,$sdom) = |
&Apache::lonmsg::unpackmsgid($msgid,undef,1); |
&Apache::lonmsg::unpackmsgid($msgid,undef,1); |
$subj = &Apache::lonnet::escape($subj); |
|
$date = &Apache::lonlocal::locallocaltime($date); |
$date = &Apache::lonlocal::locallocaltime($date); |
foreach my $user (sort(keys(%{$dcmail{$msgid}{recipient}}))) { |
foreach my $user (sort(keys(%{$dcmail{$msgid}{recipient}}))) { |
$recipients .= $dcmail{$msgid}{recipient}{$user}.', '; |
$recipients .= $dcmail{$msgid}{recipient}{$user}.', '; |
Line 307 ENDSCRIPT
|
Line 308 ENDSCRIPT
|
} |
} |
} else { |
} else { |
foreach my $msgid (sort(keys(%dcmail))) { |
foreach my $msgid (sort(keys(%dcmail))) { |
my ($date,$subj,$sname,$sdom) = |
my ($date,undef,$sname,$sdom) = |
&Apache::lonmsg::unpackmsgid($msgid,undef,1); |
&Apache::lonmsg::unpackmsgid($msgid,undef,1); |
$subj = &Apache::lonnet::escape($subj); |
|
if ($env{'form.sortby'} eq 'subject') { |
if ($env{'form.sortby'} eq 'subject') { |
push @{$Sortby{$dcmail{$msgid}{subject}}},$msgid; |
push @{$Sortby{$dcmail{$msgid}{subject}}},$msgid; |
} elsif ($env{'form.sortby'} eq 'message') { |
} elsif ($env{'form.sortby'} eq 'message') { |
Line 343 ENDSCRIPT
|
Line 343 ENDSCRIPT
|
} |
} |
$recipients =~ s/,\s$//; |
$recipients =~ s/,\s$//; |
} |
} |
my ($date,$subj,$sname,$sdom) = |
my ($date,undef,$sname,$sdom) = |
&Apache::lonmsg::unpackmsgid($msgid,undef,1); |
&Apache::lonmsg::unpackmsgid($msgid,undef,1); |
$subj = &Apache::lonnet::escape($subj); |
|
$date = &Apache::lonlocal::locallocaltime($date); |
$date = &Apache::lonlocal::locallocaltime($date); |
$output .= '<tr bgcolor="'.$rowColor.'"><td><small>'.$date.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{subject}).'</small></td><td><small>'.$sname.':'.$sdom.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{message}).'</small></td><td><small>'.$recipients.'</small></td></tr>'."\n"; |
$output .= '<tr bgcolor="'.$rowColor.'"><td><small>'.$date.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{subject}).'</small></td><td><small>'.$sname.':'.$sdom.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{message}).'</small></td><td><small>'.$recipients.'</small></td></tr>'."\n"; |
$rowNum ++; |
$rowNum ++; |
Line 627 function goBack(target) {
|
Line 626 function goBack(target) {
|
} |
} |
foreach my $username (sort(keys(%recipients))) { |
foreach my $username (sort(keys(%recipients))) { |
if ($recipients{$username} =~ /\@/) { |
if ($recipients{$username} =~ /\@/) { |
my $value=&Apache::lonnet::escape($username).':'.&Apache::lonnet::escape($recipients{$username}); |
my $value=&escape($username).':'.&escape($recipients{$username}); |
$output .= '<tr><td><input type="checkbox" name="recipient" value="'.$value.'" /></td><td>'.$username.'</td><td> </td><td>'.$recipients{$username}.'</td></tr>'; |
$output .= '<tr><td><input type="checkbox" name="recipient" value="'.$value.'" /></td><td>'.$username.'</td><td> </td><td>'.$recipients{$username}.'</td></tr>'; |
} |
} |
} |
} |
Line 706 ENDSCRIPT
|
Line 705 ENDSCRIPT
|
<td>'; |
<td>'; |
foreach my $person (@deliveries) { |
foreach my $person (@deliveries) { |
my ($username,$email) = split(/:/,$person); |
my ($username,$email) = split(/:/,$person); |
$output .= &Apache::lonnet::unescape($email).' ('.&Apache::lonnet::unescape($username).')<br />'."\n"; |
$output .= &unescape($email).' ('.&unescape($username).')<br />'."\n"; |
} |
} |
$output .= '</td> |
$output .= '</td> |
</tr> |
</tr> |
Line 732 sub broadcast_email {
|
Line 731 sub broadcast_email {
|
foreach my $user (@{$recipients}) { |
foreach my $user (@{$recipients}) { |
my $msg = new Mail::Send; |
my $msg = new Mail::Send; |
my ($username,$to) = split(/:/,$user); |
my ($username,$to) = split(/:/,$user); |
$username = &Apache::lonnet::unescape($username); |
$username = &unescape($username); |
$to = &Apache::lonnet::unescape($to); |
$to = &unescape($to); |
$msg->to($to); |
$msg->to($to); |
$msg->subject($subject); |
$msg->subject($subject); |
$msg->add('From',"$from"); |
$msg->add('From',"$from"); |