Browse Source

Merge branch '6.x' of git://github.com/Islandora/islandora into 6.x

Conflicts:
	fedora_repository.module
pull/95/head
Adam Vessey 13 years ago
parent
commit
36d10f07be
  1. 6
      ObjectHelper.inc
  2. 38
      api/fedora_item.inc
  3. 19
      fedora_repository.module
  4. 21
      fedora_repository.solutionpacks.inc
  5. 5
      formClass.inc

6
ObjectHelper.inc

@ -949,7 +949,8 @@ class ObjectHelper {
// Before executing the query, we hve a base case of accessing the top-level collection
global $base_url;
if ($pid == variable_get('fedora_repository_pid', 'islandora:root')) {
$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
//$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(variable_get('fedora_repository_title', 'Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(t('Home'), $base_url);
}
else {
@ -979,7 +980,8 @@ class ObjectHelper {
$breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid);
if ($parent == variable_get('fedora_repository_pid', 'islandora:root')) {
$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
//$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(variable_get('fedora_repository_title', 'Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(t('Home'), $base_url);
}
elseif ($level > 0) {

38
api/fedora_item.inc

@ -6,6 +6,7 @@
*/
define('RELS_EXT_URI', 'info:fedora/fedora-system:def/relations-external#');
define("FEDORA_MODEL_URI", 'info:fedora/fedora-system:def/model#');
define("ISLANDORA_PAGE_URI", 'info:islandora/islandora-system:def/pageinfo#');
/**
* Fedora Item Class
@ -297,6 +298,10 @@ RDF;
$relationship = "hasModel";
$namespaceURI = FEDORA_MODEL_URI;
break;
case "isPageNumber":
$relationship = "isPageNumber";
$namespaceURI = ISLANDORA_PAGE_URI;
break;
}
if (!empty($object) && substr($object, 0, 12) != 'info:fedora/') {
@ -633,6 +638,35 @@ RDF;
return $relationships;
}
function get_rdf_relationships() {
$relationships = array();
try {
$relsext = $this->get_datastream_dissemination('RELS-EXT');
} catch (exception $e) {
drupal_set_message(t("Error retrieving RELS-EXT of object $pid"), 'error');
return $relationships;
}
// Parse the RELS-EXT into an associative array.
$relsextxml = new DOMDocument();
$relsextxml->loadXML($relsext);
$relsextxml->normalizeDocument();
$allTags = array();
$allTags[] = $relsextxml->getElementsByTagNameNS(RELS_EXT_URI, '*');
$allTags[] = $relsextxml->getElementsByTagNameNS(FEDORA_MODEL_URI, '*');
$allTags[] = $relsextxml->getElementsByTagNameNS(ISLANDORA_PAGE_URI, '*');
foreach ($allTags as $tags) {
foreach ($tags as $child) {
$value = preg_replace('/info:fedora\//','',$child->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource'));
$relationships[$child->tagName][] = $value;
}
}
return $relationships;
}
function get_models() {
$relationships = array();
try {
@ -698,7 +732,9 @@ RDF;
$params = array(
'pid' => $this->pid,
'state' => 'D',
'logMessage' => $logMessage
'logMessage' => $logMessage,
'label' => $this->objectProfile->objLabel,
'ownerId' => null,
);
// Send message to mark the object deleted

19
fedora_repository.module

@ -2149,15 +2149,17 @@ function fedora_repository_display_schema($file) {
* @return type
*/
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_utils');
dd($object, 'Object array');
if (!empty($object) && is_array($object)) {
$pid = $object['pid'];
if (!valid_pid($pid)) {
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);
if ($item->exists()) {
@ -2175,15 +2177,14 @@ function fedora_repository_batch_reingest_object($object, &$context) {
$new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file);
if ($new_item->exists()) {
// Batch operation was successful; can still add additional DSs, though
$context['message'][] = "$new_item->pid installed.";
$context['message'][] = "{$new_item->pid} installed.";
}
}
if (!empty($object['dsid']) && !empty($object['datastream_file'])) {
$datastreams = array(
array(
'dsid' => $object['dsid'],
'datastream_file' => $object['datastream_file'],
)
$datastreams[] = array(
'dsid' => $object['dsid'],
'datastream_file' => $object['datastream_file'],
);
}
elseif (!empty($object['datastreams'])) {
@ -2211,7 +2212,7 @@ function fedora_repository_batch_reingest_object($object, &$context) {
$new_item->add_relationship('isMemberOfCollection', $object['parent']);
dd(' parent added');
}
foreach ($datastreams as $ds) {
foreach ((array)$datastreams as $ds) {
dd("trying to add ds: {$ds['dsid']}");
if ($ds['dsid'] == 'DC') {
$new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml');

21
fedora_repository.solutionpacks.inc

@ -46,19 +46,21 @@ function fedora_repository_solution_packs_page() {
* @param array $solution_pack
*/
function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) {
// Check each object to see if it is in the repository.
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
global $base_path;
$needs_update = FALSE;
$needs_install = FALSE;
$form = array();
$form['solution_pack_module'] = array(
'#type' => 'hidden',
'#value' => $solution_pack_module,
);
if (!$form_state['submitted']) {
$form['soluction_pack_name'] = array(
$form['solution_pack_name'] = array(
'#type' => 'markup',
'#value' => t($solution_pack_name),
'#prefix' => '<h3>',
@ -75,7 +77,6 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
$table_header = array('PID', 'Status');
$table_rows = array();
foreach ($objects as $object) {
$datastreams = NULL;
if (isset($object['pid'])) {
@ -139,13 +140,16 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
);
if (!$needs_install && !$needs_update) {
$form['install_status']['#value'] = theme_image('misc/watchdog-ok.png') . t('All required objects are installed and up-to-date.');
$submit_button_text = t("Force Reinstallation of Fedora Objects");
}
else {
$form['install_status']['#value'] = theme_image('misc/watchdog-warning.png') . t('Some objects must be re-ingested. See Objects list for details.');
$submit_button_text = t("Install Fedora Objects");
}
$form['submit'] = array(
'#value' => t('Install'),
'#disabled' => !$needs_install && !$needs_update,
'#value' => $submit_button_text,
'#type' => 'submit',
'#name' => $solution_pack_module,
);
@ -159,7 +163,11 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
function fedora_repository_solution_pack_form_submit($form, &$form_state) {
$what = $form_state;
$module_name = $form_state['values']['solution_pack_module'];
// This should be replaced with module_invoke
$solution_pack_info = call_user_func($module_name . '_required_fedora_objects');
//$solution_pack_info = module_invoke($module_name, 'required_fedora_objects');
$batch = array(
'title' => t('Installing / updating solution pack objects'),
'file' => drupal_get_path('module', 'fedora_repository') . '/fedora_repository.module',
@ -181,7 +189,7 @@ function solution_pack_add_form($form_name, $form_xml) {
$object->name = $form_name;
$object->form = $form_xml;
$result = drupal_write_record('xml_forms', $object);
drupal_set_message(t("Added @name", array("@name" => $name)));
drupal_set_message(t("Added @name", array("@name" => $form_name)));
}
}
@ -196,7 +204,6 @@ function solution_pack_add_form_association($content_model, $form_name) {
$object->title_field = "['titleInfo']['title']";
$object->transform = 'mods_to_dc.xsl';
$result = drupal_write_record('islandora_content_model_forms', $object);
drupal_set_message(t("Added association between @cm@name", array("@cm" => $content_model, "@name"=>$name)));
drupal_set_message(t("Added association between @cm and @name", array("@cm" => $content_model, "@name"=>$form_name)));
}
}

5
formClass.inc

@ -25,8 +25,8 @@ class formClass {
$items = array();
$items['admin/settings/fedora_repository'] = array(
'title' => t('Islandora Configure'),
'description' => t('Enter the Islandora Collection information here'),
'title' => t('Islandora Configuration'),
'description' => t("Configure Islandora's interaction with Fedora"),
'page callback' => 'drupal_get_form',
'page arguments' => array('fedora_repository_admin'),
'access arguments' => array('administer site configuration'),
@ -48,7 +48,6 @@ class formClass {
'file' => 'fedora_repository.solutionpacks.inc',
'type' => MENU_LOCAL_TASK,
);
$items['islandoracm.xsd'] = array(
'title' => t('Islandora Content Model XML Schema Definition'),
'page callback' => 'fedora_repository_display_schema',

Loading…
Cancel
Save