Bugzilla – Attachment 72550 Details for
Bug 14272
Allow OPAC to show a single news entry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14272: Show single news item (OPAC)
Bug-14272-Show-single-news-item-OPAC.patch (text/plain), 4.50 KB, created by
Katrin Fischer
on 2018-03-09 07:06:15 UTC
(
hide
)
Description:
Bug 14272: Show single news item (OPAC)
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-03-09 07:06:15 UTC
Size:
4.50 KB
patch
obsolete
>From 4e0a76a52c2d740312b980e310af7cd26f1ef5aa Mon Sep 17 00:00:00 2001 >From: Martin Persson <xarragon@gmail.com> >Date: Fri, 18 Dec 2015 11:14:18 +0100 >Subject: [PATCH] Bug 14272: Show single news item (OPAC) > >This change makes the news shown on opac-main-pl have >clickable headings which shows just that news item in isolation. >This is to allow further patches that adds commentary functions. > >Sponsored-By: Halland County Library > >Test plan: > * Apply this patch. > * Go to OPAC main, you should see multiple news items by default. > * If you do not see any, go to Staff interface and add a few. > * Each nees item heading should be clickable. > * When clicked only that item should be shown. > * When 'news_id' is present, only a single news item should show. > * The breadcrumb should say 'News item' after 'Home'. > >Updates: > * 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 > >Signed-off-by: Aleisha <aleishaamohia@hotmail.com> > >Fixing merge conflicts > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 15 ++++++++++++--- > opac/opac-main.pl | 14 ++++++++++++-- > 2 files changed, 24 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >index 81a7580..b31e1c1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >@@ -11,7 +11,16 @@ > > <div class="main"> > <ul class="breadcrumb"> >- <li><a href="#">Home</a></li> >+ <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> >+ [% IF ( news_type ) %] >+ <span class="divider">›</span></li> >+ <li><a href="#"> >+ [% SWITCH news_type %] >+ [% CASE 'news_item' %]News item >+ [% END %] >+ </a> >+ [% END %] >+ </li> > </ul> > > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >@@ -58,8 +67,8 @@ > [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %] > [% FOREACH koha_new IN koha_news %] > <div class="newsitem"> >- <a name="newsitem[% koha_new.idnew %]"></a><h4 class="newsheader">[% koha_new.title %]</h4> >- <div class="newsbody">[% koha_new.content %]</div> >+ <a name="newsitem[% koha_new.idnew %]" href="/cgi-bin/koha/opac-main.pl?news_id=[% koha_new.idnew %]"><h4 class="newsheader">[% koha_new.title %]</h4></a> >+ <div class="newsbody">[% koha_new.new %]</div> > <div class="newsfooter">(published on [% koha_new.newdate %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title %] </span>[% koha_new.author_firstname %] [% koha_new.author_surname %][% END %])</div> > </div> > [% END %] >diff --git a/opac/opac-main.pl b/opac/opac-main.pl >index 723dced..b864ab9 100755 >--- a/opac/opac-main.pl >+++ b/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 > >@@ -93,6 +102,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, > ); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14272
:
45721
|
45740
|
45741
|
45818
|
45820
|
45845
|
45846
|
45935
|
45936
|
45937
|
47556
|
47557
|
47558
|
47665
|
47666
|
47667
|
47668
|
47669
|
47670
|
47671
|
47672
|
47673
|
50557
|
50558
|
50559
|
59483
|
70728
|
70729
|
70730
|
70731
|
72065
|
72548
|
72549
|
72550
|
72551
|
76015
|
76307
|
76580
|
76662
|
77546
|
77564
|
77565
|
77566
|
77567
|
77568
|
77569
|
78104
|
78206
|
78207
|
78208
|
78231
|
81643
|
82713
|
83425
|
83426
|
83427
|
83428
|
83429
|
83430
|
84868
|
84869
|
84870
|
84871
|
84872
|
84873
|
84874