Fixed #11314 - Highlight the current date in the admin calendar widget.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2010-01-04 22:48:36 +00:00
parent b59d6212b1
commit 7c3387ae3a
1 changed files with 13 additions and 1 deletions

View File

@ -46,6 +46,12 @@ var CalendarNamespace = {
return days;
},
draw: function(month, year, div_id, callback) { // month = 1-12, year = 1-9999
var today = new Date();
var todayDay = today.getDate();
var todayMonth = today.getMonth()+1;
var todayYear = today.getFullYear();
var todayClass = '';
month = parseInt(month);
year = parseInt(year);
var calDiv = document.getElementById(div_id);
@ -76,7 +82,13 @@ var CalendarNamespace = {
if (i%7 == 0 && currentDay != 1) {
tableRow = quickElement('tr', tableBody);
}
var cell = quickElement('td', tableRow, '');
if ((currentDay==todayDay) && (month==todayMonth) && (year==todayYear)) {
todayClass='today';
} else {
todayClass='';
}
var cell = quickElement('td', tableRow, '', 'class', todayClass);
quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));');
currentDay++;
}