Index: modules/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book.module,v retrieving revision 1.315 diff -u -r1.315 book.module --- modules/book.module 6 Sep 2005 18:55:41 -0000 1.315 +++ modules/book.module 14 Sep 2005 19:26:43 -0000 @@ -231,27 +231,38 @@ * 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.')); + $form['parent'] = array( + type => 'select', title => t('Parent'), default_value => ($node->parent ? $node->parent : arg(4)), options => book_toc($node->nid), + description => 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)); + $form['taxonomy'] = taxonomy_node_form('book', $node); } - $output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE); - $output .= filter_form('format', $node->format); - - $output .= form_textarea(t('Log message'), 'log', $node->log, 60, 5, t('An explanation of the additions or updates being made to help other authors understand your motivations.')); + $form['body'] = array( + type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE + ); + $form = array_merge($form, filter_form($node->format)); + + $form['log'] = array( + type => 'textarea', title => t('Log message'), default_value => $node->log, required => TRUE, rows => 5, + description => t('An explanation of the additions or updates being made to help other authors understand your motivations.') + ); if (user_access('administer nodes')) { - $output .= form_weight(t('Weight'), 'weight', $node->weight, 15, t('Pages at a given level are ordered first by weight and then by title.')); + $form['weight'] = array( + type => 'weight', title => t('Weight'), default_value => $node->weight, delta => 15, + description => t('Pages at a given level are ordered first by weight and then by title.') + ); } else { // If a regular user updates a book page, we create a new revision // authored by that user: - $output .= form_hidden('revision', 1); + $form['revision'] = array(type => 'hidden', value => 1); } - return $output; + return $form; } /** @@ -288,21 +299,32 @@ default: $page = db_fetch_object(db_query('SELECT * FROM {book} WHERE vid = %d', $node->vid)); - - $output = form_select(t('Parent'), 'parent', $page->parent, book_toc($node->nid), t('The parent page in the book.')); - $output .= form_weight(t('Weight'), 'weight', $page->weight, 15, t('Pages at a given level are ordered first by weight and then by title.')); - $output .= form_textarea(t('Log message'), 'log', $node->log, 60, 5, t('An explanation to help other authors understand your motivations to put this post into the book.')); + + $form['parent'] = array( + type => 'select', title => t('Parent'), default_value => $page->parent, + options => book_toc($node->nid), description => t('The parent page in the book.') + ); + + $form['weight'] = array( + type => 'weight', title => t('Weight'), default_value => $page->weight, delta => 15, + description => t('Pages at a given level are ordered first by weight and then by title.') + ); + + $form['log'] = array( + type => 'textarea', title => t('Log message'), cols => 60, rows => 5, + default_value => $node->log, description => t('An explanation to help other authors understand your motivations to put this post into the book.') + ); if ($page->nid) { - $output .= form_submit(t('Update book outline')); - $output .= form_submit(t('Remove from book outline')); + $form['update'] = array(type => 'submit', value => t('Update book outline')); + $form['remove'] = array(type => 'submit', value => t('Remove from book outline')); } else { - $output .= form_submit(t('Add to book outline')); + $form['add'] = array(type => 'submit', value => t('Add to book outline')); } drupal_set_title(check_plain($node->title)); - return form($output); + return drupal_get_form('book_outline', $form); } } } @@ -966,7 +988,13 @@ * Creates a row for the 'admin' view of a book. Each row represents a page in the book, in the tree representing the book */ function book_admin_edit_line($node, $depth = 0) { - return array('