Index: date_api.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/Attic/date_api.admin.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 date_api.admin.inc --- date_api.admin.inc 25 Jan 2009 13:03:13 -0000 1.1.2.1 +++ date_api.admin.inc 20 Feb 2009 02:19:25 -0000 @@ -131,6 +131,13 @@ function date_api_date_format_form_eleme } } +function date_api_date_time_settings_validate($form, &$form_state) { + $formats = date_get_formats('custom'); + if (!empty($formats) && in_array($form_state['values']['add_date_format'], array_keys($formats))) { + form_set_error('add_date_format', t('This format already exists. Please enter a unique format string.')); + } +} + function date_api_date_time_settings_submit($form, &$form_state) { if (!empty($form_state['values']['add_date_format'])) { $format = array(); Index: date_api.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date_api.install,v retrieving revision 1.16.2.1.2.14 diff -u -p -r1.16.2.1.2.14 date_api.install --- date_api.install 16 Feb 2009 23:46:08 -0000 1.16.2.1.2.14 +++ date_api.install 20 Feb 2009 02:19:26 -0000 @@ -55,7 +55,7 @@ function date_api_schema() { 'type' => array( 'description' => 'The date format type, e.g. medium.', 'type' => 'varchar', - 'length' => 255, + 'length' => 200, 'not null' => TRUE, ), 'title' => array( @@ -87,13 +87,13 @@ function date_api_schema() { 'format' => array( 'description' => 'The date format string.', 'type' => 'varchar', - 'length' => 255, + 'length' => 100, 'not null' => TRUE, ), 'type' => array( 'description' => 'The date format type, e.g. medium.', 'type' => 'varchar', - 'length' => 255, + 'length' => 200, 'not null' => TRUE, ), 'locked' => array( @@ -105,7 +105,7 @@ function date_api_schema() { ), ), 'primary key' => array('dfid'), - 'unique keys' => array('format' => array('format')), + 'unique keys' => array('format' => array('format', 'type')), ); $schema['date_format_locale'] = array( @@ -114,13 +114,13 @@ function date_api_schema() { 'format' => array( 'description' => 'The date format string.', 'type' => 'varchar', - 'length' => 255, + 'length' => 100, 'not null' => TRUE, ), 'type' => array( 'description' => 'The date format type, e.g. medium.', 'type' => 'varchar', - 'length' => 255, + 'length' => 200, 'not null' => TRUE, ), 'language' => array( @@ -337,7 +337,7 @@ function date_api_update_6002() { 'fields' => array( 'type' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 200, 'not null' => TRUE, ), 'title' => array( @@ -364,12 +364,12 @@ function date_api_update_6002() { ), 'format' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 100, 'not null' => TRUE, ), 'type' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 200, 'not null' => TRUE, ), 'locked' => array( @@ -380,19 +380,19 @@ function date_api_update_6002() { ), ), 'primary key' => array('dfid'), - 'unique keys' => array('format' => array('format')), + 'unique keys' => array('format' => array('format', 'type')), ); $schema['date_format_locale'] = array( 'fields' => array( 'format' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 100, 'not null' => TRUE, ), 'type' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 200, 'not null' => TRUE, ), 'language' => array( @@ -410,4 +410,4 @@ function date_api_update_6002() { db_create_table($ret, 'date_format_locale', $schema['date_format_locale']); return $ret; -} \ No newline at end of file +} Index: date_api.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date_api.module,v retrieving revision 1.64.2.5.2.71 diff -u -p -r1.64.2.5.2.71 date_api.module --- date_api.module 17 Feb 2009 14:37:14 -0000 1.64.2.5.2.71 +++ date_api.module 20 Feb 2009 02:19:29 -0000 @@ -1847,7 +1847,7 @@ function date_format_save($date_format) drupal_write_record('date_format', $format); } else { - drupal_write_record('date_format', $format, 'format'); + drupal_write_record('date_format', $format, array('format', 'type')); } $languages = language_list('enabled'); @@ -2386,4 +2386,4 @@ function date_range_string($years) { $max = '+'. ($years[1] - $this_year); } return $min .':'. $max; -} \ No newline at end of file +} Index: date/date.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date/date.install,v retrieving revision 1.37.2.5.2.26 diff -u -p -r1.37.2.5.2.26 date.install --- date/date.install 15 Feb 2009 11:32:48 -0000 1.37.2.5.2.26 +++ date/date.install 20 Feb 2009 02:19:29 -0000 @@ -722,7 +722,7 @@ function date_install_create_format($fie } variable_set('date_format_'. $name, $format); db_query("INSERT INTO {date_format_types} (type, title, locked) VALUES('%s', '%s', 0)", $name, $title); - if (!db_result(db_query("SELECT dfid FROM {date_format} WHERE format='%s'", $format))) { + if (!db_result(db_query("SELECT dfid FROM {date_format} WHERE format='%s' AND type='%s'", $format, $type))) { db_query("INSERT INTO {date_format} (format, type, locked) VALUES('%s', '%s', 0)", $format, 'custom'); } } @@ -798,4 +798,4 @@ function date_db_integrity($name) { } content_clear_type_cache(); return $ret; -} \ No newline at end of file +} Index: date/date.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date/date.module,v retrieving revision 1.61.2.4.2.47 diff -u -p -r1.61.2.4.2.47 date.module --- date/date.module 13 Feb 2009 23:07:50 -0000 1.61.2.4.2.47 +++ date/date.module 20 Feb 2009 02:19:29 -0000 @@ -279,13 +279,16 @@ function date_theme() { ), ); - $format_types = date_get_format_types('', TRUE); - if (!empty($format_types)) { - foreach ($format_types as $type => $type_info) { - $themes['date_formatter_' . $type] = $base + array( - 'arguments' => array('element' => NULL), - 'function' => 'theme_date_display_combination', - ); + // Table isn't available first time date_theme() is called in update.php. + if (db_table_exists('date_format_types')) { + $format_types = date_get_format_types('', TRUE); + if (!empty($format_types)) { + foreach ($format_types as $type => $type_info) { + $themes['date_formatter_' . $type] = $base + array( + 'arguments' => array('element' => NULL), + 'function' => 'theme_date_display_combination', + ); + } } }