--- loncom/publisher/testbankimport.pm 2008/06/17 13:00:19 1.15 +++ loncom/publisher/testbankimport.pm 2013/07/15 14:32:59 1.42 @@ -1,5 +1,5 @@ # Handler for parsing text upload problem descriptions into .problems -# $Id: testbankimport.pm,v 1.15 2008/06/17 13:00:19 raeburn Exp $ +# $Id: testbankimport.pm,v 1.42 2013/07/15 14:32:59 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,7 +28,6 @@ package Apache::testbankimport; use strict; use Apache::Constants qw(:common :http :methods); -use Apache::loncacc; use Apache::loncommon(); use Apache::lonnet; use HTML::Entities(); @@ -81,15 +80,16 @@ function createWin() { newWindow = window.open("","CreateDir","HEIGHT=400,WIDTH=750,scrollbars=yes") newWindow.document.open() newWindow.document.write('$start_page') - newWindow.document.write("[Author Header]\\n") + newWindow.document.write("[Author Header]\\n") newWindow.document.write("

$lt{'loca'}: $webpath

$lt{'newd'}

\\n") newWindow.document.write("
\\n") newWindow.document.write("$lt{'ente'}.

") - newWindow.document.write("") - newWindow.document.write("") - newWindow.document.write("") - newWindow.document.write("$webpath") - newWindow.document.write("
") + newWindow.document.write("") + newWindow.document.write("") + newWindow.document.write("") + newWindow.document.write("") + newWindow.document.write("$webpath") + newWindow.document.write("") newWindow.document.write('$end_page') newWindow.document.close() newWindow.focus() @@ -444,7 +444,7 @@ function verify() { if ($numitems > 0) { my $maxnum = $numitems - 1; my %lt = &Apache::lonlocal::texthash( - fnmb => 'File names must be unique', + fnmb => 'Filenames must be unique', isum => 'is used more than once', ); $$jsref .= qq| @@ -484,12 +484,12 @@ function backPage() { # ---------------------------------------------------------------- Display Zero sub display_zero { - my ($r,$uname,$fn,$page,$webpath) = @_; + my ($r,$fn,$page,$webpath) = @_; my $go_default = 'NextPage'; if ($fn eq '') { - $r->print(''.&mt('Incomplete file upload').' '.&mt('Return to the [_1]construction space menu[_2] to upload a file','','')); + $r->print(''.&mt('Incomplete file upload').' '.&mt('Return to the [_1]Authoring Space menu[_2] to upload a file','','')); } - $r->print(&mt('The Testbank Upload utility can be used by LON-CAPA authors to generate LON-CAPA problem files from a testbank file of questions/answers.').'
'. + $r->print(&mt('The [_1]Testbank Upload[_2] utility can be used by LON-CAPA authors to generate LON-CAPA problem files from a testbank file of questions/answers.','','').'
'. &mt('The following question types can be converted:').' '. - &page_footer($env{'form.newdir'},$uname,$fn,$page).' + &page_footer($env{'form.newdir'},$fn,$page).' '); return; } # ---------------------------------------------------------------- Display Three sub display_three { - my ($r,$uname,$fn,$page,$textref,$res,$header,$urlpath,$qcount) = @_; + my ($r,$fn,$page,$textref,$res,$header,$webpath,$qcount) = @_; my $qnumformat = $env{'form.qnumformat'}; my $filename = $env{'form.filename'}; my $source = $env{'form.go'}; @@ -681,7 +681,7 @@ sub display_three { my %lt = &Apache::lonlocal::texthash ( crt => 'Create?', typ => 'Type', - fnam => 'File Name', + fnam => 'Filename', ques => 'Question', answ => 'Answer', chka => 'check all', @@ -714,14 +714,14 @@ sub display_three { if ($header ne '') { $showheader = &HTML::Entities::decode($header); if ($res eq 'text/html') { - $showheader = &build_image_url($urlpath,$showheader); + $showheader = &build_image_url($webpath,$showheader); } } } $r->print('

'.&mt('Review and selection of problems to convert').'

