From 88ff9d81db4d39dadf4291de235bfa13d4ff3bb6 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 8 Apr 2014 11:25:37 +0300 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) Install Koha 2) Go to Cataloguing > New record 3) Clicking on the question mark links in the MARC edit will open a window to either loc.gov or archive.ifla.org 4) Install patch 5) Redo parts 1, 2, and 3. 6) Set the value of MarcFieldDocURL to http://example.com/?field={FIELD}&marc={MARC}&lang={LANG} 7) Redo parts 1 and 2 8) 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. --- cataloguing/addbiblio.pl | 1 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 10 ++++++++++ .../prog/en/modules/admin/preferences/cataloguing.pref | 7 +++++++ .../intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 8 +++++++- 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 118bfc2..931b09d 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -997,6 +997,7 @@ elsif ( $op eq "delete" ) { $template->param( title => $record->title() ) if ( $record ne "-1" ); $template->param( + marcfielddocurl => C4::Context->preference("MarcFieldDocURL"), popup => $mode, frameworkcode => $frameworkcode, itemtype => $frameworkcode, diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 661910b..bdd4dda 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -176,6 +176,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), ('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'), +('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'), ('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'), ('MaxItemsForBatch','1000',NULL,'Max number of items record to process in a batch (modification or deletion)','Integer'), ('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 70db070..b28e149 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8097,6 +8097,16 @@ if (CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(" + INSERT 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'); + "); + print "Upgrade to $DBversion done (Bug 11674: Configuration for MARC field doc URLs)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS 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 169aec4..9e29393 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 @@ -120,6 +120,13 @@ Cataloging: - pref: URLLinkText - as the text of links embedded in MARC records. - + - Use + - pref: MarcFieldDocURL + - 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: UseControlNumber choices: yes: Use 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 286e8b7..a094941 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -135,7 +135,13 @@ function PopupZ3950() { } function PopupMARCFieldDoc(field) { - [% IF ( marcflavour == 'MARC21' ) %] + [% IF (marcfielddocurl) %] + var docurl = "[% 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); -- 1.8.3.2