Index: advpoll.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll.module,v
retrieving revision 1.21.2.24
diff -u -r1.21.2.24 advpoll.module
--- advpoll.module	2 Apr 2007 17:09:39 -0000	1.21.2.24
+++ advpoll.module	3 Apr 2007 16:57:49 -0000
@@ -32,43 +32,44 @@
 /**
  * Implementation of hook_block().
  */
-function advpoll_block($op = 'list', $delta = 'mostrecent', $edit = array()) {
+function advpoll_block($op = 'list') {
   switch ($op) {
     case 'list':
       $blocks['mostrecent']['info'] = t('Latest poll');
       return $blocks;
     case 'view':
       if (user_access('view polls')) {
-        switch ($delta) {
-          case 'mostrecent': default:
-            $mostrecent = advpoll_block_mostrecent();
-            if ($mostrecent) {
-              $block['content'] = $mostrecent;
-              $block['subject'] = t('Latest poll');
-            }
-        }
-
-        if ($block['content']) {
-          return $block;
-        }
+        $block['subject'] = t('Latest poll');
+        $block['content'] = theme('advpoll_block_mostrecent');
+        return $block;
       }
-    default:
   }
 }
 
 /**
  * Content of the block, as returned by advpoll_block('view').
  */
-function advpoll_block_mostrecent() {
+function theme_advpoll_block_mostrecent() {
+  $node = advpoll_mostrecent();
   $output = '';
+  if ($node) {
+    $output .= '<h3>'. $node->title .'</h3>'; 
+    $output .= drupal_render($node->content);
+    if ($node->voted) {
+      $output .= '<p>'. l(t('Older polls'), 'polls', array('class' => 'old-polls', 'title' => t('View the list of polls on this site.'))); 
+    }
+  }
+  return $output;
+}
+
+function advpoll_mostrecent() {
   $result = db_query('SELECT MAX(n.nid) nid FROM {node} n INNER JOIN {advpoll} p ON p.nid = n.nid WHERE n.status = 1 AND p.active=1');
   $poll = db_fetch_object($result);
   // The nid will be NULL if there are no active polls.
   if ($poll->nid) {
-    $node = advpoll_view(node_load($poll->nid), FALSE, FALSE, TRUE);
-    $output = drupal_render($node->content);
+    $node = advpoll_view(node_load($poll->nid), FALSE, FALSE);
   }
-  return $output;
+  return $node;
 }
 
 function advpoll_page() {
@@ -988,33 +989,22 @@
 /**
  * Implementation of hook_view().
  */
-function advpoll_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
+function advpoll_view($node, $teaser = FALSE, $page = FALSE) {
   $mode = _advpoll_get_mode($node);
 
-  if ($block) {
-    // No 'readmore' link
-    $node->readmore = FALSE;
-    $node->links[] = _advpoll_block_oldlink();
-  }
-
   // Previewing a node, so don't show results.
   if ($node->in_preview) {
     // Show the voting form but don't let them vote
     $node->content['poll'] = array(
-      '#value' => drupal_get_form('advpoll_voting_'. $mode .'_form', $node, $teaser, $page, $block),
+      '#value' => drupal_get_form('advpoll_voting_'. $mode .'_form', $node, $teaser, $page),
     );
   }
   else if (!$node->voted && arg(2) != 'results' && $node->active && advpoll_eligible($node)) {
     // User hasn't voted and we're not on the results tab
 
-    if ($block) {
-      // XXX: Currently this isn't displayed anywhere
-      $node->links[] = _advpoll_block_resultslink($node);
-    }
-
     $node->content['poll'] = array(
       '#value' => drupal_get_form('advpoll_voting_'. $node->mode .'_form',
-        $node, $teaser, $page, $block)
+        $node, $teaser, $page)
     );
     static $addjs = TRUE;
     if ($addjs) {
@@ -1028,7 +1018,7 @@
   else {
     // Show results only if the user has voted or poll is closed
     $node->content['poll'] = array(
-      '#value' => advpoll_view_results($node, $teaser, $page, $block)
+      '#value' => advpoll_view_results($node, $teaser, $page)
     );  
   }
 
@@ -1043,52 +1033,26 @@
   );
 }
 
-function _advpoll_block_oldlink() {
-  return array(
-    'title' => t('Older polls'),
-    'href' => 'polls',
-    'attributes' => array('title' => t('View the list of polls on this site.')),
-  );
-}
-
-function theme_advpoll_results($title, $results, $votes, $links, $block, $nid, $voted, $cancel_vote) {
-  if ($block) {
-    $output .= '<div class="poll">';
-    $output .= '<div class="title">'. $title .'</div>';
-    $output .= $results;
-    $output .= '<div class="total">'. t('Total votes: %votes', array('%votes' => $votes)) .'</div>';
-    $output .= '</div>';
-    $output .= '<div class="links">'. theme('links', $links) .'</div>';
-  }
-  else {
-    $output .= '<div class="poll">';
-    $output .= $results;
-    $output .= '<div class="total">'. t('Total votes: %votes', array('%votes' => $votes)) .'</div>';
-    $output .= '</div>';
-  }
+function theme_advpoll_results($title, $results, $votes, $links, $nid, $voted, $cancel_vote) {
+  $output .= '<div class="poll">';
+  $output .= $results;
+  $output .= '<div class="total">'. t('Total votes: %votes', array('%votes' => $votes)) .'</div>';
+  $output .= '</div>';
   return $output;
 } 
 
-function _advpoll_show_cancel_form($node, $block) {
+function _advpoll_show_cancel_form($node) {
   $output = '';
-  if ($node->voted && $node->cancel_vote && user_access('cancel own vote')
-    && !$block) {
+  if ($node->voted && $node->cancel_vote && user_access('cancel own vote')) {
     $output .= drupal_get_form('advpoll_cancel_form', $node->nid);
   }
   return $output;
 }
 
-function theme_advpoll_bar($title, $percentage, $votes, $block) {
-  if ($block) {
-    $output  = '<div class="text">'. $title .'</div>';
-    $output .= '<div class="bar"><div style="width: '. $percentage .'%;" class="foreground"></div></div>';
-    $output .= '<div class="percent">'. $percentage .'%</div>';
-  }
-  else {
-    $output  = '<div class="text">'. $title .'</div>';
-    $output .= '<div class="bar"><div style="width: '. $percentage .'%;" class="foreground"></div></div>';
-    $output .= '<div class="percent">'. $percentage .'% ('. $votes .')</div>';
-  }
+function theme_advpoll_bar($title, $percentage, $votes) {
+  $output  = '<div class="text">'. $title .'</div>';
+  $output .= '<div class="bar"><div style="width: '. $percentage .'%;" class="foreground"></div></div>';
+  $output .= '<div class="percent">'. $percentage .'% <span class="votes">('. $votes .')</span></div>';
   return $output;
 }
 
@@ -1111,10 +1075,7 @@
   // Ajax response
   if ($form_values['ajax']) {
     list($node->voted, $node->cancel_vote) = _advpoll_user_voted($node);
-    if ($form_values['in_block']) {
-      $node->links[] = _advpoll_block_oldlink();
-    }
-    $ajax_output .= advpoll_view_results($node, NULL, NULL, $form_values['in_block']);
+    $ajax_output .= advpoll_view_results($node, NULL, NULL);
     // Remove linebreaks as they will break jQuery's insert-HTML methods
     $ajax_output = str_replace("\n", '', $ajax_output);
     drupal_set_header('Content-Type: text/plain; charset=utf-8');
@@ -1134,18 +1095,17 @@
  * mode. It will call advpoll_view_results_$mode, similarly to
  * advpoll_view_voting().
  */
-function advpoll_view_results(&$node, $teaser, $page, $block) {
+function advpoll_view_results(&$node, $teaser, $page) {
   $mode = _advpoll_get_mode($node);
   if (_advpoll_can_view_results($node)) {
     if (function_exists("advpoll_view_results_$mode")) {
       $results = call_user_func("advpoll_view_results_$mode", $node,
-        $teaser, $page, $block);
+        $teaser, $page);
       $output .= theme('advpoll_results', check_plain($node->title),
-        $results['results'], $results['votes'], $node->links, $block,
-        $node->nid, $node->voted, $node->cancel_vote);
+        $results['results'], $results['votes'], $node->links, $node->nid, $node->voted, $node->cancel_vote);
     }
   }
-  $output .= _advpoll_show_cancel_form($node, $block);
+  $output .= _advpoll_show_cancel_form($node);
   return $output;
 }
 
Index: modes/binary.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/modes/binary.inc,v
retrieving revision 1.7.2.11
diff -u -r1.7.2.11 binary.inc
--- modes/binary.inc	2 Apr 2007 17:09:39 -0000	1.7.2.11
+++ modes/binary.inc	3 Apr 2007 17:00:18 -0000
@@ -17,7 +17,7 @@
  * 
  * This creates a list of choices to allow the user to vote on choices.
  */
-function advpoll_voting_binary_form(&$node, $teaser, $page, $block) {
+function advpoll_voting_binary_form(&$node, $teaser, $page) {
   static $binary_form_count = 0; 
   $form['#id'] = 'advpoll_voting_binary_form-'. $binary_form_count++;
   $form['#attributes'] = array('class' => 'advpoll-vote');
@@ -36,7 +36,6 @@
       }
     }
     $form['choice'] = array(
-       '#title' => $page ? '' : check_plain($node->title),
       '#options' => $list,
     );
 
@@ -51,11 +50,6 @@
     }
   }
 
-  $form['in_block'] = array(
-    '#type' => 'hidden',
-    '#value' => $block,
-  );
-
   $form['nid'] = array(
     '#type' => 'hidden',
     '#value' => $node->nid,
@@ -71,14 +65,11 @@
     );
   }
 
-  // Multistep is set to TRUE as a hack to allow in_block to be accessed
-  // when voting via ajax in a block - there may be a better way to do this.
-  $form['#multistep'] = TRUE;
   $form['#action'] = url('node/'. $node->nid);
   return $form;
 }
 
-function advpoll_view_results_binary($node, $teaser, $page, $block) {
+function advpoll_view_results_binary($node, $teaser, $page) {
   $content_type = 'advpoll';
   $content_id = $node->nid;
 
@@ -106,7 +97,7 @@
         $votes[$i] = 0;
       }
       $percentage = round(100 * $votes[$i] / $total_votes, 0);
-      $output .= theme('advpoll_bar',  check_plain($ch['label']), $percentage, format_plural($votes[$i], '1 vote', '@count votes'), $block);
+      $output .= theme('advpoll_bar',  check_plain($ch['label']), $percentage, format_plural($votes[$i], '1 vote', '@count votes'));
     }
   }
 
Index: modes/ranking.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/modes/ranking.inc,v
retrieving revision 1.8.2.16
diff -u -r1.8.2.16 ranking.inc
--- modes/ranking.inc	2 Apr 2007 17:09:39 -0000	1.8.2.16
+++ modes/ranking.inc	3 Apr 2007 17:00:42 -0000
@@ -15,7 +15,7 @@
   );
 }
 
