Browse Source

Update print to use better css and new metadata framework.

pull/409/head
Jordan Dukart 11 years ago
parent
commit
a2a5510fa2
  1. 13
      css/islandora.base.css
  2. 10
      css/islandora.print.css
  3. 14
      includes/metadata.inc
  4. 4
      islandora.module
  5. 2
      theme/islandora-dublin-core-display.tpl.php
  6. 18
      theme/islandora-object-print.tpl.php

13
css/islandora.base.css

@ -43,6 +43,19 @@ dl.islandora-inline-metadata {
padding-left: 40px; padding-left: 40px;
} }
dl.islandora-metadata-fields {
width:100%;
}
.islandora-metadata dt,
.islandora-metadata dd {
border-top:1px solid #e5e5e5;
}
.islandora-metadata dt.first,
.islandora-metadata dd.first {
border-top:0;
}
/* /*
* In this rule, we reset the white-space (see hack above) * In this rule, we reset the white-space (see hack above)
*/ */

10
css/islandora.print.css

@ -4,15 +4,6 @@
* *
* We provide some sane print styling for Drupal, hiding most visuals. * We provide some sane print styling for Drupal, hiding most visuals.
*/ */
a:link,
a:visited { /* underline all links */
text-decoration: underline !important;
}
#site-name a:link,
#site-name a:visited { /* Don't underline header */
text-decoration: none !important;
}
#content a[href^="javascript:"]:after, #content a[href^="javascript:"]:after,
#content a[href^="#"]:after { /* Only display useful links. */ #content a[href^="#"]:after { /* Only display useful links. */
@ -66,6 +57,7 @@ body.sidebar-first {
.book-navigation, .book-navigation,
.forum-topic-navigation, .forum-topic-navigation,
.pager, .pager,
.contextual-links-region,
.feed-icons { /* Hide sidebars and nav elements */ .feed-icons { /* Hide sidebars and nav elements */
visibility: hidden !important; visibility: hidden !important;
display: none !important; display: none !important;

14
includes/metadata.inc

@ -13,16 +13,16 @@
* @return string * @return string
* Markup to be rendered for display on Islandora object pages. * Markup to be rendered for display on Islandora object pages.
*/ */
function islandora_retrieve_metadata_markup(AbstractObject $object) { function islandora_retrieve_metadata_markup(AbstractObject $object, $print = FALSE) {
$viewers = module_invoke_all('islandora_metadata_display_info'); $viewers = module_invoke_all('islandora_metadata_display_info');
$viewer = variable_get('islandora_metadata_display', 'dublin_core'); $viewer = variable_get('islandora_metadata_display', 'dublin_core');
$markup = ''; $markup = '';
if (isset($viewers[$viewer]['metadata callback'])) { if (isset($viewers[$viewer]['metadata callback'])) {
$markup = call_user_func($viewers[$viewer]['metadata callback'], $object); $markup = call_user_func($viewers[$viewer]['metadata callback'], $object, $print);
// The callback doesn't have any markup provided for this particular object, // The callback doesn't have any markup provided for this particular object,
// default back to the dublin_core display. // default back to the dublin_core display.
if ($markup === FALSE) { if ($markup === FALSE) {
$markup = call_user_func($viewers['dublin_core']['metadata callback'], $object); $markup = call_user_func($viewers['dublin_core']['metadata callback'], $object, $print);
} }
} }
return $markup; return $markup;
@ -33,6 +33,7 @@ function islandora_retrieve_metadata_markup(AbstractObject $object) {
* *
* @param AbstractObject $object * @param AbstractObject $object
* An AbstractObject representing an object within Fedora. * An AbstractObject representing an object within Fedora.
*
* @return string * @return string
* Markup to be rendered for description on Islandora object pages. * Markup to be rendered for description on Islandora object pages.
*/ */
@ -137,13 +138,16 @@ function islandora_metadata_display_form_submit($form, $form_state) {
* *
* @param AbstractObject $object * @param AbstractObject $object
* An AbstractObject representing an object within Fedora. * An AbstractObject representing an object within Fedora.
* @param bool $print
* Whether the display is being printed or not.
* *
* @return string * @return string
* Markup representing the rendered metadata from Dublin Core. * Markup representing the rendered metadata from Dublin Core.
*/ */
function islandora_metadata_display_callback(AbstractObject $object) { function islandora_metadata_display_callback(AbstractObject $object, $print = FALSE) {
$elements = array( $elements = array(
'islandora_object' => $object, 'islandora_object' => $object,
'print' => $print,
); );
return theme('islandora_dublin_core_display', $elements); return theme('islandora_dublin_core_display', $elements);
} }
@ -151,7 +155,7 @@ function islandora_metadata_display_callback(AbstractObject $object) {
/** /**
* Metadata description callback for rendering Dublin Core description. * Metadata description callback for rendering Dublin Core description.
* *
* @param AbstractObject $object * @param AbstractObject $islandora_object
* An AbstractObject representing an object within Fedora. * An AbstractObject representing an object within Fedora.
* *
* @return string * @return string

4
islandora.module

@ -1021,6 +1021,7 @@ function islandora_default_islandora_view_object($object) {
function islandora_default_islandora_printer_object($object, $alter) { function islandora_default_islandora_printer_object($object, $alter) {
module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/datastream'); module_load_include('inc', 'islandora', 'includes/datastream');
module_load_include('inc', 'islandora', 'includes/metadata');
$path = drupal_get_path('module', 'islandora'); $path = drupal_get_path('module', 'islandora');
drupal_add_css($path . '/css/islandora.print.css'); drupal_add_css($path . '/css/islandora.print.css');
@ -1035,11 +1036,12 @@ function islandora_default_islandora_printer_object($object, $alter) {
catch (Exception $e) { catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE); drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE);
} }
$metadata = islandora_retrieve_metadata_markup($object, TRUE);
$variables = isset($dc_object) ? $dc_object->asArray() : array(); $variables = isset($dc_object) ? $dc_object->asArray() : array();
$output = theme('islandora_object_print_object', array( $output = theme('islandora_object_print_object', array(
'object' => $object, 'object' => $object,
'dc_array' => $variables, 'dc_array' => $variables,
'metadata' => $metadata,
'islandora_content' => $alter)); 'islandora_content' => $alter));
return array('Default output' => array('#markup' => $output)); return array('Default output' => array('#markup' => $output));

2
theme/islandora-dublin-core-display.tpl.php

@ -16,7 +16,7 @@
* @see theme_islandora_dublin_core_display() * @see theme_islandora_dublin_core_display()
*/ */
?> ?>
<fieldset class="collapsible collapsed"> <fieldset <?php $print ? print('class="islandora islandora-metadata"') : print('class="islandora islandora-metadata collapsible collapsed"');?>>
<legend><span class="fieldset-legend"><?php print t('Details'); ?></span></legend> <legend><span class="fieldset-legend"><?php print t('Details'); ?></span></legend>
<div class="fieldset-wrapper"> <div class="fieldset-wrapper">
<dl xmlns:dcterms="http://purl.org/dc/terms/" class="islandora-inline-metadata islandora-metadata-fields"> <dl xmlns:dcterms="http://purl.org/dc/terms/" class="islandora-inline-metadata islandora-metadata-fields">

18
theme/islandora-object-print.tpl.php

@ -10,21 +10,5 @@
<div> <div>
<?php print $islandora_content; ?> <?php print $islandora_content; ?>
</div> </div>
<fieldset class="islandora-basic-image-metadata islandora"> <?php print $metadata; ?>
<legend><span class="fieldset-legend"><?php print t('Details'); ?></span></legend>
<div class="fieldset-wrapper">
<dl class="islandora-inline-metadata islandora-basic-image-fields">
<?php $row_field = 0; ?>
<?php foreach( $dc_array as $key => $value): ?>
<dt class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['label']; ?>
</dt>
<dd class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['value']; ?>
</dd>
<?php $row_field++; ?>
<?php endforeach; ?>
</dl>
</div>
</fieldset>
</div> </div>

Loading…
Cancel
Save