Ticket #5054: DateTimeShortcuts.js.diff

File DateTimeShortcuts.js.diff, 3.8 KB (added by Simon G. <dev@…>, 17 years ago)
  • django/contrib/admin/media/js/admin/DateTimeShortcuts.js

     
    77    calendarInputs: [],
    88    clockInputs: [],
    99    calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
     10    calendarIframeName: 'calendariframe',// name of calendar <iframe> that gets toggled
    1011    calendarDivName2: 'calendarin',  // name of <div> that contains calendar
    1112    calendarLinkName: 'calendarlink',// name of the link that is used to toggle
    1213    clockDivName: 'clockbox',        // name of clock <div> that gets toggled
     
    160161        var cal_box = document.createElement('div');
    161162        cal_box.style.display = 'none';
    162163        cal_box.style.position = 'absolute';
     164        cal_box.style.zIndex = 999999;
    163165        cal_box.className = 'calendarbox module';
    164166        cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
    165167        document.body.appendChild(cal_box);
    166168        addEvent(cal_box, 'click', DateTimeShortcuts.cancelEventPropagation);
    167169
     170        // Hack for IE6: create iframe to hide dropdowns which would otherwise show through the div.
     171        var cal_iframe = document.createElement('iframe');
     172        cal_iframe.style.display = 'none';
     173        cal_iframe.style.position = 'absolute';
     174        cal_iframe.style.zIndex = 999998;
     175        cal_iframe.className = 'calendarbox module';
     176        cal_iframe.setAttribute('id', DateTimeShortcuts.calendarIframeName + num);
     177        document.body.appendChild(cal_iframe);
     178        addEvent(cal_iframe, 'click', DateTimeShortcuts.cancelEventPropagation);
     179
    168180        // next-prev links
    169181        var cal_nav = quickElement('div', cal_box, '');
    170182        var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');');
     
    194206    },
    195207    openCalendar: function(num) {
    196208        var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num)
     209        var cal_iframe = document.getElementById(DateTimeShortcuts.calendarIframeName+num)
    197210        var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName+num)
    198211   
    199212        // Recalculate the clockbox position
     
    209222            cal_box.style.left = findPosX(cal_link) - 180 + 'px';
    210223        }
    211224        cal_box.style.top = findPosY(cal_link) - 75 + 'px';
     225        cal_iframe.style.left = cal_box.style.left;
     226        cal_iframe.style.top = cal_box.style.top;
    212227   
    213228        cal_box.style.display = 'block';
     229        cal_iframe.style.display = 'block';
    214230        addEvent(window, 'click', function() { DateTimeShortcuts.dismissCalendar(num); return true; });
    215231    },
    216232    dismissCalendar: function(num) {
    217233        document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'none';
     234        document.getElementById(DateTimeShortcuts.calendarIframeName+num).style.display = 'none';
    218235    },
    219236    drawPrev: function(num) {
    220237        DateTimeShortcuts.calendars[num].drawPreviousMonth();
     
    223240        DateTimeShortcuts.calendars[num].drawNextMonth();
    224241    },
    225242    handleCalendarCallback: function(num) {
    226         return "function(y, m, d) { DateTimeShortcuts.calendarInputs["+num+"].value = y+'-'+m+'-'+d; document.getElementById(DateTimeShortcuts.calendarDivName1+"+num+").style.display='none';}";
     243        return "function(y, m, d) { DateTimeShortcuts.calendarInputs["+num+"].value = y+'-'+m+'-'+d; document.getElementById(DateTimeShortcuts.calendarDivName1+"+num+").style.display='none'; document.getElementById(DateTimeShortcuts.calendarIframeName+"+num+").style.display='none';}";
    227244    },
    228245    handleCalendarQuickLink: function(num, offset) {
    229246       var d = new Date();
Back to Top