/[drupal]/contributions/modules/nodevote/nodevote.module
ViewVC logotype

Diff of /contributions/modules/nodevote/nodevote.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.30, Wed Aug 22 11:15:41 2007 UTC revision 1.31, Sun Jul 13 14:18:25 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  //$Id: nodevote.module,v 1.28.2.2 2007/08/22 11:15:09 kbahey Exp $  //$Id: nodevote.module,v 1.28.2.3 2008/06/22 16:11:59 kbahey Exp $
4    
5  // Copyright 2005 Khalid Baheyeldin http://2bits.com  // Copyright 2005 Khalid Baheyeldin http://2bits.com
6    
# Line 8  define('NODEVOTE_MIN_SCORE', Line 8  define('NODEVOTE_MIN_SCORE',
8  define('NODEVOTE_MAX_SCORE',               10);  define('NODEVOTE_MAX_SCORE',               10);
9  define('NODEVOTE_VOTE_DEFAULT',            0);  define('NODEVOTE_VOTE_DEFAULT',            0);
10  define('NODEVOTE_TYPE',                    'nodevote_type_');  define('NODEVOTE_TYPE',                    'nodevote_type_');
 define('NODEVOTE_VOTE_DESC',               'nodevote_vote_desc');  
11  define('NODEVOTE_PERM_VIEW',               'view nodevote');  define('NODEVOTE_PERM_VIEW',               'view nodevote');
12  define('NODEVOTE_PERM_USE',                'use nodevote');  define('NODEVOTE_PERM_USE',                'use nodevote');
13  define('NODEVOTE_VOTE_OWN_NODE',           'nodevote_vote_own_node');  define('NODEVOTE_VOTE_OWN_NODE',           'nodevote_vote_own_node');
# Line 21  define('NODEVOTE_BLOCK_COUNT', Line 20  define('NODEVOTE_BLOCK_COUNT',
20  define('NODEVOTE_HIGHEST_BLOCK_THRESHOLD', 'nodevote_highest_block_threshold');  define('NODEVOTE_HIGHEST_BLOCK_THRESHOLD', 'nodevote_highest_block_threshold');
21  define('NODEVOTE_USERPOINTS',              'nodevote_userpoints');  define('NODEVOTE_USERPOINTS',              'nodevote_userpoints');
22    
23  function nodevote_help($section) {  function nodevote_help($path, $arg) {
24    switch ($section) {    $output = '';
25    
26      switch ($path) {
27      case 'admin/settings/nodevote':      case 'admin/settings/nodevote':
28        $output = t('This module provides the facility to vote on certain node types using several criteria.');        $output = t('This module provides the facility to vote on certain node types using several criteria.');
29        break;        break;
# Line 30  function nodevote_help($section) { Line 31  function nodevote_help($section) {
31    return $output;    return $output;
32  }  }
33    
34  function nodevote_menu($may_cache) {  function nodevote_menu() {
   $nid = (int)arg(1);  
   
35    $items = array();    $items = array();
36    
37    $items[] = array(    $items['nodevote/%node/add'] = array(
38      'path'     => "nodevote/$nid/add",      'page callback' => 'nodevote_page',
39      'callback' => 'nodevote_page',      'page arguments' => array(1),
40      'title'    => t('Nodevote add'),      'title' => t('Nodevote add'),
41      'access'   => user_access(NODEVOTE_PERM_USE),      'access callback' => 'user_access',
42      'type'     => MENU_CALLBACK);      'access arguments' => array(NODEVOTE_PERM_USE),
43        'type' => MENU_CALLBACK
44    $items[] = array(    );
45      'path'     => 'nodevote/' . $nid,  
46      'callback' => 'nodevote_page',    $items['nodevote/%node'] = array(
47      'title'    => t('Nodevote view'),      'page callback' => 'nodevote_page',
48      'access'   => user_access(NODEVOTE_PERM_VIEW),      'page arguments' => array(1),
49      'type'     => MENU_CALLBACK);      'title' => t('Nodevote view'),
50        'access callback' => 'user_access',
51        'access arguments' => array(NODEVOTE_PERM_VIEW),
52        'type' => MENU_CALLBACK
53      );
54    
55   $items[] = array(    $items['admin/settings/nodevote'] = array(
     'path' => 'admin/settings/nodevote',  
56      'title' => t('Nodevote'),      'title' => t('Nodevote'),
57      'description' => t('Change settings for voting on nodes.'),      'description' => t('Change settings for voting on nodes.'),
58      'callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
59      'callback arguments' => 'nodevote_admin_settings',      'page arguments' => array('nodevote_admin_settings'),
60      'access' => user_access('administer site configuration'),      'access callback' => 'user_access',
61        'access arguments' => array('administer site configuration'),
62      'type' => MENU_NORMAL_ITEM, // optional      'type' => MENU_NORMAL_ITEM, // optional
63     );    );
64    
65     return $items;     return $items;
66  }  }
# Line 72  function nodevote_admin_settings() { Line 75  function nodevote_admin_settings() {
75      '#type' => 'fieldset',      '#type' => 'fieldset',
76      '#title' => t('Enable voting for these node types:'),      '#title' => t('Enable voting for these node types:'),
77    );    );
78    
79    foreach(node_get_types() as $type => $name) {    foreach(node_get_types() as $type => $name) {
80      $form[$set][NODEVOTE_TYPE . $type] = array(      $form[$set][NODEVOTE_TYPE . $type] = array(
81        '#type' => 'checkbox',        '#type' => 'checkbox',
# Line 81  function nodevote_admin_settings() { Line 84  function nodevote_admin_settings() {
84        '#default_value' => variable_get(NODEVOTE_TYPE . $type, '0'),        '#default_value' => variable_get(NODEVOTE_TYPE . $type, '0'),
85      );      );
86    }    }
87    
88    $set = 'setting';    $set = 'setting';
89    $form[$set] = array(    $form[$set] = array(
90      '#type' => 'fieldset',      '#type' => 'fieldset',
91      '#title' => t('Settings'),      '#title' => t('Settings'),
 );  
   
   $form[$set][NODEVOTE_VOTE_DESC] = array(  
     '#type' => 'textfield',  
     '#title' => t('Vote Description'),  
     '#default_value' => variable_get(NODEVOTE_VOTE_DESC, 'Score'),  
     '#size' => 25,  
     '#maxlength' => 25,  
92    );    );
93    
94    $_display = array(    $_display = array(
95      0 => t('Text'),      0 => t('Text'),
96      1 => t('Stars'),      1 => t('Stars'),
# Line 103  function nodevote_admin_settings() { Line 98  function nodevote_admin_settings() {
98    );    );
99    $form[$set][NODEVOTE_RESULT_DISPLAY_PAGE]= array(    $form[$set][NODEVOTE_RESULT_DISPLAY_PAGE]= array(
100      '#type'          => 'radios',      '#type'          => 'radios',
101      '#title'         => t('Vote result display (page view)'),      '#title'         => t('Vote result display (page view)'),
102      '#default_value' => variable_get(NODEVOTE_RESULT_DISPLAY_PAGE, 0),      '#default_value' => variable_get(NODEVOTE_RESULT_DISPLAY_PAGE, 0),
103      '#options'       =>  $_display,      '#options'       =>  $_display,
104      '#description'   => t('Select which format the results of the vote will be displayed in when in node view.'));      '#description'   => t('Select which format the results of the vote will be displayed in when in node view.'));
105    
106    $_display = array(    $_display = array(
107      0 => t('Text'),      0 => t('Text'),
# Line 115  function nodevote_admin_settings() { Line 110  function nodevote_admin_settings() {
110      3 => t('None'));      3 => t('None'));
111    $form[$set][NODEVOTE_RESULT_DISPLAY_TEASER]= array(    $form[$set][NODEVOTE_RESULT_DISPLAY_TEASER]= array(
112      '#type'          => 'radios',      '#type'          => 'radios',
113      '#title'         => t('Vote result display (teaser view)'),      '#title'         => t('Vote result display (teaser view)'),
114      '#default_value' => variable_get(NODEVOTE_RESULT_DISPLAY_TEASER, 0),      '#default_value' => variable_get(NODEVOTE_RESULT_DISPLAY_TEASER, 0),
115      '#options'       =>  $_display,      '#options'       =>  $_display,
116      '#description'   => t('Select which format the results of the vote will be displayed in when in teaser view.'));      '#description'   => t('Select which format the results of the vote will be displayed in when in teaser view.'));
117    
118    $set='advance';    $set='advance';
119    $form[$set] = array(    $form[$set] = array(
120      '#type'  => 'fieldset',      '#type'  => 'fieldset',
# Line 130  function nodevote_admin_settings() { Line 125  function nodevote_admin_settings() {
125      '#title' => t('Show vote results only if user has voted on node.'),      '#title' => t('Show vote results only if user has voted on node.'),
126      '#return_value' => 1,      '#return_value' => 1,
127      '#default_value' => variable_get(NODEVOTE_RESULT_VOTED, 0),      '#default_value' => variable_get(NODEVOTE_RESULT_VOTED, 0),
128    );    );
129    $form[$set][NODEVOTE_CHANGE_VOTE] = array(    $form[$set][NODEVOTE_CHANGE_VOTE] = array(
130      '#type' => 'checkbox',      '#type' => 'checkbox',
131      '#title' => t('Allow user to vote again.'),      '#title' => t('Allow user to vote again.'),
132      '#return_value' => 1,      '#return_value' => 1,
133      '#default_value' => variable_get(NODEVOTE_CHANGE_VOTE, 0),      '#default_value' => variable_get(NODEVOTE_CHANGE_VOTE, 0),
134    );    );
135    $form[$set][NODEVOTE_VOTE_OWN_NODE] = array(    $form[$set][NODEVOTE_VOTE_OWN_NODE] = array(
136      '#type' => 'checkbox',      '#type' => 'checkbox',
137      '#title' => t('Allow user to vote on his own node.'),      '#title' => t('Allow user to vote on his own node.'),
138      '#return_value' => 1,      '#return_value' => 1,
139      '#default_value' => variable_get(NODEVOTE_VOTE_OWN_NODE, 0),      '#default_value' => variable_get(NODEVOTE_VOTE_OWN_NODE, 0),
140    );    );
141    $form[$set][NODEVOTE_DAILY_THRESHOLD] = array(    $form[$set][NODEVOTE_DAILY_THRESHOLD] = array(
142      '#type' => 'select',      '#type' => 'select',
143      '#title' => t('Daily threshold'),      '#title' => t('Daily threshold'),
# Line 164  function nodevote_admin_settings() { Line 159  function nodevote_admin_settings() {
159      '#default_value' => variable_get(NODEVOTE_HIGHEST_BLOCK_THRESHOLD, 3),      '#default_value' => variable_get(NODEVOTE_HIGHEST_BLOCK_THRESHOLD, 3),
160      '#description' => t('Nodes must have the given number of votes before they show in the highest block.'),      '#description' => t('Nodes must have the given number of votes before they show in the highest block.'),
161    );    );
162    
163    return system_settings_form($form);    return system_settings_form($form);
164  }  }
165    
166  /**  /**
167   * Check if the current voter has cast his maximum daily votes.   * Check if the current voter has cast his maximum daily votes.
# Line 180  function nodevote_admin_settings() { Line 175  function nodevote_admin_settings() {
175   *   True if the user did not exceed the threshold.  False otherwise.   *   True if the user did not exceed the threshold.  False otherwise.
176   */   */
177  function _nodevote_within_threshold($uid, $threshold) {  function _nodevote_within_threshold($uid, $threshold) {
178    $number = db_num_rows(db_query("SELECT uid FROM {nodevote} WHERE uid = '%s' AND timestamp > '%d'", $uid, time() - 86400));    $number = db_result(db_query("SELECT count(uid) FROM {nodevote} WHERE uid = '%s' AND timestamp > '%d'", $uid, time() - 86400));
179    return ($number < $threshold ? TRUE : FALSE);    return ($number < $threshold ? TRUE : FALSE);
180  }  }
181    
# Line 188  function nodevote_link($type, $node, $te Line 183  function nodevote_link($type, $node, $te
183    if ($type == 'node' && $teaser) {    if ($type == 'node' && $teaser) {
184      if (_nodevote_is_votable($node)) {      if (_nodevote_is_votable($node)) {
185        $links['nodevote_link'] = array(        $links['nodevote_link'] = array(
186          'title' => t('Vote on it'),          'title' => t('Vote on it'),
187          'href'  => "node/$node->nid"          'href'  => "node/$node->nid"
188          );          );
189      }      }
# Line 197  function nodevote_link($type, $node, $te Line 192  function nodevote_link($type, $node, $te
192  }  }
193    
194  function nodevote_user($op) {  function nodevote_user($op) {
195      global $user;
196    
197    switch($op) {    switch($op) {
198      case 'delete':      case 'delete':
199        db_query('DELETE FROM {nodevote} WHERE uid = %d', $user->uid);        db_query('DELETE FROM {nodevote} WHERE uid = %d', $user->uid);
# Line 266  function nodevote_block($op = 'list', $d Line 263  function nodevote_block($op = 'list', $d
263    }    }
264  }  }
265    
266  function nodevote_page() {  function nodevote_page($node) {
267    global $user;    global $user;
268    $edit = $_POST;    $edit = $_POST;
269    
   $nid = (int)arg(1);  
270    $op  = arg(2);    $op  = arg(2);
271    
272    switch($op) {    switch($op) {
273      case 'add':      case 'add':
274        $vote = $edit['vote'];        $vote = $edit['vote'];
   
275        if (_nodevote_validate_vote($vote)) {        if (_nodevote_validate_vote($vote)) {
276          if (_nodevote_user_voted($user->uid, $nid)){          if (_nodevote_user_voted($user->uid, $node->nid)){
277            $result = db_query("UPDATE {nodevote} SET  vote = $vote WHERE  uid = %d AND nid = %d" , $user->uid , $nid);            $result = db_query("UPDATE {nodevote} SET  vote = $vote WHERE  uid = %d AND nid = %d" , $user->uid , $node->nid);
278          }          }
279          else {          else {
280            // check to see if the user has voted too many times today            // check to see if the user has voted too many times today
281            if(_nodevote_within_threshold($user->uid, variable_get(NODEVOTE_DAILY_THRESHOLD, 10))) {            if(_nodevote_within_threshold($user->uid, variable_get(NODEVOTE_DAILY_THRESHOLD, 10))) {
282              // log the vote              // log the vote
283              $result = db_query("INSERT INTO {nodevote} VALUES (%d, %d, %d, %d)", $user->uid, $nid, $vote, time());              $result = db_query("INSERT INTO {nodevote} VALUES (%d, %d, %d, %d)", $user->uid, $node->nid, $vote, time());
284              // do the userpoints dance              // do the userpoints dance
285              nodevote_do_userpoints();              nodevote_do_userpoints();
286            }            }
287          else {          else {
288            // if they've voted too many times today, show a message            // if they've voted too many times today, show a message
289            $output = t("You can only vote %number times in 24 hours. Please try again later.", array('%number' => variable_get(NODEVOTE_DAILY_THRESHOLD, 10)));            $output = t("You can only vote %number times in 24 hours. Please try again later.", array('%number' => variable_get(NODEVOTE_DAILY_THRESHOLD, 10)));
290            drupal_set_message($output, 'error');            drupal_set_message($output, 'error');
291          }          }
292          $o = l(t('Back to node'), 'node/' . $nid);          $o = l(t('Back to node'), 'node/' . $node->nid);
293          }          }
294          drupal_goto("node/" . $nid);          drupal_goto("node/" . $node->nid);
295        }        }
296        else {        else {
297          drupal_set_message(t('You must select a valid vote score.'), 'error');          drupal_set_message(t('You must select a valid vote score.'), 'error');
298        }        }
299        $o = l(t('Back to node'), 'node/' . $nid);        $o = l(t('Back to node'), 'node/' . $node->nid);
300        break;        break;
301    
302      case 'view':      case 'view':
# Line 329  function nodevote_nodeapi(&$node, $op, $ Line 324  function nodevote_nodeapi(&$node, $op, $
324          }          }
325        }        }
326        return $extra;        return $extra;
327    
328      case 'view':      case 'view':
329        if (variable_get(NODEVOTE_TYPE . $node->type, 0)) {        if (variable_get(NODEVOTE_TYPE . $node->type, 0)) {
330          if ($node->nodevote->vote_display) {          if ($node->nodevote->vote_display) {
331            $vote_data = _nodevote_get_vote_data($node->nid, $page);            $vote_data = _nodevote_get_vote_data($node->nid, $page);
332            $node->content['nodevote_display'] = array(            $node->content['nodevote_display'] = array(
# Line 340  function nodevote_nodeapi(&$node, $op, $ Line 335  function nodevote_nodeapi(&$node, $op, $
335            );            );
336          }          }
337        }        }
338    
339        if ($page) {        if ($page) {
340          if ($node->nodevote->vote_do) {          if ($node->nodevote->vote_do) {
341            $vote = theme('nodevote_do_vote', $node);            $vote = theme('nodevote_do_vote', $node);
# Line 350  function nodevote_nodeapi(&$node, $op, $ Line 345  function nodevote_nodeapi(&$node, $op, $
345          }          }
346        }        }
347        break;        break;
348    
349      case 'alter':      case 'alter':
350        if(!$page) {        if(!$page) {
351          if (variable_get(NODEVOTE_RESULT_DISPLAY_TEASER, 0) != 3) {          if (variable_get(NODEVOTE_RESULT_DISPLAY_TEASER, 0) != 3) {
# Line 362  function nodevote_nodeapi(&$node, $op, $ Line 357  function nodevote_nodeapi(&$node, $op, $
357                      }                      }
358        }        }
359        break;        break;
360    
361      case 'delete':      case 'delete':
362        db_query('DELETE FROM {nodevote} WHERE nid = %d', $node->nid);        db_query('DELETE FROM {nodevote} WHERE nid = %d', $node->nid);
363        break;        break;
# Line 370  function nodevote_nodeapi(&$node, $op, $ Line 365  function nodevote_nodeapi(&$node, $op, $
365  }  }
366    
367  function _nodevote_user_voted($uid, $nid) {  function _nodevote_user_voted($uid, $nid) {
368    if (db_num_rows(db_query('SELECT * FROM {nodevote} WHERE uid = %d AND nid = %d', $uid, $nid))) {    if (db_result(db_query('SELECT count(nid) FROM {nodevote} WHERE uid = %d AND nid = %d', $uid, $nid))) {
369      return TRUE;      return TRUE;
370    }    }
371    else {    else {
# Line 380  function _nodevote_user_voted($uid, $nid Line 375  function _nodevote_user_voted($uid, $nid
375    
376  function _nodevote_get_vote_data($nid, $page = TRUE) {  function _nodevote_get_vote_data($nid, $page = TRUE) {
377    $result = db_fetch_array(db_query('SELECT COUNT(*) AS votes, AVG(vote) AS score FROM {nodevote} WHERE nid = %d', $nid));    $result = db_fetch_array(db_query('SELECT COUNT(*) AS votes, AVG(vote) AS score FROM {nodevote} WHERE nid = %d', $nid));
378    
379    $score = $result['score'];    $score = $result['score'];
380    $votes = $result['votes'];    $votes = $result['votes'];
381    
382    if ($page) {    if ($page) {
383      $vote_display = variable_get(NODEVOTE_RESULT_DISPLAY_PAGE, 0);      $vote_display = variable_get(NODEVOTE_RESULT_DISPLAY_PAGE, 0);
384    }    }
385    else {    else {
386      $vote_display = variable_get(NODEVOTE_RESULT_DISPLAY_TEASER, 0);      $vote_display = variable_get(NODEVOTE_RESULT_DISPLAY_TEASER, 0);
387    }    }
388    
389    return array('score' => $score, 'votes' => $votes, 'vote_display' => $vote_display);    return array('score' => $score, 'votes' => $votes, 'vote_display' => $vote_display);
# Line 403  function theme_nodevote_display_vote($vo Line 398  function theme_nodevote_display_vote($vo
398      case 1:      case 1:
399        $result  = _nodevote_display_stars($votes, $score);        $result  = _nodevote_display_stars($votes, $score);
400        break;        break;
401    
402      case 2:      case 2:
403        $result  = _nodevote_display_stars($votes, $score);        $result  = _nodevote_display_stars($votes, $score);
404        $result .= _nodevote_display_number($votes, $score);        $result .= _nodevote_display_number($votes, $score);
405        break;        break;
406    
407      case 0:      case 0:
408      default:      default:
409        $result  = _nodevote_display_number($votes, $score);        $result  = _nodevote_display_number($votes, $score);
410        break;        break;
411    }    }
412    
413    $output .= '<div id="nodevote result">';    $output .= '<div id="nodevote result">';
414    $output .= '<h3>' . t('Vote Result') . '</h3>';    $output .= '<h3>' . t('Vote Result') . '</h3>';
415    $output .= $result;    $output .= $result;
416    $output .= '</div>';    $output .= '</div>';
417    
418    return $output;    return $output;
# Line 439  function _nodevote_display_stars($votes, Line 434  function _nodevote_display_stars($votes,
434        $alt = '-';        $alt = '-';
435      }      }
436      $stars .='<img src="' . $base_path . drupal_get_path('module', 'nodevote') . '/star_' . $val . '.png" alt="' . $alt . '" />';      $stars .='<img src="' . $base_path . drupal_get_path('module', 'nodevote') . '/star_' . $val . '.png" alt="' . $alt . '" />';
437    };    };
438    
439    return $stars;    return $stars;
440  }  }
# Line 456  function _nodevote_is_votable($node) { Line 451  function _nodevote_is_votable($node) {
451        // Does the user has permission to vote?        // Does the user has permission to vote?
452        if (user_access(NODEVOTE_PERM_USE)) {        if (user_access(NODEVOTE_PERM_USE)) {
453          // Is the node posted by someone else?          // Is the node posted by someone else?
454          if (($node->uid != $user->uid) || (variable_get(NODEVOTE_VOTE_OWN_NODE, 0))) {          if (($node->uid != $user->uid) || (variable_get(NODEVOTE_VOTE_OWN_NODE, 0))) {
455            // Did the user already vote on this node?            // Did the user already vote on this node?
456            if ((!_nodevote_user_voted($user->uid, $node->nid)) || (variable_get(NODEVOTE_CHANGE_VOTE, 0))){            if ((!_nodevote_user_voted($user->uid, $node->nid)) || (variable_get(NODEVOTE_CHANGE_VOTE, 0))){
457              $ret = TRUE;              $ret = TRUE;
# Line 484  function _nodevote_vote_is_visible($node Line 479  function _nodevote_vote_is_visible($node
479    return $ret;    return $ret;
480  }  }
481    
482    /**
483     * Implementation of hook_theme().
484     */
485    function nodevote_theme() {
486      return array(
487        'nodevote_display_vote' => array(
488          'arguments' => array('vote_data' => NULL),
489        ),
490        'nodevote_do_vote' => array(
491          'arguments' => array('node' => NULL),
492        ),
493      );
494    }
495    
496  function theme_nodevote_do_vote($node) {  function theme_nodevote_do_vote($node) {
497    return drupal_get_form('nodevote_rate_form', $node);    return drupal_get_form('nodevote_rate_form', $node);
498  }  }
499    
500  function nodevote_rate_form($node) {  function nodevote_rate_form($form_state, $node) {
501    global $user;    global $user;
502    $score = array();    $score = array();
503    $r = 0;    $r = 0;
# Line 497  function nodevote_rate_form($node) { Line 506  function nodevote_rate_form($node) {
506       $r = db_result(db_query("SELECT vote FROM {nodevote} WHERE uid = %d AND nid = %d" , $user->uid ,$node->nid));       $r = db_result(db_query("SELECT vote FROM {nodevote} WHERE uid = %d AND nid = %d" , $user->uid ,$node->nid));
507       $score[] =$r;       $score[] =$r;
508    }    }
509    
510    for($j=NODEVOTE_MIN_SCORE; $j<NODEVOTE_MAX_SCORE+1; $j++) {    for($j=NODEVOTE_MIN_SCORE; $j<NODEVOTE_MAX_SCORE+1; $j++) {
511      $score[$j] = $j;      $score[$j] = $j;
512    }    }
# Line 510  function nodevote_rate_form($node) { Line 519  function nodevote_rate_form($node) {
519      '#prefix' => '<div id="nodevote vote">',      '#prefix' => '<div id="nodevote vote">',
520      '#suffix' => '</div>',      '#suffix' => '</div>',
521     );     );
522    
   $vote_desc = variable_get(NODEVOTE_VOTE_DESC, 'Score');  
523    $form[$set]['vote'] = array(    $form[$set]['vote'] = array(
524      '#type' => 'select',      '#type' => 'select',
525      '#title' => $vote_desc,      '#title' => t('Score'),
526      '#default_value' => $score[$r],      '#default_value' => $score[$r],
527      '#options' => $score,      '#options' => $score,
528    );    );
# Line 522  function nodevote_rate_form($node) { Line 530  function nodevote_rate_form($node) {
530      '#type'  => 'submit',      '#type'  => 'submit',
531      '#value' => t('Vote'),      '#value' => t('Vote'),
532    );    );
533    
534    $form['#method'] = 'post';    $form['#method'] = 'post';
535    $form['#action'] = url('nodevote/' . $node->nid . '/add');    $form['#action'] = url('nodevote/' . $node->nid . '/add');
536    $form['#attributes'] = array('class' => 'nodevote-form');    $form['#attributes'] = array('class' => 'nodevote-form');
537    
538    return $form;    return $form;
539  }  }
540    
541  function _nodevote_validate_vote($vote) {  function _nodevote_validate_vote($vote) {

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.2