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 23 Aug 2005 11:16:51 -0000 @@ -204,16 +204,17 @@ // Note: $item->description has been validated on aggregation. $node->body = ''. check_plain($item->title) .' - '. $item->description .' ['. check_plain($item->ftitle) ."]\n"; } + } if (function_exists('taxonomy_node_form')) { - $output .= implode('', taxonomy_node_form('blog', $node)); + $form['taxonomy'] = taxonomy_node_form('blog', $node); } - $output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE); - $output .= filter_form('format', $node->format); + $form['body'] = array(type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE, weight => 1); + # $form['format'] = filter_form($node->format); - return $output; + return $form; } /** Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.521 diff -u -r1.521 node.module --- modules/node.module 22 Aug 2005 20:39:43 -0000 1.521 +++ modules/node.module 23 Aug 2005 11:18:17 -0000 @@ -1,6 +1,7 @@ 'nodetest', 'title' => 'test me', 'callback' => 'my_node_form', 'access' => 1); if ($may_cache) { + $items[] = array('path' => 'admin/node', 'title' => t('content'), 'callback' => 'node_admin', 'access' => user_access('administer nodes')); @@ -1265,9 +1267,95 @@ return $node; } + /** * Generate the node editing form. */ +function node_form($node) { + if (!$edit->validated) { + $edit = node_validate($edit); + } + + // Set the id of the top-level form tag + $form[attributes]['id'] = 'node-form'; + + // Prepend extra node form elements. + $form = array_merge($form, node_invoke_nodeapi($node, 'form pre')); + + /** + * Basic node information. + * These elements set the value property, making them immutable. + */ + $form['uid'] = array(type => 'hidden', value => $node->uid); + $form['created'] = array(type => 'hidden', value => $node->created); + $form['changed'] = array(type => 'hidden', value => $node->changed); + $form['type'] = array(type => 'hidden', value => $node->type); + + // Get the node-specific bits. + // We can't use node_invoke() because $param must be passed by reference. + $function = node_get_module_name($node) .'_form'; + $param = array(); + if (function_exists($function)) { + $form = array_merge($form, $function($node, $param)); + } + + // Append extra node form elements. + $form = array_merge($form, node_invoke_nodeapi($node, 'form post')); + + /** + * Node author information + */ + $form['author'] = array(type => 'fieldset', title => t('Authoring information'), collapsible => TRUE, collapsed => TRUE, weight => -1); + $form['author']['name'] = array(type => 'textfield', title => t('Authored by'), maxlength => 60, autocomplete_path => 'user/autocomplete', default_value => $node->name, weight => -1); + $form['author']['date'] = array(type => 'textfield', title =>t('Authored on'), maxlength => 25, required => TRUE, default_value => $node->date); + + + $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); + + /** + * Node options + */ + $form['options'] = array(type => 'fieldset', title => t('Publishing options'), collapsible => TRUE, collapsed => TRUE, weight => -1); + $form['options']['status'] = array(type => 'checkbox', title => t('Published'), default_value => in_array('status', $node_options)); + $form['options']['moderate'] = array(type => 'checkbox', title => t('In moderation queue'), default_value => in_array('moderate', $node_options)); + $form['options']['promote'] = array(type => 'checkbox', title => t('Promoted to front page'), default_value => in_array('promote', $node_options)); + $form['options']['sticky'] = array(type => 'checkbox', title =>t('Sticky at top of lists'), default_value => in_array('sticky', $node_options)); + $form['options']['revision'] = array(type => 'checkbox', title =>t('Create new revision'), default_value => in_array('revision', $node_options)); + + + // Add the default fields. + $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title); + + // Add the buttons. + $form['preview'] = array(type => 'submit', value => t('Preview'), weight => 19); + + if ($node->type && (($_POST['op'] == t('Preview') && !form_get_errors()) || !variable_get('node_preview', 0))) { + $form['submit'] = array(type => 'submit', value => t('Submit'), weight => 20); + } + + + return drupal_get_form($node->type . '_node_form', $form, $_POST['edit'], 'node_form'); +} + +function theme_node_form($form) { + $output .= '