summaryrefslogtreecommitdiff
path: root/modules/poll.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-02-17 10:51:57 +0000
committerDries Buytaert <dries@buytaert.net>2006-02-17 10:51:57 +0000
commit62b610d8d9a77133288b7af3cd5f7b1fcbb0cc3d (patch)
treea09100b78bdbdd9b9104d03516e7768bdd7c84a7 /modules/poll.module
parentadb74caa6c65a60432a6e7afe356697216c3a9bd (diff)
downloadbrdo-62b610d8d9a77133288b7af3cd5f7b1fcbb0cc3d.tar.gz
brdo-62b610d8d9a77133288b7af3cd5f7b1fcbb0cc3d.tar.bz2
- Patch #48918 by chx: remove POST from poll.
Diffstat (limited to 'modules/poll.module')
-rw-r--r--modules/poll.module15
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/poll.module b/modules/poll.module
index 8ea1cd3e5..8c6f6be55 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -137,22 +137,23 @@ function poll_form(&$node) {
$node->choices = max(2, count($node->choice) ? count($node->choice) : 5);
}
- // User ticked 'need more choices'.
- if ($_POST['edit']['morechoices']) {
- $node->choices *= 2;
+ $form['choice']['choices'] = array('#type' => 'hidden', '#default_value' => $node->choices);
+ $form['choice']['morechoices'] = array('#type' => 'checkbox', '#title' => t('Need more choices'), '#default_value' => 0, '#description' => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."), '#weight' => 1);
+ $form['choice'] = form_builder('poll_node_form', $form['choice']);
+ if ($form['choice']['morechoices']['#value']) {
+ $form['choice']['morechoices']['#value'] = 0;
+ $form['choice']['choices']['#value'] *= 2;
+ $node->choices = $form['choice']['choices']['#value'];
}
// Poll choices
- $opts = drupal_map_assoc(range(2, $node->choices * 2 + 5));
- $form['choice'] = array('#type' => 'fieldset', '#title' => t('Choices'), '#prefix' => '<div class="poll-form">', '#suffix' => '</div>', '#tree' => TRUE);
+ $form['choice'] += array('#type' => 'fieldset', '#title' => t('Choices'), '#prefix' => '<div class="poll-form">', '#suffix' => '</div>', '#tree' => TRUE);
for ($a = 0; $a < $node->choices; $a++) {
$form['choice'][$a]['chtext'] = array('#type' => 'textfield', '#title' => t('Choice %n', array('%n' => ($a + 1))), '#default_value' => $node->choice[$a]['chtext']);
if ($admin) {
$form['choice'][$a]['chvotes'] = array('#type' => 'textfield', '#title' => t('Votes for choice %n', array('%n' => ($a + 1))), '#default_value' => (int)$node->choice[$a]['chvotes'], '#size' => 5, '#maxlength' => 7);
}
}
- $form['choices'] = array('#type' => 'hidden', '#value' => $node->choices);
- $form['morechoices'] = array('#type' => 'checkbox', '#title' => t('Need more choices'), '#default_value' => 0, '#description' => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."));
// Poll attributes
$_duration = array(0 => t('Unlimited')) + drupal_map_assoc(array(86400, 172800, 345600, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), "format_interval");