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 22:38:48 -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 22:38:47 -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) { @@ -406,7 +426,8 @@ */ function node_type_delete_confirm_submit($form, &$form_state) { node_type_delete($form_state['values']['type']); - + variable_del('teaser_length_' . $form_state['values']['type']); + variable_del('node_preview_' . $form_state['values']['type']); $t_args = array('%name' => $form_state['values']['name']); drupal_set_message(t('The content type %name has been deleted.', $t_args)); watchdog('menu', 'Deleted content type %name.', $t_args, WATCHDOG_NOTICE); 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 22:38:48 -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 22:38:47 -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) { Index: modules/node/node.install =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.install,v retrieving revision 1.11 diff -u -r1.11 node.install --- modules/node/node.install 21 Jan 2009 16:58:42 -0000 1.11 +++ modules/node/node.install 5 Mar 2009 22:38:47 -0000 @@ -415,6 +415,22 @@ db_add_index($ret, 'node', 'node_frontpage', array('promote', 'status', 'sticky', 'created')); return $ret; } +/** + * Extend the existing default preview and teaser settings to all node types. + */ +function node_update_7003() { + //get original settings and all types + $original_length = variable_get('teaser_length', 600); + $original_preview = variable_get('node_preview', 0); + $type_list = node_get_types('types'); + //apply original settings to all types + foreach ($type_list as $type) { + variable_set('teaser_length_' . $type, $original_length); + variable_set('node_preview_' . $type, $original_preview); + } + //delete old variable but leave 'teaser_length' for aggregator module upgrade + variable_del('node_preview'); +} /** * End of 6.x to 7.x updates Index: modules/aggregator/aggregator.install =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.install,v retrieving revision 1.20 diff -u -r1.20 aggregator.install --- modules/aggregator/aggregator.install 22 Dec 2008 19:38:31 -0000 1.20 +++ modules/aggregator/aggregator.install 5 Mar 2009 22:38:47 -0000 @@ -23,6 +23,7 @@ variable_del('aggregator_fetcher'); variable_del('aggregator_parser'); variable_del('aggregator_processors'); + variable_del('aggregator_teaser_length'); } /** @@ -266,3 +267,9 @@ db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => '')); return $ret; } +/** + * Add aggregator teaser lenght to settings from old global default teaser length + */ +function aggregator_update_7001() { + variable_set('aggregator_teaser_length', variable_get('teaser_length')); +} Index: modules/aggregator/aggregator.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v retrieving revision 1.24 diff -u -r1.24 aggregator.pages.inc --- modules/aggregator/aggregator.pages.inc 3 Feb 2009 18:55:29 -0000 1.24 +++ modules/aggregator/aggregator.pages.inc 5 Mar 2009 22:38:47 -0000 @@ -378,7 +378,7 @@ foreach ($feeds as $feed) { switch ($feed_length) { case 'teaser': - $teaser = node_teaser($feed->description); + $teaser = node_teaser($feed->description, NULL, variable_get('aggregator_teaser_length', 600)); if ($teaser != $feed->description) { $teaser .= '
\n"; } Index: modules/aggregator/aggregator.processor.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.processor.inc,v retrieving revision 1.3 diff -u -r1.3 aggregator.processor.inc --- modules/aggregator/aggregator.processor.inc 26 Jan 2009 14:08:42 -0000 1.3 +++ modules/aggregator/aggregator.processor.inc 5 Mar 2009 22:38:47 -0000 @@ -111,6 +111,14 @@ 'select' => t('multiple selector')), '#description' => t('The type of category selection widget displayed on categorization pages. (For a small number of categories, checkboxes are easier to use, while a multiple selector works well with large numbers of categories.)'), ); + drupal_function_exists('_node_characters'); + $form['modules']['aggregator']['aggregator_teaser_length'] = array( + '#type' => 'select', '#title' => t('Length of trimmed description'), + '#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 description. Drupal will use this setting to determine at which offset long descriptions should be trimmed. Note that this setting will only affect new or updated content and will not affect existing teasers.") + ); + } }