diff --git a/islandora.module b/islandora.module index f25b5f12..99530ca8 100644 --- a/islandora.module +++ b/islandora.module @@ -300,8 +300,13 @@ function islandora_edit_object($object_id) { * A tuque Fedora Object */ function islandora_islandora_edit_object($fedora_object) { - $output = theme('islandora_default_edit', array('islandora_object' => $fedora_object)); - return array('Default Edit output' => $output); + $supported_models = islandora_get_types(); + $output = ""; + foreach ($fedora_object->models as $model) { + if ($supported_models[$model][ISLANDORA_EDIT_HOOK] == TRUE) {//another module is handling the view + return; + } + } } /** @@ -366,7 +371,6 @@ function islandora_purge_datastream($object_id, $datastream_id) { module_invoke_all('islandora_post_purge_datastream', $fedora_object, $datastream_id); //notify modules post deletion } - /** * The view entry point. modules should implement hook_islandora_view_object for the Fedora Content models that * there modules want to provide a view for. diff --git a/islandora_basic_collection/islandora_basic_collection.module b/islandora_basic_collection/islandora_basic_collection.module index e09765a8..0ff65172 100644 --- a/islandora_basic_collection/islandora_basic_collection.module +++ b/islandora_basic_collection/islandora_basic_collection.module @@ -48,7 +48,11 @@ function islandora_basic_collection_theme($existing, $type, $theme, $path) { * array of content model pids that this module supports */ function islandora_basic_collection_islandora_get_types() { - return array('info:fedora/islandora:collectionCModel'); + $types = array(); + $types['info:fedora/islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = TRUE; + $types['info:fedora/islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE; + return $types; + } /** @@ -66,12 +70,14 @@ function islandora_basic_collection_islandora_get_types() { function islandora_basic_collection_islandora_view_object($object, $user, $page_number, $page_size) { //global $user; $cmodel_list = islandora_basic_collection_islandora_get_types(); - $combined_list = array_intersect($cmodel_list, $object->models); - if (empty($combined_list)) { - return NULL; //we don't handle any of this objects cmodels + $models = $object->models; + foreach ($object->models as $model) { + if ($cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) { + $output = theme('islandora_basic_collection', array('islandora_object' => $object)); + return array('Basic Collection Output' => $output); + } } - $output = theme('islandora_basic_collection', array('islandora_object' => $object)); - return array('Basic Collection Output' => $output); + return NULL; } /** @@ -100,13 +106,12 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari if (isset($islandora_object['TN'])) { $variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view'; } - if (isset($islandora_object['MEDIUM_SIZE'])){ + if (isset($islandora_object['MEDIUM_SIZE'])) { $variables['islandora_medium_size_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view'; } - } -function islandora_basic_collection_get_objects($object){ +function islandora_basic_collection_get_objects($object) { $query = 'select $object $title $content from <#ri> where ($object $title and $object $content @@ -118,13 +123,13 @@ function islandora_basic_collection_get_objects($object){ $page_number = (empty($_GET['page'])) ? '1' : $_GET['page']; $page_size = (empty($_GET['pagesize'])) ? '10' : $_GET['pagesize']; module_load_include('inc', 'islandora', 'RestConnection'); - $query_array = array('query' => $query, 'type' => 'itql','pid' => $object->id, 'page_size'=>$page_size, 'page_number' => $page_number); - drupal_alter('islandora_basic_collection_query',$query_array); + $query_array = array('query' => $query, 'type' => 'itql', 'pid' => $object->id, 'page_size' => $page_size, 'page_number' => $page_number); + drupal_alter('islandora_basic_collection_query', $query_array); global $user; try { $restConnection = new RestConnection($user); $queryObject = new RepositoryQuery($restConnection->connection); - $results = $queryObject->query($query_array['query'],$query_array['type']); + $results = $queryObject->query($query_array['query'], $query_array['type']); } catch (Exception $e) { drupal_set_message(t('Islandora Error getting related objects for %s', array('%s' => $object->id)), 'error'); return""; diff --git a/islandora_basic_image/css/islandora_basic_image.admin.css b/islandora_basic_image/css/islandora_basic_image.admin.css index a7f79c7c..e2ad3040 100644 --- a/islandora_basic_image/css/islandora_basic_image.admin.css +++ b/islandora_basic_image/css/islandora_basic_image.admin.css @@ -1,12 +1,8 @@ /* Document : islandora_basic_collection.admin.css Created on : May 23, 2012, 11:23:06 AM - Author : ppound Description: Purpose of the stylesheet follows. */ -root { - display: block; -} diff --git a/islandora_basic_image/islandora_basic_image.module b/islandora_basic_image/islandora_basic_image.module index daffdd75..be687dcf 100644 --- a/islandora_basic_image/islandora_basic_image.module +++ b/islandora_basic_image/islandora_basic_image.module @@ -52,7 +52,10 @@ function islandora_basic_image_theme($existing, $type, $theme, $path) { * array of content model pids that this module supports */ function islandora_basic_image_islandora_get_types() { - return array('info:fedora/islandora:imgageCModel', 'info:fedora/islandora:sp_basic_image'); + $types = array(); + $types['info:fedora/islandora:sp_basic_image'][ISLANDORA_VIEW_HOOK] = TRUE; + $types['info:fedora/islandora:sp_basic_image'][ISLANDORA_EDIT_HOOK] = FALSE; + return $types; } /** @@ -70,13 +73,14 @@ function islandora_basic_image_islandora_get_types() { function islandora_basic_image_islandora_view_object($object, $user, $page_number, $page_size) { //global $user; $cmodel_list = islandora_basic_image_islandora_get_types(); - $combined_list = array_intersect($cmodel_list, $object->models); - if (empty($combined_list)) { - return NULL; //we don't handle any of this objects cmodels + $models = $object->models; + foreach ($object->models as $model) { + if ($cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) { + $output = theme('islandora_basic_image', array('islandora_object' => $object)); + return array('Basic Image Output' => $output); + } } - $output = theme('islandora_basic_image', array('islandora_object' => $object)); - - return array('Basic Image Output' => $output); + return NULL; } /** @@ -104,9 +108,8 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) { if (isset($islandora_object['TN'])) { $variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view'; } - if (isset($islandora_object['MEDIUM_SIZE'])){ + if (isset($islandora_object['MEDIUM_SIZE'])) { $variables['islandora_medium_size_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view'; } - }