Ticket #106: patch.diff

File patch.diff, 1.9 KB (added by nbstrite, 7 years ago)

This patch fixes the issue that dashes and dots cause for IE6+

  • django/contrib/admin/media/js/admin/RelatedObjectLookups.js

     
    1313
    1414function showRelatedObjectLookupPopup(triggeringLink) {
    1515    var name = triggeringLink.id.replace(/^lookup_/, '');
    16     // IE doesn't like periods in the window name, so convert temporarily.
    17     name = name.replace(/\./g, '___');
     16    // IE doesn't like periods or dashes in the window name, so convert temporarily.
     17    name = name.replace(/\./g, '___dot___');
     18    name = name.replace(/\-/g, '___dash___');
    1819    var href;
    1920    if (triggeringLink.href.search(/\?/) >= 0) {
    2021        href = triggeringLink.href + '&pop=1';
     
    2728}
    2829
    2930function dismissRelatedLookupPopup(win, chosenId) {
    30     var name = win.name.replace(/___/g, '.');
     31    var name = win.name.replace(/___dot___/g, '.');
     32    name = name.replace(/___dash___/g, '-');
    3133    var elem = document.getElementById(name);
    3234    if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
    3335        elem.value += ',' + chosenId;
     
    3941
    4042function showAddAnotherPopup(triggeringLink) {
    4143    var name = triggeringLink.id.replace(/^add_/, '');
    42     name = name.replace(/\./g, '___');
     44    name = name.replace(/\./g, '___dot___');
     45    name = name.replace(/\-/g, '___dash___');
    4346    href = triggeringLink.href
    4447    if (href.indexOf('?') == -1) {
    4548        href += '?_popup=1';
     
    5659    // django.utils.html.escape.
    5760    newId = html_unescape(newId);
    5861    newRepr = html_unescape(newRepr);
    59     var name = win.name.replace(/___/g, '.');
     62    var name = win.name.replace(/___dot___/g, '.');
     63    name = name.replace(/___dash___/g, '-');
    6064    var elem = document.getElementById(name);
    6165    if (elem) {
    6266        if (elem.nodeName == 'SELECT') {
Back to Top