From f7dc2697a388e03fdf1dabfe171f2b2026248d7b Mon Sep 17 00:00:00 2001 From: Hector Castro Date: Fri, 24 Jun 2016 15:55:40 -0600 Subject: [PATCH] Bug 16812: Revise JS script for z3950_search.tts and remove onclick events Modify JS script to all templates for z3950_search.tt and reduce the redundant code This patch propose: -z3950_auth_search.tt has various onclick events used in links. Also fix: acqui/z3950_search.tt and cataloguing/z3950_search.tt -Trigger onclick events via JQuery .on() -Make a separate .js and .inc file -Reduce the number of line and redundant code -Also add Font Awesome Icons to "Select/Clear all" and "Clear search form" links To test: 1-Apply bug 16600 on top 2-Apply patch 3-Go to Authorities > click New from Z39.50 4-Fill some fields and click in "Clear search form" link 5-Search under "Dalton" or another author that launch too many headings 6-Clic in some heading and notice the dialog open, test: "Preview MARC", ISBD (when showed), "Import" and close the dialog "X". Use the "Import" from table too. 7-Use the "next/previous page" button, change "Go to page" to number in and out of the range presented, also test whit a letter, etc. Go to Cataloging > New from Z39.50/SRU Repeat steps 3 to 6. But this time with bib records. Go to Adquisition > Open or Create a basket and choose to "Add to basket" button. A modal appear, chose the option "Order from external source" Repeat steps 3 to 6. But this thime with bib records. NOTE: The icon trash for "Clear search form" has been selected according with module "Advanced search" there is an icon trash with link "Clear fields" that has the same fuctionality. For some reason the image loading-small.gif does not charge all times when the code is get out of the template. (Fixed with this new patch) DataTable it is specific for each template Sponsored-by: Universidad de El Salvador --- .../prog/en/includes/z3950_search.inc | 29 ++++++ .../prog/en/modules/acqui/z3950_search.tt | 63 ++----------- .../en/modules/cataloguing/z3950_auth_search.tt | 78 +++------------- .../prog/en/modules/cataloguing/z3950_search.tt | 77 +++------------ koha-tmpl/intranet-tmpl/prog/js/z3950_search.js | 98 ++++++++++++++++++++ 5 files changed, 159 insertions(+), 186 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/js/z3950_search.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc new file mode 100644 index 0000000..24f44e2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc @@ -0,0 +1,29 @@ + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt index ebb18df..f2ce9dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt @@ -17,25 +17,6 @@ "aaSorting": [[ 1, "asc" ]], "bPaginate": false } ) ); - - $("#CheckAll").click(function(){ - $(".checkboxed").checkCheckboxes(); - return false; - }); - $("#CheckNone").click(function(){ - $(".checkboxed").unCheckCheckboxes(); - return false; - }); - - $("#closemenu").click(function(e){ - $(".linktools").hide(); - $("tr").removeClass("selected"); - }); - $("#resetZ3950Search").click(function(e) { - e.preventDefault(); - $("form[name='f']").find("input[type=text]").val(""); - }); - /* Inline edit/delete links */ $("td").click(function(event){ var $tgt = $(event.target); @@ -52,39 +33,13 @@ $(".linktools",row).show().css("position","absolute").css("top",top).css("left",left); } }); - $(".previewData").on("click", function(e){ - e.preventDefault(); - var ltitle = $(this).text(); - var page = $(this).attr("href"); - $("#dataPreviewLabel").text(ltitle); - $("#dataPreview .modal-body").load(page + " div"); - $('#dataPreview').modal({show:true}); - }); - $("#dataPreview").on("hidden", function(){ - $("#dataPreviewLabel").html(""); - $("#dataPreview .modal-body").html("
\"\" "+_("Loading")+"
"); - }); -}); -[% IF ( total_pages ) %] -function validate_goto_page(){ - var page = $('#goto_page').val(); - if(isNaN(page)) { - alert(_("The page entered is not a number.")); - return false; - } - else if(page < 1 || page > [% total_pages %] ) { - alert(_("The page should be a number between 1 and %s.").format([% total_pages %])); - return false; - } - else { - return true; - } -} -[% END %] +}); //]]> +[% INCLUDE 'z3950_search.inc' %] +