Index: advpoll.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll.install,v
retrieving revision 1.5.2.9
diff -u -p -r1.5.2.9 advpoll.install
--- advpoll.install	10 May 2007 23:38:02 -0000	1.5.2.9
+++ advpoll.install	9 Aug 2007 06:05:13 -0000
@@ -20,6 +20,7 @@ function advpoll_install() {
           `algorithm` VARCHAR(100),
           `showvotes` tinyint,
           `startdate` int unsigned,
+          question varchar(255) default '',
           PRIMARY KEY  (`nid`)
       ) /*!40100 DEFAULT CHARACTER SET utf8 */");
 
@@ -121,3 +122,9 @@ function advpoll_update_1() {
   }
   return $ret;  
 }
+
+function advpoll_update_2() {
+  $ret = array();
+  db_add_column($ret, 'advpoll', 'question', 'varchar(255)', array('default' => "''"));
+  return $ret;
+}
Index: advpoll.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll.module,v
retrieving revision 1.21.2.52
diff -u -p -r1.21.2.52 advpoll.module
--- advpoll.module	8 Aug 2007 11:49:27 -0000	1.21.2.52
+++ advpoll.module	9 Aug 2007 06:08:40 -0000
@@ -185,6 +185,13 @@ function advpoll_form($node, $form_value
   else {
     $choices = max(2, count($node->choice)? count($node->choice) : 5);
   }
+  
+  $form['question'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Question'),
+    '#default_value' => $node->question,
+    '#maxlength' => 255,
+  );
 
   $form['choices'] = array(
     '#type' => 'hidden',
@@ -825,7 +832,7 @@ function advpoll_update($node) {
     $node->settings['active'] = _advpoll_calculate_active($node);
   }
 
-  db_query("UPDATE {advpoll} SET active=%d, runtime=%d, maxchoices=%d, algorithm='%s', uselist=%d, showvotes=%d, startdate='%s' WHERE nid = %d", $node->settings['active'], $node->settings['runtime'], $node->settings['maxchoices'], $node->settings['algorithm'], $node->settings['uselist'], $node->settings['showvotes'], $node->settings['usestart'] ? _advpoll_create_startdate($node) : 'NULL', $node->nid);
+  db_query("UPDATE {advpoll} SET active = %d, runtime = %d, maxchoices = %d, algorithm = '%s', uselist = %d, showvotes = %d, startdate = '%s', question = '%s' WHERE nid = %d", $node->settings['active'], $node->settings['runtime'], $node->settings['maxchoices'], $node->settings['algorithm'], $node->settings['uselist'], $node->settings['showvotes'], $node->settings['usestart'] ? _advpoll_create_startdate($node) : 'NULL', $node->question, $node->nid);
 
   _advpoll_insert_choices($node->nid);
   votingapi_recalculate_results('advpoll', $node->nid);
@@ -895,7 +902,7 @@ function advpoll_insert($node) {
     $node->settings['active'] = _advpoll_calculate_active($node);
   }
 
-  db_query("INSERT INTO {advpoll} (nid, mode, uselist, active, runtime, maxchoices, algorithm, showvotes, startdate) VALUES (%d, '%s', %d, %d, %d, %d, '%s', %d, '%s')", $node->nid, $mode, $node->settings['uselist'], $node->settings['active'], $node->settings['runtime'], $node->settings['maxchoices'], $node->settings['algorithm'], $node->settings['showvotes'], $node->settings['usestart'] ? _advpoll_create_startdate($node) : 'NULL');
+  db_query("INSERT INTO {advpoll} (nid, mode, uselist, active, runtime, maxchoices, algorithm, showvotes, startdate, question) VALUES (%d, '%s', %d, %d, %d, %d, '%s', %d, '%s', '%s')", $node->nid, $mode, $node->settings['uselist'], $node->settings['active'], $node->settings['runtime'], $node->settings['maxchoices'], $node->settings['algorithm'], $node->settings['showvotes'], $node->settings['usestart'] ? _advpoll_create_startdate($node) : 'NULL', $node->question);
 
   // Insert the choices
   _advpoll_insert_choices($node->nid);
@@ -990,19 +997,27 @@ function advpoll_submit(&$node) {
  */
 function advpoll_view($node, $teaser = FALSE, $page = FALSE) {
   $mode = _advpoll_get_mode($node);
+  
+  // Add question to content if defined.
+  if (!empty($node->question)) {
+    $node->content['question'] = array(
+      '#weight' => 1,
+      '#value' => theme('advpoll_question', check_plain($node->question)), 
+    );
+  }
 
   // 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(
-      '#weight' => 1,
+      '#weight' => 2,
       '#value' => drupal_get_form('advpoll_voting_'. $mode .'_form', $node, $teaser, $page),
     );
   }
   else if (!$node->voted && arg(2) != 'results' && $node->active) {
     // User hasn't voted and we're not on the results tab
     $node->content['poll'] = array(
-      '#weight' => 1,
+      '#weight' => 2,
       '#value' => drupal_get_form('advpoll_voting_'. $node->mode .'_form', $node, $teaser, $page)
     );
     static $addjs = TRUE;
@@ -1017,7 +1032,7 @@ function advpoll_view($node, $teaser = F
   else {
     // Show results (the user has voted or poll is closed).
     $node->content['poll'] = array(
-      '#weight' => 1,
+      '#weight' => 2,
       '#value' => advpoll_view_results($node, $teaser, $page)
     );  
   }
@@ -1032,6 +1047,10 @@ function _advpoll_block_resultslink($nod
   );
 }
 
+function theme_advpoll_question($question) {
+  return '<p class="question">'. $question .'</p>';
+} 
+
 function theme_advpoll_results($title, $results, $votes, $links, $nid, $voted, $cancel_vote) {
   $output = '<div class="poll">';
   if ($results) {
