Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.55 diff -u -r1.55 node.pages.inc --- modules/node/node.pages.inc 13 Feb 2009 02:22:09 -0000 1.55 +++ modules/node/node.pages.inc 5 Mar 2009 17:39:27 -0000 @@ -238,12 +238,13 @@ $form['buttons']['#weight'] = 100; $form['buttons']['submit'] = array( '#type' => 'submit', - '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])), + '#access' => variable_get('node_preview_' . $node->type, 0) != 1 || (!form_get_errors() && isset($form_state['node_preview'])), '#value' => t('Save'), '#weight' => 5, '#submit' => array('node_form_submit'), ); $form['buttons']['preview'] = array( + '#access' => variable_get('node_preview_' . $node->type, 0) != 2, '#type' => 'submit', '#value' => t('Preview'), '#weight' => 10, @@ -372,7 +373,7 @@ // Extract a teaser, if it hasn't been set (e.g. by a module-provided // 'teaser' form item). if (!isset($node->teaser)) { - $node->teaser = empty($node->body) ? '' : node_teaser($node->body, $node->format); + $node->teaser = empty($node->body) ? '' : node_teaser($node->body, $node->format, variable_get('teaser_length_' . $type, 600)); // Chop off the teaser from the body if needed. if (!$node->teaser_include && $node->teaser == substr($node->body, 0, strlen($node->teaser))) { $node->body = substr($node->body, strlen($node->teaser)); Index: modules/node/content_types.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v retrieving revision 1.64 diff -u -r1.64 content_types.inc --- modules/node/content_types.inc 26 Jan 2009 14:08:43 -0000 1.64 +++ modules/node/content_types.inc 5 Mar 2009 17:39:26 -0000 @@ -136,6 +136,13 @@ '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), '#description' => t('The minimum number of words for the body field to be considered valid for this content type. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.') ); + $form['submission']['node_preview'] = array( + '#type' => 'radios', + '#title' => t('Preview post'), + '#default_value' => 0, + '#options' => array(t('Optional'), t('Required'), t('Disabled')), + '#description' => t('Should users preview posts before submitting?'), + ); $form['submission']['help'] = array( '#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), @@ -171,6 +178,12 @@ '#default_value' => variable_get('node_submitted_'. $type->type, TRUE), '#description' => t('Enable the submitted by Username on date text.'), ); + $form['display']['teaser_length'] = array( + '#type' => 'select', '#title' => t('Length of trimmed posts'), + '#default_value' => 600, + '#options' => drupal_map_assoc(array(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000), '_node_characters'), + '#description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited' . Note that this setting will only affect new or updated content and will not affect existing teasers.") + ); $form['old_type'] = array( '#type' => 'value', '#value' => $type->type, @@ -223,6 +236,13 @@ } /** + * Helper function for teaser length choices. + */ +function _node_characters($length) { + return ($length == 0) ? t('Unlimited') : format_plural($length, '1 character', '@count characters'); +} + +/** * Implementation of hook_form_validate(). */ function node_type_form_validate($form, &$form_state) { Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1024 diff -u -r1.1024 node.module --- modules/node/node.module 13 Feb 2009 02:27:59 -0000 1.1024 +++ modules/node/node.module 5 Mar 2009 17:39:26 -0000 @@ -1019,7 +1019,7 @@ if (!isset($node->teaser)) { if (isset($node->body)) { $node->format = (!empty($node->body_format) ? $node->body_format : FILTER_FORMAT_DEFAULT); - $node->teaser = node_teaser($node->body, isset($node->format) ? $node->format : NULL); + $node->teaser = node_teaser($node->body, isset($node->format) ? $node->format : NULL, variable_get('teaser_length_' . $node->type, 600)); // Chop off the teaser from the body if needed. The teaser_include // property might not be set (eg. in Blog API postings), so only act on // it, if it was set with a given value. Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.38 diff -u -r1.38 node.admin.inc --- modules/node/node.admin.inc 3 Feb 2009 18:55:30 -0000 1.38 +++ modules/node/node.admin.inc 5 Mar 2009 17:39:26 -0000 @@ -35,32 +35,10 @@ '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#description' => t('The default maximum number of posts to display per page on overview pages such as the main page.') ); - $form['teaser_length'] = array( - '#type' => 'select', '#title' => t('Length of trimmed posts'), - '#default_value' => 600, - '#options' => drupal_map_assoc(array(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000), '_node_characters'), - '#description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited' . Note that this setting will only affect new or updated content and will not affect existing teasers.") - ); - - $form['node_preview'] = array( - '#type' => 'radios', - '#title' => t('Preview post'), - '#default_value' => 0, - '#options' => array(t('Optional'), t('Required')), - '#description' => t('Must users preview posts before submitting?'), - ); - return system_settings_form($form, TRUE); } /** - * Helper function for teaser length choices. - */ -function _node_characters($length) { - return ($length == 0) ? t('Unlimited') : format_plural($length, '1 character', '@count characters'); -} - -/** * Form button submit callback. */ function node_configure_access_submit($form, &$form_state) {