Bug 852943: selectClassification() is no longer used
r/a=LpSolit git-svn-id: svn://10.0.0.236/trunk@264806 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
685fc54585
commit
d3f5c601c6
@ -1 +1 @@
|
|||||||
8597
|
8598
|
||||||
@ -9,75 +9,6 @@
|
|||||||
// Functions to update form select elements based on a
|
// Functions to update form select elements based on a
|
||||||
// collection of javascript arrays containing strings.
|
// collection of javascript arrays containing strings.
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the selected classifications and updates product, component,
|
|
||||||
* version and milestone lists accordingly.
|
|
||||||
*
|
|
||||||
* @param classfield Select element that contains classifications.
|
|
||||||
* @param product Select element that contains products.
|
|
||||||
* @param component Select element that contains components. Can be null if
|
|
||||||
* there is no such element to update.
|
|
||||||
* @param version Select element that contains versions. Can be null if
|
|
||||||
* there is no such element to update.
|
|
||||||
* @param milestone Select element that contains milestones. Can be null if
|
|
||||||
* there is no such element to update.
|
|
||||||
*
|
|
||||||
* @global prods Array of products indexed by classification name.
|
|
||||||
* @global first_load Boolean; true if this is the first time this page loads
|
|
||||||
* or false if not.
|
|
||||||
* @global last_sel Array that contains last list of products so we know what
|
|
||||||
* has changed, and optimize for additions.
|
|
||||||
*/
|
|
||||||
function selectClassification(classfield, product, component, version, milestone) {
|
|
||||||
// This is to avoid handling events that occur before the form
|
|
||||||
// itself is ready, which could happen in buggy browsers.
|
|
||||||
if (!classfield)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If this is the first load and nothing is selected, no need to
|
|
||||||
// merge and sort all lists; they are created sorted.
|
|
||||||
if ((first_load) && (classfield.selectedIndex == -1)) {
|
|
||||||
first_load = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't reset first_load as done in selectProduct. That's because we
|
|
||||||
// want selectProduct to handle the first_load attribute.
|
|
||||||
|
|
||||||
// Stores classifications that are selected.
|
|
||||||
var sel = Array();
|
|
||||||
|
|
||||||
// True if sel array has a full list or false if sel contains only
|
|
||||||
// new classifications that are to be merged to the current list.
|
|
||||||
var merging = false;
|
|
||||||
|
|
||||||
// If nothing selected, pick all.
|
|
||||||
var findall = classfield.selectedIndex == -1;
|
|
||||||
sel = get_selection(classfield, findall, false);
|
|
||||||
if (!findall) {
|
|
||||||
// Save sel for the next invocation of selectClassification().
|
|
||||||
var tmp = sel;
|
|
||||||
|
|
||||||
// This is an optimization: if we have just added classifications to an
|
|
||||||
// existing selection, no need to clear the form elements and add
|
|
||||||
// everything again; just merge the new ones with the existing
|
|
||||||
// options.
|
|
||||||
if ((last_sel.length > 0) && (last_sel.length < sel.length)) {
|
|
||||||
sel = fake_diff_array(sel, last_sel);
|
|
||||||
merging = true;
|
|
||||||
}
|
|
||||||
last_sel = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save original options selected.
|
|
||||||
var saved_prods = get_selection(product, false, true, null);
|
|
||||||
|
|
||||||
// Do the actual fill/update, reselect originally selected options.
|
|
||||||
updateSelect(prods, sel, product, merging, null);
|
|
||||||
restoreSelection(product, saved_prods);
|
|
||||||
selectProduct(product, component, version, milestone, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the selected products and updates component, version and milestone
|
* Reads the selected products and updates component, version and milestone
|
||||||
* lists accordingly.
|
* lists accordingly.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user