mirror of
https://github.com/django/django.git
synced 2024-12-25 02:26:12 +00:00
dd5320d1d5
git-svn-id: http://code.djangoproject.com/svn/django/trunk@96 bcc190cf-cafb-0310-a4f2-bffc1f526a37
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
// Handles related-objects functionality: lookup link for raw_id_admin=True
|
|
// and Add Another links.
|
|
|
|
function showRelatedObjectLookupPopup(triggeringLink) {
|
|
var name = triggeringLink.id.replace(/^lookup_/, '');
|
|
var win = window.open(triggeringLink.href + '?pop=1', name, 'height=500,width=740,resizable=yes,scrollbars=yes');
|
|
win.focus();
|
|
return false;
|
|
}
|
|
|
|
function dismissRelatedLookupPopup(win, chosenId) {
|
|
document.getElementById(win.name).value = chosenId;
|
|
win.close();
|
|
}
|
|
|
|
function showAddAnotherPopup(triggeringLink) {
|
|
var name = triggeringLink.id.replace(/^add_/, '');
|
|
var win = window.open(triggeringLink.href + '?_popup=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
|
win.focus();
|
|
return false;
|
|
}
|
|
|
|
function dismissAddAnotherPopup(win, newId, newRepr) {
|
|
var elem = document.getElementById(win.name);
|
|
if (elem.nodeName == 'SELECT') {
|
|
var o = new Option(newRepr, newId);
|
|
elem.appendChild(o);
|
|
elem.selectedIndex = elem.length - 1;
|
|
} else if (elem.nodeName == 'INPUT') {
|
|
elem.value = newId;
|
|
}
|
|
win.close();
|
|
} |