Browse Source

added div for more results at the bottom of the eds search results

2.x-ebsco
Paul Pound 8 years ago
parent
commit
71b2c3fbf7
  1. 7
      targets/eds/css/roblib_search_eds.css
  2. 11
      targets/eds/js/eds_results.js
  3. 2
      targets/eds/js/eds_results_article.js
  4. 6
      targets/eds/theme/roblib-search-eds-articles.tpl.php
  5. 7
      targets/eds/theme/roblib-search-eds.tpl.php
  6. 2
      targets/solr_site/css/roblib_search_solr_site.css
  7. 2
      targets/solr_site/js/solr_site_bestbet.js
  8. 23
      targets/solr_site/js/solr_site_results.js
  9. 2
      targets/solr_site/roblib_search_solr_site.module
  10. 2
      targets/solr_site/theme/roblib-search-solr-site-results.tpl.php

7
targets/eds/css/roblib_search_eds.css

@ -1,4 +1,4 @@
/* /*
Document : roblib_search_evergreen Document : roblib_search_evergreen
Created on : Apr 11, 2013, 2:27:50 PM Created on : Apr 11, 2013, 2:27:50 PM
Author : ppound Author : ppound
@ -15,3 +15,8 @@
.eds-label { .eds-label {
font-weight: bolder; font-weight: bolder;
} }
.roblib-eds-more-button {
text-align: center;
background-color: lightblue;
}

11
targets/eds/js/eds_results.js

@ -45,16 +45,6 @@ Drupal.behaviors.roblib_search_eds = {
items.push(roblib_authors); items.push(roblib_authors);
items.push('</div>'); 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>');
})
}
if (typeof val.Items.PubIrInfo !== 'undefined') {
jQuery.each(val.Items.PubIrInfo, function (key5, pubinfo) {
items.push('<div class="eds-pubinfo">' + pubinfo.Data + '</div>');
})
}*/
var url; var url;
!val.Items.URL ? url = " " : url = val.Items.URL[0].Data; !val.Items.URL ? url = " " : url = val.Items.URL[0].Data;
if(url) { if(url) {
@ -86,6 +76,7 @@ Drupal.behaviors.roblib_search_eds = {
//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=' + profile + '&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=' + profile + '&mode=bool&lang=en&bquery=';
jQuery('#roblib-search-eds-more').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="see_all_results">See all results (' + data.recordCount + ')</a>'); jQuery('#roblib-search-eds-more').empty().append('<a href="http://proxy.library.upei.ca/login?url=' + href_str + query_str + '" id="see_all_results">See all results (' + 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="see_all_results">See all results (' + data.recordCount + ')</a>');
}); });
} }

2
targets/eds/js/eds_results_article.js

@ -59,6 +59,7 @@ Drupal.behaviors.roblib_search_eds_articles = {
if (typeof val.PLink !== 'undefined' && typeof val.HTML !== 'undefined' && val.HTML == '1') { if (typeof val.PLink !== 'undefined' && typeof val.HTML !== 'undefined' && val.HTML == '1') {
items.push('<div class="eds-db eds-pdf-link"><a href="' + val.PLink + '&scope=site">HTML Full Text</a></div>'); items.push('<div class="eds-db eds-pdf-link"><a href="' + val.PLink + '&scope=site">HTML Full Text</a></div>');
} }
items.push('</div>'); items.push('</div>');
} }
}); });
@ -72,6 +73,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&site=ehost-live&scope=site&type=1&custid=uprince&groupid=main&profid=' + profile + '&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=' + profile + '&mode=bool&lang=en&bquery=';
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>'); 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>');
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">See all results (' + data.recordCount + ')</a>');
}); });
} }

6
targets/eds/theme/roblib-search-eds-articles.tpl.php

@ -12,9 +12,11 @@
?> ?>
<div class ="roblib-search-more" id="roblib-search-eds-article-more"></div> <div class ="roblib-search-more" id="roblib-search-eds-article-more"></div>
<div class ="roblib-search-content eds-article" id="roblib-search-content-eds-articles"> <div class ="roblib-search-content eds-article" id="roblib-search-content-eds-articles">
<img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/> <img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/>
</div> </div>
<div id="roblib-eds-articles-more-results" class="roblib-eds-more-button button"></div>
<?php <?php
/** /**
* Alternate way to create link back to ebscohost. * Alternate way to create link back to ebscohost.

7
targets/eds/theme/roblib-search-eds.tpl.php

@ -6,8 +6,9 @@
*/ */
?> ?>
<div class ="roblib-search-more" id="roblib-search-eds-more"></div> <div class ="roblib-search-more" id="roblib-search-eds-more"></div>
<div class ="roblib-search-content eds" id="roblib-search-content-eds"> <div class ="roblib-search-content eds" id="roblib-search-content-eds">
<img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/> <img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/>
</div> </div>
<div id="roblib-eds-books-more-results" class="roblib-eds-more-button button"></div>

2
targets/solr_site/css/roblib_search_solr_site.css

@ -14,7 +14,7 @@
color: gray; color: gray;
} }
.roblib-solr-more-results { #roblib-solr-more-results-results {
text-align: center; text-align: center;
background-color: lightblue; background-color: lightblue;
} }

