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

42
islandora_basic_collection/islandora_basic_collection.module

@ -28,34 +28,36 @@
*/
function islandora_basic_collection_menu() {
$items = array();
$items['islandora/object/%/edit/collection'] = array(
'title' => 'Manage Collection',
'page callback' => 'islandora_basic_collection_edit_object',
$items['islandora/object/%/manage/collection'] = array(
'title' => 'Collection Related',
'page callback' => 'islandora_basic_collection_manage_object',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2),
);
$items['islandora/object/%/view/collection'] = array(
);
/* 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,
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2),
);
); */
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
* @return boolean
*/
function islandora_basic_collection_access($object_id){
function islandora_basic_collection_access($object_id) {
module_load_include('inc', 'islandora', 'RestConnection');
global $user;
try {
try {
$restConnection = new RestConnection($user);
$fedora_object = new FedoraObject($object_id, $restConnection->repository);
} catch (Exception $e) {
@ -75,20 +77,18 @@ function islandora_basic_collection_access($object_id){
return FALSE;
}
if (!isset($fedora_object)) {
return FALSE;
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])){
if (isset($cmodel_list[$model])) {
return user_access(FEDORA_MODIFY_STATE);
}
}
return FALSE;
}
/**
* Theme registry function
* 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() {
$types = array();
$types['islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = TRUE;
$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE;
//$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE;
return $types;
}

37
islandora_basic_image/islandora_basic_image.module

@ -24,13 +24,15 @@
/**
* 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['islandora/object/%/edit/image'] = array(
$items['islandora/object/%/manage/image'] = array(
'title' => 'Manage Image Types',
'page callback' => 'islandora_basic_image_edit_object',
'page callback' => 'islandora_basic_image_manage_object',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_image_access',
@ -54,26 +56,43 @@ function islandora_basic_image_menu() {
'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_edit_object($object_id){
/**
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';
}
}*/
/**
* determines whether or not to show this modules manage tab

Loading…
Cancel
Save