Browse Source

updated eds targets to use publication types

2.x-ebsco
Paul Pound 11 years ago
parent
commit
f1f24a55aa
  1. 11
      targets/eds/js/eds_results.js
  2. 2
      targets/eds/js/eds_results_article.js
  3. 32
      targets/eds/roblib_search_eds.module

11
targets/eds/js/eds_results.js

@ -66,7 +66,7 @@ Drupal.behaviors.roblib_search_eds = {
//var host = "http://eds-api.ebscohost.com"; //var host = "http://eds-api.ebscohost.com";
//var get = "/edsapi/rest/Search?query=history&searchmode=all&resultsperpage=20&pagenumber=1&sort=relevance&highlight=y&includefacets=y&facetfilter=1%2cSourceType%3aMagazines%2cSourceType%3aNews%2cSourceType%3aAcademic+Journals%2cSourceType%3aConference+Materials&view=detailed"; //var get = "/edsapi/rest/Search?query=history&searchmode=all&resultsperpage=20&pagenumber=1&sort=relevance&highlight=y&includefacets=y&facetfilter=1%2cSourceType%3aMagazines%2cSourceType%3aNews%2cSourceType%3aAcademic+Journals%2cSourceType%3aConference+Materials&view=detailed";
var href_str = 'http://search.ebscohost.com/login.aspx?direct=true&site=ehost-live&scope=site&type=1&custid=uprince&groupid=main&profid=eds&mode=bool&lang=en&bquery='; var href_str = 'http://search.ebscohost.com/login.aspx?direct=true&site=ehost-live&scope=site&type=1&custid=uprince&groupid=main&profid=eds&mode=bool&lang=en&bquery=';
jQuery('#roblib-search-eds-more').empty().append('<a href="'+href_str+query_str+'" id="see_all_results">See all ' + data.recordCount + ' results</a>'); jQuery('#roblib-search-eds-more').empty().append('<a href="'+href_str+query_str+'" id="see_all_results">See all results</a>');
}); });
} }
@ -76,7 +76,14 @@ function edsPopulatePopupDivs(content, val, counter){
content[counter] = ''; content[counter] = '';
try{ try{
jQuery.each(val.DetailedRecord, function(key, value){ jQuery.each(val.DetailedRecord, function(key, value){
if(value.Group =='Ab' || value.Group == 'Note' || value.Group == 'TOC') { if (content.length < 5 &&
(value.Group == 'PubInfo' || value.Group =="TypPub" || value.Group == "TypeDoc" || value.Group =="Su" || value.Group == "Au")) {
content[counter] += '<div class="eds-popup-content"><span class="eds-popup-label">' + value.Label + ': </span>' ;
content[counter] += '<span class="eds-popup-value"> ' + value.Data +'</span></div>';(value.Group =='Ab' || value.Group == 'Note' )
} else if (content[counter].length < 5 && (value.Group == "Note" || value.Group== "Ab")) {
content[counter] += '<div class="eds-popup-content"><span class="eds-popup-label">' + value.Label + ': </span>' ;
content[counter] += '<span class="eds-popup-value"> ' + value.Data +'</span></div>';
} else if (content[counter].length < 3 && (value.Group == 'TOC' || value.Group == 'Src')) {
content[counter] += '<div class="eds-popup-content"><span class="eds-popup-label">' + value.Label + ': </span>' ; content[counter] += '<div class="eds-popup-content"><span class="eds-popup-label">' + value.Label + ': </span>' ;
content[counter] += '<span class="eds-popup-value"> ' + value.Data +'</span></div>'; content[counter] += '<span class="eds-popup-value"> ' + value.Data +'</span></div>';
} }

2
targets/eds/js/eds_results_article.js

@ -58,7 +58,7 @@ Drupal.behaviors.roblib_search_eds_articles = {
var query_str = data.queries[0].query; var query_str = data.queries[0].query;
var href_str = 'http://search.ebscohost.com/login.aspx?direct=true&amp;site=ehost-live&amp;scope=site&amp;type=0&amp;custid=uprince&amp;profid=eds&amp;groupid=main&amp;mode=and&amp;cli0=RV&amp;clv0=N&amp;lang=en' + var href_str = 'http://search.ebscohost.com/login.aspx?direct=true&amp;site=ehost-live&amp;scope=site&amp;type=0&amp;custid=uprince&amp;profid=eds&amp;groupid=main&amp;mode=and&amp;cli0=RV&amp;clv0=N&amp;lang=en' +
'&amp;authtype=ip,guest&amp;cli2=FT&clv2=N&amp;cli3=&amp;clv3=(ST+Academic+Journal+or+ST+Conference+Materials+or+ST+News+or+ST+Magazines)&amp;bquery='; '&amp;authtype=ip,guest&amp;cli2=FT&clv2=N&amp;cli3=&amp;clv3=(ST+Academic+Journal+or+ST+Conference+Materials+or+ST+News+or+ST+Magazines)&amp;bquery=';
jQuery('#roblib-search-eds-article-more').empty().append('<a href="'+href_str+query_str+'" id="eds-article-see-all-results">See all ' + data.recordCount + ' results</a>'); jQuery('#roblib-search-eds-article-more').empty().append('<a href="'+href_str+query_str+'" id="eds-article-see-all-results">See all results</a>');
}); });
} }

32
targets/eds/roblib_search_eds.module

@ -105,6 +105,24 @@ function roblib_search_eds_config_form($form, &$form_state) {
'#description' => t('The number of results to display in the Bento box'), '#description' => t('The number of results to display in the Bento box'),
'#required' => TRUE, '#required' => TRUE,
); );
$form['roblib_search_eds_article_limiters'] = array(
'#type' => 'textarea',
'#title' => t('The limiters for Article searches'),
'#default_value' => variable_get('roblib_search_eds_article_limiters',
'AND (PT Article OR PT Magazines OR PT News OR PT Academic Journals OR PT Conference Materials)'),
'#description' => t('Specify the Publication Types to use as limiters for Article searches. Formatted similar to
AND (PT Article OR PT Magazines OR PT News OR PT Academic Journals OR PT Conference Materials)'),
'#required' => TRUE,
);
$form['roblib_search_eds_book_limiters'] = array(
'#type' => 'textarea',
'#title' => t('The limiters for Books and Media searches'),
'#default_value' => variable_get('roblib_search_eds_book_limiters',
'AND (PT Book OR PT Video OR PT Audio)'),
'#description' => t('Specify the Publication Types to use as limiters for Article searches. Formatted similar to
AND (PT Book OR PT Video OR PT Audio'),
'#required' => TRUE,
);
return system_settings_form($form); return system_settings_form($form);
@ -235,7 +253,9 @@ function roblib_search_eds_get_results($query = NULL, $type = NULL) {
$eds_api = new EBSCOAPI($config); $eds_api = new EBSCOAPI($config);
$number_per_page = variable_get('roblib_search_eds_num_results', '5'); $number_per_page = variable_get('roblib_search_eds_num_results', '5');
$query = urlencode($query); $query = urlencode($query);
$params = "query=AND,$query&view=detailed&includefacets=n&$limiters&resultsperpage=$number_per_page"; $query .= $limiters;
//$params = "query=AND,$query&view=detailed&includefacets=n&$limiters&resultsperpage=$number_per_page";
$params = "query=AND,$query&view=detailed&includefacets=n&resultsperpage=$number_per_page";
$output = $eds_api->apiSearch($params); $output = $eds_api->apiSearch($params);
$output = roblib_search_eds_get_detailed_result($output, $query, $eds_api); $output = roblib_search_eds_get_detailed_result($output, $query, $eds_api);
return json_encode($output); return json_encode($output);
@ -255,17 +275,21 @@ function roblib_search_eds_get_query_limiters($type) {
$limiters = 'n'; $limiters = 'n';
switch ($type) { switch ($type) {
case 'Articles': case 'Articles':
$limiters = 'facetfilter=1,SourceType:Magazines,SourceType:News,SourceType:Academic+Journals,SourceType:Conference+Materials'; //$limiters = 'facetfilter=1,SourceType:Magazines,SourceType:News,SourceType:Academic+Journals,SourceType:Conference+Materials';
$limiters = ' ' . variable_get('roblib_search_eds_article_limiters',
'AND (PT Article OR PT Magazines OR PT News OR PT Academic Journals OR PT Conference Materials)');
break; break;
case 'Books': case 'Books':
// $limiters = '+AND+(PT+book)'; // $limiters = '+AND+(PT+book)';
$limiters = 'facetfilter=1,SourceType:Books,SourceType:Audio,SourceType:Videos'; //$limiters = 'facetfilter=1,PublicationType:Books,PublicationType:Audio,PublicationType:Videos';
$limiters = ' ' . variable_get('roblib_search_eds_book_limiters',
'AND (PT Book OR PT Video OR PT Audio)');
break; break;
} }
return $limiters; return urlencode($limiters);
} }
function roblib_search_eds_build_config_arr() { function roblib_search_eds_build_config_arr() {

Loading…
Cancel
Save