Project

General

Profile

« Previous | Next » 

Revision 4feafea8

Added by Andreas Kohlbecker about 7 years ago

fix #6374 fixing messed up UUIDs and harmonizing use descriptions block creation

View differences:

modules/cdm_dataportal/cdm_api/uuids.php
89 89
  define('UUID_CITATION', '99b2842f-9aa7-42fa-bd5f-7285311e0101');
90 90
  define('UUID_ADDITIONAL_PUBLICATION', 'cb2eab09-6d9d-4e43-8ad2-873f23400930');
91 91
  define('UUID_USES', 'e5374d39-b210-47c7-bec1-bee05b5f1cb6');
92
  define('UUID_USE_SUMMARY', 'e6bd0bb0-7b1a-11e0-819a-0800200c9a66');
93
  define('UUID_USE', '6acb0348-c070-4512-a37c-67bcac016279');
94
  define('UUID_USE_RECORD', '8125a59d-b4d5-4485-89ea-67306297b599');
95

  
92 96
  define('UUID_CONSERVATION', '4518fc20-2492-47de-b345-777d2b83c9cf');
93 97
  define('UUID_CULTIVATION', 'e28965b2-a367-48c5-b954-8afc8ac2c69b');
94 98
  define('UUID_INTRODUCTION', 'e75255ca-8ff4-4905-baad-f842927fe1d3');
......
101 105
  define('UUID_CHROMOSOMES', 'c4a60319-4978-4692-9545-58d60cf8379e');
102 106
  define('UUID_CHROMOSOMES_NUMBERS', '6f677e98-d8d5-4bc5-80bf-affdb7e3945a');
103 107

  
104
  define('UUID_USE_RECORD', 'e5374d39-b210-47c7-bec1-bee05b5f1cb6');
105
  define('UUID_USE', '6acb0348-c070-4512-a37c-67bcac016279');
106 108

  
107 109
  // SpecimenTypeDesignationStatus.
108 110
  define('UUID_STD_HOLOTYPE', 'a407dbc7-e60c-46ff-be11-eddf4c5a970d');
modules/cdm_dataportal/includes/descriptions.inc
685 685

  
686 686
    $gallery_settings = getGallerySettings(CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME);
687 687

  
688
    $use_description_features = array(UUID_USE);
689

  
688 690

  
689 691
    RenderHints::pushToRenderStack('feature_block');
690 692
    // Create a drupal block for each feature
......
703 705
        $block->content = array();
704 706
        $block_content_is_empty = TRUE;
705 707

  
708
        if(array_search($node->feature->uuid, $use_description_features) !== false) {
709
          // do not show features which belong to the UseDescriptions, these are
710
          // handled by theme_cdm_block_Uses where the according descriptions are
711
          // fetched again separately.
712
          // UseDescriptions are a feature special to palmweb
713
          continue;
714
        }
715

  
706 716
        /*
707 717
         * Content/DISTRIBUTION.
708 718
         */
......
710 720
          $block = compose_feature_block_distribution($taxon, $node->descriptionElements, $node->feature);
711 721
          $block_content_is_empty = FALSE;
712 722
        }
723

  
713 724
        /*
714 725
         * Content/COMMON_NAME.
715 726
         */
......
719 730
          $block_content_is_empty = FALSE;
720 731
        }
721 732

  
733
        /*
734
         * Contend/Use Description (Use + UseRecord)
735
         */
722 736
        else if ($node->feature->uuid == UUID_USE_RECORD) {
723
          $block_uses_content_html = theme('cdm_block_Uses', array('taxonUuid' => $taxon->uuid));
724
          $block->content[] = markup_to_render_array($block_uses_content_html);
737
          $block->content[] = cdm_block_use_description_content($taxon->uuid);
725 738
          $block_content_is_empty = FALSE;
726 739
        }
727 740

  
......
1752 1765
  /**
1753 1766
   * Provides the merged feature tree for a taxon profile page.
1754 1767
   *
1755
   * The merging of the profile feature tree is actully done in
1768
   * The merging of the profile feature tree is actually done in
1756 1769
   * _mergeFeatureTreeDescriptions(). See this method  for details
1757 1770
   * on the structure of the merged tree.
1758 1771
   *
1759
   * This method provides t hook which can be used to modify the
1772
   * This method provides a hook which can be used to modify the
1760 1773
   * merged feature tree after it has been created, see
1761 1774
   * hook_merged_taxon_feature_tree_alter()
1762 1775
   *
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
363 363
 * @see http://drupal.org/node/1354
364 364
 */
