﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11967	[patch] Firefox 3.5/TinyMCE collision breaks DateTimeShortcuts.js in admin	Daniel Roseman	Jacob	"The combination of Firefox 3.5 with TinyMCE on an admin add/edit screen which contains a date or time field causes the calendar/clock icons not to appear, and spurious 404/500 errors to appear in logs.

I have reproduced this on Mac and Linux (Ubuntu), and more reports are here:[[BR]]
http://groups.google.com/group/django-users/browse_thread/thread/14beb2d0cab45257 [[BR]]
http://groups.google.com/group/django-users/browse_thread/thread/be50deac49247f80

The cause appears to be the way `DateTimeShortcuts.js` works out the value of `admin_media_prefix`, by searching for its own name in the list of scripts returned by `document.getElementsByTagName('script')`. TinyMCE dynamically injects various scripts into the page, and some issue with Firefox 3.5 causes the it to no longer return the full list of scripts in the DOM. Therefore, `DateTimeShortcuts.js` is not found, and the script incorrectly uses a blank value as the media prefix, leading to it requesting the icons via a relative path from the current page - eg `/admin/app/model/1234/img/admin/icon_calendar.gif` - which causes a `ValueError: invalid literal for int() with base 10` in Django.

Although this is clearly a bug in Firefox and/or TinyMCE, I think it's worth fixing in Django anyway as the way `DateTimeShortcuts` works out `admin_media_prefix` is quite crufty, and using TinyMCE in the admin is fairly popular. The proposed patch simply defines a global `admin_media_prefix` variable in the change_form template, and `DateTimeShortcuts.js` uses that if defined (it still falls back to the old method otherwise). Having `admin_media_prefix` available to all scripts would seem like a good idea in any case."		closed	contrib.admin	1.1		fixed		smulloni@… olau@… justin@…	Accepted	1	0	0	0	0	0
