Bugzilla – Attachment 27014 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]
Bug 766: Use a tt include instead of a method in the AV plugin
Bug-766-Use-a-tt-include-instead-of-a-method-in-th.patch (text/plain), 4.39 KB, created by
Jonathan Druart
on 2014-04-11 11:34:13 UTC
(
hide
)
Description:
Bug 766: Use a tt include instead of a method in the AV plugin
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-04-11 11:34:13 UTC
Size:
4.39 KB
patch
obsolete
>From a5a9dc4c8e4c7c4b3bfbc283b3e8c8f812363160 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 17 Mar 2014 12:36:55 +0100 >Subject: [PATCH] Bug 766: Use a tt include instead of a method in the AV > plugin > >--- > Koha/Template/Plugin/AuthorisedValues.pm | 25 ++--------------- > .../prog/en/includes/av-build-dropbox.inc | 29 ++++++++++++++++++++ > .../prog/en/modules/members/memberentrygen.tt | 5 ++-- > 3 files changed, 34 insertions(+), 25 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc > >diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm >index 3cfdd55..d899f60 100644 >--- a/Koha/Template/Plugin/AuthorisedValues.pm >+++ b/Koha/Template/Plugin/AuthorisedValues.pm >@@ -44,28 +44,9 @@ 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 ); >+sub GetAuthValueDropbox { >+ my ( $self, $category, $default ) = @_; >+ return C4::Koha::GetAuthvalueDropbox($category, $default); > } > > 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc >new file mode 100644 >index 0000000..5002842 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc >@@ -0,0 +1,29 @@ >+[% USE AuthorisedValues %] >+[%# >+ Parameters: >+ name: tthe name of the select element >+ category: the authorised value category >+ default: the default authorised value to select >+ class: the css class of the select element >+ size: the size to use for the input (generated if not authorised value category exist). >+%] >+ >+[% SET avs = AuthorisedValues.GetAuthValueDropbox( category, default ) %] >+[% DEFAULT >+ class = '' >+ size = 20 >+%] >+ >+[% IF avs %] >+ <select id="[% name %]" name="[% name %]" class="[% class %]" > >+ [% FOR av IN avs %] >+ [% IF av.default %] >+ <option value="[% av.value %]" selected="selected">[% av.label %]</option> >+ [% ELSE %] >+ <option value="[% av.value %]">[% av.label %]</option> >+ [% END %] >+ [% END %] >+ </select> >+[% ELSE %] >+ <input type="text" id="[% name %]" name="[% name %]" size="[% size %]" value="[% default %]" class="[% class %]" /> >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 8cf58a2..174b791 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1,4 +1,3 @@ >-[% USE AuthorisedValues %] > [% IF ( opduplicate ) %][% SET focusAction = "clearDupe" %][% END %] > [% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] >@@ -959,7 +958,7 @@ > <label for="sort1"> > [% END %] > Sort 1: </label> >- [% AuthorisedValues.BuildDropbox("sort1", "Bsort1", sort1, { class => focusAction, size => 20 } ) %] >+ [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, class=focusAction, size = 20 %] > [% IF ( mandatorysort1 ) %]<span class="required">Required</span>[% END %] > </li> > [% END %] >@@ -971,7 +970,7 @@ > <label for="sort2"> > [% END %] > Sort 2: </label> >- [% AuthorisedValues.BuildDropbox("sort2", "Bsort2", sort2, { class => focusAction, size => 20 } ) %] >+ [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, class=focusAction, size = 20 %] > [% IF ( mandatorysort2 ) %]<span class="required">Required</span>[% END %] > </li> > [% END %] >-- >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 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