Project

General

Profile

« Previous | Next » 

Revision 9128dcb4

Added by Andreas Kohlbecker over 7 years ago

ref #6201 adapting portal to changes in taxon/{uuid}/accepted service

View differences:

modules/cdm_dataportal/cdm_api/webservice_uris.php
27 27
 * parameter taxonUuid. If the taxon specified by taxonUuid is itself the
28 28
 * accepted taxon, this one will be returned.
29 29
 */
30
define('CDM_WS_PORTAL_TAXON_ACCEPTED', 'portal/taxon/$0/accepted/$1');
30
define('CDM_WS_PORTAL_TAXON_ACCEPTED', 'portal/taxon/$0/accepted');
31 31

  
32 32
define('CDM_WS_PORTAL_TAXON', 'portal/taxon');
33 33
define('CDM_WS_PORTAL_TAXON_SYNONYMY', 'portal/taxon/$0/synonymy');
modules/cdm_dataportal/cdm_dataportal.module
1736 1736
    $singleTaxon = array_pop($taxon_pager->records);
1737 1737
    if ($singleTaxon->class != "Taxon") {
1738 1738
      // It is a Synonym -> look for the accepted.
1739
      $accepted_taxa = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED, array($singleTaxon->uuid, get_current_classification_uuid()));
1739
      $accepted_taxa = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED, array($singleTaxon->uuid), 'classificationFilter=' . get_current_classification_uuid());
1740 1740
      if (!empty($highlite_synonym_uuid)) {
1741 1741
        drupal_goto('cdm_dataportal/taxon/' . $accepted_taxa[0]->uuid . '/synonymy', array('query' => array('highlite' => $highlite_synonym_uuid)));
1742 1742
      }
modules/cdm_dataportal/includes/taxon.inc
437 437
  $table_of_accepted = array();
438 438

  
439 439
  foreach ($synonym_uuids as $relatedUuid) {
440
    $table_of_accepted[$relatedUuid] = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED, array(
441
      $relatedUuid,
442
      $searched_in_classification_uuid,
443
    ));
440
    $table_of_accepted[$relatedUuid] = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED,
441
      array($relatedUuid),
442
      'classificationFilter=' . $searched_in_classification_uuid
443
    );
444 444
  }
445 445

  
446 446
  foreach ($misappied_uuids as $relatedUuid) {
......
463 463
      $is_synonym = isset($synonym_uuids[$taxon->uuid]); //TODO better use the $taxon->class attribute?
464 464
      $taxon_type = $is_synonym ? "Synonym" : "misapplied-name";
465 465

  
466
      $acceptedTaxa = $table_of_accepted[$taxon->uuid];
466
      $acceptedTaxon = $table_of_accepted[$taxon->uuid];
467 467

  
468
      if (count($acceptedTaxa) == 1) {
468
      if (is_object($acceptedTaxon)) {
469 469

  
470
        $acceptedTaxon = $acceptedTaxa[0];
471 470
        $taxonUri = uri_to_synonym($taxon->uuid, $acceptedTaxon->uuid);
472 471
        $referenceUri = '';
473 472
        if (isset($acceptedTaxon->name->nomenclaturalReference)) {
......
485 484
              $classification_titles[] = $classification->titleCache;
486 485
            }
487 486
          }
488
          if(count($classification_titles) == 0){
487
          if (count($classification_titles) == 0) {
489 488
            $classification_titles[] = $unclassified_snippet;
490 489
          }
491 490
          $out .= ' : <span class="classifications">' . implode(', ', $classification_titles) . '</span>';
......
495 494
          $out .= theme('cdm_taxon_list_thumbnails', array('taxon' => $acceptedTaxon));
496 495
        }
497 496
      }
498
      else {
499

  
500
        // TODO avoid using Ajax in the cdm_dynabox .... why?
501
        // TODO add media.
502
        $out .= cdm_dynabox(
503
          $taxon->uuid,
504
          render_taxon_or_name($taxon->name, NULL, NULL, FALSE),
505
          cdm_compose_url(CDM_WS_PORTAL_TAXON_ACCEPTED,
506
            array(
507
              $taxon->uuid,
508
              $searched_in_classification_uuid
509
            )
510
          ),
511
          'cdm_list_of_taxa',
512
          'show accepted taxa of this ' . $taxon_type,
513
          array('li', 'ul'),
514
          array('class' => array($taxon_type))
515
        );
516
      }
517 497
    }
518 498
    else {
519 499
      // Its a Taxon.

Also available in: Unified diff