--- loncom/publisher/testbankimport.pm 2008/07/08 07:17:46 1.16 +++ loncom/publisher/testbankimport.pm 2008/09/22 01:53:33 1.17 @@ -1,5 +1,5 @@ # Handler for parsing text upload problem descriptions into .problems -# $Id: testbankimport.pm,v 1.16 2008/07/08 07:17:46 raeburn Exp $ +# $Id: testbankimport.pm,v 1.17 2008/09/22 01:53:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1163,8 +1163,8 @@ sub page_footer { my $nextval = &mt('Next Page'); my $prevclick = 'javascript:backPage();'; my $nextclick = 'javascript:nextPage();'; - my $go = ''; - if ($page == 0) { + my $go = ''; + if (($page == 0) || ($state eq 'badfile')) { $go = 'NextPage'; $prevval = &mt('Exit Now'); $prevclick = 'javascript:location.href='."'$webpath';"; @@ -1195,7 +1195,7 @@ sub page_footer { '; - if ($page < 4) { + if (($page < 4) && ($state ne 'badfile')) { $output .= '   @@ -1599,8 +1599,14 @@ sub probfile_name { } sub file_error { - my ($r,$uname,$fn,$current_page); - $r->print("No data here"); + my ($r,$uname,$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'},$uname,$fn,$current_page,$webpath,undef,'badfile'). + '
'); + return; } sub parse_datafile { @@ -1875,7 +1881,7 @@ sub handler { $r->print(&Apache::lonupload::phasethree($r,$fn,$uname,$udom,'testbank')); } if ($badfile) { - &file_error($r,$uname,$fn,$current_page); + &file_error($r,$uname,$fn,$current_page,$webpath,$res); } else { &display_zero ($r,$uname,$fn,$current_page,$webpath) if $page_name eq 'Welcome'; &display_one ($r,$uname,$fn,$current_page,$textref,$header) if $page_name eq 'Blocks';