[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm
raeburn
raeburn@source.lon-capa.org
Wed, 25 Aug 2010 00:46:37 -0000
raeburn Wed Aug 25 00:46:37 2010 EDT
Modified files:
/loncom/interface lonfeedback.pm
Log:
- Display discussion controls if there is at least one posting.
- Efficiency - map hidden and deleted post IDs to hash in place of
regexp match for each post ID
- Transactions which were to hide/unhide or delete posts do not contribute
to count of visible postings.
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.299 loncom/interface/lonfeedback.pm:1.300
--- loncom/interface/lonfeedback.pm:1.299 Sat Aug 14 17:48:13 2010
+++ loncom/interface/lonfeedback.pm Wed Aug 25 00:46:37 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.299 2010/08/14 17:48:13 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.300 2010/08/25 00:46:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -787,7 +787,7 @@
'<table width="100%" class="LC_disc_action_table"><tr>'.
'<td class="LC_disc_action_left">';
my $escsymb=&escape($ressymb);
- if ($visible>2) {
+ if ($visible) {
$discussion .= '<a href="/adm/feedback?cmd=threadedon&symb='.$escsymb;
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
@@ -921,6 +921,19 @@
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') {
@@ -934,13 +947,13 @@
}
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'}) {
@@ -964,7 +977,7 @@
} else {
$$replies[$$depth[$idx]]=1;
}
- unless ((($hidden) && (!$seeid)) || ($deleted)) {
+ unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) {
$$visible++;
if ($contrib{$idx.':history'}) {
if ($contrib{$idx.':history'} =~ /:/) {
@@ -998,7 +1011,7 @@
$message.=$attachtxt{$numoldver};
$subject=$subjects{$numoldver};
if ($message) {
- if ($hidden) {
+ if ($hiddens{$idx}) {
$message='<font color="#888888">'.$message.'</font>';
if ($studenthidden) {
$message .='<br /><br />Deleted by poster (student).';
@@ -1081,7 +1094,7 @@
}
}
if ($seeid) {
- if ($hidden) {
+ if ($hiddens{$idx}) {
unless ($studenthidden) {
$sender.=' <a href="/adm/feedback?unhide='.
$escsymb.':::'.$idx;
@@ -1179,7 +1192,7 @@
if ($outputtarget eq 'export') {
%{$$imsitems{$idx}} = ();
$$imsitems{$idx}{'isvisible'}='true';
- if ($hidden) {
+ if ($hiddens{$idx}) {
$$imsitems{$idx}{'isvisible'}='false';
}
$$imsitems{$idx}{'title'}=$subjects{$numoldver};