[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm lonmsgdisplay.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 27 Dec 2006 20:42:15 -0000


raeburn		Wed Dec 27 15:42:15 2006 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm lonmsgdisplay.pm 
  Log:
  Bug 5116.  Also check for return status of 'ok' or 'con_delayed' to store sent mail or send a message to user's User Notes.  
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.192 loncom/interface/lonmsg.pm:1.193
--- loncom/interface/lonmsg.pm:1.192	Wed Dec 27 13:00:00 2006
+++ loncom/interface/lonmsg.pm	Wed Dec 27 15:42:12 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.192 2006/12/27 18:00:00 raeburn Exp $
+# $Id: lonmsg.pm,v 1.193 2006/12/27 20:42:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -407,10 +407,14 @@
         if (defined($sentmessage)) {
             $$sentmessage = $packed_message;
         }
-        (undef,my $packed_message_no_citation) =
+        if ($env{'request.course.id'} eq '') {
+            (undef,my $packed_message_no_citation) =
             &packagemsg($subject,$message,undef,undef,undef,$user,$domain,
                         $msgid);
-        $status .= &store_sent_mail($msgid,$packed_message_no_citation);
+            if ($status eq 'ok' || $status eq 'con_delayed') {
+                &store_sent_mail($msgid,$packed_message_no_citation);
+            }
+        }
     } else {
        $status='no_host';
     }
@@ -540,7 +544,9 @@
            (undef,my $packed_message_no_citation) =
                &packagemsg($subject,$message,undef,$baseurl,$attachmenturl,
                            $user,$domain,$currid,undef,$crsmsgid,$symb,$error);
-           $status .= &store_sent_mail($msgid,$packed_message_no_citation);
+           if ($status eq 'ok' || $status eq 'con_delayed') {
+               &store_sent_mail($msgid,$packed_message_no_citation);
+           }
        }
     } else {
        $status='no_host';
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.59 loncom/interface/lonmsgdisplay.pm:1.60
--- loncom/interface/lonmsgdisplay.pm:1.59	Sun Dec 24 17:13:19 2006
+++ loncom/interface/lonmsgdisplay.pm	Wed Dec 27 15:42:12 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.59 2006/12/24 22:13:19 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.60 2006/12/27 20:42:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2289,11 +2289,9 @@
             my $msgtxt = $savemsg;
 	    if ($toaddr{$address}) { $msgtxt.='<hr />'.$toaddr{$address}; }
 	    my @thismsg;
-	    if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && 
-		(&Apache::lonnet::allowed('srm',$env{'request.course.id'})
-		 || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
-					     '/'.$env{'request.course.sec'}))) {
-		$r->print(&mt('Sending critical message').' '.$recuname.':'.$recdomain.': ');
+	    if ($msgtype eq 'critical') {
+		$r->print(&mt('Sending critical message').' '.
+                              $recuname.':'.$recdomain.': ');
 		@thismsg=
 		    &Apache::lonmsg::user_crit_msg($recuname,$recdomain,
 						   $msgsubj,$msgtxt,
@@ -2315,7 +2313,7 @@
 	        $specialmsg_status{$recuname.':'.$recdomain} =
 		    join(' ',@thismsg);
 		foreach my $result (@thismsg) {
-		    if ($result eq 'ok') {
+		    if ($result eq 'ok' || $result eq 'con_delayed') {
 			$numspecial++;
 		    }
 		}