/[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.29, Thu Jun 26 16:30:54 2008 UTC revision 1.19.2.30, Tue Jul 22 00:47:13 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: taxonomy_browser.module,v 1.19.2.28 2008/06/20 04:08:03 nancyw Exp $  // $Id: taxonomy_browser.module,v 1.19.2.29 2008/06/26 16:30:54 nancyw Exp $
3  // Original by Moshe Weitzman (weitzmna@tejasa.com)  // Original by Moshe Weitzman (weitzmna@tejasa.com)
4    
5  /**  /**
# Line 342  function taxonomy_browser_form() { Line 342  function taxonomy_browser_form() {
342      $voc = taxonomy_get_vocabulary($v);      $voc = taxonomy_get_vocabulary($v);
343    
344      $voc_node_types = array();      $voc_node_types = array();
345      foreach ($voc->nodes as $key => $type) {      if (isset($voc->nodes) && !empty($voc->nodes[0])) {
346        $voc_node_types[] = $node_types[$type];        foreach ($voc->nodes as $key => $type) {
347      }          $voc_node_types[] = $node_types[$type];
348      $count_types = count($voc_node_types);        }
     if (count($voc_node_types) == 1) {  
       $node_type_list = $voc_node_types[0];  
349      }      }
350      else {      else {
351        $node_type_list = implode(', ', $voc_node_types);        drupal_set_message(t('The %name vocabulary does not appear to be associated with any content types.', array('%name' => $voc->name)), 'error');
352      }      }
353    
354        $count_types = count($voc_node_types);
355        $node_type_list = implode(', ', $voc_node_types);
356    
357      $tree = taxonomy_get_tree($v);      $tree = taxonomy_get_tree($v);
358      $term_opts = array();      $term_opts = array();
359    
# Line 375  function taxonomy_browser_form() { Line 376  function taxonomy_browser_form() {
376        }        }
377      }      }
378    
379      $vocname = filter_xss($voc->name);      $vocname = check_plain($voc->name);
380        $description = $voc->description ? decode_entities(check_markup($voc->description)) : null;
381        $description .= t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => (empty($node_type_list) ? '<em>'. t('nothing') .'</em>' : $node_type_list)));
382      if (!empty($term_opts)) {      if (!empty($term_opts)) {
383        $form['taxonomy'][$v] = array(        $form['taxonomy'][$v] = array(
384          '#type' => $select_type,          '#type' => $select_type,
385          '#title' => $vocname,          '#title' => $vocname,
386          '#options' => $term_opts,          '#options' => $term_opts,
387          '#multiple' => true,          '#multiple' => true,
388          '#description' => $voc->description          '#description' => $description,
            .' &nbsp;'. t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => $node_type_list)),  
389          '#size' => min(10, count($term_opts)),          '#size' => min(10, count($term_opts)),
390          '#prefix' => '<div class="taxonomy_browser_'. $select_type .'">',          '#prefix' => '<div class="taxonomy_browser_'. $select_type .'">',
391          '#suffix' => '</div>',          '#suffix' => '</div>',
# Line 393  function taxonomy_browser_form() { Line 395  function taxonomy_browser_form() {
395        ++$i;        ++$i;
396      }      }
397    }    }
398    
399    $form['submit'] = array(    $form['submit'] = array(
400      '#type' => 'submit',      '#type' => 'submit',
401      '#value' => t('Search'),      '#value' => t('Search'),
402      '#submit' => TRUE,      '#submit' => TRUE,
403      );      );
404    
405    return $form;    return $form;
406  }  }
407    

Legend:
Removed from v.1.19.2.29  
changed lines
  Added in v.1.19.2.30

  ViewVC Help
Powered by ViewVC 1.1.2