Browse Source

ISLANDORA-260: Merged in fix

Merge ISLANDORA-260 into 6.x

Conflicts:
	fedora_repository.module
pull/7/head
Ben Woodhead 13 years ago
parent
commit
b9ca342973
  1. 29
      fedora_repository.module

29
fedora_repository.module

@ -534,7 +534,7 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) {
$pid = $form_state['values']['pid']; $pid = $form_state['values']['pid'];
$dsid = $form_state['values']['dsId']; $dsid = $form_state['values']['dsId'];
$dsLabel = $form_state['values']['dsLabel']; $dsLabel = $form_state['values']['dsLabel'];
// Remove the original file extension from the label and add the new one // Remove the original file extension from the label and add the new one
$indexOfDot = strrpos($dsLabel, '.'); //use strrpos to get the last dot $indexOfDot = strrpos($dsLabel, '.'); //use strrpos to get the last dot
if ($indexOfDot !== FALSE) { if ($indexOfDot !== FALSE) {
$dsLabel = substr($dsLabel, 0, $indexOfDot); $dsLabel = substr($dsLabel, 0, $indexOfDot);
@ -742,16 +742,20 @@ function makeObject($pid, $dsID) {
function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) { function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) {
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
global $user; global $user;
if (!fedora_available()) { if (!fedora_available()) {
drupal_set_message('The Fedora repository server is currently unavailable. Please contact the site administrator.', 'warning', FALSE); drupal_set_message('The Fedora repository server is currently unavailable. Please contact the site administrator.', 'warning', FALSE);
return ''; return '';
} }
if ($pid & !validPid($pid)) { $item = new fedora_item($pid);
if (!$item->exists()) {
drupal_not_found();
}
if ($pid & !validPid($pid)) {
drupal_set_message(t("Invalid PID!"), 'error'); drupal_set_message(t("Invalid PID!"), 'error');
return ' '; return ' ';
} }
@ -761,8 +765,6 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
return ' '; return ' ';
} }
if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $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');
if (user_access('access administration pages')) { 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');
} }
@ -790,13 +792,6 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
module_load_include('inc', 'fedora_repository', 'CollectionClass'); module_load_include('inc', 'fedora_repository', 'CollectionClass');
$collectionClass = new CollectionClass(); $collectionClass = new CollectionClass();
//if(!isset($pageNumber)){
// $pageNumber=0;
//}
//if(!isset($limit)){
// $limit=20;
//}
module_load_include('inc', 'fedora_repository', 'ContentModel'); module_load_include('inc', 'fedora_repository', 'ContentModel');
module_load_include('inc', 'fedora_repository', 'plugins/fedoraObject'); module_load_include('inc', 'fedora_repository', 'plugins/fedoraObject');
$breadcrumbs = array(); $breadcrumbs = array();
@ -804,15 +799,12 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
drupal_set_breadcrumb(array_reverse($breadcrumbs)); drupal_set_breadcrumb(array_reverse($breadcrumbs));
$offset = $limit * $page_number; $offset = $limit * $page_number;
//$results = $collectionClass->getRelatedObjects($pid, $limit, $offset, NULL); //updated so we can do paging in query not in xslt
//$results = $collectionClass->getRelatedItems($pid, NULL);
$content_models = $objectHelper->get_content_models_list($pid); $content_models = $objectHelper->get_content_models_list($pid);
// Each content model may return either a tabset array or plain HTML. If it's HTML, stick it in a tab. // Each content model may return either a tabset array or plain HTML. If it's HTML, stick it in a tab.
$cmodels_tabs = array( $cmodels_tabs = array(
'#type' => 'tabset', '#type' => 'tabset',
); );
foreach ($content_models as $content_model) { foreach ($content_models as $content_model) {
//$content_model_fieldsets = $objectHelper->createExtraFieldsets($pid, $content_model, $pageNumber);
$content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number); $content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number);
if (is_array($content_model_fieldset)) { if (is_array($content_model_fieldset)) {
$cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset); $cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset);
@ -829,13 +821,6 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
$obj = new FedoraObject($pid); $obj = new FedoraObject($pid);
$object_details = $obj->showFieldSets(); $object_details = $obj->showFieldSets();
$cmodels_tabs = array_merge($cmodels_tabs, $object_details); $cmodels_tabs = array_merge($cmodels_tabs, $object_details);
//$content .= $objectHelper
//$content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber);
//the below is for islandlives we should be able to do this in the xslt though
//$css=$path.'/stylesheets/container-large.css';
//drupal_add_css($css);
return tabs_render($cmodels_tabs); return tabs_render($cmodels_tabs);
} }

Loading…
Cancel
Save