Skip to content

Commit 7b19037

Browse files
Merge pull request #42 from Jacobomara901/socialMediaLinksGranularity
Social media links granularity
2 parents 4bdfe24 + d41927e commit 7b19037

File tree

12 files changed

+117
-35
lines changed

12 files changed

+117
-35
lines changed

code/web/interface/themes/responsive/EBSCO/share-tools.tpl

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
{if $showEmailThis == 1}
66
{/if}
77
{if !empty($showShareOnExternalSites)}
8-
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Share on Facebook" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
8+
{if !empty($sharerLinkFacebook)}
9+
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}">
910
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
1011
</a>
11-
12-
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Pin on Pinterest" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
12+
{/if}
13+
{if !empty($sharerLinkPinterest)}
14+
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}">
1315
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
1416
</a>
17+
{/if}
1518
{/if}
1619
</div>
1720
{/if}
18-
{/strip}
21+
{/strip}

code/web/interface/themes/responsive/EBSCOhost/share-tools.tpl

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
{if $showEmailThis == 1}
66
{/if}
77
{if !empty($showShareOnExternalSites)}
8-
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Share on Facebook" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
8+
{if !empty($sharerLinkFacebook)}
9+
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}">
910
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
1011
</a>
11-
12-
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Pin on Pinterest" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
12+
{/if}
13+
{if !empty($sharerLinkPinterest)}
14+
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}">
1315
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
1416
</a>
17+
{/if}
1518
{/if}
1619
</div>
1720
{/if}
18-
{/strip}
21+
{/strip}

code/web/interface/themes/responsive/Events/share-tools.tpl

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
<div class="share-tools">
44
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
55
{if !empty($showShareOnExternalSites)}
6-
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$eventUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true}" aria-label="{translate text="Share on Facebook" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
6+
{if !empty($sharerLinkFacebook)}
7+
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$eventUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true}" aria-label="Share on Facebook">
78
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
89
</a>
9-
10-
<a href="http://www.pinterest.com/pin/create/button/?url={$eventUrl}&media={$recordDriver->getBookcoverUrl('large', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Pin on Pinterest" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
10+
{/if}
11+
{if !empty($sharerLinkPinterest)}
12+
<a href="http://www.pinterest.com/pin/create/button/?url={$eventUrl}&media={$recordDriver->getBookcoverUrl('large', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}">
1113
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
1214
</a>
15+
{/if}
1316
{/if}
1417
</div>
1518
{/if}
16-
{/strip}
19+
{/strip}

code/web/interface/themes/responsive/Genealogy/share-tools.tpl

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
<div class="share-tools">
44
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
55
{if !empty($showShareOnExternalSites)}
6-
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Share on Facebook" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
6+
{if !empty($sharerLinkFacebook)}
7+
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}">
78
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
89
</a>
9-
10-
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Pin on Pinterest" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
10+
{/if}
11+
{if !empty($sharerLinkPinterest)}
12+
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}">
1113
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
1214
</a>
15+
{/if}
1316
{/if}
1417
</div>
1518
{/if}
16-
{/strip}
19+
{/strip}

code/web/interface/themes/responsive/GroupedWork/share-tools.tpl

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@
88
</a>
99
{/if}
1010
{if !empty($showShareOnExternalSites)}
11-
<a href="https://twitter.com/intent/tweet?text={$recordDriver->getTitle()|urlencode}+{$url}/GroupedWork/{$recordDriver->getPermanentId()}/Home" target="_blank" title="{translate text="Share on Twitter" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Share on Twitter" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
11+
{if !empty($sharerLinkTwitter)}
12+
<a href="https://twitter.com/intent/tweet?text={$recordDriver->getTitle()|urlencode}+{$url}/GroupedWork/{$recordDriver->getPermanentId()}/Home" target="_blank" title="{translate text="Share on Twitter" inAttribute=true isPublicFacing=true}">
1213
<i class="fab fa-twitter-square fa-2x fa-fw"></i>
1314
</a>
14-
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Share %1%, by %2% on Facebook" 1=$recordDriver->getTitle()|escapeCSS 2=$recordDriver->getTitle()|escapeCSS inAttribute=true isPublicFacing=true translateParameters=false} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
15+
{/if}
16+
{if !empty($sharerLinkFacebook)}
17+
<a href="http://www.facebook.com/sharer/sharer.php?u={$url}/{$recordDriver->getLinkUrl()|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true}" aria-label="Share {$recordDriver->getTitle()|escapeCSS}, by {$recordDriver->getPrimaryAuthor()|escape} on Facebook">
1518
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
1619
</a>
17-
18-
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Pin %1%, by %2% on Pinterest" 1=$recordDriver->getTitle()|escapeCSS 2=$recordDriver->getTitle()|escapeCSS inAttribute=true isPublicFacing=true translateParameters=false} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
20+
{/if}
21+
{if !empty($sharerLinkPinterest)}
22+
<a href="http://www.pinterest.com/pin/create/button/?url={$url}/{$recordDriver->getLinkUrl()}&media={$url}{$recordDriver->getBookcoverUrl('large')}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true}" aria-label="Pin {$recordDriver->getTitle()|escapeCSS}, by {$recordDriver->getPrimaryAuthor()|escape} on Pinterest">
1923
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
2024
</a>
25+
{/if}
2126
{/if}
2227
</div>
2328
{/if}
24-
{/strip}
29+
{/strip}

