[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 10 Nov 2005 21:28:21 -0000


albertel		Thu Nov 10 16:28:21 2005 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - throw an error when enderedirection hasn't been called
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.386 loncom/xml/lonxml.pm:1.387
--- loncom/xml/lonxml.pm:1.386	Wed Nov  2 17:48:52 2005
+++ loncom/xml/lonxml.pm	Thu Nov 10 16:28:21 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.386 2005/11/02 22:48:52 albertel Exp $
+# $Id: lonxml.pm,v 1.387 2005/11/10 21:28:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -527,7 +527,13 @@
   #   $finaloutput.=&endredirection;
   # }
 
-
+  if ($target eq 'grade') { &endredirection(); }
+  if ( $Apache::lonxml::redirection ) {
+      &error("Unclean exit of parser, text still being redirected. This is likely due to there being missing end tags.");
+      while ($Apache::lonxml::redirection) {
+	  $finaloutput.=&endredirection();
+      }
+  }
   if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) {
     $finaloutput=&afterburn($finaloutput);
   }	    
@@ -636,7 +642,7 @@
     $Apache::lonxml::evaluate = 1;
     $Apache::lonxml::import = 1;
   } elsif ($target eq 'grade') {
-    &startredirection;
+    &startredirection(); #ended in inner_xmlparse on exit
     $Apache::lonxml::metamode = 0;
     $Apache::lonxml::evaluate = 1;
     $Apache::lonxml::import = 1;