Bug 14764 - Add OPAC News branch selector
Summary: Add OPAC News branch selector
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Persson
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 14305
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-31 23:13 UTC by Martin Persson
Modified: 2017-06-14 22:18 UTC (History)
8 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Medium patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
This patch inserts a new system preference: "OpacNewsLibrarySelect". When it is active you can select to see the news of any library on the OPAC start page.


Attachments
Bug 14764: OPAC news selector - URL parameter (1.12 KB, patch)
2015-08-31 23:34 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Template tags (1.85 KB, patch)
2015-08-31 23:34 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Add syspref (2.49 KB, patch)
2015-08-31 23:35 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Atomic update SQL (983 bytes, patch)
2015-08-31 23:35 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Fix RSS feed (2.02 KB, patch)
2015-09-01 09:04 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - URL parameter (1.21 KB, patch)
2015-09-01 12:27 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Template tags (1.95 KB, patch)
2015-09-01 12:28 UTC, Martin Persson
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Add syspref (2.54 KB, patch)
2016-09-19 03:57 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Add syspref (2.54 KB, patch)
2016-09-19 03:59 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Atomic update SQL (983 bytes, patch)
2016-09-19 04:00 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Template tags (2.42 KB, patch)
2016-09-19 04:00 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Add syspref (2.54 KB, patch)
2016-09-20 21:33 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Atomic update SQL (983 bytes, patch)
2016-09-20 21:33 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Template tags (4.20 KB, patch)
2016-09-20 21:33 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Add syspref (2.59 KB, patch)
2016-10-10 14:09 UTC, Jesse Maseto
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Atomic update SQL (1.02 KB, patch)
2016-10-10 14:09 UTC, Jesse Maseto
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Template tags (4.26 KB, patch)
2016-10-10 14:09 UTC, Jesse Maseto
Details | Diff | Splinter Review
Bug 14764: OPAC news selector - Add syspref (8.36 KB, patch)
2016-11-02 03:16 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector (8.34 KB, patch)
2016-11-02 03:17 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector (8.34 KB, patch)
2016-11-02 03:19 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764 - Fix missed OPACNewsBrancSelect (1.10 KB, patch)
2016-11-02 03:22 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector (8.17 KB, patch)
2016-11-02 03:27 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector (8.17 KB, patch)
2016-11-02 03:35 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14764: OPAC news selector (8.10 KB, patch)
2016-11-02 22:18 UTC, Liz Rea
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 14764: OPAC news selector (8.12 KB, patch)
2017-01-30 15:24 UTC, Owen Leonard
Details | Diff | Splinter Review
OPAC news selector (8.17 KB, patch)
2017-01-30 15:58 UTC, Zeno Tajoli
Details | Diff | Splinter Review
Bug 14764 - [followup] Addressing QA concerns (3.97 KB, patch)
2017-02-02 21:35 UTC, Liz Rea
Details | Diff | Splinter Review
[SIGNED OFF] Bug 14764 - [followup] Addressing QA concerns (4.05 KB, patch)
2017-02-17 10:50 UTC, Baptiste
Details | Diff | Splinter Review
Bug 18119: Fix comment in cataloguing.js (1.56 KB, patch)
2017-02-17 13:40 UTC, Baptiste
Details | Diff | Splinter Review
[SIGNED OFF] Bug 14764: OPAC news selector (8.17 KB, patch)
2017-02-17 13:44 UTC, Baptiste
Details | Diff | Splinter Review
Bug 14764: OPAC news selector (8.23 KB, patch)
2017-02-20 09:19 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14764 - [followup] Addressing QA concerns (4.11 KB, patch)
2017-02-20 09:19 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Persson 2015-08-31 23:13:08 UTC
When branch-specific news are added users can only view entries from their home branch and global ones. These patches adds a syspref, 'OPACNewsBranchSelect' that allows a list of branches to be displayed above the left OpacNav field.
Comment 1 Martin Persson 2015-08-31 23:34:14 UTC Comment hidden (obsolete)
Comment 2 Martin Persson 2015-08-31 23:34:40 UTC Comment hidden (obsolete)
Comment 3 Martin Persson 2015-08-31 23:35:13 UTC
Created attachment 42131 [details] [review]
Bug 14764: OPAC news selector - Add syspref

