Commit aef2b6bf authored by Daniel Wehner's avatar Daniel Wehner Committed by Marco Villegas
Browse files

Issue #1253390 by dereine, rump and marvil07: Make vud submodules views fields...

Issue #1253390 by dereine, rump and marvil07: Make vud submodules views fields implementations compatible with views 3
parent bc110840
Loading
Loading
Loading
Loading
+10 −4
Changes for vud_comment/views/vud_comment_handler_field_widget.inc: 10 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -9,9 +9,14 @@
 * A handler that provides a Vote Up/Down widget field for nodes.
 */
class vud_comment_handler_field_widget extends views_handler_field {
  function init(&$view, &$options) {
    parent::init($view, $options);
    $this->additional_fields['cid'] = array('table' => 'comments', 'field' => 'cid');
  }

  function query() {
    // We have to override the parent here, because we don't want
    // to do anything.
    // Not calling parent method on purpose.
    $this->add_additional_fields();
  }

  function option_definition() {
@@ -27,13 +32,14 @@ class vud_comment_handler_field_widget extends views_handler_field {

  function render($values) {
    $widget = '';
    $cid = $values->{$this->aliases['cid']};
    $query = 'SELECT n.type FROM {comments} c LEFT JOIN {node} n ON c.nid = n.nid WHERE c.cid = %d';
    $type = db_result(db_query($query, $values->cid));
    $type = db_result(db_query($query, $cid));
    $comment_allow = in_array($type, variable_get('vud_comment_node_types', array()), TRUE);
    if ($comment_allow && user_access('use vote up/down on comments')) {
      $tag = variable_get('vud_tag', 'vote');
      $widget_type = variable_get('vud_comment_widget', 'plain');
      $widget = theme('vud_widget', $values->cid, 'comment', $tag, $widget_type);
      $widget = theme('vud_widget', $cid, 'comment', $tag, $widget_type);
    }

    return $widget;
+8 −3
Changes for vud_node/views/vud_node_handler_field_widget.inc: 8 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -9,9 +9,14 @@
 * A handler that provides a Vote Up/Down widget field for nodes.
 */
class vud_node_handler_field_widget extends views_handler_field {
  function init(&$view, &$options) {
    parent::init($view, $options);
    $this->additional_fields['nid'] = array('table' => 'node', 'field' => 'nid');
  }

  function query() {
    // We have to override the parent here, because we don't want
    // to do anything.
    // Not calling parent method on purpose.
    $this->add_additional_fields();
  }

  function option_definition() {
@@ -28,7 +33,7 @@ class vud_node_handler_field_widget extends views_handler_field {
  function render($values) {
    $widget = '';
    if (($can_edit = user_access('use vote up/down on nodes')) || user_access('view vote up/down count on nodes')) {
      $nid = $values->nid;
      $nid = $values->{$this->aliases['nid']};
      $type = db_result(db_query("SELECT type FROM {node} WHERE nid = '%d'", $nid));
      $valid_type = in_array($type, variable_get('vud_node_types', array()), TRUE);

+9 −3
Changes for vud_term/views/vud_term_handler_field_widget.inc: 9 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -9,9 +9,14 @@
 * A handler that provides a Vote Up/Down widget field for terms.
 */
class vud_term_handler_field_widget extends views_handler_field {
  function init(&$view, &$options) {
    parent::init($view, $options);
    $this->additional_fields['nid'] = array('table' => 'node', 'field' => 'nid');
  }

  function query() {
    // We have to override the parent here, because we don't want
    // to do anything.
    // Not calling parent method on purpose.
    $this->add_additional_fields();
  }

  function option_definition() {
@@ -26,7 +31,8 @@ class vud_term_handler_field_widget extends views_handler_field {
  }

  function render($values) {
    $node = node_load($values->nid);
    $nid = $values->{$this->aliases['nid']};
    $node = node_load($nid);
    _vud_term_generate_table($node);
    return $node->content['vud_term_show_table']['#value'];
  }