--- loncom/interface/lonfeedback.pm 2004/12/09 21:58:29 1.145
+++ loncom/interface/lonfeedback.pm 2005/02/17 04:39:58 1.152
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.145 2004/12/09 21:58:29 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.152 2005/02/17 04:39:58 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -68,13 +68,18 @@ sub discussion_visible {
}
sub list_discussion {
- my ($mode,$status,$ressymb)=@_;
+ my ($mode,$status,$ressymb,$imsextras)=@_;
my $outputtarget=$ENV{'form.grade_target'};
if (defined($ENV{'form.export'})) {
if($ENV{'form.export'}) {
$outputtarget = 'export';
}
}
+ if (defined($imsextras)) {
+ if ($$imsextras{'caller'} eq 'imsexport') {
+ $outputtarget = 'export';
+ }
+ }
if (not &discussion_visible($status)) { return ''; }
my @bgcols = ("#cccccc","#eeeeee");
my $discussiononly=0;
@@ -325,15 +330,26 @@ sub list_discussion {
} elsif ($outputtarget eq 'export') {
# Create temporary directory if this is an export
my $now = time;
- $tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports';
- if (!-e $tempexport) {
- mkdir($tempexport,0700);
- }
- $tempexport .= '/'.$now;
- if (!-e $tempexport) {
- mkdir($tempexport,0700);
+ if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) {
+ $tempexport = $$imsextras{'tempexport'};
+ if (!-e $tempexport) {
+ mkdir($tempexport,0700);
+ }
+ $tempexport .= '/'.$$imsextras{'count'};
+ if (!-e $tempexport) {
+ mkdir($tempexport,0700);
+ }
+ } else {
+ $tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports';
+ if (!-e $tempexport) {
+ mkdir($tempexport,0700);
+ }
+ $tempexport .= '/'.$now;
+ 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);
}
@@ -496,8 +512,8 @@ imscp_v1p1.xsd http://www.imsglobal.org/
$imsitems{$alldiscussion{$_}}{'isvisible'}.'" identifieref="RES-'.$ressymb.'-'.$alldiscussion{$_}.'">'.
'
'.$imsitems{$alldiscussion{$_}}{'title'}.'';
$imsresources .= "\n".
- ''.
- ''."\n".
+ ''."\n".
+ ''."\n".
$imsfiles{$alldiscussion{$_}}{$imsitems{$alldiscussion{$_}}{'currversion'}}."\n".
'';
}
@@ -634,27 +650,31 @@ END
|;
close($manifestfile);
+ if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) {
+ $discussion = $copyresult;
+ } else {
#Create zip file in prtspool
- my $imszipfile = '/prtspool/'.
- $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
- time.'_'.rand(1000000000).'.zip';
+ my $imszipfile = '/prtspool/'.
+ $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 = &getcwd();
- my $imszip = '/home/httpd/'.$imszipfile;
- chdir $tempexport;
- open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
- close(OUTPUT);
- chdir $cwd;
- %ENV=%oldENV;
- undef(%oldENV);
- $discussion .= 'Download the zip file from Discussion Posting Archive ';
- if ($copyresult) {
- $discussion .= 'The following errors occurred during export - '.$copyresult;
+ my %oldENV=%ENV;
+ undef(%ENV);
+ my $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);
+ $discussion .= 'Download the zip file from Discussion Posting Archive ';
+ if ($copyresult) {
+ $discussion .= 'The following errors occurred during export - '.$copyresult;
+ }
}
} else {
$discussion .= ' Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file. ';
@@ -729,7 +749,7 @@ ENDDISCUSS
if ($outputtarget ne 'tex') {
$discussion.='