Diff for /loncom/homework/structuretags.pm between versions 1.512.2.13.4.4 and 1.512.2.17

version 1.512.2.13.4.4, 2020/10/01 18:54:21 version 1.512.2.17, 2019/08/07 21:44:28
Line 63  use Apache::londefdef; Line 63  use Apache::londefdef;
 use Apache::lonenc();  use Apache::lonenc();
 use Apache::loncommon();  use Apache::loncommon();
 use Time::HiRes qw( gettimeofday tv_interval );  use Time::HiRes qw( gettimeofday tv_interval );
 use HTML::Entities();  
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA;  use LONCAPA;
     
Line 497  sub page_start { Line 496  sub page_start {
             }              }
         }          }
         if ($needs_upload) {          if ($needs_upload) {
             $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js();              $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js().
                              '<script type="text/javascript" '.
                              'src="/res/adm/includes/file_upload.js"></script>';
         }          }
     }      }
   
Line 652  sub setup_rndseed { Line 653  sub setup_rndseed {
         $questiontype = $Apache::lonhomework::type;          $questiontype = $Apache::lonhomework::type;
     }      }
     if (($env{'request.state'} eq "construct")       if (($env{'request.state'} eq "construct") 
         || ($symb eq '')           || ($symb eq '')
         || ($Apache::lonhomework::type eq 'practice')          || ($Apache::lonhomework::type eq 'practice')
         || ($Apache::lonhomework::history{'resource.CODE'})          || ($Apache::lonhomework::history{'resource.CODE'}) 
         || (($env{'form.code_for_randomlist'}) && ($target eq 'analyze'))) {          || (($env{'form.code_for_randomlist'}) && ($target eq 'analyze'))) {
  &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},   &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
  ['rndseed']);   ['rndseed']);
Line 1367  sub firstaccess_msg { Line 1368  sub firstaccess_msg {
     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');
     my $timertext = &mt('Start Timer?');      my $timertext = &mt('Start Timer?');
     my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb),'\'"<>&');  
     $result .= (<<ENDCHECKOUT);      $result .= (<<ENDCHECKOUT);
 <form name="markaccess" method="post" action="$uri">  <form name="markaccess" method="post" action="$uri">
 <input type="hidden" name="markaccess" value="yes" />  <input type="hidden" name="markaccess" value="yes" />
 <input type="hidden" name="symb" value="$shownsymb" />  
 <input type="button" name="accessbutton" value="$buttontext" onclick="javascript:if (confirm('$timertext')) { document.markaccess.submit(); }" />  <input type="button" name="accessbutton" value="$buttontext" onclick="javascript:if (confirm('$timertext')) { document.markaccess.submit(); }" />
 </form>  </form>
 ENDCHECKOUT  ENDCHECKOUT
Line 1529  sub start_problem { Line 1528  sub start_problem {
     my $resource_due;      my $resource_due;
   
     my $name= &get_resource_name($parstack,$safeeval);      my $name= &get_resource_name($parstack,$safeeval);
     my ($result,$form_tag_start,$slot_name,$slot,$probpartlist);      my ($result,$form_tag_start,$slot_name,$slot,$probpartlist,$firstaccres);
   
     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'}) {          if ($env{'form.markaccess'}) {
             my @interval=&Apache::lonnet::EXT("resource.0.interval");              my @interval=&Apache::lonnet::EXT("resource.0.interval");
             my ($timelimit) = ($interval[0] =~ /^(\d+)/);              my $is_set = &Apache::lonnet::set_first_access($interval[1],$interval[0]);
             &Apache::lonnet::set_first_access($interval[1],$timelimit);              unless (($is_set eq 'ok') || ($is_set eq 'already_set')) {
                   $firstaccres = $is_set;
               }
         }          }
   
         ($status,$accessmsg,$slot_name,$slot) =          ($status,$accessmsg,$slot_name,$slot) =
Line 1650  sub start_problem { Line 1651  sub start_problem {
  } elsif ($status eq 'UNCHECKEDOUT') {   } elsif ($status eq 'UNCHECKEDOUT') {
     $msg.=&checkout_msg();      $msg.=&checkout_msg();
  } elsif ($status eq 'NOT_YET_VIEWED') {   } elsif ($status eq 'NOT_YET_VIEWED') {
                       if ($firstaccres) {
                           $msg .= '<p class="LC_error">'.
                                   &mt('A problem occurred when trying to start the timer.').'</p>';
                       }
     $msg.=&firstaccess_msg($accessmsg,$symb);      $msg.=&firstaccess_msg($accessmsg,$symb);
  } elsif ($status eq 'NOT_IN_A_SLOT') {   } elsif ($status eq 'NOT_IN_A_SLOT') {
     $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");      $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");

Removed from v.1.512.2.13.4.4  
changed lines
  Added in v.1.512.2.17


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