From 5f14839cbd8df324a1291bf0f24aed904e0c0209 Mon Sep 17 00:00:00 2001 From: mroy Date: Wed, 1 Dec 2010 16:48:49 -0600 Subject: [PATCH 1/7] Removed easing from filechooser. --- form_elements/js/filechooser.js | 1 - 1 file changed, 1 deletion(-) diff --git a/form_elements/js/filechooser.js b/form_elements/js/filechooser.js index ac81ec47..7a9625ef 100644 --- a/form_elements/js/filechooser.js +++ b/form_elements/js/filechooser.js @@ -63,7 +63,6 @@ $(document).ready(function () { mouseWheel: true, circular: false, speed: 750, - easing: "bounceout", visible: visibleFiles, scroll: visibleFiles, initial: selectedIndex From a29d95297c51037d37d4fefabd2c3ad36fcba75b Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 2 Dec 2010 13:56:48 -0400 Subject: [PATCH 2/7] Suppress warnings from bad HTML in book MODS record retrieval. --- ilives/fedora_ilives.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ilives/fedora_ilives.module b/ilives/fedora_ilives.module index 84a4b4a5..ddab8d77 100644 --- a/ilives/fedora_ilives.module +++ b/ilives/fedora_ilives.module @@ -430,7 +430,7 @@ function retrieve_unapi_MODS_record($url) { $bib_response = drupal_http_request($url); $bib_html = $bib_response->data; $bib_doc = new DOMDocument; - $bib_doc->loadHTML($bib_html); + @$bib_doc->loadHTML($bib_html); $links = $bib_doc->getElementsByTagName('link'); foreach ($links as $link) { if ($link->getAttribute('rel') == 'unapi-server') { From 1cfd45cc028acfec62b4d5db50af5736a890b931 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 2 Dec 2010 14:25:37 -0400 Subject: [PATCH 3/7] Cosmetic improvements to book ingest process. --- ilives/book.inc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ilives/book.inc b/ilives/book.inc index d1ad5055..c7ec2eec 100644 --- a/ilives/book.inc +++ b/ilives/book.inc @@ -36,16 +36,17 @@ class IslandoraBook { '#title' => 'Catalogue item URL', ); $form['unapi_url_submit'] = array( - '#type' => 'submit', - '#value' => t('Retrieve MODS record'), - '#submit' => array('fedora_ilives_retrieve_unapi_submit'), - '#ahah' => array( - 'path' => 'fedora/ilives/retrieve_unapi/js', // path we defined in hook_menu - 'wrapper' => 'mods-wrapper', // the HTML that wraps the element that needs to be replaced - 'method' => 'replace', // the method we're going to use: a replace operation - 'effect' => 'fade', // the effect used when replacing the element (try fade!) - ) - ); + '#type' => 'submit', + '#value' => t('Retrieve MODS record'), + '#submit' => array('fedora_ilives_retrieve_unapi_submit'), + '#ahah' => array( + 'path' => 'fedora/ilives/retrieve_unapi/js', // path we defined in hook_menu + 'wrapper' => 'mods-wrapper', // the HTML that wraps the element that needs to be replaced + 'method' => 'replace', // the method we're going to use: a replace operation + //'effect' => 'fade', // the effect used when replacing the element (try fade!) + ), + '#suffix' => '
', + ); drupal_add_js('', 'inline'); // We define a
wrapper. Everything in it will be replaced. $form['mods'] = array( @@ -56,6 +57,7 @@ class IslandoraBook { $form['mods']['mods_record'] = array( '#type' => 'textarea', '#title' => 'MODS Record to Import', + '#rows' => 20, '#value' => (!empty($mods_save) ? $mods_save['mods']['mods_record'] : ''), ); return $form; From 2a8a1a78a45e28b65b51c5c6defc7fe86d36c056 Mon Sep 17 00:00:00 2001 From: mroy Date: Fri, 3 Dec 2010 17:27:25 -0600 Subject: [PATCH 4/7] Set number of messages to handle at once to 100. 500 was too high and would often not finish before the next cron. I have it set to run every 10 mins on my implementation. --- workflow_client/islandora_workflow_client.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow_client/islandora_workflow_client.module b/workflow_client/islandora_workflow_client.module index a361f5a8..7c2d8946 100644 --- a/workflow_client/islandora_workflow_client.module +++ b/workflow_client/islandora_workflow_client.module @@ -269,7 +269,7 @@ function islandora_workflow_client_cron() $queue='/queue/fedora.apim.update'; $con->subscribe($queue); $messagesToSend=array(); - for ($i=0;$i<500;$i++) { + for ($i=0;$i<100;$i++) { $msg = $con->readFrame(); if ($msg != null) { From 3d28455bb13bf44d92d790cfa7b583dd9d5551ae Mon Sep 17 00:00:00 2001 From: mroy Date: Fri, 3 Dec 2010 17:30:07 -0600 Subject: [PATCH 5/7] Fixed a couple bugs with alternative titles. Added alternative handling for originInfo dates. Updated the edit metadata form builder to combine multiple xpath results for list types. made some private variables protected so that they may be used by extended classes. --- plugins/ModsFormBuilder.inc | 69 +++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/plugins/ModsFormBuilder.inc b/plugins/ModsFormBuilder.inc index 3c135d6e..47dab34c 100644 --- a/plugins/ModsFormBuilder.inc +++ b/plugins/ModsFormBuilder.inc @@ -5,9 +5,9 @@ module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); class ModsFormBuilder extends FormBuilder { static $MODS_NS = 'http://www.loc.gov/mods/v3'; - private $cm; - private $item; - private $pid; + protected $cm; + protected $item; + protected $pid; function __construct($pid=null) { @@ -43,7 +43,7 @@ class ModsFormBuilder extends FormBuilder { '#type' => 'fieldset', '#title' => t('Edit metadata'), ); - + if ($this->cm !== FALSE && $this->item != NULL) { $form['pid'] = array('#type'=>'hidden','#value'=>$this->pid); @@ -85,9 +85,12 @@ class ModsFormBuilder extends FormBuilder { $includeEl=FALSE; break; + case '#edit_metadata_xpath': $nodeList = $xpath->evaluate($val); -// echo $val. ' '.$nodeList->length.' '. $nodeList. '
'; +// echo $val. ' '.$nodeList->length.' '; +// echo $nodeList->item(0)->nodeValue.' '; +// echo '
'; if (is_string($nodeList)) { @@ -101,7 +104,15 @@ class ModsFormBuilder extends FormBuilder { } } else if ($nodeList->length > 0) { - $el['#default_value'] = $nodeList->item(0)->nodeValue; + if ($el['#type'] == 'list') { + $values=array(); + for ($i=0;$i<$nodeList->length;$i++) { + $values[]=$nodeList->item($i)->nodeValue; + } + $el['#default_value']=join('; ',$values); + } else { + $el['#default_value'] = $nodeList->item(0)->nodeValue; + } } break; } @@ -389,19 +400,19 @@ class ModsFormBuilder extends FormBuilder { $titles=preg_split('/\s+\;\s+/',trim($form_values['mods_alternative_titles'])); foreach ($titles as $t) { $titleinfo = $dom->createElement('mods:titleInfo'); - $titleinfo->setAttribute('alternative') ; + $titleinfo->setAttribute('type','alternative') ; $title = $dom->createElement('mods:title',$t); - $titleInfo->appendChild($title); - $mods->appendChild($title); + $titleinfo->appendChild($title); + $mods->appendChild($titleinfo); } } if (isset($form_values['mods_alternative_title']) && trim($form_values['mods_alternative_title']) != '') { $titleinfo = $dom->createElement('mods:titleInfo'); - $titleinfo->setAttribute('alternative') ; + $titleinfo->setAttribute('type','alternative') ; $title = $dom->createElement('mods:title',trim($form_values['mods_alternative_title'])); - $titleInfo->appendChild($title); - $mods->appendChild($title); + $titleinfo->appendChild($title); + $mods->appendChild($titleinfo); } if (isset($form_values['mods_description']) && trim($form_values['mods_description']) != '') { @@ -462,7 +473,8 @@ class ModsFormBuilder extends FormBuilder { $originInfo->appendChild($edition); $addOriginInfo = TRUE; } - + + if (isset($form_values['mods_pubinfo_date']) && trim($form_values['mods_pubinfo_date']) != '' && isset($form_values['mods_pubinfo_dateType']) && trim($form_values['mods_pubinfo_dateType']) != '') { if (in_array($form_values['mods_pubinfo_dateType'], array('issued', 'created', 'copyright', 'captured'))) { @@ -475,18 +487,45 @@ class ModsFormBuilder extends FormBuilder { } $originInfo->appendChild($date); $addOriginInfo = TRUE; + } else { + if (isset($form_values['mods_createdDate'])) { + $date = $dom->createElement('mods:createdDate',htmlspecialchars(trim($form_values['mods_createdDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_issuedDate'])) { + $date = $dom->createElement('mods:issuedDate',htmlspecialchars(trim($form_values['mods_issuedDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_copyrightDate'])) { + $date = $dom->createElement('mods:copyrightDate',htmlspecialchars(trim($form_values['mods_copyrightDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_capturedDate'])) { + $date = $dom->createElement('mods:capturedDate',htmlspecialchars(trim($form_values['mods_capturedDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + } if (isset($form_values['mods_pubinfo_journalFreq']) && trim($form_values['mods_pubinfo_journalFreq']) != '') { $frequency = $dom->createElement('mods:frequency', htmlspecialchars(trim($form_values['mods_pubinfo_journalFreq']))); $originInfo->appendChild($frequency); $issuance= $dom->createElement('mods:issuance', 'journal'); + $originInfo->appendChild($issuance); $addOriginInfo = TRUE; } - else { + elseif (isset($form_values['mods_pubinfo_journalFreq'])) { $issuance= $dom->createElement('mods:issuance', 'monographic'); + $originInfo->appendChild($issuance); } - $originInfo->appendChild($issuance); + if ($addOriginInfo) { $mods->appendChild($originInfo); From 597bf501841c3933eb8f06d99b699604acbb3d41 Mon Sep 17 00:00:00 2001 From: mroy Date: Fri, 3 Dec 2010 17:30:53 -0600 Subject: [PATCH 6/7] Added isPartOf relationship to the ri query used to generate breadcrumbs. --- ObjectHelper.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 0cb03f00..80d354df 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -992,7 +992,8 @@ class ObjectHelper { where ( $title and $parentObject $content and ( $parentObject - or $parentObject) + or $parentObject + or $parentObject) and $parentObject ) minus $content order by $title'; From 7d705638753bec31359eb1782990e762416e319e Mon Sep 17 00:00:00 2001 From: mroy Date: Fri, 3 Dec 2010 17:32:05 -0600 Subject: [PATCH 7/7] Updated fedora_repository_ingest_object and fedora_repository_edit_qdc_form to include proper breadcrumbs. --- fedora_repository.module | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fedora_repository.module b/fedora_repository.module index 3df97f91..093bdb2d 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -91,6 +91,7 @@ function fedora_repository_collection_view($pid = NULL, $collection = NULL, $pag function fedora_repository_ingest_object($collection_pid=NULL, $collection_label = NULL, $content_model = NULL) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); if (!user_access('ingest new fedora objects')) { drupal_set_message(t('You do not have permission to ingest.'), 'error'); return ''; @@ -112,6 +113,11 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label } $output = drupal_get_form('fedora_repository_ingest_form', $collection_pid, $collection_label, $content_model); + $breadcrumbs = array(); + $objectHelper = new ObjectHelper(); + $objectHelper->getBreadcrumbs($collection_pid, $breadcrumbs); + drupal_set_breadcrumb(array_reverse($breadcrumbs)); + return $output; } @@ -586,6 +592,11 @@ function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); // Check if there is a custom edit metadata function defined in the content model. + $breadcrumbs = array(); + $objectHelper = new ObjectHelper(); + $objectHelper->getBreadcrumbs($pid, $breadcrumbs); + drupal_set_breadcrumb(array_reverse($breadcrumbs)); + $output = ''; if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) {