Skip to content

Commit a83ed39

Browse files
Merge pull request #50 from AlexanderBlanchardAC/summon_new_features
Summon new features
2 parents 063e933 + 8717820 commit a83ed39

File tree

13 files changed

+169
-23
lines changed

13 files changed

+169
-23
lines changed

code/web/RecordDrivers/SummonRecordDriver.php

+18-9
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,25 @@ public function isValid() {
2424
}
2525

2626
public function getBookcoverUrl($size='large', $absolutePath = false) {
27+
// require_once ROOT_DIR . '/sys/LibraryLocation/Library.php';
28+
global $library;
29+
2730
global $configArray;
2831
if ($size == 'small' || $size == 'medium'){
2932
$sizeInArray = 'thumbnail_m';
3033
}else{
3134
$sizeInArray = 'thumbnail_l';
3235
}
33-
if (!empty($this->record[$sizeInArray][0])) {
34-
$imageDimensions = getimagesize($this->record[$sizeInArray][0]);
35-
if ($sizeInArray == 'thumbnail_m' && $imageDimensions[0] > 10) {
36-
return $this->record[$sizeInArray][0];
37-
} elseif ($sizeInArray == 'thumbnail_l' && $imageDimensions[0] > 10) {
38-
return $this->record[$sizeInArray][0];
39-
}
36+
37+
if ($library->showAvailableCoversInSummon) {
38+
if(!empty($this->record[$sizeInArray][0])){
39+
$imagePath = $this->record[$sizeInArray][0];
40+
41+
$imageDimensions = getImageSize($imagePath);
42+
if($imageDimensions[0] > 10){
43+
return $imagePath;
44+
}
45+
}
4046
}
4147
if ($absolutePath) {
4248
$bookCoverUrl = $configArray['Site']['url'];
@@ -242,6 +248,9 @@ public function getStaffView() {
242248
public function getTitle() {
243249
if (isset($this->record['Title'])) {
244250
$title=$this->record['Title'][0];
251+
if (isset($this->record['Subtitle'])) {
252+
$title .= ': ' . $this->record['Subtitle'][0];
253+
}
245254
} else {
246255
$title='Unknown Title';
247256
}
@@ -339,8 +348,8 @@ public function getPrimaryAuthor() {
339348
}
340349

341350
public function getAuthor() {
342-
if(isset($this->record['Author'][0])) {
343-
$author=$this->record['Author'][0];
351+
if(isset($this->record['Author_xml'][0]['fullname'])) {
352+
$author=$this->record['Author_xml'][0]['fullname'];
344353
} else {
345354
$author='Unknown Title';
346355
}

code/web/interface/themes/responsive/Search/explore-more-bar.tpl

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{strip}
22
{* TODO: Consider renaming classes to assume they are under the exploreMoreBar class *}
3+
{if !empty($showExploreMoreOptions)}
34
<div class="exploreMoreBar row">
45
{*<div class="label-left">*}
56
<div class="label-top">
@@ -50,4 +51,9 @@
5051
</div>
5152

5253
</div>
53-
{/strip}
54+
{else}
55+
<div>
56+
</div>
57+
{/if}
58+
{/strip}
59+

code/web/interface/themes/responsive/Summon/result-tools-horizontal.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{if !empty($showMoreInfo)}
66
{if $showMoreInfo !== false}
77
<div class="btn-group btn-group-sm">
8-
<a href="{if !empty($summUrl)}{$summUrl}{else}{$recordDriver->getLinkUrl()}{/if}" class="btn btn-sm btn-tools" onclick="AspenDiscovery.EBSCO.trackEdsUsage('{$recordDriver->getPermanentId()}')" target="_blank" aria-label="{translate text='More Info' isPublicFacing=true} ({translate text='opens in new window' isPublicFacing=true})"><i class="fas fa-external-link-alt" role="presentation"></i> {translate text="More Info" isPublicFacing=true}</a>
8+
<a href="{if !empty($summUrl)}{$summUrl}{else}{$recordDriver->getLinkUrl()}{/if}" class="btn btn-sm btn-tools" onclick="AspenDiscovery.Summon.trackSummonUsage('{$recordDriver->getPermanentId()}')" target="_blank" aria-label="{translate text='More Info' isPublicFacing=true} ({translate text='opens in new window' isPublicFacing=true})"><i class="fas fa-external-link-alt" role="presentation"></i> {translate text="More Info" isPublicFacing=true}</a>
99
</div>
1010
{/if}
1111
{if $showFavorites == 1}
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[ZoneTransfer]
2+
ZoneId=3
3+
ReferrerUrl=https://www.google.com/
4+
HostUrl=https://files.mtstatic.com/site_11811/55152/0?Expires=1708452791&Signature=O-eIysOYl-1drJTT2f6LTnuDXMhKycAnvuWBQT53Y5WC-uFeYwIE744-kFoVgc-gDsc1ODNBFX1G09SEdxs6NAzaBLFM1c9V0Xq3GZiKsUMivxIQC8YNpa9VHLWM0KE-snOgnMcGuuzuqvpFNAZA5J7FNpYuE~F2eWzOKKYIdhw_&Key-Pair-Id=APKAJ5Y6AV4GI7A555NA

code/web/release_notes/24.06.00.MD

+9
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,23 @@
4848

4949
//other
5050

51+
5152
//morgan
5253
- Added new Documentation links to several settings pages (*MKD*)
5354
- Updates to default user roles: removed testing roles and a couple uncommonly used roles; updated role titles (*MKD*)
5455

56+
5557
## This release includes code contributions from
5658
- ByWater Solutions
5759
- Mark Noble (MDN)
5860
- Kirstin Kroeger (KK)
5961
- Kodi Lein (KL)
6062
- Liz Rea (LR)
6163
- Morgan Daigneault (MKD)
64+
65+
- PTFS Europe
66+
- Alexander Blanchard (AB)
67+
- Jacob O'Mara (JO)
68+
69+
70+

code/web/sys/DBMaintenance/summon_updates.php

+7
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,12 @@ function getSummonUpdates() {
8484
'ALTER TABLE library ADD COLUMN summonApiPassword VARCHAR(50)',
8585
],
8686
],
87+
'add_book_cover_display_control_in_library_settings' => [
88+
'title' => 'Display Available Book Covers in Summon',
89+
'description' => 'Whether to display available book covers in Summon Searcher',
90+
'sql' => [
91+
"ALTER TABLE library ADD COLUMN showAvailableCoversInSummon TINYINT(1) DEFAULT 0",
92+
],
93+
],
8794
];
8895
}

code/web/sys/DBMaintenance/version_updates/24.06.00.php

+17
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,26 @@ function getUpdates24_06_00(): array {
6363
"ALTER TABLE ebsco_eds_settings ADD COLUMN fullTextLimiter TINYINT NOT NULL DEFAULT 1;",
6464
],
6565
], //full_text_limiter
66+
//alexander - PTFS Europe
67+
'summon_ip_addresses' => [
68+
'title' => 'Summon IP address configuration',
69+
'description' => 'Allow configuration of which IP addresses should automatically authenticate with Summon',
70+
'continueOnError' => true,
71+
'sql' => [
72+
'ALTER TABLE ip_lookup ADD COLUMN authenticatedForSummon TINYINT DEFAULT 0',
73+
]
74+
], //summon authentication
75+
'explore_more_section_control' => [
76+
'title' => 'Explore More Section Control',
77+
'description' => 'Allow control over whether the Explore More Section is displayed',
78+
'sql' => [
79+
"ALTER TABLE layout_settings ADD COLUMN showExploreMoreOptions TINYINT DEFAULT '1'",
80+
]
81+
],//control_whether_the_explore_more_box_is_displayed
6682

6783
//other
6884

6985

86+
7087
];
7188
}

code/web/sys/ExploreMore.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ public function loadSummonOptions($activeSection, $exploreMoreOptions, $searchTe
733733
global $enabledModules;
734734
if (!empty($searchTerm) && array_key_exists('Summon', $enabledModules) && $library->summonSettingsId != -1 && $activeSection != 'summon') {
735735
//Load Summon Options
736-
/** @var Search_Object_SummonSearcher $summonSearcher */
736+
/** @var SearchObject_SummonSearcher $summonSearcher */
737737
$summonSearcher = SearchObjectFactory::initSearchObject('Summon');
738738
$summonSearcher->setSearchTerms([
739739
'lookfor' => $searchTerm,
@@ -745,9 +745,9 @@ public function loadSummonOptions($activeSection, $exploreMoreOptions, $searchTe
745745
$numMatches = $summonResults['recordCount'];
746746
if ($numMatches > 1) {
747747
if ($appliedTheme != null && !empty($appliedTheme->articlesDBImage)) {
748-
//TODO path to image files
748+
$image = '/files/origional/' . $appliedTheme->articlesDBImage;
749749
} else {
750-
//TODO inset path to default image
750+
$image = '/interface/themes/responsive/images/summon.png';
751751
}
752752
$exploreMoreOptions['searchLinks'][] = [
753753
'label' => translate([
@@ -760,8 +760,8 @@ public function loadSummonOptions($activeSection, $exploreMoreOptions, $searchTe
760760
1 => $searchTerm,
761761
'isPublicFacing' => true,
762762
]),
763-
//'image' => $image,
764-
//'link' => TODO,
763+
'image' => $image,
764+
'link' => '/Summon/Results?lookfor=' . urlencode($searchTerm),
765765
'openInNewWindow' => false,
766766
];
767767
}

code/web/sys/Interface.php

+1
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ function loadDisplayOptions($fromBookCoverProcessing = false) {
747747
$this->assign('showDisplayNameInHeader', $library->showDisplayNameInHeader);
748748
$this->assign('externalMaterialsRequestUrl', $library->externalMaterialsRequestUrl);
749749
$this->assign('languageAndDisplayInHeader', $library->languageAndDisplayInHeader);
750+
$this->assign('showExploreMoreOptions', $library->getLayoutSettings()->showExploreMoreOptions);
750751

751752
if ($location != null) {
752753
$this->assign('showDisplayNameInHeader', $location->showDisplayNameInHeader);

code/web/sys/LibraryLocation/Library.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ class Library extends DataObject {
357357

358358
//Summon Settings
359359
public $summonSettingsId;
360+
public $showAvailableCoversInSummon;
360361

361362
//SSO
362363
public /** @noinspection PhpUnused */
@@ -3703,7 +3704,6 @@ static function getObjectStructure($context = ''): array {
37033704
'label' => 'Summon',
37043705
'hideInLists' => true,
37053706
'renderAsHeading' => true,
3706-
// 'permissions' => ['A'],
37073707
'properties' => [
37083708
'summonSettingsId' => [
37093709
'property' => 'summonSettingsId',
@@ -3714,6 +3714,14 @@ static function getObjectStructure($context = ''): array {
37143714
'hideInLists' => true,
37153715
'default' => -1,
37163716
],
3717+
'showAvailableCoversInSummon' => [
3718+
'property' => 'showAvailableCoversInSummon',
3719+
'type' => 'checkbox',
3720+
'label' => 'Show Available Covers in Summon',
3721+
'description' => 'Determine whether or not available book covers should be displayed in Summon',
3722+
'hideInLists' => true,
3723+
'default' => 0,
3724+
],
37173725
],
37183726
],
37193727

@@ -4951,6 +4959,7 @@ public function getApiInfo(): array {
49514959
'passwordLabel' => $this->loginFormPasswordLabel ?? 'Library Card Number',
49524960
'code' => $this->ilsCode,
49534961
'finePaymentType' => (int)$this->finePaymentType,
4962+
'showAvailableCoversInSummon' => $this->showAvailableCoversInSummon,
49544963
];
49554964
if (empty($this->baseUrl)) {
49564965
$apiInfo['baseUrl'] = $configArray['Site']['url'];

code/web/sys/SearchObject/SummonSearcher.php

+82-6
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ class SearchObject_SummonSearcher extends SearchObject_BaseSearcher{
4141
protected $searchType = 'basic';
4242

4343
/** Values for the options array*/
44-
protected $holdings = false;
44+
protected $holdings = true;
4545
protected $didYouMean = false;
4646
protected $language = 'en';
4747
protected $idsToFetch = array();
4848
/**@var int */
4949
protected $maxTopics = 1;
5050
protected $groupFilters = array();
51-
protected $rangeFilters = array();
5251
protected $openAccessFilter = false;
5352
protected $expand = false;
5453
protected $sortOptions = array();
@@ -58,6 +57,7 @@ class SearchObject_SummonSearcher extends SearchObject_BaseSearcher{
5857
protected $defaultSort = 'relevance';
5958
protected $query;
6059
protected $filters = array();
60+
protected $rangeFilters = array();
6161

6262
/**
6363
* @var int
@@ -92,6 +92,18 @@ class SearchObject_SummonSearcher extends SearchObject_BaseSearcher{
9292
'SourceType,or,1,30',
9393
];
9494

95+
protected $limits = [
96+
'IsPeerReviewed,or,1,30',
97+
'IsScholarly,or,1,30',
98+
];
99+
100+
protected $rangeFacets = [
101+
];
102+
103+
protected $limitList = [];
104+
protected $limitFields;
105+
106+
95107
protected $facetFields;
96108

97109
public function __construct() {
@@ -233,13 +245,15 @@ public function getOptions () {
233245
//Fetch specific records
234246
's.fids' =>$this->idsToFetch,
235247
//Side facets to filter by
236-
's.ff' =>$this->facets,
248+
's.ff' =>array_merge($this->facets, $this->limits),
237249
//Filters that are active - from side facets
238250
's.fvf' => $this->getSummonFilters(),
239251
//Default 1
240252
's.rec.topic.max' => $this->maxTopics,
241253
//Filters
242254
's.fvgf' => $this->groupFilters,
255+
//Range Facets
256+
's.rff' => $this->rangeFacets,
243257
//Filters
244258
's.rf' => $this->rangeFilters,
245259
//Order results
@@ -275,9 +289,28 @@ public function processData($recordData) {
275289
$this->page = $recordData['query']['pageNumber'];
276290
$this->resultsTotal = $recordData['recordCount'];
277291
$this->filters = $recordData['query']['facetValueFilters'];
278-
$this->facetFields= $recordData['facetFields'];
292+
$splitFacets = $this->splitFacets($recordData['facetFields']);
293+
$this->facetFields = $splitFacets['facetFields'];
294+
$this->limitFields = $splitFacets['limitFields'];
279295
}
280-
return $recordData;
296+
return $recordData;
297+
}
298+
299+
public function splitFacets($combinedFacets) {
300+
$splitFacets = [];
301+
foreach($combinedFacets as $facet) {
302+
foreach ($this->facets as $facetName) {
303+
if (strpos($facetName, $facet['displayName']) !== false) {
304+
$splitFacets['facetFields'][] = $facet;
305+
}
306+
}
307+
foreach ($this->limits as $limitName) {
308+
if (strpos($limitName, $facet['displayName']) !== false) {
309+
$splitFacets['limitFields'][] = $facet;
310+
}
311+
}
312+
}
313+
return $splitFacets;
281314
}
282315

283316
/**
@@ -428,7 +461,6 @@ public function renderLinkWithSort($newSort) {
428461
*/
429462
public function getFacetSet() {
430463
$availableFacets = [];
431-
$label = '';
432464
$this->filters = [];
433465
if (isset($this->facetFields)) {
434466
foreach ($this->facetFields as $facetField) {
@@ -445,6 +477,11 @@ public function getFacetSet() {
445477
if ($facetId == 'ContentType') {
446478
$availableFacets[$facetId]['collapseByDefault'] = false;
447479
}
480+
481+
if ($facetId == 'IsScholarly' || $facetId == 'IsPeerReviewed') {
482+
$availableFacets[$facetId]['multiSelect'] = false;
483+
}
484+
448485
$list = [];
449486
foreach ($facetField['counts'] as $value) {
450487
$facetValue = $value['value'];
@@ -469,6 +506,41 @@ public function getFacetSet() {
469506
return $availableFacets;
470507
}
471508

509+
public function getLimitList() {
510+
511+
$availableLimits=[];
512+
if (isset($this->limitFields)){
513+
foreach($this->limitFields as $limitOption){
514+
$limitId = $limitOption['displayName'];
515+
$parts = preg_split('/(?=[A-Z])/', $limitId, -1, PREG_SPLIT_NO_EMPTY);
516+
$displayName = implode(' ', $parts);
517+
518+
foreach($limitOption['counts'] as $value){
519+
if ($value['value'] == 'true') {
520+
$availableLimits[$limitId] = [
521+
'display' => $displayName,
522+
'value' => $limitId,
523+
'isApplied' => ($this->limiters[$limitId]) == 'y' ? 1 : 0,
524+
'url' => $this->renderLinkWithLimiter($limitId),
525+
'removalUrl' => $this->renderLinkWithoutLimiter($limitId),
526+
];
527+
}
528+
}
529+
530+
}
531+
}
532+
return $availableLimits;
533+
}
534+
535+
public function createSearchLimits() {
536+
foreach ($this->limiters as $limiter => $limiterOptions) {
537+
if ($this->limiters[$limiter] == 'y') {
538+
$this->limitList[$limiter] = $limiterOptions;
539+
}
540+
}
541+
return $this->limitList;
542+
}
543+
472544
//Retreive a specific record - used to retreive bookcovers
473545
public function retrieveRecord ($id) {
474546
$baseUrl = $this->summonBaseApi . '/' .$this->version . '/' .$this->service;
@@ -484,6 +556,10 @@ public function retrieveRecord ($id) {
484556
//Compile filter options chosen in side facets and add to filter array to be passed in via options array
485557
public function getSummonFilters() {
486558
$this->filters = array();
559+
$this->createSearchLimits();
560+
if (isset($this->limitList) && isset($this->filterList)) {
561+
$this->filterList = array_merge($this->limitList, $this->filterList);
562+
}
487563
foreach ($this->filterList as $key => $value) {
488564
if (is_array($value)) {
489565
foreach ($value as $val) {

0 commit comments

Comments
 (0)