View | Details | Raw Unified | Return to bug 9456
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 11-16 KOHA.Preferences = { Link Here
11
    Save: function ( form ) {
11
    Save: function ( form ) {
12
        modified_prefs = $( form ).find( '.modified' );
12
        modified_prefs = $( form ).find( '.modified' );
13
        data = modified_prefs.serialize();
13
        data = modified_prefs.serialize();
14
        if ( data.length == 0 && $(modified_prefs).attr('multiple') ) {
15
            data = $(modified_prefs).attr('name') + "=";
16
        }
14
        if ( !data ) {
17
        if ( !data ) {
15
            humanMsg.displayAlert( MSG_NOTHING_TO_SAVE );
18
            humanMsg.displayAlert( MSG_NOTHING_TO_SAVE );
16
            return;
19
            return;
Lines 44-50 $( document ).ready( function () { Link Here
44
        $( this.form ).find( '.save-all' ).removeAttr( 'disabled' );
47
        $( this.form ).find( '.save-all' ).removeAttr( 'disabled' );
45
        $( this ).addClass( 'modified' );
48
        $( this ).addClass( 'modified' );
46
        var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' );
49
        var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' );
47
		if ( !name_cell.find( '.modified-warning' ).length )
50
        if ( !name_cell.find( '.modified-warning' ).length )
48
            name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' );
51
            name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' );
49
        KOHA.Preferences.Modified = true;
52
        KOHA.Preferences.Modified = true;
50
    }
53
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (+12 lines)
Lines 105-110 Link Here
105
                        </option>
105
                        </option>
106
                        [% END %]
106
                        [% END %]
107
                    </select>
107
                    </select>
108
                    [% ELSIF ( CHUNK.type_multiple ) %]
109
                    <select name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "choice" %]" multiple="multiple">
110
                        [% FOREACH CHOICE IN CHUNK.CHOICES %]
111
                        [% IF ( CHOICE.selected ) %]
112
                        <option value="[% CHOICE.value %]" selected="selected">
113
                        [% ELSE %]
114
                        <option value="[% CHOICE.value %]">
115
                        [% END %]
116
                            [% CHOICE.text %]
117
                        </option>
118
                        [% END %]
119
                    </select>
108
                    [% ELSIF ( CHUNK.type_textarea ) %]
120
                    [% ELSIF ( CHUNK.type_textarea ) %]
109
					<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
121
					<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
110
					<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea>
122
					<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 96-102 sub set_preferences { Link Here
96
96
97
            next if ( !defined( $pref ) );
97
            next if ( !defined( $pref ) );
98
98
99
            my $value = join( ',', $query->param( $param ) );
99
            my $value = join( '|', $query->param( $param ) );
100
100
101
            C4::Context->set_preference( $pref, $value );
101
            C4::Context->set_preference( $pref, $value );
102
            logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value );
102
            logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value );
103
- 

Return to bug 9456