From a2d90be9303bf37b824423ab49c939896d17b6e1 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 11 Mar 2013 10:41:00 +1100 Subject: [PATCH] Bug 9781 - Fix bug in 3.8.x (dynarch) calendar positioning in IE Currently, if you click on the calendar icon on a long patron entry/edit page, the calendar pop-up appears off-screen near the top of the page rather than under the appropriate input box next to the actual icon. For most people, they don't think the calendar pop-up is actually created. For others, it's quite annoying to scroll up to the top of the page to pick a date for a date field lower on the page. -- I've adapted a patch I found at the following URL: http://blog.anorakgirl.co.uk/2009/04/dynarch-dhtml-calendar-ie7-positioning-problem/ This takes care of the problem. -- Test Plan: Before applying patch... 1) In any version of IE, create or edit a Patron entry 2) If you have a Date of birth field at the top, click the calendar icon next to it. 3) Note that the calendar pop-up appears fine. 4) Scroll down to the bottom of the page and click on the calendar icon next to Registration date or Expiry date. 5) Note that no calendar pop-up appears on the screen. Scroll up the page and you should see it up near the top of the page. Apply patch 6) Refresh the page (you might need to clear your cache as well) and try clicking the calendar icon next to Registration date or Expiry date 7) Note that the calendar pop-up appears correctly underneath the input box for which you want to pick a date --- .../intranet-tmpl/prog/en/lib/calendar/calendar.js | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar.js b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar.js index bac31ab..33cbd1f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar.js +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar.js @@ -81,6 +81,7 @@ Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) ); Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); +Calendar.is_ie7up = ( Calendar.is_ie && parseFloat(navigator.userAgent.replace(/.*msie ([0-9]+).*/i, "$1" )) >= 7 ); /// detect Opera browser Calendar.is_opera = /opera/i.test(navigator.userAgent); @@ -1308,7 +1309,7 @@ Calendar.prototype.showAtElement = function (el, opts) { document.body.appendChild(cp); var br = Calendar.getAbsolutePos(cp); document.body.removeChild(cp); - if (Calendar.is_ie) { + if (Calendar.is_ie && !Calendar.is_ie7up) { br.y += document.body.scrollTop; br.x += document.body.scrollLeft; } else { -- 1.7.7.4