|
|
@ -27,6 +27,8 @@ class solr_index extends Process { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ContentModel'); |
|
|
|
|
|
|
|
|
|
|
|
$xsltDom = NULL; |
|
|
|
$xsltDom = NULL; |
|
|
|
if (isset($parameters['xslt'])) { |
|
|
|
if (isset($parameters['xslt'])) { |
|
|
|
list($template_pid, $template_dsid) = explode('/', $parameters['xslt']); |
|
|
|
list($template_pid, $template_dsid) = explode('/', $parameters['xslt']); |
|
|
@ -44,6 +46,11 @@ class solr_index extends Process { |
|
|
|
$xsltDom->load(drupal_get_path('module', 'islandora_workflow_client') .'/xsl/'. trim($parameters['xslt_file'])); |
|
|
|
$xsltDom->load(drupal_get_path('module', 'islandora_workflow_client') .'/xsl/'. trim($parameters['xslt_file'])); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($xsdlDom === FALSE) { |
|
|
|
|
|
|
|
$this->setMessage(t('Unable to load xslt.')); |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$item = new fedora_item($pid); |
|
|
|
$item = new fedora_item($pid); |
|
|
|
$dslist = $item->get_datastreams_list_as_array(); |
|
|
|
$dslist = $item->get_datastreams_list_as_array(); |
|
|
|
if (!isset($dslist[$parameters['dsid']])) { |
|
|
|
if (!isset($dslist[$parameters['dsid']])) { |
|
|
@ -59,9 +66,12 @@ class solr_index extends Process { |
|
|
|
|
|
|
|
|
|
|
|
$proc = new XSLTProcessor(); |
|
|
|
$proc = new XSLTProcessor(); |
|
|
|
$proc->importStylesheet($xsltDom); |
|
|
|
$proc->importStylesheet($xsltDom); |
|
|
|
$solrDoc = $proc->transformToXML($dom); |
|
|
|
$solrDom = $proc->transformToDOC($dom); |
|
|
|
|
|
|
|
|
|
|
|
$solrDom = DOMDocument::loadXML($solrDoc); |
|
|
|
if ($solrDoc === FALSE) { |
|
|
|
|
|
|
|
$this->setMessage(t('Document transform failed.')); |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
$doc = $solrDom->getElementsByTagName('doc'); |
|
|
|
$doc = $solrDom->getElementsByTagName('doc'); |
|
|
|
if ($doc->length > 0) { |
|
|
|
if ($doc->length > 0) { |
|
|
|
$doc=$doc->item(0); |
|
|
|
$doc=$doc->item(0); |
|
|
@ -73,6 +83,12 @@ class solr_index extends Process { |
|
|
|
$doc->appendChild($field); |
|
|
|
$doc->appendChild($field); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { |
|
|
|
|
|
|
|
$field=$solrDom->createElement('field', $cm->pid); |
|
|
|
|
|
|
|
$field->setAttribute('name', 'cmodel_t'); |
|
|
|
|
|
|
|
$doc->appendChild($field); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isset($dslist['DC'])) |
|
|
|
if (isset($dslist['DC'])) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$dc = $item->get_datastream('DC'); |
|
|
|
$dc = $item->get_datastream('DC'); |
|
|
|