From 049aa9fd9b7e268459619c44941e2db67362f3a0 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 4 Mar 2014 08:57:11 +0200 Subject: [PATCH] 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. To test: 1) Look at some MARC details in the staff client, noting the contents of each tab. 2) Install patch 3) Compare the MARC details output to what was shown in step 1. Should be the same, minus a dash in each of the tag title descriptions. Signed-off-by: Pasi Kallinen --- 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 f8e4095..3c7b276 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 fd78eeb..643e345 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt @@ -69,6 +69,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 ) %] @@ -105,305 +144,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 ) %]
-- 1.8.3.2