@ -62,37 +62,6 @@ function fedora_repository_purge_object($pid = NULL, $name = NULL) {
return $output;
}
/**
* fedora repository collection view
* @global type $user
* @param type $pid
* @param type $collection
* @param type $pageNumber
* @return type
*/
function fedora_repository_collection_view($pid = NULL, $collection = NULL, $pageNumber = NULL) {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
global $user;
if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error');
return ' ';
}
$objectHelper = new ObjectHelper();
if ($pid == NULL) {
$pid = variable_get('fedora_repository_pid', 'islandora:root');
}
$content = '';
module_load_include('inc', 'fedora_repository', 'CollectionClass');
$collectionClass = new CollectionClass();
$results = $collectionClass->getRelatedItems($pid, NULL);
$content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber);
return $content;
}
/**
* fedora repository ingest object
* @param type $collection_pid
@ -948,7 +917,7 @@ function makeObject($pid, $dsID) {
drupal_set_message(t("No pid or dsid given to create an object with."));
return ' ';
}
global $user;
global $user, $conf ;
if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
drupal_access_denied();
return;
@ -956,6 +925,9 @@ function makeObject($pid, $dsID) {
return ' ';
}
//Disable the page cache, so entire datastreams do not get thrown into the page cache.
$conf['cache'] = CACHE_DISABLED;
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$objectHelper = new ObjectHelper();
$objectHelper->makeObject($pid, $dsID);
@ -978,30 +950,30 @@ function makeObject($pid, $dsID) {
function fedora_repository_islandora_tabs($content_models, $pid, $page_number) {
$cmodels_tabs = array();
foreach ($content_models as $content_model) {
foreach ($content_models as $content_model) {
$content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number);
// Each content model may return either a tabpage array or plain HTML. If
// it is HTML, stick it in a tabpage.
if (is_array($content_model_fieldset)) {
$cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset);
}
else {
$cmodels_tabs[$content_model->pid] = array(
'#type' => 'tabpage',
'#title' => $content_model->name,
'#content' => $content_model_fieldset,
);
}
}
//can disable showing the object details tab in admin UI
// it is HTML, stick it in a tabpage.
if (is_array($content_model_fieldset)) {
$cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset);
}
else {
$cmodels_tabs[$content_model->pid] = array(
'#type' => 'tabpage',
'#title' => $content_model->name,
'#content' => $content_model_fieldset,
);
}
}
//can disable showing the object details tab in admin UI
if (variable_get('fedora_repository_show_object_details_tab', TRUE)) {
// Add a 'manage object' tab for all objects, where detailed list of content is shown.
// XXX: Perhaps this should be extracted into its own object?
module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent');
// Add a 'manage object' tab for all objects, where detailed list of content is shown.
// XXX: Perhaps this should be extracted into its own object?
module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent');
$obj = new FedoraObjectDetailedContent($pid);
$object_details = $obj->showFieldSets();
$cmodels_tabs = array_merge($cmodels_tabs, $object_details);
}
@ -1091,7 +1063,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
}
if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
if (user_access('access administration pages')) {
drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed @here", array('@ here' => l('here', 'admin/settings/fedora_repository'))), 'warning');
drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('! here' => l('here', 'admin/settings/fedora_repository'))), 'warning');
}
drupal_access_denied();
exit;
@ -1124,16 +1096,16 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
//Get the tabs from all modules...
$hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid, $page_number);
$cmodels_tabs = array(
'#type' => 'tabset',
$cmodels_tabs = array(
'#type' => 'tabset',
);
$cmodels_tabs += $hook_tabs;
//Assemble parameters, to pass during alter
$params = array(
'content_models' => $content_models,
'pid' => $pid,
'page' => $page_number,
$params = array(
'content_models' => $content_models,
'pid' => $pid,
'page' => $page_number,
);
//Allow returned tabs to be altered, before return.
@ -2435,21 +2407,21 @@ function fedora_repository_imagecache_default_presets() {
* @return
* Markup for the image, making use of imagecache_external if it is available.
*/
function _fedora_repository_render_image($tn_path, $imagecache_preset = 'fedora_repository_collection_thumbnail') {
$thumbnail = NULL;
if ($thumbnail === NULL &&
module_exists('imagecache_external') &&
is_callable('theme_imagecache_external_image') &&
function _fedora_repository_render_image($tn_path, $imagecache_preset = 'fedora_repository_collection_thumbnail') {
$thumbnail = NULL;
if ($thumbnail === NULL &&
module_exists('imagecache_external') &&
is_callable('theme_imagecache_external_image') &&
variable_get('fedora_repository_use_imagecache_external_in_collection_view', FALSE) &&
imagecache_external_can_fetch($tn_path, TRUE)) {
$thumbnail = theme('imagecache_external_image', $imagecache_preset, $tn_path, $truncated_title, $title);
}
if ($thumbnail === NULL) {
$thumbnail = theme('image', $tn_path, $truncated_title, $title, array(), FALSE);
}
return $thumbnail;
}
imagecache_external_can_fetch($tn_path, TRUE)) {
$thumbnail = theme('imagecache_external_image', $imagecache_preset, $tn_path, $truncated_title, $title);
}
if ($thumbnail === NULL) {
$thumbnail = theme('image', $tn_path, $truncated_title, $title, array(), FALSE);
}
return $thumbnail;
}
/**
* Render an image, given a PID, DSID and preset.
@ -2466,11 +2438,11 @@ function _fedora_repository_render_image($tn_path, $imagecache_preset = 'fedora_
* An imagecache preset with which to render the image; defaults to
* fedora_repository_collection_thumbnail, which is added in this module's
* implementation of hook_imagecache_default_presets().
*/
function fedora_repository_render_image($pid, $dsid, $imagecache_preset = 'fedora_repository_collection_thumbnail') {
$tn_path = "fedora/repository/$pid/$dsid";
return _fedora_repository_render_image($tn_path, $imagecache_preset);
*/
function fedora_repository_render_image($pid, $dsid, $imagecache_preset = 'fedora_repository_collection_thumbnail') {
$tn_path = "fedora/repository/$pid/$dsid";
return _fedora_repository_render_image($tn_path, $imagecache_preset);
}
/**