From 2bc18b615540ca4ba41cf79a27fd900835bea989 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 8 Nov 2009 11:19:02 +0000 Subject: #553326 by sun: Provide consistency to the way field UI is presented for taxonomy. --- modules/taxonomy/taxonomy.admin.inc | 14 +++++++------- modules/taxonomy/taxonomy.module | 21 ++++++++++----------- modules/taxonomy/taxonomy.test | 14 +++++++------- 3 files changed, 24 insertions(+), 25 deletions(-) (limited to 'modules/taxonomy') diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index cf5ece294..bccb1a8d0 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -20,9 +20,9 @@ function taxonomy_overview_vocabularies($form) { $form[$vocabulary->vid]['#vocabulary'] = $vocabulary; $form[$vocabulary->vid]['name'] = array('#markup' => check_plain($vocabulary->name)); $form[$vocabulary->vid]['weight'] = array('#type' => 'weight', '#delta' => 10, '#default_value' => $vocabulary->weight); - $form[$vocabulary->vid]['edit'] = array('#type' => 'link', '#title' => t('edit vocabulary'), '#href' => "admin/structure/taxonomy/$vocabulary->vid"); - $form[$vocabulary->vid]['list'] = array('#type' => 'link', '#title' => t('list terms'), '#href' => "admin/structure/taxonomy/$vocabulary->vid/list"); - $form[$vocabulary->vid]['add'] = array('#type' => 'link', '#title' => t('add terms'), '#href' => "admin/structure/taxonomy/$vocabulary->vid/list/add"); + $form[$vocabulary->vid]['edit'] = array('#type' => 'link', '#title' => t('edit vocabulary'), '#href' => "admin/structure/taxonomy/$vocabulary->vid/edit"); + $form[$vocabulary->vid]['list'] = array('#type' => 'link', '#title' => t('list terms'), '#href' => "admin/structure/taxonomy/$vocabulary->vid"); + $form[$vocabulary->vid]['add'] = array('#type' => 'link', '#title' => t('add terms'), '#href' => "admin/structure/taxonomy/$vocabulary->vid/add"); } // Only make this form include a submit button and weight if more than one @@ -212,17 +212,17 @@ function taxonomy_form_vocabulary_submit($form, &$form_state) { switch (taxonomy_vocabulary_save($vocabulary)) { case SAVED_NEW: drupal_set_message(t('Created new vocabulary %name.', array('%name' => $vocabulary->name))); - watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->vid)); + watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->vid . '/edit')); break; + case SAVED_UPDATED: drupal_set_message(t('Updated vocabulary %name.', array('%name' => $vocabulary->name))); - watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->vid)); + watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->vid . '/edit')); break; } $form_state['vid'] = $vocabulary->vid; $form_state['redirect'] = 'admin/structure/taxonomy'; - return; } /** @@ -380,7 +380,7 @@ function taxonomy_overview_terms($form, &$form_state, $vocabulary) { $form['#page_entries'] = $page_entries; $form['#back_peddle'] = $back_peddle; $form['#forward_peddle'] = $forward_peddle; - $form['#empty_text'] = t('No terms available. Add term.', array('@link' => url('admin/structure/taxonomy/' . $vocabulary->vid . '/list/add'))); + $form['#empty_text'] = t('No terms available. Add term.', array('@link' => url('admin/structure/taxonomy/' . $vocabulary->vid . '/add'))); if ($vocabulary->hierarchy < 2 && count($tree) > 1) { $form['submit'] = array( diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 6cc346368..200f39525 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -234,30 +234,29 @@ function taxonomy_menu() { ); $items['admin/structure/taxonomy/%taxonomy_vocabulary'] = array( - 'title' => 'Vocabulary', // this is replaced by callback - 'page callback' => 'drupal_get_form', - 'page arguments' => array('taxonomy_form_vocabulary', 3), 'title callback' => 'taxonomy_admin_vocabulary_title_callback', 'title arguments' => array(3), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('taxonomy_overview_terms', 3), 'access arguments' => array('administer taxonomy'), - 'type' => MENU_CALLBACK, 'file' => 'taxonomy.admin.inc', ); - $items['admin/structure/taxonomy/%taxonomy_vocabulary/edit'] = array( - 'title' => 'Edit vocabulary', + $items['admin/structure/taxonomy/%taxonomy_vocabulary/list'] = array( + 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -20, ); - $items['admin/structure/taxonomy/%taxonomy_vocabulary/list'] = array( - 'title' => 'List terms', + $items['admin/structure/taxonomy/%taxonomy_vocabulary/edit'] = array( + 'title' => 'Edit', 'page callback' => 'drupal_get_form', - 'page arguments' => array('taxonomy_overview_terms', 3), + 'page arguments' => array('taxonomy_form_vocabulary', 3), 'access arguments' => array('administer taxonomy'), 'type' => MENU_LOCAL_TASK, 'weight' => -10, 'file' => 'taxonomy.admin.inc', ); - $items['admin/structure/taxonomy/%taxonomy_vocabulary/list/add'] = array( + + $items['admin/structure/taxonomy/%taxonomy_vocabulary/add'] = array( 'title' => 'Add term', 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_form_term', array(), 3), @@ -888,7 +887,7 @@ function taxonomy_help($path, $arg) { case 'admin/structure/taxonomy': $output = '

