Ticket #5054: DateTimeShortcuts.js.diff
File DateTimeShortcuts.js.diff, 3.8 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/media/js/admin/DateTimeShortcuts.js
7 7 calendarInputs: [], 8 8 clockInputs: [], 9 9 calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled 10 calendarIframeName: 'calendariframe',// name of calendar <iframe> that gets toggled 10 11 calendarDivName2: 'calendarin', // name of <div> that contains calendar 11 12 calendarLinkName: 'calendarlink',// name of the link that is used to toggle 12 13 clockDivName: 'clockbox', // name of clock <div> that gets toggled … … 160 161 var cal_box = document.createElement('div'); 161 162 cal_box.style.display = 'none'; 162 163 cal_box.style.position = 'absolute'; 164 cal_box.style.zIndex = 999999; 163 165 cal_box.className = 'calendarbox module'; 164 166 cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num); 165 167 document.body.appendChild(cal_box); 166 168 addEvent(cal_box, 'click', DateTimeShortcuts.cancelEventPropagation); 167 169 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 168 180 // next-prev links 169 181 var cal_nav = quickElement('div', cal_box, ''); 170 182 var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');'); … … 194 206 }, 195 207 openCalendar: function(num) { 196 208 var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num) 209 var cal_iframe = document.getElementById(DateTimeShortcuts.calendarIframeName+num) 197 210 var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName+num) 198 211 199 212 // Recalculate the clockbox position … … 209 222 cal_box.style.left = findPosX(cal_link) - 180 + 'px'; 210 223 } 211 224 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; 212 227 213 228 cal_box.style.display = 'block'; 229 cal_iframe.style.display = 'block'; 214 230 addEvent(window, 'click', function() { DateTimeShortcuts.dismissCalendar(num); return true; }); 215 231 }, 216 232 dismissCalendar: function(num) { 217 233 document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'none'; 234 document.getElementById(DateTimeShortcuts.calendarIframeName+num).style.display = 'none'; 218 235 }, 219 236 drawPrev: function(num) { 220 237 DateTimeShortcuts.calendars[num].drawPreviousMonth(); … … 223 240 DateTimeShortcuts.calendars[num].drawNextMonth(); 224 241 }, 225 242 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';}"; 227 244 }, 228 245 handleCalendarQuickLink: function(num, offset) { 229 246 var d = new Date();