Merge remote branch 'kc/new/bug_4838' into kcmaster

This commit is contained in:
Chris Cormack 2011-01-10 09:13:17 +13:00
commit 2ba1ba0cfc
4 changed files with 41 additions and 41 deletions

View file

@ -70,6 +70,20 @@ if ( $op eq "do_search" ) {
SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value, SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value,
$startfrom * $resultsperpage, $startfrom * $resultsperpage,
$resultsperpage, $authtypecode, $orderby); $resultsperpage, $authtypecode, $orderby);
# If an authority heading is repeated, add an arrayref to those repetions
# First heading -- Second heading
for my $heading ( @$results ) {
my @repets = split / -- /, $heading->{summary};
if ( @repets > 1 ) {
my @repets_loop;
for (my $i = 0; $i < @repets; $i++) {
push @repets_loop,
{ index => $index, repet => $i+1, value => $repets[$i] };
}
$heading->{repets} = \@repets_loop;
}
}
# multi page display gestion # multi page display gestion
my $displaynext = 0; my $displaynext = 0;
my $displayprev = $startfrom; my $displayprev = $startfrom;

View file

@ -75,46 +75,27 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
); );
# fill arrays # fill arrays
my @loop_data = (); my @subfield_loop;
if ($authid) { if ($authid) {
foreach my $field ( $record->field( $auth_type->{auth_tag_to_report} ) ) { my @fields = $record->field( $auth_type->{auth_tag_to_report} );
my @subfields_data; my $repet = ($query->param('repet') || 1) - 1;
my @subf = $field->subfields; my $field = $fields[$repet];
for ( $field->subfields ) {
# loop through each subfield my ($letter, $value) = @$_;
my %result; $letter = '@' unless $letter;
for my $i ( 0 .. $#subf ) { push @subfield_loop, { marc_subfield => $letter, marc_value => $value };
$subf[$i][0] = "@" unless $subf[$i][0];
$result{ $subf[$i][0] } .= $subf[$i][1] . "|";
}
foreach ( keys %result ) {
my %subfield_data;
chop $result{$_};
$subfield_data{marc_value} = $result{$_};
$subfield_data{marc_subfield} = $_;
# $subfield_data{marc_tag}=$field->tag();
push( @subfields_data, \%subfield_data );
}
if ( $#subfields_data >= 0 ) {
my %tag_data;
$tag_data{tag} = $field->tag() . ' -' . $tagslib->{ $field->tag() }->{lib};
$tag_data{subfield} = \@subfields_data;
push( @loop_data, \%tag_data );
}
} }
} else { }
else {
# authid is empty => the user want to empty the entry. # authid is empty => the user want to empty the entry.
$template->param( "clear" => 1 ); $template->param( "clear" => 1 );
# warn Data::Dumper::Dumper(\@loop_data);
} }
$template->param( "0XX" => \@loop_data );
$template->param( $template->param(
authid => $authid ? $authid : "", authid => $authid ? $authid : "",
index => $index, index => $index,
tagid => $tagid, tagid => $tagid,
SUBFIELD_LOOP => \@subfield_loop,
); );
output_html_with_http_headers $query, $cookie, $template->output; output_html_with_http_headers $query, $cookie, $template->output;

View file

@ -19,19 +19,18 @@
if(subfields[i].getAttribute('name').match(re)){ // it s a subfield if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
var code = subfields[i]; // code is the first input var code = subfields[i]; // code is the first input
var subfield = subfields[i+1]; // subfield the second var subfield = subfields[i+1]; // subfield the second
<!-- TMPL_IF NAME="clear" --> <!-- TMPL_IF NAME="clear" -->
if (subfield){subfield.value="" ;} if (subfield){subfield.value="" ;}
<!--TMPL_ELSE--> <!--TMPL_ELSE-->
<!-- TMPL_LOOP NAME="0XX" --> <!-- TMPL_LOOP NAME="SUBFIELD_LOOP" -->
<!-- TMPL_LOOP NAME="subfield" --> if (code.value == "<!-- TMPL_VAR ESCAPE="JS" NAME="marc_subfield" -->"){
if (code.value == "<!-- TMPL_VAR ESCAPE="JS" NAME="marc_subfield" -->"){
subfield.value = "<!-- TMPL_VAR ESCAPE="JS" NAME="marc_value" -->"; subfield.value = "<!-- TMPL_VAR ESCAPE="JS" NAME="marc_value" -->";
}
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
if(code.value=='9'){
subfield.value = "<!-- TMPL_VAR ESCAPE="JS" NAME="authid" -->";
} }
<!-- /TMPL_LOOP -->
if(code.value=='9'){
subfield.value = "<!-- TMPL_VAR ESCAPE="JS" NAME="authid" -->";
}
<!--/TMPL_IF--> <!--/TMPL_IF-->
} }
} }

View file

@ -70,7 +70,13 @@ function jumpfull(page)
<td><!-- TMPL_VAR NAME="summary" --></td> <td><!-- TMPL_VAR NAME="summary" --></td>
<td><!-- TMPL_VAR NAME="used" --> times</td> <td><!-- TMPL_VAR NAME="used" --> times</td>
<td> <td>
<!-- TMPL_IF name="repets" -->
<!-- TMPL_LOOP NAME="repets" -->
<a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->&amp;repet=<!-- TMPL_VAR NAME="repet" -->')" title="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="repet" --></a>
<!-- /TMPL_LOOP -->
<!-- TMPL_ELSE -->
<a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->')">choose</a> <a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->')">choose</a>
<!-- /TMPL_IF -->
</td> </td>
<td><a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit authority</a></td> <td><a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit authority</a></td>
</tr> </tr>