[Rt-commit] r3041 - in rt/branches/3.4-RELEASE: . html/Search
glasser at bestpractical.com
glasser at bestpractical.com
Wed Jun 1 18:33:52 EDT 2005
Author: glasser
Date: Wed Jun 1 18:33:51 2005
New Revision: 3041
Modified:
rt/branches/3.4-RELEASE/ (props changed)
rt/branches/3.4-RELEASE/html/Search/Build.html
Log:
r33102 at tin-foil: glasser | 2005-05-25 22:22:53 -0400
build_array was being called twice for two totally disconnected reasons. Split one out.
Modified: rt/branches/3.4-RELEASE/html/Search/Build.html
==============================================================================
--- rt/branches/3.4-RELEASE/html/Search/Build.html (original)
+++ rt/branches/3.4-RELEASE/html/Search/Build.html Wed Jun 1 18:33:51 2005
@@ -245,13 +245,10 @@
$m->abort();
}
-my @options;
-my $optionlist;
$Query = "";
%queues = ();
-# Build the optionlist from the tree, so we can do additions and movements based on it
-$optionlist = build_array( \$Query, \@clauses, $tree, \@options, \%queues );
+my @options = get_displayed_nodes($tree);
my @current_values = grep { defined } @options[@clauses];
@@ -463,9 +460,25 @@
$Query = "";
@options = ();
%queues = ();
-$optionlist =
+my $optionlist =
build_array( \$Query, \@current_values, $tree, \@options, \%queues );
+# This function returns an array ref of the nodes of the tree in depth-first
+# order which correspond to options in the "clauses" multi-select box.
+# In fact, it's all of them but the top-level ones.
+sub get_displayed_nodes {
+ my $tree = shift;
+ my @keys;
+
+ $tree->traverse(sub {
+ my $node = shift;
+
+ push @keys, $node unless $node->getParent->isRoot;
+ });
+
+ return [ @keys ];
+}
+
sub build_array {
my $Query = shift;
my $values_ref = shift;
More information about the Rt-commit
mailing list