--- loncom/interface/lonfeedback.pm 2004/12/23 13:28:50 1.146 +++ loncom/interface/lonfeedback.pm 2004/12/23 14:00:58 1.147 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.146 2004/12/23 13:28:50 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.147 2004/12/23 14:00:58 raeburn 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); } @@ -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.
';