Browse Source

Broke collection and image out into differenet repos

pull/145/head
jonathangreen 13 years ago
parent
commit
35f1b1fbd5
  1. BIN
      islandora_basic_collection/Crystal_Clear_filesystem_folder_grey.png
  2. 48
      islandora_basic_collection/admin/islandora_basic_collection.admin.inc
  3. 6
      islandora_basic_collection/css/islandora_basic_collection.admin.css
  4. 51
      islandora_basic_collection/css/islandora_basic_collection.base.css
  5. 46
      islandora_basic_collection/css/islandora_basic_collection.theme.css
  6. 154
      islandora_basic_collection/includes/CollectionPolicy.inc
  7. 145
      islandora_basic_collection/includes/change_content_models.inc
  8. 202
      islandora_basic_collection/includes/child_collection.inc
  9. 222
      islandora_basic_collection/includes/collection_management.inc
  10. 113
      islandora_basic_collection/includes/collection_manager_table.inc
  11. 124
      islandora_basic_collection/includes/delete_collection.inc
  12. 233
      islandora_basic_collection/includes/manage_policies.inc
  13. 75
      islandora_basic_collection/includes/move_collection.inc
  14. 8
      islandora_basic_collection/islandora_basic_collection.info
  15. 105
      islandora_basic_collection/islandora_basic_collection.install
  16. 297
      islandora_basic_collection/islandora_basic_collection.module
  17. 35
      islandora_basic_collection/theme/islandora-basic-collection-grid.tpl.php
  18. 35
      islandora_basic_collection/theme/islandora-basic-collection-wrapper.tpl.php
  19. 53
      islandora_basic_collection/theme/islandora-basic-collection.tpl.php
  20. 133
      islandora_basic_collection/theme/islandora_basic_collection.theme.inc
  21. 58
      islandora_basic_collection/xml/islandora_collection_CModel.xml
  22. 68
      islandora_basic_collection/xml/islandora_root_collection.xml
  23. BIN
      islandora_basic_image/Crystal_Clear_filesystem_folder_grey.png
  24. 16
      islandora_basic_image/admin/islandora_basic_image.admin.inc
  25. 8
      islandora_basic_image/css/islandora_basic_image.admin.css
  26. 8
      islandora_basic_image/css/islandora_basic_image.base.css
  27. 19
      islandora_basic_image/css/islandora_basic_image.theme-rtl.css
  28. 75
      islandora_basic_image/css/islandora_basic_image.theme.css
  29. 73
      islandora_basic_image/includes/image.process.inc
  30. 8
      islandora_basic_image/islandora_basic_image.info
  31. 115
      islandora_basic_image/islandora_basic_image.install
  32. 231
      islandora_basic_image/islandora_basic_image.module
  33. 73
      islandora_basic_image/theme/islandora-basic-image.tpl.php
  34. 818
      islandora_basic_image/xml/islandora_basic_imageCM.xml
  35. 48
      islandora_basic_image/xml/islandora_basic_image_collection.xml
  36. 11
      islandora_basic_image/xml/islandora_basic_image_collection_policy.xml
  37. 67
      islandora_basic_image/xml/simple_islandora_basic_imageCM.xml

BIN
islandora_basic_collection/Crystal_Clear_filesystem_folder_grey.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

48
islandora_basic_collection/admin/islandora_basic_collection.admin.inc

@ -1,48 +0,0 @@
<?php
/**
* @file
* islandora_basic_collection.admin.inc
*/
/**
*
* @return type
*/
function islandora_basic_collection_admin() {
$form = array();
$form['islandora_basic_collection_use_for_default_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Provide the view for the default tab'),
'#default_value' => variable_get('islandora_basic_collection_use_for_default_tab', TRUE),
'#description' => t('Should this module provide the view for the default view tab. If you are seeing unexpected content
on a view tab you may have multiple modules configured to provide content for the default tab.'),
'#weight' => -10
);
$form['islandora_basic_collection_page_size'] = array(
'#type' => 'textfield',
'#title' => t('The default number of objects to show for a collection'),
'#default_value' => variable_get('islandora_basic_collection_page_size', '10'),
'#description' => t('The default number of object to show in a collection view.'),
'#weight' => -10
);
$form['islandora_basic_collection_disable_collection_policy_delete'] = array(
'#type' => 'checkbox',
'#title' => t('Disable deleting the collection policy'),
'#default_value' => variable_get('islandora_basic_collection_disable_collection_policy_delete', TRUE),
'#description' => t('This will disable the delete link for the COLLECTION_POLICY in the manage tab.'),
'#weight' => -10
);
$form['islandora_basic_collection_default_view'] = array(
'#type' => 'select',
'#title' => t('Select the default collection view style.'),
'#default_value' => variable_get('islandora_basic_collection_default_view', 'grid'),
'#options' => array(
'list' => t('List'),
'grid' => t('Grid'),
),
'#weight' => -10
);
return system_settings_form($form);
}

6
islandora_basic_collection/css/islandora_basic_collection.admin.css

@ -1,6 +0,0 @@
/*
Document : islandora_basic_collection.admin.css
Created on : May 23, 2012, 11:23:06 AM
Description:
Purpose of the stylesheet follows.
*/

51
islandora_basic_collection/css/islandora_basic_collection.base.css

@ -1,51 +0,0 @@
/*
Document : islandora_basic_collection.base.css
Created on : May 23, 2012, 11:22:04 AM
Description: Base css, for structural layout,
positioning, and to generally make things function in
the most basic form.
*/
/* List - Displays lists using a dt on the left and dd on the right */
.islandora-basic-collection-list-item {
clear: both;
width: 100%;
}
.islandora-basic-collection-list-item dl dt {
clear: left;
float: left;
padding: 3px 0 0;
text-align: center;
width: 100px;
}
.islandora-basic-collection-list-item dl dd {
margin: 0 0 0 130px;
}
/* Grid - Displays grid using dl formatted inline */
.islandora-basic-collection-grid dl
{
width: 20%;
min-width: 100px;
min-height: 180px;
display: -moz-inline-stack;
display: inline-block;
vertical-align: top;
margin: 1.5em 2%;
zoom: 1;
*display: inline;
_height: 180px;
}
.islandora-basic-collection-grid dd
{
margin: 0;
padding: 0;
}
.islandora-basic-collection-display-switch {
float: right;
}

46
islandora_basic_collection/css/islandora_basic_collection.theme.css

@ -1,46 +0,0 @@
/*
Document : islandora_basic_collection.theme
Created on : May 23, 2012, 11:23:56 AM
Description: Theme css, like margins, padding, borders, colors, etc
*/
/* Make flexible and assure content doesn't go off the page */
.islandora-basic-collection {
overflow: hidden;
width: 100%;
margin: 0 auto;
}
/* Round borders on images */
.islandora-basic-collection-object dt img {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
/* Set space between objects */
.islandora-basic-collection-object {
margin: 1.5em auto;
}
/* Set space between dd items */
.islandora-basic-collection-object dd {
padding-top: 2px;
padding-bottom: 2px;
}
/* LIST VIEW */
/* Borders to seperate collection objects */
.islandora-basic-collection-list-item {
padding-bottom: 1.5em;
border-bottom: 1px solid #ddd;
}
/* to be moved to admin when it is added */
#islandora-collection-deletion-form table th.select-all,
#islandora-collection-migrate-form table th.select-all {
width: 20px;
}

154
islandora_basic_collection/includes/CollectionPolicy.inc

@ -1,154 +0,0 @@
<?php
/**
* @file
* This file contains the classes for parsing the collection policy infomration.
*/
/**
* Collection Policy class
*/
class CollectionPolicy {
/**
* Constructor
* NOTE: Use the static constructor methods whenever possible.
*
* @param string $xmlStr
* The COLLECTION_POLICY in string form
*
* @return CollectionPolicy
* The parsed collection policy.
*/
public function __construct($xml_string) {
$this->xml = new DOMDocument();
$this->xml->loadXML($xml_string);
$this->name = 'Collection Policy';
}
/**
* Gets the name of the relationship to use
* for members of this collection.
* Returns FALSE on failure.
*
* @return string $relationship
*/
public function getRelationship() {
$ret = trim($this->xml->getElementsByTagName('relationship')->item(0)->nodeValue);
return $ret;
}
/**
* Sets the name of the relationship to use
* for members of this collection.
* Returns FALSE on failure.
*
* @param string $relationship
* @return boolean $ret
*/
public function setRelationship($relationship) {
$ret = FALSE;
if ($this->validate()) {
$relationshipEl = $this->xml->getElementsByTagName('relationship')->item(0);
$relationshipEl->nodeValue = trim($relationship);
$ret = TRUE;
}
return $ret;
}
/**
* Gets a list of ContentModel objects supported by this collection.
*
* @return ContentModel[] $models
*/
function getContentModels() {
$ret = array();
$content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model');
for ($i = 0; $i < $content_models->length; $i++) {
$cm = array();
$cm['pid'] = $content_models->item($i)->getAttribute('pid');
$cm['namespace'] = $content_models->item($i)->getAttribute('namespace');
$cm['name'] = $content_models->item($i)->getAttribute('name');
if ($cm !== FALSE) {
$ret[] = $cm;
}
}
return $ret;
}
/**
* Removes the specified content model from the collection policy. This will only
* prevent future ingests of the removed model to the collection. $cm should be
* a valid ContentModel object. Returns FALSE on failure or when the CM was not found in
* the collection policy.
*
* @param ContentModel $cm
* @return boolean $valid
*/
function removeModel($cm) {
$ret = FALSE;
if ($this->validate() && $cm->validate()) {
$contentmodelsEl = $this->xml->getElementsByTagName('content_models');
$models = $contentmodelsEl->item(0)->getElementsByTagName('content_model');
$found = FALSE;
for ($i = 0; $found === FALSE && $i < $models->length; $i++) {
if ($models->item($i)->getAttribute('pid') == $cm->pid) {
$found = $models->item($i);
}
}
if ($found !== FALSE && $models->length > 1) {
$contentmodelsEl->item(0)->removeChild($found);
$ret = TRUE;
}
}
return $ret;
}
/**
* addModel ??
* @param ContentModel $cm
* @param type $namespace
* @return type
*/
function addModel($cm, $namespace) {
$ret = FALSE;
// var_dump(self::valid_pid($namespace));
// var_dump($this->validate());
// var_dump($cm->validate());
// if (self::valid_pid($namespace) && $this->validate() && $cm->validate()) {
$contentmodelsEl = $this->xml->getElementsByTagName('content_models');
$models = $contentmodelsEl->item(0)->getElementsByTagName('content_model');
$found = FALSE;
// for ($i = 0; !$found && $i < $models->length; $i++) {
// if ($models->item($i)->getAttribute('pid') == $cm->pid)
// $found = TRUE;
// }
// if (!$found) {
$cmEl = $this->xml->createElement('content_model');
$cmEl->setAttribute('name', $cm->name);
$cmEl->setAttribute('dsid', $cm->dsid);
$cmEl->setAttribute('namespace', $namespace);
$cmEl->setAttribute('pid', $cm->pid);
$contentmodelsEl->item(0)->appendChild($cmEl);
// }
$ret = !$found;
// }
return $ret;
}
/**
* getName ??
* @return type
*/
function getName() {
$ret = FALSE;
if ($this->validate()) {
$ret = $this->xml->getElementsByTagName('collection_policy')->item(0)->getAttribute('name');
}
return $ret;
}
}

145
islandora_basic_collection/includes/change_content_models.inc

