Browse Source

Merge branch '7.x' of github.com:Islandora/islandora into 7.x

pull/114/head
Paul Pound 13 years ago
parent
commit
dfc6017287
  1. 74
      css/islandora.theme.css
  2. 67
      islandora-object.tpl.php
  3. 6
      islandora.module
  4. 38
      islandora_basic_collection/css/islandora_basic_collection.theme.css
  5. 109
      islandora_basic_collection/includes/ChildCollection.inc
  6. 564
      islandora_basic_collection/includes/CollectionManagement.inc
  7. 113
      islandora_basic_collection/includes/CollectionManagerTable.inc
  8. 104
      islandora_basic_collection/includes/DeleteCollection.inc
  9. 61
      islandora_basic_collection/includes/ManagePolicies.inc
  10. 57
      islandora_basic_collection/includes/MoveCollection.inc
  11. 9
      islandora_basic_collection/islandora-basic-collection.tpl.php
  12. 82
      islandora_basic_collection/islandora_basic_collection.module
  13. 36
      islandora_basic_image/css/islandora_basic_image.theme.css
  14. 52
      islandora_basic_image/islandora-basic-image--islandora-27.tpl.php
  15. 35
      islandora_basic_image/islandora-basic-image.tpl.php
  16. 4
      islandora_basic_image/islandora_basic_image.module

74
css/islandora.theme.css

