Browse Source

updated gridview and listview css classes

pull/125/merge
Paul Pound 13 years ago
parent
commit
daa608843e
  1. 3
      admin/islandora.admin.inc
  2. 27
      includes/tuque.inc
  3. 7
      islandora.module
  4. 47
      islandora_basic_collection/css/islandora_basic_collection.base.css
  5. 80
      islandora_basic_collection/css/islandora_basic_collection.theme.css
  6. 2
      islandora_basic_collection/includes/delete_collection.inc
  7. 10
      islandora_basic_collection/includes/manage_policies.inc
  8. 13
      islandora_basic_collection/islandora_basic_collection.install
  9. 2
      islandora_basic_collection/theme/islandora-basic-collection-grid.tpl.php
  10. 9
      islandora_basic_collection/theme/islandora-basic-collection-wrapper.tpl.php
  11. 21
      islandora_basic_collection/theme/islandora-basic-collection.tpl.php
  12. 17
      islandora_basic_collection/theme/islandora_basic_collection.theme.inc
  13. 33
      islandora_basic_image/css/islandora_basic_image.theme.css
  14. 13
      islandora_basic_image/islandora_basic_image.install
  15. 14
      islandora_basic_image/theme/islandora-basic-image.tpl.php

3
admin/islandora.admin.inc

@ -11,8 +11,7 @@ function islandora_repository_admin($form, &$form_state) {
module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/utilities');
if (!IslandoraTuque::exists()) { if (!IslandoraTuque::exists()) {
$message = t('This module requires the !url. Please install sites all libraries folder before continuing.', array('!url' => l(t('Tuque Fedora API'), 'http://github.com/islandora/tuque'))); IslandoraTuque::getError();
drupal_set_message(check_plain($message));
return; return;
} }

27
includes/tuque.inc

@ -1,15 +1,15 @@
<?php <?php
//do this until we expost these in a module or library //do this until we expost these in a module or library
require_once 'sites/all/libraries/tuque/Datastream.php'; @include_once 'sites/all/libraries/tuque/Datastream.php';
require_once 'sites/all/libraries/tuque/FedoraApi.php'; @include_once 'sites/all/libraries/tuque/FedoraApi.php';
require_once 'sites/all/libraries/tuque/FedoraApiSerializer.php'; @include_once 'sites/all/libraries/tuque/FedoraApiSerializer.php';
require_once 'sites/all/libraries/tuque/Object.php'; @include_once 'sites/all/libraries/tuque/Object.php';
require_once 'sites/all/libraries/tuque/RepositoryConnection.php'; @include_once 'sites/all/libraries/tuque/RepositoryConnection.php';
require_once 'sites/all/libraries/tuque/Cache.php'; @include_once 'sites/all/libraries/tuque/Cache.php';
require_once 'sites/all/libraries/tuque/RepositoryException.php'; @include_once 'sites/all/libraries/tuque/RepositoryException.php';
require_once 'sites/all/libraries/tuque/Repository.php'; @include_once 'sites/all/libraries/tuque/Repository.php';
require_once 'sites/all/libraries/tuque/FedoraRelationships.php'; @include_once 'sites/all/libraries/tuque/FedoraRelationships.php';
class IslandoraTuque { class IslandoraTuque {
@ -58,15 +58,24 @@ class IslandoraTuque {
$url = variable_get('islandora_base_url', 'http://localhost:8080/fedora'); $url = variable_get('islandora_base_url', 'http://localhost:8080/fedora');
} }
if(self::exists()) {
$this->connection = new RepositoryConnection($url, $user_string, $pass_string); $this->connection = new RepositoryConnection($url, $user_string, $pass_string);
$this->connection->reuseConnection = TRUE; $this->connection->reuseConnection = TRUE;
$this->api = new FedoraApi($this->connection); $this->api = new FedoraApi($this->connection);
$this->cache = new SimpleCache(); $this->cache = new SimpleCache();
$this->repository = new FedoraRepository($this->api, $this->cache); $this->repository = new FedoraRepository($this->api, $this->cache);
} }
}
static function exists() { static function exists() {
return class_exists('RepositoryConnection'); return class_exists('RepositoryConnection');
} }
static function getError() {
$islandora_doc_link = l(t('Islandora documentation'), 'https://wiki.duraspace.org/display/ISLANDORA/Islandora');
$tuque_link = l(t('Tuque Fedora API'), 'http://github.com/islandora/tuque');
$message = t('Islandora requires the !tuque_url. Please install in /sites/all/libraries/tuque before continuing. See the !islandora_url.', array( '!tuque_url' => $tuque_link, '!islandora_url' => $islandora_doc_link));
drupal_set_message($message, 'error', FALSE);
}
} }

7
islandora.module

@ -434,14 +434,19 @@ function islandora_object_load($object_id) {
$islandora_tuque = new IslandoraTuque(); $islandora_tuque = new IslandoraTuque();
} }
if(IslandoraTuque::exists()) {
try { try {
$fedora_object = $islandora_tuque->repository->getObject($object_id); $fedora_object = $islandora_tuque->repository->getObject($object_id);
} catch (Exception $e) { } catch (Exception $e) {
return NULL; return NULL;
} }
return $fedora_object; return $fedora_object;
} }
else {
IslandoraTuque::getError();
return NULL;
}
}
function islandora_ingest_access_callback($object, $perm) { function islandora_ingest_access_callback($object, $perm) {
if(islandora_access_callback($object, $perm) === FALSE) { if(islandora_access_callback($object, $perm) === FALSE) {

47
islandora_basic_collection/css/islandora_basic_collection.base.css

@ -1,8 +1,51 @@
/* /*
Document : islandora_basic_collection.base.css Document : islandora_basic_collection.base.css
Created on : May 23, 2012, 11:22:04 AM Created on : May 23, 2012, 11:22:04 AM
Description: Description: Base css, for structural layout,
Purpose of the stylesheet follows. positioning, and to generally make things function in
the most basic form.
*/ */
/* List - Displays lists using a dt on the left and dd on the right */
.islandora-basic-collection-list-item {
clear: both;
width: 100%;
}
.islandora-basic-collection-list-item dl dt {
clear: left;
float: left;
padding: 3px 0 0;
text-align: center;
width: 100px;
}
.islandora-basic-collection-list-item dl dd {
margin: 0 0 0 130px;
}
/* Grid - Displays grid using dl formatted inline */
.islandora-basic-collection-grid dl
{
width: 20%;
min-width: 100px;
min-height: 180px;
display: -moz-inline-stack;
display: inline-block;
vertical-align: top;
margin: 1.5em 2%;
zoom: 1;
*display: inline;
_height: 180px;
}
.islandora-basic-collection-grid dd
{
margin: 0;
padding: 0;
}
.islandora-basic-collection-display-switch {
float: right;
}

80
islandora_basic_collection/css/islandora_basic_collection.theme.css

@ -1,86 +1,46 @@
/* /*
Document : islandora_basic_collection.theme Document : islandora_basic_collection.theme
Created on : May 23, 2012, 11:23:56 AM Created on : May 23, 2012, 11:23:56 AM
Description: Description: Theme css, like margins, padding, borders, colors, etc
Purpose of the stylesheet follows.
*/ */
/* Make flexible and assure content doesn't go off the page */
.islandora-basic-collection { .islandora-basic-collection {
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
} }
.islandora-basic-collection-object { /* Round borders on images */
margin: 1.5em auto 3em; .islandora-basic-collection-object dt img {
}
.islandora-basic-collection-grid dl.islandora-basic-collection-object
{
width: 20%;
min-width: 100px;
min-height: 180px;
display: -moz-inline-stack;
display: inline-block;
vertical-align: top;
margin: 1.5em 2%;
zoom: 1;
*display: inline;
_height: 180px;
}
.islandora-basic-collection-grid .islandora-basic-collection-object dt img {
max-width: 100%;
*width: 100%;
-webkit-border-radius: 5px; -webkit-border-radius: 5px;
-moz-border-radius: 5px; -moz-border-radius: 5px;
border-radius: 5px; border-radius: 5px;
} }
.islandora-basic-collection-grid .islandora-basic-collection-object dd /* Set space between objects */
{ .islandora-basic-collection-object {
margin: 0; margin: 1.5em auto;
padding: 0;
}
/* to be moved to admin when it is added */
#islandora-collection-deletion-form table th.select-all,
#islandora-collection-migrate-form table th.select-all {
width: 20px;
} }
/* the base css for lists is set in islandora, just adding details */ /* Set space between dd items */
.islandora-basic-collection-object dd {
dl.islandora-basic-collection-thumb padding-top: 2px;
{ padding-bottom: 2px;
float: left;
width: 15%;
margin: 0;
} }
.islandora-basic-collection-thumb dt, /* LIST VIEW */
.islandora-basic-collection-thumb dd
{
margin: 0;
}
dl.islandora-basic-collection-fields /* Borders to seperate collection objects */
{ .islandora-basic-collection-list-item {
float: right; padding-bottom: 1.5em;
width: 83%; border-bottom: 1px solid #ddd;
border-top: 0px solid #ddd;
padding-left: 10px;
} }
.islandora-basic-collection-fields dt,
.islandora-basic-collection-fields dd
{
border-top: 1px solid #ddd;
}
.islandora-basic-collection-fields dt.first, /* to be moved to admin when it is added */
.islandora-basic-collection-fields dd.first #islandora-collection-deletion-form table th.select-all,
{ #islandora-collection-migrate-form table th.select-all {
border-top: 1px solid #ddd; width: 20px;
} }

2
islandora_basic_collection/includes/delete_collection.inc

@ -113,7 +113,7 @@ function islandora_collection_deletion_form_submit($form, &$form_state) {
* @param string $pid * @param string $pid
*/ */
function delete_root_collection($object) { function delete_root_collection($object) {
$pid = $object->id;
try { try {
$object->repository->purgeObject($object->id); $object->repository->purgeObject($object->id);
} catch (RepositoryException $e) { } catch (RepositoryException $e) {

10
islandora_basic_collection/includes/manage_policies.inc

@ -27,8 +27,9 @@ function islandora_manage_policies_form($form, &$form_state, $collection_object)
$item = $repository->getObject($content_model); $item = $repository->getObject($content_model);
$cm_name = $item->Label; $cm_name = $item->Label;
$cm_options[$content_model] = $cm_name; $cm_options[$content_model] = $cm_name;
} catch (RepositoryException $e) {
} }
catch(RepositoryException $e) {}
} }
} }
@ -71,6 +72,7 @@ function islandora_manage_policies_form($form, &$form_state, $collection_object)
'#title' => t("Manage collection policy for @collection_title", array('@collection_title' => $collection_object->label)), '#title' => t("Manage collection policy for @collection_title", array('@collection_title' => $collection_object->label)),
); );
if (count($new_content_models) > 0) {
$form ['manage_collection_policy']['add']['content_model_to_add'] = array( $form ['manage_collection_policy']['add']['content_model_to_add'] = array(
'#title' => "Choose content model", '#title' => "Choose content model",
'#type' => 'select', '#type' => 'select',
@ -101,6 +103,12 @@ function islandora_manage_policies_form($form, &$form_state, $collection_object)
'#value' => t('Add content model to collection policy'), '#value' => t('Add content model to collection policy'),
'#id' => 'add_cm' '#id' => 'add_cm'
); );
}
else {
$form['manage_collection_policy']['no_content_models'] = array(
'#markup' => t('No content models available to add!'),
);
}
if (count($current_models_in_policy) > 0) { if (count($current_models_in_policy) > 0) {
$form['manage_collection_policy']['remove'] = array( $form['manage_collection_policy']['remove'] = array(

13
islandora_basic_collection/islandora_basic_collection.install

@ -1,5 +1,18 @@
<?php <?php
function islandora_basic_collection_requirements($phase) {
if($phase == 'install') {
module_load_include('inc', 'islandora', 'includes/tuque');
if(!IslandoraTuque::exists()) {
return array(array(
'title' => 'Tuque',
'description' => 'The Islandora Collection solution pack requires the Tuque library.',
'severity' => REQUIREMENT_ERROR,
));
}
}
}
/** /**
* @file * @file
* islandora_basic_collection.install * islandora_basic_collection.install

2
islandora_basic_collection/theme/islandora-basic-collection-grid.tpl.php

@ -23,7 +23,7 @@
?> ?>
<div class="islandora-basic-collection-wrapper"> <div class="islandora islandora-basic-collection">
<div class="islandora-basic-collection-grid clearfix"> <div class="islandora-basic-collection-grid clearfix">
<?php foreach($associated_objects_array as $key => $value): ?> <?php foreach($associated_objects_array as $key => $value): ?>
<dl class="islandora-basic-collection-object <?php print $value['class']; ?>"> <dl class="islandora-basic-collection-object <?php print $value['class']; ?>">

9
islandora_basic_collection/theme/islandora-basic-collection-wrapper.tpl.php

@ -25,10 +25,9 @@
<div class="islandora-basic-collection-wrapper"> <div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix"> <div class="islandora-basic-collection clearfix">
<?php print ($grid_link); ?> <span class="islandora-basic-collection-display-switch"><?php print $grid_link; ?> <?php print $list_link; ?></span>
<?php print ($list_link); ?> <?php print $collection_pager; ?>
<?php print($collection_pager); ?> <?php print $collection_content; ?>
<?php print ($collection_content); ?> <?php print $collection_pager; ?>
<?php print($collection_pager); ?>
</div> </div>
</div> </div>

21
islandora_basic_collection/theme/islandora-basic-collection.tpl.php

@ -23,31 +23,24 @@
?> ?>
<?php drupal_set_title($islandora_object->label); ?> <?php drupal_set_title($islandora_object->label); ?>
<div class="islandora islandora-basic-collection-wrapper"> <div class="islandora islandora-basic-collection">
<?php $row_field = 0; ?> <?php $row_field = 0; ?>
<?php foreach($associated_objects_array as $associated_object): ?> <?php foreach($associated_objects_array as $associated_object): ?>
<div class="islandora-basic-collection-object clearfix"> <div class="islandora-basic-collection-object islandora-basic-collection-list-item clearfix">
<dl class="islandora-basic-collection-thumb <?php print $associated_object['class']; ?>"> <dl class="<?php print $associated_object['class']; ?>">
<dt><?php print $associated_object['thumb_link']; ?></dt> <dt>
<dd></dd> <?php print $associated_object['thumb_link']; ?>
</dl>
<dl class="islandora-inline-metadata islandora-basic-collection-fields">
<dt class="collection-label <?php print $associated_object['dc_array']['dc:title']['class']; ?> <?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $associated_object['dc_array']['dc:title']['label']; ?>
</dt> </dt>
<dd class="collection-value <?php print $associated_object['dc_array']['dc:title']['class']; ?> <?php print $row_field == 0 ? ' first' : ''; ?>"> <dd class="collection-value <?php print $associated_object['dc_array']['dc:title']['class']; ?> <?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $associated_object['title_link']; ?> <strong><?php print $associated_object['title_link']; ?></strong>
</dd> </dd>
<?php if ($associated_object['dc_array']['dc:description']['value']): ?> <?php if ($associated_object['dc_array']['dc:description']['value']): ?>
<dt class="collection-label <?php print $associated_object['dc_array']['dc:description']['class']; ?>">
<?php print $associated_object['dc_array']['dc:description']['label']; ?>
</dt>
<dd class="collection-value <?php print $associated_object['dc_array']['dc:description']['class']; ?>"> <dd class="collection-value <?php print $associated_object['dc_array']['dc:description']['class']; ?>">
<?php print $associated_object['dc_array']['dc:description']['value']; ?> <?php print $associated_object['dc_array']['dc:description']['value']; ?>
</dd> </dd>
<?php $row_field++; ?>
<?php endif; ?> <?php endif; ?>
</dl> </dl>
</div> </div>
<?php $row_field++; ?>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>

17
islandora_basic_collection/theme/islandora_basic_collection.theme.inc

@ -22,18 +22,23 @@ function islandora_basic_collection_preprocess_islandora_basic_collection_wrappe
$query_params = drupal_get_query_parameters($_GET); $query_params = drupal_get_query_parameters($_GET);
global $base_url; global $base_url;
if ($display == 'grid') { if ($display == 'grid') {
$query_params['display'] = 'list';
$list_link = l('List View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => 'islandora-view-list'), $list_link = l('List View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => 'islandora-view-list'),
'query' => array('display' => 'list'))); 'query' => $query_params));
$grid_link = l('Grid View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => array('islandora-view-grid', 'islandora-view-active')), unset($query_params['display']);
'query' => array('display' => 'grid'))); $query_params['display'] = 'grid';
$grid_link = l('Grid View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => array('islandora-view-grid', 'active')),
'query' => $query_params));
$collection_content = theme('islandora_basic_collection_grid', array('islandora_object' => $islandora_object, 'collection_results' => $results)); $collection_content = theme('islandora_basic_collection_grid', array('islandora_object' => $islandora_object, 'collection_results' => $results));
} }
else { else {
$query_params['display'] = 'list';
$list_link = l('List View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => array('islandora-view-list', 'active')),
'query' => $query_params));
unset($query_params['display']);
$query_params['display'] = 'grid'; $query_params['display'] = 'grid';
$list_link = l('List View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => array('islandora-view-list', 'islandora-view-active')),
'query' => array('display' => 'list')));
$grid_link = l('Grid View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => 'islandora-view-grid'), $grid_link = l('Grid View', $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => 'islandora-view-grid'),
'query' => array('display' => 'grid'))); 'query' => $query_params));
$collection_content = theme('islandora_basic_collection', array('islandora_object' => $islandora_object, 'collection_results' => $results)); $collection_content = theme('islandora_basic_collection', array('islandora_object' => $islandora_object, 'collection_results' => $results));
} }
$variables['list_link'] = $list_link; $variables['list_link'] = $list_link;

33
islandora_basic_image/css/islandora_basic_image.theme.css

@ -1,14 +1,22 @@
/* /*
Document : islandora_basic_collection.theme Document : islandora_basic_collection.theme
Created on : May 23, 2012, 11:23:56 AM Created on : May 23, 2012, 11:23:56 AM
Description: Description: The basic image page is a simple flexible layout page
Purpose of the stylesheet follows. that breaks down to two columns when 2 sidebars are visible
*/ */
.islandora-basic-image-content, .islandora-basic-image-content {
.islandora-basic-image-sidebar { background-color: #F2F2F2;
display: inline; border: 1px solid #ddd;
position: relative; -webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 15px;
}
.islandora-basic-image-content img {
margin: 0;
display: block;
} }
.islandora-basic-image-metadata { .islandora-basic-image-metadata {
@ -42,9 +50,6 @@ dl.islandora-basic-image-fields {
border-top:0; border-top:0;
} }
.islandora-basic-image-sidebar,
.islandora-basic-image-sidebar,
body.one-sidebar .islandora-basic-image-sidebar,
body.two-sidebars .islandora-basic-image-sidebar { body.two-sidebars .islandora-basic-image-sidebar {
clear: both; clear: both;
width: 100%; width: 100%;
@ -53,15 +58,17 @@ body.two-sidebars .islandora-basic-image-sidebar {
@media all and (min-width: 768px) { @media all and (min-width: 768px) {
body.no-sidebars .islandora-basic-image-content { body.no-sidebars .islandora-basic-image-content {
width: 60%; width: 65%;
padding: 0 20px 0 0;
float: left; /* LTR */ float: left; /* LTR */
margin-top: 1em; }
body.no-sidebars .islandora-basic-image-sidebar {
padding-left: 20px;
} }
body.no-sidebars .islandora-basic-image-sidebar { body.no-sidebars .islandora-basic-image-sidebar {
float: right; /* LTR */ float: right; /* LTR */
width: 40%; width: 35%;
clear: none; clear: none;
} }

13
islandora_basic_image/islandora_basic_image.install

@ -5,6 +5,19 @@
* islandora-basic-image.install * islandora-basic-image.install
*/ */
function islandora_basic_image_requirements($phase) {
if($phase == 'install') {
module_load_include('inc', 'islandora', 'includes/tuque');
if(!IslandoraTuque::exists()) {
return array(array(
'title' => 'Tuque',
'description' => 'The Islandora Collection solution pack requires the Tuque library.',
'severity' => REQUIREMENT_ERROR,
));
}
}
}
/** /**
* Implements hook_install * Implements hook_install
*/ */

14
islandora_basic_image/theme/islandora-basic-image.tpl.php

@ -26,22 +26,24 @@
<?php endif; ?> <?php endif; ?>
<div class="islandora-basic-image-object islandora"> <div class="islandora-basic-image-object islandora">
<div class="islandora-basic-image-content clearfix"> <div class="islandora-basic-image-content-wrapper clearfix">
<?php if(isset($islandora_medium_img)): ?>
<div class="islandora-basic-image-content">
<?php if(isset($islandora_full_url)): ?> <?php if(isset($islandora_full_url)): ?>
<?php print l($islandora_medium_img, $islandora_full_url, array('html' => TRUE)); ?> <?php print l($islandora_medium_img, $islandora_full_url, array('html' => TRUE)); ?>
<?php elseif(isset($islandora_medium_img)): ?> <?php elseif(isset($islandora_medium_img)): ?>
<?php print $islandora_medium_img; ?> <?php print $islandora_medium_img; ?>
<?php else: ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?>
<div class="islandora-basic-image-sidebar"> <div class="islandora-basic-image-sidebar">
<?php if($dc_array['dc:description']['value']): ?> <?php if($dc_array['dc:description']['value']): ?>
<h3><?php print $dc_array['dc:description']['label']; ?></h3> <h2><?php print $dc_array['dc:description']['label']; ?></h2>
<p><?php print $dc_array['dc:description']['value']; ?></p> <p><?php print $dc_array['dc:description']['value']; ?></p>
<?php endif; ?> <?php endif; ?>
<?php if(empty($parent_collections)): ?> <?php if($parent_collections): ?>
<div> <div>
<h3>In Collections</h3> <h2>In Collections</h2>
<ul> <ul>
<?php foreach($parent_collections as $key => $value): ?> <?php foreach($parent_collections as $key => $value): ?>
<li><?php print $value['label_link'] ?></li> <li><?php print $value['label_link'] ?></li>
@ -50,7 +52,7 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div>
<fieldset class="collapsible collapsed islandora-basic-image-metadata"> <fieldset class="collapsible collapsed islandora-basic-image-metadata">
<legend><span class="fieldset-legend">Extended Details</span></legend> <legend><span class="fieldset-legend">Extended Details</span></legend>
<div class="fieldset-wrapper"> <div class="fieldset-wrapper">

Loading…
Cancel
Save