Adds the new system preference to the pref and SQL files.
Comment 4 Martin Persson 2015-08-31 23:35:39 UTC Comment hidden (obsolete)
Comment 5 Martin Persson 2015-09-01 09:04:28 UTC Comment hidden (obsolete)
Comment 6 Martin Persson 2015-09-01 09:19:31 UTC
Test plan:

1) Add more libraries, at least two in total is needed. Make note of whoich 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) On the left side all branches should be listed as links. Select one, you should now see global news and the news for the selected branch, regardless of whether logged in or not.
Comment 7 Martin Persson 2015-09-01 12:27:37 UTC Comment hidden (obsolete)
Comment 8 Martin Persson 2015-09-01 12:28:26 UTC Comment hidden (obsolete)
Comment 9 Martin Persson 2015-09-01 20:38:02 UTC
Apply the RSS fix last to avoid conflict.
Comment 10 Martin Persson 2015-12-14 13:44:06 UTC

*** This bug has been marked as a duplicate of bug 14305 ***
Comment 11 Martin Persson 2015-12-14 15:59:53 UTC
Retested this, discovered that this and patch 14305 overlapped in code to some extent. Set the other as a dependency and obsoleted the overlapping patches.
Comment 12 M. Tompsett 2016-04-05 18:16:59 UTC Comment hidden (obsolete)
Comment 13 Liz Rea 2016-09-19 03:57:51 UTC Comment hidden (obsolete)
Comment 14 Liz Rea 2016-09-19 03:59:06 UTC Comment hidden (obsolete)
Comment 15 Liz Rea 2016-09-19 04:00:32 UTC Comment hidden (obsolete)
Comment 16 Liz Rea 2016-09-19 04:00:43 UTC Comment hidden (obsolete)
Comment 17 Liz Rea 2016-09-19 04:04:43 UTC
These template tags patch needed reworking after bug 15758, so that's what I've done. I also moved the branch selector from a list to a dropdown above the news instead of a list. It will not display if there is no news to show for the current branch (or all libraries) - that may not be desirable, it's a trivial change to move it.

Liz
Comment 18 Liz Rea 2016-09-20 21:33:20 UTC Comment hidden (obsolete)
Comment 19 Liz Rea 2016-09-20 21:33:26 UTC Comment hidden (obsolete)
Comment 20 Liz Rea 2016-09-20 21:33:32 UTC Comment hidden (obsolete)
Comment 21 Liz Rea 2016-09-20 21:34:40 UTC
Slight typo in the test plan - there is no "change library" button, it submits on change when you select a library.
Comment 22 Jesse Maseto 2016-10-10 14:09:04 UTC Comment hidden (obsolete)
Comment 23 Jesse Maseto 2016-10-10 14:09:25 UTC Comment hidden (obsolete)
Comment 24 Jesse Maseto 2016-10-10 14:09:29 UTC Comment hidden (obsolete)
Comment 25 Katrin Fischer 2016-11-01 22:31:52 UTC
I like this! I have found some small issues in testing tho:

- When you change the library in the pull down it jumps back to "Select a library" instead if staying at the library you selected. This way you can't be sure which library's news you are looking at.
- Same for when you are logged in - I'd think it would be nice to show that it preselected your home library's news for you.
- The 'system-wide only' option doesn't work correctly - it still displays the news for the home library of the patron as well.
- OpacNewsBranchSelect - we are trying to not use "Branch", could we change this to OpacNewsLibrarySelect instead?
- I think you don't need the ==1 here, just checking the pref is true will work too: [% IF Koha.Preference( 'OpacNewsBranchSelect' ) == 1 %] (just a note)
Comment 26 Liz Rea 2016-11-02 03:16:37 UTC Comment hidden (obsolete)
Comment 27 Liz Rea 2016-11-02 03:17:25 UTC Comment hidden (obsolete)
Comment 28 Liz Rea 2016-11-02 03:19:20 UTC Comment hidden (obsolete)
Comment 29 Liz Rea 2016-11-02 03:22:06 UTC Comment hidden (obsolete)
Comment 30 Liz Rea 2016-11-02 03:27:26 UTC Comment hidden (obsolete)
Comment 31 Liz Rea 2016-11-02 03:35:15 UTC Comment hidden (obsolete)
Comment 32 Katrin Fischer 2016-11-02 07:14:53 UTC
Hi Liz,

thx for your work (while I slept :) ) I have retested this morning, but not sure if it's working quite right yet:

1) The "Change library" link next to the pull down does nothing when I click on it. Do we need it? The pull down still reloads automatically.

