Browse Source

changed title and atitle to textareas and updated some comments

9.x-1.0
Paul Pound 8 years ago
parent
commit
f8a73a559d
  1. 7
      includes/db.inc
  2. 28
      includes/doi.inc
  3. 7
      includes/form.inc

7
includes/db.inc

@ -5,6 +5,13 @@
*/ */
/**
* Log an ILL request
* @param array $request
* The request sent to Relais as an array (before it is encoded as JSON)
* @param array $response
* The response from Relais.
*/
function upei_roblib_ill_log_request($request, $response) { function upei_roblib_ill_log_request($request, $response) {
$time_submitted = isset($request['RequestInfo']['DateSubmitted']) ? $request['RequestInfo']['DateSubmitted'] : ''; $time_submitted = isset($request['RequestInfo']['DateSubmitted']) ? $request['RequestInfo']['DateSubmitted'] : '';
$relais_message = isset($response['ConfirmMessage']) ? $response['ConfirmMessage'] : $response['Problem']['Message']; $relais_message = isset($response['ConfirmMessage']) ? $response['ConfirmMessage'] : $response['Problem']['Message'];

28
includes/doi.inc

@ -6,7 +6,15 @@
* all the dependancies it would require. * all the dependancies it would require.
*/ */
/**
* Gets the XML as crossref associated with the supplied DOI. Updates the drupal form with the data.
* @param array $form
* The Drupal form
* @param string $doi
* The DOI
* @return array
* A Drupal form with updated values.
*/
function upei_roblib_ill_doi_get_data($form, $doi) { function upei_roblib_ill_doi_get_data($form, $doi) {
if (empty($doi)) { if (empty($doi)) {
$doi = 'Empty DOI'; $doi = 'Empty DOI';
@ -34,9 +42,19 @@ function upei_roblib_ill_doi_get_data($form, $doi) {
} }
} }
function upei_roblib_ill_get_xml_node($crossref_xml, $element_name) { /**
return empty($crossref_xml->getElementsbyTagName($element_name)->item(0)) ? '' : * A convenience function for retrieving individual nodes from the Crossref XML without throwing notices.
$crossref_xml->getElementsbyTagName($element_name)->item(0)->nodeValue; *
* @param DomDocument $crossref_xml
* The Crossref XML
* @param string $node_name
* The node we want a value for, we are assuming the xml only has one node with the given name.
* @return string
* Returns the value of the element
*/
function upei_roblib_ill_get_xml_node($crossref_xml, $node_name) {
return empty($crossref_xml->getElementsbyTagName($node_name)->item(0)) ? '' :
$crossref_xml->getElementsbyTagName($node_name)->item(0)->nodeValue;
} }
@ -47,7 +65,7 @@ function upei_roblib_ill_get_xml_node($crossref_xml, $element_name) {
* @param array $form * @param array $form
* Drupal form * Drupal form
* @return mixed * @return mixed
* A Drupal form * An updated Drupal form
*/ */
function upei_roblib_ill_populate_form_doi($crossref_xml, $form) { function upei_roblib_ill_populate_form_doi($crossref_xml, $form) {
$full_title = upei_roblib_ill_get_xml_node($crossref_xml, 'full_title'); $full_title = upei_roblib_ill_get_xml_node($crossref_xml, 'full_title');

7
includes/form.inc

@ -267,7 +267,8 @@ function upei_roblib_ill_request_form($form, &$form_state) {
'#required' => FALSE, '#required' => FALSE,
); );
$form['Title'] = array( $form['Title'] = array(
'#type' => 'textfield', '#type' => 'textarea',
'#rows' => 2,
'#title' => t('Source Title'), '#title' => t('Source Title'),
'#default_value' => upei_roblib_ill_get_request_variable('title'), '#default_value' => upei_roblib_ill_get_request_variable('title'),
'#description' => 'Journal or Book Title', '#description' => 'Journal or Book Title',
@ -275,7 +276,8 @@ function upei_roblib_ill_request_form($form, &$form_state) {
'#required' => FALSE, '#required' => FALSE,
); );
$form['ArticleTitle'] = array( $form['ArticleTitle'] = array(
'#type' => 'textfield', '#type' => 'textarea',
'#rows' => 2,
'#title' => t('Title'), '#title' => t('Title'),
'#default_value' => upei_roblib_ill_get_request_variable('atitle'), '#default_value' => upei_roblib_ill_get_request_variable('atitle'),
'#description' => 'Article or Chapter Title', '#description' => 'Article or Chapter Title',
@ -411,7 +413,6 @@ function upei_roblib_ill_request_form($form, &$form_state) {
'#type' => 'submit', '#type' => 'submit',
'#value' => t('Next') '#value' => t('Next')
); );
$form_state['stage'] = 'upei_roblib_ill_auth';
return $form; return $form;
} }

Loading…
Cancel
Save