--- loncom/homework/lonhomework.pm 2003/05/14 17:16:20 1.127 +++ loncom/homework/lonhomework.pm 2003/05/16 17:41:17 1.128 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.127 2003/05/14 17:16:20 matthew Exp $ +# $Id: lonhomework.pm,v 1.128 2003/05/16 17:41:17 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -547,7 +547,7 @@ sub get_template_list { } if (@allnames && !$result) { $result="\n'; + join(''; } return $result; } @@ -558,33 +558,29 @@ sub newproblem { $extension=~s:^.*\.([\w]+)$:$1:; &Apache::lonxml::debug("Looking for :$extension:"); if ($ENV{'form.template'} && - $ENV{'form.template'} ne "Select a $extension type") { + $ENV{'form.template'} ne "Select a $extension template") { use File::Copy; my $file = &get_template_list($ENV{'form.template'},$extension); my $dest = &Apache::lonnet::filelocation("",$request->uri); copy($file,$dest); &renderpage($request,$dest); - } elsif($ENV{'form.newfile'}) { - # 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; + if ($ENV{'form.newfile'}) { + $errormsg='

You did not select a template.

'."\n"; + } my $instructions; if ($templatelist) { $instructions=", select a template from the pull-down menu below.
Then";} $request->print(<

Creating a new $extension resource

+$errormsg The requested file $url currently does not exist.

-To create a new $extension$instructions click on the "Create $extension" button. +To create a new $extension$instructions click on the "Create $extension" button.

ENDNEWPROBLEM