version 1.181.2.8, 2021/12/14 00:20:07
|
version 1.195, 2021/11/30 16:16:14
|
Line 791 sub groupmail_header {
|
Line 791 sub groupmail_header {
|
({text=>&mt('Group').": $description", |
({text=>&mt('Group').": $description", |
no_mt=>1,}); |
no_mt=>1,}); |
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/email?compose=group&group=". |
({href=>"/adm/email?compose=group&group=". |
"$env{'form.group'}&$refarg", |
"$env{'form.group'}&$refarg", |
text=>"Send a Message in a Group", |
text=>"Send a Message in a Group", |
title=>"Compose Group Message"},); |
title=>"Compose Group Message"},); |
if ($action eq 'sending') { |
if ($action eq 'sending') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({text=>"Messages being sent.", |
({text=>"Messages being sent.", |
Line 1430 sub compout {
|
Line 1430 sub compout {
|
); |
); |
if (!$forwarding && !$multiforward) { |
if (!$forwarding && !$multiforward) { |
$attachrow = '<tr><td colspan="3"><b>'.$lt{'atta'}.'</b> '.$attachmax{'text'} |
$attachrow = '<tr><td colspan="3"><b>'.$lt{'atta'}.'</b> '.$attachmax{'text'} |
.': <input type="file" name="attachment" class="LC_flUpload" />' |
.': <input type="file" name="attachment" class="LC_flUpload" multiple />' |
.'<input type="hidden" id="LC_free_space" value="'.$attachmax{'num'}.'" />' |
.'<input type="hidden" id="LC_free_space" value="'.$attachmax{'num'}.'" />' |
.'</td></tr>'; |
.'</td></tr>'; |
} |
} |
Line 2118 sub displaymessage {
|
Line 2118 sub displaymessage {
|
my $clientip = &Apache::lonnet::get_requestor_ip($r); |
my $clientip = &Apache::lonnet::get_requestor_ip($r); |
|
|
# info to generate "next" and "previous" buttons and check if message is blocked |
# info to generate "next" and "previous" buttons and check if message is blocked |
my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) = |
my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) = |
&Apache::loncommon::blockcheck(\%setters,'com',$clientip); |
&Apache::loncommon::blockcheck(\%setters,'com',$clientip); |
my @messages=&sortedmessages(\%blocked,$startblock,$endblock,$by_ip,\$numblocked,$folder,$msgstatus); |
my @messages=&sortedmessages(\%blocked,$startblock,$endblock,$by_ip,\$numblocked,$folder,$msgstatus); |
if ( $blocked{$msgid} eq 'ON' ) { |
if ( $blocked{$msgid} eq 'ON' ) { |
Line 2688 sub displayresource {
|
Line 2688 sub displayresource {
|
} |
} |
# Could not get a symb, give up |
# Could not get a symb, give up |
unless ($symb) { return $content{'citation'}; } |
unless ($symb) { return $content{'citation'}; } |
|
if ($symb =~ /ext\.tool$/) { |
|
return '<h2>'.&mt('Current transactions for student (if applicable)').'</h2>'. |
|
&Apache::loncommon::get_previous_attempt($symb, |
|
$content{'sendername'}, |
|
$content{'senderdomain'}, |
|
$content{'courseid'}); |
|
} |
# Have a symb, can render |
# Have a symb, can render |
return '<h2>'.&mt('Current attempts of student (if applicable)').'</h2>'. |
return '<h2>'.&mt('Current attempts of student (if applicable)').'</h2>'. |
&Apache::loncommon::get_previous_attempt($symb, |
&Apache::loncommon::get_previous_attempt($symb, |
Line 2794 sub sendoffmail {
|
Line 2801 sub sendoffmail {
|
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
} |
} |
if ($env{'form.send'}) { |
if ($env{'form.send'}) { |
if (!$env{'form.multiforward'}) { |
if (!$env{'form.multiforward'}) { |
if ($group eq '') { |
if ($group eq '') { |
&printheader($r,'','Messages being sent.'); |
&printheader($r,'','Messages being sent.'); |
} else { |
} else { |
Line 2824 sub sendoffmail {
|
Line 2831 sub sendoffmail {
|
|
|
my $mode = $env{'form.sendmode'}; |
my $mode = $env{'form.sendmode'}; |
my (%toaddr,$tos,$cc,$bcc,$broadcast); |
my (%toaddr,$tos,$cc,$bcc,$broadcast); |
|
my (%willtrust,%trustchecked,%disallowed); |
|
my $serverdefdom = &Apache::lonnet::default_login_domain(); |
|
|
if ($mode eq 'group') { |
if ($mode eq 'group') { |
if (defined($env{'form.courserecips'})) { |
if (defined($env{'form.courserecips'})) { |
Line 2833 sub sendoffmail {
|
Line 2842 sub sendoffmail {
|
foreach my $dest (@to) { |
foreach my $dest (@to) { |
my ($user,$domain) = split(/:/, $dest); |
my ($user,$domain) = split(/:/, $dest); |
if (($user ne '') && ($domain ne '')) { |
if (($user ne '') && ($domain ne '')) { |
my $rec = $user.":".$domain; |
unless ($trustchecked{$domain}) { |
$toaddr{$rec} = ''; |
$willtrust{$domain} = &Apache::lonnet::will_trust('msg',$serverdefdom,$domain); |
$broadcast->{$rec} = ''; |
$trustchecked{$domain} = 1; |
|
} |
|
if ($willtrust{$domain}) { |
|
my $rec = $user.":".$domain; |
|
$toaddr{$rec} = ''; |
|
$broadcast->{$rec} = ''; |
|
} else { |
|
$disallowed{'to'}{$user.":".$domain} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2846 sub sendoffmail {
|
Line 2863 sub sendoffmail {
|
if ($txt) { |
if ($txt) { |
$rec =~ s/^\s+//; |
$rec =~ s/^\s+//; |
$rec =~ s/\s+$//; |
$rec =~ s/\s+$//; |
$toaddr{$rec}.=$txt."\n"; |
my ($recuname,$recudom) = split(/:/,$rec); |
$broadcast->{$rec} = ''; |
unless ($trustchecked{$recudom}) { |
|
$willtrust{$recudom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$recudom); |
|
$trustchecked{$recudom} = 1; |
|
} |
|
if ($willtrust{$recudom}) { |
|
$toaddr{$rec}.=$txt."\n"; |
|
$broadcast->{$rec} = ''; |
|
} else { |
|
$disallowed{'to'}{$rec} = 1; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) { |
if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) { |
$toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; |
unless ($trustchecked{$env{'form.recdomain'}}) { |
$tos->{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; |
$willtrust{$env{'form.recdomain'}} = &Apache::lonnet::will_trust('msg',$serverdefdom,$env{'form.recdomain'}); |
|
$trustchecked{$env{'form.recdomain'}} = 1; |
|
} |
|
if ($willtrust{$env{'form.recdomain'}}) { |
|
$toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; |
|
$tos->{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; |
|
} else { |
|
$disallowed{'to'}{$env{'form.recuname'}.':'.$env{'form.recdomain'}}; |
|
} |
} |
} |
} |
} |
if ($env{'form.additionalrec_to'}) { |
if ($env{'form.additionalrec_to'}) { |
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_to'})) { |
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_to'})) { |
my ($auname,$audom)=split(/:/,$rec); |
my ($auname,$audom)=split(/:/,$rec); |
if (($auname ne "") && ($audom ne "")) { |
if (($auname ne "") && ($audom ne "")) { |
$toaddr{$auname.':'.$audom}=''; |
unless ($trustchecked{$audom}) { |
$tos->{$auname.':'.$audom}=''; |
$willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); |
|
$trustchecked{$audom} = 1; |
|
} |
|
if ($willtrust{$audom}) { |
|
$toaddr{$auname.':'.$audom}=''; |
|
$tos->{$auname.':'.$audom}=''; |
|
} else { |
|
$disallowed{'to'}{$auname.':'.$audom}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2871 sub sendoffmail {
|
Line 2913 sub sendoffmail {
|
foreach my $rec (@toreplies) { |
foreach my $rec (@toreplies) { |
my ($auname,$audom)=split(/:/,$rec); |
my ($auname,$audom)=split(/:/,$rec); |
if (($auname ne "") && ($audom ne "")) { |
if (($auname ne "") && ($audom ne "")) { |
$toaddr{$auname.':'.$audom}=''; |
unless ($trustchecked{$audom}) { |
$tos->{$auname.':'.$audom}=''; |
$willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); |
|
$trustchecked{$audom} = 1; |
|
} |
|
if ($willtrust{$audom}) { |
|
$toaddr{$auname.':'.$audom}=''; |
|
$tos->{$auname.':'.$audom}=''; |
|
} else { |
|
$disallowed{'to'}{$auname.':'.$audom}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2880 sub sendoffmail {
|
Line 2930 sub sendoffmail {
|
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_cc'})) { |
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_cc'})) { |
my ($auname,$audom)=split(/:/,$rec); |
my ($auname,$audom)=split(/:/,$rec); |
if (($auname ne "") && ($audom ne "")) { |
if (($auname ne "") && ($audom ne "")) { |
$toaddr{$auname.':'.$audom}=''; |
|
if (!defined($tos->{$auname.':'.$audom})) { |
if (!defined($tos->{$auname.':'.$audom})) { |
$cc->{$auname.':'.$audom}=''; |
unless ($trustchecked{$audom}) { |
|
$willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); |
|
$trustchecked{$audom} = 1; |
|
} |
|
if ($willtrust{$audom}) { |
|
$toaddr{$auname.':'.$audom}=''; |
|
$cc->{$auname.':'.$audom}=''; |
|
} else { |
|
$disallowed{'cc'}{$auname.':'.$audom}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2893 sub sendoffmail {
|
Line 2951 sub sendoffmail {
|
foreach my $rec (@ccreplies) { |
foreach my $rec (@ccreplies) { |
my ($auname,$audom)=split(/:/,$rec); |
my ($auname,$audom)=split(/:/,$rec); |
if (($auname ne "") && ($audom ne "")) { |
if (($auname ne "") && ($audom ne "")) { |
$toaddr{$auname.':'.$audom}=''; |
|
if (!defined($tos->{$auname.':'.$audom})) { |
if (!defined($tos->{$auname.':'.$audom})) { |
$cc->{$auname.':'.$audom}=''; |
unless ($trustchecked{$audom}) { |
|
$willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); |
|
$trustchecked{$audom} = 1; |
|
} |
|
if ($willtrust{$audom}) { |
|
$toaddr{$auname.':'.$audom}=''; |
|
$cc->{$auname.':'.$audom}=''; |
|
} else { |
|
$disallowed{'cc'}{$auname.':'.$audom} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2906 sub sendoffmail {
|
Line 2972 sub sendoffmail {
|
foreach my $rec (@groupreplies) { |
foreach my $rec (@groupreplies) { |
my ($auname,$audom)=split(/:/,$rec); |
my ($auname,$audom)=split(/:/,$rec); |
if (($auname ne "") && ($audom ne "")) { |
if (($auname ne "") && ($audom ne "")) { |
$toaddr{$auname.':'.$audom}=''; |
|
if (!defined($tos->{$auname.':'.$audom})) { |
if (!defined($tos->{$auname.':'.$audom})) { |
$broadcast->{$auname.':'.$audom}=''; |
unless ($trustchecked{$audom}) { |
|
$willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); |
|
$trustchecked{$audom} = 1; |
|
} |
|
if ($willtrust{$audom}) { |
|
$toaddr{$auname.':'.$audom}=''; |
|
$broadcast->{$auname.':'.$audom}=''; |
|
} else { |
|
$disallowed{'to'}{$auname.':'.$audom} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2917 sub sendoffmail {
|
Line 2991 sub sendoffmail {
|
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_bcc'})) { |
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_bcc'})) { |
my ($auname,$audom)=split(/:/,$rec); |
my ($auname,$audom)=split(/:/,$rec); |
if (($auname ne "") && ($audom ne "")) { |
if (($auname ne "") && ($audom ne "")) { |
$toaddr{$auname.':'.$audom}=''; |
if ((!defined($tos->{$auname.':'.$audom})) && |
if ((!defined($tos->{$auname.':'.$audom})) && |
|
(!defined($cc->{$auname.':'.$audom}))) { |
(!defined($cc->{$auname.':'.$audom}))) { |
$bcc->{$auname.':'.$audom}=''; |
unless ($trustchecked{$audom}) { |
|
$willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); |
|
$trustchecked{$audom} = 1; |
|
} |
|
if ($willtrust{$audom}) { |
|
$toaddr{$auname.':'.$audom}=''; |
|
$bcc->{$auname.':'.$audom}=''; |
|
} else { |
|
$disallowed{'bcc'}{$auname.':'.$audom} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2940 sub sendoffmail {
|
Line 3022 sub sendoffmail {
|
} else { |
} else { |
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); |
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); |
} |
} |
my %reciphash = ( |
my ($recipid, @recusers, @recudoms, %permresults); |
to => $tos, |
if (keys(%toaddr) > 0) { |
cc => $cc, |
my %reciphash = ( |
bcc => $bcc, |
to => $tos, |
); |
cc => $cc, |
if ($mode eq 'group') { |
bcc => $bcc, |
if ($group eq '') { |
); |
$reciphash{'course_broadcast'} = $broadcast; |
if ($mode eq 'group') { |
} else { |
if ($group eq '') { |
if ($env{'form.groupmail'} eq 'cc') { |
$reciphash{'course_broadcast'} = $broadcast; |
$reciphash{'group_cc_broadcast'} = $broadcast; |
|
} else { |
} else { |
$reciphash{'group_bcc_broadcast'} = $broadcast; |
if ($env{'form.groupmail'} eq 'cc') { |
|
$reciphash{'group_cc_broadcast'} = $broadcast; |
|
} else { |
|
$reciphash{'group_bcc_broadcast'} = $broadcast; |
|
} |
} |
} |
} |
} |
} |
($recipid,my $recipstatus) = |
my ($recipid,$recipstatus) = |
&Apache::lonmsg::store_recipients($msgsubj,$env{'user.name'}, |
&Apache::lonmsg::store_recipients($msgsubj,$env{'user.name'}, |
$env{'user.domain'},\%reciphash); |
$env{'user.domain'},\%reciphash); |
if ($recipstatus ne 'ok') { |
if ($recipstatus ne 'ok') { |
&Apache::lonnet::logthis('Failed to store To, Bcc and Cc recipients for '.$env{'user.name'}.':'.$env{'user.domain'}); |
&Apache::lonnet::logthis('Failed to store To, Bcc and Cc recipients for '.$env{'user.name'}.':'.$env{'user.domain'}); |
} |
} |
if ($env{'form.attachment'}) { |
if ($env{'form.attachment'}) { |
if (length($env{'form.attachment'}) <= 1048576) { |
if (length($env{'form.attachment'}) <= 1048576) { |
$attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now); |
$attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now); |
} else { |
} else { |
$r->print('<p><span class="LC_warning">'.&mt('Attachment not included - exceeded permitted length').'</span><br /></p>'); |
$r->print('<p><span class="LC_warning">'.&mt('Attachment not included - exceeded permitted length').'</span><br /></p>'); |
} |
} |
} elsif ($env{'form.multiforward'}) { |
} elsif ($env{'form.multiforward'}) { |
if ($env{'form.attachmenturl'} ne '') { |
if ($env{'form.attachmenturl'} ne '') { |
$attachmenturl = $env{'form.attachmenturl'}; |
$attachmenturl = $env{'form.attachmenturl'}; |
} |
} |
} |
} |
} |
my @recusers; |
|
my @recudoms; |
|
my %permresults; |
|
foreach my $address (sort(keys(%toaddr))) { |
foreach my $address (sort(keys(%toaddr))) { |
my ($recuname,$recdomain)=split(/\:/,$address); |
my ($recuname,$recdomain)=split(/\:/,$address); |
my $msgtxt = $savemsg; |
my $msgtxt = $savemsg; |
Line 3113 sub sendoffmail {
|
Line 3195 sub sendoffmail {
|
$r->print($message); |
$r->print($message); |
} |
} |
} |
} |
|
if (keys(%disallowed)) { |
|
if ((ref($disallowed{'to'}) eq 'HASH') && (keys(%{$disallowed{'to'}}) > 0)) { |
|
$r->print(&mt("The following recipients were excluded because the user's domain does not accept messages from server's domain:").'<ul><li>'. |
|
join("</li><li>\n",sort(keys(%{$disallowed{'to'}}))). |
|
'</li><ul><br />'); |
|
} |
|
if (ref($disallowed{'cc'}) eq 'HASH') { |
|
$r->print(&mt("The following CCs were excluded because the user's domain does not accept messages from server's domain:").'<ul><li>'. |
|
join("</li><li>\n",sort(keys(%{$disallowed{'cc'}}))). |
|
'</li><ul><br />'); |
|
} |
|
if (ref($disallowed{'bcc'}) eq 'HASH') { |
|
$r->print(&mt("The following BCCs were excluded because the user's domain does not accept messages from server's domain:").'<ul><li>'. |
|
join("</li><li>\n",sort(keys(%{$disallowed{'bcc'}}))). |
|
'</li><ul><br />'); |
|
} |
|
} |
} else { |
} else { |
&printheader($r,'','Messages cancelled.'); |
&printheader($r,'','Messages cancelled.'); |
return 'cancelled'; |
return 'cancelled'; |