From e41639a3356be90db0364a782b13805bbc8be8a0 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Fri, 20 Jun 2014 15:23:08 -0300 Subject: [PATCH] added panels_preprocess function for each target to make theming easier --- css/roblib_search.base.css | 8 +++-- targets/cufts/roblib_search_cufts.module | 14 ++++----- targets/cufts/theme/theme.inc | 1 - targets/eds/roblib_search_eds.module | 25 ++++++++++----- .../evergreen/roblib_search_evergreen.module | 31 +++++-------------- .../roblib_search_islandscholar.module | 7 +++++ .../solr_site/roblib_search_solr_site.module | 24 ++++++++++++++ .../roblib-search-solr-site-results.tpl.php | 6 ++++ 8 files changed, 75 insertions(+), 41 deletions(-) diff --git a/css/roblib_search.base.css b/css/roblib_search.base.css index 2ab70c3..befb92e 100644 --- a/css/roblib_search.base.css +++ b/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; } diff --git a/targets/cufts/roblib_search_cufts.module b/targets/cufts/roblib_search_cufts.module index 0c0194d..78cf7c0 100644 --- a/targets/cufts/roblib_search_cufts.module +++ b/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'] = '
'; + $variables['title_suffix'] ='
'; + } +} + 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; } diff --git a/targets/cufts/theme/theme.inc b/targets/cufts/theme/theme.inc index 6ce5165..3780ba5 100644 --- a/targets/cufts/theme/theme.inc +++ b/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?'); diff --git a/targets/eds/roblib_search_eds.module b/targets/eds/roblib_search_eds.module index d10355d..ed3055e 100644 --- a/targets/eds/roblib_search_eds.module +++ b/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'] = '
'; + $variables['title_suffix'] ='
'; + } + if($variables['pane']->subtype == 'roblib_search_eds-roblib_search_eds_results'){ + $variables['title_prefix'] = '
'; + $variables['title_suffix'] ='
'; + } +} + 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,28 +228,28 @@ 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': $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'; - break; + // $limiters = '+AND+(PT+book)'; + $limiters = 'facetfilter=1,SourceType:Books,SourceType:Audio,SourceType:Videos'; + break; } diff --git a/targets/evergreen/roblib_search_evergreen.module b/targets/evergreen/roblib_search_evergreen.module index 34fca3a..999782e 100644 --- a/targets/evergreen/roblib_search_evergreen.module +++ b/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'] = '
'; + $variables['title_suffix'] ='
'; + } +} + /** * Implements hook_theme(). */ diff --git a/targets/islandscholar/roblib_search_islandscholar.module b/targets/islandscholar/roblib_search_islandscholar.module index 25d878d..58cefd6 100644 --- a/targets/islandscholar/roblib_search_islandscholar.module +++ b/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'] = '
'; + $variables['title_suffix'] ='
'; + } +} + /** * Implements hook_block_view(). */ diff --git a/targets/solr_site/roblib_search_solr_site.module b/targets/solr_site/roblib_search_solr_site.module index 00baff3..736e386 100755 --- a/targets/solr_site/roblib_search_solr_site.module +++ b/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'] = '
'; + $variables['title_suffix'] = '
'; + break; + + case 'roblib_search_solr_site-roblib_search_solr_site_db': + $variables['title_prefix'] = '
'; + $variables['title_suffix'] = '
'; + break; + + case 'roblib_search_solr_site-roblib_search_solr_site_guides': + $variables['title_prefix'] = '
'; + $variables['title_suffix'] = '
'; + break; + + case 'roblib_search_solr_site-roblib_search_solr_site_results': + $variables['title_prefix'] = '
'; + $variables['title_suffix'] = '
'; + break; + } +} + function roblib_search_solr_site_block_view($delta = '') { switch ($delta) { case 'roblib_search_solr_site_bestbet': diff --git a/targets/solr_site/theme/roblib-search-solr-site-results.tpl.php b/targets/solr_site/theme/roblib-search-solr-site-results.tpl.php index ca15298..54e8f2a 100644 --- a/targets/solr_site/theme/roblib-search-solr-site-results.tpl.php +++ b/targets/solr_site/theme/roblib-search-solr-site-results.tpl.php @@ -9,6 +9,12 @@ * */ ?> +