From 0002070060dc2706f6f0747946c3234045399c21 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 10:53:48 -0300 Subject: [PATCH 01/22] added content model to overview --- islandora.module | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/islandora.module b/islandora.module index b3f20e21..5f95f0c3 100644 --- a/islandora.module +++ b/islandora.module @@ -2170,3 +2170,23 @@ function islandora_islandora_get_breadcrumb_query_predicates(AbstractObject $obj 'fedora-rels-ext:isMemberOf', ); } + +/** + * Implements hook_islandora_overview_object(). + */ +function islandora_islandora_overview_object(AbstractObject $object) { + $cmodels = $object->models; + $rows = array(); + foreach ($cmodels as $cmodel) { + if ($cmodel != 'fedora-system:FedoraObject-3.0') { + $object = islandora_object_load($cmodel); + $rows[] = array(l($object->label, "islandora/object/{$object->id}")); + } + } + $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); + $table = theme('table', array( + 'header' => array($header), + 'rows' => $rows, + 'empty' => t('No content model associated woith this object.'))); + return array('cmodels' => $table); +} From 66f3a45519500d2ce85cd0e5a453d73297b03c0a Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 10:56:11 -0300 Subject: [PATCH 02/22] typo fixed --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 5f95f0c3..87dd29a6 100644 --- a/islandora.module +++ b/islandora.module @@ -2187,6 +2187,6 @@ function islandora_islandora_overview_object(AbstractObject $object) { $table = theme('table', array( 'header' => array($header), 'rows' => $rows, - 'empty' => t('No content model associated woith this object.'))); + 'empty' => t('No content model associated with this object.'))); return array('cmodels' => $table); } From c6c84691886968df58aa7746d712c72f5d75c206 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 11:36:14 -0300 Subject: [PATCH 03/22] variable name collision --- islandora.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index 87dd29a6..b3dcf58e 100644 --- a/islandora.module +++ b/islandora.module @@ -2179,8 +2179,8 @@ function islandora_islandora_overview_object(AbstractObject $object) { $rows = array(); foreach ($cmodels as $cmodel) { if ($cmodel != 'fedora-system:FedoraObject-3.0') { - $object = islandora_object_load($cmodel); - $rows[] = array(l($object->label, "islandora/object/{$object->id}")); + $o = islandora_object_load($cmodel); + $rows[] = array(l($object->label, "islandora/object/{$o->id}")); } } $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); From 362348ef04ab0538009a2299fe0dba6edb95d843 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 11:54:03 -0300 Subject: [PATCH 04/22] clarified empty message --- islandora.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index b3dcf58e..77b20838 100644 --- a/islandora.module +++ b/islandora.module @@ -2180,13 +2180,13 @@ function islandora_islandora_overview_object(AbstractObject $object) { foreach ($cmodels as $cmodel) { if ($cmodel != 'fedora-system:FedoraObject-3.0') { $o = islandora_object_load($cmodel); - $rows[] = array(l($object->label, "islandora/object/{$o->id}")); + $rows[] = array(l($o->label, "islandora/object/{$o->id}")); } } $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); $table = theme('table', array( 'header' => array($header), 'rows' => $rows, - 'empty' => t('No content model associated with this object.'))); + 'empty' => t('No Islandora content model associated with this object.'))); return array('cmodels' => $table); } From d82444de89ff0494ae8fea429926ba9a78f613ee Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 12:07:05 -0300 Subject: [PATCH 05/22] added additional filter --- islandora.module | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/islandora.module b/islandora.module index 77b20838..f497c271 100644 --- a/islandora.module +++ b/islandora.module @@ -2175,18 +2175,20 @@ function islandora_islandora_get_breadcrumb_query_predicates(AbstractObject $obj * Implements hook_islandora_overview_object(). */ function islandora_islandora_overview_object(AbstractObject $object) { - $cmodels = $object->models; - $rows = array(); - foreach ($cmodels as $cmodel) { - if ($cmodel != 'fedora-system:FedoraObject-3.0') { - $o = islandora_object_load($cmodel); - $rows[] = array(l($o->label, "islandora/object/{$o->id}")); + if (is_object($object)) { + $cmodels = $object->models; + $rows = array(); + foreach ($cmodels as $cmodel) { + if ($cmodel != 'fedora-system:FedoraObject-3.0') { + $o = islandora_object_load($cmodel); + $rows[] = array(l($o->label, "islandora/object/{$o->id}")); + } } + $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); + $table = theme('table', array( + 'header' => array($header), + 'rows' => $rows, + 'empty' => t('No Islandora content model associated with this object.'))); + return array('cmodels' => $table); } - $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); - $table = theme('table', array( - 'header' => array($header), - 'rows' => $rows, - 'empty' => t('No Islandora content model associated with this object.'))); - return array('cmodels' => $table); } From 37c7fcd9d00aeb07ab70b3c63c237cee70193bda Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 12:42:41 -0300 Subject: [PATCH 06/22] yet another validity check --- islandora.module | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index f497c271..809b0d61 100644 --- a/islandora.module +++ b/islandora.module @@ -2181,7 +2181,9 @@ function islandora_islandora_overview_object(AbstractObject $object) { foreach ($cmodels as $cmodel) { if ($cmodel != 'fedora-system:FedoraObject-3.0') { $o = islandora_object_load($cmodel); - $rows[] = array(l($o->label, "islandora/object/{$o->id}")); + if(is_object($o)) { + $rows[] = array(l($o->label, "islandora/object/{$o->id}")); + } } } $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); From 448709c9325b79659aaff862fbfa2dc6f852534a Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 13:10:38 -0300 Subject: [PATCH 07/22] allowances made for missing content models --- islandora.module | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/islandora.module b/islandora.module index 809b0d61..82f891ba 100644 --- a/islandora.module +++ b/islandora.module @@ -2175,22 +2175,24 @@ function islandora_islandora_get_breadcrumb_query_predicates(AbstractObject $obj * Implements hook_islandora_overview_object(). */ function islandora_islandora_overview_object(AbstractObject $object) { - if (is_object($object)) { - $cmodels = $object->models; - $rows = array(); - foreach ($cmodels as $cmodel) { - if ($cmodel != 'fedora-system:FedoraObject-3.0') { - $o = islandora_object_load($cmodel); - if(is_object($o)) { - $rows[] = array(l($o->label, "islandora/object/{$o->id}")); - } + + $cmodels = $object->models; + $rows = array(); + foreach ($cmodels as $cmodel) { + if ($cmodel != 'fedora-system:FedoraObject-3.0') { + $o = islandora_object_load($cmodel); + if (is_object($o)) { + $rows[] = array(l($o->label, "islandora/object/{$o->id}")); + } + else { + $rows[] = array(t("@cmodel - (This content model is not in this Islandora repository.)", array('@cmodel' => $cmodel))); } } - $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); - $table = theme('table', array( - 'header' => array($header), - 'rows' => $rows, - 'empty' => t('No Islandora content model associated with this object.'))); - return array('cmodels' => $table); } + $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); + $table = theme('table', array( + 'header' => array($header), + 'rows' => $rows, + 'empty' => t('No Islandora content model associated with this object.'))); + return array('cmodels' => $table); } From e760b32e4b161750bad4e9f1993f255d614c2f84 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 13:18:41 -0300 Subject: [PATCH 08/22] allowances made for missing content models --- islandora.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index 82f891ba..804140be 100644 --- a/islandora.module +++ b/islandora.module @@ -2189,9 +2189,9 @@ function islandora_islandora_overview_object(AbstractObject $object) { } } } - $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); + $headers = format_plural(count($rows), t('Content Model'), t('Content Models')); $table = theme('table', array( - 'header' => array($header), + 'header' => array($headers), 'rows' => $rows, 'empty' => t('No Islandora content model associated with this object.'))); return array('cmodels' => $table); From 7e687cf97fb590471e81028f699a63e578dbecaf Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 13:28:40 -0300 Subject: [PATCH 09/22] reverted pluralization --- islandora.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index 804140be..82f891ba 100644 --- a/islandora.module +++ b/islandora.module @@ -2189,9 +2189,9 @@ function islandora_islandora_overview_object(AbstractObject $object) { } } } - $headers = format_plural(count($rows), t('Content Model'), t('Content Models')); + $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); $table = theme('table', array( - 'header' => array($headers), + 'header' => array($header), 'rows' => $rows, 'empty' => t('No Islandora content model associated with this object.'))); return array('cmodels' => $table); From 4def002dc31ea97aa53b868a49a21acbada6e309 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 14:15:41 -0300 Subject: [PATCH 10/22] converted output to render array --- islandora.module | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/islandora.module b/islandora.module index 82f891ba..fd98df9e 100644 --- a/islandora.module +++ b/islandora.module @@ -2175,7 +2175,6 @@ function islandora_islandora_get_breadcrumb_query_predicates(AbstractObject $obj * Implements hook_islandora_overview_object(). */ function islandora_islandora_overview_object(AbstractObject $object) { - $cmodels = $object->models; $rows = array(); foreach ($cmodels as $cmodel) { @@ -2190,9 +2189,12 @@ function islandora_islandora_overview_object(AbstractObject $object) { } } $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); - $table = theme('table', array( - 'header' => array($header), - 'rows' => $rows, - 'empty' => t('No Islandora content model associated with this object.'))); - return array('cmodels' => $table); + $table = array( + '#theme' => 'table', + '#header' => array($header), + '#rows' => $rows, + '#empty' => t('No Islandora content model associated with this object.') + ); + $rendered_table = drupal_render($table); + return array('cmodels' => $rendered_table); } From 3fdc4408c0cc9edb0af2103d1356bd4e3e78b26b Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 14:26:41 -0300 Subject: [PATCH 11/22] coder standards --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index fd98df9e..2ffc8133 100644 --- a/islandora.module +++ b/islandora.module @@ -2193,7 +2193,7 @@ function islandora_islandora_overview_object(AbstractObject $object) { '#theme' => 'table', '#header' => array($header), '#rows' => $rows, - '#empty' => t('No Islandora content model associated with this object.') + '#empty' => t('No Islandora content model associated with this object.'), ); $rendered_table = drupal_render($table); return array('cmodels' => $rendered_table); From f0bd3e9490a6114b1b9dd051aad9fb984fb535ee Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 18:08:44 -0300 Subject: [PATCH 12/22] now as a renderable array --- islandora.module | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/islandora.module b/islandora.module index 2ffc8133..7a7f2212 100644 --- a/islandora.module +++ b/islandora.module @@ -2188,13 +2188,13 @@ function islandora_islandora_overview_object(AbstractObject $object) { } } } - $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); + $header = format_plural(count($rows), 'Content Model', 'Content Models'); $table = array( - '#theme' => 'table', - '#header' => array($header), - '#rows' => $rows, - '#empty' => t('No Islandora content model associated with this object.'), - ); - $rendered_table = drupal_render($table); - return array('cmodels' => $rendered_table); + '#type' => 'markup', + '#theme' => 'table', + '#header' => array($header), + '#rows' => $rows, + '#empty' => t('No Islandora content model associated with this object.') + ); + return array('cmodels' => $table); } From ec8792fd54788924030829221f9846d896da8c43 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 18:34:29 -0300 Subject: [PATCH 13/22] coder --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 7a7f2212..96ff98d4 100644 --- a/islandora.module +++ b/islandora.module @@ -2194,7 +2194,7 @@ function islandora_islandora_overview_object(AbstractObject $object) { '#theme' => 'table', '#header' => array($header), '#rows' => $rows, - '#empty' => t('No Islandora content model associated with this object.') + '#empty' => t('No Islandora content model associated with this object.'), ); return array('cmodels' => $table); } From 715f4d2c3babcbd9913d4da4282587606d0d4bb1 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Sat, 30 Jul 2016 12:45:09 -0300 Subject: [PATCH 14/22] coder --- islandora.module | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/islandora.module b/islandora.module index 96ff98d4..e3612707 100644 --- a/islandora.module +++ b/islandora.module @@ -2190,11 +2190,11 @@ function islandora_islandora_overview_object(AbstractObject $object) { } $header = format_plural(count($rows), 'Content Model', 'Content Models'); $table = array( - '#type' => 'markup', - '#theme' => 'table', - '#header' => array($header), - '#rows' => $rows, - '#empty' => t('No Islandora content model associated with this object.'), - ); + '#type' => 'markup', + '#theme' => 'table', + '#header' => array($header), + '#rows' => $rows, + '#empty' => t('No Islandora content model associated with this object.') + ); return array('cmodels' => $table); } From 3e6eaa219ab5e683a2b32c1aa454101478175c15 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Sat, 30 Jul 2016 13:10:20 -0300 Subject: [PATCH 15/22] coder --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index e3612707..fcb88836 100644 --- a/islandora.module +++ b/islandora.module @@ -2194,7 +2194,7 @@ function islandora_islandora_overview_object(AbstractObject $object) { '#theme' => 'table', '#header' => array($header), '#rows' => $rows, - '#empty' => t('No Islandora content model associated with this object.') + '#empty' => t('No Islandora content model associated with this object.'), ); return array('cmodels' => $table); } From b5181b8653a0f8d88b59a85361c8b821d0c2ea98 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Tue, 18 Oct 2016 15:25:56 -0300 Subject: [PATCH 16/22] refactored to themed list, cleaned out non-functional code --- islandora.module | 134 ++++++++++++++++++----------------------------- theme/theme.inc | 41 +++++++++++---- 2 files changed, 82 insertions(+), 93 deletions(-) diff --git a/islandora.module b/islandora.module index fcb88836..0e2e4630 100644 --- a/islandora.module +++ b/islandora.module @@ -22,7 +22,6 @@ * You should have received a copy of the GNU General Public License * along with the program. If not, see . */ - // Common datastreams. define('ISLANDORA_DS_COMP_STREAM', 'DS-COMPOSITE-MODEL'); @@ -459,7 +458,8 @@ function islandora_theme() { 'variables' => array( 'object' => NULL, 'content' => NULL, - 'islandora_content' => NULL), + 'islandora_content' => NULL, + ), ), // Render a bunch of objects as either a grid or a list. 'islandora_objects' => array( @@ -562,6 +562,12 @@ function islandora_theme() { 'file' => 'includes/solution_packs.inc', 'render element' => 'form', ), + // Overview for manage tab + 'islandora_object_overview' => array( + 'file' => 'theme/theme.inc', + 'template' => 'theme/islandora-object-overview', + 'variables' => array('islandora_object' => NULL), + ), ); } @@ -743,7 +749,7 @@ function islandora_forms($form_id) { * TRUE if the user is allowed to access this object/datastream, FALSE * otherwise. */ -function islandora_user_access($object_or_datastream, array $permissions, $content_models = array(), $access_any = TRUE, $user = NULL) { +function islandora_user_access($object_or_datastream, array$permissions, $content_models = array(), $access_any = TRUE, $user = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); $is_repository_accessible = &drupal_static(__FUNCTION__); @@ -919,40 +925,21 @@ function islandora_object_manage_access_callback($perms, $object = NULL) { */ function islandora_manage_overview_object(AbstractObject $object) { module_load_include('inc', 'islandora', 'includes/utilities'); - $output = array(); + $output = islandora_create_manage_overview($object); $hooks = islandora_build_hook_list(ISLANDORA_OVERVIEW_HOOK, $object->models); foreach ($hooks as $hook) { $temp = module_invoke_all($hook, $object); islandora_as_renderable_array($temp); if (!empty($temp)) { + arsort($temp); $output = array_merge_recursive($output, $temp); } } - if (empty($output)) { - // Add in the default, if we did not get any results. - $output = islandora_default_islandora_manage_overview_object($object); - } - arsort($output); drupal_alter($hooks, $object, $output); islandora_as_renderable_array($output); return $output; } -/** - * Renders the default manage object page for the given object. - * - * @param AbstractObject $object - * The object used to render the manage object page. - * - * @return array - * The default rendering of the object manage page, indexed at - * 'Default Edit output'. - */ -function islandora_default_islandora_manage_overview_object(AbstractObject $object) { - $output = theme('islandora_default_overview', array('islandora_object' => $object)); - return array('Default overview output' => array('#markup' => $output)); -} - /** * Renders the given objects manage page. * @@ -1159,10 +1146,10 @@ function islandora_default_islandora_printer_object($object, $alter) { $metadata = islandora_retrieve_metadata_markup($object, TRUE); $variables = isset($dc_object) ? $dc_object->asArray() : array(); $output = theme('islandora_object_print_object', array( - 'object' => $object, - 'dc_array' => $variables, - 'metadata' => $metadata, - 'islandora_content' => $alter)); + 'object' => $object, + 'dc_array' => $variables, + 'metadata' => $metadata, + 'islandora_content' => $alter)); return array('Default output' => array('#markup' => $output)); } @@ -1223,7 +1210,7 @@ function islandora_object_load($object_id) { try { return $tuque->repository->getObject(urldecode($object_id)); } - catch (Exception $e) { + catch (Exception $e) { if ($e->getCode() == '404') { return FALSE; } @@ -1671,10 +1658,10 @@ function islandora_object_access($op, $object, $user = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); $results = islandora_invoke_hook_list('islandora_object_access', $object->models, array( - $op, - $object, - $user, - )); + $op, + $object, + $user, + )); // Nothing returned FALSE, and something returned TRUE. $cache[$op][$object->id][$user->uid] = (!in_array(FALSE, $results, TRUE) && in_array(TRUE, $results, TRUE)); @@ -1716,23 +1703,23 @@ function islandora_datastream_access($op, $datastream, $user = NULL) { if (!isset($cache[$op][$datastream->parent->id][$datastream->id][$user->uid])) { module_load_include('inc', 'islandora', 'includes/utilities'); $object_results = islandora_invoke_hook_list('islandora_object_access', $datastream->parent->models, array( - $op, - $datastream->parent, - $user, - )); + $op, + $datastream->parent, + $user, + )); $datastream_results = islandora_invoke_hook_list('islandora_datastream_access', $datastream->parent->models, array( - $op, - $datastream, - $user, - )); + $op, + $datastream, + $user, + )); // The datastream check returned FALSE, and one in the object or datastream // checks returned TRUE. $cache[$op][$datastream->parent->id][$datastream->id][$user->uid] = ( - !in_array(FALSE, $datastream_results, TRUE) && - (in_array(TRUE, $object_results, TRUE) || in_array(TRUE, $datastream_results, TRUE)) - ); + !in_array(FALSE, $datastream_results, TRUE) && + (in_array(TRUE, $object_results, TRUE) || in_array(TRUE, $datastream_results, TRUE)) + ); } return $cache[$op][$datastream->parent->id][$datastream->id][$user->uid]; @@ -1804,10 +1791,10 @@ function islandora_islandora_datastream_modified(AbstractObject $object, Abstrac 'dsid' => $datastream->id, ); $logging_results = islandora_do_derivatives($object, array( - 'source_dsid' => $datastream->id, - 'force' => TRUE, - 'ds_modified_params' => $params, - )); + 'source_dsid' => $datastream->id, + 'force' => TRUE, + 'ds_modified_params' => $params, + )); islandora_derivative_logging($logging_results); islandora_conditionally_clear_cache(); } @@ -1819,7 +1806,6 @@ function islandora_islandora_object_purged($pid) { islandora_conditionally_clear_cache(); } - /** * Implements hook_islandora_datastream_purged(). */ @@ -1839,22 +1825,22 @@ function islandora_form_simpletest_test_form_alter(array &$form) { if ($filter_status) { $filter_status_message = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array())) . " "; $filter_status_message .= t("Drupal filter at @filter_path is writable by the server.", array( - '@filter_path' => $filter_path, - )); + '@filter_path' => $filter_path, + )); } else { $filter_status_message = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array())) . " "; $filter_status_message .= t("Drupal filter at @filter_path is not writable by the server. Please make sure your webserver has permission to write to the Drupal filter. If the path given is incorrect, you will need to change it in your server's test config file, located in the Islandora module's 'tests' folder as test_config.ini or default.test_config.ini.", array( - '@filter_path' => $filter_path, - )); + '@filter_path' => $filter_path, + )); } $form['tests'] = array( '#type' => 'fieldset', '#title' => t('Tests'), '#description' => t("Select the test(s) or test group(s) you would like to run, and click Run tests.