@ -1,145 +0,0 @@
<?php
/**
* @file
* ChangeContentModels.inc
*/
function islandora_change_content_models_form($form, &$form_state, $collection_object) {
module_load_include('inc', 'islandora_basic_collection', 'includes/CollectionPolicy');
$collection_pid = $collection_object->id;
$content_models = get_content_models_list($collection_object);
$cm_options = array();
$name_mappings = array();
foreach ($content_models as $content_model) {
if ($content_model != "islandora:collectionCModel") {
$item = new FedoraObject($content_model, $rest_connection->repository);
$cm_name = $item->Label;
$cm_options[$content_model] = $cm_name;
}
}
$namespace = substr($collection_pid, 0, strpos($collection_pid, ":"));
$collection_policy_dsid = variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY');
$collection_policy_datastream = $collection_object->getDatastream($collection_policy_dsid);
$supported_collection_models = array();
if ($collection_policy_datastream && $collection_policy_datastream->content) {
$collection_policy = new CollectionPolicy($collection_policy_datastream->content);
$supported_collection_models = $collection_policy->getContentModels();
}
$collection_namespace = substr($collection_pid, 0, strpos($collection_pid, ":"));
$collection_name = $collection_object->label;
$new_content_models = get_content_models_as_option_array();
$current_models_in_policy = array();
if ($supported_collection_models) {
foreach ($supported_collection_models as $supported_model) {
$current_models_in_policy[$supported_model['pid']] = $supported_model['pid'];
}
}
$form['change_cmodel']['titlebox'] = array(
'#type' => 'item',
'#title' => t("Change content models within @collection_name", array('@collection_name' => $collection_object->label)),
);
$form['change_cmodel']['current_content_model'] = array(
'#title' => "Choose content model to be changed",
'#type' => 'select',
'#options' => $current_models_in_policy,
'#description' => t("All objects in this collection with the selected content model will be changed."),
);
$form['change_cmodel']['new_content_model'] = array(
'#title' => "Choose new content model",
'#type' => 'select',
'#options' => $new_content_models,
'#description' => t("The new content model to be assigned to selected objects."),
);
$form['change_cmodel']['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $collection_pid,
);
$form['change_cmodel']['submit'] = array(
'#type' => 'submit',
'#value' => t('Change content model associations'),
'#id' => 'change_model',
);
return $form;
}
function islandora_change_content_models_form_validate($form, &$form_state) {
}
function islandora_change_content_models_form_submit($form, &$form_state) {
module_load_include('inc', 'islandora_basic_collection', 'includes/CollectionPolicy');
$current_content_model = $form_state['values']['current_content_model'];
$new_content_model = $form_state['values']['new_content_model'];
$collection_pid = $form_state['values']['collection_pid'];
$current_content_model_object = islandora_object_load($current_content_model);
$collection_object = islandora_object_load($form_state['values']['collection_pid']);
$collection_policy_datastream = $collection_object->getDatastream(variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY'));
$policy = new CollectionPolicy($collection_policy_datastream->content);
$collection_policy_xml = new DOMDocument();
$collection_policy_xml->loadXML($collection_policy_datastream->content);
$add_to_policy = TRUE;
$policy_content_models = $policy->getContentModels();
foreach ($policy_content_models as $policy_content_model) {
if ($policy_content_model['pid'] == $current_content_model) {
$namespace = $policy_content_model['namespace'];
}
if ($policy_content_model['pid'] == $new_content_model) {
$add_to_policy = FALSE;
}
}
if ($add_to_policy) {
$new_content_model_object = islandora_object_load($new_content_model);
$new_content_model_datastream = $new_content_model_object->getDatastream(variable_get('Islandora_Content_Model_DSID', 'ISLANDORACM'));
$content_models_element = $collection_policy_xml->getElementsByTagName('content_models');
$content_model_element = $content_models_element->item(0)->getElementsByTagName('content_model');
$content_model_element = $collection_policy_xml->createElement('content_model');
$content_model_element->setAttribute('name', $new_content_model_object->label);
$content_model_element->setAttribute('dsid', variable_get('Islandora_Content_Model_DSID', 'ISLANDORACM'));
$content_model_element->setAttribute('namespace', $namespace);
$content_model_element->setAttribute('pid', $new_content_model_object->id);
$content_models_element->item(0)->appendChild($content_model_element);
$new_collection_policy_datastream = $collection_object->getDatastream('COLLECTION_POLICY');
$new_collection_policy_datastream->setContentFromString($collection_policy_xml->saveXML());
$new_collection_policy_datastream->label = 'COLLECTION_POLICY';
$collection_object->ingestDatastream($new_collection_policy_datastream);
}
$query = "select \$object from <#ri>
where (\$object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/$current_content_model>
and (\$object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/$collection_pid>
or \$object <info:fedora/fedora-system:def/relations-external#isMemberOf> <info:fedora/$collection_pid>)
and \$object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)";
$objects = $collection_object->repository->ri->itqlQuery($query, 'unlimited', '0');
$count = 0;
foreach ($objects as $object) {
if (!$object['object']['value']) {
continue;
}
$fedora_item = islandora_object_load($object['object']['value']);
$fedora_item->relationships->remove(FEDORA_MODEL_URI, 'hasModel', $current_content_model);
$fedora_item->relationships->add(FEDORA_MODEL_URI, 'hasModel', $new_content_model);
$count++;
}
drupal_set_message(t('@current_content_model changed to @new_content_model on @count objects', array('@current_content_model' => $current_content_model, '@new_content_model' => $new_content_model, '@count' => $count)));
}

202
islandora_basic_collection/includes/child_collection.inc

@ -1,202 +0,0 @@
<?php
/**
* @file
* ChildCollection.inc
*/
/**
* Create the child collection creation form
*
* @param array $form
* @param array $form_state
* @param string $this_collection_pid
* @return array
*/
function islandora_create_child_collection_form($form, &$form_state, $collection_object) {
module_load_include('inc', 'islandora_basic_collection', 'includes/CollectionPolicy');
$policy_datastream = $collection_object->getDatastream(variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY'));
if (!$policy_datastream) {
$form['no_policy'] = array(
'#type' => 'item',
'#title' => t('No collection policy datastream found!'),
);
return $form;
}
$collection_policy = new CollectionPolicy($policy_datastream->content);
$current_content_models = $collection_policy->getContentModels();
$collection_content_model_exists = FALSE;
foreach ($current_content_models as $current_content_model) {
if ($current_content_model['pid'] == 'islandora:collectionCModel') {
$collection_content_model_exists = TRUE;
}
}
if (!$collection_content_model_exists) {
$form['not_collection'] = array(
'#type' => 'item',
'#title' => t("This object can't contain child collections. To fix this add the islandora:collectionCModel to this object's collection policy"),
);
return $form;
}
$restricted = FALSE;
if (variable_get('islandora_namespace_restriction_enforced', FALSE)) {
$restricted = TRUE;
$allowed_string = variable_get('islandora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
foreach ($namespaces as $namespace) {
if ($namespace) {
$allowed[trim($namespace)] = trim($namespace);
}
}
}
$collection_namespace = substr($collection_object->id, 0, strpos($collection_object->id, ":"));
$content_models = get_content_models_as_option_array();
unset($content_models['islandora:collectionCModel']);
$form['child_creation']['titlebox'] = array(
'#type' => 'item',
'#title' => t("Create new child collection within @collection", array('@collection' => $collection_object->id)),
);
$form['child_creation']['collection_name'] = array(
'#title' => "Collection name",
'#type' => 'textfield',
'#size' => 25,
'#description' => t("Human readable name for this collection"),
);
$form['child_creation']['new_collection_pid'] = array(
'#title' => "Collection PID",
'#type' => 'textfield',
'#size' => 15,
'#default_value' => '',
'#description' => t("Unique PID for this collection. Leave blank for default. <br />Pids take the general form of namespace:collection (eg. islandora:pamphlets)"),
);
if (!$restricted) {
$form['child_creation']['collection_namespace'] = array(
'#title' => "Collection namespace",
'#type' => 'textfield',
'#size' => 15,
'#default_value' => $collection_namespace,
'#description' => t("Namespace for objects in this collection."),
);
}
else {
$form['child_creation']['collection_namespace'] = array(
'#title' => "Collection namespace",
'#type' => 'select',
'#options' => $allowed,
'#default_value' => 'default',
'#description' => t("Namespace for objects in this collection."),
);
}
$form['current'] = array(
'#type' => 'hidden',
'#value' => $collection_object->id,
);
$form['child_creation']['content_models'] = array(
'#title' => "Choose allowable content models for this collection",
'#type' => 'checkboxes',
'#options' => $content_models,
'#description' => t("Content models describe the behaviours of objects with which they are associated."),
);
$form['child_creation']['submit'] = array(
'#type' => 'submit',
'#value' => t('Create collection'),
'#id' => 'create_child'
);
return $form;
}
function islandora_create_child_collection_form_validate($form, &$form_state) {
module_load_include('inc', 'islandora', 'includes/utilities');
$new_collection_pid = $form_state['values']['new_collection_pid'];
if($new_collection_pid) {
$valid = islandora_validate_pid($new_collection_pid);
if(!$valid) {
form_set_error('new_collection_pid', 'Collection PID is Invalid.');
}
else {
$object = islandora_object_load($new_collection_pid);
if($object !== NULL) {
form_set_error('new_collection_pid', 'Collection PID already exists.');
}
}
}
}
/**
* Submit handler for child collection creation form
*
* @global type $base_url
* @param array $form
* @param array $form_state
*/
function islandora_create_child_collection_form_submit($form, &$form_state) {
global $base_url;
module_load_include('inc', 'islandora', '/includes/islandora.ingest');
$thumbnail = $base_url . '/' . drupal_get_path('module', 'islandora_basic_collection') . '/Crystal_Clear_filesystem_folder_grey.png';
$new_collection_pid = $form_state['values']['new_collection_pid'];
$this_collection_pid = $form_state['values']['current'];
if(empty($new_collection_pid)) {
$new_collection_pid = substr($this_collection_pid, 0, strpos($this_collection_pid, ":"));
}
$new_collection_label = $form_state['values']['collection_name'];
$namespace = $form_state['values']['collection_namespace'];
$all_cModels = get_content_models_as_option_array();
$collection_content_models = array(array('pid' => 'islandora:collectionCModel'));
$relationship = 'isMemberOfCollection';
$collection_policy = '<?xml version="1.0" encoding="UTF-8"?>
<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
<content_models>
<content_model dsid="ISLANDORACM" name="Islandora Collection Model ~ islandora:collectionCModel" namespace="islandora:1" pid="islandora:collectionCModel"/>
</content_models>
<search_terms>
</search_terms>
<staging_area></staging_area>
<relationship>isMemberOfCollection</relationship>
</collection_policy>';
$content_models = $form_state['values']['content_models'];
$collection_policy_xml = new DOMDocument();
$collection_policy_xml->loadXML($collection_policy);
$content_models_element = $collection_policy_xml->getElementsByTagName('content_models');
$content_model_element = $content_models_element->item(0)->getElementsByTagName('content_model');
foreach ($content_models as $content_model) {
if ($content_model) {
$content_model_element = $collection_policy_xml->createElement('content_model');
$content_model_element->setAttribute('name', $all_cModels[$content_model]);
$content_model_element->setAttribute('dsid', variable_get('Islandora_Content_Model_DSID', 'ISLANDORACM'));
$content_model_element->setAttribute('namespace', $namespace . ':1');
$content_model_element->setAttribute('pid', $content_model);
$content_models_element->item(0)->appendChild($content_model_element);
}
}
$fedora_object = islandora_ingest_get_object($collection_content_models, $form_state['values']['current'], $relationship, $new_collection_pid);
$fedora_object->label = $new_collection_label;
$thumbnail_datastream = $fedora_object->constructDatastream('TN');
$thumbnail_datastream->setContentFromUrl($thumbnail);
$thumbnail_datastream->label = 'Thumbnail';
$thumbnail_datastream->mimetype = 'image/png';
$fedora_object->ingestDatastream($thumbnail_datastream);
$policy_datastream = $fedora_object->constructDatastream(variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY'), 'X');
$policy_datastream->setContentFromString($collection_policy_xml->saveXML());
$policy_datastream->label = 'Collection policy';
$fedora_object->ingestDatastream($policy_datastream);
$new_fedora_object = islandora_ingest_add_object($fedora_object);
drupal_goto('/islandora/object/' . $fedora_object->id);
}

222
islandora_basic_collection/includes/collection_management.inc

@ -1,222 +0,0 @@
<?php
/**
* @file
* CollectionManagement.inc
* A set of useful functions to help with collection management
*/
/**
* returns content models associated with all objects in a collection
* @param string $pid
* @return array
*/
function get_represented_content_models($object) {
$query = "select \$model \$title from <#ri>
where (\$object <info:fedora/fedora-system:def/relations-external#isMemberOf> <info:fedora/$object->id>
or \$object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/$object->id>)
and \$object <info:fedora/fedora-system:def/model#hasModel> \$model
and \$object <dc:title> \$title";
$model_pids = $object->repository->ri->itqlQuery($query, 'unlimited', '0');
$represented_models = array();
foreach ($model_pids as $model_pid) {
if ($model_pid['model']['value'] && $model_pid['model']['value'] != 'fedora-system:FedoraObject-3.0') {
try {
$fedora_object = $object->repository->getObject($model_pid['model']['value']);
$content_model_title = $fedora_object->label;
$represented_models[$model_pid['model']['value']] = $model_pid['model']['value'] . ' ~ ' . $content_model_title;
}
catch (RepositoryException $e) {}
}
}
return $represented_models;
}
function get_child_collections($object) {
$query = <<<EOD
select \$object from <#ri>
where \$object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/islandora:collectionCModel>
and \$object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/$object->id>
EOD;
$lines = $object->repository->ri->itqlQuery($query, 'unlimited', '0');
$collection_pids = array_values(array_filter($lines));
return $collection_pids;
}
function islandora_collections_get_collection_from_pid($object) {
$query = 'select $parent from <#ri>
where ($object <fedora-rels-ext:isMemberOf> $parent
or $object <fedora-rels-ext:isMemberOfCollection> $parent)
and $object <dc:identifier> \'' . $object->id . '\'
order by $object';
$object_pids = $object->repository->ri->itqlQuery($query, 'unlimited', '0');
$object_pids = array_values(array_filter($object_pids));
return $object_pids;
}
/**
* Returns an array of pids that match the query contained in the collection
* object's QUERY datastream or in the suppled $query parameter.
* @param <type> $collection_pid
* @param <type> $query
* @param <type> $query_format R
*/
function get_related_items_as_array($collection_object, $relationship = array('isMemberOfCollection'), $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') {
$collection_pid = $collection_object->id;
// Not sure if this is necessary given that we should never be able to delete objects in a namespace that we don't have access to.
// if (!fedora_repository_access('view fedora repository', $collection_pid['object']['value'])) {
// drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error');
// return array();
// }
$query_string = 'select $object $title $content from <#ri>
where ($object <fedora-model:label> $title
and $object <fedora-model:hasModel> $content
and (';
if (is_array($relationship)) {
foreach ($relationship as $rel) {
$query_string .= '$object <fedora-rels-ext:' . $rel . '> <info:fedora/' . $collection_pid . '>';
if (next($relationship)) {
$query_string .= ' OR ';
}
}
}
elseif (is_string($relationship)) {
$query_string .= '$object <fedora-rels-ext:' . $relationship . '> <info:fedora/' . $collection_pid . '>';
}
else {
return '';
}
$query_string .= ') ';
$query_string .= $active_objects_only ? 'and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>' : '';
if ($cmodel) {
$query_string .= ' and $content <mulgara:is> <info:fedora/' . $cmodel . '>';
}
$query_string .= ')
minus $content <mulgara:is> <info:fedora/fedora-system:FedoraObject-3.0>
order by ' . $orderby;
$results = $collection_object->repository->ri->itqlQuery($query_string, $limit, $offset);
return $results;
}
/**
* determines whether we can see the object or not
* checks PID namespace permissions, and user permissions
* @global type $user
* @param type $op
* @param type $pid
* @return type
*/
function fedora_repository_access($permission, $pid) {
global $user;
$name_space_access = FALSE;
$is_restricted = variable_get('islandora_namespace_restriction_enforced', FALSE);
if (!$is_restricted) {
$name_space_access = TRUE;
}
if ($pid == NULL) {
$pid = variable_get('islandora_repository_pid', 'islandora:root');
}
$name_space_allowed = explode(" ", variable_get('islandora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: '));
$pos = NULL;
foreach ($name_space_allowed as $name_space) {
$pos = stripos($pid, $name_space);
if ($pos === 0) {
$name_space_access = TRUE;
}
}
if ($name_space_access) {
$user_access = user_access($permission);
if ($user_access == NULL) {
return FALSE;
}
return $user_access;
}
else {
return FALSE;
}
}
/**
* gets the name of the content models for the specified object
* this now returns an array of pids as in Fedora 3 we can have more then one Cmodel for an object
* @param type $pid
* @param type $include_fedora_system_content_models
* @return array
*/
function get_content_models_list($object, $include_fedora_system_content_models = FALSE) {
$pids = array();
$query = 'select $object from <#ri>
where <info:fedora/' . $object->id . '> <fedora-model:hasModel> $object
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>';
$content_models = $object->repository->ri->itqlQuery($query, 'unlimited', '0');
if (empty($content_models)) {
return $pids;
}
$cmodels = array();
foreach ($content_models as $content_model) {
if (strpos($content_model['object']['uri'], 'fedora-system:FedoraObject-3.0') != FALSE && $include_fedora_system_content_models == FALSE) {
continue;
}
$cmodels[] = substr(strstr($content_model['object']['uri'], '/'), 1);
}
return $cmodels;
}
/**
* Function: get_content_models_as_option_array
*
* Description: Returns an associative array of all available content models in Fedora instance
*
* @return array
*/
function get_content_models_as_option_array() {
module_load_include('inc', 'islandora', 'includes/tuque');
$rest_connection = new IslandoraTuque();
$restricted = variable_get('islandora_namespace_restriction_enforced', FALSE);
$allowed_string = variable_get('islandora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
foreach ($namespaces as $namespace) {
if ($namespace) {
$allowed[] = trim($namespace);
}
}
$query = 'select $object $title from <#ri>
where ($object <fedora-model:label> $title
and ($object <fedora-model:hasModel> <info:fedora/fedora-system:ContentModel-3.0>
or $object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:ContentModelsCollection>)
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)
order by $title';
$list = $rest_connection->repository->ri->itqlQuery($query, 'unlimited', '0');
$options = array();
foreach ($list as $item) { //removes blanks
if ($item) {
$item_namespace = explode(':', $item['object']['value']);
if (!$restricted || in_array($item_namespace[0], $allowed)) {
if (!preg_match('/fedora-system/', $item['object']['value'])) {
$options[$item['object']['value']] = $item['title']['value'] . ' ~ ' . $item['object']['value'];
}
}
}
}
return $options;
}

113
islandora_basic_collection/includes/collection_manager_table.inc

@ -1,113 +0,0 @@
<?php
/**
* @file
* collection_manager_table.inc
*/
/**
* Returns a formatted table listing all members of the collection
* defined by the $collection_pid parameter
* @param string $collection_pid
* @return array
*/
function islandora_collection_table($object) {
$query = 'select $object $title from <#ri>
where ($object <info:fedora/fedora-system:def/relations-external#isMemberOf> <info:fedora/' . $object->id . '>
or $object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/' . $object->id . '>)
and $object <dc:title> $title';
$results = $object->repository->ri->itqlQuery($query, 'unlimited', '0');
$keys = array();
$objects = array();
foreach ($results as $result) {
$objects[$result['object']['value']] = $result['title']['value'];
$keys[] = $result['object']['value'];
}
$rows = array();
foreach ($objects as $key => $object) {
$rows[$key] = array(
'#pid' => $key,
'pid' => array('#value' => l($key, 'islandora/object/' . $key)),
'title' => array(
'data' => array(
'#type' => 'link',
'#title' => $object,
'#href' => 'islandora/object/' . $key,
),
),
);
}
$header = array(
'title' => array('data' => t('Title')),
);
if (!$rows) {
return;
}
$table = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $rows,
);
return $table;
}
/**
* themes the form table.
*
* @param array $element Drupal Form Element.
* @return string
*/
function theme_islandora_basic_collection_management_form_table(array $element) {
$rows = array();
foreach (element_children($element['rows']) as $child) {
$setting = $element['rows'][$child];
$pid = $setting['#pid'];
$fields = array(
drupal_render($element['selections'][$pid]) // First field is a checkbox
);
foreach (element_children($setting) as $property) {
$field = $setting[$property];
$fields[] = drupal_render($field);
}
$rows[] = array(
'data' => $fields,
'class' => isset($setting['#attributes']['class']) ? $setting['#attributes']['class'] : NULL
);
}
$attributes = isset($element['#id']) ? array('id' => $element['#id']) : NULL;
return theme_table($element['#header'], $rows, $attributes);
}
function get_collections_as_option_array() {
module_load_include('inc', 'islandora', 'includes/tuque');
$restricted = variable_get('islandora_namespace_restriction_enforced', FALSE);
$allowed_string = variable_get('islandora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
$rest_connection = new IslandoraTuque();
$query = 'select $object $title from <#ri>
where ($object <fedora-model:label> $title
and $object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/islandora:collectionCModel>
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)
order by $title';
$results = $rest_connection->repository->ri->itqlQuery($query, 'unlimited', '0');
foreach ($namespaces as $namespace) {
$trimmed_names[] = trim($namespace);
}
$options = array();
foreach ($results as $item) { //removes blanks
$namespace = explode(':', $item['object']['value']);
$namespace = trim($namespace[0]);
if (!$restricted || in_array($namespace, $trimmed_names)) {
$options[$item['object']['value']] = $item['title']['value'];
}
}
unset($options['islandora:ContentModelCollection']);
return $options;
}

124
islandora_basic_collection/includes/delete_collection.inc

@ -1,124 +0,0 @@
<?php
/**
* @file
* DeleteCollection.inc
*/
/**
*
* @param array $form_state
* @param string $pid
*
* @return string
*/
function islandora_collection_deletion_form($form, &$form_state, $object) {
module_load_include('inc', 'islandora_basic_collection', 'collection_manager_table');
$pid = $object->id;
$potential_collections = get_collections_as_option_array();
$table = islandora_collection_table($object);
$deletion_message = ($table) ? "Delete Members of this Collection" : "Delete Collection";
$submit_text_message = ($table) ? "Delete selected objects" : "Delete collection";
$form = array();
$form['collection_delete']['titlebox'] = array(
'#type' => 'item',
'#title' => t("Delete objects from @collection_pid", array('@collection_pid' => $pid)),
);
if ($table) {
$form['collection_delete']['table'] = array(
'table' => $table,
);
}
else {
$form['collection_delete']['delete_root'] = array(
'#type' => 'checkbox',
'#title' => "Remove this empty collection?",
'#id' => 'delete_collection',
);
}
$form['current'] = array(
'#type' => 'hidden',
'#value' => $pid,
);
$form['collection_delete']['message'] = array(
'#type' => 'item',
'#value' => t("This action is permanant and cannot be undone."),
);
$form['collection_delete']['submit'] = array(
'#type' => 'submit',
'#description' => t("This action is permanant and cannot be undone."),
'#value' => t('@message', array('@message' => $submit_text_message)),
);
return $form;
}
/**
* Submit handler for object deletion form in the collection manager.
*
* @global type $user
* @param array $form
* @param array $form_state
*/
function islandora_collection_deletion_form_submit($form, &$form_state) {
$collection_pid = $form_state['values']['current'];
$fedora_object = islandora_object_load($collection_pid);
$parents = $fedora_object->relationships->get(NULL, 'isMemberOfCollection');
$parents = islandora_collections_get_collection_from_pid($fedora_object);
$collection_pid = $form_state['values']['current'];
if (isset($form_state['values']['delete_root']) && $form_state['values']['delete_root'] == 1) {
delete_root_collection($fedora_object);
drupal_goto("islandora/object/" . $parents[0]['parent']['value']);
}
$child_collections = get_child_collections($fedora_object);
$populated_child_collections = array();
$pids = @array_filter($form_state['values']['table']);
if (!empty($child_collections)) {
foreach ($child_collections as $child) {
$child_pids = get_related_items_as_array(islandora_object_load($child['object']['value']), 'isMemberOfCollection');
if (!empty($child_pids)) {
$populated_child_collections[] = $child;
}
}
}
if (!empty($populated_child_collections)) {
$conflict = FALSE;
foreach ($populated_child_collections as $collection) {
if (in_array($collection, $pids)) {
$conflict = TRUE;
drupal_set_message(t("Populated child collections were not deleted."));
}
}
}
$pids_to_delete = array_diff($pids, $populated_child_collections);
foreach ($pids_to_delete as $pid_to_delete) {
$fedora_object->repository->purgeObject($pid_to_delete);
}
drupal_goto("islandora/object/" . $collection_pid);
}
/**
* Deletes the collection object
*
* @param string $pid
*/
function delete_root_collection($object) {
$pid = $object->id;
try {
$object->repository->purgeObject($object->id);
} catch (RepositoryException $e) {
drupal_set_message(t("Collection '@pid' could not be deleted!", array('@pid' => $pid)), 'error');
return;
}
drupal_set_message(t("Collection '@pid' deleted.", array('@pid' => $pid)));
}

233
islandora_basic_collection/includes/manage_policies.inc

@ -1,233 +0,0 @@
<?php
/**
* @file
* ManagePolicies.inc
*/
/**
* Create form to collection policy management feature
*
* @param array $form
* @param array $form_state
* @param string $collection_pid
* @return type
*/
function islandora_manage_policies_form($form, &$form_state, $collection_object) {
module_load_include('inc', 'islandora_basic_collection', 'includes/CollectionPolicy');
$repository = $collection_object->repository;
$content_models = get_content_models_list($collection_object);
$cm_options = array();
$name_mappings = array();
foreach ($content_models as $content_model) {
if ($content_model != "islandora:collectionCModel") {
try {
$item = $repository->getObject($content_model);
$cm_name = $item->Label;
$cm_options[$content_model] = $cm_name;
} catch (RepositoryException $e) {
}
}
}
$namespace = substr($collection_object->id, 0, strpos($collection_object->id, ":"));
$collection_policy_dsid = variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY');
$collection_policy_string = $collection_object->getDatastream($collection_policy_dsid);
$supported_collection_models = array();
if ($collection_policy_string) {
$collection_policy = new CollectionPolicy($collection_policy_string->content);
$supported_collection_models = $collection_policy->getContentModels();
}
$collection_namespace = substr($collection_object->id, 0, strpos($collection_object->id, ":"));
$represented_content_models = get_represented_content_models($collection_object);
$collection_name = $collection_object->label;
$new_content_models = get_content_models_as_option_array();
$current_models_in_policy = array();
if ($supported_collection_models) {
foreach ($supported_collection_models as $supported_model) {
$current_models_in_policy[$supported_model['pid']] = $supported_model['pid'];
}
}
$new_options = array();
if (is_array($new_content_models) && is_array($current_models_in_policy)) {
$new_options = array_diff_key($new_content_models, $current_models_in_policy);
}
$s = '';
if (count($current_models_in_policy) > 1) {
$s = 's';
}
$form['manage_collection_policy']['titlebox'] = array(
'#type' => 'item',
'#title' => t("Manage collection policy for @collection_title", array('@collection_title' => $collection_object->label)),
);
if (count($new_content_models) > 0) {
$form ['manage_collection_policy']['add']['content_model_to_add'] = array(
'#title' => "Choose content model",
'#type' => 'select',
'#options' => $new_options,
'#description' => t("Choose content model to add to this collection policy."),
);
$form['manage_collection_policy']['add']['new_cp_namespace'] = array(
'#title' => "Choose namespace",
'#type' => 'textfield',
'#size' => 15,
'#default_value' => $namespace,
'#description' => t("Choose namespace for objects in this collection associated with this content model"),
);
$form['parent_collection'] = array(
'#type' => 'hidden',
'#value' => $collection_object->id,
);
$form['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $collection_object->id,
);
$form['manage_collection_policy']['add']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add content model to collection policy'),
'#id' => 'add_cm'
);
}
else {
$form['manage_collection_policy']['no_content_models'] = array(
'#markup' => t('No content models available to add!'),
);
}
if (count($current_models_in_policy) > 0) {
$form['manage_collection_policy']['remove'] = array(
'#title' => "Delete content model from collection policy",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form ['manage_collection_policy']['remove']['content_models_to_remove'] = array(
'#title' => "Choose content model to remove",
'#type' => 'checkboxes',
'#options' => $current_models_in_policy,
'#description' => t("Choose content models to remove from this collection policy."),
);
$form['manage_collection_policy']['remove']['submit'] = array(
'#type' => 'submit',
'#value' => t('Remove content model@s from collection policy', array('@s' => $s)),
'#id' => 'remove_cm'
);
}
return $form;
}
function islandora_manage_policies_form_validate($form, &$form_state) {
}
/**
* Submit handler for collection policy management form
*
* @param array $form
* @param array $form_state
*/
function islandora_manage_policies_form_submit($form, &$form_state) {
module_load_include('module', 'islandora', 'islandora');
$collection_pid = $form_state['values']['parent_collection'];
$collection_object = islandora_object_load($collection_pid);
$policy = $collection_object->getDatastream(variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY'));
$collection_policy = '<?xml version="1.0" encoding="UTF-8"?>
<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
<content_models>
<content_model dsid="ISLANDORACM" name="Islandora Collection Model ~ islandora:collectionCModel" namespace="islandora:1" pid="islandora:collectionCModel"/>
</content_models>
<search_terms>
</search_terms>
<staging_area></staging_area>
<relationship>isMemberOfCollection</relationship>
</collection_policy>';
$collection_policy_xml = new DOMDocument();
$collection_policy_xml->loadXML($policy->content);
if ($form_state['clicked_button']['#id'] == 'add_cm') {
if (empty($policy->content)) {
$collection_policy_datastream = $collection_object->constructDatastream('COLLECTION_POLICY', 'X');
$collection_policy_datastream->setContentFromString($collection_policy);
$collection_policy_datastream->label = 'COLLECTION_POLICY';
$collection_object->ingestDatastream($collection_policy_datastream);
$policy = $collection_object->getDatastream(variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY'));
}
$cp_namespace = $form_state['values']['new_cp_namespace'];
$cp_content_model = $form_state['values']['content_model_to_add'];
$content_model_object = islandora_object_load($cp_content_model);
$content_model_datastream = $content_model_object->getDatastream(variable_get('Islandora_Content_Model_DSID', 'ISLANDORACM'));
$content_models_element = $collection_policy_xml->getElementsByTagName('content_models');
$content_model_element = $content_models_element->item(0)->getElementsByTagName('content_model');
$content_model_element = $collection_policy_xml->createElement('content_model');
$content_model_element->setAttribute('name', $content_model_object->label);
$content_model_element->setAttribute('dsid', variable_get('Islandora_Content_Model_DSID', 'ISLANDORACM'));
$content_model_element->setAttribute('namespace', $cp_namespace);
$content_model_element->setAttribute('pid', $content_model_object->id);
$content_models_element->item(0)->appendChild($content_model_element);
$new_collection_policy_datastream = $collection_object->getDatastream('COLLECTION_POLICY');
$new_collection_policy_datastream->setContentFromString($collection_policy_xml->saveXML());
$new_collection_policy_datastream->label = 'COLLECTION_POLICY';
$collection_object->ingestDatastream($new_collection_policy_datastream);
drupal_set_message(t("Collection model @model successfully added", array('@model' => $content_model_object->label)));
}
//remove content model from collection policy
if ($form_state['clicked_button']['#id'] == 'remove_cm') {
$candidates = $form_state['values']['content_models_to_remove'];
$count = 0;
$s = '';
foreach ($candidates as $candidate) {
if (is_string($candidate)) {
$content_models_element = $collection_policy_xml->getElementsByTagName('content_models');
$models = $content_models_element->item(0)->getElementsByTagName('content_model');
$found = FALSE;
for ($i = 0; $found === FALSE && $i < $models->length; $i++) {
if ($models->item($i)->getAttribute('pid') == $candidate) {
$found = $models->item($i);
}
}
if ($found !== FALSE && $models->length > 0) {
$content_models_element->item(0)->removeChild($found);
$ret = TRUE;
}
$count++;
}
}
if ($count > 0) {
$new_collection_policy_datastream = $collection_object->getDatastream('COLLECTION_POLICY');
$new_collection_policy_datastream->setContentFromString($collection_policy_xml->saveXML());
$new_collection_policy_datastream->label = 'COLLECTION_POLICY';
$collection_object->ingestDatastream($new_collection_policy_datastream);
if ($count > 1) {
$s = 's';
}
drupal_set_message(t("$count collection model@s removed", array('@s' => $s)));
}
}
}

75
islandora_basic_collection/includes/move_collection.inc

@ -1,75 +0,0 @@
<?php
/**
* @file
* MoveCollection.inc
*/
/**
* Create object migration form for the collection manager
*
* @param array $form_state
* @param string $pid
*
* @return string
*/
function islandora_collection_migrate_form($form, &$form_state, $object) {
module_load_include('inc', 'islandora_basic_collection', 'collection_manager_table');
$potential_collections = get_collections_as_option_array();
$table = islandora_collection_table($object);
if (!$table) {
$form['no_objects'] = array(
'#type' => 'item',
'#title' => t('No objects found in this collection'),
);
return $form;
}
$form = array();
$form['migrate']['titlebox'] = array(
'#type' => 'item',
'#title' => t("Move objects from @collection_pid", array('@collection_pid' => $object->id)),
);
$form['migrate']['new_collection'] = array(
'#title' => t('New collection'),
'#description' => t("All content will be migrated from @pid to the selected collection", array('@pid' => $object->id)),
'#type' => 'select',
'#options' => $potential_collections,
);
$form['migrate']['table'] = $table;
$form['current'] = array(
'#type' => 'hidden',
'#value' => $object->id,
);
$form['migrate']['message'] = array(
'#type' => 'item',
'#value' => t(""),
);
$form['migrate']['submit'] = array(
'#type' => 'submit',
'#value' => t('Migrate selected objects'),
);
return $form;
}
/**
* Submit handler for object migration form
*
* @param array $form
* @param array $form_state
*/
function islandora_collection_migrate_form_submit($form, &$form_state) {
$pids = array_filter($form_state['values']['table']);
$new_collection = $form_state['values']['new_collection'];
$current = $form_state['values']['current'];
foreach ($pids as $pid) {
$fedora_object = islandora_object_load($pid);
$fedora_object->relationships->remove(FEDORA_RELS_EXT_URI, 'isMemberOfCollection', $current);
$fedora_object->relationships->add(FEDORA_RELS_EXT_URI, 'isMemberOfCollection', $new_collection);
}
}

8
islandora_basic_collection/islandora_basic_collection.info

@ -1,8 +0,0 @@
name = "Islandora Basic Collection"
description = "A default Islandora Repository module to handle simple collections"
dependencies[] = islandora
package = Islandora
core = 7.x
configure = admin/islandora/basic_collection
stylesheets[all][] = css/islandora_basic_collection.base.css
stylesheets[all][] = css/islandora_basic_collection.theme.css

105
islandora_basic_collection/islandora_basic_collection.install

@ -1,105 +0,0 @@
<?php
function islandora_basic_collection_requirements($phase) {
if($phase == 'install') {
module_load_include('inc', 'islandora', 'includes/tuque');
if(!IslandoraTuque::exists()) {
return array(array(
'title' => 'Tuque',
'description' => 'The Islandora Collection solution pack requires the Tuque library.',
'severity' => REQUIREMENT_ERROR,
));
}
}
}
/**
* @file
* islandora_basic_collection.install
*/
function islandora_basic_collection_install() {
module_load_include('inc', 'islandora', 'includes/tuque');
global $base_root;
try {
$rest_connection = new IslandoraTuque();
} catch (Exception $e) {
drupal_set_message(st('Unable to connect to the repository %e', array('%e' => $e)), 'error');
return;
}
$content_model_query = $rest_connection->api->a->findObjects('query', 'pid=islandora:collectionCModel');
if (empty($content_model_query['results'])) {
try {
$xml = file_get_contents(drupal_get_path('module', 'islandora_basic_collection') . '/xml/islandora_collection_CModel.xml');
$rest_connection->api->m->ingest(array('string' => $xml));
} catch (Exception $e) {
drupal_set_message(st('Unable to install content models %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(st('Content models for the basic collection module installed!'));
}
else {
drupal_set_message(st('Content models for the basic collection module already exist!'), 'warning');
}
$collection_query = $rest_connection->api->a->findObjects('query', 'pid=islandora:root');
if (empty($collection_query['results'])) {
try {
$xml = file_get_contents(drupal_get_path('module', 'islandora_basic_collection') . '/xml/islandora_root_collection.xml');
$rest_connection->api->m->ingest(array('string' => $xml));
$fedora_object = new FedoraObject('islandora:root', $rest_connection->repository);
$datastream = new NewFedoraDatastream('TN', 'M', $fedora_object, $rest_connection->repository);
$file_path = $base_root . '/' . drupal_get_path('module', 'islandora_basic_collection') . '/Crystal_Clear_filesystem_folder_grey.png';
$datastream->label = 'Thumbnail';
$datastream->mimetype = 'image/png';
$datastream->setContentFromUrl($file_path);
$fedora_object->ingestDatastream($datastream);
} catch (Exception $e) {
drupal_set_message(st('Unable to install collections for the basic collection module %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(st('Collections installed for the basic collection module!'));
}
else {
drupal_set_message(st('Collections already exist for the basic collection module!'), 'warning');
}
}
function islandora_basic_collection_uninstall() {
module_load_include('inc', 'islandora', 'includes/tuque');
try {
$rest_connection = new IslandoraTuque();
} catch (Exception $e) {
drupal_set_message(st('Unable to connect to the repository %e', array('%e' => $e)), 'error');
return;
}
$content_model_query = $rest_connection->api->a->findObjects('query', 'pid=islandora:collectionCModel');
if (!empty($content_model_query['results'])) {
try {
$rest_connection->repository->purgeObject('islandora:collectionCModel');
} catch (Exception $e) {
drupal_set_message(st('Unable to purge content models for the basic collection module %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(st('Content models for the basic collection module purged!'));
}
else {
drupal_set_message(st('Content models for the basic collection module don\'t exist!'), 'warning');
}
$collection_query = $rest_connection->api->a->findObjects('query', 'pid=islandora:root');
if (!empty($collection_query['results'])) {
try {
$rest_connection->repository->purgeObject('islandora:root');
} catch (Exception $e) {
drupal_set_message(st('Unable to purge collections for the basic collection module %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(st('Collections for the basic collection module purged!'));
}
else {
drupal_set_message(st('Collections for the basic collection module don\'t exist!'), 'warning');
}
}

297
islandora_basic_collection/islandora_basic_collection.module

@ -1,297 +0,0 @@
<?php
/*
* @file
* islandora_basic_collection.module
*
* an Islandora module to handle basic image cmodels
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
/**
* Implements hook_menu().
* we need some standard entry points so we can have consistent urls for different Object actions
*/
function islandora_basic_collection_menu() {
$items = array();
$items['islandora/object/%islandora_object/manage/collection'] = array(
'title' => 'Collection',
'page callback' => 'islandora_basic_collection_manage_object',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2),
);
$items['admin/islandora/basic_collection'] = array(
'title' => 'Core collection',
'description' => 'Configure the core Islandora collection functionality.',
'page callback' => 'drupal_get_form',
'access arguments' => array('administer site configuration'),
'page arguments' => array('islandora_basic_collection_admin'),
'file' => 'admin/islandora_basic_collection.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
/* an example of adding a tab for view
$items['islandora/object/%/view/collection'] = array(
'title' => 'Collection View',
'page callback' => 'islandora_basic_collection_view1',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2),
); */
return $items;
}
function islandora_basic_collection_init() {
if (path_is_admin(current_path())) {
drupal_add_css(drupal_get_path('module', 'islandora_basic_collection') . '/css/islandora_basic_collection.admin.css');
}
}
/**
* This function is where we create the view for the related menu item
* @param type $object_id
* @return type
*/
function islandora_basic_collection_manage_object($object) {
module_load_include('inc', 'islandora_basic_collection', 'includes/collection_management');
module_load_include('inc', 'islandora_basic_collection', 'includes/collection_manager_table');
module_load_include('inc', 'islandora_basic_collection', 'includes/delete_collection');
module_load_include('inc', 'islandora_basic_collection', 'includes/move_collection');
module_load_include('inc', 'islandora_basic_collection', 'includes/child_collection');
module_load_include('inc', 'islandora_basic_collection', 'includes/manage_policies');
module_load_include('inc', 'islandora_basic_collection', 'includes/change_content_models');
$form = array();
$form['collection_manager'] = array(
'#type' => 'vertical_tabs',
'#weight' => 0,
'#prefix' => '',
);
$form['collection_manager']['create_child_collection'] = array(
'#title' => t('Create child collection'),
'#type' => 'fieldset',
);
$form['collection_manager']['create_child_collection']['form'] = drupal_get_form('islandora_create_child_collection_form', $object);
$form['collection_manager']['manage_policies'] = array(
'#type' => 'fieldset',
'#title' => t('Manage collection policies'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['collection_manager']['manage_policies']['form'] = drupal_get_form('islandora_manage_policies_form', $object);
$form['collection_manager']['change_content_models'] = array(
'#type' => 'fieldset',
'#title' => t('Change content models'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['collection_manager']['change_content_models']['form'] = drupal_get_form('islandora_change_content_models_form', $object);
$form['collection_manager']['migrate_members'] = array(
'#type' => 'fieldset',
'#title' => t('Migrate members'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['collection_manager']['migrate_members']['form'] = drupal_get_form('islandora_collection_migrate_form', $object);
$form['collection_manager']['delete_members'] = array(
'#type' => 'fieldset',
'#title' => t('Delete members of this collection'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['collection_manager']['delete_members']['form'] = drupal_get_form('islandora_collection_deletion_form', $object);
// Pass the form around any modules that are interested so that they can add their own collection management functions.
module_invoke_all('islandora_collection_manager', $form);
return $form;
}
/**
* determines whether or not to show this modules manage tab
* @global object $user
* @param string $object_id
* @return boolean
*/
function islandora_basic_collection_access($fedora_object) {
if (!isset($fedora_object)) {
return FALSE;
}
$models = $fedora_object->models;
$cmodel_list = islandora_basic_collection_islandora_get_types();
foreach ($fedora_object->models as $model) {
if (isset($cmodel_list[$model])) {
return user_access(FEDORA_MANAGE);
}
}
return FALSE;
}
/**
* Theme registry function
* We supply a pattern so we can overide templates at the theme level if needed.
* we can append a pid to a template and the new template file will be called (the pids
* colon should be replaced with a dash)
* @return array
*/
function islandora_basic_collection_theme($existing, $type, $theme, $path) {
return array(
'islandora_basic_collection' => array(
'file' => 'theme/islandora_basic_collection.theme.inc',
'template' => 'theme/islandora-basic-collection',
'pattern' => 'islandora_basic_collection__', //we can add pids to the end of this pattern in our preprocess function
// and templates will be able to have have a pid appended to the template name to overide a template on a per object basis
//an example template would be named islandora-basic-image--islandora-27.tpl.phps
'variables' => array('islandora_object' => NULL),
),
'islandora_basic_collection_grid' => array(
'file' => 'theme/islandora_basic_collection.theme.inc',
'template' => 'theme/islandora-basic-collection-grid',
'pattern' => 'islandora_basic_collection_grid__',
'variables' => array('islandora_object' => NULL, 'collection_results' => NULL),
),
'islandora_basic_collection_wrapper' => array(
'file' => 'theme/islandora_basic_collection.theme.inc',
'template' => 'theme/islandora-basic-collection-wrapper',
'variables' => array('islandora_object' => NULL),
),
'islandora_basic_collection_management_form_table' => array(
'file' => 'theme/islandora_basic_collection.theme.inc',
'arguments' => array('element' => NULL),
'file' => 'includes/collection_manager_table.inc',
),
);
}
/**
* tells the main module what types of objects we support. This is used to determine whether or not
* this module should attempt to respond.
* If ISLANDORA_VIEW_HOOK = TRUE this function will populate the default tab. This should be configurable
* in the modules admin section, otherwise two modules can populate one tab.
* @return array
* array of content model pids that this module supports
*/
function islandora_basic_collection_islandora_get_types() {
$types = array();
$types['islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = variable_get('islandora_basic_collection_use_for_default_tab', TRUE);
//$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE;
return $types;
}
/**
* this modules implentation of view_object hook will handle objects of type islandora:basicImageCModel and info:fedora/islandora:sp_basic_image
* as registered in its return types
* Other modules would handle objects of other types.
* @param Object $object
* a tuque fedora object
* @param object $user
* @param string $page_number
* @param string $page_size
* @return string
* themed html
*/
function islandora_basic_collection_islandora_view_object($object, $user) {
//global $user;
$cmodel_list = islandora_basic_collection_islandora_get_types();
$models = $object->models;
foreach ($object->models as $model) {
if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) {
$output = theme('islandora_basic_collection_wrapper', array('islandora_object' => $object,));
return array('Collection View' => $output);
}
}
return NULL;
}
/**
* a wrappert to retrieve an object from Fedora
* @global object $user
* @param string $object_id
* @return null|\FedoraObject
*/
function islandora_basic_collection_get_object($object_id) {
return islandora_object_load($object_id);
}
/**
* gets objects associated with this object with teh isMemberOf or isMemberOfCollection
*
* @global object $user
* @param object $object
* @param string $page_number
* @param string $page_size
* @return array
*/
function islandora_basic_collection_get_objects($object, $page_number = 1, $page_size = 5) {
$query = 'select $object $title $content from <#ri>
where ($object <fedora-model:label> $title
and $object <fedora-model:hasModel> $content
and ($object <fedora-rels-ext:isMemberOfCollection> <info:fedora/' . $object->id . '>
or $object <fedora-rels-ext:isMemberOf> <info:fedora/' . $object->id . '>)
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)
minus $content <mulgara:is> <info:fedora/fedora-system:FedoraObject-3.0>
order by $title';
$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);
try {
$results = $object->repository->ri->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"";
}
return $results;
}
function islandora_basic_collection_islandora_ingest_get_information($models, $object) {
if (in_array('islandora:collectionCModel', $models) && isset($object['COLLECTION_POLICY'])) {
try {
module_load_include('inc', 'islandora_basic_collection', 'includes/CollectionPolicy');
$return = array();
$policy = new CollectionPolicy($object['COLLECTION_POLICY']->content);
$return['models'] = $policy->getContentModels();
$return['relationship'] = $policy->getRelationship();
return $return;
} catch (Exception $e) {}
}
}
function islandora_basic_collection_islandora_undeletable_datastreams($models) {
if(in_array('islandora:collectionCModel', $models)) {
if(variable_get('islandora_basic_collection_disable_collection_policy_delete', TRUE)) {
return array('COLLECTION_POLICY');
}
}
}

35
islandora_basic_collection/theme/islandora-basic-collection-grid.tpl.php

@ -1,35 +0,0 @@
<?php
/*
* islandora-basic-collection.tpl.php
*
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<div class="islandora islandora-basic-collection">
<div class="islandora-basic-collection-grid clearfix">
<?php foreach($associated_objects_array as $key => $value): ?>
<dl class="islandora-basic-collection-object <?php print $value['class']; ?>">
<dt class="islandora-basic-collection-thumb"><?php print $value['thumb_link']; ?></dt>
<dd class="islandora-basic-collection-caption"><?php print $value['title_link']; ?></dd>
</dl>
<?php endforeach; ?>
</div>
</div>

35
islandora_basic_collection/theme/islandora-basic-collection-wrapper.tpl.php

@ -1,35 +0,0 @@
<?php
/*
* islandora-basic-collection-wrapper.tpl.php
*
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php drupal_set_title($islandora_object->label); ?>
<div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix">
<span class="islandora-basic-collection-display-switch">
<?php print theme('links', array('links' => $view_links, 'attributes' => array('class' => array('links', 'inline'))));?>
</span>
<?php print $collection_pager; ?>
<?php print $collection_content; ?>
<?php print $collection_pager; ?>
</div>
</div>

53
islandora_basic_collection/theme/islandora-basic-collection.tpl.php

@ -1,53 +0,0 @@
<?php
/*
* islandora-basic-collection.tpl.php
*
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php if(isset($islandora_object_label)): ?>
<?php drupal_set_title("$islandora_object_label"); ?>
<?php endif; ?>
<div class="islandora islandora-basic-collection">
<?php $row_field = 0; ?>
<?php foreach($associated_objects_array as $associated_object): ?>
<div class="islandora-basic-collection-object islandora-basic-collection-list-item clearfix">
<dl class="<?php print $associated_object['class']; ?>">
<dt>
<?php if (isset($associated_object['thumb_link'])): ?>
<?php print $associated_object['thumb_link']; ?>
<?php endif; ?>
</dt>
<dd class="collection-value <?php print isset($associated_object['dc_array']['dc:title']['class']) ? $associated_object['dc_array']['dc:title']['class'] : ''; ?> <?php print $row_field == 0 ? ' first' : ''; ?>">
<?php if (isset($associated_object['thumb_link'])): ?>
<strong><?php print $associated_object['title_link']; ?></strong>
<?php endif; ?>
</dd>
<?php if (isset($associated_object['dc_array']['dc:description']['value'])): ?>
<dd class="collection-value <?php print $associated_object['dc_array']['dc:description']['class']; ?>">
<?php print $associated_object['dc_array']['dc:description']['value']; ?>
</dd>
<?php endif; ?>
</dl>
</div>
<?php $row_field++; ?>
<?php endforeach; ?>
</div>

133
islandora_basic_collection/theme/islandora_basic_collection.theme.inc

@ -1,133 +0,0 @@
<?php
/**
* list view preprocess
* currently just calls normal view preprocess as variables are the same
* @param type $variables
*/
function islandora_basic_collection_preprocess_islandora_basic_collection_grid(&$variables) {
islandora_basic_collection_preprocess_islandora_basic_collection($variables);
}
function islandora_basic_collection_preprocess_islandora_basic_collection_wrapper(&$variables) {
$page_number = (empty($_GET['page'])) ? 0 : $_GET['page'];
$page_size = (empty($_GET['pagesize'])) ? variable_get('islandora_basic_collection_page_size', '10') : $_GET['pagesize'];
$islandora_object = $variables['islandora_object'];
$results = islandora_basic_collection_get_objects($islandora_object, $page_number, $page_size);
$total_count = count($results);
pager_default_initialize($total_count, $page_size);
$variables['collection_pager'] = theme('pager', array('quantity' => 10));
$display = (empty($_GET['display'])) ? variable_get('islandora_basic_collection_default_view', 'grid') : $_GET['display'];
$link_text = (empty($_GET['display'])) ? 'grid' : $_GET['display'];
$query_params = drupal_get_query_parameters($_GET);
global $base_url;
if ($display == 'grid') {
$query_params['display'] = 'list';
$list_link = array('title' => 'List view', 'href' => $base_url . '/islandora/object/' . $islandora_object->id, 'attributes' => array('class' => 'islandora-view-list'),
'query' => $query_params);
unset($query_params['display']);
$query_params['display'] = 'grid';
$grid_link = array('title' => 'Grid view', 'href' => $base_url . '/islandora/object/' . $islandora_object->id, 'attributes' => array('class' => array('islandora-view-grid', 'active')),
'query' => $query_params);
$collection_content = theme('islandora_basic_collection_grid', array('islandora_object' => $islandora_object, 'collection_results' => $results));
}
else {
$query_params['display'] = 'list';
$list_link = array('title' => 'List view', 'href' => $base_url . '/islandora/object/' . $islandora_object->id, 'attributes' => array('class' => array('islandora-view-list', 'active')),
'query' => $query_params);
unset($query_params['display']);
$query_params['display'] = 'grid';
$grid_link = array('title' => 'Grid view', 'href' => $base_url . '/islandora/object/' . $islandora_object->id, 'attributes' => array('class' => 'islandora-view-grid'),
'query' => $query_params);
$collection_content = theme('islandora_basic_collection', array('islandora_object' => $islandora_object, 'collection_results' => $results));
}
$variables['view_links'] = array($grid_link,$list_link);
//$variables['grid_link'] = $grid_link;
$variables['collection_content'] = $collection_content;
}
/**
*
* @global type $base_url
* @param array $variables
* an array of variables that will be passed to the theme function
*/
function islandora_basic_collection_preprocess_islandora_basic_collection(&$variables) {
// base url
global $base_url;
// base path
global $base_path;
$islandora_object = $variables['islandora_object'];
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
try {
$dc = $islandora_object['DC']->content;
$dc_object = Dublin_Core::import_from_xml_string($dc);
} catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE);
}
$page_number = (empty($_GET['page'])) ? 0 : $_GET['page'];
$page_size = (empty($_GET['pagesize'])) ? variable_get('islandora_basic_collection_page_size', '10') : $_GET['pagesize'];
$results = $variables['collection_results']; //islandora_basic_collection_get_objects($islandora_object, $page_number, $page_size);
$total_count = count($results);
$variables['islandora_dublin_core'] = isset($dc_object) ? $dc_object : array();
$variables['islandora_object_label'] = $islandora_object->label;
$display = (empty($_GET['display'])) ? 'list' : $_GET['display'];
if ($display == 'grid') {
$variables['theme_hook_suggestions'][] = 'islandora_basic_collection_grid__' . str_replace(':', '_', $islandora_object->id);
}
else {
$variables['theme_hook_suggestions'][] = 'islandora_basic_collection__' . str_replace(':', '_', $islandora_object->id);
}
if (isset($islandora_object['OBJ'])) {
$full_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';
$variables['islandora_full_img'] = '<img src="' . $full_size_url . '"/>';
}
if (isset($islandora_object['TN'])) {
$thumbnail_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
$variables['islandora_thumbnail_img'] = '<img src="' . $thumbnail_size_url . '"/>';
}
if (isset($islandora_object['MEDIUM_SIZE'])) {
$medium_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view';
$variables['islandora_medium_img'] = '<img src="' . $medium_size_url . '"/>';
}
$associated_objects_array = array();
$start = $page_size * ($page_number);
$end = min($start + $page_size, $total_count);
for ($i = $start; $i < $end; $i++) {
$pid = $results[$i]['object']['value'];
$fc_object = islandora_basic_collection_get_object($pid);
if (!isset($fc_object)) {
continue; //null object so don't show in collection view;
}
$associated_objects_array[$pid]['object'] = $fc_object;
try {
$dc = $fc_object['DC']->content;
$dc_object = Dublin_Core::import_from_xml_string($dc);
$associated_objects_array[$pid]['dc_array'] = $dc_object->as_formatted_array();
} catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE);
}
$object_url = 'islandora/object/' . $pid;
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>';
$title = $results[$i]['title']['value'];
$associated_objects_array[$pid]['pid'] = $pid;
$associated_objects_array[$pid]['path'] = $object_url;
$associated_objects_array[$pid]['title'] = $title;
$associated_objects_array[$pid]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $pid));
if (isset($fc_object['TN'])) {
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>';
}
else {
$image_path = drupal_get_path('module', 'islandora');
$thumbnail_img = '<img src="' . $base_path . $image_path . '/images/Crystal_Clear_action_filenew.png"/>';
}
$associated_objects_array[$pid]['thumbnail'] = $thumbnail_img;
$associated_objects_array[$pid]['title_link'] = l($title, $object_url, array('html' => TRUE, 'attributes' => array('title' => $title)));
$associated_objects_array[$pid]['thumb_link'] = l($thumbnail_img, $object_url, array('html' => TRUE, 'attributes' => array('title' => $title)));
}
$variables['associated_objects_array'] = $associated_objects_array;
}
?>

58
islandora_basic_collection/xml/islandora_collection_CModel.xml

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="islandora:collectionCModel"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Islandora Collection Content Model"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2012-05-14T13:13:59.507Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2012-05-14T13:13:59.964Z"/>
</foxml:objectProperties>
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2012-05-14T13:13:59.507Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="413">
<foxml:xmlContent>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Islandora Collection Content Model</dc:title>
<dc:identifier>islandora:collectionCModel</dc:identifier>
</oai_dc:dc>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="DS-COMPOSITE-MODEL" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false">
<foxml:datastreamVersion ID="DS-COMPOSITE-MODEL1.0" LABEL="Datastream Composite Model" CREATED="2012-04-26T13:37:58.308Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:FedoraDSCompositeModel-1.0">
<foxml:xmlContent>
<dsCompositeModel xmlns="info:fedora/fedora-system:def/dsCompositeModel#"> <!-- using this as a guide -->
<dsTypeModel ID="DC" >
<form FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" MIME="text/xml"></form>
</dsTypeModel>
<dsTypeModel ID="RELS-EXT" optional="true">
<form FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0" MIME="application/rdf+xml"></form>
</dsTypeModel>
<dsTypeModel ID="RELS-INT" optional="true">
<form FORMAT_URI="info:fedora/fedora-system:FedoraRELSInt-1.0" MIME="application/rdf+xml"></form>
</dsTypeModel>
</dsCompositeModel>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora object-to-object relationship metadata" CREATED="2012-05-14T13:13:59.665Z" MIMETYPE="application/rdf+xml" SIZE="167">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:collectionCModel"></rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion ID="RELS-EXT.1" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2012-05-14T13:13:59.879Z" MIMETYPE="application/rdf+xml" SIZE="299">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:collectionCModel">
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/fedora-system:ContentModel-3.0"></hasModel>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject>

68
islandora_basic_collection/xml/islandora_root_collection.xml

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="islandora:root"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Islandora Top-level Collection"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2012-05-14T13:14:01.118Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2012-05-14T13:14:01.769Z"/>
</foxml:objectProperties>
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2012-05-14T13:14:01.118Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="397">
<foxml:xmlContent>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Islandora Top-level Collection</dc:title>
<dc:identifier>islandora:root</dc:identifier>
</oai_dc:dc>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora object-to-object relationship metadata" CREATED="2012-05-14T13:14:01.258Z" MIMETYPE="application/rdf+xml" SIZE="155">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:root"></rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion ID="RELS-EXT.1" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2012-05-14T13:14:01.471Z" MIMETYPE="application/rdf+xml" SIZE="283">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:root">
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/islandora:collectionCModel"></hasModel>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="COLLECTION_POLICY" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="COLLECTION_POLICY.0" LABEL="COLLECTION_POLICY" CREATED="2012-05-14T13:14:01.607Z" MIMETYPE="text/xml" SIZE="1211">
<foxml:xmlContent>
<collection_policy name="" xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
<content_models>
<content_model dsid="ISLANDORACM" name="Collection" namespace="islandora:collection" pid="islandora:collectionCModel"/>
</content_models>
<search_terms>
<term field="dc.title">dc.title</term>
<term field="dc.creator">dc.creator</term>
<term default="true" field="dc.description">dc.description</term>
<term field="dc.date">dc.date</term>
<term field="dc.identifier">dc.identifier</term>
<term field="dc.language">dc.language</term>
<term field="dc.publisher">dc.publisher</term>
<term field="dc.rights">dc.rights</term>
<term field="dc.subject">dc.subject</term>
<term field="dc.relation">dc.relation</term>
<term field="dcterms.temporal">dcterms.temporal</term>
<term field="dcterms.spatial">dcterms.spatial</term>
<term field="fgs.DS.first.text">Full Text</term>
</search_terms>
<relationship>isMemberOfCollection</relationship>
</collection_policy>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject>

BIN
islandora_basic_image/Crystal_Clear_filesystem_folder_grey.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

16
islandora_basic_image/admin/islandora_basic_image.admin.inc

@ -1,16 +0,0 @@
<?php
function islandora_basic_image_admin() {
$form = array();
$form['islandora_basic_image_use_for_default_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Provide the view for the default tab'),
'#default_value' => variable_get('islandora_basic_image_use_for_default_tab', TRUE),
'#description' => t('Should this module provide the view for the default view tab. If you are seeing unexpected content
on a view tab you may have multiple modules configured to provide content for the default tab.'),
'#weight' => -10
);
return system_settings_form($form);
}

8
islandora_basic_image/css/islandora_basic_image.admin.css

@ -1,8 +0,0 @@
/*
Document : islandora_basic_collection.admin.css
Created on : May 23, 2012, 11:23:06 AM
Description:
Purpose of the stylesheet follows.
*/

8
islandora_basic_image/css/islandora_basic_image.base.css

@ -1,8 +0,0 @@
/*
Document : islandora_basic_collection.base.css
Created on : May 23, 2012, 11:22:04 AM
Description:
Purpose of the stylesheet follows.
*/

19
islandora_basic_image/css/islandora_basic_image.theme-rtl.css

@ -1,19 +0,0 @@
/*
Document : islandora_basic_collection.theme-rtl
Created on : May 23, 2012, 11:23:56 AM
Description:
Purpose of the stylesheet follows.
*/
@media all and (min-width: 768px) {
body.no-sidebars .islandora-basic-image-content {
float: right; /* LTR */
padding: 0 0 0 20px;
}
body.no-sidebars .islandora-basic-image-sidebar {
float: left; /* LTR */
}
}

75
islandora_basic_image/css/islandora_basic_image.theme.css

@ -1,75 +0,0 @@
/*
Document : islandora_basic_collection.theme
Created on : May 23, 2012, 11:23:56 AM
Description: The basic image page is a simple flexible layout page
that breaks down to two columns when 2 sidebars are visible
*/
.islandora-basic-image-content {
background-color: #F2F2F2;
border: 1px solid #ddd;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 15px;
}
.islandora-basic-image-content img {
margin: 0;
display: block;
}
.islandora-basic-image-metadata {
display: block;
clear: both;
}
dl.islandora-basic-image-fields {
width:100%;
}
.islandora-basic-image-metadata dt {
font-weight: normal;
text-align: right;
font-weight: bold;
padding-right: 0;
}
.islandora-basic-image-metadata dd {
padding-left: 40px;
}
.islandora-basic-image-metadata dt,
.islandora-basic-image-metadata dd {
border-top:1px solid #e5e5e5;
}
.islandora-basic-image-metadata dt.first,
.islandora-basic-image-metadata dd.first {
border-top:0;
}
body.two-sidebars .islandora-basic-image-sidebar {
clear: both;
width: 100%;
}
@media all and (min-width: 768px) {
body.no-sidebars .islandora-basic-image-content {
width: 65%;
float: left; /* LTR */
}
body.no-sidebars .islandora-basic-image-sidebar {
padding-left: 20px;
}
body.no-sidebars .islandora-basic-image-sidebar {
float: right; /* LTR */
width: 35%;
clear: none;
}
}

73
islandora_basic_image/includes/image.process.inc

@ -1,73 +0,0 @@
<?php
/**
* @file image.process.inc
*
* This file contains all the functions for image manipulation used in the
* basic image solution pack.
*/
/**
* creates the derivatives for this content model type
* @param object $object
* tuque FedoraObject
* @return string
*/
function islandora_basic_image_create_all_derivatives($object) {
module_load_include('inc', 'islandora', 'includes/mime.detect');
module_load_include('inc', 'islandora_basic_image', 'includes/image_process');
$mime_class = new MimeDetect();
if (!isset($object['OBJ'])) {
drupal_set_message(t('Could not create image derivatives for %s. No image file was uploaded.', array('%s' => $object->id)),'error');
return "";
}
$ext = $mime_class->getExtension($object['OBJ']->mimeType);
$file_name = str_replace(':', '-', $object->id);
$original_file = file_save_data($object['OBJ']->content, 'temporary://' . $file_name . 'OBJ.' . $ext);
$tn_file = file_copy($original_file, 'temporary://' . $file_name . 'TN.' . $ext);
if (islandora_basic_image_create_derivative($tn_file, 200, 200)) {
islandora_basic_image_add_datastream($object, 'TN', $tn_file);
}
$medium_file = file_copy($original_file, 'temporary://' . $file_name . 'MEDIUM.' . $ext);
if (islandora_basic_image_create_derivative($medium_file, 500, 700)) {
islandora_basic_image_add_datastream($object, 'MEDIUM_SIZE', $medium_file);
}
file_delete($original_file);
}
/**
*
* @param object $file
* stdclass
*/
function islandora_basic_image_create_derivative($file, $width, $height) {
$real_path = drupal_realpath($file->uri);
$image = image_load($real_path);
if (!empty($image)) {
$scale = image_scale($image, $width, $height, TRUE);
if ($scale) {
return image_save($image);
}
}
return FALSE;
}
/**
* adds a datastream and deletes the tmp file from local file system
* @param object $object
* @param string $dsid
* @param object $file
*/
function islandora_basic_image_add_datastream($object, $dsid, $file) {
try {
$ds = $object->constructDatastream($dsid, 'M');
$ds->label = $dsid;
$ds->mimeType = $object['OBJ']->mimeType;
$ds->setContentFromFile(drupal_realpath($file->uri));
$object->ingestDatastream($ds);
file_delete($file);
} catch (exception $e) {
drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
}
}

8
islandora_basic_image/islandora_basic_image.info

@ -1,8 +0,0 @@
name = "Islandora Basic Image"
description = "A default Islandora Repository module to handle images"
dependencies[] = islandora
package = Islandora
core = 7.x
configure = admin/islandora/basic_image
stylesheets[all][] = css/islandora_basic_image.base.css
stylesheets[all][] = css/islandora_basic_image.theme.css

115
islandora_basic_image/islandora_basic_image.install

@ -1,115 +0,0 @@
<?php
/**
* @file
* islandora-basic-image.install
*/
function islandora_basic_image_requirements($phase) {
if($phase == 'install') {
module_load_include('inc', 'islandora', 'includes/tuque');
if(!IslandoraTuque::exists()) {
return array(array(
'title' => 'Tuque',
'description' => 'The Islandora Collection solution pack requires the Tuque library.',
'severity' => REQUIREMENT_ERROR,
));
}
}
}
/**
* Implements hook_install
*/
function islandora_basic_image_install() {
module_load_include('inc', 'islandora', 'includes/tuque');
global $base_root;
try {
$restConnection = new IslandoraTuque();
} catch (Exception $e) {
drupal_set_message(t('Unable to connect to the repository %e', array('%e' => $e)), 'error');
return;
}
$content_model_query = $restConnection->api->a->findObjects('query', 'pid=islandora:sp_basic_image');
if (empty($content_model_query['results'])) {
try {
$xml = file_get_contents(drupal_get_path('module', 'islandora_basic_image') . '/xml/simple_islandora_basic_imageCM.xml');
$restConnection->api->m->ingest(array('string' => $xml));
} catch (Exception $e) {
drupal_set_message(t('Unable to install content models for the basic image module %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(t('Content models for the basic image module installed!'));
}
else {
drupal_set_message(t('Content models for the basic image module already exist!'), 'warning');
}
$collection_query = $restConnection->api->a->findObjects('query', 'pid=islandora:sp_basic_image_collection');
if (empty($collection_query['results'])) {
try {
$xml = file_get_contents(drupal_get_path('module', 'islandora_basic_image') . '/xml/islandora_basic_image_collection.xml');
$restConnection->api->m->ingest(array('string' => $xml));
$fedora_object = new FedoraObject('islandora:sp_basic_image_collection', $restConnection->repository);
$datastream = new NewFedoraDatastream('TN', 'M', $fedora_object, $restConnection->repository);
$file_path = $base_root . '/' . drupal_get_path('module', 'islandora_basic_image') . '/Crystal_Clear_filesystem_folder_grey.png';
$datastream->label = 'Thumbnail';
$datastream->mimetype = 'image/png';
$datastream->setContentFromUrl($file_path);
$fedora_object->ingestDatastream($datastream);
} catch (Exception $e) {
drupal_set_message(t('Unable to install collections for the basic image module %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(t('Collections for the basic image module installed!'));
}
else {
drupal_set_message(t('Collections for the basic image module already exist!'), 'warning');
}
}
/**
* Implements hook_uninstall
*/
function islandora_basic_image_uninstall() {
module_load_include('inc', 'islandora', 'includes/tuque');
global $user;
try {
$restConnection = new IslandoraTuque($user);
} catch (Exception $e) {
drupal_set_message(t('Unable to connect to the repository %e', array('%e' => $e)), 'error');
return;
}
$content_model_query = $restConnection->api->a->findObjects('query', 'pid=islandora:sp_basic_image');
if (!empty($content_model_query['results'])) {
try {
$restConnection->repository->purgeObject('islandora:sp_basic_image');
} catch (Exception $e) {
drupal_set_message(t('Unable to purge content models for the basic image module %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(t('Content models for the basic image module purged!'));
}
else {
drupal_set_message(t('Content models for the basic image module don\'t exist!'), 'warning');
}
$collection_query = $restConnection->api->a->findObjects('query', 'pid=islandora:sp_basic_image_collection');
if (!empty($collection_query['results'])) {
try {
$restConnection->repository->purgeObject('islandora:sp_basic_image_collection');
} catch (Exception $e) {
drupal_set_message(t('Unable to purge collections for the basic image module %e', array('%e' => $e)), 'error');
return;
}
drupal_set_message(t('Collections for the basic image module purged!'));
}
else {
drupal_set_message(t('Collections for the basic image module don\'t exist!'), 'warning');
}
}

231
islandora_basic_image/islandora_basic_image.module

@ -1,231 +0,0 @@
<?php
/*
* @file islandora_basic_image.module
*
* an Islandora module to handle basic image cmodels
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
/**
* Implementation of hook_menu.
* If you need to add secondary tabs to either view or manage you would create a
* hook_menu function similar to below. You would also need to create an access function
* to tell islandora when to show your tabs. There is an example below.
*/
function islandora_basic_image_menu() {
$items = array();
$items['admin/islandora/basic_image'] = array(
'title' => 'Basic Image collection',
'description' => 'Configure the Basic Image solution pack.',
'page callback' => 'drupal_get_form',
'access arguments' => array('administer site configuration'),
'page arguments' => array('islandora_basic_image_admin'),
'file' => 'admin/islandora_basic_image.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
/* example menu paths
$items['islandora/object/%/manage/image'] = array(
'title' => 'Manage Image Types',
'page callback' => 'islandora_basic_image_manage_object',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_image_access',
'access arguments' => array(2),
);
$items['islandora/object/%/view/image'] = array(
'title' => 'Image View 1',
'page callback' => 'islandora_basic_image_view1',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_image_access',
'access arguments' => array(2),
);
$items['islandora/object/%/view/image2'] = array(
'title' => 'Image View 2',
'page callback' => 'islandora_basic_image_view2',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_image_access',
'access arguments' => array(2),
); */
return $items;
}
/**
* an example of adding a new managment section to the manage section of islandora.
* The islandora_basic_image_access function determines whether or not to show this
* section.
*
* This is an example function used by hook_menu above.
* @param string $object_id
* @return string
*/
/*
function islandora_basic_image_manage_object($object_id){
return 'Image CModel edit function '.$object_id;
} */
/**
* /**
* An example function used by hook_menu
* /
* @param type $object_id
* @return string
*/
/*
function islandora_basic_image_view1($object_id){
return 'A view returned by the image cmodel';
} */
/**
* An example function needed by this modules hook_menu
* @param type $object_id
* @return string
*/
/*
function islandora_basic_image_view2($object_id){
return 'Another view returned by the image cmodel';
} */
function islandora_basic_image_init() {
if (path_is_admin(current_path())) {
drupal_add_css(drupal_get_path('module', 'islandora_basic_image') . '/css/islandora_basic_image.admin.css');
}
}
/**
* Theme registry function
* We supply a pattern so we can overide templates at the theme level if needed.
* we can append a pid to a template and the new template file will be called (the pids
* colon should be replaced with a dash)
* @return array
*/
function islandora_basic_image_theme($existing, $type, $theme, $path) {
return array(
'islandora_basic_image_objects' => array(
'template' => 'islandora-basic-image-view-objects',
'variables' => array('islandora_objects' => NULL),
),
'islandora_basic_image' => array(
'template' => 'theme/islandora-basic-image',
'pattern' => 'islandora_basic_image__', //we can add pids to the end of this pattern in our preprocess function
// and templates will be able to have have a pid appended to the template name to overide a template on a per object basis
//an example template would be named islandora-basic-image--islandora-27.tpl.phps
'variables' => array('islandora_object' => NULL),
)
);
}
/**
* tells the main module what types of objects we support. This is used to determine whether or not
* this module should attempt to respond.
* @return array
* array of content model pids that this module supports
*/
function islandora_basic_image_islandora_get_types() {
$types = array();
$types['islandora:sp_basic_image'][ISLANDORA_VIEW_HOOK] = variable_get('islandora_basic_image_use_for_default_tab', TRUE);
//$types['islandora:sp_basic_image'][ISLANDORA_EDIT_HOOK] = FALSE;
return $types;
}
/**
* this modules implentation of view_object hook will handle objects of type islandora:basicImageCModel and islandora:sp_basic_image
* as registered in its return types
* Other modules would handle objects of other types.
* @param Object $object
* a tuque fedora object
* @param object $user
* @param string $page_number
* @param string $page_size
* @return string
* themed html
*/
function islandora_basic_image_islandora_view_object($object, $user, $page_number, $page_size) {
//global $user;
$cmodel_list = islandora_basic_image_islandora_get_types();
$models = $object->models;
foreach ($object->models as $model) {
if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) {
$output = theme('islandora_basic_image', array('islandora_object' => $object));
return array('' => $output);
}
}
return NULL;
}
function islandora_basic_image_islandora_ingest_post_ingest($object) {
$cmodel_list = islandora_basic_image_islandora_get_types();
if(!isset($cmodel_list)){
return ;
}
$models = $object->models;
if(!isset($models)){
return ;
}
foreach ($models as $model) {
if (isset($cmodel_list[$model])) {
module_load_include('inc', 'islandora_basic_image', 'includes/image.process');
islandora_basic_image_create_all_derivatives($object);
}
}
}
/**
*
* @global type $base_url
* @param array $variables
* an array of variables that will be passed to the theme function
*/
function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
drupal_add_js('misc/form.js');
drupal_add_js('misc/collapse.js');
$islandora_object = $variables['islandora_object'];
$repository = $islandora_object->repository;
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
module_load_include('inc', 'islandora', 'includes/datastream');
try {
$dc = $islandora_object['DC']->content;
$dc_object = Dublin_Core::import_from_xml_string($dc);
} catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE);
}
$variables['islandora_dublin_core'] = isset($dc_object) ? $dc_object : NULL;
$variables['dc_array'] = isset($dc_object) ? $dc_object->as_formatted_array() : array();
$variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id);
$variables['parent_collections'] = islandora_datastream_get_parents($islandora_object);
global $base_url;
if (isset($islandora_object['OBJ'])) {
$full_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';
$variables['islandora_full_url'] = $full_size_url;
$variables['islandora_full_img'] = '<img src="' . $full_size_url . '"/>';
}
if (isset($islandora_object['TN'])) {
$thumbnail_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
$variables['islandora_thumbnail_img'] = '<img src="' . $thumbnail_size_url . '"/>';
}
if (isset($islandora_object['MEDIUM_SIZE'])) {
$medium_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM_SIZE/view';
$variables['islandora_medium_img'] = '<img src="' . $medium_size_url . '"/>';
}
}

73
islandora_basic_image/theme/islandora-basic-image.tpl.php

@ -1,73 +0,0 @@
<?php
/*
* islandora-basic-image.tpl.php
*
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php if(isset($islandora_object_label)): ?>
<?php drupal_set_title("$islandora_object_label"); ?>
<?php endif; ?>
<div class="islandora-basic-image-object islandora">
<div class="islandora-basic-image-content-wrapper clearfix">
<?php if(isset($islandora_medium_img)): ?>
<div class="islandora-basic-image-content">
<?php if(isset($islandora_full_url)): ?>
<?php print l($islandora_medium_img, $islandora_full_url, array('html' => TRUE)); ?>
<?php elseif(isset($islandora_medium_img)): ?>
<?php print $islandora_medium_img; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="islandora-basic-image-sidebar">
<?php if(isset($dc_array['dc:description']['value'])): ?>
<h2><?php print $dc_array['dc:description']['label']; ?></h2>
<p><?php print $dc_array['dc:description']['value']; ?></p>
<?php endif; ?>
<?php if($parent_collections): ?>
<div>
<h2>In Collections</h2>
<ul>
<?php foreach($parent_collections as $key => $value): ?>
<li><?php print $value['label_link'] ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
</div>
<fieldset class="collapsible collapsed islandora-basic-image-metadata">
<legend><span class="fieldset-legend">Extended Details</span></legend>
<div class="fieldset-wrapper">
<dl class="islandora-inline-metadata islandora-basic-image-fields">
<?php $row_field = 0; ?>
<?php foreach($dc_array as $key => $value): ?>
<dt class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['label']; ?>
</dt>
<dd class="<?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['value']; ?>
</dd>
<?php $row_field++; ?>
<?php endforeach; ?>
</dl>
</div>
</fieldset>
</div>

818
islandora_basic_image/xml/islandora_basic_imageCM.xml

@ -1,818 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
VERSION="1.1"
PID="islandora:sp_basic_image">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Islandora basic image content model"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2012-04-26T13:37:58.308Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2012-04-26T13:37:58.433Z"/>
</foxml:objectProperties>
<foxml:datastream ID="DS-COMPOSITE-MODEL" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false">
<foxml:datastreamVersion ID="DS-COMPOSITE-MODEL1.0" LABEL="Datastream Composite Model" CREATED="2012-04-26T13:37:58.308Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:FedoraDSCompositeModel-1.0">
<foxml:xmlContent>
<dsCompositeModel xmlns="info:fedora/fedora-system:def/dsCompositeModel#"> <!-- using this as a guide -->
<dsTypeModel ID="DC" >
<form FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" MIME="text/xml"></form>
<extension name="SCHEMA">
<reference type="datastream" value="OAI_DC-SCHEMA"></reference> <!-- I'm thinking that by embedding the required or dependent schema in our cmodels ... when sites like loc.gov go down, the repository will not be effected. -->
</extension>
</dsTypeModel>
<dsTypeModel ID="RELS-EXT" optional="true">
<form FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0" MIME="application/rdf+xml"></form>
</dsTypeModel>
<dsTypeModel ID="RELS-INT" optional="true">
<form FORMAT_URI="info:fedora/fedora-system:FedoraRELSInt-1.0" MIME="application/rdf+xml"></form>
</dsTypeModel>
<dsTypeModel ID="OBJ">
<form MIME="image/jpeg"></form>
<form MIME="image/jpg"></form>
<form MIME="image/png"></form>
<form MIME="image/gif"></form>
</dsTypeModel>
<dsTypeModel ID="MEDIUM_SIZE">
<form MIME="image/jpeg"></form>
</dsTypeModel>
<dsTypeModel ID="TN">
<form MIME="image/jpeg"></form>
</dsTypeModel>
<dsTypeModel ID="MODS"> <!-- this could have a schema too... -->
<form MIME="text/xml"></form>
</dsTypeModel>
<dsTypeModel ID="RULES"> <!-- this is simply an idea about leveraging some of the functionality that may have been in the original ISLANDORACM ds. The ISLANDORACM is still a DS in this cmodel, but that could change ... it references the same schema as the ISLANDORACM so may be totally redundent -->
<form MIME="text/xml" />
<extension name="SCHEMA">
<reference type="datastream" value="RULES"></reference>
</extension>
</dsTypeModel>
<dsTypeModel ID="ISLANDORACM">
<form MIME="text/xml" /> <!-- this could get the schema treatment instead of the RULES ds -->
</dsTypeModel>
</dsCompositeModel>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2012-04-26T13:37:58.308Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="412">
<foxml:xmlContent>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Islandora basic image content model</dc:title>
<dc:identifier>islandora:sp_basic_image</dc:identifier>
</oai_dc:dc>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2012-04-26T13:37:58.396Z" MIMETYPE="text/xml" SIZE="297">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:sp_basic_image">
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/fedora-system:ContentModel-3.0"></hasModel>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="ISLANDORACM" STATE="A" CONTROL_GROUP="M" VERSIONABLE="true"> <!-- should the ISLANDORACM be a managed DS ? -->
<foxml:datastreamVersion ID="ISLANDORACM.0" LABEL="ISLANDORACM" CREATED="2012-04-26T13:37:58.433Z" MIMETYPE="text/xml" SIZE="5745">
<foxml:contentLocation TYPE="INTERNAL_ID" REF="islandora:sp_basic_image+ISLANDORACM+ISLANDORACM.0"/>
</foxml:datastreamVersion>
</foxml:datastream>
<!--The DC_SCHEMA datastream, referred from the DS_COMPOSITE datastream -->
<foxml:datastream
CONTROL_GROUP="X"
ID="DC_SCHEMA"
STATE="A"
VERSIONABLE="false">
<foxml:datastreamVersion
ID="SCHEMA.0"
LABEL="Schema"
MIMETYPE="text/xml">
<foxml:xmlContent>
<!--This is just the direct input of the
oai_dc schema-->
<schema targetNamespace="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<annotation>
<documentation>
XML Schema 2002-03-18 by Pete Johnston.
Adjusted for usage in the OAI-PMH.
Schema imports the Dublin Core elements from the DCMI schema for unqualified Dublin Core.
2002-12-19 updated to use simpledc20021212.xsd (instead of simpledc20020312.xsd)
</documentation>
</annotation>
<!-- The issue with embedded schemas may be a breaker - dm -->
<!--Xml schema does not allow for embedding schemas inside
other schemas, as everything in a schema share the same
targetNamespace, you have to use import to refer to schemas
for other namespaces. But there is no functional shorthand
in fedora to refer to "this object", so you have to use
the full repository url. This is nasty, and we are working
on a workaround -->
<import namespace="http://purl.org/dc/elements/1.1/"
schemaLocation="http://localhost:8080/fedora/get/doms:ContentModel_Sample/DC_ELEMENTS"/>
<element name="dc" type="oai_dc:oai_dcType"/>
<complexType name="oai_dcType">
<sequence>
<element minOccurs="1" ref="dc:title"/>
<element maxOccurs="unbounded" minOccurs="0" ref="dc:identifier"/>
<element minOccurs="0" ref="dc:creator"/>
<element minOccurs="0" ref="dc:subject"/>
<element minOccurs="0" ref="dc:description"/>
<element minOccurs="0" ref="dc:publisher"/>
<element minOccurs="0" ref="dc:contributor"/>
<element minOccurs="0" ref="dc:date"/>
<element minOccurs="0" ref="dc:type"/>
<element minOccurs="0" ref="dc:format"/>
<element minOccurs="0" ref="dc:source"/>
<element minOccurs="0" ref="dc:language"/>
<element minOccurs="0" ref="dc:relation"/>
<element minOccurs="0" ref="dc:coverage"/>
<element minOccurs="0" ref="dc:rights"/>
</sequence>
</complexType>
</schema>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<!--Referred from the DC_SCHEMA datastream.-->
<foxml:datastream
CONTROL_GROUP="X"
ID="DC_ELEMENTS"
STATE="A"
VERSIONABLE="false">
<foxml:datastreamVersion
ID="DC_ELEMENTS.0"
LABEL="Schema"
MIMETYPE="text/xml">
<foxml:xmlContent>
<!--Just a direct paste of the DC_ELEMENTS schema-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://purl.org/dc/elements/1.1/"
targetNamespace="http://purl.org/dc/elements/1.1/"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
Simple DC XML Schema, 2002-10-09
by Pete Johnston (p.johnston@ukoln.ac.uk),
Carl Lagoze (lagoze@cs.cornell.edu), Andy Powell (a.powell@ukoln.ac.uk),
Herbert Van de Sompel (hvdsomp@yahoo.com).
This schema defines terms for Simple Dublin Core, i.e. the 15
elements from the http://purl.org/dc/elements/1.1/ namespace, with
no use of encoding schemes or element refinements.
Default content type for all elements is xs:string with xml:lang
attribute available.
Supercedes version of 2002-03-12.
Amended to remove namespace declaration for http://www.w3.org/XML/1998/namespace namespace,
and to reference lang attribute via built-in xml: namespace prefix.
xs:appinfo also removed.
</xs:documentation>
</xs:annotation>
<!--Xml schema does not allow for embedding schemas inside
other schemas, as everything in a schema share the same
targetNamespace, you have to use import to refer to schemas
for other namespaces. But there is no functional shorthand
in fedora to refer to "this object", so you have to use
the full repository url. This is nasty, and we are working
on a workaround-->
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://localhost:8080/fedora/get/doms:ContentModel_Sample/NAMESPACE">
</xs:import>
<xs:complexType name="SimpleLiteral">
<xs:annotation>
<xs:documentation xml:lang="en">
This is the default type for all of the DC elements.
It permits text content only with optional
xml:lang attribute.
Text is allowed because mixed="true", but sub-elements
are disallowed because minOccurs="0" and maxOccurs="0"
are on the xs:any tag.
This complexType allows for restriction or extension permitting
child elements.
</xs:documentation>
</xs:annotation>
<xs:complexContent mixed="true">
<xs:restriction base="xs:anyType">
<xs:sequence>
<xs:any processContents="lax" minOccurs="0" maxOccurs="0"/>
</xs:sequence>
<xs:attribute ref="xml:lang" use="optional"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="any" type="SimpleLiteral" abstract="true"/>
<xs:element name="title" substitutionGroup="any"/>
<xs:element name="creator" substitutionGroup="any"/>
<xs:element name="subject" substitutionGroup="any"/>
<xs:element name="description" substitutionGroup="any"/>
<xs:element name="publisher" substitutionGroup="any"/>
<xs:element name="contributor" substitutionGroup="any"/>
<xs:element name="date" substitutionGroup="any"/>
<xs:element name="type" substitutionGroup="any"/>
<xs:element name="format" substitutionGroup="any"/>
<xs:element name="identifier" substitutionGroup="any">
<xs:annotation>
<xs:appinfo source="http://doms.statsbiblioteket.dk/gui">invisible</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="source" substitutionGroup="any"/>
<xs:element name="language" substitutionGroup="any"/>
<xs:element name="relation" substitutionGroup="any"/>
<xs:element name="coverage" substitutionGroup="any"/>
<xs:element name="rights" substitutionGroup="any"/>
<xs:group name="elementsGroup">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="title"/>
<xs:element ref="creator"/>
<xs:element ref="subject"/>
<xs:element ref="description"/>
<xs:element ref="publisher"/>
<xs:element ref="contributor"/>
<xs:element ref="date"/>
<xs:element ref="type"/>
<xs:element ref="format"/>
<xs:element ref="identifier"/>
<xs:element ref="source"/>
<xs:element ref="language"/>
<xs:element ref="relation"/>
<xs:element ref="coverage"/>
<xs:element ref="rights"/>
</xs:choice>
</xs:sequence>
</xs:group>
<xs:simpleType name="dcmiType">
<xs:restriction base="xs:string">
<xs:enumeration value='Collection'/>
<xs:enumeration value='Dataset'/>
<xs:enumeration value='Event'/>
<xs:enumeration value='Image'/>
<xs:enumeration value='InteractiveResource'/>
<xs:enumeration value='MovingImage'/>
<xs:enumeration value='PhysicalObject'/>
<xs:enumeration value='Service'/>
<xs:enumeration value='Software'/>
<xs:enumeration value='Sound'/>
<xs:enumeration value='StillImage'/>
<xs:enumeration value='Text'/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<!--Schema datastream referred from the DC_ELEMENTS datastream -->
<foxml:datastream
CONTROL_GROUP="X"
ID="NAMESPACE"
STATE="A"
VERSIONABLE="false">
<foxml:datastreamVersion
ID="NAMESPACE.0"
LABEL="Schema"
MIMETYPE="text/xml">
<foxml:xmlContent>
<!--Just a direct paste of the Namespace schema-->
<xs:schema
targetNamespace="http://www.w3.org/XML/1998/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xml:lang="en">
<xs:annotation>
<xs:documentation>
See http://www.w3.org/XML/1998/namespace.html and
http://www.w3.org/TR/REC-xml for information about this namespace.
This schema document describes the XML namespace, in a form
suitable for import by other schema documents.
Note that local names in this namespace are intended to be defined
only by the World Wide Web Consortium or its subgroups. The
following names are currently defined in this namespace and should
not be used with conflicting semantics by any Working Group,
specification, or document instance:
base (as an attribute name): denotes an attribute whose value
provides a URI to be used as the base for interpreting any
relative URIs in the scope of the element on which it
appears; its value is inherited. This name is reserved
by virtue of its definition in the XML Base specification.
lang (as an attribute name): denotes an attribute whose value
is a language code for the natural language of the content of
any element; its value is inherited. This name is reserved
by virtue of its definition in the XML specification.
space (as an attribute name): denotes an attribute whose
value is a keyword indicating what whitespace processing
discipline is intended for the content of the element; its
value is inherited. This name is reserved by virtue of its
definition in the XML specification.
Father (in any context at all): denotes Jon Bosak, the chair of
the original XML Working Group. This name is reserved by
the following decision of the W3C XML Plenary and
XML Coordination groups:
In appreciation for his vision, leadership and dedication
the W3C XML Plenary on this 10th day of February, 2000
reserves for Jon Bosak in perpetuity the XML name
xml:Father
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>In keeping with the XML Schema WG's standard versioning
policy, this schema document will persist at
http://www.w3.org/2001/03/xml.xsd.
At the date of issue it can also be found at
http://www.w3.org/2001/xml.xsd.
The schema document at that URI may however change in the future,
in order to remain compatible with the latest version of XML Schema
itself. In other words, if the XML Schema namespace changes, the version
of this document at
http://www.w3.org/2001/xml.xsd will change
accordingly; the version at
http://www.w3.org/2001/03/xml.xsd will not change.
</xs:documentation>
</xs:annotation>
<xs:attribute name="lang" type="xs:language">
<xs:annotation>
<xs:documentation>In due course, we should install the relevant ISO 2- and 3-letter
codes as the enumerated possible values . . .</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="space" default="preserve">
<xs:simpleType>
<xs:restriction base="xs:NCName">
<xs:enumeration value="default"/>
<xs:enumeration value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="base" type="xs:anyURI">
<xs:annotation>
<xs:documentation>See http://www.w3.org/TR/xmlbase/ for
information about this attribute.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup name="specialAttrs">
<xs:attribute ref="xml:base"/>
<xs:attribute ref="xml:lang"/>
<xs:attribute ref="xml:space"/>
</xs:attributeGroup>
</xs:schema>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<!-- The RULES ds referred to by the DS-COMPOSITE-MODEL -->
<foxml:datastream
CONTROL_GROUP="X"
ID="RULES"
STATE="A"
VERSIONABLE="false">
<foxml:datastreamVersion
ID="RULES.0"
LABEL="Schema"
MIMETYPE="text/xml">
<foxml:xmlContent>
<!--This is pulled from https://raw.github.com/Islandora/islandora/6.x/islandoracm.xsd -->
<schema xmlns="http://www.islandora.ca" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.islandora.ca" elementFormDefault="qualified">
<annotation>
<documentation xml:lang="en">
Islandora Content Model Schema
Islandora, Robertson Library, University of Prince Edward Island, 550 University Ave., Charlottetown, Prince Edward Island
</documentation>
</annotation>
<element name="content_model" type="content_modelType"/>
<complexType name="content_modelType">
<all>
<element name="mimetypes" type="mimetypesType"/>
<element name="ingest_form" type="ingest_formType"/>
<element name="datastreams" type="datastreamsType" minOccurs="0"/>
<element name="ingest_rules" type="ingest_rulesType"/>
<element name="edit_metadata_method" type="edit_metadata_methodType" minOccurs="0"/>
<element name="forms">
<complexType>
<sequence>
<element maxOccurs="unbounded" minOccurs="1" name="form" type="formType"
/>
</sequence>
</complexType>
</element>
</all>
<attribute name="name" type="normalizedString" use="required"/>
</complexType>
<complexType name="mimetypesType">
<sequence>
<element name="type" type="string" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="ingest_formType">
<all>
<element name="form_builder_method" type="form_builder_methodType"/>
<element name="form_elements" type="form_elementsType"/>
</all>
<attribute name="dsid" type="normalizedString" use="required"/>
<attribute name="page" type="positiveInteger" use="required"/>
<attribute name="hide_file_chooser" type="boolean" default="false"/>
<attribute name="redirect" type="boolean" default="true"/>
</complexType>
<complexType name="form_builder_methodType">
<attribute name="file" type="normalizedString" use="required"/>
<attribute name="module" type="normalizedString" default="fedora_repository"/>
<attribute name="class" type="normalizedString" use="required"/>
<attribute name="method" type="normalizedString" use="required"/>
<attribute name="handler" type="normalizedString" use="required"/>
</complexType>
<complexType name="edit_metadata_methodType">
<attribute name="file" type="normalizedString" use="required"/>
<attribute name="module" type="normalizedString" default="fedora_repository"/>
<attribute name="class" type="normalizedString" use="required"/>
<attribute name="method" type="normalizedString" use="required"/>
<attribute name="handler" type="normalizedString" use="required"/>
<attribute name="dsid" type="normalizedString" use="required"/>
</complexType>
<complexType name="form_elementsType">
<sequence>
<element name="element" type="elementType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="elementType">
<all>
<element name="description" type="string" minOccurs="0"/>
<element name="authoritative_list" type="authoritative_listType" minOccurs="0"/>
<element name="parameters" type="parametersType" minOccurs="0"/>
</all>
<attribute name="label" type="normalizedString"/>
<attribute name="name" type="normalizedString" use="required"/>
<attribute name="type" type="normalizedString" use="required"/>
<attribute name="required" type="boolean" default="false"/>
</complexType>
<complexType name="authoritative_listType">
<sequence>
<element name="item" type="itemType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="itemType">
<simpleContent>
<extension base="string">
<attribute name="field" type="string" use="optional"/>
</extension>
</simpleContent>
</complexType>
<complexType name="ingest_rulesType">
<sequence>
<element name="rule" type="ruleType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="ruleType">
<sequence>
<element name="applies_to" type="normalizedString" minOccurs="1"
maxOccurs="unbounded"/>
<element name="ingest_methods" type="ingest_methodsType" minOccurs="0"/>
</sequence>
</complexType>
<complexType name="ingest_methodsType">
<sequence>
<element name="ingest_method" type="ingest_methodType" minOccurs="1"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="ingest_methodType">
<all>
<element name="parameters" type="parametersType" minOccurs="0"/>
</all>
<attribute name="file" type="normalizedString" use="required"/>
<attribute name="module" type="normalizedString" default="fedora_repository"/>
<attribute name="class" type="normalizedString" use="required"/>
<attribute name="method" type="normalizedString" use="required"/>
<attribute name="dsid" type="normalizedString" use="required"/>
<attribute name="modified_files_ext" type="normalizedString" use="required"/>
</complexType>
<complexType name="datastreamsType">
<sequence>
<element name="datastream" type="datastreamType" minOccurs="1" maxOccurs="unbounded"
/>
</sequence>
</complexType>
<complexType name="datastreamType">
<sequence>
<element name="display_method" type="display_methodType" minOccurs="0"
maxOccurs="unbounded"/>
<element name="add_datastream_method" type="add_datastream_methodType" minOccurs="0"
maxOccurs="1"/>
</sequence>
<attribute name="dsid" type="normalizedString" use="required"/>
<attribute name="display_in_fieldset" type="boolean" default="true"/>
</complexType>
<complexType name="add_datastream_methodType">
<all>
<element name="parameters" type="parametersType" minOccurs="0"/>
</all>
<attribute name="file" type="normalizedString" use="required"/>
<attribute name="module" type="normalizedString" default="fedora_repository"/>
<attribute name="class" type="normalizedString" use="required"/>
<attribute name="method" type="normalizedString" use="required"/>
<attribute name="dsid" type="normalizedString" use="required"/>
<attribute name="modified_files_ext" type="normalizedString" use="required"/>
</complexType>
<complexType name="parametersType">
<sequence>
<element name="parameter" type="parameterType" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="parameterType">
<simpleContent>
<extension base="string">
<attribute name="name" type="normalizedString" use="required"/>
</extension>
</simpleContent>
</complexType>
<complexType name="display_methodType">
<complexContent>
<restriction base="anyType">
<attribute name="file" type="normalizedString" use="required"/>
<attribute name="module" type="normalizedString" default="fedora_repository"/>
<attribute name="class" type="normalizedString" use="required"/>
<attribute name="method" type="normalizedString" use="required"/>
<attribute name="default" type="boolean" default="false"/>
</restriction>
</complexContent>
</complexType>
<complexType name="formType">
<complexContent>
<extension base="formElementType">
<attribute name="name" type="normalizedString" use="required"/>
<attribute name="dsid" type="normalizedString" use="required"/>
<attribute name="ingest_module" type="normalizedString"/>
<attribute name="ingest_file" type="normalizedString"/>
<attribute name="ingest_class" type="normalizedString"/>
<attribute name="edit_module" type="normalizedString" use="optional"/>
<attribute name="edit_file" type="normalizedString" use="optional"/>
<attribute name="edit_class" type="normalizedString" use="optional"/>
<attribute name="document_module" type="normalizedString" use="required"/>
<attribute name="document_file" type="normalizedString" use="required"/>
<attribute name="document_class" type="normalizedString" use="required"/>
</extension>
</complexContent>
</complexType>
<complexType name="formElementType">
<choice maxOccurs="unbounded" minOccurs="0">
<element maxOccurs="1" minOccurs="1" name="fieldset">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element default="true" minOccurs="0" name="collapsible"
type="boolean"/>
<element default="false" minOccurs="0" name="collapsed"
type="boolean"/>
<element name="content" type="formElementType"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element name="textfield">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element minOccurs="0" name="required" type="boolean"/>
<element minOccurs="0" name="default_value" type="normalizedString"/>
<element minOccurs="0" name="autocomplete_path"
type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element minOccurs="1" name="textarea">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element minOccurs="0" name="required" type="boolean"/>
<element minOccurs="0" name="default_value" type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element maxOccurs="1" minOccurs="1" name="select">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element name="options" type="formControlOptionsType"/>
<element minOccurs="0" name="required" type="boolean"/>
<element minOccurs="0" name="default_value" type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element minOccurs="1" name="set">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element minOccurs="0" name="required" type="boolean"/>
<element minOccurs="0" name="default_value" type="normalizedString"/>
<element minOccurs="0" name="autocomplete_path"
type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element minOccurs="1" name="filechooser">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element minOccurs="0" name="required" type="boolean"/>
<element minOccurs="0" name="default_value" type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element minOccurs="1" name="datepicker">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element minOccurs="0" name="required" type="boolean"/>
<element minOccurs="0" name="default_value" type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element maxOccurs="1" minOccurs="1" name="tabpanel">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element default="true" minOccurs="0" name="collapsible"
type="boolean"/>
<element default="false" minOccurs="0" name="collapsed"
type="boolean"/>
<element name="content" type="formElementType"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element name="checkbox">
<complexType>
<all maxOccurs="1" minOccurs="1">
<element name="title" type="normalizedString"/>
<element minOccurs="0" name="description" type="normalizedString"/>
<element name="return_value" type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</all>
</complexType>
</element>
<element minOccurs="1" name="hidden">
<complexType>
<all>
<element minOccurs="1" name="value" type="normalizedString"/>
<element minOccurs="0" name="form_builder" type="formBuilderControlType"/>
<element minOccurs="0" name="content" type="formElementType"/>
</all>
</complexType>
</element>
</choice>
</complexType>
<complexType name="formControlXPathType">
<simpleContent>
<extension base="normalizedString">
<attribute name="full_path" type="boolean"/>
</extension>
</simpleContent>
</complexType>
<complexType name="formControlElementValidateType">
<complexContent>
<extension base="array"/>
</complexContent>
</complexType>
<complexType name="array">
<sequence>
<element maxOccurs="unbounded" name="item" type="normalizedString"/>
</sequence>
</complexType>
<complexType name="formControlOptionsType">
<sequence>
<element maxOccurs="unbounded" name="option" type="normalizedString"/>
</sequence>
<attribute name="ignoreFirstOption" type="boolean" use="required"/>
</complexType>
<complexType name="formBuilderControlType">
<sequence>
<element name="xpath">
<complexType>
<sequence>
<element name="path">
<complexType>
<simpleContent>
<extension base="normalizedString">
<attribute name="full" type="boolean" use="required"
/>
</extension>
</simpleContent>
</complexType>
</element>
<element name="parent_path" minOccurs="0">
<complexType>
<simpleContent>
<extension base="normalizedString"> </extension>
</simpleContent>
</complexType>
</element>
<choice>
<element name="xml" type="normalizedString"/>
<element name="element" type="normalizedString"/>
<element name="attribute" type="normalizedString"/>
</choice>
</sequence>
</complexType>
</element>
<element name="require_value" type="boolean"/>
</sequence>
</complexType>
</schema>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject>

48
islandora_basic_image/xml/islandora_basic_image_collection.xml

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="islandora:sp_basic_image_collection"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Islandora Basic Image Collection"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2011-09-16T16:49:44.530Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2011-09-16T16:49:45.066Z"/>
</foxml:objectProperties>
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2011-09-16T16:49:44.530Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="420">
<foxml:xmlContent>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Islandora Basic Image Collection</dc:title>
<dc:identifier>islandora:sp_basic_image_collection</dc:identifier>
</oai_dc:dc>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2011-09-16T16:49:44.895Z" MIMETYPE="text/xml" SIZE="453">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:sp_basic_image_collection">
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/islandora:collectionCModel"></hasModel>
<isMemberOfCollection xmlns="info:fedora/fedora-system:def/relations-external#" rdf:resource="info:fedora/islandora:root"></isMemberOfCollection>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="COLLECTION_POLICY" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="COLLECTION_POLICY.0" LABEL="Collection policy" CREATED="2012-05-24T14:31:59.202Z" MIMETYPE="text/xml" SIZE="507">
<foxml:xmlContent>
<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Islandora Image Collection" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
<content_models>
<content_model dsid="ISLANDORACM" name="New Image" namespace="islandora:1" pid="islandora:sp_basic_image"></content_model>
</content_models>
<search_terms></search_terms>
<relationship>isMemberOfCollection</relationship>
</collection_policy>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject>

11
islandora_basic_image/xml/islandora_basic_image_collection_policy.xml

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<collection_policy xmlns="http://www.islandora.ca"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Islandora Image Collection"
xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
<content_models>
<content_model dsid="ISLANDORACM" name="New Image" namespace="islandora:1"
pid="islandora:sp_basic_image"/>
</content_models>
<search_terms/>
<relationship>isMemberOfCollection</relationship>
</collection_policy>

67
islandora_basic_image/xml/simple_islandora_basic_imageCM.xml

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
VERSION="1.1"
PID="islandora:sp_basic_image">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Islandora basic image content model"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2012-04-26T13:37:58.308Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2012-04-26T13:37:58.433Z"/>
</foxml:objectProperties>
<foxml:datastream ID="DS-COMPOSITE-MODEL" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false">
<foxml:datastreamVersion ID="DS-COMPOSITE-MODEL1.0" LABEL="Datastream Composite Model" CREATED="2012-04-26T13:37:58.308Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:FedoraDSCompositeModel-1.0">
<foxml:xmlContent>
<dsCompositeModel xmlns="info:fedora/fedora-system:def/dsCompositeModel#"> <!-- using this as a guide -->
<dsTypeModel ID="DC" >
<form FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" MIME="text/xml"></form>
</dsTypeModel>
<dsTypeModel ID="RELS-EXT" optional="true">
<form FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0" MIME="application/rdf+xml"></form>
</dsTypeModel>
<dsTypeModel ID="RELS-INT" optional="true">
<form FORMAT_URI="info:fedora/fedora-system:FedoraRELSInt-1.0" MIME="application/rdf+xml"></form>
</dsTypeModel>
<dsTypeModel ID="OBJ">
<form MIME="image/jpeg"></form>
<form MIME="image/jpg"></form>
<form MIME="image/png"></form>
<form MIME="image/gif"></form>
</dsTypeModel>
<dsTypeModel ID="MEDIUM_SIZE">
<form MIME="image/jpeg"></form>
</dsTypeModel>
<dsTypeModel ID="TN">
<form MIME="image/jpeg"></form>
</dsTypeModel>
<dsTypeModel ID="MODS">
<form MIME="text/xml"></form>
</dsTypeModel>
</dsCompositeModel>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2012-04-26T13:37:58.308Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="412">
<foxml:xmlContent>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Islandora basic image content model</dc:title>
<dc:identifier>islandora:sp_basic_image</dc:identifier>
</oai_dc:dc>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2012-04-26T13:37:58.396Z" MIMETYPE="text/xml" SIZE="297">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:sp_basic_image">
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/fedora-system:ContentModel-3.0"></hasModel>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject>
Loading…
Cancel
Save