Browse Source

added panels_preprocess function for each target to make theming easier

2.x-ebsco
Paul Pound 11 years ago
parent
commit
e41639a335
  1. 8
      css/roblib_search.base.css
  2. 14
      targets/cufts/roblib_search_cufts.module
  3. 1
      targets/cufts/theme/theme.inc
  4. 19
      targets/eds/roblib_search_eds.module
  5. 31
      targets/evergreen/roblib_search_evergreen.module
  6. 7
      targets/islandscholar/roblib_search_islandscholar.module
  7. 24
      targets/solr_site/roblib_search_solr_site.module
  8. 6
      targets/solr_site/theme/roblib-search-solr-site-results.tpl.php

8
css/roblib_search.base.css

@ -6,9 +6,13 @@
Purpose of the stylesheet follows.
*/
/*.panel-pane {background:#f4f4f4 url(../img/bggradientresult.jpg) repeat-x top left;position:relative;overflow:hidden; padding: 5px;padding-left: 10px;
/*.pane-roblib-search-cufts-roblib-search-cufts-results {background:#f4f4f4 url(../img/bggradientresult.jpg) repeat-x top left;position:relative;padding: 5px;padding-left: 10px;
border-left:1px solid #cecfcc; border-right:1px solid #cecfcc; line-height: 1.5em; margin-bottom:10px; border-bottom:1px solid #cecfcc;
}*/
} */
.panel-pane {padding: 5px;padding-left: 10px; border-top:1px solid #cecfcc;
border-left:1px solid #cecfcc; border-right:1px solid #cecfcc; line-height: 1.5em; margin-bottom:10px; border-bottom:1px solid #cecfcc;
}
.roblib-search-row {
border-bottom:1px #cecfcc dotted;
}

14
targets/cufts/roblib_search_cufts.module

