Browse Source

Handle redirect streams better, and various minor changes.

pull/95/head
Adam Vessey 13 years ago
parent
commit
417b1ab050
  1. 8
      CollectionPolicy.inc
  2. 7
      ConnectionHelper.inc
  3. 37
      ObjectHelper.inc
  4. 67
      api/fedora_item.inc
  5. 60
      fedora_repository.module
  6. 2
      fedora_repository.solutionpacks.inc
  7. 1
      formClass.inc
  8. 37
      plugins/FedoraObjectDetailedContent.inc

8
CollectionPolicy.inc

@ -44,7 +44,12 @@ class CollectionPolicy extends XMLDatastream {
if ($preFetch) { if ($preFetch) {
$fedoraItem = new Fedora_Item($pid); $fedoraItem = new Fedora_Item($pid);
$ds = $fedoraItem->get_datastream_dissemination($dsid); if (array_key_exists($dsid, $fedoraItem->get_datastreams_list_as_array())) {
$ds = $fedoraItem->get_datastream_dissemination($dsid);
}
else { //No collection policy stream (of the default name, anyway)
return FALSE;
}
} }
else { else {
$ds = NULL; $ds = NULL;
@ -55,7 +60,6 @@ class CollectionPolicy extends XMLDatastream {
$ret = new CollectionPolicy($ds, $pid, $dsid); $ret = new CollectionPolicy($ds, $pid, $dsid);
} }
} catch (SOAPException $e) { } catch (SOAPException $e) {
$ret = FALSE; $ret = FALSE;
} }
return $ret; return $ret;

7
ConnectionHelper.inc

@ -65,10 +65,11 @@ class ConnectionHelper {
//anonymous user. We will need an entry in the fedora users.xml file //anonymous user. We will need an entry in the fedora users.xml file
//with the appropriate entry for a username of anonymous password of anonymous //with the appropriate entry for a username of anonymous password of anonymous
try { try {
$client = new SoapClient($this->_fixURL($url, 'anonymous', 'anonymous'), array( $client = new SoapClient($url, array(
'login' => 'anonymous', 'login' => 'anonymous',
'password' => 'anonymous', 'password' => 'anonymous',
'exceptions' => $exceptions, 'exceptions' => $exceptions,
'authentication' => SOAP_AUTHENTICATION_BASIC
)); ));
} catch (SoapFault $e) { } catch (SoapFault $e) {
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))));
@ -77,10 +78,12 @@ class ConnectionHelper {
} }
else { else {
try { try {
$client = new SoapClient($this->_fixURL($url, $user->name, $user->pass), array( $client = new SoapClient($url, array(
'login' => $user->name, 'login' => $user->name,
'password' => $user->pass, 'password' => $user->pass,
'exceptions' => TRUE, 'exceptions' => TRUE,
'authentication' => SOAP_AUTHENTICATION_BASIC,
'cache_wsdl' => WSDL_CACHE_MEMORY
)); ));
} catch (SoapFault $e) { } catch (SoapFault $e) {
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))));

37
ObjectHelper.inc

