? 781546_dim_vud_comments2.patch
Index: INSTALL.txt
===================================================================
RCS file: INSTALL.txt
diff -N INSTALL.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ INSTALL.txt 29 Apr 2010 05:48:37 -0000
@@ -0,0 +1,7 @@
+/* $Id$ */
+INSTALLATION FOR VUD COMMENTS
+1. Enable module.
+2. Copy comment.tpl.php from this module's folder to your theme's folder.
+3. Configure comment viewing options at /admin/settings/voteupdown/comment. Make sure to save settings, otherwise comments will not be dimmed properly.
+
+That's it!
Index: comment.tpl.php
===================================================================
RCS file: comment.tpl.php
diff -N comment.tpl.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ comment.tpl.php 29 Apr 2010 05:48:37 -0000
@@ -0,0 +1,56 @@
+
+'; ?>
+
+';
\ No newline at end of file
Index: vud.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/Attic/vud.module,v
retrieving revision 1.1.2.25
diff -u -p -r1.1.2.25 vud.module
--- vud.module 23 Apr 2010 05:10:16 -0000 1.1.2.25
+++ vud.module 29 Apr 2010 05:48:37 -0000
@@ -158,4 +158,4 @@ function vud_ctools_plugin_directory($mo
if ($module == 'vud') {
return $plugin;
}
-}
+}
\ No newline at end of file
Index: vud.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/Attic/vud.theme.inc,v
retrieving revision 1.1.2.28
diff -u -p -r1.1.2.28 vud.theme.inc
--- vud.theme.inc 23 Apr 2010 06:13:25 -0000 1.1.2.28
+++ vud.theme.inc 29 Apr 2010 05:48:37 -0000
@@ -126,6 +126,7 @@ function vud_widget_proxy($content_id, $
ctools_add_js('ajax-responder');
drupal_add_js(drupal_get_path('module', 'vud') . '/vud.js');
+ drupal_add_css(drupal_get_path('module', 'vud_comment') . '/vud_comment.css');
vud_add_files('css', $plugin); // Search and add the CSS files.
vud_add_files('js', $plugin); // Search and add the JS files.
@@ -141,7 +142,7 @@ function vud_widget_proxy($content_id, $
$variables['class_up'] = 'up-active';
$variables['class_down'] = 'down-inactive';
}
- else if ($user_vote < 0) {
+ elseif ($user_vote < 0) {
$variables['class_up'] = 'up-inactive';
$variables['class_down'] = 'down-active';
}
@@ -217,6 +218,7 @@ function vud_votes_proxy($content_id, $t
'tag' => $tag,
'function' => 'sum'
);
+
$vote_result = (int) votingapi_select_single_result_value($criteria);
$variables['unsigned_points'] = $vote_result;
@@ -226,7 +228,10 @@ function vud_votes_proxy($content_id, $t
}
else {
$variables['points'] = $vote_result;
- if ($vote_result < 0) {
+ if ($vote_result < variable_get('vud_comment_dimmed', array())) {
+ $variables['class'] = 'negative-dimmed';
+ }
+ elseif ($vote_result < 0) {
$variables['class'] = 'negative';
}
else {
@@ -277,7 +282,7 @@ function vud_vote($type, $content_id, $v
if ($value > 0) {
$vote['value'] = 1;
}
- else if ($value < 0) {
+ elseif ($value < 0) {
$vote['value'] = -1;
}
else {
Index: vud_comment/vud_comment.css
===================================================================
RCS file: vud_comment/vud_comment.css
diff -N vud_comment/vud_comment.css
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ vud_comment/vud_comment.css 29 Apr 2010 05:48:37 -0000
@@ -0,0 +1,17 @@
+/* $Id$ */
+/* VUD CSS file */
+div.negative-dimmed {
+ filter:alpha(opacity=50);
+ -ms-filter:"alpha(opacity=50)";
+ -moz-opacity:0.5;
+ -khtml-opacity: 0.5;
+ opacity: 0.5;
+}
+
+div.negative-dimmed:hover {
+ filter:alpha(opacity=100);
+ -ms-filter:"alpha(opacity=100)";
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
\ No newline at end of file
Index: vud_comment/vud_comment.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/vud_comment/Attic/vud_comment.module,v
retrieving revision 1.1.2.20
diff -u -p -r1.1.2.20 vud_comment.module
--- vud_comment/vud_comment.module 23 Apr 2010 06:13:26 -0000 1.1.2.20
+++ vud_comment/vud_comment.module 29 Apr 2010 05:48:37 -0000
@@ -62,6 +62,12 @@ function vud_comment_admin_settings() {
'#default_value' => variable_get('vud_comment_reset', 0),
'#options' => array(0 => 'No', 1 => 'Yes'),
);
+ $form['vud_comment_dimmed'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Trigger point for dimmed comments'),
+ '#default_value' => variable_get('vud_comment_dimmed', '-5'),
+ '#description' => t('Negatively voted comments will be dimmed once votes reach this point (default: -5).'),
+ );
return system_settings_form($form);
}
@@ -74,10 +80,25 @@ function vud_comment_comment(&$comment,
case 'view':
$type = _vud_comment_get_node_type($comment->nid);
$comment_allow = in_array($type, variable_get('vud_comment_node_types', array()), TRUE);
- if ($comment_allow && user_access('use vote up/down on comments')) {
+ if ($comment_allow) {
+ $content_id = $comment->cid;
$tag = variable_get('vud_tag', 'vote');
- $widget = variable_get('vud_comment_widget', 'plain');
- $comment->comment = theme('vud_widget', $comment->cid, 'comment', $tag, $widget) . $comment->comment;
+ // Get the vote for this comment.
+ $criteria = array(
+ 'content_type' => 'comment',
+ 'content_id' => $content_id,
+ 'value_type' => 'points',
+ 'tag' => $tag,
+ 'function' => 'sum'
+ );
+ $vud_sum = (int) votingapi_select_single_result_value($criteria);
+ $comment->vud_sum = $vud_sum;
+ $comment->vud_dim = variable_get('vud_comment_dimmed', array());
+ // Show a widget, if the user can vote.
+ if (user_access('use vote up/down on comments')) {
+ $widget = variable_get('vud_comment_widget', 'plain');
+ $comment->comment = theme('vud_widget', $comment->cid, 'comment', $tag, $widget) . $comment->comment;
+ }
}
break;
}
Index: vud_node/vud_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/vud_node/Attic/vud_node.module,v
retrieving revision 1.1.2.29
diff -u -p -r1.1.2.29 vud_node.module
--- vud_node/vud_node.module 23 Apr 2010 06:13:26 -0000 1.1.2.29
+++ vud_node/vud_node.module 29 Apr 2010 05:48:37 -0000
@@ -148,7 +148,7 @@ function vud_node_nodeapi(&$node, $op, $
$readonly = !$can_edit;
}
$node->content['vud_node_widget_display'] = array(
- '#value' => theme(vud_theme_functions('vud_widget','node', $node->nid), $node->nid, 'node', $tag, $widget, $readonly),
+ '#value' => theme(vud_theme_functions('vud_widget', 'node', $node->nid), $node->nid, 'node', $tag, $widget, $readonly),
'#weight' => -10,
);
break;
@@ -158,7 +158,7 @@ function vud_node_nodeapi(&$node, $op, $
if (!$can_edit) {
$widget_message = t('You are not allowed to vote.');
}
- else if (!$vote_on_teaser) {
+ elseif (!$vote_on_teaser) {
$widget_message = t('Please go to full version of this content to vote.');
}
drupal_add_js(
Index: widgets/alternate/alternate.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/widgets/alternate/Attic/alternate.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 alternate.inc
--- widgets/alternate/alternate.inc 12 Mar 2010 08:06:45 -0000 1.1.2.1
+++ widgets/alternate/alternate.inc 29 Apr 2010 05:48:37 -0000
@@ -1,7 +1,13 @@
+ + +