@ -5,4 +5,78 @@
Purpose of the stylesheet follows.
*/
/*
* Thumbnails float optionally to the left or right of descriptive lists.
*/
.islandora-object-thumb img {
max-width: 100%;
*width: 100%;
}
dl.islandora-object-thumb {
float: left;
width: 15%;
margin: 0.75em auto;
}
.islandora-object-thumb dt,
.islandora-object-thumb dd {
margin: 0;
}
/*
* These rules will display DTs/DDs as columns.
* Constructs must follow a key/value pair pattern.
* The three last declarations are meant to kill white space between DTs/DDs
* (result of inline-block styling)
*/
dl.islandora-object-fields {
float: right;
width:83%;
margin: 0.75em auto;
letter-spacing:-0.34em;
*letter-spacing:normal;
word-spacing:-0.44em;
border-top:3px solid #ddd;
}
/*
* The width + left/right padding of DTs/DDs equals 88% when compensating for an image
*/
.islandora-object-fields dt {
margin-right:-1px;
width:22.5%;
font-weight: bold;
}
.islandora-object-fields dd {
width:67%;
}
/*
* In this rule, we reset the white-space (see hack above)
*/
.islandora-object-fields dt,
.islandora-object-fields dd {
display:inline-block;
*display:inline;
zoom:1;
letter-spacing:normal;
word-spacing:normal;
vertical-align:top;
padding:6px 2% 4px;
margin:0;
border-top:1px solid #ddd;
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word; /* webkit */
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
.islandora-object-fields dt.first,
.islandora-object-fields dd.first {
border-top: 0;
}

67
islandora-object.tpl.php

@ -46,29 +46,48 @@
//dsm($object);
drupal_set_title($islandora_object->label);
$dublin_core = $variables['islandora_dublin_core'];
print($islandora_object->label . ' ' . $islandora_object->id);
print ('<h3>datastreams</h3>');
foreach ($islandora_object as $ds) {
print $ds->label . '<br>';
//do something
}
print('<h3>Dublin Core</h3>');
// $dublin_core = $variables['islandora_dublin_core'];
// print($islandora_object->label . ' ' . $islandora_object->id);
// print ('<h3>datastreams</h3>');
// foreach ($islandora_object as $ds) {
// print $ds->label . '<br>';
// //do something
// }
// print('<h3>Dublin Core</h3>');
foreach ($dublin_core as $element) {
if (!empty($element)) {
// print($element);
foreach ($element as $key => $value) {
foreach($value as $v){
if(!empty($v)){
print '<strong>'.($key).'</strong>: ';print($v).'<br />';
}
}
}
}
}
if(isset($variables['islandora_thumbnail_url'])){
print('<img src = "'.$variables['islandora_thumbnail_url'].'"/>');
}
?>
// foreach ($dublin_core as $element) {
// if (!empty($element)) {
// // print($element);
// foreach ($element as $key => $value) {
// foreach($value as $v){
// if(!empty($v)){
// print '<strong>'.($key).'</strong>: ';print($v).'<br />';
// }
// }
// }
// }
// }
?>
<div class="islandora-object">
<h2>Details</h2>
<dl class="islandora-object-thumb">
<dt>
<?php if(isset($variables['islandora_thumbnail_url'])): ?>
<?php print('<img src = "'.$variables['islandora_thumbnail_url'].'"/>'); ?></dt>
<?php endif; ?>
<dd></dd>
</dl>
<dl class="islandora-object-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>

6
islandora.module

@ -108,7 +108,7 @@ function islandora_menu() {
'access arguments' => array(FEDORA_VIEW),
);
/*
$items['islandora/object/%/add'] = array(
'title' => 'Add to an object',
//'file' => 'includes/add-menu.inc',
@ -117,6 +117,7 @@ function islandora_menu() {
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FEDORA_ADD_DS)
);
*/
$items['islandora/object/%/view'] = array(
'title' => 'View',
@ -430,7 +431,7 @@ function islandora_purge_datastream($object_id, $datastream_id) {
function islandora_view_default_object() {
$pid = variable_get('islandora_repository_pid', 'islandora:root');
return islandora_view_object($pid);
drupal_goto("islandora/object/$pid");
}
/**
@ -576,6 +577,7 @@ function islandora_preprocess_islandora_default(&$variables) {
} catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error');
}
$variables['dc_array'] = $dc_object->as_formatted_array();
$variables['islandora_dublin_core'] = $dc_object;
$variables['islandora_object_label'] = $islandora_object->label;
global $base_url;

38
islandora_basic_collection/css/islandora_basic_collection.theme.css

@ -5,32 +5,36 @@
Purpose of the stylesheet follows.
*/
/* islandora-basic-collection STYLES*/
.islandora-basic-collection {
margin: 2% auto;
overflow: hidden;
width: 96%;
margin: 1.5em auto;
overflow: hidden;
width: 96%;
}
dl.islandora-basic-collection-object
{
float: left;
margin: 2% 2% 50px;
width: 20%;
height: 180px;
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-object dt img {
max-width: 100%;
*width: 100%;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
max-width: 100%;
*width: 100%;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.islandora-basic-collection-object dd
{
margin: 0;
padding: 0;
}
margin: 0;
padding: 0;
}

109
islandora_basic_collection/includes/ChildCollection.inc

@ -0,0 +1,109 @@
<?php
function islandora_create_child_collection_form($form, &$form_state, $this_collection_pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
$restricted = FALSE;
if (variable_get('fedora_namespace_restriction_enforced', TRUE)) {
$restricted = TRUE;
$allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
foreach ($namespaces as $namespace) {
if ($namespace) {
$allowed[trim($namespace)] = trim($namespace);
}
}
}
$collection_namespace = substr($this_collection_pid, 0, strpos($this_collection_pid, ":"));
$form['child_creation']['titlebox'] = array(
'#markup' => t("Create New Child Collection within @collection", array('@collection' => $this_collection_pid)),
);
$form['child_creation']['collection_name'] = array(
'#title' => "Collection Name",
'#type' => 'textfield',
'#description' => t("Human readable name for this collection"),
);
$form['child_creation']['new_collection_pid'] = array(
'#title' => "Collection PID",
'#type' => 'textfield',
'#size' => 15,
'#default_value' => $restConnection->repository->api->m->getNextPid($collection_namespace),
'#description' => t("Unique PID for this collection. <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' => $this_collection_pid,
);
$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) {
}
function islandora_create_child_collection_form_submit($form, &$form_state) {
global $base_root;
module_load_include('inc', 'islandora', '/includes/islandora.ingest');
$thumbnail = $base_root . '/' . drupal_get_path('module', 'islandora_basic_collection') . '/Crystal_Clear_filesystem_folder_grey.png';
$new_collection_pid = $form_state['values']['new_collection_pid'];
$new_collection_label = $form_state['values']['collection_name'];
$namespace = $form_state['values']['collection_namespace'];
// $all_cModels = get_content_models_as_option_array();
$content_models = array('islandora:collectionCModel');
$relationship = array(
'uri' => FEDORA_RELS_EXT_URI,
'value' => 'isMemberOfCollection',
);
$fedora_object = islandora_ingest_get_object($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);
$new_fedora_object = islandora_ingest_add_object($fedora_object);
// $content_models = $form_state['values']['content_models'];
// $collection_policy_xml = simplexml_load_string($collection_policy);
// foreach ($content_models as $content_model) {
// if ($content_model) {
// $node = $collection_policy_xml->content_models->addChild('content_model');
// $node->addAttribute('dsid', 'ISLANDORACM');
// $node->addAttribute('name', $all_cModels[$content_model]);
// $node->addAttribute('namespace', $pid_namespace . ':1');
// $node->addAttribute('pid', $content_model);
// }
// }
drupal_goto('/islandora/object/' . $new_collection_pid);
}

564
islandora_basic_collection/includes/CollectionManagement.inc

@ -0,0 +1,564 @@
<?php
/**
* collection creation form
* @param array $form_state
* @param string $parent_collection_pid
* @param string $content_models
* @return array
*/
function collection_management_form($this_collection_pid, $content_models) {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
$restricted = FALSE;
if (variable_get('fedora_namespace_restriction_enforced', TRUE)) {
$restricted = TRUE;
$allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
foreach ($namespaces as $namespace) {
if ($namespace) {
$allowed[trim($namespace)] = trim($namespace);
}
}
}
$collection_policy = CollectionPolicy::loadFromCollection($this_collection_pid);
if ($collection_policy) {
$supported_collection_models = $collection_policy->getContentModels();
}
$collection_namespace = substr($this_collection_pid, 0, strpos($this_collection_pid, ":"));
$represented_content_models = get_represented_content_models($this_collection_pid);
$item = new Fedora_Item($this_collection_pid);
$collection_name = $item->objectProfile->objLabel;
$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;
}
}
$cm_options = array();
$name_mappings = array();
foreach ($content_models as $content_model) {
if ($content_model->pid != "islandora:collectionCModel") {
$item = new fedora_item($content_model->pid);
$cm_name = $item->objectProfile->objLabel;
$cm_options[$content_model->pid] = $cm_name;
}
}
if (!empty($current_models_in_policy)) {
$show_delete = TRUE;
}
$content_models = get_content_models_as_option_array();
unset($content_models['islandora:collectionCModel']);
$form['child_creation'] = array(
'#title' => "Create Child Collection",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['child_creation']['titlebox'] = array(
'#type' => 'item',
'#value' => t("Create New Child Collection within $this_collection_pid"),
);
$form['child_creation']['collection_name'] = array(
'#title' => "Collection Name",
'#type' => 'textfield',
'#description' => t("Human readable name for this collection"),
);
$form['child_creation']['new_collection_pid'] = array(
'#title' => "Collection PID",
'#type' => 'textfield',
'#size' => 15,
'#default_value' => Fedora_Item::get_next_PID_in_namespace($collection_namespace),
'#description' => t("Unique PID for this collection. <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['parent_collection'] = array(
'#type' => 'hidden',
'#value' => $this_collection_pid,
);
$form['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $this_collection_pid,
);
$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'
);
$form['manage_collection_policy'] = array(
'#title' => "Manage Collection Policies",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['manage_collection_policy']['add'] = array(
'#title' => "Add Content Model to Collection Policy",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => $show_delete,
);
$new_options = array();
if (is_array($content_models) && is_array($cm_options)) {
$new_options = array_diff_key($content_models, $cm_options);
}
$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' => $collection_namespace,
'#description' => t("Choose namespace for objects in this collection associated with this content model"),
);
$form['manage_collection_policy']['add']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add Content Model to Collection Policy'),
'#id' => 'add_cm'
);
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 From Collection Policy'),
'#id' => 'remove_cm'
);
}
$form['change_cmodel'] = array(
'#title' => "Change Content Models",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['change_cmodel']['titlebox'] = array(
'#type' => 'item',
'#value' => t("Change Content Models within $this_collection_pid"),
);
$form['change_cmodel']['current_content_model'] = array(
'#title' => "Choose content model to be changed",
'#type' => 'select',
'#options' => $represented_content_models,
'#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' => $this_collection_pid,
);
$form['change_cmodel']['submit'] = array(
'#type' => 'submit',
'#value' => t('Change Content Model Associations'),
'#id' => 'change_model',
);
return($form);
}
/**
* collection creation form validate
* @param array $form
* @param array $form_state
*/
function collection_management_form_validate($form, &$form_state) {
if ($form_state['clicked_button']['#id'] == 'create_child') {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$pid = $form_state['values']['new_collection_pid'];
$item = new fedora_item($pid);
$needs_model = FALSE;
foreach ($form_state['values']['content_models'] as $key => $value) {
if (is_string($value)) {
$needs_model = FALSE;
}
}
$checked = array_values($form_state['values']['content_models']);
if ($item->exists()) {
form_set_error('new_collection_pid', t("$pid already exists within your repository. the PID must be unique. Click on 'Manage This Collection' tab and enter new value."));
return;
}
if (!valid_pid($pid)) {
form_set_error('new_collection_pid', t("$pid is not a valid identifier. Click on 'Manage This Collection' tab and enter new value."));
return;
}
if ($needs_model) {
form_set_error('content_models', t("At least one content model must be selected. Click on 'Manage This Collection' tab and enter content model."));
return;
}
}
if ($form_state['clicked_button']['#id'] == 'add_cm') {
$name_parts = explode(":", $form_state['values']['new_cp_namespace']);
$namespace = $name_parts[0] . ":1";
if (!valid_pid($namespace)) {
form_set_error('new_cp_namespace', t("Namespace must be valid. Click on 'Manage This Collection' tab and enter new value."));
return;
}
$form_state['values']['new_cp_namespace'] = $namespace;
}
}
/**
* collection creation form submit
* @global user $user
* @param arary $form
* @param array $form_state
*/
function collection_management_form_submit($form, &$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_collection');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/dublin_core');
global $user;
$collection_pid = $form_state['values']['parent_collection'];
$policy = CollectionPolicy::loadFromCollection($collection_pid, TRUE);
$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>';
// add child collection to policy
if ($form_state['clicked_button']['#id'] == 'create_child') {
$module_path = drupal_get_path('module', 'fedora_repository');
$thumbnail = drupal_get_path('module', 'Fedora_Repository') . '/images/Crystal_Clear_filesystem_folder_grey.png';
$new_collection_pid = $form_state['values']['new_collection_pid'];
$new_collection_label = $form_state['values']['collection_name'];
$pid_namespace = $form_state['values']['collection_namespace'];
$all_cModels = get_content_models_as_option_array();
$content_models = $form_state['values']['content_models'];
$collection_policy_xml = simplexml_load_string($collection_policy);
foreach ($content_models as $content_model) {
if ($content_model) {
$node = $collection_policy_xml->content_models->addChild('content_model');
$node->addAttribute('dsid', 'ISLANDORACM');
$node->addAttribute('name', $all_cModels[$content_model]);
$node->addAttribute('namespace', $pid_namespace . ':1');
$node->addAttribute('pid', $content_model);
}
}
$item = fedora_item::ingest_new_item($new_collection_pid, 'A', $new_collection_label, $user->name);
$item->add_relationship('isMemberOfCollection', $collection_pid, RELS_EXT_URI);
$item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI);
$item->add_datastream_from_string($collection_policy_xml->saveXML(), 'COLLECTION_POLICY', 'COLLECTION_POLICY', 'text/xml', 'X');
$item->add_datastream_from_file($thumbnail, 'TN');
drupal_goto("/fedora/repository/$new_collection_pid");
}
// add content model to collection policy
if ($form_state['clicked_button']['#id'] == 'add_cm') {
if (!$policy) {
$item = new Fedora_Item($collection_pid);
$item->add_datastream_from_string($collection_policy, 'COLLECTION_POLICY', 'COLLECTION_POLICY', 'text/xml', 'X');
$policy = CollectionPolicy::loadFromCollection($collection_pid, TRUE);
}
$cp_namespace = $form_state['values']['new_cp_namespace'];
$cp_content_model = $form_state['values']['content_model_to_add'];
$policy->addModel(ContentModel::loadFromModel($cp_content_model), $cp_namespace);
$policy->saveToFedora();
drupal_set_message("Collection model successfully added");
}
//remove content model from collection policy
if ($form_state['clicked_button']['#id'] == 'remove_cm') {
$candidates = $form_state['values']['content_models_to_remove'];
$count = 0;
foreach ($candidates as $candidate) {
if (is_string($candidate)) {
$policy->removeModel(ContentModel::loadFromModel($candidate));
$count++;
}
}
if ($count > 0) {
$policy->saveToFedora();
if ($count > 1) {
$s = 's';
}
drupal_set_message("$count collection model$s removed");
}
}
//change content model on selected objects
if ($form_state['clicked_button']['#id'] == 'change_model') {
$current_content_model = $form_state['values']['current_content_model'];
$new_content_model = $form_state['values']['new_content_model'];
$add_to_policy = TRUE;
$policy_cms = $policy->getContentModels();
foreach ($policy_cms as $policy_cm) {
if ($policy_cm->pid == $current_content_model) {
$namespace = $policy_cm->pid_namespace;
}
if ($policy_cm->pid == $new_content_model) {
$add_to_policy = FALSE;
}
}
if ($add_to_policy) {
$policy->addModel(ContentModel::loadFromModel($new_content_model), $namespace);
$policy->saveToFedora();
}
$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>)";
$query = htmlentities(urlencode($query));
$content = '';
$url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch');
$url .= "?type=tuples&flush=TRUE&format=csv&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query;
$content .= do_curl($url);
$results = explode("\n", $content);
$object_pids = preg_replace('/^info:fedora\/|"object"/', '', $results);
$count = 0;
foreach ($object_pids as $object_pid) {
if (!$object_pid) {
continue;
}
$item = new fedora_item($object_pid);
$item->purge_relationship('hasModel', $current_content_model);
$item->add_relationship('hasModel', $new_content_model, FEDORA_MODEL_URI);
$count++;
}
drupal_set_message("$current_content_model changed to $new_content_model on $count objects");
}
}
/**
* deletes PID
* @param string $pid
*/
function delete_objects_as_batch($pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
$name = $user->name;
$restConnection->repository->purgeObject($pid);
}
/**
* removes association of this object to this collection
* @param string $pid
*/
function remove_collection_association($pid, $collection_pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
$fedora_object = new FedoraObject($pid, $restConnection->repository);
$fedora_object->relationships->remove(NULL, 'isMemberOfCollection', $collection_pid);
}
/**
* returns content models associated with all objects in a collection
* @param string $pid
* @return array
*/
function get_represented_content_models($pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
require_once 'sites/all/libraries/tuque/RepositoryQuery.php';
$query = "select \$model from <#ri>
where (\$object <info:fedora/fedora-system:def/relations-external#isMemberOf> <info:fedora/$pid>
or \$object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/$pid>)
and \$object <info:fedora/fedora-system:def/model#hasModel> \$model";
$model_pids = $restConnection->repository->ri->itqlQuery($query, 'unlimited', '0');
$represented_models = array();
foreach ($model_pids as $model_pid) {
if ($model_pid && $model_pid['object']['value'] != 'fedora-system:FedoraObject-3.0') {
$represented_models[$model_pid['object']['value']] = $model_pid['object']['value'] . ' ~ ' . $model_pid['title']['value'];
}
}
return $represented_models;
}
function get_child_collections($collection_pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
require_once 'sites/all/libraries/tuque/RepositoryQuery.php';
$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/$collection_pid>
EOD;
$lines = $restConnection->repository->ri->itqlQuery($query, 'unlimited', '0');
$collection_pids = array_values(array_filter($lines));
return $collection_pids;
}
function Islandora_collections_get_collection_from_pid($pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
require_once 'sites/all/libraries/tuque/RepositoryQuery.php';
$query = 'select $parent from <#ri>
where ($object <fedora-rels-ext:isMemberOf> $parent
or $object <fedora-rels-ext:isMemberOfCollection> $parent)
and $object <dc:identifier> \'' . $pid . '\'
order by $object';
$object_pids = $restConnection->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_pid, $relationship = array('isMemberOfCollection'), $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') {
// module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
require_once 'sites/all/libraries/tuque/RepositoryQuery.php';
global $user;
// if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
// 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;
// $query_string = htmlentities(urlencode($query_string));
//
//
// $content = '';
// $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch');
// $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query_string;
// $content .= do_curl($url);
$results = $restConnection->repository->ri->itqlQuery($query_string, $limit, $offset);
return $results;
}
//function get_related_items_as_array($collection_pid, $relationship = 'isMemberOfCollection', $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') {
// $content = get_related_items_as_xml($collection_pid, $relationship, $limit, $offset, $active_objects_only, $cmodel, $orderby);
// if (empty($content)) {
// return array();
// }
//
// $content = new SimpleXMLElement($content);
//
// $resultsarray = array();
// foreach ($content->results->result as $result) {
// $resultsarray[] = substr($result->object->attributes()->uri, 12); // Remove 'info:fedora/'.
// }
// return $resultsarray;
//}

