From 90b00a688fef440d364c3384f7453b29b152665b Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Sun, 7 Jan 2007 08:20:31 +0000 Subject: #80085: Don't show user picture form on registration pages (chx / webchick) --- modules/node/node.module | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'modules/node') diff --git a/modules/node/node.module b/modules/node/node.module index 1a0e296e9..0f38e4580 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -138,6 +138,28 @@ function node_mark($nid, $timestamp) { return MARK_READ; } +/** + * See if the user used JS to submit a teaser. + */ +function node_teaser_js(&$form, $form_values) { + // Glue the teaser to the body. + if (isset($form['#post']['teaser_js'])) { + if (trim($form_values['teaser_js'])) { + // Space the teaser from the body + $body = trim($form_values['teaser_js']) ."\r\n\r\n". trim($form_values['body']); + } + else { + // Empty teaser, no spaces. + $body = ''. $form_values['body']; + } + // Pass value onto preview/submit + form_set_value($form['body'], $body); + // Pass value back onto form + $form['body']['#value'] = $body; + } + return $form; +} + /** * Automatically generate a teaser for a node body in a given format. */ @@ -2199,7 +2221,7 @@ function node_preview($node) { function theme_node_preview($node) { $output = '
'; if ($node->teaser && $node->teaser != $node->body) { - drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.')); + drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.')); $output .= '

'. t('Preview trimmed version') .'

'; $output .= node_view(drupal_clone($node), 1, FALSE, 0); $output .= '

'. t('Preview full version') .'

'; @@ -2931,13 +2953,23 @@ function node_content_form($node) { } if ($type->has_body) { - $form['body_filter']['body'] = array( + $form['body_field'] = array( + '#after_build' => array('node_teaser_js')); + + $form['body_field']['teaser_js'] = array( + '#type' => 'textarea', + '#rows' => 10, + '#teaser' => 'edit-body', + '#disabled' => TRUE); + + $form['body_field']['body'] = array( '#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => $node->body, '#rows' => 20, '#required' => ($type->min_word_count > 0)); - $form['body_filter']['format'] = filter_form($node->format); + + $form['body_field']['format'] = filter_form($node->format); } return $form; -- cgit v1.2.3