Revision 0a288588
Added by Andreas Kohlbecker about 7 years ago
modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
765 | 765 |
*/ |
766 | 766 |
function timePeriodToString($period, $stripZeros = TRUE, $format = "YYYY-MM-DD") { |
767 | 767 |
$dateString = ''; |
768 |
if ($period->start) { |
|
769 |
$dateString = partialToDate($period->start, $stripZeros, $format); |
|
770 |
} |
|
771 |
if ($period->end) { |
|
772 |
$dateString .= (strlen($dateString) > 0 ? ' ' . t('to') . ' ' : '') . partialToDate($period->end, $stripZeros, $format); |
|
768 |
if($period->freeText){ |
|
769 |
$dateString = $period->freeText; |
|
770 |
} else { |
|
771 |
if ($period->start) { |
|
772 |
$dateString = partialToDate($period->start, $stripZeros, $format); |
|
773 |
} |
|
774 |
if ($period->end) { |
|
775 |
$dateString .= (strlen($dateString) > 0 ? ' ' . t('to') . ' ' : '') . partialToDate($period->end, $stripZeros, $format); |
|
776 |
} |
|
773 | 777 |
} |
774 | 778 |
return $dateString; |
775 | 779 |
} |
modules/cdm_dataportal/cdm_dataportal.css | ||
---|---|---|
539 | 539 |
background-color: #eee; |
540 | 540 |
} |
541 | 541 |
|
542 |
/* |
|
543 |
* ======= Reference Page ======= |
|
544 |
*/ |
|
545 |
|
|
546 |
table.cdm\:Reference { |
|
547 |
width: 100%; |
|
548 |
} |
|
542 | 549 |
|
543 | 550 |
/* |
544 | 551 |
* ======= specific blocks ======= |
modules/cdm_dataportal/theme/cdm_dataportal.page.theme | ||
---|---|---|
396 | 396 |
|
397 | 397 |
$field_order = array( |
398 | 398 |
"title", |
399 |
// "titleCache", |
|
399 |
"abbrevTitle", |
|
400 |
// "titleCache" abbrevTitleCache |
|
400 | 401 |
// "citation", |
401 | 402 |
"authorship", |
402 | 403 |
"editor", |
... | ... | |
418 | 419 |
"previousVersion", |
419 | 420 |
"isbn",// Class Book. |
420 | 421 |
"issn",// Class Journal. |
421 |
"uri", |
|
422 |
"doi", |
|
423 |
"uri" |
|
422 | 424 |
); |
423 | 425 |
|
424 |
$header = array( |
|
425 |
t('Field'), |
|
426 |
t('Value'), |
|
427 |
); |
|
428 | 426 |
$table_rows = array(); |
429 | 427 |
|
430 | 428 |
if (!isset($reference->authorship)) { |
... | ... | |
448 | 446 |
$datePublished = timePeriodToString($period); |
449 | 447 |
if (isset($datePublished) && $datePublished != '') { |
450 | 448 |
$table_rows[] = array( |
451 |
t(ucfirst(strtolower($fieldname))),
|
|
449 |
t("Date published"),
|
|
452 | 450 |
$datePublished, |
453 | 451 |
); |
454 | 452 |
} |
455 | 453 |
// $datePublished = array(t(ucfirst(strtolower($fieldname))), |
456 | 454 |
// $datePublished); |
457 | 455 |
} |
456 |
elseif ($fieldname == "doi" && is_object($reference->doi)) { |
|
457 |
$table_rows[] = array( |
|
458 |
t(ucfirst(strtolower($fieldname))), |
|
459 |
cdm_doi($reference->doi, false) |
|
460 |
); |
|
461 |
} |
|
462 |
elseif ($fieldname == "uri" && isset($reference->uri) && $reference->uri) { |
|
463 |
$table_rows[] = array( |
|
464 |
t(ucfirst(strtolower($fieldname))), |
|
465 |
cdm_external_uri($reference->uri, false) |
|
466 |
); |
|
467 |
} |
|
458 | 468 |
elseif (is_object($reference->$fieldname)) { |
459 | 469 |
if ($fieldname == "authorship") { |
460 | 470 |
$dump = $reference->$fieldname; |
... | ... | |
498 | 508 |
else { |
499 | 509 |
$value = $reference->$fieldname->titleCache; |
500 | 510 |
} |
511 |
|
|
512 |
|
|
501 | 513 |
if (isset($value) && $value != '') { |
502 | 514 |
$table_rows[] = array( |
503 | 515 |
t(ucfirst(strtolower($fieldname))), |
504 | 516 |
$value, |
505 | 517 |
); |
506 | 518 |
} |
519 |
|
|
507 | 520 |
} |
508 | 521 |
else { |
509 | 522 |
if (isset($reference->$fieldname) && $reference->$fieldname != '') { |
... | ... | |
519 | 532 |
$out = theme_table(array( |
520 | 533 |
'header' => array(), |
521 | 534 |
'rows' => $table_rows, |
522 |
'attributes' => array(), |
|
535 |
'attributes' => array( |
|
536 |
'class' => html_class_attribute_ref($reference) |
|
537 |
), |
|
523 | 538 |
'caption' => NULL, |
524 | 539 |
'colgroups' => NULL, |
525 | 540 |
'sticky' => NULL, |
526 |
'empty' => NULL, |
|
541 |
'empty' => NULL,
|
|
527 | 542 |
)); |
528 | 543 |
|
544 |
if($reference->referenceAbstract){ |
|
545 |
$out .= '<div class="abstract">' . $reference->referenceAbstract . '</div>'; |
|
546 |
} |
|
547 |
|
|
529 | 548 |
// Annotations below the table. |
530 | 549 |
$annotations = cdm_ws_getAnnotationsFor($reference); |
531 | 550 |
$out .= theme("cdm_annotations", array('annotations' => $annotations)); |
modules/cdm_dataportal/theme/cdm_dataportal.references.theme | ||
---|---|---|
80 | 80 |
$out .= ": " . $microReference; |
81 | 81 |
} |
82 | 82 |
|
83 |
if (isset($reference->doi) && !empty($reference->doi)) { |
|
83 |
if(isset($reference->doi)){ |
|
84 |
$out .= cdm_doi($reference->doi); |
|
85 |
} |
|
86 |
|
|
87 |
if (isset($reference->uri)){ |
|
88 |
$out .= cdm_external_uri($reference->uri); |
|
89 |
} |
|
90 |
|
|
91 |
return $out; |
|
92 |
} |
|
84 | 93 |
|
85 |
$doi_resolve_uri = 'http://doi.org/' . $reference->doi->prefix; |
|
86 |
if(isset($reference->doi->suffix)){ |
|
87 |
$doi_resolve_uri .= '/' . $reference->doi->suffix; |
|
94 |
/** |
|
95 |
* @param $reference |
|
96 |
* @param $out |
|
97 |
* @return string |
|
98 |
*/ |
|
99 |
function cdm_external_uri($uri, $iconified = true) |
|
100 |
{ |
|
101 |
if (!empty($uri)) { |
|
102 |
if($iconified){ |
|
103 |
return l(font_awesome_icon_markup('fa-external-link', array('class' => array('superscript'))), $uri, array('html' => TRUE)); |
|
104 |
} else { |
|
105 |
return l($uri, $uri); |
|
88 | 106 |
} |
89 |
$out .= l(font_awesome_icon_markup('fa-external-link-square', array('class' => array('superscript'))), $doi_resolve_uri, array('html' => TRUE)); |
|
90 | 107 |
} |
91 |
if (isset($reference->uri) && !empty($reference->uri)) { |
|
92 |
$out .= l(font_awesome_icon_markup('fa-external-link', array('class' => array('superscript'))), $reference->uri, array('html' => TRUE)); |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Creates markup for a CDM Doi entity. |
|
112 |
* |
|
113 |
* @param $doi |
|
114 |
* The CDM DOI |
|
115 |
* |
|
116 |
* @return string |
|
117 |
* Markup |
|
118 |
*/ |
|
119 |
function cdm_doi($doi, $iconified = true) { |
|
120 |
|
|
121 |
if (!empty($doi)) { |
|
122 |
|
|
123 |
$doi_resolve_uri = 'http://doi.org/' . $doi->prefix; |
|
124 |
if (isset($doi->suffix)) { |
|
125 |
$doi_resolve_uri .= '/' . $doi->suffix; |
|
126 |
} |
|
127 |
if($iconified){ |
|
128 |
return l(font_awesome_icon_markup('fa-external-link-square', array('class' => array('superscript'))), $doi_resolve_uri, array('html' => TRUE)); |
|
129 |
} else { |
|
130 |
return l($doi_resolve_uri, $doi_resolve_uri); |
|
131 |
} |
|
93 | 132 |
} |
94 | 133 |
|
95 |
return $out; |
|
96 | 134 |
} |
97 | 135 |
|
98 | 136 |
/** |
Also available in: Unified diff
#5723 fixing several problems with the reference page