--- loncom/imspackages/imsimportdocs.pm 2012/10/31 12:54:17 1.30 +++ loncom/imspackages/imsimportdocs.pm 2017/11/05 20:00:48 1.35 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: imsimportdocs.pm,v 1.30 2012/10/31 12:54:17 raeburn Exp $ +# $Id: imsimportdocs.pm,v 1.35 2017/11/05 20:00:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -48,9 +48,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 +225,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 +240,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 +396,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 +453,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); } @@ -502,7 +500,7 @@ sub display_two { &Apache::imsprocessor::process_resinfo($cms,'DOCS',$tempdir,$destdir,\%items,\%resources,\@targets,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$seqstem,$seqstem,\@resrcfiles,\@packages,\%hrefs,\@pages,\@sequences); - my $copy_result = &Apache::imsprocessor::copy_resources('DOCS',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\%importareas); + my $copy_result = &Apache::imsprocessor::copy_resources('DOCS',$cms,\%hrefs,\%resources,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\%importareas); &Apache::imsprocessor::build_structure($cms,'DOCS',$destdir,\%items,\%resinfo,\%resources,\@targets,\%hrefs,$udom,$uname,'',$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames,\@packages,\%includeditems); @@ -558,7 +556,7 @@ sub display_two { # Re-initialize Button my $initbutton = ''; $r->print( '
'