Bugzilla – Attachment 71601 Details for
Bug 19785
Move template JavaScript to the footer: Authorities, part 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19785: Move template JavaScript to the footer: Authorities, part 1
Bug-19785-Move-template-JavaScript-to-the-footer-A.patch (text/plain), 17.01 KB, created by
Claire Gravely
on 2018-02-14 08:09:54 UTC
(
hide
)
Description:
Bug 19785: Move template JavaScript to the footer: Authorities, part 1
Filename:
MIME Type:
Creator:
Claire Gravely
Created:
2018-02-14 08:09:54 UTC
Size:
17.01 KB
patch
obsolete
>From a8c4c588fee5f3744eae15033eb9d088ca3e05ba Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 8 Dec 2017 19:09:05 +0000 >Subject: [PATCH] Bug 19785: Move template JavaScript to the footer: > Authorities, part 1 > >This patch modifies even more staff client authorities 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 >modified templates: All button controls, DataTables functionality, tabs, >etc. > > - Authorities > - New from Z39.50 > -> Search > -> Results > - New from Z39.50 > - Deletion confirmation > - Merge records -> Merge > - Tabs > - Tag selection > -> Authority detail > - Tabs > - Deletion confirmation > - New from Z39.50 > >Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> >--- > .../prog/en/includes/authorities-search.inc | 16 ----- > .../prog/en/includes/authorities-toolbar.inc | 24 ------- > .../prog/en/includes/authorities_js.inc | 54 +++++++++++++++- > .../en/modules/authorities/authorities-home.tt | 28 ++------ > .../prog/en/modules/authorities/detail.tt | 75 ++++++++-------------- > .../prog/en/modules/authorities/merge.tt | 75 ++++++++++++---------- > .../en/modules/authorities/searchresultlist.tt | 45 ++----------- > 7 files changed, 133 insertions(+), 184 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc >index 45517c8..1f4bab7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc >@@ -1,22 +1,6 @@ > <div class="gradient"> > <h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1> > <!-- Begin Authorities Resident Search Box --> >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function() { >- var searchType = '[% marclist %]'; >- if (searchType) { >- if ('mainentry' == searchType) { >- $("#header_search").tabs( "option", "selected", 0 ); >- } else if ('match' == searchType) { >- $("#header_search").tabs( "option", "selected", 1 ); >- } else if ('all' == searchType) { >- $("#header_search").tabs( "option", "selected", 2 ); >- } >- } >- }); >-//]]> >-</script> > <div id="header_search" class="residentsearch"> > <div id="mainmain_heading" class="residentsearch"> > <p class="tip">Enter main heading ($a only):</p> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >index 52209e1..b42074a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >@@ -1,28 +1,4 @@ > [% INCLUDE 'blocking_errors.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function() { >- $("#delAuth").click(function(){ >- confirm_deletion(); >- return false; >- }); >- >- $("#z3950submit").click(function(){ >- [% IF ( authid ) %] >- if (confirm(_("Please note that this Z39.50 search could replace the current record."))){ >- window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]","z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes'); >- } >- [% ELSE %] >- window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes'); >- [% END %] >- return false; >- }); >- >- }); >- >-//]]> >-</script> >- > [% IF ( authid || CAN_user_editauthorities) %] > > <div id="toolbar" class="btn-toolbar"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc >index cf4a072..6e3b176 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc >@@ -1,5 +1,5 @@ > <script type="text/javascript"> >-//<![CDATA[ >+ > function mergeAuth(authid, summary) { > var alreadySelected = $.cookie('auth_to_merge'); > if (alreadySelected !== undefined) { >@@ -31,12 +31,62 @@ function showMergingInProgress() { > } > } > >+function confirm_deletion(id) { >+ var is_confirmed = confirm(_("Are you sure you want to delete this authority?")); >+ if( !id ){ >+ id = "[% authid %]"; >+ } >+ if (is_confirmed) { >+ window.location="authorities-home.pl?op=delete" >+ + "&authid=" + id >+ + "&type=intranet" >+ + "&authtypecode=[% authtypecode %]" >+ + "&marclist=[% marclist %]" >+ + "&and_or=[% and_or %]" >+ + "&excluding=[% excluding %]" >+ + "&operator=[% operator %]" >+ + "&orderby=[% orderby %]" >+ + "&value=[% value |url %]" >+ + "&startfrom=[% startfrom %]" >+ + "&resultsperpage=[% resultsperpage %]" >+ + "&csrf_token=[% csrf_token %]"; >+ } >+} >+ > $(document).ready(function () { > showMergingInProgress(); > $('.merge_auth').click(function (event) { > event.preventDefault(); > mergeAuth($(this).parents('tr').attr('data-authid'), $(this).parents('tr').find('div.authorizedheading').text()); > }); >+ >+ $("#delAuth").click(function(){ >+ confirm_deletion(); >+ return false; >+ }); >+ >+ $("#z3950submit").click(function(){ >+ [% IF ( authid ) %] >+ if (confirm(_("Please note that this Z39.50 search could replace the current record."))){ >+ window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]","z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes'); >+ } >+ [% ELSE %] >+ window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes'); >+ [% END %] >+ return false; >+ }); >+ >+ var searchType = '[% marclist %]'; >+ if (searchType) { >+ if ('mainentry' == searchType) { >+ $("#header_search").tabs( "option", "selected", 0 ); >+ } else if ('match' == searchType) { >+ $("#header_search").tabs( "option", "selected", 1 ); >+ } else if ('all' == searchType) { >+ $("#header_search").tabs( "option", "selected", 2 ); >+ } >+ } >+ > }); >-//]]> >+ > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities-home.tt >index 7290744..9a71269 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities-home.tt >@@ -1,28 +1,9 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Authorities</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script language="JavaScript" type="text/javascript"> >-//<![CDATA[ >-function Help() { >- newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); >-} >- >-function addauthority() { >- X = document.forms[0].authtype.value; >- window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X; >-} >-function searchauthority() { >- X = document.forms[0].authtype2.value; >- Y = document.forms[0].value.value; >- window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains"; >-} >-function confirm_deletion() { // not really implemented, but required by phantom delAuthButton code in authorities-toolbar.inc >- return true; >-} >-//]]> >-</script> >-[% INCLUDE 'authorities_js.inc' %] > </head> >+ > <body id="auth_authorities_home" class="auth"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'authorities-search.inc' %] >@@ -41,4 +22,9 @@ function confirm_deletion() { // not really implemented, but required by phant > </div> > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'authorities_js.inc' %] >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt >index 5694a2d..b8d7c37 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% PROCESS 'authorities.inc' %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Authorities › >@@ -8,56 +9,8 @@ > [% END %] > </title> > [% INCLUDE 'doc-head-close.inc' %] >-[% IF ( displayhierarchy ) %] >-<script type="text/javascript" src="/intranet-tmpl/lib/jquery/plugins/jquery.jstree_[% KOHA_VERSION %].js"></script> >-[% END %] >-<script type="text/javascript"> >- >-//<![CDATA[ >- >- $(document).ready(function() { >- $('#authoritiestabs').tabs(); >- [% IF ( displayhierarchy ) %] >- var current_nodes = []; >- $('.currentauth').each(function() { >- current_nodes.push('#' + $(this).parent().parents('li:first').attr('id')); >- }); >- $('#hierarchies').jstree({ >- "plugins": [ "themes", "html_data"], >- "themes": { "theme": "classic", >- "icons": false }, >- "core": { "initially_open": current_nodes } >- }); >- [% END %] >- }); >- >-function confirm_deletion() { >- var is_confirmed = confirm(_("Are you sure you want to delete this authority?")); >- if (is_confirmed) { >- window.location="authorities-home.pl?op=delete&authid=[% authid %]&csrf_token=[% csrf_token %]"; >- } >-} >-function Dopop(link) { >- newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes'); >-} >-//]]> >-</script> >-<script type="text/javascript"> >-function Help() { >- newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); >-} >- >-function addauthority() { >- X = document.forms[0].authtype.value; >- window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X; >-} >-function searchauthority() { >- X = document.forms[0].authtype2.value; >- Y = document.forms[0].value.value; >- window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains"; >-} >-</script> > </head> >+ > <body id="auth_detail" class="auth"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'authorities-search.inc' %] >@@ -143,4 +96,28 @@ function searchauthority() { > [% END %] > </div> > >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'authorities_js.inc' %] >+ [% IF ( displayhierarchy ) %] >+ <script type="text/javascript" src="/intranet-tmpl/lib/jquery/plugins/jquery.jstree_[% KOHA_VERSION %].js"></script> >+ [% END %] >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $('#authoritiestabs').tabs(); >+ [% IF ( displayhierarchy ) %] >+ var current_nodes = []; >+ $('.currentauth').each(function() { >+ current_nodes.push('#' + $(this).parent().parents('li:first').attr('id')); >+ }); >+ $('#hierarchies').jstree({ >+ "plugins": [ "themes", "html_data"], >+ "themes": { "theme": "classic", >+ "icons": false }, >+ "core": { "initially_open": current_nodes } >+ }); >+ [% END %] >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >index 0d30a78..4badb7b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >@@ -1,47 +1,15 @@ > [% PROCESS 'merge-record.inc' %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Cataloging › Merging records</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/merge-record_[% KOHA_VERSION %].js"></script> >-[% INCLUDE 'merge-record-strings.inc' %] > <style type="text/css"> > div.record ul, div.record li { float:none; display:block; } > div#result { margin-top: 1em; } > /* We use this style "against" the li ui-tabs-nav style automatically applied */ > </style> >-<script type="text/javascript"> >-//<![CDATA[ >- >- // When submiting the form >- function mergeformsubmit() { >- $('#tabs').remove(); >- } >- >-$(document).ready(function(){ >- // Getting marc structure via ajax >- tagslib = []; >- $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) { >- tagslib = json; >- rebuild_target($("#tabs"), $("#resultul")); >- }); >- >- $('.preview-merge-reference').click(function (ev) { >- ev.preventDefault(); >- newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes'); >- }); >- >- // Creating tabs >- $("#tabs").tabs(); >-}); >- >- >-function changeFramework(fw) { >- $("#Frameworks").val(fw); >-} >- >-//]]> >-</script> > </head> >+ > <body id="auth_merge" class="cat"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'authorities-search.inc' %] >@@ -139,4 +107,43 @@ function changeFramework(fw) { > </div> > </div> > >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'merge-record-strings.inc' %] >+ [% INCLUDE 'authorities_js.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/merge-record_[% KOHA_VERSION %].js"></script> >+ [% INCLUDE 'merge-record-strings.inc' %] >+ <script type="text/javascript"> >+ //<![CDATA[ >+ >+ // When submiting the form >+ function mergeformsubmit() { >+ $('#tabs').remove(); >+ } >+ >+ $(document).ready(function(){ >+ // Getting marc structure via ajax >+ tagslib = []; >+ $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) { >+ tagslib = json; >+ rebuild_target($("#tabs"), $("#resultul")); >+ }); >+ >+ $('.preview-merge-reference').click(function (ev) { >+ ev.preventDefault(); >+ newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes'); >+ }); >+ >+ // Creating tabs >+ $("#tabs").tabs(); >+ }); >+ >+ >+ function changeFramework(fw) { >+ $("#Frameworks").val(fw); >+ } >+ >+ //]]> >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >index 76e4589..2c8e8e0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >@@ -1,46 +1,10 @@ >+[% SET footerjs = 1 %] > [% PROCESS 'authorities-search-results.inc' %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Authorities › Authority search results</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- >-function confirm_deletion(id) { >- var is_confirmed = confirm(_("Are you sure you want to delete this authority?")); >- if (is_confirmed) { >- window.location="authorities-home.pl?op=delete" >- + "&authid=" + id >- + "&type=intranet" >- + "&authtypecode=[% authtypecode %]" >- + "&marclist=[% marclist %]" >- + "&and_or=[% and_or %]" >- + "&excluding=[% excluding %]" >- + "&operator=[% operator %]" >- + "&orderby=[% orderby %]" >- + "&value=[% value |url %]" >- + "&startfrom=[% startfrom %]" >- + "&resultsperpage=[% resultsperpage %]" >- + "&csrf_token=[% csrf_token %]"; >- } >-} >- >-function Help() { >- newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); >-} >- >-function addauthority() { >- X = document.forms[0].authtype.value; >- window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X; >-} >-function searchauthority() { >- X = document.forms[0].authtype2.value; >- Y = document.forms[0].value.value; >- window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains"; >-} >-//]]> >-</script> >-[% INCLUDE 'authorities_js.inc' %] > </head> >+ > <body id="auth_searchresultlist" class="auth"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'authorities-search.inc' %] >@@ -116,4 +80,9 @@ function searchauthority() { > </div> > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'authorities_js.inc' %] >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >-- >2.1.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 19785
:
69662
|
69683
|
70565
|
71390
|
71553
|
71601
|
71902
|
71916