|
|
|
@ -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)) { |
|
|
|
|