From 7ff619de6bba87eedc4e86d19d147ac93f71963f Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Fri, 18 May 2012 11:35:16 -0300 Subject: [PATCH] added islandora_basic_image module --- fedora_repository/fedora_repository.info | 4 - islandora.module | 2 +- .../islandora-basic-image-view-object.tpl.php | 8 +- ...islandora-basic-image-view-objects.tpl.php | 0 .../islandora_basic_image.info | 4 + .../islandora_basic_image.module | 74 +++++-------------- 6 files changed, 27 insertions(+), 65 deletions(-) delete mode 100644 fedora_repository/fedora_repository.info rename fedora_repository/fedora-repository-view-object.tpl.php => islandora_basic_image/islandora-basic-image-view-object.tpl.php (88%) rename fedora_repository/fedora-repository-view-objects.tpl.php => islandora_basic_image/islandora-basic-image-view-objects.tpl.php (100%) create mode 100644 islandora_basic_image/islandora_basic_image.info rename fedora_repository/fedora_repository.module => islandora_basic_image/islandora_basic_image.module (54%) diff --git a/fedora_repository/fedora_repository.info b/fedora_repository/fedora_repository.info deleted file mode 100644 index f7422c99..00000000 --- a/fedora_repository/fedora_repository.info +++ /dev/null @@ -1,4 +0,0 @@ -name = "Fedora Repository" -description = "A default Fedora Repository module" -dependencies[] = islandora -core = 7.x diff --git a/islandora.module b/islandora.module index 0ab0e152..8a9ef2d2 100644 --- a/islandora.module +++ b/islandora.module @@ -27,7 +27,7 @@ define('FEDORA_VIEW', 'view fedora repository'); define('FEDORA_METADATA_EDIT', 'edit fedora metadata'); define('FEDORA_ADD_DS', 'add fedora datastreams'); define('FEDORA_INGEST', 'ingest fedora objects'); -define('FEDORA_PURGE', 'purge fedora objects and datastreams'); +define('FEDORA_PURGE', 'delete fedora objects and datastreams'); define('FEDORA_MODIFY_STATE', 'modify fedora state'); /** diff --git a/fedora_repository/fedora-repository-view-object.tpl.php b/islandora_basic_image/islandora-basic-image-view-object.tpl.php similarity index 88% rename from fedora_repository/fedora-repository-view-object.tpl.php rename to islandora_basic_image/islandora-basic-image-view-object.tpl.php index d09b639f..df8ea626 100644 --- a/fedora_repository/fedora-repository-view-object.tpl.php +++ b/islandora_basic_image/islandora-basic-image-view-object.tpl.php @@ -23,8 +23,8 @@ ?> - +label); +?> diff --git a/fedora_repository/fedora-repository-view-objects.tpl.php b/islandora_basic_image/islandora-basic-image-view-objects.tpl.php similarity index 100% rename from fedora_repository/fedora-repository-view-objects.tpl.php rename to islandora_basic_image/islandora-basic-image-view-objects.tpl.php diff --git a/islandora_basic_image/islandora_basic_image.info b/islandora_basic_image/islandora_basic_image.info new file mode 100644 index 00000000..b85f14a3 --- /dev/null +++ b/islandora_basic_image/islandora_basic_image.info @@ -0,0 +1,4 @@ +name = "Islandora Basic Image" +description = "A default Islandora Repository module to handle images" +dependencies[] = islandora +core = 7.x diff --git a/fedora_repository/fedora_repository.module b/islandora_basic_image/islandora_basic_image.module similarity index 54% rename from fedora_repository/fedora_repository.module rename to islandora_basic_image/islandora_basic_image.module index 6310d1a4..2e89f5b8 100644 --- a/fedora_repository/fedora_repository.module +++ b/islandora_basic_image/islandora_basic_image.module @@ -1,7 +1,7 @@ array('islandora_metadata')); /*$rows = array(); @@ -53,7 +53,7 @@ function fedora_repository_show_metadata($metadata, &$render_array) { * @param array $variables * @return string */ -function theme_fedora_repository_view_object($variables) { +function theme_islandora_basic_image_view_object($variables) { $object = $variables['object']; //$metadata = $object->metadata; $render_array = array('title' => array( @@ -61,57 +61,25 @@ function theme_fedora_repository_view_object($variables) { '#markup' => '

' . $object->label . '

', )); - fedora_repository_show_metadata($metadata, $render_array); - fedora_repository_list_datastreams($object, $render_array); + islandora_basic_image_render_object($object, $render_array); + return drupal_render($render_array); } -/** - * - * @global object $user - * @param Object $object - * A tuque fedora object - * @param string $render_array - * @return type - */ -function fedora_repository_list_datastreams($object, &$render_array) { - - global $user; - $datastreams = $object->datastreams; - if (!isset($datastreams)) { - return $render_array; - } - foreach ($datastreams as $datastream) { - foreach ($datastream as $key => $value) { - if ($key == 'islandora:bookCmodel') { - - // $id = $d->getID()->id; - $render_array[(string)$d->getID()] = array('type' => 'markup', '#markup' => ''); - } - } - if($key = 'islandora:iaBookCModel'){ - $d = new datastream(); - $d->find($value); - if(isset($d)){ - //@TODO: do something here - } - } - } - -} /** * Theme registry function * @return array */ -function fedora_repository_theme() { +function islandora_basic_image_theme() { return array( - 'fedora_repository_view_objects' => array( - 'template' => 'fedora-repository-view-objects', + 'islandora_basic_image_view_objects' => array( + 'template' => 'islandora-basic-image-view-objects', 'variables' => array('objects' => NULL), ), - 'fedora_repository_view_object' => array( - 'varibles' => array('object'), + 'islandora_basic_image_view_object' => array( + 'template' => 'islandora-basic-image-view-object', + 'variables' => array('objects' => NULL), ) ); } @@ -120,8 +88,8 @@ function fedora_repository_theme() { * tells the main module what types of objects we support. * @return array */ -function fedora_repository_get_types() { - return array('islandora:bookCModel','islandora:isBookCModel'); +function islandora_basic_image_get_types() { + return array('info:fedora/islandora:imgageCModel', 'info:fedora/islandora:sp_basic_image'); } /** @@ -135,21 +103,15 @@ function fedora_repository_get_types() { * @return string * themed html */ -function fedora_repository_islandora_view_object($object, $user, $page_number, $page_size) { +function islandora_basic_image_islandora_view_object($object, $user, $page_number, $page_size) { //global $user; - - if (!in_array('info:fedora/islandora_bookCmodel', $object->models) && !in_array('info:fedora/islandora:iaBookCModel', $object->models)) { + $cmodel_list = islandora_basic_image_get_types(); + $combined_list = array_intersect($cmodel_list, $object->models); + if (empty($combined_list)) { return NULL; } - $output = theme('fedora_repository_view_object', array('object' => $object)); + $output = theme('islandora_basic_image_view_object', array('objects' => $object)); - //pager_default_initialize($results['count'], $page_size); - //$pager = theme('pager', array('quantity' => $results['count'])); - //$output .= $pager; - //if ($results['count'] > 0) { - // $output .= theme('fedora_repository_view_objects', $results); - //} - //$output .= $pager; return $output; }