Browse Source

updated the doi data parsing but this may need to be fleshed out even further

9.x-1.0
Paul Pound 8 years ago
parent
commit
5692ed2455
  1. 14
      includes/doi.inc

14
includes/doi.inc

@ -54,9 +54,10 @@ function upei_roblib_ill_doi_get_data($form, $doi) {
* @return string * @return string
* Returns the value of the element * Returns the value of the element
*/ */
function upei_roblib_ill_get_xml_node($crossref_xml, $node_name) { function upei_roblib_ill_get_xml_node($crossref_xml, $node_name, $index = 0) {
return empty($crossref_xml->getElementsbyTagName($node_name)->item(0)) ? '' : // TODO rewrite this function to use full xpath
$crossref_xml->getElementsbyTagName($node_name)->item(0)->nodeValue; return empty($crossref_xml->getElementsbyTagName($node_name)->item($index)) ? '' :
$crossref_xml->getElementsbyTagName($node_name)->item($index)->nodeValue;
} }
@ -74,10 +75,15 @@ function upei_roblib_ill_populate_form_doi($crossref_xml, $form) {
if (empty($full_title)) { if (empty($full_title)) {
$full_title = upei_roblib_ill_get_xml_node($crossref_xml, 'conference_name'); $full_title = upei_roblib_ill_get_xml_node($crossref_xml, 'conference_name');
} }
$form['ArticleTitle']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'title');
if (empty($full_title)) {
$form['ArticleTitle']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'title',1);
$full_title = upei_roblib_ill_get_xml_node($crossref_xml, 'title' , 0);
}
$form['Title']['#value'] = $full_title; $form['Title']['#value'] = $full_title;
$form['ISSN']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'issn'); $form['ISSN']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'issn');
$form['Date']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'year'); $form['Date']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'year');
$form['ArticleTitle']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'title');
$form['ImageOrPageNumber']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'first_page'); $form['ImageOrPageNumber']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'first_page');
$form['PagesRequested']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'first_page') . '-' . $form['PagesRequested']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'first_page') . '-' .
upei_roblib_ill_get_xml_node($crossref_xml, 'last_page'); upei_roblib_ill_get_xml_node($crossref_xml, 'last_page');

Loading…
Cancel
Save