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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Jan 2006 23:15:52 -0000


albertel		Mon Jan 23 18:15:52 2006 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  - stop adding citations to the sent message version
  - don't display citations in the not a user.adv case
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.172 loncom/interface/lonmsg.pm:1.173
--- loncom/interface/lonmsg.pm:1.172	Tue Jan 10 10:29:13 2006
+++ loncom/interface/lonmsg.pm	Mon Jan 23 18:15:51 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.172 2006/01/10 15:29:13 albertel Exp $
+# $Id: lonmsg.pm,v 1.173 2006/01/23 23:15:51 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -538,19 +538,23 @@
     my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,
 	$toperm,$currid,$newid,$sentmessage)=@_;
 # Check if allowed missing
-    my $status='';
+    my ($status,$packed_message);
     my $msgid='undefined';
     my $text=$message;
     unless (($message)&&($user)&&($domain)) { $status='empty'; };
     my $homeserver=&Apache::lonnet::homeserver($user,$domain);
     if ($homeserver ne 'no_host') {
-       ($msgid,$message)=&packagemsg($subject,$message,$citation,$baseurl,
+       ($msgid,$packed_message)=
+	                 &packagemsg($subject,$message,$citation,$baseurl,
+                                     $attachmenturl,$user,$domain,$currid);
+       (undef, my $packed_message_no_citation)=
+                         &packagemsg($subject,$message,undef     ,$baseurl,
                                      $attachmenturl,$user,$domain,$currid);
 # Store in user folder
        $status=&Apache::lonnet::critical(
            'put:'.$domain.':'.$user.':nohist_email:'.
            &Apache::lonnet::escape($msgid).'='.
-           &Apache::lonnet::escape($message),$homeserver);
+           &Apache::lonnet::escape($packed_message),$homeserver);
 # Save new message received time
        &Apache::lonnet::put
                          ('email_status',{'recnewemail'=>time},$domain,$user);
@@ -561,7 +565,7 @@
                (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
 		|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
 					    '/'.$env{'request.course.sec'})))) {
-           $status .= &store_sent_mail($msgid,$message);
+           $status .= &store_sent_mail($msgid,$packed_message_no_citation);
        }
     } else {
        $status='no_host';
@@ -570,7 +574,7 @@
         $$newid = $msgid;
     }
     if (defined($sentmessage)) {
-        $$sentmessage = $message;
+        $$sentmessage = $packed_message;
     }
 
 # Notifications
@@ -2031,9 +2035,10 @@
 						    $content{'sendername'},
 						    $content{'senderdomain'},
 						    $content{'courseid'});
-    } else {
+    } elsif ($env{'user.adv'}) {
 	return $content{'citation'};
     }
+    return '';
 }
 
 # ================================================================== The Header