From 2f4c8f3ef9e2e1a2f810fed3381d89c3df486e07 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Sun, 4 May 2014 14:19:02 -0300 Subject: [PATCH] [PASSED QA] Bug 12180 - Remove HTML from batchMod.pl This patch removes HTML code from batchMod.pl To test: 1. Check no regressions on batchMod editor, Go to Tools > Batch item modification, put a know barcode on barcode list, press continue 2. Check new line on translation files, update a language, look for 'Tag editor' Fixed capitalisation Signed-off-by: Srdjan Amended patch, a stupid mistake on line 198 of batchMod-edit.tt - [% javascript %] + [% mv.javascript %] Signed-off-by: Katrin Fischer Works as described, no problems found. Passes tests and QA script. --- .../prog/en/modules/tools/batchMod-edit.tt | 28 +++++++- tools/batchMod.pl | 76 +++++++++++++--------- 2 files changed, 74 insertions(+), 30 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index 9cbd901..ab9c2de 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -177,7 +177,33 @@ $(document).ready(function(){ [% ite.marc_lib %] [% UNLESS ( ite.mandatory ) %][% ELSE %]Required[% END %] - [% ite.marc_value %] + + [% SET mv = ite.marc_value %] + [% IF ( mv.type == 'select' ) -%] + + [% ELSIF ( mv.type == 'text1' ) %] + + ... + [% ELSIF ( mv.type == 'text2' ) %] + + ... + [% mv.javascript %] + [% ELSIF ( mv.type == 'text' ) %] + + [% ELSIF ( mv.type == 'hidden' ) %] + + [% ELSIF ( mv.type == 'textarea' ) %] + + [%- END -%] + diff --git a/tools/batchMod.pl b/tools/batchMod.pl index e886642..8cf1204 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -330,9 +330,6 @@ foreach my $tag (sort keys %{$tagslib}) { $subfield_data{visibility} = "display:none;" if (($tagslib->{$tag}->{$subfield}->{hidden} > 4) || ($tagslib->{$tag}->{$subfield}->{hidden} < -4)); # testing branch value if IndependentBranches. - my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" ); - my $attributes = qq($attributes_no_value value="$value" ); - if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { my @authorised_values; my %authorised_lib; @@ -383,25 +380,23 @@ foreach my $tag (sort keys %{$tagslib}) { } $value=""; } - $subfield_data{marc_value} =CGI::scrolling_list( # FIXME: factor out scrolling_list - -name => "field_value", - -values => \@authorised_values, - -default => $value, - -labels => \%authorised_lib, - -override => 1, - -size => 1, - -multiple => 0, - -tabindex => 1, - -id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield, - -class => "input_marceditor", - ); + $subfield_data{marc_value} = { + type => 'select', + id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield, + name => "field_value", + values => \@authorised_values, + labels => \%authorised_lib, + default => $value, + }; # it's a thesaurus / authority field } elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { - $subfield_data{marc_value} = " - {$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}'); return false;\" title=\"Tag Editor\">... - "; + $subfield_data{marc_value} = { + type => 'text1', + id => $subfield_data{id}, + value => $value, + authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, + } # it's a plugin field } elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { @@ -411,21 +406,36 @@ foreach my $tag (sort keys %{$tagslib}) { my $temp; my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); - $subfield_data{marc_value} = qq[ - ... - $javascript]; + $subfield_data{marc_value} = { + type => 'text2', + id => $subfield_data{id}, + value => $value, + function => $function_name, + random => $subfield_data{random}, + javascript => $javascript, + }; } else { warn "Plugin Failed: $plugin"; - $subfield_data{marc_value} = ""; # supply default input form + $subfield_data{marc_value} = { # supply default input form + type => 'text', + id => $subfield_data{id}, + value => $value, + }; } } elsif ( $tag eq '' ) { # it's an hidden field - $subfield_data{marc_value} = qq(); + $subfield_data{marc_value} = { + type => 'hidden', + id => $subfield_data{id}, + value => $value, + }; } elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? - $subfield_data{marc_value} = qq(); + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + value => $value, + }; } elsif ( length($value) > 100 or (C4::Context->preference("marcflavour") eq "UNIMARC" and @@ -434,10 +444,18 @@ foreach my $tag (sort keys %{$tagslib}) { 500 <= $tag && $tag < 600 ) ) { # oversize field (textarea) - $subfield_data{marc_value} = "\n"; + $subfield_data{marc_value} = { + type => 'textarea', + id => $subfield_data{id}, + value => $value, + }; } else { # it's a standard field - $subfield_data{marc_value} = ""; + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + value => $value, + }; } # $subfield_data{marc_value}=""; push (@loop_data, \%subfield_data); -- 1.9.1