Browse Source

added NON UPEI links to ebsco results added is local ip to javascript for link generation

2.x-ebsco
Paul Pound 7 years ago
parent
commit
4b86b2b19c
  1. 13
      targets/eds/js/eds_results.js
  2. 13
      targets/eds/js/eds_results_article.js
  3. 6
      targets/eds/roblib_search_eds.module

13
targets/eds/js/eds_results.js

@ -71,10 +71,15 @@ Drupal.behaviors.roblib_search_eds = {
}); });
jQuery('#' + 'roblib-search-content-eds').empty().append(items.join('')); jQuery('#' + 'roblib-search-content-eds').empty().append(items.join(''));
} }
var non_upei_link = '';
jQuery('#roblib-search-eds-more').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-see_all_results">See all results (' + data.recordCount + ')</a>'); var upei_link = '<a href="' + href_str + query_str + '" id="eds-see-all-results">SEE ALL (' + data.recordCount + ')</a> ';
jQuery('#roblib-eds-books-more-results').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-see_all_results-button">See all results (' + data.recordCount + ')</a>'); if(!data.is_local_ip) {
jQuery('#roblib-eds-books-toc').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-see_all_results">Books (' + data.recordCount + ')</a>'); non_upei_link = '<a href="' + href_str + query_str + '" id="eds-non-upei-see_all_results">[Non-UPEI]</a>';
upei_link = '<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-see-all-results">SEE ALL (' + data.recordCount + ')</a> ' + non_upei_link;
}
jQuery('#roblib-search-eds-more').empty().append(upei_link);
jQuery('#roblib-eds-books-more-results').empty().append(upei_link);
jQuery('#roblib-eds-books-toc').empty().append('<a href="' + href_str + query_str + '" id="eds-see-all-results-toc">Articles (' + data.recordCount + ')</a>');
}); });
} }

13
targets/eds/js/eds_results_article.js

@ -68,10 +68,15 @@ Drupal.behaviors.roblib_search_eds_articles = {
}); });
jQuery('#' + 'roblib-search-content-eds-articles').empty().append(items.join('')); jQuery('#' + 'roblib-search-content-eds-articles').empty().append(items.join(''));
} }
var non_upei_link = '';
jQuery('#roblib-search-eds-article-more').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-article-see-all-results">See all results (' + data.recordCount + ')</a>'); var upei_link = '<a href="' + href_str + query_str + '" id="eds-article-see-all-results">SEE ALL (' + data.recordCount + ')</a> ';
jQuery('#roblib-eds-articles-more-results').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-article-see-all-results-button">See all results (' + data.recordCount + ')</a>'); if(!data.is_local_ip) {
jQuery('#roblib-eds-articles-toc').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-article-see-all-results-toc">Articles (' + data.recordCount + ')</a>'); non_upei_link = '<a href="' + href_str + query_str + '" id="eds-article-non-upei-see_all_results">[Non-UPEI]</a>';
upei_link = '<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="eds-article-see-all-results">SEE ALL (' + data.recordCount + ')</a> ' + non_upei_link;
}
jQuery('#roblib-search-eds-article-more').empty().append(upei_link);
jQuery('#roblib-eds-articles-more-results').empty().append(upei_link);
jQuery('#roblib-eds-articles-toc').empty().append('<a href="' + href_str + query_str + '" id="eds-article-see-all-results-toc">Articles (' + data.recordCount + ')</a>');
}); });
} }

6
targets/eds/roblib_search_eds.module

@ -270,8 +270,12 @@ function roblib_search_eds_get_results($query = NULL, $type = 'Articles') {
$query .= $limiters; $query .= $limiters;
$search = array('lookfor' => $query, 'type' => 'ALLFields', 'index' => 'AllFields', 'q' => 'ebsco/results', 'op' => 'Search'); $search = array('lookfor' => $query, 'type' => 'ALLFields', 'index' => 'AllFields', 'q' => 'ebsco/results', 'op' => 'Search');
$eds_api = new EBSCOAPI($config); $eds_api = new EBSCOAPI($config);
$eds_api->isGuest(boolval(variable_get('roblib_search_eds_guest','y'))); $is_local_ip = $eds_api->connector()->isGuestIPAddress($_SERVER["REMOTE_ADDR"]);
//$eds_api->isGuest(boolval(variable_get('roblib_search_eds_guest','y')));
$eds_api->isGuest(!$is_local_ip);
$output = $eds_api->apiSearch($search, $filters, 1, $number_per_page); $output = $eds_api->apiSearch($search, $filters, 1, $number_per_page);
$output['is_local_ip'] = $is_local_ip;
return json_encode($output); return json_encode($output);
} }

Loading…
Cancel
Save