'."\n". '
'."\n". &mt('Based on your previous responses your data have been split into a total of [quant,_1,question].',$numitems). - &topic_bar(5,&mt('Choose which problems to convert and names to use for individual problem files'))); + &Apache::lonhtmlcommon::topic_bar(5,&mt('Choose which problems to convert and names to use for individual problem files'))); if ($showheader) { $r->print($showheader.'
'); } @@ -763,12 +763,12 @@ sub display_three { if (($res eq 'application/rtf') || ($res eq 'text/html')) { $showqn = &HTML::Entities::decode($showqn); if ($res eq 'text/html') { - $showqn = &build_image_url($urlpath,$showqn); + $showqn = &build_image_url($webpath,$showqn); } } $r->print(&Apache::loncommon::start_data_table_row(). ''.$qnum.'.'."\n". - ''."\n". + ''."\n". ''.$qtype[$i].''."\n". ''. ''.$showqn.'

'."\n"); @@ -807,7 +807,7 @@ sub display_three { if ($res eq 'application/rtf' || $res eq 'text/html') { $showfoil = &HTML::Entities::decode($showfoil); if ($res eq 'text/html') { - $showfoil = &build_image_url($urlpath,$showfoil); + $showfoil = &build_image_url($webpath,$showfoil); } } $r->print("$foiltag $showfoil
\n"); @@ -829,7 +829,7 @@ sub display_three { } $r->print(&Apache::loncommon::start_data_table_row(). ''.$qnum.''."\n". - ''."\n". + ''."\n". ''.$qtype[$i].''."\n". ''."\n". ''.$items->[$j].''."\n". @@ -858,13 +858,13 @@ sub display_three { '); } } - $r->print('

'.&page_footer($env{'form.newdir'},$uname,$fn,$page).' + $r->print('

'.&page_footer($env{'form.newdir'},$fn,$page).'
'); } # ---------------------------------------------------------------- Final Display sub final_display { - my ($r,$uname,$fn,$page,$textref,$res,$header,$css,$js,$webpath,$dirpath,$subdir) = @_; + my ($r,$fn,$page,$textref,$res,$header,$css,$js,$webpath,$dirpath,$subdir) = @_; my $qnumformat = $env{'form.qnumformat'}; my $blocks = $env{'form.blocks'}; my $question_id = ''; @@ -1032,7 +1032,7 @@ sub final_display { for (my $i=0; $i<$numitems; $i++) { $r->print(''."\n"); } - $r->print(&topic_bar(6,&mt('Result of conversion of testbank questions to LON-CAPA problems'))); + $r->print(&Apache::lonhtmlcommon::topic_bar(6,&mt('Result of conversion of testbank questions to LON-CAPA problems'))); my $destdir = $dirpath; if ($destdir ne '' && $subdir ne '') { $subdir .= '/'; @@ -1041,7 +1041,7 @@ sub final_display { if (@createprobs == 0) { $state = 'unchecked'; $r->print('

'.&mt('No questions were selected for conversion.').'

'. - &page_footer($env{'form.newdir'},$uname,$fn,$page,$webpath,$subdir,$state).''); + &page_footer($env{'form.newdir'},$fn,$page,$webpath,$subdir,$state).''); } elsif (($destdir ne '') && (-e $destdir)) { my (@qn_file,@result,@numid); my $qcount = 0; @@ -1129,11 +1129,11 @@ sub final_display { $r->print('

'.&mt('The following files already existed, and were not overwritten so these problems generated from the testbank have not been saved:').'
'.$existing.'

'); $state = 'existing'; } - $r->print(&page_footer($env{'form.newdir'},$uname,$fn,$page,$webpath,$subdir,$state).''); + $r->print(&page_footer($env{'form.newdir'},$fn,$page,$webpath,$subdir,$state).''); } else { $state = 'nodir'; $r->print('

'.&mt('No destination directory was available so import of questions could not proceed.').'

'. - &page_footer($env{'form.newdir'},$uname,$fn,$page,$webpath,$subdir,$state).''); + &page_footer($env{'form.newdir'},$fn,$page,$webpath,$subdir,$state).''); } return; } @@ -1141,7 +1141,7 @@ sub final_display { sub show_uploaded_data { my ($textref,$header) = @_; my $output = '

'.&mt('Testbank data uploaded to the server').'

'."\n". - '