summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-07-30 19:32:19 +0000
committerDries Buytaert <dries@buytaert.net>2009-07-30 19:32:19 +0000
commit6ef2ddae21279e50db21fb816442470b449cd1d1 (patch)
tree0e6b5977af05cadc9434eea006d25bd06ad9c37b
parentd455a8d9213962114d25bbade369cc7fe60239f6 (diff)
downloadbrdo-6ef2ddae21279e50db21fb816442470b449cd1d1.tar.gz
brdo-6ef2ddae21279e50db21fb816442470b449cd1d1.tar.bz2
- Patch #199774 by dww, ugerhard, brianV, John Morahan: make it more 'natural' to enable security notification e-mails.
-rw-r--r--install.php23
-rw-r--r--modules/system/system.js21
-rw-r--r--modules/update/update.module8
3 files changed, 48 insertions, 4 deletions
diff --git a/install.php b/install.php
index ca2deaf9d..8df7a0e94 100644
--- a/install.php
+++ b/install.php
@@ -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.
diff --git a/modules/system/system.js b/modules/system/system.js
index 7bea58dee..a0f712aec 100644
--- a/modules/system/system.js
+++ b/modules/system/system.js
@@ -2,6 +2,25 @@
(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);
+
diff --git a/modules/update/update.module b/modules/update/update.module
index ca6cab3a5..2ba9add43 100644
--- a/modules/update/update.module
+++ b/modules/update/update.module
@@ -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));
+ }
}
/**