From 487cfca3ace9c9350d90feee1e22b00e62eccae8 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 18 Feb 2016 11:44:52 -0500 Subject: [PATCH] [SIGNED-OFF]Bug 15859: Move some basic MARC editor controls into settings menu This patch moves the following options into a "Settings" menu inspired by the one in the advanced editor: - Switch to advanced editor - Show MARC tag documentation links - Show tags - Change framework To test, apply the patch and open a new or existing record in the standard MARC editor. - Test that the 'Switch to advanced editor' button option works. - Test that the 'Show MARC tag documenation links' option works (and that your choice persists across sessions). - Test that the initial settings for 'Show tags' respects the 'hide_marc' system preference. - Test that the 'Show tags' option works (and that your choice persists across sessions). - Test that framework switching works correctly and that the menu correctly reflects your choice. - Confirm that other toolbar functions work as expected, both in regular editing mode and Fast Cataloging. Signed-off-by: Hector Castro Works as expected. --- .../prog/en/modules/cataloguing/addbiblio.tt | 176 ++++++++++---------- 1 file changed, 92 insertions(+), 84 deletions(-) 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 2b6b327..0d31c4b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -26,46 +26,42 @@ $('#addbibliotabs').selectTabByID("#[% tab %]"); [% END %] - /* check cookie to hide/show marcdocs*/ - if($.cookie("marcdocs_[% borrowernumber %]") == 'false'){ - hideMARCdocLinks(); - $("#marcDocsSelect").removeAttr('checked'); - } else { - /* reset cookie expire date */ - $.cookie("marcdocs_[% borrowernumber %]",'true', - { path: "/", expires: 365 }); - } $('#toolbar').fixFloat(); + + /* check cookie to hide/show marcdocs*/ + if($.cookie("marcdocs_[% borrowernumber %]") == 'hide'){ + toggleMARCdocLinks(false); + } else { + toggleMARCdocLinks(true); + } + $("#marcDocsSelect").click(function(){ - if($(this).attr("checked")){ - showMARCdocLinks(); + if($.cookie("marcdocs_[% borrowernumber %]") == 'hide'){ + toggleMARCdocLinks(true); } else { - hideMARCdocLinks(); + toggleMARCdocLinks(false); } }); /* check cookie to hide/show marc tags*/ var marctags_cookie = $.cookie("marctags_[% borrowernumber %]"); - if( marctags_cookie == 'false'){ - hideMARCTagLinks(); - $("#marcTagsSelect").removeAttr('checked'); - } else if( marctags_cookie == 'true'){ - showMARCTagLinks(); - $("#marcTagsSelect").attr('checked', 'checked'); + if( marctags_cookie == 'hide'){ + toggleMARCTagLinks(false); + } else if( marctags_cookie == 'show'){ + toggleMARCTagLinks(true) } else { [% UNLESS Koha.Preference("hide_marc") %] - showMARCTagLinks(); - $("#marcTagsSelect").attr('checked', 'checked'); + toggleMARCTagLinks(true) [% ELSE %] - hideMARCTagLinks(); - $("#marcTagsSelect").removeAttr('checked'); + toggleMARCTagLinks(false); [% END %] } + $("#marcTagsSelect").click(function(){ - if($(this).attr("checked")){ - showMARCTagLinks(); + if( $.cookie("marctags_[% borrowernumber %]") == 'hide'){ + toggleMARCTagLinks(true) } else { - hideMARCTagLinks(); + toggleMARCTagLinks(false); } }); @@ -84,7 +80,7 @@ $(".btn-group").removeClass("open"); onOption(); return false; - }) + }); $("#saveandview").click(function(){ $(".btn-group").removeClass("open"); @@ -123,7 +119,11 @@ return false; } ); - + $(".change-framework").on("click", function(){ + var frameworkcode = $(this).data("frameworkcode"); + $("#frameworkcode").val( frameworkcode ); + Changefwk( frameworkcode ); + }); }); function redirect(dest){ @@ -199,41 +199,32 @@ function _UNIMARCFieldDoc(field) { /* * Functions to hide/show marc docs and tags links */ -function hideMARCdocLinks() { - $(".marcdocs").hide(); - $.cookie("marcdocs_[% borrowernumber %]",'false', { path: "/", expires: 365 }); -} -function showMARCdocLinks() { - $(".marcdocs").show(); - $.cookie("marcdocs_[% borrowernumber %]",'true', { path: "/", expires: 365 }); +function toggleMARCdocLinks(flag){ + if( flag === true ){ + $(".marcdocs").show(); + $.cookie("marcdocs_[% borrowernumber %]",'show', { path: "/", expires: 365 }); + $("#marcDocsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o'); + } else { + $(".marcdocs").hide(); + $.cookie("marcdocs_[% borrowernumber %]",'hide', { path: "/", expires: 365 }); + $("#marcDocsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o'); + } } -function hideMARCTagLinks() { - $(".tagnum").hide(); - $(".subfieldcode").hide(); - $.cookie("marctags_[% borrowernumber %]",'false', { path: "/", expires: 365 }); -} -function showMARCTagLinks() { - $(".tagnum").show(); - $(".subfieldcode").show(); - $.cookie("marctags_[% borrowernumber %]",'true', { path: "/", expires: 365 }); +function toggleMARCTagLinks(flag){ + if( flag === true ){ + $(".tagnum").show(); + $(".subfieldcode").show(); + $.cookie("marctags_[% borrowernumber %]",'show', { path: "/", expires: 365 }); + $("#marcTagsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o'); + } else { + $(".tagnum").hide(); + $(".subfieldcode").hide(); + $.cookie("marctags_[% borrowernumber %]",'hide', { path: "/", expires: 365 }); + $("#marcTagsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o'); + } } - [% IF hide_marc %] - var hide = false; - [% ELSE %] - var hide = true; - [% END %] - $("#show_tags").change( function(){ - if ( $(this).is(':checked') ) { - $(".tagnum").show(); - $(".subfieldcode").show(); - } else { - } - } ); - $("#show_tags").attr("checked", !hide) - $("#show_tags").change(); - /** * check if mandatory subfields are written @@ -415,13 +406,6 @@ function Changefwk(FwkList) { [% END %] -[% IF marcflavour != 'NORMARC' AND NOT advancedMARCEditor %] -
- - -
-[% END %] - [% UNLESS ( number ) %] [% IF ( duplicatebiblionumber ) %] @@ -481,9 +465,48 @@ function Changefwk(FwkList) { [% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] - [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 %] - - [% END %] + [% END %] + +
+ + +
+ [% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] [% IF (biblionumber) %] [% IF ( BiblioDefaultViewmarc ) %]
@@ -506,28 +529,13 @@ function Changefwk(FwkList) { Cancel [% END %] [% END %] -
- - -
[% IF ( popup ) %] [% END %] - + -- 1.7.10.4