113
islandora_basic_collection/includes/CollectionManagerTable.inc

@ -0,0 +1,113 @@
<?php
/**
* 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($collection_pid) {
module_load_include('inc', 'islandora', 'RestConnection');
require_once 'sites/all/libraries/tuque/RepositoryQuery.php';
$restConnection = new RestConnection();
$query = 'select $object $title from <#ri>
where ($object <info:fedora/fedora-system:def/relations-external#isMemberOf> <info:fedora/' . $collection_pid . '>
or $object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/' . $collection_pid . '>)
and $object <dc:title> $title';
$results = $restConnection->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', 'RestConnection');
require_once 'sites/all/libraries/tuque/RepositoryQuery.php';
$restricted = variable_get('fedora_namespace_restriction_enforced', TRUE);
$allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
$restConnection = new RestConnection();
$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 = $restConnection->repository->ri->itqlQuery($query, 'unlimited', '0');
foreach ($namespaces as $namespace) {
$trimmed_names[] = trim($namespace);
}
$options = array();
foreach ($results as $item) { //removes blanks
// var_dump($item['object']['value']);
$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;
}

104
islandora_basic_collection/includes/DeleteCollection.inc

@ -0,0 +1,104 @@
<?php
/**
*
* @param array $form_state
* @param string $pid
*
* @return string
*/
function islandora_collection_deletion_form($form, &$form_state, $pid) {
module_load_include('inc', 'islandora_basic_collection', 'CollectionManagerTable');
$potential_collections = get_collections_as_option_array();
$table = islandora_collection_table($pid);
$deletion_message = ($table) ? "Delete Members of this Collection" : "Delete Collection";
$submit_text_message = ($table) ? "Delete Selected Objects" : "Delete Collection";
$form = array();
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;
}
function islandora_collection_deletion_form_submit($form, &$form_state) {
global $user;
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
$collection_pid = $form_state['values']['current'];
$fedora_object = new FedoraObject($collection_pid, $restConnection->repository);
$parents = $fedora_object->relationships->get(NULL, 'isMemberOfCollection');
$parents = Islandora_collections_get_collection_from_pid($collection_pid);
$collection_pid = $form_state['values']['current'];
if (isset($form_state['values']['delete_root']) && $form_state['values']['delete_root'] == 1) {
delete_root_collection($collection_pid);
drupal_goto("islandora/object/" . $parents[0]['parent']['value']);
}
$child_collections = get_child_collections($collection_pid);
$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($child, '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("Populated child collections were not deleted.");
}
}
}
$pids_to_delete = array_diff($pids, $populated_child_collections);
foreach ($pids_to_delete as $pid_to_delete) {
$restConnection->repository->purgeObject($pid_to_delete);
}
drupal_goto("islandora/object/" . $collection_pid);
}
function delete_root_collection($pid) {
module_load_include('inc', 'islandora', 'RestConnection');
try {
$restConnection = new RestConnection();
$restConnection->repository->purgeObject($pid);
} catch (Exception $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)));
}

