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_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');
/**

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'];
foreach($variables['results'] as $object){
print_r ($object);
}?>
<?php
$object = $variables['objects'];
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
/*
* @file fedora_repository.module
* @file islandora_basic_image.module
*
* an Islandora module to handle legacy contentModels (with ISLANDORACM streams)
*
@ -29,7 +29,7 @@
* @param array $render_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'));
$table_attributes = array('class' => 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' => '<h2>' . $object->label . '</h2>',
));
fedora_repository_show_metadata($metadata, $render_array);
fedora_repository_list_datastreams($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') {
islandora_basic_image_render_object($object, $render_array);
// $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
}
}
return drupal_render($render_array);
}
}
/**
* 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;
}
Loading…
Cancel
Save