Index: advpoll.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll.module,v
retrieving revision 1.21.2.54
diff -u -p -r1.21.2.54 advpoll.module
--- advpoll.module	11 Aug 2007 20:58:26 -0000	1.21.2.54
+++ advpoll.module	12 Aug 2007 07:28:07 -0000
@@ -22,11 +22,8 @@ function advpoll_access($op, $node) {
   if ($op == 'create') {
     return user_access('create polls');
   }
-  if ($op == 'delete') {
-    return user_access('delete polls');
-  }
   if ($op == 'update') {
-    if (user_access('create polls') && ($user->uid == $node->uid)) {
+    if (user_access('edit polls') || ($node->uid == $user->uid && user_access('edit own polls'))) {
       return TRUE;
     }
   }
@@ -41,11 +38,9 @@ function advpoll_block($op = 'list') {
       $blocks['mostrecent']['info'] = t('Latest poll');
       return $blocks;
     case 'view':
-      if (user_access('view polls')) {
-        $block['subject'] = t('Latest poll');
-        $block['content'] = theme('advpoll_block_mostrecent');
-        return $block;
-      }
+      $block['subject'] = t('Latest poll');
+      $block['content'] = theme('advpoll_block_mostrecent');
+      return $block;
   }
 }
 
@@ -303,27 +298,32 @@ function advpoll_form($node, $form_value
     '#options' => $_duration,
     '#description' => t('After this period, the poll will be closed automatically. This is relative to the start date if it is specified, otherwise the date the poll was created.')
   );
-
-  $form['settings']['uselist'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Restrict voting to electoral list'),
-    '#description' => t('If enabled, a list of eligible voters will be created and only that group will be able to vote in the poll.'),
-    '#default_value' => isset($node->uselist) ? $node->uselist : variable_get('advpoll_electoral_list_'. $type->type, ADVPOLL_ELECTORAL_LIST),
-  );
-
-  $form['settings']['showvotes'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Show individual votes'),
-    '#description' => t('Users with the appropriate permissions will be able to see how each person voted.'),
-    '#default_value' => isset($node->showvotes) ? $node->showvotes : variable_get('advpoll_showvotes_'. $type->type, ADVPOLL_SHOWVOTES),
-  );
-
-  if (user_access('administer polls') && $node->nid) {
-    $form['settings']['reset'] = array(
-      '#type' => 'button',
-      '#value' => t('Reset votes'),
+  
+  // Settings available for users with 'administer polls' permission.
+  if (user_access('administer polls')) {
+    $form['settings']['uselist'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Restrict voting to electoral list'),
+      '#description' => t('If enabled, a list of eligible voters will be created and only that group will be able to vote in the poll.'),
+      '#default_value' => isset($node->uselist) ? $node->uselist : variable_get('advpoll_electoral_list_'. $type->type, ADVPOLL_ELECTORAL_LIST),
+    );
+  
+    $form['settings']['showvotes'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show individual votes'),
+      '#description' => t('Users with the appropriate permissions will be able to see how each person voted.'),
+      '#default_value' => isset($node->showvotes) ? $node->showvotes : variable_get('advpoll_showvotes_'. $type->type, ADVPOLL_SHOWVOTES),
     );
+    
+    // Only show when editing a poll, not creating.
+    if ($node->nid) {
+      $form['settings']['reset'] = array(
+          '#type' => 'button',
+          '#value' => t('Reset votes'),
+        );
+    }
   }
+  
   $form['#multistep'] = TRUE;
 
   return $form;
@@ -499,7 +499,7 @@ function advpoll_menu($may_cache) {
       'path' => 'polls',
       'title' => t('Advanced Polls'),
       'callback' => 'advpoll_page',
-      'access' => user_access('view polls'),
+      'access' => user_access('access content'),
       'type' => MENU_SUGGESTED_ITEM,
     );
   }
@@ -521,7 +521,7 @@ function advpoll_menu($may_cache) {
             'path' => 'node/'. $nid .'/results',
             'title' => t('Results'),
             'callback' => 'advpoll_results',
-            'access' => user_access('view polls'),
+            'access' => user_access('access content'),
             'weight' => 3,
             'type' => MENU_LOCAL_TASK,
           );
@@ -545,7 +545,7 @@ function advpoll_menu($may_cache) {
             'path' => 'node/'. $nid .'/electoral_list',
             'title' => t('Electoral list'),
             'callback' => 'advpoll_tab_electoral_list',
-            'access' => user_access('view polls'),
+            'access' => user_access('access electoral list'),
             'weight' => 3,
             'type' => MENU_LOCAL_TASK,
           );
@@ -839,7 +839,7 @@ function advpoll_node_info() {
  * Implementation of hook_perm().
  */
 function advpoll_perm() {
-  return array('create polls', 'delete polls', 'view polls', 'vote on polls', 'cancel own vote', 'administer polls', 'inspect all votes');
+  return array('create polls', 'edit polls', 'edit own polls', 'vote on polls', 'cancel own vote', 'administer polls', 'inspect all votes', 'access electoral list');
 }
 
 /**
