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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 24 May 2002 21:57:38 -0000


albertel		Fri May 24 17:57:38 2002 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - moved the tex generataionfor <part> to be inside of the date checking code
  - BUG#474 
  
  - still needs <problem> to be fixed
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.94 loncom/homework/structuretags.pm:1.95
--- loncom/homework/structuretags.pm:1.94	Fri May 24 16:33:55 2002
+++ loncom/homework/structuretags.pm	Fri May 24 17:57:38 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.94 2002/05/24 20:33:55 sakharuk Exp $
+# $Id: structuretags.pm,v 1.95 2002/05/24 21:57:38 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -515,6 +515,7 @@
 
 sub start_part {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+  my $result='';
   my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
   if ($id eq '') { $id = $Apache::lonxml::curdepth; }
   $Apache::inputtags::part=$id;
@@ -522,7 +523,7 @@
   @Apache::inputtags::previous=();
   if ($target eq 'meta') {
     return &Apache::response::mandatory_part_meta;
-  } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
+  } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
     my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);
     push (@Apache::inputtags::status,$status);
     my $expression='$external::datestatus="'.$status.'";';
@@ -531,15 +532,17 @@
     if ( $status eq 'CLOSED' ) {
       my $bodytext=&Apache::lonxml::get_all_text("/part",$$parser[$#$parser]);
       if ( $target eq "web" ) {
-	return "<br />Part is not open to be viewed. It $accessmsg<br />";
+	$result="<br />Part is not open to be viewed. It $accessmsg<br />";
+      } elsif ( $target eq 'tex' ) {
+	$result="\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\";
+      }
+    } else {
+      if ($target eq 'tex') {
+	$result='\vskip 0 mm';
       }
     }
   }
-  if ($target eq 'tex') {
-      return '\vskip 0 mm';
-  } else {
-      return '';
-  }
+  return $result;
 }
 
 sub end_part {