code/web/interface/themes/responsive/Lists/share-tools.tpl

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
<div class="share-tools">
44
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
55
{if !empty($showShareOnExternalSites)}
6-
<a href="http://www.facebook.com/sharer/sharer.php?u={$recordUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Share on Facebook" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
6+
{if !empty($sharerLinkFacebook)}
7+
<a href="http://www.facebook.com/sharer/sharer.php?u={$recordUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}">
78
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
89
</a>
9-
10-
<a href="http://www.pinterest.com/pin/create/button/?url={$recordUrl}&media={$recordDriver->getBookcoverUrl('medium', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text="Pin on Pinterest" isPublicFacing=true inAttribute=true} ({translate text="opens in a new window" isPublicFacing=true inAttribute=true})">
10+
{/if}
11+
{if !empty($sharerLinkPinterest)}
12+
<a href="http://www.pinterest.com/pin/create/button/?url={$recordUrl}&media={$recordDriver->getBookcoverUrl('medium', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}">
1113
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
1214
</a>
15+
{/if}
1316
{/if}
1417
</div>
1518
{/if}
16-
{/strip}
19+
{/strip}

code/web/interface/themes/responsive/OpenArchives/share-tools.tpl

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
<div class="share-tools">
44
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
55
{if !empty($showShareOnExternalSites)}
6-
<a href="http://www.facebook.com/sharer/sharer.php?u={$openArchiveUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}" aria-label="{translate text='Share on Facebook' isPublicFacing=true inAttribute=true} ({translate text='opens in new window' isPublicFacing=true inAttribute=true})">
6+
{if !empty($sharerLinkFacebook)}
7+
<a href="http://www.facebook.com/sharer/sharer.php?u={$openArchiveUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}">
78
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
89
</a>
9-
10-
<a href="http://www.pinterest.com/pin/create/button/?url={$openArchiveUrl}&media={$recordDriver->getBookcoverUrl('medium', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text='Pin on Pinterest' isPublicFacing=true inAttribute=true} ({translate text='opens in new window' isPublicFacing=true inAttribute=true})">
10+
{/if}
11+
{if !empty($sharerLinkPinterest)}
12+
<a href="http://www.pinterest.com/pin/create/button/?url={$openArchiveUrl}&media={$recordDriver->getBookcoverUrl('medium', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}">
1113
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
1214
</a>
15+
{/if}
1316
{/if}
1417
</div>
1518
{/if}
16-
{/strip}
19+
{/strip}

code/web/interface/themes/responsive/Websites/share-tools.tpl

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
<div class="share-tools">
44
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
55
{if !empty($showShareOnExternalSites)}
6-
<a href="http://www.facebook.com/sharer/sharer.php?u={$pageUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}" aria-label="{translate text='Share on Facebook' isPublicFacing=true} ({translate text='opens in new window' isPublicFacing=true})">
6+
{if !empty($sharerLinkFacebook)}
7+
<a href="http://www.facebook.com/sharer/sharer.php?u={$pageUrl|escape:'url'}" target="_blank" title="{translate text="Share on Facebook" inAttribute=true isPublicFacing=true}">
78
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
89
</a>
9-
10-
<a href="http://www.pinterest.com/pin/create/button/?url={$pageUrl}&media={$recordDriver->getBookcoverUrl('medium', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}" aria-label="{translate text='Pin on Pinterest' isPublicFacing=true} ({translate text='opens in new window' isPublicFacing=true})">
10+
{/if}
11+
{if !empty($sharerLinkPinterest)}
12+
<a href="http://www.pinterest.com/pin/create/button/?url={$pageUrl}&media={$recordDriver->getBookcoverUrl('medium', true)}&description=Pin%20on%20Pinterest" target="_blank" title="{translate text="Pin on Pinterest" inAttribute=true isPublicFacing=true}">
1113
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
1214
</a>
15+
{/if}
1316
{/if}
1417
</div>
1518
{/if}
16-
{/strip}
19+
{/strip}

code/web/release_notes/24.05.00.MD

+3
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@
121121
### Data Protection Updates
122122
- Fixed issue where Cookie Consent banner would not disappear while not logged in, regardless of cookie preferences. (JOM)
123123

124+
### Other Updates
125+
- Allow individual sharer links to be enabled/disabled granularly. (*JOM*)
126+
124127

