Project

General

Profile

« Previous | Next » 

Revision c5294246

Added by Andreas Kohlbecker over 5 years ago

ref #3061 fixing position of footnote

View differences:

modules/cdm_dataportal/includes/taxon.inc
84 84
        $sensu_citation_footnote_str = null;
85 85

  
86 86
        if(isset($taxonRelation->fromTaxon->sec)) {
87

  
87 88
          $sensu_citation_footnote_str = theme('cdm_reference', array('reference' => $taxonRelation->fromTaxon->sec));
88 89
          $authorteam = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $taxonRelation->fromTaxon->sec->uuid);
89 90

  
modules/cdm_dataportal/theme/cdm_dataportal.name.theme
76 76
  $out = '<ul class="typeDesignations">';
77 77
  $typeDesignation_footnotes = FALSE;
78 78
  $is_lectotype = FALSE;
79
  $specimenTypeDesignations = array();
79
  $specimen_type_designations = array();
80 80
  $separator = ',';
81 81
  foreach ($typeDesignations as $typeDesignation) {
82 82
    if ($typeDesignation->class == 'SpecimenTypeDesignation') {
83 83
      // SpecimenTypeDesignations should be ordered. Collect theme here only.
84
      $specimenTypeDesignations[] = $typeDesignation;
84
      $specimen_type_designations[] = $typeDesignation;
85 85
    }
86 86
    // It is a lectotype?
87 87
    else {
......
109 109
    }
110 110
  }
