From a26b178ffdea366bd972c3a3179583f878e8916d Mon Sep 17 00:00:00 2001 From: David Nind Date: Sat, 28 Dec 2024 05:34:32 +0000 Subject: [PATCH] Bug 31019: Fix broken links to UNIMARC field documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IFLA no longer provides field-level documentation pages for the UNIMARC format (as at December 2024). It only provides: - updates by year as individual PDFs (there may be multiple PDF updates for a field) - a single consolidated PDF that is not yet endorsed by IFLA. This patch updates the default UNIMARC field documentation links to https://www.ifla.org/g/unimarc-rg/unimarc-updates/ It also: - makes minor formating changes to improve consistency with the advanced editor: . the help link text is now [?], instead of ? . adds hover text for [?] - "Show help for this tag" . adds some additional spacing before the indicator fields . removes the '-' before the tag title - updates the MarcFieldDocURL system preference description Test plan: 1. Start up a Koha instance that uses UNIMARC (if using koha-testing-docker, change KOHA_MARC_FLAVOUR=unimarc in your .env file). 2. Set the EnableAdvancedCatalogingEditor system preference to "Enable". 3. Search for and edit any bibliographic record using the basic editor. 4. Click on the help text link (?) after any tag. 5. Note that you get an error: - Firefox: "The page isn’t redirecting properly" - Chrome-based browsers: "This page isn’t working archive.ifla.org redirected you too many times." 6. Switch to the advanced editor (Settings > Switch to advanced editor). 7. Click on a tag and then click the help link ([?]) at the bottom of the page. Result: You get the an error for the web page. 8. Switch back to the basic editor (Settings > Switch to basic editor). 9. Apply the patch. 10. Duplicate the tab and refresh the page for the record you were editing. 11. Click a help link for the basic editor - it now goes to a valid web page (https://www.ifla.org/g/unimarc-rg/unimarc-updates/). 12. Compare the basic editor page to the previously opened tab and note these differences: - the help link text is now [?], instead of ? - there is now hover text for [?]- "Show help for this tag" - there is some additional spacing before the indicator fields - there is no '-' before the tag title 13. Check that the page looks okay if the Settings > Show MARC tag document, and Show tags options are toggled off. 14. Switch to the advanced editor (Settings > Switch to advanced editor). If you click on the help link you now go to a valid web page. 15. View the updated description for updated MarcFieldDocURL system preference and check that it makes sense. 16. Enter a URL for the MarcFieldDocURL system preference, for example, https://example.com 17. Edit another record (using either the basic or advanced editor) and click the help link - it should take you to the web page you set for MarcFieldDocURL. 18. [Optional] Enter a custom URL pattern for the help documentation using {FIELD} (I don't know of any UNIMARC custom URL patterns). 19. Repeat the steps as appropriate for a MARC21 instance: 19.1 Start up a MARC21 instance (change KOHA_MARC_FLAVOUR=unimarc on your .env file). 19.2 The help links should take you to the Library of Congress MARC pages. 19.3 Check that custom URL patterns continue to work, for example, use the Canadian custom URL pattern http://www.marc21.ca/MaJ/BIB/B{FIELD}.pdf 20. Sign off! Signed-off-by: David Nind --- .../prog/en/includes/cateditor-ui.inc | 29 ++++--------- .../admin/preferences/cataloguing.pref | 13 ++++-- .../prog/en/modules/cataloguing/addbiblio.tt | 41 +++++++------------ 3 files changed, 33 insertions(+), 50 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index db6ec682d8..7c758dabf1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -200,38 +200,27 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr } function getFieldHelpURL( tag ) { - [% IF Koha.Preference('marcfielddocurl') %] - var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') | html %]"; + [% IF Koha.Preference('MarcFieldDocURL') %] + var docurl = "[% Koha.Preference('MarcFieldDocURL').replace('"','"') | html %]"; docurl = docurl.replace("{MARC}", "[% marcflavour | html %]"); docurl = docurl.replace("{FIELD}", ""+tag); docurl = docurl.replace("{LANG}", "[% lang | html %]"); return docurl; [% ELSIF ( marcflavour == 'MARC21' ) %] if ( tag == '000' ) { - return "http://www.loc.gov/marc/bibliographic/bdleader.html"; + return "https://www.loc.gov/marc/bibliographic/bdleader.html"; } else if ( tag >= '090' && tag < '100' ) { - return "http://www.loc.gov/marc/bibliographic/bd09x.html"; + return "https://www.loc.gov/marc/bibliographic/bd09x.html"; } else if ( tag < '900' ) { - return "http://www.loc.gov/marc/bibliographic/bd" + tag + ".html"; + return "https://www.loc.gov/marc/bibliographic/bd" + tag + ".html"; } else { - return "http://www.loc.gov/marc/bibliographic/bd9xx.html"; + return "https://www.loc.gov/marc/bibliographic/bd9xx.html"; } [% ELSIF ( marcflavour == 'UNIMARC' ) %] - /* http://archive.ifla.org/VI/3/p1996-1/ is an outdated version of UNIMARC, but - seems to be the only version available that can be linked to per tag. More recent - versions of the UNIMARC standard are available on the IFLA website only as - PDFs! + /* IFLA no longer provides field-level pages for the UNIMARC format + (as at December 2024). */ - if ( tag == '000' ) { - return "http://archive.ifla.org/VI/3/p1996-1/uni.htm"; - } else { - var first = tag[0]; - var url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#"; - if ( first == '0' ) url += "b"; - if ( first != '9' ) url += tag; - - return url; - } + return "https://www.ifla.org/g/unimarc-rg/unimarc-updates/"; [% END %] } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index ffd9b7e549..267d5661cc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -238,9 +238,16 @@ Cataloging: - pref: MarcFieldDocURL class: url - as the URL for MARC field documentation. - - Possible substitutions are {MARC} (marc flavour, eg. "MARC21" or "UNIMARC"), {FIELD} (field number, eg. "000" or "048"), {LANG} (user language, eg. "en" or "fi-FI"). - - If left empty, the format documentation on http://loc.gov (MARC21) or http://archive.ifla.org (UNIMARC) is used. - - For example http://fielddoc.example.com/?marc={MARC}&field={FIELD}&language={LANG} + - "

