Browse Source

added other source target and code cleanup some experimentation linking back to ebsco

2.x-ebsco
Paul Pound 10 years ago
parent
commit
4a8295aa7b
  1. 36
      roblib_search.module
  2. 13
      targets/cufts/theme/roblib-search-cufts.tpl.php
  3. 2
      targets/eds/js/eds_results.js
  4. 3
      targets/eds/js/eds_results_article.js
  5. 2
      targets/eds/roblib_search_eds.module
  6. 16
      targets/eds/theme/roblib-search-eds-articles.tpl.php
  7. 14
      targets/eds/theme/roblib-search-eds.tpl.php
  8. 1
      targets/eds/theme/theme.inc
  9. 15
      targets/evergreen/theme/roblib-search-evergreen.tpl.php
  10. 15
      targets/islandscholar/theme/roblib-search-islandscholar.tpl.php
  11. 19
      theme/roblib-search-other-sources.tpl.php
  12. 27
      theme/roblib-search-wrapper.tpl.php
  13. 13
      theme/theme.inc

36
roblib_search.module

@ -72,17 +72,36 @@ function roblib_search_permission() {
function roblib_search_block_info() {
$blocks['roblib_search_form'] = array(
// info: The name of the block.
'info' => t('Roblib Global Search Form'),
// Block caching options (per role, per user, etc.)
// Default.
'cache' => DRUPAL_CACHE_PER_ROLE,
);
$blocks['roblib_search_other'] = array(
'info' => t('Roblib Search Other Sources'),
'cache' => DRUPAL_CACHE_PER_ROLE,
);
return $blocks;
}
function roblib_search_init(){
/**
* Implements hook_theme().
*/
function roblib_search_theme() {
// set path
$path = drupal_get_path('module', 'roblib_search');
$file = 'theme.inc';
return array(
'roblib_search_other_sources' => array(
'path' => $path . '/theme',
'file' => $file,
'template' => 'roblib-search-other-sources',
'variables' => array('results' => NULL),
)
);
}
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');
@ -93,14 +112,13 @@ function roblib_search_init(){
function roblib_search_block_view($delta = '') {
switch ($delta) {
case 'roblib_search_form':
// The subject is displayed at the top of the block. Note that it
// should be passed through t() for translation. The title configured
// for the block using Drupal UI supercedes this one.
$block['subject'] = t('Bento Search');
// The content of the block is typically generated by calling a custom
// function.
$block['content'] = drupal_get_form('roblib_search_simple_form');
break;
case 'roblib_search_other':
$block['subject'] = t('Other Sources');
$block['content'] = theme('roblib_search_other_sources', array('results' => NULL));
}
return $block;
}

13
targets/cufts/theme/roblib-search-cufts.tpl.php

@ -1,19 +1,8 @@
<?php
/**
* @file islandora-solr-wrapper.tpl.php
* Islandora solr search results wrapper template
* @file roblib-search-cufts.tpl.php
*
* Variables available:
* - $variables: all array elements of $variables can be used as a variable. e.g. $base_url equals $variables['base_url']
* - $base_url: The base url of the current website. eg: http://example.com .
* - $user: The user object.
*
*
* - $results: Rendered search results (primary profile)
*
*
* @see template_preprocess_roblib_search_wrapper()
*/
?>
<div class ="roblib-search-more" id="roblib-search-cufts-more"></div>

2
targets/eds/js/eds_results.js

@ -63,6 +63,8 @@ Drupal.behaviors.roblib_search_eds = {
queries.push(query.query);
})
var query_str = data.queries[0].query;
//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 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>');

3
targets/eds/js/eds_results_article.js

@ -56,7 +56,8 @@ Drupal.behaviors.roblib_search_eds_articles = {
queries.push(query.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=eds&mode=bool&lang=en&bquery=';
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=';
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>');
});

2
targets/eds/roblib_search_eds.module

@ -242,7 +242,6 @@ function roblib_search_eds_get_results($query = NULL, $type = NULL) {
}
function roblib_search_eds_get_detailed_result(&$output, $query, &$eds_api) {
$detailed_record = array();
foreach ($output['records'] as &$record) {
$db = $record['DbId'];
$an = $record['An'];
@ -258,6 +257,7 @@ function roblib_search_eds_get_query_limiters($type) {
case 'Articles':
$limiters = 'facetfilter=1,SourceType:Magazines,SourceType:News,SourceType:Academic+Journals,SourceType:Conference+Materials';
break;
case 'Books':
// $limiters = '+AND+(PT+book)';
$limiters = 'facetfilter=1,SourceType:Books,SourceType:Audio,SourceType:Videos';

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

@ -8,7 +8,6 @@
* - $variables: all array elements of $variables can be used as a variable. e.g. $base_url equals $variables['base_url']
*
*
* @see template_preprocess_roblib_search_wrapper()
*/
?>
<div class ="roblib-search-more" id="roblib-search-eds-article-more"></div>
@ -16,3 +15,18 @@
<img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/>
</div>
<?php
/**
* Alternate way to create link back to ebscohost.
<form action="" id = 'roblib-search-eds-articles' method="post" style="width: 375px; overflow: auto;" onsubmit="return ebscoHostSearchGo(this);">
<input id="ebscohosturl" name="ebscohosturl" type="hidden" value="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" />
<input id="ebscohostsearchsrc" name="ebscohostsearchsrc" type="hidden" value="url" /> <input id="ebscohostsearchmode" name="ebscohostsearchmode" type="hidden" value="+" />
<input id="ebscohostkeywords" name="ebscohostkeywords" type="hidden" value="" />
<div><input id="ebscohostsearchtext" name="ebscohostsearchtext" value="history" type="hidden" size="23" style="font-size: 9pt; padding-left: 5px; margin-left: 0px;" /> <input type="submit" value="Search" style="font-size: 9pt; padding-left: 5px;" /></div>
</div>
</form>
*/
?>

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

@ -1,19 +1,8 @@
<?php
/**
* @file islandora-solr-wrapper.tpl.php
* Islandora solr search results wrapper template
* @file roblib-search-eds.tpl.php
*
* Variables available:
* - $variables: all array elements of $variables can be used as a variable. e.g. $base_url equals $variables['base_url']
* - $base_url: The base url of the current website. eg: http://example.com .
* - $user: The user object.
*
*
* - $results: Rendered search results (primary profile)
*
*
* @see template_preprocess_roblib_search_wrapper()
*/
?>
<div class ="roblib-search-more" id="roblib-search-eds-more"></div>
@ -21,3 +10,4 @@
<img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/>
</div>

1
targets/eds/theme/theme.inc

@ -20,6 +20,7 @@ function roblib_search_eds_preprocess_roblib_search_eds(&$variables) {
$search_url = $base_url . '/roblib_search/eds/ajax/' . urlencode($query);
drupal_add_js(drupal_get_path('module', 'roblib_search_eds') . '/js/eds_results.js');
drupal_add_js(array('roblib_search_eds' => array('search_url' => $search_url)), array('type' => 'setting'));
drupal_add_js("http://supportforms.epnet.com/eit/scripts/ebscohostsearch.js", 'external');
}

15
targets/evergreen/theme/roblib-search-evergreen.tpl.php

@ -1,19 +1,8 @@
<?php
/**
* @file islandora-solr-wrapper.tpl.php
* Islandora solr search results wrapper template
*
* Variables available:
* - $variables: all array elements of $variables can be used as a variable. e.g. $base_url equals $variables['base_url']
* - $base_url: The base url of the current website. eg: http://example.com .
* - $user: The user object.
*
*
* - $results: Rendered search results (primary profile)
*
*
* @see template_preprocess_roblib_search_wrapper()
* @file roblib-search-evergreen.tpl.php
*/
?>
<div class ="roblib-search-more" id="roblib-search-evergreen-more"></div>

15
targets/islandscholar/theme/roblib-search-islandscholar.tpl.php

@ -1,19 +1,8 @@
<?php
/**
* @file islandora-solr-wrapper.tpl.php
* Islandora solr search results wrapper template
*
* Variables available:
* - $variables: all array elements of $variables can be used as a variable. e.g. $base_url equals $variables['base_url']
* - $base_url: The base url of the current website. eg: http://example.com .
* - $user: The user object.
*
*
* - $results: Rendered search results (primary profile)
*
*
* @see template_preprocess_roblib_search_wrapper()
* @file roblib-search-islandscholar.tpl.php
*/
?>
<div class ="roblib-search-more" id="roblib-search-islandscholar-more">Search all Results</div>

19
theme/roblib-search-other-sources.tpl.php

@ -0,0 +1,19 @@
<?php
/**
* @file roblib-search-other-sources.tpl.php
*
*
* @see template_preprocess_roblib_search_other_sources()
*/
?>
<div class ="roblib-search-more" id="roblib-search-other-sources-more"></div>
<div class ="roblib-search-content other-sources" id="roblib-search-content-other-sources">
<div class="roblib-search-row" id="roblib-search-google-scholar">
<a href="http://scholar.google.ca/scholar?q=<?php print ($query); ?>">Google Scholar</a>
</div>
<div class="roblib-search-row" id="roblib-search-google-cse-carleton">
<a href="http://www.google.com/cse?cx=015121753026627038989:9jvssbo3xgo&ie=UTF-8&q=<?php print ($query); ?>&sa=Search">Gov Docs Google CSE</a>
</div>
</div>

27
theme/roblib-search-wrapper.tpl.php

@ -1,27 +0,0 @@
<?php
/**
* @file islandora-solr-wrapper.tpl.php
* Islandora solr search results wrapper template
*
* Variables available:
* - $variables: all array elements of $variables can be used as a variable. e.g. $base_url equals $variables['base_url']
* - $base_url: The base url of the current website. eg: http://example.com .
* - $user: The user object.
*
*
* - $results: Rendered search results (primary profile)
*
*
* @see template_preprocess_roblib_search_wrapper()
*/
?>
<div class ="roblib-search-content-wrapper">
<?php foreach($results as $result): ?>
<div><?php print $result; ?>
</div>
<?php endforeach; ?>
</div>

13
theme/theme.inc

@ -5,7 +5,16 @@
* and open the template in the editor.
*/
function roblib_search_preprocess_roblib_search_wrapper(&$variables) {
//not yet implemented
function roblib_search_preprocess_roblib_search_other_sources(&$variables) {
global $base_url;
if (!isset($query)) {
if (isset($_GET['roblib_query'])) {
$query = $_GET['roblib_query'];
}
else {
$query = '';
}
}
$variables['query'] = urlencode($query);
}
?>

Loading…
Cancel
Save