#my $request_path = $HTML::Mason::Commands::r->path_info;
my $request_path = $m->request_comp->path;
+$request_path =~ s!/{2,}!/!g;
my $query_string = sub {
my %args = @_;
my $section;
if ( $request_path =~ m|^/Admin/$type/?(?:index.html)?$|
|| ( $request_path =~ m|^/Admin/$type/(?:Modify.html)$|
- && $m->request_args->{'Create'} )
+ && $DECODED_ARGS->{'Create'} )
)
{
$section = $tabs;
}
if ( $request_path =~ m{^/Admin/Queues} ) {
- if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/
+ if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/
||
- $m->request_args->{'Queue'} && $m->request_args->{'Queue'} =~ /^\d+$/
+ $DECODED_ARGS->{'Queue'} && $DECODED_ARGS->{'Queue'} =~ /^\d+$/
) {
- my $id = $m->request_args->{'Queue'} || $m->request_args->{'id'};
+ my $id = $DECODED_ARGS->{'Queue'} || $DECODED_ARGS->{'id'};
my $queue_obj = RT::Queue->new( $session{'CurrentUser'} );
$queue_obj->Load($id);
}
}
if ( $request_path =~ m{^/Admin/Users} ) {
- if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
- my $id = $m->request_args->{'id'};
+ if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $DECODED_ARGS->{'id'};
my $obj = RT::User->new( $session{'CurrentUser'} );
$obj->Load($id);
}
if ( $request_path =~ m{^/Admin/Groups} ) {
- if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
- my $id = $m->request_args->{'id'};
+ if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $DECODED_ARGS->{'id'};
my $obj = RT::Group->new( $session{'CurrentUser'} );
$obj->Load($id);
}
if ( $request_path =~ m{^/Admin/CustomFields/} ) {
- if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
- my $id = $m->request_args->{'id'};
+ if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $DECODED_ARGS->{'id'};
my $obj = RT::CustomField->new( $session{'CurrentUser'} );
$obj->Load($id);
if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
my $tabs = PageMenu();
- if ( my $id = $m->request_args->{'id'} ) {
+ if ( my $id = $DECODED_ARGS->{'id'} ) {
my $obj = RT::CustomField->new( $session{'CurrentUser'} );
$obj->Load($id);
$about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
}
if ( $request_path =~ m{^/Dashboards/(\d+)?}) {
- if ( my $id = ( $1 || $m->request_args->{'id'} ) ) {
+ if ( my $id = ( $1 || $DECODED_ARGS->{'id'} ) ) {
my $obj = RT::Dashboard->new( $session{'CurrentUser'} );
$obj->LoadById($id);
if ( $obj and $obj->id ) {
if ( $request_path =~ m{^/Ticket/} ) {
- if ( ( $m->request_args->{'id'} || '' ) =~ /^(\d+)$/ ) {
+ if ( ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
my $obj = RT::Ticket->new( $session{'CurrentUser'} );
$obj->Load($id);
&& $request_path !~ m{^/Search/Simple\.html}
)
|| ( $request_path =~ m{^/Search/Simple\.html}
- && $m->request_args->{'q'} )
+ && $DECODED_ARGS->{'q'} )
)
{
my $search = Menu()->child('search');
my $args = '';
my $has_query = '';
my $current_search = $session{"CurrentSearchHash"} || {};
- my $search_id = $m->request_args->{'SavedSearchLoad'} || $m->request_args->{'SavedSearchId'} || $current_search->{'SearchId'} || '';
- my $chart_id = $m->request_args->{'SavedChartSearchId'} || $current_search->{SavedChartSearchId};
+ my $search_id = $DECODED_ARGS->{'SavedSearchLoad'} || $DECODED_ARGS->{'SavedSearchId'} || $current_search->{'SearchId'} || '';
+ my $chart_id = $DECODED_ARGS->{'SavedChartSearchId'} || $current_search->{SavedChartSearchId};
- $has_query = 1 if ( $m->request_args->{'Query'} or $current_search->{'Query'} );
+ $has_query = 1 if ( $DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
my %query_args;
my %fallback_query_args = (
(
map {
my $p = $_;
- $p => $m->request_args->{$p} || $current_search->{$p}
+ $p => $DECODED_ARGS->{$p} || $current_search->{$p}
} qw(Query Format OrderBy Order Page)
),
RowsPerPage => (
- defined $m->request_args->{'RowsPerPage'}
- ? $m->request_args->{'RowsPerPage'}
+ defined $DECODED_ARGS->{'RowsPerPage'}
+ ? $DECODED_ARGS->{'RowsPerPage'}
: $current_search->{'RowsPerPage'}
),
);
$current_search_menu->child( bulk => title => loc('Bulk Update'), path => "/Search/Bulk.html$args" );
$current_search_menu->child( chart => title => loc('Chart'), path => "/Search/Chart.html$args" );
+ #formerly Callbacks/RTx-Calendar/Ticket/Element/Tabs/Default
+ $current_search_menu->child( calendar => title => loc('Calendar'), path => "/Search/Calendar.html$args" );
+
my $more = $current_search_menu->child( more => title => loc('Feeds') );
- $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Search/Results.tsv$args" );
+ $more->child( tsv => title => loc('TSV'), path => "/Search/Results.tsv$args" );
+ $more->child( csv => title => loc('CSV'), path => "/Search/Results.csv$args" );
+ $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Search/Results.xls$args" );
my %rss_data = map {
$_ => $QueryArgs->{$_} || $fallback_query_args{$_} || '' }
}
if ( $request_path =~ m{^/Article/} ) {
- if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
- my $id = $m->request_args->{'id'};
+ if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $DECODED_ARGS->{'id'};
my $tabs = PageMenu();
$tabs->child( display => title => loc('Display'), path => "/Articles/Article/Display.html?id=".$id );
my $tabs = PageMenu();
$tabs->child( search => title => loc("Search"), path => "/Articles/Article/Search.html" );
$tabs->child( create => title => loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
- if ( ( $m->request_args->{'id'} || '' ) =~ /^(\d+)$/ ) {
+ if ( $request_path =~ m{^/Articles/Article/} and ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
my $obj = RT::Article->new( $session{'CurrentUser'} );
$obj->Load($id);
$queues->UnLimit;
my $queue_count = 0;
- my $queue_id = 1;
+ my $queue_id;
while ( my $queue = $queues->Next ) {
next unless $queue->CurrentUserHasRight('CreateTicket');
}
- my $tickets = Menu->child( tickets => title => loc('Tickets'));
- $tickets->child( open => title => loc('Open tickets'), path => '/SelfService/' );
- $tickets->child( closed => title => loc('Closed tickets'), path => '/SelfService/Closed.html' );
if ( $queue_count > 1 ) {
- $tickets->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
- } else {
- $tickets->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
+ Menu->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
+ } elsif ( $queue_id ) {
+ Menu->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
}
+ my $tickets = Menu->child( tickets => title => loc('Tickets'), path => '/SelfService/' );
+ $tickets->child( open => title => loc('Open tickets'), path => '/SelfService/' );
+ $tickets->child( closed => title => loc('Closed tickets'), path => '/SelfService/Closed.html' );
my $username = '<span class="current-user">'