Commit ece869b0 authored by Dries's avatar Dries
Browse files

- Patch #192242 by catch, quicksketch, webchick, keith et all: usability...

- Patch #192242 by catch, quicksketch, webchick, keith et all: usability improvements for the vocabulary/term forms.
parent 1c02e47e
...@@ -2428,7 +2428,7 @@ function locale_batch_by_language($langcode, $finished = NULL, $skip = array()) ...@@ -2428,7 +2428,7 @@ function locale_batch_by_language($langcode, $finished = NULL, $skip = array())
$components = array(); $components = array();
$query = "SELECT name, filename FROM {system} WHERE status = 1"; $query = "SELECT name, filename FROM {system} WHERE status = 1";
if (count($skip)) { if (count($skip)) {
$query .= " AND name NOT IN (". db_placeholders($skip, 'varchar') .")"; $query .= " AND name NOT IN (". db_placeholders($skip, 'varchar') .")";
} }
$result = db_query($query, $skip); $result = db_query($query, $skip);
while ($component = db_fetch_object($result)) { while ($component = db_fetch_object($result)) {
......
...@@ -1673,7 +1673,7 @@ function theme_progress_bar($percent, $message) { ...@@ -1673,7 +1673,7 @@ function theme_progress_bar($percent, $message) {
/** /**
* Create a standard indentation div. Used for drag and drop tables. * Create a standard indentation div. Used for drag and drop tables.
* *
* @param $size * @param $size
* Optional. The number of indentations to create. * Optional. The number of indentations to create.
* @return * @return
......
...@@ -644,7 +644,7 @@ function install_tasks($profile, $task) { ...@@ -644,7 +644,7 @@ function install_tasks($profile, $task) {
$batch = locale_batch_by_language($install_locale, '_install_locale_initial_batch_finished'); $batch = locale_batch_by_language($install_locale, '_install_locale_initial_batch_finished');
if (!empty($batch)) { if (!empty($batch)) {
// Remember components we cover in this batch set. // Remember components we cover in this batch set.
variable_set('install_locale_batch_components', $batch['#components']); variable_set('install_locale_batch_components', $batch['#components']);
// Start a batch, switch to 'locale-batch' task. We need to // Start a batch, switch to 'locale-batch' task. We need to
// set the variable here, because batch_process() redirects. // set the variable here, because batch_process() redirects.
variable_set('install_task', 'locale-initial-batch'); variable_set('install_task', 'locale-initial-batch');
...@@ -782,7 +782,7 @@ function install_tasks($profile, $task) { ...@@ -782,7 +782,7 @@ function install_tasks($profile, $task) {
/** /**
* Finished callback for the first locale import batch. * Finished callback for the first locale import batch.
* *
* Advance installer task to the configure screen. * Advance installer task to the configure screen.
*/ */
function _install_locale_initial_batch_finished($success, $results) { function _install_locale_initial_batch_finished($success, $results) {
...@@ -791,7 +791,7 @@ function _install_locale_initial_batch_finished($success, $results) { ...@@ -791,7 +791,7 @@ function _install_locale_initial_batch_finished($success, $results) {
/** /**
* Finished callback for the second locale import batch. * Finished callback for the second locale import batch.
* *
* Advance installer task to the finished screen. * Advance installer task to the finished screen.
*/ */
function _install_locale_remaining_batch_finished($success, $results) { function _install_locale_remaining_batch_finished($success, $results) {
......
...@@ -354,11 +354,11 @@ function forum_form_alter(&$form, $form_state, $form_id) { ...@@ -354,11 +354,11 @@ function forum_form_alter(&$form, $form_state, $form_id) {
); );
$form['nodes']['#required'] = TRUE; $form['nodes']['#required'] = TRUE;
$form['hierarchy'] = array('#type' => 'value', '#value' => 1); $form['hierarchy'] = array('#type' => 'value', '#value' => 1);
unset($form['relations']); unset($form['settings']['relations']);
unset($form['tags']); unset($form['settings']['tags']);
unset($form['multiple']); unset($form['settings']['multiple']);
unset($form['delete']); unset($form['delete']);
$form['required'] = array('#type' => 'value', '#value' => 1); $form['settings']['required'] = array('#type' => 'value', '#value' => 1);
} }
} }
} }
......
...@@ -118,10 +118,10 @@ function _menu_overview_tree_form($tree) { ...@@ -118,10 +118,10 @@ function _menu_overview_tree_form($tree) {
/** /**
* Submit handler for the menu overview form. * Submit handler for the menu overview form.
* *
* This function takes great care in saving parent items first, then items * This function takes great care in saving parent items first, then items
* underneath them. Saving items in the incorrect order can break the menu tree. * underneath them. Saving items in the incorrect order can break the menu tree.
* *
* @see menu_overview_form() * @see menu_overview_form()
*/ */
function menu_overview_form_submit($form, &$form_state) { function menu_overview_form_submit($form, &$form_state) {
......
...@@ -52,60 +52,73 @@ function taxonomy_form_vocabulary(&$form_state, $edit = array()) { ...@@ -52,60 +52,73 @@ function taxonomy_form_vocabulary(&$form_state, $edit = array()) {
'required' => 0, 'required' => 0,
'weight' => 0, 'weight' => 0,
); );
$form['name'] = array('#type' => 'textfield', $form['identification'] = array(
'#type' => 'fieldset',
'#title' => t('Identification'),
'#collapsible' => TRUE,
);
$form['identification']['name'] = array('#type' => 'textfield',
'#title' => t('Vocabulary name'), '#title' => t('Vocabulary name'),
'#default_value' => $edit['name'], '#default_value' => $edit['name'],
'#maxlength' => 255, '#maxlength' => 255,
'#description' => t('The name for this vocabulary. Example: "Topic".'), '#description' => t('The name for this vocabulary. Example: "Topic".'),
'#required' => TRUE, '#required' => TRUE,
); );
$form['description'] = array('#type' => 'textarea', $form['identification']['description'] = array('#type' => 'textarea',
'#title' => t('Description'), '#title' => t('Description'),
'#default_value' => $edit['description'], '#default_value' => $edit['description'],
'#description' => t('Description of the vocabulary; can be used by modules.'), '#description' => t('Description of the vocabulary; can be used by modules.'),
); );
$form['help'] = array('#type' => 'textfield', $form['identification']['help'] = array('#type' => 'textfield',
'#title' => t('Help text'), '#title' => t('Help text'),
'#maxlength' => 255, '#maxlength' => 255,
'#default_value' => $edit['help'], '#default_value' => $edit['help'],
'#description' => t('Instructions to present to the user when choosing a term.'), '#description' => t('Instructions to present to the user when choosing a term.'),
); );
$form['nodes'] = array('#type' => 'checkboxes', $form['content_types'] = array(
'#type' => 'fieldset',
'#title' => t('Content types'),
'#collapsible' => TRUE,
);
$form['content_types']['nodes'] = array('#type' => 'checkboxes',
'#title' => t('Content types'), '#title' => t('Content types'),
'#default_value' => $edit['nodes'], '#default_value' => $edit['nodes'],
'#options' => node_get_types('names'), '#options' => node_get_types('names'),
'#description' => t('A list of content types you would like to categorize using this vocabulary.'), '#description' => t('Select content types to categorize using this vocabulary.'),
);
$form['hierarchy'] = array('#type' => 'radios',
'#title' => t('Hierarchy'),
'#default_value' => $edit['hierarchy'],
'#options' => array(t('Disabled'), t('Single'), t('Multiple')),
'#description' => t('Allows <a href="@help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('@help-url' => url('admin/help/taxonomy', array('absolute' => TRUE)))),
); );
$form['relations'] = array('#type' => 'checkbox', $form['settings'] = array(
'#title' => t('Related terms'), '#type' => 'fieldset',
'#default_value' => $edit['relations'], '#title' => t('Settings'),
'#description' => t('Allows <a href="@help-url">related terms</a> in this vocabulary.', array('@help-url' => url('admin/help/taxonomy', array('absolute' => TRUE)))), '#collapsible' => TRUE,
); );
$form['tags'] = array('#type' => 'checkbox', $form['settings']['tags'] = array('#type' => 'checkbox',
'#title' => t('Free tagging'), '#title' => t('Free tagging'),
'#default_value' => $edit['tags'], '#default_value' => $edit['tags'],
'#description' => t('Content is categorized by typing terms instead of choosing from a list.'), '#description' => t('Content is categorized by typing terms instead of choosing from a list.'),
); );
$form['multiple'] = array('#type' => 'checkbox', $form['settings']['multiple'] = array('#type' => 'checkbox',
'#title' => t('Multiple select'), '#title' => t('Multiple select'),
'#default_value' => $edit['multiple'], '#default_value' => $edit['multiple'],
'#description' => t('Allows posts to have more than one term from this vocabulary (always true for free tagging).'), '#description' => t('Allows posts to have more than one term from this vocabulary (always true for free tagging).'),
); );
$form['required'] = array('#type' => 'checkbox', $form['settings']['required'] = array('#type' => 'checkbox',
'#title' => t('Required'), '#title' => t('Required'),
'#default_value' => $edit['required'], '#default_value' => $edit['required'],
'#description' => t('If enabled, every post <strong>must</strong> have at least one term in this vocabulary.'), '#description' => t('At least one term in this vocabulary must be selected when submitting a post.'),
); );
$form['weight'] = array('#type' => 'weight', $form['settings']['weight'] = array('#type' => 'weight',
'#title' => t('Weight'), '#title' => t('Weight'),
'#default_value' => $edit['weight'], '#default_value' => $edit['weight'],
'#description' => t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.'), '#description' => t('Vocabularies are displayed in ascending order by weight.'),
);
// Set the hierarchy to "multiple parents" by default. This simplifies the
// vocabulary form and standardizes the term form.
$form['hierarchy'] = array('#type' => 'value',
'#value' => '2',
);
// Enable "related terms" by default.
$form['relations'] = array('#type' => 'value',
'#value' => '1',
); );
$form['submit'] = array('#type' => 'submit', '#value' => t('Save')); $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
...@@ -237,52 +250,52 @@ function taxonomy_form_term(&$form_state, $vocabulary, $edit = array()) { ...@@ -237,52 +250,52 @@ function taxonomy_form_term(&$form_state, $vocabulary, $edit = array()) {
'tid' => NULL, 'tid' => NULL,
'weight' => 0, 'weight' => 0,
); );
$form['name'] = array( $form['identification'] = array(
'#type' => 'fieldset',
'#title' => t('Identification'),
'#collapsible' => TRUE,
);
$form['identification']['name'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Term name'), '#title' => t('Term name'),
'#default_value' => $edit['name'], '#default_value' => $edit['name'],
'#maxlength' => 255, '#maxlength' => 255,
'#description' => t('The name of this term.'), '#description' => t('The name of this term.'),
'#required' => TRUE); '#required' => TRUE);
$form['identification']['description'] = array(
$form['description'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Description'), '#title' => t('Description'),
'#default_value' => $edit['description'], '#default_value' => $edit['description'],
'#description' => t('A description of the term.')); '#description' => t('A description of the term.'));
if ($vocabulary->hierarchy) { $form['advanced'] = array(
$parent = array_keys(taxonomy_get_parents($edit['tid'])); '#type' => 'fieldset',
$children = taxonomy_get_tree($vocabulary->vid, $edit['tid']); '#title' => 'Advanced options',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// A term can't be the child of itself, nor of its children. $parent = array_keys(taxonomy_get_parents($edit['tid']));
foreach ($children as $child) { $children = taxonomy_get_tree($vocabulary->vid, $edit['tid']);
$exclude[] = $child->tid;
}
$exclude[] = $edit['tid'];
if ($vocabulary->hierarchy == 1) { // A term can't be the child of itself, nor of its children.
$form['parent'] = _taxonomy_term_select(t('Parent'), 'parent', $parent, $vocabulary->vid, t('Parent term') .'.', 0, '<'. t('root') .'>', $exclude); foreach ($children as $child) {
} $exclude[] = $child->tid;
elseif ($vocabulary->hierarchy == 2) {
$form['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary->vid, t('Parent terms') .'.', 1, '<'. t('root') .'>', $exclude);
}
} }
$exclude[] = $edit['tid'];
if ($vocabulary->relations) { $form['advanced']['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary->vid, t('Parent terms') .'.', 1, '<'. t('root') .'>', $exclude);
$form['relations'] = _taxonomy_term_select(t('Related terms'), 'relations', array_keys(taxonomy_get_related($edit['tid'])), $vocabulary->vid, NULL, 1, '<'. t('none') .'>', array($edit['tid']));
}
$form['synonyms'] = array( $form['advanced']['synonyms'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Synonyms'), '#title' => t('Synonyms'),
'#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])), '#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])),
'#description' => t('Synonyms of this term, one synonym per line.')); '#description' => t('Synonyms of this term, one synonym per line.'));
$form['weight'] = array( $form['advanced']['weight'] = array(
'#type' => 'weight', '#type' => 'weight',
'#title' => t('Weight'), '#title' => t('Weight'),
'#default_value' => $edit['weight'], '#default_value' => $edit['weight'],
'#description' => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.')); '#description' => t('Vocabularies are displayed in ascending order by weight.'));
$form['vid'] = array( $form['vid'] = array(
'#type' => 'value', '#type' => 'value',
'#value' => $vocabulary->vid); '#value' => $vocabulary->vid);
......
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