Bugzilla – Attachment 166996 Details for
Bug 35604
ILL - Allow for automatic backend selection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35604: New 'ill-backends' syspref type
Bug-35604-New-ill-backends-syspref-type.patch (text/plain), 6.50 KB, created by
David Nind
on 2024-05-21 22:51:30 UTC
(
hide
)
Description:
Bug 35604: New 'ill-backends' syspref type
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-05-21 22:51:30 UTC
Size:
6.50 KB
patch
obsolete
>From a4b26aead280bd8fb2636898a6071939c4d558b5 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 18 Dec 2023 16:42:15 -0100 >Subject: [PATCH] Bug 35604: New 'ill-backends' syspref type > >UI rendering of sortable ILL backends > >Signed-off-by: David Nind <david@davidnind.com> >--- > admin/preferences.pl | 24 +++++++++++++++++++ > .../prog/en/modules/admin/preferences.tt | 22 +++++++++++++++++ > .../prog/js/pages/preferences.js | 8 +++++++ > 3 files changed, 54 insertions(+) > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index d00672b1ae..86203cb9c4 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -29,6 +29,7 @@ use C4::Output qw( output_html_with_http_headers output_and_exit_if_error ); > use C4::Templates; > use Koha::Acquisition::Currencies; > use Koha::Database::Columns; >+use Koha::ILL::Backends; > use IO::File; > use YAML::XS; > use Encode; >@@ -79,6 +80,29 @@ sub _get_chunk { > $chunk->{'input_type'} = 'email'; > } elsif ( $options{'class'} && $options{'class'} eq 'date' ) { > $chunk->{'dateinput'} = 1; >+ } elsif ( $options{'type'} && $options{'type'} eq 'ill-backends' ) { >+ my @priority_enabled_backends = split ",", C4::Context->preference('AutoILLBackendPriority'); >+ my @sys_pref_backends = map( { name => $_, enabled => 1 }, @priority_enabled_backends ); >+ >+ my $installed_backends = Koha::ILL::Backends->installed_backends; >+ foreach my $installed_backend ( @{$installed_backends} ) { >+ if ( not grep { $installed_backend eq $_->{name} } @sys_pref_backends ) { >+ my $backend = Koha::ILL::Request->new->load_backend($installed_backend); >+ push( >+ @sys_pref_backends, >+ { >+ name => $installed_backend, >+ enabled => 0, >+ !$backend->_backend_capability('provides_backend_availability_check') >+ ? ( unable => 1 ) >+ : () >+ } >+ ); >+ } >+ } >+ >+ $chunk->{'ill_backends'} = \@sys_pref_backends; >+ $chunk->{'type'} = 'ill_backends'; > } elsif ( $options{'type'} && ( $options{'type'} eq 'opac-languages' || $options{'type'} eq 'staff-languages' ) ) { > my $current_languages = { map { +$_, 1 } split( /\s*,\s*/, $value ) }; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >index 1df62540f1..4a392f7884 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -173,6 +173,28 @@ > <textarea style="display:none" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %] codemirror" rows="10" cols="40">[% CHUNK.value | html %]</textarea> > <a class="collapse-textarea" id="collapse_[% CHUNK.name | html %]" data-target="[% CHUNK.name | html %]" data-syntax="[% CHUNK.syntax | html %]" style="display:none" href="#">Collapse</br></a> > [% END %] >+ [% ELSIF ( CHUNK.type_ill_backends ) %] >+ [% IF ( !CHUNK.ill_backends.empty ) %] >+ <ul class="sortable"> >+ [% FOREACH ill_backend IN CHUNK.ill_backends %] >+ <li> >+ <i class="fa-solid fa-fw fa-grip-vertical" aria-hidden="true" style="color:#B7B7B7"></i> >+ [% IF ( ill_backend.enabled ) %] >+ <label for="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]">[% loop.index()+1 | html %]. [% ill_backend.name | html %]</label> >+ <input value="[% ill_backend.name | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]" type="checkbox" class="preference preference-checkbox" checked="checked" /> >+ [% ELSIF (ill_backend.unable) %] >+ <label style="color:red" for="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]">[% loop.index()+1 | html %]. [% ill_backend.name | html %] (Unable to provide availability)</label> >+ <input value="[% ill_backend.name | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]" type="checkbox" class="preference preference-checkbox" disabled /> >+ [% ELSE %] >+ <label for="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]">[% ill_backend.name | html %]</label> >+ <input value="[% ill_backend.name | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]" type="checkbox" class="preference preference-checkbox" /> >+ [% END %] >+ </li> >+ [% END # FOREACH ill_backend %] >+ </ul> <!-- / ul.sortable --> >+ [% ELSE %] >+ <p><strong>No available backends</strong></p> >+ [% END # IF ( CHUNK.ill_backends ) %] > [% ELSIF ( CHUNK.type_languages ) %] > <ul class="sortable"> > [% FOREACH language IN CHUNK.languages %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index 608c916d64..eaaf11600e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -244,6 +244,14 @@ $(".sortable").each((i, e) => { > Sortable.create(e, { > animation: 150, > onUpdate: function (e) { >+ $(e.target) >+ .find("li label") >+ .each(function (i) { >+ let newText = $(this) >+ .text() >+ .replace(/\d+\./, i + 1 + "."); >+ $(this).text(newText); >+ }); > $(e.target).find("input:first").change(); > }, > }); >-- >2.39.2
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 35604
:
160035
|
164883
|
164884
|
164885
|
164886
|
164887
|
164888
|
165135
|
165164
|
165165
|
165294
|
165295
|
165296
|
165297
|
165298
|
165299
|
165300
|
166897
|
166898
|
166899
|
166900
|
166901
|
166902
|
166903
|
166995
|
166996
|
166997
|
166998
|
166999
|
167000
|
167001
|
171326
|
171327
|
171328
|
171329
|
171330
|
171331
|
171332
|
174515
|
174516
|
174517
|
174518
|
174519
|
174520
|
174521
|
174522
|
174524
|
174792
|
175828
|
175829
|
175830
|
175831
|
175832
|
175833
|
175834
|
175835
|
175836
|
176036
|
176261
|
176262
|
176263
|
176264
|
176265
|
176266
|
176267
|
176268
|
176269
|
176270
|
176572
|
176662
|
176681
|
176682
|
176683
|
176684
|
176685
|
176686
|
176687
|
176688
|
176689
|
176690
|
176691
|
176692