
jesse at bestpractical
Nov 6, 2009, 11:41 AM
Post #1 of 1
(71 views)
Permalink
|
|
rt branch, librarize-search-logic, updated. 297ef780c6f9f7de719ff69a0e02414e38b9d53d
|
|
The branch, librarize-search-logic has been updated via 297ef780c6f9f7de719ff69a0e02414e38b9d53d (commit) via 496e6da26fbfede00e693d54efd08f68ab1f2244 (commit) from 30d6694fb8f6608b9e6d04a45317211b34dee17a (commit) Summary of changes: lib/RT/Interface/Web/QueryBuilder.pm | 6 +++--- lib/RT/Report/Tickets.pm | 2 +- share/html/Elements/SelectOwner | 6 +++--- share/html/Prefs/Search.html | 2 +- share/html/Search/Build.html | 19 ++++++------------- share/html/Search/Elements/EditQuery | 6 ++++-- share/html/Search/Elements/PickCFs | 8 ++++---- share/html/Search/Elements/PickCriteria | 4 ++-- 8 files changed, 24 insertions(+), 29 deletions(-) - Log ----------------------------------------------------------------- commit 496e6da26fbfede00e693d54efd08f68ab1f2244 Author: Jesse Vincent <jesse[at]bestpractical.com> Date: Fri Nov 6 14:20:40 2009 -0500 Move some HTML generation out of Search/Build.html's init block diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html index 473843f..370387d 100644 --- a/share/html/Search/Build.html +++ b/share/html/Search/Build.html @@ -92,7 +92,7 @@ <& Elements/EditQuery, %ARGS, actions => \@actions, - optionlist => $optionlist, + parsed_query => $parsed_query, description => $saved_search->{'description'}, &> </div> @@ -126,7 +126,7 @@ if ($new_query) { # Wipe all data-carrying variables clear if we want a new # search, or we're deleting an old one.. %query = (); - $saved_search = { id => 'new'}; + $saved_search = { id => 'new' }; # ..then wipe the sessionand the search results. Jifty->web->session->remove('CurrentSearchHash'); @@ -212,15 +212,8 @@ foreach my $arg ( keys %ARGS ) { push @actions, RT::Interface::Web::QueryBuilder->process_query( \%ARGS, $tree, \@current_values, \@new_values, ); # Rebuild $Query based on the additions / movements - -my $optionlist_arrayref; -( $query{'query'}, $optionlist_arrayref ) = $tree->get_query_and_option_list( \@current_values ); - -my $optionlist = join "\n", map { - qq(<option value="$_->{INDEX}" $_->{SELECTED}>) - . ( " " x ( 5 * $_->{DEPTH} ) ) - . Jifty->web->escape( $_->{TEXT}) - . qq(</option>) } @$optionlist_arrayref; +my $parsed_query; +( $query{'query'}, $parsed_query ) = $tree->get_query_and_option_list( \@current_values ); my $queues = $tree->get_referenced_queues; diff --git a/share/html/Search/Elements/EditQuery b/share/html/Search/Elements/EditQuery index 19f9cc8..b319815 100644 --- a/share/html/Search/Elements/EditQuery +++ b/share/html/Search/Elements/EditQuery @@ -49,7 +49,9 @@ <&|/Widgets/TitleBox, title => join(': ', grep defined, _("Current search"), $description) &> <select size="10" name="clauses" style="width: 100%" multiple="multiple"> -% $m->out($optionlist); +% for (@$parsed_query) { +% $m->out( qq(<option value="$_->{INDEX}" $_->{SELECTED}>) . ( " " x ( 5 * $_->{DEPTH} ) ) . Jifty->web->escape( $_->{TEXT}) . qq(</option>\n)); +% } </select> <p align="center"> @@ -65,6 +67,6 @@ </&> <%ARGS> $description => undef -$optionlist => '' +$parsed_query => '' $actions => [] </%ARGS> commit 297ef780c6f9f7de719ff69a0e02414e38b9d53d Author: Jesse Vincent <jesse[at]bestpractical.com> Date: Fri Nov 6 14:40:29 2009 -0500 cfqueues -> queues. the list of queues doesn't care that it's primarily used for custom field enumeration diff --git a/lib/RT/Interface/Web/QueryBuilder.pm b/lib/RT/Interface/Web/QueryBuilder.pm index 92f84c3..d59cb09 100644 --- a/lib/RT/Interface/Web/QueryBuilder.pm +++ b/lib/RT/Interface/Web/QueryBuilder.pm @@ -346,7 +346,7 @@ sub build_format_string { my $self = shift; my %args = ( format => undef, - cfqueues => undef, + queues => undef, face => undef, size => undef, link => undef, @@ -386,7 +386,7 @@ sub build_format_string { ); # loc_qw my $CustomFields = RT::Model::CustomFieldCollection->new(); - foreach my $id ( keys %{$args{cfqueues}} ) { + foreach my $id ( keys %{$args{queues}} ) { # Gotta load up the $queue object, since queues get stored by name now. my $id my $queue = RT::Model::Queue->new(); @@ -394,7 +394,7 @@ sub build_format_string { unless ( $queue->id ) { # XXX TODO: This ancient code dates from a former developer - # we have no idea what it means or why cfqueues are so encoded. + # we have no idea what it means or why queues are so encoded. $id =~ s/^.'*(.*).'*$/$1/; $queue->load($id); } diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm index 6dfacfb..304d929 100644 --- a/lib/RT/Report/Tickets.pm +++ b/lib/RT/Report/Tickets.pm @@ -96,7 +96,7 @@ sub groupings { unless ( $queue->id ) { # XXX TODO: This ancient code dates from a former developer - # we have no idea what it means or why cfqueues are so encoded. + # we have no idea what it means or why queues are so encoded. $id =~ s/^.'*(.*).'*$/$1/; $queue->load($id); } diff --git a/share/html/Elements/SelectOwner b/share/html/Elements/SelectOwner index bea54e6..2f281a6 100755 --- a/share/html/Elements/SelectOwner +++ b/share/html/Elements/SelectOwner @@ -71,8 +71,8 @@ if ($ticket_obj) { @objects = ($ticket_obj); } elsif ($queue_obj) { @objects = ($queue_obj); -} elsif ($cfqueues) { - @objects = keys %{$cfqueues}; +} elsif ($queues) { + @objects = keys %{$queues}; } else { # Let's check rights on an empty queue object. that will do a search # for any queue. @@ -131,5 +131,5 @@ $ticket_obj => undef $default_value => 1 $default_label => "-" $value_attribute => 'id' -$cfqueues => undef +$queues => undef </%ARGS> diff --git a/share/html/Prefs/Search.html b/share/html/Prefs/Search.html index 6e62506..94f527a 100644 --- a/share/html/Prefs/Search.html +++ b/share/html/Prefs/Search.html @@ -99,7 +99,7 @@ $ARGS{'order_by'} = join '|', grep defined && /\S/, (ref $ARGS{'order_by'})? @{$ my ( $AvailableColumns, $current_format ); ( $ARGS{format}, $AvailableColumns, $current_format ) = RT::Interface::Web::QueryBuilder->build_format_string( - cfqueues => {}, %ARGS + queues => {}, %ARGS ); if ($ARGS{'save'}) { diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html index 370387d..8232943 100644 --- a/share/html/Search/Build.html +++ b/share/html/Search/Build.html @@ -82,7 +82,7 @@ <div id="pick-criteria"> - <& Elements/PickCriteria, query => $query{'query'}, cfqueues => $queues &> + <& Elements/PickCriteria, query => $query{'query'}, queues => $queues &> </div> <& /Elements/Submit, label => _('Add these terms'), name => 'add_clause'&> <& /Elements/Submit, label => _('Add these terms and Search'), name => 'do_search'&> @@ -222,7 +222,7 @@ my ( $available_columns, $current_format ); ( $query{'format'}, $available_columns, $current_format ) = RT::Interface::Web::QueryBuilder->build_format_string( %ARGS, - cfqueues => $queues, + queues => $queues, format => $query{'format'}, ); diff --git a/share/html/Search/Elements/PickCFs b/share/html/Search/Elements/PickCFs index 681821a..f08aeee 100644 --- a/share/html/Search/Elements/PickCFs +++ b/share/html/Search/Elements/PickCFs @@ -50,13 +50,13 @@ % } <%INIT> my $CustomFields = RT::Model::CustomFieldCollection->new( current_user => Jifty->web->current_user ); -foreach my $id (keys %cfqueues) { +foreach my $id (keys %queues) { # Gotta load up the $queue object, since queues get stored by name now. my $id my $queue = RT::Model::Queue->new( current_user => Jifty->web->current_user ); $queue->load($id); unless ($queue->id) { # XXX TODO: This ancient code dates from a former developer - # we have no idea what it means or why cfqueues are so encoded. + # we have no idea what it means or why queues are so encoded. $id =~ s/^.'*(.*).'*$/$1/; # unescape internal quotes @@ -95,10 +95,10 @@ while ( my $CustomField = $CustomFields->next ) { push @lines, \%line; } -$m->callback( Conditions => \@lines, Queues => \%cfqueues ); +$m->callback( Conditions => \@lines, Queues => \%queues ); </%INIT> <%ARGS> -%cfqueues => undef +%queues => undef </%ARGS> diff --git a/share/html/Search/Elements/PickCriteria b/share/html/Search/Elements/PickCriteria index 9bf8732..a2d48dd 100644 --- a/share/html/Search/Elements/PickCriteria +++ b/share/html/Search/Elements/PickCriteria @@ -52,7 +52,7 @@ <& PickBasics &> -<& PickCFs, cfqueues => \%cfqueues &> +<& PickCFs, queues => \%queues &> <tr class="separator"><td colspan="3"><hr /></td></tr> <tr> @@ -68,5 +68,5 @@ <%ARGS> $addquery => 0 $query => undef -%cfqueues => undef +%queues => undef </%ARGS> ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit[at]lists.bestpractical.com http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|