125128
## This release includes code contributions from
126129
- ByWater Solutions

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,19 @@ function getUpdates24_05_00(): array {
8080
'sql' => [
8181
'ALTER TABLE library ADD COLUMN allowMasqueradeWithUsername TINYINT NOT NULL DEFAULT 1',
8282
]
83-
]
83+
],
8484
//other
85+
//jacob - PTFS Europe
86+
'granularShareLinks' => [
87+
'title' => 'Ability to enable/disable share links per external share site',
88+
'description' => 'Add the ability to enable/disable the sharing links for individual lites (facebook/twitter etc.)',
89+
'continueOnError' => true,
90+
'sql' => [
91+
'ALTER TABLE library ADD COLUMN sharerLinkFacebook TINYINT(1) DEFAULT 1',
92+
'ALTER TABLE library ADD COLUMN sharerLinkPinterest TINYINT(1) DEFAULT 1',
93+
'ALTER TABLE library ADD COLUMN sharerLinkTwitter TINYINT(1) DEFAULT 1',
94+
]
95+
],
8596

8697

8798
];

code/web/sys/Interface.php

+6
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ function loadDisplayOptions($fromBookCoverProcessing = false) {
643643
$this->assign('showEmailThis', $location->showEmailThis && $library->showEmailThis);
644644
$showStaffView = $groupedWorkDisplaySettings->showStaffView;
645645
$this->assign('showShareOnExternalSites', $location->showShareOnExternalSites && $library->showShareOnExternalSites);
646+
$this->assign('sharerLinkTwitter', $library->sharerLinkTwitter);
647+
$this->assign('sharerLinkFacebook', $library->sharerLinkFacebook);
648+
$this->assign('sharerLinkPinterest', $library->sharerLinkPinterest);
646649
$this->assign('showGoodReadsReviews', $groupedWorkDisplaySettings->showGoodReadsReviews);
647650
$showHoldButton = (($location->showHoldButton == 1) && ($library->showHoldButton == 1)) ? 1 : 0;
648651
$showHoldButtonInSearchResults = (($location->showHoldButton == 1) && ($library->showHoldButtonInSearchResults == 1)) ? 1 : 0;
@@ -659,6 +662,9 @@ function loadDisplayOptions($fromBookCoverProcessing = false) {
659662
$this->assign('showComments', $groupedWorkDisplaySettings->showComments);
660663
$this->assign('showEmailThis', $library->showEmailThis);
661664
$this->assign('showShareOnExternalSites', $library->showShareOnExternalSites);
665+
$this->assign('sharerLinkTwitter', $library->sharerLinkTwitter);
666+
$this->assign('sharerLinkFacebook', $library->sharerLinkFacebook);
667+
$this->assign('sharerLinkPinterest', $library->sharerLinkPinterest);
662668
$showStaffView = $library->getGroupedWorkDisplaySettings()->showStaffView;
663669
$this->assign('showSimilarTitles', $groupedWorkDisplaySettings->showSimilarTitles);
664670
$this->assign('showSimilarAuthors', $groupedWorkDisplaySettings->showSimilarAuthors);

code/web/sys/LibraryLocation/Library.php

+37-1
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ class Library extends DataObject {
265265
public /** @noinspection PhpUnused */
266266
$showLibraryHoursNoticeOnAccountPages;
267267
public $showShareOnExternalSites;
268+
public $sharerLinkFacebook;
269+
public $sharerLinkPinterest;
270+
public $sharerLinkTwitter;
268271
public /** @noinspection PhpUnused */
269272
$barcodePrefix;
270273
public $libraryCardBarcodeStyle;
@@ -3069,6 +3072,39 @@ static function getObjectStructure($context = ''): array {
30693072
'hideInLists' => true,
30703073
'default' => 1,
30713074
],
3075+
'sharerLinksSection' => [
3076+
'property' => 'sharerLinksSection',
3077+
'type' => 'section',
3078+
'label' => 'Share Links To Show',
3079+
'hideInLists' => true,
3080+
'permissions' =>['Library Catalog Options'],
3081+
'properties' => [
3082+
'sharerLinkTwitter' => [
3083+
'property' => 'sharerLinkTwitter',
3084+
'type' => 'checkbox',
3085+
'label' => 'Show Sharing Link To Twitter',
3086+
'description' => 'Whether or not sharing on Twitter is shown',
3087+
'hideInLists' => true,
3088+
'default' => 1,
3089+
],
3090+
'sharerLinkFacebook' => [
3091+
'property' => 'sharerLinkFacebook',
3092+
'type' => 'checkbox',
3093+
'label' => 'Show Sharing Link To Facebook',
3094+
'description' => 'Whether or not sharing on Facebook is shown',
3095+
'hideInLists' => true,
3096+
'default' => 1,
3097+
],
3098+
'sharerLinkPinterest' => [
3099+
'property' => 'sharerLinkPinterest',
3100+
'type' => 'checkbox',
3101+
'label' => 'Show Sharing Link To Pinterest',
3102+
'description' => 'Whether or not sharing on Pinterest is shown',
3103+
'hideInLists' => true,
3104+
'default' => 1,
3105+
],
3106+
],
3107+
],
30723108
],
30733109
],
30743110

@@ -5170,4 +5206,4 @@ public function loadCopyableSubObjects() {
51705206
}
51715207
}
51725208
}
5173-
}
5209+
}

0 commit comments

Comments
 (0)