61
islandora_basic_collection/includes/ManagePolicies.inc

@ -0,0 +1,61 @@
<?php
function islandora_manage_policies_form($form, &$form_state, $collection_pid) {
$new_options = array();
if (is_array($content_models) && is_array($cm_options)) {
$new_options = array_diff_key($content_models, $cm_options);
}
$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' => $collection_namespace,
'#description' => t("Choose namespace for objects in this collection associated with this content model"),
);
$form['manage_collection_policy']['add']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add Content Model to Collection Policy'),
'#id' => 'add_cm'
);
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 From Collection Policy'),
'#id' => 'remove_cm'
);
}
return $form;
}
function islandora_manage_policies_form_validate($form, &$form_state) {
}
function islandora_manage_policies_form_submit($form, &$form_state) {
}

57
islandora_basic_collection/includes/MoveCollection.inc

@ -0,0 +1,57 @@
<?php
/**
*
* @param array $form_state
* @param string $pid
*
* @return string
*/
function islandora_collection_migrate_form($form, &$form_state, $pid) {
module_load_include('inc', 'islandora_basic_collection', 'CollectionManagerTable');
$potential_collections = get_collections_as_option_array();
$table = islandora_collection_table($pid);
if (!$table) {
return;
}
$form = array();
$form['migrate']['new_collection'] = array(
'#title' => t('New Collection'),
'#description' => t("All content will be migrated from $pid to the selected collection"),
'#type' => 'select',
'#options' => $potential_collections,
);
$form['migrate']['table'] = $table;
$form['current'] = array(
'#type' => 'hidden',
'#value' => $pid,
);
$form['migrate']['message'] = array(
'#type' => 'item',
'#value' => t(""),
);
$form['migrate']['submit'] = array(
'#type' => 'submit',
'#value' => t('Migrate selected objects'),
);
return $form;
}
function islandora_collection_migrate_form_submit($form, &$form_state) {
module_load_include('inc', 'islandora', 'RestConnection');
$restConnection = new RestConnection();
$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 = new FedoraObject($pid, $restConnection->repository);
$fedora_object->relationships->remove(FEDORA_RELS_EXT_URI, 'isMemberOfCollection', $current);
$fedora_object->relationships->add(FEDORA_RELS_EXT_URI, 'isMemberOfCollection', $new_collection);
}
}