@ -139,7 +139,7 @@ class ObjectHelper {
curl_setopt($ch, CURLOPT_USERPWD, "$fedoraUser:$fedoraPass"); curl_setopt($ch, CURLOPT_USERPWD, "$fedoraUser:$fedoraPass");
// There seems to be a bug in Fedora 3.1's REST authentication, removing this line fixes the authorization denied error. // There seems to be a bug in Fedora 3.1's REST authentication, removing this line fixes the authorization denied error.
// curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); // curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); // return into a variable curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // return into a variable
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
@ -151,7 +151,6 @@ class ObjectHelper {
fclose($fp); fclose($fp);
} }
else { else {
header("Content-type: $mimeType"); header("Content-type: $mimeType");
if ($contentSize > 0) { if ($contentSize > 0) {
header("Content-length: $contentSize"); header("Content-length: $contentSize");
@ -182,12 +181,38 @@ class ObjectHelper {
header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"'); header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"');
} }
if ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_exec($ch); $curl_out = curl_exec($ch);
if ($curl_out !== FALSE) {
$info = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
//dd($info, 'effective URL');
if ($url !== $info) { //Handle redirect streams (the final URL is not the same as the Fedora URL)
//Add the parameters passed to Drupal, leaving out the 'q'
$query = array();
parse_str($_SERVER['QUERY_STRING'], $query);
if (isset($query['q'])) {
unset($query['q']);
}
header('HTTP/1.1 307 Moved Temporarily');
header('Location: ' . $info . '?' . http_build_query($query)); //Fedora seems to discard the query portion.
}
elseif ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { //If not anonymous, soap is force or we're using HTTPS
//Have the webserver mediate the transfer (download and restream)
curl_setopt($ch, CURLOPT_NOBODY, FALSE);
curl_setopt($ch, CURLOPT_HTTPGET, TRUE); //CURLOPT_NOBODY sets it to 'HEAD'
$toReturn = curl_exec($ch);
echo $toReturn;
}
else {
header('Location: ' . $url);
}
} }
else { else {
header('Location: ' . $url); //Curl error...
} }
} }
curl_close($ch); curl_close($ch);
} }

67
api/fedora_item.inc

