From ff1e9150a55aef832155b1759668a7c6600502b3 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 1 Feb 2018 12:00:02 +0200 Subject: [PATCH] Bug 11674: Configuration for MARC field doc URLs Add a new system preference MarcFieldDocURL. Setting it to some URL will make all the MARC documentation links point to that in the MARC edit UI. Leaving the value empty will use the old defaults (http://loc.gov for MARC21 and http://archive.ifla.org for UNIMARC). There are some possible substitutions usable in the URL: - {MARC} is replaced with either "MARC21" or "UNIMARC" - {FIELD} is replaced by the MARC field number, eg. "000", "048", ... - {LANG} is replaced by the UI language, eg. "en", or "fi-FI" To test: 1) Go to Cataloguing > New record 2) Clicking on the question mark links in the MARC edit will open a window to either loc.gov or archive.ifla.org 3) Install patch, run updatedatabase, etc 4) Redo parts 1, and 2. 5) Set the value of MarcFieldDocURL to http://example.com/?field={FIELD}&marc={MARC}&lang={LANG} 6) Redo parts 1 and 2 7) Clicking on the question mark links in the MARC edit will open a window to example.com, with the proper substitutions in the URL for the field, marc flavour and language Signed-off-by: Pasi Kallinen Signed-off-by: Mark Tompsett Signed-off-by: Katrin Fischer --- .../atomicupdate/bug_11674-config_for_marc_field_doc_urls.sql | 3 +++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/cataloguing.pref | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 8 +++++++- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_11674-config_for_marc_field_doc_urls.sql diff --git a/installer/data/mysql/atomicupdate/bug_11674-config_for_marc_field_doc_urls.sql b/installer/data/mysql/atomicupdate/bug_11674-config_for_marc_field_doc_urls.sql new file mode 100644 index 0000000..5fb200c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_11674-config_for_marc_field_doc_urls.sql @@ -0,0 +1,3 @@ + +INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) +VALUES ('MarcFieldDocURL', NULL, NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. \"MARC21\" or \"UNIMARC\". {FIELD} = field number, eg. \"000\" or \"048\". {LANG} = user language, eg. \"en\" or \"fi-FI\"', 'free'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d498841..ad8f41d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -258,6 +258,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('makePreviousSerialAvailable','0','','make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','YesNo'), ('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'), ('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'), +('MarcFieldDocURL', NULL, NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. "MARC21" or "UNIMARC". {FIELD} = field number, eg. "000" or "048". {LANG} = user language, eg. "en" or "fi-FI"', 'free'), ('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'), ('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'), ('MarkLostItemsAsReturned','1','','Mark items as returned when flagged as lost','YesNo'), 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 f8afdc9..cc75b6d 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 @@ -155,6 +155,14 @@ Cataloging: no: "Don't use" - record control number ($w subfields) and control number (001) for linking of bibliographic records. - + - Use + - 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} + - - pref: hide_marc choices: yes: "Don't display" 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 fa58629..2f31727 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -163,7 +163,13 @@ function PopupZ3950() { } function PopupMARCFieldDoc(field) { - [% IF ( marcflavour == 'MARC21' ) %] + [% IF Koha.Preference('marcfielddocurl') %] + var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') %]"; + docurl = docurl.replace("{MARC}", "[% marcflavour %]"); + docurl = docurl.replace("{FIELD}", ""+field); + docurl = docurl.replace("{LANG}", "[% lang %]"); + window.open(docurl); + [% ELSIF ( marcflavour == 'MARC21' ) %] _MARC21FieldDoc(field); [% ELSIF ( marcflavour == 'UNIMARC' ) %] _UNIMARCFieldDoc(field); -- 2.1.4