version 1.512.2.13.4.4, 2020/10/01 18:54:21
|
version 1.512.2.18, 2019/10/23 22:30: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 343 var postsubmit = '$postsubmit';
|
Line 342 var postsubmit = '$postsubmit';
|
submithandled = 1; |
submithandled = 1; |
\$( "#msg_"+buttonId ).css({"display": "inline","background-color": "#87cefa", |
\$( "#msg_"+buttonId ).css({"display": "inline","background-color": "#87cefa", |
"color": "black","padding": "2px"}) ; |
"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") { |
if (buttonId != "all_submit") { |
\$( ".LC_status_"+buttonId ).hide(); |
\$( ".LC_status_"+buttonId ).hide(); |
if (( "#"+buttonId+"_pressed" ).length) { |
} |
\$( "#"+buttonId+"_pressed" ).val( "1" ); |
if (( "#"+buttonId+"_pressed" ).length) { |
} |
\$( "#"+buttonId+"_pressed" ).val( "1" ); |
} |
} |
} else { |
} else { |
\$( ".LC_status_"+buttonId ).hide(); |
\$( ".LC_status_"+buttonId ).hide(); |
Line 361 var postsubmit = '$postsubmit';
|
Line 360 var postsubmit = '$postsubmit';
|
if (timeout > 0) { |
if (timeout > 0) { |
setTimeout(function(){ |
setTimeout(function(){ |
\$( "#msg_"+buttonId ).css({"display": "none"}); |
\$( "#msg_"+buttonId ).css({"display": "none"}); |
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") { |
if (( "#"+buttonId+"_pressed" ).length) { |
if (( "#"+buttonId+"_pressed" ).length) { |
\$( "#"+buttonId+"_pressed" ).val( "" ); |
\$( "#"+buttonId+"_pressed" ).val( "" ); |
|
} |
|
} |
} |
} |
} |
\$( ".LC_hwk_submit" ).prop( "disabled", false); |
\$( ".LC_hwk_submit" ).prop( "disabled", false); |
Line 497 sub page_start {
|
Line 494 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 651 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 1366 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 1526 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 1649 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"); |