--- loncom/homework/lonhomework.pm 2006/06/26 22:33:22 1.254
+++ loncom/homework/lonhomework.pm 2006/09/25 19:41:56 1.258
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.254 2006/06/26 22:33:22 albertel Exp $
+# $Id: lonhomework.pm,v 1.258 2006/09/25 19:41:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -344,9 +344,14 @@ sub check_slot_access {
}
}
+
if ( $is_correct) {
+ if ($type eq 'problem') {
+ return ($status);
+ }
return ('SHOW_ANSWER');
}
+
if ( $status eq 'CANNOT_ANSWER' &&
($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) {
return ($status,$datemsg);
@@ -475,7 +480,11 @@ sub check_access {
if (!$first_access) {
$status='NOT_YET_VIEWED';
my $due_date = &due_date($id);
- $datemsg=&seconds_to_human_length($due_date-time);
+ my $seconds_left = $due_date - time;
+ if ($seconds_left > $interval || $due_date eq '') {
+ $seconds_left = $interval;
+ }
+ $datemsg=&seconds_to_human_length($seconds_left);
}
}
}
@@ -505,8 +514,9 @@ sub due_date {
my $due_date= &Apache::lonnet::EXT("resource.$part_id.duedate",$symb,
$udom,$uname);
&Apache::lonxml::debug("looking for due_date $part_id $symb $due_date");
- if (defined($interval)) {
+ if ($interval =~ /\d+/) {
my $first_access=&Apache::lonnet::get_first_access('map',$symb);
+ &Apache::lonxml::debug("looking for first_access $first_access");
if (defined($first_access)) {
$interval = $first_access+$interval;
$date = ($interval < $due_date)? $interval : $due_date;
@@ -959,7 +969,7 @@ sub newproblem {
# I don't like hard-coded filenames but for now, this will work.
use File::Copy;
my $templatefilename =
- $request->dir_config('lonIncludes').'/templates/blank.problem';
+ $request->dir_config('lonIncludes').'/templates/blank.'.$extension;
&Apache::lonxml::debug("$templatefilename");
my $dest = &Apache::lonnet::filelocation("",$request->uri);
copy($templatefilename,$dest);
@@ -985,16 +995,19 @@ sub newproblem {
'click' => 'click on the',
'Create' => 'Create',
'button' => 'button');
- $request->print(<
-$lt{'createnew'} $extension$instructions $lt{'click'} "$lt{'Create'} $extension" $lt{'button'}.
-$lt{'create'} $extension $lt{'resource'}
+".&mt("Creating a new $extension resource.")."
$errormsg
-$lt{'requested'} $shownurl $lt{'not exist'}.
+".&mt("The requested file [_1] currently does not exist.",
+ "$shownurl")."