".
+ "
".
$message.
'
';
if ($canvote) {
+ my $ownpost;
+ if (($uname eq $env{'user.name'}) &&
+ ($udom eq $env{'user.domain'})) {
+ $ownpost = 1;
+ }
# Put in the like and unlike buttons
- if ($userlikes{$idx}) {
- $$discussionitems[$idx].='
';
- } else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,'
','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));
- }
- if ($userunlikes{$idx}) {
- $$discussionitems[$idx].='
';
+ if ($ownpost || (($hiddens{$idx}) && ($seehidden))) {
+ my $novote;
+ if ($ownpost) {
+ $novote = &mt('No voting for your own posts.');
+ } else {
+ $novote = &mt('No voting for hidden posts.');
+ }
+ $$discussionitems[$idx].=
+ '
'.
+ ' '.
+ '';
+
} else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,'
','unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));
+ if ($userlikes{$idx}) {
+ $$discussionitems[$idx].='
';
+ } else {
+ $$discussionitems[$idx].=' '.&discussion_link($symb,'
','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"));
+ }
}
}
if ($seeid || $canvote) {
@@ -1447,7 +1526,7 @@ sub build_posting_display {
if ($contrib{$idx.':history'}) {
my @postversions = ();
$$discussionitems[$idx] .= ' '.&mt('This post has been edited by the author.');
- if ($seeid) {
+ if ($seehidden) {
$$discussionitems[$idx] .= ' '.
&discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
}
@@ -1533,13 +1612,13 @@ sub filter_regexp {
sub get_post_contents {
- my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$showaboutme,$numver) = @_;
+ my ($contrib,$idx,$seeid,$seehidden,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$showaboutme,$numver) = @_;
my $discussion = '';
my $start=$numver;
my $end=$numver + 1;
%{$$imsfiles{$idx}}=();
if ($type eq 'allversions') {
- unless($seeid) {
+ unless($seehidden) {
$discussion=&mt('You do not have privileges to view all versions of posts.').' '.&mt('Please select a different role.');
return $discussion;
}
@@ -1754,6 +1833,7 @@ END
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
unless (($contrib{'hidden'}=~/\.$idx\./) || ($contrib{'deleted'}=~/\.$idx\./)) {
+ my $numoldver = 0;
if ($contrib{$idx.':history'}) {
if ($contrib{$idx.':history'} =~ /:/) {
my @oldversions = split(/:/,$contrib{$idx.':history'});
@@ -1762,36 +1842,25 @@ END
$numoldver = 1;
}
}
- if ($env{'form.replydisc'}) {
- if ($contrib{$idx.':history'}) {
- if ($contrib{$idx.':history'} =~ /:/) {
- my @oldversions = split(/:/,$contrib{$idx.':history'});
- $numoldver = @oldversions;
- } else {
- $numoldver = 1;
- }
+ if ($idx > 0) {
+ my (%msgversions,%subversions,$htmldecode);
+ $htmldecode = 0;
+ if ($env{'form.replydisc'}) {
+ $htmldecode = 1;
}
- if ($idx > 0) {
- my %msgversions = ();
- &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver);
+ &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver);
+ &get_post_versions(\%subversions,$contrib{$idx.':subject'},$htmldecode,
+ $numoldver);
+ $subject = $subversions{$numoldver};
+ if ($env{'form.replydisc'}) {
$quote = $msgversions{$numoldver};
- }
- if ($idx > 0) {
- my %subversions = ();
- &get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver);
- $subject = &mt('Re: ').$subversions{$numoldver};
- }
- $subject = &HTML::Entities::encode($subject,'<>&"');
- } else {
- $attachmenturls = $contrib{$idx.':attachmenturl'};
- if ($idx > 0) {
- my %msgversions = ();
- &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver);
+ $subject = &HTML::Entities::encode(&mt('Re: ').$subject,'<>&"');
+ } else {
$comment = $msgversions{$numoldver};
- my %subversions = ();
- &get_post_versions(\%subversions,$contrib{$idx.':subject'},0,$numoldver);
- $subject = $subversions{$numoldver};
}
+ }
+ if ($env{'form.editdisc'}) {
+ $attachmenturls = $contrib{$idx.':attachmenturl'};
if (defined($contrib{$idx.':replyto'})) {
$parentmsg = $contrib{$idx.':replyto'};
}
@@ -1883,7 +1952,7 @@ END
my %onload = ('onload' => 'window.focus();setposttype();');
my %parms=('add_entries' => \%onload);
- if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
+ if ($env{'form.modal'} ne 'yes') { $parms{'bread_crumbs'} = $brcrum; }
my $start_page=
&Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms);
@@ -1892,7 +1961,11 @@ END
unless (&contains_block_html($quote)) {
&newline_to_br(\$quote);
}
- $quote='
'.&Apache::lontexconvert::msgtexconverted($quote).'
';
+ $quote=&Apache::lonhtmlcommon::start_pick_box().
+ &Apache::lonhtmlcommon::row_title(&mt('Quote')).
+ &Apache::lontexconvert::msgtexconverted($quote).
+ &Apache::lonhtmlcommon::row_closure(1).
+ &Apache::lonhtmlcommon::end_pick_box();
}
my $header='';
unless ($env{'form.modal'}) {
@@ -1920,26 +1993,31 @@ END
}
$r->print(<
+END
+$r->print(&Apache::lonhtmlcommon::start_pick_box());
+$r->print(<
$textareaheader
-
$latexHelp
END
-$r->print(&Apache::lonhtmlcommon::start_pick_box());
-$r->print(&Apache::lonhtmlcommon::row_title(&mt('Subject')));
-$r->print('
');
-$r->print(&Apache::lonhtmlcommon::row_closure());
-$r->print(&Apache::lonhtmlcommon::row_title(&mt('Message')));
-$r->print('');
-$r->print(&Apache::lonhtmlcommon::row_closure(1));
-$r->print(&Apache::lonhtmlcommon::end_pick_box());
+
+ $r->print(&Apache::lonhtmlcommon::row_title(&mt('Subject')));
+ $r->print('');
+ $r->print(&Apache::lonhtmlcommon::row_closure());
+ $r->print(&Apache::lonhtmlcommon::row_title(&mt('Message')));
+ $r->print('');
+ $r->print(&Apache::lonhtmlcommon::row_closure(1));
+ $r->print(&Apache::lonhtmlcommon::end_pick_box());
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
if ($env{'form.origpage'}) {
@@ -1973,10 +2051,8 @@ END
$r->print('');
}
$r->print(<
-
END
if ($env{'form.editdisc'} || $env{'form.replydisc'}) {
@@ -1991,7 +2067,6 @@ END
$attachnum += @currnewattach;
}
my $blockblog = &Apache::loncommon::blocking_status('blogs');
- $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog));
if ($attachnum > 0) {
if (@currnewattach > 0) {
$newattachmsg .= '
'.&mt('New attachments').'
';
@@ -2011,9 +2086,10 @@ END
$r->print("
$lt{'reta'}:$attachmsg
\n");
}
if ($newattachmsg) {
- $r->print("$newattachmsg
");
+ $r->print("$newattachmsg");
}
}
+ $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog));
}
$r->print(&generate_preview_button().
&Apache::loncommon::end_page());
@@ -2454,24 +2530,11 @@ sub print_showposters {
$r->send_http_header;
&Apache::lonenc::check_encrypt(\$symb);
- my $crs='/'.$env{'request.course.id'};
- if ($env{'request.course.sec'}) {
- $crs.='_'.$env{'request.course.sec'};
- }
- $crs=~s/\_/\//g;
- my $seeid;
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $group = $env{'form.group'};
my $ressymb = &wrap_symb($symb);
- if (($group ne '') &&
- ($ressymb =~ m|^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) {
- if (&check_group_priv($group,'dgp') eq 'ok') {
- $seeid = 1;
- }
- } else {
- $seeid=&Apache::lonnet::allowed('rin',$crs);
- }
+ my $seehidden = &can_see_hidden('',$ressymb,$feedurl,$group,$cdom,$cnum);
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},
$cdom,$cnum);
my %namesort = ();
@@ -2487,7 +2550,7 @@ sub print_showposters {
for (my $idx=1;$idx<=$contrib{'version'};$idx++) {
my $hidden=($contrib{'hidden'}=~/\.$idx\./);
my $deleted=($contrib{'deleted'}=~/\.$idx\./);
- unless ((($hidden) && (!$seeid)) || ($deleted)) {
+ unless ((($hidden) && (!$seehidden)) || ($deleted)) {
if ((!$contrib{$idx.':anonymous'}) || (&Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')))) {
my %names = &Apache::lonnet::get('environment',['firstname','lastname'],$contrib{$idx.':senderdomain'},$contrib{$idx.':sendername'});
my $lastname = $names{'lastname'};
@@ -2512,14 +2575,14 @@ sub print_showposters {
}
}
}
- }
+ }
}
my $start_page = &Apache::loncommon::start_page('Discussion options');
my $table_start =&Apache::loncommon::start_data_table();
$r->print(<
+