Bug 22318: Example implementation: OpacNavRight system preference
authorOwen Leonard <oleonard@myacpl.org>
Thu, 14 Feb 2019 15:49:25 +0000 (15:49 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 18 Apr 2019 10:47:03 +0000 (10:47 +0000)
commitd6e1c6ffe639c08be9876c9e6f2f3551b3a82cb0
tree57aa2509f19bc7d218a9fe328044012456bdeaa4
parentcb83128f62f258ad4bf97896b44fbf0ca65f7b35
Bug 22318: Example implementation: OpacNavRight system preference

This patch implements a Koha news system replacement of the OpacNavRight
system preference. The changes to koha-news.tt enable the selection of
"OpacNavRight" as a location for the content. opac-main.pl is modified
to ensure that the user's selected language is passed to the template
for use by the KohaNews plugin.

The database update process takes the contents of Koha's OpacNavRight
system preference and adds it to the Koha news system. The OpacNavRight
system preference is then removed from the database.

When the new entry is added to Koha news, the language is set based on
the top selected language in the "opaclanguages" preference. The entry
is added to "All libraries" without an author, title, or expiration
date.

Note that this patch doesn't change the way OPAC news is displayed. I
think it's best to keep existing markup and code for that since it
handles details like branch selection and RSS.

To test, apply the patch and run the database update.

 - In the staff client go to Tools -> News and confirm that there is now
   an entry with the location "OpacNavRight_en" (assuming an "en"
   English interface).
 - Confirm that the previous contents of OpacNavRight were added
   correctly.
 - Go to Administration -> System preferences -> OPAC and verify that
   the OpacNavRight preference has been removed.
 - In the OPAC, confirm that the correct content is displayed in the
   region previously defined in the OpacNavRight system preference.
 - Test that the language and library-specific nature of news items is
   reflected in the behavior of this content area:
   - Define different text based on language and location. Confirm that
     switching translations and logging in to the OPAC both trigger the
     correct display of different content.

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
installer/data/mysql/atomicupdate/bug_22313-move-opacnavright-to-news.perl [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
opac/opac-main.pl