version 1.146, 2004/12/23 13:28:50
|
version 1.148, 2005/02/13 22:52:48
|
Line 68 sub discussion_visible {
|
Line 68 sub discussion_visible {
|
} |
} |
|
|
sub list_discussion { |
sub list_discussion { |
my ($mode,$status,$ressymb)=@_; |
my ($mode,$status,$ressymb,$imsextras)=@_; |
my $outputtarget=$ENV{'form.grade_target'}; |
my $outputtarget=$ENV{'form.grade_target'}; |
if (defined($ENV{'form.export'})) { |
if (defined($ENV{'form.export'})) { |
if($ENV{'form.export'}) { |
if($ENV{'form.export'}) { |
$outputtarget = 'export'; |
$outputtarget = 'export'; |
} |
} |
} |
} |
|
if (defined($imsextras)) { |
|
if ($$imsextras{'caller'} eq 'imsexport') { |
|
$outputtarget = 'export'; |
|
} |
|
} |
if (not &discussion_visible($status)) { return ''; } |
if (not &discussion_visible($status)) { return ''; } |
my @bgcols = ("#cccccc","#eeeeee"); |
my @bgcols = ("#cccccc","#eeeeee"); |
my $discussiononly=0; |
my $discussiononly=0; |
Line 325 sub list_discussion {
|
Line 330 sub list_discussion {
|
} elsif ($outputtarget eq 'export') { |
} elsif ($outputtarget eq 'export') { |
# Create temporary directory if this is an export |
# Create temporary directory if this is an export |
my $now = time; |
my $now = time; |
$tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports'; |
if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) { |
if (!-e $tempexport) { |
$tempexport = $$imsextras{'tempexport'}; |
mkdir($tempexport,0700); |
if (!-e $tempexport) { |
} |
mkdir($tempexport,0700); |
$tempexport .= '/'.$now; |
} |
if (!-e $tempexport) { |
$tempexport .= '/'.$$imsextras{'count'}; |
mkdir($tempexport,0700); |
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) { |
if (!-e $tempexport) { |
mkdir($tempexport,0700); |
mkdir($tempexport,0700); |
} |
} |
Line 634 END
|
Line 650 END
|
</manifest> |
</manifest> |
|; |
|; |
close($manifestfile); |
close($manifestfile); |
|
if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) { |
|
$discussion = $copyresult; |
|
} else { |
|
|
#Create zip file in prtspool |
#Create zip file in prtspool |
|
|
my $imszipfile = '/prtspool/'. |
my $imszipfile = '/prtspool/'. |
$ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'. |
$ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'. |
time.'_'.rand(1000000000).'.zip'; |
time.'_'.rand(1000000000).'.zip'; |
# zip can cause an sh launch which can pass along all of %ENV |
# zip can cause an sh launch which can pass along all of %ENV |
# which can be too large for /bin/sh to handle |
# which can be too large for /bin/sh to handle |
my %oldENV=%ENV; |
my %oldENV=%ENV; |
undef(%ENV); |
undef(%ENV); |
my $cwd = &getcwd(); |
my $cwd = &getcwd(); |
my $imszip = '/home/httpd/'.$imszipfile; |
my $imszip = '/home/httpd/'.$imszipfile; |
chdir $tempexport; |
chdir $tempexport; |
open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); |
open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); |
close(OUTPUT); |
close(OUTPUT); |
chdir $cwd; |
chdir $cwd; |
%ENV=%oldENV; |
%ENV=%oldENV; |
undef(%oldENV); |
undef(%oldENV); |
$discussion .= 'Download the zip file from <a href="'.$imszipfile.'">Discussion Posting Archive</a><br />'; |
$discussion .= 'Download the zip file from <a href="'.$imszipfile.'">Discussion Posting Archive</a><br />'; |
if ($copyresult) { |
if ($copyresult) { |
$discussion .= 'The following errors occurred during export - <br />'.$copyresult; |
$discussion .= 'The following errors occurred during export - <br />'.$copyresult; |
|
} |
} |
} |
} else { |
} else { |
$discussion .= '<br />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.<br />'; |
$discussion .= '<br />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.<br />'; |
Line 729 ENDDISCUSS
|
Line 749 ENDDISCUSS
|
if ($outputtarget ne 'tex') { |
if ($outputtarget ne 'tex') { |
$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='. |
$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='. |
$ressymb.':::" '.$target.'>'. |
$ressymb.':::" '.$target.'>'. |
'<img src="/adm/lonMisc/chat.gif" border="0" />'. |
'<img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'. |
&mt('Post Discussion').'</a></td></tr></table>'; |
&mt('Post Discussion').'</a></td></tr></table>'; |
} |
} |
} |
} |