2) For "All libraries" I think I'd expect to see all news from all branches, but it just shows the system wide news instead. I am not sure how to solve this unless we do some changes to the news system itself. What we can do now is "system wide and your own branch if you are logged in" which doesn't really explain well as an option - maybe we should just remove it?
Comment 33 Katrin Fischer 2016-11-02 07:17:45 UTC
Ah ok, "All libraries" is not showing me the news of my own library when logged in - sorry about that. I think I'd keep it as 'system-wide' news then, to match what is written for the RSS feed too.
Comment 34 Liz Rea 2016-11-02 22:18:52 UTC
Created attachment 57110 [details] [review]
Bug 14764: OPAC news selector

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 'system wide only' view for logged in user. We still show system wide even when a library is selected.

* Removed the "change library" link

* Added a label to the field.
Comment 35 Liz Rea 2017-01-29 21:14:31 UTC
Bump for attention please. :)
Comment 36 Owen Leonard 2017-01-30 15:24:23 UTC
Created attachment 59648 [details] [review]
[SIGNED-OFF] Bug 14764: OPAC news selector

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 'system wide only' view for logged in user. We still show system
  wide even when a library is selected.

* Removed the "change library" link

* Added a label to the field.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 37 Zeno Tajoli 2017-01-30 15:58:15 UTC
Created attachment 59653 [details] [review]
OPAC news selector
Comment 38 Zeno Tajoli 2017-01-30 16:01:44 UTC
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.
Comment 39 Jonathan Druart 2017-02-02 08:56:24 UTC
Liz:

Is this:
 if (defined $input->param('branch') and length $input->param('branch')) {
     $homebranch = $input->param('branch');
 }
 if (C4::Context->userenv and defined $input->param('branch') and length $input->param('branch') == 0 ){
   $homebranch = "";
}

could actually be:
 if (defined $input->param('branch') and length $input->param('branch')) {
     $homebranch = $input->param('branch');
 } elsif (C4::Context->userenv and defined $input->param('branch') ) {
   $homebranch = "";
 }

?
Comment 40 Jonathan Druart 2017-02-02 11:20:47 UTC
Ha, something else:
1/ OpacNewsLibrarySelect is not correctly placed in sysprefs.sql
2/ In opac.pref, "Policy:" seems wrong
Comment 41 Liz Rea 2017-02-02 21:35:56 UTC
Created attachment 59827 [details] [review]
Bug 14764 - [followup] Addressing QA concerns

* removed Policy:
* put the syspref in alpha order with the others
* added els to the if.
Comment 42 Jonathan Druart 2017-02-09 08:44:13 UTC
Must we provide a non-JS version?
Comment 43 Baptiste 2017-02-17 10:50:10 UTC
Created attachment 60396 [details] [review]
[SIGNED OFF] Bug 14764 - [followup] Addressing QA concerns

* removed Policy:
* put the syspref in alpha order with the others
* added els to the if.

Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Comment 44 Baptiste 2017-02-17 13:40:12 UTC
Created attachment 60424 [details] [review]
Bug 18119: Fix comment in cataloguing.js

Test plan:
Go to cataloging, and try something which depends on javascript -
collapse/uncollapse fields, open authority search window, ...
    -> without patch it is not working
    -> with patch it is working correctly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 45 Baptiste 2017-02-17 13:44:16 UTC
Created attachment 60425 [details] [review]
[SIGNED OFF] Bug 14764: OPAC news selector

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 'system wide only' view for logged in user. We still show system
  wide even when a library is selected.

* Removed the "change library" link

* Added a label to the field.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Zeno Tajoli <z.tajoli@cineca.it>
Comment 46 Jonathan Druart 2017-02-20 09:19:38 UTC
Created attachment 60451 [details] [review]
Bug 14764: OPAC news selector

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 'system wide only' view for logged in user. We still show system
  wide even when a library is selected.

* Removed the "change library" link

* Added a label to the field.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Zeno Tajoli <z.tajoli@cineca.it>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 47 Jonathan Druart 2017-02-20 09:19:42 UTC
Created attachment 60452 [details] [review]
Bug 14764 - [followup] Addressing QA concerns

* removed Policy:
* put the syspref in alpha order with the others
* added els to the if.

Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 48 Kyle M Hall 2017-03-03 18:30:24 UTC
Pushed to master for 17.05, thanks Liz!
Comment 49 Katrin Fischer 2017-03-12 23:03:27 UTC
This won't get ported back to 16.11.x as it is an enhancement.