NOTE: Tests in groups prefixed with Islandora generally require a configuration file, found in the Islandora module 'tests' folder, as well as the use of the Islandora Drupal filter. Before any tests are run, please ensure that your web server has the appropriate permissions to alter the drupal-filter.xml file in your Fedora config folder. Your original Islandora Drupal filter configuration will NOT be overwritten by tests; HOWEVER, if PHP exits abnormally before the filter is reset, please use the 'Repair Drupal Filter' button below.

Drupal Filter Write Status: !filter_status_message

", array( - '!filter_status_message' => $filter_status_message, - )), + '!filter_status_message' => $filter_status_message, + )), ); $form['tests']['table'] = array( @@ -2032,12 +2018,12 @@ function islandora_menu_local_tasks_alter(&$data, $router_item, $root_path) { $tab['#suffix'] = ''; $tab['#theme'] = 'link'; $tab['#text'] = theme('image', array( - 'path' => "$islandora_path/images/print-icon.png", - 'alt' => t('Print Object'), - 'attributes' => array( - 'id' => 'print_btn', - ), - )); + 'path' => "$islandora_path/images/print-icon.png", + 'alt' => t('Print Object'), + 'attributes' => array( + 'id' => 'print_btn', + ), + )); $tab['#path'] = "{$router_item['href']}/print_object"; $tab['#options'] = array( 'attributes' => array(), @@ -2174,27 +2160,7 @@ function islandora_islandora_get_breadcrumb_query_predicates(AbstractObject $obj /** * Implements hook_islandora_overview_object(). */ -function islandora_islandora_overview_object(AbstractObject $object) { - $cmodels = $object->models; - $rows = array(); - foreach ($cmodels as $cmodel) { - if ($cmodel != 'fedora-system:FedoraObject-3.0') { - $o = islandora_object_load($cmodel); - if (is_object($o)) { - $rows[] = array(l($o->label, "islandora/object/{$o->id}")); - } - else { - $rows[] = array(t("@cmodel - (This content model is not in this Islandora repository.)", array('@cmodel' => $cmodel))); - } - } - } - $header = format_plural(count($rows), 'Content Model', 'Content Models'); - $table = array( - '#type' => 'markup', - '#theme' => 'table', - '#header' => array($header), - '#rows' => $rows, - '#empty' => t('No Islandora content model associated with this object.'), - ); - return array('cmodels' => $table); +function islandora_create_manage_overview(AbstractObject $object) { + $output = theme('islandora_object_overview', array('islandora_object' => $object)); + return array('cmodels' => $output); } diff --git a/theme/theme.inc b/theme/theme.inc index 844c0719..91ddb433 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -130,8 +130,8 @@ function islandora_preprocess_islandora_default(&$variables) { $datastreams[$id]['id'] = $id; $datastreams[$id]['label'] = $label; $datastreams[$id]['label_link'] = islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $ds) ? - l($label, $download_path) : - $label; + l($label, $download_path) : + $label; $datastreams[$id]['download_url'] = $download_path; $datastreams[$id]['mimetype'] = $ds->mimetype; $datastreams[$id]['size'] = islandora_datastream_get_human_readable_size($ds); @@ -139,7 +139,7 @@ function islandora_preprocess_islandora_default(&$variables) { $datastreams[$id]['class'] = drupal_strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id)); } catch (RepositoryException $e) { - + } } $variables['datastreams'] = $datastreams; @@ -268,8 +268,8 @@ function islandora_objects_object_mapper($object_id) { $img = array( '#theme' => 'image', '#path' => ($o && islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $o['TN']) ? - "$url/datastream/TN/view" : - "$module_path/images/folder.png"), + "$url/datastream/TN/view" : + "$module_path/images/folder.png"), '#attributes' => array(), ); $img = drupal_render($img); @@ -412,8 +412,8 @@ function theme_islandora_datastream_download_link(array $vars) { $label = t('download'); return islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $datastream) ? - l($label, islandora_datastream_get_url($datastream, 'download')) : - ''; + l($label, islandora_datastream_get_url($datastream, 'download')) : + ''; } /** @@ -543,8 +543,8 @@ function theme_islandora_datastream_edit_link(array $vars) { $can_edit = count($edit_registry) > 0 && islandora_datastream_access(ISLANDORA_METADATA_EDIT, $datastream); return $can_edit ? - l(t('edit'), "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/edit") : - ''; + l(t('edit'), "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/edit") : + ''; } /** @@ -647,3 +647,26 @@ function islandora_preprocess_islandora_dublin_core_description(array &$variable } $variables['dc_array'] = isset($dc_object) ? $dc_object->asArray() : array(); } + +/** + * Implements hook_preprocess(). + */ +function islandora_preprocess_islandora_object_overview(array &$variables) { + $object = $variables['islandora_object']; + $cmodels = $object->models; + $links = array(); + foreach ($cmodels as $cmodel) { + if ($cmodel != 'fedora-system:FedoraObject-3.0') { + $o = islandora_object_load($cmodel); + if (is_object($o)) { + $links[] = array(l($o->label, "islandora/object/{$o->id}")); + } + else { + $links[] = array(t("@cmodel - (This content model is not in this Islandora repository.)", array('@cmodel' => $cmodel))); + } + } + } + $pluralized_identifier = format_plural(count($links), 'Islandora content model', 'Islandora content models'); + $variables['header'] = t("This object's behavior is defined by the @identifier", array("@identifier" => $pluralized_identifier)); + $variables['list'] = theme('item_list', array('items' => $links)); +} From a12a7199b2b16be8e761014e79070965cc9d4f61 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Tue, 18 Oct 2016 18:09:34 -0300 Subject: [PATCH 17/22] added missing template --- theme/islandora-object-overview.tpl.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 theme/islandora-object-overview.tpl.php diff --git a/theme/islandora-object-overview.tpl.php b/theme/islandora-object-overview.tpl.php new file mode 100644 index 00000000..ed1c4a40 --- /dev/null +++ b/theme/islandora-object-overview.tpl.php @@ -0,0 +1,11 @@ + +
+

