From dcbab232d61223e4b4143615f3d2560478477c07 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 20 Sep 2003 16:03:05 +0000 Subject: - Updated the story module to use the _validate hook. Fixes bug #2919 reported by Jonathan. --- modules/story.module | 32 ++++++++++++++++---------------- modules/story/story.module | 32 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 32 deletions(-) (limited to 'modules') diff --git a/modules/story.module b/modules/story.module index 3357e27c4..f58fa4381 100644 --- a/modules/story.module +++ b/modules/story.module @@ -61,32 +61,32 @@ function story_link($type) { return $links; } -function story_form(&$node, &$help, &$error) { - - if (isset($node->body)) { +function story_validate(&$node) { - /* - ** Validate the size of the story: - */ - - if (count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { - $error["body"] = "
". t("The body of your story is too short.") ."
"; - } + /* + ** Validate the size of the story: + */ + if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { +print "body : $node->body"; + $error["body"] = "
". t("The body of your story is too short.") ."
"; } - else { - /* - ** Carry out some explanation or submission guidelines: - */ + return $error; +} + +function story_form(&$node, &$help, &$error) { - $help = variable_get("story_help", ""); + /* + ** Carry out some explanation or submission guidelines: + */ - } + $help = variable_get("story_help", ""); if (function_exists("taxonomy_node_form")) { $output .= implode("", taxonomy_node_form("story", $node)); } + $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text()); return $output; diff --git a/modules/story/story.module b/modules/story/story.module index 3357e27c4..f58fa4381 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -61,32 +61,32 @@ function story_link($type) { return $links; } -function story_form(&$node, &$help, &$error) { - - if (isset($node->body)) { +function story_validate(&$node) { - /* - ** Validate the size of the story: - */ - - if (count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { - $error["body"] = "
". t("The body of your story is too short.") ."
"; - } + /* + ** Validate the size of the story: + */ + if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { +print "body : $node->body"; + $error["body"] = "
". t("The body of your story is too short.") ."
"; } - else { - /* - ** Carry out some explanation or submission guidelines: - */ + return $error; +} + +function story_form(&$node, &$help, &$error) { - $help = variable_get("story_help", ""); + /* + ** Carry out some explanation or submission guidelines: + */ - } + $help = variable_get("story_help", ""); if (function_exists("taxonomy_node_form")) { $output .= implode("", taxonomy_node_form("story", $node)); } + $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text()); return $output; -- cgit v1.2.3