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.
Created attachment 42129 [details] [review] Bug 14764: OPAC news selector - URL parameter This patch adds an URL-based override for the homebranch variable in opac-main.pl. Allows viewing of arbitrary branches. Possible security issue: The user changes branch parameter to perform SQL or XSS injection. This would not be possible via the database, as the foreign key constraint would block arbitrary code. However, the News retrieval function is using prepared statements which are immune to this.
Created attachment 42130 [details] [review] Bug 14764: OPAC news selector - Template tags Adds tags to the template files to inject branch list.
Created attachment 42131 [details] [review] Bug 14764: OPAC news selector - Add syspref Adds the new system preference to the pref and SQL files.
Created attachment 42132 [details] [review] Bug 14764: OPAC news selector - Atomic update SQL Adds an SQL file to perform the database upgrade.
Created attachment 42139 [details] [review] Bug 14764: OPAC news selector - Fix RSS feed Update opac-main RSS feed to match current branch.
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.
Created attachment 42146 [details] [review] Bug 14764: OPAC news selector - URL parameter This patch adds an URL-based override for the homebranch variable in opac-main.pl. Allows viewing of arbitrary branches. Possible security issue: The user changes branch parameter to perform SQL or XSS injection. This would not be possible via the database, as the foreign key constraint would block arbitrary code. However, the News retrieval function is using prepared statements which are immune to this. Changes: Parameter 'branch' renamed 'branchcode' Sponsored-By: Halland County Library
Created attachment 42147 [details] [review] Bug 14764: OPAC news selector - Template tags Adds tags to the template files to inject branch list. Changes: Fixed pref name, renamed branch to branchcode Sponsored-By: Halland County Library
Apply the RSS fix last to avoid conflict.
*** This bug has been marked as a duplicate of bug 14305 ***
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 on attachment 42147 [details] [review] Bug 14764: OPAC news selector - Template tags Review of attachment 42147 [details] [review]: ----------------------------------------------------------------- ::: koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ +24,4 @@ > [% END %] > > <div class="row-fluid"> > + [% IF Koha.Preference( 'opacnewsbranchselect' ) == 1 %] Even though everything should work regardless of case, please match case anyways so as to confuse less people.
Created attachment 55679 [details] [review] Bug 14764: OPAC news selector - Add syspref Adds the new system preference to the pref and SQL files.
Created attachment 55680 [details] [review] Bug 14764: OPAC news selector - Add syspref Adds the new system preference to the pref and SQL files.
Created attachment 55681 [details] [review] Bug 14764: OPAC news selector - Atomic update SQL Adds an SQL file to perform the database upgrade.
Created attachment 55682 [details] [review] 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
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
Created attachment 55724 [details] [review] Bug 14764: OPAC news selector - Add syspref Adds the new system preference to the pref and SQL files.
Created attachment 55725 [details] [review] Bug 14764: OPAC news selector - Atomic update SQL Adds an SQL file to perform the database upgrade.
Created attachment 55726 [details] [review] 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
Slight typo in the test plan - there is no "change library" button, it submits on change when you select a library.
Created attachment 56107 [details] [review] Bug 14764: OPAC news selector - Add syspref Adds the new system preference to the pref and SQL files. Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Created attachment 56108 [details] [review] Bug 14764: OPAC news selector - Atomic update SQL Adds an SQL file to perform the database upgrade. Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Created attachment 56109 [details] [review] 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 Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
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)
Created attachment 57058 [details] [review] Bug 14764: OPAC news selector - Add syspref 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.
Created attachment 57059 [details] [review] 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.
Created attachment 57060 [details] [review] 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.
Created attachment 57061 [details] [review] Bug 14764 - Fix missed OPACNewsBrancSelect
Created attachment 57062 [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 '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.
Created attachment 57063 [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 '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.
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?
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.
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.
Bump for attention please. :)
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>
Created attachment 59653 [details] [review] 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.
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 = ""; } ?
Ha, something else: 1/ OpacNewsLibrarySelect is not correctly placed in sysprefs.sql 2/ In opac.pref, "Policy:" seems wrong
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.
Must we provide a non-JS version?
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>
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>
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>
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>
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>
Pushed to master for 17.05, thanks Liz!
This won't get ported back to 16.11.x as it is an enhancement.