From ee49d6d37277f427b10ce763592a74a0aafd9201 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 11 Jun 2008 16:38:15 -0500 Subject: [PATCH] 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 --- C4/Biblio.pm | 12 +++-- authorities/authorities.pl | 23 +++++++-- cataloguing/addbiblio.pl | 24 ++++++++-- .../intranet-tmpl/prog/en/css/addbiblio.css | 6 ++- .../en/modules/authorities/authorities.tmpl | 47 ++++++++++++++----- .../en/modules/cataloguing/addbiblio.tmpl | 12 +++-- 6 files changed, 96 insertions(+), 28 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 7b2dbd220f..1d98793d18 100755 --- a/C4/Biblio.pm +++ b/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. diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 59acbb8b18..1cb8f8cb60 100755 --- a/authorities/authorities.pl +++ b/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) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 68c70968a7..6b44cf767e 100755 --- a/cataloguing/addbiblio.pl +++ b/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, diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css index 3f7d26016e..9d8f9461ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css +++ b/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; -} \ No newline at end of file +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl index 709699e5f3..2c401fb05f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl +++ b/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__indicator_" - size="2" - maxlength="2" - value="" /> + name="tag__indicator1_" + size="1" + maxlength="1" + value="" /> + _indicator2_" + size="1" + maxlength="1" + value="" /> _indicator_" - size="2" - maxlength="2" - value="" /> + name="tag__indicator1_" + size="1" + maxlength="1" + value="" /> + _indicator2_" + size="1" + maxlength="1" + value="" /> - _indicator_" - value="" /> + name="tag__indicator1_" + value="" /> + _indicator2_" + value="" /> _indicator_" - value="" /> + name="tag__indicator1_" + value="" /> + _indicator2_" + value="" /> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl index 934d351cdb..ddb098fe03 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl @@ -547,15 +547,19 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ? "> - _indicator_" size="2" maxlength="2" value="" /> + _indicator1_" size="1" maxlength="1" value="" /> + _indicator2_" size="1" maxlength="1" value="" /> - _indicator_" size="2" maxlength="2" value="" /> + _indicator1_" size="1" maxlength="1" value="" /> + _indicator2_" size="1" maxlength="1" value="" /> - - _indicator_" value="" /> + _indicator1_" value="" /> + _indicator2_" value="" /> - _indicator_" value="" /> + _indicator1_" value="" /> + _indicator2_" value="" /> -- 2.39.5