### Eclipse Workspace Patch 1.0 #P drupalcvs Index: sites/all/modules/votingapi_field/votingapi_field.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/votingapi_field/votingapi_field.module,v retrieving revision 1.5 diff -u -r1.5 votingapi_field.module --- sites/all/modules/votingapi_field/votingapi_field.module 7 Dec 2006 09:28:27 -0000 1.5 +++ sites/all/modules/votingapi_field/votingapi_field.module 7 Dec 2006 20:30:36 -0000 @@ -94,7 +94,7 @@ * Implementation of hook_perm(). */ function votingapi_field_perm() { - $perms = array('register vote'); + $perms = array('register vote', 'use PHP for voting target'); return $perms; } @@ -108,7 +108,22 @@ switch ($op) { case 'form': - $form = array(); + $form = array(); + $form['target'] = array( + '#type' => 'textarea', + '#title' => t('Node ID'), + '#weight' => 101, + '#default_value' => $field['target'] ? $field['target'] : '', + '#description' => t( + 'A single node ID on which this field will register the vote. If no ID is specified, the vote will be registered on the created node.' + ), + ); + + if (user_access('use PHP for voting target')) { + $form['target']['#description'] .= ' ' . t( + ' Return the target node ID or use plain text. Enter PHP code between <?php ?>. Note that executing incorrect PHP-code can break your Drupal site.' + ); + } switch($field['type']) { case 'votingapi_score': @@ -212,10 +227,10 @@ case 'save': switch($field['type']) { - case 'votingapi_choice': return array('ajax', 'minval', 'maxval', 'labels'); - case 'votingapi_score': return array('ajax', 'minval', 'maxval', 'labels'); - case 'votingapi_rating': return array('minval', 'maxval'); - case 'votingapi_percent': return array('ajax'); + case 'votingapi_choice': return array('target', 'ajax', 'minval', 'maxval', 'labels'); + case 'votingapi_score': return array('target', 'ajax', 'minval', 'maxval', 'labels'); + case 'votingapi_rating': return array('target', 'minval', 'maxval'); + case 'votingapi_percent': return array('target', 'ajax'); default: return array(); } }