/[drupal]/contributions/modules/taxonomy_browser/taxonomy_browser.module
ViewVC logotype

Diff of /contributions/modules/taxonomy_browser/taxonomy_browser.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.19.2.32, Thu Sep 25 20:43:50 2008 UTC revision 1.19.2.33, Sat Feb 7 02:20:24 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: taxonomy_browser.module,v 1.19.2.31 2008/08/14 14:27:13 nancyw Exp $  // $Id: taxonomy_browser.module,v 1.19.2.32 2008/09/25 20:43:50 nancyw Exp $
3  // Original by Moshe Weitzman (weitzmna@tejasa.com)  // Original by Moshe Weitzman (weitzmna@tejasa.com)
4    
5  /**  /**
# Line 132  function taxonomy_browser_admin_settings Line 132  function taxonomy_browser_admin_settings
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(
# Line 223  function taxonomy_browser_admin_settings Line 226  function taxonomy_browser_admin_settings
226      && $form_values['taxonomy_browser_show_unused'] == TRUE) {      && $form_values['taxonomy_browser_show_unused'] == TRUE) {
227      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."'));
228    }    }
229      if ($form_values['taxonomy_browser_collapse'] != 0
230        && $form_values['taxonomy_browser_select_type'] != 1) {
231        form_set_error('taxonomy_browser_collapse', t('"Make vocabularies collapsible" requires "Check boxes."'));
232      }
233  }  }
234    
235    
236  //********************************************************************  //********************************************************************
237  //* Module Functions : Public  //* Module Functions : Public
238  //********************************************************************  //********************************************************************
# Line 242  function taxonomy_browser_form() { Line 250  function taxonomy_browser_form() {
250    $form = array();    $form = array();
251    $selection_types = array('select', 'checkboxes');    $selection_types = array('select', 'checkboxes');
252    $select_type = $selection_types[variable_get('taxonomy_browser_select_type', 1)];    $select_type = $selection_types[variable_get('taxonomy_browser_select_type', 1)];
253    $collapsible = variable_get('taxonomy_browser_collapse', FALSE) && ($select_type == 'checkboxes');    $collapsible = variable_get('taxonomy_browser_collapse', 0);
254    $count_nodes = variable_get('taxonomy_browser_count_nodes', FALSE);    $count_nodes = variable_get('taxonomy_browser_count_nodes', FALSE);
255    $show_unused = variable_get('taxonomy_browser_show_unused', FALSE);    $show_unused = variable_get('taxonomy_browser_show_unused', FALSE);
256    $allow_children = variable_get('taxonomy_browser_allow_children', FALSE);    $allow_children = variable_get('taxonomy_browser_allow_children', FALSE);
# Line 391  function taxonomy_browser_form() { Line 399  function taxonomy_browser_form() {
399      }      }
400    
401      $vocname = check_plain($voc->name);      $vocname = check_plain($voc->name);
402      $description = $voc->description ? decode_entities(check_markup($voc->description)) : NULL;      $description = $voc->description ? check_markup($voc->description) : NULL;
403      if (variable_get('taxonomy_browser_show_types', FALSE)) {      if (variable_get('taxonomy_browser_show_types', FALSE)) {
404        $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)));
405      }      }
406    
407      if (!empty($term_opts)) {      if (!empty($term_opts)) {
# Line 402  function taxonomy_browser_form() { Line 410  function taxonomy_browser_form() {
410          '#title' => $vocname,          '#title' => $vocname,
411          '#options' => $term_opts,          '#options' => $term_opts,
412          '#multiple' => TRUE,          '#multiple' => TRUE,
413          '#description' => $description,          '#description' => $collapsible ? $used_for : $description . $used_for,
414          '#prefix' => '<div class="taxonomy_browser_'. $select_type .'">',          '#prefix' => '<div class="taxonomy_browser_'. $select_type .'">',
415          '#suffix' => '</div>',          '#suffix' => '</div>',
416          '#field_suffix' => $node_type_list,          '#field_suffix' => $node_type_list,
# Line 415  function taxonomy_browser_form() { Line 423  function taxonomy_browser_form() {
423            '#type' => 'fieldset',            '#type' => 'fieldset',
424            '#title' => $vocname,            '#title' => $vocname,
425            '#collapsible' => TRUE,            '#collapsible' => TRUE,
426            '#collapsed' => TRUE,            '#collapsed' => $collapsible == 1,
427              '#description' => $description,
428            );            );
429          $form['taxonomy'][$fld_set][$v] = $voc_element;          $form['taxonomy'][$fld_set][$v] = $voc_element;
430        }        }

Legend:
Removed from v.1.19.2.32  
changed lines
  Added in v.1.19.2.33

  ViewVC Help
Powered by ViewVC 1.1.2