From b002191085827a8482bd8c6cddeae921598e85e4 Mon Sep 17 00:00:00 2001 From: MorganDawe Date: Tue, 27 Aug 2013 13:46:26 -0300 Subject: [PATCH 1/3] Added the previously removed print callback, as it was required by another module and was breaking clipping. --- islandora.module | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/islandora.module b/islandora.module index 1a53aebf..ed2268db 100644 --- a/islandora.module +++ b/islandora.module @@ -297,6 +297,15 @@ function islandora_menu() { 'access arguments' => array(ISLANDORA_VIEW_DATASTREAM_HISTORY, 4), 'load arguments' => array(2), ); + $items['islandora/object/%islandora_object/printer'] = array( + 'title' => 'Print Object', + 'page callback' => 'islandora_print_object', + 'page arguments' => array(2), + 'type' => MENU_CALLBACK, + 'access callback' => 'islandora_object_access', + 'access arguments' => array(FEDORA_VIEW_OBJECTS, 2), + 'load arguments' => array(2), + ); $items['islandora/object/%islandora_object/download_clip'] = array( 'page callback' => 'islandora_download_clip', 'page arguments' => array(2), @@ -341,6 +350,12 @@ function islandora_theme() { 'variables' => array('islandora_object' => NULL), ), // Default edit page. + 'islandora_default_print' => array( + 'file' => 'theme/theme.inc', + 'template' => 'theme/islandora-object-print', + 'variables' => array('islandora_object' => NULL), + ), + // Default edit page. 'islandora_default_edit' => array( 'file' => 'theme/theme.inc', 'template' => 'theme/islandora-object-edit', @@ -454,6 +469,22 @@ function islandora_permission() { ); } +/** + * Renders the print page for the given object. + * + * Modules can either implement preprocess functions to append content onto the + * 'content' variable, or override the display by providing a theme suggestion. + * + * @param AbstractObject $object + * The object. + * + * @return array + * A renderable array. + */ +function islandora_print_object(AbstractObject $object) { + drupal_set_title($object->label); + return theme('islandora_object_print', array('object' => $object)); +} /** * Implements hook_forms(). */ From 76e09b2471f3bd0259769be5ed74d093cc8807db Mon Sep 17 00:00:00 2001 From: MorganDawe Date: Wed, 28 Aug 2013 09:50:56 -0300 Subject: [PATCH 2/3] Fixed Menu path conflicts with printing dc_data and clipping large image and newspaper. --- islandora.module | 42 +++++++++++++++++++----------------------- js/add_print.js | 1 + 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/islandora.module b/islandora.module index ed2268db..a8250fcc 100644 --- a/islandora.module +++ b/islandora.module @@ -119,13 +119,22 @@ function islandora_menu() { 'access callback' => 'islandora_object_access_callback', 'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2), ); - $items['islandora/object/%islandora_object/print'] = array( + $items['islandora/object/%islandora_object/print_object'] = array( 'page callback' => 'islandora_printer_object', 'page arguments' => array(2), 'type' => MENU_NORMAL_ITEM, - 'access callback' => 'islandora_object_access_callback', + 'access callback' => 'islandora_object_access', 'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2), ); + $items['islandora/object/%islandora_object/print'] = array( + 'title' => 'Print Object', + 'page callback' => 'islandora_print_object', + 'page arguments' => array(2), + 'type' => MENU_CALLBACK, + 'access callback' => 'islandora_object_access', + 'access arguments' => array(FEDORA_VIEW_OBJECTS, 2), + 'load arguments' => array(2), + ); $items['islandora/object/%islandora_object/view'] = array( 'title' => 'View', 'type' => MENU_DEFAULT_LOCAL_TASK, @@ -151,13 +160,11 @@ function islandora_menu() { ISLANDORA_INGEST, ), 2), ); - $items['islandora/object/%islandora_object/manage/overview'] = array( 'title' => 'Overview', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -20, ); - $items['islandora/object/%islandora_object/manage/datastreams'] = array( 'title' => 'Datastreams', 'type' => MENU_LOCAL_TASK, @@ -172,7 +179,6 @@ function islandora_menu() { ), 2), 'weight' => -10, ); - $items['islandora/object/%islandora_object/manage/properties'] = array( 'title' => 'Properties', 'page callback' => 'drupal_get_form', @@ -297,15 +303,6 @@ function islandora_menu() { 'access arguments' => array(ISLANDORA_VIEW_DATASTREAM_HISTORY, 4), 'load arguments' => array(2), ); - $items['islandora/object/%islandora_object/printer'] = array( - 'title' => 'Print Object', - 'page callback' => 'islandora_print_object', - 'page arguments' => array(2), - 'type' => MENU_CALLBACK, - 'access callback' => 'islandora_object_access', - 'access arguments' => array(FEDORA_VIEW_OBJECTS, 2), - 'load arguments' => array(2), - ); $items['islandora/object/%islandora_object/download_clip'] = array( 'page callback' => 'islandora_download_clip', 'page arguments' => array(2), @@ -350,12 +347,6 @@ function islandora_theme() { 'variables' => array('islandora_object' => NULL), ), // Default edit page. - 'islandora_default_print' => array( - 'file' => 'theme/theme.inc', - 'template' => 'theme/islandora-object-print', - 'variables' => array('islandora_object' => NULL), - ), - // Default edit page. 'islandora_default_edit' => array( 'file' => 'theme/theme.inc', 'template' => 'theme/islandora-object-edit', @@ -366,8 +357,13 @@ function islandora_theme() { 'file' => 'includes/solution_packs.inc', 'render element' => 'form', ), - // Print object view. + // Print used by the clipper. 'islandora_object_print' => array( + 'file' => 'theme/theme.inc', + 'variables' => array('object' => NULL, 'content' => array()), + ), + // Print object view, prints islandora objects. + 'islandora_object_print_object' => array( 'file' => 'theme/theme.inc', 'template' => 'theme/islandora-object-print', 'variables' => array( @@ -866,7 +862,7 @@ function islandora_view_object(AbstractObject $object) { drupal_add_js(array( 'islandora' => array( - 'print_link' => 'islandora/object/' . $object->id . '/print')), + 'print_link' => 'islandora/object/' . $object->id . '/print_object')), array('type' => 'setting')); drupal_add_js($path . '/js/add_print.js'); @@ -999,7 +995,7 @@ function islandora_default_islandora_printer_object($object, $alter) { } $variables = isset($dc_object) ? $dc_object->asArray() : array(); - $output = theme('islandora_object_print', array( + $output = theme('islandora_object_print_object', array( 'object' => $object, 'dc_array' => $variables, 'islandora_content' => $alter)); diff --git a/js/add_print.js b/js/add_print.js index 0059ed88..014ec2e3 100644 --- a/js/add_print.js +++ b/js/add_print.js @@ -10,6 +10,7 @@ $(document).ready(function() { $('.tabs .primary').append(''); $('#print_btn').css("cursor","pointer"); + console.log(Drupal.settings.basePath + Drupal.settings.islandora.print_link); $('#print_btn').click(function() { window.location=Drupal.settings.basePath + Drupal.settings.islandora.print_link; }); From 81cc6be97748b359e8cf4543cca10b18c83e6ce0 Mon Sep 17 00:00:00 2001 From: MorganDawe Date: Wed, 28 Aug 2013 09:58:21 -0300 Subject: [PATCH 3/3] Removed console log function and reference to old view object permission. --- islandora.module | 2 +- js/add_print.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index a8250fcc..8fa20898 100644 --- a/islandora.module +++ b/islandora.module @@ -132,7 +132,7 @@ function islandora_menu() { 'page arguments' => array(2), 'type' => MENU_CALLBACK, 'access callback' => 'islandora_object_access', - 'access arguments' => array(FEDORA_VIEW_OBJECTS, 2), + 'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2), 'load arguments' => array(2), ); $items['islandora/object/%islandora_object/view'] = array( diff --git a/js/add_print.js b/js/add_print.js index 014ec2e3..0059ed88 100644 --- a/js/add_print.js +++ b/js/add_print.js @@ -10,7 +10,6 @@ $(document).ready(function() { $('.tabs .primary').append(''); $('#print_btn').css("cursor","pointer"); - console.log(Drupal.settings.basePath + Drupal.settings.islandora.print_link); $('#print_btn').click(function() { window.location=Drupal.settings.basePath + Drupal.settings.islandora.print_link; });