'.
'';
my $escsymb=&escape($ressymb);
- if ($visible>2) {
+ if ($visible) {
$discussion .= '
@@ -913,7 +931,7 @@ ENDDISCUSS
}
sub build_posting_display {
- my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
+ my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
my @original=();
my @index=();
my $skip_group_check = 0;
@@ -929,6 +947,19 @@ sub build_posting_display {
if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) {
$skip_group_check = 1;
}
+ my (%deletions,%hiddens);
+ if ($contrib{'deleted'}) {
+ my $deleted = $contrib{'deleted'};
+ $deleted =~ s/^\.//;
+ $deleted =~ s/\.$//;
+ %deletions = map { $_ => 1 } (split(/\.\./,$deleted));
+ }
+ if ($contrib{'hidden'}) {
+ my $hidden = $contrib{'hidden'};
+ $hidden =~ s/^\.//;
+ $hidden =~ s/\.$//;
+ %hiddens = map { $_ => 1 } (split(/\.\./,$hidden));
+ }
if ($contrib{'version'}) {
my $oldest = $contrib{'1:timestamp'};
if ($prevread eq '0') {
@@ -942,13 +973,13 @@ sub build_posting_display {
}
for (my $id=1;$id<=$contrib{'version'};$id++) {
my $idx=$id;
+ next if ($contrib{$idx.':deleted'});
+ next if ($contrib{$idx.':hidden'});
my $posttime = $contrib{$idx.':timestamp'};
if ($prevread <= $posttime) {
$$newpostsflag = 1;
}
- my $hidden=($contrib{'hidden'}=~/\.$idx\./);
my $studenthidden=($contrib{'studenthidden'}=~/\.$idx\./);
- my $deleted=($contrib{'deleted'}=~/\.$idx\./);
my $origindex='0.';
my $numoldver=0;
if ($contrib{$idx.':replyto'}) {
@@ -972,7 +1003,7 @@ sub build_posting_display {
} else {
$$replies[$$depth[$idx]]=1;
}
- unless ((($hidden) && (!$seeid)) || ($deleted)) {
+ unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) {
$$visible++;
if ($contrib{$idx.':history'}) {
if ($contrib{$idx.':history'} =~ /:/) {
@@ -1006,7 +1037,7 @@ sub build_posting_display {
$message.=$attachtxt{$numoldver};
$subject=$subjects{$numoldver};
if ($message) {
- if ($hidden) {
+ if ($hiddens{$idx}) {
$message=''.$message.'';
if ($studenthidden) {
$message .='
Deleted by poster (student).';
@@ -1070,48 +1101,35 @@ sub build_posting_display {
} else {
@{$$namesort{$lastname}{$firstname}} = ("$idx");
}
- if ((&editing_allowed($escsymb.':::'.$idx,$group)) && ($outputtarget ne 'tex')) {
- if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
- $sender.=' '.&mt('Edit').'';
-
- unless ($seeid) {
- my $grpargs = &group_args($group);
- $sender.=" ';
+ if ($outputtarget ne 'tex') {
+ 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));
+ unless ($seeid) {
+ my $grpargs = &group_args($group);
+ $sender.=" ';
+ }
}
}
- }
- if (($seeid) && ($outputtarget ne 'tex')) {
- if ($hidden) {
- unless ($studenthidden) {
- $sender.=' '.&mt('Make Visible').'';
- }
- } else {
- $sender.=' '.&mt('Hide').'';
- }
- my $grpargs = &group_args($group);
- $sender.=
- " ";
- $sender .= &mt('Delete').'';
+ } else {
+ $sender.=' '.
+ &discussion_link($symb,&mt('Hide'),'hide',$idx,$$newpostsflag,$prevread,&group_args($group));
+ }
+ my $grpargs = &group_args($group);
+ $sender.=
+ " ";
+ $sender .= &mt('Delete').'';
+ }
}
- } else {
+ } else {
if ($screenname) {
$sender=''.$screenname.'';
} else {
@@ -1137,36 +1155,29 @@ sub build_posting_display {
@{$$namesort{'__anon'}{'__anon'}} = ("$idx");
}
}
- if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {
- if (($group ne '') &&
- (&check_group_priv($group,'pgd') eq 'ok')) {
- $sender.=' '.&mt('Reply').'';
- } elsif (&Apache::lonnet::allowed('pch',
- $env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.
- $env{'request.course.sec'}:''))) {
- $sender.=' '.&mt('Reply').'';
}
- }
- if (($viewgrades) && ($outputtarget ne 'tex')) {
+ if ($viewgrades) {
$vgrlink=&Apache::loncommon::submlink(&mt('Submissions'),
- $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
- }
- if (($$dischash{$readkey}=~/\.$idx\./) && ($outputtarget ne 'tex')) {
- $ctlink = '';
- } else {
- $ctlink = '';
+ $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
+ }
+ if ($$dischash{$readkey}=~/\.$idx\./) {
+ $ctlink = '';
+ } else {
+ $ctlink = '';
+ }
}
}
#figure out at what position this needs to print
@@ -1183,7 +1194,7 @@ sub build_posting_display {
if ($outputtarget eq 'export') {
%{$$imsitems{$idx}} = ();
$$imsitems{$idx}{'isvisible'}='true';
- if ($hidden) {
+ if ($hiddens{$idx}) {
$$imsitems{$idx}{'isvisible'}='false';
}
$$imsitems{$idx}{'title'}=$subjects{$numoldver};
@@ -1286,9 +1297,8 @@ sub build_posting_display {
my @postversions = ();
$$discussionitems[$idx] .= &mt('This post has been edited by the author.');
if ($seeid) {
- $$discussionitems[$idx] .= ' '.&mt('Display all versions').'';
+ $$discussionitems[$idx] .= ' '.
+ &discussion_link($symb,&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/:/) {
@@ -1690,6 +1700,11 @@ END
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
$textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive();
$textareaclass = 'class="LC_richDefaultOff"';
+ if ($env{'request.course.id'}) {
+ unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) {
+ undef($textareaclass);
+ }
+ }
}
# Breadcrumbs
@@ -1697,10 +1712,10 @@ END
'text' => 'Resource Feedback and Discussion'}];
my %onload = ('onload' => 'window.focus();setposttype();');
+ my %parms=('add_entries' => \%onload);
+ if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
my $start_page=
- &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
- {'add_entries' => \%onload,
- 'bread_crumbs' => $brcrum,});
+ &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms);
if ($quote ne '') {
$quote = &HTML::Entities::decode($quote);
@@ -1709,14 +1724,18 @@ END
}
$quote=''.&Apache::lontexconvert::msgtexconverted($quote).' ';
}
-
+ my $header='';
+ unless ($env{'form.modal'}) {
+ $header="$restitle";
+ }
$r->print(<$restitle
+$header
|