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> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
01371f8fad
commit
c6ea593971
6 changed files with 45 additions and 1 deletions
|
@ -0,0 +1 @@
|
||||||
|
INSERT IGNORE INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES('OpacNewsLibrarySelect', '0', '', 'Show selector for branches on OPAC news page', 'YesNo');
|
|
@ -288,6 +288,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'),
|
('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'),
|
('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'),
|
('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'),
|
||||||
|
('OpacNewsLibrarySelect','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'),
|
('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'),
|
('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'),
|
('OpacAdvSearchOptions','pubdate,itemtype,language,sorting,location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple'),
|
||||||
|
|
|
@ -502,6 +502,14 @@ OPAC:
|
||||||
yes: Display
|
yes: Display
|
||||||
no: Don't display
|
no: Don't display
|
||||||
- the acquisition details on OPAC detail pages.
|
- 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:"
|
- "Use the following as the OPAC ISBD template:"
|
||||||
- pref: OPACISBD
|
- pref: OPACISBD
|
||||||
|
|
|
@ -232,6 +232,14 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
|
||||||
<script type="text/javascript" src="[% interface %]/[% theme %]/js/googleindictransliteration.js"></script>
|
<script type="text/javascript" src="[% interface %]/[% theme %]/js/googleindictransliteration.js"></script>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
|
[% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#news-branch-select").change(function() {
|
||||||
|
$( "#news-branch-select" ).submit();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
[% END %]
|
||||||
|
|
||||||
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
|
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
@ -37,8 +37,22 @@
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
[% END %]
|
[% END %]
|
||||||
|
[% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
|
||||||
|
<form id="news-branch-select" class="form-inline" name="news-branch-select" method="get" action="/cgi-bin/koha/opac-main.pl">
|
||||||
|
<label for="news-branch">Display news for: </label>
|
||||||
|
<select id="news-branch" name="branch">
|
||||||
|
[% IF ( branchcode == "" ) %]
|
||||||
|
<option value="" selected="selected">system-wide only</option>
|
||||||
|
[% ELSE %]
|
||||||
|
<option value="" >system-wide only</option>
|
||||||
|
[% END %]
|
||||||
|
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
[% END %]
|
||||||
|
|
||||||
[% IF ( koha_news_count ) %]
|
[% IF ( koha_news_count ) %]
|
||||||
|
|
||||||
<div id="news" class="newscontainer">
|
<div id="news" class="newscontainer">
|
||||||
[% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
|
[% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
|
||||||
[% FOREACH koha_new IN koha_news %]
|
[% FOREACH koha_new IN koha_news %]
|
||||||
|
@ -54,7 +68,16 @@
|
||||||
<a href="[% OPACBaseURL %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode %]"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png"></a>
|
<a href="[% OPACBaseURL %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode %]"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png"></a>
|
||||||
RSS feed for [% IF ( branchcode ) %][% Branches.GetName( branchcode ) %] <i>and</i> [% END %] system-wide library news.
|
RSS feed for [% IF ( branchcode ) %][% Branches.GetName( branchcode ) %] <i>and</i> [% END %] system-wide library news.
|
||||||
</div>
|
</div>
|
||||||
[% END %]
|
[% ELSE %]
|
||||||
|
[% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
|
||||||
|
<div id="news" class="newscontainer">
|
||||||
|
<div class="newsitem">
|
||||||
|
<div class="newsbody">No news to display.</div>
|
||||||
|
<div class="newsfooter"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
[% END %]
|
||||||
|
[% END %]
|
||||||
|
|
||||||
[% IF ( display_daily_quote && daily_quote ) %]
|
[% IF ( display_daily_quote && daily_quote ) %]
|
||||||
<div id="daily-quote">
|
<div id="daily-quote">
|
||||||
|
|
|
@ -54,6 +54,9 @@ if (C4::Context->userenv) {
|
||||||
if (defined $input->param('branch') and length $input->param('branch')) {
|
if (defined $input->param('branch') and length $input->param('branch')) {
|
||||||
$homebranch = $input->param('branch');
|
$homebranch = $input->param('branch');
|
||||||
}
|
}
|
||||||
|
if (C4::Context->userenv and defined $input->param('branch') and length $input->param('branch') == 0 ){
|
||||||
|
$homebranch = "";
|
||||||
|
}
|
||||||
my $all_koha_news = &GetNewsToDisplay($news_lang,$homebranch);
|
my $all_koha_news = &GetNewsToDisplay($news_lang,$homebranch);
|
||||||
my $koha_news_count = scalar @$all_koha_news;
|
my $koha_news_count = scalar @$all_koha_news;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue