Commit 296f6e9f authored by Dries's avatar Dries

- Patch #180948 by quicksketch: automatically populate e-mail fields during install.

parent 923abc79
......@@ -922,7 +922,7 @@ function install_configure_form() {
drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module');
// We add these strings as settings because JavaScript translation does not
// work on install time.
drupal_add_js(array('cleanURL' => array('success' => st('Your server has been successfully tested to support this feature.'), 'failure' => st('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.'), 'testing' => st('Testing clean URLs...'))), 'setting');
drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail')), 'cleanURL' => array('success' => st('Your server has been successfully tested to support this feature.'), 'failure' => st('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.'), 'testing' => st('Testing clean URLs...'))), 'setting');
drupal_add_js('
// Global Killswitch
if (Drupal.jsEnabled) {
......
......@@ -60,6 +60,31 @@ Drupal.cleanURLsInstallCheck = function() {
$("#clean-url").addClass('clean-url-processed');
};
/**
* When a field is filled out, apply its value to other fields that will likely
* use the same value. In the installer this is used to populate the
* administrator e-mail address with the same value as the site e-mail address.
*/
Drupal.behaviors.copyFieldValue = function (context) {
for (var sourceId in Drupal.settings.copyFieldValue) {
// Get the list of target fields.
targetIds = Drupal.settings.copyFieldValue[sourceId];
if (!$('#'+ sourceId + '.copy-field-values-processed').size(), context) {
// Add the behavior to update target fields on blur of the primary field.
sourceField = $('#' + sourceId);
sourceField.bind('blur', function() {
for (var delta in targetIds) {
var targetField = $('#'+ targetIds[delta]);
if (targetField.val() == '') {
targetField.val(this.value);
}
}
});
sourceField.addClass('copy-field-values-processed');
}
}
}
/**
* Show/hide custom format sections on the date-time settings page.
*/
......
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