Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.433 diff -u -F^f -r1.433 common.inc --- includes/common.inc 31 Mar 2005 09:25:33 -0000 1.433 +++ includes/common.inc 31 Mar 2005 17:30:13 -0000 @@ -10,6 +10,21 @@ */ /** + * Return status for saving which involved creating a new item. + */ +define('SAVED_NEW', 1); + +/** + * Return status for saving which involved an update to an existing item. + */ +define('SAVED_UPDATED', 2); + +/** + * Return status for saving which deleted an existing item. + */ +define('SAVED_DELETED', 3); + +/** * Set the breadcrumb trail for the current page. * * @param $breadcrumb Index: modules/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v retrieving revision 1.188 diff -u -F^f -r1.188 taxonomy.module --- modules/taxonomy.module 31 Mar 2005 09:25:33 -0000 1.188 +++ modules/taxonomy.module 31 Mar 2005 17:30:13 -0000 @@ -130,10 +130,10 @@ function taxonomy_save_vocabulary($edit) db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type); } module_invoke_all('taxonomy', 'update', 'vocabulary', $edit); - $message = t('Updated vocabulary %name.', array('%name' => theme('placeholder', $edit['name']))); + $status = SAVED_UPDATED; } else if ($edit['vid']) { - $message = taxonomy_del_vocabulary($edit['vid']); + $status = taxonomy_del_vocabulary($edit['vid']); } else { $data['vid'] = $edit['vid'] = db_next_id('{vocabulary}_vid'); @@ -142,14 +142,12 @@ function taxonomy_save_vocabulary($edit) db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type); } module_invoke_all('taxonomy', 'insert', 'vocabulary', $edit); - $message = t('Created new vocabulary %name.', array('%name' => theme('placeholder', $edit['name']))); + $status = SAVED_NEW; } cache_clear_all(); - drupal_set_message($message); - - return $edit; + return $status; } function taxonomy_del_vocabulary($vid) { @@ -166,7 +164,7 @@ function taxonomy_del_vocabulary($vid) { cache_clear_all(); - return t('deleted vocabulary "%name".', array('%name' => $vocabulary->name)); + return SAVED_DELETED; } function _taxonomy_confirm_del_vocabulary($vid) { @@ -174,6 +172,7 @@ function _taxonomy_confirm_del_vocabular $extra = form_hidden('type', 'vocabulary'); $extra .= form_hidden('vid', $vid); + $extra .= form_hidden('name', $vocabulary->name); $output = theme('confirm', t('Are you sure you want to delete the vocabulary %title?', array('%title' => $vocabulary->name)), @@ -236,7 +235,7 @@ function taxonomy_save_term($edit) { db_query('UPDATE {term_data} SET '. _taxonomy_prepare_update($data) .' WHERE tid = %d', $edit['tid']); module_invoke_all('taxonomy', 'update', 'term', $edit); - $message = t('The term %term has been updated.', array('%term' => theme('placeholder', $edit['name']))); + $status = SAVED_UPDATED; } else if ($edit['tid']) { return taxonomy_del_term($edit['tid']); @@ -246,7 +245,7 @@ function taxonomy_save_term($edit) { $data = array('tid' => $edit['tid'], 'name' => $edit['name'], 'description' => $edit['description'], 'vid' => $edit['vid'], 'weight' => $edit['weight']); db_query('INSERT INTO {term_data} '. _taxonomy_prepare_insert($data, 1) .' VALUES '. _taxonomy_prepare_insert($data, 2)); module_invoke_all('taxonomy', 'insert', 'term', $edit); - $message = t('Created new term %term.', array('%term' => theme('placeholder', $edit['name']))); + $status = SAVED_NEW; } db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $edit['tid'], $edit['tid']); @@ -286,8 +285,7 @@ function taxonomy_save_term($edit) { cache_clear_all(); - drupal_set_message($message); - return $edit; + return $status; } function taxonomy_del_term($tid) { @@ -1011,15 +1009,33 @@ function taxonomy_admin() { break; } else { + $deleted_name = $edit['name']; $edit['name'] = 0; // fall through: } case t('Submit'): if (arg(3) == 'vocabulary') { - taxonomy_save_vocabulary($edit); + switch (taxonomy_save_vocabulary($edit)) { + case SAVED_NEW: + drupal_set_message(t('Created new vocabulary %name.', array('%name' => theme('placeholder', $edit['name'])))); + break; + case SAVED_UPDATED: + drupal_set_message(t('Updated vocabulary %name.', array('%name' => theme('placeholder', $edit['name'])))); + break; + case SAVED_DELETED: + drupal_set_message(t('Deleted vocabulary %name.', array('%name' => theme('placeholder', $deleted_name)))); + break; + } } else { - taxonomy_save_term($edit); + switch (taxonomy_save_term($edit)) { + case SAVED_NEW: + drupal_set_message(t('Created new term %term.', array('%term' => theme('placeholder', $edit['name'])))); + break; + case SAVED_UPDATED: + drupal_set_message(t('The term %term has been updated.', array('%term' => theme('placeholder', $edit['name'])))); + break; + } } drupal_goto('admin/taxonomy'); default: Index: modules/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum.module,v retrieving revision 1.241 diff -u -F^f -r1.241 forum.module --- modules/forum.module 31 Mar 2005 09:25:33 -0000 1.241 +++ modules/forum.module 31 Mar 2005 17:30:13 -0000 @@ -92,12 +92,26 @@ function forum_admin() { $edit['name'] = 0; } case t('Submit'): - $edit = taxonomy_save_term($edit); + $status = taxonomy_save_term($edit); if (arg(3) == 'container') { $containers = variable_get('forum_containers', array()); $containers[] = $edit['tid']; variable_set('forum_containers', $containers); - } + if ($status == SAVED_NEW) { + drupal_set_message(t('Created new forum container %term.', array('%term' => theme('placeholder', $edit['name'])))); + } + else { + drupal_set_message(t('The forum container %term has been updated.', array('%term' => theme('placeholder', $edit['name'])))); + } + } + else { + if ($status == SAVED_NEW) { + drupal_set_message(t('Created new forum %term.', array('%term' => theme('placeholder', $edit['name'])))); + } + else { + drupal_set_message(t('The forum %term has been updated.', array('%term' => theme('placeholder', $edit['name'])))); + } + } drupal_goto('admin/forum'); default: $output = forum_overview(); @@ -130,7 +144,7 @@ function _forum_confirm_delete($tid) { $extra = form_hidden('tid', $tid); $output = theme('confirm', - t('Are you sure you want to delete the forum %name?', array('%name' => ''. $term->name .'')), + t('Are you sure you want to delete the forum %name?', array('%name' => theme('placeholder', $term->name))), 'admin/forums', t('Deleting a forum or container will delete all sub-forums as well. This action cannot be undone.'), t('Delete'),