Browse Source

solr site search module installs successfully and admin form works

d9
ppound 3 years ago
parent
commit
efd1161717
  1. 1
      modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsArticles.php
  2. 3
      modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsBooks.php
  3. 8
      modules/solr_site/roblib_search_solr_site.info
  4. 8
      modules/solr_site/roblib_search_solr_site.info.yml
  5. 2
      modules/solr_site/roblib_search_solr_site.install
  6. 10
      modules/solr_site/roblib_search_solr_site.libraries.yml
  7. 318
      modules/solr_site/roblib_search_solr_site.module
  8. 24
      modules/solr_site/roblib_search_solr_site.routing.yml
  9. 70
      modules/solr_site/src/Controller/RoblibSearchSolrsiteController.php
  10. 85
      modules/solr_site/src/Form/SolrsiteSettingsForm.php
  11. 39
      modules/solr_site/src/Plugin/Block/RoblibSearchSolrsiteBestbet.php
  12. 40
      modules/solr_site/src/Plugin/Block/RoblibSearchSolrsiteGeneral.php
  13. 0
      modules/solr_site/templates/roblib-search-solr-site-results.html.twig
  14. 0
      modules/solr_site/templates/theme.inc
  15. 3
      roblib_search.module
  16. 34
      src/Plugin/Block/RoblibSearchOtherSourcesBlock.php
  17. 16
      templates/roblib-search-other-sources.html.twig
  18. 4
      theme/theme.inc

1
modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsArticles.php

