Browse Source

more formatting for books and media and added link to our catalog where appropriate

2.x-ebsco
Paul Pound 7 years ago
parent
commit
8a46de374e
  1. 2
      roblib_search.module
  2. 39
      targets/eds/js/eds_results.js
  3. 1
      targets/eds/roblib_search_eds.module

2
roblib_search.module

@ -214,8 +214,6 @@ function roblib_search_preprocess_panels_pane(&$variables, $hook){
* Implements hook_init().
*/
function roblib_search_init() {
// Make qtip available for all targets js.
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/jquery.qtip.min.js');
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/imagesloaded.pkg.min.js');
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/roblib_search.js');
drupal_add_css(drupal_get_path('module', 'roblib_search') . '/css/jquery.qtip.min.css');

39
targets/eds/js/eds_results.js

@ -23,29 +23,33 @@ Drupal.behaviors.roblib_search_eds = {
if (typeof val.Items !== 'undefined') {
items.push('<div class ="roblib-search-row" id="' + id + '">');
if (typeof val.Items.Ti !== 'undefined') {
jQuery.each(val.Items.Ti, function (key2, val2) {
jQuery.each(val.RecordInfo.BibEntity.Titles, function (key2, val2) {
items.push('<div class="roblib-title eds">');
items.push('<a href="http://proxy.library.upei.ca/login?url=' + val.PLink + '&scope=site">' + val2.Data + '</a></div>');
items.push('<a href="http://proxy.library.upei.ca/login?url=' + val.PLink + '&scope=site">' + val2.TitleFull + '</a></div>');
})
}
val.pubType == 'Book' ? pubType = 'Print Book' : pubType = val.pubType;
pubYear = val.RecordInfo.BibRelationships.IsPartOfRelationships["date"];
!pubYear ? pubYear = " " : pubYear = pubYear[0]["Y"];
if (typeof val.Items.TypPub !== 'undefined') {
jQuery.each(val.Items.TypPub, function (key6, typpub) {
strs = typpub.Data.split('; ');
types = roblib_intersects(strs, ['<span class="highlight">Book</span>', '<span class="highlight">eBook</span>']);
items.push('<div class="eds-type"><span class="eds-pubyear">' + pubYear + '</span> - ' + types.join(', ') + '</div>');
//strs = typpub.Data.split('; ');
//types = roblib_intersects(strs, ['<span class="highlight">Book</span>', '<span class="highlight">eBook</span>']);
items.push('<div class="eds-type"><span class="eds-pubyear">' + pubYear + '</span> - ' + pubType + '</div>');
})
}
items.push('<div class="eds-sor">');
roblib_authors = "";
var roblib_authors =[];
jQuery.each(val.RecordInfo.BibRelationships.HasContributorRelationships, function (key3, author) {
roblib_authors += author.NameFull;
roblib_authors.push(author.NameFull);
})
roblib_authors = roblib_shorten(roblib_authors, 50, " ");
items.push('<div class="eds-sor">');
roblib_authors = roblib_shorten(roblib_authors.join('; '), 50, " ");
items.push(roblib_authors);
items.push('</div>');
if (typeof val.Items.Src !== 'undefined') {
jQuery.each(val.Items.Src, function (key4, source) {
items.push('<div class="eds-src">' + source.Data + '</div>');
@ -56,9 +60,22 @@ Drupal.behaviors.roblib_search_eds = {
items.push('<div class="eds-pubinfo">' + pubinfo.Data + '</div>');
})
}
var url;
!val.Items.URL ? url = " " : url = val.Items.URL[0].Data;
if(url) {
items.push('<div class="eds-url">' + url + '</div>');
}
items.push('<div class="eds-db">' + val.DbLabel + '</div>');
if(pubType == "Print Book") {
anNumber = val.An.split(".");
if (anNumber[0] && anNumber[0] == 'upei') {
catalogUrl = '<a href="http://islandpines.roblib.upei.ca/eg/opac/record/' + anNumber[1] +
'">View in UPEI Catalogue</a>';
}
if (catalogUrl) {
items.push('<div class="eds-catalog-link">' + catalogUrl + '</div>');
}
}
items.push('</div>');
}
});

1
targets/eds/roblib_search_eds.module

@ -259,6 +259,7 @@ function roblib_search_eds_get_results($query = NULL, $type = NULL) {
//$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);
//roblib_search_eds_get_detailed_result($output, $query, $eds_api);
return json_encode($output);
}

Loading…
Cancel
Save