diff --git a/.travis.yml b/.travis.yml index 17a22707..660fb448 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ branches: env: - FEDORA_VERSION="3.5" - FEDORA_VERSION="3.6.2" + - FEDORA_VERSION="3.7.0" before_install: - export ISLANDORA_DIR=$TRAVIS_BUILD_DIR - $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh diff --git a/README.md b/README.md index c1974352..90d935cf 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,17 @@ REQUIREMENTS The Tuque library must be installed to use Islandora. It can be found here: http://github.com/Islandora/tuque 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 +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 ------------ diff --git a/includes/derivatives.inc b/includes/derivatives.inc index 8a6627e5..4daa2133 100644 --- a/includes/derivatives.inc +++ b/includes/derivatives.inc @@ -96,7 +96,19 @@ function islandora_derivative_logging(array $logging_results) { foreach ($logging_results as $result) { foreach ($result['messages'] as $message) { 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 { // We know what we are doing here. Passing through the translated diff --git a/includes/dublin_core.inc b/includes/dublin_core.inc index ec058181..ae59ef5c 100644 --- a/includes/dublin_core.inc +++ b/includes/dublin_core.inc @@ -130,8 +130,11 @@ class DublinCore { } $dc_label = explode(':', $field); $element_label = drupal_ucfirst($dc_label[1]); - $dc_array[$field]['label'] = $element_label; - $dc_array[$field]['value'] = $value; + $i18n_object_id = drupal_strtolower($element_label); + $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]['dcterms'] = preg_replace('/^dc/', 'dcterms', $field); } @@ -140,7 +143,6 @@ class DublinCore { return $dc_array; } - /** * Creates a new instance of the class by parsing dc_xml. * diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index 0ed75385..b49556d7 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -773,6 +773,9 @@ function islandora_ingest_form_submit(array $form, array &$form_state) { try { islandora_add_object($object); $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) { // If post hooks throws it may already exist at this point but may be diff --git a/includes/utilities.inc b/includes/utilities.inc index 2139ae09..d858ff0c 100644 --- a/includes/utilities.inc +++ b/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); 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.
With stack: @trace', + array('@trace' => $e->getTraceAsString()), + WATCHDOG_ERROR + ); + } + return FALSE; +} diff --git a/islandora.info b/islandora.info index 36ed0dff..732143b5 100644 --- a/islandora.info +++ b/islandora.info @@ -1,6 +1,8 @@ name = Islandora description = "View and manage Fedora objects" package = Islandora +dependencies[] = image +dependencies[] = file version = 7.x-dev core = 7.x configure = admin/islandora/configure diff --git a/islandora.module b/islandora.module index ba5ec91e..4a1a051e 100644 --- a/islandora.module +++ b/islandora.module @@ -322,6 +322,13 @@ function islandora_menu() { 'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 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( 'title' => 'Autocomplete callback', '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. * @@ -993,7 +1042,7 @@ function islandora_drupal_title(AbstractObject $object) { module_load_include('inc', 'islandora', 'includes/breadcrumb'); 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(). */ function islandora_islandora_basic_collection_get_query_filters() { + module_load_include('inc', 'islandora', 'includes/utilities'); $enforced = variable_get('islandora_namespace_restriction_enforced', FALSE); if ($enforced) { $namespace_array = islandora_get_allowed_namespaces(); diff --git a/tests/scripts/travis_setup.sh b/tests/scripts/travis_setup.sh index f46c2fc6..2fa3fd0e 100755 --- a/tests/scripts/travis_setup.sh +++ b/tests/scripts/travis_setup.sh @@ -25,7 +25,7 @@ pear install drush/drush-5.9.0 phpenv rehash drush dl --yes 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 & 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 diff --git a/theme/islandora-dublin-core-display.tpl.php b/theme/islandora-dublin-core-display.tpl.php index da67de18..2c2a02ee 100644 --- a/theme/islandora-dublin-core-display.tpl.php +++ b/theme/islandora-dublin-core-display.tpl.php @@ -20,11 +20,11 @@
$value): ?> -
- +
+
- +
diff --git a/theme/theme.inc b/theme/theme.inc index 8ffffc4f..6a80fbb6 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -39,7 +39,7 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { ); $row[] = array( 'class' => 'datastream-label', - 'data' => $ds->label, + 'data' => filter_xss($ds->label), ); $row[] = array( 'class' => 'datastream-control', @@ -47,7 +47,7 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { ); $row[] = array( 'class' => 'datastream-mime', - 'data' => $ds->mimeType, + 'data' => filter_xss($ds->mimeType), ); $row[] = array( 'class' => 'datastream-size', @@ -81,7 +81,7 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { ); $rows[] = $row; } - $caption = $islandora_object->label . ' - ' . $islandora_object->id; + $caption = filter_xss($islandora_object->label) . ' - ' . $islandora_object->id; $table = array( 'colgroups' => NULL, 'sticky' => TRUE,