+

+
From cb2aeee3aff36bd5b4291aa624fa5b589c240895 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Tue, 18 Oct 2016 18:25:33 -0300 Subject: [PATCH 18/22] white space pulled --- theme/theme.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/theme.inc b/theme/theme.inc index 91ddb433..eace1c14 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -139,7 +139,7 @@ function islandora_preprocess_islandora_default(&$variables) { $datastreams[$id]['class'] = drupal_strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id)); } catch (RepositoryException $e) { - + } } $variables['datastreams'] = $datastreams; From 0c71e2eec5433f93ad5c84f8777e4fe2ad5d8a51 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Tue, 18 Oct 2016 19:30:55 -0300 Subject: [PATCH 19/22] formatting --- islandora.module | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/islandora.module b/islandora.module index 0e2e4630..905f79ba 100644 --- a/islandora.module +++ b/islandora.module @@ -22,6 +22,7 @@ * You should have received a copy of the GNU General Public License * along with the program. If not, see . */ + // Common datastreams. define('ISLANDORA_DS_COMP_STREAM', 'DS-COMPOSITE-MODEL'); @@ -562,7 +563,7 @@ function islandora_theme() { 'file' => 'includes/solution_packs.inc', 'render element' => 'form', ), - // Overview for manage tab + // Overview for manage tab. 'islandora_object_overview' => array( 'file' => 'theme/theme.inc', 'template' => 'theme/islandora-object-overview', @@ -749,7 +750,7 @@ function islandora_forms($form_id) { * TRUE if the user is allowed to access this object/datastream, FALSE * otherwise. */ -function islandora_user_access($object_or_datastream, array$permissions, $content_models = array(), $access_any = TRUE, $user = NULL) { +function islandora_user_access($object_or_datastream, array $permissions, $content_models = array(), $access_any = TRUE, $user = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); $is_repository_accessible = &drupal_static(__FUNCTION__); @@ -1210,14 +1211,14 @@ function islandora_object_load($object_id) { try { return $tuque->repository->getObject(urldecode($object_id)); } - catch (Exception $e) { + catch (Exception $e) { if ($e->getCode() == '404') { return FALSE; } else { return NULL; } - } + } } else { IslandoraTuque::getError(); From 03e6fa720c5b0467c4760ad271f7944d6ab61f36 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Tue, 18 Oct 2016 20:00:09 -0300 Subject: [PATCH 20/22] another missing space --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 905f79ba..45b98bde 100644 --- a/islandora.module +++ b/islandora.module @@ -1218,7 +1218,7 @@ function islandora_object_load($object_id) { else { return NULL; } - } + } } else { IslandoraTuque::getError(); From 70c6ac28ec63c7b1ef1f45e285d55eb72f254b93 Mon Sep 17 00:00:00 2001 From: ajstanley Date: Mon, 24 Oct 2016 17:10:39 -0300 Subject: [PATCH 21/22] spacing, comment --- islandora.module | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/islandora.module b/islandora.module index 45b98bde..767229d8 100644 --- a/islandora.module +++ b/islandora.module @@ -1147,10 +1147,10 @@ function islandora_default_islandora_printer_object($object, $alter) { $metadata = islandora_retrieve_metadata_markup($object, TRUE); $variables = isset($dc_object) ? $dc_object->asArray() : array(); $output = theme('islandora_object_print_object', array( - 'object' => $object, - 'dc_array' => $variables, - 'metadata' => $metadata, - 'islandora_content' => $alter)); + 'object' => $object, + 'dc_array' => $variables, + 'metadata' => $metadata, + 'islandora_content' => $alter)); return array('Default output' => array('#markup' => $output)); } @@ -2159,7 +2159,13 @@ function islandora_islandora_get_breadcrumb_query_predicates(AbstractObject $obj } /** - * Implements hook_islandora_overview_object(). + * Provides information for the object manage page. + * + * @param AbstractObject $object + * The object being managed. + * + * @return array + * themed output */ function islandora_create_manage_overview(AbstractObject $object) { $output = theme('islandora_object_overview', array('islandora_object' => $object)); From 705ae910654f10a48d9c4b141c0c19d3623b86fe Mon Sep 17 00:00:00 2001 From: ajstanley Date: Tue, 25 Oct 2016 13:30:18 -0300 Subject: [PATCH 22/22] spacing --- islandora.module | 56 ++++++++++++++++++++++++------------------------ theme/theme.inc | 16 +++++++------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/islandora.module b/islandora.module index 767229d8..21fbccfd 100644 --- a/islandora.module +++ b/islandora.module @@ -1659,10 +1659,10 @@ function islandora_object_access($op, $object, $user = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); $results = islandora_invoke_hook_list('islandora_object_access', $object->models, array( - $op, - $object, - $user, - )); + $op, + $object, + $user, + )); // Nothing returned FALSE, and something returned TRUE. $cache[$op][$object->id][$user->uid] = (!in_array(FALSE, $results, TRUE) && in_array(TRUE, $results, TRUE)); @@ -1704,16 +1704,16 @@ function islandora_datastream_access($op, $datastream, $user = NULL) { if (!isset($cache[$op][$datastream->parent->id][$datastream->id][$user->uid])) { module_load_include('inc', 'islandora', 'includes/utilities'); $object_results = islandora_invoke_hook_list('islandora_object_access', $datastream->parent->models, array( - $op, - $datastream->parent, - $user, - )); + $op, + $datastream->parent, + $user, + )); $datastream_results = islandora_invoke_hook_list('islandora_datastream_access', $datastream->parent->models, array( - $op, - $datastream, - $user, - )); + $op, + $datastream, + $user, + )); // The datastream check returned FALSE, and one in the object or datastream // checks returned TRUE. @@ -1792,10 +1792,10 @@ function islandora_islandora_datastream_modified(AbstractObject $object, Abstrac 'dsid' => $datastream->id, ); $logging_results = islandora_do_derivatives($object, array( - 'source_dsid' => $datastream->id, - 'force' => TRUE, - 'ds_modified_params' => $params, - )); + 'source_dsid' => $datastream->id, + 'force' => TRUE, + 'ds_modified_params' => $params, + )); islandora_derivative_logging($logging_results); islandora_conditionally_clear_cache(); } @@ -1826,22 +1826,22 @@ function islandora_form_simpletest_test_form_alter(array &$form) { if ($filter_status) { $filter_status_message = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array())) . " "; $filter_status_message .= t("Drupal filter at @filter_path is writable by the server.", array( - '@filter_path' => $filter_path, - )); + '@filter_path' => $filter_path, + )); } else { $filter_status_message = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array())) . " "; $filter_status_message .= t("Drupal filter at @filter_path is not writable by the server. Please make sure your webserver has permission to write to the Drupal filter. If the path given is incorrect, you will need to change it in your server's test config file, located in the Islandora module's 'tests' folder as test_config.ini or default.test_config.ini.", array( - '@filter_path' => $filter_path, - )); + '@filter_path' => $filter_path, + )); } $form['tests'] = array( '#type' => 'fieldset', '#title' => t('Tests'), '#description' => t("Select the test(s) or test group(s) you would like to run, and click Run tests.