365 365
function theme_cdm_UseDescription($variables) {
366

  
367

  
368
  RenderHints::pushToRenderStack('block_Uses');
369

  
366 370
  $descriptions = $variables['description'];
367 371
  $taxonUuid = $variables['taxonUuid'];
368
  $out = '<div id="content"><ul id="Description" class ="description">';
372
  $out = '<ul id="Description" class ="description">';
369 373
  if ($descriptions == NULL) {
370
    return;
374
    return '';
371 375
  }
372 376

  
373
  $feature_block_settings = get_feature_block_settings(UUID_DISTRIBUTION);
377
  $feature_block_settings = get_feature_block_settings(UUID_DISTRIBUTION); //FIXME wrong UUID here
374 378

  
375 379
  $descriptionSynonyms = '';
376 380
  $descriptionOut = '';
......
478 482
  }
479 483
  $out .= $descriptionOut . $synonymOut;
480 484
  $out .= "</ul></div>";
485

  
486
  RenderHints::popFromRenderStack();
487

  
481 488
  return $out;
482 489
}
483 490

  
484 491

  
485 492
/**
486
 * The theming function for a block of Uses Descriptions for a given taxon.
493
 * Provides the content for a block of Uses Descriptions for a given taxon.
494
 *
495
 * Fetches the list of TaxonDescriptions tagged with the MARKERTYPE_USE
496
 * and passes them to the theme function theme_cdm_UseDescription().
487 497
 *
488
 * The Uses block has been removed from the code but the according theme function
489
 * is kept for compatibility reasons with existing code regarding palmweb.
498
 * @param string $taxon_uuid
499
 *   The uuid of the Taxon
490 500
 *
501
 * @return array
502
 *   A drupal render array
491 503
 */
492
function theme_cdm_block_Uses($variables) {
493
  $taxonUuid = $variables['taxonUuid'];
494
  RenderHints::pushToRenderStack('block_Uses');
504
function cdm_block_use_description_content($taxon_uuid) {
495 505

  
496
  if ($taxonUuid == NULL) {
497
    return;
498
  }
499
  $out = '';
500
  $markerTypes = array();
501
  $markerTypes['markerTypes'] = UUID_MARKERTYPE_USE;
502
  $useDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxonUuid . '/descriptions', $markerTypes);
503
  if (!empty($useDescriptions)) {
504
    // FIXME use theme_block instaed of hardcoding the block html here !!!!
505
    $out .= '<div id="block-cdm_dataportal-feature-description" class="clear-block block block-cdm_dataportal-feature"><H2><a name="userecords"> </a> Uses </H2>';
506
    $formatUseDescriptions = theme('cdm_UseDescription', array('description' => $useDescriptions, 'taxonUuid' => $taxonUuid));
507

  
508
    $out .= $formatUseDescriptions;
509
    $out .= "</div>";
506
  $use_description_content = '';
507

  
508
  if (is_uuid($taxon_uuid )) {
509
    $markerTypes = array();
510
    $markerTypes['markerTypes'] = UUID_MARKERTYPE_USE;
511
    $useDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxon_uuid . '/descriptions', $markerTypes);
512
    if (!empty($useDescriptions)) {
513
      $use_description_content = theme('cdm_UseDescription', array('description' => $useDescriptions, 'taxonUuid' => $taxon_uuid));
514
    }
510 515
  }
511 516

  
512
  return $out;
517
  return markup_to_render_array($use_description_content);
513 518
}
modules/cdm_dataportal/theme/theme_registry.inc
81 81
    'cdm_list_IdentificationKeys' => array('variables' => array('type' => NULL, 'taxonUuid' => NULL)),
82 82
    'cdm_block_IdentificationKeys' => array('variables' => array('taxonUuid' => NULL)),
83 83
    'cdm_UseDescription' => array('variables' => array('description' => NULL, 'taxonUuid' => NULL)),
84
    'cdm_block_Uses' => array('variables' => array('taxonUuid' => NULL)),
85 84

  
86 85
    // Themes in cdm_dataportal.media.theme.
87 86
    'cdm_media_mime_application' => array('variables' => array('mediaRepresentation' => NULL, 'feature' => NULL)),

Also available in: Unified diff