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

Return to bug 35604