9
islandora_basic_collection/islandora-basic-collection.tpl.php

@ -22,11 +22,14 @@
*/
?>
<?php drupal_set_title($islandora_object->label); ?>
<div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix">
<?php foreach($associated_objects_array as $key => $value): ?>
<dl class="islandora-basic-collection-object">
<dt class="<?php print $value['class']; ?>"><?php print $value['thumb_link']; ?></dt>
<dd class="<?php print $value['class']; ?>"><?php print $value['title_link']; ?></dd>
<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>

82
islandora_basic_collection/islandora_basic_collection.module

@ -30,8 +30,8 @@ function islandora_basic_collection_menu() {
$items = array();
$items['islandora/object/%/manage/collection'] = array(
'title' => 'Collection Related',
'page callback' => 'islandora_basic_collection_manage_object',
'page arguments' => array(2),
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_basic_collection_manage_object', 2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2),
@ -66,7 +66,70 @@ function islandora_basic_collection_menu() {
* @return type
*/
function islandora_basic_collection_manage_object($object_id) {
return 'Collection CModel edit function ' . $object_id;
module_load_include('inc', 'islandora_basic_collection', 'includes/CollectionManagement');
module_load_include('inc', 'islandora_basic_collection', 'includes/CollectionManagerTable');
module_load_include('inc', 'islandora_basic_collection', 'includes/DeleteCollection');
module_load_include('inc', 'islandora_basic_collection', 'includes/MoveCollection');
module_load_include('inc', 'islandora_basic_collection', 'includes/ChildCollection');
module_load_include('inc', 'islandora_basic_collection', 'includes/ManagePolicies');
$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_id);
$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_id);
$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'] = array(
// '#content' => drupal_get_form($form_id),
);
$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_id);
$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_id);
return $form;
// return 'Collection CModel edit function ' . $object_id;
}
/**
@ -112,7 +175,11 @@ function islandora_basic_collection_theme($existing, $type, $theme, $path) {
// 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_management_form_table' => array(
'arguments' => array('element' => NULL),
'file' => 'includes/CollectionManagerTable.inc',
),
);
}
@ -206,7 +273,7 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari
$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');
}
}
$object_url = 'islandora/object/' . $pid;
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>';
$title = $variables['islandora_associated_objects'][$key]['title']['value'];
@ -214,9 +281,10 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari
$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'])){
if (isset($fc_object['TN'])) {
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>';
} else {
}
else {
$thumbnail_img = '<img src="http://codesprint-centos.islandora.ca/islandora/object/islandora%3A52/datastream/TN"' . '/>';
}
$associated_objects_array[$pid]['thumbnail'] = $thumbnail_img;

36
islandora_basic_image/css/islandora_basic_image.theme.css

@ -18,8 +18,8 @@
}
.islandora-basic-image-metadata {
clear: both;
padding-top: 1.5em;
display: block;
clear: both
}
dl.islandora-basic-image-fields {
@ -33,15 +33,25 @@ dl.islandora-basic-image-fields {
/*
* The width + left/right padding of DTs/DDs equals 88% when compensating for an image
*/
.islandora-basic-image-metadata * {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.islandora-basic-image-metadata dt {
margin-right:-1px;
width:12.5%;
font-weight: bold;
width:15.625%;
font-weight: normal;
text-align: right;
font-weight: bold;
padding-right: 0;
}
.islandora-basic-image-metadata dd {
width:77%;
width:84.375%;
padding-left: 40px;
}
/*
@ -55,15 +65,15 @@ dl.islandora-basic-image-fields {
letter-spacing:normal;
word-spacing:normal;
vertical-align:top;
padding:5px 0 3px 3%;
padding-top: 6px;
padding-bottom: 4px;
margin:0;
border-top:1px solid #ddd;
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word; /* webkit */
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
border-top:1px solid #e5e5e5;
}
.islandora-basic-image-metadata dt.first,
.islandora-basic-image-metadata dd.first {
border-top:0;
}
.islandora-basic-image-sidebar,