@ -211,27 +211,39 @@ class Fedora_Item {
* @param type $namespaceURI * @param type $namespaceURI
*/ */
function add_relationship($relationship, $object, $namespaceURI = RELS_EXT_URI) { function add_relationship($relationship, $object, $namespaceURI = RELS_EXT_URI) {
dd($this, 'The Fedora_Item');
$ds_list = $this->get_datastreams_list_as_array(); $ds_list = $this->get_datastreams_list_as_array();
$f_prefix = 'info:fedora/';
if (empty($ds_list['RELS-EXT'])) { if (!array_key_exists('RELS-EXT', $ds_list)) {
$this->add_datastream_from_string(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> $rdf_string = <<<RDF
<rdf:Description rdf:about="info:fedora/' . $this->pid . '"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="$f_prefix{$this->pid}">
</rdf:Description> </rdf:Description>
</rdf:RDF>', 'RELS-EXT', 'Fedora object-to-object relationship metadata', 'text/xml', 'X'); </rdf:RDF>
RDF;
dd($rdf_string, 'RELS-EXT RDF being added');
$this->add_datastream_from_string($rdf_string, 'RELS-EXT', 'Fedora object-to-object relationship metadata', 'application/rdf+xml', 'X');
dd('Added');
} }
dd('Getting RELS-EXT');
$relsext = $this->get_datastream_dissemination('RELS-EXT'); $relsext = $this->get_datastream_dissemination('RELS-EXT');
dd('Got RELS-EXT');
if (substr($object, 0, 12) != 'info:fedora/') {
$object = "info:fedora/$object"; if (substr($object, 0, strlen($f_prefix)) !== $f_prefix) {
$object = $f_prefix . $object;
} }
$relsextxml = new DomDocument(); $relsextxml = new DOMDocument();
$relsextxml->loadXML($relsext); $relsextxml->loadXML($relsext);
$description = $relsextxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description'); $description = $relsextxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description');
if ($description->length == 0) { if ($description->length == 0) {
//XXX: This really shouldn't be done; lower case d doesn't fit the schema. Warn users to fix the data and generators, pending deprecation.
$description = $relsextxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'description'); $description = $relsextxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'description');
if ($description->length > 0) {
drupal_set_message(t('RDF with lower case "d" in "description" encountered. Should be uppercase! PID: %pid', array('%pid' => $this->pid)), 'warning');
}
} }
$description = $description->item(0); $description = $description->item(0);
@ -241,7 +253,7 @@ class Fedora_Item {
$newrel->setAttribute('rdf:resource', $object); $newrel->setAttribute('rdf:resource', $object);
$description->appendChild($newrel); $description->appendChild($newrel);
$this->modify_datastream_by_value($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml'); $this->modify_datastream_by_value($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'application/rdf+xml');
//print ($description->dump_node()); //print ($description->dump_node());
/* /*
$params = array( 'pid' => $this->pid, $params = array( 'pid' => $this->pid,
@ -287,7 +299,7 @@ class Fedora_Item {
break; break;
} }
if (substr($object, 0, 12) != 'info:fedora/') { if (!empty($object) && substr($object, 0, 12) != 'info:fedora/') {
$object = "info:fedora/$object"; $object = "info:fedora/$object";
} }
@ -297,7 +309,7 @@ class Fedora_Item {
$rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship); $rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship);
if (!empty($rels)) { if (!empty($rels)) {
foreach ($rels as $rel) { foreach ($rels as $rel) {
if ($rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) { if (empty($object) || $rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) {
$rel->parentNode->removeChild($rel); $rel->parentNode->removeChild($rel);
$modified = TRUE; $modified = TRUE;
} }
@ -307,7 +319,6 @@ class Fedora_Item {
$this->modify_datastream_by_value($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml'); $this->modify_datastream_by_value($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml');
} }
return $modified; return $modified;
//print ($description->dump_node());
} }
/** /**
@ -743,8 +754,9 @@ class Fedora_Item {
* @return type * @return type
*/ */
function url() { function url() {
global $base_url; return url('fedora/repository/' . $this->pid . (!empty($this->objectProfile) ? '/-/' . drupal_urlencode($this->objectProfile->objLabel) : ''), array(
return $base_url . '/fedora/repository/' . $this->pid . (!empty($this->objectProfile) ? '/-/' . drupal_urlencode($this->objectProfile->objLabel) : ''); 'absolute' => TRUE
));
} }
/** /**
@ -780,9 +792,14 @@ class Fedora_Item {
* @param type $foxml * @param type $foxml
* @return Fedora_Item * @return Fedora_Item
*/ */
static function ingest_from_FOXML($foxml) { static function ingest_from_FOXML(DOMDocument $foxml) {
$params = array('objectXML' => $foxml->saveXML(), 'format' => "info:fedora/fedora-system:FOXML-1.1", 'logMessage' => "Fedora Object Ingested"); $params = array(
'objectXML' => $foxml->saveXML(),
'format' => 'info:fedora/fedora-system:FOXML-1.1',
'logMessage' => 'Fedora Object Ingested'
);
$object = self::soap_call('ingest', $params); $object = self::soap_call('ingest', $params);
dd($object, 'Soap return');
return new Fedora_Item($object->objectPID); return new Fedora_Item($object->objectPID);
} }
@ -982,25 +999,23 @@ class Fedora_Item {
} }
} }
$root_element = $foxml->createElement("foxml:digitalObject"); $root_element = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:digitalObject");
$root_element->setAttribute("VERSION", "1.1"); $root_element->setAttribute("VERSION", "1.1");
$root_element->setAttribute("PID", $pid); $root_element->setAttribute("PID", $pid);
$root_element->setAttribute("xmlns:foxml", "info:fedora/fedora-system:def/foxml#"); $root_element->setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd");
$root_element->setAttribute("xmlns:xsl", "http://www.w3.org/2001/XMLSchema-instance");
$root_element->setAttribute("xsl:schemaLocation", "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd");
$foxml->appendChild($root_element); $foxml->appendChild($root_element);
// FOXML object properties section // FOXML object properties section
$object_properties = $foxml->createElement("foxml:objectProperties"); $object_properties = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:objectProperties");
$state_property = $foxml->createElement("foxml:property"); $state_property = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:property");
$state_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); $state_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#state");
$state_property->setAttribute("VALUE", $state); $state_property->setAttribute("VALUE", $state);
$label_property = $foxml->createElement("foxml:property"); $label_property = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:property");
$label_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); $label_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#label");
$label_property->setAttribute("VALUE", $label); $label_property->setAttribute("VALUE", $label);
$owner_property = $foxml->createElement("foxml:property"); $owner_property = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:property");
$owner_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); $owner_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId");
$owner_property->setAttribute("VALUE", $owner); $owner_property->setAttribute("VALUE", $owner);
@ -1009,7 +1024,7 @@ class Fedora_Item {
$object_properties->appendChild($owner_property); $object_properties->appendChild($owner_property);
$root_element->appendChild($object_properties); $root_element->appendChild($object_properties);
$foxml->appendChild($root_element); $foxml->appendChild($root_element);
//dd($foxml->saveXML(), 'XML to ingest'); Worked on 2012/01/16
return $foxml; return $foxml;
} }

