summaryrefslogtreecommitdiff
path: root/modules/poll.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/poll.module')
-rw-r--r--modules/poll.module30
1 files changed, 16 insertions, 14 deletions
diff --git a/modules/poll.module b/modules/poll.module
index ab8fbe9ea..b93cdbb8d 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -77,14 +77,8 @@ function poll_delete($node) {
db_query("DELETE FROM {poll_choices} WHERE nid = %d", $node->nid);
}
-function poll_form(&$node, &$help, &$error) {
- $admin = user_access("administer nodes");
-
- $_duration = array(0 => t("Unlimited"), 86400 => format_interval(86400), 172800 => format_interval(172800), 345600 => format_interval(345600), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 4838400 => format_interval(4838400), 9676800 => format_interval(9676800), 31536000 => format_interval(31536000));
- $_active = array(0 => t("Closed"), 1 => t("Active"));
-
- $node->choices = $node->choices ? $node->choices : max(2, count($node->choice) ? count($node->choice) : 5);
+function poll_validate(&$node) {
if (isset($node->title)) {
// Check for at least two options and validate amount of votes:
for ($i = 0; $i < $node->choices; $i++) {
@@ -101,9 +95,21 @@ function poll_form(&$node, &$help, &$error) {
$error["choice][0"] = theme("theme_error", t("You must fill in at least two choices."));
}
}
- else {
- $help = variable_get("poll_help", "");
- }
+
+ $node->teaser = poll_teaser($node);
+
+ return $error;
+}
+
+function poll_form(&$node, &$help, &$error) {
+ $admin = user_access("administer nodes");
+
+ $_duration = array(0 => t("Unlimited"), 86400 => format_interval(86400), 172800 => format_interval(172800), 345600 => format_interval(345600), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 4838400 => format_interval(4838400), 9676800 => format_interval(9676800), 31536000 => format_interval(31536000));
+ $_active = array(0 => t("Closed"), 1 => t("Active"));
+
+ $node->choices = $node->choices ? $node->choices : max(2, count($node->choice) ? count($node->choice) : 5);
+
+ $help = variable_get("poll_help", "");
if (function_exists("taxonomy_node_form")) {
$output = implode("", taxonomy_node_form("poll", $node));
@@ -380,8 +386,4 @@ function poll_update($node) {
}
}
-function poll_validate(&$node) {
- $node->teaser = poll_teaser($node);
-}
-
?>