Bugzilla – Attachment 69662 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), 14.16 KB, created by
Owen Leonard
on 2017-12-08 19:20:39 UTC
(
hide
)
Description:
Bug 19785: Move template JavaScript to the footer: Authorities, part 1
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2017-12-08 19:20:39 UTC
Size:
14.16 KB
patch
obsolete
>From fe715b697c5b4eaf3c709efef379e9a3c5b87a2f 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 >--- > .../prog/en/includes/authorities-search.inc | 16 ----- > .../prog/en/includes/authorities-toolbar.inc | 24 ------- > .../prog/en/includes/authorities_js.inc | 39 ++++++++++- > .../en/modules/authorities/authorities-home.tt | 28 ++------ > .../prog/en/modules/authorities/detail.tt | 75 ++++++++-------------- > .../en/modules/authorities/searchresultlist.tt | 65 ++++++++----------- > 6 files changed, 97 insertions(+), 150 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 582a4ed..dc857d0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >@@ -1,27 +1,3 @@ >-<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..f1f4aea 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,47 @@ function showMergingInProgress() { > } > } > >+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 %]"; >+ } >+} >+ > $(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 d8d736a..a3104a1 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.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.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/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >index 76e4589..c3b433e 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,29 @@ function searchauthority() { > </div> > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript"> >+ 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 %]"; >+ } >+ } >+ </script> >+ [% 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