Bugzilla – Attachment 27045 Details for
Bug 766
Omnibus: Use of CGI::scrolling_list prevents customization in template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 766: Create a plugin routine to build dropdown list
SIGNED-OFF-Bug-766-Create-a-plugin-routine-to-buil.patch (text/plain), 1.78 KB, created by
Bernardo Gonzalez Kriegel
on 2014-04-11 21:46:55 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 766: Create a plugin routine to build dropdown list
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2014-04-11 21:46:55 UTC
Size:
1.78 KB
patch
obsolete
>From 6c2e5bd51ba4c4fa803b90715c69ea9e0d95aa91 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 6 Mar 2014 17:07:08 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 766: Create a plugin routine to build > dropdown list > >On this way, dropdown list could be generated from the templates. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >--- > Koha/Template/Plugin/AuthorisedValues.pm | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > >diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm >index 0a19be2..3cfdd55 100644 >--- a/Koha/Template/Plugin/AuthorisedValues.pm >+++ b/Koha/Template/Plugin/AuthorisedValues.pm >@@ -25,6 +25,7 @@ use base qw( Template::Plugin ); > use Encode qw{encode decode}; > > use C4::Koha; >+use C4::Charset; > > =pod > >@@ -43,4 +44,28 @@ sub GetByCode { > return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); > } > >+sub BuildDropbox { >+ my ( $self, $name, $category, $default, $params ) = @_; >+ my $class = $params->{class}; >+ my $avs = C4::Koha::GetAuthvalueDropbox($category, $default); >+ my $size = $params->{size} || 20; >+ my $html; >+ if ( @$avs ) { >+ $html = qq|<select id="$name" name="$name" class="$class" >|; >+ for my $av ( @$avs ) { >+ if ( $av->{default} ) { >+ $html .= qq|<option value="$av->{value}" selected="selected">$av->{label}</option>|; >+ } else { >+ $html .= qq|<option value="$av->{value}">$av->{label}</option>|; >+ } >+ } >+ $html .= q|</select>|; >+ } else { >+ $html .= qq|<input type="text" id="$name" name="$name" size="$size" value="$default" class="$class" />|; >+ >+ } >+ >+ return encode( 'UTF-8', $html ); >+} >+ > 1; >-- >1.7.9.5
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 766
:
18538
|
18550
|
18664
|
25904
|
25905
|
25906
|
25907
|
26401
|
27010
|
27011
|
27012
|
27013
|
27014
|
27044
|
27045
|
27046
|
27047
|
27048
|
27396
|
27400
|
27441
|
27442
|
27443
|
27444
|
27445
|
27446
|
27447
|
27448
|
27479
|
27495
|
27665
|
27666
|
27667
|
27668
|
27669
|
27670
|
27671
|
29870
|
29871
|
29872
|
29877
|
30404
|
30405
|
30406
|
30428
|
30430
|
30432
|
30510
|
30511
|
30512