Browse Source

updated menus for secondary tabs changed edit path to use manage

pull/110/merge
Paul Pound 13 years ago
parent
commit
9be9cf0ed2
  1. 12
      islandora.module
  2. 44
      islandora_basic_collection/islandora_basic_collection.module
  3. 37
      islandora_basic_image/islandora_basic_image.module

12
islandora.module

@ -132,7 +132,7 @@ function islandora_menu() {
'weight' => -10, 'weight' => -10,
); );
$items['islandora/object/%/edit'] = array( $items['islandora/object/%/manage'] = array(
'title' => 'Manage', 'title' => 'Manage',
'page callback' => 'islandora_edit_object', 'page callback' => 'islandora_edit_object',
'page arguments' => array(2), 'page arguments' => array(2),
@ -140,8 +140,8 @@ function islandora_menu() {
'access arguments' => array(FEDORA_MODIFY_STATE), 'access arguments' => array(FEDORA_MODIFY_STATE),
); );
$items['islandora/object/%/edit/datastreams'] = array( $items['islandora/object/%/manage/datastreams'] = array(
'title' => 'Manage Datastreams', 'title' => 'Datastreams',
'page callback' => 'islandora_edit_object', 'page callback' => 'islandora_edit_object',
'page arguments' => array(2), 'page arguments' => array(2),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
@ -149,8 +149,8 @@ function islandora_menu() {
'weight' => -10, 'weight' => -10,
); );
$items['islandora/object/%/edit/properties'] = array( $items['islandora/object/%/manage/properties'] = array(
'title' => 'Manage Properties', 'title' => 'Properties',
'page callback' => 'islandora_edit_properties', 'page callback' => 'islandora_edit_properties',
'page arguments' => array(2), 'page arguments' => array(2),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
@ -217,7 +217,7 @@ function islandora_menu() {
function islandora_admin_paths_alter(&$paths) { function islandora_admin_paths_alter(&$paths) {
$paths['*/edit*'] = TRUE; $paths['*/manage*'] = TRUE;
} }

44
islandora_basic_collection/islandora_basic_collection.module

@ -28,34 +28,36 @@
*/ */
function islandora_basic_collection_menu() { function islandora_basic_collection_menu() {
$items = array(); $items = array();
$items['islandora/object/%/edit/collection'] = array( $items['islandora/object/%/manage/collection'] = array(
'title' => 'Manage Collection', 'title' => 'Collection Related',
'page callback' => 'islandora_basic_collection_edit_object', 'page callback' => 'islandora_basic_collection_manage_object',
'page arguments' => array(2), 'page arguments' => array(2),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_collection_access', 'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2), 'access arguments' => array(2),
); );
/* an example of adding a tab for view
$items['islandora/object/%/view/collection'] = array( $items['islandora/object/%/view/collection'] = array(
'title' => 'Collection View', 'title' => 'Collection View',
'page callback' => 'islandora_basic_collection_view1', 'page callback' => 'islandora_basic_collection_view1',
'page arguments' => array(2), 'page arguments' => array(2),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_collection_access', 'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2), 'access arguments' => array(2),
); ); */
return $items; return $items;
} }
function islandora_basic_collection_edit_object($object_id){ /**
return 'Collection CModel edit function '.$object_id; * 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_id) {
return 'Collection CModel edit function ' . $object_id;
} }
function islandora_basic_collection_view1($object_id){
return 'A view returned by the Collection cmodel '.$object_id;
}
/** /**
@ -64,10 +66,10 @@ function islandora_basic_collection_view1($object_id){
* @param string $object_id * @param string $object_id
* @return boolean * @return boolean
*/ */
function islandora_basic_collection_access($object_id){ function islandora_basic_collection_access($object_id) {
module_load_include('inc', 'islandora', 'RestConnection'); module_load_include('inc', 'islandora', 'RestConnection');
global $user; global $user;
try { try {
$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) {
@ -75,20 +77,18 @@ function islandora_basic_collection_access($object_id){
return FALSE; return FALSE;
} }
if (!isset($fedora_object)) { if (!isset($fedora_object)) {
return FALSE; return FALSE;
} }
$models = $fedora_object->models; $models = $fedora_object->models;
$cmodel_list = islandora_basic_collection_islandora_get_types(); $cmodel_list = islandora_basic_collection_islandora_get_types();
foreach ($fedora_object->models as $model) { foreach ($fedora_object->models as $model) {
if (isset($cmodel_list[$model])){ if (isset($cmodel_list[$model])) {
return user_access(FEDORA_MODIFY_STATE); return user_access(FEDORA_MODIFY_STATE);
} }
} }
return FALSE; return FALSE;
} }
/** /**
* Theme registry function * Theme registry function
* We supply a pattern so we can overide templates at the theme level if needed. * We supply a pattern so we can overide templates at the theme level if needed.
@ -117,7 +117,7 @@ function islandora_basic_collection_theme($existing, $type, $theme, $path) {
function islandora_basic_collection_islandora_get_types() { function islandora_basic_collection_islandora_get_types() {
$types = array(); $types = array();
$types['islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = TRUE; $types['islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = TRUE;
$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE; //$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE;
return $types; return $types;
} }

37
islandora_basic_image/islandora_basic_image.module

@ -24,13 +24,15 @@
/** /**
* Implementation of hook_menu. * Implementation of hook_menu.
* we need some standard entry points so we can have consistent urls for different Object actions * 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() { /*function islandora_basic_image_menu() {
$items = array(); $items = array();
$items['islandora/object/%/edit/image'] = array( $items['islandora/object/%/manage/image'] = array(
'title' => 'Manage Image Types', 'title' => 'Manage Image Types',
'page callback' => 'islandora_basic_image_edit_object', 'page callback' => 'islandora_basic_image_manage_object',
'page arguments' => array(2), 'page arguments' => array(2),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_image_access', 'access callback' => 'islandora_basic_image_access',
@ -54,26 +56,43 @@ function islandora_basic_image_menu() {
'access arguments' => array(2), 'access arguments' => array(2),
); );
return $items; return $items;
} }*/
/** /**
* an example of adding a new managment section to the manage section of islandora. * 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 * The islandora_basic_image_access function determines whether or not to show this
* section. * section.
*
* This is an example function used by hook_menu above.
* @param string $object_id * @param string $object_id
* @return string * @return string
*/ */
function islandora_basic_image_edit_object($object_id){ /**
function islandora_basic_image_manage_object($object_id){
return 'Image CModel edit function '.$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){ function islandora_basic_image_view1($object_id){
return 'A view returned by the image cmodel'; 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){ function islandora_basic_image_view2($object_id){
return 'Another view returned by the image cmodel'; return 'Another view returned by the image cmodel';
} }*/
/** /**
* determines whether or not to show this modules manage tab * determines whether or not to show this modules manage tab

Loading…
Cancel
Save