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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 15 Nov 2005 21:13:42 -0000


albertel		Tue Nov 15 16:13:42 2005 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - the global startredirs were mucking with the metamode attribute
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.320 loncom/homework/structuretags.pm:1.321
--- loncom/homework/structuretags.pm:1.320	Thu Nov 10 17:01:30 2005
+++ loncom/homework/structuretags.pm	Tue Nov 15 16:13:42 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.320 2005/11/10 22:01:30 albertel Exp $
+# $Id: structuretags.pm,v 1.321 2005/11/15 21:13:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -513,7 +513,9 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
 
     # We'll use the redirection to fix up printing of duedates.
-    &Apache::lonxml::startredirection();
+    if (!$Apache::lonxml::metamode) {
+	&Apache::lonxml::startredirection();
+    }
 
     # Problems don't nest and we don't allow more than one <problem> in
     # a .problem file.
@@ -683,14 +685,20 @@
 
 sub end_problem {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
-    my $result= &Apache::lonxml::endredirection(); # started in &start_problem
+    my $result;
 
-    # Figure out the front matter which was too deeply coupled for me to easily
-    # unravel and replace the INSERTTEXFRONTMATTERHERE in result with it.
-    # note that we do this in end_problem because whether or not we display
-    # due dates depends on whether due dates have already been displayed in the problem parts.
+    if (!$Apache::lonxml::metamode) {
+	$result = &Apache::lonxml::endredirection(); #started in &start_problem
+    }
 
     if ($target eq 'tex') {
+
+	# Figure out the front matter and replace the
+	# INSERTTEXFRONTMATTERHERE in result with it.  note that we do
+	# this in end_problem because whether or not we display due
+	# dates depends on whether due dates have already been
+	# displayed in the problem parts.
+
 	my $frontmatter   = '';
 	my $startminipage = '';
 	if (not $env{'form.problem_split'}=~/yes/) {
@@ -1215,8 +1223,10 @@
 
 sub start_part {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
-    &Apache::lonxml::startredirection(); # we'll use redirection to fix up 
-                                         # duedates.
+    if (!$Apache::lonxml::metamode) {
+	&Apache::lonxml::startredirection(); # we'll use redirection to fix up 
+	                                     # duedates.
+    }
     my $result='';
     my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
     if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
@@ -1325,7 +1335,10 @@
     my $status=$Apache::inputtags::status['-1'];
     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
     my $in_order_show=&ordered_show_check();
-    my $result= &Apache::lonxml::endredirection(); # started in &start_part
+    my $result;
+    if (!$Apache::lonxml::metamode) {
+	$result = &Apache::lonxml::endredirection(); # started in &start_part
+    }
     if ($target eq 'grade') {
 	if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
 	    !$hidden && $in_order_show) {