Help editing metadata displayed within Internet Archive Book Reader module (7)

319 views
Skip to first unread message

Kelli Babcock

unread,
Dec 17, 2013, 5:55:50 PM12/17/13
to isla...@googlegroups.com
Hi everyone,

I'm fairly new to Islandora and just started a position with the University of Toronto Libraries' ITS department working on their digital collections. Does anyone have experience modifying the metadata fields displayed within the Internet Archive Book Reader module in Islandora 7? 

I'm looking for information on how to modify the default fields displayed.

Right now, with my sample metadata (--METADATA--.xml attached) I get only the Title; Subtitle; Date; Name; Identifier; Physical Description, and Topic MODS elements displayed (sorry, crappy image).

What I need to have displayed are the following fields:

ISLANDORA DISPLAY

MODS ELEMENT/MODS SUB-ELEMENT

Title

<titleInfo>

   <title></title>

</titleInfo>

SubTitle

<titleInfo>

   <title></title>

   <subtitle></subtitle>

</titleInfo>

Date

<originInfo>

   <dateIssued></dateIssued>

</origininfo>

Name

<name>

   <namePart></namePart>

</name>

Identifier

<identifier></identifier>

Physical Description

<physicalDescription>

    <form></form>

</physicalDescription>

Topic

<subject>

   <topic></topic>

</subject>

Note

<note></note>

Serial Title

<relatedItem type=”series”>

   <titleInfo></titleInfo>

</relatedItem>

Publication Category

<genre></genre>


Configuring the metadata fields display in Islandora is new to me so any help or direction to the right info would be awesome :)

Take care,
Kelli



--METADATA--.xml

Nelson Hart

unread,
Dec 17, 2013, 11:02:17 PM12/17/13
to isla...@googlegroups.com
The IA book reader should really used the same metadata logic as the other content models, it currently doesn't.

If you're a dev or have access to a dev you can modify the fields by hooking this function in your theme

https://github.com/Islandora/islandora_internet_archive_bookreader/blob/7.x/theme/theme.inc#L89
and doing something similar to this
https://github.com/Islandora/islandora_internet_archive_bookreader/blob/7.x/theme/theme.inc#L118

I am writing up a slight code change to the IA Book Reader so it can use the solr metadata display module like all the other solution packs. It's currently working, just need to figure some css weirdness.

Nelson




--
You received this message because you are subscribed to the Google Groups "islandora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Daron Dierkes

unread,
Jun 3, 2014, 4:00:06 PM6/3/14
to isla...@googlegroups.com
Why might switching Metadata Display from Dublin Core to Islandora Solr Metadata occasionally make the IA book reader's metadata display twice the size of the screen?  Is it set to a width of pixels rather than a percentage?  I'm also not sure why it isn't uniform across all our books.

Amanda Lehman

unread,
Jul 3, 2014, 11:38:20 AM7/3/14
to isla...@googlegroups.com
We are working with Islandora 7 and are having the same problem - should this be a new thread? 

Ken Yang

unread,
Jul 3, 2014, 1:45:34 PM7/3/14
to isla...@googlegroups.com


1) Add code to hook_preprocess_theme().  For example: in sites/all/modules/islandora/islandora_internet_archive_bookreader/theme/theme.inc

==========================================================
/**
* Implements hook_preprocess_theme().
*/
function islandora_internet_archive_bookreader_preprocess_islandora_internet_archive_bookreader(array &$variables) {
module_load_include('inc', 'islandora_internet_archive_bookreader', 'includes/utilities');
$object = $variables['object'];

// add the following two lines of code
module_load_include('inc', 'islandora', 'includes/metadata');
$variables['metadata'] = islandora_retrieve_metadata_markup($object);

....
...
}
==========================================================


2) Update the theme file islandora-internet-archive-bookreader.tpl.php by adding a line of code "<?php print $metadata; ?>"

