Diff for /loncom/homework/structuretags.pm between versions 1.505 and 1.508

version 1.505, 2012/04/18 11:49:50 version 1.508, 2012/09/12 05:14:09
Line 1160  sub start_problem { Line 1160  sub start_problem {
     &Apache::run::run($expression,$safeeval);      &Apache::run::run($expression,$safeeval);
     my $status;      my $status;
     my $accessmsg;      my $accessmsg;
       my $resource_due;
   
     my $name= &get_resource_name($parstack,$safeeval);      my $name= &get_resource_name($parstack,$safeeval);
     my ($result,$form_tag_start);      my ($result,$form_tag_start,$slot_name,$slot);
   
       if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
           $target eq 'tex') {
           if ($env{'form.markaccess'}) {
               my @interval=&Apache::lonnet::EXT("resource.0.interval");
               &Apache::lonnet::set_first_access($interval[1]);
           }
   
           ($status,$accessmsg,$slot_name,$slot) =
               &Apache::lonhomework::check_slot_access('0','problem');
           push (@Apache::inputtags::status,$status);
       }
   
     if ($target eq 'web' || $target eq 'webgrade' || $target eq 'tex'      if ($target eq 'web' || $target eq 'webgrade' || $target eq 'tex'
  || $target eq 'edit') {   || $target eq 'edit') {
  ($result,$form_tag_start) =   ($result,$form_tag_start) =
Line 1175  sub start_problem { Line 1189  sub start_problem {
     if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval,$target); }      if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval,$target); }
     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||      if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
  $target eq 'tex') {   $target eq 'tex') {
  if ($env{'form.markaccess'}) {  
     my @interval=&Apache::lonnet::EXT("resource.0.interval");  
     &Apache::lonnet::set_first_access($interval[1]);  
  }  
  my $resource_due =  &Apache::lonhomework::due_date(0, $env{'request.symb'});  
  my $time_left = $resource_due - time();  
  if ($resource_due && ($time_left > 0) && ($target eq 'web')) {  
     $result .= &Apache::lonhtmlcommon::set_due_date($resource_due);  
  }  
   
       
         ($status,$accessmsg,my $slot_name,my $slot) =  
             &Apache::lonhomework::check_slot_access('0','problem');  
         push (@Apache::inputtags::status,$status);  
   
  #handle rand seed in construction space   #handle rand seed in construction space
  my $rndseed=&setup_rndseed($safeeval,$target);   my $rndseed=&setup_rndseed($safeeval,$target);
Line 1298  sub start_problem { Line 1298  sub start_problem {
  'problem');   'problem');
     }      }
  } elsif ($target eq 'web') {   } elsif ($target eq 'web') {
     if ($status eq 'CAN_ANSWER'       if ($status eq 'CAN_ANSWER') {
  && $slot_name ne ''                  $resource_due = &Apache::lonhomework::due_date(0, $env{'request.symb'});
  && $Apache::lonhomework::history{'resource.0.checkedin'} eq '') {                  if ($slot_name ne '') {
  # unproctored slot access, self checkin                      my $checked_in =
  &Apache::bridgetask::check_in('problem',undef,undef,                          $Apache::lonhomework::history{'resource.0.checkedin'};
       $slot_name);                      if ($checked_in eq '') {
     }                          # unproctored slot access, self checkin
                           &Apache::bridgetask::check_in('problem',undef,undef,
                                                         $slot_name);
                           $checked_in =
                               $Apache::lonhomework::results{"resource.0.checkedin"};
                       }
                       if ((ref($slot) eq 'HASH') && ($checked_in ne '')) {
                           if ($slot->{'starttime'} < time()) {
                               if (!$resource_due) {
                                   $resource_due = $slot->{'endtime'};
                               } elsif ($slot->{'endtime'} < $resource_due) {
                                   $resource_due = $slot->{'endtime'};
                               }
                           }
                       }
                   }
                   if ($resource_due) {
                       my $time_left = $resource_due - time();
                       if ($resource_due && ($time_left > 0) && ($target eq 'web')) {
                           $result .= &Apache::lonhtmlcommon::set_due_date($resource_due);
                       }
                   }
               }
     $result.="\n $form_tag_start \t".      $result.="\n $form_tag_start \t".
       '<input type="hidden" name="submitted" value="yes" />';        '<input type="hidden" name="submitted" value="yes" />';
     # create a page header and exit      # create a page header and exit
Line 1490  sub end_problem { Line 1512  sub end_problem {
  $result.="</form>";   $result.="</form>";
     }      }
     if ($target eq 'web') {      if ($target eq 'web') {
  $result.= &Apache::loncommon::end_page({'discussion' => 1});                  #
                   # Closing </body></html> not added by end_page().
                   # Added separately at end of this routine, after added
                   # <script></script> so document will be valid xhtml.
                   #
    $result.= &Apache::loncommon::end_page({'discussion' => 1,
    'notbody'    => 1});
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $endminipage = '';   my $endminipage = '';
  if (not $env{'form.problem_split'}=~/yes/) {   if (not $env{'form.problem_split'}=~/yes/) {
Line 1548  sub end_problem { Line 1576  sub end_problem {
     #      #
     if ($target eq 'web') {      if ($target eq 'web') {
         $result .= &Apache::lonhtmlcommon::set_compute_end_time();          $result .= &Apache::lonhtmlcommon::set_compute_end_time();
           #
           # Closing tags delayed so any <script></script> tags 
           # not in head can appear inside body, for valid xhtml.
           # 
           $result .= "</body>\n</html>";
     }      }
     return $result;      return $result;
 }  }

Removed from v.1.505  
changed lines
  Added in v.1.508


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