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

foxr lon-capa-cvs@mail.lon-capa.org
Thu, 03 Nov 2005 12:20:57 -0000


foxr		Thu Nov  3 07:20:57 2005 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  Got the redirection in <problem> and <part> right now.
  
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.310 loncom/homework/structuretags.pm:1.311
--- loncom/homework/structuretags.pm:1.310	Thu Nov  3 07:14:31 2005
+++ loncom/homework/structuretags.pm	Thu Nov  3 07:20:54 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.310 2005/11/03 12:14:31 foxr Exp $
+# $Id: structuretags.pm,v 1.311 2005/11/03 12:20:54 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -499,6 +499,10 @@
 sub start_problem {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
 
+    # We'll use the redirection to fix up printing of duedates.
+
+    &Apache::lonxml::startredirection;
+
     # Problems don't nest and we don't allow more than one <problem> in
     # a .problem file.
     #
@@ -735,7 +739,7 @@
 
 sub end_problem {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
-    my $result='';
+    my $result= &Apache::lonxml::endredirection; # This captures the entire <problem>.... body.
 
     my $status=$Apache::inputtags::status['-1'];
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
@@ -1176,6 +1180,7 @@
 
 sub start_part {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+    &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; }
@@ -1284,13 +1289,13 @@
     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='';
+    my $result= &Apache::lonxml::endredirection; # $resutl has entire <part> body.
     if ( $target eq 'meta' ) {
-	$result='';
+	$result.='';
     } elsif ($target eq 'grade') {
 	if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
 	    !$hidden && $in_order_show) {
-	    $result=&Apache::inputtags::grade;
+	    $result.=&Apache::inputtags::grade;
 	} else {
 	    # move any submission data to .hidden
 	    &Apache::inputtags::hidealldata($Apache::inputtags::part);
@@ -1302,10 +1307,10 @@
 	if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') {
 	    $gradestatus='';
 	}
-	$result=$gradestatus;
+	$result.=$gradestatus;
 	if ($$tagstack[-2] eq 'td' and $target eq 'tex') {$result.='\end{minipage}';} 
     } elsif ($target eq 'edit') {
-	$result=&Apache::edit::end_table();
+	$result.=&Apache::edit::end_table();
     }
     pop @Apache::inputtags::status;
     $Apache::inputtags::part='';