" + - "If left empty, the default URLs are:" + - "" + - "Placeholders available for use in the URL:" + - "" + - "Examples:" - - pref: hide_marc choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 799a26e6c8..6c88e25b5b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -444,8 +444,8 @@ function AutomaticLinker() { function PopupMARCFieldDoc() { let field = this.dataset.tag; - [% IF Koha.Preference('marcfielddocurl') %] - var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') | html %]"; + [% IF Koha.Preference('MarcFieldDocURL') %] + var docurl = "[% Koha.Preference('MarcFieldDocURL').replace('"','"') | html %]"; docurl = docurl.replace("{MARC}", "[% marcflavour | html %]"); docurl = docurl.replace("{FIELD}", ""+field); docurl = docurl.replace("{LANG}", "[% lang | html %]"); @@ -485,38 +485,25 @@ $(document).ready(function(){ function _MARC21FieldDoc(field) { if(field == 0) { - window.open("http://www.loc.gov/marc/bibliographic/bdleader.html"); + window.open("https://www.loc.gov/marc/bibliographic/bdleader.html"); } else if (field >= 90 && field <= 99 ){ - window.open("http://www.loc.gov/marc/bibliographic/bd09x.html"); + window.open("https://www.loc.gov/marc/bibliographic/bd09x.html"); } else if (field >= 590 && field <= 599 ){ - window.open("http://www.loc.gov/marc/bibliographic/bd59x.html"); + window.open("https://www.loc.gov/marc/bibliographic/bd59x.html"); } else if (field >= 690 && field <= 699 ){ - window.open("http://www.loc.gov/marc/bibliographic/bd69x.html"); + window.open("https://www.loc.gov/marc/bibliographic/bd69x.html"); } else if (field < 900) { - window.open("http://www.loc.gov/marc/bibliographic/bd" + ("000"+field).slice(-3) + ".html"); + window.open("https://www.loc.gov/marc/bibliographic/bd" + ("000"+field).slice(-3) + ".html"); } else { - window.open("http://www.loc.gov/marc/bibliographic/bd9xx.html"); + window.open("https://www.loc.gov/marc/bibliographic/bd9xx.html"); } } function _UNIMARCFieldDoc(field) { - /* http://archive.ifla.org/VI/3/p1996-1/ is an outdated version of UNIMARC, but - seems to be the only version available that can be linked to per tag. More recent - versions of the UNIMARC standard are available on the IFLA website only as - PDFs! + /* IFLA no longer provides field-level pages for the UNIMARC format + (as at December 2024). */ - var url; - if (field == 0) { - url = "http://archive.ifla.org/VI/3/p1996-1/uni.htm"; - } else { - var first = field.substring(0,1); - url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#"; - if (first == 0) url = url + "b"; - url = first == 9 - ? "http://archive.ifla.org/VI/3/p1996-1/uni9.htm" - : url + field; - } - window.open(url); + window.open("https://www.ifla.org/g/unimarc-rg/unimarc-updates/"); } /* @@ -1082,7 +1069,7 @@ $(document).ready(function(){ [% innerloo.tag | html %] [% ELSE %] [% innerloo.tag | html %] -  ? +  [?]   [% END %] [% IF ( innerloo.fixedfield ) %] @@ -1117,10 +1104,10 @@ $(document).ready(function(){ size="1" maxlength="1" value="[% innerloo.indicator2 | html %]" /> - [% END # /IF innerloo.fixedfield %] - + [% END # /IF innerloo.fixedfield %] [% UNLESS advancedMARCEditor %] - [% innerloo.tag_lib | html %] +   [% innerloo.tag_lib | html %] [% END %] -- 2.39.5