From dfb7af91af64b2d47eb0aa2cf44e8caa7613a00b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 12 Jul 2019 14:13:50 +0000 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- admin/columns_settings.yml | 21 +++++++++++++++++++ .../prog/en/includes/columns_settings.inc | 13 ++++++++---- .../en/modules/cataloguing/z3950_search.tt | 18 +++++++++++----- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 43a2273c8c..3c5d2a9181 100644 --- a/admin/columns_settings.yml +++ b/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: diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc index abfe065afd..4c36f4b104 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc +++ b/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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt index 31bf6f89ee..37a77becec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt +++ b/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' %] Koha › Z39.50/SRU search results [% INCLUDE 'doc-head-close.inc' %] @@ -204,7 +205,7 @@ [% IF ( show_prevbutton ) %] [% END %] - Page [% current_page | html %] / [% total_pages | html %] + Showing page [% current_page | html %] of [% total_pages | html %] [% IF ( show_nextbutton ) %] [% 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' %] [% INCLUDE 'z3950_search.inc' %] [% END %] -- 2.39.5