--- loncom/imspackages/imsimportdocs.pm 2009/11/06 17:16:53 1.24 +++ loncom/imspackages/imsimportdocs.pm 2009/11/20 14:39:32 1.26 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: imsimportdocs.pm,v 1.24 2009/11/06 17:16:53 bisitz Exp $ +# $Id: imsimportdocs.pm,v 1.26 2009/11/20 14:39:32 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -165,9 +165,15 @@ sub handler { my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); unless ($allowed) { $r->print(&Apache::loncommon::start_page('Import IMS package',undef, - {'only_body' => 1,})); - $r->print('
' + .&mt('Modification of Course Contents Disallowed') + .'
' + .&mt('Your current role does not grant you the right to modify course content in this course.') + .'
' + .&Apache::loncommon::end_page() + ); return OK; } @@ -183,11 +189,13 @@ sub handler { } $javascript = - "\n"; - my $start_page = &Apache::loncommon::start_page('Import IMS package', - $javascript, - {'only_body' => 1,}); + "\n"; + my $headline = 'Import IMS package'; + my $start_page = &Apache::loncommon::start_page($headline, + $javascript, + {'only_body' => 1,}) + .'' + .&mt('Processing of your IMS package failed because the file you' + .' uploaded could not be unzipped.') + .'
' + ); + return(); + } + + # Get manifest file from package + $manifest_result = &Apache::imsprocessor::process_manifest( + $cms,$tempdir,\%resources,\%items,\%hrefs, + \%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.') + .'
' + ); + return(); + } + + # Count areas depending on cms version + foreach my $res (sort keys %resources) { + if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4') { + foreach my $area (keys %{$cmsmap{$cms}}) { + if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) { + $count{$area} ++; } } - $r->print(<
-
|
-
' - .&mt('Unpacking of your IMS package failed because an IMS manifest file was not located in the package.') - .'
' + '' + .&mt('Unsupported IMS format: [_1]',$cms) + .'