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

version 1.503, 2012/04/05 09:49:51 version 1.508, 2012/09/12 05:14:09
Line 990  sub firstaccess_msg { Line 990  sub firstaccess_msg {
  my $foldertitle=&Apache::lonnet::gettitle($map);   my $foldertitle=&Apache::lonnet::gettitle($map);
           
  &Apache::lonxml::debug("map is $map title is $foldertitle");   &Apache::lonxml::debug("map is $map title is $foldertitle");
  $result .= "<h2>".&mt('The resources in "[_1]" are open for a limited time.'   $result .= "<h2>".&mt('The resources in "[_1]" are open for a limited time.',$foldertitle)."</h2>"
                              .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'                               .'<p>'.&mt('Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'
                              ,$foldertitle,$time)."</h2>";                               ,$foldertitle,$time)."</p>";
     } elsif ($interval[1] eq 'course') {      } elsif ($interval[1] eq 'course') {
  my $course = $env{'course.'.$env{'request.course.id'}.'.description'};   my $course = $env{'course.'.$env{'request.course.id'}.'.description'};
         $result .= "<h2>".&mt('The resources in "[_1]" are open for a limited time.'          $result .= "<h2>".&mt('The resources in "[_1]" are open for a limited time.',$course)."</h2>"
                              .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'                               .'<p>'.&mt('Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'
                              ,$course,$time)."</h2>";                               ,$course,$time)."</p>";
     } else {      } else {
  my $title=&Apache::lonnet::gettitle($symb);   my $title=&Apache::lonnet::gettitle($symb);
         $result .= "<h2>".&mt('This resource "[_1]" is open for a limited time.'          $result .= "<h2>".&mt('This resource "[_1]" is open for a limited time.',$title)."</h2>"
                              .' Once you click the "Show Resource" button below you have [_2] to complete this resource "[_1]".'                               .'<p>'.&mt('Once you click the "Show Resource" button below you have [_2] to complete this resource "[_1]".'
                              ,$title,$time)."</h2>";                               ,$title,$time)."</p>";
     }      }
     my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});      my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
     my $buttontext = &mt('Show Resource');      my $buttontext = &mt('Show Resource');
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 1247  sub start_problem { Line 1247  sub start_problem {
     if ( $target eq "web" ) {      if ( $target eq "web" ) {
  my $msg;   my $msg;
  if ($status eq 'UNAVAILABLE') {   if ($status eq 'UNAVAILABLE') {
     $msg.='<h1>'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'</h1>';      $msg.='<p class="LC_error">'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'</p>';
                 } elsif ($status eq 'NOT_IN_A_SLOT') {                  } elsif ($status eq 'NOT_IN_A_SLOT') {
                     $msg.='<h1>'.&mt('You are not currently signed up to work at this time and/or place.').'</h1>';                      $msg.='<p class="LC_warning">'.&mt('You are not currently signed up to work at this time and/or place.').'</p>';
                 } elsif (($status eq 'RESERVABLE') || ($status eq 'RESERVABLE_LATER') ||                  } elsif (($status eq 'RESERVABLE') || ($status eq 'RESERVABLE_LATER') ||
                          ($status eq 'NOTRESERVABLE')) {                           ($status eq 'NOTRESERVABLE')) {
                     $msg.='<h1>'.&mt('Access requires reservation to work at specific time/place.').'</h1>';                      $msg.='<p class="LC_warning">'.&mt('Access requires reservation to work at specific time/place.').'</p>';
  } elsif ($status ne 'NOT_YET_VIEWED') {   } elsif ($status ne 'NOT_YET_VIEWED') {
     $msg.='<h1>'.&mt('Not open to be viewed').'</h1>';      $msg.='<p class="LC_warning">'.&mt('Not open to be viewed').'</p>';
                 }                  }
  if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {   if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
     $msg.=&mt('The problem ').$accessmsg;      $msg.=&mt('The problem ').$accessmsg;
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.503  
changed lines
  Added in v.1.508


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