From 5ebbdd0c362187c3348a15e4a4a9a62fc648179a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 5 Aug 2008 18:11:44 +0000 Subject: - Patch #280628 by pwolanin et al: fixed locale module confirm form and broken locale module tests. --- includes/locale.inc | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/locale.inc b/includes/locale.inc index 783d17ed2..2dea9784f 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -871,16 +871,36 @@ function locale_translate_edit_form_submit($form, &$form_state) { */ /** - * Delete a language string. + * String deletion confirmation page. */ -function locale_translate_delete($lid) { - db_query('DELETE FROM {locales_source} WHERE lid = %d', $lid); - db_query('DELETE FROM {locales_target} WHERE lid = %d', $lid); +function locale_translate_delete_page($lid) { + if ($source = db_fetch_object(db_query('SELECT * FROM {locales_source} WHERE lid = %d', $lid))) { + return drupal_get_form('locale_translate_delete_form', $source); + } + else { + return drupal_not_found(); + } +} + +/** + * User interface for the string deletion confirmation screen. + */ +function locale_translate_delete_form(&$form_state, $source) { + $form['lid'] = array('#type' => 'value', '#value' => $source->lid); + return confirm_form($form, t('Are you sure you want to delete the string "%source"?', array('%source' => $source->source)), 'admin/build/translate/search', t('Deleting the string will remove all translations of this string in all languages. This action cannot be undone.'), t('Delete'), t('Cancel')); +} + +/** + * Process string deletion submissions. + */ +function locale_translate_delete_form_submit($form, &$form_state) { + db_query('DELETE FROM {locales_source} WHERE lid = %d', $form_state['values']['lid']); + db_query('DELETE FROM {locales_target} WHERE lid = %d', $form_state['values']['lid']); // Force JavaScript translation file recreation for all languages. _locale_invalidate_js(); cache_clear_all('locale:', 'cache', TRUE); drupal_set_message(t('The string has been removed.')); - drupal_goto('admin/build/translate/search'); + $form_state['redirect'] = 'admin/build/translate/search'; } /** * @} End of "locale-translate-delete" -- cgit v1.2.3