// create a copy of the original function used by django to add the realted field
var dismissAddAnotherPopupCopy = Function("win", "newId", "newRepr", 'return ' + dismissAddAnotherPopup.toString())();
(function($) {
// overwrite the original function used by django to add the realted field
dismissAddAnotherPopup = function dismissAddAnotherPopup(win, newId, newRepr) {
newId = html_unescape(newId);
newRepr = html_unescape(newRepr);
var name = windowname_to_id(win.name);
var elem = document.getElementById('mcheckbox-' + name);
// if the field was a multiple checkbox
if(elem) {
$(
'
'
+ '
'
+ '
'
+ '
'
).appendTo(elem);
win.close();
}
// else call the default function previously copied
else {
dismissAddAnotherPopupCopy(win, newId, newRepr);
}
}
// convert a multiple select in a multiple checkbox
var mselectTOmcheckbox = function mselectTOmcheckbox(selector) {
var elements = $(selector);
elements.each(function(index, item) {
var id = $(item).attr('id'),
name = $(item).attr('name'),
options = $(item).children();
var mcheckbox_table = $('