52
islandora_basic_image/islandora-basic-image--islandora-27.tpl.php

@ -1,52 +0,0 @@
<?php
/*
* islandora-basic-image--islandora-27.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(""); ?>
<div class="islandora-basic-image-object">
<div class="islandora-basic-image-content clearfix">
<?php print $islandora_medium_img; ?>
</div>
<div class="islandora-basic-image-sidebar">
<h1 class="title"><?php print $islandora_object_label; ?></h1>
<h3><?php print $dc_array['dc:description']['label']; ?></h3>
<p><?php print $dc_array['dc:description']['value']; ?></p>
</div>
<div class="islandora-basic-image-metadata">
<h4>Details</h4>
<dl class="islandora-basic-image-fields">
<?php $row_field = 0; ?>
<?php foreach($dc_array as $key => $value): ?>
<dt class="solr-label <?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['label']; ?>
</dt>
<?php if ($key == 'PID'): ?>
<?php $value['value'] = l($value['value'], 'fedora/repository/' . htmlspecialchars($value['value'], ENT_QUOTES, 'utf-8')); ?>
<?php endif; ?>
<dd class="solr-value <?php print $value['class']; ?><?php print $row_field == 0 ? ' first' : ''; ?>">
<?php print $value['value']; ?>
</dd>
<?php $row_field++; ?>
<?php endforeach; ?>
</dl>
</div>
</div>

35
islandora_basic_image/islandora-basic-image.tpl.php

@ -32,19 +32,22 @@
<h3><?php print $dc_array['dc:description']['label']; ?></h3>
<p><?php print $dc_array['dc:description']['value']; ?></p>
</div>
<div class="islandora-basic-image-metadata">
<h4>Details</h4>
<dl class="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>
</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-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>

4
islandora_basic_image/islandora_basic_image.module

@ -77,7 +77,7 @@ function islandora_basic_image_menu() {
* @param string $object_id
* @return string
*/
/**
/*
function islandora_basic_image_manage_object($object_id){
return 'Image CModel edit function '.$object_id;
}*/
@ -200,6 +200,8 @@ function islandora_basic_image_islandora_view_object($object, $user, $page_numbe
* 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'];
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
try {

Loading…
Cancel
Save