Revision f79d32d6
Added by Andreas Kohlbecker almost 7 years ago
modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
948 | 948 |
|
949 | 949 |
case 'cdm_media_caption': |
950 | 950 |
$variables = array( |
951 |
'media' => $obj, |
|
952 |
// $args[0] is set in taxon_image_gallery_default in |
|
953 |
// cdm_dataportal.page.theme. |
|
954 |
'elements' => isset($args[0]) ? $args[0] : array( |
|
955 |
'title', |
|
956 |
'description', |
|
957 |
'artist', |
|
958 |
'location', |
|
959 |
'rights', |
|
951 |
'media' => $obj,
|
|
952 |
// $args[0] is set in taxon_image_gallery_default in
|
|
953 |
// cdm_dataportal.page.theme.
|
|
954 |
'elements' => isset($args[0]) ? $args[0] : array(
|
|
955 |
'title',
|
|
956 |
'description',
|
|
957 |
'artist',
|
|
958 |
'location',
|
|
959 |
'rights',
|
|
960 | 960 |
), |
961 |
'fileUri' => isset($args[1]) ? $args[1] : NULL,
|
|
961 |
'sources_as_content' => isset($args[1]) ? $args[1] : FALSE
|
|
962 | 962 |
); |
963 | 963 |
$reponse_data = theme($hook, $variables); |
964 | 964 |
break; |
modules/cdm_dataportal/cdm_dataportal.css | ||
---|---|---|
578 | 578 |
margin-left: 0; |
579 | 579 |
} |
580 | 580 |
|
581 |
.media-caption dt.title { |
|
582 |
display: none; |
|
583 |
} |
|
584 |
|
|
581 | 585 |
.image-passe-partout{ |
582 | 586 |
border: 0px none; |
583 | 587 |
background-color: #eee; |
modules/cdm_dataportal/classes/renderhints.php | ||
---|---|---|
54 | 54 |
/** |
55 | 55 |
* @todo document this function. |
56 | 56 |
*/ |
57 |
public static function clearFootnoteListKey() { |
|
58 |
self::$footnoteListKey = FALSE; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* @todo document this function. |
|
63 |
*/ |
|
57 | 64 |
public static function pushToRenderStack($pathelement) { |
58 | 65 |
array_push(self::$renderStack, $pathelement); |
59 | 66 |
} |
modules/cdm_dataportal/includes/descriptions.inc | ||
---|---|---|
502 | 502 |
|
503 | 503 |
$config = $feature_block_settings; |
504 | 504 |
unset($config['sources_as_content_to_bibliography']); |
505 |
$config['add_footnote_keys'] = 0; |
|
505 | 506 |
if($feature_block_settings['sources_as_content'] !== 1 || $feature_block_settings['sources_as_content_to_bibliography'] == 1) { |
506 | 507 |
$config['add_footnote_keys'] = 1; |
507 | 508 |
} |
modules/cdm_dataportal/includes/media.inc | ||
---|---|---|
397 | 397 |
|
398 | 398 |
// preparing the part link (= click on image iteself) which can be handled in two ways |
399 | 399 |
// |
400 |
// 1. open image in lightbox, the captions in the lighhtbox will be loaded via AHAH
|
|
400 |
// 1. open image in lightbox, the captions in the lightbox will be loaded via AHAH |
|
401 | 401 |
// 2. open the media in a new window with target 'specimen' |
402 | 402 |
if ($mediaLinkType == 'LIGHTBOX' && $contentTypeDirectory == 'image') { |
403 | 403 |
$mediaPartLinkAttributes['class'] = array('lightbox'); |
... | ... | |
474 | 474 |
$out .= '<tr><td colspan="' . $cols . '">' . $moreHtml . '</td></tr>'; |
475 | 475 |
} |
476 | 476 |
$out .= '</table>'; |
477 |
|
|
477 | 478 |
return $out; |
478 | 479 |
} |
479 | 480 |
|
modules/cdm_dataportal/theme/cdm_dataportal.media.theme | ||
---|---|---|
62 | 62 |
* |
63 | 63 |
* @return string |
64 | 64 |
* The markup |
65 |
* |
|
66 |
* FIXME: move to descriptions.inc |
|
65 | 67 |
*/ |
66 | 68 |
function cdm_description_element_media($descriptionElement, $mimeTypePreference) { |
67 | 69 |
|
... | ... | |
205 | 207 |
|
206 | 208 |
$media = $variables['media']; |
207 | 209 |
$elements = $variables['elements']; |
210 |
$sources_as_content = $variables['sources_as_content']; |
|
208 | 211 |
$media_metadata = read_media_metadata($media); |
209 | 212 |
|
210 | 213 |
$doTitle = !$elements || array_search('title', $elements) !== FALSE; |
... | ... | |
217 | 220 |
$footnote_list_key = 'media-' . $media->uuid; |
218 | 221 |
|
219 | 222 |
// handle sources and annotations |
220 |
cdm_lazyload_array_field('media', 'sources', $media); |
|
221 | 223 |
cdm_lazyload_array_field('media', 'annotations', $media); |
222 | 224 |
$annotations_and_sources = handle_annotations_and_sources( |
223 | 225 |
$media, |
224 | 226 |
array( |
225 |
'sources_as_content' => $doTitle ? 0 : 1,
|
|
227 |
'sources_as_content' => $sources_as_content,
|
|
226 | 228 |
'link_to_name_used_in_source' => 1, |
227 | 229 |
'link_to_reference' => 0, |
228 |
'add_footnote_keys' => 1 |
|
230 |
'add_footnote_keys' => $sources_as_content ? 0 : 1
|
|
229 | 231 |
), |
230 |
$doTitle ? $media_metadata['title'] : NULL,
|
|
231 |
$footnote_list_key |
|
232 |
NULL, |
|
233 |
$footnote_list_key
|
|
232 | 234 |
); |
233 | 235 |
|
234 | 236 |
$out = ''; |
235 | 237 |
|
236 | 238 |
// Title. |
237 | 239 |
if ($doTitle) { |
238 |
$title_string = $media_metadata['title'] . ' ' . join(', ', $annotations_and_sources['source_references']) . $annotations_and_sources['foot_note_keys']; |
|
240 |
$title_string = $media_metadata['title'] |
|
241 |
. $annotations_and_sources['foot_note_keys']; // placing the footnote keys here is not optimal, see #6329 A.1. |
|
239 | 242 |
$title_string = trim($title_string); |
240 | 243 |
if (empty($title_string) && !($doDescription && $media_metadata['description'])) { |
241 | 244 |
// Use filename as fallback option if no description and no source citations are available. |
... | ... | |
245 | 248 |
$descriptionPrefix = "- "; |
246 | 249 |
} |
247 | 250 |
|
251 |
$groups = array(); |
|
248 | 252 |
|
249 |
$out .= '<dl class="media-caption">'; // FIXME rename to media-details
|
|
253 |
$out .= '<dl class="media-caption">'; |
|
250 | 254 |
// Description. |
251 | 255 |
if ($media_metadata['description'] && $doDescription) { |
252 |
$out .= '<dt class = "description">' . t('Description') . ':'. '</dt> <dd class = "description">' . $descriptionPrefix . $media_metadata['description'] . '</dd>';
|
|
256 |
_description_list_group_add($groups, t('Description') . ':', $descriptionPrefix . $media_metadata['description'] );
|
|
253 | 257 |
} |
254 | 258 |
// Artist. |
255 | 259 |
if ($media_metadata['artist'] && $doArtist) { |
256 |
$out .= '<dt class = "artist">' . t('Artist') . ':' . '</dt> <dd class = "artist">' . $media_metadata['artist'] . '</dd>';
|
|
260 |
_description_list_group_add($groups, t('Artist') . ':', $media_metadata['artist'] );
|
|
257 | 261 |
} |
258 | 262 |
// Location. |
259 | 263 |
if ($doLocation) { |
... | ... | |
274 | 278 |
$location .= $media_metadata['location']['country']; |
275 | 279 |
} |
276 | 280 |
if ($location) { |
277 |
$out .= '<dt class = "location">' . t('Location') . ':' . '</dt> <dd class = "location">' . $location . '</dd>';
|
|
281 |
_description_list_group_add($groups, t('Location') . ':', $location );
|
|
278 | 282 |
} |
279 | 283 |
} |
280 | 284 |
// Rights. |
281 | 285 |
if ($doRights) { |
282 |
$rights_render_item = array(
|
|
283 |
'#theme' => 'description_list',
|
|
284 |
'#groups' => cdm_rights_as_dl_groups($media_metadata['rights']) |
|
285 |
);
|
|
286 |
$out .= drupal_render($rights_render_item);
|
|
286 |
$groups = array_merge($groups, cdm_rights_as_dl_groups($media_metadata['rights']));
|
|
287 |
}
|
|
288 |
|
|
289 |
if(!empty($annotations_and_sources['source_references'])){
|
|
290 |
_description_list_group_add($groups, t('Sources') . ':', join(', ', $annotations_and_sources['source_references']) );
|
|
287 | 291 |
} |
292 |
|
|
288 | 293 |
// TODO add all other metadata elements generically. |
289 |
$out .= '</dl>'; |
|
294 |
|
|
295 |
$description_list_item = array( |
|
296 |
'#theme' => 'description_list', |
|
297 |
'#groups' => $groups, |
|
298 |
'#attributes' => array('class' => 'media-caption') |
|
299 |
); |
|
300 |
$out .= drupal_render($description_list_item); |
|
290 | 301 |
|
291 | 302 |
$out .= theme('cdm_footnotes', array('footnoteListKey' => $footnote_list_key)); |
292 | 303 |
|
modules/cdm_dataportal/theme/cdm_dataportal.page.theme | ||
---|---|---|
609 | 609 |
$out .= '</div>'; |
610 | 610 |
|
611 | 611 |
// General media metadata. |
612 |
$metadataToPrint = theme('cdm_media_caption', array('media' => $media)); |
|
612 |
$metadataToPrint = theme('cdm_media_caption', array('media' => $media, 'sources_as_content' => true));
|
|
613 | 613 |
$out .= $metadataToPrint; |
614 | 614 |
|
615 | 615 |
// Tabs for the different representations. |
modules/cdm_dataportal/theme/theme_registry.inc | ||
---|---|---|
90 | 90 |
'cdm_media_caption' => array('variables' => array( |
91 | 91 |
'media' => NULL, |
92 | 92 |
'elements' => array('title', 'description', 'artist', 'location', 'rights'), |
93 |
'sources_as_content' => FALSE |
|
93 | 94 |
)), |
94 | 95 |
// Themes in cdm_dataportal.name.theme. |
95 | 96 |
'cdm_typedesignations' => array('variables' => array('typeDesignations' => array())), |
Also available in: Unified diff
ref #6301 sources as inline elements on media page