Diff for /loncom/homework/structuretags.pm between versions 1.307 and 1.308

version 1.307, 2005/11/01 21:52:47 version 1.308, 2005/11/03 11:10:25
Line 422  sub firstaccess_msg { Line 422  sub firstaccess_msg {
 ENDCHECKOUT  ENDCHECKOUT
 }  }
   
   # initializes the problem globals across the inputtags, lonhomework, and 
   # structuretags modules.
   #
   # 
 sub init_problem_globals {  sub init_problem_globals {
     my ($type)=@_;      my ($type)=@_;
     #initialize globals      #initialize globals
       #   For problems, we start out in part 0 (outside a <part> tag).
       #   and part 0 is used to describe the main body of the <problem>
       #
     if ($type eq 'problem') {      if ($type eq 'problem') {
  $Apache::inputtags::part='0';   $Apache::inputtags::part='0';
  @Apache::inputtags::partlist=('0');   @Apache::inputtags::partlist=('0');
  $Apache::lonhomework::problemstatus=&get_problem_status('0');   $Apache::lonhomework::problemstatus=&get_problem_status('0');
  $Apache::lonhomework::ignore_response_errors=0;   $Apache::lonhomework::ignore_response_errors=0;
   
     } elsif ($type eq 'library') {      } elsif ($type eq 'library') {
  $Apache::inputtags::part='';   $Apache::inputtags::part='';
  @Apache::inputtags::partlist=();   @Apache::inputtags::partlist=();
  $Apache::lonhomework::problemstatus='';   $Apache::lonhomework::problemstatus='';
  $Apache::lonhomework::ignore_response_errors=1;   $Apache::lonhomework::ignore_response_errors=1;
   
     } elsif ($type eq 'Task') {      } elsif ($type eq 'Task') {
  $Apache::inputtags::part='0';   $Apache::inputtags::part='0';
  @Apache::inputtags::partlist=('0');   @Apache::inputtags::partlist=('0');
Line 490  sub get_problem_status { Line 499  sub get_problem_status {
 sub start_problem {  sub start_problem {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   
       # Problems don't nest and we don't allow more than one <problem> in
       # a .problem file.
       #
     if ( $Apache::inputtags::part ne '' ||      if ( $Apache::inputtags::part ne '' ||
  $Apache::lonhomework::parsing_a_problem) {   $Apache::lonhomework::parsing_a_problem) {
  &Apache::lonxml::error('Only one &lt;problem&gt; allowed in a .problem file');   &Apache::lonxml::error('Only one &lt;problem&gt; allowed in a .problem file');
Line 653  sub start_problem { Line 665  sub start_problem {
     '.disableexampointprint'}) eq 'yes') {      '.disableexampointprint'}) eq 'yes') {
  $allow_print_points=0;   $allow_print_points=0;
     }      }
     my $duedate = &Apache::lonnet::EXT("resource.$id.duedate");   
     $duedate = POSIX::strftime("%c",localtime($duedate));  
     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 {  
  $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;  
     my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');      my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
     my $begin_doc='\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent ';      my $begin_doc='\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent ';
     my $toc_line='\vskip 1 mm\noindent '.$startminipage.      my $toc_line='\vskip 1 mm\noindent '.$startminipage.
  '\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';   '\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
     if ($due_file_content ne $duedate) {  
       #  Figure out what the due date is and if we need to print it in the problem header.
       #  We have been logging the last due date written to file.  
       #
   
   
       my $duetime = &Apache::lonnet::EXT("resource.$id.duedate"); 
       my $duedate = POSIX::strftime("%c",localtime($duetime));
       my $temp_file;
       my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
   
       # Figure out what the last printed due date is or set it to the epoch if no duedates
       # have been printed.
   
       my $due_file_content = 0;      #   If the file does not yet exist, time is the epoch.
       if (-e $filename) {
    $temp_file = Apache::File->new($filename);
    my @due_file      = <$temp_file>;
    $due_file_content = $due_file[$#due_file];
    chomp $due_file_content;
       } 
       # The big change; Due do the comparison on 
       # the absolute time rather than textual time since that is format independent.
       #
       if ($due_file_content ne $duetime) {
  $temp_file = Apache::File->new('>'.$filename);   $temp_file = Apache::File->new('>'.$filename);
  print $temp_file "$duedate\n";   print $temp_file "$duetime\n";
  if (not $env{'request.symb'} =~ m/\.page_/) {   if (not $env{'request.symb'} =~ m/\.page_/) {
     if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {      if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
  $result .= $begin_doc.   $result .= $begin_doc.

Removed from v.1.307  
changed lines
  Added in v.1.308


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>