View | Details | Raw Unified | Return to bug 35604
Collapse All | Expand All

(-)a/admin/preferences.pl (+24 lines)
Lines 29-34 use C4::Output qw( output_html_with_http_headers output_and_exit_if_error ); Link Here
29
use C4::Templates;
29
use C4::Templates;
30
use Koha::Acquisition::Currencies;
30
use Koha::Acquisition::Currencies;
31
use Koha::Database::Columns;
31
use Koha::Database::Columns;
32
use Koha::ILL::Backends;
32
use IO::File;
33
use IO::File;
33
use YAML::XS;
34
use YAML::XS;
34
use Encode;
35
use Encode;
Lines 79-84 sub _get_chunk { Link Here
79
        $chunk->{'input_type'} = 'email';
80
        $chunk->{'input_type'} = 'email';
80
    } elsif ( $options{'class'} && $options{'class'} eq 'date' ) {
81
    } elsif ( $options{'class'} && $options{'class'} eq 'date' ) {
81
        $chunk->{'dateinput'} = 1;
82
        $chunk->{'dateinput'} = 1;
83
    } elsif ( $options{'type'} && $options{'type'} eq 'ill-backends' ) {
84
        my @priority_enabled_backends = split ",", C4::Context->preference('AutoILLBackendPriority');
85
        my @sys_pref_backends         = map( { name => $_, enabled => 1 }, @priority_enabled_backends );
86
87
        my $installed_backends = Koha::ILL::Backends->installed_backends;
88
        foreach my $installed_backend ( @{$installed_backends} ) {
89
            if ( not grep { $installed_backend eq $_->{name} } @sys_pref_backends ) {
90
                my $backend = Koha::ILL::Request->new->load_backend($installed_backend);
91
                push(
92
                    @sys_pref_backends,
93
                    {
94
                        name    => $installed_backend,
95
                        enabled => 0,
96
                        !$backend->_backend_capability('provides_backend_availability_check')
97
                            ? ( unable => 1 )
98
                            : ()
99
                    }
100
                );
101
            }
102
        }
103
104
        $chunk->{'ill_backends'} = \@sys_pref_backends;
105
        $chunk->{'type'}      = 'ill_backends';
82
    } elsif ( $options{'type'} && ( $options{'type'} eq 'opac-languages' || $options{'type'} eq 'staff-languages' ) ) {
106
    } elsif ( $options{'type'} && ( $options{'type'} eq 'opac-languages' || $options{'type'} eq 'staff-languages' ) ) {
83
        my $current_languages = { map { +$_, 1 } split( /\s*,\s*/, $value ) };
107
        my $current_languages = { map { +$_, 1 } split( /\s*,\s*/, $value ) };
84
108
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (+22 lines)
Lines 173-178 Link Here
173
                            <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>
173
                            <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>
174
                            <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>
174
                            <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>
175
                        [% END %]
175
                        [% END %]
176
                    [% ELSIF ( CHUNK.type_ill_backends ) %]
177
                        [% IF ( !CHUNK.ill_backends.empty ) %]
178
                            <ul class="sortable">
179
                                [% FOREACH ill_backend IN CHUNK.ill_backends %]
180
                                    <li>
181
                                        <i class="fa-solid fa-fw fa-grip-vertical" aria-hidden="true" style="color:#B7B7B7"></i>
182
                                        [% IF ( ill_backend.enabled ) %]
183
                                            <label for="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]">[% loop.index()+1 | html %]. [% ill_backend.name | html %]</label>
184
                                            <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" />
185
                                        [% ELSIF (ill_backend.unable) %]
186
                                            <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>
187
                                            <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 />
188
                                        [% ELSE %]
189
                                            <label for="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]">[% ill_backend.name | html %]</label>
190
                                            <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" />
191
                                        [% END %]
192
                                    </li>
193
                                [% END # FOREACH ill_backend %]
194
                            </ul> <!-- / ul.sortable -->
195
                        [% ELSE %]
196
                            <p><strong>No available backends</strong></p>
197
                        [% END # IF ( CHUNK.ill_backends ) %]
176
                    [% ELSIF ( CHUNK.type_languages ) %]
198
                    [% ELSIF ( CHUNK.type_languages ) %]
177
                        <ul class="sortable">
199
                        <ul class="sortable">
178
                            [% FOREACH language IN CHUNK.languages %]
200
                            [% FOREACH language IN CHUNK.languages %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-1 / +8 lines)
Lines 244-249 $(".sortable").each((i, e) => { Link Here
244
    Sortable.create(e, {
244
    Sortable.create(e, {
245
        animation: 150,
245
        animation: 150,
246
        onUpdate: function (e) {
246
        onUpdate: function (e) {
247
            $(e.target)
248
                .find("li label")
249
                .each(function (i) {
250
                    let newText = $(this)
251
                        .text()
252
                        .replace(/\d+\./, i + 1 + ".");
253
                    $(this).text(newText);
254
                });
247
            $(e.target).find("input:first").change();
255
            $(e.target).find("input:first").change();
248
        },
256
        },
249
    });
257
    });
250
- 

Return to bug 35604