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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 17 Feb 2003 17:09:27 -0000


albertel		Mon Feb 17 12:09:27 2003 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm lonfeedback.pm 
  Log:
  
  -adding answers to feddback messages
  
  VS: ----------------------------------------------------------------------
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.46 loncom/interface/lonmsg.pm:1.47
--- loncom/interface/lonmsg.pm:1.46	Mon Dec 30 09:10:58 2002
+++ loncom/interface/lonmsg.pm	Mon Feb 17 12:09:27 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.46 2002/12/30 14:10:58 www Exp $
+# $Id: lonmsg.pm,v 1.47 2003/02/17 17:09:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -47,21 +47,23 @@
 use strict;
 use Apache::lonnet();
 use vars qw($msgcount);
-use HTML::TokeParser;
+use HTML::TokeParser();
 use Apache::Constants qw(:common);
-use Apache::loncommon;
-use Apache::lontexconvert;
+use Apache::loncommon();
+use Apache::lontexconvert();
+use HTML::Entities();
 
 # ===================================================================== Package
 
 sub packagemsg {
     my ($subject,$message,$citation)=@_;
-    $message=~s/\</\&lt\;/g;
-    $message=~s/\>/\&gt\;/g;
-    $citation=~s/\</\&lt\;/g;
-    $citation=~s/\>/\&gt\;/g;
-    $subject=~s/\</\&lt\;/g;
-    $subject=~s/\>/\&gt\;/g;
+#    $message=~s/\</\&lt\;/g;
+#    $message=~s/\>/\&gt\;/g;
+    $message =&HTML::Entities::encode($message);
+    $citation=&HTML::Entities::encode($citation);
+    $subject =&HTML::Entities::encode($subject);
+#    $subject=~s/\</\&lt\;/g;
+#    $subject=~s/\>/\&gt\;/g;
     my $now=time;
     $msgcount++;
     my $partsubj=$subject;
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.39 loncom/interface/lonfeedback.pm:1.40
--- loncom/interface/lonfeedback.pm:1.39	Mon Feb 10 11:22:28 2003
+++ loncom/interface/lonfeedback.pm	Mon Feb 17 12:09:27 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.39 2003/02/10 16:22:28 www Exp $
+# $Id: lonfeedback.pm,v 1.40 2003/02/17 17:09:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -248,7 +248,7 @@
 }
 
 sub assemble_email {
-  my ($feedurl,$message,$prevattempts,$usersaw)=@_;
+  my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_;
   my $email=<<"ENDEMAIL";
 Refers to <a href="$feedurl">$feedurl</a>
 
@@ -260,6 +260,8 @@
 <p><hr>
 <h2>Original screen output (if applicable)</h2>
 $usersaw
+<h2>Correct Answer(s) (if applicable)</h2>
+$useranswer
 ENDCITE
   return ($email,$citations);
 }
@@ -550,13 +552,18 @@
 # Get output from resource
       my $usersaw=&resource_output($feedurl);
 
+# Get resource answer
+      my $useranswer=&Apache::loncommon::get_student_answers(
+                       $symb,$ENV{'user.name'},$ENV{'user.domain'},
+		       $ENV{'request.course.id'});
+
 # Filter HTML out of message (could be nasty)
       my $message=&clear_out_html($ENV{'form.comment'});
 
 # Assemble email
       my ($email,$citations)=&assemble_email($feedurl,$message,$prevattempts,
-          $usersaw);
-
+          $usersaw,$useranswer);
+ 
 # Who gets this?
       my ($typestyle,%to) = &decide_receiver($feedurl);