Project

General

Profile

« Previous | Next » 

Revision 3d526ffb

Added by Andreas Kohlbecker over 12 years ago

fixing #2679 (Improve Concept Relationships for Dataportal)

View differences:

5.x/modules/cdm_dataportal/cdm_dataportal.module
1296 1296

  
1297 1297

  
1298 1298
/**
1299
 * Enter description here...
1299
 * Creates a URL to the taxon page specified by the $uuid parameter.
1300
 * The URL will be prepended with a path element to a specific taxon page tab.
1301
 *
1302
 * This tab is either taken from the CDM_DATAPORTAL_DEFAULT_TAXON_TAB which can
1303
 * be set globally in the administrative settings or individually in the user
1304
 * profile. If the CDM_DATAPORTAL_DEFAULT_TAXON_TAB value is set to LAST_VISITED_TAB
1305
 * the last portal will stay on this last tab.
1306
 *
1307
 * A third option is offerered by the $page_tab parameter which allows overwriting this
1308
 * internal mechanism by a specific value.
1300 1309
 *
1301 1310
 * @param String $uuid the UUID of the taxon
1311
 * @param String $page_tab overwriting the preset mechanism by defining specific valuefor the taxon page tab.
1312
 *
1302 1313
 * @return the URL
1303 1314
 */
