diff --git a/includes/derivatives.inc b/includes/derivatives.inc index 8a6627e5..cb8bacbf 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_derivative_messages'])) { + $_SESSION['islandora_derivative_messages'] = array(); + } + $_SESSION['islandora_derivative_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/utilities.inc b/includes/utilities.inc index 2139ae09..5417100b 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -924,3 +924,22 @@ 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_derivative_messages'])) { + foreach ($_SESSION['islandora_derivative_messages'] as $message) { + drupal_set_message($message['message'], $message['severity']); + $results = TRUE; + } + unset($_SESSION['islandora_derivative_messages']); + } + $text = ($results) ? t('The status messages above will be deleted after viewing this page.') : t('No messages to display.'); + return array('#markup' => $text); +} diff --git a/islandora.module b/islandora.module index 1d951b74..9c14c90f 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.',