Browse Source

Try to limit wall of text with derivative messages

pull/421/head
mitchmac 11 years ago
parent
commit
40c8bac425
  1. 14
      includes/derivatives.inc
  2. 19
      includes/utilities.inc
  3. 7
      islandora.module

14
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

19
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);
}

7
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.',

Loading…
Cancel
Save