'.&mt('Internal Filename').' | '.&mt('Title').' | '.&mt('Save as ...').' |
');
@@ -222,12 +229,13 @@ sub dumpcourse {
my ($ext)=($_=~/\.(\w+)$/);
my $title=$hash{'title_'.$hash{
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}};
+ $title=~s/:/:/g;
$r->print(''.($title?$title:' ').' | ');
unless ($title) {
$title=$_;
}
$title=~s/\.(\w+)$//;
- $title=~s/[^\w\/]+/\_/gs;
+ $title=&clean($title);
$title.='.'.$ext;
$r->print("\n | \n");
}
@@ -241,6 +249,7 @@ sub dumpcourse {
# ------------------------------------------------------ Generate "export" button
sub exportbutton {
+ return '';
return ''.
''.
@@ -250,7 +259,7 @@ sub exportbutton {
sub exportcourse {
my $r=shift;
my %discussiontime = &Apache::lonnet::dump('discussiontimes',
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
my $numdisc = keys %discussiontime;
my $navmap = Apache::lonnavmaps::navmap->new();
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
@@ -259,31 +268,16 @@ sub exportcourse {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['finishexport']);
- if ($ENV{'form.finishexport'}) {
+ if ($env{'form.finishexport'}) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['archive','discussion']);
- my @exportitems = ();
- if (defined($ENV{'form.archive'})) {
- if (ref($ENV{'form.archive'}) eq 'ARRAY') {
- @exportitems = @{$ENV{'form.archive'}};
- } else {
- $exportitems[0] = $ENV{'form.archive'};
- }
- }
- my @discussions = ();
- if (defined($ENV{'form.discussion'})) {
- if (ref($ENV{'form.discussion'}) eq 'ARRAY') {
- @discussions = $ENV{'form.discussion'};
- } else {
- $discussions[0] = $ENV{'form.discussion'};
- }
- }
+ my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');
+ my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');
if (@exportitems == 0 && @discussions == 0) {
$outcome = ' As you did not select any content items or discussions for export, an IMS package has not been created. Please go back to select either content items or discussions for export';
} else {
my $now = time;
- my $count = 0;
my %symbs;
my $manifestok = 0;
my $imsresources;
@@ -291,25 +285,19 @@ sub exportcourse {
my $copyresult;
my $ims_manifest = &create_ims_store($now,\$manifestok,\$outcome,\$tempexport);
if ($manifestok) {
- &build_package($now,$navmap,\@exportitems,\@discussions,\$outcome,\$tempexport,\$copyresult,$ims_manifest);
+ &build_package($now,$navmap,\@exportitems,\@discussions,\$outcome,$tempexport,\$copyresult,$ims_manifest);
close($ims_manifest);
#Create zip file in prtspool
my $imszipfile = '/prtspool/'.
- $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
+ $env{'user.name'}.'_'.$env{'user.domain'}.'_'.
time.'_'.rand(1000000000).'.zip';
-# zip can cause an sh launch which can pass along all of %ENV
-# which can be too large for /bin/sh to handle
- my %oldENV=%ENV;
- undef(%ENV);
my $cwd = &Cwd::getcwd();
my $imszip = '/home/httpd/'.$imszipfile;
chdir $tempexport;
open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
close(OUTPUT);
chdir $cwd;
- %ENV=%oldENV;
- undef(%oldENV);
$outcome .= 'Download the zip file from IMS course archive ';
if ($copyresult) {
$outcome .= 'The following errors occurred during export - '.$copyresult;
@@ -318,9 +306,9 @@ sub exportcourse {
$outcome = ' Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file. ';
}
}
-
- $r->print('Export Course'.
- &Apache::loncommon::bodytag('Export course to IMS or SCORM content package'));
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print($html.'Export Course'.
+ &Apache::loncommon::bodytag('Export course to IMS content package'));
$r->print($outcome);
$r->print('');
} else {
@@ -369,6 +357,12 @@ sub exportcourse {
}
if (ref($curRes)) {
my $symb = $curRes->symb();
+ my $ressymb = $symb;
+ if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) {
+ unless ($ressymb =~ m|adm/wrapper/adm|) {
+ $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
+ }
+ }
my $color = $count%2;
$display .=' | '."\n".
'title().' | ';
- if ($discussiontime{$symb} > 0) {
+ if ($discussiontime{$ressymb} > 0) {
$boards ++;
$currelem = $count+$boards+$startcount;
$display .= ' | | '."\n";
@@ -403,13 +397,23 @@ sub exportcourse {
|;
- $r->print('Export Course'.$scripttag.''.
- &Apache::loncommon::bodytag('Export course to IMS or SCORM content package'
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print($html.'Export Course'.$scripttag.''.
+ &Apache::loncommon::bodytag('Export course to IMS content package'
));
$r->print($display.'
'.
@@ -466,10 +471,13 @@ sub create_ims_store {
if (!-e $$tempexport) {
mkdir($$tempexport,0700);
}
- $$tempexport .= '/'.$ENV{'user.domain'}.'_'.$ENV{'user.name'};
+ $$tempexport .= '/'.$env{'user.domain'}.'_'.$env{'user.name'};
if (!-e $$tempexport) {
mkdir($$tempexport,0700);
}
+ if (!-e "$$tempexport/resources") {
+ mkdir("$$tempexport/resources",0700);
+ }
# open manifest file
my $manifest = '/imsmanifest.xml';
my $manifestfilename = $$tempexport.$manifest;
@@ -480,13 +488,13 @@ sub create_ims_store {
'