--- loncom/imspackages/imsimportdocs.pm 2013/07/27 22:04:49 1.31
+++ loncom/imspackages/imsimportdocs.pm 2018/05/02 17:06:45 1.37
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: imsimportdocs.pm,v 1.31 2013/07/27 22:04:49 raeburn Exp $
+# $Id: imsimportdocs.pm,v 1.37 2018/05/02 17:06:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,6 +36,7 @@ use Apache::imsprocessor;
use LONCAPA::map();
use lib '/home/httpd/lib/perl/';
use LONCAPA;
+use File::Path();
use strict;
@@ -48,9 +49,9 @@ sub jscript_one {
es => 'Enroll students only',
ea => 'Enroll all users',
nr => 'Not required',
- id => 'You must select one of the additional options when importing Disussion Boards',
- ie => 'You must select one of the additional options when importing Enrollment',
- ct => 'You must check at least one Content Type',
+ id => 'You must select one of the additional options when importing Discussion Boards.',
+ ie => 'You must select one of the additional options when importing Enrollment.',
+ ct => 'You must check at least one Content Type.',
);
return <<"ENDJS";
function setOptions(caller,itemnum) {
@@ -225,10 +226,11 @@ sub display_one {
if ($unzip_result ne 'ok') {
$r->print(
- '
'
- .&mt('Processing of your IMS package failed because the file you'
- .' uploaded could not be unzipped.')
- .'
'
+ &Apache::loncommon::confirmwrapper(
+ &Apache::lonhtmlcommon::confirm_success(
+ &mt('Processing of your IMS package failed because the file you'
+ .' uploaded could not be unzipped.'),1)
+ .' '.&mt('Error: [_1]',$unzip_result))
);
return();
}
@@ -239,23 +241,24 @@ sub display_one {
\%resinfo,'choose',\%includedres,\%includeditems);
if ($manifest_result ne 'ok') {
$r->print(
- '
'
- .&mt('Unpacking of your IMS package failed because an IMS manifest file was not located in the package.')
- .'
'
+ ' '.&Apache::loncommon::confirmwrapper(
+ &Apache::lonhtmlcommon::confirm_success(
+ &mt('Unpacking of your IMS package failed because an IMS manifest file'
+ .' was not located in the package.'),1))
);
return();
}
# Count areas depending on cms version
- foreach my $res (sort keys %resources) {
+ foreach my $res (sort(keys(%resources))) {
if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4') {
- foreach my $area (keys %{$cmsmap{$cms}}) {
+ foreach my $area (keys(%{$cmsmap{$cms}})) {
if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {
$count{$area} ++;
}
}
} elsif ($cms eq 'angel5') {
- foreach my $area (keys %{$cmsmap{$cms}}) {
+ foreach my $area (keys(%{$cmsmap{$cms}})) {
if ($area eq 'doc') {
if (grep/^$resources{$res}{type}$/,@{$cmsmap{$cms}{doc}}) {
$count{$area} ++;
@@ -394,10 +397,6 @@ sub display_two {
my $folder = $env{'form.folder'};
my $cms = $env{'form.source'};
my $tempdir = $env{'form.tempdir'};
- my $longcrs = '';
- if ($crs =~ m/^(\d)(\d)(\d)/) {
- $longcrs = $1.'/'.$2.'/'.$3.'/'.$crs;
- }
my %importareas = ();
my %includedres = ();
my %includeditems = ();
@@ -455,16 +454,16 @@ sub display_two {
my $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'prepare',\%includedres,\%includeditems);
if ($manifest_result eq 'ok') {
- foreach my $res (sort keys %resources) {
+ foreach my $res (sort(keys(%resources))) {
if ($importareas{$resources{$res}{type}}) {
$includedres{$res} = 1;
}
}
- foreach my $itm (sort keys %items) {
+ foreach my $itm (sort(keys(%items))) {
&Apache::imsprocessor::get_imports(\%includeditems,\%items,\%resources,\%importareas,$itm);
}
}
- foreach my $itm (sort keys %includeditems) {
+ foreach my $itm (sort(keys(%includeditems))) {
&Apache::imsprocessor::get_parents(\%includeditems,\%items,$itm);
}
@@ -546,7 +545,7 @@ sub display_two {
}
}
if ($tempdir =~ m/^\/home\/httpd\/perl\/tmp\/$crs\/\d{10}/) {
- system("rm -r -f $tempdir");
+ &File::Path::remove_tree($tempdir,{ safe => 1 });
}
# All done, display success message
@@ -558,10 +557,14 @@ sub display_two {
# Re-initialize Button
my $initbutton =
'';
+ my $windowname = 'loncapaclient';
+ if ($env{'request.lti.login'}) {
+ $windowname .= 'lti';
+ }
$r->print(
- '