';
+ return $footer;
}
- return $blocktext;
}
my @bgcols = ("LC_disc_old_item","LC_disc_new_item");
@@ -336,12 +352,15 @@ sub list_discussion {
'aner' => 'An error occurred opening the manifest file.',
'difo' => 'Discussion for',
'aerr' => 'An error occurred opening the export file for posting',
+ 'discussions' => 'DISCUSSIONS'
+ );
+ my %js_lt = &Apache::lonlocal::texthash(
'aysu' => 'Are you sure you want to delete this post?',
'dpwn' => 'Deleted posts will no longer be visible to you and other students',
'bwco' => 'but will continue to be visible to your instructor',
'depo' => 'Deleted posts will no longer be visible to you or anyone else.',
- 'discussions' => 'DISCUSSIONS'
);
+ &js_escape(\%js_lt);
my $currdisp = $lt{'allposts'};
my $currmark = $lt{'onmark'};
@@ -447,12 +466,12 @@ imscp_v1p1.xsd http://www.imsglobal.org/
prevparm = "&previous="+previous
}
if (caller == 'studentdelete') {
- if (confirm("$lt{'aysu'}\\n$lt{'dpwn'},\\n$lt{'bwco'}")) {
+ if (confirm("$js_lt{'aysu'}\\n$js_lt{'dpwn'},\\n$js_lt{'bwco'}")) {
document.location.href = "/adm/feedback?hide="+symbparm+prevparm+groupparm
}
} else {
if (caller == 'seeiddelete') {
- if (confirm("$lt{'aysu'}\\n$lt{'depo'}")) {
+ if (confirm("$js_lt{'aysu'}\\n$js_lt{'depo'}")) {
document.location.href = "/adm/feedback?deldisc="+symbparm+prevparm+groupparm
}
}
@@ -468,18 +487,18 @@ imscp_v1p1.xsd http://www.imsglobal.org/
my $numhidden = keys(%notshown);
if ($numhidden > 0) {
my $colspan = $maxdepth+1;
- $discussion.="\n".'
'.
@@ -671,7 +690,7 @@ END
$newpostsflag,$group,
$prevread,$markondisp,$seehidden);
$discussion .= "\n";
- }
+ }
if ($outputtarget eq 'export') {
if ($manifestok) {
while ($currdepth > 0) {
@@ -693,22 +712,34 @@ END
#Create zip file in prtspool
- my $imszipfile = '/prtspool/'.
- $env{'user.name'}.'_'.$env{'user.domain'}.'_'.
- time.'_'.rand(1000000000).'.zip';
- my $cwd = &getcwd();
- my $imszip = '/home/httpd/'.$imszipfile;
- chdir $tempexport;
- open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
- close(OUTPUT);
- chdir $cwd;
- $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive','').' ';
- if ($copyresult) {
- $discussion .= &mt('The following errors occurred during export').' - '.$copyresult;
+ if (($env{'user.name'} =~ /^$match_username$/)
+ && ($env{'user.domain'} =~ /^$match_domain$/)) {
+ my $now = time();
+ my $imszipfile = '/prtspool/'.
+ join('_',$env{'user.name'},$env{'user.domain'},$now).
+ '_'.rand(1000000000).'.zip';
+ my $zip = Archive::Zip->new();
+ $zip->addTree($tempexport);
+ my $imszip = '/home/httpd/'.$imszipfile;
+ if ($zip->writeToFileNamed($imszip) == AZ_OK) {
+ $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive[_2]',
+ '','').' ';
+ } else {
+ $discussion .= &mt('Failed to create zip file').' ';
+ }
+ if ($copyresult) {
+ $discussion .= ''.
+ &mt('The following errors occurred during export:').
+ ' '.$copyresult;
+ }
+ } else {
+ $discussion .= '
'.
+ &mt('Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating the zip file.').'
';
}
}
} else {
- $discussion .= ' '.&mt('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.').' ';
+ $discussion .= '
'.
+ &mt('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.').'
';
}
return $discussion;
}
@@ -759,33 +790,60 @@ END
&mt('This discussion is closed.').'';
}
} elsif ($outputtarget ne 'tex') {
- $discussion.='
';
- if (&discussion_open($status) &&
- &Apache::lonnet::allowed('pch',
- $env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
- $discussion.= &send_feedback_link($ressymb);
- if ($env{'request.role.adv'}) {
- my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
- my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);
- if (defined($close) && $close ne '' && $close < time) {
- if ($canvote eq 'notended') {
- $discussion .= ' '.&mt('(Posting and voting closed for [_1] roles)',
- &Apache::lonnet::plaintext('st',$crstype));
- } else {
- $discussion .= ' '.&mt('(Closed for [_1] roles)',
- &Apache::lonnet::plaintext('st',$crstype));
+ unless ($nofooter) {
+ $discussion.='
';
+ unless ($nodisclink) {
+ if (&discussion_open($status) &&
+ &Apache::lonnet::allowed('pch',
+ $env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
+ $discussion.= &send_feedback_link($ressymb);
+ if ($env{'request.role.adv'}) {
+ my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
+ my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);
+ if (defined($close) && $close ne '' && $close < time) {
+ if ($canvote eq 'notended') {
+ $discussion .= ' '.&mt('(Posting and voting closed for [_1] roles)',
+ &Apache::lonnet::plaintext('st',$crstype));
+ } else {
+ $discussion .= ' '.&mt('(Closed for [_1] roles)',
+ &Apache::lonnet::plaintext('st',$crstype));
+ }
+ }
}
+ } else {
+ $discussion.= ''.&mt('This discussion is closed.').'';
}
}
- } else {
- $discussion.= ''.&mt('This discussion is closed.').'';
+ unless ($nofdbklink) {
+ $discussion.= &send_message_link($ressymb);
+ }
+ $discussion.='