--- loncom/interface/lonfeedback.pm 2017/11/08 00:36:56 1.375 +++ loncom/interface/lonfeedback.pm 2019/08/07 16:08:04 1.381 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.375 2017/11/08 00:36:56 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.381 2019/08/07 16:08:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,7 +44,7 @@ use HTML::LCParser(); #use HTML::Tidy::libXML; use Apache::lonspeller(); use Apache::longroup; -use Cwd; +use Archive::Zip qw( :ERROR_CODES ); use LONCAPA qw(:DEFAULT :match); sub discussion_open { @@ -674,7 +674,7 @@ END $newpostsflag,$group, $prevread,$markondisp,$seehidden); $discussion .= "\n"; - } + } if ($outputtarget eq 'export') { if ($manifestok) { while ($currdepth > 0) { @@ -698,18 +698,19 @@ END if (($env{'user.name'} =~ /^$match_username$/) && ($env{'user.domain'} =~ /^$match_domain$/)) { - my $now = time(); + my $now = time(); my $imszipfile = '/prtspool/'. join('_',$env{'user.name'},$env{'user.domain'},$now). '_'.rand(1000000000).'.zip'; - my $cwd = &getcwd(); + my $zip = Archive::Zip->new(); + $zip->addTree($tempexport); 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[_2]', + 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:'). @@ -1780,14 +1781,11 @@ sub mail_screen { my %lt = &Apache::lonlocal::texthash( 'myqu' => 'Question/comment/feedback:', - 'title' => 'Title', 'reta' => 'Retained attachments', 'atta' => 'Attachment', ); - if($env{'form.editdisc'} || $env{'form.replydisc'}){ - %lt = &Apache::lonlocal::texthash( - 'myqu' => 'Post Discussion', - ); + if ($env{'form.editdisc'} || $env{'form.replydisc'}){ + $lt{'myqu'} = &mt('Post Discussion'); } my $restitle = &get_resource_title($caller_symb,$feedurl); my $quote=''; @@ -2062,7 +2060,7 @@ END } else { $r->print(< -$lt{'atta'} $attachmaxtext: +$lt{'atta'} $attachmaxtext:

END @@ -2839,6 +2837,10 @@ sub redirect_back { my $start_page= &Apache::loncommon::start_page('Feedback sent',undef,\%parms); my $end_page = &Apache::loncommon::end_page(); + my $windowname = 'loncapaclient'; + if ($env{'request.lti.login'}) { + $windowname .= 'lti'; + } $r->print(< @@ -2847,7 +2849,7 @@ $typestyle $blog $toolarge $status -
+ $prevtag $sorttag $statustag @@ -3558,7 +3560,7 @@ END $r->print(''.$subject.''); $r->print(&Apache::lonhtmlcommon::row_closure()); $r->print(&Apache::lonhtmlcommon::row_title($lt{'adda'})); - $r->print('' + $r->print('' .'' .' '.$attachmaxtext); @@ -4046,11 +4048,15 @@ sub handler { 'only_body' => 1, 'add_entries' => \%onload}); my $end_page = &Apache::loncommon::end_page(); + my $windowname = 'loncapaclient'; + if ($env{'request.lti.login'}) { + $windowname .= 'lti'; + } $r->print (< $textline - +
$end_page @@ -4551,6 +4557,8 @@ ENDREDIR ($env{'request.course.id'} && ($feedurl!~m:^/adm:)) || ($env{'request.course.id'} && ($symb=~/^bulletin\_\_\_/)) + || + (($env{'request.course.id'} && ($feedurl =~ /ext\.tool$/))) ) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header;