Skip to content

Commit

Permalink
Merge pull request #42 from Jacobomara901/socialMediaLinksGranularity
Browse files Browse the repository at this point in the history
Social media links granularity
  • Loading branch information
AlexanderBlanchardAC authored May 1, 2024
2 parents 4bdfe24 + d41927e commit 7b19037
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 35 deletions.
11 changes: 7 additions & 4 deletions code/web/interface/themes/responsive/EBSCO/share-tools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
{if $showEmailThis == 1}
{/if}
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkFacebook)}
<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}">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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}">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
11 changes: 7 additions & 4 deletions code/web/interface/themes/responsive/EBSCOhost/share-tools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
{if $showEmailThis == 1}
{/if}
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkFacebook)}
<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}">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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}">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
11 changes: 7 additions & 4 deletions code/web/interface/themes/responsive/Events/share-tools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<div class="share-tools">
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkFacebook)}
<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">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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}">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
11 changes: 7 additions & 4 deletions code/web/interface/themes/responsive/Genealogy/share-tools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<div class="share-tools">
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkFacebook)}
<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}">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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}">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
15 changes: 10 additions & 5 deletions code/web/interface/themes/responsive/GroupedWork/share-tools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
</a>
{/if}
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkTwitter)}
<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}">
<i class="fab fa-twitter-square fa-2x fa-fw"></i>
</a>
<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})">
{/if}
{if !empty($sharerLinkFacebook)}
<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">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
11 changes: 7 additions & 4 deletions code/web/interface/themes/responsive/Lists/share-tools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<div class="share-tools">
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkFacebook)}
<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}">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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}">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<div class="share-tools">
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkFacebook)}
<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}">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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}">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
11 changes: 7 additions & 4 deletions code/web/interface/themes/responsive/Websites/share-tools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<div class="share-tools">
<span class="share-tools-label hidden-inline-xs">{translate text="SHARE" isPublicFacing=true}</span>
{if !empty($showShareOnExternalSites)}
<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})">
{if !empty($sharerLinkFacebook)}
<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}">
<i class="fab fa-facebook-square fa-2x fa-fw"></i>
</a>

<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})">
{/if}
{if !empty($sharerLinkPinterest)}
<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}">
<i class="fab fa-pinterest-square fa-2x fa-fw"></i>
</a>
{/if}
{/if}
</div>
{/if}
{/strip}
{/strip}
3 changes: 3 additions & 0 deletions code/web/release_notes/24.05.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@
### Data Protection Updates
- Fixed issue where Cookie Consent banner would not disappear while not logged in, regardless of cookie preferences. (JOM)

### Other Updates
- Allow individual sharer links to be enabled/disabled granularly. (*JOM*)


## This release includes code contributions from
- ByWater Solutions
Expand Down
13 changes: 12 additions & 1 deletion code/web/sys/DBMaintenance/version_updates/24.05.00.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,19 @@ function getUpdates24_05_00(): array {
'sql' => [
'ALTER TABLE library ADD COLUMN allowMasqueradeWithUsername TINYINT NOT NULL DEFAULT 1',
]
]
],
//other
//jacob - PTFS Europe
'granularShareLinks' => [
'title' => 'Ability to enable/disable share links per external share site',
'description' => 'Add the ability to enable/disable the sharing links for individual lites (facebook/twitter etc.)',
'continueOnError' => true,
'sql' => [
'ALTER TABLE library ADD COLUMN sharerLinkFacebook TINYINT(1) DEFAULT 1',
'ALTER TABLE library ADD COLUMN sharerLinkPinterest TINYINT(1) DEFAULT 1',
'ALTER TABLE library ADD COLUMN sharerLinkTwitter TINYINT(1) DEFAULT 1',
]
],


];
Expand Down
6 changes: 6 additions & 0 deletions code/web/sys/Interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,9 @@ function loadDisplayOptions($fromBookCoverProcessing = false) {
$this->assign('showEmailThis', $location->showEmailThis && $library->showEmailThis);
$showStaffView = $groupedWorkDisplaySettings->showStaffView;
$this->assign('showShareOnExternalSites', $location->showShareOnExternalSites && $library->showShareOnExternalSites);
$this->assign('sharerLinkTwitter', $library->sharerLinkTwitter);
$this->assign('sharerLinkFacebook', $library->sharerLinkFacebook);
$this->assign('sharerLinkPinterest', $library->sharerLinkPinterest);
$this->assign('showGoodReadsReviews', $groupedWorkDisplaySettings->showGoodReadsReviews);
$showHoldButton = (($location->showHoldButton == 1) && ($library->showHoldButton == 1)) ? 1 : 0;
$showHoldButtonInSearchResults = (($location->showHoldButton == 1) && ($library->showHoldButtonInSearchResults == 1)) ? 1 : 0;
Expand All @@ -659,6 +662,9 @@ function loadDisplayOptions($fromBookCoverProcessing = false) {
$this->assign('showComments', $groupedWorkDisplaySettings->showComments);
$this->assign('showEmailThis', $library->showEmailThis);
$this->assign('showShareOnExternalSites', $library->showShareOnExternalSites);
$this->assign('sharerLinkTwitter', $library->sharerLinkTwitter);
$this->assign('sharerLinkFacebook', $library->sharerLinkFacebook);
$this->assign('sharerLinkPinterest', $library->sharerLinkPinterest);
$showStaffView = $library->getGroupedWorkDisplaySettings()->showStaffView;
$this->assign('showSimilarTitles', $groupedWorkDisplaySettings->showSimilarTitles);
$this->assign('showSimilarAuthors', $groupedWorkDisplaySettings->showSimilarAuthors);
Expand Down
38 changes: 37 additions & 1 deletion code/web/sys/LibraryLocation/Library.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ class Library extends DataObject {
public /** @noinspection PhpUnused */
$showLibraryHoursNoticeOnAccountPages;
public $showShareOnExternalSites;
public $sharerLinkFacebook;
public $sharerLinkPinterest;
public $sharerLinkTwitter;
public /** @noinspection PhpUnused */
$barcodePrefix;
public $libraryCardBarcodeStyle;
Expand Down Expand Up @@ -3069,6 +3072,39 @@ static function getObjectStructure($context = ''): array {
'hideInLists' => true,
'default' => 1,
],
'sharerLinksSection' => [
'property' => 'sharerLinksSection',
'type' => 'section',
'label' => 'Share Links To Show',
'hideInLists' => true,
'permissions' =>['Library Catalog Options'],
'properties' => [
'sharerLinkTwitter' => [
'property' => 'sharerLinkTwitter',
'type' => 'checkbox',
'label' => 'Show Sharing Link To Twitter',
'description' => 'Whether or not sharing on Twitter is shown',
'hideInLists' => true,
'default' => 1,
],
'sharerLinkFacebook' => [
'property' => 'sharerLinkFacebook',
'type' => 'checkbox',
'label' => 'Show Sharing Link To Facebook',
'description' => 'Whether or not sharing on Facebook is shown',
'hideInLists' => true,
'default' => 1,
],
'sharerLinkPinterest' => [
'property' => 'sharerLinkPinterest',
'type' => 'checkbox',
'label' => 'Show Sharing Link To Pinterest',
'description' => 'Whether or not sharing on Pinterest is shown',
'hideInLists' => true,
'default' => 1,
],
],
],
],
],

Expand Down Expand Up @@ -5170,4 +5206,4 @@ public function loadCopyableSubObjects() {
}
}
}
}
}

0 comments on commit 7b19037

Please sign in to comment.