[Rt-commit] [rtir] 02/08: Limit what Menus are shown on a New Search
Kevin Falcone
falcone at bestpractical.com
Fri Jul 12 22:55:34 EDT 2013
This is an automated email from the git hooks/post-receive script.
falcone pushed a commit to branch 2.9/search-menus
in repository rtir.
commit b4031ecc91d012c047ea10c85ca46e0a485de735
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Jul 12 18:11:25 2013 -0400
Limit what Menus are shown on a New Search
In core, New Search shows you Edit Search and Advanced. Since Advanced
isn't an option in RTIR, limit ourselves to Edit Search.
---
html/Callbacks/RTIR/Elements/Tabs/Privileged | 79 +++++++++++++++-------------
t/walk-web.t | 2 +-
2 files changed, 42 insertions(+), 39 deletions(-)
diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index d46c4bb..cda1975 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -398,21 +398,25 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update|Forward|
$args{'Queue'} = $queue if $queue;
- PageMenu()->child(
- link => title => loc('Show Results'),
- path => "/RTIR/Search/Results.html?". $query_string->( %args ),
- );
+ if ( $args{'Query'} ) {
+ PageMenu()->child(
+ link => title => loc('Show Results'),
+ path => "/RTIR/Search/Results.html?". $query_string->( %args ),
+ );
+ }
PageMenu()->child(
edit_search => title => loc('Edit Search'),
path => "/RTIR/Search/Refine.html?". $query_string->( %args ),
);
- PageMenu()->child(
- new_search => title => loc('New Search'),
- path => "/RTIR/Search/Refine.html?". $query_string->(
- NewQuery => 1,
- Queue => $queue,
- ),
- );
+ if ( $args{'Query'} ) {
+ PageMenu()->child(
+ new_search => title => loc('New Search'),
+ path => "/RTIR/Search/Refine.html?". $query_string->(
+ NewQuery => 1,
+ Queue => $queue,
+ ),
+ );
+ }
if ( $type eq 'Incident' ) {
PageMenu()->child(
@@ -431,22 +435,23 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update|Forward|
path => "/RTIR/Report/BulkReject.html?". $query_string->( %args ),
);
}
- PageMenu()->child(
- chart => title => loc('Chart'),
- path => "/RTIR/Search/Reporting.html?". $query_string->( %args ),
- );
- my $more = PageMenu->child( more => title => loc('Feeds') );
- $more->child(
- spreadsheet => title => loc('Spreadsheet'),
- path => "/Search/Results.tsv?". $query_string->( %args ),
- );
+ if ( $args{'Query'} ) {
+ PageMenu()->child(
+ chart => title => loc('Chart'),
+ path => "/RTIR/Search/Reporting.html?". $query_string->( %args ),
+ );
- # other paths need query defined
- $args{'Query'} = RT::IR->Query( Queue => $args{'Queue'} )
- if !$args{'Query'} && $args{'Queue'};
+ my $more = PageMenu->child( more => title => loc('Feeds') );
+ $more->child(
+ spreadsheet => title => loc('Spreadsheet'),
+ path => "/Search/Results.tsv?". $query_string->( %args ),
+ );
+
+ # other paths need query defined
+ $args{'Query'} = RT::IR->Query( Queue => $args{'Queue'} )
+ if !$args{'Query'} && $args{'Queue'};
- if ( $args{'Query'} ) {
my $RSSPath = join '/', map $m->interp->apply_escapes( $_, 'u' ),
$session{'CurrentUser'}->UserObj->Name,
$session{'CurrentUser'}->UserObj->GenerateAuthString(
@@ -466,21 +471,19 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update|Forward|
$args{Query}
;
$more->child( ical => title => loc('iCal') => path => '/NoAuth/iCal/'.$ical_path);
- }
- if ( $args{'Query'} && $session{'CurrentUser'}->HasRight(
- Right => 'SuperUser', Object => RT->System
- ) ) {
- my $shred_args = $query_string->(
- search => 1,
- plugin => 'Tickets',
- 'Tickets:query' => $args{'Query'},
- 'Tickets:limit' => $args{'RowsPerPage'},
- );
- $more->child(
- shredder => title => loc('Shredder'),
- path => '/Admin/Tools/Shredder/?' . $shred_args
- );
+ if ( $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System ) ) {
+ my $shred_args = $query_string->(
+ search => 1,
+ plugin => 'Tickets',
+ 'Tickets:query' => $args{'Query'},
+ 'Tickets:limit' => $args{'RowsPerPage'},
+ );
+ $more->child(
+ shredder => title => loc('Shredder'),
+ path => '/Admin/Tools/Shredder/?' . $shred_args
+ );
+ }
}
} elsif ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?Split\.html$} ) {
my $id = $args->{'Split'};
diff --git a/t/walk-web.t b/t/walk-web.t
index 9ae2e30..b594e15 100644
--- a/t/walk-web.t
+++ b/t/walk-web.t
@@ -5,7 +5,7 @@ use warnings;
use HTML::TreeBuilder;
-use RT::IR::Test tests => 594;
+use RT::IR::Test tests => 486;
RT::Test->started_ok;
my $m = default_agent();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Rt-commit
mailing list