|
|
@ -1,12 +1,12 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
/* |
|
|
|
|
|
|
|
* |
|
|
|
/** |
|
|
|
* |
|
|
|
* @file |
|
|
|
* Copyright [2017] [EBSCO Information Services] |
|
|
|
* Copyright [2017] [EBSCO Information Services]. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* You may obtain a copy of the License at |
|
|
|
* You may obtain a copy of the License at. |
|
|
|
* |
|
|
|
* |
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
|
|
* |
|
|
|
* |
|
|
@ -16,22 +16,21 @@ |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* limitations under the License. |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
require_once 'lib/EBSCODocument.php'; |
|
|
|
require_once 'lib/EBSCODocument.php'; |
|
|
|
|
|
|
|
|
|
|
|
# global variable |
|
|
|
// Global variable. |
|
|
|
$Document = null; |
|
|
|
$Document = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************** |
|
|
|
/****************************************** |
|
|
|
* Hooks |
|
|
|
* Hooks |
|
|
|
******************************************/ |
|
|
|
******************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_user_login. |
|
|
|
* Implements hook_user_login. |
|
|
|
* |
|
|
|
* |
|
|
|
* Redirects after login |
|
|
|
* Redirects after login. |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function ebsco_user_login(&$edit, $account) { |
|
|
|
function ebsco_user_login(&$edit, $account) { |
|
|
|
if (isset($_SESSION['EBSCO']['redirect'])) { |
|
|
|
if (isset($_SESSION['EBSCO']['redirect'])) { |
|
|
@ -69,32 +68,30 @@ function ebsco_help($path, $arg) { |
|
|
|
return $output; |
|
|
|
return $output; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_theme(). |
|
|
|
* Implements hook_theme(). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function ebsco_theme() { |
|
|
|
function ebsco_theme() { |
|
|
|
$themes = array( |
|
|
|
$themes = array( |
|
|
|
'ebsco_result' => array( |
|
|
|
'ebsco_result' => array( |
|
|
|
'template' => 'templates/ebsco-result' |
|
|
|
'template' => 'templates/ebsco-result', |
|
|
|
), |
|
|
|
), |
|
|
|
'ebsco_results' => array( |
|
|
|
'ebsco_results' => array( |
|
|
|
'template' => 'templates/ebsco-results' |
|
|
|
'template' => 'templates/ebsco-results', |
|
|
|
), |
|
|
|
), |
|
|
|
'ebsco_side_facets' => array( |
|
|
|
'ebsco_side_facets' => array( |
|
|
|
'template' => 'templates/ebsco-side-facets' |
|
|
|
'template' => 'templates/ebsco-side-facets', |
|
|
|
), |
|
|
|
), |
|
|
|
'ebsco_basic_search' => array( |
|
|
|
'ebsco_basic_search' => array( |
|
|
|
'template' => 'templates/ebsco-basic-search' |
|
|
|
'template' => 'templates/ebsco-basic-search', |
|
|
|
), |
|
|
|
), |
|
|
|
'ebsco_advanced_search' => array( |
|
|
|
'ebsco_advanced_search' => array( |
|
|
|
'template' => 'templates/ebsco-advanced-search' |
|
|
|
'template' => 'templates/ebsco-advanced-search', |
|
|
|
) |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
return $themes; |
|
|
|
return $themes; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_permission(). |
|
|
|
* Implements hook_permission(). |
|
|
|
* |
|
|
|
* |
|
|
@ -106,25 +103,23 @@ function ebsco_theme() { |
|
|
|
function ebsco_permission() { |
|
|
|
function ebsco_permission() { |
|
|
|
return array( |
|
|
|
return array( |
|
|
|
'administer ebsco' => array( |
|
|
|
'administer ebsco' => array( |
|
|
|
'title' => t('Administer EBSCO') |
|
|
|
'title' => t('Administer EBSCO'), |
|
|
|
), |
|
|
|
), |
|
|
|
'use ebsco' => array( |
|
|
|
'use ebsco' => array( |
|
|
|
'title' => t('Use EBSCO') |
|
|
|
'title' => t('Use EBSCO'), |
|
|
|
) |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_admin(). |
|
|
|
* Implements hook_admin(). |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function ebsco_admin() { |
|
|
|
function ebsco_admin() { |
|
|
|
$form = array(); |
|
|
|
$form = array(); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials'] = array( |
|
|
|
$form['ebsco_credentials'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => t('EDS API credentials') |
|
|
|
'#title' => t('EDS API credentials'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_profile'] = array( |
|
|
|
$form['ebsco_credentials']['ebsco_profile'] = array( |
|
|
@ -133,7 +128,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_profile'), |
|
|
|
'#default_value' => variable_get('ebsco_profile'), |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#description' => t("The API Profile Id."), |
|
|
|
'#description' => t("The API Profile Id."), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_user'] = array( |
|
|
|
$form['ebsco_credentials']['ebsco_user'] = array( |
|
|
@ -142,7 +137,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_user'), |
|
|
|
'#default_value' => variable_get('ebsco_user'), |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#description' => t("The API User Id."), |
|
|
|
'#description' => t("The API User Id."), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_password'] = array( |
|
|
|
$form['ebsco_credentials']['ebsco_password'] = array( |
|
|
@ -151,7 +146,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_password'), |
|
|
|
'#default_value' => variable_get('ebsco_password'), |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#description' => t("The API password."), |
|
|
|
'#description' => t("The API password."), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_interface'] = array( |
|
|
|
$form['ebsco_credentials']['ebsco_interface'] = array( |
|
|
@ -160,7 +155,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_interface'), |
|
|
|
'#default_value' => variable_get('ebsco_interface'), |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#description' => t("The API Interface Id."), |
|
|
|
'#description' => t("The API Interface Id."), |
|
|
|
'#required' => FALSE |
|
|
|
'#required' => FALSE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_organization'] = array( |
|
|
|
$form['ebsco_credentials']['ebsco_organization'] = array( |
|
|
@ -169,7 +164,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_organization'), |
|
|
|
'#default_value' => variable_get('ebsco_organization'), |
|
|
|
'#size' => 50, |
|
|
|
'#size' => 50, |
|
|
|
'#description' => t("The API Organization Id."), |
|
|
|
'#description' => t("The API Organization Id."), |
|
|
|
'#required' => FALSE |
|
|
|
'#required' => FALSE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_local_ips'] = array( |
|
|
|
$form['ebsco_credentials']['ebsco_local_ips'] = array( |
|
|
@ -178,7 +173,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_local_ips'), |
|
|
|
'#default_value' => variable_get('ebsco_local_ips'), |
|
|
|
'#size' => 100, |
|
|
|
'#size' => 100, |
|
|
|
'#description' => t("Local IP address list for guest detection (ex: 127.0.0.1, 192.168.10.1, 172.18.12)"), |
|
|
|
'#description' => t("Local IP address list for guest detection (ex: 127.0.0.1, 192.168.10.1, 172.18.12)"), |
|
|
|
'#required' => FALSE |
|
|
|
'#required' => FALSE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_guest'] = array( |
|
|
|
$form['ebsco_credentials']['ebsco_guest'] = array( |
|
|
@ -187,12 +182,12 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_guest', 0), |
|
|
|
'#default_value' => variable_get('ebsco_guest', 0), |
|
|
|
'#description' => t("The Guest session."), |
|
|
|
'#description' => t("The Guest session."), |
|
|
|
'#options' => array(t('No'), t('Yes')), |
|
|
|
'#options' => array(t('No'), t('Yes')), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_general'] = array( |
|
|
|
$form['ebsco_general'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => t('General Settings') |
|
|
|
'#title' => t('General Settings'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_limit'] = array( |
|
|
|
$form['ebsco_general']['ebsco_default_limit'] = array( |
|
|
@ -201,7 +196,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_default_limit', 10), |
|
|
|
'#default_value' => variable_get('ebsco_default_limit', 10), |
|
|
|
'#description' => t("Default number of results per page."), |
|
|
|
'#description' => t("Default number of results per page."), |
|
|
|
'#options' => EBSCODocument::limit_options(), |
|
|
|
'#options' => EBSCODocument::limit_options(), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_sort'] = array( |
|
|
|
$form['ebsco_general']['ebsco_default_sort'] = array( |
|
|
@ -210,7 +205,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_default_sort', 'relevance'), |
|
|
|
'#default_value' => variable_get('ebsco_default_sort', 'relevance'), |
|
|
|
'#description' => t("Default sorting option."), |
|
|
|
'#description' => t("Default sorting option."), |
|
|
|
'#options' => EBSCODocument::sort_options(), |
|
|
|
'#options' => EBSCODocument::sort_options(), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_amount'] = array( |
|
|
|
$form['ebsco_general']['ebsco_default_amount'] = array( |
|
|
@ -219,7 +214,7 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_default_amount', 'brief'), |
|
|
|
'#default_value' => variable_get('ebsco_default_amount', 'brief'), |
|
|
|
'#description' => t("Default level of data detail."), |
|
|
|
'#description' => t("Default level of data detail."), |
|
|
|
'#options' => EBSCODocument::amount_options(), |
|
|
|
'#options' => EBSCODocument::amount_options(), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_mode'] = array( |
|
|
|
$form['ebsco_general']['ebsco_default_mode'] = array( |
|
|
@ -228,51 +223,50 @@ function ebsco_admin() { |
|
|
|
'#default_value' => variable_get('ebsco_default_mode', 'all'), |
|
|
|
'#default_value' => variable_get('ebsco_default_mode', 'all'), |
|
|
|
'#description' => t("Default search mode."), |
|
|
|
'#description' => t("Default search mode."), |
|
|
|
'#options' => EBSCODocument::mode_options(), |
|
|
|
'#options' => EBSCODocument::mode_options(), |
|
|
|
'#required' => TRUE |
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return system_settings_form($form); |
|
|
|
return system_settings_form($form); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_menu(). |
|
|
|
* Implements hook_menu(). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function ebsco_menu() { |
|
|
|
function ebsco_menu() { |
|
|
|
// Ths is a route |
|
|
|
// Ths is a route. |
|
|
|
$items['ebsco/results'] = array( |
|
|
|
$items['ebsco/results'] = array( |
|
|
|
'title' => 'EBSCO Results', |
|
|
|
'title' => 'EBSCO Results', |
|
|
|
'page callback' => 'ebsco_results_page', |
|
|
|
'page callback' => 'ebsco_results_page', |
|
|
|
'access callback' => true, |
|
|
|
'access callback' => TRUE, |
|
|
|
'type' => MENU_CALLBACK |
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$items['ebsco/result'] = array( |
|
|
|
$items['ebsco/result'] = array( |
|
|
|
'title' => 'EBSCO Record', |
|
|
|
'title' => 'EBSCO Record', |
|
|
|
'page callback' => 'ebsco_result_page', |
|
|
|
'page callback' => 'ebsco_result_page', |
|
|
|
'access callback' => true, |
|
|
|
'access callback' => TRUE, |
|
|
|
'type' => MENU_CALLBACK |
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$items['ebsco/pdf'] = array( |
|
|
|
$items['ebsco/pdf'] = array( |
|
|
|
'title' => 'EBSCO Record', |
|
|
|
'title' => 'EBSCO Record', |
|
|
|
'page callback' => 'ebsco_pdf_page', |
|
|
|
'page callback' => 'ebsco_pdf_page', |
|
|
|
'access callback' => true, |
|
|
|
'access callback' => TRUE, |
|
|
|
'type' => MENU_CALLBACK |
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$items['ebsco/fulltext'] = array( |
|
|
|
$items['ebsco/fulltext'] = array( |
|
|
|
'title' => 'EBSCO Record', |
|
|
|
'title' => 'EBSCO Record', |
|
|
|
'page callback' => 'ebsco_fulltext_page', |
|
|
|
'page callback' => 'ebsco_fulltext_page', |
|
|
|
'access callback' => true, |
|
|
|
'access callback' => TRUE, |
|
|
|
'type' => MENU_CALLBACK |
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$items['ebsco/advanced'] = array( |
|
|
|
$items['ebsco/advanced'] = array( |
|
|
|
'title' => 'EBSCO advanced search', |
|
|
|
'title' => 'EBSCO advanced search', |
|
|
|
'page callback' => 'ebsco_advanced_search_page', |
|
|
|
'page callback' => 'ebsco_advanced_search_page', |
|
|
|
'access callback' => true, |
|
|
|
'access callback' => TRUE, |
|
|
|
'type' => MENU_CALLBACK |
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$items['admin/config/search/ebsco'] = array( |
|
|
|
$items['admin/config/search/ebsco'] = array( |
|
|
@ -281,31 +275,29 @@ function ebsco_menu() { |
|
|
|
'page callback' => 'drupal_get_form', |
|
|
|
'page callback' => 'drupal_get_form', |
|
|
|
'page arguments' => array('ebsco_admin'), |
|
|
|
'page arguments' => array('ebsco_admin'), |
|
|
|
'access arguments' => array('administer ebsco'), |
|
|
|
'access arguments' => array('administer ebsco'), |
|
|
|
'type' => MENU_NORMAL_ITEM |
|
|
|
'type' => MENU_NORMAL_ITEM, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return $items; |
|
|
|
return $items; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_block_info(). |
|
|
|
* Implements hook_block_info(). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function ebsco_block_info() { |
|
|
|
function ebsco_block_info() { |
|
|
|
$blocks['ebsco_main'] = array( |
|
|
|
$blocks['ebsco_main'] = array( |
|
|
|
'info' => t('EBSCO Search Form'), |
|
|
|
'info' => t('EBSCO Search Form'), |
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE |
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$blocks['ebsco_facets'] = array( |
|
|
|
$blocks['ebsco_facets'] = array( |
|
|
|
'info' => t('EBSCO Narrow Search'), |
|
|
|
'info' => t('EBSCO Narrow Search'), |
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE |
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return $blocks; |
|
|
|
return $blocks; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implements hook_block_view(). |
|
|
|
* Implements hook_block_view(). |
|
|
|
* |
|
|
|
* |
|
|
@ -315,66 +307,75 @@ function ebsco_block_view($delta = '') { |
|
|
|
$params = $_GET; |
|
|
|
$params = $_GET; |
|
|
|
switch ($delta) { |
|
|
|
switch ($delta) { |
|
|
|
case 'ebsco_main': |
|
|
|
case 'ebsco_main': |
|
|
|
$reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== false; |
|
|
|
$reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== FALSE; |
|
|
|
return array( |
|
|
|
return array( |
|
|
|
'content' => $reject ? '' : ebsco_basic_search_block() |
|
|
|
'content' => $reject ? '' : ebsco_basic_search_block(), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'ebsco_facets': |
|
|
|
case 'ebsco_facets': |
|
|
|
$reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== false; |
|
|
|
$reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== FALSE; |
|
|
|
$reject = $reject || (isset($params['edit']) && strpos('ebsco/results', $params['q']) !== false); |
|
|
|
$reject = $reject || (isset($params['edit']) && strpos('ebsco/results', $params['q']) !== FALSE); |
|
|
|
$reject = $reject || (isset($params['q']) && strpos('ebsco/result', $params['q']) !== false); |
|
|
|
$reject = $reject || (isset($params['q']) && strpos('ebsco/result', $params['q']) !== FALSE); |
|
|
|
return array( |
|
|
|
return array( |
|
|
|
'content' => $reject ? '' : ebsco_side_facets_block() |
|
|
|
'content' => $reject ? '' : ebsco_side_facets_block(), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/****************************************************** |
|
|
|
* Page callbacks. |
|
|
|
* Page callbacks |
|
|
|
*/ |
|
|
|
******************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ebsco_results_page() { |
|
|
|
function ebsco_results_page() { |
|
|
|
return theme('ebsco_results'); |
|
|
|
return theme('ebsco_results'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
function ebsco_result_page() { |
|
|
|
function ebsco_result_page() { |
|
|
|
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; |
|
|
|
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; |
|
|
|
if ($is_xhr) { |
|
|
|
if ($is_xhr) { |
|
|
|
print theme('ebsco_result'); |
|
|
|
print theme('ebsco_result'); |
|
|
|
return true; |
|
|
|
return TRUE; |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
return theme('ebsco_result'); |
|
|
|
return theme('ebsco_result'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
function ebsco_fulltext_page() { |
|
|
|
function ebsco_fulltext_page() { |
|
|
|
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; |
|
|
|
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; |
|
|
|
if (user_is_logged_in()) { |
|
|
|
if (user_is_logged_in()) { |
|
|
|
if ($is_xhr) { |
|
|
|
if ($is_xhr) { |
|
|
|
print theme('ebsco_result'); |
|
|
|
print theme('ebsco_result'); |
|
|
|
return true; |
|
|
|
return TRUE; |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
return theme('ebsco_result'); |
|
|
|
return theme('ebsco_result'); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); |
|
|
|
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); |
|
|
|
if ($is_xhr) { |
|
|
|
if ($is_xhr) { |
|
|
|
echo "<script type=\"text/javascript\">window.location.href = '" . url('user') . "';</script>"; |
|
|
|
echo "<script type=\"text/javascript\">window.location.href = '" . url('user') . "';</script>"; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
drupal_goto('user'); |
|
|
|
drupal_goto('user'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
function ebsco_pdf_page() { |
|
|
|
function ebsco_pdf_page() { |
|
|
|
global $Document; |
|
|
|
global $Document; |
|
|
|
$params = $_REQUEST; |
|
|
|
$params = $_REQUEST; |
|
|
@ -386,34 +387,38 @@ function ebsco_pdf_page() { |
|
|
|
$Document->retrieve(); |
|
|
|
$Document->retrieve(); |
|
|
|
$record = $Document->record(); |
|
|
|
$record = $Document->record(); |
|
|
|
drupal_goto($record->pdf_link); |
|
|
|
drupal_goto($record->pdf_link); |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); |
|
|
|
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); |
|
|
|
drupal_goto('user'); |
|
|
|
drupal_goto('user'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
function ebsco_advanced_search_page() { |
|
|
|
function ebsco_advanced_search_page() { |
|
|
|
return theme('ebsco_advanced_search'); |
|
|
|
return theme('ebsco_advanced_search'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
function ebsco_basic_search_block() { |
|
|
|
function ebsco_basic_search_block() { |
|
|
|
return theme('ebsco_basic_search'); |
|
|
|
return theme('ebsco_basic_search'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
function ebsco_side_facets_block() { |
|
|
|
function ebsco_side_facets_block() { |
|
|
|
return theme('ebsco_side_facets'); |
|
|
|
return theme('ebsco_side_facets'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************** |
|
|
|
/****************************************************** |
|
|
|
* Form builders, form handlers and templates handlers |
|
|
|
* Form builders, form handlers and templates handlers |
|
|
|
******************************************************/ |
|
|
|
******************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Form builder; Output a sort form for the search results. |
|
|
|
* Form builder; Output a sort form for the search results. |
|
|
|
* |
|
|
|
* |
|
|
@ -424,7 +429,7 @@ function ebsco_sort_form() { |
|
|
|
|
|
|
|
|
|
|
|
$form = array( |
|
|
|
$form = array( |
|
|
|
'#attributes' => array('class' => 'sort-form'), |
|
|
|
'#attributes' => array('class' => 'sort-form'), |
|
|
|
'#method' => 'get' |
|
|
|
'#method' => 'get', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$options = EBSCODocument::amount_options(); |
|
|
|
$options = EBSCODocument::amount_options(); |
|
|
@ -436,7 +441,7 @@ function ebsco_sort_form() { |
|
|
|
'#title' => t('Page options'), |
|
|
|
'#title' => t('Page options'), |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#options' => $options, |
|
|
|
'#options' => $options, |
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')) |
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$options = EBSCODocument::sort_options(); |
|
|
|
$options = EBSCODocument::sort_options(); |
|
|
@ -448,13 +453,12 @@ function ebsco_sort_form() { |
|
|
|
'#title' => t('Sort'), |
|
|
|
'#title' => t('Sort'), |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#options' => $options, |
|
|
|
'#options' => $options, |
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')) |
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
return $form; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Form builder; Output a search form for the search block's search box. |
|
|
|
* Form builder; Output a search form for the search block's search box. |
|
|
|
* |
|
|
|
* |
|
|
@ -466,12 +470,12 @@ function ebsco_basic_search_form() { |
|
|
|
$form = array( |
|
|
|
$form = array( |
|
|
|
'#attributes' => array('class' => 'search-form'), |
|
|
|
'#attributes' => array('class' => 'search-form'), |
|
|
|
'#action' => url('ebsco/results'), |
|
|
|
'#action' => url('ebsco/results'), |
|
|
|
'#method' => 'get' |
|
|
|
'#method' => 'get', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['basic']['q'] = array( |
|
|
|
$form['basic']['q'] = array( |
|
|
|
'#type' => 'hidden', |
|
|
|
'#type' => 'hidden', |
|
|
|
'#default_value' => 'ebsco/results' |
|
|
|
'#default_value' => 'ebsco/results', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$default_value = isset($params['lookfor']) ? $params['lookfor'] : ''; |
|
|
|
$default_value = isset($params['lookfor']) ? $params['lookfor'] : ''; |
|
|
@ -488,23 +492,23 @@ function ebsco_basic_search_form() { |
|
|
|
'#id' => 'ebsco-basic-search-type', |
|
|
|
'#id' => 'ebsco-basic-search-type', |
|
|
|
'#type' => 'select', |
|
|
|
'#type' => 'select', |
|
|
|
'#options' => EBSCODocument::basic_search_type_options(), |
|
|
|
'#options' => EBSCODocument::basic_search_type_options(), |
|
|
|
'#default_value' => $default_value |
|
|
|
'#default_value' => $default_value, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['basic']['submit'] = array( |
|
|
|
$form['basic']['submit'] = array( |
|
|
|
'#id' => 'ebsco-basic-search-submit', |
|
|
|
'#id' => 'ebsco-basic-search-submit', |
|
|
|
'#type' => 'submit', |
|
|
|
'#type' => 'submit', |
|
|
|
'#value' => t('Search') |
|
|
|
'#value' => t('Search'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$link = url('ebsco/advanced'); |
|
|
|
$link = url('ebsco/advanced'); |
|
|
|
$form['basic']['links'] = array( |
|
|
|
$form['basic']['links'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#value' => "<a href=\"$link\">" . t('Advanced search') . "</a>" |
|
|
|
'#value' => "<a href=\"$link\">" . t('Advanced search') . "</a>", |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['basic']['offscreen'] = array( |
|
|
|
$form['basic']['offscreen'] = array( |
|
|
|
'#type' => 'container' |
|
|
|
'#type' => 'container', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($params['filter'])) { |
|
|
|
if (isset($params['filter'])) { |
|
|
@ -512,8 +516,9 @@ function ebsco_basic_search_form() { |
|
|
|
$form['basic']['offscreen']['group' . $key]['filter[]'] = array( |
|
|
|
$form['basic']['offscreen']['group' . $key]['filter[]'] = array( |
|
|
|
'#id' => 'ebsco-basic-search-filter' . $key, |
|
|
|
'#id' => 'ebsco-basic-search-filter' . $key, |
|
|
|
'#type' => 'checkbox', |
|
|
|
'#type' => 'checkbox', |
|
|
|
'#default_value' => $value, // doesn't work |
|
|
|
// doesn't work. |
|
|
|
'#attributes' => array('checked' => 'checked', 'value' => $value) |
|
|
|
'#default_value' => $value, |
|
|
|
|
|
|
|
'#attributes' => array('checked' => 'checked', 'value' => $value), |
|
|
|
|
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -522,7 +527,7 @@ function ebsco_basic_search_form() { |
|
|
|
'#type' => 'checkbox', |
|
|
|
'#type' => 'checkbox', |
|
|
|
'#title' => t('Retain my current filters'), |
|
|
|
'#title' => t('Retain my current filters'), |
|
|
|
'#prefix' => '<br />', |
|
|
|
'#prefix' => '<br />', |
|
|
|
'#default_value' => true |
|
|
|
'#default_value' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -547,26 +552,26 @@ function ebsco_advanced_search_form() { |
|
|
|
|
|
|
|
|
|
|
|
$form = array( |
|
|
|
$form = array( |
|
|
|
'#attributes' => array('class' => 'search-form'), |
|
|
|
'#attributes' => array('class' => 'search-form'), |
|
|
|
'#action' => url('ebsco/advanced') |
|
|
|
'#action' => url('ebsco/advanced'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced'] = array( |
|
|
|
$form['advanced'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => t('Advanced Search'), |
|
|
|
'#title' => t('Advanced Search'), |
|
|
|
'#collapsible' => false, |
|
|
|
'#collapsible' => FALSE, |
|
|
|
'#collapsed' => false |
|
|
|
'#collapsed' => FALSE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['rows'] = array( |
|
|
|
$form['advanced']['rows'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => '' |
|
|
|
'#title' => '', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
for ($i = 0; $i < $counter; $i++) { |
|
|
|
for ($i = 0; $i < $counter; $i++) { |
|
|
|
$form['advanced']['rows']['group' . $i] = array( |
|
|
|
$form['advanced']['rows']['group' . $i] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#tree' => true, |
|
|
|
'#tree' => TRUE, |
|
|
|
'#attributes' => array('class' => array('_advanced-row')) |
|
|
|
'#attributes' => array('class' => array('_advanced-row')), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$default_value = isset($params['group'][$i]['bool']) ? $params['group'][$i]['bool'] : ''; |
|
|
|
$default_value = isset($params['group'][$i]['bool']) ? $params['group'][$i]['bool'] : ''; |
|
|
@ -575,13 +580,14 @@ function ebsco_advanced_search_form() { |
|
|
|
'#id' => 'ebsco-advanced-search-bool' . $i, |
|
|
|
'#id' => 'ebsco-advanced-search-bool' . $i, |
|
|
|
'#type' => 'select', |
|
|
|
'#type' => 'select', |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#options' => EBSCODocument::bool_options() |
|
|
|
'#options' => EBSCODocument::bool_options(), |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
$form['advanced']['rows']['group' . $i]['bool'] = array( |
|
|
|
$form['advanced']['rows']['group' . $i]['bool'] = array( |
|
|
|
'#id' => 'ebsco-advanced-search-bool' . $i, |
|
|
|
'#id' => 'ebsco-advanced-search-bool' . $i, |
|
|
|
'#type' => 'hidden', |
|
|
|
'#type' => 'hidden', |
|
|
|
'#default_value' => 'AND' |
|
|
|
'#default_value' => 'AND', |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -593,7 +599,7 @@ function ebsco_advanced_search_form() { |
|
|
|
'#size' => 30, |
|
|
|
'#size' => 30, |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#title' => $title, |
|
|
|
'#title' => $title, |
|
|
|
'#attributes' => array('title' => t('Enter the terms you wish to search for.')) |
|
|
|
'#attributes' => array('title' => t('Enter the terms you wish to search for.')), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$default_value = isset($params['group'][$i]['type']) ? $params['group'][$i]['type'] : ''; |
|
|
|
$default_value = isset($params['group'][$i]['type']) ? $params['group'][$i]['type'] : ''; |
|
|
@ -602,30 +608,30 @@ function ebsco_advanced_search_form() { |
|
|
|
'#type' => 'select', |
|
|
|
'#type' => 'select', |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#default_value' => $default_value, |
|
|
|
'#title' => t('in'), |
|
|
|
'#title' => t('in'), |
|
|
|
'#options' => EBSCODocument::advanced_search_type_options() |
|
|
|
'#options' => EBSCODocument::advanced_search_type_options(), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if ($i > 2) { |
|
|
|
if ($i > 2) { |
|
|
|
$form['advanced']['rows']['group' . $i]['remove'] = array( |
|
|
|
$form['advanced']['rows']['group' . $i]['remove'] = array( |
|
|
|
'#markup' => '<div class="delete-search"><a href="#" class="delete _delete_row" id="delete_search_link_' . $i . '">' . t('Remove Search Field') . '</a></div>' |
|
|
|
'#markup' => '<div class="delete-search"><a href="#" class="delete _delete_row" id="delete_search_link_' . $i . '">' . t('Remove Search Field') . '</a></div>', |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['rows']['add_row'] = array( |
|
|
|
$form['advanced']['rows']['add_row'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#value' => "<a class=\"add _add_row\" href=\"#\">". t('Add Search Field') . "</a>" |
|
|
|
'#value' => "<a class=\"add _add_row\" href=\"#\">" . t('Add Search Field') . "</a>", |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$items = array( |
|
|
|
$items = array( |
|
|
|
array( |
|
|
|
array( |
|
|
|
'url' => url('ebsco/results'), |
|
|
|
'url' => url('ebsco/results'), |
|
|
|
'title' => t('Basic search') |
|
|
|
'title' => t('Basic search'), |
|
|
|
), |
|
|
|
), |
|
|
|
array( |
|
|
|
array( |
|
|
|
'url' => url('ebsco/advanced'), |
|
|
|
'url' => url('ebsco/advanced'), |
|
|
|
'title' => t('Advanced search') |
|
|
|
'title' => t('Advanced search'), |
|
|
|
) |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
$links = array(); |
|
|
|
$links = array(); |
|
|
|
foreach ($items as $item) { |
|
|
|
foreach ($items as $item) { |
|
|
@ -633,45 +639,46 @@ function ebsco_advanced_search_form() { |
|
|
|
} |
|
|
|
} |
|
|
|
$form['advanced']['links'] = array( |
|
|
|
$form['advanced']['links'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#value' => implode(' | ', $links) |
|
|
|
'#value' => implode(' | ', $links), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['modes'] = array( |
|
|
|
$form['advanced']['modes'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => t('Search modes') |
|
|
|
'#title' => t('Search modes'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['modes']['mode'] = array( |
|
|
|
$form['advanced']['modes']['mode'] = array( |
|
|
|
'#type' => 'radios', |
|
|
|
'#type' => 'radios', |
|
|
|
'#default_value' => 'all', |
|
|
|
'#default_value' => 'all', |
|
|
|
'#options' => EBSCODocument::mode_options() |
|
|
|
'#options' => EBSCODocument::mode_options(), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$expanders = $Document->expanders(); |
|
|
|
$expanders = $Document->expanders(); |
|
|
|
$limiters = $Document->limiters(); |
|
|
|
$limiters = $Document->limiters(); |
|
|
|
$options = array('' => true); |
|
|
|
$options = array('' => TRUE); |
|
|
|
foreach ($expanders as $key => $expander) { |
|
|
|
foreach ($expanders as $key => $expander) { |
|
|
|
$options[$expander['Action']] = true; |
|
|
|
$options[$expander['Action']] = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
foreach ($limiters as $key => $limiter) { |
|
|
|
foreach ($limiters as $key => $limiter) { |
|
|
|
if (!empty($limiter['Values'])) { |
|
|
|
if (!empty($limiter['Values'])) { |
|
|
|
$options[$limiter['Id']] = true; |
|
|
|
$options[$limiter['Id']] = TRUE; |
|
|
|
foreach ($limiter['Values'] as $value) { |
|
|
|
foreach ($limiter['Values'] as $value) { |
|
|
|
$options[str_replace('value', $value['Value'], $value['Action'])] = true; |
|
|
|
$options[str_replace('value', $value['Value'], $value['Action'])] = TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
$options[str_replace('value', 'y', $limiter['Action'])] = true; |
|
|
|
$options[str_replace('value', 'y', $limiter['Action'])] = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['expanders'] = array( |
|
|
|
$form['advanced']['expanders'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => t('Expand results') |
|
|
|
'#title' => t('Expand results'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters'] = array( |
|
|
|
$form['advanced']['limiters'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => t('Limit results') |
|
|
|
'#title' => t('Limit results'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$children = array(); |
|
|
|
$children = array(); |
|
|
@ -683,7 +690,7 @@ function ebsco_advanced_search_form() { |
|
|
|
'#title_display' => 'after', |
|
|
|
'#title_display' => 'after', |
|
|
|
'#name' => 'filter[]', |
|
|
|
'#name' => 'filter[]', |
|
|
|
'#attributes' => array('value' => $expander['Action']), |
|
|
|
'#attributes' => array('value' => $expander['Action']), |
|
|
|
'#checked' => $expander['selected'] |
|
|
|
'#checked' => $expander['selected'], |
|
|
|
); |
|
|
|
); |
|
|
|
$element['#children'] = ($key != 0) ? '<br />' : ''; |
|
|
|
$element['#children'] = ($key != 0) ? '<br />' : ''; |
|
|
|
$element['#children'] .= theme('checkbox', array('element' => $element)); |
|
|
|
$element['#children'] .= theme('checkbox', array('element' => $element)); |
|
|
@ -694,9 +701,9 @@ function ebsco_advanced_search_form() { |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['expanders']['filter'] = array( |
|
|
|
$form['advanced']['expanders']['filter'] = array( |
|
|
|
'#type' => 'checkboxes', |
|
|
|
'#type' => 'checkboxes', |
|
|
|
'#validated' => true, |
|
|
|
'#validated' => TRUE, |
|
|
|
'#options' => $options, |
|
|
|
'#options' => $options, |
|
|
|
'#children' => implode('', $children) |
|
|
|
'#children' => implode('', $children), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$checkboxes = $selects = $dates = array(); |
|
|
|
$checkboxes = $selects = $dates = array(); |
|
|
@ -709,34 +716,38 @@ function ebsco_advanced_search_form() { |
|
|
|
'#title_display' => 'after', |
|
|
|
'#title_display' => 'after', |
|
|
|
'#name' => 'filter[]', |
|
|
|
'#name' => 'filter[]', |
|
|
|
'#attributes' => array('value' => str_replace('value', 'y', $limiter['Action'])), |
|
|
|
'#attributes' => array('value' => str_replace('value', 'y', $limiter['Action'])), |
|
|
|
'#checked' => $limiter['selected'] |
|
|
|
'#checked' => $limiter['selected'], |
|
|
|
|
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
$element['#children'] = ($key != 0) ? '<br />' : ''; |
|
|
|
$element['#children'] = ($key != 0) ? '<br />' : ''; |
|
|
|
if (!isset($element['#children'])) |
|
|
|
if (!isset($element['#children'])) { |
|
|
|
{$element['#children']="";} |
|
|
|
$element['#children'] = ""; |
|
|
|
|
|
|
|
} |
|
|
|
$element['#children'] .= theme('checkbox', array('element' => $element)); |
|
|
|
$element['#children'] .= theme('checkbox', array('element' => $element)); |
|
|
|
$checkboxes[] = theme('form_element', array('element' => $element)); |
|
|
|
$checkboxes[] = theme('form_element', array('element' => $element)); |
|
|
|
} else if ($limiter['Type'] == 'multiselectvalue') { |
|
|
|
} |
|
|
|
|
|
|
|
elseif ($limiter['Type'] == 'multiselectvalue') { |
|
|
|
$opts = array('' => t('All')); |
|
|
|
$opts = array('' => t('All')); |
|
|
|
foreach ($limiter['Values'] as $value) { |
|
|
|
foreach ($limiter['Values'] as $value) { |
|
|
|
$opts[$value['Action']] = $value['Value']; |
|
|
|
$opts[$value['Action']] = $value['Value']; |
|
|
|
} |
|
|
|
} |
|
|
|
$element = array( |
|
|
|
$element = array( |
|
|
|
'#type' => 'select', |
|
|
|
'#type' => 'select', |
|
|
|
'#multiple' => true, |
|
|
|
'#multiple' => TRUE, |
|
|
|
'#size' => 4, |
|
|
|
'#size' => 4, |
|
|
|
'#id' => 'ebsco-advanced-search-limiter' . $limiter['Id'], |
|
|
|
'#id' => 'ebsco-advanced-search-limiter' . $limiter['Id'], |
|
|
|
'#title' => $limiter['Label'], |
|
|
|
'#title' => $limiter['Label'], |
|
|
|
'#name' => 'filter[]', |
|
|
|
'#name' => 'filter[]', |
|
|
|
'#options' => $opts, |
|
|
|
'#options' => $opts, |
|
|
|
'#default_value' => $limiter['selected'], // empty value means "All" |
|
|
|
// Empty value means "All". |
|
|
|
|
|
|
|
'#default_value' => $limiter['selected'], |
|
|
|
'#value' => $limiter['selected'], |
|
|
|
'#value' => $limiter['selected'], |
|
|
|
'#attributes' => array('class' => array('multiselectvalue'), 'multiple' => 'multiple') |
|
|
|
'#attributes' => array('class' => array('multiselectvalue'), 'multiple' => 'multiple'), |
|
|
|
); |
|
|
|
); |
|
|
|
$element['#children'] = theme('select', array('element' => $element)); |
|
|
|
$element['#children'] = theme('select', array('element' => $element)); |
|
|
|
$selects[] = theme('form_element', array('element' => $element)); |
|
|
|
$selects[] = theme('form_element', array('element' => $element)); |
|
|
|
} else if ($limiter['Type'] == 'ymrange') { |
|
|
|
} |
|
|
|
|
|
|
|
elseif ($limiter['Type'] == 'ymrange') { |
|
|
|
$value = $limiter['selected'] ? $limiter['selected'] : ''; |
|
|
|
$value = $limiter['selected'] ? $limiter['selected'] : ''; |
|
|
|
$displayValue = str_replace(array('addlimiter(DT1:', '-1/2013-1)'), array('', ''), $value); |
|
|
|
$displayValue = str_replace(array('addlimiter(DT1:', '-1/2013-1)'), array('', ''), $value); |
|
|
|
$element = array( |
|
|
|
$element = array( |
|
|
@ -745,8 +756,8 @@ function ebsco_advanced_search_form() { |
|
|
|
'#title' => $limiter['Label'], |
|
|
|
'#title' => $limiter['Label'], |
|
|
|
'#value' => $displayValue, |
|
|
|
'#value' => $displayValue, |
|
|
|
'#name' => $limiter['Id'], |
|
|
|
'#name' => $limiter['Id'], |
|
|
|
'#autocomplete_path' => null, |
|
|
|
'#autocomplete_path' => NULL, |
|
|
|
'#attributes' => array('size' => 4, 'maxlength' => 4, 'class' => array('yearbox')) |
|
|
|
'#attributes' => array('size' => 4, 'maxlength' => 4, 'class' => array('yearbox')), |
|
|
|
); |
|
|
|
); |
|
|
|
$element['#children'] = theme('textfield', array('element' => $element)); |
|
|
|
$element['#children'] = theme('textfield', array('element' => $element)); |
|
|
|
$element['#children'] .= '<input id="ebsco-advanced-search-limiter' . $limiter['Id'] . '" type="hidden" name="filter[]" value="' . $value . '"/>'; |
|
|
|
$element['#children'] .= '<input id="ebsco-advanced-search-limiter' . $limiter['Id'] . '" type="hidden" name="filter[]" value="' . $value . '"/>'; |
|
|
@ -757,39 +768,38 @@ function ebsco_advanced_search_form() { |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters']['checkboxes'] = array( |
|
|
|
$form['advanced']['limiters']['checkboxes'] = array( |
|
|
|
'#type' => 'checkboxes', |
|
|
|
'#type' => 'checkboxes', |
|
|
|
'#validated' => true, |
|
|
|
'#validated' => TRUE, |
|
|
|
'#options' => $options, |
|
|
|
'#options' => $options, |
|
|
|
'#children' => implode('', $checkboxes), |
|
|
|
'#children' => implode('', $checkboxes), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters']['dates'] = array( |
|
|
|
$form['advanced']['limiters']['dates'] = array( |
|
|
|
'#type' => 'container', |
|
|
|
'#type' => 'container', |
|
|
|
'#validated' => true, |
|
|
|
'#validated' => TRUE, |
|
|
|
'#prefix' => '<hr />', |
|
|
|
'#prefix' => '<hr />', |
|
|
|
'#children' => implode('', $dates) |
|
|
|
'#children' => implode('', $dates), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters']['selects'] = array( |
|
|
|
$form['advanced']['limiters']['selects'] = array( |
|
|
|
'#type' => 'container', |
|
|
|
'#type' => 'container', |
|
|
|
'#prefix' => '<hr />', |
|
|
|
'#prefix' => '<hr />', |
|
|
|
'#validated' => true, |
|
|
|
'#validated' => TRUE, |
|
|
|
'#children' => implode('', $selects) |
|
|
|
'#children' => implode('', $selects), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['submit'] = array( |
|
|
|
$form['advanced']['submit'] = array( |
|
|
|
'#id' => 'ebsco-advanced-search-submit', |
|
|
|
'#id' => 'ebsco-advanced-search-submit', |
|
|
|
'#type' => 'submit', |
|
|
|
'#type' => 'submit', |
|
|
|
'#value' => t('Search') |
|
|
|
'#value' => t('Search'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['advanced']['clear'] = array( |
|
|
|
$form['advanced']['clear'] = array( |
|
|
|
'#markup' => '<input id="ebsco-advanced-search-clear" class="form-submit" type="reset" value="' . t('Clear') . '" name="reset">' |
|
|
|
'#markup' => '<input id="ebsco-advanced-search-clear" class="form-submit" type="reset" value="' . t('Clear') . '" name="reset">', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
return $form; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Form validation handler for ebsco_basic_search_form(). |
|
|
|
* Form validation handler for ebsco_basic_search_form(). |
|
|
|
* |
|
|
|
* |
|
|
@ -802,7 +812,6 @@ function ebsco_basic_search_form_validate($form, &$form_state) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Form validation handler for ebsco_advanced_search_form(). |
|
|
|
* Form validation handler for ebsco_advanced_search_form(). |
|
|
|
* |
|
|
|
* |
|
|
@ -817,7 +826,6 @@ function ebsco_advanced_search_form_validate($form, &$form_state) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Form submission handler for ebsco_basic_search_form(). |
|
|
|
* Form submission handler for ebsco_basic_search_form(). |
|
|
|
* |
|
|
|
* |
|
|
@ -831,11 +839,10 @@ function ebsco_basic_search_form_submit($form, &$form_state) { |
|
|
|
unset($params[$key]); |
|
|
|
unset($params[$key]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$form_state['rebuild'] = false; |
|
|
|
$form_state['rebuild'] = FALSE; |
|
|
|
$form_state['redirect'] = array('ebsco/results', array('query' => $params)); |
|
|
|
$form_state['redirect'] = array('ebsco/results', array('query' => $params)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Form submission handler for ebsco_advanced_search_form(). |
|
|
|
* Form submission handler for ebsco_advanced_search_form(). |
|
|
|
* |
|
|
|
* |
|
|
@ -847,34 +854,35 @@ function ebsco_advanced_search_form_submit($form, &$form_state) { |
|
|
|
$allowed_keys = array('filter', 'mode'); |
|
|
|
$allowed_keys = array('filter', 'mode'); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($params as $key => $value) { |
|
|
|
foreach ($params as $key => $value) { |
|
|
|
if (!(in_array($key, $allowed_keys) || strpos($key, 'group') !== false)) { |
|
|
|
if (!(in_array($key, $allowed_keys) || strpos($key, 'group') !== FALSE)) { |
|
|
|
unset($params[$key]); |
|
|
|
unset($params[$key]); |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
if ($key == 'filter') { |
|
|
|
if ($key == 'filter') { |
|
|
|
foreach ($value as $k => $v) { |
|
|
|
foreach ($value as $k => $v) { |
|
|
|
if (empty($v)) { |
|
|
|
if (empty($v)) { |
|
|
|
unset($params[$key][$k]); |
|
|
|
unset($params[$key][$k]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (empty($value)) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif (empty($value)) { |
|
|
|
unset($params[$key]); |
|
|
|
unset($params[$key]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach ($params as $key => $value) { |
|
|
|
foreach ($params as $key => $value) { |
|
|
|
if (strpos($key, 'group') !== false) { |
|
|
|
if (strpos($key, 'group') !== FALSE) { |
|
|
|
$new_params['group'][] = $value; |
|
|
|
$new_params['group'][] = $value; |
|
|
|
unset($params[$key]); |
|
|
|
unset($params[$key]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$params = array_merge($params, $new_params); |
|
|
|
$params = array_merge($params, $new_params); |
|
|
|
|
|
|
|
|
|
|
|
$form_state['rebuild'] = false; |
|
|
|
$form_state['rebuild'] = FALSE; |
|
|
|
$form_state['redirect'] = array('ebsco/results', array('query' => $params)); |
|
|
|
$form_state['redirect'] = array('ebsco/results', array('query' => $params)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process variables for ebsco-results.tpl.php. |
|
|
|
* Process variables for ebsco-results.tpl.php. |
|
|
|
* |
|
|
|
* |
|
|
@ -905,7 +913,8 @@ function template_preprocess_ebsco_results(&$variables) { |
|
|
|
$variables['lookfor'] = ''; |
|
|
|
$variables['lookfor'] = ''; |
|
|
|
if (isset($params['lookfor'])) { |
|
|
|
if (isset($params['lookfor'])) { |
|
|
|
$variables['lookfor'] = $params['lookfor']; |
|
|
|
$variables['lookfor'] = $params['lookfor']; |
|
|
|
} else if (isset($params['group'])) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif (isset($params['group'])) { |
|
|
|
$types = EBSCODocument::basic_search_type_options(); |
|
|
|
$types = EBSCODocument::basic_search_type_options(); |
|
|
|
foreach ($params['group'] as $key => $group) { |
|
|
|
foreach ($params['group'] as $key => $group) { |
|
|
|
if (!empty($group['lookfor'])) { |
|
|
|
if (!empty($group['lookfor'])) { |
|
|
@ -923,7 +932,6 @@ function template_preprocess_ebsco_results(&$variables) { |
|
|
|
// $Document->search_write(); |
|
|
|
// $Document->search_write(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process variables for ebsco-basic-search.tpl.php. |
|
|
|
* Process variables for ebsco-basic-search.tpl.php. |
|
|
|
* |
|
|
|
* |
|
|
@ -941,7 +949,8 @@ function template_preprocess_ebsco_basic_search(&$variables) { |
|
|
|
$variables['lookfor'] = ''; |
|
|
|
$variables['lookfor'] = ''; |
|
|
|
if (isset($params['lookfor'])) { |
|
|
|
if (isset($params['lookfor'])) { |
|
|
|
$variables['lookfor'] = $params['lookfor']; |
|
|
|
$variables['lookfor'] = $params['lookfor']; |
|
|
|
} else if (isset($params['group'])) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif (isset($params['group'])) { |
|
|
|
$types = EBSCODocument::basic_search_type_options(); |
|
|
|
$types = EBSCODocument::basic_search_type_options(); |
|
|
|
foreach ($params['group'] as $key => $group) { |
|
|
|
foreach ($params['group'] as $key => $group) { |
|
|
|
if (!empty($group['lookfor'])) { |
|
|
|
if (!empty($group['lookfor'])) { |
|
|
@ -954,7 +963,6 @@ function template_preprocess_ebsco_basic_search(&$variables) { |
|
|
|
$variables['search_form'] = drupal_render($v1); |
|
|
|
$variables['search_form'] = drupal_render($v1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process variables for ebsco-advanced-search.tpl.php. |
|
|
|
* Process variables for ebsco-advanced-search.tpl.php. |
|
|
|
* |
|
|
|
* |
|
|
@ -974,7 +982,6 @@ function template_preprocess_ebsco_advanced_search(&$variables) { |
|
|
|
$variables['search_form'] = drupal_render($v1); |
|
|
|
$variables['search_form'] = drupal_render($v1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process variables for ebsco-result.tpl.php. |
|
|
|
* Process variables for ebsco-result.tpl.php. |
|
|
|
* |
|
|
|
* |
|
|
@ -998,7 +1005,6 @@ function template_preprocess_ebsco_result(&$variables) { |
|
|
|
drupal_set_title($record->title); |
|
|
|
drupal_set_title($record->title); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process variables for ebsco-side-facets.tpl.php. |
|
|
|
* Process variables for ebsco-side-facets.tpl.php. |
|
|
|
* |
|
|
|
* |
|
|
@ -1016,24 +1022,24 @@ function template_preprocess_ebsco_side_facets(&$variables) { |
|
|
|
$variables['expanders'] = $Document->expanders(); |
|
|
|
$variables['expanders'] = $Document->expanders(); |
|
|
|
$variables['limiters'] = $Document->limiters(); |
|
|
|
$variables['limiters'] = $Document->limiters(); |
|
|
|
$variables['facets'] = $Document->facets(); |
|
|
|
$variables['facets'] = $Document->facets(); |
|
|
|
$variables['filters'] = $Document->filters(); // applied facets, limiters or expanders |
|
|
|
// Applied facets, limiters or expanders. |
|
|
|
$variables['search_params'] = $Document->search_params(); // hidden parameters |
|
|
|
$variables['filters'] = $Document->filters(); |
|
|
|
$variables['link_search_params'] = $Document->link_search_params(); // hidden parameters |
|
|
|
// Hidden parameters. |
|
|
|
|
|
|
|
$variables['search_params'] = $Document->search_params(); |
|
|
|
|
|
|
|
// Hidden parameters. |
|
|
|
|
|
|
|
$variables['link_search_params'] = $Document->link_search_params(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************** |
|
|
|
/****************************************** |
|
|
|
* View Helpers |
|
|
|
* View Helpers |
|
|
|
******************************************/ |
|
|
|
******************************************/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns an URL without the given filter parameter |
|
|
|
* Returns an URL without the given filter parameter. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return string |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function remove_filter_link($filter) |
|
|
|
function remove_filter_link($filter) { |
|
|
|
{ |
|
|
|
|
|
|
|
$params = $_REQUEST; |
|
|
|
$params = $_REQUEST; |
|
|
|
if (isset($params['filter'])) { |
|
|
|
if (isset($params['filter'])) { |
|
|
|
foreach ($params['filter'] as $key => $value) { |
|
|
|
foreach ($params['filter'] as $key => $value) { |
|
|
@ -1045,14 +1051,12 @@ function remove_filter_link($filter) |
|
|
|
return url('ebsco/results', array('query' => $params)); |
|
|
|
return url('ebsco/results', array('query' => $params)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Performs a regex and replaces any url's with links containing themselves as the text |
|
|
|
* Performs a regex and replaces any url's with links containing themselves as the text. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return string |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function auto_link($string) |
|
|
|
function auto_link($string) { |
|
|
|
{ |
|
|
|
|
|
|
|
$linkedString = preg_replace_callback( |
|
|
|
$linkedString = preg_replace_callback( |
|
|
|
"/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i", |
|
|
|
"/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i", |
|
|
|
create_function( |
|
|
|
create_function( |
|
|
|