[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 22 Mar 2002 20:11:00 -0000


albertel		Fri Mar 22 15:11:00 2002 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - protects entities in editxml mode
  - updates to debug messages
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.72 loncom/homework/lonhomework.pm:1.73
--- loncom/homework/lonhomework.pm:1.72	Wed Feb 27 20:18:47 2002
+++ loncom/homework/lonhomework.pm	Fri Mar 22 15:11:00 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.72 2002/02/28 01:18:47 albertel Exp $
+# $Id: lonhomework.pm,v 1.73 2002/03/22 20:11:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,17 +31,18 @@
 
 package Apache::lonhomework;
 use strict;
-use Apache::style;
-use Apache::lonxml;
-use Apache::lonnet;
-use Apache::lonplot;
-use Apache::inputtags;
-use Apache::structuretags;
-use Apache::randomlabel;
-use Apache::response;
-use Apache::hint;
-use Apache::outputtags;
+use Apache::style();
+use Apache::lonxml();
+use Apache::lonnet();
+use Apache::lonplot();
+use Apache::inputtags();
+use Apache::structuretags();
+use Apache::randomlabel();
+use Apache::response();
+use Apache::hint();
+use Apache::outputtags();
 use Apache::Constants qw(:common);
+use HTML::Entities();
 #use Time::HiRes qw( gettimeofday tv_interval );
 
 BEGIN {
@@ -128,6 +129,7 @@
   my $type;
   my $passed;
   &Apache::lonxml::debug("checking for part :$id:");
+  &Apache::lonxml::debug("time:".time);
   foreach $temp ("opendate","duedate","answerdate") {
     $lastdate = $date;
     $date = &Apache::lonnet::EXT("resource.$id.$temp");
@@ -189,7 +191,20 @@
   my (%hash) = @_;
   my $resultkey;
   foreach $resultkey (sort keys %hash) {
-    &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}");
+    if (ref($hash{$resultkey})) {
+      if ($hash{$resultkey} =~ /ARRAY/ ) {
+	my $string="$resultkey ---- (";
+	foreach my $elm (@{ $hash{$resultkey} }) {
+	  $string.="$elm,";
+	}
+	chop($string);
+	&Apache::lonxml::debug("$string)");
+      } else {
+	&Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}");
+      }
+    } else {
+      &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}");
+    }
   }
   &Apache::lonxml::debug("\n<br />restored values^</br>\n");
   return '';
@@ -281,7 +296,7 @@
             <input type="submit" name="Undo" value="undo" />
             <hr />
             <textarea rows="'.$rows.'" cols="'.$cols.'" name="editxmltext">'.
-	      $problem.'</textarea>
+	      &HTML::Entities::encode($problem).'</textarea>
             </form></body></html>';
   $request->print($result);
   return '';