This patch makes the following changes:
1) If there is no logged in patron, the RSS link states it is for
system-wide news.
2) If a patron is logged in, the RSS link states it is for system-wide
news *and* news for the patron's home library.
3) The patron's home branch code is embedded in the RSS feed url so
he or she no longer needs to be logged in for us to know what branch's
news to pull.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
[% USE Koha %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog
[% INCLUDE 'doc-head-close.inc' %]
[% END %]
</div>
<div id="rssnews-container">
- <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-news-rss.pl"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png"></a>
- RSS for Library News.
+ [% SET branchcode = Branches.GetLoggedInBranchcode() %]
+ <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 ( loggedinusername ) %][% Branches.GetName( branchcode ) %] <i>and</i> [% END %] system-wide library news.
</div>
[% END %]
# use cookie setting for language, bug default to syspref if it's not set
my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
-my $homebranch;
+my $branchcode = $input->param('branchcode');
-if (C4::Context->userenv) {
- $homebranch = C4::Context->userenv->{'branch'};
-}
-my $all_koha_news = &GetNewsToDisplay($news_lang,$homebranch);
+my $all_koha_news = GetNewsToDisplay( $news_lang, $branchcode );
my $koha_news_count = scalar @$all_koha_news;
$template->param(