@@ -, +, @@
* Apply this patch.
* Go to OPAC main, you should see multiple news items by default.
* Each nees item heading should be clickable.
* When clicked only that item should be shown.
* Renamed URL parameter and local variables with 'news_' prefix.
* Fixed Search-And-Replace error; 'news_news_id' => 'news_id'
* Added breadcrumb for viewing single news item.
* Updated OPAC to use new GetNewsToDisplay parameters
* Fixed template formatting and calling of GetNewsToDisplay
---
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 15 ++++++++++++---
opac/opac-main.pl | 14 ++++++++++++--
2 files changed, 24 insertions(+), 5 deletions(-)
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
@@ -11,7 +11,16 @@
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
@@ -58,8 +67,8 @@
[% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
[% FOREACH koha_new IN koha_news %]
-
-
[% koha_new.content %]
+
+
[% koha_new.new %]
[% END %]
--- a/opac/opac-main.pl
+++ a/opac/opac-main.pl
@@ -61,8 +61,17 @@ if (defined $input->param('branch') and length $input->param('branch')) {
elsif (C4::Context->userenv and defined $input->param('branch') and length $input->param('branch') == 0 ){
$homebranch = "";
}
-my $all_koha_news = &GetNewsToDisplay($news_lang,$homebranch);
-my $koha_news_count = scalar @$all_koha_news;
+
+my $news_id = $input->param('news_id');
+my ($all_koha_news, $koha_news_count, $news_type);
+if (defined $news_id && length $news_id) {
+ $all_koha_news = &GetNewsToDisplay($news_lang, $homebranch, undef, $news_id);
+ $koha_news_count = 1;
+ $news_type = 'news_item';
+} else {
+ $all_koha_news = &GetNewsToDisplay($news_lang, $homebranch);
+ $koha_news_count = scalar @$all_koha_news;
+}
my $quote = GetDailyQuote(); # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
@@ -86,6 +95,7 @@ $template->param(
koha_news => $all_koha_news,
koha_news_count => $koha_news_count,
branchcode => $homebranch,
+ news_type => $news_type,
display_daily_quote => C4::Context->preference('QuoteOfTheDay'),
daily_quote => $quote,
);
--