--- loncom/publisher/testbankimport.pm 2011/10/23 01:27:34 1.31
+++ loncom/publisher/testbankimport.pm 2013/04/11 14:59:58 1.38
@@ -1,5 +1,5 @@
# Handler for parsing text upload problem descriptions into .problems
-# $Id: testbankimport.pm,v 1.31 2011/10/23 01:27:34 www Exp $
+# $Id: testbankimport.pm,v 1.38 2013/04/11 14:59:58 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();
@@ -445,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|
@@ -485,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('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:').'
'.&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; @@ -1130,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.'
'.&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; } @@ -1159,7 +1158,7 @@ sub show_uploaded_data { } sub page_footer { - my ($newdir,$uname,$fn,$page,$webpath,$subdir,$state) = @_; + my ($newdir,$fn,$page,$webpath,$subdir,$state) = @_; my $prevval = &mt('Previous Page'); my $nextval = &mt('Next Page'); my $prevclick = 'javascript:backPage();'; @@ -1184,7 +1183,6 @@ sub page_footer { } my $output = ' - @@ -1580,6 +1578,7 @@ sub create_ess { if (open(PROB,">$destdir$libfile")) { print PROB $output; close(PROB); + $result = 'ok'; } else { $result = 'failed'; } @@ -1604,18 +1603,18 @@ sub probfile_name { } sub file_error { - my ($r,$uname,$fn,$current_page,$webpath,$res) = @_; + my ($r,$fn,$current_page,$webpath,$res) = @_; $r->print(''); return; } sub parse_datafile { - my ($r,$uname,$filename,$pathname,$dirpath,$urlpath,$page_name,$subdir,$timestamp) = @_; + my ($r,$filename,$dirpath,$webpath,$page_name,$subdir,$timestamp) = @_; my ($badfile,$res,%allfiles,%codebase); my $mm = new File::MMagic; my ($text,$header,$css,$js); @@ -1630,7 +1629,7 @@ sub parse_datafile { my $html = ''; my $image_uri = $timestamp; if ($page_name eq 'Target') { - $image_uri = $urlpath.'/'.$timestamp; + $image_uri = "$webpath/$timestamp"; } my $image_dir; if ($page_name eq 'Blocks') { @@ -1768,15 +1767,15 @@ sub parse_htmlcontent { } sub build_image_url { - my ($urlpath,$item) = @_; - $item =~ s/(