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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 31 Aug 2007 19:32:57 -0000


albertel		Fri Aug 31 15:32:57 2007 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
    /loncom/homework	lonhomework.pm 
  Log:
  - BUG#5400, was bleeding resource titles across requests if an html file 
    contained some subset of .problem related tags
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.454 loncom/xml/lonxml.pm:1.455
--- loncom/xml/lonxml.pm:1.454	Wed Aug 29 17:49:38 2007
+++ loncom/xml/lonxml.pm	Fri Aug 31 15:32:54 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.454 2007/08/29 21:49:38 albertel Exp $
+# $Id: lonxml.pm,v 1.455 2007/08/31 19:32:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1529,9 +1529,13 @@
 						    ['editmode']);
 	}
 	if (!$env{'form.editmode'} || $env{'form.viewmode'} || $env{'form.discardview'}) {
+	    &Apache::structuretags::reset_problem_globals();
 	    $result = &Apache::lonxml::xmlparse($request,$target,$filecontents,
 						'',%mystyle);
-	    undef($Apache::lonhomework::parsing_a_task);
+	    # .html files may contain <problem> or <Task> need to clean
+	    # up if it did
+	    &Apache::structuretags::reset_problem_globals();
+	    &Apache::lonhomework::finished_parsing();
 	    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 						    ['rawmode']);
 	    if ($env{'form.rawmode'}) { $result = $filecontents; }
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.272 loncom/homework/lonhomework.pm:1.273
--- loncom/homework/lonhomework.pm:1.272	Fri Aug 24 18:58:18 2007
+++ loncom/homework/lonhomework.pm	Fri Aug 31 15:32:57 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.272 2007/08/24 22:58:18 albertel Exp $
+# $Id: lonhomework.pm,v 1.273 2007/08/31 19:32:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -951,7 +951,7 @@
 	&Apache::lonxml::debug("Should be parsing now");
 	$result .= &Apache::lonxml::xmlparse($request, $target, $problem,
 					     &setup_vars($target),%mystyle);
-	undef($Apache::lonhomework::parsing_a_problem);
+	&finished_parsing();
 	if (!$output) { $result = ''; }
 	#$request->print("Result follows:");
 	if ($target eq 'modified') {
@@ -982,6 +982,11 @@
     }
 }
 
+sub finished_parsing {
+    undef($Apache::lonhomework::parsing_a_problem);
+    undef($Apache::lonhomework::parsing_a_task);
+}
+
 # with no arg it returns a HTML <option> list of the template titles
 # with one arg it returns the filename associated with the arg passed
 sub get_template_list {