--- loncom/homework/lonhomework.pm 2004/02/16 20:30:34 1.168
+++ loncom/homework/lonhomework.pm 2004/05/27 22:25:16 1.177
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.168 2004/02/16 20:30:34 albertel Exp $
+# $Id: lonhomework.pm,v 1.177 2004/05/27 22:25:16 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,6 +47,7 @@ use Apache::externalresponse();
use Apache::rankresponse();
use Apache::matchresponse();
use Apache::chemresponse();
+use Apache::drawimage();
use Apache::Constants qw(:common);
use HTML::Entities();
use Apache::loncommon();
@@ -206,11 +207,11 @@ sub check_access {
if ( ! ($ENV{'form.problemstate'} eq 'CANNOT_ANSWER_correct' &&
lc($Apache::lonhomework::problemstatus) eq 'no')) {
return ('CANNOT_ANSWER',
- &mt('is in this state by royal decree.'));
+ &mt('is in this state due to author settings.'));
}
} else {
return ($ENV{'form.problemstate'},
- &mt('is in this state by royal decree.'));
+ &mt('is in this state due to author settings.'));
}
}
&Apache::lonxml::debug("in construction ignoring dates");
@@ -291,7 +292,26 @@ sub check_access {
$status = 'CANNOT_ANSWER';
}
}
-
+ if ($status eq 'CAN_ANSWER') {
+ my $interval=&Apache::lonnet::EXT("resource.$id.interval");
+ &Apache::lonxml::debug("looking for interval $interval");
+ if ($interval) {
+ my $first_access=&Apache::lonnet::get_first_access('map');
+ &Apache::lonxml::debug("looking for accesstime $first_access");
+ if (!$first_access) {
+ $status='NOT_YET_VIEWED';
+ $datemsg=' '.$interval.' seconds';
+ } else {
+ my $newdate=localtime($first_access+$interval);
+ if (time > ($first_access+$interval)) {
+ $status='CLOSED';
+ $datemsg = &mt("was due on")." $newdate".&mt(", and answers will be available on")." $date";
+ } else {
+ $datemsg = &mt("is due at")." $newdate";
+ }
+ }
+ }
+ }
#if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&
# (!$Apache::lonhomework::history{"resource.0.outtoken"})) {
# return ('UNCHECKEDOUT','needs to be checked out');
@@ -398,29 +418,29 @@ sub handle_save_or_undo {
if ((!$error) && (!copy($filebak,$file))) { $error=1; }
if ((!$error) && (!move($filetmp,$filebak))) { $error=1; }
if (!$error) {
- $request->print("