111 111

  
112
  if (!empty($specimenTypeDesignations)) {
112
  if (!empty($specimen_type_designations)) {
113 113
    // Sorting might be different for dataportals so this has to be
114 114
    // parameterized.
115
    usort($specimenTypeDesignations, "compare_specimenTypeDesignationStatus");
116
    foreach ($specimenTypeDesignations as $std) {
115
    usort($specimen_type_designations, "compare_specimenTypeDesignationStatus");
116
    foreach ($specimen_type_designations as $type_designation) {
117 117
      $typeReference = '';
118
      if (!empty($std->citation)) {
119
        $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $std->citation->uuid);
120
        $shortCitation = $author_team->titleCache;
121

  
122
        $shortCitation .= (strlen($shortCitation) > 0 ? ' ' : '') . partialToYear($std->citation->datePublished->start);
123
        $missingShortCitation = FALSE;
124
        if (strlen($shortCitation) == 0) {
125
          $shortCitation = theme('cdm_reference', array('reference' => $std->citation));
126
          $missingShortCitation = TRUE;
118

  
119
      if (!empty($type_designation->citation)) {
120

  
121
        $citation_footnote_str = theme('cdm_reference', array('reference' => $type_designation->citation));
122
        $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $type_designation->citation->uuid);
123

  
124
        if(isset($author_team->titleCache)){
125
          $authorteam_str = $author_team->titleCache . partialToYear($type_designation->citation->datePublished->start);
126
          if($authorteam_str == $type_designation->citation->titleCache){
127
            $citation_footnote_str = '';
128
          }
129
        } else {
130
          $authorteam_str = $citation_footnote_str;
131
          // no need for a footnote in case in case it is used as replacement for missing author teams
132
          $citation_footnote_str = '';
127 133
        }
128 134

  
129
        $typeReference .= '&nbsp;(' . t('designated by');
130
        $typeReference .= '&nbsp;<span class="typeReference">';
131
        $typeReference .= $shortCitation . '</span>';
132
        if (!empty($std->citationMicroReference)) {
133
          $typeReference .= ':' . $std->citationMicroReference;
135
        $footnote_key_markup = '';
136
        if($citation_footnote_str) {
137
          // footnotes should be rendered in the parent element so we
138
          // are relying on the FootnoteListKey set there
139
          $_fkey2 = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $citation_footnote_str);
140
          $footnote_key_markup = theme('cdm_footnote_key', array(
141
            'footnoteKey' => $_fkey2,
142
            'separator' => $separator,
143
            'highlightable' => TRUE,
144
            'separator_off' => TRUE,
145
           ));
146

  
134 147
        }
135
        $typeReference .= ')';
136

  
137
        // footnotes should be rendered in the parent element so we
138
        // are relying on the FootnoteListKey set there
139
        $_fkey2 = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $std->citation->titleCache);
140
        $typeReference .= theme('cdm_footnote_key', array(
141
          'footnoteKey' => $_fkey2,
142
          'separator' => $separator,
143
          'highlightable' => TRUE,
144
          'separator_off' => TRUE,
145
         ));
148

  
149
        $typeReference .= '&nbsp;(' . t('designated by') . '&nbsp;<span class="typeReference">'. $authorteam_str . '</span>';
150
        if (!empty($type_designation->citationMicroReference)) {
151
          $typeReference .= ':' . $type_designation->citationMicroReference;
152
        }
153
        $typeReference .= $footnote_key_markup . ')';
154

  
146 155
      }
147 156

  
148 157
      $derivedUnitFacadeInstance = null;
149 158

  
150 159
      $out .= '<li class="specimenTypeDesignation">';
151 160
      $out .= '<span class="status">'
152
        . ((isset($std->typeStatus->representation_L10n)) ? $std->typeStatus->representation_L10n : t('Type'))
161
        . ((isset($type_designation->typeStatus->representation_L10n)) ? $type_designation->typeStatus->representation_L10n : t('Type'))
153 162
        . $typeReference
154 163
        . '</span>';
155 164

  
156 165

  
157
      if (isset($std->typeSpecimen)) {
158
        $derivedUnitFacadeInstance = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, $std->typeSpecimen->uuid);
166
      if (isset($type_designation->typeSpecimen)) {
167
        $derivedUnitFacadeInstance = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, $type_designation->typeSpecimen->uuid);
159 168
      }
160 169
      if ( isset($derivedUnitFacadeInstance ) ){
161 170
        $out .= ': ' . $derivedUnitFacadeInstance->titleCache; // . ': ' . theme('cdm_specimen', array('specimenTypeDesignation' => $derivedUnitFacadeInstance));
src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_TypeTest.java
9 9
 */
10 10
package eu.etaxonomy.dataportal.selenium.tests.cichorieae;
11 11

  
12
import static org.junit.Assert.assertEquals;
13

  
14 12
import java.net.MalformedURLException;
15 13
import java.util.List;
16 14
import java.util.UUID;
......
34 32
@DataPortalContexts( { DataPortalContext.cichorieae })
35 33
public class Cichorieae_TypeTest extends CdmDataPortalTestBase{
36 34

  
37

  
38 35
    static UUID cichorium_uuid = UUID.fromString("21d7161a-455e-4f4d-9d61-7f0100c38ff3");
39 36

  
40 37
    static UUID scorzonera_tuzgoluensis_Uuid = UUID.fromString("296b4758-048a-47bb-a394-affca64dfc40");
41 38

  
42 39
    static UUID lactuca_glandulifera_Uuid = UUID.fromString("6ece0be7-ba4a-4363-b103-4e60429988e5");
43 40

  
41
    static UUID hypochaeris_uuid = UUID.fromString("79d6b29a-7a73-42b6-a024-2ab35fbd60ff");
42

  
43
    static UUID hypochaeris_maculata_uuid = UUID.fromString("90943959-f2ef-4a3a-8744-c8bcd935c8c2");
44 44

  
45 45
    @Test
46 46
    public void cichorium() throws MalformedURLException {
......
85 85
        assertEquals("Syntype: [Cameroon], Maitland 226", typeDesignations.get(0).getText());
86 86
        assertEquals("Syntype: [Cameroon], Mildbraed 10814", typeDesignations.get(1).getText());
87 87
        assertEquals("Syntype: [Cameroon] \"Cameroons Mt., 6,000 ft.\", Dunlap 47", typeDesignations.get(2).getText());
88
    }
88 89

  
90
    @Test
91
    public void hypochaeris_maculata() throws MalformedURLException {
92
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), hypochaeris_maculata_uuid);
93
        assertEquals(getContext().prepareTitle("Hypochaeris maculata"), driver.getTitle());
94
        assertEquals("Hypochaeris maculata L., Sp. Pl.: 810. 1753", p.getAcceptedNameText());
95
        List<TypeDesignationElement> typeDesignations = p.getHomotypicalGroupTypeDesignations();
96
        assertEquals("Expecting two Typedesignation", 2, typeDesignations.size());
97
        assertEquals(TypeDesignationType.specimenTypeDesignation, typeDesignations.get(0).getTypeDesignationType());
98
        assertEquals("Type: \"Habitat in Europae frigidioris pratis asperis.\"", typeDesignations.get(0).getText());
99
        assertEquals(TypeDesignationType.specimenTypeDesignation, typeDesignations.get(1).getTypeDesignationType());
100
        assertEquals("Lectotype (designated by Iamonico 2012:??1): [s. loc.], Herb. Linnaeus, no. 959.1", typeDesignations.get(1).getText());
101
    }
89 102

  
103
    @Test
104
    public void hypochaeris() throws MalformedURLException {
105
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), hypochaeris_uuid);
106
        assertEquals(getContext().prepareTitle("Hypochaeris"), driver.getTitle());
107
        assertEquals("Hypochaeris L., Sp. Pl.: 810. 17531", p.getAcceptedNameText());
108

  
109
        List<TypeDesignationElement> typeDesignations = p.getHomotypicalGroupTypeDesignations();
110
        assertEquals("Expecting two Typedesignation", 1, typeDesignations.size());
111
        assertEquals(TypeDesignationType.nameTypeDesignation, typeDesignations.get(0).getTypeDesignationType());
112
        assertEquals("Lectotype (designated by M. L. Green: 1783): Hypochaeris radicata L.", typeDesignations.get(0).getText());
113

  
114
        typeDesignations = p.getHeterotypicalGroupTypeDesignations(2);
115
        assertEquals("Expecting two Typedesignation", 1, typeDesignations.size());
116
        assertEquals(TypeDesignationType.nameTypeDesignation, typeDesignations.get(0).getTypeDesignationType());
117
        assertEquals("Lectotype (designated by Steudel 1841: 5685): Seriola laevigata L.", typeDesignations.get(0).getText());
90 118
    }
91 119

  
92 120
}

Also available in: Unified diff