Jonathan Druart
89ade834d6
One big patch for one big move. The "News" feature (opac_news) has been hijacked to handle some system preferences (bug 26050). The goal was to take profit of the UI (editor) and the ability to translate the value. Disclaimer: This patch is NOT offering the best implementation but, as we still don't have bug 24975, it cannot be done now. And no, we don't want to wait for it to move forward here. This patch is going into the right direction anyway. This enhancement is going to rename the "News" with a more genertic "Additional contents". We have two different "categories" of content: "news" and "html customizations". What does it bring? - A split on the UI for disambigate the two types of content (news and syspref/html customizations) - A simplification of the edit form: all languages will be translatable on the same view (like the "notice templates") - Ground will be prepared for different types of content (if needed later) - Staff news can be translated How was the "News" area working before this patch? The opac_news DB table contained a (very inconsistent) 'lang' column. The different values were: - '' => news to display at the OPAC and staff interfaces - 'koha' => news for staff only - 'slip' => news for slip notices - $lang => news for OPAC only, translated in $lang ('en', 'es-ES', etc.) - "$location_$lang" => A syspref moved to this "news" area. The syspref is $location, and is translated in $lang. Eg. OpacLoginInstructions_en, OpacLoginInstructions_fr-FR, opacheader_es-ES This patch is improving the DB structure with the following changes: - renaming 'opac_news' with 'additional_contents' - new 'category' column => 'news' or 'html_customizations' - new 'location' column => For 'news': 'staff_and_opac', 'staff_only', 'slip' => For 'html_customizations': the old syspref name (eg. 'OpacLoginInstructions'). - new 'code' column (see later for more info) - the 'lang' column will only contain the language code ('en', 'es-ES', etc.). BUT a 'default' entry will ALWAYS exist for fallback behaviour. We are getting closer to the 'notice template' table structure because we want to match its UI. The 'code' column will bring us the ability to group the different 'additional_contents' rows. The code for a given news will be the same, but the (lang, title, content) will differ. Examples: News 1 will have, for each of the translated versions (category, code, location, branchcode) ('news', 'News1', $location, $branchcode||undef) And the 3 following columns will differ: (title, content, lang) ('title for news 1', 'content for news 1', 'default') ('titulo para 1', 'contenido para 1', 'es-ES') Note that the "category" is not strictely necessary, but it seems better to have the ability to split the different content by category/type easily. Additional changes: - Syspref 'NewsToolEditor' is renamed 'AdditionalContentsEditor' - Koha::NewItem => Koha::AdditionalContent - Koha::News => Koha::AdditionalContents - Script and template renamed from koha-news to additional-contents - Foreign keys have been renamed - Subpermission edit_news has been renamed edit_additional_contents - The UI can now be accessed via a "News" or "HTML customizations" link from the tools module. The related contents will then be displayed (both categories are now split) Changes not done here: - Primary key 'idnew' could be renamed 'id' Limitations of the upgrade: News cannot be grouped by a unique code for existing translations. => A given news will be now displayed several times on the translated interface Any ideas to improve the upgrade behaviour? We will have to add a warning in the release notes to tell libraries to review their news. Test plan: 0. Don't apply the patches 1. Translate the interfaces in some languages . Create some news for staff and OPAC . Create some content for different entry of HTML customizations Note that you are forced to define a 'default'. Also note that you are only forced to fill the title (not the content). This is certainly problematic (see FIXME in the code) as sometime only the content is displayed. . Play with the interface (edit, delete, filter) . Go to the different places the news are displayed, and confirm they are displayed correctly (staff home, opac home, opac rss) . Create 1+ news for 'slip', check an item out and 'print slip' (from the circulation page). You must see the news. . Go to the different places you are expecting the HTML customizations to be present and confirm that you see them. . Switch the lang of the interface and confirm that you now see the content in the translated version . Generate the templates in another language, don't translate the content . Use this language for the interface and confirm that the 'default' version is displauyed. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
245 lines
15 KiB
Text
245 lines
15 KiB
Text
[% USE raw %]
|
|
[% USE Koha %]
|
|
[% USE Categories %]
|
|
[% USE AdditionalContents %]
|
|
[% PROCESS 'html_helpers.inc' %]
|
|
[% SET OpacLoginInstructions = AdditionalContents.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>
|
|
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
|
|
Log in to your account
|
|
[% ELSE %]
|
|
Catalog login disabled
|
|
[% 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-login-page' bodyclass='scrollto' %]
|
|
[% INCLUDE 'masthead.inc' %]
|
|
|
|
<div class="main">
|
|
<nav aria-label="breadcrumb">
|
|
<ul class="breadcrumb">
|
|
<li class="breadcrumb-item">
|
|
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
|
|
</li>
|
|
<li class="breadcrumb-item active" aria-current="page">
|
|
<a href="#">Log in</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<div class="container-fluid">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-10 col-lg-6">
|
|
<div id="opac-auth" class="maincontent">
|
|
<!--CONTENT-->
|
|
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
|
|
[% IF ( nopermission ) %]
|
|
<!-- This is what is displayed if user doesn't have permission -->
|
|
<div class="alert alert-warning">
|
|
<h1>Access denied</h1>
|
|
<p>Sorry, the system doesn't think you have permission to access this page. </p>
|
|
[% IF SCO_login %]
|
|
<p><a href="/cgi-bin/koha/sco/sco-main.pl?logout.x=1">Log out and try again with a different user.</a></p>
|
|
[% ELSIF SCI_login %]
|
|
<p><a href="/cgi-bin/koha/sci/sci-main.pl?logout.x=1">Log out and try again with a different user.</a></p>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF ( loginprompt ) %]
|
|
<!-- login prompt time-->
|
|
<h1>Log in to your account</h1>
|
|
|
|
[% IF ( timed_out ) %]
|
|
<!-- This is what is displayed if login has timed out -->
|
|
<div class="alert alert-info">
|
|
<p>Sorry, your session has timed out. Please log in again.</p>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF ( different_ip ) %]
|
|
<!-- This is what is displayed if user doesn't have permission -->
|
|
<div class="alert alert-info">
|
|
<p>You are logging from a different IP address. Please log in again.</p>
|
|
</div>
|
|
[% END %]
|
|
|
|
|
|
[% IF invalid_username_or_password || too_many_login_attempts %]
|
|
<!-- This is what is displayed if user doesn't have permission or account is locked. (Do not expose more information than needed.) -->
|
|
<div class="alert alert-info">
|
|
<p>You entered an incorrect username or password. Please try again! But note that passwords are case sensitive[% IF Koha.Preference('FailedLoginAttempts') %] and that your account will be locked out after a fixed number of failed login attempts[% END %]. Please contact a library staff member if you continue to have problems.</p>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF ( shibbolethAuthentication ) %]
|
|
[% IF ( invalidShibLogin ) %]
|
|
<!-- This is what is displayed if shibboleth login has failed to match a koha user -->
|
|
<div class="alert alert-info">
|
|
<p>Sorry, your Shibboleth identity does not match a valid library identity.</p>
|
|
[% UNLESS ( Koha.Preference('OPACShibOnly') ) %]
|
|
[% IF ( casAuthentication ) %]
|
|
[% IF ( invalidCasLogin ) %]
|
|
<!-- This is what is displayed if cas login has failed -->
|
|
<p>Sorry, the CAS login also failed. If you have a local login you may use that below.</p>
|
|
[% ELSE %]
|
|
<p>If you have a CAS account, you may use that below.</p>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<p>If you have a local account, you may use that below.</p>
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
[% ELSE %]
|
|
<h2>Shibboleth Login</h2>
|
|
<p><a href="[% shibbolethLoginUrl | $raw %]">Log in using a Shibboleth account.</a></p>
|
|
[% END # /IF invalidShibLogin %]
|
|
[% UNLESS ( Koha.Preference('OPACShibOnly') ) %]
|
|
[% IF ( casAuthentication ) %]
|
|
<h2>CAS login</h2>
|
|
<p>If you do not have a Shibboleth account, but you do have a CAS account, you can use CAS.</p>
|
|
[% ELSE %]
|
|
<h2>Local login</h2>
|
|
<p>If you do not have a Shibboleth account, but you do have a local login, then you may login below.</p>
|
|
[% END %]
|
|
[% END %]
|
|
[% END # /IF shibbolethAuthentication %]
|
|
|
|
[% UNLESS ( Koha.Preference('OPACShibOnly') ) %]
|
|
[% IF ( casAuthentication ) %]
|
|
[% IF ( shibbolethAuthentication ) %]
|
|
[% IF ( casServerUrl ) %]
|
|
<p><a href="[% casServerUrl | $raw %]">Log in.</a><p>
|
|
[% END %]
|
|
|
|
[% IF ( casServersLoop ) %]
|
|
<p>Please choose against which one you would like to authenticate: </p>
|
|
<ul>
|
|
[% FOREACH casServer IN casServersLoop %]
|
|
<li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
|
|
[% END %]
|
|
</ul>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<h2>CAS login</h2>
|
|
|
|
[% IF ( invalidCasLogin ) %]
|
|
<!-- This is what is displayed if cas login has failed -->
|
|
<p>Sorry, the CAS login failed.</p>
|
|
[% END %]
|
|
|
|
[% IF ( casServerUrl ) %]
|
|
<p><a href="[% casServerUrl | $raw %]">Log in using a CAS account.</a><p>
|
|
[% END %]
|
|
|
|
[% IF ( casServersLoop ) %]
|
|
<p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
|
|
<ul>
|
|
[% FOREACH casServer IN casServersLoop %]
|
|
<li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
|
|
[% END %]
|
|
</ul>
|
|
[% END %]
|
|
[% END # /IF shibbolethAuthentication %]
|
|
|
|
[% IF ( shibbolethAuthentication ) %]
|
|
<p>Nothing</p>
|
|
[% ELSE %]
|
|
<h2>Local login</h2>
|
|
<p>If you do not have a CAS account, but do have a local account, you can still log in: </p>
|
|
[% END %]
|
|
|
|
[% END # / IF casAuthentication %]
|
|
|
|
[% IF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %]
|
|
[% IF ( invalidGoogleOpenIDConnectLogin ) %]
|
|
<h2>Google login</h2>
|
|
<p>Sorry, your Google login failed. <span class="error">[% invalidGoogleOpenIDConnectLogin | html %]</span></p>
|
|
<p>Please note that the Google login will only work if you are using the e-mail address registered with this library.</p>
|
|
<p>If you want to, you can try to <a href="/cgi-bin/koha/svc/auth/googleopenidconnect?reauthenticate=select_account">log in using a different account</a>
|
|
[% END %]
|
|
<a href="/cgi-bin/koha/svc/auth/googleopenidconnect" class="btn btn-primary" id="openid_connect">Log in with Google</a>
|
|
<p>If you do not have a Google account, but do have a local account, you can still log in: </p>
|
|
[% END # /IF GoogleOpenIDConnect %]
|
|
[% END # /UNLESS OPACShibOnly %]
|
|
|
|
[% IF !Koha.Preference('OPACShibOnly') or SCO_login or SCI_login %]
|
|
[% IF SCO_login %]
|
|
<form action="/cgi-bin/koha/sco/sco-main.pl" name="auth" id="auth" method="post" autocomplete="off">
|
|
[% ELSIF SCI_login %]
|
|
<form action="/cgi-bin/koha/sci/sci-main.pl" name="auth" id="auth" method="post" autocomplete="off">
|
|
[% ELSE %]
|
|
<form action="[% script_name | html %]" name="auth" id="auth" method="post" autocomplete="off">
|
|
[% END %]
|
|
<input type="hidden" name="koha_login_context" value="opac" />
|
|
|
|
<fieldset class="brief">
|
|
[% FOREACH INPUT IN INPUTS %]
|
|
[% NEXT IF INPUT.name == 'logout.x' %]
|
|
<input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
|
|
[% END %]
|
|
<div class="form-group">
|
|
<label for="userid">Login</label>
|
|
<input class="form-control" type="text" size="25" id="userid" name="userid" />
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input class="form-control" type="password" size="25" id="password" name="password" />
|
|
</div>
|
|
<fieldset class="action">
|
|
<input type="submit" value="Log in" class="btn btn-primary" />
|
|
</fieldset>
|
|
</fieldset>
|
|
|
|
[% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
|
|
<div id="forgotpassword">
|
|
<a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
|
|
</div>
|
|
[% END %]
|
|
<div id="nologininstructions">
|
|
[% IF OpacLoginInstructions %]
|
|
[% PROCESS koha_news_block news => OpacLoginInstructions %]
|
|
[% ELSE %]
|
|
<h2>Don't have a password yet?</h2>
|
|
<p>If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.</p>
|
|
<h2>Don't have a library card?</h2>
|
|
<p>If you don't have a library card, stop by your local library to sign up.</p>
|
|
[% END # / IF OpacLoginInstructions %]
|
|
|
|
[% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
|
|
<span id="registrationinstructions">
|
|
<a href="/cgi-bin/koha/opac-memberentry.pl">You may register here.</a>
|
|
</span>
|
|
[% END %]
|
|
</div>
|
|
</form>
|
|
[% END # / IF !OPACShibOnly or SCO_login or SCI_login %]
|
|
[% END # / IF loginprompt %]
|
|
|
|
[% ELSE %]
|
|
<h1>Logging on to the catalog has not been enabled by the library.</h1>
|
|
<ul>
|
|
<li>To report this error, you can email the Koha Administrator.<a href="mailto:[% admin | uri %]">Email</a></li>
|
|
<li>Use top menu bar to navigate to another part of Koha.</li>
|
|
</ul>
|
|
[% END # / IF opacuserlogin %]
|
|
|
|
</div> <!-- /.opac-auth -->
|
|
</div> <!-- /.col-md-10 col-lg-6 -->
|
|
</div> <!-- /.row -->
|
|
</div> <!-- /.container-fluid -->
|
|
</div> <!-- /.main -->
|
|
|
|
[% INCLUDE 'opac-bottom.inc' %]
|
|
[% BLOCK jsinclude %]
|
|
<script>
|
|
// Hide circular 'Log in to Your Account' link in opac-auth.pl
|
|
$(document).ready(function() {
|
|
if ( $("#auth" ) ) { $("#members ul li a").hide(); }
|
|
});
|
|
</script>
|
|
[% END %]
|