version 1.173.2.2, 2006/06/19 09:36:14
|
version 1.179, 2006/03/21 20:54:35
|
Line 137 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,$type)=@_; |
$recuser,$recdomain,$msgid,$type,$crsmsgid)=@_; |
$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 170 sub packagemsg {
|
Line 170 sub packagemsg {
|
$msgid = &buildmsgid($now,$subject,$env{'user.name'},$env{'user.domain'}, |
$msgid = &buildmsgid($now,$subject,$env{'user.name'},$env{'user.domain'}, |
$msgcount,$course_context,$$); |
$msgcount,$course_context,$$); |
} |
} |
my $result='<sendername>'.$env{'user.name'}.'</sendername>'. |
my $result = '<sendername>'.$env{'user.name'}.'</sendername>'. |
'<senderdomain>'.$env{'user.domain'}.'</senderdomain>'. |
'<senderdomain>'.$env{'user.domain'}.'</senderdomain>'. |
'<subject>'.$subject.'</subject>'. |
'<subject>'.$subject.'</subject>'. |
'<time>'.&Apache::lonlocal::locallocaltime($now).'</time>'. |
'<time>'.&Apache::lonlocal::locallocaltime($now).'</time>'; |
'<servername>'.$ENV{'SERVER_NAME'}.'</servername>'. |
if (defined($crsmsgid)) { |
|
$result.= '<courseid>'.$course_context.'</courseid>'. |
|
'<coursesec>'.$env{'request.course.sec'}.'</coursesec>'. |
|
'<msgid>'.$msgid.'</msgid>'. |
|
'<coursemsgid>'.$crsmsgid.'</coursemsgid>'. |
|
'<message>'.$message.'</message>'; |
|
return ($msgid,$result); |
|
} |
|
$result .= '<servername>'.$ENV{'SERVER_NAME'}.'</servername>'. |
'<host>'.$ENV{'HTTP_HOST'}.'</host>'. |
'<host>'.$ENV{'HTTP_HOST'}.'</host>'. |
'<client>'.$ENV{'REMOTE_ADDR'}.'</client>'. |
'<client>'.$ENV{'REMOTE_ADDR'}.'</client>'. |
'<browsertype>'.$env{'browser.type'}.'</browsertype>'. |
'<browsertype>'.$env{'browser.type'}.'</browsertype>'. |
Line 431 sub all_url_author_res_msg {
|
Line 439 sub all_url_author_res_msg {
|
return %returnhash; |
return %returnhash; |
} |
} |
|
|
# ====================================== Add a comment to the User Notes screen |
|
|
|
sub store_instructor_comment { |
|
my ($msg,$uname,$udom) = @_; |
|
my $cid = $env{'request.course.id'}; |
|
my $cnum = $env{'course.'.$cid.'.num'}; |
|
my $cdom = $env{'course.'.$cid.'.domain'}; |
|
my $subject= &mt('Record').' ['.$uname.':'.$udom.']'; |
|
my $result = &user_normal_msg_raw($cnum,$cdom,$subject,$msg); |
|
return $result; |
|
} |
|
|
|
# ================================================== Critical message to a user |
# ================================================== Critical message to a user |
|
|
sub user_crit_msg_raw { |
sub user_crit_msg_raw { |
Line 548 sub user_crit_received {
|
Line 544 sub user_crit_received {
|
|
|
sub user_normal_msg_raw { |
sub user_normal_msg_raw { |
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, |
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, |
$toperm,$currid,$newid,$sentmessage)=@_; |
$toperm,$currid,$newid,$sentmessage,$crsmsgid)=@_; |
# Check if allowed missing |
# Check if allowed missing |
my ($status,$packed_message); |
my ($status,$packed_message); |
my $msgid='undefined'; |
my $msgid='undefined'; |
Line 558 sub user_normal_msg_raw {
|
Line 554 sub user_normal_msg_raw {
|
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
($msgid,$packed_message)= |
($msgid,$packed_message)= |
&packagemsg($subject,$message,$citation,$baseurl, |
&packagemsg($subject,$message,$citation,$baseurl, |
$attachmenturl,$user,$domain,$currid); |
$attachmenturl,$user,$domain,$currid, |
(undef, my $packed_message_no_citation)= |
undef,$crsmsgid); |
&packagemsg($subject,$message,undef ,$baseurl, |
|
$attachmenturl,$user,$domain,$currid); |
|
# Store in user folder |
# Store in user folder |
$status=&Apache::lonnet::critical( |
$status=&Apache::lonnet::critical( |
'put:'.$domain.':'.$user.':nohist_email:'. |
'put:'.$domain.':'.$user.':nohist_email:'. |
Line 577 sub user_normal_msg_raw {
|
Line 572 sub user_normal_msg_raw {
|
(&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'})))) { |
|
(undef, my $packed_message_no_citation)= |
|
&packagemsg($subject,$message,undef ,$baseurl, |
|
$attachmenturl,$user,$domain,$currid, |
|
undef,$crsmsgid); |
|
|
$status .= &store_sent_mail($msgid,$packed_message_no_citation); |
$status .= &store_sent_mail($msgid,$packed_message_no_citation); |
} |
} |
} else { |
} else { |
Line 712 sub statuschange {
|
Line 712 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') { |
return &movemsg($msgid,$folder,'trash'); |
&movemsg(&Apache::lonnet::unescape($msgid),$folder,'trash'); |
} |
} |
return ; |
|
} |
} |
|
|
# ============================================================= Make new folder |
# ============================================================= Make new folder |
Line 735 sub movemsg {
|
Line 734 sub movemsg {
|
if ($srcfolder eq 'new') { $srcfolder=''; } |
if ($srcfolder eq 'new') { $srcfolder=''; } |
my $srcsuffix=&foldersuffix($srcfolder); |
my $srcsuffix=&foldersuffix($srcfolder); |
my $trgsuffix=&foldersuffix($trgfolder); |
my $trgsuffix=&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]); |
if (!exists($message{$msgid}) || $message{$msgid} eq '') { |
&Apache::lonnet::put('nohist_email'.$trgsuffix,{$msgid => $message{$msgid}}); |
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]); |
# a non-existant status is the mark of an unread msg |
&Apache::lonnet::put('email_status'.$trgsuffix,{$msgid => $status{$msgid}}); |
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 |
my $result_del_msg = |
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]); |
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]); |
&Apache::lonnet::del('email_status'.$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 809 sub discourse {
|
Line 774 sub discourse {
|
for (i=0; i<document.forms.compemail.elements.length; i++) { |
for (i=0; i<document.forms.compemail.elements.length; i++) { |
if |
if |
(document.forms.compemail.elements[i].name.indexOf |
(document.forms.compemail.elements[i].name.indexOf |
('send_to_&&&'+document.forms.compemail.chksec.value)==0) { |
('send_to_&&&'+document.forms.compemail.chksec.value+'&&&')==0) { |
document.forms.compemail.elements[i].checked=true; |
document.forms.compemail.elements[i].checked=true; |
} |
} |
} |
} |
Line 1067 ENDLINK
|
Line 1032 ENDLINK
|
} |
} |
$r->print("</td></tr>"); |
$r->print("</td></tr>"); |
} |
} |
$r->print('</table>'.&Apache::loncommon::endbodytag().'</html>'); |
$r->print('</table>'); |
} elsif ($numblocked == 0) { |
} elsif ($numblocked == 0) { |
$r->print("<h3>".&mt('You have no unread messages')."</h3>"); |
$r->print("<h3>".&mt('You have no unread messages')."</h3>"); |
} |
} |
Line 1210 ENDDISHEADER
|
Line 1175 ENDDISHEADER
|
$description.'</td><td>'.$status.'</td></tr>'."\n"); |
$description.'</td><td>'.$status.'</td></tr>'."\n"); |
} elsif ($status eq 'deleted') { |
} elsif ($status eq 'deleted') { |
# purge |
# purge |
my ($result,$msg) = |
&movemsg(&Apache::lonnet::unescape($origID),$folder,'trash'); |
&movemsg(&Apache::lonnet::unescape($origID),$folder,'trash'); |
|
|
|
} |
} |
} |
} |
$r->print("</table>\n<p>". |
$r->print("</table>\n<p>". |
Line 1296 sub compout {
|
Line 1259 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'}; |
Line 1473 sub disfacetoface {
|
Line 1437 sub disfacetoface {
|
} elsif ($content{'subject'}=~/^Broadcast/) { |
} elsif ($content{'subject'}=~/^Broadcast/) { |
$result .='<h3>'.&mt('Broadcast Message').'</h3>'; |
$result .='<h3>'.&mt('Broadcast Message').'</h3>'; |
if ($content{'subject'}=~/^Broadcast\./) { |
if ($content{'subject'}=~/^Broadcast\./) { |
%content=&unpackagemsg($content{'message'}); |
if (defined($content{'coursemsgid'})) { |
$content{'message'}= |
my $crsmsgid = &Apache::lonnet::escape($content{'coursemsgid'}); |
|
my $broadcast_message = &general_message($crsmsgid); |
|
$content{'message'} = '<b>'.&mt('Subject').': '.$content{'message'}.'</b><br />'.$broadcast_message; |
|
} else { |
|
%content=&unpackagemsg($content{'message'}); |
|
$content{'message'} = |
'<b>'.&mt('Subject').': '.$content{'subject'}.'</b><br />'. |
'<b>'.&mt('Subject').': '.$content{'subject'}.'</b><br />'. |
$content{'message'}; |
$content{'message'}; |
|
} |
} |
} |
} else { |
} else { |
$result.='<h3>'.&mt('Critical Message').'</h3>'; |
$result.='<h3>'.&mt('Critical Message').'</h3>'; |
%content=&unpackagemsg($content{'message'}); |
if (defined($content{'coursemsgid'})) { |
$content{'message'}= |
my $crsmsgid=&Apache::lonnet::escape($content{'coursemsgid'}); |
|
my $critical_message = &general_message($crsmsgid); |
|
$content{'message'} = '<b>'.&mt('Subject').': '.$content{'message'}.'</b><br />'.$critical_message; |
|
} else { |
|
%content=&unpackagemsg($content{'message'}); |
|
$content{'message'}= |
'<b>'.&mt('Subject').': '.$content{'subject'}.'</b><br />'. |
'<b>'.&mt('Subject').': '.$content{'subject'}.'</b><br />'. |
$content{'message'}; |
$content{'message'}; |
|
} |
} |
} |
$result.=&mt('By').': <b>'. |
$result.=&mt('By').': <b>'. |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
Line 1506 $content{'sendername'}.'@'.
|
Line 1482 $content{'sendername'}.'@'.
|
} |
} |
} |
} |
|
|
|
sub general_message { |
|
my ($crsmsgid) = @_; |
|
my %general_content; |
|
if ($crsmsgid) { |
|
my %course_content = &Apache::lonnet::get('nohist_email',[$crsmsgid], |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
%general_content = &unpackagemsg($course_content{$crsmsgid}); |
|
} |
|
return $general_content{'message'}; |
|
} |
|
|
# ---------------------------------------------------------------- Face to face |
# ---------------------------------------------------------------- Face to face |
|
|
sub facetoface { |
sub facetoface { |
Line 1556 ENDTREC
|
Line 1544 ENDTREC
|
($env{'form.recdomain'}) && ($env{'form.recuname'})) { |
($env{'form.recdomain'}) && ($env{'form.recuname'})) { |
chomp($env{'form.newrecord'}); |
chomp($env{'form.newrecord'}); |
if ($env{'form.newrecord'}) { |
if ($env{'form.newrecord'}) { |
&Apache::lonmsg::store_instructor_comment($env{'form.newrecord'}, |
my $recordtxt = $env{'form.newrecord'}; |
$env{'form.recuname'}, |
&user_normal_msg_raw( |
$env{'form.recdomain'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
&mt('Record'). |
|
' ['.$env{'form.recuname'}.':'.$env{'form.recdomain'}.']', |
|
$recordtxt); |
} |
} |
$r->print('<h3>'.&Apache::loncommon::plainname($env{'form.recuname'}, |
$r->print('<h3>'.&Apache::loncommon::plainname($env{'form.recuname'}, |
$env{'form.recdomain'}).'</h3>'); |
$env{'form.recdomain'}).'</h3>'); |
Line 1629 sub examblock {
|
Line 1621 sub examblock {
|
$r->print($lt{'ncbc'}.'<br /><br />'); |
$r->print($lt{'ncbc'}.'<br /><br />'); |
} |
} |
&display_addblocker_table($r,$parmcount,\%ltext); |
&display_addblocker_table($r,$parmcount,\%ltext); |
my $endbody=&Apache::loncommon::endbodytag(); |
my $end_page=&Apache::loncommon::end_page(); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<br /> |
<br /> |
<input type="hidden" name="blocktotal" value="$blockcount" /> |
<input type="hidden" name="blocktotal" value="$blockcount" /> |
<input type ="submit" value="Save Changes" /> |
<input type ="submit" value="Save Changes" /> |
</form> |
</form> |
$endbody |
$end_page |
</html> |
|
END |
END |
return; |
return; |
} |
} |
Line 2090 sub displayresource {
|
Line 2081 sub displayresource {
|
|
|
sub header { |
sub header { |
my ($r,$title,$baseurl)=@_; |
my ($r,$title,$baseurl)=@_; |
$r->print(&Apache::lonxml::xmlbegin(). |
|
'<head>'.&Apache::lonxml::fontsettings(). |
my $extra = &Apache::loncommon::studentbrowser_javascript(); |
'<title>Communication and Messages</title>'. |
|
&Apache::lonhtmlcommon::htmlareaheaders()); |
|
if ($baseurl) { |
if ($baseurl) { |
$r->print("<base href=\"http://$ENV{'SERVER_NAME'}/$baseurl\" />"); |
$extra .= "<base href=\"http://$ENV{'SERVER_NAME'}/$baseurl\" />"; |
} |
} |
$r->print(&Apache::loncommon::studentbrowser_javascript().'</head>'. |
$r->print(&Apache::loncommon::start_page('Communication and Messages', |
&Apache::loncommon::bodytag('Communication and Messages')); |
$extra)); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
(undef,($title?$title:'Communication and Messages'))); |
(undef,($title?$title:'Communication and Messages'))); |
|
|
} |
} |
|
|
Line 2133 sub storedcommentlisting {
|
Line 2122 sub storedcommentlisting {
|
my ($r)=@_; |
my ($r)=@_; |
my %msgs=&Apache::lonnet::dump('nohist_stored_comments',undef,undef, |
my %msgs=&Apache::lonnet::dump('nohist_stored_comments',undef,undef, |
'^'.&Apache::lonnet::escape(&Apache::lonnet::escape($env{'form.showcommentbaseurl'}))); |
'^'.&Apache::lonnet::escape(&Apache::lonnet::escape($env{'form.showcommentbaseurl'}))); |
$r->print(&Apache::lonxml::xmlbegin().'<head>'. |
$r->print(&Apache::loncommon::start_page('Stored Comment Listing',undef, |
&Apache::lonxml::fontsettings().'</head><body>'); |
{'onlybody' => 1})); |
if ((keys %msgs)[0]=~/^error\:/) { |
if ((keys %msgs)[0]=~/^error\:/) { |
$r->print(&mt('No stored comments yet.')); |
$r->print(&mt('No stored comments yet.')); |
} else { |
} else { |
Line 2205 sub sendoffmail {
|
Line 2194 sub sendoffmail {
|
my $savemsg; |
my $savemsg; |
my $msgtype; |
my $msgtype; |
my %sentmessage; |
my %sentmessage; |
|
my $msgsubj=&Apache::lonfeedback::clear_out_html($env{'form.subject'}); |
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 2226 sub sendoffmail {
|
Line 2216 sub sendoffmail {
|
|| &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=&user_crit_msg($recuname,$recdomain, |
$thismsg=&user_crit_msg($recuname,$recdomain,$msgsubj,$msgtxt, |
&Apache::lonfeedback::clear_out_html($env{'form.subject'}), |
$env{'form.sendbck'},$env{'form.permanent'}, |
$msgtxt, |
\$sentmessage{$_}); |
$env{'form.sendbck'},$env{'form.permanent'},\$sentmessage{$_}); |
|
} else { |
} else { |
$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); |
$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); |
$thismsg=&user_normal_msg($recuname,$recdomain, |
$thismsg=&user_normal_msg($recuname,$recdomain,$msgsubj,$msgtxt, |
&Apache::lonfeedback::clear_out_html($env{'form.subject'}), |
|
$msgtxt, |
|
$content{'citation'},undef,undef,$env{'form.permanent'},\$sentmessage{$_}); |
$content{'citation'},undef,undef,$env{'form.permanent'},\$sentmessage{$_}); |
} |
} |
if (($env{'request.course.id'}) && (($msgtype eq 'critical') || |
if (($env{'request.course.id'}) && (($msgtype eq 'critical') || |
Line 2270 sub sendoffmail {
|
Line 2257 sub sendoffmail {
|
my $record_sent; |
my $record_sent; |
my @recusers = (); |
my @recusers = (); |
my @recudoms = (); |
my @recudoms = (); |
my ($stamp,$msgsubj,$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') { |
Line 2278 sub sendoffmail {
|
Line 2265 sub sendoffmail {
|
my $usermsgid = &buildmsgid($stamp,$usersubj,$msgname, |
my $usermsgid = &buildmsgid($stamp,$usersubj,$msgname, |
$msgdom,$msgcount,$context,$pid); |
$msgdom,$msgcount,$context,$pid); |
&user_normal_msg_raw($cnum,$cdom,$subj_prefix. |
&user_normal_msg_raw($cnum,$cdom,$subj_prefix. |
' ['.$recipient.']',$sentmessage{$recipient}, |
' ['.$recipient.']',$msgsubj,undef, |
undef,undef,undef,undef,$usermsgid); |
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); |
Line 2288 sub sendoffmail {
|
Line 2275 sub sendoffmail {
|
if (@recusers) { |
if (@recusers) { |
my $specialmessage; |
my $specialmessage; |
my $sentsubj = $subj_prefix.' ('.$numspecial.' sent) '. |
my $sentsubj = $subj_prefix.' ('.$numspecial.' sent) '. |
&Apache::lonfeedback::clear_out_html($env{'form.subject'}); |
$msgsubj; |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
my $sentmsgid = &buildmsgid($stamp,$sentsubj,$msgname, |
my $sentmsgid = &buildmsgid($stamp,$sentsubj,$msgname, |
$msgdom,$msgcount,$context,$pid); |
$msgdom,$msgcount,$context,$pid); |
($specialmsgid,$specialmessage) = |
($specialmsgid,$specialmessage) = &packagemsg($msgsubj,$savemsg, |
&packagemsg(&Apache::lonfeedback::clear_out_html( |
undef,undef,undef,\@recusers,\@recudoms,$sentmsgid); |
$env{'form.subject'}),$savemsg,undef,undef,undef, |
|
\@recusers,\@recudoms,$sentmsgid); |
|
$record_sent = &store_sent_mail($specialmsgid,$specialmessage); |
$record_sent = &store_sent_mail($specialmsgid,$specialmessage); |
} |
} |
} else { |
} else { |
Line 2423 sub handler {
|
Line 2408 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'); |
my ($result,$msg) = |
&statuschange($env{'form.markdel'},'deleted',$folder); |
&statuschange($env{'form.markdel'},'deleted',$folder); |
|
if (!$result) { |
|
$r->print('<p style="color: red">Failed to delete the message.</p>'. |
|
'<p style="color: red">'.$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,$failed,@failed_msg)=(0,0); |
my $total=0; |
foreach my $key (keys(%env)) { |
foreach (keys %env) { |
if ($key=~/^form\.delmark_(.*)$/) { |
if ($_=~/^form\.delmark_(.*)$/) { |
my ($result,$msg) = |
&movemsg(&Apache::lonnet::unescape($1),$folder, |
&movemsg(&Apache::lonnet::unescape($1),$folder, |
$env{'form.movetofolder'}); |
$env{'form.movetofolder'}); |
$total++; |
if ($result) { |
|
$total++; |
|
} else { |
|
$failed++; |
|
push(@failed_msg,$msg); |
|
} |
|
} |
} |
} |
} |
&printheader($r,'','Moved Messages'); |
&printheader($r,'','Moved Messages'); |
if ($failed) { |
|
$r->print('<p style="color: red;"> |
|
Failed to move '.$failed.' message(s)</p>'); |
|
$r->print('<p style="color: red;">'. |
|
join("</p>\n<p style=\"color: red;\">",@failed_msg). |
|
"</p>\n"); |
|
} |
|
$r->print('Moved '.$total.' message(s)<p>'); |
$r->print('Moved '.$total.' message(s)<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,$failed,@failed_msg)=(0,0); |
my $total=0; |
foreach my $key (keys(%env)) { |
foreach (keys %env) { |
if ($key=~/^form\.delmark_(.*)$/) { |
if ($_=~/^form\.delmark_(.*)$/) { |
my ($result,$msg) = |
&statuschange(&Apache::lonnet::unescape($1),'deleted',$folder); |
&statuschange(&Apache::lonnet::unescape($1),'deleted', |
$total++; |
$folder); |
|
if ($result) { |
|
$total++; |
|
} else { |
|
$failed++; |
|
push(@failed_msg,$msg); |
|
} |
|
} |
} |
} |
} |
&printheader($r,'','Deleted Messages'); |
&printheader($r,'','Deleted Messages'); |
if ($failed) { |
|
$r->print('<p style="color: red;"> |
|
Failed to delete '.$failed.' message(s)</p>'); |
|
$r->print('<p style="color: red;">'. |
|
join("</p>\n<p style=\"color: red;\">",@failed_msg). |
|
"</p>\n"); |
|
} |
|
$r->print('Deleted '.$total.' message(s)<p>'); |
$r->print('Deleted '.$total.' message(s)<p>'); |
&Apache::loncommunicate::menu($r); |
&Apache::loncommunicate::menu($r); |
&disall($r,($folder?$folder:$dismode)); |
&disall($r,($folder?$folder:$dismode)); |
Line 2519 sub handler {
|
Line 2472 sub handler {
|
&Apache::loncommunicate::menu($r); |
&Apache::loncommunicate::menu($r); |
&disall($r,($folder?$folder:$dismode)); |
&disall($r,($folder?$folder:$dismode)); |
} |
} |
$r->print(&Apache::loncommon::endbodytag().'</html>'); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
# ================================================= Main program, reset counter |
# ================================================= Main program, reset counter |