--- loncom/homework/lonhomework.pm 2006/06/30 17:42:38 1.256
+++ loncom/homework/lonhomework.pm 2006/10/05 13:59:57 1.260
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.256 2006/06/30 17:42:38 albertel Exp $
+# $Id: lonhomework.pm,v 1.260 2006/10/05 13:59:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -514,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;
@@ -884,9 +885,16 @@ sub renderpage {
my $problem=&Apache::lonnet::getfile($file);
my $result;
if ($problem eq -1) {
- my $filename=(split('/',$file))[-1];
- $result.=" ".&mt('Unable to find')." $filename";
$problem='';
+ my $filename=(split('/',$file))[-1];
+ my $error =
+ " ".&mt('Unable to find [_1]',
+ ' '.$filename.'')
+ ."";
+ $result.=
+ &Apache::loncommon::simple_error_page($request,'Not available',
+ $error);
+ return;
}
my %mystyle;
@@ -968,7 +976,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,25 +993,18 @@ sub newproblem {
my $instructions;
my $start_page =
&Apache::loncommon::start_page("Create New $extension");
- if ($templatelist) { $instructions=&mt(", select a template from the pull-down menu below.").'
-$lt{'createnew'} $extension$instructions $lt{'click'} "$lt{'Create'} $extension" $lt{'button'}.
-
'.&mt("Then");}
- my %lt=&Apache::lonlocal::texthash( 'create' => 'Creating a new',
- 'resource' => 'resource',
- 'requested' => 'The requested file',
- 'not exist' => 'currently does not exist',
- 'createnew' => 'To create a new',
- 'click' => 'click on the',
- 'Create' => 'Create',
- 'button' => 'button');
- $request->print(<$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")."