Browse Source

initial change to image menu with access function

pull/110/merge
Paul Pound 13 years ago
parent
commit
34a249c6d8
  1. 3
      islandora.module
  2. 45
      islandora_basic_image/islandora_basic_image.module

3
islandora.module

@ -543,6 +543,9 @@ function islandora_preprocess_islandora_default(&$variables) {
function islandora_preprocess_islandora_default_edit(&$variables) {
$islandora_object = $variables['islandora_object'];
//module_load_include('inc', 'islandora', 'includes/datastream');
//$test = '';
//$dsids = islandora_add_datastream_form($islandora_object->id, $test);
global $base_url;
$datastreams = array();
$variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id;

45
islandora_basic_image/islandora_basic_image.module

@ -22,6 +22,50 @@
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
/**
* Implementation of hook_menu.
* we need some standard entry points so we can have consistent urls for different Object actions
*/
function islandora_basic_image_menu() {
$items = array();
$items['islandora/object/%/image'] = array(
'title' => 'Manage Image',
'page callback' => 'islandora_edit_object',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_image_access',
'access arguments' => array(2),
);
return $items;
}
function islandora_basic_image_access($object_id){
return true;
module_load_include('inc', 'islandora', 'RestConnection');
global $user;
try {
$restConnection = new RestConnection($user);
$fedora_object = new FedoraObject($object_id, $restConnection->repository);
} catch (Exception $e) {
drupal_set_message(t('Error getting Islandora object %s %e', array('%s' => $object_id, '%e' => $e)), 'error');
return "";
}
if (!isset($fedora_object)) {
drupal_set_message(t('Could not remove object, object not found'));
return;
}
$models = $fedora_object->models;
$cmodel_list = islandora_basic_image_islandora_get_types();
foreach ($fedora_object->models as $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.
@ -101,7 +145,6 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
$variables['islandora_dublin_core'] = $dc_object;
//create a nicer array for themers
//TODO: give this a better home
//$dc_array = array();
//foreach ($dc_object as $element) {
// if (!empty($element)) {

Loading…
Cancel
Save