NOTE: Tests in groups prefixed with Islandora generally require a configuration file, found in the Islandora module 'tests' folder, as well as the use of the Islandora Drupal filter. Before any tests are run, please ensure that your web server has the appropriate permissions to alter the drupal-filter.xml file in your Fedora config folder. Your original Islandora Drupal filter configuration will NOT be overwritten by tests; HOWEVER, if PHP exits abnormally before the filter is reset, please use the 'Repair Drupal Filter' button below.

Drupal Filter Write Status: !filter_status_message

", array( - '!filter_status_message' => $filter_status_message, - )), + '!filter_status_message' => $filter_status_message, + )), ); $form['tests']['table'] = array( @@ -2019,12 +2019,12 @@ function islandora_menu_local_tasks_alter(&$data, $router_item, $root_path) { $tab['#suffix'] = ''; $tab['#theme'] = 'link'; $tab['#text'] = theme('image', array( - 'path' => "$islandora_path/images/print-icon.png", - 'alt' => t('Print Object'), - 'attributes' => array( - 'id' => 'print_btn', - ), - )); + 'path' => "$islandora_path/images/print-icon.png", + 'alt' => t('Print Object'), + 'attributes' => array( + 'id' => 'print_btn', + ), + )); $tab['#path'] = "{$router_item['href']}/print_object"; $tab['#options'] = array( 'attributes' => array(), diff --git a/theme/theme.inc b/theme/theme.inc index eace1c14..725b2e17 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -130,8 +130,8 @@ function islandora_preprocess_islandora_default(&$variables) { $datastreams[$id]['id'] = $id; $datastreams[$id]['label'] = $label; $datastreams[$id]['label_link'] = islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $ds) ? - l($label, $download_path) : - $label; + l($label, $download_path) : + $label; $datastreams[$id]['download_url'] = $download_path; $datastreams[$id]['mimetype'] = $ds->mimetype; $datastreams[$id]['size'] = islandora_datastream_get_human_readable_size($ds); @@ -268,8 +268,8 @@ function islandora_objects_object_mapper($object_id) { $img = array( '#theme' => 'image', '#path' => ($o && islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $o['TN']) ? - "$url/datastream/TN/view" : - "$module_path/images/folder.png"), + "$url/datastream/TN/view" : + "$module_path/images/folder.png"), '#attributes' => array(), ); $img = drupal_render($img); @@ -412,8 +412,8 @@ function theme_islandora_datastream_download_link(array $vars) { $label = t('download'); return islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $datastream) ? - l($label, islandora_datastream_get_url($datastream, 'download')) : - ''; + l($label, islandora_datastream_get_url($datastream, 'download')) : + ''; } /** @@ -543,8 +543,8 @@ function theme_islandora_datastream_edit_link(array $vars) { $can_edit = count($edit_registry) > 0 && islandora_datastream_access(ISLANDORA_METADATA_EDIT, $datastream); return $can_edit ? - l(t('edit'), "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/edit") : - ''; + l(t('edit'), "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/edit") : + ''; } /**