Browse Source

Merge branch '7.x' of github.com:Islandora/islandora into 7.x

pull/111/merge
Paul Pound 13 years ago
parent
commit
a5b9b9b2ad
  1. 28
      islandora_basic_collection/css/islandora_basic_collection.theme.css
  2. 36
      islandora_basic_collection/islandora-basic-collection.tpl.php
  3. 33
      islandora_basic_collection/islandora_basic_collection.module
  4. 63
      islandora_basic_image/islandora-basic-image--islandora-27.tpl.php
  5. 13
      islandora_basic_image/islandora-basic-image.tpl.php
  6. 12
      islandora_basic_image/islandora_basic_image.module

28
islandora_basic_collection/css/islandora_basic_collection.theme.css

@ -5,5 +5,33 @@
Purpose of the stylesheet follows.
*/
/* islandora-basic-collection STYLES*/
.islandora-basic-collection {
width: 100%;
margin: 0 auto;
overflow: hidden;
}
dl.islandora-basic-collection-object
{
width: 20%;
min-width: 100px;
text-align: center;
float: left;
margin: 2% 2% 50px 2%;
}
.islandora-basic-collection-object dt img {
max-width: 100%;
*width: 100%;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.islandora-basic-collection-object dd
{
margin: 0;
padding: 0;
}

36
islandora_basic_collection/islandora-basic-collection.tpl.php

@ -21,30 +21,12 @@
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php
$object = $variables['islandora_object'];
$image_url = $variables['islandora_thumbnail_url'];
drupal_set_title($object->label);
foreach ($variables['islandora_dublin_core'] as $element) {
if (!empty($element)) {
foreach ($element as $key => $value) {
foreach ($value as $v) {
if (!empty($v)) {
print '<strong>' . ($key) . '</strong>: ';
print($v) . '<br />';
}
}
}
}
}
print('<img src = "' . $image_url . '"/>');
print('<h3>Associated Objects</h3>');
foreach($variables['islandora_associated_objects'] as $associated_objects){
global $base_url;
$link = l($associated_objects['title']['value'],$base_url.'/islandora/object/'.$associated_objects['object']['value']);
print ($link).'<br />';
}
?>
<?php drupal_set_title($islandora_object->label); ?>
<div class="islandora-basic-collection clearfix">
<?php foreach($associated_objects_array as $key => $value): ?>
<dl class="islandora-basic-collection-object">
<dt class="<?php print $value['class']; ?>"><?php print $value['thumb_link']; ?></dt>
<dd class="<?php print $value['class']; ?>"><?php print $value['title_link']; ?></dd>
</dl>
<?php endforeach; ?>
</div>

33
islandora_basic_collection/islandora_basic_collection.module

@ -152,7 +152,7 @@ function islandora_basic_collection_islandora_view_object($object, $user, $page_
foreach ($object->models as $model) {
if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) {
$output = theme('islandora_basic_collection', array('islandora_object' => $object));
return array('Basic Collection Output' => $output);
return array('' => $output);
}
}
return NULL;
@ -165,6 +165,10 @@ function islandora_basic_collection_islandora_view_object($object, $user, $page_
* an array of variables that will be passed to the theme function
*/
function islandora_basic_collection_preprocess_islandora_basic_collection(&$variables) {
// base url
global $base_url;
// base path
global $base_path;
$islandora_object = $variables['islandora_object'];
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
try {
@ -177,16 +181,35 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari
$variables['islandora_dublin_core'] = $dc_object;
$variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_collection__' . str_replace(':', '_', $islandora_object->id);
global $base_url;
if (isset($islandora_object['OBJ'])) {
$variables['islandora_image_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';
$full_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';
$variables['islandora_full_img'] = '<img src="' . $full_size_url . '"/>';
}
if (isset($islandora_object['TN'])) {
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
$thumbnail_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
$variables['islandora_thumbnail_img'] = '<img src="' . $thumbnail_size_url . '"/>';
}
if (isset($islandora_object['MEDIUM_SIZE'])) {
$variables['islandora_medium_size_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view';
$medium_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view';
$variables['islandora_medium_img'] = '<img src="' . $medium_size_url . '"/>';
}
$associated_objects_array = array();
foreach($variables['islandora_associated_objects'] as $key => $value) {
$pid = $variables['islandora_associated_objects'][$key]['object']['value'];
$object_url = 'islandora/object/' . $pid;
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>';
$title = $variables['islandora_associated_objects'][$key]['title']['value'];
$associated_objects_array[$pid]['pid'] = $pid;
$associated_objects_array[$pid]['path'] = $object_url;
$associated_objects_array[$pid]['title'] = $title;
$associated_objects_array[$pid]['class'] = strtolower( preg_replace('/[^A-Za-z0-9]/', '-', $pid));
$associated_objects_array[$pid]['thumbnail'] = $thumbnail_img;
$associated_objects_array[$pid]['title_link'] = l($title, $object_url, array('html' => TRUE, 'attributes' => array('title' => $title)));
$associated_objects_array[$pid]['thumb_link'] = l($thumbnail_img, $object_url, array('html' => TRUE, 'attributes' => array('title' => $title)));
}
$variables['associated_objects_array'] = $associated_objects_array;
}
function islandora_basic_collection_get_objects($object) {

63
islandora_basic_image/islandora-basic-image--islandora-27.tpl.php

@ -1,7 +1,6 @@
<?php
/*
* fedora-repository-view-object.tpl.php
* islandora-basic-image--islandora-27.tpl.php
*
*
*
@ -21,35 +20,33 @@
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php
/**
* This template is an example of overiding a template by pid
*
* This template must be placed in your themes template directory and
* allows you to override a template file for a specific object
* an example use case would be for theming a collection object differently
* based on the actual collection object.
*
* Best practice would be to create a new cmodel if you have many objects that
* need to be themed differently but if you only have a few objects that need different
* templates this method would work.
*/
$object = $variables['islandora_object'];
$image_url = $variables['islandora_image_url'];
drupal_set_title($object->label);
print ('This template has been overridden by a theme suggestion');
foreach ($variables['islandora_dublin_core'] as $element) {
if (!empty($element)) {
foreach ($element as $key => $value) {
foreach ($value as $v) {
if (!empty($v)) {
print '<strong>' . ($key) . '</strong>: ';
print($v) . '<br />';
}
}
}
}
}
print('<img src = "' . $image_url . '"/>');
?>
<?php drupal_set_title(""); ?>
<div class="islandora-basic-image-object">
<div class="islandora-basic-image-content clearfix">
<?php print $islandora_medium_img; ?>
</div>
<div class="islandora-basic-image-sidebar">
<h1 class="title"><?php print $islandora_object_label; ?></h1>
<h3><?php print $dc_array['dc:description']['label']; ?></h3>
<p><?php print $dc_array['dc:description']['value']; ?></p>
</div>
<div class="islandora-basic-image-metadata">
<h4>Details</h4>
<dl class="islandora-basic-image-fields">
<?php $row_field = 0; ?>
<?php foreach($dc_array as $key => $value): ?>
<dt class="solr-label <?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['label']; ?>
</dt>
<?php if ($key == 'PID'): ?>
<?php $value['value'] = l($value['value'], 'fedora/repository/' . htmlspecialchars($value['value'], ENT_QUOTES, 'utf-8')); ?>
<?php endif; ?>
<dd class="solr-value <?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['value']; ?>
</dd>
<?php $row_field++; ?>
<?php endforeach; ?>
</dl>
</div>
</div>

13
islandora_basic_image/islandora-basic-image.tpl.php

@ -1,7 +1,7 @@
<?php
/*
* fedora-repository-view-object.tpl.php
* islandora-basic-image.tpl.php
*
*
*
@ -25,7 +25,7 @@
<div class="islandora-basic-image-object">
<div class="islandora-basic-image-content clearfix">
<?php print $islandora_medium_size_url; ?>
<?php print $islandora_medium_img; ?>
</div>
<div class="islandora-basic-image-sidebar">
<h1 class="title"><?php print $islandora_object_label; ?></h1>
@ -37,19 +37,14 @@
<dl class="islandora-basic-image-fields">
<?php $row_field = 0; ?>
<?php foreach($dc_array as $key => $value): ?>
<dt class="solr-label <?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<dt class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['label']; ?>
</dt>
<?php if ($key == 'PID'): ?>
<?php $value['value'] = l($value['value'], 'fedora/repository/' . htmlspecialchars($value['value'], ENT_QUOTES, 'utf-8')); ?>
<?php endif; ?>
<dd class="solr-value <?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<dd class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['value']; ?>
</dd>
<?php $row_field++; ?>
<?php endforeach; ?>
</dl>
</div>
</div>

12
islandora_basic_image/islandora_basic_image.module

@ -222,7 +222,7 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
// $dc_label = explode(':', $field);
// $element_label = ucfirst($dc_label[1]);
// $dc_array[$field]['label'] = $element_label;
// $dc_array[$field]['value'] = strip_tags($value);
// $dc_array[$field]['value'] = strip_tags($value);
// $dc_array[$field]['class'] = strtolower( preg_replace('/[^A-Za-z0-9]/', '-', $field));
// }
// }
@ -233,14 +233,16 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id);
global $base_url;
if (isset($islandora_object['OBJ'])) {
$variables['islandora_image_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';
$full_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';
$variables['islandora_full_img'] = '<img src="' . $full_size_url . '"/>';
}
if (isset($islandora_object['TN'])) {
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
$thumbnail_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
$variables['islandora_thumbnail_img'] = '<img src="' . $thumbnail_size_url . '"/>';
}
if (isset($islandora_object['MEDIUM_SIZE'])) {
$medium_size = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view';
$variables['islandora_medium_size_url'] = '<img src="' . $medium_size . '"/>';
$medium_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view';
$variables['islandora_medium_img'] = '<img src="' . $medium_size_url . '"/>';
}
}

Loading…
Cancel
Save