';
}
sub problem_edit_footer {
@@ -976,7 +975,7 @@ sub checkout_msg {
$lt{'warning'}
ENDCHECKOUT
}
@@ -996,7 +995,7 @@ sub firstaccess_msg {
} elsif ($interval[1] eq 'course') {
my $course = $env{'course.'.$env{'request.course.id'}.'.description'};
$result .= "".&mt('The resources in "[_1]" are open for a limited time.',$course).""
- .''.&mt('Once you click the "Show Resource" button below you have [_2] to omplete all resources "[_1]".'
+ .' '.&mt('Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'
,$course,$time)." ";
} else {
my $title=&Apache::lonnet::gettitle($symb);
@@ -1010,7 +1009,7 @@ sub firstaccess_msg {
$result .= (<
-
+
ENDCHECKOUT
return $result;
@@ -1160,9 +1159,23 @@ sub start_problem {
&Apache::run::run($expression,$safeeval);
my $status;
my $accessmsg;
+ my $resource_due;
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'
|| $target eq 'edit') {
($result,$form_tag_start) =
@@ -1175,20 +1188,6 @@ sub start_problem {
if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval,$target); }
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]);
- }
- 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
my $rndseed=&setup_rndseed($safeeval,$target);
@@ -1298,13 +1297,35 @@ sub start_problem {
'problem');
}
} elsif ($target eq 'web') {
- if ($status eq 'CAN_ANSWER'
- && $slot_name ne ''
- && $Apache::lonhomework::history{'resource.0.checkedin'} eq '') {
- # unproctored slot access, self checkin
- &Apache::bridgetask::check_in('problem',undef,undef,
- $slot_name);
- }
+ if ($status eq 'CAN_ANSWER') {
+ $resource_due = &Apache::lonhomework::due_date(0, $env{'request.symb'});
+ if ($slot_name ne '') {
+ my $checked_in =
+ $Apache::lonhomework::history{'resource.0.checkedin'};
+ 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".
'';
# create a page header and exit
@@ -1490,7 +1511,13 @@ sub end_problem {
$result.="";
}
if ($target eq 'web') {
- $result.= &Apache::loncommon::end_page({'discussion' => 1});
+ #
+ # Closing |