Project

General

Profile

« Previous | Next » 

Revision 96d19435

Added by Andreas Kohlbecker about 12 years ago

finally fixing #2648 (search for misapplied names implemented)

View differences:

5.x/modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
94 94
          $authorteam = $authorteam->titleCache;
95 95

  
96 96
          if(!isset($misapplied[$name])){
97
            $misapplied[$name]['out'] =
98
              '<span class="misapplied">'
99
              .cdm_related_taxon($taxonRelation->fromTaxon, UUID_MISAPPLIED_NAME_FOR).
100
              '</span>';
97
            // render the first name found as reprensntative for all others
98
            $misapplied[$name]['out'] = cdm_related_taxon($taxonRelation->fromTaxon, UUID_MISAPPLIED_NAME_FOR);
99
          } else {
100
            // we need to add the anchors for all of the other mispplied names not being rendered explicitely.
101
            $misapplied[$name]['out'] = uuid_anchor($taxonRelation->fromTaxon->uuid, $misapplied[$name]['out']);
102

  
101 103
          }
102 104

  
103 105
          // collect all authors for this fullname
......
125 127
      $out .= '<ul class="misapplied">';
126 128
      foreach($misapplied as $misapplied_name){
127 129

  
128
        $out .= '<li class="synonym">'.$misapplied_name['out'] . " ";
130
        $out .= '<li class="synonym"><span class="misapplied">' . $other_anchors . $misapplied_name['out'] . ' </span>';
131

  
129 132
        if(isset($misapplied_name['authorteam'])){
130 133
          // fill authors with the renderedFootnoteKey and sorting 'em
131 134
          foreach($misapplied_name['authorteam'] as $authorteam=>&$renderedFootnoteKey) {
......
207 210

  
208 211
  // .. well, for sure not as performant as before, but better than nothing.
209 212
  $synonym_uuids = array();
213
  $misappied_uuids = array();
210 214
  foreach($records as $taxon){
211
    if($taxon->class != "Taxon"){
215

  
216
    if($taxon->class == "Synonym") {
212 217
      if(!array_key_exists($taxon->uuid, $synonym_uuids)){
213 218
        $synonym_uuids[$taxon->uuid] = $taxon->uuid;
214 219
      }
220
    } else if( !_cdm_dataportal_acceptedByCurrentView($taxon) ) {
221
      // assuming that it is a misappied name, will be further examined below
222
      $misappied_uuids[$taxon->uuid] = $taxon->uuid;
215 223
    }
224

  
216 225
  }
226

  
217 227
  // batch service not jet implemented:
218 228
  // $table_of_accepted = cdm_ws_property(CDM_WS_PORTAL_TAXON_ACCEPTED, join(',', $synonym_uuids));
219 229
  // thus ...
220 230
  $table_of_accepted = array();
221 231

  
222
  foreach($synonym_uuids as $synUuid){
223
    $table_of_accepted[$synUuid] = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED, array($synUuid, $classification_uuid));
232
  foreach($synonym_uuids as $relatedUuid){
233
    $table_of_accepted[$relatedUuid] = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED, array($relatedUuid, $classification_uuid));
234
  }
235

  
236
  foreach($misappied_uuids as $relatedUuid){
237
    $taxonRelations = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, array($relatedUuid));
238
    foreach($taxonRelations as $relation) {
239
      if($relation->type->uuid == UUID_MISAPPLIED_NAME_FOR && _cdm_dataportal_acceptedByCurrentView($relation->toTaxon)) {
240
        $table_of_accepted[$relatedUuid][] = $relation->toTaxon;
241
      }
242
    }
224 243
  }
225 244

  
226 245
  $out = '<ul class="cdm_names" style="background-image: none;">';
227 246

  
228 247
  foreach($records as $taxon){
229
    // its a Taxon
230
    if($taxon->class == "Taxon"){
231
      $taxonUri = url(path_to_taxon($taxon->uuid));
232
      if(isset($taxon->name->nomenclaturalReference)){
233
        $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
234
      }
235
      $out .= '<li class="Taxon">'.theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri);
236
      $out .= theme('cdm_annotations_as_footnotekeys', $taxon);
237 248

  
238
      if($showMedia_taxa){
239
        $out .= theme('cdm_taxon_list_thumbnails', $taxon);
240
      }
241
      $out .= '</li>';
242
    } else {
243
      // its a synonym
244
      $uuid = $taxon->uuid;
245
      $acceptedTaxa = $table_of_accepted[$uuid];
249
    if( isset($table_of_accepted[$taxon->uuid])) {
250
      // its a synonym or misapplied name
251
      $is_synonym = isset($synonym_uuids[$taxon->uuid]);
252
      $class_name = $is_synonym ? "Synonym" : "misapplied-name";
253

  
254
      $acceptedTaxa = $table_of_accepted[$taxon->uuid];
255

  
246 256
      if(count($acceptedTaxa) == 1){
257

  
247 258
        $acceptedTaxon = $acceptedTaxa[0];
248 259
        $taxonUri = uri_to_synonym($taxon->uuid, $acceptedTaxon->uuid, 'synonymy');
249 260
        if(isset($acceptedTaxon->name->nomenclaturalReference)){
250 261
          $referenceUri = url(path_to_reference($acceptedTaxon->name->nomenclaturalReference->uuid));
251 262
        }
252
        $out .= '<li class="Synonym">'.theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri);
263
        $out .= '<li class="' . $class_name . '">'.theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri);
264
        if(!$is_synonym){
265
          $out .= '<span class="sensu"> sensu ' . theme('cdm_reference', $taxon->sec) . '</span>';
266
        }
253 267
        $out .= theme('cdm_annotations_as_footnotekeys', $taxon);
254 268
        if($showMedia_synonyms){
255 269
          $out .= theme('cdm_taxon_list_thumbnails', $acceptedTaxon);
256 270
        }
257 271
        $out .= '</li>';
272

  
258 273
      } else {
274

  
259 275
        //TODO avoid using Ajax in the cdm_dynabox .... why?
260 276
        //TODO add media
261 277
        $out .= cdm_dynabox(
......
263 279
          cdm_compose_url(CDM_WS_PORTAL_TAXON_ACCEPTED, array($taxon->uuid, $classification_uuid)),
264 280
          'cdm_list_of_taxa',
265 281
          'Click for accepted taxon');
282

  
266 283
      }
284
    } else {
285
      // its a Taxon
286
      $taxonUri = url(path_to_taxon($taxon->uuid));
287
      if(isset($taxon->name->nomenclaturalReference)){
288
        $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
289
      }
290
      $out .= '<li class="Taxon">'.theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri);
291
      $out .= theme('cdm_annotations_as_footnotekeys', $taxon);
292

  
293
      if($showMedia_taxa){
294
        $out .= theme('cdm_taxon_list_thumbnails', $taxon);
295
      }
296
      $out .= '</li>';
267 297
    }
268 298
  }
269 299

  

Also available in: Unified diff