Project

General

Profile

« Previous | Next » 

Revision ef686dd8

Added by Andreas Kohlbecker over 4 years ago

fix #7975 fix #8196 name relationships list representation implemented

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
1242 1242
 *   An additional element do be placed at the beginning og the list. This element will be the default option.
1243 1243
 *
1244 1244
 * @return array
1245
 *   the terms in an array as options for a form element that allows multiple choices.
1245
 *   the terms in an array (key: uuid => value: label) as options for a form element that allows multiple choices.
1246

  
1246 1247
 */
1247 1248
function cdm_terms_as_options($terms, $term_label_callback = NULL, $empty_option = FALSE){
1248 1249
  $options = array();
......
1279 1280
 *   so a boolean 'true' can be matched by '/true/'
1280 1281
 * @param string $order_by
1281 1282
 *   One of the order by constants defined in this file
1282
 * @return mixed
1283
 * @return array
1284
 *   the terms in an array (key: uuid => value: label) as options for a form element that allows multiple choices.
1283 1285
 */
1284 1286
function cdm_vocabulary_as_option($vocabulary_uuid, $term_label_callback = NULL, $empty_option = FALSE,
1285 1287
                                  array $include_filter = null, $order_by = CDM_ORDER_BY_ORDER_INDEX_ASC) {
......
1374 1376
 * @param bool $empty_option
1375 1377
 *   An additional element do be placed at the beginning og the list. This element will be the default option.
1376 1378
 * @return array
1377
 *    the terms in an array as options for a form element that allows multiple choices.
1379
 *    the terms in an array (key: uuid => value: label) as options for a form element that allows multiple choices.
1378 1380
 */
1379 1381
function cdm_terms_by_type_as_option($term_type, $order_by = CDM_ORDER_BY_TITLE_CACHE_ASC, $term_label_callback = NULL, $empty_option = FALSE){
1380 1382
  $terms = cdm_ws_fetch_all(
......
1456 1458
  }
1457 1459
}
1458 1460

  
1461
/**
1462
 * Returns the localized abbreviated label of the relationship term.
1463
 *
1464
 * In case the abbreviated label is not set the normal representation is returned.
1465
 *
1466
 * @param $term
1467
 * @param bool $is_inverse_relation
1468
 * @return string
1469
 *   The abbreviated label
1470
 */
1471
function cdm_relationship_type_term_abbreviated_label($term, $is_inverse_relation = false){
1472

  
1473
  if($is_inverse_relation) {
1474
    if (isset($term->inverseRepresentation_L10n_abbreviatedLabel) && $term->inverseRepresentation_L10n_abbreviatedLabel) {
1475
      $abbr_label = $term->inverseResentation_L10n_abbreviatedLabel;
1476
    } else {
1477
      $abbr_label = $term->inverseRepresentation_L10n;
1478
    }
1479
  } else {
1480
    if (isset($term->representation_L10n_abbreviatedLabel) && $term->representation_L10n_abbreviatedLabel) {
1481
      $abbr_label = $term->representation_L10n_abbreviatedLabel;
1482
    } else {
1483
      $abbr_label = $term->representation_L10n;
1484
    }
1485
  }
1486
  return $abbr_label;
1487
}
1488

  
1489
/**
1490
 * Returns the symbol of the relationship term.
1491
 *
1492
 * In case the symbol is not set the function falls back to use the abbreviated label or
1493
 * the normal representation..
1494
 *
1495
 * @param $term
1496
 * @param bool $is_inverse_relation
1497
 * @return string
1498
 *   The abbreviated label
1499
 */
1500
function cdm_relationship_type_term_symbol($term, $is_inverse_relation = false){
1501

  
1502
  if($is_inverse_relation) {
1503
    if (isset($term->inverseSymbol) && $term->inverseSymbol) {
1504
      $symbol = $term->inverseSymbol;
1505
    } else if (isset($term->inverseRepresentation_L10n_abbreviatedLabel) && $term->inverseRepresentation_L10n_abbreviatedLabel) {
1506
      $symbol = $term->inverseResentation_L10n_abbreviatedLabel;
1507
    } else {
1508
      $symbol = $term->inverseRepresentation_L10n;
1509
    }
1510
  } else {
1511
    if (isset($term->symbol) && $term->symbol) {
1512
      $symbol = $term->symbol;
1513
    } else if (isset($term->representation_L10n_abbreviatedLabel) && $term->representation_L10n_abbreviatedLabel) {
1514
      $symbol = $term->representation_L10n_abbreviatedLabel;
1515
    } else {
1516
      $symbol = $term->representation_L10n;
1517
    }
1518
  }
1519
  return $symbol;
1520
}
1521

  
1459 1522
// ========================================================================================== //
1460 1523
/**
1461 1524
 * @todo Improve documentation of this function.
modules/cdm_dataportal/cdm_api/uuids.php
76 76
  define('UUID_NAMERELATIONSHIPTYPE_LATER_VALIDATED_BY_NAME', 'a25ee4c1-863a-4dab-9499-290bf9b89639');
77 77
  define('UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR', '1dab357f-2e12-4511-97a4-e5153589e6a6');
78 78

  
79

  
80 79
  // Features.
81 80
  define('UUID_UNKNOWN', '910307f1-dc3c-452c-a6dd-af5ac7cd365c');
82 81
  define('UUID_DESCRIPTION', '9087cdcd-8b08-4082-a1de-34c9ba9fb493');
modules/cdm_dataportal/cdm_dataportal.css
273 273
    margin: 0;
274 274
}
275 275

  
276
/* the relationships_list can replace the unordered list styles */
277
.relationships_list {
278
    margin-top: 1em;
279
    margin-bottom: 1em;
280
}
281

  
282
.relationships_list .item {
283
    padding-left: 26px ;
284
    text-indent: -26px ;
285
}
286

  
276 287
#synonymy ul.heterotypicSynonymyGroup,
277 288
#synonymy ul.homotypicSynonymyGroup,
278 289
#synonymy ul.homotypicSynonyms,
modules/cdm_dataportal/includes/name.inc
581 581
    $name = cdm_ws_get(CDM_WS_PORTAL_NAME, $registration_dto->nameRef->uuid);
582 582
    $render_array['published_name'] = markup_to_render_array('<p class="published-name">' . render_taxon_or_name($name) . '</p>', 0);
583 583
    $name_relations = cdm_ws_fetch_all(str_replace("$0", $registration_dto->nameRef->uuid, CDM_WS_PORTAL_NAME_NAME_RELATIONS));
584
    $render_array['name_relations'] = markup_to_render_array(render_name_relationships_inline($name_relations, $registration_dto->nameRef->uuid, null, false));
584
    $render_array['name_relations'] = compose_name_relationships_list($name_relations, $registration_dto->nameRef->uuid, null, false);
585 585
    $render_array['name_relations']['#weight'] = 10;
586 586
  } else {
587 587
    // in this case the registration must have a
......
907 907
}
908 908

  
909 909
/**
910
 * Renders an inline representation of the name relationships.
910
 * @param $name_rel
911
 * @param $current_name_uuid
912
 * @param $current_taxon_uuid
913
 * @param $suppress_if_current_name_is_source // FIXME UNUSED !!!!
914
 * @param $show_name_cache_only
915
 *    The nameCache will be shown instead of the titleCache if this parameter is true.
916
 * @return null|string
917
 */
918
function name_relationship_markup($name_rel, $current_name_uuid, $current_taxon_uuid, $suppress_if_current_name_is_source, $show_name_cache_only = false){
919

  
920
  $relationship_markup = null;
921

  
922
  $current_name_is_toName = $current_name_uuid == $name_rel->toName->uuid;
923

  
924
  if($current_name_is_toName){
925
    $name = $name_rel->fromName;
926
  } else {
927
    $name = $name_rel->toName;
928
  }
929

  
930
  $highlited_synonym_uuid = isset ($name->taxonBases[0]->uuid) ? $name->taxonBases[0]->uuid : '';
931
  if(!$show_name_cache_only){
932
    $relationship_markup = render_taxon_or_name($name,
933
      url(path_to_name($name->uuid, $current_taxon_uuid, $highlited_synonym_uuid))
934
    );
935
  } else {
936
    $relationship_markup = l(
937
      '<span class="' . html_class_attribute_ref($name) . '"">' . $name->nameCache . '</span>',
938
      path_to_name($name->uuid, $current_taxon_uuid, $highlited_synonym_uuid),
939
      array('html' => true)
940
    );
941
  }
942

  
943
  return $relationship_markup;
944
}
945

  
946

  
947
/**
948
 * Renders an inline representation of selected name relationships
911 949
 *
912 950
 * The output of this function will be usually appended to taxon name representations.
951
 * Only the following types are displayed: LATER_HOMONYM, TREATED_AS_LATER_HOMONYM, BLOCKING_NAME_FOR, ORTHOGRAPHIC_VARIANT
952
 *
953
 * LATER_HOMONYM, TREATED_AS_LATER_HOMONYM, BLOCKING_NAME_FOR are displayed as
954
 * non {titleCache} nec {titleCache} nec {titleCache} whereas the related names
955
 * are ordered alphabetically.
956
 *
957
 * ORTHOGRAPHIC_VARIANT is displayed as 'ort. var. {nameCache}'
913 958
 *
914 959
 * Related issues:
915 960
 *   - https://dev.e-taxonomy.eu/redmine/issues/5697 "Show name conserved against as [non xxx]"
916 961
 *   - https://dev.e-taxonomy.eu/redmine/issues/6678 "How to correctly show name relationship "orth. var." in dataportal"
917 962
 *   - https://dev.e-taxonomy.eu/redmine/issues/5857
963
 *   - https://dev.e-taxonomy.eu/redmine/issues/2001 "[Cichorieae Portal] Name Relationship -> blocking name are not shown"
918 964
 *
919 965
 * @param $name_relations
920 966
 *    The list of CDM NameRelationsips
......
933 979
 */
934 980
function render_name_relationships_inline($name_relations, $current_name_uuid, $current_taxon_uuid, $suppress_if_current_name_is_source = true) {
935 981

  
936
  static $inverse_name_rels_uuids = array(UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR);
937

  
938 982
  RenderHints::pushToRenderStack('homonym');
939 983
  // the render stack element homonyms is being used in the default render templates !!!, see CDM_NAME_RENDER_TEMPLATES_DEFAULT
940 984

  
941
  $selected_name_rel_uuids = variable_get(CDM_NAME_RELATIONSHIP_TYPES, unserialize(CDM_NAME_RELATIONSHIP_TYPES_DEFAULT));
985
  $selected_name_rel_uuids = variable_get(CDM_NAME_RELATIONSHIP_INLINE_TYPES, unserialize(CDM_NAME_RELATIONSHIP_INLINE_TYPES_DEFAULT));
942 986

  
943 987
  $relations_array = array();
944 988

  
......
948 992
        // skip if not selected in the settings
949 993
        continue;
950 994
      }
951
      $is_inverse_relation = array_search($name_rel->type->uuid, $inverse_name_rels_uuids) !== false;
952
      $is_current_name_to_name = $current_name_uuid == $name_rel->toName->uuid;
953
      $is_current_name_from_name = $current_name_uuid == $name_rel->fromName->uuid;
954
      $relationship_markup = null;
955

  
956
      if($is_current_name_to_name && ($suppress_if_current_name_is_source && $is_inverse_relation || !$suppress_if_current_name_is_source)){
957
        $highlited_synonym_uuid = isset ($name_rel->fromName->taxonBases[0]->uuid) ? $name_rel->fromName->taxonBases[0]->uuid : '';
958
        $relationship_markup = render_taxon_or_name($name_rel->fromName,
959
          url(path_to_name($name_rel->fromName->uuid, $current_taxon_uuid, $highlited_synonym_uuid))
960
        );
961
      } else if($is_current_name_from_name && ($suppress_if_current_name_is_source && !$is_inverse_relation || !$suppress_if_current_name_is_source)){
962
        $highlited_synonym_uuid = isset ($name_rel->toName->taxonBases[0]->uuid) ? $name_rel->toName->taxonBases[0]->uuid : '';
963
        $relationship_markup = render_taxon_or_name($name_rel->toName,
964
          url(path_to_name($name_rel->toName->uuid, $current_taxon_uuid, $highlited_synonym_uuid))
965
        );
966
      }
995

  
996
      $relationship_markup = name_relationship_markup($name_rel, $current_name_uuid, $current_taxon_uuid, $suppress_if_current_name_is_source);
967 997
        
968 998
      if($relationship_markup){
969 999
        if($name_rel->type->uuid == UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT){
......
986 1016
  return (count($relations_array) ?'<div class="name-relationships">[' . trim(join(" ", $relations_array)) . ']</div>' : '');
987 1017
}
988 1018

  
1019
/**
1020
 * Composes an list representation of the name relationships.
1021
 *
1022
 * The output of this function will be usually appended to taxon name representations.
1023
 *
1024
 * Related issues:
1025
 *   - https://dev.e-taxonomy.eu/redmine/issues/5697 "Show name conserved against as [non xxx]"
1026
 *   - https://dev.e-taxonomy.eu/redmine/issues/6678 "How to correctly show name relationship "orth. var." in dataportal"
1027
 *   - https://dev.e-taxonomy.eu/redmine/issues/5857
1028
 *
1029
 * @param $name_relations
1030
 *    The list of CDM NameRelationsips
1031
 * @param $current_name_uuid
1032
 *    The Uuid of the name for which the relations are to be rendered, the current name will be hidden when
1033
 *    rendering the relation an only the other name is shown. Parameter is REQUIRED.
1034
 * @param $suppress_if_current_name_is_source
1035
 *    The display of the relation will be
1036
 *    suppressed is the current name is on the source of the relation edge.
1037
 *    That is if it is on the from side of the relation. Except for 'blocking name for' which is
1038
 *    an inverse relation. For this relation type the toName is taken in to account.
1039
 * @param $current_taxon_uuid
1040
 *    The taxon to be omitted from related taxa. This is only used to create links, see path_to_name()
1041
 * @return array
1042
 *    A drupal render array
1043
 *
1044
 * @ingroup Compose
1045
 */
1046
function compose_name_relationships_list($name_relations, $current_name_uuid, $current_taxon_uuid, $suppress_if_current_name_is_source = true) {
1047

  
1048
  $non_nec_name_reltype_uuids = array(UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM,
1049
    UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM,
1050
    UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR);
1051
  // $ordered_name_relation_type_uuids = array_keys(cdm_terms_by_type_as_option('NameRelationshipType', CDM_ORDER_BY_ORDER_INDEX_ASC));
1052

  
1053
  RenderHints::pushToRenderStack('name_relationships');
1054
  RenderHints::setFootnoteListKey('name_relationships');
1055
  // the render stack element homonyms is being used in the default render templates !!!, see CDM_NAME_RENDER_TEMPLATES_DEFAULT
1056

  
1057
  $selected_name_rel_uuids = variable_get(CDM_NAME_RELATIONSHIP_LIST_TYPES, unserialize(CDM_NAME_RELATIONSHIP_LIST_TYPES_DEFAULT));
1058

  
1059
  $render_array = array(
1060
    'list' => array(
1061
      '#prefix' => '<div class="relationships_list name_relationships">',
1062
      '#suffix' => '</div>',
1063
      'items' => array()
1064
    ),
1065
    'footnotes' => array()
1066
  );
1067

  
1068
  if($name_relations) {
1069

  
1070
    // remove all relations which are not selected in the settings and
1071
    // sepearate all LATER_HOMONYM, TREATED_AS_LATER_HOMONYM, BLOCKING_NAME_FOR relations and ORTHOGRAPHIC_VARIANTs
1072
    // for special handling
1073
    $filtered_name_rels = array();
1074
    $non_nec_name_rels = array();
1075
    $orthographic_variants = array();
1076
    foreach($name_relations as $name_rel) {
1077
      if (isset($selected_name_rel_uuids[$name_rel->type->uuid]) && $selected_name_rel_uuids[$name_rel->type->uuid]) {
1078
        if(array_search($name_rel->type->uuid, $non_nec_name_reltype_uuids) !== false){
1079
          $non_nec_name_rels[] = $name_rel;
1080
        } else if(UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT == $name_rel->type->uuid) {
1081
          $orthographic_variants[] = $name_rel;
1082
        } else {
1083
          $filtered_name_rels[] = $name_rel;
1084
        }
1085
      }
1086
    }
1087
    $name_relations = $filtered_name_rels;
1088

  
1089
    usort($name_relations, 'compare_name_relations_by_term_order_index');
1090

  
1091
    foreach($name_relations as $name_rel) {
1092

  
1093
      $current_name_is_toName = $current_name_uuid == $name_rel->toName->uuid;
1094

  
1095
      $footnote_key_markup = name_relationship_footnote_markup($name_rel);
1096
      $relationship_markup = name_relationship_markup($name_rel, $current_name_uuid, $current_taxon_uuid, $suppress_if_current_name_is_source);
1097
      $is_inverse_relation = $current_name_is_toName;
1098

  
1099
      $label = cdm_relationship_type_term_abbreviated_label($name_rel->type, $is_inverse_relation);
1100
      $symbol = cdm_relationship_type_term_symbol($name_rel->type, $is_inverse_relation);
1101

  
1102
      $relationship_markup = '<span class="symbol" title="' . $label . '">' . $symbol . '</span> ' . $relationship_markup . $footnote_key_markup;
1103
      if($relationship_markup){
1104
        $render_array['list']['items'][] = markup_to_render_array($relationship_markup,
1105
          null,
1106
          '<div class="item">',
1107
          '</div>');
1108
      }
1109
    }
1110

  
1111
    // name relationships to be displayed as non nec
1112
    if(count($non_nec_name_rels) > 0){
1113
      $non_nec_markup = '';
1114
      foreach($non_nec_name_rels as $name_rel){
1115
        $footnote_key_markup = name_relationship_footnote_markup($name_rel);
1116
        $relationship_markup = name_relationship_markup($name_rel, $current_name_uuid, $current_taxon_uuid, $suppress_if_current_name_is_source);
1117
        $symbol = $non_nec_markup ? ' nec ' : 'non';
1118
        $non_nec_markup .= '<span class="symbol" title="' . $label . '">' . $symbol . '</span> ' . $relationship_markup . $footnote_key_markup;
1119
      }
1120
       if($non_nec_markup){
1121
         $render_array['list']['items'][] = markup_to_render_array($non_nec_markup,
1122
           null,
1123
           '<div class="item">',
1124
           '</div>');
1125
       }
1126
    }
1127

  
1128
    // orthographic variants
1129
    if(count($orthographic_variants) > 0){
1130
      foreach($orthographic_variants as $name_rel){
1131
        $footnote_key_markup = name_relationship_footnote_markup($name_rel);
1132
        $footnote_key_markup .= ($footnote_key_markup ? ', ' : '') . nomenclatural_reference_footnote_markup($name_rel->toName);
1133
        $relationship_markup = name_relationship_markup($name_rel, $current_name_uuid, $current_taxon_uuid, $suppress_if_current_name_is_source, TRUE);
1134
        $symbol = cdm_relationship_type_term_symbol($name_rel->type, $is_inverse_relation);
1135
        $relationship_markup = '<span class="symbol" title="' . $label . '">' . $symbol . '</span> ' . $relationship_markup . $footnote_key_markup;
1136
      }
1137
      if($relationship_markup){
1138
        $render_array['list']['items'][] = markup_to_render_array($relationship_markup,
1139
          null,
1140
          '<div class="item">',
1141
          '</div>');
1142
      }
1143
    }
1144
  }
1145

  
1146
  RenderHints::popFromRenderStack();
1147
  $render_array['footnotes'] = markup_to_render_array(theme('cdm_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey())));
1148
  RenderHints::clearFootnoteListKey();
1149

  
1150
  return $render_array;
1151
}
1152

  
1153
/**
1154
 * @param $name_rel
1155
 * @return string
1156
 */
1157
function name_relationship_footnote_markup($name_rel)
1158
{
1159
  $footnote_markup = '';
1160
  $footnote_key_markup = '';
1161
  if (isset($name_rel->ruleConsidered) && $name_rel) {
1162
    $footnote_markup = '<span class="rule_considered">' . $name_rel->ruleConsidered . '</span> ';
1163
  }
1164
  if (isset($name_rel->citation)) {
1165
    $footnote_markup .= '<span class="reference">' . $name_rel->citation->abbrevTitleCache . '</span>';
1166
  }
1167
  if (isset($name_rel->citationMicroReference)) {
1168
    $footnote_markup .= (isset($name_rel->citation) ? ':' : '') . '<span class="reference_detail">' . $name_rel->citationMicroReference . '</span>';
1169
  }
1170
  if ($footnote_markup) {
1171
    $fnkey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $footnote_markup);
1172
    $footnote_key_markup = theme('cdm_footnote_key', array(
1173
      'footnoteKey' => $fnkey,
1174
      'separator' => ',',
1175
      'highlightable' => TRUE,
1176
      'separator_off' => TRUE,
1177
    ));
1178
  }
1179
  return $footnote_key_markup;
1180
}
1181

  
1182
/**
1183
 * @param $name
1184
 * @return string
1185
 */
1186
function nomenclatural_reference_footnote_markup($name)
1187
{
1188
  $footnote_markup = '';
1189
  $footnote_key_markup = '';
1190
  if (isset($name->nomenclaturalReference) && $name->nomenclaturalReference) {
1191
    $footnote_markup .= '<span class="reference">' . $name->nomenclaturalReference->titleCache . '</span>';
1192
  }
1193
  if (isset($name->nomenclaturalMicroReference)) {
1194
    $footnote_markup .= ($footnote_key_markup ? ':' : '') . '<span class="reference_detail">' . $name->nomenclaturalMicroReference . '</span>';
1195
  }
1196
  if ($footnote_markup) {
1197
    $fnkey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $footnote_markup);
1198
    $footnote_key_markup = theme('cdm_footnote_key', array(
1199
      'footnoteKey' => $fnkey,
1200
      'separator' => ',',
1201
      'highlightable' => TRUE,
1202
      'separator_off' => TRUE,
1203
    ));
1204
  }
1205
  return $footnote_key_markup;
1206
}
1207

  
989 1208
/**
990 1209
 * @param $taxon
991 1210
 * @return array
......
1085 1304
  return $nameTypeLabelMap[$dtype];
1086 1305

  
1087 1306
}
1307

  
1308

  
1309
function compare_name_relations_by_term_order_index($name_rel1, $name_rel2){
1310
  return compare_terms_by_order_index($name_rel1->type, $name_rel2->type);
1311
}
modules/cdm_dataportal/settings.php
417 417
 */
418 418
define('CDM_TAXON_RELATIONSHIP_TYPES', 'cdm_taxon_relationship_types');
419 419

  
420
define('CDM_NAME_RELATIONSHIP_TYPES', 'cdm_name_relationship_types');
421
define('CDM_NAME_RELATIONSHIP_TYPES_DEFAULT', serialize(
420
define('CDM_NAME_RELATIONSHIP_INLINE_TYPES', 'cdm_name_relationship_types');
421
define('CDM_NAME_RELATIONSHIP_INLINE_TYPES_DEFAULT', serialize(
422 422
    array(
423 423
      UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM,
424 424
      UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM,
......
427 427
  )
428 428
);
429 429

  
430
define('CDM_NAME_RELATIONSHIP_LIST_TYPES', 'cdm_name_relationship_list_types');
431
define('CDM_NAME_RELATIONSHIP_LIST_TYPES_DEFAULT', serialize(
432
    array(
433
      UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM,
434
      UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM,
435
      UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR => UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR,
436
      UUID_NAMERELATIONSHIPTYPE_BASIONYM => UUID_NAMERELATIONSHIPTYPE_BASIONYM,
437
      UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT => UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT,
438
      UUID_NAMERELATIONSHIPTYPE_VALIDATED_BY_NAME => UUID_NAMERELATIONSHIPTYPE_VALIDATED_BY_NAME,
439
      UUID_NAMERELATIONSHIPTYPE_LATER_VALIDATED_BY_NAME => UUID_NAMERELATIONSHIPTYPE_LATER_VALIDATED_BY_NAME,
440
      UUID_NAMERELATIONSHIPTYPE_REPLACED_SYNONYM => UUID_NAMERELATIONSHIPTYPE_REPLACED_SYNONYM
441
    )
442
  )
443
);
444

  
430 445
/**
431 446
 * The drupal variable for the configuration of the information aggregation along
432 447
 * the taxon relation ships. The mapped arrayis associative and holds two elements:
......
2579 2594
        . UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR . '|'
2580 2595
        . UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT . '/' )
2581 2596
  );
2582
  $form['taxon_synonymy']['name_relations'][CDM_NAME_RELATIONSHIP_TYPES] = array(
2597
  $form['taxon_synonymy']['name_relations'][CDM_NAME_RELATIONSHIP_INLINE_TYPES] = array(
2583 2598
    '#type' => 'checkboxes',
2584 2599
    '#title' => t('Name relationship types') . ':',
2585 2600
    '#description' => 'This setting only affects specific types of name relations which are displayed appended to scientific name. 
2586 2601
    A full listing of all name relationships for a scientific name is provided by the taxon ' . l('name page', 'admin/config/cdm_dataportal/settings/layout/name-page') . '.',
2587 2602
    '#options' => $name_relationship_type_options,
2588
    '#default_value' => variable_get(CDM_NAME_RELATIONSHIP_TYPES, unserialize(CDM_NAME_RELATIONSHIP_TYPES_DEFAULT)),
2603
    '#default_value' => variable_get(CDM_NAME_RELATIONSHIP_INLINE_TYPES, unserialize(CDM_NAME_RELATIONSHIP_INLINE_TYPES_DEFAULT)),
2589 2604
  );
2590 2605

  
2591 2606
  // ====== SPECIMENS ====== //
......
2780 2795
         <p>To perform a blast search a blast database for the cdm instance is needed.</p> '),
2781 2796
    );
2782 2797

  
2783
    $form['blast_search_settings'][CDM_BLAST] = array(
2798
    $form['blast_search_settings'][CDM_SEARCH_BLAST_ENABLED] = array(
2784 2799
        '#type' => 'checkbox',
2785 2800
        '#title' => t('Activate Blast search') . ':',
2786
        '#default_value' => variable_get(CDM_BLAST, 0), // '05b0dd06-30f8-477d-bf4c-30d9def56320' =>  Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc)
2801
        '#default_value' => variable_get(CDM_SEARCH_BLAST_ENABLED, 0), // '05b0dd06-30f8-477d-bf4c-30d9def56320' =>  Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc)
2787 2802

  
2788 2803
        '#description' => t('Activate the blast search for this portal, this works only with an existing blast database!'),
2789 2804
    );
2790
    $form['blast_search_settings'][CDM_WS_PORTAL_BLAST] = array(
2805
    $form['blast_search_settings'][CDM_SEARCH_BLAST_SERVICE_URI] = array(
2791 2806
        '#type' => 'textfield',
2792 2807
        '#title' => t('Webservice URL for blast search') . ':',
2793
        '#default_value' => variable_get(CDM_WS_PORTAL_BLAST, 'http://127.0.0.1:9001/api/sequence'), // '05b0dd06-30f8-477d-bf4c-30d9def56320' =>  Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc)
2808
        '#default_value' => variable_get(CDM_SEARCH_BLAST_SERVICE_URI, 'http://127.0.0.1:9001/api/sequence'), // '05b0dd06-30f8-477d-bf4c-30d9def56320' =>  Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc)
2794 2809

  
2795 2810
        '#description' => t('Enter the webservice URL for blast search'),
2796 2811
    );
src/main/java/eu/etaxonomy/dataportal/elements/RegistrationItem.java
39 39
    protected WebElement metadata;
40 40
    protected WebElement identifier;
41 41
    protected WebElement nameElement;
42
    protected List<BaseElement> nameRelationsipsElements;
43
    protected List<BaseElement> nameRelationsipFootnotes;
42 44
    protected WebElement typifiedNameElement;
43 45
    protected WebElement summaryElement;
44 46

  
......
63 65
                try {
64 66
                    typifiedNameElement = containerElement.findElement(By.cssSelector(".typified-name"));
65 67
                } catch (Exception e2) {
66
                    // typifiedNameElement must exist whennameElement is not present, so we throw the  Exception in this case:
68
                    // typifiedNameElement must exist when nameElement is not present, so we throw the  Exception in this case:
67 69
                    throw e2;
68 70
                }
69 71
            }
72
            try{
73
                List<WebElement> std = containerElement.findElements(By.cssSelector(".name_relationships .item"));
74
                nameRelationsipsElements = new ArrayList<BaseElement>(std.size());
75
                for(WebElement we : std){
76
                    nameRelationsipsElements.add(new BaseElement(we));
77
                }
78
            } catch (Exception e) { /* IGNORE */}
79
            try{
80
                List<WebElement> std = containerElement.findElements(By.cssSelector(".footnotes-name_relationships .footnote"));
81
                nameRelationsipFootnotes = new ArrayList<BaseElement>(std.size());
82
                for(WebElement we : std){
83
                    nameRelationsipFootnotes.add(new BaseElement(we));
84
                }
85
            } catch (Exception e) { /* IGNORE */}
70 86
            try{
71 87
                List<WebElement> std = containerElement.findElements(By.cssSelector(".specimen_type_designation"));
72 88
                specimenTypeDesignations = new ArrayList<BaseElement>(std.size());
src/main/java/eu/etaxonomy/dataportal/elements/RegistrationItemFull.java
42 42
        return nameTypeDesignations;
43 43
    }
44 44

  
45
    public List<BaseElement> getNameRelationsipsElements() {
46
        return nameRelationsipsElements;
47
    }
48

  
49
    public List<BaseElement> getNameRelationsipFootnotes() {
50
        return nameRelationsipFootnotes;
51
    }
52

  
45 53
    public WebElement getCitation() {
46 54
        return citation;
47 55
    }
src/test/java/eu/etaxonomy/dataportal/selenium/tests/reference/NameRelationshipsTest.java
1
/**
2
* Copyright (C) 2019 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.dataportal.selenium.tests.reference;
10

  
11
import java.io.UnsupportedEncodingException;
12
import java.net.MalformedURLException;
13
import java.util.List;
14

  
15
import org.junit.Before;
16
import org.junit.Test;
17

  
18
import eu.etaxonomy.dataportal.DataPortalSite;
19
import eu.etaxonomy.dataportal.elements.BaseElement;
20
import eu.etaxonomy.dataportal.elements.RegistrationItemFull;
21
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
22
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
23
import eu.etaxonomy.dataportal.pages.RegistrationPage;
24

  
25
/**
26
 * @author a.kohlbecker
27
 * @since Feb 5, 2019
28
 *
29
 */
30
@DataPortalContexts( { DataPortalSite.reference })
31
public class NameRelationshipsTest extends CdmDataPortalTestBase {
32

  
33
    private static final String reg_nodosilinea_sensensia_id = "http://testbank.org/100009";
34

  
35
    String titleSuffix = " | Integration test reference";
36

  
37
    @Before
38
    public void setUp() throws Exception {
39
        driver.get(getContext().getBaseUri().toString());
40
    }
41

  
42

  
43
    @Test
44
    public void testNodosilinea_sensensia_RegPage() throws MalformedURLException, UnsupportedEncodingException{
45

  
46
        RegistrationPage p = new RegistrationPage(driver, getContext(), reg_nodosilinea_sensensia_id);
47

  
48
        assertEquals("Registration Id: http://testbank.org/100009" + titleSuffix, driver.getTitle());
49
        RegistrationItemFull regItem = p.getRegistrationItem();
50
        assertNotNull(regItem);
51
        assertEquals(
52
                "Nodosilinea sensensia (Blanco) Heidari & Hauer ex Lem, Nonsens species of the developers Vol1",
53
                regItem.getNameElement().getText());
54
        assertEquals(
55
                "Lem, Nonsens species of the developers Vol1",
56
                regItem.getCitation().getText());
57

  
58
        List<BaseElement> nameRelationshipElements = regItem.getNameRelationsipsElements();
59
        assertEquals(5,  nameRelationshipElements.size());
60
        assertEquals("is new combination for Nepenthes alata Blanco, Fl. Filip., ed. 1: 805. 1837", nameRelationshipElements.get(0).getText());
61
        assertEquals("is new name for Nepenthes blancoi Blume in Mus. Bot. Lugd.-Bat. 2: 10. 1852", nameRelationshipElements.get(1).getText());
62
        assertEquals("is validating Nodosilinea radiophila Heidari & Hauer in Fottea 18(2): 142. fig. 5C, D. 1.11.20181", nameRelationshipElements.get(2).getText());
63
        assertEquals("non Nodosilinea blockensis, New Species in the solar system nec Nodosilinea sensensia, Plantas vasculares de Oz nec Nodosilinea sensensia, Species solaris", nameRelationshipElements.get(3).getText());
64
        assertEquals("has orthographic variant Nodosilinea sensensi2, 3", nameRelationshipElements.get(4).getText());
65

  
66
        List<BaseElement> nameRelationshipFootnotes = regItem.getNameRelationsipFootnotes();
67
        assertEquals(3, nameRelationshipFootnotes.size());
68
        assertEquals("1. Art.99.9 Turland, Wiersema, Barrie, Greuter, D.Hawksw., Herend., S.Knapp, Kusber, D.Z.Li, Marhold, T.W.May, McNeill, A.M.Monro, J.Prado, M.J.Price & Gideon F.Sm., International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code) adopted by the Nineteenth International Botanical Congress Shenzhen, China, July 2017:22", nameRelationshipFootnotes .get(0).getText());
69
        assertEquals("2. Art. 88.9 Turland, Wiersema, Barrie, Greuter, D.Hawksw., Herend., S.Knapp, Kusber, D.Z.Li, Marhold, T.W.May, McNeill, A.M.Monro, J.Prado, M.J.Price & Gideon F.Sm., International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code) adopted by the Nineteenth International Botanical Congress Shenzhen, China, July 2017:33", nameRelationshipFootnotes .get(1).getText());
70
        assertEquals("3. Lem, Nonsens species of the developers Vol1", nameRelationshipFootnotes .get(2).getText());
71

  
72
    }
73

  
74
}

Also available in: Unified diff