[Rt-commit] rt branch, 5.0/customize-search, repushed
? sunnavy
sunnavy at bestpractical.com
Wed Apr 8 09:43:59 EDT 2020
The branch 5.0/customize-search was deleted and repushed:
was e3ee2c67b5c3c1693439e02a5dfd617107a5992b
now 1294a7ec229813a4e74420180901099506414a16
1: 8f55beddff = 1: 8f55beddff Add ShowSearchAdvanced/ShowSearchBulkUpdate rights
2: acf73a7473 = 2: acf73a7473 Show ticket shredder link on all ticket search pages
3: db09e0b2fa ! 3: 1b4a8a6ac2 Support to filter lifecycle in ticket search builder
@@ -83,9 +83,9 @@
+ Name => 'Lifecycle',
+ Field => loc('Lifecycle'),
+ Op => {
-+ Type => 'component',
-+ Path => '/Elements/SelectBoolean',
-+ Arguments => { TrueVal=> '=', FalseVal => '!=' },
++ Type => 'component',
++ Path => '/Elements/SelectBoolean',
++ Arguments => { TrueVal => '=', FalseVal => '!=' },
+ },
+ Value => {
+ Type => 'component',
4: 9323c56648 = 4: b7331ced82 Add BeforeDisplay callback to search builder page
5: fdc8e48d12 ! 5: 65b9213ccf Add ExtraQueryParams parameter to search pages
@@ -14,22 +14,19 @@
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@
- $has_query = 1 if ( $HTML::Mason::Commands::DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
-
- my %query_args;
-+ my $extra_query_params = $HTML::Mason::Commands::DECODED_ARGS->{ExtraQueryParams};
- my %fallback_query_args = (
- SavedSearchId => ( $search_id eq 'new' ) ? undef : $search_id,
- SavedChartSearchId => $chart_id,
-@@
- map {
- my $p = $_;
- $p => $HTML::Mason::Commands::DECODED_ARGS->{$p} || $current_search->{$p}
-- } qw(Query Format OrderBy Order Page Class ObjectType)
-+ } qw(Query Format OrderBy Order Page Class ObjectType ExtraQueryParams), ( $extra_query_params ? ( ref $extra_query_params eq 'ARRAY' ? @$extra_query_params : $extra_query_params ) : () )
- ),
- RowsPerPage => (
- defined $HTML::Mason::Commands::DECODED_ARGS->{'RowsPerPage'}
+ my %final_query_args = ();
+ # key => callback to avoid unnecessary work
+
++ if ( my $extra_params = $query_args->{ExtraQueryParams} ) {
++ $final_query_args{ExtraQueryParams} = $extra_params;
++ for my $param ( ref $extra_params eq 'ARRAY' ? @$extra_params : $extra_params ) {
++ $final_query_args{$param} = $query_args->{$param};
++ }
++ }
++
+ for my $param (keys %fallback_query_args) {
+ $final_query_args{$param} = defined($query_args->{$param})
+ ? $query_args->{$param}
diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
--- a/share/html/Search/Build.html
@@ -70,6 +67,20 @@
# ..then wipe the session out..
@@
+ # Clean unwanted junk from the format
+ $query{'Format'} = $m->comp( '/Elements/ScrubHTML', Content => $query{'Format'} );
+ }
++
++ if ( !$ARGS{SavedSearchLoad} and ( my $extra_params = $current->{ExtraQueryParams} ) ) {
++ $query{ExtraQueryParams} //= $extra_params;
++ for my $param ( ref $extra_params eq 'ARRAY' ? @$extra_params : $extra_params ) {
++ $query{$param} //= $current->{$param};
++ }
++ }
+ }
+
+ my $ParseQuery = sub {
+@@
@clauses => ()
$Class => 'RT::Tickets'
$ObjectType => 'RT::Ticket'
@@ -196,13 +207,6 @@
</%ARGS>
<%METHOD Init>
- <%ARGS>
- $Query => {}
- $SavedSearch => {}
-+ at ExtraQueryParams => ()
- @SearchFields => qw(Query Format OrderBy Order RowsPerPage ObjectType)
- $Class => 'RT::Tickets'
- $Type => $Class eq 'RT::Transactions' ? 'Transaction' : 'Ticket'
@@
$SavedSearch->{'Description'} = $search->Description;
$Query->{$_} = $search->SubValue($_) foreach @SearchFields;
@@ -211,6 +215,17 @@
+ $Query->{ExtraQueryParams} = $extra_params;
+ for my $param ( ref $extra_params eq 'ARRAY' ? @$extra_params : $extra_params ) {
+ $Query->{$param} = $search->SubValue($param);
++ }
++ }
++ else {
++ delete $Query->{ExtraQueryParams};
++ }
++
++ # Remove all extra params not set in saved search.
++ if ( my $extra_params = $ARGS{ExtraQueryParams} ) {
++ for my $param ( ref $extra_params eq 'ARRAY' ? @$extra_params : $extra_params ) {
++ next if defined $search->SubValue($param);
++ delete $Query->{$param};
+ }
+ }
+
6: e3ee2c67b5 ! 6: 1294a7ec22 Add ResultPage parameter to redirect to customized search result page
@@ -9,8 +9,8 @@
map {
my $p = $_;
$p => $HTML::Mason::Commands::DECODED_ARGS->{$p} || $current_search->{$p}
-- } qw(Query Format OrderBy Order Page Class ObjectType ExtraQueryParams), ( $extra_query_params ? ( ref $extra_query_params eq 'ARRAY' ? @$extra_query_params : $extra_query_params ) : () )
-+ } qw(Query Format OrderBy Order Page Class ObjectType ResultPage ExtraQueryParams), ( $extra_query_params ? ( ref $extra_query_params eq 'ARRAY' ? @$extra_query_params : $extra_query_params ) : () )
+- } qw(Query Format OrderBy Order Page Class ObjectType)
++ } qw(Query Format OrderBy Order Page Class ObjectType ResultPage)
),
RowsPerPage => (
defined $HTML::Mason::Commands::DECODED_ARGS->{'RowsPerPage'}
More information about the rt-commit
mailing list