From 251c95f998b7ddd5b49cc658a43acec5eafdef39 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 11 Oct 2019 18:32:19 +0000 Subject: [PATCH] Bug 23791: Allow granular control of social networks enabled by SocialNetworks syspref This patch updates the SocialNetworks system preference so that it offers a choice of social networks (and email) which can be enabled in the OPAC. This patch also replaces the social network images with Font Awesome icons styled so that the colors match the social networks' current branding. The old social networks sprite image is removed. To test, apply the patch and run the database update. Rebuild the OPAC CSS: https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client - Go to Administration -> Global system preferences -> OPAC -> Features and find the SocialNetworks preference. - If your SocialNetworks preference was enabled, all choices should be selected. Otherwise none should be selected. - If none are selected, select them all and save. - Locate a record in the OPAC and view the details page. - The social network icons should appear as expected and function as before. - Return to system preferences in the staff client and try enabling and disabling different options, verifying each time that the OPAC reflects your choices. --- .../bug_23791-opac-social-network-selection.perl | 14 ++++++++++++++ .../prog/en/modules/admin/preferences/opac.pref | 11 +++++++---- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 21 +++++++++++++++------ .../opac-tmpl/bootstrap/images/social-sprite.png | Bin 2802 -> 0 bytes 4 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23791-opac-social-network-selection.perl delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/images/social-sprite.png diff --git a/installer/data/mysql/atomicupdate/bug_23791-opac-social-network-selection.perl b/installer/data/mysql/atomicupdate/bug_23791-opac-social-network-selection.perl new file mode 100644 index 0000000000..46d6a04d7d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23791-opac-social-network-selection.perl @@ -0,0 +1,14 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + my ($socialnetworks) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='socialnetworks'; + |); + if( $socialnetworks ){ + # If the socialnetworks preference is enabled, enable all social networks + $dbh->do("UPDATE systempreferences SET value = 'email,facebook,linkedin,twitter', explanation = 'email|facebook|linkedin|twitter', type = 'multiple' WHERE variable = 'SocialNetworks'"); + } else { + $dbh->do("UPDATE systempreferences SET value = '', explanation = 'email|facebook|linkedin|twitter', type = 'multiple' WHERE variable = 'SocialNetworks'"); + } + SetVersion ($DBversion); + print "Upgrade to $DBversion done (Bug 22880: Move contents of socialnetworks preference to Koha news system)\n"; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 0ffe05b44d..8d00e78155 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -487,11 +487,14 @@ OPAC: class: long - search results in the RSS feed. - + - Show - pref: SocialNetworks - default: 0 - choices: - yes: Enable - no: Disable + multiple: + facebook: Facebook + linkedin: LinkedIn + email: Email + twitter: Twitter + - social network links in opac detail pages - - pref: OpacBrowseResults diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index ca0f5f3f2d..08b1c1d936 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1152,15 +1152,24 @@ [% END %] - [% IF ( SocialNetworks ) %] + [% IF ( Koha.Preference('SocialNetworks') ) %]
Share -
Facebook
-
LinkedIn
-
Email
-
+ [% SET SocialNetworks = Koha.Preference('SocialNetworks') %] + [% FOREACH network IN SocialNetworks.split(",") %] + [% SWITCH network -%] + [% CASE "facebook" -%] +
+ [% CASE "linkedin" -%] +
+ [% CASE "email" -%] +
+ [% CASE "twitter" -%] +
+ [% END -%] + [% END %]
- [% END %] + [% END # /IF SocialNetworks %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/images/social-sprite.png b/koha-tmpl/opac-tmpl/bootstrap/images/social-sprite.png deleted file mode 100644 index 63d6b74b31cd5d37dfced08b0e918e65c48a5402..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2802 zcmd^BX;c$g8Z8nU5k-T>1+f`KK^CzU8wZ?5mL_dj#UvmqA|RkP3W^Nk$Ou6Yh$tok zii(mzSOX#m2w@WlghdE~4aTs9orFLL5fYYUD#3G{K683ze$2nAbLv&ScfR`GefPWf zI~C{bbWBxchYA1ysx|0WWN-ZisIK78sK9GVxeMD|MTqsWgkTI#3xlV60{#SNzD z$CqE1a2KVKwB}F4Q-UvxX4ey`9~Z<+D_MPmZQabjrgVyzrDRGap^APpr;a%^eEwF^ zh5XludI@WiH_Dwm9hCFDsGQ1}+TipSzec=KX5n;nU{Rd@Fed?=cJ&!Z$i^6)zs8d^V%+k6>Qib zVf7DpejLTWsEnly8B-;`d9RF&jNId!%gV|${RnBK4Bni`JE3i}3zj=Ax{a@J!58=T zarOtNYPd%~BGMA`spz{jb8MCmG2JsWmoq(AI5g^#QXyDaeom&=*ViM?J-$pcI zkc&g&O5fGBC$x2Nx!i_nsZhLBIXUGVPw$%)-+J&?_k1jsBhfq={*su%==uzIi|&}2 zCDu$%f02w$iwCA8yZw{*+YyT1&#IrqKFw}y<4YfAm3Fc@A3m})HOFc{4wh86Z*j+& z#k>XpXUm0{}{wZEdVDp-gYlaYaB`OUWCqpa?sG z10b<_2tdImQ9AqG z6ZQITW)@#(d21;^a*sWfC9}pOn6m{m3ybg>J9{pNGZY@10p@xL7i;XeUDG0rIn>_D zU=*%91@5v--`mSeTmUx--hKW_dzfTlW~Q4?U!u!k*{VVB_*vQ=?7Eld58b|9n~aws zBWOE18WLZgpwVb2)~wX~D<4Yk11V!wF2b&CiVxZtbJI^hxaR*6oXI-%37pN z-~Tg@Hu?~7?LX4}`!HqO6XWUbrrBLqGE~ZlB7aOT+cMhxds{iC(Vma*bD&tWz`e&` z)K{plE?%KWMK*JSf+&IAt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