From 3a7f53d25d41454d1ff0e8db22f74da0d3b07520 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 28 Apr 2017 02:53:18 +0000 Subject: [PATCH] Bug 12145: Add LockMoveUpButtons syspref to lock subfield positions This patch adds a syspref LockMoveUpButtons to hide the 'move up' buttons by default in the MARC editor. There is also a new option in the settings menu in the MARC editor called 'Lock subfield positions' so users can toggle the 'move up' buttons in the editor. To test: 1) Apply patch and update database 2) Find the LockMoveUpButtons syspref in Admin -> Global system preferences. Confirm it is set to "Don't lock" by default 3) Go to add a new biblio or edit an existing one in cataloguing 4) The Move Up buttons should still be present and work as normal. Click Settings and confirm the 'Lock subfield positions' option is unchecked 5) Click 'Lock subfield positions' to show and hide the buttons 6) Set the LockMoveUpButtons syspref to Lock and refresh the cataloguing editor 7) Confirm the buttons are hidden by default Sponsored-by: Catalyst IT --- .../bug_12145_-_add_LockMoveUpButtons_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../en/modules/admin/preferences/cataloguing.pref | 6 +++++ .../prog/en/modules/cataloguing/addbiblio.tt | 27 ++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_12145_-_add_LockMoveUpButtons_syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_12145_-_add_LockMoveUpButtons_syspref.sql b/installer/data/mysql/atomicupdate/bug_12145_-_add_LockMoveUpButtons_syspref.sql new file mode 100644 index 0000000..358fc91 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_12145_-_add_LockMoveUpButtons_syspref.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`) VALUES ('LockMoveUpButtons', 0, NULL, "Lock and unlock the 'Move up' buttons in the MARC editor.", 'YesNo'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ef52c81..fa00caa 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -243,6 +243,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('LocalHoldsPriority', '0', NULL, 'Enables the LocalHoldsPriority feature', 'YesNo'), ('LocalHoldsPriorityItemControl', 'holdingbranch', 'holdingbranch|homebranch', 'decides if the feature operates using the item''s home or holding library.', 'Choice'), ('LocalHoldsPriorityPatronControl', 'PickupLibrary', 'HomeLibrary|PickupLibrary', 'decides if the feature operates using the library set as the patron''s home library, or the library set as the pickup library for the given hold.', 'Choice'), +('LockMoveUpButtons', 0, NULL, "Lock and unlock the 'Move up' buttons in the MARC editor.", 'YesNo'), ('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'), 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 1aeadf9..9d2272f 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 @@ -2,6 +2,12 @@ Cataloging: # broken, omitted: marc Interface: - + - pref: LockMoveUpButtons + choices: + yes: Lock + no: "Don't lock" + - "the 'Move up' buttons in the MARC editor." + - - Use - pref: DefaultClassificationSource choices: class-sources 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 7a50096..0f6a821 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -18,6 +18,22 @@ $("#loading").hide(); }); $(document).ready(function() { + var showButtons = true; + [% IF Koha.Preference('LockMoveUpButtons') %] + showButtons = false; + [% ELSE %] + showButtons = true; + [% END %] + toggleMoveUpButtons(showButtons); + $("#lockMoveUpButtons").click(function(){ + if ( showButtons == true ) { + showButtons = false; + } else { + showButtons = true; + } + toggleMoveUpButtons(showButtons); + }); + $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) { $("#"+ui.panel.id+" input:eq(0)").focus(); }); @@ -226,6 +242,16 @@ function toggleMARCTagLinks(flag){ } } +function toggleMoveUpButtons(flag){ + if( flag === true ){ + $(".buttonUp").show(); + $("#lockMoveUpButtons i").removeClass('fa-check-square-o').addClass('fa-square-o'); + } else { + $(".buttonUp").hide(); + $("#lockMoveUpButtons i").addClass('fa-check-square-o').removeClass('fa-square-o'); + } +} + /** * check if mandatory subfields are written */ @@ -489,6 +515,7 @@ function Changefwk() { Show tags [% END %] +
  • Lock subfield positions
  • -- 2.1.4