Bugzilla – Attachment 15544 Details for
Bug 9456
Add callnumber column to the cart
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9043: Syspref improvement: add new type "multiple"
Bug-9043-Syspref-improvement-add-new-type-multiple.patch (text/plain), 4.86 KB, created by
Jonathan Druart
on 2013-02-19 13:54:06 UTC
(
hide
)
Description:
Bug 9043: Syspref improvement: add new type "multiple"
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-02-19 13:54:06 UTC
Size:
4.86 KB
patch
obsolete
>From 7411fe90c37869d00cf7e6f49a6e2d2e62350d01 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 19 Feb 2013 14:48:04 +0100 >Subject: [PATCH] Bug 9043: Syspref improvement: add new type "multiple" > >This patch adds a new type "multiple" for syspref. >This new type allows to select several values for one syspref. > >http://bugs.koha-community.org/show_bug.cgi?id=9456 >--- > admin/preferences.pl | 11 +++++++++-- > koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js | 5 ++++- > .../intranet-tmpl/prog/en/modules/admin/preferences.tt | 12 ++++++++++++ > svc/config/systempreferences | 2 +- > 4 files changed, 26 insertions(+), 4 deletions(-) > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index db91e76..fc27657 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -17,8 +17,7 @@ > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI; > use C4::Auth; >@@ -104,6 +103,14 @@ sub _get_chunk { > map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } } > keys %{ $options{'choices'} } > ]; >+ } elsif ( $options{'multiple'} ) { >+ my @values = split /\|/, $value; >+ $chunk->{type} = 'multiple'; >+ $chunk->{CHOICES} = [ >+ sort { $a->{'text'} cmp $b->{'text'} } >+ map { { text => $options{multiple}->{$_}, value => $_, selected => ( $_ ~~ @values ) } } >+ keys %{ $options{multiple} } >+ ]; > } > > $chunk->{ 'type_' . $chunk->{'type'} } = 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >index 4d793a1..dec4037 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >@@ -11,6 +11,9 @@ KOHA.Preferences = { > Save: function ( form ) { > modified_prefs = $( form ).find( '.modified' ); > data = modified_prefs.serialize(); >+ if ( data.length == 0 && $(modified_prefs).attr('multiple') ) { >+ data = $(modified_prefs).attr('name') + "="; >+ } > if ( !data ) { > humanMsg.displayAlert( MSG_NOTHING_TO_SAVE ); > return; >@@ -44,7 +47,7 @@ $( document ).ready( function () { > $( this.form ).find( '.save-all' ).removeAttr( 'disabled' ); > $( this ).addClass( 'modified' ); > var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' ); >- if ( !name_cell.find( '.modified-warning' ).length ) >+ if ( !name_cell.find( '.modified-warning' ).length ) > name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' ); > KOHA.Preferences.Modified = true; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >index 5b20399..778b685 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -105,6 +105,18 @@ > </option> > [% END %] > </select> >+ [% ELSIF ( CHUNK.type_multiple ) %] >+ <select name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "choice" %]" multiple="multiple"> >+ [% FOREACH CHOICE IN CHUNK.CHOICES %] >+ [% IF ( CHOICE.selected ) %] >+ <option value="[% CHOICE.value %]" selected="selected"> >+ [% ELSE %] >+ <option value="[% CHOICE.value %]"> >+ [% END %] >+ [% CHOICE.text %] >+ </option> >+ [% END %] >+ </select> > [% ELSIF ( CHUNK.type_textarea ) %] > <a class="expand-textarea" style="display: none" href="#">Click to Edit</a> > <textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea> >diff --git a/svc/config/systempreferences b/svc/config/systempreferences >index 8622f6a..831a646 100755 >--- a/svc/config/systempreferences >+++ b/svc/config/systempreferences >@@ -96,7 +96,7 @@ sub set_preferences { > > next if ( !defined( $pref ) ); > >- my $value = join( ',', $query->param( $param ) ); >+ my $value = join( '|', $query->param( $param ) ); > > C4::Context->set_preference( $pref, $value ); > logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value ); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9456
:
14779
|
14780
|
14782
|
14783
|
14861
|
14903
|
14904
|
15542
|
15544
|
15727
|
15728
|
15759
|
15760
|
15813
|
15844
|
15845
|
15846
|
15847
|
15848
|
15937
|
15938
|
15941
|
15943
|
15944
|
15949
|
15950
|
16630
|
16631
|
16734
|
17994
|
17995
|
17996
|
17997
|
19123
|
19124
|
19125
|
19126
|
19146
|
19844
|
19845
|
19846
|
19847
|
19848
|
19849
|
20341
|
20385
|
20386
|
20387
|
20388
|
20389
|
20390