2
targets/solr_site/js/solr_site_bestbet.js

@ -1,6 +1,7 @@
Drupal.behaviors.roblib_search_solr_site_bestbet = { Drupal.behaviors.roblib_search_solr_site_bestbet = {
attach: function(context, settings) { attach: function(context, settings) {
url = settings.roblib_search_solr_site_bestbet.search_url; url = settings.roblib_search_solr_site_bestbet.search_url;
default_site_type = settings.roblib_search_solr_site_results.default_site_type
jQuery.getJSON(url, function(data) { jQuery.getJSON(url, function(data) {
var items = []; var items = [];
var numberOfDocs = 0; var numberOfDocs = 0;
@ -28,7 +29,6 @@ Drupal.behaviors.roblib_search_solr_site_bestbet = {
}); });
jQuery('#' + 'roblib-search-content-solr-site-bestbet').empty().append(items.join('')); jQuery('#' + 'roblib-search-content-solr-site-bestbet').empty().append(items.join(''));
//qtipify(divs, content, 'Best Bet');
} }
}); });
} }

23
targets/solr_site/js/solr_site_results.js

@ -1,10 +1,10 @@
Drupal.behaviors.roblib_search_solr_site_results = { Drupal.behaviors.roblib_search_solr_site_results = {
attach: function(context, settings) { attach: function (context, settings) {
url = settings.roblib_search_solr_site_results.search_url; url = settings.roblib_search_solr_site_results.search_url;
query = settings.roblib_search_solr_site_results.search_query; query = settings.roblib_search_solr_site_results.search_query;
baseUrl = settings.roblib_search_solr_site_results.base_url; baseUrl = settings.roblib_search_solr_site_results.base_url;
default_site_type = settings.roblib_search_solr_site_results.default_site_type + '/'; default_site_type = settings.roblib_search_solr_site_results.default_site_type + '/';
jQuery.getJSON(url, function(data) { jQuery.getJSON(url, function (data) {
var items = []; var items = [];
total_found = data.response.numFound; total_found = data.response.numFound;
var numberOfDocs = 0; var numberOfDocs = 0;
@ -21,26 +21,23 @@ Drupal.behaviors.roblib_search_solr_site_results = {
var counter = 0; var counter = 0;
var divs = new Array(); var divs = new Array();
var content = new Array(); var content = new Array();
jQuery.each(data.response.docs, function(key, val) { jQuery.each(data.response.docs, function (key, val) {
id = 'roblib_search_solr_results_' + counter; id = 'roblib_search_solr_results_' + counter;
content[counter] = val.teaser; content[counter] = val.teaser;
divs[counter++] = id; divs[counter++] = id;
items.push('<div class ="roblib-search-row" id="'+ id +'">\n\ items.push('<div class ="roblib-search-row" id="' + id + '">\n\
<span class="roblib-title results">\n\ <span class="roblib-title results">\n\
<a href="' + val.url + '">' + val.label + '</a></span>' + <a href="' + val.url + '">' + val.label + '</a></span>' +
'\n\<span class="roblib-solr-bundle">(' + val.bundle_name + ')</span> <span class="roblib-solr-teaser"> ' + val.teaser + '</span></div>'); '\n\<span class="roblib-solr-bundle">(' + val.bundle_name + ')</span> <span class="roblib-solr-teaser"> ' + val.teaser + '</span></div>');
}); });
jQuery('#' + 'roblib-search-content-solr-site-results').empty().append(items.join('')); jQuery('#' + 'roblib-search-content-solr-site-results').empty().append(items.join(''));
} }
if (numberOfDocs > 0) if (numberOfDocs > 0) {
{ results_url = '<a href="' + baseUrl + '/search/' + default_site_type + query + '?f[0]=(-bundle:bestbet)"' + '>see all results ('
jQuery('#' + 'roblib-search-solr-site-results-more').empty().append('<a href="'+ baseUrl + '/search/' + default_site_type + query +'"' + '>see all results (' + total_found + ') </a>';
+ total_found + ') </a>'); jQuery('#' + 'roblib-search-solr-site-results-more').empty().append(results_url);
jQuery('.' + 'roblib-solr-more-results').empty().append('<a href="'+ baseUrl + '/search/' + default_site_type + query +'"' + '>see all results (' jQuery('#' + 'roblib-solr-more-results-results').empty().append(results_url);
+ total_found + ') </a>'); }
roblib-solr-more-results
}
}); });
} }

2
targets/solr_site/roblib_search_solr_site.module

@ -253,7 +253,7 @@ function roblib_search_solr_site_block_view($delta = '') {
* The solr search string. * The solr search string.
*/ */
function roblib_search_solr_site_results($query) { function roblib_search_solr_site_results($query) {
print roblib_search_solr_site_get_results($query, ''); print roblib_search_solr_site_get_results($query, '-bundle:bestbet');
exit(); exit();
} }

2
targets/solr_site/theme/roblib-search-solr-site-results.tpl.php

@ -20,4 +20,4 @@ if (!isset($type)){
<img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/> <img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/>
</div> </div>
<div class="roblib-solr-more-results roblib-solr-more-button button"></div> <div id="roblib-solr-more-results-<?php print($type)?>" class="roblib-solr-more-button button"></div>

Loading…
Cancel
Save