Index: modules/blog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blog.module,v retrieving revision 1.222 diff -u -r1.222 blog.module --- modules/blog.module 31 Jul 2005 08:58:01 -0000 1.222 +++ modules/blog.module 16 Aug 2005 19:08:57 -0000 @@ -183,12 +183,21 @@ } /** + * Implementation of hook_validate(). + */ +function blog_validate(&$node) { + node_validate_title($node); +} + +/** * Implementation of hook_form(). */ function blog_form(&$node) { global $nid; $iid = $_GET['iid']; + $output = form_textfield(t('Title'), 'title', $node->title, 60, 128, NULL, NULL, TRUE); + if (empty($node->body)) { /* ** If the user clicked a "blog it" link, we load the data from the Index: modules/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book.module,v retrieving revision 1.310 diff -u -r1.310 book.module --- modules/book.module 29 Jul 2005 07:13:25 -0000 1.310 +++ modules/book.module 16 Aug 2005 19:08:45 -0000 @@ -220,13 +220,16 @@ $node->weight = 0; $node->revision = 1; } + + node_validate_title($node); } /** * Implementation of hook_form(). */ function book_form(&$node) { - $output = form_select(t('Parent'), 'parent', ($node->parent ? $node->parent : arg(4)), book_toc($node->nid), t('The parent that this page belongs in. Note that pages whose parent is <top-level> are regarded as independent, top-level books.')); + $output = form_textfield(t('Title'), 'title', $node->title, 60, 128, NULL, NULL, TRUE); + $output .= form_select(t('Parent'), 'parent', ($node->parent ? $node->parent : arg(4)), book_toc($node->nid), t('The parent that this page belongs in. Note that pages whose parent is <top-level> are regarded as independent, top-level books.')); if (function_exists('taxonomy_node_form')) { $output .= implode('', taxonomy_node_form('book', $node)); Index: modules/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum.module,v retrieving revision 1.260 diff -u -r1.260 forum.module --- modules/forum.module 1 Aug 2005 05:14:05 -0000 1.260 +++ modules/forum.module 16 Aug 2005 19:08:49 -0000 @@ -502,6 +502,8 @@ // Make sure all fields are set properly: $node->icon = $node->icon ? $node->icon : ''; + node_validate_title($node); + if ($node->taxonomy) { // Extract the node's proper topic ID. $vocabulary = variable_get('forum_nav_vocabulary', ''); @@ -538,6 +540,8 @@ * Implementation of hook_form(). */ function forum_form(&$node) { + $output = form_textfield(t('Subject'), 'title', $node->title, 60, 128, NULL, NULL, TRUE); + if (!$node->nid) { // new topic $node->taxonomy[] = arg(3); @@ -546,7 +550,7 @@ $node->taxonomy = array($node->tid); } - $output = implode('', taxonomy_node_form('forum', $node)); + $output .= implode('', taxonomy_node_form('forum', $node)); if ($node->nid) { // if editing, give option to leave shadows Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.519 diff -u -r1.519 node.module --- modules/node.module 11 Aug 2005 12:53:39 -0000 1.519 +++ modules/node.module 16 Aug 2005 19:15:16 -0000 @@ -1180,13 +1180,6 @@ // Convert the node to an object, if necessary. $node = array2object($node); - // Validate the title field. - if (isset($node->title)) { - if (trim($node->title) == '') { - form_set_error('title', t('You have to specify a title.')); - } - } - // Make sure the body has the minimum number of words. // todo use a better word counting algorithm that will work in other languages if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_'. $node->type .'_size', 0)) { @@ -1266,6 +1259,18 @@ } /** + * Validate the title of a node + */ +function node_validate_title($node) { + // Validate the title field. + if (isset($node->title)) { + if (trim($node->title) == '') { + form_set_error('title', t('You have to specify a title.')); + } + } +} + +/** * Generate the node editing form. */ function node_form($edit) { @@ -1319,9 +1324,8 @@ $output .= $extras ? '
'. $extras .'
' : ''; } - // Add the default fields. + // Open the enclosing div. $output .= '
'; - $output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE); // Add the node-type-specific fields. $output .= $form; Index: modules/page.module =================================================================== RCS file: /cvs/drupal/drupal/modules/page.module,v retrieving revision 1.132 diff -u -r1.132 page.module --- modules/page.module 8 Feb 2005 19:44:39 -0000 1.132 +++ modules/page.module 16 Aug 2005 19:08:39 -0000 @@ -64,9 +64,18 @@ } /** + * Implementation of hook_validate(). + */ +function page_validate(&$node) { + node_validate_title($node); +} + +/** * Implementation of hook_form(). */ function page_form(&$node) { + $output = form_textfield(t('Title'), 'title', $node->title, 60, 128, NULL, NULL, TRUE); + if (function_exists('taxonomy_node_form')) { $output .= implode('', taxonomy_node_form('page', $node)); } Index: modules/story.module =================================================================== RCS file: /cvs/drupal/drupal/modules/story.module,v retrieving revision 1.167 diff -u -r1.167 story.module --- modules/story.module 1 Apr 2005 15:55:01 -0000 1.167 +++ modules/story.module 16 Aug 2005 19:08:53 -0000 @@ -64,10 +64,17 @@ } /** + * Implementation of hook_validate(). + */ +function story_validate(&$node) { + node_validate_title($node); +} + +/** * Implementation of hook_form(). */ function story_form(&$node) { - $output = ''; + $output = form_textfield(t('Title'), 'title', $node->title, 60, 128, NULL, NULL, TRUE); if (function_exists('taxonomy_node_form')) { $output .= implode('', taxonomy_node_form('story', $node));