From 50d2b712883808a36b1d03ac770aed470c8d19d1 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 20 May 2015 14:56:48 +0200 Subject: [PATCH] Bug 12176: [QA Follow-up] Small additem adjustments Adjusting a few small things and making qa tools happy: [1] Remove .hidden after [% avalue %] in additem.tt. (Typo) [2] A closer look revealed that mv.avalue is useless too. An input element does not contain any content. Putting it after the hidden element in a non-visible context has no meaning. [3] Change handling of select attributes readonly and disabled. [4] Remove unused variable $attributes_no_value_textarea [5] Removed a comment with TODO referring to this report. [6] Moving a duplicated TT variable (mv.javascript) outside IF statement. [7] And finally could not resist this one: Moving strings Tag editor and No popup from script to template. Plugins++ NOTE: Most item plugins redirect click to focus. In that case there is no popup, but unfortunately the text Tag editor comes up. When you remove or rename function Click, No popup comes up. So it works. Sorry that this small list kept growing :) Signed-off-by: Marcel de Rooy Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- cataloguing/additem.pl | 13 +++---------- .../prog/en/modules/cataloguing/additem.tt | 17 +++++++++++------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 48bcd596a6..8a800e10d4 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -155,7 +155,6 @@ sub generate_subfield_form { $value = $input->param('barcode'); } my $attributes_no_value = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" ); - my $attributes_no_value_textarea = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" ); # Getting list of subfields to keep when restricted editing is enabled my $subfieldsToAllowForRestrictedEditing = C4::Context->preference('SubfieldsToAllowForRestrictedEditing'); @@ -236,7 +235,6 @@ sub generate_subfield_form { id => $subfield_data{id}, maxlength => $subfield_data{max_length}, value => $value, - avalue => $authorised_lib{$value}, }; } else { @@ -249,14 +247,11 @@ sub generate_subfield_form { }; # If we're on restricted editing, and our field is not in the list of subfields to allow, # then it is read-only - if ( + $subfield_data{marc_value}->{readonlyselect} = ( not $allowAllSubfields and $restrictededition and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow - ) { - $subfield_data{marc_value}->{readonly} ='readonly="readonly"', - $subfield_data{marc_value}->{disabled} ='disabled="disabled"', - } + ) ? 1: 0; } } # it's a thesaurus / authority field @@ -280,16 +275,14 @@ sub generate_subfield_form { id => $subfield_data{id}, tabloop => $loop_data }; $plugin->build( $pars ); if( !$plugin->errstr ) { - #TODO Report 12176 will make this even better ! my $class= 'buttonDot'. ( $plugin->noclick? ' disabled': '' ); - my $title= $plugin->noclick? 'No popup': 'Tag editor'; $subfield_data{marc_value} = { type => 'text_plugin', id => $subfield_data{id}, maxlength => $subfield_data{max_length}, value => $value, class => $class, - title => $title, + nopopup => $plugin->noclick, javascript => $plugin->javascript, }; } else { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 78e97c54c1..1cc8402e07 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -228,9 +228,13 @@ $(document).ready(function() { [% SET mv = ite.marc_value %] [% IF ( mv.type == 'hidden' ) %] - [% mv.avalue %].hidden + [% ELSIF ( mv.type == 'select' ) %] - + [% ELSE %] + - [% IF ( mv.title == 'Tag editor' ) %] - ...[%- mv.javascript -%] - [% ELSIF ( mv.title == 'No popup' ) %] - ...[%- mv.javascript -%] + [% IF ( mv.nopopup ) %] + ... + [% ELSE %] + ... [% END %] + [%- mv.javascript -%] [% ELSIF ( mv.type == 'text' ) %] [% ELSIF ( mv.type == 'textarea' ) %] -- 2.39.5