From 7d203a28fe4f6b8af5df2ef0e67f4b3c9ee2579c Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Sat, 3 May 2014 21:35:43 -0300 Subject: [PATCH] Bug 12177 - Remove HTML from authorities.pl This patch removes HTML code from authorities.pl To test: 1. Check no regressions on authority editor, new/edit/save 2. Check new line on translation files, update a language, look for 'Tag editor' Signed-off-by: Srdjan Signed-off-by: Katrin Fischer Checked various features of the authority edtior: - repeating subfields - deleting subfields - changing the order of subfields - linking a subfield to an authorised value - plugins No regressions found. Passes tests and QA script. Signed-off-by: Tomas Cohen Arazi --- authorities/authorities.pl | 136 ++++++++---------- .../en/modules/authorities/authorities.tt | 28 +++- 2 files changed, 86 insertions(+), 78 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 60a9343d8c..89049fedf7 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -118,18 +118,14 @@ sub build_authorized_values_list { $authorised_lib{$value} = $lib; } } - return CGI::scrolling_list( - -name => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, - -values => \@authorised_values, - -default => $value, - -labels => \%authorised_lib, - -override => 1, - -size => 1, - -multiple => 0, - -tabindex => 1, - -id => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, - -class => "input_marceditor", - ); + return { + type => 'select', + id => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, + name => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, + values => \@authorised_values, + labels => \%authorised_lib, + default => $value, + }; } @@ -209,16 +205,13 @@ sub create_input { # it's a thesaurus / authority field } elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { - $subfield_data{marc_value} = - " - {$tag}->{$subfield}->{authtypecode}."','auth'); return false;\" tabindex=\"1\" title=\"Tag Editor\">... - "; + $subfield_data{marc_value} = { + type => 'text1', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, + }; # it's a plugin field } elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { @@ -238,43 +231,35 @@ sub create_input { my ( $function_name, $javascript ) = plugin_javascript( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop ); # my ( $function_name, $javascript,$extended_param ); - $subfield_data{marc_value} = - " - ... - $javascript"; + $subfield_data{marc_value} = { + type => 'text2', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + function => $function_name, + index_tag => $index_tag, + javascript => $javascript, + }; # it's an hidden field } elsif ( $tag eq '' ) { - $subfield_data{marc_value} = - " - "; + $subfield_data{marc_value} = { + type => 'hidden', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + } } elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { - $subfield_data{marc_value} = - ""; + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + }; # it's a standard field } @@ -289,30 +274,24 @@ sub create_input { && C4::Context->preference("marcflavour") eq "MARC21" ) ) { - $subfield_data{marc_value} = - " - "; + $subfield_data{marc_value} = { + type => 'textarea', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + }; + } else { - $subfield_data{marc_value} = - " - "; + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + }; + } } $subfield_data{'index_subfield'} = $index_subfield; @@ -538,7 +517,10 @@ sub build_hidden_data { $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib}; $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory}; $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; - $subfield_data{marc_value}=""; + $subfield_data{marc_value} = { + type => 'hidden_simple', + name => 'field_value[]', + }; push(@loop_data, \%subfield_data); $i++ } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index b7dcbf7a9b..a3329cd6fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -311,7 +311,33 @@ function confirmnotdup(redirect){ [% END %] - [% subfield_loo.marc_value %] + [% SET mv = subfield_loo.marc_value %] + [% IF ( mv.type == 'select' ) %] + + [% ELSIF ( mv.type == 'text1' ) %] + + ... + [% ELSIF ( mv.type == 'text2' ) %] + + ... + [% mv.javascript %] + [% ELSIF ( mv.type == 'text' ) %] + + [% ELSIF ( mv.type == 'textarea' ) %] + + [% ELSIF ( mv.type == 'hidden' ) %] + + [% ELSIF ( mv.type == 'hidden_simple' ) %] + + [% END %] [% IF ( subfield_loo.repeatable ) %] -- 2.39.5