From 3abb88dd36ab85548cc4afb6a6a20f984971ac27 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Wed, 19 Jul 2017 14:36:21 -0300 Subject: [PATCH] added misc search results --- targets/eds/js/eds_results.js | 2 +- .../evergreen/roblib_search_evergreen.module | 18 +- ...scholar.css => roblib_search_passthru.css} | 0 .../js/islandscholar_results.js | 99 --------- .../passthru_results/js/passthru_results.js | 19 ++ .../roblib_search_islandscholar.info | 8 - .../roblib_search_islandscholar.module | 197 ----------------- .../roblib_search_passthru.info | 8 + ...install => roblib_search_passthru.install} | 0 .../roblib_search_passthru.module | 207 ++++++++++++++++++ .../theme/roblib-search-islandscholar.tpl.php | 13 -- .../theme/roblib-search-passthru.tpl.php | 15 ++ targets/passthru_results/theme/theme.inc | 28 ++- 13 files changed, 279 insertions(+), 335 deletions(-) rename targets/passthru_results/css/{roblib_search_islandscholar.css => roblib_search_passthru.css} (100%) delete mode 100644 targets/passthru_results/js/islandscholar_results.js create mode 100644 targets/passthru_results/js/passthru_results.js delete mode 100644 targets/passthru_results/roblib_search_islandscholar.info delete mode 100644 targets/passthru_results/roblib_search_islandscholar.module create mode 100644 targets/passthru_results/roblib_search_passthru.info rename targets/passthru_results/{roblib_search_islandscholar.install => roblib_search_passthru.install} (100%) create mode 100644 targets/passthru_results/roblib_search_passthru.module delete mode 100644 targets/passthru_results/theme/roblib-search-islandscholar.tpl.php create mode 100644 targets/passthru_results/theme/roblib-search-passthru.tpl.php diff --git a/targets/eds/js/eds_results.js b/targets/eds/js/eds_results.js index befdaa1..d20dbab 100644 --- a/targets/eds/js/eds_results.js +++ b/targets/eds/js/eds_results.js @@ -77,7 +77,7 @@ Drupal.behaviors.roblib_search_eds = { var href_str = 'http://search.ebscohost.com/login.aspx?direct=true&site=ehost-live&scope=site&type=1&custid=uprince&groupid=main&profid=' + profile + '&mode=bool&lang=en&bquery='; jQuery('#roblib-search-eds-more').empty().append('See all results (' + data.recordCount + ')'); jQuery('#roblib-eds-books-more-results').empty().append('See all results (' + data.recordCount + ')'); - jQuery('#roblib-eds-books-toc').empty().append('Books (' + data.recordCount + ')'); + jQuery('#roblib-eds-books-toc').empty().append('Books (' + data.recordCount + ')'); }); } diff --git a/targets/evergreen/roblib_search_evergreen.module b/targets/evergreen/roblib_search_evergreen.module index 983b4f7..df13d4c 100644 --- a/targets/evergreen/roblib_search_evergreen.module +++ b/targets/evergreen/roblib_search_evergreen.module @@ -150,16 +150,16 @@ function roblib_search_evergreen_block_view($delta = '') { } function roblib_search_evergreen_ajax($query) { - $output = roblib_search_evergreen_get_results($query); + $output = roblib_search_passthru_evergreen_get_results($query); print $output; exit(); } /** - * + * * @param string $query * @return string - * json + * json */ function roblib_search_evergreen_get_results($query) { drupal_add_css(drupal_get_path('module', 'roblib_search_evergreen') . '/css/roblib_search_evergreen.theme.css'); @@ -186,7 +186,7 @@ function roblib_search_evergreen_get_results($query) { } /** - * + * * @param string $results * results in marcxml * @return array $output @@ -206,13 +206,13 @@ function roblib_search_evergreen_parse_results($results, $query) { $output['numberOfRecords'] = (string)$number_of_records[0]; $catalog_base_search_url = variable_get('roblib_search_evergreen_catalog_base_search_url', 'http://islandpines.roblib.upei.ca/opac/en-CA/skin/roblib/xml/rresult.xml?rt=keyword&tp=keyword&t='); $catalog_base_search_url .= $query; - $output['catalogBaseSearchUrl'] = $catalog_base_search_url; - + $output['catalogBaseSearchUrl'] = $catalog_base_search_url; + $records = $sxml->xpath('//marcxml:record'); //$records = $sxml->xpath('//marcxml:record/marcxml:recordData/marcxml:record/marcxml:datafield[@tag="245"]/marcxml:subfield[@code="a"]'); $index = 0; foreach ($records as $record) { - $record->registerXPathNamespace('marcxml', 'http://www.loc.gov/MARC21/slim'); + $record->registerXPathNamespace('marcxml', 'http://www.loc.gov/MARC21/slim'); roblib_search_evergreen_update_array($output, $index, 'title', $record->xpath('marcxml:datafield[@tag="245"]/marcxml:subfield[@code="a"]')); roblib_search_evergreen_update_array($output, $index, 'subtitle', $record->xpath('marcxml:datafield[@tag="245"]/marcxml:subfield[@code="b"]')); roblib_search_evergreen_update_array($output, $index, 'sor', $record->xpath('marcxml:datafield[@tag="245"]/marcxml:subfield[@code="c"]')); @@ -245,7 +245,7 @@ function roblib_search_evergreen_holdings(&$arr, $index, $xpath_result){ $arr[$index]['holdings'][$holding_index]['availability'] = (string)$availability[0]; $location = $xml->xpath('marcxml:subfield[@code="a"]'); $arr[$index]['holdings'][$holding_index++]['location'] = (string)$location[0]; - } + } } function roblib_search_evergreen_electronic_holdings(&$arr, $index, $xpath_result){ @@ -258,7 +258,7 @@ function roblib_search_evergreen_electronic_holdings(&$arr, $index, $xpath_resul $url = (string)$url[0]; $arr[$index]['electronic_holdings'][$holding_index]['url'] = $url; $arr[$index]['electronic_holdings'][$holding_index++]['label'] = $label; - + } } diff --git a/targets/passthru_results/css/roblib_search_islandscholar.css b/targets/passthru_results/css/roblib_search_passthru.css similarity index 100% rename from targets/passthru_results/css/roblib_search_islandscholar.css rename to targets/passthru_results/css/roblib_search_passthru.css diff --git a/targets/passthru_results/js/islandscholar_results.js b/targets/passthru_results/js/islandscholar_results.js deleted file mode 100644 index e90a2c0..0000000 --- a/targets/passthru_results/js/islandscholar_results.js +++ /dev/null @@ -1,99 +0,0 @@ -Drupal.behaviors.roblib_search_islandscholar = { - attach: function (context, settings) { - url = settings.roblib_search_islandscholar.search_url; - jQuery.getJSON(url, function (data) { - var items = []; - var numberOfDocs = 0; - try { - numberOfDocs = data.response.docs.length; - } catch (err) { - // do nothing leave docLength at 0 - } - if (numberOfDocs < 1) { - jQuery('#' + 'roblib-search-content-islandscholar').empty().append('No Results'); - jQuery('.' + 'pane-roblib-search-islandscholar-roblib-islandscholar-results').hide(); - } else { - var counter = 0; - var divs = new Array(); - var content = new Array(); - jQuery.each(data.response.docs, function (key, val) { - id = 'roblib-search-islandscholar-' + counter; - content[counter] = ''; - if (typeof val['mods_abstract_s'] !== 'undefined') { - content[counter] = val['mods_abstract_s'][0]; - } else { - content[counter] = 'No abstract available'; - } - divs[counter++] = id; - items.push('
\n\ - '); - try { - items.push('
'); - jQuery.each(val["mods_author_lastname_first_ms"], function (key2, val2) { - items.push('' + val2 + '; ') - }) - items.push('
') - } catch (e) { - - } - - items.push('
'); - - - if (typeof val.mods_relatedItem_host_titleInfo_title_s !== 'undefined') { - items.push('' + val.mods_relatedItem_host_titleInfo_title_s + ' ') - } - - - if (typeof val.mods_canonical_date_issued_s !== 'undefined') { - items.push('' + val.mods_canonical_date_issued_s + ' ') - } - - - if (typeof val.mods_part_detail_volume_number_s !== 'undefined') { - items.push('Vol. ' + val.mods_part_detail_volume_number_s + ' ') - } - - - if (typeof val.mods_part_detail_issue_number_s !== 'undefined') { - items.push('Issue ' + val.mods_part_detail_issue_number_s + ', ') - } - - - if (typeof val.mods_part_extent_start_s !== 'undefined') { - items.push('p' + val.mods_part_extent_start_s + '') - } - - - if (typeof val.mods_part_extent_end_s !== 'undefined') { - items.push('-' + val.mods_part_extent_end_s + ',') - } - - if (typeof val.mods_genre_s !== 'undefined') { - items.push('
' + val.mods_genre_s + '
'); - } - - if (jQuery.inArray('PDF', val.fedora_datastreams_ms) > 0) { - items.push('
full text
'); - } - - items.push('
'); - - items.push('
'); - }); - - - jQuery('#roblib-search-content-islandscholar').empty().append(items.join('')); - qtipify(divs, content, 'Abstract'); - var number = data.response.numFound; - var query = encodeURIComponent(data.responseHeader.params.q);//.'milk'; - jQuery('#roblib-search-islandscholar-more').empty().append('see all results'); - - } - }); - } - -} - diff --git a/targets/passthru_results/js/passthru_results.js b/targets/passthru_results/js/passthru_results.js new file mode 100644 index 0000000..cbb5a67 --- /dev/null +++ b/targets/passthru_results/js/passthru_results.js @@ -0,0 +1,19 @@ +Drupal.behaviors.roblib_search_passthru = { + attach: function (context, settings) { + scholar_url = settings.roblib_search_passthru.scholar_search_url; + evergreen_url = settings.roblib_search_passthru.evergreen_search_url; + jQuery.getJSON(scholar_url, function (data) { + var scholar_numfound = data.response.numFound; + var query = encodeURIComponent(data.responseHeader.params.q); + jQuery('#roblib-search-passthru-islandscholar-more').empty().append('Islandscholar Results (' + scholar_numfound + ')'); + + }); + jQuery.getJSON(evergreen_url, function (data) { + var evergreen_numfound = data.numberOfRecords; + jQuery('#roblib-search-passthru-evergreen-more').empty().append('PEI Collection (' + + evergreen_numfound +')'); + }); + jQuery('#roblib-search-content-passthru').empty(); + } +} diff --git a/targets/passthru_results/roblib_search_islandscholar.info b/targets/passthru_results/roblib_search_islandscholar.info deleted file mode 100644 index ce23845..0000000 --- a/targets/passthru_results/roblib_search_islandscholar.info +++ /dev/null @@ -1,8 +0,0 @@ -name = Roblib Search IslandScholar -dependencies[] = roblib_search -configure = admin/roblib_search/islandscholar_search -description = implements the Roblib Search IslandScholar results -package = Roblib Search -version = 7.x-dev -core = 7.x -stylesheets[all][] = css/roblib_search_islandscholar.css \ No newline at end of file diff --git a/targets/passthru_results/roblib_search_islandscholar.module b/targets/passthru_results/roblib_search_islandscholar.module deleted file mode 100644 index 93606c4..0000000 --- a/targets/passthru_results/roblib_search_islandscholar.module +++ /dev/null @@ -1,197 +0,0 @@ - 'Roblib Islandscholar Search Target configuration', - 'description' => 'Configuration for the Roblib Islandscholar site search target', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('roblib_search_islandscholar_config_form'), - 'access arguments' => array('access administration pages'), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['roblib_search/islandscholar/ajax/%'] = array( - 'title' => 'islandscholar ajax', - 'page callback' => 'roblib_search_islandscholar_ajax', - 'page arguments' => array(3), - 'type' => MENU_CALLBACK, - 'access arguments' => array('search roblib islandscholar'), - ); - - return $items; -} - -function roblib_search_islandscholar_config_form($form, &$form_state) { - $form['roblib_search_islandscholar_url'] = array( - '#type' => 'textfield', - '#title' => t('Islandscholar Solr url'), - '#default_value' => variable_get('roblib_search_islandscholar_url', 'http://www.islandscholar.ca:8080/solr/'), - '#description' => t('The base Islandscholar Solr URL, for example http://www.islandscholar.ca:8080/solr/'), - '#required' => TRUE, - ); - $form['roblib_search_islandscholar_num_results'] = array( - '#type' => 'textfield', - '#title' => t('Number of results to return'), - '#default_value' => variable_get('roblib_search_islandscholar_num_results', '5'), - '#description' => t('The number of results to display in the Bento box'), - '#required' => TRUE, - ); - $form['roblib_search_islandscholar_fq'] = array( - '#type' => 'textarea', - '#title' => t('Filter Query'), - '#default_value' => variable_get('roblib_search_islandscholar_fq', 'PID:ir* AND (RELS_EXT_hasModel_uri_ms:info\:fedora/ir\:thesisCModel OR RELS_EXT_hasModel_uri_ms:info\:fedora/ir\:citationCModel)'), - '#description' => t('A query used to restrict the results to namespace and content models'), - '#required' => TRUE, - ); - - $form['roblib_search_islandscholar_qf'] = array( - '#type' => 'textarea', - '#title' => t('Query Field'), - '#default_value' => variable_get('roblib_search_islandscholar_qf', 'dc.title^2.5 dc.creator^5.0 dc.contributor^2.0 dc.description^2.0 dc.identifier^2.0 dc.type^2.0 catch_all_fields_mt^1.0'), - '#description' => t('The fields to query and a weight for each field.'), - '#required' => TRUE, - ); - - return system_settings_form($form); -} - -/** - * Implements hook_permission(). - */ -function roblib_search_islandscholar_permission() { - return array( - 'search roblib islandscholar' => array( - 'title' => t('Search the islandscholar target'), - 'description' => t('Search all Roblib islandscholar target. This permission exposes the search blocks and allows you to see search results.'), - ), - 'administer roblib search_islandscholar' => array( - 'title' => t('Administer Roblib Search Evergreen'), - 'description' => t('Administer settings for the Roblib islandscholar search client.'), - ), - ); -} - -/** - * Implements hook_theme(). - */ -function roblib_search_islandscholar_theme() { - // set path - $path = drupal_get_path('module', 'roblib_search_islandscholar'); - $file = 'theme.inc'; - - return array( - // results page - 'roblib_search_islandscholar' => array( - 'path' => $path . '/theme', - 'file' => $file, - 'template' => 'roblib-search-islandscholar', - 'variables' => array('results' => NULL), - ) - ); -} - -function roblib_search_islandscholar_block_info() { - - $blocks['roblib_islandscholar_results'] = array( - // info: The name of the block. - 'info' => t('Roblib Islandscholar Solr Search Results block'), - // Block caching options (per role, per user, etc.) - 'cache' => DRUPAL_CACHE_PER_ROLE, // default - ); - - 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(). - */ -function roblib_search_islandscholar_block_view($delta = '') { - //The $delta parameter tells us which block is being requested. - switch ($delta) { - case 'roblib_islandscholar_results': - $block['subject'] = t('IslandScholar'); - $block['content'] = theme('roblib_search_islandscholar', array('results' => NULL)); - break; - } - return $block; -} - -/** - * An endpoint for the islandscholar ajax call - * - * @param string $query - * - */ -function roblib_search_islandscholar_ajax($query) { - $output = roblib_search_islandscholar_get_results($query); - print $output; - exit(); -} - -/** - * @param $query - * @return string - */ -function roblib_search_islandscholar_get_search_url($query){ - $solr_url = variable_get('roblib_search_islandscholar_url', 'http://localhost:8983/solr'); - $num_results = variable_get('roblib_search_islandscholar_num_results', '5'); - $data = array( - 'wt' => 'json', - 'q' => $query , - 'fq' => variable_get('roblib_search_islandscholar_fq','PID:ir* AND (RELS_EXT_hasModel_uri_ms:info\:fedora/ir\:thesisCModel OR RELS_EXT_hasModel_uri_ms:info\:fedora/ir\:citationCModel)'), - 'qf' => variable_get('roblib_search_islandscholar_qf','dc.title^2.5 dc.creator^5.0 dc.contributor^2.0 dc.description^2.0 dc.identifier^2.0 dc.type^2.0 catch_all_fields_mt^1.0'), - 'rows' => $num_results, - 'defType' => 'dismax', - ); - $url = url($solr_url . '/select', array('query' => $data)); - return $url; -} - -/** - * - * @param string $query - * - * @return string - * json - */ -function roblib_search_islandscholar_get_results($query) { - $url = roblib_search_islandscholar_get_search_url($query); - $results = drupal_http_request($url); - if($results->code != '200'){ - return ""; - } - return $results->data; -} - -/** - * Implements hook_help(). - */ -function roblib_search_islandscholar_help($path, $arg) { - switch ($path) { - case 'admin/help#roblib_search_islandscholar': - return t( - '

-provides an Islandscholar target for the Roblib search module -

' - ); - } -} - diff --git a/targets/passthru_results/roblib_search_passthru.info b/targets/passthru_results/roblib_search_passthru.info new file mode 100644 index 0000000..2e5f76d --- /dev/null +++ b/targets/passthru_results/roblib_search_passthru.info @@ -0,0 +1,8 @@ +name = Roblib Search Passthru +dependencies[] = roblib_search +#configure = admin/roblib_search/passthru_search +description = implements the Roblib Search Passthru results +package = Roblib Search +version = 7.x-dev +core = 7.x +stylesheets[all][] = css/roblib_search_passthru.css diff --git a/targets/passthru_results/roblib_search_islandscholar.install b/targets/passthru_results/roblib_search_passthru.install similarity index 100% rename from targets/passthru_results/roblib_search_islandscholar.install rename to targets/passthru_results/roblib_search_passthru.install diff --git a/targets/passthru_results/roblib_search_passthru.module b/targets/passthru_results/roblib_search_passthru.module new file mode 100644 index 0000000..603ddf7 --- /dev/null +++ b/targets/passthru_results/roblib_search_passthru.module @@ -0,0 +1,207 @@ + 'Passthru ajax', + 'page callback' => 'roblib_search_passthru_islandscholar_ajax', + 'page arguments' => [4], + 'type' => MENU_CALLBACK, + 'access arguments' => ['search roblib'], + ]; + $items['roblib_search/passthru/evergreen/ajax/%'] = [ + 'title' => 'evergreen ajax', + 'page callback' => 'roblib_search_passthru_evergreen_ajax', + 'page arguments' => [4], + 'type' => MENU_CALLBACK, + 'access arguments' => ['search roblib'], + ]; + + return $items; +} + +function roblib_search_passthru_evergreen_ajax($query) { + $output = roblib_search_passthru_evergreen_get_results($query); + print $output; + exit(); +} + +/** + * + * @param string $query + * + * @return string + * json + */ +function roblib_search_passthru_evergreen_get_results($query) { + $url = variable_get('roblib_search_evergreen_url', 'http://islandpines.roblib.upei.ca'); + $url_suffix = variable_get('roblib_search_evergreen_search_suffix', '/opac/extras/sru?version=1.1&operation=searchRetrieve&query='); + $number_of_records = variable_get('roblib_search_evergreen_num_results', '5'); + $query = trim($query); + $query = str_replace(' ', '%20AND%20', $query); //hack until the library decides if we want phrase or individual words + $query .= '%20AND%20%22prince%20edward%20island%22'; + $search_url = $url . $url_suffix . $query . '&maximumRecords=' . $number_of_records; + $results = drupal_http_request($search_url); + if ($results->code == '200') { + $output = roblib_search_passthru_evergreen_parse_results($results, $query); + } + else { + watchdog('roblib_search_evergreen', 'Error retrieving results: %error', ['%error' => $results->status_message], WATCHDOG_ERROR); + $output = ''; + } + return json_encode($output); +} + +/** + * + * @param string $results + * results in marcxml + * + * @return array $output + * information we want from the xml stored in an array + */ +function roblib_search_passthru_evergreen_parse_results($results, $query) { + $xml = $results->data; + if (!isset($xml)) { + return 'no results found'; + } + $sxml = simplexml_load_string(trim($results->data)); + $output = []; + if ($sxml) { + $sxml->registerXPathNamespace('marcxml', 'http://www.loc.gov/MARC21/slim'); + $sxml->registerXPathNamespace('srw', 'http://www.loc.gov/zing/srw/'); + $number_of_records = $sxml->xpath('//srw:numberOfRecords'); + $output['numberOfRecords'] = (string) $number_of_records[0]; + $catalog_base_search_url = 'http://islandpines.roblib.upei.ca/eg/opac/results?qtype=keyword&l=4&d=2&ol=4&tp=&query='; + $catalog_base_search_url .= $query; + $output['catalogBaseSearchUrl'] = $catalog_base_search_url; + } + return $output; +} + +/** + * Implements hook_theme(). + */ +function roblib_search_passthru_theme() { + // set path + $path = drupal_get_path('module', 'roblib_search_passthru'); + $file = 'theme.inc'; + + return [ + // results page + 'roblib_search_passthru' => [ + 'path' => $path . '/theme', + 'file' => $file, + 'template' => 'roblib-search-passthru', + 'variables' => ['results' => NULL], + ], + ]; +} + +function roblib_search_passthru_block_info() { + + $blocks['roblib_passthru_results'] = [ + // info: The name of the block. + 'info' => t('Misc Results'), + // Block caching options (per role, per user, etc.) + 'cache' => DRUPAL_CACHE_PER_ROLE, + ]; + + + return $blocks; +} + +function roblib_search_passthru_preprocess_panels_pane(&$variables, $hook) { + if ($variables['pane']->subtype == 'roblib_search_passthru-roblib_passthru_results') { + $variables['title_prefix'] = '
'; + $variables['title_suffix'] = '
'; + } +} + +/** + * Implements hook_block_view(). + */ +function roblib_search_passthru_block_view($delta = '') { + $block = []; + switch ($delta) { + case 'roblib_passthru_results': + $block['subject'] = t('Misc Results'); + $block['content'] = theme('roblib_search_passthru', ['results' => NULL]); + break; + } + return $block; +} + +/** + * An endpoint for the passthru ajax call + * + * @param string $query + * + */ +function roblib_search_passthru_islandscholar_ajax($query) { + $output = roblib_search_passthru_get_results($query); + debug($output, 'pp_passthru_content', TRUE); + print $output; + exit(); +} + +/** + * @param $query + * + * @return string + */ +function roblib_search_passthru_get_search_url($query) { + $solr_url = variable_get('roblib_search_islandscholar_url', 'http://islandscholar.ca:8080/solr'); + $num_results = variable_get('roblib_search_islandscholar_num_results', '5'); + $data = [ + 'wt' => 'json', + 'q' => $query, + 'fq' => variable_get('roblib_search_islandscholar_fq', 'PID:ir* AND (RELS_EXT_hasModel_uri_ms:info\:fedora/ir\:thesisCModel OR RELS_EXT_hasModel_uri_ms:info\:fedora/ir\:citationCModel)'), + 'qf' => variable_get('roblib_search_islandscholar_qf', 'dc.title^2.5 dc.creator^5.0 dc.contributor^2.0 dc.description^2.0 dc.identifier^2.0 dc.type^2.0 catch_all_fields_mt^1.0'), + 'rows' => $num_results, + 'defType' => 'dismax', + ]; + $url = url($solr_url . '/select', ['query' => $data]); + return $url; +} + +/** + * + * @param string $query + * + * @return string + * json + */ +function roblib_search_passthru_get_results($query) { + $url = roblib_search_passthru_get_search_url($query); + $results = drupal_http_request($url); + if ($results->code != '200') { + return ""; + } + return $results->data; +} + +/** + * Implements hook_help(). + */ +function roblib_search_passthru_help($path, $arg) { + switch ($path) { + case 'admin/help#roblib_search_passthru': + return t( + '

+provides a Passthru target for the Roblib search module +

' + ); + } +} + diff --git a/targets/passthru_results/theme/roblib-search-islandscholar.tpl.php b/targets/passthru_results/theme/roblib-search-islandscholar.tpl.php deleted file mode 100644 index 208a523..0000000 --- a/targets/passthru_results/theme/roblib-search-islandscholar.tpl.php +++ /dev/null @@ -1,13 +0,0 @@ - -
Search all Results
-
- -
- - diff --git a/targets/passthru_results/theme/roblib-search-passthru.tpl.php b/targets/passthru_results/theme/roblib-search-passthru.tpl.php new file mode 100644 index 0000000..bace589 --- /dev/null +++ b/targets/passthru_results/theme/roblib-search-passthru.tpl.php @@ -0,0 +1,15 @@ + + +
+ +
+ + + + diff --git a/targets/passthru_results/theme/theme.inc b/targets/passthru_results/theme/theme.inc index 18ed5d0..c73925a 100644 --- a/targets/passthru_results/theme/theme.inc +++ b/targets/passthru_results/theme/theme.inc @@ -1,13 +1,13 @@ array('search_url' => $search_url)), array('type' => 'setting')); + $scholar_search_url = $base_url . '/roblib_search/passthru/scholar/ajax/' . urlencode($query); + $evergreen_search_url = $base_url . '/roblib_search/passthru/evergreen/ajax/' . urlencode($query); + + drupal_add_js(drupal_get_path('module', 'roblib_search_passthru') . '/js/passthru_results.js'); + drupal_add_js( + [ + 'roblib_search_passthru' => [ + 'scholar_search_url' => $scholar_search_url, + 'evergreen_search_url' => $evergreen_search_url, + ], + ], + ['type' => 'setting']); + //drupal_add_js(array('roblib_search_passthru' => array('scholar_search_url' => $scholar_search_url)), array('type' => 'setting')); + } + ?>