From e04a170aa3eb9ad6da75983a1ae77476db98e9c1 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 8 Oct 2015 14:24:36 +0200 Subject: [PATCH] Bug 14980 - Add a page showing one news MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The news system allow to create rich HTML content on OPAC main page. This enh proposes a new page that shows one of these new. Test plan : - Go to Tools > News - Create a new entry - Enter a title and a few content - Save - You see the new entry in table - Note its number, for example 3 - Go to opac and enter URL : /cgi-bin/koha/opac-page.pl?id=3 Signed-off-by: Marc VĂ©ron --- .../opac-tmpl/bootstrap/en/modules/opac-page.tt | 43 +++++++++++++++++ opac/opac-page.pl | 51 ++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-page.tt create mode 100755 opac/opac-page.pl diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-page.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-page.tt new file mode 100644 index 0000000..a76b231 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-page.tt @@ -0,0 +1,43 @@ +[% INCLUDE 'doc-head-open.inc' %] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › [% data.title | html %] +[% INCLUDE 'doc-head-close.inc' %] +[% BLOCK cssinclude %] +[% END %] + +[% INCLUDE 'bodytag.inc' bodyid='opac-page' %] +[% INCLUDE 'masthead.inc' %] + +
+ + + +
+
+ [% IF ( OpacNav||loggedinusername ) %] +
+ +
+
+ [% ELSE %] +
+ [% END %] + +
+

[% data.title | html %]

+
[% data.new %]
+
(published on [% data.expirationdate %])
+
+ + +
+
+
+
+ +[% INCLUDE 'opac-bottom.inc' %] +[% BLOCK jsinclude %][% END %] diff --git a/opac/opac-page.pl b/opac/opac-page.pl new file mode 100755 index 0000000..093c23d --- /dev/null +++ b/opac/opac-page.pl @@ -0,0 +1,51 @@ +#!/usr/bin/perl +# +# Copyright 2015 BibLibre +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use strict; +use warnings; + +use CGI qw ( -utf8 ); + +use C4::Auth qw(get_template_and_user); +use C4::Context; +use C4::Output; +use C4::NewsChannels; + +my $query = new CGI; + +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-page.tt", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + } +); + +my $page_id = $query->param("id"); +my $page_data = get_opac_new($page_id); + +# broken +unless ( $page_data->{'idnew'} ) { + print $query->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} + +$template->param( data => $page_data, ); + +output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.10.4