--- loncom/homework/structuretags.pm 2020/10/01 18:54:21 1.512.2.13.4.4 +++ loncom/homework/structuretags.pm 2019/08/07 21:44:28 1.512.2.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.512.2.13.4.4 2020/10/01 18:54:21 raeburn Exp $ +# $Id: structuretags.pm,v 1.512.2.17 2019/08/07 21:44:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -63,7 +63,6 @@ use Apache::londefdef; use Apache::lonenc(); use Apache::loncommon(); use Time::HiRes qw( gettimeofday tv_interval ); -use HTML::Entities(); use lib '/home/httpd/lib/perl/'; use LONCAPA; @@ -497,7 +496,9 @@ sub page_start { } } if ($needs_upload) { - $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js(); + $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js(). + ''; } } @@ -652,9 +653,9 @@ sub setup_rndseed { $questiontype = $Apache::lonhomework::type; } if (($env{'request.state'} eq "construct") - || ($symb eq '') + || ($symb eq '') || ($Apache::lonhomework::type eq 'practice') - || ($Apache::lonhomework::history{'resource.CODE'}) + || ($Apache::lonhomework::history{'resource.CODE'}) || (($env{'form.code_for_randomlist'}) && ($target eq 'analyze'))) { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['rndseed']); @@ -1367,11 +1368,9 @@ sub firstaccess_msg { my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'}); my $buttontext = &mt('Show Resource'); my $timertext = &mt('Start Timer?'); - my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb),'\'"<>&'); $result .= (< - ENDCHECKOUT @@ -1529,14 +1528,16 @@ sub start_problem { my $resource_due; 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' || $target eq 'tex') { if ($env{'form.markaccess'}) { my @interval=&Apache::lonnet::EXT("resource.0.interval"); - my ($timelimit) = ($interval[0] =~ /^(\d+)/); - &Apache::lonnet::set_first_access($interval[1],$timelimit); + my $is_set = &Apache::lonnet::set_first_access($interval[1],$interval[0]); + unless (($is_set eq 'ok') || ($is_set eq 'already_set')) { + $firstaccres = $is_set; + } } ($status,$accessmsg,$slot_name,$slot) = @@ -1650,6 +1651,10 @@ sub start_problem { } elsif ($status eq 'UNCHECKEDOUT') { $msg.=&checkout_msg(); } elsif ($status eq 'NOT_YET_VIEWED') { + if ($firstaccres) { + $msg .= '

'. + &mt('A problem occurred when trying to start the timer.').'

'; + } $msg.=&firstaccess_msg($accessmsg,$symb); } elsif ($status eq 'NOT_IN_A_SLOT') { $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");