Browse Source

Merge pull request #1 from Islandora/7.x

7.x update
pull/428/head
qadan 11 years ago
parent
commit
9a4b5cc403
  1. 1
      .travis.yml
  2. 10
      README.md
  3. 14
      includes/derivatives.inc
  4. 8
      includes/dublin_core.inc
  5. 3
      includes/ingest.form.inc
  6. 57
      includes/utilities.inc
  7. 2
      islandora.info
  8. 52
      islandora.module
  9. 2
      tests/scripts/travis_setup.sh
  10. 6
      theme/islandora-dublin-core-display.tpl.php
  11. 6
      theme/theme.inc

1
.travis.yml

@ -8,6 +8,7 @@ branches:
env: env:
- FEDORA_VERSION="3.5" - FEDORA_VERSION="3.5"
- FEDORA_VERSION="3.6.2" - FEDORA_VERSION="3.6.2"
- FEDORA_VERSION="3.7.0"
before_install: before_install:
- export ISLANDORA_DIR=$TRAVIS_BUILD_DIR - export ISLANDORA_DIR=$TRAVIS_BUILD_DIR
- $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh - $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh

10
README.md

@ -26,9 +26,17 @@ REQUIREMENTS
The Tuque library must be installed to use Islandora. It can be found here: The Tuque library must be installed to use Islandora. It can be found here:
http://github.com/Islandora/tuque http://github.com/Islandora/tuque
It is expected to be in one of two paths: It is expected to be in one of two paths:
- sites/all/libraries/tuque (libraries directory may need to be created) - sites/all/libraries/tuque (libraries directory may need to be created)
- islandora_folder/libraries/tuque - islandora_folder/libraries/tuque
OPTIONAL REQUIREMENTS
---------------------
If you want to support languages other than English download and enable
[String Translation](https://drupal.org/project/i18n), And follow our
[guide](wiki/Multilingual-Support) for setting up additional languges.
INSTALLATION INSTALLATION
------------ ------------

14
includes/derivatives.inc

@ -96,7 +96,19 @@ function islandora_derivative_logging(array $logging_results) {
foreach ($logging_results as $result) { foreach ($logging_results as $result) {
foreach ($result['messages'] as $message) { foreach ($result['messages'] as $message) {
if ($message['type'] === 'dsm') { if ($message['type'] === 'dsm') {
drupal_set_message(filter_xss(format_string($message['message'], isset($message['message_sub']) ? $message['message_sub'] : array())), isset($message['severity']) ? $message['severity'] : 'status'); if (isset($message['severity']) && $message['severity'] != 'status') {
drupal_set_message(filter_xss(format_string($message['message'], isset($message['message_sub']) ? $message['message_sub'] : array())), $message['severity']);
}
else {
if (!isset($_SESSION['islandora_event_messages'])) {
$_SESSION['islandora_event_messages'] = array();
}
$_SESSION['islandora_event_messages'][] = array(
'message' => filter_xss(format_string($message['message'], isset($message['message_sub']) ? $message['message_sub'] : array())),
'severity' => 'status',
);
drupal_set_message(l(t('Derivatives successfully created.'), 'islandora/event-status'), 'status', FALSE);
}
} }
else { else {
// We know what we are doing here. Passing through the translated // We know what we are doing here. Passing through the translated

8
includes/dublin_core.inc

@ -130,8 +130,11 @@ class DublinCore {
} }
$dc_label = explode(':', $field); $dc_label = explode(':', $field);
$element_label = drupal_ucfirst($dc_label[1]); $element_label = drupal_ucfirst($dc_label[1]);
$dc_array[$field]['label'] = $element_label; $i18n_object_id = drupal_strtolower($element_label);
$dc_array[$field]['value'] = $value; $dc_array[$field]['label'] = function_exists('i18n_string') ?
i18n_string("islandora:dc:{$i18n_object_id}:label", $element_label) :
$element_label;
$dc_array[$field]['value'] = filter_xss($value);
$dc_array[$field]['class'] = drupal_strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $field)); $dc_array[$field]['class'] = drupal_strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $field));
$dc_array[$field]['dcterms'] = preg_replace('/^dc/', 'dcterms', $field); $dc_array[$field]['dcterms'] = preg_replace('/^dc/', 'dcterms', $field);
} }
@ -140,7 +143,6 @@ class DublinCore {
return $dc_array; return $dc_array;
} }
/** /**
* Creates a new instance of the class by parsing dc_xml. * Creates a new instance of the class by parsing dc_xml.
* *

3
includes/ingest.form.inc

@ -773,6 +773,9 @@ function islandora_ingest_form_submit(array $form, array &$form_state) {
try { try {
islandora_add_object($object); islandora_add_object($object);
$form_state['redirect'] = "islandora/object/{$object->id}"; $form_state['redirect'] = "islandora/object/{$object->id}";
drupal_set_message(
t('"@label" (ID: @pid) has been ingested.', array('@label' => $object->label, '@pid' => $object->id)),
'status');
} }
catch (Exception $e) { catch (Exception $e) {
// If post hooks throws it may already exist at this point but may be // If post hooks throws it may already exist at this point but may be

57
includes/utilities.inc

@ -924,3 +924,60 @@ function islandora_sanitize_input_for_valid_xml($input, $replacement = '') {
$input = preg_replace('/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u', $replacement, $input); $input = preg_replace('/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u', $replacement, $input);
return $input; return $input;
} }
/**
* Page callback for session status messages to be sent to drupal_set_message().
*
* @return array
* Render array containing markup.
*/
function islandora_event_status() {
$results = FALSE;
if (isset($_SESSION['islandora_event_messages'])) {
foreach ($_SESSION['islandora_event_messages'] as $message) {
drupal_set_message($message['message'], $message['severity']);
$results = TRUE;
}
unset($_SESSION['islandora_event_messages']);
}
$text = ($results) ? t('The status messages above will be deleted after viewing this page.') : t('No messages to display.');
return array('#markup' => $text);
}
/**
* Scales the given image.
*
* @param object $file
* The image file to scale.
* @param int $width
* The width to scale the derived image to.
* @param int $height
* The height to scale the derived image to.
*
* @return bool
* TRUE if successful, FALSE otherwise.
*/
function islandora_scale_thumbnail($file, $width, $height) {
$real_path = drupal_realpath($file->uri);
$image = image_load($real_path);
try {
if (!empty($image)) {
$scale = image_scale($image, $width, $height, TRUE);
if ($scale) {
return image_save($image);
}
}
}
catch (exception $e) {
drupal_set_message(t(
"Islandora failed to scale image with message: '@message'",
array("@message" => $e->getMessage())));
watchdog(
'islandora',
'Islandora failed to scale image.<br/> With stack: @trace',
array('@trace' => $e->getTraceAsString()),
WATCHDOG_ERROR
);
}
return FALSE;
}

