summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/aggregator/aggregator.install7
-rw-r--r--modules/aggregator/aggregator.pages.inc2
-rw-r--r--modules/aggregator/aggregator.processor.inc15
-rw-r--r--modules/node/content_types.inc29
-rw-r--r--modules/node/node.admin.inc9
-rw-r--r--modules/node/node.install21
-rw-r--r--modules/node/node.module42
-rw-r--r--modules/node/node.pages.inc5
-rw-r--r--modules/system/system.admin.inc6
-rw-r--r--modules/system/system.module15
10 files changed, 128 insertions, 23 deletions
diff --git a/modules/aggregator/aggregator.install b/modules/aggregator/aggregator.install
index d6a811313..9d3733312 100644
--- a/modules/aggregator/aggregator.install
+++ b/modules/aggregator/aggregator.install
@@ -28,6 +28,7 @@ function aggregator_uninstall() {
variable_del('aggregator_fetcher');
variable_del('aggregator_parser');
variable_del('aggregator_processors');
+ variable_del('aggregator_teaser_length');
}
/**
@@ -280,3 +281,9 @@ function aggregator_update_7000() {
db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''));
return $ret;
}
+/**
+ * Add aggregator teaser length to settings from old global default teaser length
+ */
+function aggregator_update_7001() {
+ variable_set('aggregator_teaser_length', variable_get('teaser_length'));
+}
diff --git a/modules/aggregator/aggregator.pages.inc b/modules/aggregator/aggregator.pages.inc
index 16cd6cf70..5c5d0c70c 100644
--- a/modules/aggregator/aggregator.pages.inc
+++ b/modules/aggregator/aggregator.pages.inc
@@ -378,7 +378,7 @@ function theme_aggregator_page_rss($feeds, $category = NULL) {
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 .= '<p><a href="' . check_url($feed->link) . '">' . t('read more') . "</a></p>\n";
}
diff --git a/modules/aggregator/aggregator.processor.inc b/modules/aggregator/aggregator.processor.inc
index a2ff818c8..567db2634 100644
--- a/modules/aggregator/aggregator.processor.inc
+++ b/modules/aggregator/aggregator.processor.inc
@@ -112,10 +112,25 @@ function aggregator_form_aggregator_admin_form_alter(&$form, $form_state) {
'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.)'),
);
+ $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), '_aggregator_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.")
+ );
+
}
}
/**
+ * Helper function for teaser length choices.
+ */
+function _aggregator_characters($length) {
+ return ($length == 0) ? t('Unlimited') : format_plural($length, '1 character', '@count characters');
+}
+
+/**
* Add/edit/delete an aggregator item.
*
* @param $edit
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc
index c681ab9b9..c611f6753 100644
--- a/modules/node/content_types.inc
+++ b/modules/node/content_types.inc
@@ -136,6 +136,17 @@ function node_type_form(&$form_state, $type = NULL) {
'#options' => drupal_map_assoc(array(0, 1, 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' => variable_get('node_preview_' . $type->type, DRUPAL_OPTIONAL),
+ '#options' => array(
+ DRUPAL_DISABLED => t('Disabled'),
+ DRUPAL_OPTIONAL => t('Optional'),
+ DRUPAL_REQUIRED => t('Required'),
+ ),
+ '#description' => t('Should users preview posts before submitting?'),
+ );
$form['submission']['help'] = array(
'#type' => 'textarea',
'#title' => t('Explanation or submission guidelines'),
@@ -171,6 +182,13 @@ function node_type_form(&$form_state, $type = NULL) {
'#default_value' => variable_get('node_submitted_' . $type->type, TRUE),
'#description' => t('Enable the <em>submitted by Username on date</em> 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,7 +241,14 @@ function node_type_form(&$form_state, $type = NULL) {
}
/**
- * Implement hook_form_validate().
+ * 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) {
$type = new stdClass();
@@ -407,6 +432,8 @@ function node_type_delete_confirm(&$form_state, $type) {
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);
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index 3750e5891..dbddaea1e 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -48,13 +48,6 @@ function node_configure() {
}
/**
- * 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) {
@@ -74,7 +67,7 @@ function node_configure_rebuild_confirm() {
*/
function node_configure_rebuild_confirm_submit($form, &$form_state) {
node_access_rebuild(TRUE);
- $form_state['redirect'] = 'admin/content/node-settings';
+ $form_state['redirect'] = 'admin/reports/status';
}
/**
diff --git a/modules/node/node.install b/modules/node/node.install
index aa278adba..e2f8ec8d9 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -407,6 +407,27 @@ function node_update_7003() {
}
/**
+ * Extend the existing default preview and teaser settings to all node types.
+ */
+function node_update_7004() {
+ // Get original settings and all types.
+ $original_length = variable_get('teaser_length', 600);
+ $original_preview = variable_get('node_preview', 0);
+
+ // Map old preview setting to new values order.
+ $original_preview ? $original_preview = 2 : $original_preview = 1;
+ $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 "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
diff --git a/modules/node/node.module b/modules/node/node.module
index dee045a9e..af28dd192 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1046,7 +1046,7 @@ function node_submit($node) {
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.
@@ -1870,15 +1870,9 @@ function node_menu() {
'weight' => -10,
);
- $items['admin/content/node-settings'] = array(
- 'title' => 'Post settings',
- 'description' => 'Control posting behavior, such as teaser length, requiring previews before posting, and the number of posts on the front page.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('node_configure'),
- 'access arguments' => array('administer nodes'),
- );
- $items['admin/content/node-settings/rebuild'] = array(
+ $items['admin/reports/status/rebuild'] = array(
'title' => 'Rebuild permissions',
+ 'page callback' => 'drupal_get_form',
'page arguments' => array('node_configure_rebuild_confirm'),
// Any user than can potentially trigger a node_access_needs_rebuild(TRUE)
// has to be allowed access to the 'node access rebuild' confirm form.
@@ -2191,7 +2185,7 @@ function node_page_default() {
->addTag('node_access');
$nids = $select->execute()->fetchCol();
-
+
if (!empty($nids)) {
$nodes = node_load_multiple($nids);
$build = node_build_multiple($nodes);
@@ -2206,7 +2200,7 @@ function node_page_default() {
}
else {
drupal_set_title(t('Welcome to @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))));
-
+
$default_message = '<p>' . t('No front page content has been created yet.') . '</p>';
if (user_access('access administration pages')) {
@@ -3376,3 +3370,29 @@ function node_elements() {
function theme_node_links($element) {
return theme('links', $element['#value'], array('class' => 'links inline'));
}
+
+/**
+ * Implement hook_requirements().
+ */
+function node_requirements($phase) {
+ $requirements = array();
+ // Ensure translations don't break at install time
+ $t = get_t();
+ // Only show rebuild button if there are either 0, or 2 or more, rows
+ // in the {node_access} table, or if there are modules that
+ // implement hook_node_grants().
+ $grant_count = db_result(db_query('SELECT COUNT(*) FROM {node_access}'));
+ if ($grant_count != 1 || count(module_implements('node_grants')) > 0) {
+ $value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
+ } else {
+ $value = $t('Disabled');
+ }
+ $description = $t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed posts will automatically use the new permissions.');
+
+ $requirements['node_access'] = array(
+ 'title' => $t('Node Access Permissions'),
+ 'value' => $value,
+ 'description' => $description . ' ' . l('Rebuild Permissions', 'admin/reports/status/rebuild'),
+ );
+ return $requirements;
+}
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index 2ded07985..729a991db 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -257,12 +257,13 @@ function node_form(&$form_state, $node) {
$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, 1) != DRUPAL_REQUIRED || (!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, 1) != DRUPAL_DISABLED,
'#type' => 'submit',
'#value' => t('Preview'),
'#weight' => 10,
@@ -395,7 +396,7 @@ function node_preview($node) {
// 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));
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 6fd477674..1ff8bdf9e 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1213,6 +1213,12 @@ function system_site_information_settings() {
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
'#required' => TRUE,
);
+ $form['default_nodes_main'] = array(
+ '#type' => 'select', '#title' => t('Number of posts on front page'),
+ '#default_value' => 10,
+ '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
+ '#description' => t('The maximum number of posts per page to display on overview pages like the front page above.')
+ );
$form['site_403'] = array(
'#type' => 'textfield',
'#title' => t('Default 403 (access denied) page'),
diff --git a/modules/system/system.module b/modules/system/system.module
index 6db8db9dc..767981c82 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -56,6 +56,21 @@ define('DRUPAL_USER_TIMEZONE_EMPTY', 1);
*/
define('DRUPAL_USER_TIMEZONE_SELECT', 2);
+ /**
+ * Disabled option on forms and settings
+ */
+define('DRUPAL_DISABLED', 0);
+
+/**
+ * Optional option on forms and settings
+ */
+define('DRUPAL_OPTIONAL', 1);
+
+/**
+ * Required option on forms and settings
+ */
+define('DRUPAL_REQUIRED', 2);
+
/**
* Implement hook_help().
*/