Bugzilla – Attachment 69049 Details for
Bug 19594
Move admin templates JavaScript to the footer: MARC-related
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19594: Move admin templates JavaScript to the footer: MARC-related
Bug-19594-Move-admin-templates-JavaScript-to-the-f.patch (text/plain), 19.29 KB, created by
Simon Pouchol
on 2017-11-09 11:21:00 UTC
(
hide
)
Description:
Bug 19594: Move admin templates JavaScript to the footer: MARC-related
Filename:
MIME Type:
Creator:
Simon Pouchol
Created:
2017-11-09 11:21:00 UTC
Size:
19.29 KB
patch
obsolete
>From 0936571e1a5a1e617354acbf6981aeb97f150d9e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 8 Nov 2017 17:40:55 +0000 >Subject: [PATCH] Bug 19594: Move admin templates JavaScript to the footer: > MARC-related > >This patch modifies the staff client MARC-related administration >templates so that JavaScript is included in the footer instead of the >header. > >To test, apply the patch and test the JavaScript-driven features of the >cart: All button controls, DataTables functionality, tabs, etc. > >Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com> >--- > .../intranet-tmpl/prog/en/includes/admin-menu.inc | 16 +------- > .../en/modules/admin/auth_subfields_structure.tt | 18 +++++---- > .../prog/en/modules/admin/auth_tag_structure.tt | 30 ++++++++------- > .../prog/en/modules/admin/authtypes.tt | 35 +++++++++-------- > .../prog/en/modules/admin/biblio_framework.tt | 27 +++++++------ > .../prog/en/modules/admin/checkmarc.tt | 5 +++ > .../prog/en/modules/admin/fieldmapping.tt | 25 ++++++------ > .../prog/en/modules/admin/koha2marclinks.tt | 27 +++++++------ > .../en/modules/admin/marc_subfields_structure.tt | 8 +++- > .../prog/en/modules/admin/marctagstructure.tt | 45 +++++++++++----------- > koha-tmpl/intranet-tmpl/prog/js/admin-menu.js | 12 ++++++ > 11 files changed, 138 insertions(+), 110 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/admin-menu.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >index 9f8f4f6..06f3619 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >@@ -1,19 +1,5 @@ > [% USE Koha %] >-<script type="text/javascript">//<![CDATA[ >- $(document).ready(function() { >- var path = location.pathname.substring(1); >- if (path == "cgi-bin/koha/admin/marctagstructure.pl" || path == "cgi-bin/koha/admin/marc_subfields_structure.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/biblio_framework.pl"]').css('font-weight','bold'); >- } else if (path == "cgi-bin/koha/admin/auth_tag_structure.pl" || path == "cgi-bin/koha/admin/auth_subfields_structure.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/authtypes.pl"]').css('font-weight','bold'); >- } else if (path == "cgi-bin/koha/admin/oai_set_mappings.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/oai_sets.pl"]').css('font-weight','bold'); >- } else { >- $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >- } >- }); >-//]]> >-</script> >+ > <div id="navmenu"> > <div id="navmenulist"> > <h5>System preferences</h5> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >index aa1baa7..abff20e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >@@ -1,14 +1,9 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Authority MARC subfield structure</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function() { >- $('#subfieldtabs').tabs(); >- }); >-//]]> >-</script> > </head> >+ > <body id="admin_auth_subfields_structure" class="admin"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'prefs-admin-search.inc' %] >@@ -338,4 +333,13 @@ > [% INCLUDE 'admin-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $('#subfieldtabs').tabs(); >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt >index f083e25..a55c605 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt >@@ -1,4 +1,5 @@ > [% USE AuthorisedValues %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Authority MARC framework [% IF ( add_form ) %][% IF ( use_heading_flags_p ) %] > [% IF ( heading_modify_tag_p ) %]› [% IF ( authtypecode ) %][% authtypecode %] Framework[% ELSE %]Default framework[% END %] › Modify tag[% END %] >@@ -7,20 +8,8 @@ > [% INCLUDE 'doc-head-close.inc' %] > > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function() { >- $("#table_authtagstructure").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- ], >- "sPaginationType": "four_button" >- })); >- }); >-//]]> >-</script> > </head> >+ > <body id="admin_auth_tag_structure" class="admin"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'prefs-admin-search.inc' %] >@@ -242,4 +231,19 @@ > [% INCLUDE 'admin-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $("#table_authtagstructure").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "sPaginationType": "four_button" >+ })); >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt >index 2f69f53..77cca18 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Authority types > [% IF op == 'add_form' %] >@@ -8,22 +9,6 @@ > </title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function() { >- $("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- ], >- "sPaginationType": "four_button" >- })); >- $("#authtypecode").on("blur",function(){ >- toUC(this); >- }); >- }); >-//]]> >-</script> > </head> > > <body id="admin_authtypes" class="admin"> >@@ -186,4 +171,22 @@ > [% INCLUDE 'admin-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "sPaginationType": "four_button" >+ })); >+ $("#authtypecode").on("blur",function(){ >+ toUC(this); >+ }); >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt >index 9b81657..8f430cf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › MARC frameworks > [% IF op == 'add_form' %] >@@ -8,18 +9,8 @@ > </title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript"> >- /* Set some variable needed in biblio_framework.js */ >- var MSG_IMPORT_ERROR = _("Error importing the framework"); >- var MSG_SELECT_FILE_FORMAT = _("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."); >- var MSG_OVERWRITE_WARNING = _("Do you really want to import the framework fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"); >- var MSG_IMPORTING_TO_FRAMEWORK = _("Importing to framework: %s. Importing from file: %s."); >- var template_path = "[% interface %]/[% theme %]"; >-</script> >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/biblio_framework.js"></script> >- > </head> >+ > <body id="admin_biblio_framework" class="admin"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'prefs-admin-search.inc' %] >@@ -287,4 +278,18 @@ > [% INCLUDE 'admin-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript"> >+ /* Set some variable needed in biblio_framework.js */ >+ var MSG_IMPORT_ERROR = _("Error importing the framework"); >+ var MSG_SELECT_FILE_FORMAT = _("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."); >+ var MSG_OVERWRITE_WARNING = _("Do you really want to import the framework fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"); >+ var MSG_IMPORTING_TO_FRAMEWORK = _("Importing to framework: %s. Importing from file: %s."); >+ var template_path = "[% interface %]/[% theme %]"; >+ </script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/biblio_framework.js"></script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/checkmarc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/checkmarc.tt >index 7fdf2d0..24ce22e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/checkmarc.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/checkmarc.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › MARC check > [% IF ( total ) %] :[% total %] errors found[% ELSE %] : Configuration OK![% END %]</title> >@@ -276,4 +277,8 @@ > [% INCLUDE 'admin-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt >index 7e2f073..46cd8d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt >@@ -1,19 +1,7 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Keyword to MARC mapping</title> > [% INCLUDE 'doc-head-close.inc' %] >- >-<script type="text/javascript"> >-//<![CDATA[ >-$(document).ready(function() { >- $('#selectframework').find("input:submit").hide(); >- $('#framework').change(function() { >- $('#selectframework').submit(); >- }); >-}); >-//]]> >-</script> >- >- > </head> > > <body id="admin_fieldmapping" class="admin"> >@@ -85,4 +73,15 @@ $(document).ready(function() { > [% INCLUDE 'admin-menu.inc' %] > </div> > >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $('#selectframework').find("input:submit").hide(); >+ $('#framework').change(function() { >+ $('#selectframework').submit(); >+ }); >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >index 1cf606a..2802d71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >@@ -1,21 +1,10 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › > [% IF ( add_form ) %] Koha to MARC mapping › Connect [% tablename %].[% kohafield %] to a MARC subfield[% END %] > [% IF ( else ) %]Koha to MARC mapping [% tagfield %][% END %]</title> > > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >-$(document).ready(function() { >- [% IF tablename.default == 'biblio' %] >- $("#tablename option:first").attr('selected','selected'); >- [% END %] >- $('#tablename').change(function() { >- $('#koha2marc').submit(); >- }); >-}); >-//]]> >-</script> > </head> > > <body id="admin_koha2marclinks" class="admin"> >@@ -124,4 +113,18 @@ $(document).ready(function() { > </div> > [% END %] > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ [% IF tablename.default == 'biblio' %] >+ $("#tablename option:first").attr('selected','selected'); >+ [% END %] >+ $('#tablename').change(function() { >+ $('#koha2marc').submit(); >+ }); >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >index efdac8d..399c179 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >@@ -1,9 +1,10 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration ›[% IF ( add_form ) %][% IF ( use_heading_flags_p ) %][% IF ( heading_edit_subfields_p ) %] MARC subfield structure › Edit MARC subfields constraints[% END %][% ELSE %] MARC subfield structure › [% action %][% END %][% END %] > [% IF ( delete_confirm ) %] MARC subfield structure › Confirm deletion of subfield [% tagsubfield %][% END %][% IF ( delete_confirmed ) %] MARC subfield structure › Subfield deleted[% END %][% IF ( else ) %]MARC subfield structure[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/marc_subfields_structure.js"></script> > </head> >+ > <body id="admin_marc_subfields_structure" class="admin"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'prefs-admin-search.inc' %] >@@ -312,4 +313,9 @@ > [% INCLUDE 'admin-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/marc_subfields_structure.js"></script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >index e4033a3..2f4d0fa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >@@ -1,4 +1,5 @@ > [% USE AuthorisedValues %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › > [% IF ( add_form ) %]MARC frameworks › [% action %] [% searchfield %][% END %] >@@ -7,29 +8,8 @@ > [% IF ( else ) %]MARC frameworks[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script> >- >-<script type="text/javascript"> >-//<![CDATA[ >- >-$(document).ready(function() { >- $("#table_marctagstructure").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- ], >- "sPaginationType": "four_button" >- })); >- $("#select_display").on("change",function(){ >- var checked = $(this).prop("checked") ? 1: 0; >- $.cookie('marctagstructure_selectdisplay', checked); >- this.form.submit(); >- }); >-}); >- >-//]]> >-</script> > </head> >+ > <body id="admin_marctagstructure" class="admin"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'prefs-admin-search.inc' %] >@@ -259,4 +239,25 @@ $(document).ready(function() { > [% INCLUDE 'admin-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script> >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $("#table_marctagstructure").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "sPaginationType": "four_button" >+ })); >+ $("#select_display").on("change",function(){ >+ var checked = $(this).prop("checked") ? 1: 0; >+ $.cookie('marctagstructure_selectdisplay', checked); >+ this.form.submit(); >+ }); >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/admin-menu.js b/koha-tmpl/intranet-tmpl/prog/js/admin-menu.js >new file mode 100644 >index 0000000..0d3aab7 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/admin-menu.js >@@ -0,0 +1,12 @@ >+$(document).ready(function() { >+ var path = location.pathname.substring(1); >+ if (path == "cgi-bin/koha/admin/marctagstructure.pl" || path == "cgi-bin/koha/admin/marc_subfields_structure.pl") { >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/biblio_framework.pl"]').css('font-weight','bold'); >+ } else if (path == "cgi-bin/koha/admin/auth_tag_structure.pl" || path == "cgi-bin/koha/admin/auth_subfields_structure.pl") { >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/authtypes.pl"]').css('font-weight','bold'); >+ } else if (path == "cgi-bin/koha/admin/oai_set_mappings.pl") { >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/oai_sets.pl"]').css('font-weight','bold'); >+ } else { >+ $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >+ } >+}); >-- >2.7.4
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 19594
:
69042
|
69049
|
69496
|
69572