--- loncom/imspackages/imsimportdocs.pm 2006/03/23 23:12:21 1.15
+++ loncom/imspackages/imsimportdocs.pm 2009/08/17 03:52:09 1.23
@@ -1,3 +1,7 @@
+# The LearningOnline Network with CAPA
+#
+# $Id: imsimportdocs.pm,v 1.23 2009/08/17 03:52:09 raeburn Exp $
+#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -30,6 +34,10 @@ use Apache::loncommon;
use Apache::lonlocal;
use Apache::imsprocessor;
use LONCAPA::Configuration;
+use LONCAPA::map();
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
+
use strict;
sub jscript_one {
@@ -150,7 +158,7 @@ sub handler {
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
- my $plainname=&Apache::lonnet::escape(
+ my $plainname=&escape(
&Apache::loncommon::plainname($uname,$udom));
# does this user have privileges to post, etc?
@@ -210,7 +218,7 @@ sub display_one {
-
+
Specify the Course Management system used to create the package.
@@ -226,11 +234,11 @@ sub display_one {
Please choose the CMS used to create your IMS content package.
@@ -242,7 +250,7 @@ Please choose the CMS used to create you
-
+
Locate the IMS content package you wish to upload.
@@ -274,10 +282,10 @@ Please choose the CMS used to create you
-
+
-
+
@@ -332,13 +340,13 @@ sub display_two {
$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') {
foreach my $area (keys %{$cmsmap{$cms}}) {
if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {
$count{$area} ++;
}
}
- } elsif ($cms eq 'angel') {
+ } elsif ($cms eq 'angel5') {
foreach my $area (keys %{$cmsmap{$cms}}) {
if ($area eq 'doc') {
if (grep/^$resources{$res}{type}$/,@{$cmsmap{$cms}{doc}}) {
@@ -361,7 +369,7 @@ sub display_two {
-
+
Choose which content types you wish to import
@@ -399,13 +407,13 @@ ENDBLOCK
if ($area eq 'board') {
$r->print("
");
} elsif ($area eq 'users') {
$r->print("
");
@@ -431,7 +439,7 @@ ENDBLOCK
-
+
Choose display options for listing of contents of top level of package.
@@ -445,10 +453,10 @@ ENDBLOCK
-
Display listing of contents in a new folder, with folder name:
+
-
Append listing of contents of top level of package to contents list for the current folder.
+
@@ -473,10 +481,10 @@ ENDBLOCK
-
+
-
+
@@ -545,7 +553,7 @@ sub display_three {
foreach my $area (@{$areas}) {
if (defined($env{"form.$area"}) && ($env{'form.'.$area} ne '')) {
- if ($cms eq 'angel' && $area eq 'doc') {
+ if ($cms eq 'angel5' && $area eq 'doc') {
foreach (@{$cmsmap{$cms}{$area}}) {
$importareas{$_} = 1;
}
@@ -631,25 +639,25 @@ sub display_three {
my @imports = ();
if ($toplevel eq 'oldfolder') {
for (my $i=0; $i<@topurls; $i++) {
- my $url = &Apache::lonnet::unescape($topurls[$i]);
- my $name = &Apache::lonnet::unescape($topnames[$i]);
- push @imports, $name, $url;
+ my $url = &unescape($topurls[$i]);
+ my $name = &unescape($topnames[$i]);
+ push(@imports, [$name, $url]);
}
} elsif ($toplevel eq 'newfolder') {
- my $url = &Apache::lonnet::unescape("/uploaded/$cdom/$crs/$timenow/sequences/Top.sequence");
- my $name = &Apache::lonnet::unescape("$env{'form.foldername'}");
- push @imports, $name, $url;
+ my $url = &unescape("/uploaded/$cdom/$crs/$timenow/sequences/Top.sequence");
+ my $name = &unescape("$env{'form.foldername'}");
+ push(@imports, [$name, $url]);
}
my $errtext='';
my $fatal=0;
($errtext,$fatal)= &Apache::londocs::mapread($crs,$cdom,$folder.'.sequence');
- if ($#Apache::lonratedt::order<1) {
- $Apache::lonratedt::order[0]=1;
- $Apache::lonratedt::resources[1]='';
+ if ($#LONCAPA::map::order<1) {
+ $LONCAPA::map::order[0]=1;
+ $LONCAPA::map::resources[1]='';
}
my ($errtext,$fatal)=&Apache::londocs::group_import($crs,$cdom,$folder,'sequence','imsimport',@imports);
if ($fatal) {
- print STDERR "Fatal error during group_import\n";
+ &Apache::lonnet::logthis("Fatal error during group_import.");
}
}
if ($tempdir =~ m/^\/home\/httpd\/perl\/tmp\/$crs\/\d{10}/) {
@@ -665,7 +673,7 @@ sub display_three {
-
+
Your import is complete
@@ -686,7 +694,7 @@ ENDBLOCK
|;
+ $initblock .= qq|" onClick="javascript:init(this.form)" />|;
$initblock .= ', '.&mt('or the next time you log in.');
$initblock .= qq||;
$r->print($initblock);