Browse Source

added islandora_basic_image module

pull/108/head
Paul Pound 13 years ago
parent
commit
7ff619de6b
  1. 4
      fedora_repository/fedora_repository.info
  2. 2
      islandora.module
  3. 8
      islandora_basic_image/islandora-basic-image-view-object.tpl.php
  4. 0
      islandora_basic_image/islandora-basic-image-view-objects.tpl.php
  5. 4
      islandora_basic_image/islandora_basic_image.info
  6. 74
      islandora_basic_image/islandora_basic_image.module

4
fedora_repository/fedora_repository.info

@ -1,4 +0,0 @@
name = "Fedora Repository"
description = "A default Fedora Repository module"
dependencies[] = islandora
core = 7.x

2
islandora.module

@ -27,7 +27,7 @@ define('FEDORA_VIEW', 'view fedora repository');
define('FEDORA_METADATA_EDIT', 'edit fedora metadata'); define('FEDORA_METADATA_EDIT', 'edit fedora metadata');
define('FEDORA_ADD_DS', 'add fedora datastreams'); define('FEDORA_ADD_DS', 'add fedora datastreams');
define('FEDORA_INGEST', 'ingest fedora objects'); 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'); define('FEDORA_MODIFY_STATE', 'modify fedora state');
/** /**

8
fedora_repository/fedora-repository-view-object.tpl.php → islandora_basic_image/islandora-basic-image-view-object.tpl.php

@ -23,8 +23,8 @@
?> ?>
<?php print $variables['count']; <?php
foreach($variables['results'] as $object){ $object = $variables['objects'];
print_r ($object); print($object->label);
}?> ?>

0
fedora_repository/fedora-repository-view-objects.tpl.php → islandora_basic_image/islandora-basic-image-view-objects.tpl.php

4
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

74
fedora_repository/fedora_repository.module → islandora_basic_image/islandora_basic_image.module

@ -1,7 +1,7 @@
<?php <?php
/* /*
* @file fedora_repository.module * @file islandora_basic_image.module
* *
* an Islandora module to handle legacy contentModels (with ISLANDORACM streams) * an Islandora module to handle legacy contentModels (with ISLANDORACM streams)
* *
@ -29,7 +29,7 @@
* @param array $render_array * @param array $render_array
* @return array * @return array
*/ */
function fedora_repository_show_metadata($metadata, &$render_array) { function islandora_basic_image_render_object($metadata, &$render_array) {
$header = array(t('Label'), t('Value')); $header = array(t('Label'), t('Value'));
$table_attributes = array('class' => array('islandora_metadata')); $table_attributes = array('class' => array('islandora_metadata'));
/*$rows = array(); /*$rows = array();
@ -53,7 +53,7 @@ function fedora_repository_show_metadata($metadata, &$render_array) {
* @param array $variables * @param array $variables
* @return string * @return string
*/ */
function theme_fedora_repository_view_object($variables) { function theme_islandora_basic_image_view_object($variables) {
$object = $variables['object']; $object = $variables['object'];
//$metadata = $object->metadata; //$metadata = $object->metadata;
$render_array = array('title' => array( $render_array = array('title' => array(
@ -61,57 +61,25 @@ function theme_fedora_repository_view_object($variables) {
'#markup' => '<h2>' . $object->label . '</h2>', '#markup' => '<h2>' . $object->label . '</h2>',
)); ));
fedora_repository_show_metadata($metadata, $render_array); islandora_basic_image_render_object($object, $render_array);
fedora_repository_list_datastreams($object, $render_array);
return drupal_render($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' => '<div class = "cmr-external-link">'.l($d->label, $d->path,array('html'=>TRUE)).'</div>');
}
}
if($key = 'islandora:iaBookCModel'){
$d = new datastream();
$d->find($value);
if(isset($d)){
//@TODO: do something here
}
}
}
}
/** /**
* Theme registry function * Theme registry function
* @return array * @return array
*/ */
function fedora_repository_theme() { function islandora_basic_image_theme() {
return array( return array(
'fedora_repository_view_objects' => array( 'islandora_basic_image_view_objects' => array(
'template' => 'fedora-repository-view-objects', 'template' => 'islandora-basic-image-view-objects',
'variables' => array('objects' => NULL), 'variables' => array('objects' => NULL),
), ),
'fedora_repository_view_object' => array( 'islandora_basic_image_view_object' => array(
'varibles' => array('object'), '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. * tells the main module what types of objects we support.
* @return array * @return array
*/ */
function fedora_repository_get_types() { function islandora_basic_image_get_types() {
return array('islandora:bookCModel','islandora:isBookCModel'); return array('info:fedora/islandora:imgageCModel', 'info:fedora/islandora:sp_basic_image');
} }
/** /**
@ -135,21 +103,15 @@ function fedora_repository_get_types() {
* @return string * @return string
* themed html * 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; //global $user;
$cmodel_list = islandora_basic_image_get_types();
if (!in_array('info:fedora/islandora_bookCmodel', $object->models) && !in_array('info:fedora/islandora:iaBookCModel', $object->models)) { $combined_list = array_intersect($cmodel_list, $object->models);
if (empty($combined_list)) {
return NULL; 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; return $output;
} }
Loading…
Cancel
Save