Browse Source

Merge pull request #115 from krisbulman/7.x

moved add datastream link to action item
pull/116/merge
Kris Bulman 13 years ago
parent
commit
97113de10f
  1. 4
      includes/datastream.inc
  2. 53
      islandora.module

4
includes/datastream.inc

@ -280,8 +280,8 @@ function islandora_add_datastream_form($form, &$form_state, $object_id) {
$form['add_fieldset'] = array( $form['add_fieldset'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => 'Add a datastream', '#title' => 'Add a datastream',
'#collapsible' => TRUE, '#collapsible' => FALSE,
'#collapsed' => TRUE, '#collapsed' => FALSE,
); );
$form['add_fieldset']['add_datastream_label'] = array( $form['add_fieldset']['add_datastream_label'] = array(
'#value' => t('<br /><h3>Add Datastream:</h3>'), '#value' => t('<br /><h3>Add Datastream:</h3>'),

53
islandora.module

@ -108,16 +108,7 @@ function islandora_menu() {
'access arguments' => array(FEDORA_VIEW), 'access arguments' => array(FEDORA_VIEW),
); );
$items['islandora/object/%/add'] = array(
'title' => 'Add to an object',
'file' => 'includes/datastream.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_add_datastream_form',2),
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FEDORA_ADD_DS)
);
$items['islandora/object/%/view'] = array( $items['islandora/object/%/view'] = array(
'title' => 'View', 'title' => 'View',
@ -153,6 +144,7 @@ function islandora_menu() {
'weight' => -10, 'weight' => -10,
); );
$items['islandora/object/%/manage/properties'] = array( $items['islandora/object/%/manage/properties'] = array(
'title' => 'Properties', 'title' => 'Properties',
'page callback' => 'drupal_get_form', 'page callback' => 'drupal_get_form',
@ -163,7 +155,6 @@ function islandora_menu() {
'weight' => -5, 'weight' => -5,
); );
$items['islandora/object/%/delete'] = array( $items['islandora/object/%/delete'] = array(
'title' => 'Purge object', 'title' => 'Purge object',
'page callback' => 'islandora_purge_object', 'page callback' => 'islandora_purge_object',
@ -172,6 +163,26 @@ function islandora_menu() {
'access arguments' => array(FEDORA_PURGE), 'access arguments' => array(FEDORA_PURGE),
); );
$items['islandora/object/%/manage/datastreams/add'] = array(
'title' => 'Add a datastream',
'file' => 'includes/datastream.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_add_datastream_form', 2),
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FEDORA_ADD_DS)
);
// $items['islandora/object/%/add'] = array(
// 'title' => 'Add to an object',
// 'file' => 'includes/datastream.inc',
// 'page callback' => 'drupal_get_form',
// 'page arguments' => array('islandora_add_datastream_form',2),
// 'type' => MENU_NORMAL_ITEM,
// 'access arguments' => array(FEDORA_ADD_DS)
// );
$items['islandora/object/%/datastream/%'] = array( $items['islandora/object/%/datastream/%'] = array(
'title' => 'View datastream', 'title' => 'View datastream',
'page callback' => 'islandora_datastream_as_attachment', 'page callback' => 'islandora_datastream_as_attachment',
@ -223,6 +234,24 @@ function islandora_admin_paths_alter(&$paths) {
$paths['*/manage*'] = TRUE; $paths['*/manage*'] = TRUE;
} }
/**
* Implements hook_menu_local_tasks_alter().
*/
function islandora_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// Add action link 'islandora/object/%/manage/datastreams'.
$object_id = $router_item['page_arguments'][0];
if ($root_path == 'islandora/object/%/manage/datastreams') {
$item = menu_get_item("islandora/object/$object_id/manage/datastreams/add");
if ($item['access']) {
$data['actions']['output'][] = array(
'#theme' => 'menu_local_action',
'#link' => $item,
);
}
}
}
/** /**
* determines whether we can see the object or not * determines whether we can see the object or not
* checks PID namespace permissions, and user permissions * checks PID namespace permissions, and user permissions
@ -616,7 +645,7 @@ function islandora_preprocess_islandora_default_edit(&$variables) {
$datastreams = array(); $datastreams = array();
$variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id; $variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id;
module_load_include('inc','islandora','includes/datastream'); module_load_include('inc','islandora','includes/datastream');
$variables['add_datastream_form'] = drupal_get_form('islandora_add_datastream_form', $islandora_object->id); // $variables['add_datastream_form'] = drupal_get_form('islandora_add_datastream_form', $islandora_object->id);
foreach ($islandora_object as $ds) { foreach ($islandora_object as $ds) {
$datastreams['download_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/download'; $datastreams['download_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/download';
$datastreams['view_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/view'; $datastreams['view_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/view';

Loading…
Cancel
Save