Browse Source

updated dc_array to make it easier to deal with in templates, added layout css, created default template markup

added rtl css, changed heading tag for metadata and modified responsive portions of layout

isolated responsive img css to only override the template
pull/109/head
krisbulman 13 years ago
parent
commit
e7b3f61828
  1. 19
      islandora_basic_image/css/islandora_basic_image.theme-rtl.css
  2. 97
      islandora_basic_image/css/islandora_basic_image.theme.css
  3. 48
      islandora_basic_image/islandora-basic-image.tpl.php
  4. 22
      islandora_basic_image/islandora_basic_image.module

19
islandora_basic_image/css/islandora_basic_image.theme-rtl.css

@ -0,0 +1,19 @@
/*
Document : islandora_basic_collection.theme-rtl
Created on : May 23, 2012, 11:23:56 AM
Description:
Purpose of the stylesheet follows.
*/
@media all and (min-width: 768px) {
body.no-sidebars .islandora-basic-image-content {
float: right; /* LTR */
padding: 0 0 0 20px;
}
body.no-sidebars .islandora-basic-image-sidebar {
float: left; /* LTR */
}
}

97
islandora_basic_image/css/islandora_basic_image.theme.css

@ -5,4 +5,101 @@
Purpose of the stylesheet follows. Purpose of the stylesheet follows.
*/ */
.islandora-basic-image-object img {
height: auto;
max-width: 100%;
*width: 100%;
}
.islandora-basic-image-content,
.islandora-basic-image-sidebar {
display: inline;
position: relative;
}
.islandora-basic-image-metadata {
clear: both;
padding-top: 1.5em;
}
dl.islandora-basic-image-fields {
width:100%;
margin: 0 auto;
letter-spacing:-0.31em;
*letter-spacing:normal;
word-spacing:-0.43em;
}
/*
* The width + left/right padding of DTs/DDs equals 88% when compensating for an image
*/
.islandora-basic-image-metadata dt {
margin-right:-1px;
width:12.5%;
font-weight: bold;
text-align: right;
}
.islandora-basic-image-metadata dd {
width:77%;
}
/*
* In this rule, we reset the white-space (see hack above)
*/
.islandora-basic-image-metadata dt,
.islandora-basic-image-metadata dd {
display:inline-block;
*display:inline;
zoom:1;
letter-spacing:normal;
word-spacing:normal;
vertical-align:top;
padding:5px 0 3px 3%;
margin:0;
border-top:1px solid #ddd;
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word; /* webkit */
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
.islandora-basic-image-sidebar,
.islandora-basic-image-sidebar,
body.one-sidebar .islandora-basic-image-sidebar,
body.two-sidebars .islandora-basic-image-sidebar {
clear: both;
width: 100%;
}
.islandora-basic-image-sidebar,
.islandora-basic-image-sidebar,
body.one-sidebar .islandora-basic-image-sidebar,
body.two-sidebars .islandora-basic-image-sidebar {
width: 100%;
}
@media all and (min-width: 768px) {
body.no-sidebars .islandora-basic-image-content,
body.no-sidebars .islandora-basic-image-sidebar {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body.no-sidebars .islandora-basic-image-content {
width: 60%;
padding: 0 20px 0 0;
float: left; /* LTR */
}
body.no-sidebars .islandora-basic-image-sidebar {
float: right; /* LTR */
width: 40%;
clear: none;
}
}

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

@ -21,23 +21,35 @@
* along with the program. If not, see <http ://www.gnu.org/licenses/>. * along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/ */
?> ?>
<?php <?php drupal_set_title(""); ?>
<div class="islandora-basic-image-object">
<div class="islandora-basic-image-content clearfix">
<?php print $islandora_medium_size_url; ?>
</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>
$object = $variables['islandora_object'];
$image_url = $variables['islandora_image_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 . '"/>');
?>
</div>

22
islandora_basic_image/islandora_basic_image.module

@ -77,7 +77,7 @@ function islandora_basic_image_islandora_view_object($object, $user, $page_numbe
foreach ($object->models as $model) { foreach ($object->models as $model) {
if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) { if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) {
$output = theme('islandora_basic_image', array('islandora_object' => $object)); $output = theme('islandora_basic_image', array('islandora_object' => $object));
return array('Basic Image Output' => $output); return array('' => $output);
} }
} }
return NULL; return NULL;
@ -101,15 +101,20 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
$variables['islandora_dublin_core'] = $dc_object; $variables['islandora_dublin_core'] = $dc_object;
//create a nicer array for themers //create a nicer array for themers
//TODO: give this a better home //TODO: give this a better home
$dc_array = array(); $dc_array = array();
foreach ($dc_object as $element) { foreach ($dc_object as $element) {
if (!empty($element)) { if (!empty($element)) {
foreach ($element as $key => $value) { foreach ($element as $field => $value) {
foreach ($value as $v) { // split value if the result value is an array
if (!empty($v)) { if (is_array($value)) {
$dc_array[] = array($key => $v); $value = implode(", ", $value);
} }
} $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]['class'] = strtolower( preg_replace('/[^A-Za-z0-9]/', '-', $field));
} }
} }
} }
@ -124,7 +129,8 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view'; $variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
} }
if (isset($islandora_object['MEDIUM_SIZE'])) { if (isset($islandora_object['MEDIUM_SIZE'])) {
$variables['islandora_medium_size_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view'; $medium_size = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view';
$variables['islandora_medium_size_url'] = '<img src="' . $medium_size . '"/>';
} }
} }

Loading…
Cancel
Save