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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 28 Nov 2005 20:14:43 -0000


raeburn		Mon Nov 28 15:14:43 2005 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  Bug 4454. Replies to COM messages that were originally sent in course context now retain the same course context even if replied to in a different context.
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.157 loncom/interface/lonmsg.pm:1.158
--- loncom/interface/lonmsg.pm:1.157	Mon Nov 28 13:32:39 2005
+++ loncom/interface/lonmsg.pm	Mon Nov 28 15:14:43 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.157 2005/11/28 18:32:39 raeburn Exp $
+# $Id: lonmsg.pm,v 1.158 2005/11/28 20:14:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -136,7 +136,15 @@
     #remove machine specification
     $attachmenturl =~ s|^http://[^/]+/|/|;
     $attachmenturl =&HTML::Entities::encode($attachmenturl,'<>&"');
-
+    my $course_context;
+    if (defined($env{'form.replyid'})) {
+        my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$origcid)=
+                   split(/\:/,&Apache::lonnet::unescape($env{'form.replyid'}));
+        $course_context = $origcid;
+    }
+    unless(defined($course_context)) {
+        $course_context = $env{'request.course.id'};
+    }
     my $now=time;
     $msgcount++;
     my $partsubj=$subject;
@@ -145,7 +153,7 @@
         $msgid=&Apache::lonnet::escape(
            $now.':'.$partsubj.':'.$env{'user.name'}.':'.
            $env{'user.domain'}.':'.$msgcount.':'.
-           $env{'request.course.id'}.':'.$$);
+           $course_context.':'.$$);
     }
     my $result='<sendername>'.$env{'user.name'}.'</sendername>'.
            '<senderdomain>'.$env{'user.domain'}.'</senderdomain>'.
@@ -159,7 +167,7 @@
 	   '<browserversion>'.$env{'browser.version'}.'</browserversion>'.
            '<browsermathml>'.$env{'browser.mathml'}.'</browsermathml>'.
 	   '<browserraw>'.$ENV{'HTTP_USER_AGENT'}.'</browserraw>'.
-	   '<courseid>'.$env{'request.course.id'}.'</courseid>'.
+	   '<courseid>'.$course_context.'</courseid>'.
 	   '<coursesec>'.$env{'request.course.sec'}.'</coursesec>'.
 	   '<role>'.$env{'request.role'}.'</role>'.
 	   '<resource>'.$env{'request.filename'}.'</resource>'.