| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_browser.module,v 1.19.2.11.2.21 2008/08/14 14:27:30 nancyw Exp $ |
// $Id: taxonomy_browser.module,v 1.19.2.11.2.22 2008/09/25 20:43:33 nancyw Exp $ |
| 3 |
// Original by Moshe Weitzman (weitzmna@tejasa.com) |
// Original by Moshe Weitzman (weitzmna@tejasa.com) |
| 4 |
|
|
| 5 |
/** |
/** |
| 132 |
|
|
| 133 |
$form['taxonomy_browser_collapse'] = array( |
$form['taxonomy_browser_collapse'] = array( |
| 134 |
'#title' => t('Make vocabularies collapsible'), |
'#title' => t('Make vocabularies collapsible'), |
| 135 |
'#type' => 'checkbox', |
'#type' => 'radios', |
| 136 |
'#default_value' => variable_get('taxonomy_browser_collapse', FALSE), |
'#options' => array('Not collapsible', 'Collapsed by default', 'Collapsible, but not collapsed'), |
| 137 |
|
'#default_value' => variable_get('taxonomy_browser_collapse', 0), |
| 138 |
'#description' => t('Do you want to display of the terms within a vocabulary to be collapsible? Requires "Check boxes" above.'), |
'#description' => t('Do you want to display of the terms within a vocabulary to be collapsible? Requires "Check boxes" above.'), |
| 139 |
|
'#prefix' => '<div class="taxonomy_browser_radios">', |
| 140 |
|
'#suffix' => '</div>', |
| 141 |
); |
); |
| 142 |
|
|
| 143 |
$form['taxonomy_browser_default_op'] = array( |
$form['taxonomy_browser_default_op'] = array( |
| 222 |
&& $form_state['values']['taxonomy_browser_show_unused'] == TRUE) { |
&& $form_state['values']['taxonomy_browser_show_unused'] == TRUE) { |
| 223 |
form_set_error('taxonomy_browser_show_unused', t('"Show unused" requires "count nodes."')); |
form_set_error('taxonomy_browser_show_unused', t('"Show unused" requires "count nodes."')); |
| 224 |
} |
} |
| 225 |
|
if ($form_state['values']['taxonomy_browser_collapse'] != 0 |
| 226 |
|
&& $form_state['values']['taxonomy_browser_select_type'] != 1) { |
| 227 |
|
form_set_error('taxonomy_browser_collapse', t('"Make vocabularies collapsible" requires "Check boxes."')); |
| 228 |
|
} |
| 229 |
} |
} |
| 230 |
|
|
| 231 |
//******************************************************************** |
//******************************************************************** |
| 245 |
$form = array(); |
$form = array(); |
| 246 |
$selection_types = array('select', 'checkboxes'); |
$selection_types = array('select', 'checkboxes'); |
| 247 |
$select_type = $selection_types[variable_get('taxonomy_browser_select_type', 1)]; |
$select_type = $selection_types[variable_get('taxonomy_browser_select_type', 1)]; |
| 248 |
$collapsible = variable_get('taxonomy_browser_collapse', FALSE) && ($select_type == 'checkboxes'); |
$collapsible = variable_get('taxonomy_browser_collapse', 0); |
| 249 |
$count_nodes = variable_get('taxonomy_browser_count_nodes', FALSE); |
$count_nodes = variable_get('taxonomy_browser_count_nodes', FALSE); |
| 250 |
$show_unused = variable_get('taxonomy_browser_show_unused', FALSE); |
$show_unused = variable_get('taxonomy_browser_show_unused', FALSE); |
| 251 |
$allow_children = variable_get('taxonomy_browser_allow_children', FALSE); |
$allow_children = variable_get('taxonomy_browser_allow_children', FALSE); |
| 394 |
} |
} |
| 395 |
|
|
| 396 |
$vocname = check_plain($voc->name); |
$vocname = check_plain($voc->name); |
| 397 |
$description = $voc->description ? decode_entities(check_markup($voc->description)) : NULL; |
$description = $voc->description ? check_markup($voc->description) : NULL; |
| 398 |
if (variable_get('taxonomy_browser_show_types', FALSE)) { |
if (variable_get('taxonomy_browser_show_types', FALSE)) { |
| 399 |
$description .= t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => (empty($node_type_list) ? '<em>'. t('nothing') .'</em>' : $node_type_list))); |
$used_for = t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => (empty($node_type_list) ? '<em>'. t('nothing') .'</em>' : $node_type_list))); |
| 400 |
} |
} |
| 401 |
|
|
| 402 |
if (!empty($term_opts)) { |
if (!empty($term_opts)) { |
| 405 |
'#title' => $vocname, |
'#title' => $vocname, |
| 406 |
'#options' => $term_opts, |
'#options' => $term_opts, |
| 407 |
'#multiple' => TRUE, |
'#multiple' => TRUE, |
| 408 |
'#description' => $description, |
'#description' => $collapsible ? $used_for : $description . $used_for, |
| 409 |
'#prefix' => '<div class="taxonomy_browser_'. $select_type .'">', |
'#prefix' => '<div class="taxonomy_browser_'. $select_type .'">', |
| 410 |
'#suffix' => '</div>', |
'#suffix' => '</div>', |
| 411 |
'#field_suffix' => $node_type_list, |
'#field_suffix' => $node_type_list, |
| 418 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 419 |
'#title' => $vocname, |
'#title' => $vocname, |
| 420 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 421 |
'#collapsed' => TRUE, |
'#collapsed' => $collapsible == 1, |
| 422 |
|
'#description' => $description, |
| 423 |
); |
); |
| 424 |
$form['taxonomy'][$fld_set][$v] = $voc_element; |
$form['taxonomy'][$fld_set][$v] = $voc_element; |
| 425 |
} |
} |