Bugzilla – Attachment 104042 Details for
Bug 13388
Add library pages to the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13388: Add library pages to the OPAC
Bug-13388-Add-library-pages-to-the-OPAC.patch (text/plain), 11.59 KB, created by
Owen Leonard
on 2020-04-30 15:21:59 UTC
(
hide
)
Description:
Bug 13388: Add library pages to the OPAC
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-04-30 15:21:59 UTC
Size:
11.59 KB
patch
obsolete
>From 0fc64d774b8887b5931d9b927f6f757dc1f6f96e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 28 Apr 2020 19:23:55 +0000 >Subject: [PATCH] Bug 13388: Add library pages to the OPAC > >This patch adds a script and a template for showing library information >pages in the OPAC. A "libraries" page lists all the libraries in the >system, linking to individual pages for each library showing more >information.. > >If there is only one library in the system the page shows all of that >library's information. > >To test, apply the patch and rebuild the OPAC CSS >(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). > > - Go to /cgi-bin/koha/opac-library.pl in the OPAC. > - Verify that all the correct information is displayed for the > libraries in your system. > - Verify that page title and breadcrumbs look correct. > - Click to view details for a library. > - The details page should show the full contents of > branches.opac_info > - A menu should show links to other libraries' detail pages. > >EDIT: This revised patch adds a "Libraries" link to the links under the >search bar; Corrects encoding in the breadcrumb link; Makes the page >title more specific when viewing an individual library. >--- > koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss | 22 +++ > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 1 + > .../opac-tmpl/bootstrap/en/modules/opac-library.tt | 149 +++++++++++++++++++++ > opac/opac-library.pl | 52 +++++++ > 4 files changed, 224 insertions(+) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt > create mode 100644 opac/opac-library.pl > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >index d78fd167a7..8babc17b63 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >+++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >@@ -1649,6 +1649,28 @@ div { > } > > /* nav */ >+ >+nav { >+ &.libraries { >+ li { >+ list-style-type: none; >+ padding: .3em .5em; >+ >+ a { >+ display: block; >+ } >+ } >+ >+ i.fa { >+ color: #7cbc0f; >+ } >+ >+ .fa-li { >+ top: unset; >+ } >+ } >+} >+ > .nav_pages { > border-top: 1px solid #DDD; > padding: .6em; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 3f5b3a9549..99162b996f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -315,6 +315,7 @@ > <li><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase suggestions</a></li> > [% END %] > [% END %] >+ <li><a href="/cgi-bin/koha/opac-library.pl">Libraries</a></li> > [% Koha.Preference('OpacMoreSearches') | $raw %] > </ul> > </div> <!-- /#moresearches --> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt >new file mode 100644 >index 0000000000..8d9680cade >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt >@@ -0,0 +1,149 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Koha %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title> >+ [% IF ( LibraryNameTitle ) %] >+ [% LibraryNameTitle | html %] >+ [% ELSE %] >+ Koha online >+ [% END %] catalog › Libraries >+ [% IF ( library ) %] >+ › [% library.branchname | html %] >+ [% END %] >+</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% BLOCK cssinclude %][% END %] >+</head> >+ >+[% INCLUDE 'bodytag.inc' bodyid='opac-library' bodyclass='scrollto' %] >+[% INCLUDE 'masthead.inc' %] >+ >+[% BLOCK library_description %] >+ <div property="description"> >+ [% library.opac_info | $raw %] >+ </div> >+[% END %] >+ >+[% BLOCK library_info %] >+ <div property="address" typeof="PostalAddress"> >+ <p> >+ <span property="streetAddress"> >+ [% IF ( library.branchaddress1 ) %] >+ [% library.branchaddress1 | html %] >+ [% END %] >+ [% IF ( library.branchaddress2 ) %] >+ <br />[% library.branchaddress2 | html %] >+ [% END %] >+ [% IF ( library.branchaddress3 ) %] >+ <br />[% library.branchaddress3 | html %] >+ [% END %] >+ </span><br> >+ [% IF ( library.branchcity ) %] >+ <span property="addressLocality">[% library.branchcity | html %]</span> >+ [% END %] >+ [% IF ( library.branchstate ) %] >+ <span property="addressRegion">[% library.branchstate | html %]</span> >+ [% END %] >+ [% IF ( library.branchzip ) %] >+ <span property="postalCode">[% library.branchzip | html %]</span> >+ [% END %] >+ [% IF ( library.branchcountry ) %] >+ <br /><span property="addressCountry">[% library.branchcountry | html %]</span> >+ [% END %] >+ [% IF ( library.branchphone ) %] >+ <p>Phone: <a href="tel:[% library.branchphone | url %]" property="telephone">[% library.branchphone | html %]</a></p> >+ [% END %] >+ [% IF ( library.branchfax ) %] >+ <p>Fax: <span property="faxNumber">[% library.branchfax | html %]</span></p> >+ [% END %] >+ [% IF ( library.branchemail ) %] >+ <p>Email: <a href="mailto:[% library.branchemail | url %]" property="email">[% library.branchemail | html %]</a></p> >+ [% END %] >+ [% IF ( library.branchurl ) %] >+ <p><a href="[% library.branchurl | url %]" property="url">[% library.branchurl | html %]</a></p> >+ [% END %] >+ </p> >+ </div> <!-- /div property=address --> >+[% END %] >+ >+<div class="main"> >+ <ul class="breadcrumb"> >+ <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >+ <li><a href="/cgi-bin/koha/opac-library.pl">Libraries</a> >+ [% IF ( library ) %] >+ <span class="divider">›</span></li> >+ <li><a href="#">[% library.branchname | html %]</a></li> >+ [% ELSE %] >+ </li> >+ [% END %] >+ </ul> >+ >+ <div class="container-fluid"> >+ <div class="row-fluid"> >+ <div class="span12"> >+ >+ [% IF ( library ) %] >+ >+ <div id="library_info" class="maincontent" vocab="http://schema.org/" typeof="Library"> >+ <h3 property="name">[% library.branchname | html %]</h3> >+ >+ <div class="row-fluid"> >+ <div class="span8"> >+ [% PROCESS library_info %] >+ [% IF ( library.opac_info ) %] >+ <hr /> >+ [% PROCESS library_description %] >+ [% END %] >+ </div> >+ <div class="span4"> >+ [% IF ( libraries.count > 1 ) %] >+ <nav class="libraries"> >+ <ul class="fa-ul"> >+ [% FOREACH library IN libraries %] >+ [% IF ( branchcode == library.branchcode ) %] >+ <li class="current"> >+ <a href="/cgi-bin/koha/opac-library.pl?branchcode=[% library.branchcode | url %]"> >+ <i class="fa fa-li fa-map-pin" aria-hidden="true"></i> [% library.branchname | html %] >+ </a> >+ </li> >+ [% ELSE %] >+ <li> >+ <a href="/cgi-bin/koha/opac-library.pl?branchcode=[% library.branchcode | url %]"> >+ <i class="fa fa-li" aria-hidden="true"></i> [% library.branchname | html %] >+ </a> >+ </li> >+ [% END %] >+ [% END %] >+ </ul> >+ </nav> >+ [% END %] >+ </div> >+ </div> >+ </div> <!-- /#library_info --> >+ >+ [% ELSE %] >+ <h2>Libraries</h2> >+ >+ [% FOREACH library IN libraries %] >+ <h3 property="name"> >+ [% IF ( libraries.count > 1 ) %] >+ <a href="/cgi-bin/koha/opac-library.pl?branchcode=[% library.branchcode | url %]">[% library.branchname | html %]</a> >+ [% ELSE %] >+ [% library.branchname | html %] >+ [% END %] >+ </h3> >+ [% PROCESS library_info %] >+ <hr> >+ [% IF ( libraries.count == 1 ) %] >+ [% PROCESS library_description %] >+ [% END %] >+ [% END %] >+ >+ [% END %] >+ >+ </div> <!-- /.row-fluid --> >+ </div> <!-- /.container-fluid --> >+</div> <!-- / .main --> >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %][% END %] >diff --git a/opac/opac-library.pl b/opac/opac-library.pl >new file mode 100644 >index 0000000000..52168615f3 >--- /dev/null >+++ b/opac/opac-library.pl >@@ -0,0 +1,52 @@ >+#!/usr/bin/perl >+ >+# Copyright 2020 Athens County Public Libraries >+# >+# 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; >+use C4::Output; >+use Koha::Libraries; >+ >+my $query = CGI->new(); >+ >+my $branchcode = $query->param('branchcode'); >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-library.tt", >+ query => $query, >+ type => "opac", >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), >+ } >+); >+ >+if( $branchcode ){ >+ my $library = Koha::Libraries->find( $branchcode ); >+ $template->param( library => $library ); >+} >+ >+my $libraries = Koha::Libraries->search( {}, { order_by => ['branchname'] }, ); >+$template->param( >+ libraries => $libraries, >+ branchcode => $branchcode, >+); >+ >+output_html_with_http_headers $query, $cookie, $template->output; >-- >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 13388
:
103923
|
104042
|
104052
|
104081
|
104083
|
104084
|
104095
|
104096
|
104097
|
104109
|
104110
|
104111
|
104112