Bug 31019: Fix broken links to UNIMARC field documentation

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 <david@davidnind.com>
Signed-off-by: Mathieu Saby <mathsabypro@gmail.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9cebd54ab1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
David Nind 2024-12-28 05:34:32 +00:00 committed by Fridolin Somers
parent 906f743a17
commit 5a8e5cefc4
No known key found for this signature in database
GPG Key ID: 9A8E73E2A8B96537
3 changed files with 33 additions and 50 deletions

View File

@ -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('"','&quot;') | html %]";
[% IF Koha.Preference('MarcFieldDocURL') %]
var docurl = "[% Koha.Preference('MarcFieldDocURL').replace('"','&quot;') | 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 %]
}

View File

@ -238,9 +238,16 @@ Cataloging:
- pref: MarcFieldDocURL
class: url
- as the URL for MARC field documentation.
- Possible substitutions are <tt>{MARC}</tt> (marc flavour, eg. "MARC21" or "UNIMARC"), <tt>{FIELD}</tt> (field number, eg. "000" or "048"), <tt>{LANG}</tt> (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 <tt>http://fielddoc.example.com/?marc={MARC}&field={FIELD}&language={LANG}</tt>
- "<br><br>"
- "If left empty, the default URLs are:"
- "<ul><li>MARC21: field-level pages at https://www.loc.gov/marc/bibliographic/</li>"
- "<li>UNIMARC: https://www.ifla.org/g/unimarc-rg/unimarc-updates/</a></li></ul>"
- "Placeholders available for use in the URL:"
- "<ul><li><code>{MARC}</code>: MARC flavor, \"MARC21\" or \"UNIMARC\"</li>"
- "<li><code>{FIELD}</code>: field number, for example, \"000\" or \"048\"</li>"
- "<li><code>{LANG}</code>: language, for example, \"en\" or \"fi-FI\"</li></ul>"
- "Examples:<ul><li>https://www.example.com/marcdocs?marc={MARC}&field={FIELD}&language={LANG}</li>"
- "<li>https://www.marc21.ca/MaJ/BIB/B{FIELD}.pdf</li></ul>"
-
- pref: hide_marc
choices:

View File

@ -444,8 +444,8 @@ function AutomaticLinker() {
function PopupMARCFieldDoc() {
let field = this.dataset.tag;
[% IF Koha.Preference('marcfielddocurl') %]
var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','&quot;') | html %]";
[% IF Koha.Preference('MarcFieldDocURL') %]
var docurl = "[% Koha.Preference('MarcFieldDocURL').replace('"','&quot;') | 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(){
<a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to expand this tag" data-field_id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">[% innerloo.tag | html %]</a>
[% ELSE %]
<span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
<a href="#" class="marcdocs" data-tag="[% innerloo.tag | html %]">&nbsp;?</a>
&nbsp;<a href="#" class="marcdocs" data-tag="[% innerloo.tag | html %]" title="Show help for this tag">[?]</a> &nbsp;
[% 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 %]
<a href="#" tabindex="1" class="expandfield" data-field_id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" title="Click to expand this tag">[% innerloo.tag_lib | html %]</a>
&nbsp; <a href="#" tabindex="1" class="expandfield" data-field_id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" title="Click to expand this tag">[% innerloo.tag_lib | html %]</a>
[% END %]
<span class="field_controls">