Browse Source

Merge pull request #6 from BluesparkLabs/drupal7-coding-standards

Drupal7 coding standards
roblib
Rui Francisco 8 years ago committed by GitHub
parent
commit
dac99c4004
  1. 517
      ebsco/css/ebsco.css
  2. 2
      ebsco/ebsco.info
  3. 1644
      ebsco/ebsco.module
  4. 18
      ebsco/js/ebsco.js
  5. 1249
      ebsco/lib/EBSCOAPI.php
  6. 933
      ebsco/lib/EBSCOConnector.php
  7. 1669
      ebsco/lib/EBSCODocument.php
  8. 738
      ebsco/lib/EBSCORecord.php
  9. 1093
      ebsco/lib/EBSCOResponse.php
  10. 826
      ebsco/lib/sanitizer.class.php
  11. 7
      ebsco/templates/ebsco-advanced-search.tpl.php
  12. 30
      ebsco/templates/ebsco-basic-search.tpl.php
  13. 262
      ebsco/templates/ebsco-result.tpl.php
  14. 651
      ebsco/templates/ebsco-results.tpl.php
  15. 6
      ebsco/templates/ebsco-side-facets.tpl.php

517
ebsco/css/ebsco.css

@ -1,6 +1,6 @@
/*
* The styles for EBSCO module
*
/**
* @file
* The EBSCO module styles.
*
* Copyright [2017] [EBSCO Information Services]
*
@ -9,104 +9,104 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
@CHARSET "UTF-8";
/** General ***/
.floatleft {
float: left;
float: left;
}
.floatright {
float: right;
float: right;
}
.clear {
clear: both;
clear: both;
}
.offscreen {
display: none;
display: none;
}
.spinner {
width: 16px;
height: 16px;
background: url("../images/ajax_loading.gif") no-repeat left top;
display: none;
width: 16px;
height: 16px;
background: url("../images/ajax_loading.gif") no-repeat left top;
display: none;
}
.highlight {
font-weight: bold;
font-weight: bold;
}
/** Search list ***/
.ebsco .result {
width: 650px;
width: 650px;
}
.ebsco .record-number {
margin-right: 10px;
min-width: 10px;
margin-right: 10px;
min-width: 10px;
}
.ebsco .span-2 {
width: auto;
max-width: 70px;
margin-right: 10px;
float: left;
width: auto;
max-width: 70px;
margin-right: 10px;
float: left;
}
.ebsco .span-9 {
float: none;
overflow: auto;
width: auto;
margin-right: 0;
float: none;
overflow: auto;
width: auto;
margin-right: 0;
}
.ebsco .pagination {
margin-bottom: 0;
padding: 0.2em
margin-bottom: 0;
padding: 0.2em
}
.ebsco p.submit {
padding: 10px 0;
padding: 10px 0;
}
.ebsco .jumpMenu {
max-width: 130px;
max-width: 130px;
}
.ebsco ul.custom-links {
list-style-type: none;
margin: 0;
padding: 0;
list-style-type: none;
margin: 0;
padding: 0;
}
.ebsco ul.custom-links li {
display: inline-block;
padding-left: 0;
padding-right: 10px;
margin-left: 10px;
border-right: 1px solid #CCCCCC;
display: inline-block;
padding-left: 0;
padding-right: 10px;
margin-left: 10px;
border-right: 1px solid #cccccc;
}
.ebsco ul.custom-links li:first-child {
margin-left: 0;
margin-left: 0;
}
.ebsco ul.custom-links li:last-child {
padding-right: 0;
border-right: 0 none;
padding-right: 0;
border-right: 0 none;
}
@ -114,63 +114,63 @@
/** Side facets **/
#block-ebsco-ebsco-facets h2 {
font-weight: bold;
font-weight: bold;
}
#block-ebsco-ebsco-facets {
padding: 5px !important;
padding: 5px !important;
}
#block-ebsco-ebsco-facets dl {
margin: 5px 0;
padding: 0;
margin: 5px 0;
padding: 0;
}
#block-ebsco-ebsco-facets dl dt {
font-size: 115%;
padding: 5px;
background-color: #eeeeee;
font-size: 115%;
padding: 5px;
background-color: #eeeeee;
}
#block-ebsco-ebsco-facets dd {
font-weight: normal !important;
margin: 0;
padding: 5px !important;
border-bottom: 1px solid #dddddd;
font-weight: normal !important;
margin: 0;
padding: 5px !important;
border-bottom: 1px solid #dddddd;
}
#block-ebsco-ebsco-facets dd.submit input {
margin: 0;
margin: 0;
}
#block-ebsco-ebsco-facets dl dd:last-child {
border-bottom: none;
border-bottom: none;
}
#block-ebsco-ebsco-facets dd label {
font-weight: normal;
font-family: Arial;
padding: 0 3px;
font-weight: normal;
font-family: Arial;
padding: 0 3px;
}
#block-ebsco-ebsco-facets dd label {
display: inline;
display: inline;
}
#block-ebsco-ebsco-facets dl.expandable:hover {
cursor: pointer;
cursor: pointer;
}
#block-ebsco-ebsco-facets dl.expandable:hover dt span {
color: #444444;
color: #444444;
}
#block-ebsco-ebsco-facets .narrow-list.filters {
background-color: orange;
background-color: orange;
}
#block-ebsco-ebsco-facets .narrow-list.filters a {
color: white;
color: white;
}
@ -178,85 +178,85 @@
/** Detailed view ***/
.ebsco-record .toolbar {
border-bottom: 1px solid #EEEEEE;
margin-bottom: 1em;
min-height: 2em;
padding-left: 1em;
border-bottom: 1px solid #eeeeee;
margin-bottom: 1em;
min-height: 2em;
padding-left: 1em;
}
.ebsco-record.push-5 {
margin: 0;
margin: 0;
}
.ebsco-record .span-13 {
min-width: 540px;
max-width: 690px;
width: auto;
float: left;
min-width: 540px;
max-width: 690px;
width: auto;
float: left;
}
.ebsco-record .span-13 table {
margin-top: 0;
margin-top: 0;
}
.ebsco-record .span-13 table tr td {
word-break: break-all;
word-break: break-all;
}
.ebsco-record .span-4 {
max-width: 150px;
min-width: 80px;
width: auto;
margin: 0 0 0 10px;
text-align: center;
float: left;
max-width: 150px;
min-width: 80px;
width: auto;
margin: 0 0 0 10px;
text-align: center;
float: left;
}
.ebsco-record .external-links {
border: 1px solid #eeeeee;
list-style-type: none;
margin: 10px 0;
padding: 0;
border: 1px solid #eeeeee;
list-style-type: none;
margin: 10px 0;
padding: 0;
}
.ebsco-record .external-links li {
display: inline-block;
padding-left: 0;
padding-right: 10px;
margin-left: 10px;
border-right: 1px solid #CCCCCC;
line-height: 32px;
margin: 5px;
display: inline-block;
padding-left: 0;
padding-right: 10px;
margin-left: 10px;
border-right: 1px solid #cccccc;
line-height: 32px;
margin: 5px;
}
.ebsco-record .external-links li:last-child {
border-right: 0 none;
border-right: 0 none;
}
.external-link img {
vertical-align: middle;
padding-right: 5px;
vertical-align: middle;
padding-right: 5px;
}
.top-login-message {
margin-top:10px;
width: 100%;
text-align: center;
margin-top: 10px;
width: 100%;
text-align: center;
}
.ebsco-record .record {
width: 100%;
padding: 0;
width: 100%;
padding: 0;
}
.ebsco-record .book-jacket {
max-width: 150px;
max-width: 150px;
}
.ebsco-record .html {
background-color: white;
padding:10px 0;
border: 0;
background-color: white;
padding: 10px 0;
border: 0;
}
@ -264,281 +264,274 @@
#ebsco-basic-search-form .form-item-lookfor,
#ebsco-basic-search-form .form-item-type {
display: inline !important;
display: inline !important;
}
#ebsco-basic-search-form #edit-links {
display: inline;
margin: 0;
padding: 0;
border: none 0;
position: static;
display: inline;
margin: 0;
padding: 0;
border: none 0;
position: static;
}
#ebsco-basic-search-form #edit-offscreen {
display: none;
display: none;
}
#ebsco-basic-search-form .form-item-remember label {
font-weight: bold;
font-weight: bold;
}
#ebsco-sort-form {
margin : 10px 0;
margin: 10px 0;
}
#ebsco-sort-form > div {
border-bottom: 1px solid #CCCCCC;
border-bottom: 1px solid #cccccc;
}
#ebsco-sort-form label,
#ebsco-sort-form .form-item {
display: inline-block !important;
display: inline-block !important;
}
#ebsco-sort-form .form-item:first-child {
float: right;
float: right;
}
#ebsco-sort-form .form-item:last-child {
float: left;
float: left;
}
/** Advanced search form ***/
.ebsco-advanced ._advanced-row {
border: 0 none;
padding: 0;
margin: 10px;
top: 5px;
border: 0 none;
padding: 0;
margin: 10px;
top: 5px;
}
.ebsco-advanced #edit-rows {
margin-bottom: 20px;
margin-bottom: 20px;
}
.ebsco-advanced ._advanced-row .fieldset-wrapper {
margin: 0 !important;
padding: 0;
margin: 0 !important;
padding: 0;
}
.ebsco-advanced .form-item-group0-lookfor label {
display: inline-block;
text-align: right;
width: 100px;
display: inline-block;
text-align: right;
width: 100px;
}
.ebsco-advanced .form-type-radio label {
display: inline-block;
text-align: left;
width: 90%;
display: inline-block;
text-align: left;
width: 90%;
}
.ebsco-advanced #edit-add-row {
border: 0 none;
padding: 0;
margin: 10px;
top: 5px;
border: 0 none;
padding: 0;
margin: 10px;
top: 5px;
}
.ebsco-advanced #edit-add-row .fieldset-wrapper {
margin-top: 5px;
margin-top: 5px;
}
.ebsco-advanced #edit-links {
margin-bottom: 20px;
text-align: center;
margin-bottom: 20px;
text-align: center;
}
.ebsco-advanced #edit-links .fieldset-wrapper {
margin-top: 10px;
margin-top: 10px;
}
.ebsco-advanced #edit-limiters {
width: 99%;
width: 99%;
}
.ebsco-advanced #edit-modes {
width: 49%;
float: left;
width: 49%;
float: left;
}
.ebsco-advanced #edit-modes {
width: 49%;
float: left;
width: 49%;
float: left;
}
.ebsco-advanced #edit-expanders {
width: 49%;
float: right;
width: 49%;
float: right;
}
.ebsco-advanced #edit-limiters label {
font-weight: normal;
font-weight: normal;
}
.ebsco-advanced #edit-limiters .form-type-select label {
display: block;
display: block;
}
.ebsco-advanced #edit-limiters hr {
margin: 15px 0;
height: 1px;
background-color: #CCCCCC;
color: #CCCCCC;
border: 0 none;
margin: 15px 0;
height: 1px;
background-color: #cccccc;
color: #cccccc;
border: 0 none;
}
.dateSlider {
width: 150px;
display: inline-block !important;
margin: 0 10px;
width: 150px;
display: inline-block !important;
margin: 0 10px;
}
/** Icons ***/
.icon {
background: url("../images/sprites_32.png") no-repeat top left;
height: 32px;
line-height: 32px;
display: inline-block;
padding: 0 0 0 36px !important;
background: url("../images/sprites_32.png") no-repeat top left;
height: 32px;
line-height: 32px;
display: inline-block;
padding: 0 0 0 36px !important;
}
.icon.ebook {
background-position: 0 0;
background-position: 0 0;
}
.icon.html {
background-position: 0 -42px;
background-position: 0 -42px;
}
.icon.pdf {
background-position: 0 -84px;
background-position: 0 -84px;
}
.icon13 {
background: url("../images/sprites_32.png") no-repeat top left;
padding-left: 18px !important;
width: 13px;
height: 13px;
background: url("../images/sprites_32.png") no-repeat top left;
padding-left: 18px !important;
width: 13px;
height: 13px;
}
.icon13.collapsed {
background-position: 0 -126px;
background-position: 0 -126px;
}
.icon13.expanded {
background-position: 0 -149px;
background-position: 0 -149px;
}
.icon16 {
background: url("../images/sprites_32.png") no-repeat top left;
padding-left: 21px !important;
width: 16px;
height: 16px;
display: inline-block;
background: url("../images/sprites_32.png") no-repeat top left;
padding-left: 21px !important;
width: 16px;
height: 16px;
display: inline-block;
}
.icon16.tick {
background-position: 0 -171px;
background-position: 0 -171px;
}
/* RS, EMP carousel */
#quote-carousel
{
padding: 0 10px 30px 10px;
margin-top: 30px;
}
/* Control buttons */
#quote-carousel .carousel-control
{
background: none;
color: #222;
font-size: 2.3em;
text-shadow: none;
margin-top: 30px;
}
/* Previous button */
#quote-carousel .carousel-control.left
{
left: -12px;
}
/* Next button */
#quote-carousel .carousel-control.right
{
right: -12px !important;
}
/* Changes the position of the indicators */
#quote-carousel .carousel-indicators
{
right: 50%;
top: auto;
bottom: 0px;
margin-right: -19px;
}
/* Changes the color of the indicators */
#quote-carousel .carousel-indicators li
{
background: #c0c0c0;
}
#quote-carousel .carousel-indicators .active
{
background: #333333;
}
#quote-carousel img
{
width: 250px;
height: 100px
}
/* End carousel */
.item blockquote {
border-left: none;
margin: 0;
}
.item blockquote img {
margin-bottom: 10px;
}
.item blockquote p:before {
content: "\f10d";
font-family: 'Fontawesome';
float: left;
margin-right: 10px;
}
#relatedInformation img { padding-right :10px;}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#quote-carousel {
padding: 0 10px 30px 10px;
margin-top: 30px;
}
/* Control buttons */
#quote-carousel .carousel-control {
background: none;
color: #222;
font-size: 2.3em;
text-shadow: none;
margin-top: 30px;
}
/* Previous button */
#quote-carousel .carousel-control.left {
left: -12px;
}
/* Next button */
#quote-carousel .carousel-control.right {
right: -12px !important;
}
/* Changes the position of the indicators */
#quote-carousel .carousel-indicators {
right: 50%;
top: auto;
bottom: 0px;
margin-right: -19px;
}
/* Changes the color of the indicators */
#quote-carousel .carousel-indicators li {
background: #c0c0c0;
}
#quote-carousel .carousel-indicators .active {
background: #333333;
}
#quote-carousel img {
width: 250px;
height: 100px
}
/* End carousel */
.item blockquote {
border-left: none;
margin: 0;
}
.item blockquote img {
margin-bottom: 10px;
}
.item blockquote p:before {
content: "\f10d";
font-family: 'Fontawesome';
float: left;
margin-right: 10px;
}
#relatedInformation img {
padding-right: 10px;
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.carousel-control .glyphicon-chevron-right {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
}
.carousel-control.left span,
.carousel-control.right span {
background-color: #000;
}
.carousel-control.left span, .carousel-control.right span {
background-color: #000;
}
h3.relatedTitle a{
font-size:24px;
}
h3.relatedTitle a {
font-size: 24px;
}
/* */
/* */

