From e5027f60e3080e86915bc3d12521f44043a07860 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Mon, 27 Feb 2012 16:07:53 -0400 Subject: [PATCH 1/5] Added namespaces to relationship maninupulators for pagination --- api/fedora_item.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index d315f904..0a345723 100644 --- a/api/fedora_item.inc +++ b/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 @@ -164,7 +165,6 @@ class Fedora_Item { return $returnvalue; } - /** * Wrapper to add new or modify existing datastream * @global url $base_url @@ -270,6 +270,10 @@ class Fedora_Item { $relationship = "hasModel"; $namespaceURI = FEDORA_MODEL_URI; break; + case "isPageNumber": + $relationship = "isPageNumber"; + $namespaceURI = ISLANDORA_PAGE_URI; + break; } if (substr($object, 0, 12) != 'info:fedora/') { From 6f2442e96b8559aceebde2b06dc0db6dd33691f4 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Wed, 14 Mar 2012 14:01:19 -0300 Subject: [PATCH 2/5] Added abiltiy to force reinstallation of fedora objects --- api/fedora_item.inc | 29 +++++++++++++++++++++++++++++ fedora_repository.solutionpacks.inc | 22 +++++++++++++++------- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 0a345723..a306bdab 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -611,6 +611,35 @@ class Fedora_Item { 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 { diff --git a/fedora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc index fb09528d..fc8cd879 100644 --- a/fedora_repository.solutionpacks.inc +++ b/fedora_repository.solutionpacks.inc @@ -143,13 +143,21 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul else { $form['install_status']['#value'] = theme_image('misc/watchdog-warning.png') . t('Some objects must be re-ingested. See Objects list for details.'); } - $form['submit'] = array( - '#value' => t('Install'), - '#disabled' => !$needs_install && !$needs_update, - '#type' => 'submit', - '#name' => $solution_pack_module, - ); - + if ($need_install || $needs_update) { + $form['submit'] = array( + '#value' => t('Install'), + '#type' => 'submit', + '#name' => $solution_pack_module, + ); + } + else { + $form['force_submit'] = array( + '#value' => t('Forced Reinstall'), + '#attributes' => array('title' => ('Installs all fedora objects, reverting any changes made since installation. Use with caution.')), + '#type' => 'submit', + '#name' => $solution_pack_module, + ); + } $form['#submit'] = array( 'fedora_repository_solution_pack_form_submit', ); From eb71393289aa6094c2d8059fe7b1364f09dbc4c1 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Wed, 14 Mar 2012 15:29:10 -0300 Subject: [PATCH 3/5] Fixed typo --- fedora_repository.solutionpacks.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc index fc8cd879..df651c93 100644 --- a/fedora_repository.solutionpacks.inc +++ b/fedora_repository.solutionpacks.inc @@ -143,7 +143,7 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul else { $form['install_status']['#value'] = theme_image('misc/watchdog-warning.png') . t('Some objects must be re-ingested. See Objects list for details.'); } - if ($need_install || $needs_update) { + if ($needs_install || $needs_update) { $form['submit'] = array( '#value' => t('Install'), '#type' => 'submit', From 6429d11a8b3e9ce175702f7cea86ae080ce19788 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 15 Mar 2012 09:49:39 -0300 Subject: [PATCH 4/5] Minor code cleanup --- fedora_repository.solutionpacks.inc | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/fedora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc index df651c93..1b395548 100644 --- a/fedora_repository.solutionpacks.inc +++ b/fedora_repository.solutionpacks.inc @@ -139,25 +139,21 @@ 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"); + } - if ($needs_install || $needs_update) { - $form['submit'] = array( - '#value' => t('Install'), - '#type' => 'submit', - '#name' => $solution_pack_module, - ); - } - else { - $form['force_submit'] = array( - '#value' => t('Forced Reinstall'), - '#attributes' => array('title' => ('Installs all fedora objects, reverting any changes made since installation. Use with caution.')), - '#type' => 'submit', - '#name' => $solution_pack_module, - ); - } + $form['submit'] = array( + '#value' => $submit_button_text, + '#type' => 'submit', + '#name' => $solution_pack_module, + ); + + $form['#submit'] = array( 'fedora_repository_solution_pack_form_submit', ); From ae06196a2ec2c07d85742a92cc1842c6edf03e5c Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 15 Mar 2012 10:11:11 -0300 Subject: [PATCH 5/5] Fixed fore submit logic --- fedora_repository.solutionpacks.inc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fedora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc index 7743a0b7..5bb5a117 100644 --- a/fedora_repository.solutionpacks.inc +++ b/fedora_repository.solutionpacks.inc @@ -153,13 +153,6 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul '#type' => 'submit', '#name' => $solution_pack_module, ); - $form['forcesubmit'] = array( - '#value' => t('Force Reinstall'), - //'#disabled' => !$needs_install && !$needs_update, - '#type' => 'submit', - '#name' => $solution_pack_module, - ); - $form['#submit'] = array( 'fedora_repository_solution_pack_form_submit',