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 .= '
'; + $output .= '
'; + $output .= '
'; + $output .= form_render($form['author']); + $output .= '
'; + $output .= '
'; + $output .= form_render($form['options']); + $output .= '
'; + $output .= '
'; + $output .= '
'; + $output .= form_render($form); + $output .= '
'; + $output .= '
'; + return $output; +} + +/** + * Generate the node editing form. function node_form($edit) { // Validate the node if we don't already know the errors. if (!$edit->validated) { @@ -1381,6 +1469,7 @@ } return form($output, ($param['method'] ? $param['method'] : 'post'), $param['action'], $attributes); } + */ /** * Present a node submission form or a set of links to such forms. @@ -1402,7 +1491,7 @@ $node[$field] = $_GET['edit'][$field]; } } - $output = node_form($node); + $output = node_form(array2object($node)); drupal_set_title(t('Submit %name', array('%name' => node_invoke($node, 'node_name')))); } else { @@ -2000,4 +2089,5 @@ * @} End of "defgroup node_access". */ + ?> Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.226 diff -u -r1.226 system.module --- modules/system.module 22 Aug 2005 05:09:01 -0000 1.226 +++ modules/system.module 23 Aug 2005 11:20:52 -0000 @@ -49,6 +49,22 @@ } /** + * Implementation of hook_elements(). + */ +function system_elements() { + $type['form'] = array(method => 'post', action => request_uri()); + $type['checkbox'] = array(input => TRUE, return_value => 1); + $type['submit'] = array(input => TRUE, name => 'op', button_type => 'submit'); + $type['button'] = array(input => TRUE, name => 'op', button_type => 'submit'); + $type['textfield'] = array(input => TRUE, size => 20, maxlength => 50, autocomplete_path => FALSE); + $type['textarea'] = array(input => TRUE, cols => 60, rows => 20); + $type['fieldset'] = array(input => TRUE, collapsible => FALSE, collapsed => FALSE); + $type['item'] = array(); + $type['hidden'] = array(); + return $type; +} + +/** * Implementation of hook_menu(). */ function system_menu($may_cache) { Index: modules/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v retrieving revision 1.217 diff -u -r1.217 taxonomy.module --- modules/taxonomy.module 25 Jul 2005 04:55:37 -0000 1.217 +++ modules/taxonomy.module 23 Aug 2005 11:21:41 -0000 @@ -515,14 +515,19 @@ } } $typed_string = implode(', ', $typed_terms) . (array_key_exists('tags', $terms) ? $terms['tags'][$vocabulary->vid] : NULL); - $result[] = form_autocomplete($vocabulary->name, "$name][tags][". $vocabulary->vid, $typed_string, 60, 100, 'taxonomy/autocomplete/'. $vocabulary->vid, t('A comma-separated list of terms describing this content (Example: funny, bungie jumping, "Company, Inc.").'), NULL, ($vocabulary->required ? TRUE : FALSE)); + + # $result[] = form_autocomplete($vocabulary->name, "$name][tags][". $vocabulary->vid, $typed_string, 60, 100, 'taxonomy/autocomplete/'. $vocabulary->vid, t('A comma-separated list of terms describing this content (Example: funny, bungie jumping, "Company, Inc.").'), NULL, ($vocabulary->required ? TRUE : FALSE)); + + $form[$name]['tags'][$vocabulary->vid] = array( type => textfield, default_value => $typed_string, size => 60, maxlength => 100, + autocomplete_path => 'taxonomy/autocomplete/'. $vocabulary->vid, required => ($vocabulary->required ? TRUE : FALSE), title => $vocabulary->name, + description => t('A comma-separated list of terms describing this content (Example: funny, bungie jumping, "Company, Inc.").') ); } else { $ntterms = array_key_exists('taxonomy', $node) ? $terms : array_keys($terms); - $result[] = taxonomy_form($vocabulary->vid, $ntterms, $help, $name); + $form[$name][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, $name); } } - return $result ? $result : array(); + return $form ? $form : array(); } /** Index: modules/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload.module,v retrieving revision 1.46 diff -u -r1.46 upload.module --- modules/upload.module 17 Aug 2005 19:27:03 -0000 1.46 +++ modules/upload.module 23 Aug 2005 11:21:48 -0000 @@ -157,7 +157,6 @@ $node->list[$key] = $file->list; } } - if (($file = file_check_upload('upload')) && user_access('upload files')) { global $user;