Browse Source

Updated 7.x

pull/105/head
rwincewicz 13 years ago
parent
commit
6f4b4cd6f0
  1. 12
      admin/islandora.admin.inc
  2. 137
      islandora.module

12
admin/islandora.admin.inc

@ -1,9 +1,11 @@
<?php <?php
/** /**
* Create admin form * @file islandora.admin.inc
* @return array * Create admin form
*/ * @return array
*/
function islandora_repository_admin() { function islandora_repository_admin() {
if (!user_access('administer site configuration')) { if (!user_access('administer site configuration')) {
drupal_set_message(t('You must be a site administrator to edit the Fedora collections list.'), 'error'); drupal_set_message(t('You must be a site administrator to edit the Fedora collections list.'), 'error');
@ -139,6 +141,4 @@
return system_settings_form($form); return system_settings_form($form);
} }
?>

137
islandora.module

@ -38,8 +38,8 @@ function islandora_menu() {
$items = array(); $items = array();
$items['admin/settings/islandora'] = array( $items['admin/settings/islandora'] = array(
'title' => t('Islandora Configuration'), 'title' => 'Islandora Configuration',
'description' => t("Configure Islandora's interaction with Fedora"), 'description' => "Configure Islandora's interaction with Fedora",
'page callback' => 'drupal_get_form', 'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_repository_admin'), 'page arguments' => array('islandora_repository_admin'),
'file' => 'admin/islandora.admin.inc', 'file' => 'admin/islandora.admin.inc',
@ -47,23 +47,24 @@ function islandora_menu() {
'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM,
); );
$items['admin/settings/islandora/collection'] = array( $items['admin/settings/islandora/collection'] = array(
'title' => t('Islandora Configuration'), 'title' => 'Islandora Configuration',
'description' => t('Enter the Islandora collection information here.'), 'description' => 'Enter the Islandora collection information here.',
'access arguments' => array('administer site configuration'), 'access arguments' => array('administer site configuration'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0, 'weight' => 0,
); );
$items['admin/settings/islandora/demoobjects'] = array( $items['admin/settings/islandora/demoobjects'] = array(
'title' => t('Solution Packs'), 'title' => 'Solution Packs',
'description' => t('Install content models and collections required by installed solution packs.'), 'description' => 'Install content models and collections required by installed solution packs.',
'page callback' => 'islandora_solution_packs_page', 'page callback' => 'islandora_solution_packs_page',
'access arguments' => array(FEDORA_ADD_DS), 'access arguments' => array(FEDORA_ADD_DS),
'file' => 'admin/islandora.solutionpacks.inc', 'file' => 'admin/islandora.solutionpacks.inc',
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
); );
$items['islandoracm.xsd'] = array( $items['islandoracm.xsd'] = array(
'title' => t('Islandora Content Model XML Schema Definition'), 'title' => 'Islandora Content Model XML Schema Definition',
'page callback' => 'islandora_display_schema', 'page callback' => 'islandora_display_schema',
'page arguments' => array('islandoracm.xsd'), 'page arguments' => array('islandoracm.xsd'),
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
@ -71,13 +72,20 @@ function islandora_menu() {
); );
$items['collection_policy.xsd'] = array( $items['collection_policy.xsd'] = array(
'title' => t('Islandora Content Model XML Schema Definition'), 'title' => 'Islandora Content Model XML Schema Definition',
'page callback' => 'islandora_display_schema', 'page callback' => 'islandora_display_schema',
'page arguments' => array('collection_policy.xsd'), 'page arguments' => array('collection_policy.xsd'),
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_VIEW), 'access arguments' => array(FEDORA_VIEW),
); );
$items['islandora/ingest'] = array(
'title' => 'Ingest object',
'page callback' => 'islandora_ingest_object',
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_INGEST)
);
$items['islandora/object/%'] = array( $items['islandora/object/%'] = array(
'title' => 'Repository', 'title' => 'Repository',
'page callback' => 'islandora_view_object', 'page callback' => 'islandora_view_object',
@ -85,72 +93,67 @@ function islandora_menu() {
'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FEDORA_VIEW), 'access arguments' => array(FEDORA_VIEW),
); );
/* $items['fedora/repository/service'] = array( $items['islandora/object/%/view'] = array(
'page callback' => 'repository_service', 'title' => 'Repository',
'type' => MENU_CALLBACK, 'page callback' => 'islandora_view_object',
'page arguments' => array(2),
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FEDORA_VIEW), 'access arguments' => array(FEDORA_VIEW),
); */
$items['islandora/object/%/datastream/%/download'] = array(
'title' => t('Download object'),
'page callback' => 'islandora_object_as_attachment',
'page arguments' => array(2, 4),
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_VIEW)
); );
/* $items['fedora/repository/editmetadata'] = array( $items['islandora/object/%/edit'] = array(
'title' => t('Edit metadata'), 'title' => 'Repository',
'page callback' => 'fedora_repository_edit_qdc_page', 'page callback' => 'islandora_edit_object',
'type' => MENU_CALLBACK, 'page arguments' => array(2),
'access arguments' => array('edit fedora meta data') 'type' => MENU_NORMAL_ITEM,
); */ 'access arguments' => array(FEDORA_MODIFY_STATE),
$items['islandora/object/%/datastream/%/purge'] = array(
'title' => t('Purge data stream'),
'page callback' => 'islandora_purge_stream',
'page arguments' => array(2, 4),
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_PURGE)
); );
/* $items['fedora/repository/replaceStream'] = array(
'title' => t('Replace Stream'),
'page callback' => 'fedora_repository_replace_stream',
'type' => MENU_CALLBACK,
'access arguments' => array('add fedora datastreams'),
); */
$items['islandora/object/%/purge'] = array( $items['islandora/object/%/purge'] = array(
'title' => t('Purge object'), 'title' => 'Purge object',
'page callback' => 'islandora_purge_object', 'page callback' => 'islandora_purge_object',
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_PURGE) 'access arguments' => array(FEDORA_PURGE),
); );
$items['islandora/object/%/datastream/%/add'] = array( $items['islandora/object/%/datastream/%/add'] = array(
'title' => t('Add stream'), 'title' => 'Add stream',
'page callback' => 'islandora_add_stream', 'page callback' => 'islandora_add_stream',
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_ADD_DS) 'access arguments' => array(FEDORA_ADD_DS)
); );
/* $items['fedora/repository/collection'] = array( $items['islandora/object/%/datastream/%/download'] = array(
'title' => t('Collection view'), 'title' => 'Download datastream',
'page callback' => 'fedora_collection_view', 'page callback' => 'islandora_datastream_as_attachment',
'page arguments' => array(2, 4),
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
'access argruments' => array('view fedora collection'), 'access arguments' => array(FEDORA_VIEW),
); */ );
//new for mnpl******************************************
$items['islandora/object/ingest'] = array( $items['islandora/object/%/datastream/%/view'] = array(
'title' => t('Ingest object'), 'title' => 'Download datastream',
'page callback' => 'islandora_ingest_object', 'page callback' => 'islandora_datastream_as_attachment',
'page arguments' => array(2, 4),
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_INGEST) 'access arguments' => array(FEDORA_VIEW),
);
$items['islandora/object/%/datastream/%/edit'] = array(
'title' => 'Edit datastream',
'page callback' => 'islandora_edit_stream',
'page arguments' => array(2, 4),
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_METADATA_EDIT),
);
$items['islandora/object/%/datastream/%/purge'] = array(
'title' => 'Purge data stream',
'page callback' => 'islandora_purge_stream',
'page arguments' => array(2, 4),
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_PURGE),
); );
return $items; return $items;
@ -194,12 +197,12 @@ function islandora_node_access($op, $pid = NULL, $as_user = NULL) {
*/ */
function islandora_purge_object($object_id) { function islandora_purge_object($object_id) {
if (!isset($object_id)) { if (!isset($object_id)) {
drupal_set_message('Cannot remove object, object id not set'); drupal_set_message(t('Cannot remove object, object id not set'));
return; return;
} }
$object = new Object($object_id); $object = new Object($object_id);
if (!isset($object)) { if (!isset($object)) {
drupal_set_message('Could not remove object, object not found'); drupal_set_message(t('Could not remove object, object not found'));
return; return;
} }
module_invoke_all('islandora_purge_object', $object); //notify modules of pending deletion module_invoke_all('islandora_purge_object', $object); //notify modules of pending deletion
@ -221,12 +224,12 @@ function islandora_get_types() {
*/ */
function islandora_purge_datastream($object_id, $datastream_id) { function islandora_purge_datastream($object_id, $datastream_id) {
if (!isset($datastream_id)) { if (!isset($datastream_id)) {
drupal_set_message('Cannot remove datastream, datastream id not set'); drupal_set_message(t('Cannot remove datastream, datastream id not set'));
return; return;
} }
$object = new Object($object_id); $object = new Object($object_id);
if (!isset($object)) { if (!isset($object)) {
drupal_set_message('Could not remove object, object not found'); drupal_set_message(t('Could not remove object, object not found'));
return; return;
} }
module_invoke_all('islandora_purge_datastream', $datastream); //notify modules of pending deletion so we can update rels etc module_invoke_all('islandora_purge_datastream', $datastream); //notify modules of pending deletion so we can update rels etc
@ -243,7 +246,7 @@ function islandora_purge_datastream($object_id, $datastream_id) {
function islandora_view_object($object_id) { function islandora_view_object($object_id) {
//return $object_id; //return $object_id;
if (!isset($object_id)) { if (!isset($object_id)) {
drupal_set_message('Cannot view object, object id not set'); drupal_set_message(t('Cannot view object, object id not set'));
return; return;
} }
@ -257,7 +260,7 @@ function islandora_view_object($object_id) {
$restConnection = new RestConnection($user); $restConnection = new RestConnection($user);
$fedora_object = new FedoraObject($object_id, $restConnection->repository); $fedora_object = new FedoraObject($object_id, $restConnection->repository);
} catch (Exception $e) { } catch (Exception $e) {
drupal_set_message(t('Error getting Islandora object %s',array('%s' => $object_id)), 'error'); drupal_set_message(t('Error getting Islandora object %s', array('%s' => $object_id)), 'error');
return""; return"";
} }
drupal_alter('islandora_view_object', $fedora_object); //modify object if required before it is passed along drupal_alter('islandora_view_object', $fedora_object); //modify object if required before it is passed along
@ -311,17 +314,15 @@ function islandora_permission() {
*/ */
function islandora_add_datastream($object_id) { function islandora_add_datastream($object_id) {
if (!isset($object_id)) { if (!isset($object_id)) {
drupal_set_message('Cannot add datastream to object, object id not set'); drupal_set_message(t('Cannot add datastream to object, object id not set'));
return; return;
} }
//send message to synapse //send message to synapse
$object = new IslandoraObject($object_id); $object = new IslandoraObject($object_id);
if (!isset($object)) { if (!isset($object)) {
drupal_set_message('Could not remove object, object not found'); drupal_set_message(t('Could not remove object, object not found'));
return; return;
} }
module_invoke_all('islandora_add_datastream', $object); //allow submodules to handle add datastream based on object type module_invoke_all('islandora_add_datastream', $object); //allow submodules to handle add datastream based on object type
} }
?>
Loading…
Cancel
Save