From 7f84ccebfbc6c3c55c129efe20d83425a1f169a8 Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 22 Dec 2004 10:14:43 +0000 Subject: [PATCH] minor html modif : when a tag is repeated, the tag header is not repeated, but replaced by a space. --- MARCdetail.pl | 45 ++++---- .../default/en/catalogue/MARCdetail.tmpl | 100 ++++++++++++------ 2 files changed, 97 insertions(+), 48 deletions(-) diff --git a/MARCdetail.pl b/MARCdetail.pl index 3dc8f02514..22e0282af8 100755 --- a/MARCdetail.pl +++ b/MARCdetail.pl @@ -73,6 +73,7 @@ my $itemtype = &MARCfind_frameworkcode($dbh,$bibid); my $tagslib = &MARCgettagslib($dbh,1,$itemtype); my $record =MARCgetbiblio($dbh,$bibid); +warn "=>".$record->as_formatted; # open template my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "catalogue/MARCdetail.tmpl", @@ -91,45 +92,53 @@ for (my $tabloop = 0; $tabloop<=10;$tabloop++) { # loop through each tag my @fields = $record->fields(); my @loop_data =(); - foreach my $field (@fields) { - my @subfields_data; +# foreach my $field (@fields) { + my @subfields_data; + for (my $x_i=0;$x_i<=$#fields;$x_i++) { + warn "$tabloop => $x_i"; # if tag <10, there's no subfield, use the "@" trick - if ($field->tag()<10) { - next if ($tagslib->{$field->tag()}->{'@'}->{tab} ne $tabloop); - next if ($tagslib->{$field->tag()}->{'@'}->{hidden}); + if ($fields[$x_i]->tag()<10) { + next if ($tagslib->{$fields[$x_i]->tag()}->{'@'}->{tab} ne $tabloop); + next if ($tagslib->{$fields[$x_i]->tag()}->{'@'}->{hidden}); my %subfield_data; - $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{'@'}->{lib}; - $subfield_data{marc_value}=$field->data(); + $subfield_data{marc_lib}=$tagslib->{$fields[$x_i]->tag()}->{'@'}->{lib}; + $subfield_data{marc_value}=$fields[$x_i]->data(); $subfield_data{marc_subfield}='@'; - $subfield_data{marc_tag}=$field->tag(); + $subfield_data{marc_tag}=$fields[$x_i]->tag(); push(@subfields_data, \%subfield_data); } else { - my @subf=$field->subfields; + my @subf=$fields[$x_i]->subfields; # loop through each subfield for my $i (0..$#subf) { $subf[$i][0] = "@" unless $subf[$i][0]; - next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne $tabloop); - next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden}); + next if ($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{tab} ne $tabloop); + next if ($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{hidden}); my %subfield_data; - $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib}; - if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl}) { + $subfield_data{marc_lib}=$tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{lib}; + if ($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{isurl}) { $subfield_data{marc_value}="$subf[$i][1]"; } else { - if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{authtypecode}) { - $subfield_data{authority}=$field->subfield(9); + if ($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{authtypecode}) { + $subfield_data{authority}=$fields[$x_i]->subfield(9); } $subfield_data{marc_value}=$subf[$i][1]; } $subfield_data{marc_subfield}=$subf[$i][0]; - $subfield_data{marc_tag}=$field->tag(); + $subfield_data{marc_tag}=$fields[$x_i]->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; + if ($fields[$x_i]->tag() eq $fields[$x_i-1]->tag()) { + $tag_data{tag}=""; + } else { + $tag_data{tag}=$fields[$x_i]->tag().' -'. $tagslib->{$fields[$x_i]->tag()}->{lib}; + } + my @tmp = @subfields_data; + $tag_data{subfield} = \@tmp; push (@loop_data, \%tag_data); + undef @subfields_data; } } $template->param($tabloop."XX" =>\@loop_data); diff --git a/koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl b/koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl index ae5b3be3cc..217efba060 100644 --- a/koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl @@ -75,9 +75,13 @@
-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+

-

- -

+ +

+ +

+ +
+