[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm
raeburn
raeburn at source.lon-capa.org
Sat Mar 17 10:49:29 EDT 2012
raeburn Sat Mar 17 14:49:29 2012 EDT
Modified files:
/loncom/interface lonfeedback.pm
Log:
- No voting for own posts, hidden posts or deleted posts.
- Thumbs up and thumbs down icons grayed out for hidden posts displayed
to users with privileges to see them.
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.350 loncom/interface/lonfeedback.pm:1.351
--- loncom/interface/lonfeedback.pm:1.350 Sat Mar 17 04:55:10 2012
+++ loncom/interface/lonfeedback.pm Sat Mar 17 14:49:29 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.350 2012/03/17 04:55:10 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.351 2012/03/17 14:49:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1457,13 +1457,24 @@
$message.
'</div></blockquote>';
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 (($uname eq $env{'user.name'}) && ($udom eq $env{'user.domain'})) {
- my $novote = &mt('No voting for your own posts');
+ 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].=
'<a href="javascript:alert('."'$novote'".');" style="text-decoration: none;">'.
'<img border="0" src="/res/adm/pages/thumbsup_novote.png" alt="'.$novote.'" /> '.
'<img border="0" src="/res/adm/pages/thumbsdown_novote.png" alt="'.$novote.'" /></a>';
+
} else {
if ($userlikes{$idx}) {
$$discussionitems[$idx].='<img border="0" src="/res/adm/pages/thumbsup_gray.png" alt="'.&mt('You like this posting').'" />';
@@ -4127,11 +4138,21 @@
if (&discussion_vote_available($status,$realsymb)) {
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},
$cdom,$cnum);
+ my $ownpost;
if (($contrib{$idx.':sendername'} eq $env{'user.name'}) &&
($contrib{$idx.':senderdomain'} eq $env{'user.domain'})) {
- $result = &mt("Vote not registered. No voting for your own posts.");
+ $ownpost = 1;
+ }
+ if ($ownpost || $contrib{$idx.':hidden'} || $contrib{$idx.':deleted'}) {
+ $result = &mt('Vote not registered.').' ';
+ }
+ if ($ownpost) {
+ $result .= &mt('No voting for your own posts.');
+ } elsif ($contrib{$idx.':hidden'}) {
+ $result .= &mt('No voting for hidden posts.');
+ } elsif ($contrib{$idx.':deleted'}) {
+ $result .= &mt('No voting for deleted posts.');
} else {
-
#
# Likes and unlikes are in db-file "disclikes" of the course
# The prefix is the $symb to identify the resource discussion,
More information about the LON-CAPA-cvs
mailing list