From 9bff9b39dc46b493ed275d9fab8433f8cc6141f0 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 8 Dec 2017 19:57:28 +0000 Subject: [PATCH] Bug 19786: Move template JavaScript to the footer: Authorities, part 2 This patch modifies the staff client patron lists 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 each modified template. I've made one change to the JavaScript in addition to moving it: I've made it so that the blank window which pops up briefly in this process is 100px x 100px instead of full screen. - Cataloging -> Add or edit bibliographic record in a framework which has authorities linked to a tag -> Click authorities plugin link -> Create new authority button -> Autocomplete on text inputs (except "Search all headings") -> Search -> Select authority record ("choose") -> Click authorities plugin link again -> Clear field --- .../prog/en/includes/auth-finder-search.inc | 105 ---------- .../prog/en/modules/authorities/auth_finder.tt | 12 +- .../authorities/blinddetail-biblio-search.tt | 230 +++++++++++---------- .../modules/authorities/searchresultlist-auth.tt | 49 +++-- .../intranet-tmpl/prog/js/auth-finder-search.js | 100 +++++++++ 5 files changed, 256 insertions(+), 240 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc index 16a666e..22f9a75 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc @@ -1,109 +1,4 @@ [% PROCESS 'form-blocks.inc' %] -
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/auth_finder.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/auth_finder.tt index b1d9971..7460ecc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/auth_finder.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/auth_finder.tt @@ -1,3 +1,4 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Cataloging authority plugin [% INCLUDE 'doc-head-close.inc' %] @@ -21,4 +22,13 @@
-[% INCLUDE 'popup-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' popup_window = 1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt index f6ab158..8bd3bcd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt @@ -1,129 +1,131 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Authority details [% INCLUDE 'doc-head-close.inc' %] - +
- +
Loading
-[% INCLUDE 'popup-bottom.inc' %] +[% MACRO jsinclude BLOCK %] + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' popup_window = 1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt index fd2e92b..1e8cf99 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt @@ -1,3 +1,4 @@ +[% SET footerjs = 1 %] [% PROCESS 'authorities-search-results.inc' %] [% INCLUDE 'doc-head-open.inc' %] Koha › Cataloging authority plugin @@ -5,26 +6,8 @@ - +
@@ -111,4 +94,30 @@ function doauth(authid, index, repet)
-[% INCLUDE 'popup-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + + + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' popup_window = 1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js b/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js new file mode 100644 index 0000000..ab1d394 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js @@ -0,0 +1,100 @@ +/* global index authtypecode */ + +$(document).ready(function(){ + $("#clear").on("click",function(e){ + e.preventDefault(); + finderjumpfull('blinddetail-biblio-search.pl?authid=0&index=' + index ); + }); + $("#createnew").on("click",function(e){ + e.preventDefault(); + finderjumpfull('authorities.pl?index=' + index + '&authtypecode=' + authtypecode ); + }); + // marclist + $( "#value_any" ).autocomplete({ + source: function(request, response) { + $.ajax({ + url: "/cgi-bin/koha/authorities/ysearch.pl", + dataType: "json", + data: { + authtypecode : authtypecode, + term: request.term, + op: "do_search", + type: "intranet", + and_or: "and", + operator: "contains", + orderby: "HeadingAsc", + querytype: "marclist" + }, + success: function(data) { + response( $.map( data, function( item ) { + return { + label: item.summary, + value: item.summary + }; + })); + } + }); + }, + minLength: 3, + }); + // mainentry + $( "#value_main" ).autocomplete({ + source: function(request, response) { + $.ajax({ + url: "/cgi-bin/koha/authorities/ysearch.pl", + dataType: "json", + data: { + authtypecode : authtypecode, + term: request.term, + op: "do_search", + type: "intranet", + and_or: "and", + operator: "contains", + orderby: "HeadingAsc", + querytype: "mainentry" + }, + success: function(data) { + response( $.map( data, function( item ) { + return { + label: item.summary, + value: item.summary + }; + })); + } + }); + }, + minLength: 3, + }); + // mainmainentry + $( "#value_mainstr" ).autocomplete({ + source: function(request, response) { + $.ajax({ + url: "/cgi-bin/koha/authorities/ysearch.pl", + dataType: "json", + data: { + authtypecode : authtypecode, + term: request.term, + op: "do_search", + type: "intranet", + and_or: "and", + operator: "contains", + orderby: "HeadingAsc", + querytype: "mainmainentry" + }, + success: function(data) { + response( $.map( data, function( item ) { + return { + label: item.summary, + value: item.summary + }; + })); + } + }); + }, + minLength: 3, + }); +}); + +function finderjumpfull(page){ + window.open(page,'','width=100,height=100,resizable=yes,toolbar=false,scrollbars=yes,top'); +} -- 2.1.4