Index: modules/system/admin.css =================================================================== RCS file: /cvs/drupal/drupal/modules/system/admin.css,v retrieving revision 1.13 diff -u -p -r1.13 admin.css --- modules/system/admin.css 17 Apr 2007 07:19:39 -0000 1.13 +++ modules/system/admin.css 5 May 2007 22:35:55 -0000 @@ -109,4 +109,30 @@ table.screenshot { } .theme-info p { margin-top: 0; -} \ No newline at end of file +} + + +/** + * Date and time settings page + */ +div.date-container { + overflow: auto; +} + +div.date-container > div { + float: left; +} + +html.js div.custom-container { + display: none; +} + +html.js div.custom-container .form-item label { + visibility: hidden; +} + +div.custom-container { + margin-left: 15px; + width: 50%; +} + Index: modules/system/system.js =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.js,v retrieving revision 1.3 diff -u -p -r1.3 system.js --- modules/system/system.js 29 Apr 2007 16:06:04 -0000 1.3 +++ modules/system/system.js 5 May 2007 22:35:55 -0000 @@ -24,3 +24,25 @@ Drupal.cleanURLsSettingsCheck = function } }}); } + +/** + * Show/hide custom format sections on the date-time settings page. + */ +Drupal.dateTimeAutoAttach = function() { + // Show/hide custom format depending on the select's value. + $("select.date-format").change(function() { + $(this).parents("div.date-container").children("div.custom-container")[$(this).val() == "custom" ? "show" : "hide"](); + }); + + // Attach keyup handler to custom format inputs. + $("input.custom-format").keyup(function() { + var input = $(this); + var url = Drupal.settings.dateTime.lookup +(Drupal.settings.dateTime.lookup.match(/\?q=/) ? "&format=" : "?format=") + Drupal.encodeURIComponent(input.val()); + $.getJSON(url, function(data) { + $("div.description span", input.parent()).html(data); + }); + }); + + // Trigger the event handler to show the form input if necessary. + $("select.date-format").trigger("change"); +} Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.473 diff -u -p -r1.473 system.module --- modules/system/system.module 4 May 2007 09:41:37 -0000 1.473 +++ modules/system/system.module 5 May 2007 22:35:56 -0000 @@ -284,6 +284,11 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_date_time_settings'), ); + $items['admin/settings/date-time/lookup'] = array( + 'title' => t('Date and time lookup'), + 'type' => MENU_CALLBACK, + 'page callback' => 'system_date_time_lookup', + ); $items['admin/settings/site-maintenance'] = array( 'title' => 'Site maintenance', 'description' => 'Take the site off-line for maintenance or bring it back online.', @@ -813,32 +818,41 @@ function system_rss_feeds_settings() { } function system_date_time_settings() { + drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module'); + drupal_add_js(array('dateTime' => array('lookup' => url('admin/settings/date-time/lookup'))), 'setting'); + drupal_add_js(' +// Global Killswitch +if (Drupal.jsEnabled) { + $(document).ready(Drupal.dateTimeAutoAttach); +}', 'inline'); // Date settings: $zones = _system_zonelist(); // Date settings: possible date formats - $dateshort = array('Y-m-d H:i', 'm/d/Y - H:i', 'd/m/Y - H:i', 'Y/m/d - H:i', + $date_short = array('Y-m-d H:i', 'm/d/Y - H:i', 'd/m/Y - H:i', 'Y/m/d - H:i', 'd.m.Y - H:i', 'm/d/Y - g:ia', 'd/m/Y - g:ia', 'Y/m/d - g:ia', 'M j Y - H:i', 'j M Y - H:i', 'Y M j - H:i', 'M j Y - g:ia', 'j M Y - g:ia', 'Y M j - g:ia'); - $datemedium = array('D, Y-m-d H:i', 'D, m/d/Y - H:i', 'D, d/m/Y - H:i', + $date_medium = array('D, Y-m-d H:i', 'D, m/d/Y - H:i', 'D, d/m/Y - H:i', 'D, Y/m/d - H:i', 'F j, Y - H:i', 'j F, Y - H:i', 'Y, F j - H:i', 'D, m/d/Y - g:ia', 'D, d/m/Y - g:ia', 'D, Y/m/d - g:ia', 'F j, Y - g:ia', 'j F Y - g:ia', 'Y, F j - g:ia', 'j. F Y - G:i'); - $datelong = array('l, F j, Y - H:i', 'l, j F, Y - H:i', 'l, Y, F j - H:i', + $date_long = array('l, F j, Y - H:i', 'l, j F, Y - H:i', 'l, Y, F j - H:i', 'l, F j, Y - g:ia', 'l, j F Y - g:ia', 'l, Y, F j - g:ia', 'l, j. F Y - G:i'); // Date settings: construct choices for user - foreach ($dateshort as $f) { - $dateshortchoices[$f] = format_date(time(), 'custom', $f); + foreach ($date_short as $f) { + $date_short_choices[$f] = format_date(time(), 'custom', $f); } - foreach ($datemedium as $f) { - $datemediumchoices[$f] = format_date(time(), 'custom', $f); + foreach ($date_medium as $f) { + $date_medium_choices[$f] = format_date(time(), 'custom', $f); } - foreach ($datelong as $f) { - $datelongchoices[$f] = format_date(time(), 'custom', $f); + foreach ($date_long as $f) { + $date_long_choices[$f] = format_date(time(), 'custom', $f); } + $date_long_choices['custom'] = $date_medium_choices['custom'] = $date_short_choices['custom'] = t('Custom format'); + $form['date_default_timezone'] = array( '#type' => 'select', '#title' => t('Default time zone'), @@ -855,30 +869,75 @@ function system_date_time_settings() { '#description' => t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.') ); + $date_format_short = variable_get('date_format_short', $date_short[1]); $form['date_format_short'] = array( + '#prefix' => '