Browse Source

Merge branch 'master' of github.com:Islandora/islandora

pull/105/head
root 14 years ago
parent
commit
16eb7fa151
  1. 3
      ObjectHelper.inc
  2. 11
      fedora_repository.module
  3. 1
      form_elements/js/filechooser.js
  4. 22
      ilives/book.inc
  5. 2
      ilives/fedora_ilives.module
  6. 69
      plugins/ModsFormBuilder.inc
  7. 2
      workflow_client/islandora_workflow_client.module

3
ObjectHelper.inc

@ -992,7 +992,8 @@ class ObjectHelper {
where (<info:fedora/' . $pid . '> <dc:title> $title where (<info:fedora/' . $pid . '> <dc:title> $title
and $parentObject <fedora-model:hasModel> $content and $parentObject <fedora-model:hasModel> $content
and (<info:fedora/' . $pid . '> <fedora-rels-ext:isMemberOfCollection> $parentObject and (<info:fedora/' . $pid . '> <fedora-rels-ext:isMemberOfCollection> $parentObject
or <info:fedora/' . $pid . '> <fedora-rels-ext:isMemberOf> $parentObject) or <info:fedora/' . $pid . '> <fedora-rels-ext:isMemberOf> $parentObject
or <info:fedora/' . $pid . '> <fedora-rels-ext:isPartOf> $parentObject)
and $parentObject <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) and $parentObject <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)
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';

11
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) { 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', 'api/fedora_utils');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
if (!user_access('ingest new fedora objects')) { if (!user_access('ingest new fedora objects')) {
drupal_set_message(t('You do not have permission to ingest.'), 'error'); drupal_set_message(t('You do not have permission to ingest.'), 'error');
return ''; 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); $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; 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')); $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. // 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 = ''; $output = '';
if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) {

1
form_elements/js/filechooser.js

@ -63,7 +63,6 @@ $(document).ready(function () {
mouseWheel: true, mouseWheel: true,
circular: false, circular: false,
speed: 750, speed: 750,
easing: "bounceout",
visible: visibleFiles, visible: visibleFiles,
scroll: visibleFiles, scroll: visibleFiles,
initial: selectedIndex initial: selectedIndex

22
ilives/book.inc

@ -36,16 +36,17 @@ class IslandoraBook {
'#title' => 'Catalogue item URL', '#title' => 'Catalogue item URL',
); );
$form['unapi_url_submit'] = array( $form['unapi_url_submit'] = array(
'#type' => 'submit', '#type' => 'submit',
'#value' => t('Retrieve MODS record'), '#value' => t('Retrieve MODS record'),
'#submit' => array('fedora_ilives_retrieve_unapi_submit'), '#submit' => array('fedora_ilives_retrieve_unapi_submit'),
'#ahah' => array( '#ahah' => array(
'path' => 'fedora/ilives/retrieve_unapi/js', // path we defined in hook_menu '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 '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 'method' => 'replace', // the method we're going to use: a replace operation
'effect' => 'fade', // the effect used when replacing the element (try fade!) //'effect' => 'fade', // the effect used when replacing the element (try fade!)
) ),
); '#suffix' => '<br/>',
);
drupal_add_js('', 'inline'); drupal_add_js('', 'inline');
// We define a <div> wrapper. Everything in it will be replaced. // We define a <div> wrapper. Everything in it will be replaced.
$form['mods'] = array( $form['mods'] = array(
@ -56,6 +57,7 @@ class IslandoraBook {
$form['mods']['mods_record'] = array( $form['mods']['mods_record'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => 'MODS Record to Import', '#title' => 'MODS Record to Import',
'#rows' => 20,
'#value' => (!empty($mods_save) ? $mods_save['mods']['mods_record'] : ''), '#value' => (!empty($mods_save) ? $mods_save['mods']['mods_record'] : ''),
); );
return $form; return $form;

2
ilives/fedora_ilives.module

@ -430,7 +430,7 @@ function retrieve_unapi_MODS_record($url) {
$bib_response = drupal_http_request($url); $bib_response = drupal_http_request($url);
$bib_html = $bib_response->data; $bib_html = $bib_response->data;
$bib_doc = new DOMDocument; $bib_doc = new DOMDocument;
$bib_doc->loadHTML($bib_html); @$bib_doc->loadHTML($bib_html);
$links = $bib_doc->getElementsByTagName('link'); $links = $bib_doc->getElementsByTagName('link');
foreach ($links as $link) { foreach ($links as $link) {
if ($link->getAttribute('rel') == 'unapi-server') { if ($link->getAttribute('rel') == 'unapi-server') {

69
plugins/ModsFormBuilder.inc

@ -5,9 +5,9 @@
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
class ModsFormBuilder extends FormBuilder { class ModsFormBuilder extends FormBuilder {
static $MODS_NS = 'http://www.loc.gov/mods/v3'; static $MODS_NS = 'http://www.loc.gov/mods/v3';
private $cm; protected $cm;
private $item; protected $item;
private $pid; protected $pid;
function __construct($pid=null) function __construct($pid=null)
{ {
@ -43,7 +43,7 @@ class ModsFormBuilder extends FormBuilder {
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => t('Edit metadata'), '#title' => t('Edit metadata'),
); );
if ($this->cm !== FALSE && $this->item != NULL) { if ($this->cm !== FALSE && $this->item != NULL) {
$form['pid'] = array('#type'=>'hidden','#value'=>$this->pid); $form['pid'] = array('#type'=>'hidden','#value'=>$this->pid);
@ -85,9 +85,12 @@ class ModsFormBuilder extends FormBuilder {
$includeEl=FALSE; $includeEl=FALSE;
break; break;
case '#edit_metadata_xpath': case '#edit_metadata_xpath':
$nodeList = $xpath->evaluate($val); $nodeList = $xpath->evaluate($val);
// echo $val. ' '.$nodeList->length.' '. $nodeList. '<br/>'; // echo $val. ' '.$nodeList->length.' ';
// echo $nodeList->item(0)->nodeValue.' ';
// echo '<br/>';
if (is_string($nodeList)) if (is_string($nodeList))
{ {
@ -101,7 +104,15 @@ class ModsFormBuilder extends FormBuilder {
} }
} else if ($nodeList->length > 0) } 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; break;
} }
@ -389,19 +400,19 @@ class ModsFormBuilder extends FormBuilder {
$titles=preg_split('/\s+\;\s+/',trim($form_values['mods_alternative_titles'])); $titles=preg_split('/\s+\;\s+/',trim($form_values['mods_alternative_titles']));
foreach ($titles as $t) { foreach ($titles as $t) {
$titleinfo = $dom->createElement('mods:titleInfo'); $titleinfo = $dom->createElement('mods:titleInfo');
$titleinfo->setAttribute('alternative') ; $titleinfo->setAttribute('type','alternative') ;
$title = $dom->createElement('mods:title',$t); $title = $dom->createElement('mods:title',$t);
$titleInfo->appendChild($title); $titleinfo->appendChild($title);
$mods->appendChild($title); $mods->appendChild($titleinfo);
} }
} }
if (isset($form_values['mods_alternative_title']) && trim($form_values['mods_alternative_title']) != '') { if (isset($form_values['mods_alternative_title']) && trim($form_values['mods_alternative_title']) != '') {
$titleinfo = $dom->createElement('mods:titleInfo'); $titleinfo = $dom->createElement('mods:titleInfo');
$titleinfo->setAttribute('alternative') ; $titleinfo->setAttribute('type','alternative') ;
$title = $dom->createElement('mods:title',trim($form_values['mods_alternative_title'])); $title = $dom->createElement('mods:title',trim($form_values['mods_alternative_title']));
$titleInfo->appendChild($title); $titleinfo->appendChild($title);
$mods->appendChild($title); $mods->appendChild($titleinfo);
} }
if (isset($form_values['mods_description']) && trim($form_values['mods_description']) != '') { if (isset($form_values['mods_description']) && trim($form_values['mods_description']) != '') {
@ -462,7 +473,8 @@ class ModsFormBuilder extends FormBuilder {
$originInfo->appendChild($edition); $originInfo->appendChild($edition);
$addOriginInfo = TRUE; $addOriginInfo = TRUE;
} }
if (isset($form_values['mods_pubinfo_date']) && trim($form_values['mods_pubinfo_date']) != '' && 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']) != '') { 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'))) { if (in_array($form_values['mods_pubinfo_dateType'], array('issued', 'created', 'copyright', 'captured'))) {
@ -475,18 +487,45 @@ class ModsFormBuilder extends FormBuilder {
} }
$originInfo->appendChild($date); $originInfo->appendChild($date);
$addOriginInfo = TRUE; $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']) != '') { 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']))); $frequency = $dom->createElement('mods:frequency', htmlspecialchars(trim($form_values['mods_pubinfo_journalFreq'])));
$originInfo->appendChild($frequency); $originInfo->appendChild($frequency);
$issuance= $dom->createElement('mods:issuance', 'journal'); $issuance= $dom->createElement('mods:issuance', 'journal');
$originInfo->appendChild($issuance);
$addOriginInfo = TRUE; $addOriginInfo = TRUE;
} }
else { elseif (isset($form_values['mods_pubinfo_journalFreq'])) {
$issuance= $dom->createElement('mods:issuance', 'monographic'); $issuance= $dom->createElement('mods:issuance', 'monographic');
$originInfo->appendChild($issuance);
} }
$originInfo->appendChild($issuance);
if ($addOriginInfo) { if ($addOriginInfo) {
$mods->appendChild($originInfo); $mods->appendChild($originInfo);

2
workflow_client/islandora_workflow_client.module

@ -269,7 +269,7 @@ function islandora_workflow_client_cron()
$queue='/queue/fedora.apim.update'; $queue='/queue/fedora.apim.update';
$con->subscribe($queue); $con->subscribe($queue);
$messagesToSend=array(); $messagesToSend=array();
for ($i=0;$i<500;$i++) { for ($i=0;$i<100;$i++) {
$msg = $con->readFrame(); $msg = $con->readFrame();
if ($msg != null) { if ($msg != null) {

Loading…
Cancel
Save