--- loncom/interface/lonfeedback.pm 2018/09/14 15:32:55 1.370.2.2 +++ loncom/interface/lonfeedback.pm 2017/11/03 21:36:27 1.374 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.370.2.2 2018/09/14 15:32:55 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.374 2017/11/03 21:36:27 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 Archive::Zip qw( :ERROR_CODES ); +use Cwd; use LONCAPA qw(:DEFAULT :match); sub discussion_open { @@ -698,19 +698,18 @@ 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 $zip = Archive::Zip->new(); - $zip->addTree($tempexport); + my $cwd = &getcwd(); my $imszip = '/home/httpd/'.$imszipfile; - if ($zip->writeToFileNamed($imszip) == AZ_OK) { - $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive[_2]', + 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]', '','').'
'; - } else { - $discussion .= &mt('Failed to create zip file').'
'; - } if ($copyresult) { $discussion .= ''. &mt('The following errors occurred during export:'). @@ -855,7 +854,7 @@ sub send_feedback_link { &discussion_link($ressymb, ''.&mt('Post Discussion').'', + '" border="0" />'.&mt('Post Discussion').'', 'replydisc'). ''; } @@ -866,7 +865,7 @@ sub send_message_link { &discussion_link($ressymb, ''.&mt('Send Feedback').'', + '" border="0" />'.&mt('Send Feedback').'', 'sendmessageonly'). ''; return $output; @@ -960,9 +959,14 @@ sub postingform_display { } } } + my $postanon; + if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}. + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { + $postanon = ''; + } $postingform .= (< - +$postanon @@ -1950,6 +1954,7 @@ END $anonscript //--> + END my ($textareaheader,$textareaclass); @@ -2057,7 +2062,8 @@ END } else { $r->print(< -$lt{'atta'} $attachmaxtext: +$lt{'atta'} $attachmaxtext: +

END } @@ -2068,7 +2074,7 @@ END $r->print(''); } $r->print(< +

END @@ -2943,12 +2949,16 @@ sub screen_header { $env{'request.course.id'}. ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) { - $discussoptions='
'. - ''.&mt('Change Screenname').''; + $discussoptions=''; + if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}. + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { + $discussoptions .= '
'. + ''.&mt('Change Screenname').''; + } my $blockblog = &Apache::loncommon::blocking_status('blogs'); if (!$blockblog) { $discussoptions.= &add_blog_checkbox($crstype); @@ -3506,6 +3516,7 @@ sub modify_attachments { document.modattachments.submit(); } + END # Breadcrumbs @@ -3547,7 +3558,10 @@ END $r->print(''.$subject.''); $r->print(&Apache::lonhtmlcommon::row_closure()); $r->print(&Apache::lonhtmlcommon::row_title($lt{'adda'})); - $r->print(' '.$attachmaxtext); + $r->print('' + .'' + .' '.$attachmaxtext); if(($idx)||(ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)){ $r->print(&Apache::lonhtmlcommon::row_closure()); $r->print(&Apache::lonhtmlcommon::row_title(&mt('Attachments'))); @@ -4638,7 +4652,11 @@ ENDREDIR && $env{'form.discuss'} !~ /^(?:author|question|course|policy)/) || $env{'form.anondiscuss'} ne '') { my $subject = &clear_out_html($env{'form.subject'}); - my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} ); + my $anonmode; + if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}. + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { + $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} ); + } $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl, $subject,$group); $numpost++;