Koha/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
Owen Leonard 59ff962caa Bug 26019: Koha should set SameSite attribute on cookies
This patch modifies the way Koha sets cookies so that the "sameSite"
attribute is explicitly set to "Lax." This option is chosen because it
is the value which is currently assumed by browsers when the sameSite
attribute is not set.

To test, apply the patch and restart services.

- Log in to the staff interface and open your browser's developer tools.
  - In Firefox, look for a "Storage" tab.
  - In Chrome, look for an "Application" tab.
- Under "Cookies," click the URL of the staff interface.
- You should see all the cookies which are set for that domain.
- The CGISESSID cookie should have sameSite set to "Lax."

- Go to Cataloging -> New record.
  - Check the "marcdocs" and "marctags" cookies.
- Switch to the Advanced MARC editor (you may need to enable
  theEnableAdvancedCatalogingEditor preference).
  - Check the "catalogue_editor" cookie.
- Add a new item to an existing bibliographic record.
  - Check the "LastCreatedItem" cookie which is set after you save the
    new item.
- Go to Authorities -> Authority search.
  - In authority search results, click "Merge" from the "Actions" menu
    next to one of the results..
    - Check the "auth_to_merge" cookie.
- Go to Administration -> MARC bibliographic framework
  - Choose "MARC structure" from the menu corresponding to one of the
    frameworks.
  - Check the "Display only used tags/subfields" checkbox.
    - Check the "marctagstructure_selectdisplay" cookie.
- Go to Circulation -> Check out to a patron with checkouts.
  - Check the "Always show checkouts immediately" checkbox.
    - Check the "issues-table-load-immediately-circulation" cookie.
- Go to Tools -> Patron clubs. You will need at least one active club
  with one or more patrons enrolled.
  - From the list of clubs, click Actions -> Search to hold.
    - Check the "holdforclub" cookie.
- Go to Tools -> Batch item modification and submit a batch of items.
  - Uncheck one or more checkboxes in the "Show/hide columns" area.
    - Check the "showColumns" cookie.
- View a patron -> Search to hold.
  - Check the 'holdfor' cookie.
- With WebBasedSelfCheck enabled, log in to the self-checkout page.
  - Check the "JWT" cookie.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-13 15:55:38 +02:00

