diff --git a/css/roblib_search.base.css b/css/roblib_search.base.css index d8192c1..2ab70c3 100644 --- a/css/roblib_search.base.css +++ b/css/roblib_search.base.css @@ -6,9 +6,9 @@ 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; +/*.panel-pane {background:#f4f4f4 url(../img/bggradientresult.jpg) repeat-x top left;position:relative;overflow:hidden; 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; -} +}*/ .roblib-search-row { border-bottom:1px #cecfcc dotted; } diff --git a/targets/islandscholar/roblib_search_islandscholar.module b/targets/islandscholar/roblib_search_islandscholar.module index 67a4b81..25d878d 100644 --- a/targets/islandscholar/roblib_search_islandscholar.module +++ b/targets/islandscholar/roblib_search_islandscholar.module @@ -88,9 +88,9 @@ function roblib_search_islandscholar_theme() { function roblib_search_islandscholar_block_info() { - $blocks['roblib_search_islandscholar_results'] = array( + $blocks['roblib_islandscholar_results'] = array( // info: The name of the block. - 'info' => t('Roblib Islandscholar Solr Search Results block'), + 'info' => t('Islandscholar Solr Search Results block'), // Block caching options (per role, per user, etc.) 'cache' => DRUPAL_CACHE_PER_ROLE, // default ); @@ -104,7 +104,7 @@ function roblib_search_islandscholar_block_info() { function roblib_search_islandscholar_block_view($delta = '') { //The $delta parameter tells us which block is being requested. switch ($delta) { - case 'roblib_search_islandscholar_results': + case 'roblib_islandscholar_results': $block['subject'] = t('IslandScholar'); $block['content'] = theme('roblib_search_islandscholar', array('results' => NULL)); break; diff --git a/targets/solr_site/js/solr_site_results.js b/targets/solr_site/js/solr_site_results.js index 26438cf..6b4cf8d 100644 --- a/targets/solr_site/js/solr_site_results.js +++ b/targets/solr_site/js/solr_site_results.js @@ -1,6 +1,7 @@ Drupal.behaviors.roblib_search_solr_site = { attach: function(context, settings) { url = settings.roblib_search_solr_site.search_url; + query = settings.roblib_search_solr_site.search_query; jQuery.getJSON(url, function(data) { var items = []; var numberOfDocs = 0; @@ -19,36 +20,19 @@ Drupal.behaviors.roblib_search_solr_site = { items.push('
\n\
\n\ ' + val.label + '
'); + //items.push('
' + val.teaser + '
') }); - var number = parseInt(data.rows); - jQuery('#' + 'roblib-search-content-solr-site').empty(); - items = showMoreItems(items, number); - } - }); - } - -} + jQuery('#roblib-search-content-solr-site').empty().append(items.join('')); + var number = data.response.numFound; + //var query = encodeURIComponent(data.responseHeader.params.q);//.'milk'; + var scholarUrl = "http://www.islandscholar.ca/islandora/solr/search/" + jQuery('#' + 'roblib-search-solr-site-more').empty().append('see all ' + number + ' results'); -function showMoreItems(items, number) { - for (var i = 0; i < number; i++) { - jQuery('#' + 'roblib-search-content-solr-site').append(items.pop()); - } - - if (items.length > 0) - { - - jQuery('#roblib-search-solr-site-more').empty().append('see ' + items.length + ' more results'); - jQuery('#see_more_result').click(function() { - items = showMoreItems(items, number); + } }); } - else - { - jQuery('#roblib-search-solr-site-more').empty().append('no more results'); - } - +} - return items; -} \ No newline at end of file diff --git a/targets/solr_site/roblib_search_solr_site.module b/targets/solr_site/roblib_search_solr_site.module index 6e51ec0..2044693 100644 --- a/targets/solr_site/roblib_search_solr_site.module +++ b/targets/solr_site/roblib_search_solr_site.module @@ -85,7 +85,7 @@ function roblib_search_solr_site_theme() { 'roblib_search_solr_site' => array( 'path' => $path . '/theme', 'file' => $file, - 'template' => 'roblib-search-solr_site', + 'template' => 'roblib-search-solr-site', 'variables' => array('results' => NULL), ) ); @@ -110,7 +110,7 @@ function roblib_search_solr_site_block_view($delta = '') { // 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('Site Results'); + $block['subject'] = t('Library Website'); // The content of the block is typically generated by calling a custom // function. $block['content'] = theme('roblib_search_solr_site', array('results' => NULL)); @@ -132,21 +132,28 @@ function roblib_search_solr_site_ajax($query) { * json */ function roblib_search_solr_site_get_results($query) { + $url = roblib_search_solr_site_get_search_url($query); + $results = drupal_http_request($url); + if($results->code != '200'){ + return ""; + } + return $results->data; +} + +/** + * @param $query + * @return string + */ +function roblib_search_solr_site_get_search_url($query){ $solr_url = variable_get('roblib_search_solr_site_url', 'http://localhost:8983/solr'); - //$query = $solr_url . '/select?wt=json&q=test page'; $num_results = variable_get('roblib_search_solr_site_num_results', '5'); $data = array( 'wt' => 'json', - 'q' => $query, + 'q' => $query , + 'rows' => $num_results, ); $url = url($solr_url . '/select', array('query' => $data)); - $results = drupal_http_request($url); - if($results->code != '200'){ - return ""; - } - $temp = substr($results->data, 1); - //$out = '{"rows":"' . $num_results . '",' . $results->data; - return $results->data; + return $url; } /** diff --git a/targets/solr_site/theme/roblib-search-solr_site.tpl.php b/targets/solr_site/theme/roblib-search-solr-site.tpl.php similarity index 94% rename from targets/solr_site/theme/roblib-search-solr_site.tpl.php rename to targets/solr_site/theme/roblib-search-solr-site.tpl.php index ecab03e..84563b0 100644 --- a/targets/solr_site/theme/roblib-search-solr_site.tpl.php +++ b/targets/solr_site/theme/roblib-search-solr-site.tpl.php @@ -16,9 +16,7 @@ * @see template_preprocess_roblib_search_wrapper() */ ?> - +
Search all Results
- - +
-
Search all Results
\ No newline at end of file diff --git a/targets/solr_site/theme/theme.inc b/targets/solr_site/theme/theme.inc index 9dc72dd..cc2798c 100644 --- a/targets/solr_site/theme/theme.inc +++ b/targets/solr_site/theme/theme.inc @@ -19,6 +19,8 @@ function roblib_search_solr_site_preprocess_roblib_search_solr_site(&$variables) $variables['spinner_path'] = $spinner_path; $search_url = $base_url .'/roblib_search/solr_site/ajax/'.urlencode($query); drupal_add_js(drupal_get_path('module', 'roblib_search_solr_site') . '/js/solr_site_results.js'); - drupal_add_js(array('roblib_search_solr_site' => array('search_url' => $search_url)), array('type' => 'setting')); + drupal_add_js(array('roblib_search_solr_site' => array('search_url' => $search_url, + 'search_query' => urlencode($query))), array('type' => 'setting')); + } ?>