1304
function path_to_taxon($uuid, $no_tab = false){
1315
function path_to_taxon($uuid, $page_tab = false){
1316

  
1305 1317
  $tab = get_default_taxon_tab();
1306 1318
  $values = unserialize(CDM_DATAPORTAL_DEFAULT_TAXON_TAB);
1307 1319

  
1308 1320
  if(!$uuid) return false;
1309 1321

  
1310
  if (!$tab){
1322
  if($page_tab){
1323
    return 'cdm_dataportal/taxon/'.$uuid . '/' . $page_tab;
1324
  } else if (!$tab){
1311 1325
    return 'cdm_dataportal/taxon/'.$uuid;
1312 1326
  }else if(get_last_taxon_page_tab() &&  $tab == $values[CDM_DATAPORTAL_LAST_VISITED_TAB_ARRAY_INDEX]){
1313 1327
    return 'cdm_dataportal/taxon/'.$uuid . '/' . get_last_taxon_page_tab();
......
1316 1330
  }
1317 1331
}
1318 1332

  
1333
function uri_to_synonym($synonymUuid, $acceptedUuid){
1334
  $acceptedPath = path_to_taxon($acceptedUuid, "synonymy");
1335
  return url($acceptedPath, 'highlite='.$synonymUuid.'&acceptedFor='.$synonymUuid, $synonymUuid);
1336
}
1337

  
1319 1338
function path_to_key($keyType, $keyUuid){
1320 1339
  if(!$keyUuid || !$keyType) return false;
1321 1340
  $keyType{0} = strtolower($keyType{0});
......
1388 1407
  }
1389 1408
}
1390 1409

  
1391
function theme_cdm_uri_to_synonym($synonymUuid, $acceptedUuid, $pagePart = null){
1392
  $acceptedPath = path_to_taxon($acceptedUuid, true);
1393
  return url($acceptedPath.($pagePart ? '/'.$pagePart : ''), 'highlite='.$synonymUuid.'&acceptedFor='.$synonymUuid, $synonymUuid);
1394
}
1395 1410

  
1396 1411
/**
1397 1412
 * Preprocess the taggedName to normalize newly introduced tagtypes like hybridSign, separator, .. more?
......
1514 1529
}
1515 1530

  
1516 1531
function _is_invers_taxonRelationship($taxonRelationship, $focusedTaxon){
1517
  return $taxonRelationship->fromTaxon->uuid == $focusedTaxon->uuid;
1532
  return $taxonRelationship->toTaxon->uuid == $focusedTaxon->uuid;
1518 1533
}
1519 1534

  
1520 1535

  
......
1644 1659
  return $outArrayOfMedia;
1645 1660
}
1646 1661

  
1647
function cdm_annotations_as_footnotekeys($cdmBase, $footnote_list_key = null){
1662
/**
1663
 *
1664
 * @param - $cdmBase_list @param $cdmBase_list an array of CdmBase instances or a single instance
1665
 * @param - $footnote_list_key
1666
 */
1667
function cdm_annotations_as_footnotekeys($cdmBase_list, $footnote_list_key = null){
1648 1668
  $footNoteKeys = array();
1649 1669
  //is argument cdmBase an array?
1650
  if (!is_array($cdmBase)){
1670
  if (!is_array($cdmBase_list)){
1651 1671
    $cdmBase_array = array();
1652
    $cdmBase_array[] = $cdmBase;
1672
    $cdmBase_array[] = $cdmBase_list;
1653 1673
  }else{
1654
    $cdmBase_array = $cdmBase;
1674
    $cdmBase_array = $cdmBase_list;
1655 1675
  }
1656 1676
  //getting the key for the footnotemanager
1657 1677
  if( $footnote_list_key ){
5.x/modules/cdm_dataportal/theme/cdm_dataportal.common.theme
154 154
 *	TaxonNode
155 155
 *  WorkingSet
156 156
 *
157
 * @param $cdmBase_list an array of CdmBase instances or a single instance
158
 * @param $footnote_list_key
157 159
 */
158
function theme_cdm_annotations_as_footnotekeys($cdmBase, $footnote_list_key = null){
160
function theme_cdm_annotations_as_footnotekeys($cdmBase_list, $footnote_list_key = null){
159 161
  if (variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)){
160 162
    return '';
161 163
  }
5.x/modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
1079 1079

  
1080 1080
      // Feature
1081 1081
      if($hasFeature){
1082
        $out .= $polytomousKeyNode->feature->representation_L10n . " ";
1082
        $out .= $polytomousKeyNode->feature->representation_L10n . ": ";
1083 1083
      }
1084 1084

  
1085 1085
      // Statement
5.x/modules/cdm_dataportal/theme/cdm_dataportal.references.theme
36 36
 *
37 37
 */
38 38
function theme_cdm_reference($reference, $microReference = null, $doLink = FALSE, $referenceStyle = NULL ){
39
  global $theme_key; //TODO: implement in the palmae theme the concrete case
40
  $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
41 39

  
42
	if($style == "zoology"){
43
		$year = partialToYear($reference->datePublished->start);
44
		$citation = $author_team->titleCache . ($year ? '. '.$year : '');
45
	}else
46
	  //FIXME move palmweb specific lines to palweb theme !!!!
47
	if ($theme_key == 'palmweb_2') {
48
		$year = partialToYear($reference->datePublished->start);
49
    	$citation = short_form_of_author_team ($author_team->titleCache) . ($year ? '. '.$year : '');
50
    	$citation = str_replace('..', '.', $citation);
51
	} else {
52
		$citation = $reference->titleCache;
40
  $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
53 41

  
54
		//$year = partialToYear($reference->datePublished->start);
55
		//$citation = short_form_of_author_team ($author_team->titleCache) . ($year ? '. '.$year : '');
56
		//$citation = str_replace('..', '.', $citation);
57
	}
42
  if($referenceStyle == "zoology"){
43
  	$year = partialToYear($reference->datePublished->start);
44
  	$citation = $author_team->titleCache . ($year ? '. '.$year : '');
45
  } else {
46
  	$citation = $reference->titleCache;
47
  }
58 48

  
59
	if($doLink){
60
		$out = l('<span class="reference">'.$citation.'</span>'
49
  if($doLink){
50
  	$out = l('<span class="reference">'.$citation.'</span>'
61 51
          , path_to_reference($reference->uuid)
62 52
          , array("class"=>"reference")
63 53
          , NULL, NULL, FALSE ,TRUE);
64 54
    } else {
65
		$out = '<span class="reference">'.$citation.'</span>';
66
	}
67
    if(!empty($descriptionElementSource->citationMicroReference)){
68
        $out .= ': '. $descriptionElementSource->citationMicroReference;
69
     }
55
  	$out = '<span class="reference">'.$citation.'</span>';
56
  }
57

  
58
  //FIXME use microreference webservice instead
59
  if(!empty($descriptionElementSource->citationMicroReference)){
60
      $out .= ': '. $descriptionElementSource->citationMicroReference;
61
  }
70 62

  
71
    return $out;
63
  return $out;
72 64
}
73 65

  
74
function short_form_of_author_team ($author_team){
66
function _short_form_of_author_team ($author_team){
75 67

  
76 68
	$number_of_authors = substr_count($author_team, ' & ') + 1;
77 69
	//var_dump($author_team);
5.x/modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
245 245
      $acceptedTaxa = $table_of_accepted[$uuid];
246 246
      if(count($acceptedTaxa) == 1){
247 247
        $acceptedTaxon = $acceptedTaxa[0];
248
        $taxonUri = theme('cdm_uri_to_synonym', $taxon->uuid, $acceptedTaxon->uuid, 'synonymy');
248
        $taxonUri = uri_to_synonym($taxon->uuid, $acceptedTaxon->uuid, 'synonymy');
249 249
        if(isset($acceptedTaxon->name->nomenclaturalReference)){
250 250
          $referenceUri = url(path_to_reference($acceptedTaxon->name->nomenclaturalReference->uuid));
251 251
        }
......
296 296
  $reltype_representation = '';
297 297

  
298 298
  if($inverse) {
299
    $taxon = $taxonRelationship->toTaxon;
299
    $toTaxon = $taxonRelationship->fromTaxon;
300
    $fromTaxon = $taxonRelationship->toTaxon;
300 301
    $relsign = $taxonRelationType->inverseRepresentation_L10n_abbreviatedLabel;
301 302
    $reltype_representation = $taxonRelationType->inverseRepresentation_L10n;
302 303
  } else {
303
    $taxon = $taxonRelationship->fromTaxon;
304
    $toTaxon = $taxonRelationship->toTaxon;
305
    $fromTaxon = $taxonRelationship->fromTaxon;
304 306
    $relsign = $taxonRelationType->representation_L10n_abbreviatedLabel;
305 307
    $reltype_representation = $taxonRelationType->representation_L10n;
306 308
  }
307 309

  
308
  return cdm_related_taxon($taxon, null, $relsign, $reltype_representation, $doLinkTaxon);
310
  return cdm_related_taxon($toTaxon, null, $relsign, $reltype_representation, $doLinkTaxon);
309 311
}
310 312

  
311 313
/**
......
372 374
    $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
373 375
  }
374 376
  if($doLinkTaxon){
375
    $taxonUri = url(path_to_taxon($taxon->uuid));
377
    $taxonUri = url(path_to_taxon($taxon->uuid, "synonymy"));
376 378
  }
377 379
  //printing the taxonName and the handling the special case of annotations
378
  $nameHtml = theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri, true, false, $skiptags);
379
  $special_annotations_array = array();
380
  $special_annotations_array[] = $taxon->name;
381
  $special_annotations_array[] = $taxon;
382
  $nameHtml .= theme('cdm_annotations_as_footnotekeys', $special_annotations_array);
380
  $out_taxon_part = theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri, true, false, $skiptags);
381
  $out_taxon_part .= theme('cdm_annotations_as_footnotekeys', array($taxon->name, $taxon) );
382
  $out_taxon_part .= ' sec. ' . theme('cdm_reference',  $taxon->sec);
383

  
383 384

  
384 385
  //later homonym or trated as later homonym AND bloking names
385 386
  $from_name_relations = cdm_ws_get(CDM_WS_PORTAL_TAXON_FROM_NAMERELATIONS, $taxon->uuid);
386 387
  $to_name_relations = cdm_ws_get(CDM_WS_PORTAL_TAXON_TO_NAMERELATIONS, $taxon->uuid);
388

  
387 389
  //first the FROM RELS
390
  //FIXME use UUID below instad of representation_L10n
388 391
  if ($from_name_relations){
389 392
    foreach($from_name_relations as $element){
390 393
      switch ($element->type->representation_L10n){
......
432 435
    }
433 436
  }
434 437
  //geneal output
435
  $out = '<span class="relation_sign" title="' . $reltype_representation . '">'.$relsign.'</span>'.$name_prefix . $nameHtml . $name_postfix . $name_relations_html;
438
  $out = '<span class="relation_sign" title="' . $reltype_representation . '">'.$relsign.'</span>'.$name_prefix . $out_taxon_part . $name_postfix . $name_relations_html;
436 439
  $out = uuid_anchor($taxon->uuid, $out);
437 440

  
438 441
  RenderHints::popFromRenderStack();
......
455 458
  $gallery_name = $taxon->uuid;
456 459

  
457 460
   $mediaQueryParameters = array("type"=>"ImageFile");
458
  $galleryLinkUri = path_to_taxon($taxon->uuid).'/images';
461
  $galleryLinkUri = path_to_taxon($taxon->uuid, 'images');
459 462

  
460 463
  // cdm_dataportal_show_media = ???? TODO
461 464
  $selectShowMedia = variable_get('cdm_dataportal_show_media', 0);
5.x/themes/palmweb_2/template.php
83 83
}
84 84

  
85 85

  
86
/**
87
 *
88
 * Enter description here ...
89
 * @param unknown_type $reference
90
 * @param unknown_type $microReference
91
 * @param unknown_type $doLink
92
 * @param unknown_type $referenceStyle
93
 */
94
function palmweb_2_cdm_reference($reference, $microReference = null, $doLink = FALSE, $referenceStyle = NULL ){
95

  
96
  $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
97

  
98
  $year = partialToYear($reference->datePublished->start);
99
  $citation = _short_form_of_author_team ($author_team->titleCache) . ($year ? '. '.$year : '');
100
  $citation = str_replace('..', '.', $citation);
101

  
102
  if($doLink){
103
    $out = l('<span class="reference">'.$citation.'</span>'
104
    , path_to_reference($reference->uuid)
105
    , array("class"=>"reference")
106
    , NULL, NULL, FALSE ,TRUE);
107
  } else {
108
    $out = '<span class="reference">'.$citation.'</span>';
109
  }
110
  //FIXME use microreference webservice instead
111
  if(!empty($descriptionElementSource->citationMicroReference)){
112
    $out .= ': '. $descriptionElementSource->citationMicroReference;
113
  }
114

  
115
  return $out;
116
}
117

  
118

  
86 119
/**
87 120
 * Sets the body-tag class attribute.
88 121
 *

Also available in: Unified diff