2
islandora.info

@ -1,6 +1,8 @@
name = Islandora name = Islandora
description = "View and manage Fedora objects" description = "View and manage Fedora objects"
package = Islandora package = Islandora
dependencies[] = image
dependencies[] = file
version = 7.x-dev version = 7.x-dev
core = 7.x core = 7.x
configure = admin/islandora/configure configure = admin/islandora/configure

52
islandora.module

@ -322,6 +322,13 @@ function islandora_menu() {
'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2), 'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2),
'load arguments' => array(2), 'load arguments' => array(2),
); );
$items['islandora/event-status'] = array(
'title' => 'Event Status',
'page callback' => 'islandora_event_status',
'type' => MENU_CALLBACK,
'access callback' => TRUE,
'file' => 'includes/utilities.inc',
);
$items[ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE] = array( $items[ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE] = array(
'title' => 'Autocomplete callback', 'title' => 'Autocomplete callback',
'description' => 'Autocomplete a Fedora content model PID.', 'description' => 'Autocomplete a Fedora content model PID.',
@ -525,6 +532,48 @@ function islandora_permission() {
); );
} }
/**
* Implements hook_i18n_string_info().
*/
function islandora_i18n_string_info() {
return array(
'islandora' => array(
'title' => t('Islandora'),
'description' => t('Translatable Metadata labels, etc.'),
'format' => FALSE,
'list' => TRUE,
),
);
}
/**
* Implements islandora_i18n_string_list().
*/
function islandora_i18n_string_list($group) {
if ($group == 'islandora') {
return array(
'islandora' => array(
'dc' => array(
'title' => array('label' => 'Title'),
'creator' => array('label' => 'Creator'),
'subject' => array('label' => 'Subject'),
'description' => array('label' => 'Description'),
'publisher' => array('label' => 'Publisher'),
'contributor' => array('label' => 'Contributor'),
'date' => array('label' => 'Date'),
'type' => array('label' => 'Type'),
'format' => array('label' => 'Format'),
'identifier' => array('label' => 'Identifier'),
'source' => array('label' => 'Source'),
'language' => array('label' => 'Language'),
'relation' => array('label' => 'Relation'),
'coverage' => array('label' => 'Coverage'),
),
),
);
}
}
/** /**
* Renders the print page for the given object. * Renders the print page for the given object.
* *
@ -993,7 +1042,7 @@ function islandora_drupal_title(AbstractObject $object) {
module_load_include('inc', 'islandora', 'includes/breadcrumb'); module_load_include('inc', 'islandora', 'includes/breadcrumb');
drupal_set_breadcrumb(islandora_get_breadcrumbs($object)); drupal_set_breadcrumb(islandora_get_breadcrumbs($object));
return $object->label; return filter_xss($object->label);
} }
/** /**
@ -1585,6 +1634,7 @@ function islandora_datastream_access($op, $datastream, $user = NULL) {
* Implements hook_islandora_basic_collection_get_query_filters(). * Implements hook_islandora_basic_collection_get_query_filters().
*/ */
function islandora_islandora_basic_collection_get_query_filters() { function islandora_islandora_basic_collection_get_query_filters() {
module_load_include('inc', 'islandora', 'includes/utilities');
$enforced = variable_get('islandora_namespace_restriction_enforced', FALSE); $enforced = variable_get('islandora_namespace_restriction_enforced', FALSE);
if ($enforced) { if ($enforced) {
$namespace_array = islandora_get_allowed_namespaces(); $namespace_array = islandora_get_allowed_namespaces();

2
tests/scripts/travis_setup.sh

@ -25,7 +25,7 @@ pear install drush/drush-5.9.0
phpenv rehash phpenv rehash
drush dl --yes drupal drush dl --yes drupal
cd drupal-* cd drupal-*
drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes
drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null & drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null &
ln -s $ISLANDORA_DIR sites/all/modules/islandora ln -s $ISLANDORA_DIR sites/all/modules/islandora
mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini

6
theme/islandora-dublin-core-display.tpl.php

@ -20,11 +20,11 @@
<dl xmlns:dcterms="http://purl.org/dc/terms/" class="islandora-inline-metadata islandora-metadata-fields"> <dl xmlns:dcterms="http://purl.org/dc/terms/" class="islandora-inline-metadata islandora-metadata-fields">
<?php $row_field = 0; ?> <?php $row_field = 0; ?>
<?php foreach($dc_array as $key => $value): ?> <?php foreach($dc_array as $key => $value): ?>
<dt property="<?php print $value['dcterms']; ?>" content="<?php print $value['value']; ?>" class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>"> <dt property="<?php print $value['dcterms']; ?>" content="<?php print filter_xss($value['value']); ?>" class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['label']; ?> <?php print filter_xss($value['label']); ?>
</dt> </dt>
<dd class="<?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']; ?> <?php print filter_xss($value['value']); ?>
</dd> </dd>
<?php $row_field++; ?> <?php $row_field++; ?>
<?php endforeach; ?> <?php endforeach; ?>

6
theme/theme.inc

@ -39,7 +39,7 @@ function islandora_preprocess_islandora_default_edit(array &$variables) {
); );
$row[] = array( $row[] = array(
'class' => 'datastream-label', 'class' => 'datastream-label',
'data' => $ds->label, 'data' => filter_xss($ds->label),
); );
$row[] = array( $row[] = array(
'class' => 'datastream-control', 'class' => 'datastream-control',
@ -47,7 +47,7 @@ function islandora_preprocess_islandora_default_edit(array &$variables) {
); );
$row[] = array( $row[] = array(
'class' => 'datastream-mime', 'class' => 'datastream-mime',
'data' => $ds->mimeType, 'data' => filter_xss($ds->mimeType),
); );
$row[] = array( $row[] = array(
'class' => 'datastream-size', 'class' => 'datastream-size',
@ -81,7 +81,7 @@ function islandora_preprocess_islandora_default_edit(array &$variables) {
); );
$rows[] = $row; $rows[] = $row;
} }
$caption = $islandora_object->label . ' - ' . $islandora_object->id; $caption = filter_xss($islandora_object->label) . ' - ' . $islandora_object->id;
$table = array( $table = array(
'colgroups' => NULL, 'colgroups' => NULL,
'sticky' => TRUE, 'sticky' => TRUE,

Loading…
Cancel
Save