From d8b83674940282c082bb3d2fce3f19bfd1589988 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 20 Oct 2005 13:16:46 +0000 Subject: [PATCH] Fixed #658 -- Fixed JavaScript calendar widget in IE. Thanks for the patch, kieranholland git-svn-id: http://code.djangoproject.com/svn/django/trunk@977 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../admin/media/js/admin/DateTimeShortcuts.js | 18 ++++++++++++------ django/contrib/admin/media/js/calendar.js | 6 ++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/django/contrib/admin/media/js/admin/DateTimeShortcuts.js b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js index 5da6f2f48e..85482c4cd5 100644 --- a/django/contrib/admin/media/js/admin/DateTimeShortcuts.js +++ b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js @@ -77,13 +77,15 @@ var DateTimeShortcuts = { addEvent(clock_box, 'click', DateTimeShortcuts.cancelEventPropagation); quickElement('h2', clock_box, 'Choose a time'); - time_list = quickElement('ul', clock_box, '', 'class', 'timelist'); + time_list = quickElement('ul', clock_box, ''); + time_list.className = 'timelist'; quickElement("a", quickElement("li", time_list, ""), "Now", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinute());") quickElement("a", quickElement("li", time_list, ""), "Midnight", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '00:00');") quickElement("a", quickElement("li", time_list, ""), "6 a.m.", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '06:00');") quickElement("a", quickElement("li", time_list, ""), "Noon", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '12:00');") - cancel_p = quickElement('p', clock_box, '', 'class', 'calendar-cancel'); + cancel_p = quickElement('p', clock_box, ''); + cancel_p.className = 'calendar-cancel'; quickElement('a', cancel_p, 'Cancel', 'href', 'javascript:DateTimeShortcuts.dismissClock(' + num + ');'); }, openClock: function(num) { @@ -147,8 +149,10 @@ var DateTimeShortcuts = { // next-prev links var cal_nav = quickElement('div', cal_box, ''); - quickElement('a', cal_nav, '<', 'class', 'calendarnav-previous', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');'); - quickElement('a', cal_nav, '>', 'class', 'calendarnav-next', 'href', 'javascript:DateTimeShortcuts.drawNext('+num+');'); + var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');'); + cal_nav_prev.className = 'calendarnav-previous'; + var cal_nav_next = quickElement('a', cal_nav, '>', 'href', 'javascript:DateTimeShortcuts.drawNext('+num+');'); + cal_nav_next.className = 'calendarnav-next'; cal_box.appendChild(cal_nav); // main box @@ -158,7 +162,8 @@ var DateTimeShortcuts = { DateTimeShortcuts.calendars[num].drawCurrent(); // calendar shortcuts - var shortcuts = quickElement('div', cal_box, '', 'class', 'calendar-shortcuts'); + var shortcuts = quickElement('div', cal_box, ''); + shortcuts.className = 'calendar-shortcuts'; quickElement('a', shortcuts, 'Yesterday', 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', -1);'); shortcuts.appendChild(document.createTextNode('\240|\240')); quickElement('a', shortcuts, 'Today', 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', 0);'); @@ -166,7 +171,8 @@ var DateTimeShortcuts = { quickElement('a', shortcuts, 'Tomorrow', 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', +1);'); // cancel bar - var cancel_p = quickElement('p', cal_box, '', 'class', 'calendar-cancel'); + var cancel_p = quickElement('p', cal_box, ''); + cancel_p.className = 'calendar-cancel'; quickElement('a', cancel_p, 'Cancel', 'href', 'javascript:DateTimeShortcuts.dismissCalendar(' + num + ');'); }, openCalendar: function(num) { diff --git a/django/contrib/admin/media/js/calendar.js b/django/contrib/admin/media/js/calendar.js index ad1f0a9734..eeff433bfb 100644 --- a/django/contrib/admin/media/js/calendar.js +++ b/django/contrib/admin/media/js/calendar.js @@ -65,7 +65,8 @@ var CalendarNamespace = { // Draw blanks before first of month tableRow = quickElement('tr', tableBody); for (var i = 0; i < startingPos; i++) { - quickElement('td', tableRow, ' ', 'bgcolor','#f3f3f3'); + var _cell = quickElement('td', tableRow, ' '); + _cell.style.backgroundColor = '#f3f3f3'; } // Draw days of month @@ -81,7 +82,8 @@ var CalendarNamespace = { // Draw blanks after end of month (optional, but makes for valid code) while (tableRow.childNodes.length < 7) { - quickElement('td', tableRow, ' ', 'bgcolor','#f3f3f3'); + var _cell = quickElement('td', tableRow, ' '); + _cell.style.backgroundColor = '#f3f3f3'; } calDiv.appendChild(calTable);