Commit c9c320bd authored by jake%acutex.net's avatar jake%acutex.net

Bug 122154 part 2 - Eliminiate the use of the "usetms" Javascript cache variable.

Patch by Christian Reis <kiko@async.com.br> r= bbaetz, jake
parent 5febefd7
...@@ -28,22 +28,16 @@ ...@@ -28,22 +28,16 @@
[%# Note: use Template comments and not JS ones here, to avoid bloating [%# Note: use Template comments and not JS ones here, to avoid bloating
what we actually send to the browser %] what we actually send to the browser %]
[% IF Param('usetargetmilestone') %]
[% tms = 1 %]
[% ELSE %]
[% tms = 0 %]
[% END %]
<script language="JavaScript" type="text/javascript"> <!-- <script language="JavaScript" type="text/javascript"> <!--
var first_load = true; [%# is this the first time we load the page? %] var first_load = true; [%# is this the first time we load the page? %]
var last_sel = new Array(); [%# caches last selection %] var last_sel = new Array(); [%# caches last selection %]
var usetms = [% IF tms %]true[% ELSE %]false[% END %];
[%# do we have target milestone? %]
var cpts = new Array(); var cpts = new Array();
var vers = new Array(); var vers = new Array();
[% IF Param('usetargetmilestone') %]
var tms = new Array(); var tms = new Array();
[% END %]
[%# Create three arrays of components, versions and target milestones, indexed [%# Create three arrays of components, versions and target milestones, indexed
# numerically according to the product they refer to. #%] # numerically according to the product they refer to. #%]
...@@ -54,7 +48,7 @@ var tms = new Array(); ...@@ -54,7 +48,7 @@ var tms = new Array();
[%- FOREACH item = componentsbyproduct.$p %]'[% item FILTER js %]', [%- END -%]]; [%- FOREACH item = componentsbyproduct.$p %]'[% item FILTER js %]', [%- END -%]];
vers[[% n %]] = [ vers[[% n %]] = [
[%- FOREACH item = versionsbyproduct.$p -%]'[% item FILTER js %]', [%- END -%]]; [%- FOREACH item = versionsbyproduct.$p -%]'[% item FILTER js %]', [%- END -%]];
[% IF tms %] [% IF Param('usetargetmilestone') %]
tms[[% n %]] = [ tms[[% n %]] = [
[%- FOREACH item = milestonesbyproduct.$p %]'[% item FILTER js %]', [%- END -%]]; [%- FOREACH item = milestonesbyproduct.$p %]'[% item FILTER js %]', [%- END -%]];
[% END %] [% END %]
...@@ -248,8 +242,6 @@ function restoreSelection(control, sel) { ...@@ -248,8 +242,6 @@ function restoreSelection(control, sel) {
# subarrays contain a list of names to be fed to the respective # subarrays contain a list of names to be fed to the respective
# selectboxes. For bugzilla, these are generated with perl code # selectboxes. For bugzilla, these are generated with perl code
# at page start. # at page start.
# - usetms: this is a global boolean that is defined if the
# bugzilla installation has it turned on. generated in perl too.
# - first_load: boolean, specifying if it is the first time we load # - first_load: boolean, specifying if it is the first time we load
# the query page. # the query page.
# - last_sel: saves our last selection list so we know what has # - last_sel: saves our last selection list so we know what has
...@@ -262,7 +254,7 @@ function selectProduct(f) { ...@@ -262,7 +254,7 @@ function selectProduct(f) {
} }
[%# if this is the first load and nothing is selected, no need to [%# if this is the first load and nothing is selected, no need to
merge and sort all components; perl gives it to us sorted. %] merge and sort all components; perl gives it to us sorted. %]
if ((first_load) && (f.product.selectedIndex == -1)) { if ((first_load) && (f.product.selectedIndex == -1)) {
first_load = false; first_load = false;
return; return;
...@@ -307,9 +299,9 @@ function selectProduct(f) { ...@@ -307,9 +299,9 @@ function selectProduct(f) {
[%# do the actual fill/update %] [%# do the actual fill/update %]
updateSelect(cpts, sel, f.component, merging); updateSelect(cpts, sel, f.component, merging);
updateSelect(vers, sel, f.version, merging); updateSelect(vers, sel, f.version, merging);
if (usetms) { [% IF Param('usetargetmilestone') %]
updateSelect(tms, sel, f.target_milestone, merging); updateSelect(tms, sel, f.target_milestone, merging);
} [% END %]
} }
// --> // -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment