Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt
Owen Leonard 4577950900 Bug 24223: Convert OpacNav system preference to additional content
This patch builds on Bug 22318 to move the OpacNav system
preference into the "Additional contents" system, making it possible to
have language- and library-specific content.

To test you should have some content in the OpacNav system
preference. To make testing easier it's also a good idea to have content
in the OpacNavBottom preference.

 - Apply the patch and run the database update process.
 - In the staff client, go to Tools -> HTML customizations and verify
   that the content from OpacNav is now stored there. When you
   edit the entry you should see content for each of the enabled
   translations in your system under each tab.
   - Confirm that the previous contents of OpacNav were added
     correctly.
 - Go to Administration -> System preferences -> OPAC and verify that
   the OpacNav preference has been removed.
 - Update and reinstall active translations (for instance fr-FR):
   - cd misc/translator/
   - perl translate update fr-FR
   - perl translate install fr-FR
 - View the OPAC and confirm that the contents of the OpacNav system
   preference displays in the left-hand sidebar.
 - Test as many pages as possible to confirm that wherever the
   OpacNavBottom content is displayed, OpacNav is also displayed.
 - Test also using the updated translation.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 24223: (follow-up) Add date to OpacNav additional content entries

This follow-up modifies the atomic update so that it inserts today's
date as the "Published on" date. Without that information the system
considers the item unpublished and will not display the content.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 24223: (follow-up) Make logged-in user's branchcode available to template

This patch makes a couple of corrections for problems I discovered
while working on Bug 24224: The variables required for correct display
of news items by branch and language were not consistently available to
the templates.

In opac-readingrecord.pl, the "lang" variable was being overwritten. On
this and other pages the logged-in patron's brachcode was not made
available. I've corrected instances of KohaNews.get() to use the
globally-available "logged_in_user.branchcode" instead.

To test, apply the patch and follow the original test plan, with the
addition of instances of the OpacNav additional contents item which
have a specific library selected.

Confirm that such items are correctly displayed according to the
logged-in user's home library. If there is no logged-in user the
library-specific OpacNav should not display.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 24223: (follow-up) Updates to conform to new practices

- The patch now works with new "Additional contents" system
- The database update follows new skeleton.pl
- Add "OpacNav" option to the additional contents template

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 24223: (follow-up) Add missing "return" to atomicupdate

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 24223: (QA follow-up) Link OpacNav to HTML customizations now