60
fedora_repository.module

@ -146,14 +146,13 @@ function fedora_repository_ingest_form_submit(array $form, array &$form_state) {
$form_state['submitted'] = FALSE; $form_state['submitted'] = FALSE;
return; return;
} }
if ($form_state['storage']['xml']) { //ddebug_backtrace();
if (module_exists('islandora_content_model_forms')) { if ($form_state['storage']['xml'] && module_exists('islandora_content_model_forms')) {
module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm'); module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm');
$xml_form = new IngestObjectMetadataForm(); $xml_form = new IngestObjectMetadataForm();
$xml_form->submit($form, $form_state); $xml_form->submit($form, $form_state);
}
} }
elseif ($form_state['clicked_button']['#id'] == 'edit-submit') { elseif (strpos($form_state['clicked_button']['#id'], 'edit-submit') === 0) {
global $base_url; global $base_url;
module_load_include('inc', 'fedora_repository', 'CollectionClass'); module_load_include('inc', 'fedora_repository', 'CollectionClass');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
@ -188,7 +187,7 @@ function fedora_repository_ingest_form_submit(array $form, array &$form_state) {
} }
if ($redirect) { if ($redirect) {
$form_state['redirect'] = ($err) ? ' ' : $base_url . "/fedora/repository/{$form_state['values']['collection_pid']}"; $form_state['redirect'] = ($err) ? ' ' : url("fedora/repository/{$form_state['values']['collection_pid']}");
} }
} }
} }
@ -205,7 +204,7 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
$form_state['submitted'] = FALSE; $form_state['submitted'] = FALSE;
return; return;
} }
if ($form_state['clicked_button']['#id'] == 'edit-submit' && $form_state['ahah_submission'] != 1) { if (strpos($form_state['clicked_button']['#id'], 'edit-submit') === 0 && $form_state['ahah_submission'] != 1) {
switch ($form_state['storage']['step']) { switch ($form_state['storage']['step']) {
case 1: case 1:
$form_state['storage']['step']++; $form_state['storage']['step']++;
@ -286,7 +285,8 @@ function fedora_repository_ingest_form(&$form_state, $collection_pid, $collectio
$ingestForm = new formClass(); $ingestForm = new formClass();
$form_state['storage']['content_model'] = $content_model; $form_state['storage']['content_model'] = $content_model;
$form_state['storage']['collection_pid'] = $collection_pid; $form_state['storage']['collection_pid'] = $collection_pid;
return $ingestForm->createIngestForm($collection_pid, $collection_label, $form_state); $form = $ingestForm->createIngestForm($collection_pid, $collection_label, $form_state);
return $form;
} }
/** /**
@ -1706,22 +1706,22 @@ function fedora_repository_required_fedora_objects() {
'pid' => 'islandora:collectionCModel', 'pid' => 'islandora:collectionCModel',
'label' => 'Islandora Collection Content Model', 'label' => 'Islandora Collection Content Model',
'dsid' => 'ISLANDORACM', 'dsid' => 'ISLANDORACM',
'datastream_file' => "$module_path/content_models/COLLECTIONCM.xml", 'datastream_file' => "./$module_path/content_models/COLLECTIONCM.xml",
'dsversion' => 2, 'dsversion' => 2,
'cmodel' => 'fedora-system:ContentModel-3.0', 'cmodel' => 'info:fedora/fedora-system:ContentModel-3.0',
), ),
array( array(
'pid' => 'islandora:root', 'pid' => 'islandora:root',
'label' => 'Islandora Top-level Collection', 'label' => 'Islandora Top-level Collection',
'cmodel' => 'islandora:collectionCModel', 'cmodel' => 'info:fedora/islandora:collectionCModel',
'datastreams' => array( 'datastreams' => array(
array( array(
'dsid' => 'COLLECTION_POLICY', 'dsid' => 'COLLECTION_POLICY',
'datastream_file' => "$module_path/collection_policies/COLLECTION-COLLECTION POLICY.xml", 'datastream_file' => "./$module_path/collection_policies/COLLECTION-COLLECTION POLICY.xml",
), ),
array( array(
'dsid' => 'TN', 'dsid' => 'TN',
'datastream_file' => "$module_path/images/Gnome-emblem-photos.png", 'datastream_file' => "./$module_path/images/Gnome-emblem-photos.png",
'mimetype' => 'image/png', 'mimetype' => 'image/png',
), ),
), ),
@ -2152,23 +2152,30 @@ function fedora_repository_display_schema($file) {
function fedora_repository_batch_reingest_object($object, &$context) { function fedora_repository_batch_reingest_object($object, &$context) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
dd($object, 'Object array');
if (!empty($object) && is_array($object)) { if (!empty($object) && is_array($object)) {
$pid = $object['pid']; $pid = $object['pid'];
if (!valid_pid($pid)) { if (!valid_pid($pid)) {
return NULL; return NULL;
} }
// Does the object exist? If so, purge it. // Does the object exist? If so, purge it.
dd("About to test existence of PID: $pid");
$item = new Fedora_Item($pid); $item = new Fedora_Item($pid);
if ($item->exists()) { if ($item->exists()) {
dd(' Found');
$item->purge(t('Remove during re-install batch job')); $item->purge(t('Remove during re-install batch job'));
dd(' Purged');
} }
$new_item = NULL; //Need to have this a couple places... (After trying from FOXML and later for individual DSs)
$datastreams = array(); //Seems like this might be getting messed up due to scope?
// Ingest the object from the source file. // Ingest the object from the source file.
if (!empty($object['foxml_file'])) { if (!empty($object['foxml_file'])) {
$foxml_file = $object['foxml_file']; $foxml_file = $object['foxml_file'];
$new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file); $new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file);
if ($new_item->exists()) { if ($new_item->exists()) {
// Batch operation was successful. // Batch operation was successful; can still add additional DSs, though
$context['message'][] = "$new_item->pid installed."; $context['message'][] = "$new_item->pid installed.";
} }
} }
@ -2184,18 +2191,29 @@ function fedora_repository_batch_reingest_object($object, &$context) {
$datastreams = $object['datastreams']; $datastreams = $object['datastreams'];
} }
if (!empty($datastreams) && is_array($datastreams)) { $label = !empty($object['label']) ? $object['label'] : '';
$label = !empty($object['label']) ? $object['label'] : ''; if (!isset($new_item)) {
if (empty($object['foxml_file']) && !isset($new_item)) { dd(' Not found, creating');
$new_item = Fedora_Item::ingest_new_item($object['pid'], 'A', $label); $new_item = Fedora_Item::ingest_new_item($pid, 'A', $label);
} dd(' Created');
}
elseif (!empty($label)) {
$new_item->modify_object($label);
}
if (isset($new_item)) {
if (!empty($object['cmodel'])) { if (!empty($object['cmodel'])) {
dd(' relating to cmodel');
$new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI); $new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI);
dd(' related to cmodel');
} }
if (!empty($object['parent'])) { if (!empty($object['parent'])) {
dd(' adding parent');
$new_item->add_relationship('isMemberOfCollection', $object['parent']); $new_item->add_relationship('isMemberOfCollection', $object['parent']);
dd(' parent added');
} }
foreach ($datastreams as $ds) { foreach ($datastreams as $ds) {
dd("trying to add ds: {$ds['dsid']}");
if ($ds['dsid'] == 'DC') { if ($ds['dsid'] == 'DC') {
$new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml'); $new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml');
} }

2
fedora_repository.solutionpacks.inc

@ -109,7 +109,7 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
$object_status = 'Missing datastream'; $object_status = 'Missing datastream';
break; break;
} }
if (isset($ds['dsversion'])) { elseif (isset($ds['dsversion'])) {
// Check if the datastream is versioned and needs updating. // Check if the datastream is versioned and needs updating.
$installed_version = fedora_repository_get_islandora_datastream_version($item, $ds['dsid']); $installed_version = fedora_repository_get_islandora_datastream_version($item, $ds['dsid']);
$available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']); $available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']);

1
formClass.inc

@ -602,6 +602,7 @@ class formClass {
$form = new IngestObjectMetadataForm(); $form = new IngestObjectMetadataForm();
return $form->create($collection_pid, $collection_label, $form_state); return $form->create($collection_pid, $collection_label, $form_state);
} catch (Exception $e) { } catch (Exception $e) {
dd('An error occured; reverting to QDC form...');
$form_state['storage']['xml'] = FALSE; // An error occured revert back to the QDC Form. $form_state['storage']['xml'] = FALSE; // An error occured revert back to the QDC Form.
} }
} }

37
plugins/FedoraObjectDetailedContent.inc

@ -43,6 +43,7 @@ class FedoraObjectDetailedContent {
'#type' => 'tabpage', '#type' => 'tabpage',
'#title' => t('Object Details'), '#title' => t('Object Details'),
'#selected' => $details_selected, '#selected' => $details_selected,
'#weight' => 100, //XXX: Make the weight configurable?
); );
$tabset['fedora_object_details']['tabset'] = array( $tabset['fedora_object_details']['tabset'] = array(
'#type' => 'tabset', '#type' => 'tabset',
@ -51,12 +52,28 @@ class FedoraObjectDetailedContent {
$ds_list = $objectHelper->get_formatted_datastream_list($this->pid, NULL, $this->item); $ds_list = $objectHelper->get_formatted_datastream_list($this->pid, NULL, $this->item);
$i = 0;
$tabset['fedora_object_details']['tabset']['view'] = array( if (fedora_repository_access(OBJECTHELPER :: $VIEW_DETAILED_CONTENT_LIST, $this->pid, $user)) {
'#type' => 'tabpage', $tabset['fedora_object_details']['tabset']['view'] = array(
'#title' => t('View'), '#type' => 'tabpage',
'#content' => $dc_html . $ds_list . $purge_form, '#title' => t('View'),
); 'dc' => array(
'#type' => 'markup',
'#value' => $dc_html, //XXX: This could easily be done in Drupal, instead of using an XSL
'#weight' => $i++
),
'list' => array(
'#type' => 'markup',
'#value' => $ds_list, //XXX: The function called here could be cleaned up a fair bit as well...
'#weight' => $i++
),
'purge' => array(
'#type' => 'markup',
'#value' => $purge_form,
'#weight' => $i++
)
);
}
if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) {
$editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC');
@ -68,7 +85,13 @@ class FedoraObjectDetailedContent {
); );
} }
return $tabset; $ts = $tabset['fedora_object_details']['tabset'];
if (array_key_exists('view', $ts) || array_key_exists('edit', $ts)) {
return $tabset;
}
else {
return array();
}
} }
} }

Loading…
Cancel
Save