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' ,
}
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.
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
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.
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 );
}
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)
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 ) = @_;
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.
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 );
}
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,
width:30em;
}
+.indicator {
+ width: 1em;
+}
+
*html .input_marceditor {
width : 15em;
-}
\ No newline at end of file
+}
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 -->
<!-- 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 -->