@ -120,6 +120,13 @@ function roblib_search_cufts_theme() {
);
}
function roblib_search_cufts_preprocess_panels_pane(&$variables, $hook){
if($variables['pane']->subtype == 'roblib_search_cufts-roblib_search_cufts_results'){
$variables['title_prefix'] = '<div class="roblib-search-cufts-header">';
$variables['title_suffix'] ='</div>';
}
}
function roblib_search_cufts_block_info() {
$blocks['roblib_search_cufts_results'] = array(
@ -133,16 +140,9 @@ function roblib_search_cufts_block_info() {
}
function roblib_search_cufts_block_view($delta = '') {
//The $delta parameter tells us which block is being requested.
switch ($delta) {
case 'roblib_search_cufts_results':
// 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('Journals');
// The content of the block is typically generated by calling a custom
// function.
// $block['content'] = roblib_search_cufts_get_results();
$block['content'] = theme('roblib_search_cufts', array('results' => NULL)); //we will get the results via javascript
break;
}

1
targets/cufts/theme/theme.inc

@ -18,7 +18,6 @@ function roblib_search_cufts_preprocess_roblib_search_cufts(&$variables) {
$spinner_path = $base_url . '/' . drupal_get_path('module', 'roblib_search') . '/img/'.'spinner.gif';
$variables['spinner_path'] = $spinner_path;
$search_url = $base_url .'/roblib_search/cufts/ajax/'.urlencode($query);
drupal_add_js(drupal_get_path('module', 'roblib_search_cufts') . '/js/cufts_results.js');
$url = variable_get('roblib_search_cufts_url', 'http://cufts2.lib.sfu.ca/CJDB/PCU/browse/show?');

19
targets/eds/roblib_search_eds.module

@ -151,6 +151,17 @@ function roblib_search_eds_theme() {
);
}
function roblib_search_eds_preprocess_panels_pane(&$variables, $hook){
if($variables['pane']->subtype == 'roblib_search_eds-roblib_search_eds_articles'){
$variables['title_prefix'] = '<div class="roblib-search-eds-articles-header">';
$variables['title_suffix'] ='</div>';
}
if($variables['pane']->subtype == 'roblib_search_eds-roblib_search_eds_results'){
$variables['title_prefix'] = '<div class="roblib-search-eds-media-header">';
$variables['title_suffix'] ='</div>';
}
}
function roblib_search_eds_block_info() {
$blocks['roblib_search_eds_results'] = array(
@ -193,7 +204,7 @@ function roblib_search_eds_ajax($query) {
exit();
}
function roblib_search_eds_articles($query){
function roblib_search_eds_articles($query) {
print roblib_search_eds_get_results($query, 'Articles');
exit();
}
@ -217,19 +228,19 @@ function roblib_search_eds_get_results($query = NULL, $type = NULL) {
}
}
$limiters = '';
if($type != NULL){
if ($type != NULL) {
$limiters = roblib_search_eds_get_query_limiters($type);
}
$config = roblib_search_eds_build_config_arr();
$eds_api = new EBSCOAPI($config);
$number_per_page = variable_get('roblib_search_eds_num_results', '5');
$query = urlencode($query);
$params = "query=AND,$query&includefacets=n&$limiters&resultsperpage=$number_per_page";
$params = "query=AND,$query&view=detailed&includefacets=n&$limiters&resultsperpage=$number_per_page";
$output = $eds_api->apiSearch($params);
return json_encode($output);
}
function roblib_search_eds_get_query_limiters($type){
function roblib_search_eds_get_query_limiters($type) {
$limiters = 'n';
switch ($type) {
case 'Articles':

31
targets/evergreen/roblib_search_evergreen.module

@ -5,30 +5,6 @@
* Implementation of Roblib search for searching several targets.
*/
/**
* Implements hook_boot().
* @global type $conf
*/
function roblib_search_evergreen_boot() {
/* below is an example from islandora_solr module for internationalization
* global $conf;
// Allow i18n, by using multilingual variables.
if (module_exists('i18n')) {
$vars = array(
'islandora_solr_facets',
'islandora_solr_result_fields',
'islandora_solr_searchterms'
);
if (isset($conf['i18n_variables']) && is_array($conf['i18n_variables'])) {
$conf['i18n_variables'] = array_merge($vars, $conf['i18n_variables']);
}
else {
$conf['i18n_variables'] = $vars;
}
} */
}
/**
* Implements hook_menu().
@ -119,6 +95,13 @@ function roblib_search_evergreen_permission() {
);
}
function roblib_search_evergreen_preprocess_panels_pane(&$variables, $hook){
if($variables['pane']->subtype == 'roblib_search_evergreen-roblib_search_evergreen_results'){
$variables['title_prefix'] = '<div class="roblib-search-evergreen-header">';
$variables['title_suffix'] ='</div>';
}
}
/**
* Implements hook_theme().
*/

7
targets/islandscholar/roblib_search_islandscholar.module

@ -98,6 +98,13 @@ function roblib_search_islandscholar_block_info() {
return $blocks;
}
function roblib_search_islandscholar_preprocess_panels_pane(&$variables, $hook){
if($variables['pane']->subtype == 'roblib_search_islandscholar-roblib_islandscholar_results'){
$variables['title_prefix'] = '<div class="roblib-search-islandscholar-header">';
$variables['title_suffix'] ='</div>';
}
}
/**
* Implements hook_block_view().
*/

24
targets/solr_site/roblib_search_solr_site.module

@ -162,6 +162,30 @@ function roblib_search_solr_site_block_info() {
return $blocks;
}
function roblib_search_solr_site_preprocess_panels_pane(&$variables, $hook){
switch ($variables['pane']->subtype) {
case 'roblib_search_solr_site-roblib_search_solr_site_bestbet':
$variables['title_prefix'] = '<div class="roblib-search-solr-bestbet-header">';
$variables['title_suffix'] = '</div>';
break;
case 'roblib_search_solr_site-roblib_search_solr_site_db':
$variables['title_prefix'] = '<div class="roblib-search-solr-db-header">';
$variables['title_suffix'] = '</div>';
break;
case 'roblib_search_solr_site-roblib_search_solr_site_guides':
$variables['title_prefix'] = '<div class="roblib-search-solr-guides-header">';
$variables['title_suffix'] = '</div>';
break;
case 'roblib_search_solr_site-roblib_search_solr_site_results':
$variables['title_prefix'] = '<div class="roblib-search-solr-results-header">';
$variables['title_suffix'] = '</div>';
break;
}
}
function roblib_search_solr_site_block_view($delta = '') {
switch ($delta) {
case 'roblib_search_solr_site_bestbet':

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

@ -9,6 +9,12 @@
*
*/
?>
<?
// Get rid of warnings in admin interface
if (!isset($type)){
$type = 'results';
}
?>
<div class ="roblib-search-more" id="roblib-search-solr-site-<?php echo $type;?>-more"></div>
<div class ="roblib-search-content solr-site-<?php echo $type;?>" id="roblib-search-content-solr-site-<?php echo $type;?>">
<img src="<?php print (empty($spinner_path) ? ' ' : $spinner_path); ?>"/>

Loading…
Cancel
Save