--- loncom/homework/structuretags.pm 2020/10/01 18:54:21 1.512.2.13.4.4
+++ loncom/homework/structuretags.pm 2019/10/23 22:30:28 1.512.2.18
@@ -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.18 2019/10/23 22:30: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;
@@ -343,12 +342,12 @@ var postsubmit = '$postsubmit';
submithandled = 1;
\$( "#msg_"+buttonId ).css({"display": "inline","background-color": "#87cefa",
"color": "black","padding": "2px"}) ;
- if (( \$(this.form).id == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
+ if (( \$(this.form).attr("id") == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
if (buttonId != "all_submit") {
\$( ".LC_status_"+buttonId ).hide();
- if (( "#"+buttonId+"_pressed" ).length) {
- \$( "#"+buttonId+"_pressed" ).val( "1" );
- }
+ }
+ if (( "#"+buttonId+"_pressed" ).length) {
+ \$( "#"+buttonId+"_pressed" ).val( "1" );
}
} else {
\$( ".LC_status_"+buttonId ).hide();
@@ -361,11 +360,9 @@ var postsubmit = '$postsubmit';
if (timeout > 0) {
setTimeout(function(){
\$( "#msg_"+buttonId ).css({"display": "none"});
- if (( \$(this.form).id == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
- if (buttonId != "all_submit") {
- if (( "#"+buttonId+"_pressed" ).length) {
- \$( "#"+buttonId+"_pressed" ).val( "" );
- }
+ if (( \$(this.form).attr("id") == "LC_page" ) && (\$('input[name="all_submit"]').length )) {
+ if (( "#"+buttonId+"_pressed" ).length) {
+ \$( "#"+buttonId+"_pressed" ).val( "" );
}
}
\$( ".LC_hwk_submit" ).prop( "disabled", false);
@@ -497,7 +494,9 @@ sub page_start {
}
}
if ($needs_upload) {
- $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js();
+ $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js().
+ '';
}
}
@@ -652,9 +651,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 +1366,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 +1526,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 +1649,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");