|
|
@ -45,6 +45,7 @@ function upei_roblib_ill_form_validate($form, &$form_state) { |
|
|
|
if (!$form_state['values']['certify']) { |
|
|
|
if (!$form_state['values']['certify']) { |
|
|
|
form_set_error('certify', t('Please certify that this is item is being sought for a fair dealing purpose')); |
|
|
|
form_set_error('certify', t('Please certify that this is item is being sought for a fair dealing purpose')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$form_state['values']['campus_id'] = upei_roblib_ill_form_message_id($form_state['values']['campus_id']); |
|
|
|
$aid = upei_roblib_ill_authenticate($form_state['values']['campus_id'], $form_state['values']['Surname']); |
|
|
|
$aid = upei_roblib_ill_authenticate($form_state['values']['campus_id'], $form_state['values']['Surname']); |
|
|
|
if (is_array($aid) && isset($aid['Problem']['Message'])) { |
|
|
|
if (is_array($aid) && isset($aid['Problem']['Message'])) { |
|
|
|
form_set_error('Surname', $aid['Problem']['Message']); |
|
|
|
form_set_error('Surname', $aid['Problem']['Message']); |
|
|
@ -59,12 +60,24 @@ function upei_roblib_ill_form_validate($form, &$form_state) { |
|
|
|
$form_state['storage']['aid'] = $aid; |
|
|
|
$form_state['storage']['aid'] = $aid; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ($form_state['step'] == 'upei_roblib_ill_request_form' && $form_state['triggering_element']['#value'] !== 'lookup DOI' && empty($form_state['values']['Title'])) { |
|
|
|
if ($form_state['step'] == 'upei_roblib_ill_request_form' && $form_state['triggering_element']['#value'] !== 'Lookup DOI' && empty($form_state['values']['Title'])) { |
|
|
|
form_set_error('Title', t('Source Title is required.')); |
|
|
|
form_set_error('Title', t('Journal/Book Title is required.')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param string $id |
|
|
|
|
|
|
|
* The users campus id |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return mixed |
|
|
|
|
|
|
|
* the campus id with leading zeros and leading/trailing whitespace removed. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function upei_roblib_ill_form_message_id($id) { |
|
|
|
|
|
|
|
$id = ltrim($id, '0'); |
|
|
|
|
|
|
|
return trim($id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Submit handler for the upei_roblib_ill_form form. |
|
|
|
* Submit handler for the upei_roblib_ill_form form. |
|
|
|
* |
|
|
|
* |
|
|
@ -78,7 +91,7 @@ function upei_roblib_ill_form_submit($form, &$form_state) { |
|
|
|
$form_state['storage'][$form_state['step']] = $form_state['values']; |
|
|
|
$form_state['storage'][$form_state['step']] = $form_state['values']; |
|
|
|
switch ($form_state['step']) { |
|
|
|
switch ($form_state['step']) { |
|
|
|
case 'upei_roblib_ill_request_form': |
|
|
|
case 'upei_roblib_ill_request_form': |
|
|
|
if ($form_state['clicked_button']['#value'] != 'lookup DOI') { |
|
|
|
if ($form_state['clicked_button']['#value'] != 'Lookup DOI') { |
|
|
|
$form_state['step'] = 'upei_roblib_ill_auth_form'; |
|
|
|
$form_state['step'] = 'upei_roblib_ill_auth_form'; |
|
|
|
$form_state['rebuild'] = TRUE; |
|
|
|
$form_state['rebuild'] = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
@ -167,7 +180,14 @@ call @phone.", ['@phone' => $contact_phone_number, '@email' => $contact_email]); |
|
|
|
function upei_roblib_ill_auth_form($form, &$form_state) { |
|
|
|
function upei_roblib_ill_auth_form($form, &$form_state) { |
|
|
|
module_load_include('inc', 'upei_roblib_ill', 'includes/utilities'); |
|
|
|
module_load_include('inc', 'upei_roblib_ill', 'includes/utilities'); |
|
|
|
$form['#prefix'] = upei_roblib_format_biblio_info($form_state); |
|
|
|
$form['#prefix'] = upei_roblib_format_biblio_info($form_state); |
|
|
|
|
|
|
|
$form['#suffix'] = '<div class="roblib-required">* = Required Field</div> |
|
|
|
|
|
|
|
<div class="roblib-FOIPP"><strong>Protection of Privacy</strong> - The personal information requested |
|
|
|
|
|
|
|
on this form is collected under the authority of Section 31(c) of the PEI |
|
|
|
|
|
|
|
Freedom of Information and Protection of Privacy Act and will be protected |
|
|
|
|
|
|
|
under Part 2 of that Act. It will be used for the purpose of administering |
|
|
|
|
|
|
|
and providing library service. Direct any questions about this collection to |
|
|
|
|
|
|
|
Health Sciences and Scholarly Communications Librarian at ill@upei.ca, 550 |
|
|
|
|
|
|
|
University Ave, Charlottetown PE , 902-566-0453.</div>'; |
|
|
|
$form['FirstName'] = [ |
|
|
|
$form['FirstName'] = [ |
|
|
|
'#type' => 'textfield', |
|
|
|
'#type' => 'textfield', |
|
|
|
'#title' => t('Your First Name'), |
|
|
|
'#title' => t('Your First Name'), |
|
|
@ -187,14 +207,14 @@ function upei_roblib_ill_auth_form($form, &$form_state) { |
|
|
|
'#required' => TRUE, |
|
|
|
'#required' => TRUE, |
|
|
|
]; |
|
|
|
]; |
|
|
|
$patron_types = [ |
|
|
|
$patron_types = [ |
|
|
|
'None' => t('None'), |
|
|
|
'Faculty/Staff' => t('Faculty/Staff'), |
|
|
|
'UPEI Faculty/Staff' => t('UPEI Faculty/Staff'), |
|
|
|
'Undergraduate Student' => t('Undergraduate Student'), |
|
|
|
'UPEI Graduate Student' => t('UPEI Graduate Student'), |
|
|
|
'Masters Student' => t('Masters Student'), |
|
|
|
'UPEI Undergraduate Student' => t('UPEI Undergraduate Student'), |
|
|
|
'Doctoral Student' => t('Doctoral Student'), |
|
|
|
'UPEI Honours Undergraduate Student' => t('UPEI Honours Undergraduate Student'), |
|
|
|
'Honours Undergraduate Student' => t('Honours Undergraduate Student'), |
|
|
|
'UPEI Alumni Premiere member' => t('UPEI Alumni Premiere member'), |
|
|
|
'Alumni Premiere Subscriber' => t('Alumni Premiere Subscriber'), |
|
|
|
'UPEI Alumni member' => t('UPEI Alumni member'), |
|
|
|
'Alumni/Public' => t('Alumni/Public'), |
|
|
|
'Public Borrower' => t('Public Borrower'), |
|
|
|
'Other' => 'Other', |
|
|
|
]; |
|
|
|
]; |
|
|
|
$departments = [ |
|
|
|
$departments = [ |
|
|
|
'Applied Human Sciences' => t('Applied Human Sciences'), |
|
|
|
'Applied Human Sciences' => t('Applied Human Sciences'), |
|
|
@ -300,35 +320,34 @@ function upei_roblib_ill_auth_form($form, &$form_state) { |
|
|
|
function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
module_load_include('inc', 'upei_roblib_ill', 'includes/utilities'); |
|
|
|
module_load_include('inc', 'upei_roblib_ill', 'includes/utilities'); |
|
|
|
$form['#prefix'] = '<div id="upei-roblib-ill-request-form">'; |
|
|
|
$form['#prefix'] = '<div id="upei-roblib-ill-request-form">'; |
|
|
|
$form['#suffix'] = '</div>'; |
|
|
|
$form['#suffix'] = '<div class="roblib-required">* = Required Field</div></div>'; |
|
|
|
$genre = empty(upei_roblib_ill_get_request_variable('genre')) ? 'article' : upei_roblib_ill_get_request_variable('genre'); |
|
|
|
$genre = empty(upei_roblib_ill_get_request_variable('genre')) ? 'article' : upei_roblib_ill_get_request_variable('genre'); |
|
|
|
$form['Genre'] = [ |
|
|
|
$form['Genre'] = [ |
|
|
|
'#type' => 'select', |
|
|
|
'#type' => 'select', |
|
|
|
'#title' => t('Genre'), |
|
|
|
'#title' => t('Item Type'), |
|
|
|
'#default_value' => $genre, |
|
|
|
|
|
|
|
'#options' => [ |
|
|
|
'#options' => [ |
|
|
|
'article' => t('Journal Article'), |
|
|
|
|
|
|
|
'book' => t('Book'), |
|
|
|
'book' => t('Book'), |
|
|
|
'chapter' => t('Book Chapter'), |
|
|
|
'chapter' => t('Book Chapter'), |
|
|
|
|
|
|
|
'article' => t('Journal Article'), |
|
|
|
], |
|
|
|
], |
|
|
|
'#required' => TRUE, |
|
|
|
'#required' => TRUE, |
|
|
|
]; |
|
|
|
]; |
|
|
|
$form['doi'] = [ |
|
|
|
$form['doi'] = [ |
|
|
|
'#type' => 'textfield', |
|
|
|
'#type' => 'textfield', |
|
|
|
'#title' => t('DOI'), |
|
|
|
'#title' => t("DOI (ex: 10.1016/j.ypmed.2019.01.018)"), |
|
|
|
'#default_value' => upei_roblib_ill_get_doi_from_request(), |
|
|
|
'#default_value' => upei_roblib_ill_get_doi_from_request(), |
|
|
|
'#description' => 'DOI, if you provide a DOI we will attempt to lookup the record for you', |
|
|
|
//'#description' => 'DOI, if you provide a DOI we will attempt to lookup the record for you', |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#states' => [ |
|
|
|
'#states' => [ |
|
|
|
'visible' => [ |
|
|
|
'invisible' => [ |
|
|
|
':input[name="Genre"]' => ['value' => 'article'], |
|
|
|
':input[name="Genre"]' => ['value' => 'book'], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
'#required' => FALSE, |
|
|
|
'#required' => FALSE, |
|
|
|
]; |
|
|
|
]; |
|
|
|
$form['doi_button'] = [ |
|
|
|
$form['doi_button'] = [ |
|
|
|
'#type' => 'submit', |
|
|
|
'#type' => 'submit', |
|
|
|
'#value' => 'lookup DOI', |
|
|
|
'#value' => 'Lookup DOI', |
|
|
|
'#ajax' => [ |
|
|
|
'#ajax' => [ |
|
|
|
'callback' => 'upei_roblib_ill_doi_callback', |
|
|
|
'callback' => 'upei_roblib_ill_doi_callback', |
|
|
|
'method' => 'replace', |
|
|
|
'method' => 'replace', |
|
|
@ -336,8 +355,8 @@ function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
'effect' => 'fade', |
|
|
|
'effect' => 'fade', |
|
|
|
], |
|
|
|
], |
|
|
|
'#states' => [ |
|
|
|
'#states' => [ |
|
|
|
'visible' => [ |
|
|
|
'invisible' => [ |
|
|
|
':input[name="Genre"]' => ['value' => 'article'], |
|
|
|
':input[name="Genre"]' => ['value' => 'book'], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
'#required' => FALSE, |
|
|
|
'#required' => FALSE, |
|
|
@ -345,18 +364,18 @@ function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
$form['Title'] = [ |
|
|
|
$form['Title'] = [ |
|
|
|
'#type' => 'textarea', |
|
|
|
'#type' => 'textarea', |
|
|
|
'#rows' => 2, |
|
|
|
'#rows' => 2, |
|
|
|
'#title' => t('Source Title'), |
|
|
|
'#title' => t('Journal/Book Title *'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('title'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('title'), |
|
|
|
'#description' => 'Journal or Book Title (Required)', |
|
|
|
//'#description' => 'Journal or Book Title (Required)', |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#required' => FALSE, |
|
|
|
'#required' => FALSE, |
|
|
|
]; |
|
|
|
]; |
|
|
|
$form['ArticleTitle'] = [ |
|
|
|
$form['ArticleTitle'] = [ |
|
|
|
'#type' => 'textarea', |
|
|
|
'#type' => 'textarea', |
|
|
|
'#rows' => 2, |
|
|
|
'#rows' => 2, |
|
|
|
'#title' => t('Title'), |
|
|
|
'#title' => t('Article/Chapter 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', |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#states' => [ |
|
|
|
'#states' => [ |
|
|
|
'invisible' => [ |
|
|
|
'invisible' => [ |
|
|
@ -368,7 +387,7 @@ function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
|
|
|
|
|
|
|
|
$form['ISSN'] = [ |
|
|
|
$form['ISSN'] = [ |
|
|
|
'#type' => 'textfield', |
|
|
|
'#type' => 'textfield', |
|
|
|
'#title' => t('ISSN'), |
|
|
|
'#title' => t('ISSN (ex: 1234-567X)'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('issn'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('issn'), |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#states' => [ |
|
|
|
'#states' => [ |
|
|
@ -381,11 +400,11 @@ function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
$article_author = ($genre == 'book') ? '' : upei_roblib_ill_get_request_variable('author'); |
|
|
|
$article_author = ($genre == 'book') ? '' : upei_roblib_ill_get_request_variable('author'); |
|
|
|
$form['ArticleAuthor'] = [ |
|
|
|
$form['ArticleAuthor'] = [ |
|
|
|
'#type' => 'textfield', |
|
|
|
'#type' => 'textfield', |
|
|
|
'#title' => t('Author'), |
|
|
|
'#title' => t('Article/Chapter Author'), |
|
|
|
'#default_value' => $article_author, |
|
|
|
'#default_value' => $article_author, |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#required' => FALSE, |
|
|
|
'#required' => FALSE, |
|
|
|
'#description' => 'Article or Chapter Author', |
|
|
|
//'#description' => 'Article or Chapter Author', |
|
|
|
'#states' => [ |
|
|
|
'#states' => [ |
|
|
|
'invisible' => [ |
|
|
|
'invisible' => [ |
|
|
|
':input[name="Genre"]' => ['value' => 'book'], |
|
|
|
':input[name="Genre"]' => ['value' => 'book'], |
|
|
@ -407,7 +426,7 @@ function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
]; |
|
|
|
]; |
|
|
|
$form['ISBN'] = [ |
|
|
|
$form['ISBN'] = [ |
|
|
|
'#type' => 'textfield', |
|
|
|
'#type' => 'textfield', |
|
|
|
'#title' => t('ISBN'), |
|
|
|
'#title' => t('ISBN (ex: 9780323554459)'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('isbn'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('isbn'), |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#states' => [ |
|
|
|
'#states' => [ |
|
|
@ -458,9 +477,9 @@ function upei_roblib_ill_request_form($form, &$form_state) { |
|
|
|
]; |
|
|
|
]; |
|
|
|
$form['PagesRequested'] = [ |
|
|
|
$form['PagesRequested'] = [ |
|
|
|
'#type' => 'textfield', |
|
|
|
'#type' => 'textfield', |
|
|
|
'#title' => t('Pages'), |
|
|
|
'#title' => t('Pages (startpage-endpage)'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('pages'), |
|
|
|
'#default_value' => upei_roblib_ill_get_request_variable('pages'), |
|
|
|
'#description' => 'Pages requested (startpage-endpage)', |
|
|
|
//'#description' => 'Pages requested (startpage-endpage)', |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#required' => FALSE, |
|
|
|
'#required' => FALSE, |
|
|
|
'#states' => [ |
|
|
|
'#states' => [ |
|
|
|