Bugzilla – Attachment 177673 Details for
Bug 31019
UNIMARC field help link when cataloging - update default URL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31019: Fix broken links to UNIMARC field documentation
Bug-31019-Fix-broken-links-to-UNIMARC-field-docume.patch (text/plain), 13.83 KB, created by
Biblibre Sandboxes
on 2025-02-10 10:16:24 UTC
(
hide
)
Description:
Bug 31019: Fix broken links to UNIMARC field documentation
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2025-02-10 10:16:24 UTC
Size:
13.83 KB
patch
obsolete
>From 06574d1e8016ea2e036c0b7fb856cc87dd2b781a Mon Sep 17 00:00:00 2001 >From: David Nind <david@davidnind.com> >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 <david@davidnind.com> >Signed-off-by: Mathieu Saby <mathsabypro@gmail.com> >--- > .../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 11eed37437..500b3184f8 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 <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: >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 fab93ca4be..72f8b55367 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(){ > <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 %]"> ?</a> >+ <a href="#" class="marcdocs" data-tag="[% innerloo.tag | html %]" title="Show help for this tag">[?]</a> > [% 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> >+ <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"> >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31019
:
175967
|
175968
|
177673
|
177694