--- loncom/imspackages/imsimport.pm 2006/03/23 23:12:21 1.14
+++ loncom/imspackages/imsimport.pm 2006/11/27 16:37:36 1.21
@@ -34,15 +34,21 @@ use HTML::Entities();
use Apache::lonlocal;
use Apache::lonupload;
use File::Basename();
-
+use LONCAPA;
+
# ---------------------------------------------------------------- Jscript One
sub jscript_one {
my ($fullpath,$jsref) = @_;
+ my %body_layout = ('rightmargin' => "0",
+ 'leftmargin' => "0",
+ 'marginwidth' => "0",
+ 'topmargin' => "0",
+ 'marginheight' => "0");
my $start_page =
&Apache::loncommon::start_page('Create IMS import directory',undef,
{'only_body' => 1,
- 'add_entries' => "topmargin='0' leftmargin='0' marginheight='0'marginwidth='0' rightmargin='0'",
+ 'add_entries' => \%body_layout,
'js_ready' => 1,});
my $end_page =
&Apache::loncommon::end_page({'js_ready' => 1,});
@@ -78,10 +84,10 @@ function createWin() {
newWindow.document.write("
\\n")
newWindow.document.write("
\\n")
newWindow.document.write("")
@@ -300,11 +306,12 @@ sub display_one {
Please choose the CMS used to create your IMS content package.
@@ -327,7 +334,7 @@ Please choose the CMS used to create you
-Please choose a destination LON-CAPA directory in which to store the contents of the IMS package file.
+Please choose a destination LON-CAPA directory in which to store the contents of the IMS package file.
@@ -339,9 +346,9 @@ Please choose a destination LON-CAPA dir
-
-
-
+
+
+
@@ -352,10 +359,10 @@ Please choose a destination LON-CAPA dir
-
+
-
+
@@ -408,10 +415,13 @@ sub display_two {
my $conditions;
if ($unzip_result eq 'ok') {
- $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'choose',\%includedres,\%includeditems);
+ $manifest_result = &Apache::imsprocessor::process_manifest($cms,
+ $tempdir,\%resources,\%items,\%hrefs,\%resinfo,
+ 'choose',\%includedres,\%includeditems);
if ($manifest_result eq 'ok') {
foreach my $res (sort keys %resources) {
- if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webct4') {
+ if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4'
+ || $cms eq 'webctvista4') {
foreach my $area (keys %{$$cmsmap{$cms}}) {
if ($resources{$res}{type} eq $$cmsmap{$cms}{$area}) {
$count{$area} ++;
@@ -490,13 +500,13 @@ ENDBLOCK
if ($area eq 'board') {
$r->print("
");
} elsif ($area eq 'users') {
$r->print("
");
@@ -543,7 +553,7 @@ ENDBLOCKTWO
Choose course:
@@ -587,10 +597,10 @@ ENDBLOCK
-
+
-
+
@@ -650,6 +660,7 @@ sub display_three {
my @pages = ();
my @sequences = ();
my @resrcfiles = ();
+ my @assessmentfiles = ();
my $tempdir = $env{'form.tempdir'};
@@ -670,11 +681,18 @@ sub display_three {
}
}
- my $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'prepare',\%includedres);
+ my $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,
+ \%resources,\%items,\%hrefs,\%resinfo,'prepare',
+ \%includedres);
if ($manifest_result eq 'ok') {
foreach my $res (sort keys %resources) {
if ($importareas{$resources{$res}{type}}) {
$includedres{$res} = 1;
+ if ($resources{$res}{type} eq 'webct.manifest' ||
+ $resources{$res}{type} eq 'webct.assessment' ||
+ $resources{$res}{type} eq 'webct.question') {
+ push(@assessmentfiles,$res);
+ }
}
}
foreach my $itm (sort keys %items) {
@@ -686,7 +704,9 @@ sub display_three {
&Apache::imsprocessor::get_parents(\%includeditems,\%items,$itm);
}
- $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'build',\%includedres,\%includeditems);
+ $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,
+ \%resources,\%items,\%hrefs,\%resinfo,'build',
+ \%includedres,\%includeditems);
if ($manifest_result eq 'ok') {
&Apache::imsprocessor::target_resources(\%resources,\%importareas,\@targets);
@@ -705,7 +725,7 @@ sub display_three {
&Apache::imsprocessor::process_resinfo($cms,'CSTR',$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,\%randompicks);
- my $copy_result = &Apache::imsprocessor::copy_resources('CSTR',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\%importareas);
+ my $copy_result = &Apache::imsprocessor::copy_resources('CSTR',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\%importareas,\@assessmentfiles);
&Apache::imsprocessor::build_structure($cms,'CSTR',$destdir,\%items,\%resinfo,\%resources,\@targets,\%hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames,\@packages,\%includeditems,\%randompicks);
@@ -738,7 +758,7 @@ sub get_ccroles {
my @crslist = ();
my %descrip =();
foreach my $key (keys %roles ) {
- if ($key =~ m/^\/(\w+)\/(\w+)_cc$/) {
+ if ($key =~ m{^/($LONCAPA::domain_re)/($LONCAPA::username_re)_cc$}) {
my $cdom = $1;
my $crs = $2;
my $role_end = 0;
@@ -807,7 +827,6 @@ sub handler {
my $javascript = '';
my $page_name = '';
my $current_page = '';
- my $loadentries = '';
my $qcount = '';
# get personal information for this user
@@ -850,7 +869,6 @@ sub handler {
unless ($pathname eq '/') {
$fullpath .= '/';
}
- my $loadentries = '';
my @areas = ();
my %cmsmap = ();
@@ -872,9 +890,7 @@ sub handler {
$javascript = "\n";
my $title = 'Upload IMS package to Construction Space';
- $r->print(&Apache::loncommon::start_page($title, $javascript,
- {'add_entries' =>
- $loadentries,}));
+ $r->print(&Apache::loncommon::start_page($title, $javascript));
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
$r->print('