From e7b3f618287176df9ec8fbc243b33de3b307b7a3 Mon Sep 17 00:00:00 2001 From: krisbulman Date: Thu, 24 May 2012 00:53:04 -0300 Subject: [PATCH] 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 --- .../css/islandora_basic_image.theme-rtl.css | 19 ++++ .../css/islandora_basic_image.theme.css | 97 +++++++++++++++++++ .../islandora-basic-image.tpl.php | 48 +++++---- .../islandora_basic_image.module | 22 +++-- 4 files changed, 160 insertions(+), 26 deletions(-) create mode 100644 islandora_basic_image/css/islandora_basic_image.theme-rtl.css diff --git a/islandora_basic_image/css/islandora_basic_image.theme-rtl.css b/islandora_basic_image/css/islandora_basic_image.theme-rtl.css new file mode 100644 index 00000000..0611c541 --- /dev/null +++ b/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 */ + } + +} diff --git a/islandora_basic_image/css/islandora_basic_image.theme.css b/islandora_basic_image/css/islandora_basic_image.theme.css index 764ed690..d9836fd6 100644 --- a/islandora_basic_image/css/islandora_basic_image.theme.css +++ b/islandora_basic_image/css/islandora_basic_image.theme.css @@ -5,4 +5,101 @@ 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; + } + +} \ No newline at end of file diff --git a/islandora_basic_image/islandora-basic-image.tpl.php b/islandora_basic_image/islandora-basic-image.tpl.php index 03576390..59147518 100644 --- a/islandora_basic_image/islandora-basic-image.tpl.php +++ b/islandora_basic_image/islandora-basic-image.tpl.php @@ -21,23 +21,35 @@ * along with the program. If not, see . */ ?> - + +
+
+ +
+
+

+

+

+
+ - $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 '' . ($key) . ': '; - print($v) . '
'; - } - } - } - } - } - print(''); -?> +
diff --git a/islandora_basic_image/islandora_basic_image.module b/islandora_basic_image/islandora_basic_image.module index 0fb48fc5..de92ac0f 100644 --- a/islandora_basic_image/islandora_basic_image.module +++ b/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) { if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) { $output = theme('islandora_basic_image', array('islandora_object' => $object)); - return array('Basic Image Output' => $output); + return array('' => $output); } } return NULL; @@ -101,15 +101,20 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) { $variables['islandora_dublin_core'] = $dc_object; //create a nicer array for themers //TODO: give this a better home + $dc_array = array(); - foreach ($dc_object as $element) { + foreach ($dc_object as $element) { if (!empty($element)) { - foreach ($element as $key => $value) { - foreach ($value as $v) { - if (!empty($v)) { - $dc_array[] = array($key => $v); + foreach ($element as $field => $value) { + // split value if the result value is an array + if (is_array($value)) { + $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'; } 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'] = ''; } }