' . t('Configure the vocabularies and terms for your site.') . '

'; return $output; - case 'admin/structure/taxonomy/%/list': + case 'admin/structure/taxonomy/%': $vocabulary = taxonomy_vocabulary_load($arg[3]); switch ($vocabulary->hierarchy) { case 0: diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 27508f572..945b07f34 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -114,7 +114,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { $edit[$key . '[weight]'] = $vocabulary->weight; } // Saving the new weights via the interface. - $this->drupalPost('admin/structure/taxonomy/', $edit, t('Save')); + $this->drupalPost('admin/structure/taxonomy', $edit, t('Save')); // Load the vocabularies from the database. $new_vocabularies = taxonomy_get_vocabularies(); @@ -162,7 +162,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { // Delete the vocabulary. $edit = array(); - $this->drupalPost('admin/structure/taxonomy/' . $vid, $edit, t('Delete')); + $this->drupalPost('admin/structure/taxonomy/' . $vid . '/edit', $edit, t('Delete')); $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), t('[confirm deletion] Asks for confirmation.')); $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), t('[confirm deletion] Inform that all terms will be deleted.')); @@ -439,13 +439,13 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $edit['parent[]'] = array(0); // Create the term to edit. - $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->vid . '/list/add', $edit, t('Save')); + $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->vid . '/add', $edit, t('Save')); $term = reset(taxonomy_get_term_by_name($edit['name'])); $this->assertNotNull($term, t('Term found in database')); // Submitting a term takes us to the add page; we need the List page. - $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->vid . '/list'); + $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->vid); // Test edit link as accessed from Taxonomy administration pages. // Because Simpletest creates its own database when running tests, we know @@ -497,7 +497,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // tabledrag.js by changing the page HTML source. Each term has three hidden // fields, "tid:1:0[tid]", "tid:1:0[parent]", and "tid:1:0[depth]". The // order of the input fields in the page is used when the form is processed. - $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->vid . '/list'); + $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->vid); $reorder = array( 'tid:' . $term1->tid . ':0' => 'tid:' . $term2->tid . ':0', 'tid:' . $term2->tid . ':0' => 'tid:' . $term3->tid . ':0', @@ -527,7 +527,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $this->assertEqual($terms[1]->parents, array($term2->tid), t('Term 3 was made a child of term 2.')); $this->assertEqual($terms[2]->tid, $term1->tid, t('Term 1 was moved below term 2.')); - $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->vid . '/list', array(), t('Reset to alphabetical')); + $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->vid, array(), t('Reset to alphabetical')); // Submit confirmation form. $this->drupalPost(NULL, array(), t('Reset to alphabetical')); @@ -669,7 +669,7 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase { 'name' => $this->randomName(), 'antonym' => 'Long', ); - $this->drupalPost('admin/structure/taxonomy/' . $vocabulary->vid . '/list/add', $edit, t('Save')); + $this->drupalPost('admin/structure/taxonomy/' . $vocabulary->vid . '/add', $edit, t('Save')); $term = reset(taxonomy_get_term_by_name($edit['name'])); $this->assertEqual($term->antonym, $edit['antonym'], t('Antonym was loaded into the term object')); -- cgit v1.2.3