--- loncom/homework/lonhomework.pm 2006/07/20 03:57:38 1.257
+++ loncom/homework/lonhomework.pm 2006/11/30 01:14:17 1.262
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.257 2006/07/20 03:57:38 albertel Exp $
+# $Id: lonhomework.pm,v 1.262 2006/11/30 01:14:17 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -393,7 +393,7 @@ sub check_access {
&Apache::lonxml::debug("checking for part :$id:");
&Apache::lonxml::debug("time:".time);
- my ($symb)=&Apache::lonxml::whichuser();
+ my ($symb)=&Apache::lonnet::whichuser();
&Apache::lonxml::debug("symb:".$symb);
#if ($env{'request.state'} ne "construct" && $symb ne '') {
if ($env{'request.state'} ne "construct") {
@@ -604,7 +604,7 @@ sub setuppermissions {
if ($Apache::lonhomework::browse eq 'F' &&
$env{'form.devalidatecourseresdata'} eq 'on') {
- my (undef,$courseid) = &Apache::lonxml::whichuser();
+ my (undef,$courseid) = &Apache::lonnet::whichuser();
&Apache::lonnet::devalidatecourseresdata($env{"course.$courseid.num"},
$env{"course.$courseid.domain"});
}
@@ -657,9 +657,6 @@ sub handle_save_or_undo {
my $filebak =$file.".bak";
my $filetmp =$file.".tmp";
my $error=0;
-
- &Apache::lonnet::correct_line_ends($result);
-
if ($env{'form.Undo'} eq &mt('undo')) {
my $error=0;
if (!copy($file,$filetmp)) { $error=1; }
@@ -672,6 +669,7 @@ sub handle_save_or_undo {
$error=1;
}
} else {
+ &Apache::lonnet::correct_line_ends($result);
my $fs=Apache::File->new(">$filebak");
if (defined($fs)) {
print $fs $$problem;
@@ -885,9 +883,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;
@@ -969,7 +974,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);
@@ -986,25 +991,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")."