Browse Source

Update print to use better css and new metadata framework.

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

19
css/islandora.base.css

@ -1,4 +1,4 @@
/*
/*
Document : islandora_basic_collection.base.css
Created on : May 23, 2012, 11:22:04 AM
Description:
@ -19,7 +19,7 @@
/*
* These rules will display DTs/DDs as columns.
* Constructs must follow a key/value pair pattern.
* The three last declarations are meant to kill white space between DTs/DDs
* The three last declarations are meant to kill white space between DTs/DDs
* (result of inline-block styling)
*/
@ -43,7 +43,20 @@ dl.islandora-inline-metadata {
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)
*/
.islandora-inline-metadata dt,

10
css/islandora.print.css

@ -4,15 +4,6 @@
*
* 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^="#"]:after { /* Only display useful links. */
@ -66,6 +57,7 @@ body.sidebar-first {
.book-navigation,
.forum-topic-navigation,
.pager,
.contextual-links-region,
.feed-icons { /* Hide sidebars and nav elements */
visibility: hidden !important;
display: none !important;

16
includes/metadata.inc

@ -13,16 +13,16 @@
* @return string
* 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');
$viewer = variable_get('islandora_metadata_display', 'dublin_core');
$markup = '';
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,
// default back to the dublin_core display.
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;
@ -33,6 +33,7 @@ function islandora_retrieve_metadata_markup(AbstractObject $object) {
*
* @param AbstractObject $object
* An AbstractObject representing an object within Fedora.
*
* @return string
* 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
* An AbstractObject representing an object within Fedora.
* @param bool $print
* Whether the display is being printed or not.
*
* @return string
* 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(
'islandora_object' => $object,
'print' => $print,
);
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.
*
* @param AbstractObject $object
* @param AbstractObject $islandora_object
* An AbstractObject representing an object within Fedora.
*
* @return string
@ -173,4 +177,4 @@ function islandora_metadata_description_callback(AbstractObject $islandora_objec
'dc_array' => $dc_array,
);
return theme('islandora_dublin_core_description', $elements);
}
}

4
islandora.module

@ -1021,6 +1021,7 @@ function islandora_default_islandora_view_object($object) {
function islandora_default_islandora_printer_object($object, $alter) {
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/datastream');
module_load_include('inc', 'islandora', 'includes/metadata');
$path = drupal_get_path('module', 'islandora');
drupal_add_css($path . '/css/islandora.print.css');
@ -1035,11 +1036,12 @@ function islandora_default_islandora_printer_object($object, $alter) {
catch (Exception $e) {
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();
$output = theme('islandora_object_print_object', array(
'object' => $object,
'dc_array' => $variables,
'metadata' => $metadata,
'islandora_content' => $alter));
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()
*/
?>
<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>
<div class="fieldset-wrapper">
<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>
<?php print $islandora_content; ?>
</div>
<fieldset class="islandora-basic-image-metadata islandora">
<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>
<?php print $metadata; ?>
</div>

2
theme/theme.inc

@ -456,4 +456,4 @@ function islandora_preprocess_islandora_dublin_core_description(array &$variable
}
}
$variables['dc_array'] = isset($dc_object) ? $dc_object->asArray() : array();
}
}

Loading…
Cancel
Save