[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 23 May 2003 06:25:53 -0000
albertel Fri May 23 02:25:53 2003 EDT
Modified files:
/loncom/homework lonhomework.pm
Log:
- fixes BUG#1465, couldn't make a .exam as their aren't any templetes for it
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.130 loncom/homework/lonhomework.pm:1.131
--- loncom/homework/lonhomework.pm:1.130 Mon May 19 17:05:23 2003
+++ loncom/homework/lonhomework.pm Fri May 23 02:25:53 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.130 2003/05/19 21:05:23 albertel Exp $
+# $Id: lonhomework.pm,v 1.131 2003/05/23 06:25:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -399,7 +399,6 @@
my $subresult=&Apache::lonnet::ssi($request->uri,
('grade_target' => 'analyze'),
('rndseed' => $i+$rndseed));
- &Apache::lonxml::debug(":$subresult:");
(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2);
my %analyze=&Apache::lonnet::str2hash($subresult);
my @parts;
@@ -572,6 +571,7 @@
my $extension=$request->uri;
$extension=~s:^.*\.([\w]+)$:$1:;
&Apache::lonxml::debug("Looking for :$extension:");
+ my $templatelist=&get_template_list('',$extension);
if ($ENV{'form.template'} &&
$ENV{'form.template'} ne "Select a $extension template") {
use File::Copy;
@@ -579,8 +579,16 @@
my $dest = &Apache::lonnet::filelocation("",$request->uri);
copy($file,$dest);
&renderpage($request,$dest);
+ } elsif($ENV{'form.newfile'} && !$templatelist) {
+ # 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';
+ &Apache::lonxml::debug("$templatefilename");
+ my $dest = &Apache::lonnet::filelocation("",$request->uri);
+ copy($templatefilename,$dest);
+ &renderpage($request,$dest);
} else {
- my $templatelist=&get_template_list('',$extension);
my $url=$request->uri;
my $dest = &Apache::lonnet::filelocation("",$request->uri);
my $errormsg;