-function advpoll_voting_ranking_form(&$node, $teaser, $page, $block) {
+function advpoll_voting_ranking_form(&$node, $teaser, $page) {
   $form = array();
 
   static $ranking_form_count = 0; 
@@ -69,11 +69,6 @@
     }
   }
 
-  $form['in_block'] = array(
-    '#type' => 'hidden',
-    '#value' => $block,
-  );
-
   $form['nid'] = array(
     '#type' => 'hidden',
     '#value' => $node->nid,
@@ -89,14 +84,11 @@
     );
   }
 
-  // Multistep is set to TRUE as a hack to allow in_block to be accessed
-  // when voting via ajax in a block - there may be a better way to do this.
-  $form['#multistep'] = TRUE;
   $form['#action'] = url('node/'. $node->nid);
   return $form;
 }
 
-function advpoll_view_results_ranking($node, $teaser, $page, $block) {
+function advpoll_view_results_ranking($node, $teaser, $page) {
   $results = votingapi_get_voting_results('advpoll', $node->nid);
   $round_table = '';
 
@@ -162,7 +154,7 @@
         }
 
         $percentage = round(100 * $ranking[$i]->percentage, 0);
-        $output .= theme('advpoll_bar',  $this_rank, $percentage, $ranking[$i]->viewscore, $block);
+        $output .= theme('advpoll_bar',  $this_rank, $percentage, $ranking[$i]->viewscore);
 
       }
     }
@@ -188,7 +180,7 @@
     }
     $output .= '</ol>';
 
-    if (!$block && user_access('inspect all votes') && isset($rounds)) {
+    if (user_access('inspect all votes') && isset($rounds)) {
       if (count($rounds) > 0) {
         $header[0] = t('Rounds');
         $total_rounds = count($rounds);
