/* SelectFilter2 - Turns a multiple-select box into a filter interface. Different than SelectFilter because this is coupled to the admin framework. Requires core.js, SelectBox.js and addevent.js. */ function findForm(node) { // returns the node of the form containing the given node if (node.tagName.toLowerCase() != 'form') { return findForm(node.parentNode); } return node; } var SelectFilter = { init: function(field_id, field_name, is_stacked, admin_media_prefix) { var from_box = document.getElementById(field_id); from_box.id += '_from'; // change its ID from_box.className = 'filtered'; // Remove

, because it just gets in the way. var ps = from_box.parentNode.getElementsByTagName('p'); for (var i=0; i or

var selector_div = quickElement('div', from_box.parentNode); selector_div.className = is_stacked ? 'selector stacked' : 'selector'; //
var selector_available = quickElement('div', selector_div, ''); selector_available.className = 'selector-available'; quickElement('h2', selector_available, interpolate(gettext('Available %s'), [field_name])); var filter_p = quickElement('p', selector_available, ''); filter_p.className = 'selector-filter'; quickElement('img', filter_p, '', 'src', admin_media_prefix + '/selector-search.gif'); filter_p.appendChild(document.createTextNode(' ')); var filter_input = quickElement('input', filter_p, '', 'type', 'text'); filter_input.id = field_id + '_input'; selector_available.appendChild(from_box); var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); })()'); choose_all.className = 'selector-chooseall'; //