Bugzilla – Attachment 136432 Details for
Bug 15326
Add CMS feature
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15326: Using AdditionalContents for custom pages on OPAC
Bug-15326-Using-AdditionalContents-for-custom-page.patch (text/plain), 28.18 KB, created by
Aleisha Amohia
on 2022-06-22 22:05:42 UTC
(
hide
)
Description:
Bug 15326: Using AdditionalContents for custom pages on OPAC
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2022-06-22 22:05:42 UTC
Size:
28.18 KB
patch
obsolete
>From 5aaf429a53727ea7312eea125d0cf63d411992a1 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Fri, 17 Dec 2021 02:06:51 +0000 >Subject: [PATCH] Bug 15326: Using AdditionalContents for custom pages on OPAC > >This page utilises the Additional Contents feature to add custom pages >to the staff client and the OPAC in the user's desired language. > >To test: >1. Apply patch and restart services >2. In the staff client, go to Tools, then go to the new 'Pages' page >3. Add a new page to display on both the staff client and OPAC. >4. Notice the 'View' button in the Actions column. This button should >only show when viewing Pages, it should not show when viewing HTML >customisations or News. Test that the main View button links you to the >page in the staff client. Test that clicking the arrow shows a button to >view the page in the OPAC, and clicking it opens the OPAC in a new tab. >5. When viewing your new page in the staff client, confirm a Pages >navigation shows in the left navigation. >6. When viewing your new page in the OPAC, confirm a Pages navigation >shows in the left navigation. Confirm pages are also linked in the >masthead links (i.e. with Advanced search and Libraries etc). >7. Confirm that any pages made for the staff client only do not show in >the OPAC, and that any pages made for the OPAC only do not show in the >staff client. >8. Pages that can be viewed on the staff client will also show under the >Pages link on the Tools main page. > >Sponsored-by: Chartered Accountants Australia and New Zealand >--- > Koha/AdditionalContents.pm | 3 +- > Koha/Template/Plugin/AdditionalContents.pm | 4 ++ > .../intranet-tmpl/prog/en/includes/pages-nav.inc | 10 +++ > .../intranet-tmpl/prog/en/includes/tools-menu.inc | 1 + > .../prog/en/modules/tools/additional-contents.tt | 74 ++++++++++++++----- > .../intranet-tmpl/prog/en/modules/tools/page.tt | 64 +++++++++++++++++ > .../prog/en/modules/tools/tools-home.tt | 10 +++ > koha-tmpl/intranet-tmpl/prog/js/tools-menu.js | 2 + > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 14 ++++ > .../opac-tmpl/bootstrap/en/modules/opac-page.tt | 83 ++++++++++++++++++++++ > opac/opac-page.pl | 65 +++++++++++++++++ > tools/page.pl | 64 +++++++++++++++++ > tools/tools-home.pl | 16 ++++- > 13 files changed, 390 insertions(+), 20 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/pages-nav.inc > 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 > >diff --git a/Koha/AdditionalContents.pm b/Koha/AdditionalContents.pm >index 711b187ad30..2bae923954a 100644 >--- a/Koha/AdditionalContents.pm >+++ b/Koha/AdditionalContents.pm >@@ -38,7 +38,7 @@ Koha::AdditionalContents - Koha Additional content object set class > =head3 search_for_display > > my $contents = Koha::AdditionalContents->search_for_display({ >- category => 'news', # news or html_customizations >+ category => 'news', # news, html_customizations, or pages > location => 'slip', > lang => 'es-ES', > library_id => $branchcode >@@ -75,6 +75,7 @@ sub search_for_display { > $search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' }; > $search_params->{-or} = [ expirationdate => { '>=' => \'CAST(NOW() AS DATE)' }, > expirationdate => undef ]; >+ $search_params->{category} = $params->{category}; > > if ( $params->{lang} ) { > # FIXME I am failing to translate the following query >diff --git a/Koha/Template/Plugin/AdditionalContents.pm b/Koha/Template/Plugin/AdditionalContents.pm >index c37abece4ea..8f2821d456d 100644 >--- a/Koha/Template/Plugin/AdditionalContents.pm >+++ b/Koha/Template/Plugin/AdditionalContents.pm >@@ -46,6 +46,10 @@ sub get { > } > ); > >+ if ( $category and $category eq 'pages' ) { >+ return $content->unblessed; >+ } >+ > if ( $content->count ) { > return { > content => $content, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/pages-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/pages-nav.inc >new file mode 100644 >index 00000000000..b3105c19eb7 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/pages-nav.inc >@@ -0,0 +1,10 @@ >+[% IF ( pages.count ) %] >+ [% IF show_heading %]<h3><span class="pages_title">Pages</span></h3>[% END %] >+ <ul id="pages-nav"> >+ [% FOREACH page IN pages %] >+ <li> >+ <a href="/cgi-bin/koha/tools/page.pl?page_id=[% page.idnew | uri %]">[% page.title | html %]</a> >+ </li> >+ [% END %] >+ </ul> >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >index 7ec650be1cc..195221ce0cc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >@@ -110,6 +110,7 @@ > [% IF ( CAN_user_tools_edit_additional_contents ) %] > <li><a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a></li> > <li><a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a></li> >+ <li><a href="/cgi-bin/koha/tools/additional-contents.pl?category=pages">Pages</a></li> > [% END %] > [% IF ( CAN_user_tools_schedule_tasks ) %] > <li><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index 3a762a95056..476dde73ebe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/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; >+ } > </style> > </head> > >@@ -44,6 +50,8 @@ > <li> > [% IF category == 'news' %] > <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a> >+ [% ELSIF category == 'pages' %] >+ <a href="/cgi-bin/koha/tools/additional-contents.pl?category=pages">Pages</a> > [% ELSE %] > <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a> > [% END %] >@@ -55,7 +63,7 @@ > [% ELSE %] > <span>Add additional content</span> > [% END %] >- ([% IF category == 'news' %]<span>News</span>[% ELSE %]<span>HTML customizations</span>[% END %]) >+ ([% IF category == 'news' %]<span>News</span>[% ELSIF category == 'pages' %]<span>Pages</span>[% ELSE %]<span>HTML customizations</span>[% END %]) > </a> > </li> > [% ELSE %] >@@ -63,6 +71,8 @@ > <a href="#" aria-current="page"> > [% IF category == 'news' %] > News >+ [% ELSIF category == 'pages' %] >+ Pages > [% ELSE %] > HTML customizations > [% END %] >@@ -165,7 +175,7 @@ > [% IF additional_content %] > <h1>Modify an additional content</h1> > [% ELSE %] >- <h1>New additional content ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h1> >+ <h1>New additional content ([% IF category == 'news' %]News[% ELSIF category == 'pages' %]Pages[% ELSE %]HTML customizations[% END %])</h1> > [% END %] > > <div id="toolbar" class="btn-toolbar"> >@@ -174,6 +184,8 @@ > </div> > [% IF category == 'news' %] > <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl"><i class="fa fa-remove"></i> Cancel</a> >+ [% ELSIF category == 'pages' %] >+ <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl?category=pages"><i class="fa fa-remove"></i> Cancel</a> > [% ELSE %] > <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations"><i class="fa fa-remove"></i> Cancel</a> > [% END %] >@@ -300,16 +312,17 @@ > </div> > </div> > >- <h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2> >- [% IF category == 'news' %] >- See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a> >- [% ELSE %] >- See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a> >- [% END %] >- [% IF ( CAN_user_parameters_manage_sysprefs ) %] >- <a class="syspref-link" href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserJS'>OPACUserJS</a> >- <a class="syspref-link" href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserCSS'>OPACUserCSS</a> >- [% END %] >+ <h2>Additional contents ([% IF category == 'news' %]News[% ELSIF category == 'pages' %]Pages[% ELSE %]HTML customizations[% END %])</h2> >+ <span id="additional_contents_links"> >+ See >+ <a class="customisation-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a> >+ <a class="customisation-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a> >+ <a class="customisation-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=pages">Pages</a> >+ [% IF ( CAN_user_parameters_manage_sysprefs ) %] >+ <a class="syspref-link" href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserJS'>OPACUserJS</a> >+ <a class="syspref-link" href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserCSS'>OPACUserCSS</a> >+ [% END %] >+ </span> > > [% IF additional_contents.count %] > <form id="del_form" method="post" action="/cgi-bin/koha/tools/additional-contents.pl"> >@@ -335,7 +348,7 @@ > <input type="checkbox" name="ids" value="[% c.idnew | html %]" /> > </td> > <td> >- [% IF c.category == 'news' %] >+ [% IF c.category == 'news' || c.category == 'pages' %] > [% IF c.location == 'staff_and_opac' %]<span>All</span> > [% ELSIF c.location == 'staff_only' %]<span>Librarian interface</span> > [% ELSIF c.location == 'opac_only' %]<span>OPAC</span> >@@ -394,6 +407,29 @@ > <div class="btn-group"> > <a href="#" class="delete_news btn btn-default btn-xs" data-idnew="[% c.idnew | html %]"><i class="fa fa-trash"></i> Delete</a> > </div> >+ [% IF c.category == 'pages' %] >+ <div class="btn-group dropup"> >+ [% IF c.location == 'opac_only' %] >+ <a target="_blank" href="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-page.pl?page_id=[% c.idnew | uri %]" class="btn btn-default btn-xs" title="View on OPAC"> <i class="fa fa-eye"></i> View</a><button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"> >+ <span class="caret"></span> >+ </button> >+ [% ELSE %] >+ <a href="/cgi-bin/koha/tools/page.pl?page_id=[% c.idnew | uri %]" class="btn btn-default btn-xs" title="View on staff client"><i class="fa fa-eye"></i> View</a><button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"> >+ <span class="caret"></span> >+ </button> >+ [% END %] >+ <ul class="dropdown-menu pull-right"> >+ <li> >+ [% UNLESS c.location == 'staff_only' %] >+ <a target="_blank" href="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-page.pl?page_id=[% c.idnew | uri %]" title="View on OPAC"><i class="fa fa-eye"></i> View on OPAC</a> >+ [% END %] >+ [% UNLESS c.location == 'opac_only' %] >+ <a href="/cgi-bin/koha/tools/page.pl?page_id=[% c.idnew | uri %]" title="View on staff client"><i class="fa fa-eye"></i> View on staff client</a> >+ [% END %] >+ </li> >+ </ul> >+ </div> >+ [% END %] > </td> > </tr> > [% END %] >@@ -414,7 +450,7 @@ > [% END %] > > [% BLOCK locations_options %] >- [% IF category == 'news' %] >+ [% IF category == 'news' || category == 'pages' %] > [% IF location == "staff_and_opac" %] > <option value="staff_and_opac" selected="selected">Librarian and OPAC interfaces</option> > [% ELSE %] >@@ -433,10 +469,12 @@ > <option value="opac_only">OPAC</option> > [% END %] > >- [% IF location == "slip" %] >- <option value="slip" selected="selected">Slip</option> >- [% ELSE %] >- <option value="slip">Slip</option> >+ [% UNLESS category == 'pages' %] >+ [% IF location == "slip" %] >+ <option value="slip" selected="selected">Slip</option> >+ [% ELSE %] >+ <option value="slip">Slip</option> >+ [% END %] > [% END %] > [% ELSE %] > [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote' ] %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/page.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/page.tt >new file mode 100644 >index 00000000000..172da7f5d6f >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/page.tt >@@ -0,0 +1,64 @@ >+[% USE raw %] >+[% USE Asset %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>[% IF page %][% page.title | html %][% ELSE %]Page error[% END %] › Tools › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="tools_page_[% page.idnew | html %]" class="tools"> >+ [% INCLUDE 'header.inc' %] >+ [% INCLUDE 'cat-search.inc' %] >+ >+ <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> >+ <ol> >+ <li> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> >+ </li> >+ <li> >+ <a href="#" aria-current="page">[% IF page %][% page.title | html %][% ELSE %]Page error[% END %]</a> >+ </li> >+ </ol> >+ </nav> >+ >+ <div class="main container-fluid"> >+ <div class="row"> >+ <div class="col-sm-10 col-sm-push-2"> >+ <main> >+ >+ [% IF page %] >+ >+ <h1>[% page.title | html %]</h1> >+ >+ <div class="page"> >+ [% page.content | $raw %] >+ </div> >+ >+ [% ELSE %] >+ >+ <div class="dialog alert"> >+ This page does not exist. >+ </div> >+ >+ [% END %] >+ >+ </main> >+ </div> <!-- /.col-sm-10.col-sm-push-2 --> >+ >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> >+ [% INCLUDE 'pages-nav.inc' show_heading=1 %] >+ <hr> >+ [% INCLUDE 'tools-menu.inc' %] >+ </aside> >+ </div> <!-- /.col-sm-2.col-sm-pull-10 --> >+ </div> <!-- /.row --> >+ >+[% MACRO jsinclude BLOCK %] >+ [% Asset.js("js/tools-menu.js") | $raw %] >+[% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 114b0f723d9..6c22c3a5907 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -5,6 +5,12 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Tools › Koha</title> > [% INCLUDE 'doc-head-close.inc' %] >+<style> >+#pages-nav { >+ font-size: 90%; >+ padding: .2em .2em .2em 2.5em; >+} >+</style> > </head> > <body id="tools_tools-home" class="tools"> > [% INCLUDE 'header.inc' %] >@@ -121,6 +127,10 @@ > > <dt><a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a></dt> > <dd>Write HTML customizations</dd> >+ >+ <dt><a href="/cgi-bin/koha/tools/additional-contents.pl?category=pages">Pages</a></dt> >+ <dd>Write custom pages</dd> >+ [% INCLUDE 'pages-nav.inc' %] > [% END %] > > [% IF ( CAN_user_tools_schedule_tasks ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js b/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >index 8fad270f871..fa8c1a6e2d2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >+++ b/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"); > } > }); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index b60c696d562..123bff1a65c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/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 ) %] > > <button id="scrolltocontent">Skip to main content</button> > <div id="wrapper"> >@@ -345,6 +346,19 @@ > [% END %] > </a> > </li> >+ >+ [% IF pages %] >+ <div id="pages-masthead"> >+ [% FOREACH page IN pages %] >+ <li class="nav-item"> >+ <a class="custom_page" href="/cgi-bin/koha/opac-page.pl?page_id=[% page.idnew | uri %]"> >+ [% page.title | html %] >+ </a> >+ </li> >+ [% END %] >+ </div> >+ [% END %] >+ > [% PROCESS koha_news_block news => OpacMoreSearches %] > </ul> <!-- /.nav#moresearches --> > </div> <!-- /.row --> >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 00000000000..5889c344ac5 >--- /dev/null >+++ b/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' %] >+<title>[% IF page %][% page.title | html %][% ELSE %]Page error[% END %] › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% BLOCK cssinclude %][% END %] >+</head> >+[% INCLUDE 'bodytag.inc' bodyid='opac-page-' _ page.idnew %] >+[% INCLUDE 'masthead.inc' %] >+ >+<div class="main"> >+ <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs"> >+ <ol class="breadcrumb"> >+ <li class="breadcrumb-item"> >+ <a href="/cgi-bin/koha/opac-main.pl">Home</a> >+ </li> >+ [% IF page %] >+ <li class="breadcrumb-item active"> >+ <a href="#" aria-current="page">[% page.title | html %]</a> >+ </li> >+ [% ELSE %] >+ <li class="breadcrumb-item active"> >+ <a href="#" aria-current="page">Page error</a> >+ </li> >+ [% END %] >+ </ol> >+ </nav> <!-- /#breadcrumbs --> >+ >+ <div class="container-fluid"> >+ <div class="row"> >+ [% IF ( OpacNav || OpacNavBottom || pages.count ) %] >+ <div class="col-12 col-lg-2 order-3 order-lg-1"> >+ <div id="navigation"> >+ [% IF ( pages.count ) %] >+ <h2><span class="pages_title">Pages</span></h2> >+ <ul id="pages-nav"> >+ [% FOREACH p IN pages %] >+ <li> >+ <a href="/cgi-bin/koha/opac-page.pl?page_id=[% p.idnew | uri %]">[% p.title | html %]</a> >+ </li> >+ [% END %] >+ </ul> >+ [% END %] >+ [% IF ( OpacNav || OpacNavBottom ) %] >+ <hr> >+ [% INCLUDE 'navigation.inc' %] >+ [% END %] >+ </div> >+ </div> >+ <div class="col-12 col-lg-10 order-md-1 maincontent"> >+ [% ELSE %] >+ <div class="col order-md-1 maincontent"> >+ [% END %] >+ <div id="page_[% page.idnew | html %]" class="maincontent"> >+ >+ [% IF page %] >+ >+ <h1>[% page.title | html %]</h1> >+ >+ <div class="page_content"> >+ [% page.content | $raw %] >+ </div> >+ >+ [% ELSE %] >+ >+ <div class="alert alert-error"> >+ This page does not exist. >+ </div> >+ >+ [% END %] >+ >+ </div> <!-- / .col 6/8 --> >+ >+ </div> <!-- /.container-fluid --> >+ </div> <!-- /.row --> >+</div> <!-- /.main --> >+ >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %][% END %] >diff --git a/opac/opac-page.pl b/opac/opac-page.pl >new file mode 100755 >index 00000000000..d23c0e91b3c >--- /dev/null >+++ b/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 <http://www.gnu.org/licenses>. >+ >+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; >diff --git a/tools/page.pl b/tools/page.pl >new file mode 100755 >index 00000000000..18102b288b8 >--- /dev/null >+++ b/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 <http://www.gnu.org/licenses>. >+ >+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; >diff --git a/tools/tools-home.pl b/tools/tools-home.pl >index 842ae688740..17734d27080 100755 >--- a/tools/tools-home.pl >+++ b/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') ) { >-- >2.11.0
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 15326
:
45621
|
58272
|
58607
|
58608
|
58609
|
58787
|
63904
|
63905
|
64241
|
64941
|
64942
|
66255
|
70866
|
70867
|
70868
|
70869
|
70870
|
70871
|
76387
|
76388
|
76389
|
76390
|
76391
|
76392
|
78232
|
78233
|
78234
|
78235
|
78236
|
78237
|
78238
|
78240
|
79269
|
83318
|
83319
|
83320
|
83321
|
83322
|
83323
|
83324
|
83325
|
83326
|
83404
|
83405
|
83406
|
83407
|
83408
|
83409
|
83410
|
83411
|
83412
|
84682
|
84683
|
84684
|
84685
|
84686
|
84687
|
84688
|
84689
|
84690
|
84691
|
87494
|
87495
|
87496
|
87497
|
87498
|
87499
|
87500
|
87501
|
87502
|
87503
|
87608
|
87609
|
87610
|
87617
|
96084
|
96085
|
96086
|
96087
|
96088
|
96089
|
96090
|
96091
|
96092
|
96093
|
96094
|
96095
|
96096
|
96097
|
96098
|
97237
|
101565
|
101566
|
101567
|
101568
|
101569
|
101570
|
101571
|
101572
|
101573
|
101574
|
101575
|
101576
|
101577
|
101578
|
101579
|
101580
|
128341
|
128342
|
128343
|
128344
|
128345
|
128346
|
128347
|
128348
|
128349
|
128350
|
128351
|
128352
|
128353
|
128354
|
128355
|
128356
|
128357
|
128585
|
128642
|
136432
|
136757
|
136768
|
138489
|
138493
|
139028
|
139029
|
139030
|
139031
|
139111
|
139123
|
139124
|
139125
|
139172
|
139173
|
139174