Revision 70fb5e15
Added by Andreas Kohlbecker about 15 years ago
modules/cdm_dataportal/cdm_dataportal.theme.php | ||
---|---|---|
20 | 20 |
drupal_add_css(drupal_get_path('module', 'cdm_dataportal').'/js/cdm_thickbox.css'); |
21 | 21 |
} |
22 | 22 |
|
23 |
function _add_js_cluetip(){ |
|
24 |
|
|
25 |
//TODO replace by http://www.socialembedded.com/labs/jQuery-Tooltip-Plugin/jQuery-Tooltip-Plugin.html |
|
26 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/cluetip/jquery.cluetip.js'); |
|
27 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/jquery.dimensions.js'); |
|
28 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/cluetip/jquery.hoverIntent.js'); |
|
29 |
drupal_add_css(drupal_get_path('module', 'cdm_dataportal').'/js/cluetip/jquery.cluetip.css'); |
|
30 |
drupal_add_js ("$(document).ready(function(){ |
|
31 |
$('.cluetip').css({color: '#0062C2'}).cluetip({ |
|
32 |
splitTitle: '|', |
|
33 |
showTitle: true, |
|
34 |
activation: 'hover', |
|
35 |
sicky: true, |
|
36 |
arrows: true, |
|
37 |
dropShadow: false, |
|
38 |
cluetipClass: 'rounded' |
|
39 |
}); |
|
40 |
});", 'inline'); |
|
41 |
} |
|
42 |
|
|
23 | 43 |
/** |
24 | 44 |
* TODO if getting fragment from request is possible remove $_REQUEST['highlite'] HACK |
25 | 45 |
* NOT WORKING since fragments are not available to the server |
... | ... | |
243 | 263 |
return; |
244 | 264 |
} |
245 | 265 |
$out = '<table class="media_gallerie">'; |
266 |
for($r = 0; $r < $maxRows && count($mediaList) > 0; $r++){ |
|
267 |
$out .= '<colgroup>'; |
|
268 |
for($r = 0; $r < $cols; $r++){ |
|
269 |
$out .= '<col width="'.(100 / $cols).'%">'; |
|
270 |
} |
|
271 |
$out .= '</colgroup>'; |
|
272 |
} |
|
246 | 273 |
for($r = 0; $r < $maxRows && count($mediaList) > 0; $r++){ |
247 | 274 |
$out .= '<tr>'; |
248 | 275 |
for($r = 0; $r < $cols; $r++){ |
... | ... | |
301 | 328 |
|
302 | 329 |
if(variable_get('cdm_dataportal_map_openlayers', 1)){ |
303 | 330 |
// embed into openlayers viewer |
304 |
$server = 'http://edit.csic.es/v1/areas3_ol2.php';
|
|
331 |
$server = 'http://edit.csic.es/v1/areas_sld.php';
|
|
305 | 332 |
$map_tdwg_Uri = url($server. '?' .$map_data_parameters->String, $query_string); |
306 | 333 |
//$map_tdwg_Uri ='http://edit.csic.es/v1/areas3_ol.php?l=earth&ad=tdwg4:c:UGAOO,SAROO,NZSOO,SUDOO,SPAAN,BGMBE,SICSI,TANOO,GEROO,SPASP,KENOO,SICMA,CLCBI,YUGMA,GRCOO,ROMOO,NZNOO,CLCMA,YUGSL,CLCLA,ALGOO,SWIOO,CLCSA,MDROO,HUNOO,ETHOO,BGMLU,COROO,BALOO,POROO,BALOO|e:CZESK,GRBOO|g:AUTAU|b:LBSLB,TUEOO|d:IREIR,AUTLI,POLOO,IRENI|f:NETOO,YUGCR|a:TUEOO,BGMBE,LBSLB||tdwg3:c:BGM,MOR,SPA,SIC,ITA,MOR,SPA,FRA|a:YUG,AUT&as=a:8dd3c7,,1|b:fdb462,,1|c:4daf4a,,1|d:ffff33,,1|e:bebada,,1|f:ff7f00,,1|g:377eb8,,1&&ms=610&bbox=-180,-90,180,90'; |
307 | 334 |
//$tdwg_sldFile = cdm_http_request($map_tdwg_Uri); |
... | ... | |
490 | 517 |
// due to a bug in the cdmlib the taggedName alway has a lst empty element, we will remove it: |
491 | 518 |
array_pop($taggedName); |
492 | 519 |
|
493 |
if(!isset($renderTemplate['namePart']['authorTeam'])){ |
|
494 |
// find author and split off from name |
|
495 |
// TODO expecting to find the author as the last element |
|
496 |
if($taggedName[count($taggedName)- 1]->type == 'authors'){ |
|
497 |
$authorTeam = $taggedName[count($taggedName)- 1]->text; |
|
498 |
unset($taggedName[count($taggedName)- 1]); |
|
499 |
} |
|
520 |
$lastAuthorElementString = false; |
|
521 |
$hasNamePart_with_Authors = isset($renderTemplate['namePart']) && isset($renderTemplate['namePart']['authors']); |
|
522 |
$hasNameAuthorPart_with_Authors = isset($renderTemplate['nameAuthorPart']) && isset($renderTemplate['nameAuthorPart']['authors']); |
|
523 |
|
|
524 |
if(!($hasNamePart_with_Authors || $hasNameAuthorPart_with_Authors)){ |
|
525 |
// // find author and split off from name |
|
526 |
// // TODO expecting to find the author as the last element |
|
527 |
// if($taggedName[count($taggedName)- 1]->type == 'authors'){ |
|
528 |
// $authorTeam = $taggedName[count($taggedName)- 1]->text; |
|
529 |
// unset($taggedName[count($taggedName)- 1]); |
|
530 |
// } |
|
531 |
|
|
532 |
// remove all authors |
|
533 |
$taggedNameNew = array(); |
|
534 |
foreach($taggedName as $element){ |
|
535 |
if($element->type != 'authors'){ |
|
536 |
$taggedNameNew[] = $element; |
|
537 |
} else { |
|
538 |
$lastAuthorElementString = $element->text; |
|
539 |
} |
|
540 |
} |
|
541 |
$taggedName = $taggedNameNew; |
|
542 |
|
|
500 | 543 |
} |
501 | 544 |
$name = '<span class="'.$taxonName->class.'">'.theme('cdm_taggedtext2html', $taggedName).'</span>'; |
502 | 545 |
} else { |
... | ... | |
506 | 549 |
// fill name into $renderTemplate |
507 | 550 |
array_setr('name', $name, $renderTemplate); |
508 | 551 |
|
509 |
// fill with authorTeam |
|
510 |
if($authorTeam){ |
|
511 |
$authorTeamHtml = ' <span class="authorTeam">'.$authorTeam.'</span>'; |
|
512 |
array_setr('authorTeam', $authorTeamHtml, $renderTemplate); |
|
513 |
} |
|
552 |
// // fill with authorTeam |
|
553 |
// if($authorTeam){ |
|
554 |
// $authorTeamHtml = ' <span class="authorTeam">'.$authorTeam.'</span>'; |
|
555 |
// array_setr('authorTeam', $authorTeamHtml, $renderTemplate); |
|
556 |
// } |
|
557 |
|
|
514 | 558 |
|
515 | 559 |
// fill with reference |
516 |
if($taxonName->nomenclaturalReference){ |
|
517 |
$citation = $taxonName->nomenclaturalReference->titleCache; |
|
518 |
$authorTeam = cdm_taggedtext_value($taggedName, 'authors'); |
|
519 |
$citation = trim(str_replace($authorTeam, '', $citation)); |
|
520 |
if(str_beginsWith($citation, ", in")){ |
|
521 |
$citation = substr($citation, 2); |
|
522 |
$separator = ' '; |
|
523 |
} else if(!str_beginsWith($citation, "in")){ |
|
524 |
$separator = ', '; |
|
525 |
} else { |
|
526 |
$separator = ' '; |
|
560 |
if(isset($renderTemplate['referencePart'])){ |
|
561 |
|
|
562 |
// [Eckhard]:"Komma nach dem Taxonnamen ist grunsätzlich falsch, |
|
563 |
// Komma nach dem Autornamen ist überall dort falsch, wo ein "in" folgt." |
|
564 |
if(isset($renderTemplate['referencePart']['reference']) && $taxonName->nomenclaturalReference){ |
|
565 |
$microreference = null; |
|
566 |
if(isset($renderTemplate['referencePart']['microreference'])){ |
|
567 |
$microreference = $taxonName->nomenclaturalMicroReference; |
|
568 |
} |
|
569 |
$citation = cdm_ws_get(CDM_WS_NOMENCLATURAL_REFERENCE_CITATION, array($taxonName->nomenclaturalReference->uuid, $microreference)); |
|
570 |
$citation = $citation->String; |
|
571 |
// find preceding element of the refrence |
|
572 |
$precedingKey = get_preceding_contentElementKey('reference', $renderTemplate); |
|
573 |
if(str_beginsWith($citation, ", in")){ |
|
574 |
$citation = substr($citation, 2); |
|
575 |
$separator = ' '; |
|
576 |
} else if(!str_beginsWith($citation, "in") && $precedingKey == 'authors'){ |
|
577 |
$separator = ', '; |
|
578 |
} else { |
|
579 |
$separator = ' '; |
|
580 |
} |
|
581 |
|
|
582 |
$referenceArray['#separator'] = $separator; |
|
583 |
$referenceArray['#html'] = '<span class="reference">'.$citation.'</span>'; |
|
584 |
array_setr('reference', $referenceArray, $renderTemplate); |
|
527 | 585 |
} |
528 |
$referenceArray['#separator'] = $separator; |
|
529 |
$referenceArray['#html'] = '<span class="reference">'.$citation.'</span>'; |
|
530 |
array_setr('reference', $referenceArray, $renderTemplate); |
|
531 |
} |
|
532 |
|
|
533 |
// fill with microreference |
|
534 |
if($taxonName->nomenclaturalMicroReference){ |
|
535 |
$microreferenceHtml = '<span class="microreference">: ' . $taxonName->nomenclaturalMicroReference . '</span>'; |
|
536 |
array_setr('microreference', $microreferenceHtml, $renderTemplate); |
|
586 |
|
|
587 |
// if authors have been removed from the name part the last named authorteam |
|
588 |
// should be added to the reference citation, otherwise, keep the separator |
|
589 |
// out of the reference |
|
590 |
if(isset($renderTemplate['referencePart']['authors']) && $lastAuthorElementString){ |
|
591 |
// if the nomenclaturalReference cintation is not included in the reference part but diplay of the microreference |
|
592 |
// is whanted append the microreference to the authorTeam |
|
593 |
if(!isset($renderTemplate['referencePart']['reference']) && isset($renderTemplate['referencePart']['microreference'])){ |
|
594 |
$separator = ": "; |
|
595 |
$citation = $taxonName->nomenclaturalMicroReference; |
|
596 |
} |
|
597 |
$referenceArray['#html'] = ' <span class="reference">'.$lastAuthorElementString.$separator.$citation.'</span>'; |
|
598 |
array_setr('authors', $referenceArray, $renderTemplate); |
|
599 |
} |
|
600 |
|
|
537 | 601 |
} |
538 | 602 |
|
539 | 603 |
// fill with status |
... | ... | |
614 | 678 |
return null; |
615 | 679 |
} |
616 | 680 |
|
681 |
function &get_preceding_contentElement($contentElementKey, array &$renderTemplate){ |
|
682 |
$precedingElement = null; |
|
683 |
foreach($renderTemplate as &$part){ |
|
684 |
foreach($part as $key=>&$element){ |
|
685 |
if($key == $contentElementKey){ |
|
686 |
return $precedingElement; |
|
687 |
} |
|
688 |
$precedingElement = $element; |
|
689 |
} |
|
690 |
} |
|
691 |
return null; |
|
692 |
} |
|
693 |
|
|
694 |
function &get_preceding_contentElementKey($contentElementKey, array &$renderTemplate){ |
|
695 |
$precedingKey = null; |
|
696 |
foreach($renderTemplate as &$part){ |
|
697 |
foreach($part as $key=>&$element){ |
|
698 |
if($key == $contentElementKey){ |
|
699 |
return $precedingKey; |
|
700 |
} |
|
701 |
if(!str_beginsWith($key, '#')){ |
|
702 |
$precedingKey = $key; |
|
703 |
} |
|
704 |
} |
|
705 |
} |
|
706 |
return null; |
|
707 |
} |
|
708 |
|
|
617 | 709 |
|
618 | 710 |
function theme_cdm_related_taxon($taxon, $reltype_uuid = '', $displayNomRef = true){ |
619 | 711 |
|
... | ... | |
931 | 1023 |
$hideTabs[] = theme('cdm_taxonpage_tab', 'Images'); |
932 | 1024 |
|
933 | 1025 |
} |
1026 |
|
|
1027 |
// hideImage flag depending on administative preset |
|
1028 |
$hideImages = false; |
|
1029 |
if(variable_get('image_hide_rank', '0') != '0'){ |
|
1030 |
$rankCompare = rank_compare($taxon->name->rank->uuid, variable_get('image_hide_rank', '-99')); |
|
1031 |
$hideImages = ($rankCompare > -1); |
|
1032 |
} |
|
934 | 1033 |
// $hideTabs[] = theme('cdm_taxonpage_tab', 'General'); |
935 | 1034 |
// $hideTabs[] = theme('cdm_taxonpage_tab', 'Synonymy') |
936 | 1035 |
|
... | ... | |
956 | 1055 |
$mergedTrees = cdm_ws_descriptions_by_featuretree($featureTree, $taxonDescriptions, variable_get('cdm_dataportal_descriptions_separated', FALSE)); |
957 | 1056 |
|
958 | 1057 |
$out .= '<div id="general">'; |
959 |
$out .= theme('cdm_taxon_page_description', $taxon, $mergedTrees, $media); |
|
1058 |
$out .= theme('cdm_taxon_page_description', $taxon, $mergedTrees, $media, $hideImages);
|
|
960 | 1059 |
$out .= '</div>'; |
961 | 1060 |
} |
962 | 1061 |
// --- IMAGES --- // |
963 |
if($page_part == 'images' || $page_part == 'all'){ |
|
1062 |
if(!$hideImages && $page_part == 'images' || $page_part == 'all'){
|
|
964 | 1063 |
$out .= '<div id="images">'; |
965 | 1064 |
if($page_part == 'all'){ |
966 | 1065 |
$out .= '<h2>'.t('Images').'</h2>'; |
... | ... | |
997 | 1096 |
* accepted taxon. |
998 | 1097 |
* |
999 | 1098 |
*/ |
1000 |
function theme_cdm_taxon_page_description($taxon, $mergedTrees, $media = null){ |
|
1099 |
function theme_cdm_taxon_page_description($taxon, $mergedTrees, $media = null, $hideImages = false){
|
|
1001 | 1100 |
|
1002 | 1101 |
// preferred image |
1003 | 1102 |
// hardcoded for testing; |
1103 |
//if(!$hideImages){ |
|
1004 | 1104 |
//$defaultPreferredImage = drupal_get_path('theme', 'palmweb_2').'/images/no_picture.png'; |
1005 | 1105 |
//$out .= '<div class="preferredImage">'.theme('cdm_preferredImage', $media, $defaultPreferredImage, '&width=333&height=220&quality=95&format=jpeg').'</div>'; |
1006 |
|
|
1106 |
//} |
|
1107 |
|
|
1007 | 1108 |
// description TOC |
1008 | 1109 |
$out .= theme('cdm_featureTreeTOCs', $mergedTrees); |
1009 | 1110 |
// description |
... | ... | |
1290 | 1391 |
if(!$taxonRelationships){ |
1291 | 1392 |
return; |
1292 | 1393 |
} |
1293 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/cluetip/jquery.cluetip.js'); |
|
1294 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/jquery.dimensions.js'); |
|
1295 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/cluetip/jquery.hoverIntent.js'); |
|
1296 |
drupal_add_css(drupal_get_path('module', 'cdm_dataportal').'/js/cluetip/jquery.cluetip.css'); |
|
1297 |
|
|
1298 |
drupal_add_js ("$(document).ready(function(){ |
|
1299 |
$('.cluetip').css({color: '#0062C2'}).cluetip({ |
|
1300 |
splitTitle: '|', |
|
1301 |
showTitle: true, |
|
1302 |
activation: 'hover', |
|
1303 |
arrows: true, |
|
1304 |
dropShadow: false, |
|
1305 |
cluetipClass: 'rounded' |
|
1306 |
}); |
|
1307 |
});", 'inline'); |
|
1394 |
|
|
1395 |
_add_js_cluetip(); |
|
1308 | 1396 |
|
1309 | 1397 |
// aggregate misapplied names having the same fullname: |
1310 | 1398 |
$misapplied = array(); |
... | ... | |
1409 | 1497 |
} |
1410 | 1498 |
|
1411 | 1499 |
function theme_cdm_typedesignations($typeDesignations = array()){ |
1500 |
|
|
1501 |
_add_js_cluetip(); |
|
1412 | 1502 |
$renderPath = 'typedesignations'; |
1413 | 1503 |
$out = '<ul class="typeDesignations">'; |
1414 | 1504 |
|
... | ... | |
1450 | 1540 |
foreach($specimenTypeDesignations as $std){ |
1451 | 1541 |
|
1452 | 1542 |
$typeReference = ''; |
1453 |
if(!empty($std->citation)){ |
|
1543 |
//show citation only for Lectotype or Neotype |
|
1544 |
$showCitation = isset($std->typeStatus) && ($std->typeStatus->uuid == UUID_NEOTYPE || $std->typeStatus->uuid == UUID_LECTOTYPE); |
|
1545 |
if($showCitation && !empty($std->citation)){ |
|
1546 |
$shortCitation = $std->citation->authorTeam->titleCache; |
|
1547 |
$shortCitation .= (strlen($shortCitation) > 0 ? ' ' : '' ). partialToYear($std->citation->datePublished->start); |
|
1548 |
if(strlen($shortCitation) == 0){ |
|
1549 |
$shortCitation = theme('cdm_reference',$std->citation ); |
|
1550 |
$missingShortCitation = true; |
|
1551 |
} |
|
1454 | 1552 |
$typeReference .= ' (' . t('designated by'); |
1455 |
$typeReference .= ' <span class="typeReference cluetip no-print" title="|'. htmlspecialchars(theme('cdm_reference',$std->citation )) .'|">'; |
|
1456 |
$typeReference .= $std->citation->authorTeam->titleCache . ' ' . partialToYear($std->citation->datePublished->start); |
|
1457 |
$typeReference .= '</span>'; |
|
1553 |
$typeReference .= ' <span class="typeReference '.($missingShortCitation ? '' : 'cluetip').' no-print" title="'. htmlspecialchars('|'.theme('cdm_reference',$std->citation ).'|') .'">'; |
|
1554 |
$typeReference .= $shortCitation.'</span>'; |
|
1458 | 1555 |
$typeReference .= ')'; |
1459 |
$typeReference .= '<span class="reference only-print">(designated by '.theme('cdm_reference',$std->citation ).')</span>'; |
|
1556 |
//$typeReference .= '<span class="reference only-print">(designated by '.theme('cdm_reference',$std->citation ).')</span>';
|
|
1460 | 1557 |
} |
1461 | 1558 |
|
1462 | 1559 |
$out .= '<li class="specimenTypeDesignation">'; |
Also available in: Unified diff
release v2.0