From c5bd3545aa4f17fec4c2c5e5128c50339f790e5d Mon Sep 17 00:00:00 2001 From: Martin Persson Date: Tue, 1 Sep 2015 00:37:18 +0200 Subject: [PATCH] Bug 14764: OPAC news selector Adds the new system preference to the pref and SQL files. Bug 14764: OPAC news selector - Atomic update SQL Adds an SQL file to perform the database upgrade. Bug 14764: OPAC news selector - Template tags Test plan: 1) Add more than one library, at least two in total is needed. Make note of which is your current user's home branch. 2) Go to Tools -> News and add one global ("All") news item and one specific for each branch. 3) Apply the patches. 4) Perform database upgrades when you log in. 5) Go to OPAC main, it should work as before: Showing global news as well as the news for your home branch once logged in. 6) Go to System Preferences -> OPAC and set 'OPACNewsBranchSelect' to yes. 7) Go to OPAC main, you should see the global news item plus any items for your home branch for the current user if logged in. 8) Above the news, you will see a dropdown that lists the branches. Select one, and click "Change library." 9) You should now see global news and the news for the selected branch, regardless of whether logged in or not. Sponsored-By: Halland County Library Fixes QA comments: * Keep the current selected branch selected * Change OPACNewsBranchSelect -> OPACNewsLibrarySelect * fix 'all libraries' view for logged in user - note that I've gotten rid of "system wide news" in favour of "all libraries." It's terminology, whatever you think is best. --- .../add_opacnewsbranchselect_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/opac.pref | 8 +++++++ .../bootstrap/en/includes/opac-bottom.inc | 8 +++++++ .../opac-tmpl/bootstrap/en/modules/opac-main.tt | 27 ++++++++++++++++++++-- opac/opac-main.pl | 3 +++ 6 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/add_opacnewsbranchselect_syspref.sql diff --git a/installer/data/mysql/atomicupdate/add_opacnewsbranchselect_syspref.sql b/installer/data/mysql/atomicupdate/add_opacnewsbranchselect_syspref.sql new file mode 100644 index 0000000..ee9eb62 --- /dev/null +++ b/installer/data/mysql/atomicupdate/add_opacnewsbranchselect_syspref.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES('OPACNewsLibrarySelect', '0', '', 'Show selector for branches on OPAC news page', 'YesNo'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 7c69940..9fbb961 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -286,6 +286,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'), ('OCLCAffiliateID','','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','free'), ('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'), +('OPACNewsBranchSelect','0','','Show selector for branches on OPAC news page','YesNo'), ('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'), ('OpacAdvSearchMoreOptions','pubdate,itemtype,language,subtype,sorting,location','Show search options for the expanded view (More options)','pubdate|itemtype|language|subtype|sorting|location','multiple'), ('OpacAdvSearchOptions','pubdate,itemtype,language,sorting,location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple'), 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 62aaeff..49a4e36 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 @@ -503,6 +503,14 @@ OPAC: no: Don't display - the acquisition details on OPAC detail pages. - + - pref: OPACNewsLibrarySelect + default: 0 + choices: + yes: Display + no: Don't display + - a branch selection list for news items in the OPAC. + Policy: + - - "Use the following as the OPAC ISBD template:" - pref: OPACISBD type: textarea diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index 1a13370..a6c18d0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -267,6 +267,14 @@ $.widget.bridge('uitooltip', $.ui.tooltip); [% END # / IF persona %] +[% IF Koha.Preference( 'OpacNewsLibrarySelect' ) == 1 %] + +[% END %] +