@@ -, +, @@ --- .../prog/en/includes/tools-menu.inc | 1 + .../en/modules/tools/additional-contents.tt | 70 +++++++++++++----- .../prog/en/modules/tools/page.tt | 62 ++++++++++++++++ .../prog/en/modules/tools/tools-home.tt | 3 + koha-tmpl/intranet-tmpl/prog/js/tools-menu.js | 2 + .../bootstrap/en/modules/opac-main.tt | 2 + .../bootstrap/en/modules/opac-page.tt | 73 +++++++++++++++++++ opac/opac-page.pl | 48 ++++++++++++ tools/page.pl | 47 ++++++++++++ 9 files changed, 289 insertions(+), 19 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/tools/page.tt create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-page.tt create mode 100755 opac/opac-page.pl create mode 100755 tools/page.pl --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -110,6 +110,7 @@ [% IF ( CAN_user_tools_edit_additional_contents ) %]
  • News
  • HTML customizations
  • +
  • Pages
  • [% END %] [% IF ( CAN_user_tools_schedule_tasks ) %]
  • Task scheduler
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -24,6 +24,12 @@ .syspref-link::before { content: " | "; } + .customisation-link::before { + content: " | "; + } + .customisation-link:first-child::before { + content: none; + } @@ -44,6 +50,8 @@
  • [% IF category == 'news' %] News + [% ELSIF category == 'pages' %] + Pages [% ELSE %] HTML customizations [% END %] @@ -55,7 +63,7 @@ [% ELSE %] Add additional content [% END %] - ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %]) + ([% IF category == 'news' %]News[% ELSIF category == 'pages' %]Pages[% ELSE %]HTML customizations[% END %])
  • [% ELSE %] @@ -63,6 +71,8 @@ [% IF category == 'news' %] News + [% ELSIF category == 'pages' %] + Pages [% ELSE %] HTML customizations [% END %] @@ -165,7 +175,7 @@ [% IF additional_content %]

    Modify an additional content

    [% ELSE %] -

    New additional content ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])

    +

    New additional content ([% IF category == 'news' %]News[% ELSIF category == 'pages' %]Pages[% ELSE %]HTML customizations[% END %])

    [% END %]
    @@ -180,6 +190,8 @@
    [% IF category == 'news' %]
    Cancel + [% ELSIF category == 'pages' %] + Cancel [% ELSE %] Cancel [% END %] @@ -308,16 +320,17 @@ -

    Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])

    - [% IF category == 'news' %] - See HTML customizations - [% ELSE %] - See News - [% END %] - [% IF ( CAN_user_parameters_manage_sysprefs ) %] - OPACUserJS - OPACUserCSS - [% END %] +

    Additional contents ([% IF category == 'news' %]News[% ELSIF category == 'pages' %]Pages[% ELSE %]HTML customizations[% END %])

    + + See + News + HTML customizations + Pages + [% IF ( CAN_user_parameters_manage_sysprefs ) %] + OPACUserJS + OPACUserCSS + [% END %] + [% IF additional_contents.count %]
    @@ -332,7 +345,12 @@ Expiration date Title Author - News + [% IF category == 'pages' %] + Page URL + Page + [% ELSE %] + News + [% END %] Actions @@ -343,7 +361,7 @@ - [% IF c.category == 'news' %] + [% IF c.category == 'news' || c.category == 'pages' %] [% IF c.location == 'staff_and_opac' %]All [% ELSIF c.location == 'staff_only' %]Librarian interface [% ELSIF c.location == 'opac_only' %]OPAC @@ -365,6 +383,18 @@ [% c.expirationdate | $KohaDates %] [% IF ( c.is_expired ) %](expired)[% END %] [% c.title | html %] [% IF ( c.author) %][% INCLUDE 'patron-title.inc' patron=c.author %][% END %] + [% IF category == 'pages' %] + + [% IF c.location == 'opac_only' %] + OPAC: [% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-page.pl?page_id=[% c.idnew | uri %] + [% ELSIF c.location == 'staff_only' %] + Librarian interface: [% Koha.Preference('staffClientBaseURL') | url %]/cgi-bin/koha/tools/page.pl?page_id=[% c.idnew | uri %] + [% ELSIF c.location == 'staff_and_opac' %] + OPAC: [% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-page.pl?page_id=[% c.idnew | uri %]
    + Librarian interface: [% Koha.Preference('staffClientBaseURL') | url %]/cgi-bin/koha/tools/page.pl?page_id=[% c.idnew | uri %] + [% END %] + + [% END %]
    Preview content @@ -422,7 +452,7 @@ [% END %] [% BLOCK locations_options %] - [% IF category == 'news' %] + [% IF category == 'news' || category == 'pages' %] [% IF location == "staff_and_opac" %] [% ELSE %] @@ -441,10 +471,12 @@ [% END %] - [% IF location == "slip" %] - - [% ELSE %] - + [% UNLESS category == 'pages' %] + [% IF location == "slip" %] + + [% ELSE %] + + [% END %] [% END %] [% ELSE %] [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote' ] %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/page.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/page.tt @@ -0,0 +1,62 @@ +[% USE raw %] +[% USE Asset %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +[% IF page %][% page.title | html %][% ELSE %]Page error[% END %] › Tools › Koha +[% INCLUDE 'doc-head-close.inc' %] + + + + [% INCLUDE 'header.inc' %] + [% INCLUDE 'cat-search.inc' %] + + + +
    +
    +
    +
    + + [% 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 @@ -121,6 +121,9 @@
    HTML customizations
    Write HTML customizations
    + +
    Pages
    +
    Write custom pages
    [% 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/modules/opac-main.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -100,6 +100,7 @@
    [% SET show_author = Koha.Preference('NewsAuthorDisplay') == 'opac' || Koha.Preference('NewsAuthorDisplay') == 'both' %] [% FOREACH koha_new IN koha_news %] + [% IF koha_new.category == 'news' %]

    [% IF ( news_item ) %] @@ -120,6 +121,7 @@

    [% END %] + [% END %] [% UNLESS news_item %]
    --- 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,73 @@ +[% 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 ) %] +
    + +
    +
    + [% 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,48 @@ +#!/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 $page_id = $query->param('page_id'); +my $page; + +if (defined $page_id){ + $page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['opac_only', 'staff_and_opac'] }); + if ( $page->count > 0){ + $template->param( page => $page->next ); + } else { + $template->param( page_error => 1 ); + } +} + +output_html_with_http_headers $query, $cookie, $template->output; --- a/tools/page.pl +++ a/tools/page.pl @@ -0,0 +1,47 @@ +#!/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 $page_id = $query->param('page_id'); +my $page; + +if (defined $page_id){ + $page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['staff_only', 'staff_and_opac'] }); + if ( $page->count > 0){ + $template->param( page => $page->next ); + } else { + $template->param( page_error => 1 ); + } +} + +output_html_with_http_headers $query, $cookie, $template->output; --