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 159-164 Link Here
159
                            <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>
159
                            <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>
160
                            <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>
160
                            <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>
161
                        [% END %]
161
                        [% END %]
162
                    [% ELSIF ( CHUNK.type_ill_backends ) %]
163
                        [% IF ( !CHUNK.ill_backends.empty ) %]
164
                            <ul class="sortable">
165
                                [% FOREACH ill_backend IN CHUNK.ill_backends %]
166
                                    <li>
167
                                        <i class="fa-solid fa-fw fa-grip-vertical" aria-hidden="true" style="color:#B7B7B7"></i>
168
                                        [% IF ( ill_backend.enabled ) %]
169
                                            <label for="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]">[% loop.index()+1 | html %]. [% ill_backend.name | html %]</label>
170
                                            <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" />
171
                                        [% ELSIF (ill_backend.unable) %]
172
                                            <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>
173
                                            <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 />
174
                                        [% ELSE %]
175
                                            <label for="pref_[% CHUNK.name | html %]_[% ill_backend.name | html %]">[% ill_backend.name | html %]</label>
176
                                            <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" />
177
                                        [% END %]
178
                                    </li>
179
                                [% END # FOREACH ill_backend %]
180
                            </ul> <!-- / ul.sortable -->
181
                        [% ELSE %]
182
                            <p><strong>No available backends</strong></p>
183
                        [% END # IF ( CHUNK.ill_backends ) %]
162
                    [% ELSIF ( CHUNK.type_languages ) %]
184
                    [% ELSIF ( CHUNK.type_languages ) %]
163
                        <ul class="sortable">
185
                        <ul class="sortable">
164
                            [% FOREACH language IN CHUNK.languages %]
186
                            [% FOREACH language IN CHUNK.languages %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-1 / +6 lines)
Lines 203-208 $( document ).ready( function () { Link Here
203
        Sortable.create(e, {
203
        Sortable.create(e, {
204
            animation: 150,
204
            animation: 150,
205
            onUpdate: function( e ){
205
            onUpdate: function( e ){
206
                $(e.target)
207
                    .find("li label")
208
                    .each(function (i) {
209
                        let newText = $(this).text().replace(/\d+\./, i+1+".");
210
                        $(this).text(newText);
211
                    });
206
                $(e.target).find('input:first').change();
212
                $(e.target).find('input:first').change();
207
            }
213
            }
208
        });
214
        });
209
- 

Return to bug 35604