From 4b8a2e10ef73324df0a8bfc26e3309ffff1e7610 Mon Sep 17 00:00:00 2001
From: Marco Antonio Villegas Vega <marvil07@gmail.com>
Date: Tue, 16 Feb 2010 23:45:54 -0500
Subject: [PATCH 2/2] popup for denied access

---
 vud.js                           |   15 +++++++++++++++
 vud.theme.inc                    |    1 +
 widgets/alternate/widget.tpl.php |    2 +-
 widgets/plain/widget.tpl.php     |    2 +-
 widgets/updown/widget.tpl.php    |    2 +-
 5 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 vud.js

diff --git a/vud.js b/vud.js
new file mode 100644
index 0000000..ac6bba1
--- /dev/null
+++ b/vud.js
@@ -0,0 +1,15 @@
+// $Id$
+/**
+ * @file
+ *
+ * Various customizations for all widgets.
+ */
+
+Drupal.behaviors.vudUpdownWidget = function () {
+  $('.vud-widget .up-active,.vud-widget .up-inactive,.vud-widget .down-active,.vud-widget .down-inactive').click(function () {
+    if ($(this).hasClass('denied')) {
+      alert(Drupal.settings.vud_node.widget_message);
+      return false;
+    }
+  });
+}
diff --git a/vud.theme.inc b/vud.theme.inc
index 1ca3776..94fe937 100644
--- a/vud.theme.inc
+++ b/vud.theme.inc
@@ -89,6 +89,7 @@ function vud_widget_proxy($cid, $type, $tag, $widget_theme, $readonly=NULL) {
   $uid = votingapi_current_user_identifier();
 
   ctools_add_js('ajax-responder');
+  drupal_add_js(drupal_get_path('module', 'vud') . '/vud.js');
   vud_add_files('css', $plugin);  // Search and add the CSS files.
   vud_add_files('js', $plugin);   // Search and add the JS files.
 
diff --git a/widgets/alternate/widget.tpl.php b/widgets/alternate/widget.tpl.php
index 45c97c9..7bf0d9d 100644
--- a/widgets/alternate/widget.tpl.php
+++ b/widgets/alternate/widget.tpl.php
@@ -7,7 +7,7 @@
  * Alternate widget theme for Vote Up/Down
  */
 ?>
-<div class="vud-widget-alternate" id="<?php print $id; ?>">
+<div class="vud-widget vud-widget-alternate" id="<?php print $id; ?>">
 <?php if ($class_up) : ?>
   <div class="alternate-votes-display"><?php print $unsigned_points; ?></div>
   <?php if ($readonly): ?>
diff --git a/widgets/plain/widget.tpl.php b/widgets/plain/widget.tpl.php
index b272bff..7d6dd03 100644
--- a/widgets/plain/widget.tpl.php
+++ b/widgets/plain/widget.tpl.php
@@ -7,7 +7,7 @@
  * Plain widget theme for Vote Up/Down
  */
 ?>
-<div class="vud-widget-plain" id="<?php print $id; ?>">
+<div class="vud-widget vud-widget-plain" id="<?php print $id; ?>">
 <?php if ($class_up): ?>
   <?php if ($readonly): ?>
     <span class="<?php print $class_up; ?>" title="<?php print t('Vote up!'); ?>"></span>
diff --git a/widgets/updown/widget.tpl.php b/widgets/updown/widget.tpl.php
index 5ab60b2..a6a2170 100644
--- a/widgets/updown/widget.tpl.php
+++ b/widgets/updown/widget.tpl.php
@@ -8,7 +8,7 @@
  * UpDown widget theme for Vote Up/Down
  */
 ?>
-<div class="vud-widget-updown" id="<?php print $id; ?>">
+<div class="vud-widget vud-widget-updown" id="<?php print $id; ?>">
   <div class="updown-score">
     <span class="updown-current-score"><?php print $unsigned_points; ?></span>
     <?php print $vote_label; ?>
-- 
1.6.6.1

