From 25e6c2885d1547fd4ed28c29fd8462e33dc8b4f1 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 10 May 2013 08:32:11 -0400 Subject: [PATCH] Bug 9424: Move JavaScript out of header include This patch removes JavaScript "onlick" attributes from header.inc and moves the functionality to staff-global.js. This is in keeping with the idea of progressive enhancement. To test, be sure to clear your browser cache after applying the patch. - Test the help link. - Test the logout link with the intranetbookbag preference on and off. - Open a patron's account and click "search to hold." Log out, and log in again. Koha should not remember the patron you chose before logging out (as seen from a search results page). Signed-off-by: Galen Charlton Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- .../intranet-tmpl/prog/en/includes/header.inc | 10 ++-------- .../intranet-tmpl/prog/en/js/staff-global.js | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 194a0f9b93..9070aa47b7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -75,21 +75,15 @@ Set library [% END %] - [% IF ( intranetbookbag ) %]
  • - Log out + Log out
  • - [% ELSE %] -
  • - Log out -
  • - [% END %] [% ELSE %] You are not logged in | [% END %]
  • - Help + Help
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js index 1d23253ea1..17fe162881 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js @@ -15,6 +15,14 @@ function _(s) { return s; } // dummy function for gettext $(".focus").focus(); $(".validated").validate(); + $("#logout").on("click",function(){ + logOut(); + }); + $("#helper").on("click",function(){ + openHelp(); + return false; + }); + $('.noEnterSubmit').keypress(function(e){ if ( e.which == 13 ) return false; }); @@ -42,6 +50,17 @@ function clearHoldFor(){ $.cookie("holdfor",null, { path: "/", expires: 0 }); } +function logOut(){ + if( typeof delBasket == 'function' ){ + delBasket('main', true); + } + clearHoldFor(); +} + +function openHelp(){ + openWindow("/cgi-bin/koha/help.pl","Koha help",600,600); +} + jQuery.fn.preventDoubleFormSubmit = function() { jQuery(this).submit(function() { $("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting'); -- 2.39.5