Commit 2bc18b61 authored by webchick's avatar webchick

#553326 by sun: Provide consistency to the way field UI is presented for taxonomy.

parent 95346366
......@@ -28,7 +28,7 @@ function forum_help($path, $arg) {
case 'admin/structure/forum/add/forum':
return '<p>' . t('A forum holds related or similar forum topics (a forum topic is the initial post to a threaded discussion). For example, a forum named "Fruit" may contain forum topics titled "Apples" and "Bananas", respectively.') . '</p>';
case 'admin/structure/forum/settings':
return '<p>' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the <em>Content types</em> on the <a href="@forum-vocabulary">forum vocabulary page</a>.', array('@forum-vocabulary' => url('admin/structure/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary', 0)))) . '</p>';
return '<p>' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the <em>Content types</em> on the <a href="@forum-vocabulary">forum vocabulary page</a>.', array('@forum-vocabulary' => url('admin/structure/taxonomy/' . variable_get('forum_nav_vocabulary', 0) . '/edit'))) . '</p>';
}
}
......
......@@ -142,7 +142,7 @@ class ForumTestCase extends DrupalWebTestCase {
);
// Edit the vocabulary.
$this->drupalPost('admin/structure/taxonomy/' . $vid, $edit, t('Save'));
$this->drupalPost('admin/structure/taxonomy/' . $vid . '/edit', $edit, t('Save'));
$this->assertResponse(200);
$this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited'));
......
......@@ -183,7 +183,7 @@ class PathTaxonomyTermTestCase extends DrupalWebTestCase {
$edit['name'] = $this->randomName();
$edit['description'] = $this->randomName();
$edit['path[alias]'] = $this->randomName();
$this->drupalPost('admin/structure/taxonomy/1/list/add', $edit, t('Save'));
$this->drupalPost('admin/structure/taxonomy/1/add', $edit, t('Save'));
// Confirm that the alias works.
$this->drupalGet($edit['path[alias]']);
......
......@@ -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. <a href="@link">Add term</a>.', array('@link' => url('admin/structure/taxonomy/' . $vocabulary->vid . '/list/add')));
$form['#empty_text'] = t('No terms available. <a href="@link">Add term</a>.', array('@link' => url('admin/structure/taxonomy/' . $vocabulary->vid . '/add')));
if ($vocabulary->hierarchy < 2 && count($tree) > 1) {
$form['submit'] = array(
......
......@@ -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 = '<p>' . t('Configure the vocabularies and terms for your site.') . '</p>';
return $output;
case 'admin/structure/taxonomy/%/list':
case 'admin/structure/taxonomy/%':
$vocabulary = taxonomy_vocabulary_load($arg[3]);
switch ($vocabulary->hierarchy) {
case 0:
......
......@@ -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'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment