From 6d7772afe4e008b3174201f838a866b7854e3d4d Mon Sep 17 00:00:00 2001 From: krisbulman Date: Fri, 25 May 2012 12:33:12 -0300 Subject: [PATCH] cleaned up basic image collection css, populated override file for basic image collection, added base styling for collections and top-level collections, created better array for default collections --- .../css/islandora_basic_collection.theme.css | 28 +++++++++ .../islandora-basic-collection.tpl.php | 36 +++-------- .../islandora_basic_collection.module | 33 ++++++++-- ...slandora-basic-image--islandora-27.tpl.php | 63 +++++++++---------- .../islandora-basic-image.tpl.php | 13 ++-- .../islandora_basic_image.module | 12 ++-- 6 files changed, 106 insertions(+), 79 deletions(-) diff --git a/islandora_basic_collection/css/islandora_basic_collection.theme.css b/islandora_basic_collection/css/islandora_basic_collection.theme.css index 860fa8c7..780abdce 100644 --- a/islandora_basic_collection/css/islandora_basic_collection.theme.css +++ b/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; +} diff --git a/islandora_basic_collection/islandora-basic-collection.tpl.php b/islandora_basic_collection/islandora-basic-collection.tpl.php index 16b252bb..07f2a73d 100644 --- a/islandora_basic_collection/islandora-basic-collection.tpl.php +++ b/islandora_basic_collection/islandora-basic-collection.tpl.php @@ -21,30 +21,12 @@ * along with the program. If not, see . */ ?> -label); - foreach ($variables['islandora_dublin_core'] as $element) { - if (!empty($element)) { - foreach ($element as $key => $value) { - foreach ($value as $v) { - if (!empty($v)) { - print '' . ($key) . ': '; - print($v) . '
'; - } - } - } - } - } - print(''); - print('

Associated Objects

'); - 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).'
'; - - } -?> - +label); ?> +
+ $value): ?> +
+
+
+
+ +
diff --git a/islandora_basic_collection/islandora_basic_collection.module b/islandora_basic_collection/islandora_basic_collection.module index ca76e816..cc79caad 100644 --- a/islandora_basic_collection/islandora_basic_collection.module +++ b/islandora_basic_collection/islandora_basic_collection.module @@ -73,7 +73,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; @@ -86,6 +86,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 { @@ -98,16 +102,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'] = ''; } 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'] = ''; } 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'] = ''; } + + $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 = ''; + $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) { diff --git a/islandora_basic_image/islandora-basic-image--islandora-27.tpl.php b/islandora_basic_image/islandora-basic-image--islandora-27.tpl.php index 8b775078..1ea742c9 100644 --- a/islandora_basic_image/islandora-basic-image--islandora-27.tpl.php +++ b/islandora_basic_image/islandora-basic-image--islandora-27.tpl.php @@ -1,7 +1,6 @@ . */ ?> -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 '' . ($key) . ': '; - print($v) . '
'; - } - } - } - } - } - print(''); -?> + +
+
+ +
+
+

+

+

+
+ +
diff --git a/islandora_basic_image/islandora-basic-image.tpl.php b/islandora_basic_image/islandora-basic-image.tpl.php index 59147518..7736e664 100644 --- a/islandora_basic_image/islandora-basic-image.tpl.php +++ b/islandora_basic_image/islandora-basic-image.tpl.php @@ -1,7 +1,7 @@
- +

@@ -37,19 +37,14 @@
$value): ?> -
+
- - - -
+
- - diff --git a/islandora_basic_image/islandora_basic_image.module b/islandora_basic_image/islandora_basic_image.module index ff952c64..23f8ef39 100644 --- a/islandora_basic_image/islandora_basic_image.module +++ b/islandora_basic_image/islandora_basic_image.module @@ -113,7 +113,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)); // } // } @@ -124,14 +124,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'] = ''; } 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'] = ''; } if (isset($islandora_object['MEDIUM_SIZE'])) { - $medium_size = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view'; - $variables['islandora_medium_size_url'] = ''; + $medium_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view'; + $variables['islandora_medium_img'] = ''; } }