--- loncom/interface/lonfeedback.pm 2015/09/30 21:04:04 1.371
+++ loncom/interface/lonfeedback.pm 2017/11/08 00:36:56 1.375
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.371 2015/09/30 21:04:04 musolffc Exp $
+# $Id: lonfeedback.pm,v 1.375 2017/11/08 00:36:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,7 +45,7 @@ use HTML::LCParser();
use Apache::lonspeller();
use Apache::longroup;
use Cwd;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub discussion_open {
my ($status,$symb)=@_;
@@ -696,21 +696,28 @@ 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[_2]',
+ 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 $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[_2]',
'','').' ';
- if ($copyresult) {
- $discussion .= ''.
- &mt('The following errors occurred during export:').
- ' '.$copyresult;
+ 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 {
@@ -847,7 +854,7 @@ sub send_feedback_link {
&discussion_link($ressymb,
''.&mt('Post Discussion').'',
+ '" />'.&mt('Post Discussion').'',
'replydisc').
'';
}
@@ -858,7 +865,7 @@ sub send_message_link {
&discussion_link($ressymb,
''.&mt('Send Feedback').'',
+ '" />'.&mt('Send Feedback').'',
'sendmessageonly').
'';
return $output;
@@ -933,7 +940,7 @@ sub postingform_display {
$currnewattach,$currdelold,$group,$crstype) = @_;
my $newattachmsg;
my %lt = &Apache::lonlocal::texthash(
- 'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
+ 'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
'title' => 'Title',
'podi' => 'Post Discussion',
'poan' => 'Post Anonymous Discussion',
@@ -952,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
@@ -1285,7 +1297,7 @@ sub build_posting_display {
if (&editing_allowed($escsymb.':::'.$idx,$group)) {
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
$sender.=' '.
- &discussion_link($symb,&mt('Edit'),'editdisc',$idx,$$newpostsflag,$prevread,&group_args($group));
+ &discussion_link($ressymb,&mt('Edit'),'editdisc',$idx,$$newpostsflag,$prevread,&group_args($group));
unless ($seehidden) {
my $grpargs = &group_args($group);
$sender.=" ';
} else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,'','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));
+ $$discussionitems[$idx].=' '.&discussion_link($ressymb,'','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));
}
if ($userunlikes{$idx}) {
$$discussionitems[$idx].='';
} else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,'','unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));
+ $$discussionitems[$idx].=' '.&discussion_link($ressymb,'','unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));
}
}
}
@@ -1536,7 +1548,7 @@ sub build_posting_display {
$$discussionitems[$idx] .= ' '.&mt('This post has been edited by the author.');
if ($seehidden) {
$$discussionitems[$idx] .= ' '.
- &discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
+ &discussion_link($ressymb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
}
$$discussionitems[$idx].=' '.&mt('Earlier version(s) were posted on: ');
if ($contrib{$idx.':history'} =~ m/:/) {
@@ -2062,7 +2074,7 @@ END
$r->print('');
}
$r->print(<
+
END
@@ -2937,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);
@@ -4636,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++;