+
+
+
+
+ [% IF page %]
+
+ [% page.title | html %]
+
+
+ [% page.content | $raw %]
+
+
+ [% ELSE %]
+
+
+ This page does not exist.
+
+
+ [% END %]
+
+
+
+
+
+
+
+
+
+[% MACRO jsinclude BLOCK %]
+ [% Asset.js("js/tools-menu.js") | $raw %]
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
@@ -5,6 +5,12 @@
[% INCLUDE 'doc-head-open.inc' %]
Tools › Koha
[% INCLUDE 'doc-head-close.inc' %]
+
[% INCLUDE 'header.inc' %]
@@ -121,6 +127,10 @@
HTML customizations
Write HTML customizations
+
+
Pages
+
Write custom pages
+ [% INCLUDE 'pages-nav.inc' %]
[% END %]
[% IF ( CAN_user_tools_schedule_tasks ) %]
--- a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js
@@ -18,5 +18,7 @@
$('#navmenulist a[href$="/cgi-bin/koha/tools/stockrotation.pl"]').addClass("current");
} else if (path.indexOf("plugins") >= 0 ) {
$('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl?method=tool"]').addClass("current");
+ } else if (path.indexOf("page.pl") >= 0 ) {
+ $('#navmenulist a[href$="/cgi-bin/koha/tools/additional-contents.pl?category=pages"]').addClass("current");
}
});
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
@@ -9,6 +9,7 @@
[% SET OpacCustomSearch = AdditionalContents.get( location => "OpacCustomSearch", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% SET OpacLoginInstructions = AdditionalContents.get( location => "OpacLoginInstructions", lang => lang, library => branchcode || default_branch ) %]
[% SET OpacMoreSearches = AdditionalContents.get( location => "OpacMoreSearches", lang => lang, library => branchcode || default_branch ) %]
+[% SET pages = AdditionalContents.get( category => "pages", location => [ "opac_only", "staff_and_opac" ], lang => lang, library => branchcode || default_branch ) %]
@@ -345,6 +346,19 @@
[% END %]
+
+ [% IF pages %]
+
+ [% END %]
+
[% PROCESS koha_news_block news => OpacMoreSearches %]
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-page.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-page.tt
@@ -0,0 +1,83 @@
+[% USE raw %]
+[% USE Koha %]
+[% USE AdditionalContents %]
+[% PROCESS 'i18n.inc' %]
+[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
+[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
+[% INCLUDE 'doc-head-open.inc' %]
+
[% IF page %][% page.title | html %][% ELSE %]Page error[% END %] › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog
+[% INCLUDE 'doc-head-close.inc' %]
+[% BLOCK cssinclude %][% END %]
+
+[% INCLUDE 'bodytag.inc' bodyid='opac-page-' _ page.idnew %]
+[% INCLUDE 'masthead.inc' %]
+
+
+
+
+
+
+ [% IF ( OpacNav || OpacNavBottom || pages.count ) %]
+
+
+ [% IF ( pages.count ) %]
+
Pages
+
+ [% FOREACH p IN pages %]
+ -
+ [% p.title | html %]
+
+ [% END %]
+
+ [% END %]
+ [% IF ( OpacNav || OpacNavBottom ) %]
+
+ [% INCLUDE 'navigation.inc' %]
+ [% END %]
+
+
+
+ [% ELSE %]
+
+ [% END %]
+
+
+ [% IF page %]
+
+
[% page.title | html %]
+
+
+ [% page.content | $raw %]
+
+
+ [% ELSE %]
+
+
+ This page does not exist.
+
+
+ [% END %]
+
+
+
+
+
+
+
+[% INCLUDE 'opac-bottom.inc' %]
+[% BLOCK jsinclude %][% END %]
--- a/opac/opac-page.pl
+++ a/opac/opac-page.pl
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+# This file is part of Koha.
+#
+# 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 Modern::Perl;
+
+use CGI qw ( -utf8 );
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use Koha::AdditionalContents;
+
+my $query = CGI->new();
+
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+ {
+ template_name => "opac-page.tt",
+ query => $query,
+ type => "opac",
+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
+ }
+);
+
+my $homebranch = $ENV{OPAC_BRANCH_DEFAULT};
+if (C4::Context->userenv) {
+ $homebranch = C4::Context->userenv->{'branch'};
+}
+
+my $pages = Koha::AdditionalContents->search_for_display(
+ {
+ category => 'pages',
+ location => [ 'opac_only', 'staff_and_opac' ],
+ lang => $template->lang,
+ library_id => $homebranch
+ }
+);
+
+my $page_id = $query->param('page_id');
+my $page;
+if ( $page_id ) {
+ foreach ( @{$pages->unblessed} ) {
+ if ( $_->{idnew} eq $page_id ) {
+ $page = $_;
+ }
+ }
+}
+
+$template->param(
+ pages => $pages,
+ page => $page,
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
--- a/tools/page.pl
+++ a/tools/page.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+# This file is part of Koha.
+#
+# 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 Modern::Perl;
+
+use CGI qw ( -utf8 );
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use Koha::AdditionalContents;
+
+my $query = CGI->new;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "tools/page.tt",
+ query => $query,
+ type => "intranet",
+ flagsrequired => { tools => '*' },
+ }
+);
+
+my $homebranch;
+if (C4::Context->userenv) {
+ $homebranch = C4::Context->userenv->{'branch'};
+}
+my $pages = Koha::AdditionalContents->search_for_display(
+ {
+ category => 'pages',
+ location => [ 'staff_only', 'staff_and_opac' ],
+ lang => $template->lang,
+ library_id => $homebranch
+ }
+);
+
+my $page_id = $query->param('page_id');
+
+my $page;
+if ( $page_id ) {
+ foreach ( @{$pages->unblessed} ) {
+ if ( $_->{idnew} eq $page_id ) {
+ $page = $_;
+ }
+ }
+}
+
+$template->param(
+ pages => $pages,
+ page => $page,
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
--- a/tools/tools-home.pl
+++ a/tools/tools-home.pl
@@ -36,9 +36,23 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $pendingcomments = Koha::Reviews->search_limited({ approved => 0 })->count;
my $pendingtags = get_count_by_tag_status(0);
+my $homebranch;
+if (C4::Context->userenv) {
+ $homebranch = C4::Context->userenv->{'branch'};
+}
+my $pages = Koha::AdditionalContents->search_for_display(
+ {
+ category => 'pages',
+ location => [ 'staff_only', 'staff_and_opac' ],
+ lang => $template->lang,
+ library_id => $homebranch
+ }
+);
+
$template->param(
pendingcomments => $pendingcomments,
- pendingtags => $pendingtags
+ pendingtags => $pendingtags,
+ pages => $pages,
);
if ( C4::Context->config('enable_plugins') ) {
--