==========================================================
<?php
/**
* @file
*
* Theme for the Open Library Internet Archive BookReader.
*/
?>

<div id="BookReader" class="islandora-internet-archive-bookreader">
Loading the Internet Archive BookReader, please wait...
</div>

<?php print $metadata; ?>
==========================================================

3) Configure the metadata display - Kelli knows the exact steps :)

Kelli Babcock

unread,
Jul 3, 2014, 1:56:34 PM7/3/14
to isla...@googlegroups.com
Thanks for posting the above, Ken :)

Our other developer, Chul, forked the Islandora internet archive book reader module and posted our changes to the utlib git, here: https://github.com/utlib/islandora_internet_archive_bookreader/commit/48591bec0ef80c1c883bb34dba17c42a88630bdf

After the changes were pushed to our production site, I was able to configure the book content model to use the Islandora Solr Metadata Display (https://github.com/Islandora/islandora_solr_metadata). Now our book viewer has metadata displayed beneath the viewer: http://collections.library.utoronto.ca/islandora/object/govinfo1%3A39928#page/1/mode/1up - hurray!

The css is a bit off, but we can tweak that later.

Hope this helps,
Kelli

Matthew Short

unread,
Jul 16, 2014, 1:30:59 PM7/16/14
to isla...@googlegroups.com
I wanted to follow up with that CSS tweaking for Solr Metadata display within the book viewer itself, in case anyone else is working on this.

1. I first changed the class name for the dl within islandora-solr-metadata-display.tpl.php, because that same class name is used elsewhere (e.g. Solr browse). I changed it to "islandora-display-metadata." Instead of changing the .tpl.php in the module, you can just drop the updated version into your theme directory, which will override the module theme. I don't know if any of these changes would be appropriate to commit to the Solr Metadata module.:

<dl class="islandora-display-metadata islandora-metadata-fields">

2. Then I added the following to my theme's style.css to fix how the record is displayed within the viewer. (You can play with the width and padding.)

.islandora-display-metadata dl {
    overflow: hidden;
    width: 100%;
}

dl.islandora-display-metadata dt {
    width: 30%;
    padding: 5px;
    margin: 0;
    float: left;
    clear: left;
    font-weight: bold;
}

dl.islandora-display-metadata dd {
    width: 70%;
    padding: 5px;
    margin: 0;
    overflow: hidden;
}

#cboxContent {
height: 100% !important;
}

3. If you have fields that are not required and don't want to display empty field labels (e.g. sometimes you have subjects, but not always, and you don't want to display the empty "Subject" label), you can also add some logic to islandora-solr-metadata-display.tpl.php to first check to see if the value is empty. Here's my complete override, which also gets rid of the "Details" legend/collapsed:

<?php if (!(empty($solr_fields) && variable_get('islandora_solr_metadata_omit_empty_values', FALSE))):?>
<fieldset <?php $print ? print('class="islandora islandora-metadata"') : print('class="islandora islandora-metadata"');?>>
  <div class="fieldset-wrapper">
    <dl xmlns:dcterms="http://purl.org/dc/terms/" class="islandora-display-metadata islandora-metadata-fields">
      <?php $row_field = 0; ?>
      <?php foreach($solr_fields as $value): ?>
<?php if (!empty($value['value'])): ?>
          <dt class="<?php print $row_field == 0 ? ' first' : ''; ?>">
            <?php print $value['display_label']; ?>
          </dt>
        <?php endif; ?>
        <?php if (!empty($value['value'])): ?>
          <dd class="<?php print $row_field == 0 ? ' first' : ''; ?>">
            <?php print implode('<br/>', $value['value']); ?>
          </dd>
        <?php endif; ?>
        <?php $row_field++; ?>
      <?php endforeach; ?>
    </dl>
  </div>
</fieldset>
<?php endif; ?>

This thread was enormously useful while I was trying to figure out how to display with Solr Metadata within the viewer, so thanks!

Matt
Reply all
Reply to author
Forward
0 new messages