version 1.4, 2006/04/22 17:10:07
|
version 1.13, 2006/04/25 19:50:09
|
Line 184 sub statuschange {
|
Line 184 sub statuschange {
|
&Apache::lonnet::put('email_status'.$suffix,{$msgid => $newstatus}); |
&Apache::lonnet::put('email_status'.$suffix,{$msgid => $newstatus}); |
} |
} |
if ($newstatus eq 'deleted') { |
if ($newstatus eq 'deleted') { |
&movemsg(&Apache::lonnet::unescape($msgid),$folder,'trash'); |
return &movemsg($msgid,$folder,'trash'); |
} |
} |
|
return ; |
} |
} |
|
|
# ============================================================= Make new folder |
# ============================================================= Make new folder |
Line 206 sub movemsg {
|
Line 207 sub movemsg {
|
if ($srcfolder eq 'new') { $srcfolder=''; } |
if ($srcfolder eq 'new') { $srcfolder=''; } |
my $srcsuffix=&Apache::lonmsg::foldersuffix($srcfolder); |
my $srcsuffix=&Apache::lonmsg::foldersuffix($srcfolder); |
my $trgsuffix=&Apache::lonmsg::foldersuffix($trgfolder); |
my $trgsuffix=&Apache::lonmsg::foldersuffix($trgfolder); |
|
if ($srcsuffix eq $trgsuffix) { |
|
return (0,&mt('Message not moved, Attempted to move message to the same folder as it already is in.')); |
|
} |
|
|
# Copy message |
# Copy message |
my %message=&Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid]); |
my %message=&Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid]); |
&Apache::lonnet::put('nohist_email'.$trgsuffix,{$msgid => $message{$msgid}}); |
if (!exists($message{$msgid}) || $message{$msgid} eq '') { |
|
if (&Apache::slotrequest::network_error(%message)) { |
|
return (0,&mt('Message not moved, A network error occurred.')); |
|
} else { |
|
return (0,&mt('Message not moved as the message is no longer in the source folder.')); |
|
} |
|
} |
|
|
|
my $result =&Apache::lonnet::put('nohist_email'.$trgsuffix, |
|
{$msgid => $message{$msgid}}); |
|
if (&Apache::slotrequest::network_error($result)) { |
|
return (0,&mt('Message not moved, A network error occurred.')); |
|
} |
|
|
# Copy status |
# Copy status |
unless ($trgfolder eq 'trash') { |
unless ($trgfolder eq 'trash') { |
my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]); |
my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]); |
&Apache::lonnet::put('email_status'.$trgsuffix,{$msgid => $status{$msgid}}); |
# a non-existant status is the mark of an unread msg |
|
if (&Apache::slotrequest::network_error(%status)) { |
|
return (0,&mt('Message copied to new folder but status was not, A network error occurred.')); |
|
} |
|
my $result=&Apache::lonnet::put('email_status'.$trgsuffix, |
|
{$msgid => $status{$msgid}}); |
|
if (&Apache::slotrequest::network_error($result)) { |
|
return (0,&mt('Message copied to new folder but status was not, A network error occurred.')); |
|
} |
} |
} |
|
|
# Delete orginals |
# Delete orginals |
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]); |
my $result_del_msg = |
&Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]); |
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]); |
|
my $result_del_stat = |
|
&Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]); |
|
if (&Apache::slotrequest::network_error($result_del_msg)) { |
|
return (0,&mt('Message copied, but unable to delete the original from the source folder.')); |
|
} |
|
if (&Apache::slotrequest::network_error($result_del_stat)) { |
|
return (0,&mt('Message copied, but unable to delete the original status from the source folder.')); |
|
} |
|
|
|
return (1); |
} |
} |
|
|
# ======================================================= Display a course list |
# ======================================================= Display a course list |
Line 313 ENDDISHEADER
|
Line 348 ENDDISHEADER
|
|
|
sub discrit { |
sub discrit { |
my $r=shift; |
my $r=shift; |
my $header = '<h1><font color=red>'.&mt('Critical Messages').'</font></h1>'. |
my $header = '<h1><font color="red">'.&mt('Critical Messages').'</font></h1>'. |
'<form action="/adm/email" method="POST">'. |
'<form action="/adm/email" method="POST">'. |
'<input type="hidden" name="confirm" value="true" />'; |
'<input type="hidden" name="confirm" value="true" />'; |
my %what=&Apache::lonnet::dump('critical'); |
my %what=&Apache::lonnet::dump('critical'); |
Line 357 sub sortedmessages {
|
Line 392 sub sortedmessages {
|
my %descriptions; |
my %descriptions; |
my %status_cache = |
my %status_cache = |
&Apache::lonnet::get('email_status'.&Apache::lonmsg::foldersuffix($folder),\@messages); |
&Apache::lonnet::get('email_status'.&Apache::lonmsg::foldersuffix($folder),\@messages); |
foreach (@messages) { |
|
my $msgid=&Apache::lonnet::escape($_); |
my $get_received; |
|
if ($folder eq 'sent' |
|
&& ($env{'form.sortedby'} =~ m/^(rev)?(user|domain)$/)) { |
|
$get_received = 1; |
|
} |
|
|
|
foreach my $msgid (@messages) { |
|
my $esc_msgid=&Apache::lonnet::escape($msgid); |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)= |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)= |
&Apache::lonmsg::unpackmsgid($msgid,$folder,undef, |
&Apache::lonmsg::unpackmsgid($esc_msgid,$folder,undef, |
\%status_cache); |
\%status_cache); |
my $description = &get_course_desc($fromcid,\%descriptions); |
my $description = &get_course_desc($fromcid,\%descriptions); |
my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status, |
my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status, |
$msgid,$description); |
$esc_msgid,$description); |
|
if ($get_received) { |
|
my %message = &Apache::lonnet::get('nohist_email'.$suffix, |
|
[$msgid]); |
|
my %content = &Apache::lonmsg::unpackagemsg($message{$msgid}); |
|
push(@temp1,$content{'recuser'},$content{'recdomain'}); |
|
} |
# Check whether message was sent during blocking period. |
# Check whether message was sent during blocking period. |
if ($sendtime >= $startblock && ($sendtime <= $endblock && $endblock > 0) ) { |
if ($sendtime >= $startblock && ($sendtime <= $endblock && $endblock > 0) ) { |
my $escid = &Apache::lonnet::unescape($msgid); |
$$blocked{$msgid} = 'ON'; |
$$blocked{$escid} = 'ON'; |
|
$$numblocked ++; |
$$numblocked ++; |
} else { |
} else { |
push @temp ,\@temp1; |
push @temp ,\@temp1; |
Line 383 sub sortedmessages {
|
Line 430 sub sortedmessages {
|
@temp = sort {$b->[0] <=> $a->[0]} @temp; |
@temp = sort {$b->[0] <=> $a->[0]} @temp; |
} |
} |
if ($env{'form.sortedby'} eq "user"){ |
if ($env{'form.sortedby'} eq "user"){ |
@temp = sort {lc($a->[2]) cmp lc($b->[2])} @temp; |
if ($get_received) { |
|
@temp = sort {lc($a->[7][0]) cmp lc($b->[7][0])} @temp; |
|
} else { |
|
@temp = sort {lc($a->[2]) cmp lc($b->[2])} @temp; |
|
} |
} |
} |
if ($env{'form.sortedby'} eq "revuser"){ |
if ($env{'form.sortedby'} eq "revuser"){ |
@temp = sort {lc($b->[2]) cmp lc($a->[2])} @temp; |
if ($get_received) { |
|
@temp = sort {lc($b->[7][0]) cmp lc($a->[7][0])} @temp; |
|
} else { |
|
@temp = sort {lc($b->[2]) cmp lc($a->[2])} @temp; |
|
} |
} |
} |
if ($env{'form.sortedby'} eq "domain"){ |
if ($env{'form.sortedby'} eq "domain"){ |
@temp = sort {$a->[3] cmp $b->[3]} @temp; |
if ($get_received) { |
|
@temp = sort {$a->[8][0] cmp $b->[8][0]} @temp; |
|
} else { |
|
@temp = sort {$a->[3] cmp $b->[3]} @temp; |
|
} |
} |
} |
if ($env{'form.sortedby'} eq "revdomain"){ |
if ($env{'form.sortedby'} eq "revdomain"){ |
@temp = sort {$b->[3] cmp $a->[3]} @temp; |
if ($get_received) { |
|
@temp = sort {$b->[8][0] cmp $a->[8][0]} @temp; |
|
} else { |
|
@temp = sort {$b->[3] cmp $a->[3]} @temp; |
|
} |
} |
} |
if ($env{'form.sortedby'} eq "subject"){ |
if ($env{'form.sortedby'} eq "subject"){ |
@temp = sort {lc($a->[1]) cmp lc($b->[1])} @temp; |
@temp = sort {lc($a->[1]) cmp lc($b->[1])} @temp; |
Line 478 sub disnew {
|
Line 541 sub disnew {
|
push @newmsgs, { |
push @newmsgs, { |
msgid => $msgid, |
msgid => $msgid, |
sendtime => $sendtime, |
sendtime => $sendtime, |
shortsub => &Apache::lonnet::unescape($shortsubj), |
shortsub => $shortsubj, |
from => $fromname, |
from => $fromname, |
fromdom => $fromdom, |
fromdom => $fromdom, |
course => $description |
course => $description |
Line 624 ENDDISHEADER
|
Line 687 ENDDISHEADER
|
$r->print('<a href = "?sortedby=revstatus'.$fsqs.'">'.&mt('Status').'</a></th>'); |
$r->print('<a href = "?sortedby=revstatus'.$fsqs.'">'.&mt('Status').'</a></th>'); |
} |
} |
$r->print("</tr>\n"); |
$r->print("</tr>\n"); |
|
|
|
my $suffix = &Apache::lonmsg::foldersuffix($folder); |
for (my $n=$firstdis;$n<=$lastdis;$n++) { |
for (my $n=$firstdis;$n<=$lastdis;$n++) { |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$origID,$description)= @{$temp[$n]}; |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$origID, |
|
$description,$recv_name,$recv_domain)= |
|
@{$temp[$n]}; |
if (($status ne 'deleted') && defined($sendtime) && $sendtime!~/error/) { |
if (($status ne 'deleted') && defined($sendtime) && $sendtime!~/error/) { |
if ($status eq 'new') { |
if ($status eq 'new') { |
$r->print('<tr class="LC_mail_new">'); |
$r->print('<tr class="LC_mail_new">'); |
Line 636 ENDDISHEADER
|
Line 703 ENDDISHEADER
|
} else { |
} else { |
$r->print('<tr class="LC_mail_other">'); |
$r->print('<tr class="LC_mail_other">'); |
} |
} |
|
my ($dis_name,$dis_domain) = ($fromname,$fromdomain); |
|
if ($folder eq 'sent') { |
|
if (defined($recv_name) && !defined($recv_domain)) { |
|
$dis_name = join('<br />',@{$recv_name}); |
|
$dis_domain = join('<br />',@{$recv_domain}); |
|
} else { |
|
my $msg_id = &Apache::lonnet::unescape($origID); |
|
my %message = &Apache::lonnet::get('nohist_email'.$suffix, |
|
[$msg_id]); |
|
my %content = &Apache::lonmsg::unpackagemsg($message{$msg_id}); |
|
$dis_name = join('<br />',@{$content{'recuser'}}); |
|
$dis_domain = join('<br />',@{$content{'recdomain'}}); |
|
} |
|
} |
$r->print('<td><input type="checkbox" name="delmark_'.$origID.'" /></td><td><a href="/adm/email?display='.$origID.$sqs. |
$r->print('<td><input type="checkbox" name="delmark_'.$origID.'" /></td><td><a href="/adm/email?display='.$origID.$sqs. |
'">'.&mt('Open').'</a></td><td>'. |
'">'.&mt('Open').'</a></td><td>'. |
($folder ne 'trash'?'<a href="/adm/email?markdel='.$origID.$sqs. |
($folder ne 'trash'?'<a href="/adm/email?markdel='.$origID.$sqs. |
'">'.&mt('Delete'):' ').'</a></td>'. |
'">'.&mt('Delete'):' ').'</a></td>'. |
'<td>'.&Apache::lonlocal::locallocaltime($sendtime).'</td><td>'. |
'<td>'.&Apache::lonlocal::locallocaltime($sendtime).'</td><td>'. |
$fromname.'</td><td>'.$fromdomain.'</td><td>'. |
$dis_name.'</td><td>'.$dis_domain.'</td><td>'. |
&Apache::lonnet::unescape($shortsubj).'</td><td>'. |
$shortsubj.'</td><td>'. |
$description.'</td><td>'.$status.'</td></tr>'."\n"); |
$description.'</td><td>'.$status.'</td></tr>'."\n"); |
} elsif ($status eq 'deleted') { |
} elsif ($status eq 'deleted') { |
# purge |
# purge |
&movemsg(&Apache::lonnet::unescape($origID),$folder,'trash'); |
my ($result,$msg) = |
|
&movemsg(&Apache::lonnet::unescape($origID),$folder,'trash'); |
|
|
} |
} |
} |
} |
$r->print("</table>\n<p>". |
$r->print("</table>\n<p>". |
Line 1636 sub sendoffmail {
|
Line 1719 sub sendoffmail {
|
%content=&Apache::lonmsg::unpackagemsg($message{$msgid},1); |
%content=&Apache::lonmsg::unpackagemsg($message{$msgid},1); |
&statuschange($msgid,'replied',$folder); |
&statuschange($msgid,'replied',$folder); |
} |
} |
my %toaddr=(); |
|
undef %toaddr; |
my %toaddr; |
if ($env{'form.sendmode'} eq 'group') { |
if ($env{'form.sendmode'} eq 'group') { |
foreach (keys %env) { |
foreach $address (keys(%env)) { |
if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
$toaddr{$1}=''; |
$toaddr{$1}=''; |
} |
} |
} |
} |
} elsif ($env{'form.sendmode'} eq 'upload') { |
} elsif ($env{'form.sendmode'} eq 'upload') { |
foreach (split(/[\n\r\f]+/,$env{'form.upfile'})) { |
foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) { |
my ($rec,$txt)=split(/\s*\:\s*/,$_); |
my ($rec,$txt)=split(/\s*\:\s*/,$line); |
if ($txt) { |
if ($txt) { |
$rec=~s/\@/\:/; |
$rec=~s/\@/\:/; |
$toaddr{$rec}.=$txt."\n"; |
$toaddr{$rec}.=$txt."\n"; |
Line 1665 sub sendoffmail {
|
Line 1748 sub sendoffmail {
|
my $savemsg; |
my $savemsg; |
my $msgtype; |
my $msgtype; |
my %sentmessage; |
my %sentmessage; |
my $msgsubj=&Apache::lonfeedback::clear_out_html($env{'form.subject'}); |
my $msgsubj=&Apache::lonfeedback::clear_out_html($env{'form.subject'}, |
|
undef,1); |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
Line 1677 sub sendoffmail {
|
Line 1761 sub sendoffmail {
|
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); |
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); |
} |
} |
|
|
foreach (keys %toaddr) { |
foreach my $address (sort(keys(%toaddr))) { |
my ($recuname,$recdomain)=split(/\:/,$_); |
my ($recuname,$recdomain)=split(/\:/,$address); |
my $msgtxt = $savemsg; |
my $msgtxt = $savemsg; |
if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; } |
if ($toaddr{$address}) { $msgtxt.='<hr />'.$toaddr{$address}; } |
my $thismsg; |
my @thismsg; |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
'/'.$env{'request.course.sec'}))) { |
'/'.$env{'request.course.sec'}))) { |
$r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': '); |
$r->print(&mt('Sending critical message').' '.$recuname.':'.$recdomain.': '); |
$thismsg=&Apache::lonmsg::user_crit_msg($recuname,$recdomain,$msgsubj,$msgtxt, |
@thismsg= |
$env{'form.sendbck'},$env{'form.permanent'}, |
&Apache::lonmsg::user_crit_msg($recuname,$recdomain, |
\$sentmessage{$_}); |
$msgsubj,$msgtxt, |
|
$env{'form.sendbck'}, |
|
$env{'form.permanent'}, |
|
\$sentmessage{$address}); |
} else { |
} else { |
$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); |
$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); |
$thismsg=&Apache::lonmsg::user_normal_msg($recuname,$recdomain,$msgsubj,$msgtxt, |
@thismsg= |
$content{'citation'},undef,undef,$env{'form.permanent'},\$sentmessage{$_}); |
&Apache::lonmsg::user_normal_msg($recuname,$recdomain, |
|
$msgsubj,$msgtxt, |
|
$content{'citation'}, |
|
undef,undef, |
|
$env{'form.permanent'}, |
|
\$sentmessage{$address}); |
} |
} |
if (($env{'request.course.id'}) && (($msgtype eq 'critical') || |
if (($env{'request.course.id'}) && (($msgtype eq 'critical') || |
($env{'form.sendmode'} eq 'group'))) { |
($env{'form.sendmode'} eq 'group'))) { |
$specialmsg_status{$recuname.':'.$recdomain} = $thismsg; |
$specialmsg_status{$recuname.':'.$recdomain} = |
if ($thismsg eq 'ok') { |
join(' ',@thismsg); |
$numspecial ++; |
foreach my $result (@thismsg) { |
} |
if ($result eq 'ok') { |
|
$numspecial++; |
|
} |
|
} |
} |
} |
$r->print($thismsg.'<br />'); |
$sendstatus.=' '.join(' ',@thismsg); |
$sendstatus.=' '.$thismsg; |
|
} |
} |
if (($env{'request.course.id'}) && (($env{'form.sendmode'} eq 'group') |
if (($env{'request.course.id'}) && (($env{'form.sendmode'} eq 'group') |
|| ($msgtype eq 'critical'))) { |
|| ($msgtype eq 'critical'))) { |
Line 1726 sub sendoffmail {
|
Line 1820 sub sendoffmail {
|
} |
} |
if ($specialresult eq 'ok') { |
if ($specialresult eq 'ok') { |
my $record_sent; |
my $record_sent; |
my @recusers = (); |
my @recusers; |
my @recudoms = (); |
my @recudoms; |
my ($stamp,$crssubj,$msgname,$msgdom,$msgcount,$context,$pid) = |
my ($stamp,$crssubj,$msgname,$msgdom,$msgcount,$context,$pid) = |
split(/\:/,&Apache::lonnet::unescape($specialmsgid)); |
split(/\:/,&Apache::lonnet::unescape($specialmsgid)); |
|
|
foreach my $recipient (sort(keys(%toaddr))) { |
foreach my $recipient (sort(keys(%toaddr))) { |
if ($specialmsg_status{$recipient} eq 'ok') { |
if ($specialmsg_status{$recipient} eq 'ok') { |
my $usersubj = $subj_prefix.'['.$recipient.']'; |
my $usersubj = $subj_prefix.'['.$recipient.']'; |
Line 1741 sub sendoffmail {
|
Line 1836 sub sendoffmail {
|
&Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,$subj_prefix. |
&Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,$subj_prefix. |
' ['.$recipient.']',$msgsubj,undef, |
' ['.$recipient.']',$msgsubj,undef, |
undef,undef,undef,$usermsgid,undef,undef,$specialmsgid); |
undef,undef,undef,$usermsgid,undef,undef,$specialmsgid); |
my ($uname,$udom) = split/:/,$recipient; |
my ($uname,$udom) = split(/:/,$recipient); |
push(@recusers,$uname); |
push(@recusers,$uname); |
push(@recudoms,$udom); |
push(@recudoms,$udom); |
} |
} |
} |
} |
if (@recusers) { |
if (@recusers) { |
my $specialmessage; |
my $specialmessage; |
my $sentsubj = $subj_prefix.' ('.$numspecial.' sent) '. |
my $sentsubj = |
$msgsubj; |
$subj_prefix.' ('.$numspecial.' sent) '.$msgsubj; |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
my $sentmsgid = |
my $sentmsgid = |
&Apache::lonmsg::buildmsgid($stamp,$sentsubj,$msgname, |
&Apache::lonmsg::buildmsgid($stamp,$sentsubj,$msgname, |
Line 1767 sub sendoffmail {
|
Line 1862 sub sendoffmail {
|
&printheader($r,'','No messages sent.'); |
&printheader($r,'','No messages sent.'); |
} |
} |
if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) { |
if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) { |
$r->print('<br /><font color="green">'.&mt('Completed.').'</font>'); |
$r->print('<br /><span class="LC_success">'.&mt('Completed.').'</span>'); |
if ($env{'form.displayedcrit'}) { |
if ($env{'form.displayedcrit'}) { |
&discrit($r); |
&discrit($r); |
} else { |
} else { |
&Apache::loncommunicate::menu($r); |
&Apache::loncommunicate::menu($r); |
} |
} |
} else { |
} else { |
$r->print( |
$r->print('<p><span class="LC_error">'.&mt('Could not deliver message').'</span> '. |
'<h2><font color="red">'.&mt('Could not deliver message').'</font></h2>'. |
&mt('Please use the browser "Back" button and correct the recipient addresses').'</p>'); |
&mt('Please use the browser "Back" button and correct the recipient addresses') |
|
); |
|
} |
} |
} |
} |
|
|
Line 1884 sub handler {
|
Line 1977 sub handler {
|
&compout($r,$env{'form.forward'},undef,undef,undef,$folder); |
&compout($r,$env{'form.forward'},undef,undef,undef,$folder); |
} elsif ($env{'form.markdel'}) { |
} elsif ($env{'form.markdel'}) { |
&printheader($r,'','Deleted Message'); |
&printheader($r,'','Deleted Message'); |
&statuschange($env{'form.markdel'},'deleted',$folder); |
my ($result,$msg) = |
|
&statuschange($env{'form.markdel'},'deleted',$folder); |
|
if (!$result) { |
|
$r->print('<p class="LC_error">'. |
|
&mt('Failed to delete the message.').'</p>'. |
|
'<p class="LC_error">'.$msg."</p>\n"); |
|
} |
&Apache::loncommunicate::menu($r); |
&Apache::loncommunicate::menu($r); |
&disall($r,($folder?$folder:$dismode)); |
&disall($r,($folder?$folder:$dismode)); |
} elsif ($env{'form.markedmove'}) { |
} elsif ($env{'form.markedmove'}) { |
my $total=0; |
my ($total,$failed,@failed_msg)=(0,0); |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^form\.delmark_(.*)$/) { |
if ($key=~/^form\.delmark_(.*)$/) { |
&movemsg(&Apache::lonnet::unescape($1),$folder, |
my ($result,$msg) = |
$env{'form.movetofolder'}); |
&movemsg(&Apache::lonnet::unescape($1),$folder, |
$total++; |
$env{'form.movetofolder'}); |
|
if ($result) { |
|
$total++; |
|
} else { |
|
$failed++; |
|
push(@failed_msg,$msg); |
|
} |
} |
} |
} |
} |
&printheader($r,'','Moved Messages'); |
&printheader($r,'','Moved Messages'); |
$r->print('Moved '.$total.' message(s)<p>'); |
if ($failed) { |
|
$r->print('<p class="LC_error"> |
|
'.&mt('Failed to move [_1] message(s)',$failed). |
|
'</p>'); |
|
$r->print('<p class="LC_error">'. |
|
join("</p>\n<p class=\"LC_error\">",@failed_msg). |
|
"</p>\n"); |
|
} |
|
$r->print(&mt('Moved [_1] message(s)',$total).'<p>'); |
&Apache::loncommunicate::menu($r); |
&Apache::loncommunicate::menu($r); |
&disall($r,($folder?$folder:$dismode)); |
&disall($r,($folder?$folder:$dismode)); |
} elsif ($env{'form.markeddel'}) { |
} elsif ($env{'form.markeddel'}) { |
my $total=0; |
my ($total,$failed,@failed_msg)=(0,0); |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^form\.delmark_(.*)$/) { |
if ($key=~/^form\.delmark_(.*)$/) { |
&statuschange(&Apache::lonnet::unescape($1),'deleted',$folder); |
my ($result,$msg) = |
$total++; |
&statuschange(&Apache::lonnet::unescape($1),'deleted', |
|
$folder); |
|
if ($result) { |
|
$total++; |
|
} else { |
|
$failed++; |
|
push(@failed_msg,$msg); |
|
} |
} |
} |
} |
} |
&printheader($r,'','Deleted Messages'); |
&printheader($r,'','Deleted Messages'); |
$r->print('Deleted '.$total.' message(s)<p>'); |
if ($failed) { |
|
$r->print('<p class="LC_error"> |
|
'.&mt('Failed to delete [_1] message(s)',$failed). |
|
'</p>'); |
|
$r->print('<p class="LC_error">'. |
|
join("</p>\n<p class=\"LC_error\">",@failed_msg). |
|
"</p>\n"); |
|
} |
|
$r->print(&mt('Deleted [_1] message(s)',$total).'<p>'); |
&Apache::loncommunicate::menu($r); |
&Apache::loncommunicate::menu($r); |
&disall($r,($folder?$folder:$dismode)); |
&disall($r,($folder?$folder:$dismode)); |
} elsif ($env{'form.markunread'}) { |
} elsif ($env{'form.markunread'}) { |