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

(-)a/admin/preferences.pl (-2 / +9 lines)
Lines 17-24 Link Here
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
19
20
use strict;
20
use Modern::Perl;
21
use warnings;
22
21
23
use CGI;
22
use CGI;
24
use C4::Auth;
23
use C4::Auth;
Lines 104-109 sub _get_chunk { Link Here
104
            map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } }
103
            map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } }
105
            keys %{ $options{'choices'} }
104
            keys %{ $options{'choices'} }
106
        ];
105
        ];
106
    } elsif ( $options{'multiple'} ) {
107
        my @values = split /\|/, $value;
108
        $chunk->{type} = 'multiple';
109
        $chunk->{CHOICES} = [
110
            sort { $a->{'text'} cmp $b->{'text'} }
111
            map { { text => $options{multiple}->{$_}, value => $_, selected => ( $_ ~~ @values ) } }
112
            keys %{ $options{multiple} }
113
        ];
107
    }
114
    }
108
115
109
    $chunk->{ 'type_' . $chunk->{'type'} } = 1;
116
    $chunk->{ 'type_' . $chunk->{'type'} } = 1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js (-1 / +4 lines)
Lines 4-9 KOHA.Preferences = { Link Here
4
    Save: function ( form ) {
4
    Save: function ( form ) {
5
        modified_prefs = $( form ).find( '.modified' );
5
        modified_prefs = $( form ).find( '.modified' );
6
        data = modified_prefs.serialize();
6
        data = modified_prefs.serialize();
7
        if ( data.length == 0 && $(modified_prefs).attr('multiple') ) {
8
            data = $(modified_prefs).attr('name') + "=";
9
        }
7
        if ( !data ) {
10
        if ( !data ) {
8
            humanMsg.displayAlert( MSG_NOTHING_TO_SAVE );
11
            humanMsg.displayAlert( MSG_NOTHING_TO_SAVE );
9
            return;
12
            return;
Lines 46-52 $( document ).ready( function () { Link Here
46
        $( this.form ).find( '.save-all' ).removeAttr( 'disabled' );
49
        $( this.form ).find( '.save-all' ).removeAttr( 'disabled' );
47
        $( this ).addClass( 'modified' );
50
        $( this ).addClass( 'modified' );
48
        var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' );
51
        var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' );
49
		if ( !name_cell.find( '.modified-warning' ).length )
52
        if ( !name_cell.find( '.modified-warning' ).length )
50
            name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' );
53
            name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' );
51
        KOHA.Preferences.Modified = true;
54
        KOHA.Preferences.Modified = true;
52
    }
55
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (+12 lines)
Lines 112-117 Link Here
112
                        </option>
112
                        </option>
113
                        [% END %]
113
                        [% END %]
114
                    </select>
114
                    </select>
115
                    [% ELSIF ( CHUNK.type_multiple ) %]
116
                    <select name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "choice" %]" multiple="multiple">
117
                        [% FOREACH CHOICE IN CHUNK.CHOICES %]
118
                        [% IF ( CHOICE.selected ) %]
119
                        <option value="[% CHOICE.value %]" selected="selected">
120
                        [% ELSE %]
121
                        <option value="[% CHOICE.value %]">
122
                        [% END %]
123
                            [% CHOICE.text %]
124
                        </option>
125
                        [% END %]
126
                    </select>
115
                    [% ELSIF ( CHUNK.type_textarea ) %]
127
                    [% ELSIF ( CHUNK.type_textarea ) %]
116
					<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
128
					<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
117
					<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea>
129
					<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea>
(-)a/svc/config/systempreferences (-2 / +1 lines)
Lines 95-101 sub set_preferences { Link Here
95
95
96
            next if ( !defined( $pref ) );
96
            next if ( !defined( $pref ) );
97
97
98
            my $value = join( ',', $query->param( $param ) );
98
            my $value = join( '|', $query->param( $param ) );
99
99
100
            C4::Context->set_preference( $pref, $value );
100
            C4::Context->set_preference( $pref, $value );
101
            logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value );
101
            logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value );
102
- 

Return to bug 9043