@ -30,7 +30,6 @@ class RoblibSearchEdsArticles extends BlockBase {
return [ return [
'#theme' => 'roblib_search_eds_articles', '#theme' => 'roblib_search_eds_articles',
'query' => $query, 'query' => $query,
'spinner_path' => 'test',
'#attached' => [ '#attached' => [
'library' => [ 'library' => [
'roblib_search_eds/eds-article' 'roblib_search_eds/eds-article'

3
modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsBooks.php

@ -29,8 +29,7 @@ class RoblibSearchEdsBooks extends BlockBase {
]; ];
return [ return [
'#theme' => 'roblib_search_eds_books', '#theme' => 'roblib_search_eds_books',
'query' => $query, //'query' => $query,
'spinner_path' => 'test',
'#attached' => [ '#attached' => [
'library' => [ 'library' => [
'roblib_search_eds/eds-book' 'roblib_search_eds/eds-book'

8
modules/solr_site/roblib_search_solr_site.info

@ -1,8 +0,0 @@
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

8
modules/solr_site/roblib_search_solr_site.info.yml

@ -0,0 +1,8 @@
name: Roblib Search Solr site
type: module
configure: roblib_search_solr_site.settings
description: Implements the Roblib Search for local Solr site bento results
package: Roblib Search
core_version_requirement: ^8.9 || ^9
dependancies:
- roblib_search

2
modules/solr_site/roblib_search_solr_site.install

@ -1,2 +0,0 @@
<?php

10
modules/solr_site/roblib_search_solr_site.libraries.yml

@ -0,0 +1,10 @@
solr-site:
version: 1.x
css:
base:
css/roblib_search_solr_site.css: {}
js:
js/solr_site_results.js: {}
js/solr_site_bestbet.js: {}
dependencies:
- core/drupal

318
modules/solr_site/roblib_search_solr_site.module

@ -4,245 +4,23 @@
* @file * @file
* Implementation of Roblib search for searching several targets. * Implementation of Roblib search for searching several targets.
*/ */
/** /**
* Implements hook_menu().
*/
function roblib_search_solr_site_menu() {
$items = array();
$items['admin/roblib_search/solr_site_search'] = array(
'title' => '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/bestbet/%'] = array(
'title' => 'BestBet',
'page callback' => 'roblib_search_solr_site_bestbet',
'page arguments' => array(3),
'type' => MENU_CALLBACK,
'access arguments' => array('search roblib solr_site'),
);
$items['roblib_search/solr_site/reserves/%'] = array(
'title' => 'BestBet',
'page callback' => 'roblib_search_solr_site_reserves',
'page arguments' => array(3),
'type' => MENU_CALLBACK,
'access arguments' => array('search roblib solr_site'),
);
$items['roblib_search/solr_site/databases/%'] = array(
'title' => 'solr_site databases',
'page callback' => 'roblib_search_solr_site_databases',
'page arguments' => array(3),
'type' => MENU_CALLBACK,
'access arguments' => array('search roblib solr_site'),
);
$items['roblib_search/solr_site/guides/%'] = array(
'title' => 'solr_site guides',
'page callback' => 'roblib_search_solr_site_guides',
'page arguments' => array(3),
'type' => MENU_CALLBACK,
'access arguments' => array('search roblib solr_site'),
);
$items['roblib_search/solr_site/results/%'] = array(
'title' => 'solr_site guides',
'page callback' => 'roblib_search_solr_site_results',
'page arguments' => array(3),
'type' => MENU_CALLBACK,
'access arguments' => array('search roblib solr_site'),
);
return $items;
}
/**
* A form to manage the modules configuration.
*
* @param array $form
* A Drupal form array
* @param array $form_state
* A Drupal formstate array
*
* @return array
* A Drupal form array
*/
function roblib_search_solr_site_config_form($form, &$form_state) {
$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(). * Implements hook_theme().
*/ */
function roblib_search_solr_site_theme() { function roblib_search_solr_site_theme($existing, $type, $theme, $path) {
// set path $modulePath = \Drupal::service('module_handler')->getModule('roblib_search')
$path = drupal_get_path('module', 'roblib_search_solr_site'); ->getPath();
$file = 'theme.inc'; $spinner_path = '/' . $modulePath . "/img/spinner.gif";
return [
return array( 'roblib_search_solr_site' => [
// results page 'variables' => ['query' => NULL, 'spinner_path' => $spinner_path],
'roblib_search_solr_site' => array( ],
'path' => $path . '/theme', ];
'file' => $file,
'template' => 'roblib-search-solr-site-results',
'variables' => array('type' => NULL),
),
);
} }
/**
* Implements hook_block_info().
*/
function roblib_search_solr_site_block_info() {
$blocks['roblib_search_solr_site_bestbet'] = array(
// info: The name of the block.
'info' => t('Roblib Solr Search Best bets'),
// Block caching options (per role, per user, etc.)
'cache' => DRUPAL_CACHE_PER_ROLE, // default
);
$blocks['roblib_search_solr_site_db'] = array(
// info: The name of the block.
'info' => t('Roblib Solr Search Databases Block'),
// Block caching options (per role, per user, etc.)
'cache' => DRUPAL_CACHE_PER_ROLE, // default
);
$blocks['roblib_search_solr_site_guides'] = array(
// info: The name of the block.
'info' => t('Roblib Solr Search Guides Block'),
// Block caching options (per role, per user, etc.)
'cache' => DRUPAL_CACHE_PER_ROLE, // default
);
$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
);
$blocks['roblib_search_solr_site_reserves'] = array(
// info: The name of the block.
'info' => t('Roblib Solr Search Reserves Block'),
// Block caching options (per role, per user, etc.)
'cache' => DRUPAL_CACHE_PER_ROLE, // default
);
return $blocks;
}
/**
* Add a div around our block content so we can theme our panels.
*
* By adding our divs we can theme ours without affecting other drupal panels.
*
* @param array $variables
* Drupal variables array
* @param array $hook
*/
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-header 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-header 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-header 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-header roblib-search-solr-results-header">';
$variables['title_suffix'] = '</div>';
break;
case 'roblib_search_solr_site-roblib_search_solr_site_reserves':
$variables['title_prefix'] = '<div class="roblib-search-header roblib-search-solr-reserves-header">';
$variables['title_suffix'] = '</div>';
break;
}
}
/**
* Implements hook_block_view().
*/
function roblib_search_solr_site_block_view($delta = '') {
switch ($delta) {
case 'roblib_search_solr_site_bestbet':
$block['subject'] = t('Best Bets');
$block['content'] = theme('roblib_search_solr_site', array('type' => 'bestbet'));
break;
case 'roblib_search_solr_site_db':
$block['subject'] = t('Databases');
$block['content'] = theme('roblib_search_solr_site', array('type' => 'databases'));
break;
case 'roblib_search_solr_site_guides':
$block['subject'] = t('Guides');
$block['content'] = theme('roblib_search_solr_site', array('type' => 'guides'));
break;
case 'roblib_search_solr_site_results':
$block['subject'] = t('Library Site');
$block['content'] = theme('roblib_search_solr_site', array('type' => 'results'));
break;
case 'roblib_search_solr_site_reserves':
$block['subject'] = t('Reserves');
$block['content'] = theme('roblib_search_solr_site', array('type' => 'reserves'));
break;
}
return $block;
}
/** /**
* Send the query to solr but limit the results so it doesn't include certain content. * Send the query to solr but limit the results so it doesn't include certain content.
@ -252,10 +30,10 @@ function roblib_search_solr_site_block_view($delta = '') {
* @param string $query * @param string $query
* The solr search string. * The solr search string.
*/ */
function roblib_search_solr_site_results($query) { /*function roblib_search_solr_site_results($query) {
print roblib_search_solr_site_get_results($query, '-bundle:bestbet'); print roblib_search_solr_site_get_results($query, '-bundle:bestbet');
exit(); exit();
} }*/
/** /**
* Send the query to solr but limit the results so it only includes content of type bestbet. * Send the query to solr but limit the results so it only includes content of type bestbet.
@ -265,54 +43,14 @@ function roblib_search_solr_site_results($query) {
* @param string $query * @param string $query
* The solr search string. * The solr search string.
*/ */
function roblib_search_solr_site_bestbet($query) { /*function roblib_search_solr_site_bestbet($query) {
$query = str_replace('"', '', $query); $query = str_replace('"', '', $query);
$json = roblib_search_solr_site_get_results("sort_label:$query", 'bundle:bestbet'); $json = roblib_search_solr_site_get_results("sort_label:$query", 'bundle:bestbet');
$json = roblib_search_solr_site_add_url($json); $json = roblib_search_solr_site_add_url($json);
print $json; print $json;
exit(); exit();
} }*/
/**
* Send the query to solr but limit the results so it only includes content of type database.
*
* Print json and exit so the javascript can consume the json.
*
* @param string $query
* The solr search string.
*/
function roblib_search_solr_site_databases($query) {
print roblib_search_solr_site_get_results($query, 'bundle:database');
exit();
}
/**
* Send the query to solr but limit the results so it only includes content of type database.
*
* Print json and exit so the javascript can consume the json.
*
* @param string $query
* The solr search string.
*/
function roblib_search_solr_site_reserves($query) {
print roblib_search_solr_site_get_results($query, 'bundle:course_reserve');
exit();
}
/**
* Send the query to solr but limit the results so it only includes content of tagged with the guide keyword.
*
* Print json and exit so the javascript can consume the json.
*
* @param string $query
* The solr search string.
*/
function roblib_search_solr_site_guides($query) {
// TODO make the field and value searched configurable instead of hardcoded.
// sm_vid_SearchKeywords:guides is another field we might use.
print roblib_search_solr_site_get_results($query, 'im_field_keywords:627');
exit();
}
/** /**
@ -327,7 +65,7 @@ function roblib_search_solr_site_guides($query) {
* @return string * @return string
* json we got from solr with an updated url directly to the target of the link field * json we got from solr with an updated url directly to the target of the link field
*/ */
function roblib_search_solr_site_add_url($json) { /*function roblib_search_solr_site_add_url($json) {
$responses = json_decode($json); $responses = json_decode($json);
foreach ($responses->response->docs as &$doc) { foreach ($responses->response->docs as &$doc) {
$nid = $doc->entity_id; $nid = $doc->entity_id;
@ -341,31 +79,7 @@ function roblib_search_solr_site_add_url($json) {
} }
return json_encode($responses); return json_encode($responses);
} }
*/
/**
* Sends a query to Solr.
*
* @param string $query_string
* A string to search for
* @param string $type
* A string to filter the query against field:value
*
* @return string
* Solr results as json.
*/
function roblib_search_solr_site_get_results($query_string = NULL, $type) {
$num_results = variable_get('roblib_search_solr_site_num_results', '5');
$query = apachesolr_drupal_query("apachesolr");
$encoded_query = htmlentities($query_string, ENT_QUOTES);
$query->addParam('q', $encoded_query); // keyword to be searched
$query->addParam('rows', $num_results);
$query->addParam('fq', $type);
$query->addParam('mm', '1');
apachesolr_search_add_boost_params($query);
$response = $query->search();
$json_results = drupal_json_encode($response);
return $json_results;
}
/** /**
@ -376,7 +90,7 @@ function roblib_search_solr_site_help($path, $arg) {
case 'admin/help#roblib_search_solr_site': case 'admin/help#roblib_search_solr_site':
return t( return t(
'<p> '<p>
provides a target for the Roblib search module provides a Solr target for the Roblib search module
</p>' </p>'
); );
} }

24
modules/solr_site/roblib_search_solr_site.routing.yml

@ -0,0 +1,24 @@
roblib_search_solr_site.settings:
path: '/admin/config/system/roblib_search_solr_site_settings'
defaults:
_form: '\Drupal\roblib_search_solr_site\Form\SolrsiteSettingsForm'
_title: 'Roblib Search Solr Site Settings Form'
requirements:
_permission: 'administer site configuration'
roblib_search_solr_site.bestbet_search:
path: '/roblib_search/solr_site/bestbet/{query}'
defaults:
_controller: '\Drupal\roblib_search_solr_site\Controller\RoblibSearchSolrsiteController::bestbetResults'
_title: 'Roblib Search Bestbet'
query: '[a-zA-Z\s]+'
requirements:
_permission: 'access content'
roblib_search_solr_site.general_search:
path: '/roblib_search/solr_site/general/{query}'
defaults:
_controller: '\Drupal\roblib_search_solr_site\Controller\RoblibSearchSolrsiteController::generalResults'
_title: 'Roblib Search Solr Site Search'
query: '[a-zA-Z\s]+'
requirements:
_permission: 'access content'

70
modules/solr_site/src/Controller/RoblibSearchSolrsiteController.php

@ -0,0 +1,70 @@
<?php
namespace Drupal\roblib_search_solr_site\Controller;
use Drupal\Core\Controller\ControllerBase;
/**
* Controller for d3 graphs.
*/
class RoblibSearchSolrsiteController extends ControllerBase {
/**
* Print JSON.
*
*/
public function bestbetResults($query = NULL) {
print $this->getResults($query, 'BestBet');
exit();
}
/**
* Print JSON.
*
*/
public function generalResults($query = NULL) {
print $this->getResults($query, 'General');
exit();
}
/**
* Query Solr for site results.
* @param string $query
* The search term(s) to send to Solr.
* @param string type
* The type of search, either BestBet or General.
* @return string
* A JSON string
*/
function getResults($query = NULL, $type = 'General') {
global $base_url;
$config = \Drupal::config('roblib_search_solr_site.settings');
// Url parameters.
if (!isset($query)) {
if (isset($_GET['roblib_query'])) {
$query = $_GET['roblib_query'];
}
else {
return '';
}
}
$query = urlencode($query);
/* $num_results = variable_get('roblib_search_solr_site_num_results', '5');
$query = apachesolr_drupal_query("apachesolr");
$encoded_query = htmlentities($query_string, ENT_QUOTES);
$query->addParam('q', $encoded_query); // keyword to be searched
$query->addParam('rows', $num_results);
$query->addParam('fq', $type);
$query->addParam('mm', '1');
apachesolr_search_add_boost_params($query);
$response = $query->search();
$json_results = drupal_json_encode($response);
return $json_results;*/
$search_url = $base_url . '/roblib_search/solr_site/' . $type . '/' . $query;
return json_encode($query);
}
}

85
modules/solr_site/src/Form/SolrsiteSettingsForm.php

@ -0,0 +1,85 @@
<?php
namespace Drupal\roblib_search_solr_site\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Settings form for module
*
* @author ppound
*/
class SolrsiteSettingsForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'roblib_search_eds_settings_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = \Drupal::config('roblib_search_eds.settings');
/*
*
* $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);
*/
$form['solr_site_url'] = array(
'#type' => 'textfield',
'#title' => t('Solr URL'),
'#default_value' => $config->get('solr_site_url'),
'#description' => t('The base Solr URL, for example http://localhost:8983/solr'),
'#required' => TRUE,
);
$form['solr_site_num_results'] = array(
'#type' => 'textfield',
'#title' => t('Number of results to return'),
'#default_value' => $config->get('solr_site_num_results'),
'#description' => t('The number of results to display in the Bento box'),
'#required' => TRUE,
);
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => t('Save'),
'#button_type' => 'primary',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = \Drupal::configFactory()->getEditable('roblib_search_eds.settings');
$config->set('solr_site_url', $form_state->getValue('solr_site_url'))->save();
$config->set('solr_site_num_results', $form_state->getValue('solr_site_num_results'))->save();
}
}

39
modules/solr_site/src/Plugin/Block/RoblibSearchSolrsiteBestbet.php

@ -0,0 +1,39 @@
<?php
namespace Drupal\roblib_search_solr_site\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides EDS Article search results.
*
* @Block(
* id = "roblib_search_solr_site_bestbet_block",
* admin_label = @Translation("Roblib Search Solr Bestbet Block"),
* category = @Translation("Roblib Search"),
* )
*/
class RoblibSearchSolrSiteBestbet extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
//$host = \Drupal::request()->getSchemeAndHttpHost();
$search_url = \Drupal::config('roblib_search_solr_site.settings')
->get('solr_site_url');
$settings = [
'solr_site_search_url' => $search_url,
];
return [
'#theme' => 'roblib_search_solr_site',
'query' => $query,
'#attached' => [
'library' => [
'roblib_search_solr_site/solr_site'
],
'drupalSettings' => $settings,
],
];
}
}

40
modules/solr_site/src/Plugin/Block/RoblibSearchSolrsiteGeneral.php

@ -0,0 +1,40 @@
<?php
namespace Drupal\roblib_search_solr_site\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides EDS book search results.
*
* @Block(
* id = "roblib_search_solr_site_general_block",
* admin_label = @Translation("Roblib Search Solr Site Block"),
* category = @Translation("Roblib Search"),
* )
*/
class RoblibSearchSolrsiteGeneral extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
// $host = \Drupal::request()->getSchemeAndHttpHost();
$search_url = \Drupal::config('roblib_search_solr_site.settings')
->get('solr_site_url');
$settings = [
'solr_site_search_url' => $search_url,
];
return [
'#theme' => 'roblib_search_solr_site',
'query' => $query,
'#attached' => [
'library' => [
'roblib_search_solr_site/solr_site'
],
'drupalSettings' => $settings,
],
];
}
}

0
modules/solr_site/theme/roblib-search-solr-site-results.tpl.php → modules/solr_site/templates/roblib-search-solr-site-results.html.twig

0
modules/solr_site/theme/theme.inc → modules/solr_site/templates/theme.inc

3
roblib_search.module

@ -13,6 +13,9 @@ function roblib_search_theme($existing, $type, $theme, $path) {
'roblib_search_results' => [ 'roblib_search_results' => [
'variables' => ['query' => NULL], 'variables' => ['query' => NULL],
], ],
'roblib_search_other_sources' => [
'variables' => ['query' => NULL],
],
]; ];
} }

34
src/Plugin/Block/RoblibSearchOtherSourcesBlock.php

@ -0,0 +1,34 @@
<?php
namespace Drupal\roblib_search\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides a search form.
*
* @Block(
* id = "roblib_search_other_sources",
* admin_label = @Translation("Roblib Search Other Sources"),
* category = @Translation("Roblib Search"),
* )
*/
class RoblibSearchOtherSourcesBlock extends BlockBase {
/**
* {@inheritdoc}
*/
///roblib_search/
public function build() {
$prefix = '/roblib_search/';
$query = $_SERVER['REQUEST_URI'];
if (substr($query, 0, strlen($prefix)) == $prefix) {
$query = substr($query, strlen($prefix));
}
return [
'#theme' => 'roblib_search_other_sources',
'#query' => $query,
];
}
}

16
theme/roblib-search-other-sources.tpl.php → templates/roblib-search-other-sources.html.twig

@ -1,21 +1,11 @@
<?php
/**
* @file roblib-search-other-sources.tpl.php
*
*
* @see template_preprocess_roblib_search_other_sources()
*/
?>
<div class ="roblib-search-content other-sources" id="roblib-search-content-other-sources"> <div class ="roblib-search-content other-sources" id="roblib-search-content-other-sources">
<div class="roblib-search-row" id="roblib-search-google-scholar"> <div class="roblib-search-row" id="roblib-search-google-scholar">
<a href="http://scholar.google.ca/scholar?q=<?php print ($query); ?>">Google Scholar</a> <a href="http://scholar.google.ca/scholar?q={{ query }}">Google Scholar</a>
</div> </div>
<div class="roblib-search-row" id="roblib-search-google-cse-carleton"> <div class="roblib-search-row" id="roblib-search-google-cse-carleton">
<a href="http://www.google.com/cse?cx=015121753026627038989:9jvssbo3xgo&ie=UTF-8&q=<?php print ($query); ?>&sa=Search">Canadian Government Sites</a> <a href="http://www.google.com/cse?cx=015121753026627038989:9jvssbo3xgo&ie=UTF-8&q={{ query }}&sa=Search">Canadian Government Sites</a>
</div> </div>
<div class="roblib-search-row" id="roblib-search-filmsondemand"> <div class="roblib-search-row" id="roblib-search-filmsondemand">
<a href="http://proxy.library.upei.ca/login?url=http://digital.films.com/portalplaylists.aspx?aid=14978&rd=lo&q=<?php print ($query); ?>">Films on Demand</a> <a href="http://proxy.library.upei.ca/login?url=http://digital.films.com/portalplaylists.aspx?aid=14978&rd=lo&q={{ query }}">Films on Demand</a>
</div> </div>
</div> </div>

4
theme/theme.inc

@ -5,7 +5,7 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
function roblib_search_preprocess_roblib_search_other_sources(&$variables) { /*function roblib_search_preprocess_roblib_search_other_sources(&$variables) {
global $base_url; global $base_url;
if (!isset($query)) { if (!isset($query)) {
if (isset($_GET['roblib_query'])) { if (isset($_GET['roblib_query'])) {
@ -16,5 +16,5 @@ function roblib_search_preprocess_roblib_search_other_sources(&$variables) {
} }
} }
$variables['query'] = urlencode($query); $variables['query'] = urlencode($query);
} }*/
?> ?>

Loading…
Cancel
Save