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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 03 Jul 2002 15:36:40 -0000


sakharuk		Wed Jul  3 11:36:40 2002 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  Corrected to take into account only the change in the due date for
  problems in a sequence and a page.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.100 loncom/homework/structuretags.pm:1.101
--- loncom/homework/structuretags.pm:1.100	Thu Jun 27 14:47:23 2002
+++ loncom/homework/structuretags.pm	Wed Jul  3 11:36:40 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.100 2002/06/27 18:47:23 sakharuk Exp $
+# $Id: structuretags.pm,v 1.101 2002/07/03 15:36:40 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 
 use strict;
 use Apache::lonnet;
+use Apache::File();
 
 BEGIN {
   &Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext'));
@@ -287,10 +288,30 @@
 	my $id = $Apache::inputtags::part;
 	my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); 
 	$duedate = POSIX::strftime("%c",localtime($duedate));
-	if (not $ENV{'request.symb'} =~ m/\.page_/) {
-	    $result .= '\begin{document} \noindent\fbox{Due date: '.$duedate.'} \vskip 1 mm';	  
+	my $temp_file;
+	my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";
+        if (-e $filename) {
+	    $temp_file = Apache::File->new($filename); 
 	} else {
-	    $result .= '\parbox{\minipagewidth}{\vskip 1mm\fbox{Due date: '.$duedate.'} \\\\\\\\';
+	    $temp_file = Apache::File->new('>>'.$filename); 
+	}
+	my @due_file_content = <$temp_file>;
+	my $due_file_content = $due_file_content[$#due_file_content];
+        chomp $due_file_content;
+        if ($due_file_content ne $duedate) {	    
+	$temp_file = Apache::File->new('>'.$filename); 
+	    print $temp_file "$duedate\n";	    
+	    if (not $ENV{'request.symb'} =~ m/\.page_/) {
+		$result .= '\begin{document} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm';	
+	    } else {
+		$result .= '\parbox{\minipagewidth}{\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\';
+	    } 
+	} else {
+	    if (not $ENV{'request.symb'} =~ m/\.page_/) {
+		$result .= '\begin{document} \noindent \vskip 1 mm';	
+	    } else {
+		$result .= '\parbox{\minipagewidth}{\vskip 1mm \\\\\\\\';
+	    } 
 	}
     }
   } elsif ($target eq 'edit') {
@@ -356,7 +377,7 @@
     $result ='<br /><input type="submit" name="submit" value="Submit Changes and Edit" />';
     $result.='<input type="submit" name="submit" value="Submit Changes and View" />';
   } elsif ($target eq 'tex') {
-      $result .= '\vskip 0.5mm\noindent\makebox[9.0cm][b]{\hrulefill}';
+      $result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';
       if (not $ENV{'request.symb'} =~ m/\.page_/) {
 	  $result .= '\end{document} ';
       } else {