358 lines
21 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE raw %]
[% USE Koha %]
[% USE KohaDates %]
[% USE TablesSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Cataloging [% IF ( total || breeding_loop ) %] &rsaquo; Search results [% ELSIF ( query ) %] &rsaquo; No results found [% END %] &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="cat_addbooks" class="cat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cataloging-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
[% IF ( total || breeding_loop ) %]
<li>
<a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
</li>
<li>
<a href="#" aria-current="page">Search results</a>
</li>
[% ELSIF ( query ) %]
<li>
<a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
</li>
<li>
<a href="#" aria-current="page">No results found</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
Cataloging
</a>
</li>
[% END %]
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
<div id="toolbar" class="btn-toolbar">
[% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %]
<a id="useadvanced" href="/cgi-bin/koha/cataloguing/editor.pl" class="btn btn-default"><i class="fa fa-pencil"></i> Advanced editor</a>
[% END %]
<div class="btn-group">
<button class="btn btn-default" id="newRecord"><i class="fa fa-plus"></i> New record</button>
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a id="newRecordDefault" href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=">Default framework</a></li>
[% FOREACH framework IN frameworks %]
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% framework.frameworktext | html %]</a></li>
[% END %]
</ul>
</div>
[% IF servers.count > 0 %]
<div class="btn-group">
<button class="btn btn-default" id="z3950search"><i class="fa fa-search"></i> New from Z39.50/SRU</button>
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li id="Default" class="z3950searchFw"><a href="#">Default framework</a></li>
[% FOREACH framework IN frameworks %]
<li id="[% framework.frameworkcode | html %]" class="z3950searchFw"><a href="#">[% framework.frameworktext | html %]</a></li>
[% END %]
</ul>
</div>
[% END # /IF servers.count %]
[% IF ( total ) %]
<div class="btn-group"><button type="submit" class="btn btn-default merge-items"><i class="fa fa-compress"></i> Merge selected</button></div>
[% END %]
</div> <!-- /#toolbar -->
[% END # /IF CAN_user_editcatalogue_edit_catalogue %]
[% IF ( noitemsfound ) %]
No results found
[% END %]
[%# display the search results %]
[% IF ( total ) %]
<h1>Records found in the catalog</h1>
<div>
[% total | html %] result(s) found in catalog,
<a href="#searchresult-breeding">[% breeding_count | html %] result(s) found in reservoir</a>
</div>
<div class="pages">[% pagination_bar | $raw %]</div>
<div class="searchresults">
<table>
<tr>
<th>&nbsp;</th>
<th>Title</th>
<th>Location</th>
<th>&nbsp;</th>
</tr>
[% FOREACH resultsloo IN resultsloop %]
<tr>
<td><input type="checkbox" class="selection" id="bib[% resultsloo.biblionumber | html %]" name="biblionumber" value="[% resultsloo.biblionumber | html %]" /></td>
<td>
<p>
[% INCLUDE 'biblio-title.inc' biblio=resultsloo link = 1 %]
</p>
[% IF ( resultsloo.summary ) %]
<p>[% resultsloo.summary | html %]</p>
[% ELSE %]
<p>
[% IF ( resultsloo.author ) %]
[% resultsloo.author | html %]
[% ELSE %]
&nbsp;
[% END %]
[% IF ( resultsloo.isbn ) %] - [% resultsloo.isbn | html %] [% END %]
[% IF ( resultsloo.publicationyear ) %] - [% resultsloo.publicationyear | html %][% END %]
[% IF ( resultsloo.publishercode ) %]- [% resultsloo.publishercode | html %][% END %]
[% IF ( resultsloo.copyrightdate ) %] - [% resultsloo.copyrightdate | html %][% END %]
[% IF ( resultsloo.edition ) %]Edition: [% resultsloo.edition | html %][% END %]
[% IF ( resultsloo.place ) %] ; [% resultsloo.place | html %][% END %]
[% IF ( resultsloo.pages ) %] - [% resultsloo.pages | html %][% END %]
[% IF ( resultsloo.item('size') ) %] ; [% resultsloo.item('size') | html %][% END %]
[% IF ( resultsloo.timestamp ) %] <em>(modified on [% resultsloo.timestamp | html %])</em>[% END %]
</p>
[% END %]
</td>
<td>
[% IF ( resultsloo.available_items_loop ) %]
<span class="available">
[% FOREACH items_loo IN resultsloo.available_items_loop %]
[% items_loo.count | html %] [% items_loo.branchname | html %]
[% IF ( items_loo.location ) %]<span class="shelvingloc">[% items_loo.location | html %]</span>[% END %]
[% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %]
[% IF ( items_loo.classification ) %]
<a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:[% items_loo.classification |url %]">
[% items_loo.classification | html %]
</a>
[% END %]
<br />
[% END %]
</span>
[% END %]
<span class="unavailable">
[% IF ( resultsloo.onloancount ) %] Checked out ([% resultsloo.onloancount | html %]),<br /> [% END %]
[% IF ( resultsloo.withdrawncount ) %] Withdrawn ([% resultsloo.withdrawncount | html %]),<br /> [% END %]
[% IF ( resultsloo.itemlostcount ) %] Lost ([% resultsloo.itemlostcount | html %])<br />[% END %]
[% IF ( resultsloo.recalledcount ) %] Waiting to fill recall ([% resultsloo.recalled | html %])[% END %]
[% IF ( resultsloo.onholdcount ) %] Waiting on hold ([% resultsloo.onholdcount | html %])[% END %]
</span>
<span class="notforloan">
[% IF ( resultsloo.other_items_loop ) %]
[% FOREACH items_loo IN resultsloo.other_items_loop %]
[% IF ( items_loo.notforloan ) %][% items_loo.notforloan | html %] ([% items_loo.count | html %])<br />[% END %]
[% END %]
[% END %]
</span>
</td>
<td>
<div class="dropup">
<a class="btn btn-default btn-xs dropdown-toggle" id="cataloguesearchactions[% resultsloo.biblionumber | html %]" role="button" data-toggle="dropdown" href="#">
Actions <b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% resultsloo.biblionumber | html %]">
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% resultsloo.biblionumber | uri %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% resultsloo.biblionumber | uri %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% resultsloo.biblionumber | uri %]"><i class="fa fa-pencil"></i> Edit record</a></li>
[% END %]
[% IF ( CAN_user_editcatalogue_edit_items ) %]
<li><a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% resultsloo.biblionumber | uri %]"><i class="fa fa-plus"></i> Add/Edit items</a></li>
[% END %]
</ul>
</div> <!-- /.dropup -->
</td>
</tr>
[% END # /FOREACH resultsloo %]
</table>
<div class="pages">[% pagination_bar | $raw %]</div>
</div> <!-- /.searchresults -->
[% ELSE # IF total %]
[% IF ( query ) %]
[% IF ( error ) %]
<div class="dialog alert">
[% END %]
<h3>No results found</h3>
[% IF ( error ) %]
Error: <span class="error">[% error | html %]</span>
</div>
[% END %]
[% END %]
[% END # /IF total %]
[% IF ( query ) %]
<hr />
<div id="searchresult-breeding">
<h2>Records found in the reservoir</h2>
[% IF ( breeding_loop ) %]
<table id="reservoir-table">
<thead>
<tr>
<th>Title</th>
<th>ISBN</th>
<th>Coming from</th>
<th>Import date</th>
<th class="NoSort noExport">&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH breeding_loo IN breeding_loop %]
<tr>
<td>
[% breeding_loo.title | html %] [% breeding_loo.author | html %]
</td>
<td>[% breeding_loo.isbn | html %]</td>
<td>[% breeding_loo.file | html %]</td>
<td data-sort="[% breeding_loo.upload_timestamp | html %]">[% breeding_loo.upload_timestamp | $KohaDates %]</td>
<td>
<div class="dropup">
<a class="btn btn-default btn-xs dropdown-toggle" id="reservoirsearchactions[% breeding_loo.id | html %]" role="button" data-toggle="dropdown" href="#">
Actions <b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reservoirsearchactions[% breeding_loo.id | html %]">
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id | uri %]"><i class="fa fa-plus"></i> Add biblio</a></li>
[% END %]
</ul>
</div>
</td>
</tr>
[% END # /IF breeding_loo %]
</tbody>
</table>
[% ELSE %]
<h3 id="searchresult-breeding">No results found</h3>
[% END # /IF breeding_loop %]
</div>
[% END # /IF query %]
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="dataPreviewLabel">Preview</h3>
</div>
<div class="modal-body">
<div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /#dataPreview -->
</div> <!-- /.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
//Set focus to cataloging search
$("input[name=q]:eq(0)").focus();
$("#newRecord").click(function(){
var url = $("a#newRecordDefault").prop("href");
window.location.href = url;
return false;
});
$("#z3950search").click(function(){
PopupZ3950("Default");
return false;
});
$(".z3950searchFw").click(function(){
PopupZ3950($(this).prop('id'));
return false;
});
$(".merge-items").on("click",function(e){
e.preventDefault();
MergeItems();
});
$("#useadvanced").click(function(){
Cookies.set( "catalogue_editor_[% logged_in_user.borrowernumber | html %]", "advanced", { expires: 365, path: '/', sameSite: 'Lax' } );
return true;
});
$(".previewData").on("click", function(e){
e.preventDefault();
var ltitle = $(this).text();
var page = $(this).attr("href");
$("#dataPreviewLabel").text(ltitle);
$("#dataPreview .modal-body").load(page + " div");
$('#dataPreview').modal({show:true});
});
$("#dataPreview").on("hidden.bs.modal", function(){
$("#dataPreviewLabel").html("");
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
});
columns_settings = [% TablesSettings.GetColumns( 'cataloguing', 'addbooks', 'reservoir-table', 'json' ) | $raw %]
var reservoirt = KohaTable("reservoir-table", {
"pagingType": "simple"
}, columns_settings );
});
/* this function open a popup to search on z3950 server. */
function PopupZ3950(fw) {
var strQuery = GetZ3950Terms(fw);
if(strQuery){
window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes');
}
}
/* provide Z3950 search points */
function GetZ3950Terms(fw){
var strQuery="&frameworkcode=" + fw;
[% FOREACH z3950_search_param IN z3950_search_params %]
strQuery += "&" + "[% z3950_search_param.name | uri %]" + "=" + "[% z3950_search_param.value | uri %]";
[% END %]
return strQuery;
}
/**
* This function checks if the adequate number of records are checked for merging
*/
function MergeItems() {
var checkboxes = $("input:checkbox:checked");
if (checkboxes.length < 2) {
alert(_("At least two records must be selected for merging."));
} else {
var params = [];
$(checkboxes).each(function() {
params.push('biblionumber=' + $(this).val());
});
var url = '/cgi-bin/koha/cataloguing/merge.pl?' + params.join('&');
location.href = url;
}
return false;
}
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]