In the pref description of OpacNavBottom. (Before obsoleting that
one too somewhere soon.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-08 11:18:39 +01:00

319 lines
19 KiB
Text

[% USE raw %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% USE AdditionalContents %]
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Your interlibrary loan requests &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-illrequests' bodyclass='scrollto' %]
[% BLOCK messages %]
[% IF message == "1" %]
<div class="alert alert-success" role="alert">Request updated</div>
[% ELSIF message == "2" %]
<div class="alert alert-success" role="alert">Request placed</div>
[% END %]
[% END %]
[% 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 ( logged_in_user ) %]
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
</li>
[% END %]
[% IF method != 'list' %]
<li class="breadcrumb-item active">
<a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a>
</li>
[% IF method == 'create' %]
<li class="breadcrumb-item active">
<a href="#" aria-current="page">New interlibrary loan request</a>
</li>
[% ELSIF method == 'view' %]
<li class="breadcrumb-item active">
<a href="#" aria-current="page">View interlibrary loan request</a>
</li>
[% END %]
[% ELSE %]
<li class="breadcrumb-item active">
<a href="#" aria-current="page">Interlibrary loan requests</a>
</li>
[% END %]
</ol> <!-- / .breadcrumb -->
</nav> <!-- /#breadcrumbs -->
<div class="container-fluid">
<div class="row">
[% IF ( OpacNav||loggedinusername ) && !print %]
<div class="col-lg-2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
[% END %]
[% IF ( OpacNav||loggedinusername ) %]
<div class="col-lg-10 order-first order-md-first order-lg-2">
[% ELSE %]
<div class="col order-first order-md-first order-lg-2">
[% END %]
[% IF !backends_available %]
<div class="alert alert-warning">ILL module configuration problem. Contact your administrator.</div>
[% ELSE %]
<div id="illrequests" class="maincontent">
[% IF method == 'create' %]
<h1>New interlibrary loan request</h1>
[% IF stage == 'copyrightclearance' %]
[% INCLUDE messages %]
<div>
<p>
[% Koha.Preference('ILLModuleCopyrightClearance') | $raw %]
</p>
[% USE link_url = url('/cgi-bin/koha/opac-illrequests.pl', whole.value.other) %]
<a href="[% link_url _ '&amp;stage=copyrightclearance' | $raw %]"
class="btn btn-sm btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Yes</a>
<a href="/cgi-bin/koha/opac-illrequests.pl"
class="btn btn-sm btn-danger"><i class="fa fa-times" aria-hidden="true"></i> No</a>
</div>
[% ELSE %]
[% INCLUDE messages %]
[% IF backends %]
<form method="post" id="illrequestcreate-form" novalidate="novalidate">
<legend class="sr-only">Backends</legend>
<fieldset class="rows">
<label for="backend">Provider:</label>
<select name="backend">
[% FOREACH backend IN backends %]
<option value="[% backend | html %]">[% backend | html %]</option>
[% END %]
</select>
</fieldset>
<fieldset class="action">
<input type="hidden" name="method" value="create" />
<input type="submit" name="create_select_backend" value="Next" />
</fieldset>
</form>
[% ELSE %]
[% PROCESS $whole.opac_template %]
[% END %]
[% END # /IF stage == 'copyrightclearance' %]
[% ELSIF method == 'list' %]
<h1>Interlibrary loan requests</h1>
[% INCLUDE messages %]
<div id="illrequests-create-button" class="dropdown btn-group">
[% IF backends.size > 1 %]
<button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-plus" aria-hidden="true"></i> Create a new request <span class="caret"></span>
</button>
<div id="backend-dropdown-options" class="dropdown-menu nojs" aria-labelledby="ill-backend-dropdown">
[% FOREACH backend IN backends %]
<a class="dropdown-item" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backend | uri %]">[% backend | html %]</a>
[% END %]
</div>
[% ELSE %]
<a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backends.0 | html %]">
<i class="fa fa-plus" aria-hidden="true"></i> Create a new request
</a>
[% END %]
</div>
<table id="illrequestlist" class="table table-bordered table-striped">
<caption class="sr-only">Requests</caption>
<thead>
<tr>
<th>Request ID</th>
<th>Author</th>
<th>Title</th>
<th>Requested from</th>
<th>Request type</th>
<th>Status</th>
<th>Request placed</th>
<th>Last updated</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH request IN requests %]
[% status = request.status | html %]
[% type = request.get_type %]
<tr>
<td>[% request.id | html %]</td>
<td>
[% IF request.metadata.Author %][% request.metadata.Author | html %][% ELSE %]<span>N/A</span>[% END %]
</td>
<td>
[% IF request.metadata.Title %][% request.metadata.Title | html %][% ELSE %]<span>N/A</span>[% END %]
</td>
<td>[% request.backend | html %]</td>
<td>
[% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
</td>
<td>[% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %]</td>
<td data-order="[% request.placed | html %]">[% request.placed | $KohaDates %]</td>
<td data-order="[% request.updated | html %]">[% request.updated | $KohaDates %]</td>
<td>
<a href="/cgi-bin/koha/opac-illrequests.pl?method=view&amp;illrequest_id=[% request.id | uri %]" class="btn btn-primary btn-sm pull-right">View</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSIF method == 'view' %]
<h1>View interlibrary loan request</h1>
[% INCLUDE messages %]
[% status = request.status %]
<form method="post" action="?method=update" id="illrequestupdate-form" novalidate="novalidate">
<fieldset class="rows">
<legend id="library_legend">Details from library</legend>
<ol>
[% type = request.get_type %]
<li>
<label for="request_id">Request ID:</label>
[% request.id | html %]
</li>
<li>
<label for="backend">Requested from:</label>
[% request.backend | html %]
</li>
[% IF request.biblio_id %]
<li>
<label for="biblio">Requested item:</label>
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% request.biblio_id | uri %]">View the requested item</a>
</li>
[% END %]
<li>
<label for="branchcode">Collection library:</label>
[% Branches.GetName(request.branchcode) | html %]
</li>
<li>
<label for="status">Status:</label>
[% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %]
</li>
<li>
<label for="medium">Request type:</label>
[% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
</li>
<li>
<label for="placed">Request placed:</label>
[% request.placed | $KohaDates %]
</li>
<li>
<label for="updated">Last updated:</label>
[% request.updated | $KohaDates %]
</li>
<li>
<label for="notesopac">Notes:</label>
[% IF !request.completed %]
<textarea name="notesopac" rows="5" cols="50">[% request.notesopac | html %]</textarea>
[% ELSE %]
[% request.notesopac | html %]
[% END %]
</li>
</ol>
</fieldset>
<div id="ill-supplier-metadata" class="rows">
<legend id="backend_legend">Details from [% request.backend | html %]</legend>
[% FOREACH meta IN request.metadata %]
<div class="requestattr-[% meta.key | replace(' ', '_') | html %]">
<span class="label">[% meta.key | html %]:</span>
<span class="value">[% IF meta.value %][% meta.value | html %][% ELSE %]N/A[% END %]</span>
</div>
[% END %]
</div>
<fieldset class="action illrequest-actions">
<input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
<input type="hidden" name="method" value="update" />
[% IF !request.completed %]
[% IF request.status == "NEW" %]
<a class="cancel-illrequest btn btn-danger" href="/cgi-bin/koha/opac-illrequests.pl?method=cancreq&amp;illrequest_id=[% request.illrequest_id | html %]">Request cancellation</a>
[% END %]
<input type="submit" class="update-illrequest btn btn-primary" value="Submit modifications" />
[% END %]
<span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
</fieldset>
</form>
[% ELSIF method == 'availability' %]
<h1>Interlibrary loan item availability</h1>
<div id="results">
<form method="POST" action="/cgi-bin/koha/opac-illrequests.pl">
<legend><h2>Displaying availability results</h2></legend>
[% FOREACH key IN whole.keys %]
[% value = whole.$key %]
[% IF key != 'custom_key' && key != 'custom_value' %]
<input type="hidden" name="[% key | html %]" value="[% value | html %]">
[% END %]
[% END %]
[% custom_keys = whole.custom_key.split('\0') %]
[% custom_values = whole.custom_value.split('\0') %]
[% i = 0 %]
[% FOREACH custom_key IN custom_keys %]
<input type="hidden" name="custom_key" value="[% custom_key | html %]">
<input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
[% i = i + 1 %]
[% END %]
<input type="hidden" name="checked_availability" value="1">
<div id="continue-request-row" class="alert">
If you can't find what you are looking for, you can
<button class="button" type="submit">continue creating your request</button> or
<a href="/cgi-bin/koha/opac-illrequests.pl">cancel your request</a>
</div>
</form>
[% FOR service IN services %]
<h3 class="ill_availability_sourcename">[% service.name | html %]</h3>
[% INCLUDE 'ill-availability-table.inc' service=service %]
[% END %]
</div> <!-- /#illrequestupdate-form -->
[% END # / IF method == 'create' %]
</div> <!-- / #illrequests -->
[% END # /IF !backends_available %]
</div> <!-- / .col-lg-10/12 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script>
$("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "sortable": false, "searchable": false }
],
"order": [[ 3, "desc" ]],
"deferRender": true
}));
$("#backend-dropdown-options").removeClass("nojs");
[% IF services_json.length > 0 %]
var services = [% services_json | $raw %];
[% ELSE %]
var services = [];
[% END %]
[% IF metadata.length > 0 %]
var metadata = "[% metadata | $raw %]";
[% END %]
</script>
[% IF method == 'availability' %]
[% Asset.js("js/ill-availability.js") | $raw %]
<script>
$(document).ready(function() {
window.doSearch();
});
</script>
[% END %]
[% TRY %]
[% PROCESS backend_jsinclude %]
[% CATCH %]
[% END %]
[% END %]