Commit 6ef2ddae authored by Dries's avatar Dries

- Patch #199774 by dww, ugerhard, brianV, John Morahan: make it more 'natural'...

- Patch #199774 by dww, ugerhard, brianV, John Morahan: make it more 'natural' to enable security notification e-mails.
parent d455a8d9
......@@ -1355,6 +1355,8 @@ function install_configure_form(&$form_state, &$install_state) {
// work on install time.
drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail'))), 'setting');
drupal_add_js('jQuery(function () { Drupal.cleanURLsInstallCheck(); });', 'inline');
// Add JS to show / hide the 'Email administrator about site updates' elements
drupal_add_js('jQuery(function () { Drupal.hideEmailAdministratorCheckbox() });', 'inline');
// Build menu to allow clean URL check.
menu_rebuild();
......@@ -1591,11 +1593,18 @@ function _install_configure_form(&$form_state, &$install_state) {
'#attributes' => array('class' => 'install'),
);
$form['server_settings']['update_status_module'] = array(
'#type' => 'checkboxes',
$form['update_notifications'] = array(
'#type' => 'fieldset',
'#title' => st('Update notifications'),
'#options' => array(1 => st('Check for updates automatically')),
'#default_value' => array(1),
'#collapsible' => FALSE,
);
$form['update_notifications']['update_status_module'] = array(
'#type' => 'checkboxes',
'#options' => array(
1 => st('Check for updates automatically'),
2 => st('Receive e-mail notifications'),
),
'#default_value' => array(1, 2),
'#description' => st('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to <a href="@drupal">Drupal.org</a>.', array('@drupal' => 'http://drupal.org')),
'#weight' => 15,
);
......@@ -1645,6 +1654,12 @@ function install_configure_form_submit($form, &$form_state) {
// Enable update.module if this option was selected.
if ($form_state['values']['update_status_module'][1]) {
drupal_install_modules(array('update'));
// Add the administrator's email address to the list of addresses to be
// notified when updates are available, if selected.
if ($form_state['values']['update_status_module'][2]) {
variable_set('update_notify_emails', array($form_state['values']['account']['mail']));
}
}
// Turn this off temporarily so that we can pass a password through.
......
// $Id$
(function ($) {
/**
* Show/hide the 'Email site administrator when updates are available' checkbox
* on the install page.
*/
Drupal.hideEmailAdministratorCheckbox = function () {
// Make sure the secondary box is shown / hidden as necessary on page load.
if ($('#edit-update-status-module-1').is(':checked')) {
$('.update-status-module-2-wrapper').show();
}
else {
$('.update-status-module-2-wrapper').hide();
}
// Toggle the display as necessary when the checkbox is clicked.
$('#edit-update-status-module-1').change( function () {
$('.update-status-module-2-wrapper').toggle();
})
};
/**
* Internal function to check using Ajax if clean URLs can be enabled on the
* settings page.
......@@ -128,4 +147,6 @@ Drupal.behaviors.poweredByPreview = {
}
};
})(jQuery);
......@@ -419,6 +419,14 @@ function update_mail($key, &$message, $params) {
$message['body'][] = _update_message_text($msg_type, $msg_reason, FALSE, $language);
}
$message['body'][] = t('See the available updates page for more information:', array(), array('langcode' => $langcode)) . "\n" . url('admin/reports/updates', array('absolute' => TRUE, 'language' => $language));
$settings_url = url('admin/settings/updates', array('absolute' => TRUE));
if (variable_get('update_notification_threshold', 'all') == 'all') {
$message['body'][] = t('Your site is currently configured to send these emails when any updates are available. To get notified only for security updates, please visit !url.', array('!url' => $settings_url));
}
else {
$message['body'][] = t('Your site is currently configured to send these emails only when security updates are available. To get notified for any available updates, please visit !url.', array('!url' => $settings_url));
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment