- Patch #459836 by Xano: rework admin/settings/regional-settings.
							parent
							
								
									06dbf309b6
								
							
						
					
					
						commit
						b166ca9b3c
					
				| 
						 | 
				
			
			@ -1524,7 +1524,7 @@ function system_regional_settings() {
 | 
			
		|||
 | 
			
		||||
  $form['locale'] = array(
 | 
			
		||||
    '#type' => 'fieldset',
 | 
			
		||||
    '#title' => t('Locale settings'),
 | 
			
		||||
    '#title' => t('Locale'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['locale']['site_default_country'] = array(
 | 
			
		||||
| 
						 | 
				
			
			@ -1532,65 +1532,63 @@ function system_regional_settings() {
 | 
			
		|||
    '#title' => t('Default country'),
 | 
			
		||||
    '#default_value' => variable_get('site_default_country', ''),
 | 
			
		||||
    '#options' => $countries,
 | 
			
		||||
    '#description' => t('Select the default country for the site.'),
 | 
			
		||||
    '#attributes' => array('class' => 'country-detect'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['locale']['date_default_timezone'] = array(
 | 
			
		||||
    '#type' => 'select',
 | 
			
		||||
    '#title' => t('Default time zone'),
 | 
			
		||||
    '#default_value' => variable_get('date_default_timezone', date_default_timezone_get()),
 | 
			
		||||
    '#options' => $zones,
 | 
			
		||||
    '#description' => t('Select the default time zone for the site.'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['locale']['date_first_day'] = array(
 | 
			
		||||
    '#type' => 'select',
 | 
			
		||||
    '#title' => t('First day of week'),
 | 
			
		||||
    '#default_value' => variable_get('date_first_day', 0),
 | 
			
		||||
    '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
 | 
			
		||||
    '#description' => t('The first day of the week for calendar views.')
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['timezone'] = array(
 | 
			
		||||
    '#type' => 'fieldset',
 | 
			
		||||
    '#title' => t('User time zones'),
 | 
			
		||||
    '#title' => t('Time zones'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['timezone']['date_default_timezone'] = array(
 | 
			
		||||
    '#type' => 'select',
 | 
			
		||||
    '#title' => t('Default time zone'),
 | 
			
		||||
    '#default_value' => variable_get('date_default_timezone', date_default_timezone_get()),
 | 
			
		||||
    '#options' => $zones,
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $configurable_timezones = variable_get('configurable_timezones', 1);
 | 
			
		||||
  $form['timezone']['configurable_timezones'] = array(
 | 
			
		||||
    '#type' => 'radios',
 | 
			
		||||
    '#title' => t('User-configurable time zones'),
 | 
			
		||||
    '#default_value' => variable_get('configurable_timezones', 1),
 | 
			
		||||
    '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
 | 
			
		||||
    '#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.')
 | 
			
		||||
    '#type' => 'checkbox',
 | 
			
		||||
    '#title' => t('Users may set their own time zone.'),
 | 
			
		||||
    '#default_value' => $configurable_timezones,
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['timezone']['user_default_timezone'] = array(
 | 
			
		||||
  $js_hide = !$configurable_timezones ? ' class="js-hide"' : '';
 | 
			
		||||
  $form['timezone']['configurable_timezones_wrapper'] =  array(
 | 
			
		||||
    '#prefix' => '<div id="empty-timezone-message-wrapper"' . $js_hide . '>',
 | 
			
		||||
    '#suffix' => '</div>',
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['timezone']['configurable_timezones_wrapper']['empty_timezone_message'] = array(
 | 
			
		||||
    '#type' => 'checkbox',
 | 
			
		||||
    '#title' => t('Remind users at login if their time zone is not set.'),
 | 
			
		||||
    '#default_value' => variable_get('empty_timezone_message', 0),
 | 
			
		||||
    '#description' => t('Only applied if users may set their own time zone.')
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['timezone']['configurable_timezones_wrapper']['user_default_timezone'] = array(
 | 
			
		||||
    '#type' => 'radios',
 | 
			
		||||
    '#title' => t('User time zone defaults'),
 | 
			
		||||
    '#title' => t('Time zone for new users'),
 | 
			
		||||
    '#default_value' => variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT),
 | 
			
		||||
    '#options' => array(
 | 
			
		||||
      DRUPAL_USER_TIMEZONE_DEFAULT => t('New users will be set to the default time zone at registration.'),
 | 
			
		||||
      DRUPAL_USER_TIMEZONE_EMPTY   => t('New users will get an empty time zone at registration.'),
 | 
			
		||||
      DRUPAL_USER_TIMEZONE_SELECT  => t('New users will select their own time zone at registration.'),
 | 
			
		||||
      DRUPAL_USER_TIMEZONE_DEFAULT => t('Default time zone.'),
 | 
			
		||||
      DRUPAL_USER_TIMEZONE_EMPTY   => t('Empty time zone.'),
 | 
			
		||||
      DRUPAL_USER_TIMEZONE_SELECT  => t('Users may set their own time zone at registration.'),
 | 
			
		||||
    ),
 | 
			
		||||
    '#description' => t('Method for setting user time zones at registration when user-configurable time zones are enabled. This only affects the initial time zone setting for a new registration. Users will be able to change their time zone any time they edit their account.')
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['timezone']['empty_timezone_message'] = array(
 | 
			
		||||
    '#type' => 'radios',
 | 
			
		||||
    '#title' => t('Empty user time zones'),
 | 
			
		||||
    '#default_value' => variable_get('empty_timezone_message', 0),
 | 
			
		||||
    '#options' => array(
 | 
			
		||||
      0 => t('Ignore empty user time zones.'),
 | 
			
		||||
      1 => t('Remind users at login if their time zone is not set.'),
 | 
			
		||||
    ),
 | 
			
		||||
    '#description' => t('Handling for empty user time zones when user-configurable time zones are enabled. Use this option to help ensure that users set the correct time zone.')
 | 
			
		||||
    '#description' => t('Only applied if users may set their own time zone.')
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $form['date_formats'] = array(
 | 
			
		||||
    '#type' => 'fieldset',
 | 
			
		||||
    '#title' => t('Formatting'),
 | 
			
		||||
    '#title' => t('Date formats'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $date_format_short = variable_get('date_format_short', $date_short[1]);
 | 
			
		||||
| 
						 | 
				
			
			@ -1602,7 +1600,6 @@ function system_regional_settings() {
 | 
			
		|||
    '#attributes' => array('class' => 'date-format'),
 | 
			
		||||
    '#default_value' => (isset($date_short_choices[$date_format_short]) ? $date_format_short : 'custom'),
 | 
			
		||||
    '#options' => $date_short_choices,
 | 
			
		||||
    '#description' => t('The short format of date display.'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $default_short_custom = variable_get('date_format_short_custom', (isset($date_short_choices[$date_format_short]) ? $date_format_short : ''));
 | 
			
		||||
| 
						 | 
				
			
			@ -1625,7 +1622,6 @@ function system_regional_settings() {
 | 
			
		|||
    '#attributes' => array('class' => 'date-format'),
 | 
			
		||||
    '#default_value' => (isset($date_medium_choices[$date_format_medium]) ? $date_format_medium : 'custom'),
 | 
			
		||||
    '#options' => $date_medium_choices,
 | 
			
		||||
    '#description' => t('The medium sized date display.'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $default_medium_custom = variable_get('date_format_medium_custom', (isset($date_medium_choices[$date_format_medium]) ? $date_format_medium : ''));
 | 
			
		||||
| 
						 | 
				
			
			@ -1648,7 +1644,6 @@ function system_regional_settings() {
 | 
			
		|||
    '#attributes' => array('class' => 'date-format'),
 | 
			
		||||
    '#default_value' => (isset($date_long_choices[$date_format_long]) ? $date_format_long : 'custom'),
 | 
			
		||||
    '#options' => $date_long_choices,
 | 
			
		||||
    '#description' => t('Longer date format used for detailed display.')
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $default_long_custom = variable_get('date_format_long_custom', (isset($date_long_choices[$date_format_long]) ? $date_format_long : ''));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,6 +112,19 @@ Drupal.behaviors.dateTime = {
 | 
			
		|||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Show/hide settings for user configurable time zones depending on whether
 | 
			
		||||
 * users are able to set their own time zones or not.
 | 
			
		||||
 */
 | 
			
		||||
Drupal.behaviors.userTimeZones = {
 | 
			
		||||
  attach: function (context, settings) {
 | 
			
		||||
    $('#empty-timezone-message-wrapper .description').hide();
 | 
			
		||||
    $('#edit-configurable-timezones', context).change(function () {
 | 
			
		||||
      $('#empty-timezone-message-wrapper').toggle();
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Show the powered by Drupal image preview
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue