Revision 7efd13a9
Added by Andreas Kohlbecker almost 5 years ago
modules/cdm_dataportal/cdm_api/uuids.php | ||
---|---|---|
75 | 75 |
define('UUID_NAMERELATIONSHIPTYPE_VALIDATED_BY_NAME', 'a176c9ad-b4c2-4c57-addd-90373f8270eb'); |
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 |
define('UUID_NAMERELATIONSHIPTYPE_MISSPELLING', 'c6f9afcb-8287-4a2b-a6f6-4da3a073d5de'); |
|
78 | 79 |
|
79 | 80 |
// Features. |
80 | 81 |
define('UUID_UNKNOWN', '910307f1-dc3c-452c-a6dd-af5ac7cd365c'); |
modules/cdm_dataportal/includes/name.inc | ||
---|---|---|
985 | 985 |
// the render stack element homonyms is being used in the default render templates !!!, see CDM_NAME_RENDER_TEMPLATES_DEFAULT |
986 | 986 |
|
987 | 987 |
$selected_name_rel_uuids = variable_get(CDM_NAME_RELATIONSHIP_INLINE_TYPES, unserialize(CDM_NAME_RELATIONSHIP_INLINE_TYPES_DEFAULT)); |
988 |
$name_rel_type_filter = array('direct' => array(), 'inverse' => array()); |
|
989 |
foreach ($selected_name_rel_uuids as $uuid){ |
|
990 |
$name_rel_type_filter['direct'][$uuid] = $uuid; |
|
991 |
if($uuid != UUID_NAMERELATIONSHIPTYPE_MISSPELLING){ |
|
992 |
$name_rel_type_filter['inverse'][$uuid] = $uuid; |
|
993 |
} |
|
994 |
} |
|
988 | 995 |
|
989 | 996 |
$list_prefix = '<span class="name_relationships">['; |
990 | 997 |
$list_suffix = ']</span>'; |
991 | 998 |
$item_prefix = '<span class="item">'; |
992 | 999 |
$item_suffix = '</span> '; |
993 | 1000 |
$show_relationship_symbol = true; |
994 |
$render_array = compose_name_relationships($name_relations, $selected_name_rel_uuids, $current_name_uuid, $current_taxon_uuid, $show_relationship_symbol, $list_prefix, $list_suffix, $item_prefix, $item_suffix); |
|
1001 |
$render_array = compose_name_relationships($name_relations, $name_rel_type_filter, $current_name_uuid, $current_taxon_uuid, $show_relationship_symbol, $list_prefix, $list_suffix, $item_prefix, $item_suffix); |
|
1002 |
|
|
1003 |
// remove the glue space from the last item element which has been added by the $item_suffix = '</span> ' |
|
1004 |
$items_ctn = count($render_array['list']['items']); |
|
1005 |
if($items_ctn){ |
|
1006 |
$render_array['list']['items'][$items_ctn - 1]['#suffix'] = '</span>'; |
|
1007 |
} |
|
995 | 1008 |
|
996 | 1009 |
RenderHints::popFromRenderStack(); |
997 | 1010 |
return $render_array; |
... | ... | |
1028 | 1041 |
// the render stack element homonyms is being used in the default render templates !!!, see CDM_NAME_RENDER_TEMPLATES_DEFAULT |
1029 | 1042 |
|
1030 | 1043 |
$selected_name_rel_uuids = variable_get(CDM_NAME_RELATIONSHIP_LIST_TYPES, unserialize(CDM_NAME_RELATIONSHIP_LIST_TYPES_DEFAULT)); |
1044 |
$name_rel_type_filter = array('direct' => array(), 'inverse' => array()); |
|
1045 |
foreach ($selected_name_rel_uuids as $uuid){ |
|
1046 |
$name_rel_type_filter['direct'][$uuid] = $uuid; |
|
1047 |
$name_rel_type_filter['inverse'][$uuid] = $uuid; |
|
1048 |
} |
|
1031 | 1049 |
|
1032 | 1050 |
$list_prefix = '<div class="relationships_list name_relationships">'; |
1033 | 1051 |
$list_suffix = '</div>'; |
... | ... | |
1035 | 1053 |
$item_suffix = '</div>'; |
1036 | 1054 |
$show_relationship_symbol = true; |
1037 | 1055 |
|
1038 |
$render_array = compose_name_relationships($name_relations, $selected_name_rel_uuids, $current_name_uuid, $current_taxon_uuid, $show_relationship_symbol, $list_prefix, $list_suffix, $item_prefix, $item_suffix);
|
|
1056 |
$render_array = compose_name_relationships($name_relations, $name_rel_type_filter, $current_name_uuid, $current_taxon_uuid, $show_relationship_symbol, $list_prefix, $list_suffix, $item_prefix, $item_suffix);
|
|
1039 | 1057 |
|
1040 | 1058 |
RenderHints::popFromRenderStack(); |
1041 | 1059 |
$render_array['footnotes'] = markup_to_render_array(theme('cdm_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey()))); |
... | ... | |
1046 | 1064 |
|
1047 | 1065 |
/** |
1048 | 1066 |
* @param $name_relations |
1049 |
* @param $selected_name_rel_uuids |
|
1067 |
* @param $name_rel_type_filter |
|
1068 |
* Associative array with two keys: |
|
1069 |
* - 'direct': the relationship type uuids for the direct direction of the relation edge to be included |
|
1070 |
* - 'inverse': the relationship type uuids for the direct direction of the relation edge to be included |
|
1050 | 1071 |
* @param $current_name_uuid |
1051 | 1072 |
* @param $current_taxon_uuid |
1052 | 1073 |
* @param $show_relationship_symbol |
... | ... | |
1058 | 1079 |
* |
1059 | 1080 |
* @ingroup Compose |
1060 | 1081 |
*/ |
1061 |
function compose_name_relationships($name_relations, $selected_name_rel_uuids, $current_name_uuid, $current_taxon_uuid, $show_relationship_symbol, $list_prefix, $list_suffix, $item_prefix, $item_suffix) |
|
1082 |
function compose_name_relationships($name_relations, $name_rel_type_filter, $current_name_uuid, $current_taxon_uuid, |
|
1083 |
$show_relationship_symbol, $list_prefix, $list_suffix, $item_prefix, $item_suffix) |
|
1062 | 1084 |
{ |
1063 | 1085 |
$non_nec_name_reltype_uuids = array(UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM, |
1064 | 1086 |
UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM, |
1065 | 1087 |
UUID_NAMERELATIONSHIPTYPE_CONSERVED_AGAINST, |
1088 |
UUID_NAMERELATIONSHIPTYPE_MISSPELLING, |
|
1066 | 1089 |
UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR); |
1067 | 1090 |
|
1068 | 1091 |
$render_array = array( |
... | ... | |
1084 | 1107 |
$orthographic_variants = array(); |
1085 | 1108 |
foreach ($name_relations as $name_rel) { |
1086 | 1109 |
$rel_type_uuid = $name_rel->type->uuid; |
1087 |
if (isset($selected_name_rel_uuids[$rel_type_uuid]) && $selected_name_rel_uuids[$rel_type_uuid]) { |
|
1110 |
$is_inverse_relation = $current_name_uuid == $name_rel->toName->uuid; |
|
1111 |
if ((!$is_inverse_relation && isset($name_rel_type_filter['direct'][$rel_type_uuid]) && $name_rel_type_filter['direct'][$rel_type_uuid]) |
|
1112 |
||($is_inverse_relation && isset($name_rel_type_filter['inverse'][$rel_type_uuid]) && $name_rel_type_filter['inverse'][$rel_type_uuid])) { |
|
1113 |
|
|
1088 | 1114 |
if (array_search($rel_type_uuid, $non_nec_name_reltype_uuids) !== false && ( |
1089 | 1115 |
$current_name_uuid == $name_rel->fromName->uuid && $rel_type_uuid != UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR |
1090 | 1116 |
|| $current_name_uuid == $name_rel->toName->uuid && $rel_type_uuid == UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR |
... | ... | |
1103 | 1129 |
|
1104 | 1130 |
usort($name_relations, 'compare_name_relations_by_term_order_index'); |
1105 | 1131 |
|
1132 |
// compose |
|
1106 | 1133 |
foreach ($name_relations as $name_rel) { |
1107 | 1134 |
|
1108 | 1135 |
$is_inverse_relation = $current_name_uuid == $name_rel->toName->uuid; |
modules/cdm_dataportal/settings.php | ||
---|---|---|
2593 | 2593 |
. UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM . '|' |
2594 | 2594 |
. UUID_NAMERELATIONSHIPTYPE_CONSERVED_AGAINST . '|' |
2595 | 2595 |
. UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR . '|' |
2596 |
. UUID_NAMERELATIONSHIPTYPE_MISSPELLING . '|' |
|
2596 | 2597 |
. UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT . '/' ) |
2597 | 2598 |
); |
2598 | 2599 |
$form['taxon_synonymy']['name_relations'][CDM_NAME_RELATIONSHIP_INLINE_TYPES] = array( |
src/test/java/eu/etaxonomy/dataportal/selenium/tests/reference/NameRelationshipsTest.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
private static final UUID taxon_bulbostylis_pauciflora_uuid = UUID.fromString("27f2ad59-0e11-44f4-a931-c69053260321"); |
42 | 42 |
|
43 |
private static final UUID taxon_nepenthes_gracilis_uuid = UUID.fromString("5d9af5a8-c8ad-45e8-85df-ce6a01011fb9"); |
|
44 |
|
|
43 | 45 |
String titleSuffix = " | Integration test reference"; |
44 | 46 |
|
45 | 47 |
@Before |
... | ... | |
87 | 89 |
TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), taxon_nodosilinea_sensensia_uuid); |
88 | 90 |
|
89 | 91 |
WebElement accName = p.getAcceptedName(); |
90 |
assertEquals("Nodosilinea sensensia (Blanco) Heidari & Hauer ex Lem, Nonsens species of the developers Vol1 [non Nodosilinea sensensia nec Nodosilinea sensensia nec Nodosilinea blockensis orth. var. Nodosilinea sensensi1, 2 ]", accName.getText());
|
|
92 |
assertEquals("Nodosilinea sensensia (Blanco) Heidari & Hauer ex Lem, Nonsens species of the developers Vol1 [non Nodosilinea sensensia nec Nodosilinea sensensia nec Nodosilinea blockensis orth. var. Nodosilinea sensensi1, 2]", accName.getText()); |
|
91 | 93 |
|
92 | 94 |
List<BaseElement> footnotes = p.getHomotypicalGroupFootNotes(); |
93 | 95 |
assertEquals("1. 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", footnotes.get(0).getText()); |
... | ... | |
107 | 109 |
TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), taxon_bulbostylis_pauciflora_uuid); |
108 | 110 |
|
109 | 111 |
WebElement accName = p.getAcceptedName(); |
110 |
assertEquals("Bulbostylis pauciflora (Liebm.) C. B. Clarke, nom. cons. [non Bulbostylis pauciflora (Kunth) D.C. ]", accName.getText());
|
|
112 |
assertEquals("Bulbostylis pauciflora (Liebm.) C. B. Clarke, nom. cons. [non Bulbostylis pauciflora (Kunth) D.C.]", accName.getText()); |
|
111 | 113 |
assertEquals("is conserved against", accName.findElement(By.className("symbol")).getAttribute("title")); |
112 | 114 |
|
113 | 115 |
} |
114 | 116 |
|
117 |
/** |
|
118 |
* Test for https://dev.e-taxonomy.eu/redmine/issues/6523 |
|
119 |
* |
|
120 |
* @throws MalformedURLException |
|
121 |
* @throws UnsupportedEncodingException |
|
122 |
*/ |
|
123 |
@Test |
|
124 |
public void testIssue6523() throws MalformedURLException, UnsupportedEncodingException { |
|
125 |
|
|
126 |
TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), taxon_nepenthes_gracilis_uuid); |
|
127 |
|
|
128 |
WebElement accName = p.getAcceptedName(); |
|
129 |
assertEquals("Nepenthes gracilis Korth., Verh. Nat. Gesch. Ned. Bezitt., Bot. 19: 22, t. 1 & 4. 1840", accName.getText()); |
|
130 |
|
|
131 |
WebElement synonym1 = p.getHeterotypicalGroupSynonym(1, 1); |
|
132 |
assertEquals("=\nNepenthes teysmanniana Miq., Fl. Ned. Ind. 1(1): 1073. 1858", synonym1.getText()); |
|
133 |
WebElement synonym2 = p.getHeterotypicalGroupSynonym(1, 2); |
|
134 |
assertEquals("≡\nNepenthes tupmanniana Bonstedt in Parey Blumeng. 1: 663. 1931 [non Nepenthes teysmanniana Miq., Fl. Ned. Ind. 1(1): 1073. 1858]", synonym2.getText()); |
|
135 |
assertEquals("is misspelling for", synonym2.findElement(By.className("symbol")).getAttribute("title")); |
|
136 |
|
|
137 |
} |
|
138 |
|
|
115 | 139 |
} |
Also available in: Unified diff
implementing misspelling for ref #6523; implementing name rel type filter for direct and inverse edges for #5855