--- loncom/publisher/testbankimport.pm 2013/10/10 00:46:50 1.43 +++ loncom/publisher/testbankimport.pm 2017/11/12 23:08:58 1.45 @@ -1,5 +1,5 @@ # Handler for parsing text upload problem descriptions into .problems -# $Id: testbankimport.pm,v 1.43 2013/10/10 00:46:50 raeburn Exp $ +# $Id: testbankimport.pm,v 1.45 2017/11/12 23:08:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -579,7 +579,7 @@ sub display_two { my $blocks = $env{'form.blocks'}; my $qnumformat = $env{'form.qnumformat'}; my @types = ("MC","MA","TF","Ess","FIB","Ord"); - my %typenames = ( + my %typenames = &Apache::lonlocal::texthash( MC => "Multiple Choice", TF => "True/False", MA => "Multiple Answer", @@ -1508,7 +1508,7 @@ sub create_mcq { if (-e $destdir.$libfile) { $result = 'exists'; } else { - if (open(PROB,">$destdir$libfile")) { + if (open(PROB,">",$destdir.$libfile)) { print PROB $output; close(PROB); $result = 'ok'; @@ -1586,7 +1586,7 @@ sub create_ess { if (-e $destdir.$libfile) { $result = 'exists'; } else { - if (open(PROB,">$destdir$libfile")) { + if (open(PROB,">",$destdir.$libfile)) { print PROB $output; close(PROB); $result = 'ok'; @@ -1617,7 +1617,10 @@ sub file_error { my ($r,$fn,$current_page,$webpath,$res) = @_; $r->print('

'.&mt('The file you uploaded does not appear to be in the correct format.'). '

'.&mt('Extraction of questions is only possible for the following file types:'). - '

'. + ''. &mt('The file type identified for the file you uploaded is [_1].',''.$res.'').'

'); $r->print(&page_footer($env{'form.newdir'},$fn,$current_page,$webpath,undef,'badfile'). '
'); @@ -1633,7 +1636,7 @@ sub parse_datafile { $res = $mm->checktype_filename($dirpath.$filename); if ($env{'form.phase'} eq 'three') { if ($res eq 'text/plain') { - open(TESTBANK,"<$dirpath$filename"); + open(TESTBANK,"<",$dirpath.$filename); @{$text} = ; close(TESTBANK); } elsif ($res eq 'application/rtf') { @@ -1862,7 +1865,7 @@ sub handler { if ($env{'form.phase'} eq 'three') { $current_page = &display_control(); @pages = ('Welcome','Blocks','Format','Target','Confirmation'); - %names = ( + %names = &Apache::lonlocal::texthash( Welcome => 'Testbank Format', Blocks => 'Classification', Format => 'Selection',