Browse Source

Bug 23307: Add columns configuration to cataloguing/z3950_search.tt

This patch adds columns configuration to the DataTable which displays
Z39.50 search results in the cataloging module.

The Z39.50 results screen has its own server-side paging system, so I
added some code to copy the page number information ("Page 2 / 6") to
the DataTable toolbar for a more consistent appearance. The wording of
that information has also been modified for consistency's sake.

To test, apply the patch and restart Plack (or restart_all on
kohadevbox)

 - Go to Cataloging -> New from Z39.50/SRU.
 - Perform a Z39.50 search which will return multiple pages of results.
 - Confirm that the DataTable controls work correctly: Search, columns
   show/hide, export.
 - Confirm that the page number information is correct as you navigate
   through pages of results.

 - Go to Administration -> Columns settings.
 - Confirm that the columns configuration settings for the z3950_search
   table in the "Cataloging" section works correctly. Changes made here
   should be reflected in the table of Z39.50 search results.

 - Test other tables which use columns configuration to confirm that the
   changes made in this patch doesn't disrupt their behavior. Test that
   any custom columns configuration are applied. For example:

   - Administration -> Libraries
   - Reports -> Saved reports
   - Circulation -> Holds queue

Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Owen Leonard 4 years ago
committed by Martin Renvoize
parent
commit
dfb7af91af
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 21
      admin/columns_settings.yml
  2. 13
      koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc
  3. 18
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt

21
admin/columns_settings.yml

@ -295,6 +295,27 @@ modules:
-
columnname: stocknumber
z3950_search:
resultst:
-
columnname: server
-
columnname: title
-
columnname: author
-
columnname: date
-
columnname: edition
-
columnname: isbn
-
columnname: lccn
-
columnname: actions
cannot_be_toggled: 1
cannot_be_modified: 1
coursereserves:
courses:
course_reserves_table:

13
koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc

@ -102,11 +102,16 @@ function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) {
thead_row.before(clone);
}
table.dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
table.DataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
$(hidden_ids).each(function(index, value) {
table.fnSetColumnVis( value, false );
});
table.DataTable().on("column-visibility.dt", function(){
if( typeof columnsInit == 'function' ){
// This function can be created separately and used to trigger
// an event after the DataTable has loaded AND column visibility
// has been updated according to the table's configuration
columnsInit();
}
}).columns( hidden_ids ).visible( false );
if ( add_filters ) {
// show a link to activate filtering

18
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt

@ -2,6 +2,7 @@
[% USE Asset %]
[% SET footerjs = 1 %]
[% USE Koha %]
[% USE ColumnsSettings %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Z39.50/SRU search results</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -204,7 +205,7 @@
[% IF ( show_prevbutton ) %]
<input type="button" name="changepage_prev" value="Previous page" data-currentpage="[% current_page | html %]" />
[% END %]
Page [% current_page | html %] / [% total_pages | html %]
<span id="result_pagenumbers">Showing page [% current_page | html %] of [% total_pages | html %]</span>
[% IF ( show_nextbutton ) %]
<input type="button" name="changepage_next" value="Next page" data-currentpage="[% current_page | html %]" />
[% END %]
@ -234,6 +235,7 @@
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
[% Asset.js("js/z3950_search.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function(){
@ -248,15 +250,16 @@
});
});
$("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
var columns_settings = [% ColumnsSettings.GetColumns( 'cataloguing', 'z3950_search', 'resultst', 'json' ) | $raw %];
var thetable = KohaTable("resultst", {
"aoColumnDefs": [
{ "aTargets": [ -1,-2,-3 ], "bSortable": false, "bSearchable": false },
{ "targets": [ "NoSort" ],"sortable": false,"searchable": false },
{ "aTargets": [ 1 ], "sType": "nsb-nse" },
],
"aaSorting": [[ 1, "asc" ]],
"bPaginate": false
}));
}, columns_settings );
/* Display actions menu anywhere the table is clicked */
$("td").click(function(event){
@ -284,6 +287,11 @@
}
});
});
function columnsInit(){
$(".dataTables_info").text( $("#result_pagenumbers").text() );
$("#result_pagenumbers").hide();
}
</script>
[% INCLUDE 'z3950_search.inc' %]
[% END %]

Loading…
Cancel
Save