From 69e0a1b9b2f622bcdab05c4ebe548bd8c548bc6a Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 4 Mar 2014 08:57:11 +0200 Subject: [PATCH] Bug 11885: fix inconsistent HTML in MARC Details In Catalog > MARC Details, the HTML in the different tabs is slightly inconsistent and doesn't differentiate different elements, making CSS styling complicated or impossible: * tab 0 has

whereas all the other tabs have just

* all other tabs wrap the subfield character in tags, except for tab 0 * the MARC tag title is a single div with the tag, the indicators and the field description. Attached patch folds all the tab outputs into a single TT BLOCK, which is then reused. It also marks the separate parts of the tag title in their own spans. The output should be nearly identical to previous behaviour, minus a dash from the tag title descriptions - it was used to separate the tag from the description. The description can now be styled separately from the tag itself, so the dash can be added with CSS, if necessary. Revised test: 1) Find a biblio 2) Edit the record so that there is something in every tab (0-9). 3) Save and then click 'MARC' in the left pane to view the MARC details. 4) Note the contents of each tab. 5) Apply patch 6) Compare the MARC details output to what was noted. Should be the same, minus a dash in each of the tag title descriptions. Signed-off-by: Pasi Kallinen Signed-off-by: Mark Tompsett Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton (cherry picked from commit 0ea17a6a7689e7fb3d60ebb72cac72eefb142d8a) Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit 18a5f1cb289261ffe613d7df22b428e12a5be072) --- catalogue/MARCdetail.pl | 12 +- .../prog/en/modules/catalogue/MARCdetail.tt | 339 +++--------------- 2 files changed, 54 insertions(+), 297 deletions(-) diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index d8079bd758..be65d0e715 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -149,7 +149,8 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { $subfield_data{marc_tag} = '000'; push( @subfields_data, \%subfield_data ); my %tag_data; - $tag_data{tag} = '000 -' . $tagslib->{'000'}->{lib}; + $tag_data{tag} = '000'; + $tag_data{tag_desc} = $tagslib->{'000'}->{lib}; my @tmp = @subfields_data; $tag_data{subfield} = \@tmp; push( @loop_data, \%tag_data ); @@ -236,12 +237,9 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { $tag_data{tag} = $tagslib->{ $fields[$x_i]->tag() }->{lib}; } else { - $tag_data{tag} = - $fields[$x_i]->tag() - . ' ' - . C4::Koha::display_marc_indicators($fields[$x_i]) - . ' - ' - . $tagslib->{ $fields[$x_i]->tag() }->{lib}; + $tag_data{tag} = $fields[$x_i]->tag(); + $tag_data{tag_ind} = C4::Koha::display_marc_indicators($fields[$x_i]); + $tag_data{tag_desc} = $tagslib->{ $fields[$x_i]->tag() }->{lib}; } } my @tmp = @subfields_data; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt index a9ab8d6c39..17f57ba743 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt @@ -62,6 +62,45 @@ function Changefwk(FwkList) { [% END %] + +[% BLOCK show_tab_html %] +

+ [% FOREACH tab0X IN tab_data %] + [% IF ( tab0X.tag ) %] +
+
+ [% tab0X.tag %] + [% IF ( tab0X.tag_ind ) %] + [% tab0X.tag_ind.substr(0, 1) %] + [% tab0X.tag_ind.substr(1, 1) %] + [% END %] + [% IF (tab0X.tag_desc) %][% tab0X.tag_desc %][% END %] +
+ [% ELSE %] +
+ [% END %] + [% FOREACH subfiel IN tab0X.subfield %] +

+   + [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] + [% subfiel.short_desc %] + [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] + [% IF ( subfiel.link ) %] + + Search on [% subfiel.marc_value |html %] + + [% END %] + [% IF ( subfiel.authority ) %] + Auth + [% END %] +

+ [% END %] +
+ [% END %] +
+[% END %] + +
    [% IF ( tab0XX ) %] @@ -98,305 +137,25 @@ function Changefwk(FwkList) {
  • Item(s)
  • [% END %]
-
- [% FOREACH tab0X IN tab0XX %] - [% IF ( tab0X.tag ) %] -
-
- [% tab0X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab0X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab0XX" tab_data=tab0XX %] -
- [% FOREACH tab1X IN tab1XX %] - [% IF ( tab1X.tag ) %] -
-
- [% tab1X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab1X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab1XX" tab_data=tab1XX %] -
- [% FOREACH tab2X IN tab2XX %] - [% IF ( tab2X.tag ) %] -
-
- [% tab2X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab2X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab2XX" tab_data=tab2XX %] -
- [% FOREACH tab3X IN tab3XX %] - [% IF ( tab3X.tag ) %] -
-
- [% tab3X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab3X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab3XX" tab_data=tab3XX %] -
- [% FOREACH tab4X IN tab4XX %] - [% IF ( tab4X.tag ) %] -
-
- [% tab4X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab4X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab4XX" tab_data=tab4XX %] -
- [% FOREACH tab5X IN tab5XX %] - [% IF ( tab5X.tag ) %] -
-
- [% tab5X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab5X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab5XX" tab_data=tab5XX %] -
- [% FOREACH tab6X IN tab6XX %] - [% IF ( tab6X.tag ) %] -
-
- [% tab6X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab6X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab6XX" tab_data=tab6XX %] -
- [% FOREACH tab7X IN tab7XX %] - [% IF ( tab7X.tag ) %] -
-
- [% tab7X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab7X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab7XX" tab_data=tab7XX %] -
- [% FOREACH tab8X IN tab8XX %] - [% IF ( tab8X.tag ) %] -
-
- [% tab8X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab8X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab8XX" tab_data=tab8XX %] -
- [% FOREACH tab9X IN tab9XX %] - [% IF ( tab9X.tag ) %] -
-
- [% tab9X.tag %] -
- [% ELSE %] -
- [% END %] - [% FOREACH subfiel IN tab9X.subfield %] -

-   - [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %] - [% subfiel.short_desc %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value |html %][% ELSE %][% subfiel.marc_value |html %][% END %] - [% IF ( subfiel.link ) %] - - Search on [% subfiel.marc_value |html %] - - [% END %] - [% IF ( subfiel.authority ) %] - Auth - [% END %] -

- [% END %] -
- [% END %] -
+ [% PROCESS show_tab_html tab_id="tab9XX" tab_data=tab9XX %] [% IF ( tab10XX ) %]
-- 2.39.5