Bugzilla – Attachment 191328 Details for
Bug 41564
Tidy kohaTable block - admin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41564: admin - auto tidy
Bug-41564-admin---auto-tidy.patch (text/plain), 153.75 KB, created by
Owen Leonard
on 2026-01-12 19:36:41 UTC
(
hide
)
Description:
Bug 41564: admin - auto tidy
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2026-01-12 19:36:41 UTC
Size:
153.75 KB
patch
obsolete
>From d6d18b2ead8e688a8e6faac41cd036778ad223a8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 9 Jan 2026 13:10:23 +0100 >Subject: [PATCH] Bug 41564: admin - auto tidy > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../prog/en/modules/admin/aqbudgetperiods.tt | 102 +++--- > .../prog/en/modules/admin/aqbudgets.tt | 80 ++-- > .../modules/admin/auth_subfields_structure.tt | 8 +- > .../prog/en/modules/admin/background_jobs.tt | 189 +++++----- > .../modules/admin/branch_transfer_limits.tt | 43 ++- > .../prog/en/modules/admin/branches.tt | 344 +++++++++--------- > .../prog/en/modules/admin/cities.tt | 129 ++++--- > .../prog/en/modules/admin/currency.tt | 19 +- > .../prog/en/modules/admin/edi_accounts.tt | 3 +- > .../prog/en/modules/admin/file_transports.tt | 286 ++++++++------- > .../admin/identity_provider_domains.tt | 150 ++++---- > .../prog/en/modules/admin/itemtypes.tt | 55 ++- > .../prog/en/modules/admin/localization.tt | 160 ++++---- > .../en/modules/admin/marc-overlay-rules.tt | 298 ++++++++------- > .../prog/en/modules/admin/oai_servers.tt | 24 +- > .../prog/en/modules/admin/smtp_servers.tt | 166 +++++---- > .../en/modules/admin/systempreferences.tt | 63 ++-- > .../prog/en/modules/admin/z3950servers.tt | 40 +- > 18 files changed, 1109 insertions(+), 1050 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >index a081c285a06..6bf1da18ac4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >@@ -566,68 +566,64 @@ > <script> > const budget_period_description = "[% budget_period_description | html %]"; > </script> >- > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > $("#budgeth").kohaTable({ > dom: "t", > }); >- $("#move_form").submit(function(){ >- var budget_from = budget_period_description; >- var budget_to = $("#to_budget_period_id").find("option:selected").html(); >- var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to); >- alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?"); >- return confirm ( alert_message ); >- }); >+ $("#move_form").submit(function () { >+ var budget_from = budget_period_description; >+ var budget_to = $("#to_budget_period_id").find("option:selected").html(); >+ var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to); >+ alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?"); >+ return confirm(alert_message); >+ }); > }); > </script> > [% END %] > > [% IF closed %] > <script> >- $(document).ready(function() { >- var oTable = $("#closed_report").kohaTable({ >- // The following is a c/p from aqbudgets.tt and is a candidate for refactoring. >- drawCallback: function ( oSettings ) { >- if ( oSettings.aiDisplay.length == 0 ) >- { >- return; >- } >- >- var nTrs = $('#closed_report tbody tr'); >- var iColspan = nTrs[1].getElementsByTagName('td').length; >- var sLastGroup = ""; >- for ( var i=0 ; i<nTrs.length ; i++ ) >- { >- var iDisplayIndex = oSettings._iDisplayStart + i; >- var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0]; >- if ( sGroup != sLastGroup ) >- { >- var nGroup = document.createElement( 'tr' ); >- var nCell = document.createElement( 'td' ); >- nCell.colSpan = iColspan; >- nCell.className = "group"; >- nCell.innerHTML = sGroup; >- nGroup.appendChild( nCell ); >- nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >- sLastGroup = sGroup; >+ $(document).ready(function () { >+ var oTable = $("#closed_report").kohaTable({ >+ // The following is a c/p from aqbudgets.tt and is a candidate for refactoring. >+ drawCallback: function (oSettings) { >+ if (oSettings.aiDisplay.length == 0) { >+ return; > } >- } >- }, >- columnDefs: [ >- { visible: false, targets: [ 0, 1 ] }, >- { orderable: false, targets: ["_all"] } >- ], >- ordering: true, >- orderFixed: [[ 1, 'asc' ]], >- autoWidth: false, >- pagingType: "full_numbers" >- }); >+ >+ var nTrs = $("#closed_report tbody tr"); >+ var iColspan = nTrs[1].getElementsByTagName("td").length; >+ var sLastGroup = ""; >+ for (var i = 0; i < nTrs.length; i++) { >+ var iDisplayIndex = oSettings._iDisplayStart + i; >+ var sGroup = oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[0]; >+ if (sGroup != sLastGroup) { >+ var nGroup = document.createElement("tr"); >+ var nCell = document.createElement("td"); >+ nCell.colSpan = iColspan; >+ nCell.className = "group"; >+ nCell.innerHTML = sGroup; >+ nGroup.appendChild(nCell); >+ nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]); >+ sLastGroup = sGroup; >+ } >+ } >+ }, >+ columnDefs: [ >+ { visible: false, targets: [0, 1] }, >+ { orderable: false, targets: ["_all"] }, >+ ], >+ ordering: true, >+ orderFixed: [[1, "asc"]], >+ autoWidth: false, >+ pagingType: "full_numbers", >+ }); > }); > </script> > [% END %] > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > let dt_params = { > pagingType: "full", > autoWidth: false, >@@ -641,18 +637,18 @@ > budget_period_startdate: "required", > budget_period_enddate: { > required: true, >- date_on_or_after: "#from" >+ date_on_or_after: "#from", > }, > budget_period_description: "required", > budget_period_total: { >- number: true >- } >+ number: true, >+ }, > }, > messages: { > budget_period_enddate: { >- date_on_or_after: _("Budget end date must be on or after budget start date") >- } >- } >+ date_on_or_after: _("Budget end date must be on or after budget start date"), >+ }, >+ }, > }); > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >index 148e05291bc..9e5af86256c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >@@ -680,82 +680,78 @@ > <script> > const budget_period_id = [% budget_period_id || 'null' | html %]; > </script> >- > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > var oTable = $("#budgeth").kohaTable({ >- drawCallback: function ( oSettings ) { >- if ( oSettings.aiDisplay.length == 0 ) >- { >+ drawCallback: function (oSettings) { >+ if (oSettings.aiDisplay.length == 0) { > return; > } > >- var nTrs = $('#budgeth tbody tr'); >- var iColspan = nTrs[0].getElementsByTagName('td').length; >+ var nTrs = $("#budgeth tbody tr"); >+ var iColspan = nTrs[0].getElementsByTagName("td").length; > var sLastGroup = ""; >- for ( var i=0 ; i<nTrs.length ; i++ ) >- { >+ for (var i = 0; i < nTrs.length; i++) { > var iDisplayIndex = oSettings._iDisplayStart + i; >- var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; >- if ( sGroup != sLastGroup ) >- { >- var nGroup = document.createElement( 'tr' ); >- var nCell = document.createElement( 'td' ); >+ var sGroup = oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[1]; >+ if (sGroup != sLastGroup) { >+ var nGroup = document.createElement("tr"); >+ var nCell = document.createElement("td"); > nCell.colSpan = iColspan; > nCell.className = "group"; > nCell.innerHTML = sGroup; >- nGroup.appendChild( nCell ); >- nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >+ nGroup.appendChild(nCell); >+ nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]); > sLastGroup = sGroup; > } > } > }, >- footerCallback: function ( row, data, start, end, display ) { >- var api = this.api(), data; >- footer_column_sum( api, [ 4, 6, 8, 10 ], 2 ); >+ footerCallback: function (row, data, start, end, display) { >+ var api = this.api(), >+ data; >+ footer_column_sum(api, [4, 6, 8, 10], 2); > }, > columnDefs: [ >- { visible: false, targets: [ 0, 1 ] }, >- { orderable: false, targets: ["_all"] } >+ { visible: false, targets: [0, 1] }, >+ { orderable: false, targets: ["_all"] }, > ], > ordering: true, >- orderFixed: [[ 1, 'asc' ]], >+ orderFixed: [[1, "asc"]], > paging: false, >- autoWidth: false >+ autoWidth: false, > }); > let table_dt = oTable.DataTable(); > > $(oTable).treetable({ >- expandable: true >+ expandable: true, > }); >- $(oTable).treetable('expandAll'); >- $("#expand_all").click(function(e){ >+ $(oTable).treetable("expandAll"); >+ $("#expand_all").click(function (e) { > e.preventDefault(); >- $(oTable).treetable('expandAll'); >+ $(oTable).treetable("expandAll"); > }); >- $("#collapse_all").click(function(e){ >+ $("#collapse_all").click(function (e) { > e.preventDefault(); >- $(oTable).treetable('collapseAll'); >+ $(oTable).treetable("collapseAll"); > }); > >- if (!budget_period_id){ >- $("#hide_inactive").click(function(e){ >- e.preventDefault(); >- table_dt.columns(0).search(1).draw(); // Show only active=1 >- }); >- $("#show_inactive").click(function(e){ >- e.preventDefault(); >- table_dt.columns(0).search("").draw(); // Show only active=1 >- }); >- $("#hide_inactive").click(); >+ if (!budget_period_id) { >+ $("#hide_inactive").click(function (e) { >+ e.preventDefault(); >+ table_dt.columns(0).search(1).draw(); // Show only active=1 >+ }); >+ $("#show_inactive").click(function (e) { >+ e.preventDefault(); >+ table_dt.columns(0).search("").draw(); // Show only active=1 >+ }); >+ $("#hide_inactive").click(); > } > }); > </script> > [% END %] >- > <script> >- $(document).ready(function() { >- $(".deletefund-disabled").on("click", function(e){ >+ $(document).ready(function () { >+ $(".deletefund-disabled").on("click", function (e) { > e.preventDefault(); > alert(_("This fund has sub funds. It cannot be deleted.")); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >index 76f063e8fcc..769b99bc522 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >@@ -438,18 +438,17 @@ > <script> > const tagsubfield = [% IF tabsubfield %]"[% tabsubfield | html %]"[% ELSE %]null[% END %]; > </script> >- > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > $("#table_authsubfieldstructure").kohaTable({ > order: [], > paging: false, > }); > > if ($("#subfieldtabs").length > 0) { >- if (tagsubfield && tagsubfield == "@"){ >+ if (tagsubfield && tagsubfield == "@") { > $("#subfieldtabs a[href='#AT_panel']").tab("show"); >- } else if ( tagsubfield && tagsubfield != "@") { >+ } else if (tagsubfield && tagsubfield != "@") { > $(`#subfieldtabs a[href='#${tagsubfield}_panel']`).tab("show"); > } else { > $("#subfieldtabs a:first").tab("show"); >@@ -472,7 +471,6 @@ > }, > }); > } >- > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >index 78fac298b2b..eccc21bb977 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >@@ -244,106 +244,125 @@ > type: "[% job.type | html %]", > }; > </script> >- > <script> >- function get_job_type (job_type) { >- let job_type_lib = job_types.find( t => t._id == job_type ); >- if ( job_type_lib ) { >+ function get_job_type(job_type) { >+ let job_type_lib = job_types.find(t => t._id == job_type); >+ if (job_type_lib) { > return job_type_lib._str; > } > return _("Unknown job type '%s'").format(job_type); > } > >- $(document).ready(function() { >- if (op == 'view'){ >- $("#job_status_description").html( get_job_status(job.status) ); >- $("#job_type_description").html( get_job_type(job.type) ); >+ $(document).ready(function () { >+ if (op == "view") { >+ $("#job_status_description").html(get_job_status(job.status)); >+ $("#job_type_description").html(get_job_type(job.type)); > $("#job_details").show(); > } > >- let only_current_filter = function(){ >- if ( $("#only_current").is(":checked") ) { >- return 'only_current=1'; >+ let only_current_filter = function () { >+ if ($("#only_current").is(":checked")) { >+ return "only_current=1"; > } else { >- return 'only_current=0'; >+ return "only_current=0"; > } >- } >+ }; > >- let jobs_table = $("#table_jobs").kohaTable({ >- ajax: { >- "url": "/api/v1/jobs?" + only_current_filter() >- }, >- order: [[ 4, "desc" ]], >- columns: [ >- { >- data: "job_id", >- searchable: true, >- orderable: true >- }, >- { >- data: "status", >- searchable: true, >- orderable: true, >- render: function(data, type, row, meta) { >- return get_job_status(row.status).escapeHtml(); >- } >- }, >- { >- data: "progress,size", >- searchable: false, >- orderable: true, >- render: function(data, type, row, meta) { >- return "%s/%s".format(row.progress, row.size).escapeHtml(); >- } >- }, >- { >- data: "type", >- searchable: true, >- orderable: true, >- render: function(data, type, row, meta) { >- return get_job_type(row.type); >- } >- }, >- { >- data: "enqueued_date", >- searchable: true, >- orderable: true, >- render: function(data, type, row, meta) { >- return $datetime(row.enqueued_date); >- } >- }, >- { >- data: "started_date", >- searchable: true, >- orderable: true, >- render: function(data, type, row, meta) { >- return $datetime(row.started_date); >- } >- }, >- { >- data: "ended_date", >- searchable: true, >- orderable: true, >- render: function(data, type, row, meta) { >- return $datetime(row.ended_date); >- } >+ let jobs_table = $("#table_jobs").kohaTable( >+ { >+ ajax: { >+ url: "/api/v1/jobs?" + only_current_filter(), > }, >- { >- data: function( row, type, val, meta ) { >- var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id='+ encodeURIComponent(row.job_id) +'"><i class="fa-solid fa-eye aria-hidden="true"></i> '+_("View")+'</a>'+"\n"; >- if ( row.status == 'new' || row.status == 'started' ) { >- result += '<a class="btn btn-default btn-xs submit-form-link" role="button" href="#" data-action="/cgi-bin/koha/admin/background_jobs.pl" data-method="post" data-op="cud-cancel" data-confirmation-msg="' + _("Are you sure you want to cancel this job?") + '" data-id="'+ encodeURIComponent(row.job_id) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Cancel")+'</a>'; >- } >- return result; >+ order: [[4, "desc"]], >+ columns: [ >+ { >+ data: "job_id", >+ searchable: true, >+ orderable: true, > }, >- searchable: false, >- orderable: false >- } >- ] >- }, null, 1); >+ { >+ data: "status", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return get_job_status(row.status).escapeHtml(); >+ }, >+ }, >+ { >+ data: "progress,size", >+ searchable: false, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return "%s/%s".format(row.progress, row.size).escapeHtml(); >+ }, >+ }, >+ { >+ data: "type", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return get_job_type(row.type); >+ }, >+ }, >+ { >+ data: "enqueued_date", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $datetime(row.enqueued_date); >+ }, >+ }, >+ { >+ data: "started_date", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $datetime(row.started_date); >+ }, >+ }, >+ { >+ data: "ended_date", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $datetime(row.ended_date); >+ }, >+ }, >+ { >+ data: function (row, type, val, meta) { >+ var result = >+ '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=' + >+ encodeURIComponent(row.job_id) + >+ '"><i class="fa-solid fa-eye aria-hidden="true"></i> ' + >+ _("View") + >+ "</a>" + >+ "\n"; >+ if (row.status == "new" || row.status == "started") { >+ result += >+ '<a class="btn btn-default btn-xs submit-form-link" role="button" href="#" data-action="/cgi-bin/koha/admin/background_jobs.pl" data-method="post" data-op="cud-cancel" data-confirmation-msg="' + >+ _("Are you sure you want to cancel this job?") + >+ '" data-id="' + >+ encodeURIComponent(row.job_id) + >+ '"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + >+ _("Cancel") + >+ "</a>"; >+ } >+ return result; >+ }, >+ searchable: false, >+ orderable: false, >+ }, >+ ], >+ }, >+ null, >+ 1 >+ ); > >- $("#only_current").on("change", function(){ >- jobs_table.DataTable().ajax.url("/api/v1/jobs?" + only_current_filter()).load(); >+ $("#only_current").on("change", function () { >+ jobs_table >+ .DataTable() >+ .ajax.url("/api/v1/jobs?" + only_current_filter()) >+ .load(); > return false; > }); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt >index a8ecf568c0b..35cc0d7d2c3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt >@@ -135,54 +135,53 @@ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] >- <script> >- const codes_loop = [% To.json(codes_loop) | $raw %]; >- </script> >- >- <script> >- $(document).ready(function(){ >- $("#CheckAll").on("click", function(e){ >+ <script> >+ const codes_loop = [% To.json(codes_loop) | $raw %]; >+ </script> >+ <script> >+ $(document).ready(function () { >+ $("#CheckAll").on("click", function (e) { > e.preventDefault(); >- $(".cb").each(function(){ >+ $(".cb").each(function () { > $(this).prop("checked", true); > }); > }); > >- $("#UncheckAll").on("click", function(e){ >+ $("#UncheckAll").on("click", function (e) { > e.preventDefault(); >- $(".cb").each(function(){ >+ $(".cb").each(function () { > $(this).prop("checked", false); > }); > }); > >- if( $("#transferlimit_tabs .tab-pane.active").length < 1 ){ >- $("#transferlimit_tabs a:first").tab("show"); >+ if ($("#transferlimit_tabs .tab-pane.active").length < 1) { >+ $("#transferlimit_tabs a:first").tab("show"); > } > >- $('#branchselect').change(function() { >- $('#selectlibrary').submit(); >- }); >+ $("#branchselect").change(function () { >+ $("#selectlibrary").submit(); >+ }); > > var checkall = $(".checkall"); > var uncheckall = $(".uncheckall"); > >- $(checkall).on("click", function(e){ >+ $(checkall).on("click", function (e) { > e.preventDefault(); > var tid = $(this).data("cb"); >- $(".cb" + tid ).each(function(){ >+ $(".cb" + tid).each(function () { > $(this).prop("checked", true); >- }) >+ }); > }); > >- $(uncheckall).on("click", function(e){ >+ $(uncheckall).on("click", function (e) { > e.preventDefault(); > var tid = $(this).data("cb"); >- $(".cb" + tid ).each(function(){ >+ $(".cb" + tid).each(function () { > $(this).prop("checked", false); >- }) >+ }); > }); > >- codes_loop.forEach((code) => { >+ codes_loop.forEach(code => { > $(`#${code.code}table`).kohaTable({ > paging: false, > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >index ef52fb79642..f558edfba1c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >@@ -820,182 +820,190 @@ > var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %]; > var calendarFirstDayOfWeek = '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]'; > </script> >- > <script> > var libraries_table; >- $(document).ready(function() { >- >- var libraries_url = '/api/v1/libraries'; >- libraries_table = $("#libraries").kohaTable({ >- ajax: { >- "url": libraries_url >- }, >- embed: [ 'smtp_server', 'library_hours' ], >- emptyTable: '<div class="alert alert-info">'+_("There are no libraries defined.")+' <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">'+_("Start defining libraries")+'</a>.</div>', >- columnDefs: [ { >- targets: [1,3,4,5,6], >- render: function (data, type, row, meta) { >- if ( type == 'display' ) { >- if ( data != null ) { >- return data.escapeHtml(); >- } >- else { >- return ""; >- } >- } >- return data; >- } >- } ], >- columns: [ >- { >- data: "name", >- searchable: true, >- orderable: true, >- render: function( data, type, row, meta ) { >- return "<a href=\"/cgi-bin/koha/admin/branches.pl?op=view&branchcode=" + encodeURIComponent( row.library_id ) + "\">" + row.name.escapeHtml() + "</a>"; >- } >- }, >- { >- data: "library_id", >- searchable: true, >- orderable: true >+ $(document).ready(function () { >+ var libraries_url = "/api/v1/libraries"; >+ libraries_table = $("#libraries").kohaTable( >+ { >+ ajax: { >+ url: libraries_url, > }, >- { >- render: function( data, type, row, meta ) { >- const library_info = []; >- if ( row.address1 != null ) library_info.push(row.address1.escapeHtml()); >- if ( row.address2 != null ) library_info.push(row.address2.escapeHtml()); >- if ( row.address3 != null ) library_info.push(row.address3.escapeHtml()); >- // geographical_location = city, state postal_code >- const locations = []; >- if ( row.city != null ) locations.push(row.city.escapeHtml()); >- if ( row.state != null ) locations.push(row.state.escapeHtml()); >- const geographical_location = locations.join(', '); >- if ( geographical_location != '' && row.postal_code != null) { >- library_info.push(geographical_location+' '+row.postal_code.escapeHtml()); >- } >- else { >- library_info.push(geographical_location); >- } >- if ( row.country != null ) library_info.push(row.country.escapeHtml()); >- if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml()); >- if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml()); >- if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>'); >- if ( row.url != null ) library_info.push('<a href="'+encodeURI(row.url)+'">'+row.url.escapeHtml()+'</a>'); >- if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml()); >- return library_info.join('<br/>'); >+ embed: ["smtp_server", "library_hours"], >+ emptyTable: '<div class="alert alert-info">' + _("There are no libraries defined.") + ' <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">' + _("Start defining libraries") + "</a>.</div>", >+ columnDefs: [ >+ { >+ targets: [1, 3, 4, 5, 6], >+ render: function (data, type, row, meta) { >+ if (type == "display") { >+ if (data != null) { >+ return data.escapeHtml(); >+ } else { >+ return ""; >+ } >+ } >+ return data; >+ }, > }, >- searchable: false, >- orderable: false >- }, >- { >- data: "marc_org_code", >- searchable: true, >- orderable: true >- }, >- { >- data: "ip", >- searchable: true, >- orderable: true >- }, >- { >- data: "pickup_location", >- searchable: true, >- orderable: true, >- render: function( data, type, row, meta ) { >- return (data) ? _("Yes") : _("No"); >- } >- }, >- { >- data: "public", >- searchable: true, >- orderable: true, >- render: function( data, type, row, meta ) { >- return (data) ? _("Yes") : _("No"); >- } >- }, >- { >- data: "smtp_server", >- render: function( data, type, row, meta ) { >- if ( data.smtp_server_id ) { >- return '<a href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id='+encodeURIComponent(data.smtp_server_id)+'">'+data.name.escapeHtml()+'</a>'; >- } >- else { >- return _("Default").escapeHtml(); >- } >+ ], >+ columns: [ >+ { >+ data: "name", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return '<a href="/cgi-bin/koha/admin/branches.pl?op=view&branchcode=' + encodeURIComponent(row.library_id) + '">' + row.name.escapeHtml() + "</a>"; >+ }, > }, >- searchable: false, >- visible: true, >- orderable: false >- }, >- { >- data: function( row, type, val, meta ) { >- let result = ''; >- let set_hours = 0; >- if ( row.library_hours.length > 0 ) { >- for (let check_counter = 0; check_counter < 7; check_counter++) { >- if ( row.library_hours[check_counter].open_time != null || row.library_hours[check_counter].close_time != null ) { >- set_hours = 1; >+ { >+ data: "library_id", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ render: function (data, type, row, meta) { >+ const library_info = []; >+ if (row.address1 != null) library_info.push(row.address1.escapeHtml()); >+ if (row.address2 != null) library_info.push(row.address2.escapeHtml()); >+ if (row.address3 != null) library_info.push(row.address3.escapeHtml()); >+ // geographical_location = city, state postal_code >+ const locations = []; >+ if (row.city != null) locations.push(row.city.escapeHtml()); >+ if (row.state != null) locations.push(row.state.escapeHtml()); >+ const geographical_location = locations.join(", "); >+ if (geographical_location != "" && row.postal_code != null) { >+ library_info.push(geographical_location + " " + row.postal_code.escapeHtml()); >+ } else { >+ library_info.push(geographical_location); >+ } >+ if (row.country != null) library_info.push(row.country.escapeHtml()); >+ if (row.phone != null) library_info.push(_("Ph: ") + row.phone.escapeHtml()); >+ if (row.fax != null) library_info.push(_("Fax: ") + row.fax.escapeHtml()); >+ if (row.email != null) library_info.push('<a href="mailto:' + encodeURIComponent(row.email) + '">' + row.email.escapeHtml() + "</a>"); >+ if (row.url != null) library_info.push('<a href="' + encodeURI(row.url) + '">' + row.url.escapeHtml() + "</a>"); >+ if (row.notes != null) library_info.push(_("Notes") + ": " + row.notes.escapeHtml()); >+ return library_info.join("<br/>"); >+ }, >+ searchable: false, >+ orderable: false, >+ }, >+ { >+ data: "marc_org_code", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "ip", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "pickup_location", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return data ? _("Yes") : _("No"); >+ }, >+ }, >+ { >+ data: "public", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return data ? _("Yes") : _("No"); >+ }, >+ }, >+ { >+ data: "smtp_server", >+ render: function (data, type, row, meta) { >+ if (data.smtp_server_id) { >+ return '<a href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id=' + encodeURIComponent(data.smtp_server_id) + '">' + data.name.escapeHtml() + "</a>"; >+ } else { >+ return _("Default").escapeHtml(); >+ } >+ }, >+ searchable: false, >+ visible: true, >+ orderable: false, >+ }, >+ { >+ data: function (row, type, val, meta) { >+ let result = ""; >+ let set_hours = 0; >+ if (row.library_hours.length > 0) { >+ for (let check_counter = 0; check_counter < 7; check_counter++) { >+ if (row.library_hours[check_counter].open_time != null || row.library_hours[check_counter].close_time != null) { >+ set_hours = 1; >+ } > } > } >- } >- if ( set_hours > 0 ) { >- const daysOfWeek = [ _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday") ]; >+ if (set_hours > 0) { >+ const daysOfWeek = [_("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")]; > >- result = '<table id="library_hours_table"><thead><tr><th>Day</th><th>Open time</th><th>Close time</th></tr></thead><tbody>'; >- let counter = 0; >- for (let i = calendarFirstDayOfWeek; counter < 7; i++) { >- const day = i % 7; // Wrap around the day using modulo operator >- result += '<tr id="hours_'+day+'">'; >- result += '<td>'+daysOfWeek[day].escapeHtml()+'</td>'; >- result += '<td><span>'; >- result += row.library_hours[day].open_time != null ? $kohatime(row.library_hours[day].open_time): ''; >- result += '</span></td>'; >- result += '<td><span>'; >- result += row.library_hours[day].close_time != null ? $kohatime(row.library_hours[day].close_time): ''; >- result += '</span></td>'; >- result += '</tr>'; >- counter++; >+ result = '<table id="library_hours_table"><thead><tr><th>Day</th><th>Open time</th><th>Close time</th></tr></thead><tbody>'; >+ let counter = 0; >+ for (let i = calendarFirstDayOfWeek; counter < 7; i++) { >+ const day = i % 7; // Wrap around the day using modulo operator >+ result += '<tr id="hours_' + day + '">'; >+ result += "<td>" + daysOfWeek[day].escapeHtml() + "</td>"; >+ result += "<td><span>"; >+ result += row.library_hours[day].open_time != null ? $kohatime(row.library_hours[day].open_time) : ""; >+ result += "</span></td>"; >+ result += "<td><span>"; >+ result += row.library_hours[day].close_time != null ? $kohatime(row.library_hours[day].close_time) : ""; >+ result += "</span></td>"; >+ result += "</tr>"; >+ counter++; >+ } >+ result += "</tbody></table>"; >+ } else { >+ result = _("Library hours not set").escapeHtml(); > } >- result += '</tbody></table>'; >- } else { >- result = _("Library hours not set").escapeHtml(); >- } >- return result; >+ return result; >+ }, >+ searchable: false, >+ orderable: false, > }, >- searchable: false, >- orderable: false >- }, >- { >- data: function( row, type, val, meta ) { >- >- var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode='+encodeURIComponent(row.library_id)+'" role="button"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'; >- result += '<form action="/cgi-bin/koha/admin/branches.pl" method="get">'; >- result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n"; >- result += '<input type="hidden" name="op" value="delete_confirm" />'; >- result += '<button type="submit" id="delete_library_'+row.library_id.escapeHtml()+'" class="btn btn-default btn-xs" role="button"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</button></form>'; >- >- return result; >+ { >+ data: function (row, type, val, meta) { >+ var result = >+ '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode=' + >+ encodeURIComponent(row.library_id) + >+ '" role="button"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + >+ _("Edit") + >+ "</a>"; >+ result += '<form action="/cgi-bin/koha/admin/branches.pl" method="get">'; >+ result += '<input type="hidden" name="branchcode" value="' + row.library_id.escapeHtml() + '" />' + "\n"; >+ result += '<input type="hidden" name="op" value="delete_confirm" />'; >+ result += >+ '<button type="submit" id="delete_library_' + >+ row.library_id.escapeHtml() + >+ '" class="btn btn-default btn-xs" role="button"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + >+ _("Delete") + >+ "</button></form>"; > >+ return result; >+ }, >+ searchable: false, >+ orderable: false, > }, >- searchable: false, >- orderable: false >- }, >- ], >- bKohaColumnsUseNames: true, >- }, table_settings); >+ ], >+ bKohaColumnsUseNames: true, >+ }, >+ table_settings >+ ); > }); > >- $( ".expand-textarea" ).on("click", function(e){ >+ $(".expand-textarea").on("click", function (e) { > e.preventDefault(); > $(this).hide(); > var target = $(this).data("target"); > var syntax = $(this).data("syntax"); >- $("#collapse_" + target ).show(); >- if( syntax ){ >- var esLintConfig = { 'esversion': 6 }; >- var lint_type = syntax === 'javascript' ? esLintConfig : true; >- var editor = CodeMirror.fromTextArea( document.getElementById( target ), { >+ $("#collapse_" + target).show(); >+ if (syntax) { >+ var esLintConfig = { esversion: 6 }; >+ var lint_type = syntax === "javascript" ? esLintConfig : true; >+ var editor = CodeMirror.fromTextArea(document.getElementById(target), { > lineNumbers: true, > mode: syntax, > lineWrapping: true, >@@ -1003,32 +1011,31 @@ > gutters: ["CodeMirror-lint-markers"], > lint: lint_type, > }); >- editor.on("blur", function(){ >+ editor.on("blur", function () { > editor.save(); > }); > } else { >- $( target ).show(); >+ $(target).show(); > } > }); > >- $( ".collapse-textarea" ).on("click", function(e){ >+ $(".collapse-textarea").on("click", function (e) { > e.preventDefault(); > $(this).hide(); > var target = $(this).data("target"); > var syntax = $(this).data("syntax"); >- $("#expand_" + target ).show(); >- if( syntax ){ >- var editor = $( "#" + target ).next(".CodeMirror")[0].CodeMirror; >+ $("#expand_" + target).show(); >+ if (syntax) { >+ var editor = $("#" + target).next(".CodeMirror")[0].CodeMirror; > editor.toTextArea(); > } >- $( "#" + target ).hide(); >+ $("#" + target).hide(); > }); > </script> >- > [% UNLESS library %] > <script> >- $("#Aform").on("submit", function( event ) { >- if ( $("#branchcode").val().match(/\s/) ) { >+ $("#Aform").on("submit", function (event) { >+ if ($("#branchcode").val().match(/\s/)) { > event.preventDefault(); > alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code")); > return false; >@@ -1038,7 +1045,6 @@ > }); > </script> > [% END %] >- > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt >index 81144320d38..d6c85353c4a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt >@@ -219,67 +219,80 @@ > [% END %] > }); > </script> >- > <script> >- $(document).ready(function() { >- var cities_table = $("#table_cities").kohaTable({ >- ajax: { >- "url": cities_table_url >- }, >- order: [[ 1, "asc" ]], >- columnDefs: [ { >- targets: [0,1,2,3,4], >- render: function (data, type, row, meta) { >- if ( type == 'display' ) { >- if ( data != null ) { >- return data.escapeHtml(); >- } else { >- return ""; >- } >- } >- return data; >- } >- } ], >- columns: [ >- { >- data: "city_id", >- searchable: true, >- orderable: true >- }, >- { >- data: "name", >- searchable: true, >- orderable: true >+ $(document).ready(function () { >+ var cities_table = $("#table_cities").kohaTable( >+ { >+ ajax: { >+ url: cities_table_url, > }, >- { >- data: "state", >- searchable: true, >- orderable: true >- }, >- { >- data: "postal_code", >- searchable: true, >- orderable: true >- }, >- { >- data: "country", >- searchable: true, >- orderable: true >- }, >- { >- data: function( row, type, val, meta ) { >- >- var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=add_form&cityid='+ encodeURIComponent(row.city_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; >- result += '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&cityid='+ encodeURIComponent(row.city_id) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>'; >- return result; >- >+ order: [[1, "asc"]], >+ columnDefs: [ >+ { >+ targets: [0, 1, 2, 3, 4], >+ render: function (data, type, row, meta) { >+ if (type == "display") { >+ if (data != null) { >+ return data.escapeHtml(); >+ } else { >+ return ""; >+ } >+ } >+ return data; >+ }, > }, >- searchable: false, >- orderable: false >- } >- ] >- }, table_settings, 1); >- >+ ], >+ columns: [ >+ { >+ data: "city_id", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "name", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "state", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "postal_code", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "country", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: function (row, type, val, meta) { >+ var result = >+ '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=add_form&cityid=' + >+ encodeURIComponent(row.city_id) + >+ '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + >+ _("Edit") + >+ "</a>" + >+ "\n"; >+ result += >+ '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&cityid=' + >+ encodeURIComponent(row.city_id) + >+ '"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + >+ _("Delete") + >+ "</a>"; >+ return result; >+ }, >+ searchable: false, >+ orderable: false, >+ }, >+ ], >+ }, >+ table_settings, >+ 1 >+ ); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >index 4c8080726a3..18ce99e98ff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >@@ -269,28 +269,27 @@ > <script> > let table_settings = [% TablesSettings.GetTableSettings( 'admin', 'currency', 'currencies-table', 'json' ) | $raw %] > </script> >- > <script> > function check_currency(val) { >- if ( val == 1.0 ) { >- $("#active").prop('disabled', false); >+ if (val == 1.0) { >+ $("#active").prop("disabled", false); > $("#hint").html(""); > } else { >- $("#active").prop('checked', false); >- $("#active").prop('disabled', true); >+ $("#active").prop("checked", false); >+ $("#active").prop("disabled", true); > $("#hint").html(_("The active currency must have a rate of 1.0")); > } > } > >- $(document).ready(function() { >+ $(document).ready(function () { > $("#currencies-table").kohaTable({}, table_settings); > > // prevents users to check active with a currency != 1 >- $("#rate").keyup(function() { >- check_currency( $(this).val() ); >+ $("#rate").keyup(function () { >+ check_currency($(this).val()); > }); >- check_currency( $("#rate").val() ); >- $("#currency_code").on("blur",function(){ >+ check_currency($("#rate").val()); >+ $("#currency_code").on("blur", function () { > toUC(this); > }); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt >index 57f969d9423..94a4838b95f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt >@@ -412,9 +412,8 @@ > <script> > var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'edi_accounts', 'edi_accounts_table', 'json' ) | $raw %]; > </script> >- > <script> >- $(document).ready(function(){ >+ $(document).ready(function () { > $("#edi_accounts_table").kohaTable( > { > pagingType: "full", >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt >index 3cdcb466ac8..84d635dadab 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt >@@ -464,123 +464,123 @@ > on: "[% tp("Active", "On") | html %]"; > }; > </script> >- > <script> >- $(document).ready(function() { >- >- var file_transports_url = '/api/v1/config/file_transports'; >+ $(document).ready(function () { >+ var file_transports_url = "/api/v1/config/file_transports"; > window.file_transports = $("#file_transports").kohaTable({ >- "ajax": { >- "url": file_transports_url >+ ajax: { >+ url: file_transports_url, > }, >- "language": { >- "emptyTable": "<div class=\"alert alert-info\">"+_("There are no file transports defined.")+"</div>" >+ language: { >+ emptyTable: '<div class="alert alert-info">' + _("There are no file transports defined.") + "</div>", > }, >- "columnDefs": [ { >- "targets": [0,1], >- "render": function(data, type, row, meta) { >- if (type == "display") { >- if(data != null) { >- return data.escapeHtml(); >- } else { >- return "Default"; >+ columnDefs: [ >+ { >+ targets: [0, 1], >+ render: function (data, type, row, meta) { >+ if (type == "display") { >+ if (data != null) { >+ return data.escapeHtml(); >+ } else { >+ return "Default"; >+ } > } >- } >- return data; >- } >- } ], >- "columns": [ >+ return data; >+ }, >+ }, >+ ], >+ columns: [ > { >- "data": "name", >- "searchable": true, >- "orderable": true >+ data: "name", >+ searchable: true, >+ orderable: true, > }, > { >- "data": "host", >- "searchable": true, >- "orderable": true >+ data: "host", >+ searchable: true, >+ orderable: true, > }, > { >- "data": "port", >- "searchable": true, >- "orderable": false >+ data: "port", >+ searchable: true, >+ orderable: false, > }, > { >- "data": "transport", >- "render": function(data, type, row, meta) { >+ data: "transport", >+ render: function (data, type, row, meta) { > return data.toUpperCase(); > }, >- "searchable": true, >- "orderable": false >+ searchable: true, >+ orderable: false, > }, > { >- "data": "auth_mode", >- "render": function(data, type, row, meta) { >- if(data == "password") { >+ data: "auth_mode", >+ render: function (data, type, row, meta) { >+ if (data == "password") { > return _("Password-based"); >- } else if(data == "key_file") { >+ } else if (data == "key_file") { > return _("Key file-based"); > } else { > return _("No authentication"); > } > }, >- "searchable": false, >- "orderable": false >+ searchable: false, >+ orderable: false, > }, > { >- "data": "user_name", >- "searchable": false, >- "orderable": false >+ data: "user_name", >+ searchable: false, >+ orderable: false, > }, > { >- "data": "download_directory", >- "render": function(data, type, row, meta) { >- if(data) { >+ data: "download_directory", >+ render: function (data, type, row, meta) { >+ if (data) { > return data; > } else { > return "<em>" + _("Not specified") + "</em>"; > } > }, >- "searchable": false, >- "orderable": false >+ searchable: false, >+ orderable: false, > }, > { >- "data": "upload_directory", >- "render": function(data, type, row, meta) { >- if(data) { >+ data: "upload_directory", >+ render: function (data, type, row, meta) { >+ if (data) { > return data; > } else { > return "<em>" + _("Not specified") + "</em>"; > } > }, >- "searchable": false, >- "orderable": false >+ searchable: false, >+ orderable: false, > }, > { >- "data": "status", >- "render": function(data, type, row, meta) { >- let render = ''; >+ data: "status", >+ render: function (data, type, row, meta) { >+ let render = ""; > if (data) { > if (data.status == "ok") { > render += '<i class="text-success fa-solid fa-circle-check"></i> '; > render += '<span class="text-success">'; > render += _("Tests passing"); >- render += '</span>' >+ render += "</span>"; > } else if (data.status == "errors") { > data.operations.forEach(operation => { > render += "<div>"; >- if ( operation.status == "error" ) { >+ if (operation.status == "error") { > render += '<i class="text-danger fa-solid fa-circle-xmark"></i> '; > render += '<span class="text-danger">'; > render += operationLabels[operation.code] || operation.code; >- render += ' ' + _("failed"); >- render += '</span>'; >+ render += " " + _("failed"); >+ render += "</span>"; > } else { > render += '<i class="text-success fa-solid fa-circle-check"></i> '; > render += '<span class="text-success">'; > render += operationLabels[operation.code] || operation.code; >- render += ' ' + _("ok"); >- render += '</span>'; >+ render += " " + _("ok"); >+ render += "</span>"; > } > render += "</div>"; > }); >@@ -592,124 +592,134 @@ > } > return render; > }, >- "searchable": false, >- "orderable": false >+ searchable: false, >+ orderable: false, > }, > { >- "data": "debug", >- "render": function(data, type, row, meta) { >- if(data == true) { >+ data: "debug", >+ render: function (data, type, row, meta) { >+ if (data == true) { > return i18n.on; >- } >- else { >+ } else { > return _("Off"); > } > }, >- "searchable": false, >- "orderable": false >+ searchable: false, >+ orderable: false, > }, > { >- "data": function(row, type, val, meta) { >- let result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/file_transports.pl?op=edit_form&file_transport_id='+ encodeURIComponent(row.file_transport_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; >- result += '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-file-transport-id="'+ encodeURIComponent(row.file_transport_id) +'" data-file-transport-name="'+ encodeURIComponent(row.name.escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>'; >+ data: function (row, type, val, meta) { >+ let result = >+ '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/file_transports.pl?op=edit_form&file_transport_id=' + >+ encodeURIComponent(row.file_transport_id) + >+ '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + >+ _("Edit") + >+ "</a>" + >+ "\n"; >+ result += >+ '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-file-transport-id="' + >+ encodeURIComponent(row.file_transport_id) + >+ '" data-file-transport-name="' + >+ encodeURIComponent(row.name.escapeHtml()) + >+ '"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + >+ _("Delete") + >+ "</a>"; > return result; > }, >- "searchable": false, >- "orderable": false >- } >+ searchable: false, >+ orderable: false, >+ }, > ], >- createdRow: function(row, data, dataIndex) { >- if(data.is_default) { >- $(row).addClass('default warn'); >+ createdRow: function (row, data, dataIndex) { >+ if (data.is_default) { >+ $(row).addClass("default warn"); > } >- if(data.debug) { >- $(row).addClass('debug'); >+ if (data.debug) { >+ $(row).addClass("debug"); > } > }, > }); > >- $('#file_transports').on("click", '.delete_server', function() { >- var file_transport_id = $(this).data('file-transport-id'); >- var file_transport_name = decodeURIComponent($(this).data('file-transport-name')); >+ $("#file_transports").on("click", ".delete_server", function () { >+ var file_transport_id = $(this).data("file-transport-id"); >+ var file_transport_name = decodeURIComponent($(this).data("file-transport-name")); > >- $("#delete_confirm_dialog").html( >- _("You are about to delete the '%s' file transport.").format(file_transport_name) >- ); >- $("#delete_confirm_modal_button").data('file-transport-id', file_transport_id); >- $("#delete_confirm_modal_button").data('file-transport-name', file_transport_name); >+ $("#delete_confirm_dialog").html(_("You are about to delete the '%s' file transport.").format(file_transport_name)); >+ $("#delete_confirm_modal_button").data("file-transport-id", file_transport_id); >+ $("#delete_confirm_modal_button").data("file-transport-name", file_transport_name); > }); > >- $("#delete_confirm_modal_button").on("click", function() { >- >- var file_transport_id = $(this).data('file-transport-id'); >- var file_transport_name = $(this).data('file-transport-name'); >+ $("#delete_confirm_modal_button").on("click", function () { >+ var file_transport_id = $(this).data("file-transport-id"); >+ var file_transport_name = $(this).data("file-transport-name"); > > $.ajax({ > method: "DELETE", >- url: "/api/v1/config/file_transports/"+file_transport_id >- }).success(function() { >- window.file_transports.api().ajax.reload(function(data) { >- $("#action_result_dialog").hide(); >- $("#delete_success").html(_("Server '%s' deleted successfully.").format(file_transport_name)).show(); >+ url: "/api/v1/config/file_transports/" + file_transport_id, >+ }) >+ .success(function () { >+ window.file_transports.api().ajax.reload(function (data) { >+ $("#action_result_dialog").hide(); >+ $("#delete_success").html(_("Server '%s' deleted successfully.").format(file_transport_name)).show(); >+ }); >+ }) >+ .fail(function () { >+ $("#delete_error").html(_("Error deleting server '%s'. Please ensure all linked EDI accounts are unlinked or deleted. Check the logs for details.").format(file_transport_name)).show(); >+ }) >+ .done(function () { >+ $("#delete_confirm_modal").modal("hide"); > }); >- }).fail(function() { >- $("#delete_error").html(_("Error deleting server '%s'. Please ensure all linked EDI accounts are unlinked or deleted. Check the logs for details.").format(file_transport_name)).show(); >- }).done(function() { >- $("#delete_confirm_modal").modal('hide'); >- }); > }); > > transportChange(); >- $("#transport").on("change", function(event) { >+ $("#transport").on("change", function (event) { > transportChange(); > }); > > authModeChange(); >- $("#auth_mode").on("change", function(event) { >+ $("#auth_mode").on("change", function (event) { > authModeChange(); > }); > >- $('#confirm_key_accept_submit').on('click', function(event) { >+ $("#confirm_key_accept_submit").on("click", function (event) { > event.preventDefault(); > >- if ( $('#add').length > 0 ) { >- if( $('#add').valid() == true ) { >+ if ($("#add").length > 0) { >+ if ($("#add").valid() == true) { > modalChange(); >- $('#confirm_key_accept').modal('show'); >+ $("#confirm_key_accept").modal("show"); > } else { >- $('#confirm_key_accept').modal('hide'); >+ $("#confirm_key_accept").modal("hide"); > } > } > >- if ( $('#edit_save').length > 0 ) { >- if( $('#edit_save').valid() == true ) { >+ if ($("#edit_save").length > 0) { >+ if ($("#edit_save").valid() == true) { > modalChange(); >- $('#confirm_key_accept').modal('show'); >+ $("#confirm_key_accept").modal("show"); > } else { >- $('#confirm_key_accept').modal('hide'); >+ $("#confirm_key_accept").modal("hide"); > } > } >- > }); > >- $('#confirm_key_accept .approve').on('click', function() { >- $('#confirm_key_accept .deny').click(); >+ $("#confirm_key_accept .approve").on("click", function () { >+ $("#confirm_key_accept .deny").click(); > >- if ( $('#add').length > 0 ) { >- $('#add').submit(); >+ if ($("#add").length > 0) { >+ $("#add").submit(); > } > >- if ( $('#edit_save').length > 0 ) { >- $('#edit_save').submit(); >+ if ($("#edit_save").length > 0) { >+ $("#edit_save").submit(); > } > }); >- > }); > > function transportChange() { > let transport = $("#transport"); > >- if(transport.val() == "ftp") { >+ if (transport.val() == "ftp") { > $("#host").removeAttr("disabled"); > $("#port").removeAttr("disabled"); > $("#passive").removeAttr("disabled"); >@@ -721,15 +731,15 @@ > $("#auth_mode option[value='password']").removeAttr("disabled"); > $("#auth_mode option[value='key_file']").attr("disabled", "disabled"); > $("#auth_mode option[value='noauth']").removeAttr("disabled"); >- if($("#auth_mode option:selected").val() == "key_file") { >+ if ($("#auth_mode option:selected").val() == "key_file") { > $("#auth_mode option[value='password']").prop("selected", true); > } > > let port = $("#port").val(); >- if(port == 22) $("#port").val("21"); >+ if (port == 22) $("#port").val("21"); > > authModeChange(); >- } else if(transport.val() == "sftp") { >+ } else if (transport.val() == "sftp") { > $("#host").removeAttr("disabled"); > $("#port").removeAttr("disabled"); > $("#passive").attr("disabled", "disabled"); >@@ -744,7 +754,7 @@ > $("#passive option[value='1']").prop("selected", true); > > let port = $("#port").val(); >- if(port == 21) $("#port").val("22"); >+ if (port == 21) $("#port").val("22"); > > return authModeChange(); > } >@@ -753,10 +763,10 @@ > function authModeChange() { > let auth_mode = $("#auth_mode").val(); > >- if(auth_mode == "password") { >+ if (auth_mode == "password") { > $("#password").removeAttr("disabled"); > $("#key_file").attr("disabled", "disabled"); >- } else if(auth_mode == "key_file") { >+ } else if (auth_mode == "key_file") { > $("#password").attr("disabled", "disabled"); > $("#key_file").removeAttr("disabled"); > } else { >@@ -766,14 +776,14 @@ > } > > function modalChange() { >- $('#modal_message').hide(); >- if ( $('#transport').val() == 'sftp' ) $('#modal_message').show(); >- >- $('#modal_host').text( $('#host').val() ); >- $('#modal_port').text( $('#port').val() ); >- $('#modal_transport').text( $('#transport option:selected').text() ); >- $('#modal_user_name').text( $('#user_name').val() ); >- $('#modal_auth_mode').text( $('#auth_mode option:selected').text() ); >+ $("#modal_message").hide(); >+ if ($("#transport").val() == "sftp") $("#modal_message").show(); >+ >+ $("#modal_host").text($("#host").val()); >+ $("#modal_port").text($("#port").val()); >+ $("#modal_transport").text($("#transport option:selected").text()); >+ $("#modal_user_name").text($("#user_name").val()); >+ $("#modal_auth_mode").text($("#auth_mode option:selected").text()); > } > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt >index b587277b93d..bebc628994f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt >@@ -344,46 +344,45 @@ > > const identity_provider_id = "[%- identity_provider_id | html -%]"; > </script> >- > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > window.identity_provider_domains = $("#identity_provider_domains").kohaTable({ > ajax: { >- "url": identity_provider_domains_url >+ url: identity_provider_domains_url, > }, > language: { >- emptyTable: '<div class="alert alert-info">'+_("There are no identity provider domains defined.")+'</div>' >+ emptyTable: '<div class="alert alert-info">' + _("There are no identity provider domains defined.") + "</div>", > }, >- columnDefs: [ { >- targets: [1], >- render: function (data, type, row, meta) { >- if ( type == 'display' ) { >- if ( data != null ) { >- return data.escapeHtml(); >- } >- else { >- return ""; >+ columnDefs: [ >+ { >+ targets: [1], >+ render: function (data, type, row, meta) { >+ if (type == "display") { >+ if (data != null) { >+ return data.escapeHtml(); >+ } else { >+ return ""; >+ } > } >- } >- return data; >- } >- } ], >+ return data; >+ }, >+ }, >+ ], > columns: [ > { > data: "domain", > searchable: true, > orderable: true, >- render: function(data, type, row, meta) { >- if ( data != null ) { >+ render: function (data, type, row, meta) { >+ if (data != null) { > return data.escapeHtml(); >- } >- else { >+ } else { > return "*"; > } >- } >+ }, > }, > { >- data: function( row, type, val, meta ) { >+ data: function (row, type, val, meta) { > if (row.update_on_auth) { > return _("Yes"); > } else { >@@ -391,10 +390,10 @@ > } > }, > searchable: true, >- orderable: true >+ orderable: true, > }, > { >- data: function( row, type, val, meta ) { >+ data: function (row, type, val, meta) { > if (row.auto_register_opac) { > return _("Yes"); > } else { >@@ -402,10 +401,10 @@ > } > }, > searchable: true, >- orderable: true >+ orderable: true, > }, > { >- data: function( row, type, val, meta ) { >+ data: function (row, type, val, meta) { > if (row.auto_register_staff) { > return _("Yes"); > } else { >@@ -413,24 +412,24 @@ > } > }, > searchable: true, >- orderable: true >+ orderable: true, > }, > { >- data: function( row, type, val, meta ) { >+ data: function (row, type, val, meta) { > return libraries[row.default_library_id] || ""; > }, > searchable: true, >- orderable: true >+ orderable: true, > }, > { >- data: function( row, type, val, meta ) { >+ data: function (row, type, val, meta) { > return categories[row.default_category_id] || ""; > }, > searchable: true, >- orderable: true >+ orderable: true, > }, > { >- data: function( row, type, val, meta ) { >+ data: function (row, type, val, meta) { > if (row.allow_opac) { > return _("Yes"); > } else { >@@ -438,10 +437,10 @@ > } > }, > searchable: true, >- orderable: true >+ orderable: true, > }, > { >- data: function( row, type, val, meta ) { >+ data: function (row, type, val, meta) { > if (row.allow_staff) { > return _("Yes"); > } else { >@@ -449,60 +448,75 @@ > } > }, > searchable: true, >- orderable: true >+ orderable: true, > }, > { >- data: function( row, type, val, meta ) { >- var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=' + identity_provider_id + '&op=edit_form&identity_provider_domain_id='+ encodeURIComponent(row.identity_provider_domain_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; >- result += '<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-auth-provider-domain-id="'+ encodeURIComponent(row.identity_provider_domain_id) +'" data-auth-provider-domain="'+ encodeURIComponent((row.domain || '').escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>'; >+ data: function (row, type, val, meta) { >+ var result = >+ '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=' + >+ identity_provider_id + >+ "&op=edit_form&identity_provider_domain_id=" + >+ encodeURIComponent(row.identity_provider_domain_id) + >+ '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + >+ _("Edit") + >+ "</a>" + >+ "\n"; >+ result += >+ '<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-auth-provider-domain-id="' + >+ encodeURIComponent(row.identity_provider_domain_id) + >+ '" data-auth-provider-domain="' + >+ encodeURIComponent((row.domain || "").escapeHtml()) + >+ '"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + >+ _("Delete") + >+ "</a>"; > return result; > }, > searchable: false, >- orderable: false >- } >+ orderable: false, >+ }, > ], > createdRow: function (row, data, dataIndex) { >- if ( data.debug ) { >- $(row).addClass('debug'); >+ if (data.debug) { >+ $(row).addClass("debug"); > } > }, > }); > >- $('#identity_provider_domains').on( "click", '.delete_identity_provider_domain', function () { >- var identity_provider_domain_id = $(this).data('auth-provider-domain-id'); >- var identity_provider_domain = decodeURIComponent($(this).data('auth-provider-domain')); >+ $("#identity_provider_domains").on("click", ".delete_identity_provider_domain", function () { >+ var identity_provider_domain_id = $(this).data("auth-provider-domain-id"); >+ var identity_provider_domain = decodeURIComponent($(this).data("auth-provider-domain")); > >- $("#delete_confirm_dialog").html( >- _("You are about to delete the '%s' identity provider domain.").format(identity_provider_domain) >- ); >- $("#delete_confirm_modal_button").data('auth-provider-domain-id', identity_provider_domain_id); >- $("#delete_confirm_modal_button").data('auth-provider-domain', identity_provider_domain); >+ $("#delete_confirm_dialog").html(_("You are about to delete the '%s' identity provider domain.").format(identity_provider_domain)); >+ $("#delete_confirm_modal_button").data("auth-provider-domain-id", identity_provider_domain_id); >+ $("#delete_confirm_modal_button").data("auth-provider-domain", identity_provider_domain); > }); > >- $("#delete_confirm_modal_button").on( "click", function () { >- >- var identity_provider_domain_id = $(this).data('auth-provider-domain-id'); >- var identity_provider_domain = $(this).data('auth-provider-domain'); >+ $("#delete_confirm_modal_button").on("click", function () { >+ var identity_provider_domain_id = $(this).data("auth-provider-domain-id"); >+ var identity_provider_domain = $(this).data("auth-provider-domain"); > > $.ajax({ > method: "DELETE", >- url: identity_provider_domains_url+"/"+identity_provider_domain_id >- }).success(function() { >- window.identity_provider_domains.api().ajax.reload(function (data) { >- $("#smtp_action_result_dialog").hide(); >- $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(identity_provider_domain)).show(); >+ url: identity_provider_domains_url + "/" + identity_provider_domain_id, >+ }) >+ .success(function () { >+ window.identity_provider_domains.api().ajax.reload(function (data) { >+ $("#smtp_action_result_dialog").hide(); >+ $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(identity_provider_domain)).show(); >+ }); >+ }) >+ .fail(function () { >+ $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(identity_provider_domain)).show(); >+ }) >+ .done(function () { >+ $("#delete_confirm_modal").modal("hide"); > }); >- }).fail(function () { >- $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(identity_provider_domain)).show(); >- }).done(function () { >- $("#delete_confirm_modal").modal('hide'); >- }); > }); > >- $('button.more').on('click', function(event) { >+ $("button.more").on("click", function (event) { > event.preventDefault(); >- var target = $(this).hide().data('target'); >- $('.more-'+target).show(); >+ var target = $(this).hide().data("target"); >+ $(".more-" + target).show(); > }); > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >index 3906a51c050..2c503087ff0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -555,37 +555,36 @@ > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'select2.inc' %] > <script> >- var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'itemtypes', 'table_item_type', 'json' ) | $raw %]; >- [% IF ( Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') ) %] >- table_settings['columns'].shift(); // Remove item type image column from configuration >- [% END %] >+ var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'itemtypes', 'table_item_type', 'json' ) | $raw %]; >+ [% IF ( Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') ) %] >+ table_settings['columns'].shift(); // Remove item type image column from configuration >+ [% END %] > </script> >- > <script> >- $(document).ready(function() { >- $("#table_item_type").kohaTable( >- { >- pagingType: "full", >- }, >- table_settings >- ); >+ $(document).ready(function () { >+ $("#table_item_type").kohaTable( >+ { >+ pagingType: "full", >+ }, >+ table_settings >+ ); > >- $( "#itemtypeentry" ).validate({ >- rules: { >- itemtype: { required: true }, >- description: { required: true }, >- rentalcharge: { number: true }, >- rentalcharge_hourly: { number: true }, >- defaultreplacecost: { number: true }, >- processfee: { number: true } >- } >- }); >- $("#itemtype").on("blur",function(){ >- toUC(this); >- }); >- if( $("#icons .tab-pane.active").length < 1 ){ >- $("#icons a:first").tab("show"); >- } >+ $("#itemtypeentry").validate({ >+ rules: { >+ itemtype: { required: true }, >+ description: { required: true }, >+ rentalcharge: { number: true }, >+ rentalcharge_hourly: { number: true }, >+ defaultreplacecost: { number: true }, >+ processfee: { number: true }, >+ }, >+ }); >+ $("#itemtype").on("blur", function () { >+ toUC(this); >+ }); >+ if ($("#icons .tab-pane.active").length < 1) { >+ $("#icons a:first").tab("show"); >+ } > > if ($("#library_limitation").length > 0) { > $("#library_limitation")[0].style.minWidth = "450px"; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt >index b5a17f688e2..79b97a85678 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt >@@ -142,33 +142,33 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > <script> >- function show_message( params ) { >+ function show_message(params) { > var type = params.type; > var data = params.data; > var messages = $("#messages"); > var message; >- if ( type == 'success_on_update' ) { >+ if (type == "success_on_update") { > message = $('<div class="alert alert-info"></div>'); > message.text(_("Entity %s (code %s) for lang %s has been updated with '%s'").format(data.entity, data.code, data.lang, data.translation)); >- } else if ( type == 'error_on_update' ) { >+ } else if (type == "error_on_update") { > message = $('<div class="alert alert-warning"></div>'); >- if ( data.error_code == 'already_exists' ) { >+ if (data.error_code == "already_exists") { > message.text(_("A translation already exists for this language.")); > } else { > message.text(_("An error occurred when updating this translation.")); > } >- } else if ( type == 'success_on_delete' ) { >+ } else if (type == "success_on_delete") { > message = $('<div class="alert alert-info"></div>'); > message.text(_("The translation (id %s) has been removed successfully").format(data.id)); >- } else if ( type == 'error_on_delete' ) { >+ } else if (type == "error_on_delete") { > message = $('<div class="alert alert-warning"></div>'); > message.text(_("An error occurred when deleting this translation")); >- } else if ( type == 'success_on_insert' ) { >+ } else if (type == "success_on_insert") { > message = $('<div class="alert alert-info"></div>'); > message.text(_("Translation (id %s) has been added successfully").format(data.id)); >- } else if ( type == 'error_on_insert' ) { >+ } else if (type == "error_on_insert") { > message = $('<div class="alert alert-warning"></div>'); >- if ( data.error_code == 'already_exists' ) { >+ if (data.error_code == "already_exists") { > message.text(_("A translation already exists for this language.")); > } else { > message.text(_("An error occurred when adding this translation")); >@@ -177,58 +177,62 @@ > > $(messages).append(message); > >- setTimeout(function(){ >- message.hide() >+ setTimeout(function () { >+ message.hide(); > }, 3000); > } > >- function send_update_request( data, cell ) { >+ function send_update_request(data, cell) { > const client = APIClient.localization; > client.localizations.update(data).then( > success => { >- if ( success.error ) { >- $(cell).css('background-color', '#FF0000'); >- show_message({ type: 'error_on_update', data: success }); >- } else if ( success.is_changed == 1 ) { >- $(cell).css('background-color', '#00FF00'); >- show_message({ type: 'success_on_update', data: success }); >+ if (success.error) { >+ $(cell).css("background-color", "#FF0000"); >+ show_message({ type: "error_on_update", data: success }); >+ } else if (success.is_changed == 1) { >+ $(cell).css("background-color", "#00FF00"); >+ show_message({ type: "success_on_update", data: success }); > } > >- if ( $(cell).hasClass('lang') ) { >- $(cell).text(success.lang) >- } else if ( $(cell).hasClass('translation') ) { >- $(cell).text(success.translation) >+ if ($(cell).hasClass("lang")) { >+ $(cell).text(success.lang); >+ } else if ($(cell).hasClass("translation")) { >+ $(cell).text(success.translation); > } > }, > error => { >- $(cell).css('background-color', '#FF9090'); >- if ( $(cell).hasClass('lang') ) { >- $(cell).text(error.lang) >- } else if ( $(cell).hasClass('translation') ) { >- $(cell).text(error.translation) >+ $(cell).css("background-color", "#FF9090"); >+ if ($(cell).hasClass("lang")) { >+ $(cell).text(error.lang); >+ } else if ($(cell).hasClass("translation")) { >+ $(cell).text(error.translation); > } >- show_message({ type: 'error_on_update', data: error }); >+ show_message({ type: "error_on_update", data: error }); > console.warn("Something wrong happened: %s".format(error)); > } > ); > } > >- function send_delete_request( id, cell ) { >+ function send_delete_request(id, cell) { > const client = APIClient.localization; > client.localizations.delete(id).then( > success => { >- $("#localization").DataTable().row( '#row_id_' + id ).remove().draw(); >- show_message({ type: 'success_on_delete', data: {id} }); >+ $("#localization") >+ .DataTable() >+ .row("#row_id_" + id) >+ .remove() >+ .draw(); >+ show_message({ type: "success_on_delete", data: { id } }); > }, > error => { >- $(cell).css('background-color', '#FF9090'); >- show_message({ type: 'error_on_delete', data: error }); >+ $(cell).css("background-color", "#FF9090"); >+ show_message({ type: "error_on_delete", data: error }); > console.warn("Something wrong happened: %s".format(error)); > } > ); > } > >- $(document).ready(function() { >+ $(document).ready(function () { > $(".dialog").hide(); > > let table = $("#localization").kohaTable({ >@@ -238,54 +242,54 @@ > }); > let table_dt = table.DataTable(); > >- $("body").on('focus', "td.translation", function(){ >- $(this).css('background-color', ''); >+ $("body").on("focus", "td.translation", function () { >+ $(this).css("background-color", ""); > }); >- $("body").on('click', "td.lang", function(){ >+ $("body").on("click", "td.lang", function () { > var td = $(this); > var tr = td.parent(); >- var id = tr.data('id'); >+ var id = tr.data("id"); > var lang = td.text(); >- td.css('background-color', ''); >+ td.css("background-color", ""); > var my_select = languages_select.clone(); >- my_select.find('option[value="' + lang + '"]').attr('selected', 'selected'); >- my_select.on('click', function(e){ >+ my_select.find('option[value="' + lang + '"]').attr("selected", "selected"); >+ my_select.on("click", function (e) { > e.stopPropagation(); > }); > var lang; >- my_select.on('change', function(){ >- lang = td.find('option:selected').val(); >+ my_select.on("change", function () { >+ lang = td.find("option:selected").val(); > var translation = tr.find("td.translation").text(); >- send_update_request( {id, lang, translation}, td[0] ); >+ send_update_request({ id, lang, translation }, td[0]); > }); >- my_select.on('blur', function(){ >+ my_select.on("blur", function () { > td.html(lang); > }); > td.html(my_select); > }); > >- $("body").on('blur', "td.translation", function(){ >+ $("body").on("blur", "td.translation", function () { > var tr = $(this).parent(); >- var id = $(tr).data('id'); >- var lang = $(tr).find('td.lang').text(); >+ var id = $(tr).data("id"); >+ var lang = $(tr).find("td.lang").text(); > var translation = $(this).text(); >- send_update_request( {id, lang, translation}, this ); >+ send_update_request({ id, lang, translation }, this); > }); > >- $("body").on("click", "a.delete", function(e){ >+ $("body").on("click", "a.delete", function (e) { > e.preventDefault(); >- if ( confirm(_("Are you sure you want to delete this translation?")) ) { >+ if (confirm(_("Are you sure you want to delete this translation?"))) { > var td = $(this).parent(); > var tr = $(td).parent(); >- var id = $(tr).data('id'); >- send_delete_request( id, td ); >+ var id = $(tr).data("id"); >+ send_delete_request(id, td); > } > }); > >- const th_lang_index = document.querySelector('th.lang').cellIndex; >- const th_translation_index = document.querySelector('th.translation').cellIndex; >+ const th_lang_index = document.querySelector("th.lang").cellIndex; >+ const th_translation_index = document.querySelector("th.translation").cellIndex; > >- $("#add_translation").on('submit', function(e){ >+ $("#add_translation").on("submit", function (e) { > e.preventDefault(); > let localization = { > entity: $(this).find('input[name="entity"]').val(), >@@ -296,39 +300,43 @@ > const client = APIClient.localization; > client.localizations.create(localization).then( > success => { >- if ( success.error ) { >- show_message({ type: 'error_on_insert', data: success }); >+ if (success.error) { >+ show_message({ type: "error_on_insert", data: success }); > } else { >- var new_row = table_dt.row.add( [ success.id, success.entity, success.code, success.lang, success.translation, "<a href=\"#\" class=\"btn btn-default btn-xs delete\"><i class=\"fa fa-trash-can\"></i> Delete</a>" ] ).draw().node(); >- $( new_row ).attr("id", "row_id_" + success.id ).data("id", success.id ); >- $( new_row.children[th_lang_index] ).prop("contenteditable", true).addClass("lang") >- $( new_row.children[th_translation_index] ).prop("contenteditable", true).addClass("translation") >- show_message({ type: 'success_on_insert', data: success }); >+ var new_row = table_dt.row >+ .add([success.id, success.entity, success.code, success.lang, success.translation, '<a href="#" class="btn btn-default btn-xs delete"><i class="fa fa-trash-can"></i> Delete</a>']) >+ .draw() >+ .node(); >+ $(new_row) >+ .attr("id", "row_id_" + success.id) >+ .data("id", success.id); >+ $(new_row.children[th_lang_index]).prop("contenteditable", true).addClass("lang"); >+ $(new_row.children[th_translation_index]).prop("contenteditable", true).addClass("translation"); >+ show_message({ type: "success_on_insert", data: success }); > } > }, > error => { >- show_message({ type: 'error_on_insert', data: error }); >+ show_message({ type: "error_on_insert", data: error }); > console.warn("Something wrong happened: %s".format(error)); > } > ); > }); >- }); >+ }); > </script> >- > <script> >- var languages_select = $('<select name="lang" id="lang"></select>'); >- [% FOR language IN languages %] >- [% FOR sublanguage IN language.sublanguages_loop %] >- var option; >- [% IF language.plural %] >- option = $('<option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>'); >- $(languages_select).append(option); >- [% ELSE %] >- option = $('<option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>'); >- [% END %] >+ var languages_select = $('<select name="lang" id="lang"></select>'); >+ [% FOR language IN languages %] >+ [% FOR sublanguage IN language.sublanguages_loop %] >+ var option; >+ [% IF language.plural %] >+ option = $('<option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>'); > $(languages_select).append(option); >+ [% ELSE %] >+ option = $('<option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>'); > [% END %] >+ $(languages_select).append(option); > [% END %] >+ [% END %] > </script> > [% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt >index 62181e55e86..cb01fc68c3f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt >@@ -321,246 +321,238 @@ > <script> > var categories = [% To.json( categories ) | $raw %]; > </script> >- > <script> >- $(document).ready(function(){ >- >- var validator = $( "#marc-overlay-rules-form" ).validate({ >- ignore: ".ignore" >+ $(document).ready(function () { >+ var validator = $("#marc-overlay-rules-form").validate({ >+ ignore: ".ignore", > }); > > function prepareSubmit(op, id) { >- > $('#marc-overlay-rules-form > input[name="op"]').val(op); > >- if(id) { >- $('<input type="hidden"/>') >- .attr('name', 'id') >- .attr('value', id) >- .appendTo('#marc-overlay-rules-form'); >+ if (id) { >+ $('<input type="hidden"/>').attr("name", "id").attr("value", id).appendTo("#marc-overlay-rules-form"); > } > >- if (op == 'cud-add' || op == 'cud-edit') { >- $('#marc-overlay-rules-form input[name="tag"]').removeClass('ignore'); >+ if (op == "cud-add" || op == "cud-edit") { >+ $('#marc-overlay-rules-form input[name="tag"]').removeClass("ignore"); > } else { >- $('#marc-overlay-rules-form input[name="tag"]').addClass('ignore'); >+ $('#marc-overlay-rules-form input[name="tag"]').addClass("ignore"); > } >- > } > >- $('#doedit').on('click', function(){ >- prepareSubmit('cud-edit', $("#doedit").attr('value')); >+ $("#doedit").on("click", function () { >+ prepareSubmit("cud-edit", $("#doedit").attr("value")); > }); >- $('#add').on('click', function(){ >- prepareSubmit('cud-add'); >+ $("#add").on("click", function () { >+ prepareSubmit("cud-add"); > }); >- $('.btn_remove').on('click', function(el){ >+ $(".btn_remove").on("click", function (el) { > // remove all earlier selections >- $('#marc-overlay-rules-form input[name="batchremove"]').each(function() { >- $(this).prop( "checked", false ); >+ $('#marc-overlay-rules-form input[name="batchremove"]').each(function () { >+ $(this).prop("checked", false); > }); > > confirm_remove(el.currentTarget.value); > }); >- $('#btn_batchremove').on('click', function(){ >+ $("#btn_batchremove").on("click", function () { > confirm_remove(); > }); > >- function confirm_remove(id){ >- if (confirm(_("Are you sure you want to remove the selected rule(s)?"))){ >- prepareSubmit('cud-remove', id); >- $('#marc-overlay-rules-form').submit() >+ function confirm_remove(id) { >+ if (confirm(_("Are you sure you want to remove the selected rule(s)?"))) { >+ prepareSubmit("cud-remove", id); >+ $("#marc-overlay-rules-form").submit(); > } > } > > /* Disable batch remove unless one or more checkboxes are checked */ >- $('input[name="batchremove"]').change(function() { >- if($('input[name="batchremove"]:checked').length > 0) { >- $('#btn_batchremove').removeAttr('disabled'); >+ $('input[name="batchremove"]').change(function () { >+ if ($('input[name="batchremove"]:checked').length > 0) { >+ $("#btn_batchremove").removeAttr("disabled"); > } else { >- $('#btn_batchremove').attr('disabled', 'disabled'); >+ $("#btn_batchremove").attr("disabled", "disabled"); > } > }); > >- $.fn.dataTable.ext.order['dom-input'] = function (settings, col) { >- return this.api().column(col, { order: 'index' }).nodes() >+ $.fn.dataTable.ext.order["dom-input"] = function (settings, col) { >+ return this.api() >+ .column(col, { order: "index" }) >+ .nodes() > .map(function (td, i) { >- if($('input', td).val() != undefined) { >- return $('input', td).val(); >- } else if($('select', td).val() != undefined) { >+ if ($("input", td).val() != undefined) { >+ return $("input", td).val(); >+ } else if ($("select", td).val() != undefined) { > return $('option[selected="selected"]', td).val(); > } else { > return $(td).html(); > } > }); >- } >+ }; > >- $('#marc-overlay-rules').kohaTable({ >+ $("#marc-overlay-rules").kohaTable({ > columns: [ >- {searchable: false, orderable: false}, >- {orderDataType: "dom-input"}, >- {orderDataType: "dom-input"}, >- {searchable: false, orderDataType: "dom-input"}, >- {searchable: false, orderDataType: "dom-input"}, >- {searchable: false, orderDataType: "dom-input"}, >- {searchable: false, orderDataType: "dom-input"}, >- {searchable: false, orderDataType: "dom-input"}, >- {searchable: false, orderDataType: "dom-input"}, >- {searchable: false, orderable: false}, >- {searchable: false, orderable: false} >+ { searchable: false, orderable: false }, >+ { orderDataType: "dom-input" }, >+ { orderDataType: "dom-input" }, >+ { searchable: false, orderDataType: "dom-input" }, >+ { searchable: false, orderDataType: "dom-input" }, >+ { searchable: false, orderDataType: "dom-input" }, >+ { searchable: false, orderDataType: "dom-input" }, >+ { searchable: false, orderDataType: "dom-input" }, >+ { searchable: false, orderDataType: "dom-input" }, >+ { searchable: false, orderable: false }, >+ { searchable: false, orderable: false }, > ], >- pagingType: "simple" >+ pagingType: "simple", > }); > > var overlay_rules_presets = {}; > overlay_rules_presets["protect"] = { >- 'add': 0, >- 'append': 0, >- 'remove': 0, >- 'delete': 0 >+ add: 0, >+ append: 0, >+ remove: 0, >+ delete: 0, > }; > overlay_rules_presets["overwrite"] = { >- 'add': 1, >- 'append': 1, >- 'remove': 1, >- 'delete': 1 >+ add: 1, >+ append: 1, >+ remove: 1, >+ delete: 1, > }; > overlay_rules_presets["add"] = { >- 'add': 1, >- 'append': 0, >- 'remove': 0, >- 'delete': 0 >+ add: 1, >+ append: 0, >+ remove: 0, >+ delete: 0, > }; > overlay_rules_presets["addappend"] = { >- 'add': 1, >- 'append': 1, >- 'remove': 0, >- 'delete': 0 >+ add: 1, >+ append: 1, >+ remove: 0, >+ delete: 0, > }; > overlay_rules_presets["protectfromdeletion"] = { >- 'add': 1, >- 'append': 1, >- 'remove': 1, >- 'delete': 0 >+ add: 1, >+ append: 1, >+ remove: 1, >+ delete: 0, > }; > > function hash_config(config) { >- return JSON.stringify(config, Object.keys(config).sort()); >+ return JSON.stringify(config, Object.keys(config).sort()); > } > > var overlay_rules_preset_map = {}; >- $.each(overlay_rules_presets, function(preset, config) { >- overlay_rules_preset_map[hash_config(config)] = preset; >+ $.each(overlay_rules_presets, function (preset, config) { >+ overlay_rules_preset_map[hash_config(config)] = preset; > }); > > function operations_config_overlay_rule_preset(config) { >- return overlay_rules_preset_map[hash_config(config)] || ''; >+ return overlay_rules_preset_map[hash_config(config)] || ""; > } > > /* Set preset values according to operation config */ >- $('.rule').each(function() { >- var $this = $(this); >- var operations_config = {}; >- $('.rule-operation-action', $this).each(function() { >- var $operation = $(this); >- operations_config[$operation.data('operation')] = $operation.data('value'); >- }); >- $('.rule-preset', $this).text( >- $('select[name="preset"] option[value="' + operations_config_overlay_rule_preset(operations_config) + '"]').text() >- ); >+ $(".rule").each(function () { >+ var $this = $(this); >+ var operations_config = {}; >+ $(".rule-operation-action", $this).each(function () { >+ var $operation = $(this); >+ operations_config[$operation.data("operation")] = $operation.data("value"); >+ }); >+ $(".rule-preset", $this).text($('select[name="preset"] option[value="' + operations_config_overlay_rule_preset(operations_config) + '"]').text()); > }); > > /* Listen to operations config changes and set presets accordingly */ >- $('.rule-operation-action-edit select').change(function() { >- var operations_config = {}; >- var $parent_row = $(this).closest('tr'); >- $('.rule-operation-action-edit select', $parent_row).each(function() { >- var $this = $(this); >- operations_config[$this.attr('name')] = parseInt($this.val()); >- }); >- $('select[name="preset"]', $parent_row).val( >- operations_config_overlay_rule_preset(operations_config) >- ); >+ $(".rule-operation-action-edit select").change(function () { >+ var operations_config = {}; >+ var $parent_row = $(this).closest("tr"); >+ $(".rule-operation-action-edit select", $parent_row).each(function () { >+ var $this = $(this); >+ operations_config[$this.attr("name")] = parseInt($this.val()); >+ }); >+ $('select[name="preset"]', $parent_row).val(operations_config_overlay_rule_preset(operations_config)); > }); > > /* Listen to preset changes and set operations config accordingly */ >- $('select[name="preset"]').change(function() { >- var $this = $(this); >- var $parent_row = $this.closest('tr'); >- var preset = $this.val(); >- if (preset) { >- $.each(overlay_rules_presets[preset], function(operation, action) { >- $('select[name="' + operation + '"]', $parent_row).val(action); >- }); >- } >+ $('select[name="preset"]').change(function () { >+ var $this = $(this); >+ var $parent_row = $this.closest("tr"); >+ var preset = $this.val(); >+ if (preset) { >+ $.each(overlay_rules_presets[preset], function (operation, action) { >+ $('select[name="' + operation + '"]', $parent_row).val(action); >+ }); >+ } > }); > > // Add * => * to this array of objects, and *reduce* it to one object > // Note: This allows displaying a sorted list of categories later, but we still depend on an object! >- categories.unshift({ categorycode: '*', description: '*'}); >- categories = categories.reduce( ( a,c ) => ( { ...a, [c.categorycode]: c.description } ), {} ); >+ categories.unshift({ categorycode: "*", description: "*" }); >+ categories = categories.reduce((a, c) => ({ ...a, [c.categorycode]: c.description }), {}); > > var module_filter_options = { >- source: { >- '*': '*', >- batchmod: _("Batch record modification"), >- intranet: _("Staff interface MARC editor"), >- batchimport: _("Staged MARC import"), >- z3950: _("Z39.50"), >- bulkmarcimport: _("bulkmarcimport.pl"), >- import_lexile: _("import_lexile.pl") >- }, >+ source: { >+ "*": "*", >+ batchmod: _("Batch record modification"), >+ intranet: _("Staff interface MARC editor"), >+ batchimport: _("Staged MARC import"), >+ z3950: _("Z39.50"), >+ bulkmarcimport: _("bulkmarcimport.pl"), >+ import_lexile: _("import_lexile.pl"), >+ }, > > categorycode: categories, > }; > > //Kind of hack: Replace filter value with label when one exist >- $('.rule-module').each(function() { >- var $this = $(this); >- var module = $this.text(); >- if (module in module_filter_options) { >- let $filter = $this.siblings('.rule-filter'); >- if ($filter.text() in module_filter_options[module]) { >- $filter.text(module_filter_options[module][$filter.text()]); >+ $(".rule-module").each(function () { >+ var $this = $(this); >+ var module = $this.text(); >+ if (module in module_filter_options) { >+ let $filter = $this.siblings(".rule-filter"); >+ if ($filter.text() in module_filter_options[module]) { >+ $filter.text(module_filter_options[module][$filter.text()]); >+ } > } >- } > }); > >- var $filter_container = $('#filter-container'); >+ var $filter_container = $("#filter-container"); > > /* Listen to module changes and set filter input accordingly */ >- $('select[name="module"]').change(function() { >- var $this = $(this); >- var module_name = $this.val(); >- >- /* Remove current element if any */ >- $filter_container.empty(); >- >- var filter_elem = null; >- if (module_name in module_filter_options) { >- // Create select element >- filter_elem = document.createElement('select'); >- for (var filter_value in module_filter_options[module_name]) { >- var option = document.createElement('option'); >- option.value = filter_value; >- option.text = module_filter_options[module_name][filter_value]; >- filter_elem.appendChild(option); >- } >- } >- else { >- // Create text input element >- filter_elem = document.createElement('input'); >- filter_elem.type = 'text'; >- filter_elem.setAttribute('size', 5); >- } >- filter_elem.name = 'filter'; >- filter_elem.id = 'filter'; >- $filter_container.append(filter_elem); >- }).change(); // Trigger change >+ $('select[name="module"]') >+ .change(function () { >+ var $this = $(this); >+ var module_name = $this.val(); >+ >+ /* Remove current element if any */ >+ $filter_container.empty(); >+ >+ var filter_elem = null; >+ if (module_name in module_filter_options) { >+ // Create select element >+ filter_elem = document.createElement("select"); >+ for (var filter_value in module_filter_options[module_name]) { >+ var option = document.createElement("option"); >+ option.value = filter_value; >+ option.text = module_filter_options[module_name][filter_value]; >+ filter_elem.appendChild(option); >+ } >+ } else { >+ // Create text input element >+ filter_elem = document.createElement("input"); >+ filter_elem.type = "text"; >+ filter_elem.setAttribute("size", 5); >+ } >+ filter_elem.name = "filter"; >+ filter_elem.id = "filter"; >+ $filter_container.append(filter_elem); >+ }) >+ .change(); // Trigger change > > // Hack: set value if editing rule >- if ($filter_container.data('filter')) { >- $('#filter').val($filter_container.data('filter')); >+ if ($filter_container.data("filter")) { >+ $("#filter").val($filter_container.data("filter")); > } > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt >index c74e658d801..8342a29a107 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt >@@ -194,43 +194,43 @@ > [% END %] > [% IF ( add_form ) %] > <script> >- $(document).ready(function(){ >+ $(document).ready(function () { > // Update selects for dataformat and recordtype > // FIXME Do not do this in JS! >- if (typeof server !== "undefined"){ >+ if (typeof server !== "undefined") { > $("#dataformat").val(server.dataformat); > $("#recordtype").val(server.recordtype); > } >- $( "#serverentry" ).validate({ >+ $("#serverentry").validate({ > rules: { > servername: { required: true }, > host: { required: true }, > port: { >- number: true >+ number: true, > }, > rank: { number: true }, >- } >+ }, > }); >- $("#serverentry").submit(function( event ) { >+ $("#serverentry").submit(function (event) { > // enable recordtype to include field in post >- $('#recordtype').prop('disabled',false); >+ $("#recordtype").prop("disabled", false); > }); >- $("#servername").on("blur",function(){ >+ $("#servername").on("blur", function () { > toUC(this); > }); > }); > </script> > [% ELSE %] > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > $("#serverst").kohaTable({ > pagingType: "full", > }); >- $(".delete").on("click",function(e){ >+ $(".delete").on("click", function (e) { > var servername = $(this).data("servername"); > let formid = $(this).data("formid"); >- if( confirm( _("Are you sure you want to delete repository %s?").format(servername) ) ) { >- $('#'+formid).submit(); >+ if (confirm(_("Are you sure you want to delete repository %s?").format(servername))) { >+ $("#" + formid).submit(); > return true; > } else { > e.preventDefault(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt >index 9d218df3e19..0d5fb62dd1b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt >@@ -324,158 +324,166 @@ > on: "[% tp("Active", "On") | html %]"; > }; > </script> >- > <script> >- $(document).ready(function() { >- >- var smtp_servers_url = '/api/v1/config/smtp_servers'; >+ $(document).ready(function () { >+ var smtp_servers_url = "/api/v1/config/smtp_servers"; > window.smtp_servers = $("#smtp_servers").kohaTable({ > ajax: { >- "url": smtp_servers_url >+ url: smtp_servers_url, > }, >- 'language': { >- emptyTable: '<div class="alert alert-info">'+_("There are no SMTP servers defined.")+'</div>' >+ language: { >+ emptyTable: '<div class="alert alert-info">' + _("There are no SMTP servers defined.") + "</div>", > }, >- columnDefs: [ { >- targets: [0,1], >- render: function (data, type, row, meta) { >- if ( type == 'display' ) { >- if ( data != null ) { >- return data.escapeHtml(); >- } >- else { >- return "Default"; >+ columnDefs: [ >+ { >+ targets: [0, 1], >+ render: function (data, type, row, meta) { >+ if (type == "display") { >+ if (data != null) { >+ return data.escapeHtml(); >+ } else { >+ return "Default"; >+ } > } >- } >- return data; >- } >- } ], >+ return data; >+ }, >+ }, >+ ], > columns: [ > { > data: "name", > searchable: true, >- orderable: true >+ orderable: true, > }, > { > data: "host", > searchable: true, >- orderable: true >+ orderable: true, > }, > { > data: "port", > searchable: true, >- orderable: false >+ orderable: false, > }, > { > data: "timeout", > searchable: true, >- orderable: false >+ orderable: false, > }, > { > data: "ssl_mode", > render: function (data, type, row, meta) { >- if (data == 'disabled') { >+ if (data == "disabled") { > return _("Disabled"); >- } >- else if (data == 'ssl') { >+ } else if (data == "ssl") { > return _("SSL"); >- } >- else { >+ } else { > return _("STARTTLS"); > } > }, > searchable: false, >- orderable: false >+ orderable: false, > }, > { >- data: function( row, type, val, meta ) { >- if ( row.user_name != null ) { >+ data: function (row, type, val, meta) { >+ if (row.user_name != null) { > return _("Yes"); >- } >- else { >+ } else { > return _("No"); > } > }, > searchable: false, >- orderable: false >+ orderable: false, > }, > { >- data: function( row, type, val, meta ) { >- if ( row.debug ) { >- let result = '<span class="badge text-bg-warning">' + i18n.on + '</span>'; >+ data: function (row, type, val, meta) { >+ if (row.debug) { >+ let result = '<span class="badge text-bg-warning">' + i18n.on + "</span>"; > return result; >- } >- else { >+ } else { > return _(""); > } > }, > searchable: false, >- orderable: false >+ orderable: false, > }, > { >- data: function( row, type, val, meta ) { >- if ( row.is_default ) { >- let result = '<span class="badge text-bg-success">' + _("Default") + '</span>'; >+ data: function (row, type, val, meta) { >+ if (row.is_default) { >+ let result = '<span class="badge text-bg-success">' + _("Default") + "</span>"; > return result; > } else { > return ""; > } > }, > searchable: false, >- orderable: false >+ orderable: false, > }, > { >- data: function( row, type, val, meta ) { >- var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id='+ encodeURIComponent(row.smtp_server_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; >- result += '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-smtp-server-id="'+ encodeURIComponent(row.smtp_server_id) +'" data-smtp-server-name="'+ encodeURIComponent(row.name.escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>'; >+ data: function (row, type, val, meta) { >+ var result = >+ '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id=' + >+ encodeURIComponent(row.smtp_server_id) + >+ '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + >+ _("Edit") + >+ "</a>" + >+ "\n"; >+ result += >+ '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-smtp-server-id="' + >+ encodeURIComponent(row.smtp_server_id) + >+ '" data-smtp-server-name="' + >+ encodeURIComponent(row.name.escapeHtml()) + >+ '"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + >+ _("Delete") + >+ "</a>"; > return result; > }, > searchable: false, >- orderable: false >- } >+ orderable: false, >+ }, > ], > }); > >- $('#smtp_servers').on( "click", '.delete_server', function () { >- var smtp_server_id = $(this).data('smtp-server-id'); >- var smtp_server_name = decodeURIComponent($(this).data('smtp-server-name')); >+ $("#smtp_servers").on("click", ".delete_server", function () { >+ var smtp_server_id = $(this).data("smtp-server-id"); >+ var smtp_server_name = decodeURIComponent($(this).data("smtp-server-name")); > >- $("#delete_confirm_dialog").html( >- _("You are about to delete the '%s' SMTP server.").format(smtp_server_name) >- ); >- $("#delete_confirm_modal_button").data('smtp-server-id', smtp_server_id); >- $("#delete_confirm_modal_button").data('smtp-server-name', smtp_server_name); >+ $("#delete_confirm_dialog").html(_("You are about to delete the '%s' SMTP server.").format(smtp_server_name)); >+ $("#delete_confirm_modal_button").data("smtp-server-id", smtp_server_id); >+ $("#delete_confirm_modal_button").data("smtp-server-name", smtp_server_name); > }); > >- $('#smtp_default').on( "click", function () { >- $("#default_confirm_modal").modal('show'); >+ $("#smtp_default").on("click", function () { >+ $("#default_confirm_modal").modal("show"); > }); >- $('.default_confirm_modal_yes').on( "click", function () { >- $("#default_confirm_modal").modal('hide'); >+ $(".default_confirm_modal_yes").on("click", function () { >+ $("#default_confirm_modal").modal("hide"); > }); >- $('.default_confirm_modal_no').on( "click", function () { >- $("#smtp_default").prop('checked', !$("#smtp_default").prop('checked') ); >- $("#default_confirm_modal").modal('hide'); >+ $(".default_confirm_modal_no").on("click", function () { >+ $("#smtp_default").prop("checked", !$("#smtp_default").prop("checked")); >+ $("#default_confirm_modal").modal("hide"); > }); > >- $("#delete_confirm_modal_button").on( "click", function () { >- >- var smtp_server_id = $(this).data('smtp-server-id'); >- var smtp_server_name = $(this).data('smtp-server-name'); >+ $("#delete_confirm_modal_button").on("click", function () { >+ var smtp_server_id = $(this).data("smtp-server-id"); >+ var smtp_server_name = $(this).data("smtp-server-name"); > > $.ajax({ > method: "DELETE", >- url: "/api/v1/config/smtp_servers/"+smtp_server_id >- }).success(function() { >- window.smtp_servers.api().ajax.reload(function (data) { >- $("#smtp_action_result_dialog").hide(); >- $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(smtp_server_name)).show(); >+ url: "/api/v1/config/smtp_servers/" + smtp_server_id, >+ }) >+ .success(function () { >+ window.smtp_servers.api().ajax.reload(function (data) { >+ $("#smtp_action_result_dialog").hide(); >+ $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(smtp_server_name)).show(); >+ }); >+ }) >+ .fail(function () { >+ $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(smtp_server_name)).show(); >+ }) >+ .done(function () { >+ $("#delete_confirm_modal").modal("hide"); > }); >- }).fail(function () { >- $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(smtp_server_name)).show(); >- }).done(function () { >- $("#delete_confirm_modal").modal('hide'); >- }); > }); > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt >index 4d74c154e75..fb43af57404 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt >@@ -494,71 +494,74 @@ > [% IF else && loop %] > [% INCLUDE 'datatables.inc' %] > <script> >- $(document).ready(function() { >- $("#sysprefst").kohaTable({ >- dom: '<"top pager"ilf>t', >- paging: false, >- }); >+ $(document).ready(function () { >+ $("#sysprefst").kohaTable({ >+ dom: '<"top pager"ilf>t', >+ paging: false, >+ }); > }); > </script> > [% END %] > > [% IF ( add_form ) %] > <script> >- $(document).ready(function() { >- $('.variabletype').css({ color: "#0000CC", cursor: "pointer" }); >- $('.variabletype').click(function() { >- $('#preftype').attr("value",$(this).attr("id")); >+ $(document).ready(function () { >+ $(".variabletype").css({ color: "#0000CC", cursor: "pointer" }); >+ $(".variabletype").click(function () { >+ $("#preftype").attr("value", $(this).attr("id")); > }); > }); > </script> > [% END %] >- > <script> >- // FIXME: many of these js functions appear unused >- function isNotNull(f,noalert) { >- if (f.value.length ==0) { >- return false; >- } >- return true; >+ // FIXME: many of these js functions appear unused >+ function isNotNull(f, noalert) { >+ if (f.value.length == 0) { >+ return false; >+ } >+ return true; > } > >- function isNum(v,maybenull) { >+ function isNum(v, maybenull) { > var n = new Number(v.value); > if (isNaN(n)) { > return false; >- } >- if (maybenull==0 && v.value=='') { >+ } >+ if (maybenull == 0 && v.value == "") { > return false; > } > return true; > } > > function Check(f) { >- var ok=1; >- var _alertString=""; >+ var ok = 1; >+ var _alertString = ""; > var alertString2; >- if (f.variable.value.length==0) { >+ if (f.variable.value.length == 0) { > _alertString += "\n- " + _("variable missing"); > } >- if (f.value.value.length==0) { >+ if (f.value.value.length == 0) { > _alertString += "\n- " + _("value missing"); > } >- if (_alertString.length==0) { >+ if (_alertString.length == 0) { > document.Aform.submit(); > } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >+ alertString2 = _("Form not submitted because of the following problem(s)"); > alertString2 += "\n------------------------------------------------------------------------------------\n"; > alertString2 += _alertString; > alert(alertString2); > } > } >- $( function() { >- $( '#sysprefst .expand-textarea' ).show().click( function () { >- $( this ).hide().nextAll( 'textarea, input[type=submit]' ).show( 'slow' ); >+ $(function () { >+ $("#sysprefst .expand-textarea") >+ .show() >+ .click(function () { >+ $(this).hide().nextAll("textarea, input[type=submit]").show("slow"); > >- return false; >- } ).nextAll( 'textarea, input[type=submit]' ).hide(); >+ return false; >+ }) >+ .nextAll("textarea, input[type=submit]") >+ .hide(); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >index f22129f981e..5b598f9efc4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >@@ -284,60 +284,60 @@ > > [% IF ( add_form ) %] > <script> >- $(document).ready(function(){ >+ $(document).ready(function () { > // Update selects for syntax, encoding and recordtype >- if (typeof server !== 'undefined'){ >+ if (typeof server !== "undefined") { > $("#syntax").val(server.syntax); > $("#encoding").val(server.encoding); > $("#recordtype").val(server.recordtype); > } >- $( "#serverentry" ).validate({ >+ $("#serverentry").validate({ > rules: { > servername: { required: true }, > host: { required: true }, > port: { > required: true, >- number: true >+ number: true, > }, > db: { required: true }, > rank: { number: true }, >- timeout: { number: true } >- } >+ timeout: { number: true }, >+ }, > }); >- $("#serverentry").submit(function( event ) { >+ $("#serverentry").submit(function (event) { > // first test if show_sru_fields exists >- if( $('#show_sru_fields').length && $('#show_sru_fields').val()=='' && !confirm( _("No SRU search field mappings have been defined. This means that all field searches will go through the whole record. Continue?"))) { >+ if ($("#show_sru_fields").length && $("#show_sru_fields").val() == "" && !confirm(_("No SRU search field mappings have been defined. This means that all field searches will go through the whole record. Continue?"))) { > return false; > } > // copy show_sru_fields to hidden counterpart >- $('#sru_fields').val( $('#show_sru_fields').val() ); >+ $("#sru_fields").val($("#show_sru_fields").val()); > // enable recordtype to include field in post >- $('#recordtype').prop('disabled',false); >+ $("#recordtype").prop("disabled", false); > }); >- $("#servername").on("blur",function(){ >+ $("#servername").on("blur", function () { > toUC(this); > }); >- $("#modify_sru_fields").on("click",function(){ >+ $("#modify_sru_fields").on("click", function () { > ModMapping(); > }); > }); >- function ModMapping () { >- var map= $('#show_sru_fields').val(); >- var type= $('#recordtype').val(); >- window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map + '&type=' + type,'popup','width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top'); >+ function ModMapping() { >+ var map = $("#show_sru_fields").val(); >+ var type = $("#recordtype").val(); >+ window.open("/cgi-bin/koha/admin/sru_modmapping.pl?mapping=" + map + "&type=" + type, "popup", "width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top"); > } > </script> > [% ELSE %] > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > $("#serverst").kohaTable({ > pagingType: "full", > }); >- $("#serverst").on("click", ".delete", function(e) { >+ $("#serverst").on("click", ".delete", function (e) { > var servername = $(this).data("servername"); > let formid = $(this).data("formid"); >- if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) { >- $('#'+formid).submit(); >+ if (confirm(_("Are you sure you want to delete server %s?").format(servername))) { >+ $("#" + formid).submit(); > return false; > } else { > e.preventDefault(); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41564
:
191082
|
191083
|
191084
|
191085
|
191086
|
191087
|
191088
|
191089
|
191090
|
191091
|
191092
|
191093
|
191094
|
191095
|
191096
|
191097
|
191098
|
191099
|
191100
|
191310
|
191311
|
191312
|
191313
|
191314
|
191315
|
191316
|
191317
|
191318
|
191319
|
191320
|
191321
|
191322
|
191323
|
191324
|
191325
|
191326
|
191327
| 191328 |
191329