diff --git a/css/roblib_search.base.css b/css/roblib_search.base.css index 16cdd77..d8192c1 100644 --- a/css/roblib_search.base.css +++ b/css/roblib_search.base.css @@ -6,13 +6,12 @@ Purpose of the stylesheet follows. */ -.panels-ipe-portlet-content{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; } -.panels-ipe-portlet-wrapper { - border-left:1px solid #cecfcc; border-right:1px solid #cecfcc; line-height: 1.5em; margin-bottom:10px; border-bottom:1px solid #cecfcc; -} .roblib-search-more{ text-align: right; font-size: smaller; } \ No newline at end of file diff --git a/targets/eds/theme/theme.inc b/targets/eds/theme/theme.inc index 8424479..f1ac7c4 100644 --- a/targets/eds/theme/theme.inc +++ b/targets/eds/theme/theme.inc @@ -1,8 +1,8 @@ '); + items.push('
'); + items.push('' + val.label + ''); + items.push('
') + items.push(''); + }); + } + jQuery('#roblib-search-content-solr-site').empty().append(items.join('')); + }); + } + +} + diff --git a/targets/solr_site/roblib_search_solr_site.info b/targets/solr_site/roblib_search_solr_site.info new file mode 100644 index 0000000..8e3b4b6 --- /dev/null +++ b/targets/solr_site/roblib_search_solr_site.info @@ -0,0 +1,8 @@ +name = Roblib Search Solr site +dependencies[] = roblib_search +configure = admin/roblib_search/solr_site_search +description = implements the Roblib Search local Solr site bento results +package = Roblib Search +version = 7.x-dev +core = 7.x +stylesheets[all][] = css/roblib_search_solr_site.css \ No newline at end of file diff --git a/targets/solr_site/roblib_search_solr_site.install b/targets/solr_site/roblib_search_solr_site.install new file mode 100644 index 0000000..a4abe2d --- /dev/null +++ b/targets/solr_site/roblib_search_solr_site.install @@ -0,0 +1,2 @@ + 'Roblib Solr Search Target configuration', + 'description' => 'Configuration for the Roblib Solr site search target', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('roblib_search_solr_site_config_form'), + 'access arguments' => array('access administration pages'), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['roblib_search/solr_site/ajax/%'] = array( + 'title' => 'solr_site ajax', + 'page callback' => 'roblib_search_solr_site_ajax', + 'page arguments' => array(3), + 'type' => MENU_CALLBACK, + 'access arguments' => array('search roblib solr_site'), + ); + + return $items; +} + +function roblib_search_solr_site_config_form($form, &$form_state) { + /* + * $url = variable_get('roblib_search_solr_site_url', 'http://137.149.200.52'); + $url_suffix = variable_get('roblib_search_solr_site_suffix', '/opac/extras/sru?version=1.1&operation=searchRetrieve&query='); + $number_of_records = variable_get('roblib_search_solr_site_num_results', '5'); + */ + $form['roblib_search_solr_site_url'] = array( + '#type' => 'textfield', + '#title' => t('Solr url'), + '#default_value' => variable_get('roblib_search_solr_site_url', 'http://localhost:8983/solr'), + '#description' => t('The base Solr URL, for example http://localhost:8983/solr'), + '#required' => TRUE, + ); + $form['roblib_search_solr_site_num_results'] = array( + '#type' => 'textfield', + '#title' => t('Number of results to return'), + '#default_value' => variable_get('roblib_search_solr_site_num_results', '5'), + '#description' => t('The number of results to display in the Bento box'), + '#required' => TRUE, + ); + + return system_settings_form($form); +} + +/** + * Implements hook_permission(). + */ +function roblib_search_solr_site_permission() { + return array( + 'search roblib solr_site' => array( + 'title' => t('Search the solr_site target'), + 'description' => t('Search all Roblib solr_site target. This permission exposes the search blocks and allows you to see search results.'), + ), + 'administer roblib search_solr_site' => array( + 'title' => t('Administer Roblib Search Evergreen'), + 'description' => t('Administer settings for the Roblib solr_site search client.'), + ), + ); +} + +/** + * Implements hook_theme(). + */ +function roblib_search_solr_site_theme() { + // set path + $path = drupal_get_path('module', 'roblib_search_solr_site'); + $file = 'theme.inc'; + + return array( + // results page + 'roblib_search_solr_site' => array( + 'path' => $path . '/theme', + 'file' => $file, + 'template' => 'roblib-search-solr_site', + 'variables' => array('results' => NULL), + ) + ); +} + +function roblib_search_solr_site_block_info() { + + $blocks['roblib_search_solr_site_results'] = array( + // info: The name of the block. + 'info' => t('Roblib Solr Search Results block'), + // Block caching options (per role, per user, etc.) + 'cache' => DRUPAL_CACHE_PER_ROLE, // default + ); + + return $blocks; +} + +function roblib_search_solr_site_block_view($delta = '') { + //The $delta parameter tells us which block is being requested. + switch ($delta) { + case 'roblib_search_solr_site_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('Site Results'); + // The content of the block is typically generated by calling a custom + // function. + $block['content'] = theme('roblib_search_solr_site', array('results' => NULL)); + break; + } + return $block; +} + +function roblib_search_solr_site_ajax($query) { + $output = roblib_search_solr_site_get_results($query); + print $output; + exit(); +} + +/** + * + * @param string $query + * @return string + * json + */ +function roblib_search_solr_site_get_results($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, + 'rows' => $num_results, + ); + $url = url($solr_url.'/select', array('query' => $data)); + $results = drupal_http_request($url); + + return $results->data; +} + +/** + * Implements hook_help(). + * + * @param type $path + * @param type $arg + * @return type + */ +function roblib_search_solr_site_help($path, $arg) { + switch ($path) { + case 'admin/help#roblib_search_solr_site': + return t( + '

+ provides a target for the Roblib search module +

' + ); + } +} + diff --git a/targets/solr_site/theme/roblib-search-solr_site.tpl.php b/targets/solr_site/theme/roblib-search-solr_site.tpl.php new file mode 100644 index 0000000..ecab03e --- /dev/null +++ b/targets/solr_site/theme/roblib-search-solr_site.tpl.php @@ -0,0 +1,24 @@ + + +
+ + +
+
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 new file mode 100644 index 0000000..9dc72dd --- /dev/null +++ b/targets/solr_site/theme/theme.inc @@ -0,0 +1,24 @@ + array('search_url' => $search_url)), array('type' => 'setting')); +} +?>