Browse Source

Merge remote branch 'origin/ISLANDORA-250'

pull/105/head
jonathangreen 14 years ago
parent
commit
946711dbc0
  1. 57
      CollectionClass.inc
  2. 2
      ObjectHelper.inc

57
CollectionClass.inc

@ -32,7 +32,6 @@ class CollectionClass {
$this->collectionObject = new ObjectHelper($pid); $this->collectionObject = new ObjectHelper($pid);
$this->pid = $pid; $this->pid = $pid;
} }
} }
/* gets objects related to this object. must include offset and limit /* gets objects related to this object. must include offset and limit
@ -81,7 +80,6 @@ class CollectionClass {
minus $content <mulgara:is> <info:fedora/fedora-system:FedoraObject-3.0> minus $content <mulgara:is> <info:fedora/fedora-system:FedoraObject-3.0>
order by $title'; order by $title';
} }
} }
else { else {
// Replace %parent_collection% with the actual collection PID // Replace %parent_collection% with the actual collection PID
@ -312,33 +310,33 @@ class CollectionClass {
$fullpath = $file; $fullpath = $file;
// $form = array(); // $form = array();
$form['step'] = array( $form['step'] = array(
'#type' => 'hidden', '#type' => 'hidden',
'#value' => (isset($form_state['values']['step']) ? $form_state['values']['step'] : 0) + 1, '#value' => (isset($form_state['values']['step']) ? $form_state['values']['step'] : 0) + 1,
); );
$form['ingest-file-location'] = array( $form['ingest-file-location'] = array(
'#type' => 'hidden', '#type' => 'hidden',
'#value' => $file, '#value' => $file,
); );
$form['content_model_name'] = array( $form['content_model_name'] = array(
'#type' => 'hidden', '#type' => 'hidden',
'#value' => $contentModelDsid '#value' => $contentModelDsid
); );
$form['models'] = array(//content models available $form['models'] = array(//content models available
'#type' => 'hidden', '#type' => 'hidden',
'#value' => $form_state['values']['models'], '#value' => $form_state['values']['models'],
); );
$form['fullpath'] = array( $form['fullpath'] = array(
'#type' => 'hidden', '#type' => 'hidden',
'#value' => $fullpath, '#value' => $fullpath,
); );
$form['#attributes']['enctype'] = 'multipart/form-data'; $form['#attributes']['enctype'] = 'multipart/form-data';
$form['indicator']['ingest-file-location'] = array( $form['indicator']['ingest-file-location'] = array(
'#type' => 'file', '#type' => 'file',
'#title' => t('Upload Document'), '#title' => t('Upload Document'),
'#size' => 48, '#size' => 48,
'#description' => t('Full text'), '#description' => t('Full text'),
); );
if ($xml->ingest_form->hide_file_chooser == 'TRUE') { if ($xml->ingest_form->hide_file_chooser == 'TRUE') {
$form['indicator']['ingest-file-location']['#type'] = 'hidden'; $form['indicator']['ingest-file-location']['#type'] = 'hidden';
@ -366,7 +364,7 @@ class CollectionClass {
return; return;
} }
$username = array( $username = array(
'name' => variable_get('fedora_admin_user', 'fedoraAdmin') 'name' => variable_get('fedora_admin_user', 'fedoraAdmin')
); );
$admin_user = user_load($username); $admin_user = user_load($username);
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
@ -376,12 +374,12 @@ class CollectionClass {
$pidNameSpace = variable_get('fedora_repository_pid', 'vre:'); $pidNameSpace = variable_get('fedora_repository_pid', 'vre:');
$pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); $pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":"));
$params = array( $params = array(
'numPIDs' => '', 'numPIDs' => '',
'pidNamespace' => $pidNameSpace 'pidNamespace' => $pidNameSpace
); );
$object = $soapClient->__soapCall('getNextPID', array( $object = $soapClient->__soapCall('getNextPID', array(
$params $params
)); ));
} catch (exception $e) { } catch (exception $e) {
drupal_set_message(t('Error getting Next PID: !e', array('!e' => $e->getMessage())), 'error'); drupal_set_message(t('Error getting Next PID: !e', array('!e' => $e->getMessage())), 'error');
return FALSE; return FALSE;
@ -390,7 +388,7 @@ class CollectionClass {
$pidNumber = strstr($pid, ":"); $pidNumber = strstr($pid, ":");
$pid = $pidNameSpace . ':' . 'USER-' . $user->name . '-' . substr($pidNumber, 1); $pid = $pidNameSpace . ':' . 'USER-' . $user->name . '-' . substr($pidNumber, 1);
$personal_collection_pid = array( $personal_collection_pid = array(
'fedora_personal_pid' => $pid 'fedora_personal_pid' => $pid
); );
module_load_include('inc', 'fedora_repository', 'plugins/PersonalCollectionClass'); module_load_include('inc', 'fedora_repository', 'plugins/PersonalCollectionClass');
$personalCollectionClass = new PersonalCollectionClass(); $personalCollectionClass = new PersonalCollectionClass();
@ -426,19 +424,18 @@ class CollectionClass {
$objectHelper = new ObjectHelper(); $objectHelper = new ObjectHelper();
$item = new Fedora_Item($this->pid); $item = new Fedora_Item($this->pid);
$query = NULL; $query = NULL;
if ($item->exists()) { if ($item->exists() && array_key_exists('QUERY', $item->datastreams)) {
$query = $item->get_datastream_dissemination('QUERY'); $query = $item->get_datastream_dissemination('QUERY');
} }
$results = $this->getRelatedItems($this->pid, $query); $results = $this->getRelatedItems($this->pid, $query);
$collection_items = $this->renderCollection($results, $this->pid, NULL, NULL, $page_number ); $collection_items = $this->renderCollection($results, $this->pid, NULL, NULL, $page_number);
$collection_item = new Fedora_Item($this->pid); $collection_item = new Fedora_Item($this->pid);
// Check the form post to see if we are in the middle of an ingest operation. // Check the form post to see if we are in the middle of an ingest operation.
$show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form'); $show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form');
$add_to_collection = $this->getIngestInterface(); $add_to_collection = $this->getIngestInterface();
$tabset['view_tab'] = array( $tabset['view_tab'] = array(
// $collection_fieldset = array (
'#type' => 'tabpage', '#type' => 'tabpage',
'#title' => 'View', '#title' => 'View',
'#content' => $collection_items '#content' => $collection_items
@ -461,14 +458,12 @@ class CollectionClass {
$collectionPolicyExists = $objectHelper->getMimeType($this->pid, CollectionPolicy::getDefaultDSID()); $collectionPolicyExists = $objectHelper->getMimeType($this->pid, CollectionPolicy::getDefaultDSID());
if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) {
if (!empty($collectionPolicyExists)) { if (!empty($collectionPolicyExists)) {
$allow=TRUE; $allow = TRUE;
if (module_exists('fedora_fesl')) { if (module_exists('fedora_fesl')) {
$allow= fedora_fesl_check_roles($this->pid,'write'); $allow = fedora_fesl_check_roles($this->pid, 'write');
} }
if ($allow) { if ($allow) {
// $ingestObject = '<a title="'. t('Ingest a New object into ') . $collectionName . ' '. $collection_pid . '" href="'. base_path() .
$ingestObject = drupal_get_form('fedora_repository_ingest_form', $this->pid); $ingestObject = drupal_get_form('fedora_repository_ingest_form', $this->pid);
} }
} }
} }
@ -483,7 +478,6 @@ class CollectionClass {
$path = drupal_get_path('module', 'fedora_repository'); $path = drupal_get_path('module', 'fedora_repository');
global $base_url; global $base_url;
$collection_pid = $pid; //we will be changing the pid later maybe $collection_pid = $pid; //we will be changing the pid later maybe
//module_load_include('php', ''Fedora_Repository'', 'ObjectHelper');
$objectHelper = new ObjectHelper(); $objectHelper = new ObjectHelper();
$parsedContent = NULL; $parsedContent = NULL;
$contentModels = $objectHelper->get_content_models_list($pid); $contentModels = $objectHelper->get_content_models_list($pid);
@ -539,7 +533,8 @@ class CollectionClass {
return ''; return '';
} }
} }
} else { }
else {
drupal_set_message(t("No Objects in this collection or bad query.")); drupal_set_message(t("No Objects in this collection or bad query."));
} }
return $objectList; return $objectList;

2
ObjectHelper.inc

@ -510,7 +510,7 @@ class ObjectHelper {
$pids = array(); $pids = array();
$query = 'select $object from <#ri> $query = 'select $object from <#ri>
where <info:fedora/' . $pid . '> <fedora-model:hasModel> $object where <info:fedora/' . $pid . '> <fedora-model:hasModel> $object
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>'; and $object <fedora-model:state> <info:fedora/Fedora-system:def/model#Active>';
$content_models = $collectionHelper->getRelatedItems($pid, $query); $content_models = $collectionHelper->getRelatedItems($pid, $query);
if (empty($content_models)) { if (empty($content_models)) {

Loading…
Cancel
Save