Opened 9 years ago

Closed 5 years ago

#5704 closed Bug (fixed)

Admin popup windows won't close when using application/xhtml as default content type

Reported by: Rob van der Linde <robvdl@…> Owned by: Alexander Herrmann
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

With my projects, I like to use DEFAULT_CONTENT_TYPE = 'application/xhtml+xml' in my settings.py file. I then use an XhtmlDegrader middleware, to gracefully degrade my pages to text/html to browsers that do not support this mimetype, such as IE.

Admin works 100% with the application/xhtml mime, I haven't had any other problems with it at all, except for the following bug:

If I am filling in a new entry, and I have a dropdown for a OneToMany relationship, if I hit the '+' icon next to the dropdown, I get a popup window where I can add a new entry. This works fine right upto the point when I click 'Save'. Now what it is supposed to do is close the popup, and refresh the parent page (which is fine under text/html), but under application/xhtml+xml it produces an XML error in Firefox:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<script type="text/javascript">
opener.dismissAddAnotherPopup(window, 2, "Foo");
</script>

To fix, wrap inside a proper <html><body></body></html> block, and the error should go away.

Attachments (5)

5704trunk.diff (1.9 KB) - added by mb0@… 9 years ago.
patched with minimal valid xhml structure, javascript elem.nodeName happens to be lowercase
5704nfa.diff (1.8 KB) - added by mb0@… 9 years ago.
same for newforms-admin
5704-r16357.diff (1.9 KB) - added by Alexander Herrmann 5 years ago.
5704-r16435.diff (1.8 KB) - added by Alexander Herrmann 5 years ago.
5704-r17038.diff (1.8 KB) - added by Claude Paroz 5 years ago.
Updated patch after media -> static renaming

Download all attachments as: .zip

Change History (18)

comment:1 Changed 9 years ago by Rob van der Linde <robvdl@…>

Component: UncategorizedAdmin interface

comment:2 Changed 9 years ago by Jacob

Triage Stage: UnreviewedAccepted

Changed 9 years ago by mb0@…

Attachment: 5704trunk.diff added

patched with minimal valid xhml structure, javascript elem.nodeName happens to be lowercase

Changed 9 years ago by mb0@…

Attachment: 5704nfa.diff added

same for newforms-admin

comment:3 Changed 9 years ago by anonymous

Has patch: set

comment:4 Changed 7 years ago by Ramiro Morales

#11683 was a duplicate and contains a patch solving this in a slightly different way.

See also #11684.

comment:5 Changed 6 years ago by Gabriel Hurley

Severity: Normal
Type: Bug

comment:6 Changed 6 years ago by Julien Phalip

Easy pickings: unset

#11684 is a dupe.

comment:7 Changed 6 years ago by patchhammer

Patch needs improvement: set

5704nfa.diff fails to apply cleanly on to trunk

comment:8 Changed 5 years ago by Alexander Herrmann

Owner: changed from nobody to Alexander Herrmann
Status: newassigned
UI/UX: unset

Changed 5 years ago by Alexander Herrmann

Attachment: 5704-r16357.diff added

comment:9 Changed 5 years ago by Alexander Herrmann

Patch needs improvement: unset

fixed the patch to current source

comment:10 Changed 5 years ago by Julien Phalip

Patch needs improvement: set

The HTML5 doctype is now to be used throughout the admin.

Changed 5 years ago by Alexander Herrmann

Attachment: 5704-r16435.diff added

comment:11 Changed 5 years ago by Alexander Herrmann

Patch needs improvement: unset

fixed the doctype in 5704-r16435.diff

Changed 5 years ago by Claude Paroz

Attachment: 5704-r17038.diff added

Updated patch after media -> static renaming

comment:12 Changed 5 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

comment:13 Changed 5 years ago by Luke Plant

Resolution: fixed
Status: assignedclosed

In [17065]:

Fixed #5704 - Admin popup windows won't close when using application/xhtml as default content type

Thanks to Rob van der Linde for the report, and to mb0, dArignac and claudep
for the patch.

Note: See TracTickets for help on using tickets.
Back to Top