
jesse at bestpractical
Nov 6, 2009, 1:27 PM
Post #1 of 1
(269 views)
Permalink
|
|
rt branch, librarize-search-logic, updated. d23386b2de2a02a150e2f7e664a4d9b931ee72e7
|
|
The branch, librarize-search-logic has been updated via d23386b2de2a02a150e2f7e664a4d9b931ee72e7 (commit) via ecc49ef36d2e2f1a6fa726decae3670af8582f26 (commit) via 52e00bf2709798bd5eb63fac7adcb9970f5aa840 (commit) from 27cfe643ef3a6309ad0877dd928f9d59434b301e (commit) Summary of changes: lib/RT/Interface/Web/QueryBuilder.pm | 46 ++++++++++++++------------------- share/html/Search/Build.html | 10 +------ 2 files changed, 22 insertions(+), 34 deletions(-) - Log ----------------------------------------------------------------- commit 52e00bf2709798bd5eb63fac7adcb9970f5aa840 Author: Jesse Vincent <jesse [at] bestpractical> Date: Fri Nov 6 16:25:08 2009 -0500 minor tidying diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html index 62eedfa..b5d2399 100644 --- a/share/html/Search/Build.html +++ b/share/html/Search/Build.html @@ -154,7 +154,7 @@ my ( $available_columns, $current_format ); # if we're asked to save the current search, save it if( $ARGS{'saved_search_save'} || $ARGS{'saved_search_copy'}) { -push @actions, RT::Interface::Web::QueryBuilder->save_search( \%query, $saved_search ); + push @actions, RT::Interface::Web::QueryBuilder->save_search( \%query, $saved_search ); } # Push the updates into the session so we don't lose 'em commit ecc49ef36d2e2f1a6fa726decae3670af8582f26 Author: Jesse Vincent <jesse [at] bestpractical> Date: Fri Nov 6 16:25:56 2009 -0500 perltidy diff --git a/lib/RT/Interface/Web/QueryBuilder.pm b/lib/RT/Interface/Web/QueryBuilder.pm index 68c511a..cd397c0 100644 --- a/lib/RT/Interface/Web/QueryBuilder.pm +++ b/lib/RT/Interface/Web/QueryBuilder.pm @@ -2,11 +2,11 @@ package RT::Interface::Web::QueryBuilder; use warnings; use strict; - sub set_query_defaults { - my $self = shift; - my %query = (@_); - # Attempt to load what we can from the session and preferences, set defaults + my $self = shift; + my %query = (@_); + + # Attempt to load what we can from the session and preferences, set defaults my $current = Jifty->web->session->get('CurrentSearchHash'); my $prefs = Jifty->web->current_user->user_object->preferences("SearchDisplay") || {}; @@ -18,15 +18,14 @@ sub set_query_defaults { $query{$param} = $default->{$param} unless defined $query{$param}; } - for my $param (qw(order order_by)) { - $query{$param} = join( '|', @{ $query{$param} } ) if ( ref $query{$param} eq "ARRAY" ) + for my $param (qw(order order_by)) { + $query{$param} = join( '|', @{ $query{$param} } ) if ( ref $query{$param} eq "ARRAY" ); } - $query{'format'} = RT::Interface::Web->scrub_html( $query{'format'} ) if ( $query{'format'} ); - return %query; + $query{'format'} = RT::Interface::Web->scrub_html( $query{'format'} ) if ( $query{'format'} ); + return %query; } - sub process_query { my $self = shift; my $ARGS = shift; @@ -186,7 +185,7 @@ sub process_query { } sub process_query_additions { - my $self = shift; + my $self = shift; my $cgi_args = shift; my @new_values; foreach my $arg ( keys %$cgi_args ) { @@ -236,7 +235,7 @@ sub process_query_additions { } } return @new_values; -}; +} sub load_saved_search { my $self = shift; @@ -307,18 +306,16 @@ sub load_saved_search { return @results; } - sub save_search { my $self = shift; my $query = shift; my $saved_search = shift; my $search_fields = shift || [qw( query format order_by order rows_per_page)]; - my @results; - my $obj = $saved_search->{'object'}; - my $id = $saved_search->{'id'}; - my $desc = $saved_search->{'description'}; + my $obj = $saved_search->{'object'}; + my $id = $saved_search->{'id'}; + my $desc = $saved_search->{'description'}; my $privacy = $saved_search->{'Privacy'}; my %params = map { $_ => $query->{$_} } @$search_fields; @@ -416,12 +413,11 @@ sub _load_container_object { return RT::SavedSearch->new()->_load_privacy_object( $obj_type, $obj_id ); } - sub build_format_string { my $self = shift; my %args = ( format => undef, - queues => undef, + queues => undef, face => undef, size => undef, link => undef, @@ -434,9 +430,8 @@ sub build_format_string { current_display_columns => undef, @_ ); - - - $args{format} = RT->config->get('default_search_result_format') unless $args{format}; + + $args{format} = RT->config->get('default_search_result_format') unless $args{format}; # All the things we can display in the format string by default my @fields = qw( @@ -461,7 +456,7 @@ sub build_format_string { ); # loc_qw my $CustomFields = RT::Model::CustomFieldCollection->new(); - foreach my $id ( keys %{$args{queues}} ) { + 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(); @@ -537,9 +532,9 @@ sub build_format_string { $column{Prefix} .= "<i>"; $column{Suffix} .= "</i>"; } - if ($args{size}) { - $column{Prefix} .= "<" . Jifty->web->escape($args{size}) . ">"; - $column{Suffix} .= "</" . Jifty->web->escape($args{size}) . ">"; + if ( $args{size} ) { + $column{Prefix} .= "<" . Jifty->web->escape( $args{size} ) . ">"; + $column{Suffix} .= "</" . Jifty->web->escape( $args{size} ) . ">"; } if ( $args{link} eq "Display" ) { $column{Prefix} .= q{<a HREF="__WebPath__/Ticket/Display.html?id=__id__">}; @@ -594,5 +589,4 @@ sub build_format_string { } - 1; commit d23386b2de2a02a150e2f7e664a4d9b931ee72e7 Author: Jesse Vincent <jesse [at] bestpractical> Date: Fri Nov 6 16:26:16 2009 -0500 whitespace diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html index b5d2399..0afb095 100644 --- a/share/html/Search/Build.html +++ b/share/html/Search/Build.html @@ -120,20 +120,14 @@ if ($new_query) { } - - %query = RT::Interface::Web::QueryBuilder->set_query_defaults(%query); - - my $tree = RT::Interface::Web::QueryBuilder::Tree->new('AND'); -push @actions, $tree->parse_sql( query => $query{query} ); +push @actions, $tree->parse_sql( query => $query{query} ); my @options = $tree->get_displayed_nodes; my @current_values = grep defined, @options[@clauses]; - - my @new_values = RT::Interface::Web::QueryBuilder->process_query_additions( \%ARGS ); push @actions, RT::Interface::Web::QueryBuilder->process_query( \%ARGS, $tree, \@current_values, \@new_values, ); ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit [at] lists http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|