2
ebsco/ebsco.info

@ -5,4 +5,4 @@ core = 7.x
configure = admin/config/search/ebsco
stylesheets[screen][] = css/ebsco.css
scripts[] = js/ebsco.js
scripts[] = js/ebsco.js

1644
ebsco/ebsco.module

File diff suppressed because it is too large Load Diff

18
ebsco/js/ebsco.js

@ -1,6 +1,6 @@
/*
* The EBSCO module javascript
*
/**
* @file
* The EBSCO module javascript.
*
* Copyright [2017] [EBSCO Information Services]
*
@ -9,17 +9,16 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
*/
(function ($) {
$(document).ready(function () {
//
var updatePublishDateSlider = function () {
var from = parseInt($('#DT1').val());
var min = 1000;
@ -38,10 +37,9 @@
});
};
/*
/**
* Self executing function
**/
*/
var onLoad = function () {
// EBSCO/Search : Expand limiters
$('._more_limiters').live('click', function (event) {
@ -165,7 +163,7 @@
// Retain search filters checkbox functionality
$('#edit-remember').live('click', function (event) {
$("#ebsco-basic-search-form :input[type='checkbox'][name^='filter[']").attr('checked', $(this).attr('checked'));
});
});
// Advanced Search : handle 'Date Published from' limiter
// Create the UI slider (if slider function is defined)

1249
ebsco/lib/EBSCOAPI.php

File diff suppressed because it is too large Load Diff

933
ebsco/lib/EBSCOConnector.php

@ -1,9 +1,10 @@
<?php
/**
* EBSCOException class
* Used when EBSCO API calls return error messages
*
* @file
* The EBSCO Connector and Exception classes.
*
* Used when EBSCO API calls return error messages.
*
* Copyright [2017] [EBSCO Information Services]
*
@ -12,246 +13,257 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class EBSCOException extends Exception
{
const CRITICAL_ERROR = 1;
// Make message argument mandatory
public function __construct($message, $code = self::CRITICAL_ERROR, Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
}
/**
* EBSCOException class.
*/
class EBSCOException extends Exception {
const CRITICAL_ERROR = 1;
/**
* Make message argument mandatory.
*/
public function __construct($message, $code = self::CRITICAL_ERROR, Exception $previous = NULL) {
parent::__construct($message, $code, $previous);
}
class EBSCOConnector
{
}
/**
* Error codes defined by EDS API
* EBSCOConnector class.
*/
class EBSCOConnector {
/**
* Error codes defined by EDS API.
*/
const EDS_UNKNOWN_PARAMETER = 100;
const EDS_INCORRECT_PARAMETER_FORMAT = 101;
const EDS_INVALID_PARAMETER_INDEX = 102;
const EDS_MISSING_PARAMETER = 103;
const EDS_AUTH_TOKEN_INVALID = 104;
const EDS_INCORRECT_ARGUMENTS_NUMBER = 105;
const EDS_UNKNOWN_ERROR = 106;
const EDS_AUTH_TOKEN_MISSING = 107;
const EDS_SESSION_TOKEN_MISSING = 108;
const EDS_SESSION_TOKEN_INVALID = 109;
const EDS_INVALID_RECORD_FORMAT = 110;
const EDS_UNKNOWN_ACTION = 111;
const EDS_INVALID_ARGUMENT_VALUE = 112;
const EDS_CREATE_SESSION_ERROR = 113;
const EDS_REQUIRED_DATA_MISSING = 114;
const EDS_TRANSACTION_LOGGING_ERROR = 115;
const EDS_DUPLICATE_PARAMETER = 116;
const EDS_UNABLE_TO_AUTHENTICATE = 117;
const EDS_SEARCH_ERROR = 118;
const EDS_INVALID_PAGE_SIZE = 119;
const EDS_SESSION_SAVE_ERROR = 120;
const EDS_SESSION_ENDING_ERROR = 121;
const EDS_CACHING_RESULTSET_ERROR = 122;
const EDS_INVALID_EXPANDER_ERROR = 123;
const EDS_INVALID_SEARCH_MODE_ERROR = 124;
const EDS_INVALID_LIMITER_ERROR = 125;
const EDS_INVALID_LIMITER_VALUE_ERROR = 126;
const EDS_UNSUPPORTED_PROFILE_ERROR = 127;
const EDS_PROFILE_NOT_SUPPORTED_ERROR = 128;
const EDS_INVALID_CONTENT_PROVIDER_ERROR = 129;
const EDS_INVALID_SOURCE_TYPE_ERROR = 130;
const EDS_XSLT_ERROR = 131;
const EDS_RECORD_NOT_FOUND_ERROR = 132;
const EDS_SIMULTANEOUS_USER_LIMIT_ERROR = 133;
const EDS_NO_GUEST_ACCESS_ERROR = 134;
const EDS_DBID_NOT_IN_PROFILE_ERROR = 135;
const EDS_INVALID_SEARCH_VIEW_ERROR = 136;
const EDS_RETRIEVING_FULL_TEXT_ERROR = 137;
/**
const EDS_UNKNOWN_PARAMETER = 100;
const EDS_INCORRECT_PARAMETER_FORMAT = 101;
const EDS_INVALID_PARAMETER_INDEX = 102;
const EDS_MISSING_PARAMETER = 103;
const EDS_AUTH_TOKEN_INVALID = 104;
const EDS_INCORRECT_ARGUMENTS_NUMBER = 105;
const EDS_UNKNOWN_ERROR = 106;
const EDS_AUTH_TOKEN_MISSING = 107;
const EDS_SESSION_TOKEN_MISSING = 108;
const EDS_SESSION_TOKEN_INVALID = 109;
const EDS_INVALID_RECORD_FORMAT = 110;
const EDS_UNKNOWN_ACTION = 111;
const EDS_INVALID_ARGUMENT_VALUE = 112;
const EDS_CREATE_SESSION_ERROR = 113;
const EDS_REQUIRED_DATA_MISSING = 114;
const EDS_TRANSACTION_LOGGING_ERROR = 115;
const EDS_DUPLICATE_PARAMETER = 116;
const EDS_UNABLE_TO_AUTHENTICATE = 117;
const EDS_SEARCH_ERROR = 118;
const EDS_INVALID_PAGE_SIZE = 119;
const EDS_SESSION_SAVE_ERROR = 120;
const EDS_SESSION_ENDING_ERROR = 121;
const EDS_CACHING_RESULTSET_ERROR = 122;
const EDS_INVALID_EXPANDER_ERROR = 123;
const EDS_INVALID_SEARCH_MODE_ERROR = 124;
const EDS_INVALID_LIMITER_ERROR = 125;
const EDS_INVALID_LIMITER_VALUE_ERROR = 126;
const EDS_UNSUPPORTED_PROFILE_ERROR = 127;
const EDS_PROFILE_NOT_SUPPORTED_ERROR = 128;
const EDS_INVALID_CONTENT_PROVIDER_ERROR = 129;
const EDS_INVALID_SOURCE_TYPE_ERROR = 130;
const EDS_XSLT_ERROR = 131;
const EDS_RECORD_NOT_FOUND_ERROR = 132;
const EDS_SIMULTANEOUS_USER_LIMIT_ERROR = 133;
const EDS_NO_GUEST_ACCESS_ERROR = 134;
const EDS_DBID_NOT_IN_PROFILE_ERROR = 135;
const EDS_INVALID_SEARCH_VIEW_ERROR = 136;
const EDS_RETRIEVING_FULL_TEXT_ERROR = 137;
/**
* HTTP status codes constants
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
*
* @global integer HTTP_OK The request has succeeded
* @global integer HTTP_NOT_FOUND The server has not found anything matching the Request-URI
*/
const HTTP_OK = 200;
const HTTP_BAD_REQUEST = 400;
const HTTP_NOT_FOUND = 404;
const HTTP_INTERNAL_SERVER_ERROR = 500;
/**
* The HTTP_Request object used for API transactions
* @global object HTTP_Request
*/
private $client;
/**
* The URL of the EBSCO API server
* @global string
*/
private static $end_point = 'http://eds-api.ebscohost.com/EDSAPI/rest';
/**
* The URL of the EBSCO API server
* @global string
*/
private static $authentication_end_point = 'https://eds-api.ebscohost.com/AuthService/rest';
/**
* The password used for API transactions
* @global string
*/
private $password;
/**
* The user id used for API transactions
* @global string
*/
private $userId;
/**
* The profile ID used for API transactions
* @global string
*/
private $profileId;
/**
* The interface ID used for API transactions
* @global string
*/
private $interfaceId;
/**
* The customer ID used for API transactions
* @global string
*/
private $orgId;
/**
* The isGuest used for API transactions
* @global string 'y' or 'n'
*/
private $isGuest;
/**
* Contains the list of ip addresses
* @global string
*/
private $local_ip_address;
/*
* You can log HTTP_Request requests using this option
* @global bool logAPIRequests
*/
private $logAPIRequests;
/**
* The logger object
* @global object Logger
*/
private $logger;
/**
* Constructor
*
* Sets up the EBSCO API settings
*
* @param none
*
* @access public
*/
public function __construct($config)
{
$this->password = $config['password'];
$this->userId = $config['user'];
$this->interfaceId = $config['interface'];
$this->profileId = $config['profile'];
$this->orgId = $config['organization'];
$this->local_ip_address = $config['local_ip_address'];
$this->isGuest = (user_is_logged_in() || $this->isGuestIPAddress($_SERVER["REMOTE_ADDR"]))? 'n' : 'y';
$this->logAPIRequests = ($config['log'] == 1);
if ($this->logAPIRequests) {
$writer = new Zend_Log_Writer_Stream('php://output');
$this->logger = new Zend_Log($writer);
}
const HTTP_OK = 200;
const HTTP_BAD_REQUEST = 400;
const HTTP_NOT_FOUND = 404;
const HTTP_INTERNAL_SERVER_ERROR = 500;
/**
* The HTTP_Request object used for API transactions.
*
* @global object HTTP_Request
*/
private $client;
/**
* The URL of the EBSCO API server.
*
* @global string
*/
private static $end_point = 'http://eds-api.ebscohost.com/EDSAPI/rest';
/**
* The URL of the EBSCO API server.
*
* @global string
*/
private static $authentication_end_point = 'https://eds-api.ebscohost.com/AuthService/rest';
/**
* The password used for API transactions.
*
* @global string
*/
private $password;
/**
* The user id used for API transactions.
*
* @global string
*/
private $userId;
/**
* The profile ID used for API transactions.
*
* @global string
*/
private $profileId;
/**
* The interface ID used for API transactions.
*
* @global string
*/
private $interfaceId;
/**
* The customer ID used for API transactions.
*
* @global string
*/
private $orgId;
/**
* The isGuest used for API transactions.
*
* @global string 'y' or 'n'
*/
private $isGuest;
/**
* Contains the list of ip addresses.
*
* @global string
*/
private $local_ip_address;
/**
* You can log HTTP_Request requests using this option.
*
* @global bool logAPIRequests
*/
private $logAPIRequests;
/**
* The logger object.
*
* @global object Logger
*/
private $logger;
/**
* Constructor.
*
* Sets up the EBSCO API settings.
*
* @param none
*
* @access public
*/
public function __construct($config) {
$this->password = $config['password'];
$this->userId = $config['user'];
$this->interfaceId = $config['interface'];
$this->profileId = $config['profile'];
$this->orgId = $config['organization'];
$this->local_ip_address = $config['local_ip_address'];
$this->isGuest = (user_is_logged_in() || $this->isGuestIPAddress($_SERVER["REMOTE_ADDR"])) ? 'n' : 'y';
$this->logAPIRequests = ($config['log'] == 1);
if ($this->logAPIRequests) {
$writer = new Zend_Log_Writer_Stream('php://output');
$this->logger = new Zend_Log($writer);
}
/**
* Detects if the user is authorized based on the IP address
*
* @return string
*/
public function isGuestIPAddress($ipUser)
{
$s= $this->local_ip_address;
if (trim($s)=="") {
return false;
}
//break records
$m=explode(",",$s);
foreach($m as $ip) {
if ( strcmp(substr($ipUser,0,strlen(trim($ip))),trim($ip))==0) {
// inside of ip address range of customer
return true;
}
}
return false;
}
/**
* Detects if the user is authorized based on the IP address.
*
* @return string
*/
public function isGuestIPAddress($ipUser) {
$s = $this->local_ip_address;
if (trim($s) == "") {
return FALSE;
}
/**
* Public getter for private isGuest
*
* @param none
*
* @return string isGuest
* @access public
*/
public function isGuest()
{
return $this->isGuest;
// Break records.
$m = explode(",", $s);
foreach ($m as $ip) {
if (strcmp(substr($ipUser, 0, strlen(trim($ip))), trim($ip)) == 0) {
// Inside of ip address range of customer.
return TRUE;
}
}
/**
* Request the authentication token
*
* @param none
*
* @return object SimpleXml or PEAR_Error
* @access public
*/
public function requestAuthenticationToken()
{
$url = self::$authentication_end_point . '/UIDAuth';
// Add the body of the request
$params =<<<BODY
return FALSE;
}
/**
* Public getter for private isGuest .
*
* @param none
*
* @return string isGuest
*
* @access public
*/
public function isGuest() {
return $this->isGuest;
}
/**
* Request the authentication token.
*
* @param none
*
* @return object SimpleXml or PEAR_Error
*
* @access public
*/
public function requestAuthenticationToken() {
$url = self::$authentication_end_point . '/UIDAuth';
// Add the body of the request.
$params = <<<BODY
<UIDAuthRequestMessage xmlns="http://www.ebscohost.com/services/public/AuthService/Response/2012/06/01">
<UserId>{$this->userId}</UserId>
<Password>{$this->password}</Password>
@ -259,246 +271,251 @@ class EBSCOConnector
</UIDAuthRequestMessage>
BODY;
$response = $this->request($url, $params, array(), 'POST');
return $response;
}
/**
* Request the session token
*
* @param array $headers Authentication token
*
* @return object SimpleXml or PEAR_Error
* @access public
*/
public function requestSessionToken($headers)
{
$url = self::$end_point . '/CreateSession';
// Add the HTTP query params
$params = array(
'profile' => $this->profileId,
'org' => $this->orgId,
'guest' => $this->isGuest
);
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Request the search records
*
* @param array $params Search specific parameters
* @param array $headers Authentication and session tokens
*
* @return object SimpleXml or PEAR_Error
* @access public
*/
public function requestSearch($params, $headers)
{
$url = self::$end_point . '/Search';
$response = $this->request($url, $params, $headers);
return $response;
$response = $this->request($url, $params, array(), 'POST');
return $response;
}
/**
* Request the session token.
*
* @param array $headers
* Authentication token.
*
* @return object SimpleXml or PEAR_Error
*
* @access public
*/
public function requestSessionToken($headers) {
$url = self::$end_point . '/CreateSession';
// Add the HTTP query params.
$params = array(
'profile' => $this->profileId,
'org' => $this->orgId,
'guest' => $this->isGuest,
);
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Request the search records.
*
* @param array $params
* Search specific parameters.
* @param array $headers
* Authentication and session tokens.
*
* @return object SimpleXml or PEAR_Error
*
* @access public
*/
public function requestSearch($params, $headers) {
$url = self::$end_point . '/Search';
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Request a specific record.
*
* @param array $params
* Retrieve specific parameters.
* @param array $headers
* Authentication and session tokens.
*
* @return object SimpleXml or PEAR_Error
*
* @access public
*/
public function requestRetrieve($params, $headers) {
$url = self::$end_point . '/Retrieve';
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Request the info data.
*
* @param null $params
* Not used.
* @param array $headers
* Authentication and session tokens.
*
* @return object SimpleXml or PEAR_Error
*
* @access public
*/
public function requestInfo($params, $headers) {
$url = self::$end_point . '/Info';
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Send an HTTP request and inspect the response.
*
* @param string $url
* The url of the HTTP request.
* @param array $params
* The parameters of the HTTP request.
* @param array $headers
* The headers of the HTTP request.
* @param array $body
* The body of the HTTP request.
* @param string $method
* The HTTP method, default is 'GET'.
*
* @return object SimpleXml or PEAR_Error
*
* @access protected
*/
protected function request($url, $params, $headers = array(), $method = 'GET') {
$xml = FALSE;
$return = FALSE;
$data = NULL;
if (!empty($params)) {
// Arrays of parameters are used only for GET requests.
if (is_array($params)) {
$query = http_build_query($params, '', '&');
$query = preg_replace('/\%5B\d+\%5D/', '', $query);
$url = $url . '?' . $query;
// String parameters are used only for POST requests.
}
else {
$data = $params;
$headers = array_merge(
array('content-type' => 'text/xml'),
$headers
);
}
}
/**
* Request a specific record
*
* @param array $params Retrieve specific parameters
* @param array $headers Authentication and session tokens
*
* @return object SimpleXml or PEAR_Error
* @access public
*/
public function requestRetrieve($params, $headers)
{
$url = self::$end_point . '/Retrieve';
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Request the info data
*
* @param null $params Not used
* @param array $headers Authentication and session tokens
*
* @return object SimpleXml or PEAR_Error
* @access public
*/
public function requestInfo($params, $headers)
{
$url = self::$end_point . '/Info';
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Send an HTTP request and inspect the response
*
* @param string $url The url of the HTTP request
* @param array $params The parameters of the HTTP request
* @param array $headers The headers of the HTTP request
* @param array $body The body of the HTTP request
* @param string $method The HTTP method, default is 'GET'
*
* @return object SimpleXml or PEAR_Error
* @access protected
*/
protected function request($url, $params, $headers = array(), $method = 'GET')
{
$xml = false;
$return = false;
$data = null;
if (!empty($params)) {
// Arrays of parameters are used only for GET requests
if (is_array($params)) {
$query = http_build_query($params, '', '&');
$query = preg_replace('/\%5B\d+\%5D/', '', $query);
$url = $url . '?' . $query;
// String parameters are used only for POST requests
} else {
$data = $params;
$headers = array_merge(
array('content-type' => 'text/xml'),
$headers
);
}
// Add compression in case its not there.
$headers = array_merge(
array('Accept-Encoding' => 'gzip,deflate'),
$headers
);
$options = array(
'headers' => $headers,
'method' => $method,
'data' => $data,
);
// Send the request.
try {
$response = drupal_http_request($url, $options);
// print_r($url);
// print_r($response);
$code = $response->code;
if (isset($response->headers['content-encoding'])) {
if ($response->headers['content-encoding'] == 'gzip') {
$response->data = gzinflate(substr($response->data, 10));
}
//add compression in case its not there
$headers = array_merge(
array('Accept-Encoding' => 'gzip,deflate'),
$headers
);
$options = array(
'headers' => $headers,
'method' => $method,
'data' => $data
);
// Send the request
try {
$response = drupal_http_request($url, $options);
//print_r($url);
//print_r($response);
$code = $response->code;
if (isset($response->headers['content-encoding'])) {
if ($response->headers['content-encoding'] == 'gzip') {
$response->data = gzinflate(substr($response->data, 10));
}
elseif ($response->headers['content-encoding'] == 'deflate') {
$response->data = gzinflate($response->data);
}
}
switch ($code) {
case self::HTTP_OK:
$xml_str = $response->data;
try {
// clean EMP namespace
$xml_str=str_replace(array("<a:","</a:"),array("<","</"),$xml_str);
$xml = simplexml_load_string($xml_str);
$return = $xml;
} catch(Exception $e) {
$return = new EBSCOException($xml);
}
break;
case self::HTTP_BAD_REQUEST:
$xml_str = $response->data;
try {
$xml = simplexml_load_string($xml_str);
// If the response is an API error
$isError = isset($xml->ErrorNumber) || isset($xml->ErrorCode);
if ($isError) {
$error = ''; $code = 0;
if (isset($xml->DetailedErrorDescription) && !empty($xml->DetailedErrorDescription)) {
$error = (string) $xml->DetailedErrorDescription;
} else if (isset($xml->ErrorDescription)) {
$error = (string) $xml->ErrorDescription;
} else if (isset($xml->Reason)) {
$error = (string) $xml->Reason;
}
if (isset($xml->ErrorNumber)) {
$code = (integer) $xml->ErrorNumber;
} else if (isset($xml->ErrorCode)) {
$code = (integer) $xml->ErrorCode;
}
$return = new EBSCOException($error, $code);
} else {
$return = new EBSCOException("HTTP {$code} : The request could not be understood
by the server due to malformed syntax. Modify your search before retrying.");
}
} catch (Exception $e) {
$return = new EBSCOException($xml);
}
break;
case self::HTTP_NOT_FOUND:
$return = new EBSCOException("HTTP {$code} : The resource you are looking for might
have been removed, had its name changed, or is temporarily unavailable.");
break;
case self::HTTP_INTERNAL_SERVER_ERROR:
$return = new EBSCOException("HTTP {$code} : The server encountered an unexpected condition
which prevented it from fulfilling the request.");
break;
default:
$return = new EBSCOException("HTTP {$code} : Unexpected HTTP error.");
break;
}
} catch (Exception $e) {
$message = $this->toString($client); // or $this->toString($response)
$this->logger->log($message, Zend_Log::ERR);
$return = new EBSCOException($response);
elseif ($response->headers['content-encoding'] == 'deflate') {
$response->data = gzinflate($response->data);
}
// Log any error
/*if ($this->logAPIRequests) {
// $client = both the HTTP request and response
// $response = only the HTTP response
$message = $this->toString($client); // or $this->toString($response)
$this->logger->log($message, Zend_Log::ERR);
}*/
return $return;
}
switch ($code) {
case self::HTTP_OK:
$xml_str = $response->data;
try {
// Clean EMP namespace.
$xml_str = str_replace(array("<a:", "</a:"), array("<", "</"), $xml_str);
$xml = simplexml_load_string($xml_str);
$return = $xml;
}
catch (Exception $e) {
$return = new EBSCOException($xml);
}
break;
case self::HTTP_BAD_REQUEST:
$xml_str = $response->data;
try {
$xml = simplexml_load_string($xml_str);
// If the response is an API error.
$isError = isset($xml->ErrorNumber) || isset($xml->ErrorCode);
if ($isError) {
$error = ''; $code = 0;
if (isset($xml->DetailedErrorDescription) && !empty($xml->DetailedErrorDescription)) {
$error = (string) $xml->DetailedErrorDescription;
}
elseif (isset($xml->ErrorDescription)) {
$error = (string) $xml->ErrorDescription;
}
elseif (isset($xml->Reason)) {
$error = (string) $xml->Reason;
}
if (isset($xml->ErrorNumber)) {
$code = (integer) $xml->ErrorNumber;
}
elseif (isset($xml->ErrorCode)) {
$code = (integer) $xml->ErrorCode;
}
$return = new EBSCOException($error, $code);
}
else {
$return = new EBSCOException("HTTP {$code} : The request could not be understood by the server due to malformed syntax. Modify your search before retrying.");
}
}
catch (Exception $e) {
$return = new EBSCOException($xml);
}
break;
case self::HTTP_NOT_FOUND:
$return = new EBSCOException("HTTP {$code} : The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.");
break;
case self::HTTP_INTERNAL_SERVER_ERROR:
$return = new EBSCOException("HTTP {$code} : The server encountered an unexpected condition which prevented it from fulfilling the request.");
break;
default:
$return = new EBSCOException("HTTP {$code} : Unexpected HTTP error.");
break;
}
}
/*
* Capture the output of print_r into a string
*
* @param object Any object
* @access private
*/
private function toString($object)
{
ob_start();
print_r($object);
return ob_get_clean();
catch (Exception $e) {
// Or $this->toString($response)
$message = $this->toString($client);
$this->logger->log($message, Zend_Log::ERR);
$return = new EBSCOException($response);
}
// Log any error
/*if ($this->logAPIRequests) {
// $client = both the HTTP request and response
// $response = only the HTTP response
$message = $this->toString($client); // or $this->toString($response)
$this->logger->log($message, Zend_Log::ERR);
}*/
return $return;
}
/**
* Capture the output of print_r into a string.
*
* @param object Any object
*
* @access private
*/
private function toString($object) {
ob_start();
print_r($object);
return ob_get_clean();
}
}
?>

1669
ebsco/lib/EBSCODocument.php

File diff suppressed because it is too large Load Diff

738
ebsco/lib/EBSCORecord.php

@ -1,10 +1,10 @@
<?php
/**
* The EBSCO record object
* @file
* The EBSCO record object.
*
* PHP version 5
*
*
*
* Copyright [2017] [EBSCO Information Services]
*
@ -13,7 +13,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -21,393 +21,379 @@
* limitations under the License.
*/
class EBSCORecord
{
/**
* The array of data
* @global array
*/
private $data = array();
/**
* The result id (the EBSCO counter) of the record
* @global integer
*/
public $result_id = null;
/**
* The id of the record
* @global integer
*/
public $record_id = null;
/**
* The summary of the record.
* @global string
*/
public $summary = null;
/**
* The authors of the record.
* @global string
*/
public $authors = null;
/**
* The subjects of the record.
* @global string
*/
public $subjects = null;
/**
* The custom links provided for the record.
* @global array
*/
public $custom_links = array();
/**
* The database label of the record.
* @global string
*/
public $db_label = null;
/**
* The full-text availability of the record.
* @global boolean
*/
public $full_text_availability = null;
/**
* The full text of the record.
* @global string
*/
public $full_text = null;
/**
* The PDF availability of the record.
* @global boolean
*/
public $pdf_availability = null;
/**
* The items of the record.
* @global array
*/
public $items = array();
/**
* The external link of the record.
* @global string
*/
public $p_link = null;
/**
* The external link to the PDF version of the record.
* @global string
*/
public $pdf_link = null;
/**
* The publication type link of the record.
* @global string
*/
public $publication_type = null;
/**
* The external thumbnails links of the record.
* @global string
*/
public $small_thumb_link = null;
public $medium_thumb_link = null;
/**
* The title of the record.
* @global string
*/
public $title = null;
/**
* The source of the record.
* @global string
*/
public $source = null;
/**
* The access level of the record.
* @global string
*/
public $access_level = null;
/**
* Constructor.
*
* @param array $data Raw data from the EBSCO search representing the record.
*/
public function __construct($data = array())
{
$this->data = $data;
$this->record_id = $this->record_id();
$this->result_id = $this->result_id();
$this->title = $this->title();
$this->summary = $this->summary();
$this->authors = $this->authors();
$this->subjects = $this->subjects();
$this->custom_links = $this->custom_links();
$this->db_label = $this->db_label();
$this->full_text_availability = $this->full_text_availability();
$this->full_text = $this->full_text();
$this->items = $this->items();
$this->p_link = $this->p_link();
$this->publication_type = $this->publication_type();
$this->pdf_availability = $this->pdf_availability();
$this->pdf_link = $this->pdf_link();
$this->small_thumb_link = $this->thumb_link();
$this->medium_thumb_link = $this->thumb_link('medium');
$this->source = $this->source();
$this->access_level = $this->access_level();
}
/********************************************************
*
* Getters
*
********************************************************/
/**
* Get the summary of the record.
*
* @return string
*/
public function access_level()
{
return isset($this->data['AccessLevel']) ?
/**
* EBSCORecord class.
*/
class EBSCORecord {
/**
* The array of data.
*
* @global array
*/
private $data = array();
/**
* The result id (the EBSCO counter) of the record.
*
* @global integer
*/
public $result_id = NULL;
/**
* The id of the record.
*
* @global integer
*/
public $record_id = NULL;
/**
* The summary of the record.
*
* @global string
*/
public $summary = NULL;
/**
* The authors of the record.
*
* @global string
*/
public $authors = NULL;
/**
* The subjects of the record.
*
* @global string
*/
public $subjects = NULL;
/**
* The custom links provided for the record.
*
* @global array
*/
public $custom_links = array();
/**
* The database label of the record.
*
* @global string
*/
public $db_label = NULL;
/**
* The full-text availability of the record.
*
* @global boolean
*/
public $full_text_availability = NULL;
/**
* The full text of the record.
*
* @global string
*/
public $full_text = NULL;
/**
* The PDF availability of the record.
*
* @global boolean
*/
public $pdf_availability = NULL;
/**
* The items of the record.
*
* @global array
*/
public $items = array();
/**
* The external link of the record.
*
* @global string
*/
public $p_link = NULL;
/**
* The external link to the PDF version of the record.
*
* @global string
*/
public $pdf_link = NULL;
/**
* The publication type link of the record.
*
* @global string
*/
public $publication_type = NULL;
/**
* The external thumbnails links of the record.
*
* @global string
*/
public $small_thumb_link = NULL;
public $medium_thumb_link = NULL;
/**
* The title of the record.
*
* @global string
*/
public $title = NULL;
/**
* The source of the record.
*
* @global string
*/
public $source = NULL;
/**
* The access level of the record.
*
* @global string
*/
public $access_level = NULL;
/**
* Constructor.
*
* @param array $data
* Raw data from the EBSCO search representing the record.
*/
public function __construct($data = array()) {
$this->data = $data;
$this->record_id = $this->record_id();
$this->result_id = $this->result_id();
$this->title = $this->title();
$this->summary = $this->summary();
$this->authors = $this->authors();
$this->subjects = $this->subjects();
$this->custom_links = $this->custom_links();
$this->db_label = $this->db_label();
$this->full_text_availability = $this->full_text_availability();
$this->full_text = $this->full_text();
$this->items = $this->items();
$this->p_link = $this->p_link();
$this->publication_type = $this->publication_type();
$this->pdf_availability = $this->pdf_availability();
$this->pdf_link = $this->pdf_link();
$this->small_thumb_link = $this->thumb_link();
$this->medium_thumb_link = $this->thumb_link('medium');
$this->source = $this->source();
$this->access_level = $this->access_level();
}
/********************************************************
*
* Getters
*
********************************************************/
/**
* Get the summary of the record.
*
* @return string
*/
public function access_level() {
return isset($this->data['AccessLevel']) ?
$this->data['AccessLevel'] : '';
}
/**
* Get the summary of the record.
*
* @return string
*/
public function summary()
{
return isset($this->data['Items']['Abstract']) ?
}
/**
* Get the summary of the record.
*
* @return string
*/
public function summary() {
return isset($this->data['Items']['Abstract']) ?
$this->data['Items']['Abstract']['Data'] : '';
}
/**
* Get the authors of the record.
*
* @return string
*/
public function authors()
{
return isset($this->data['Items']['Author']) ?
}
/**
* Get the authors of the record.
*
* @return string
*/
public function authors() {
return isset($this->data['Items']['Author']) ?
$this->data['Items']['Author']['Data'] : '';
}
/**
* Get the custom links of the record.
*
* @return array
*/
public function custom_links()
{
return isset($this->data['CustomLinks']) ?
}
/**
* Get the custom links of the record.
*
* @return array
*/
public function custom_links() {
return isset($this->data['CustomLinks']) ?
$this->data['CustomLinks'] : array();
}
/**
* Get the database label of the record.
*
* @return string
*/
public function db_label()
{
return isset($this->data['DbLabel']) ?
}
/**
* Get the database label of the record.
*
* @return string
*/
public function db_label() {
return isset($this->data['DbLabel']) ?
$this->data['DbLabel'] : '';
}
/**
* Get the full text availability of the record.
*
* @return boolean
*/
public function full_text()
{
return isset($this->data['FullText']) &&
}
/**
* Get the full text availability of the record.
*
* @return bool
*/
public function full_text() {
return isset($this->data['FullText']) &&
isset($this->data['FullText']['Value']) ? $this->data['FullText']['Value'] : '';
}
/**
* Get the full text availability of the record.
*
* @return boolean
*/
public function full_text_availability()
{
return isset($this->data['FullText']) &&
}
/**
* Get the full text availability of the record.
*
* @return bool
*/
public function full_text_availability() {
return isset($this->data['FullText']) &&
$this->data['FullText']['Availability'];
}
/**
* Get the items of the record.
*
* @return array
*/
public function items()
{
return isset($this->data['Items']) ? $this->data['Items'] : array();
}
/**
* Get the external url of the record.
*
* @return string
*/
public function p_link()
{
return isset($this->data['PLink']) ? $this->data['PLink'] : '';
}
/**
* Get the publication type of the record.
*
* @return string
*/
public function publication_type()
{
return isset($this->data['PubType']) ? $this->data['PubType'] : '';
}
/**
* Get the PDF availability of the record.
*
* @return boolean
*/
public function pdf_availability()
{
return isset($this->data['FullText']) &&
isset($this->data['FullText']['Links']) &&
isset($this->data['FullText']['Links']['pdflink']) &&
}
/**
* Get the items of the record.
*
* @return array
*/
public function items() {
return isset($this->data['Items']) ? $this->data['Items'] : array();
}
/**
* Get the external url of the record.
*
* @return string
*/
public function p_link() {
return isset($this->data['PLink']) ? $this->data['PLink'] : '';
}
/**
* Get the publication type of the record.
*
* @return string
*/
public function publication_type() {
return isset($this->data['PubType']) ? $this->data['PubType'] : '';
}
/**
* Get the PDF availability of the record.
*
* @return bool
*/
public function pdf_availability() {
return isset($this->data['FullText']) &&
isset($this->data['FullText']['Links']) &&
isset($this->data['FullText']['Links']['pdflink']) &&
$this->data['FullText']['Links']['pdflink'];
}
/**
* Get the PDF url of the record.
*
* @return string
*/
public function pdf_link()
{
return isset($this->data['FullText']) &&
isset($this->data['FullText']['Links']) &&
isset($this->data['FullText']['Links']['pdflink']) ?
}
/**
* Get the PDF url of the record.
*
* @return string
*/
public function pdf_link() {
return isset($this->data['FullText']) &&
isset($this->data['FullText']['Links']) &&
isset($this->data['FullText']['Links']['pdflink']) ?
$this->data['FullText']['Links']['pdflink'] :
'';
}
/**
* Get the result id of the record.
*
* @return integer
*/
public function result_id()
{
return isset($this->data['ResultId']) ?
}
/**
* Get the result id of the record.
*
* @return int
*/
public function result_id() {
return isset($this->data['ResultId']) ?
$this->data['ResultId'] : '';
}
/**
* Get the subject data of the record.
*
* @return string
*/
public function subjects()
{
return isset($this->data['Items']['Subject']) ?
}
/**
* Get the subject data of the record.
*
* @return string
*/
public function subjects() {
return isset($this->data['Items']['Subject']) ?
$this->data['Items']['Subject']['Data'] : '';
}
/**
* Return a URL to a thumbnail preview of the record, if available; false
* otherwise.
*
* @param string $size
* Size of thumbnail (small, medium or large -- small is
* default).
*
* @return string
*/
public function thumb_link($size = 'small') {
$imageInfo = isset($this->data['ImageInfo']) ? $this->data['ImageInfo'] : '';
if ($imageInfo && isset($imageInfo['thumb'])) {
switch ($size) {
case 'large':
case 'medium':
return $imageInfo['medium'];
break;
case 'small':
default:
return $imageInfo['thumb'];
break;
}
}
/**
* Return a URL to a thumbnail preview of the record, if available; false
* otherwise.
*
* @param string $size Size of thumbnail (small, medium or large -- small is
* default).
*
* @return string
*/
public function thumb_link($size = 'small')
{
$imageInfo = isset($this->data['ImageInfo']) ? $this->data['ImageInfo'] : '';
if ($imageInfo && isset($imageInfo['thumb'])) {
switch ($size) {
case 'large':
case 'medium':
return $imageInfo['medium'];
break;
case 'small':
default:
return $imageInfo['thumb'];
break;
}
}
return false;
}
/**
* Get the title of the record.
*
* @return string
*/
public function title()
{
return isset($this->data['Items']['Title']) ?
return FALSE;
}
/**
* Get the title of the record.
*
* @return string
*/
public function title() {
return isset($this->data['Items']['Title']) ?
$this->data['Items']['Title']['Data'] : '';
}
/**
* Get the source of the record.
*
* @return string
*/
public function source()
{
return isset($this->data['Items']['TitleSource']) ?
}
/**
* Get the source of the record.
*
* @return string
*/
public function source() {
return isset($this->data['Items']['TitleSource']) ?
$this->data['Items']['TitleSource']['Data'] : '';
}
/**
* Return the identifier of this record within the EBSCO databases
*
* @return string Unique identifier.
*/
public function record_id()
{
return isset($this->data['id']) ?
}
/**
* Return the identifier of this record within the EBSCO databases.
*
* @return string Unique identifier.
*/
public function record_id() {
return isset($this->data['id']) ?
$this->data['id'] : '';
}
}
}

1093
ebsco/lib/EBSCOResponse.php

File diff suppressed because it is too large Load Diff

826
ebsco/lib/sanitizer.class.php

@ -1,444 +1,444 @@
<?php // $Id$
<?php
// vim: expandtab sw=4 ts=4 sts=4:
# ***** BEGIN LICENSE BLOCK *****
# This file is part of HTML Sanitizer.
# Copyright (c) 2005-2011 Frederic Minne <zefredz@gmail.com>.
# All rights reserved.
#
# HTML Sanitizer is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# HTML Sanitizer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with HTML Sanitizer; if not, see <http://www.gnu.org/licenses/>.
#
# ***** END LICENSE BLOCK *****
/**
* @file
* $Id$.
*/
// vim: expandtab sw=4 ts=4 sts=4:
// ***** BEGIN LICENSE BLOCK *****
// This file is part of HTML Sanitizer.
// Copyright (c) 2005-2011 Frederic Minne <zefredz@gmail.com>.
// All rights reserved.
//
// HTML Sanitizer is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// HTML Sanitizer is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with HTML Sanitizer; if not, see <http://www.gnu.org/licenses/>.
//
// ***** END LICENSE BLOCK *****.
/**
* Sanitize HTML contents :
* Remove dangerous tags and attributes that can lead to security issues like
* XSS or HTTP response splitting
* XSS or HTTP response splitting.
*
* @author Frederic Minne <zefredz@gmail.com>
* @author Frederic Minne <zefredz@gmail.com>
* @copyright Copyright &copy; 2005-2011, Frederic Minne
* @license http://www.gnu.org/licenses/lgpl.txt GNU Lesser General Public License version 3 or later
* @version 1.1
*/
class HTML_Sanitizer
{
// Private fields
private $_allowedTags;
private $_allowJavascriptEvents;
private $_allowJavascriptInUrls;
private $_allowObjects;
private $_allowScript;
private $_allowStyle;
private $_additionalTags;
/**
* Constructor
*/
public function __construct()
{
$this->resetAll();
}
/**
* (re)set all options to default value
*/
public function resetAll()
{
$this->_allowDOMEvents = false;
$this->_allowJavascriptInUrls = false;
$this->_allowStyle = false;
$this->_allowScript = false;
$this->_allowObjects = false;
$this->_allowStyle = false;
$this->_allowedTags = '<a><br><b><h1><h2><h3><h4><h5><h6>'
class HTML_Sanitizer {
/**
* Private fields.
*/
private $_allowedTags;
private $_allowJavascriptEvents;
private $_allowJavascriptInUrls;
private $_allowObjects;
private $_allowScript;
private $_allowStyle;
private $_additionalTags;
/**
* Constructor.
*/
public function __construct() {
$this->resetAll();
}
/**
* (re)set all options to default value.
*/
public function resetAll() {
$this->_allowDOMEvents = FALSE;
$this->_allowJavascriptInUrls = FALSE;
$this->_allowStyle = FALSE;
$this->_allowScript = FALSE;
$this->_allowObjects = FALSE;
$this->_allowStyle = FALSE;
$this->_allowedTags = '<a><br><b><h1><h2><h3><h4><h5><h6>'
. '<img><li><ol><p><strong><table><tr><td><th><u><ul><thead>'
. '<tbody><tfoot><em><dd><dt><dl><span><div><del><add><i><hr>'
. '<pre><br><blockquote><address><code><caption><abbr><acronym>'
. '<cite><dfn><q><ins><sup><sub><kbd><samp><var><tt><small><big>'
;
$this->_additionalTags = '';
}
/**
* Add additional tags to allowed tags
* @param string
* @access public
*/
public function addAdditionalTags( $tags )
{
$this->_additionalTags .= $tags;
}
. '<cite><dfn><q><ins><sup><sub><kbd><samp><var><tt><small><big>';
/**
* Allow iframes
* @access public
*/
public function allowIframes()
{
$this->addAdditionalTags( '<iframe>' );
}
$this->_additionalTags = '';
}
/**
* Allow HTML5 media tags
* @access public
*/
public function allowHtml5Media()
{
$this->addAdditionalTags( '<canvas><video><audio>' );
}
/**
* Add additional tags to allowed tags.
*
* @param string
*
* @access public
*/
public function addAdditionalTags($tags) {
$this->_additionalTags .= $tags;
}
/**
* Allow object, embed, applet and param tags in html
* @access public
*/
public function allowObjects()
{
$this->_allowObjects = true;
}
/**
* Allow DOM event on DOM elements
* @access public
*/
public function allowDOMEvents()
{
$this->_allowDOMEvents = true;
}
/**
* Allow script tags
* @access public
*/
public function allowScript()
{
$this->_allowScript = true;
}
/**
* Allow the use of javascript: in urls
* @access public
*/
public function allowJavascriptInUrls()
{
$this->_allowJavascriptInUrls = true;
}
/**
* Allow style tags and attributes
* @access public
*/
public function allowStyle()
{
$this->_allowStyle = true;
}
/**
* Helper to allow all javascript related tags and attributes
* @access public
*/
public function allowAllJavascript()
{
$this->allowDOMEvents();
$this->allowScript();
$this->allowJavascriptInUrls();
}
/**
* Allow all tags and attributes
* @access public
*/
public function allowAll()
{
$this->allowAllJavascript();
$this->allowObjects();
$this->allowStyle();
$this->allowIframes();
$this->allowHtml5Media();
}
/**
* Filter URLs to avoid HTTP response splitting attacks
* @access public
* @param string url
* @return string filtered url
*/
public function filterHTTPResponseSplitting( $url )
{
$dangerousCharactersPattern = '~(\r\n|\r|\n|%0a|%0d|%0D|%0A)~';
return preg_replace( $dangerousCharactersPattern, '', $url );
}
/**
* Remove potential javascript in urls
* @access public
* @param string url
* @return string filtered url
*/
public function removeJavascriptURL( $str )
{
$HTML_Sanitizer_stripJavascriptURL = 'javascript:[^"]+';
$str = preg_replace("/$HTML_Sanitizer_stripJavascriptURL/i"
, '__forbidden__'
, $str );
return $str;
}
/**
* Remove potential flaws in urls
* @access private
* @param string url
* @return string filtered url
*/
private function sanitizeURL( $url )
{
if ( ! $this->_allowJavascriptInUrls )
{
$url = $this->removeJavascriptURL( $url );
}
$url = $this->filterHTTPResponseSplitting( $url );
return $url;
}
/**
* Callback for PCRE
* @access private
* @param matches array
* @return string
* @see sanitizeURL
*/
private function _sanitizeURLCallback( $matches )
{
return 'href="'.$this->sanitizeURL( $matches[1] ).'"';
}
/**
* Remove potential flaws in href attributes
* @access private
* @param string html tag
* @return string filtered html tag
*/
private function sanitizeHref( $str )
{
$HTML_Sanitizer_URL = 'href="([^"]+)"';
return preg_replace_callback("/$HTML_Sanitizer_URL/i"
, array( &$this, '_sanitizeURLCallback' )
, $str );
}
/**
* Callback for PCRE
* @access private
* @param matches array
* @return string
* @see sanitizeURL
*/
private function _sanitizeSrcCallback( $matches )
{
return 'src="'.$this->sanitizeURL( $matches[1] ).'"';
/**
* Allow iframes.
*
* @access public
*/
public function allowIframes() {
$this->addAdditionalTags('<iframe>');
}
/**
* Allow HTML5 media tags.
*
* @access public
*/
public function allowHtml5Media() {
$this->addAdditionalTags('<canvas><video><audio>');
}
/**
* Allow object, embed, applet and param tags in html.
*
* @access public
*/
public function allowObjects() {
$this->_allowObjects = TRUE;
}
/**
* Allow DOM event on DOM elements.
*
* @access public
*/
public function allowDOMEvents() {
$this->_allowDOMEvents = TRUE;
}
/**
* Allow script tags.
*
* @access public
*/
public function allowScript() {
$this->_allowScript = TRUE;
}
/**
* Allow the use of javascript: in urls.
*
* @access public
*/
public function allowJavascriptInUrls() {
$this->_allowJavascriptInUrls = TRUE;
}
/**
* Allow style tags and attributes.
*
* @access public
*/
public function allowStyle() {
$this->_allowStyle = TRUE;
}
/**
* Helper to allow all javascript related tags and attributes.
*
* @access public
*/
public function allowAllJavascript() {
$this->allowDOMEvents();
$this->allowScript();
$this->allowJavascriptInUrls();
}
/**
* Allow all tags and attributes.
*
* @access public
*/
public function allowAll() {
$this->allowAllJavascript();
$this->allowObjects();
$this->allowStyle();
$this->allowIframes();
$this->allowHtml5Media();
}
/**
* Filter URLs to avoid HTTP response splitting attacks.
*
* @access public
* @param string url
*
* @return string filtered url
*/
public function filterHTTPResponseSplitting($url) {
$dangerousCharactersPattern = '~(\r\n|\r|\n|%0a|%0d|%0D|%0A)~';
return preg_replace($dangerousCharactersPattern, '', $url);
}
/**
* Remove potential javascript in urls.
*
* @access public
* @param string url
*
* @return string filtered url
*/
public function removeJavascriptURL($str) {
$HTML_Sanitizer_stripJavascriptURL = 'javascript:[^"]+';
$str = preg_replace("/$HTML_Sanitizer_stripJavascriptURL/i", '__forbidden__', $str);
return $str;
}
/**
* Remove potential flaws in urls.
*
* @access private
* @param string url
*
* @return string filtered url
*/
private function sanitizeURL($url) {
if (!$this->_allowJavascriptInUrls) {
$url = $this->removeJavascriptURL($url);
}
/**
* Remove potential flaws in href attributes
* @access private
* @param string html tag
* @return string filtered html tag
*/
private function sanitizeSrc( $str )
{
$HTML_Sanitizer_URL = 'src="([^"]+)"';
return preg_replace_callback("/$HTML_Sanitizer_URL/i"
, array( &$this, '_sanitizeSrcCallback' )
, $str );
$url = $this->filterHTTPResponseSplitting($url);
return $url;
}
/**
* Callback for PCRE.
*
* @access private
* @param matches array
*
* @return string
*
* @see sanitizeURL
*/
private function _sanitizeURLCallback($matches) {
return 'href="' . $this->sanitizeURL($matches[1]) . '"';
}
/**
* Remove potential flaws in href attributes.
*
* @access private
* @param string html tag
*
* @return string filtered html tag
*/
private function sanitizeHref($str) {
$HTML_Sanitizer_URL = 'href="([^"]+)"';
return preg_replace_callback("/$HTML_Sanitizer_URL/i", array(&$this, '_sanitizeURLCallback'), $str);
}
/**
* Callback for PCRE.
*
* @access private
* @param matches array
*
* @return string
*
* @see sanitizeURL
*/
private function _sanitizeSrcCallback($matches) {
return 'src="' . $this->sanitizeURL($matches[1]) . '"';
}
/**
* Remove potential flaws in href attributes.
*
* @access private
* @param string html tag
*
* @return string filtered html tag
*/
private function sanitizeSrc($str) {
$HTML_Sanitizer_URL = 'src="([^"]+)"';
return preg_replace_callback("/$HTML_Sanitizer_URL/i", array(&$this, '_sanitizeSrcCallback'), $str);
}
/**
* Remove dangerous attributes from html tags.
*
* @access private
* @param string html tag
*
* @return string filtered html tag
*/
private function removeEvilAttributes($str) {
if (!$this->_allowDOMEvents) {
$str = preg_replace_callback('/<(.*?)>/i', array(&$this, '_removeDOMEventsCallback'), $str);
}
/**
* Remove dangerous attributes from html tags
* @access private
* @param string html tag
* @return string filtered html tag
*/
private function removeEvilAttributes( $str )
{
if ( ! $this->_allowDOMEvents )
{
$str = preg_replace_callback('/<(.*?)>/i'
, array( &$this, '_removeDOMEventsCallback' )
, $str );
}
if ( ! $this->_allowStyle )
{
$str = preg_replace_callback('/<(.*?)>/i'
, array( &$this, '_removeStyleCallback' )
, $str );
}
return $str;
if (!$this->_allowStyle) {
$str = preg_replace_callback('/<(.*?)>/i', array(&$this, '_removeStyleCallback'), $str);
}
/**
* Remove DOM events attributes from html tags
* @access private
* @param string html tag
* @return string filtered html tag
*/
private function removeDOMEvents( $str )
{
$str = preg_replace ( '/\s*=\s*/', '=', $str );
$HTML_Sanitizer_stripAttrib = '(onclick|ondblclick|onmousedown|'
return $str;
}
/**
* Remove DOM events attributes from html tags.
*
* @access private
* @param string html tag
*
* @return string filtered html tag
*/
private function removeDOMEvents($str) {
$str = preg_replace('/\s*=\s*/', '=', $str);
$HTML_Sanitizer_stripAttrib = '(onclick|ondblclick|onmousedown|'
. 'onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|'
. 'onkeyup|onfocus|onblur|onabort|onerror|onload)'
;
. 'onkeyup|onfocus|onblur|onabort|onerror|onload)';
$str = stripslashes( preg_replace("/$HTML_Sanitizer_stripAttrib/i"
, 'forbidden'
, $str ) );
$str = stripslashes(preg_replace("/$HTML_Sanitizer_stripAttrib/i", 'forbidden', $str));
return $str;
}
/**
* Callback for PCRE
* @access private
* @param matches array
* @return string
* @see removeDOMEvents
*/
private function _removeDOMEventsCallback( $matches )
{
return '<' . $this->removeDOMEvents( $matches[1] ) . '>';
}
/**
* Remove style attributes from html tags
* @access private
* @param string html tag
* @return string filtered html tag
*/
private function removeStyle( $str )
{
$str = preg_replace ( '/\s*=\s*/', '=', $str );
$HTML_Sanitizer_stripAttrib = '(style)'
;
$str = stripslashes( preg_replace("/$HTML_Sanitizer_stripAttrib/i"
, 'forbidden'
, $str ) );
return $str;
}
/**
* Callback for PCRE
* @access private
* @param matches array
* @return string
* @see removeStyle
*/
private function _removeStyleCallback( $matches )
{
return '<' . $this->removeStyle( $matches[1] ) . '>';
}
/**
* Remove dangerous HTML tags
* @access private
* @param string html code
* @return string filtered url
*/
private function removeEvilTags( $str )
{
$allowedTags = $this->_allowedTags;
if ( $this->_allowScript )
{
$allowedTags .= '<script>';
}
if ( $this->_allowStyle )
{
$allowedTags .= '<style>';
}
if ( $this->_allowObjects )
{
$allowedTags .= '<object><embed><applet><param>';
}
$allowedTags .= $this->_additionalTags;
$str = strip_tags($str, $allowedTags );
return $str;
return $str;
}
/**
* Callback for PCRE.
*
* @access private
* @param matches array
*
* @return string
*
* @see removeDOMEvents
*/
private function _removeDOMEventsCallback($matches) {
return '<' . $this->removeDOMEvents($matches[1]) . '>';
}
/**
* Remove style attributes from html tags.
*
* @access private
* @param string html tag
*
* @return string filtered html tag
*/
private function removeStyle($str) {
$str = preg_replace('/\s*=\s*/', '=', $str);
$HTML_Sanitizer_stripAttrib = '(style)';
$str = stripslashes(preg_replace("/$HTML_Sanitizer_stripAttrib/i", 'forbidden', $str));
return $str;
}
/**
* Callback for PCRE.
*
* @access private
* @param matches array
*
* @return string
*
* @see removeStyle
*/
private function _removeStyleCallback($matches) {
return '<' . $this->removeStyle($matches[1]) . '>';
}
/**
* Remove dangerous HTML tags.
*
* @access private
* @param string html code
*
* @return string filtered url
*/
private function removeEvilTags($str) {
$allowedTags = $this->_allowedTags;
if ($this->_allowScript) {
$allowedTags .= '<script>';
}
/**
* Sanitize HTML
* remove dangerous tags and attributes
* clean urls
* @access public
* @param string html code
* @return string sanitized html code
*/
public function sanitize( $html )
{
$html = $this->removeEvilTags( $html );
$html = $this->removeEvilAttributes( $html );
$html = $this->sanitizeHref( $html );
$html = $this->sanitizeSrc( $html );
return $html;
if ($this->_allowStyle) {
$allowedTags .= '<style>';
}
}
function html_sanitize( $str )
{
static $san = null;
if ( empty( $san ) )
{
$san = new HTML_Sanitizer;
if ($this->_allowObjects) {
$allowedTags .= '<object><embed><applet><param>';
}
return $san->sanitize( $str );
$allowedTags .= $this->_additionalTags;
$str = strip_tags($str, $allowedTags);
return $str;
}
/**
* Sanitize HTML
* remove dangerous tags and attributes
* clean urls.
*
* @access public
* @param string html code
*
* @return string sanitized html code
*/
public function sanitize($html) {
$html = $this->removeEvilTags($html);
$html = $this->removeEvilAttributes($html);
$html = $this->sanitizeHref($html);
$html = $this->sanitizeSrc($html);
return $html;
}
}
function html_loose_sanitize( $str )
{
static $san = null;
if ( empty( $san ) )
{
$san = new HTML_Sanitizer;
$san->allowAll();
}
return $san->sanitize( $str );
/**
*
*/
function html_sanitize($str) {
static $san = NULL;
if (empty($san)) {
$san = new HTML_Sanitizer();
}
return $san->sanitize($str);
}
/**
*
*/
function html_loose_sanitize($str) {
static $san = NULL;
if (empty($san)) {
$san = new HTML_Sanitizer();
$san->allowAll();
}
return $san->sanitize($str);
}

7
ebsco/templates/ebsco-advanced-search.tpl.php

@ -5,7 +5,7 @@
* Displays the advanced search form.
*
* @see template_preprocess_ebsco_advanced_search()
*
*
*
* Copyright [2017] [EBSCO Information Services]
*
@ -14,7 +14,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -51,7 +51,6 @@
<option value="Abstract">Abstract</option>
<option value="ISBN">ISBN</option>
<option value="ISSN">ISSN</option>
</select>
</div>
<div class="delete-search">
@ -61,4 +60,4 @@
</div>
</div>
</fieldset>
</div>
</div>

30
ebsco/templates/ebsco-basic-search.tpl.php

@ -5,7 +5,7 @@
* Displays the basic search form block.
*
* @see template_preprocess_ebsco_basic_search()
*
*
*
* Copyright [2017] [EBSCO Information Services]
*
@ -14,7 +14,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -24,17 +24,17 @@
?>
<div class="container-inline">
<?php
if ($search_view == 'basic'){
echo $search_form;
}
elseif ($search_view == 'advanced'){
echo '<a href="'.url('ebsco/advanced', array('query' => array('edit' => 1))).'" class="small">'.t('Edit this Advanced Search')."</a> |";
echo '<a href="'.url('ebsco/advanced').'" class="small">'.t('Start a new Advanced Search').'</a> |';
echo '<a href="'.url('ebsco/results').'" class="small">'.t('Start a new Basic Search').'</a>';
echo "<br/>";
echo t('Your search terms').": <strong>".check_plain($lookfor); "</strong>";
}
?>
<?php
if ($search_view == 'basic'){
echo $search_form;
}
elseif ($search_view == 'advanced'){
echo '<a href="' . url('ebsco/advanced', array('query' => array('edit' => 1))) . '" class="small">' . t('Edit this Advanced Search') . "</a> |";
echo '<a href="' . url('ebsco/advanced') . '" class="small">' . t('Start a new Advanced Search') . '</a> |';
echo '<a href="' . url('ebsco/results') . '" class="small">' . t('Start a new Basic Search') . '</a>';
echo "<br/>";
echo t('Your search terms') . ": <strong>" . check_plain($lookfor); "</strong>";
}
?>
</div>

262
ebsco/templates/ebsco-result.tpl.php

@ -5,7 +5,7 @@
* Default theme implementation for displaying an EBSCO result.
*
* @see template_preprocess_ebsco_result()
*
*
*
* Copyright [2017] [EBSCO Information Services]
*
@ -14,7 +14,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -23,138 +23,138 @@
*/
?>
<?php
if ($record) {
<?php
if ($record) {
$id = check_plain($record->record_id());
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
$id = check_plain($record->record_id());
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
?>
<div class="ebsco-record">
<h1><?php print $record->title; ?></h1>
<div class="record-toolbar">
<?php
if ($last_search){
?>
<div class="floatright">
<?php
if ($last_search['previous']){
echo '<a href="'.url('ebsco/result', array('query' => array('id' => $last_search['previous'], 'op' => 'Previous'))).'" class="_record_link">&laquo; '.t('Previous').'</a>';
}
echo "#";
print $last_search['current_index']; ?> of <?php print $last_search['count'];
if ($last_search['next']){
echo '<a href="'.url('ebsco/result', array('query' => array('id' => $last_search['next'], 'op' => 'Next'))).'" class="_record_link">'.t('Next').' &raquo;</a>';
}
?>
</div>
<div class="floatleft">
<a href="<?php print "?{$last_search['query']}"; ?>">
&laquo; <?php print t('Back to Results list'); ?>
</a>
</div>
<div class="clear"></div>
<?php
}
?>
</div>
<div class="span-5">
<ul class="external-links">
<?php
if($record->p_link){
echo "<li> <a href='".$record->p_link."'>".t('View in EDS')."</a></li>";
}
if ($record->pdf_link){
echo '
<li>
<a href="'.$pdfUrl.'" class="icon pdf fulltext">'.t('PDF full text').'</a>
</li>';
}
if ($record->full_text_availability){
echo '
<li>
<a href="'.( (!user_is_logged_in())?$fulltextUrl:"").'#html" class="icon html fulltext">'.t('HTML full text').'</a>
</li>';
}
if (!empty($record->custom_links)){
foreach ($record->custom_links as $link){
echo '
<li>
<a href="'.$link['Url'].'" target="_blank" title="'.$link['MouseOverText'].'" class="external-link">'. ($link['Icon'])? '<img src="'.$link['Icon'].'" />':''.$link['Name'].'</a>
</li>';
}
}
?>
</ul>
</div>
<div class="span-13">
<table cellpadding="2" cellspacing="0" border="0" class="citation" summary="<?php print t('Bibliographic Details'); ?>">
<?php
foreach ($record->items as $item){
if (!empty($item['Data'])){
echo '
<tr valign="top">
<th width="150">'.t($item['Label']).':</th>
<td>'.auto_link($item['Data']).'</td>
</tr>';
}
}
if ($record->db_label){
echo '
<tr valign="top">
<th width="150">'.t('Database').':</th><td>'.check_plain($record->db_label).'</td>
</tr>';
}
if ($record->full_text){
echo '
<tr id="html" valign="top">
<td colspan="2" class="html">'.$record->full_text.'</td>
</tr>';
}
elseif ($record->access_level && !user_is_logged_in()){
echo '
<tr id="html" valign="top">
<td colspan="2" class="html">
<p>'.t('The full text cannot be displayed to guests.').'<br />.';
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo '<strong>'.sprintf(t('%s for full access.'), $link).'</strong>
</p>
</td>
</tr>
';
}
?>
</table>
</div>
<div class="span-4">
<?php
if ($record->medium_thumb_link){
echo '<img src="'.check_url($record->medium_thumb_link).'" class="book-jacket" alt="'.t('Book jacket').'"/>';
}
if ($record->publication_type){
echo '<p>'. check_plain($record->publication_type).'</p>';
}
?>
</div>
<div class="clear"></div>
</div>
<?php
}
<div class="ebsco-record">
<h1><?php print $record->title; ?></h1>
<div class="record-toolbar">
<?php
if ($last_search){
?>
<div class="floatright">
<?php
if ($last_search['previous']){
echo '<a href="' . url('ebsco/result', array('query' => array('id' => $last_search['previous'], 'op' => 'Previous'))) . '" class="_record_link">&laquo; ' . t('Previous') . '</a>';
}
echo "#";
print $last_search['current_index']; ?> of <?php print $last_search['count'];
if ($last_search['next']){
echo '<a href="' . url('ebsco/result', array('query' => array('id' => $last_search['next'], 'op' => 'Next'))) . '" class="_record_link">' . t('Next') . ' &raquo;</a>';
}
?>
</div>
<div class="floatleft">
<a href="<?php print "?{$last_search['query']}"; ?>">
&laquo; <?php print t('Back to Results list'); ?>
</a>
</div>
<div class="clear"></div>
<?php
}
?>
</div>
<div class="span-5">
<ul class="external-links">
<?php
if($record->p_link){
echo "<li> <a href='" . $record->p_link . "'>" . t('View in EDS') . "</a></li>";
}
if ($record->pdf_link){
echo '
<li>
<a href="' . $pdfUrl . '" class="icon pdf fulltext">' . t('PDF full text') . '</a>
</li>';
}
if ($record->full_text_availability){
echo '
<li>
<a href="' . ((!user_is_logged_in()) ? $fulltextUrl : "") . '#html" class="icon html fulltext">' . t('HTML full text') . '</a>
</li>';
}
if (!empty($record->custom_links)){
foreach ($record->custom_links as $link){
echo '
<li>
<a href="' . $link['Url'] . '" target="_blank" title="' . $link['MouseOverText'] . '" class="external-link">' . ($link['Icon']) ? '<img src="' . $link['Icon'] . '" />' : '' . $link['Name'] . '</a>
</li>';
}
}
?>
</ul>
</div>
<div class="span-13">
<table cellpadding="2" cellspacing="0" border="0" class="citation" summary="<?php print t('Bibliographic Details'); ?>">
<?php
foreach ($record->items as $item){
if (!empty($item['Data'])){
echo '
<tr valign="top">
<th width="150">' . t($item['Label']) . ':</th>
<td>' . auto_link($item['Data']) . '</td>
</tr>';
}
}
if ($record->db_label){
echo '
<tr valign="top">
<th width="150">' . t('Database') . ':</th><td>' . check_plain($record->db_label) . '</td>
</tr>';
}
if ($record->full_text){
echo '
<tr id="html" valign="top">
<td colspan="2" class="html">' . $record->full_text . '</td>
</tr>';
}
elseif ($record->access_level && !user_is_logged_in()){
echo '
<tr id="html" valign="top">
<td colspan="2" class="html">
<p>' . t('The full text cannot be displayed to guests.') . '<br />.';
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo '<strong>' . sprintf(t('%s for full access.'), $link) . '</strong>
</p>
</td>
</tr>
';
}
?>
</table>
</div>
<div class="span-4">
<?php
if ($record->medium_thumb_link){
echo '<img src="' . check_url($record->medium_thumb_link) . '" class="book-jacket" alt="' . t('Book jacket') . '"/>';
}
if ($record->publication_type){
echo '<p>' . check_plain($record->publication_type) . '</p>';
}
?>
</div>
<div class="clear"></div>
</div>
<?php
}
?>
<div id="spinner" class="spinner"></div>

651
ebsco/templates/ebsco-results.tpl.php

@ -5,7 +5,7 @@
* Default theme implementation for displaying EBSCO results.
*
* @see template_preprocess_ebsco_results()
*
*
*
* Copyright [2017] [EBSCO Information Services]
*
@ -14,7 +14,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -22,337 +22,338 @@
* limitations under the License.
*/
if (isset ($autoSuggestTerms) ) {
if (count($autoSuggestTerms)>0) {
$suggestString="";
foreach ($autoSuggestTerms as $term ) {
$path = url('ebsco/results', array('query' => array('type' => "")));
$suggestString.="<a href=\"{$path}&lookfor=$term\">".$term."</a> ";
}
echo "<p><strong>Did you mean ".$suggestString."?</strong></p>";
}
}
if ($records){
echo t('Showing')." <strong>".$record_start."</strong> - <strong> ".$record_end."</strong> ".t('of')." <strong>".$record_count."</strong> ";
if ($search_view == 'basic') {
echo t('for search')." <strong>'".check_plain($lookfor)."'</strong> ";
}
if ($search_time){
echo "," .t('query time').":".check_plain(round($search_time, 2))." s";
}
print $sort_form;
print $pager;
if (!user_is_logged_in()) {
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo '<p class="top-login-message">';
echo sprintf(t('Hello, Guest. %s for full access.'), $link);
echo '</p>';
}
$tabs="";
$tabsContent="";
$counter=0;
$rsItem=null;
if (isset ($relatedContent) ) {
foreach ($relatedContent as $item ) {
if (isset($item["RelatedRecord"])) {
$tabs.='<li data-target="#researchstarters" data-slide-to="'.$counter.'" '.($counter==0?' class="active" ':' ').'></li>';
$counter++;
if (isset($item["RelatedRecord"]["Records"]["Record"][0])) {
$rsItem=$item["RelatedRecord"]["Records"]["Record"][0];
}
else
{
if (isset($item["Records"]["Record"])) {
$rsItem=$item["Records"]["Record"];
}
}
if ($rsItem==null) {
continue ;
}
//var_dump($rsItem);
$rsTitle="";
$rsSubjects="";
$rsAbstract="";
$rsSource="";
$rsImage="";
$rsAN=$rsItem["Header"]["An"];
$rsDB=$rsItem["Header"]["DbId"];
$rsUrl = url('ebsco/result', array('query' => array('id' => $rsAN."|".$rsDB)));
if (isset($rsItem["ImageInfo"]["CoverArt"])) {
$rsImage=$rsItem["ImageInfo"]["CoverArt"]["Target"];
}
foreach($rsItem["Items"]["Item"] as $it) {
switch ($it["Group"]) {
case "Ti":
$rsTitle=$it["Data"];
break;
case "Src":
$rsSource=$it["Data"];
break;
case "Su":
$rsSubjects=$it["Data"];
break;
case "Ab":
$rsAbstract=$it["Data"];
break;
}
}
$tabsContent.='<div class="item" ><div class="carousel-caption">';
if ($rsImage<>"") {
$tabsContent.='<img src="'.$rsImage.'" alt="'.$rsTitle.'" style="float:left">';
}
if ($rsTitle<>""){
$tabsContent.='<h3 class="relatedTitle"><a href="'.$rsUrl.'" class="title _record_link">'.$rsTitle.'</a></h3>';
}
if ($rsSubjects<>""){
$path = url('ebsco/results', array('query' => array('type' => "Subject")));
$link_xml = '/<searchLink fieldCode="([^\"]*)" term="%22([^\"]*)%22">/';
$link_html = "<a href=\"{$path}&lookfor=$2\">";
$rsSubjects = preg_replace($link_xml, $link_html, $rsSubjects);
$rsSubjects = str_replace('</searchLink>', '</a>', $rsSubjects);
$tabsContent.='<p><strong>'.t('Subjects').'</strong>:<span class="quotestart">'.str_replace(array("<br>","<br />"), ', ', $rsSubjects).'</span></p>';
}
if ($rsSource<>""){
$tabsContent.='<p>'.$rsSource.'</p>';
}
if ($rsAbstract<>""){
$tabsContent.='<p><cite>'.$rsAbstract.'</cite></p>';
}
$tabsContent.='</div></div>';
}
// replated publications
if (isset($item["RelatedPublication"])) {
//var_dump($item);
$tabs.='<li data-target="#ematchplacard" data-slide-to="'.$counter.'" '.($counter==0?' class="active" ':' ').'></li>';
$counter++;
$tabsContent.='<div class="item" ><div class="carousel-caption">';
$tabsContent.='
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
';
foreach ($item["RelatedPublication"]["PublicationRecords"] as $pub){
$plink = $pub["PLink"];
foreach($pub["Items"]["Item"] as $item) {
if ($item["Group"]=="Ti")
{
$tabsContent.='<h3 class="relatedTitle"><a href="'.$plink.' target="_blank" >'.$item["Data"].'</a></h3>';
}
else
{
$tabsContent.="<strong>".$item["Label"]."</strong> : ".$item["Data"]."<br/>";
}
}
$tabsContent.='<div id="publicationList"><ul>';
foreach($pub["FullTextHoldings"]["FullTextHolding"] as $itemHoldings) {
$hURL=isset($itemHoldings["URL"])?$itemHoldings["URL"] :"";
$hName=isset($itemHoldings["Name"])?$itemHoldings["Name"] :"";
$hCoverage=isset($itemHoldings["CoverageStatement"])?$itemHoldings["CoverageStatement"] :"";
$hEmbargo="";
if (isset($itemHoldings["EmbargoDescription"])) {
// if no embargo, zero size array
if (!is_array($itemHoldings["EmbargoDescription"] )) {
$hEmbargo=$itemHoldings["EmbargoDescription"];
}
}
$tabsContent.='<li>
<a href="'.$hURL.'" target="_blank">'.$hName.'</a>;
<ul><li>Coverage:'.$hCoverage.'; ';
if ($hEmbargo<>'') {
$tabsContent.='</li><li>Embargo:'.$hEmbargo;
}
$tabsContent.='</li></ul></li>';
// Notes
}
$tabsContent.='</ul></div>';
}
$tabsContent.='
<script>
jQuery("#publicationList").jstree().on("changed.jstree", function (e, data) {
var pubURL = data.instance.get_node(data.node, true).children("a").attr("href");
if (pubURL!="#") {
window.open(pubURL);
}
});
</script>';
$tabsContent.='</div></div>';
break;
}
}
}
if ($tabsContent<>"") {
echo '<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div id="relatedInformation" class="carousel slide" data-ride="carousel" style="display:block;">
<!-- Indicators -->
<ol class="carousel-indicators">'.$tabs.'</ol>';
echo '<div class="carousel-inner" role="listbox" >'.$tabsContent.'</div>';
echo '<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" ></span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" ></span>
</a>
</div>
<script>
jQuery("#relatedInformation").carousel({
pause: true,
interval:4000
})
</script>';
}
?>
if (isset($autoSuggestTerms)) {
if (count($autoSuggestTerms) > 0) {
$suggestString = "";
foreach ($autoSuggestTerms as $term) {
$path = url('ebsco/results', array('query' => array('type' => "")));
$suggestString .= "<a href=\"{$path}&lookfor=$term\">" . $term . "</a> ";
}
echo "<p><strong>Did you mean " . $suggestString . "?</strong></p>";
}
}
if ($records){
echo t('Showing') . " <strong>" . $record_start . "</strong> - <strong> " . $record_end . "</strong> " . t('of') . " <strong>" . $record_count . "</strong> ";
if ($search_view == 'basic') {
echo t('for search') . " <strong>'" . check_plain($lookfor) . "'</strong> ";
}
if ($search_time){
echo "," . t('query time') . ":" . check_plain(round($search_time, 2)) . " s";
}
print $sort_form;
print $pager;
if (!user_is_logged_in()) {
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo '<p class="top-login-message">';
echo sprintf(t('Hello, Guest. %s for full access.'), $link);
echo '</p>';
}
$tabs = "";
$tabsContent = "";
$counter = 0;
$rsItem = NULL;
if (isset($relatedContent)) {
foreach ($relatedContent as $item) {
if (isset($item["RelatedRecord"])) {
$tabs .= '<li data-target="#researchstarters" data-slide-to="' . $counter . '" ' . ($counter == 0 ? ' class="active" ' : ' ') . '></li>';
$counter++;
if (isset($item["RelatedRecord"]["Records"]["Record"][0])) {
$rsItem = $item["RelatedRecord"]["Records"]["Record"][0];
}
else
{
if (isset($item["Records"]["Record"])) {
$rsItem = $item["Records"]["Record"];
}
}
if ($rsItem == NULL) {
continue;
}
// var_dump($rsItem);
$rsTitle = "";
$rsSubjects = "";
$rsAbstract = "";
$rsSource = "";
$rsImage = "";
$rsAN = $rsItem["Header"]["An"];
$rsDB = $rsItem["Header"]["DbId"];
$rsUrl = url('ebsco/result', array('query' => array('id' => $rsAN . "|" . $rsDB)));
if (isset($rsItem["ImageInfo"]["CoverArt"])) {
$rsImage = $rsItem["ImageInfo"]["CoverArt"]["Target"];
}
foreach($rsItem["Items"]["Item"] as $it) {
switch ($it["Group"]) {
case "Ti":
$rsTitle = $it["Data"];
break;
case "Src":
$rsSource = $it["Data"];
break;
case "Su":
$rsSubjects = $it["Data"];
break;
case "Ab":
$rsAbstract = $it["Data"];
break;
}
}
$tabsContent .= '<div class="item" ><div class="carousel-caption">';
if ($rsImage <> "") {
$tabsContent .= '<img src="' . $rsImage . '" alt="' . $rsTitle . '" style="float:left">';
}
if ($rsTitle <> ""){
$tabsContent .= '<h3 class="relatedTitle"><a href="' . $rsUrl . '" class="title _record_link">' . $rsTitle . '</a></h3>';
}
if ($rsSubjects <> ""){
$path = url('ebsco/results', array('query' => array('type' => "Subject")));
$link_xml = '/<searchLink fieldCode="([^\"]*)" term="%22([^\"]*)%22">/';
$link_html = "<a href=\"{$path}&lookfor=$2\">";
$rsSubjects = preg_replace($link_xml, $link_html, $rsSubjects);
$rsSubjects = str_replace('</searchLink>', '</a>', $rsSubjects);
$tabsContent .= '<p><strong>' . t('Subjects') . '</strong>:<span class="quotestart">' . str_replace(array("<br>", "<br />"), ', ', $rsSubjects) . '</span></p>';
}
if ($rsSource <> ""){
$tabsContent .= '<p>' . $rsSource . '</p>';
}
if ($rsAbstract <> ""){
$tabsContent .= '<p><cite>' . $rsAbstract . '</cite></p>';
}
$tabsContent .= '</div></div>';
}
// Replated publications.
if (isset($item["RelatedPublication"])) {
// var_dump($item);
$tabs .= '<li data-target="#ematchplacard" data-slide-to="' . $counter . '" ' . ($counter == 0 ? ' class="active" ' : ' ') . '></li>';
$counter++;
$tabsContent .= '<div class="item" ><div class="carousel-caption">';
$tabsContent .= '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
';
foreach ($item["RelatedPublication"]["PublicationRecords"] as $pub){
$plink = $pub["PLink"];
foreach($pub["Items"]["Item"] as $item) {
if ($item["Group"] == "Ti")
{
$tabsContent .= '<h3 class="relatedTitle"><a href="' . $plink . ' target="_blank" >' . $item["Data"] . '</a></h3>';
}
else
{
$tabsContent .= "<strong>" . $item["Label"] . "</strong> : " . $item["Data"] . "<br/>";
}
}
$tabsContent .= '<div id="publicationList"><ul>';
foreach($pub["FullTextHoldings"]["FullTextHolding"] as $itemHoldings) {
$hURL = isset($itemHoldings["URL"]) ? $itemHoldings["URL"] : "";
$hName = isset($itemHoldings["Name"]) ? $itemHoldings["Name"] : "";
$hCoverage = isset($itemHoldings["CoverageStatement"]) ? $itemHoldings["CoverageStatement"] : "";
$hEmbargo = "";
if (isset($itemHoldings["EmbargoDescription"])) {
// If no embargo, zero size array.
if (!is_array($itemHoldings["EmbargoDescription"])) {
$hEmbargo = $itemHoldings["EmbargoDescription"];
}
}
$tabsContent .= '<li>
<a href="' . $hURL . '" target="_blank">' . $hName . '</a>;
<ul><li>Coverage:' . $hCoverage . '; ';
if ($hEmbargo <> '') {
$tabsContent .= '</li><li>Embargo:' . $hEmbargo;
}
$tabsContent .= '</li></ul></li>';
// Notes.
}
$tabsContent .= '</ul></div>';
}
$tabsContent .= '
<script>
jQuery("#publicationList").jstree().on("changed.jstree", function (e, data) {
var pubURL = data.instance.get_node(data.node, true).children("a").attr("href");
if (pubURL!="#") {
window.open(pubURL);
}
});
</script>';
$tabsContent .= '</div></div>';
break;
}
}
}
if ($tabsContent <> "") {
echo '<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div id="relatedInformation" class="carousel slide" data-ride="carousel" style="display:block;">
<!-- Indicators -->
<ol class="carousel-indicators">' . $tabs . '</ol>';
echo '<div class="carousel-inner" role="listbox" >' . $tabsContent . '</div>';
echo '<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" ></span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" ></span>
</a>
</div>
<script>
jQuery("#relatedInformation").carousel({
pause: true,
interval:4000
})
</script>';
}
?>
<ol class="search-results ebsco">
<?php foreach ($records as $record):
$id = check_plain($record->record_id());
$recordUrl = url('ebsco/result', array('query' => array('id' => $id)));
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
<?php foreach ($records as $record):
$id = check_plain($record->record_id());
$recordUrl = url('ebsco/result', array('query' => array('id' => $id)));
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
?>
<li>
<div class="record-number floatleft">
<?php print $record->result_id; ?>
</div>
<div class="result floatleft">
<div class="span-2">
<?php
if ($record->small_thumb_link){
echo '
<a href="' . $recordUrl . '" class="_record_link">
<img src="' . $record->small_thumb_link . '" class="book-jacket" alt="' . t('Book jacket') . '"/>
</a>';
}
?>
<li>
<div class="record-number floatleft">
<?php print $record->result_id; ?>
</div>
</div>
<div class="result floatleft">
<div class="span-2">
<?php
if ($record->small_thumb_link){
echo'
<a href="'.$recordUrl.'" class="_record_link">
<img src="'.$record->small_thumb_link.'" class="book-jacket" alt="'.t('Book jacket').'"/>
</a>';
}
?>
</div>
<div class="span-9">
<div class="result-line1">
<?php
<div class="span-9">
<div class="result-line1">
<?php
if ($record->access_level == '1'){
echo '<p>';
$label = '<strong>' . check_plain($record->db_label) . '</strong>';
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo sprintf(t('This result from %s cannot be displayed to guests.'), $label)."<br /><strong>".sprintf(t('%s for full access.'), $link)."</strong>";
echo "</p>";
}
elseif ($record->title){
echo '<a href="'.$recordUrl.'" class="title _record_link">'.$record->title.'</a>';
}
?>
</div>
<div class="result-line2">
<?php
if (!empty($record->authors)){
echo "<span>".t('by'). " ".str_replace(array("<br>","<br />"), ', ', $record->authors)." </span>";
}
if (!empty($record->source)){
echo '<p>'.t('Published in')." ".$record->source.'</p>';
}
?>
</div>
<div class="result-line3">
<?php
if (!empty($record->summary)){
echo '<cite>'.$record->summary.'</cite><br />';
}
if (!empty($record->subjects)){
echo '<strong>'.t('Subjects').'</strong>:<span class="quotestart">'.str_replace('<br />', ', ', $record->subjects).'</span>';
}
?>
</div>
<?php
if (!empty($record->custom_links)){
?>
<div class="result-line4">
<ul class="custom-links">
<?php
foreach ($record->custom_links as $link){ ?>
<li>
<a href="<?php print $link['Url']; ?>" target="_blank" title="<?php print $link['MouseOverText']; ?>" class="external-link">
<?php if ($link['Icon']): ?><img src="<?php print $link['Icon']?>" /><?php endif; ?><?php print $link['Name']; ?>
</a>
</li>
<?php } ?>
</ul>
</div>
<?php } ?>
<div class="result-line5">
<?php
if ($record->full_text_availability){
echo '<a href="'.$fulltextUrl.'#html" class="icon html fulltext _record_link">';
echo t('HTML full text');
echo "</a>&nbsp; &nbsp;";
}
if ($record->pdf_availability){
echo ' <a href="'.$pdfUrl.'" class="icon pdf fulltext">';
echo t('PDF full text');
echo "</a>";
}
?>
</div>
</div>
if ($record->access_level == '1'){
echo '<p>';
$label = '<strong>' . check_plain($record->db_label) . '</strong>';
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo sprintf(t('This result from %s cannot be displayed to guests.'), $label) . "<br /><strong>" . sprintf(t('%s for full access.'), $link) . "</strong>";
echo "</p>";
}
elseif ($record->title){
echo '<a href="' . $recordUrl . '" class="title _record_link">' . $record->title . '</a>';
}
?>
</div>
<div class="result-line2">
<?php
if (!empty($record->authors)){
echo "<span>" . t('by') . " " . str_replace(array("<br>", "<br />"), ', ', $record->authors) . " </span>";
}
if (!empty($record->source)){
echo '<p>' . t('Published in') . " " . $record->source . '</p>';
}
?>
</div>
<div class="result-line3">
<?php
if (!empty($record->summary)){
echo '<cite>' . $record->summary . '</cite><br />';
}
if (!empty($record->subjects)){
echo '<strong>' . t('Subjects') . '</strong>:<span class="quotestart">' . str_replace('<br />', ', ', $record->subjects) . '</span>';
}
?>
</div>
<?php
if (!empty($record->custom_links)){
?>
<div class="result-line4">
<ul class="custom-links">
<?php
foreach ($record->custom_links as $link){ ?>
<li>
<a href="<?php print $link['Url']; ?>" target="_blank" title="<?php print $link['MouseOverText']; ?>" class="external-link">
<?php if ($link['Icon']): ?><img src="<?php print $link['Icon']?>" /><?php
endif; ?><?php print $link['Name']; ?>
</a>
</li>
<?php } ?>
</ul>
</div>
<div class="clear"></div>
</li>
<?php endforeach; ?>
<?php } ?>
<div class="result-line5">
<?php
if ($record->full_text_availability){
echo '<a href="' . $fulltextUrl . '#html" class="icon html fulltext _record_link">';
echo t('HTML full text');
echo "</a>&nbsp; &nbsp;";
}
if ($record->pdf_availability){
echo ' <a href="' . $pdfUrl . '" class="icon pdf fulltext">';
echo t('PDF full text');
echo "</a>";
}
?>
</div>
</div>
</div>
<div class="clear"></div>
</li>
<?php endforeach; ?>
</ol>
<?php print $pager; ?>
<?php
}
elseif (!empty($lookfor)) {
echo "<h2>".t('Your search did not match any resources.')."</h2>";
// check for autocomplete
/*
if (isset ($autoSuggestTerms) ) {
if (count($autoSuggestTerms)>0) {
echo "Did you mean "."?<br/>";
var_dump($autoSuggestTerms);
}
}
*/
echo search_help('search#noresults', drupal_help_arg());
}
<?php
}
elseif (!empty($lookfor)) {
echo "<h2>" . t('Your search did not match any resources.') . "</h2>";
// Check for autocomplete.
/*
if (isset ($autoSuggestTerms) ) {
if (count($autoSuggestTerms)>0) {
echo "Did you mean "."?<br/>";
var_dump($autoSuggestTerms);
}
}
*/
echo search_help('search#noresults', drupal_help_arg());
}
?>
<div id="spinner" class="spinner"></div>
<div id="spinner" class="spinner"></div>

6
ebsco/templates/ebsco-side-facets.tpl.php

@ -2,7 +2,7 @@
/**
* @file
* Display the sidebar block with facets filters
* Display the sidebar block with facets filters.
*
* @see template_preprocess_ebsco_side_facets()
*
@ -14,12 +14,12 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
?>

Loading…
Cancel
Save