Browse Source

kohabug 2207 - improve indicator input in MARC editor

Instead of having one input field for both indicators
of a variable field, the bib and authority MARC editor
now has an input field for each indicator.  This has
two main advantages:

* it is easier to tell what the indicator values are,
  even when the first indicator is a space
* it is easier to set the first indicator to blank
  and the second indicator to non-blank.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Galen Charlton 15 years ago
committed by Joshua Ferraro
parent
commit
ee49d6d372
  1. 12
      C4/Biblio.pm
  2. 23
      authorities/authorities.pl
  3. 24
      cataloguing/addbiblio.pl
  4. 6
      koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css
  5. 47
      koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl
  6. 12
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl

12
C4/Biblio.pm

@ -1466,10 +1466,12 @@ sub TransformHtmlToXml {
L<$record> = TransformHtmlToMarc(L<$params>,L<$cgi>)
L<$params> is a ref to an array as below:
{
'tag_010_indicator_531951' ,
'tag_010_indicator1_531951' ,
'tag_010_indicator2_531951' ,
'tag_010_code_a_531951_145735' ,
'tag_010_subfield_a_531951_145735' ,
'tag_200_indicator_873510' ,
'tag_200_indicator1_873510' ,
'tag_200_indicator2_873510' ,
'tag_200_code_a_873510_673465' ,
'tag_200_subfield_a_873510_673465' ,
'tag_200_code_b_873510_704318' ,
@ -1528,13 +1530,13 @@ sub TransformHtmlToMarc {
}
push @fields,$newfield if($newfield);
}
elsif ($param =~ /^tag_(\d*)_indicator_/){ # new field start when having 'input name="..._indicator_..."
elsif ($param =~ /^tag_(\d*)_indicator1_/){ # new field start when having 'input name="..._indicator1_..."
my $tag = $1;
my $ind1 = substr($cgi->param($param),0,1);
my $ind2 = substr($cgi->param($param),1,1);
my $ind2 = substr($cgi->param($params->[$i+1]),0,1);
$newfield=0;
my $j=$i+1;
my $j=$i+2;
if($tag < 10){ # no code for theses fields
# in MARC editor, 000 contains the leader.

23
authorities/authorities.pl

@ -279,6 +279,21 @@ sub create_input {
return \%subfield_data;
}
=item format_indicator
Translate indicator value for output form - specifically, map
indicator = ' ' to ''. This is for the convenience of a cataloger
using a mouse to select an indicator input.
=cut
sub format_indicator {
my $ind_value = shift;
return '' if not defined $ind_value;
return '' if $ind_value eq ' ';
return $ind_value;
}
=item CreateKey
Create a random value to set it into the input name
@ -321,7 +336,7 @@ sub build_tabs ($$$$$) {
foreach my $tag (sort @tab_data) {
$i++;
next if ! $tag;
my $indicator;
my ($indicator1, $indicator2);
my $index_tag = CreateKey;
# if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab.
@ -408,7 +423,8 @@ sub build_tabs ($$$$$) {
random => CreateKey,
);
if ($tag >= 010){ # no indicator for theses tag
$tag_data{indicator} = $field->indicator(1).$field->indicator(2);
$tag_data{indicator1} = format_indicator($field->indicator(1)),
$tag_data{indicator2} = format_indicator($field->indicator(2)),
}
push( @loop_data, \%tag_data );
}
@ -438,7 +454,8 @@ sub build_tabs ($$$$$) {
index => $index_tag,
tag_lib => $tagslib->{$tag}->{lib},
repeatable => $tagslib->{$tag}->{repeatable},
indicator => $indicator,
indicator1 => $indicator1,
indicator2 => $indicator2,
subfield_loop => \@subfields_data,
tagfirstsubfield => $subfields_data[0],
fixedfield => ($tag < 10)?(1):(0)

24
cataloguing/addbiblio.pl

@ -482,6 +482,22 @@ sub create_input {
return \%subfield_data;
}
=item format_indicator
Translate indicator value for output form - specifically, map
indicator = ' ' to ''. This is for the convenience of a cataloger
using a mouse to select an indicator input.
=cut
sub format_indicator {
my $ind_value = shift;
return '' if not defined $ind_value;
return '' if $ind_value eq ' ';
return $ind_value;
}
sub build_tabs ($$$$$) {
my ( $template, $record, $dbh, $encoding,$input ) = @_;
@ -522,7 +538,7 @@ sub build_tabs ($$$$$) {
foreach my $tag (@tab_data) {
$i++;
next if ! $tag;
my $indicator;
my ($indicator1, $indicator2);
my $index_tag = CreateKey;
# if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab.
@ -612,7 +628,8 @@ sub build_tabs ($$$$$) {
random => CreateKey,
);
if ($tag >= 010){ # no indicator for theses tag
$tag_data{indicator} = $field->indicator(1).$field->indicator(2);
$tag_data{indicator1} = format_indicator($field->indicator(1)),
$tag_data{indicator2} = format_indicator($field->indicator(2)),
}
push( @loop_data, \%tag_data );
}
@ -644,7 +661,8 @@ sub build_tabs ($$$$$) {
index => $index_tag,
tag_lib => $tagslib->{$tag}->{lib},
repeatable => $tagslib->{$tag}->{repeatable},
indicator => $indicator,
indicator1 => $indicator1,
indicator2 => $indicator2,
subfield_loop => \@subfields_data,
tagfirstsubfield => $subfields_data[0],
fixedfield => $tag < 10?1:0,

6
koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css

@ -92,6 +92,10 @@ div.subfield_line label {
width:30em;
}
.indicator {
width: 1em;
}
*html .input_marceditor {
width : 15em;
}
}

47
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl

@ -472,30 +472,53 @@ function searchauthority() {
class="indicator flat"
type="text"
style="display:none;"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
size="2"
maxlength="2"
value="<!-- TMPL_VAR NAME="indicator" -->" />
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
size="1"
maxlength="1"
value="<!-- TMPL_VAR NAME="indicator1" -->" />
<input tabindex="1"
class="indicator flat"
type="text"
style="display:none;"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
size="1"
maxlength="1"
value="<!-- TMPL_VAR NAME="indicator2" -->" />
<!-- TMPL_ELSE -->
<input tabindex="1"
class="indicator flat"
type="text"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
size="2"
maxlength="2"
value="<!-- TMPL_VAR NAME="indicator" -->" />
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
size="1"
maxlength="1"
value="<!-- TMPL_VAR NAME="indicator1" -->" />
<input tabindex="1"
class="indicator flat"
type="text"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
size="1"
maxlength="1"
value="<!-- TMPL_VAR NAME="indicator2" -->" />
<!-- /TMPL_IF --> -
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="fixedfield" -->
<input tabindex="1"
type="hidden"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'-->"
value="<!-- TMPL_VAR NAME="indicator" --><!-- TMPL_VAR name="random" -->" />
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'-->"
value="<!-- TMPL_VAR NAME="indicator1" --><!-- TMPL_VAR name="random" -->" />
<input tabindex="1"
type="hidden"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'-->"
value="<!-- TMPL_VAR NAME="indicator2" --><!-- TMPL_VAR name="random" -->" />
<!-- TMPL_ELSE -->
<input tabindex="1"
type="hidden"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'-->"
value="<!-- TMPL_VAR NAME="indicator" --><!-- TMPL_VAR name="random" -->" />
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'-->"
value="<!-- TMPL_VAR NAME="indicator1" --><!-- TMPL_VAR name="random" -->" />
<input tabindex="1"
type="hidden"
name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'-->"
value="<!-- TMPL_VAR NAME="indicator2" --><!-- TMPL_VAR name="random" -->" />
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->

12
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl

@ -547,15 +547,19 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
<!-- TMPL_UNLESS name="hide_marc" -->
<span class="tagnum" title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --></span>
<!-- TMPL_IF NAME="fixedfield" -->
<input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" />
<input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator1" -->" />
<input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator2" -->" />
<!-- TMPL_ELSE -->
<input tabindex="1" class="indicator flat" type="text" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" />
<input tabindex="1" class="indicator flat" type="text" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator1" -->" />
<input tabindex="1" class="indicator flat" type="text" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator2" -->" />
<!-- /TMPL_IF --> -
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="fixedfield" -->
<input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator" -->" />
<input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator1" -->" />
<input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator2" -->" />
<!-- TMPL_ELSE -->
<input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator" -->" />
<input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator1" -->" />
<input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator2" -->" />
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->

Loading…
Cancel
Save