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 <srdjan@catalyst.net.nz> Amended patch, a stupid mistake on line 198 of batchMod-edit.tt - [% javascript %] + [% mv.javascript %] Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works as described, no problems found. Passes tests and QA script. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
7d203a28fe
commit
6f10c7bbbc
2 changed files with 74 additions and 30 deletions
|
@ -177,7 +177,33 @@ $(document).ready(function(){
|
||||||
[% ite.marc_lib %]
|
[% ite.marc_lib %]
|
||||||
</label>
|
</label>
|
||||||
[% UNLESS ( ite.mandatory ) %]<input type="checkbox" id="row[% ite.tag %][% ite.subfield %][% ite.random %]" title="Check to delete subfield [% ite.subfield %]" name="disable_input" value="[% ite.subfield %]" />[% ELSE %]<span class="required">Required</span>[% END %]
|
[% UNLESS ( ite.mandatory ) %]<input type="checkbox" id="row[% ite.tag %][% ite.subfield %][% ite.random %]" title="Check to delete subfield [% ite.subfield %]" name="disable_input" value="[% ite.subfield %]" />[% ELSE %]<span class="required">Required</span>[% END %]
|
||||||
[% ite.marc_value %]
|
|
||||||
|
[% SET mv = ite.marc_value %]
|
||||||
|
[% IF ( mv.type == 'select' ) -%]
|
||||||
|
<select name="[%- mv.name -%]" id="[%- mv.id -%]" size="1" tabindex="1" class="input_marceditor">
|
||||||
|
[%- FOREACH aval IN mv.values %]
|
||||||
|
[% IF aval == mv.default %]
|
||||||
|
<option value="[%- aval -%]" selected="selected">[%- mv.labels.$aval -%]</option>
|
||||||
|
[% ELSE %]
|
||||||
|
<option value="[%- aval -%]">[%- mv.labels.$aval -%]</option>
|
||||||
|
[% END %]
|
||||||
|
[%- END -%]
|
||||||
|
</select>
|
||||||
|
[% ELSIF ( mv.type == 'text1' ) %]
|
||||||
|
<input type="text" tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" />
|
||||||
|
<a href="#" class="buttonDot" onclick="Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=[%- mv.authtypecode -%]&index=[%- mv.id -%]','[%- mv.id -%]'); return false;" title="Tag editor">...</a>
|
||||||
|
[% ELSIF ( mv.type == 'text2' ) %]
|
||||||
|
<input type="text" tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" onfocus="Focus[%- mv.function -%]([%- mv.random -%], '[%- mv.id -%]');" onblur=" Blur[%- mv.function -%]([%- mv.random -%], '[%- mv.id -%]');" />
|
||||||
|
<a href="#" class="buttonDot" onclick="Clic[%- mv.function -%]('[%- mv.id -%]'); return false;" title="Tag editor">...</a>
|
||||||
|
[% mv.javascript %]
|
||||||
|
[% ELSIF ( mv.type == 'text' ) %]
|
||||||
|
<input type="text" tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" />
|
||||||
|
[% ELSIF ( mv.type == 'hidden' ) %]
|
||||||
|
<input type="hidden" tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" />
|
||||||
|
[% ELSIF ( mv.type == 'textarea' ) %]
|
||||||
|
<textarea tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255">[%- mv.value -%]"</textarea>
|
||||||
|
[%- END -%]
|
||||||
|
|
||||||
<input type="hidden" name="tag" value="[% ite.tag %]" />
|
<input type="hidden" name="tag" value="[% ite.tag %]" />
|
||||||
<input type="hidden" name="subfield" value="[% ite.subfield %]" />
|
<input type="hidden" name="subfield" value="[% ite.subfield %]" />
|
||||||
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
|
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
|
||||||
|
|
|
@ -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));
|
$subfield_data{visibility} = "display:none;" if (($tagslib->{$tag}->{$subfield}->{hidden} > 4) || ($tagslib->{$tag}->{$subfield}->{hidden} < -4));
|
||||||
# testing branch value if IndependentBranches.
|
# 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} ) {
|
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
|
||||||
my @authorised_values;
|
my @authorised_values;
|
||||||
my %authorised_lib;
|
my %authorised_lib;
|
||||||
|
@ -383,25 +380,23 @@ foreach my $tag (sort keys %{$tagslib}) {
|
||||||
}
|
}
|
||||||
$value="";
|
$value="";
|
||||||
}
|
}
|
||||||
$subfield_data{marc_value} =CGI::scrolling_list( # FIXME: factor out scrolling_list
|
$subfield_data{marc_value} = {
|
||||||
-name => "field_value",
|
type => 'select',
|
||||||
-values => \@authorised_values,
|
id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield,
|
||||||
-default => $value,
|
name => "field_value",
|
||||||
-labels => \%authorised_lib,
|
values => \@authorised_values,
|
||||||
-override => 1,
|
labels => \%authorised_lib,
|
||||||
-size => 1,
|
default => $value,
|
||||||
-multiple => 0,
|
};
|
||||||
-tabindex => 1,
|
|
||||||
-id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield,
|
|
||||||
-class => "input_marceditor",
|
|
||||||
);
|
|
||||||
# it's a thesaurus / authority field
|
# it's a thesaurus / authority field
|
||||||
}
|
}
|
||||||
elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
|
elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
|
||||||
$subfield_data{marc_value} = "<input type=\"text\" $attributes />
|
$subfield_data{marc_value} = {
|
||||||
<a href=\"#\" class=\"buttonDot\"
|
type => 'text1',
|
||||||
onclick=\"Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=".$tagslib->{$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}'); return false;\" title=\"Tag Editor\">...</a>
|
id => $subfield_data{id},
|
||||||
";
|
value => $value,
|
||||||
|
authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode},
|
||||||
|
}
|
||||||
# it's a plugin field
|
# it's a plugin field
|
||||||
}
|
}
|
||||||
elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) {
|
elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) {
|
||||||
|
@ -411,21 +406,36 @@ foreach my $tag (sort keys %{$tagslib}) {
|
||||||
my $temp;
|
my $temp;
|
||||||
my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data );
|
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 );
|
my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data );
|
||||||
$subfield_data{marc_value} = qq[<input type="text" $attributes
|
$subfield_data{marc_value} = {
|
||||||
onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');"
|
type => 'text2',
|
||||||
onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" />
|
id => $subfield_data{id},
|
||||||
<a href="#" class="buttonDot" onclick="Clic$function_name('$subfield_data{id}'); return false;" title="Tag Editor">...</a>
|
value => $value,
|
||||||
$javascript];
|
function => $function_name,
|
||||||
|
random => $subfield_data{random},
|
||||||
|
javascript => $javascript,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
warn "Plugin Failed: $plugin";
|
warn "Plugin Failed: $plugin";
|
||||||
$subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # 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
|
elsif ( $tag eq '' ) { # it's an hidden field
|
||||||
$subfield_data{marc_value} = qq(<input type="hidden" $attributes />);
|
$subfield_data{marc_value} = {
|
||||||
|
type => 'hidden',
|
||||||
|
id => $subfield_data{id},
|
||||||
|
value => $value,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ?
|
elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ?
|
||||||
$subfield_data{marc_value} = qq(<input type="text" $attributes />);
|
$subfield_data{marc_value} = {
|
||||||
|
type => 'text',
|
||||||
|
id => $subfield_data{id},
|
||||||
|
value => $value,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
elsif ( length($value) > 100
|
elsif ( length($value) > 100
|
||||||
or (C4::Context->preference("marcflavour") eq "UNIMARC" and
|
or (C4::Context->preference("marcflavour") eq "UNIMARC" and
|
||||||
|
@ -434,10 +444,18 @@ foreach my $tag (sort keys %{$tagslib}) {
|
||||||
500 <= $tag && $tag < 600 )
|
500 <= $tag && $tag < 600 )
|
||||||
) {
|
) {
|
||||||
# oversize field (textarea)
|
# oversize field (textarea)
|
||||||
$subfield_data{marc_value} = "<textarea $attributes_no_value>$value</textarea>\n";
|
$subfield_data{marc_value} = {
|
||||||
|
type => 'textarea',
|
||||||
|
id => $subfield_data{id},
|
||||||
|
value => $value,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
# it's a standard field
|
# it's a standard field
|
||||||
$subfield_data{marc_value} = "<input type=\"text\" $attributes />";
|
$subfield_data{marc_value} = {
|
||||||
|
type => 'text',
|
||||||
|
id => $subfield_data{id},
|
||||||
|
value => $value,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
# $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\">";
|
# $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\">";
|
||||||
push (@loop_data, \%subfield_data);
|
push (@loop_data, \%subfield_data);
|
||||||
|
|
Loading…
Reference in a new issue