[Rt-commit] rt branch, 4.4/show-assets-action-menu, created. rt-4.4.1rc1-29-gf88d770
Dustin Graves
dustin at bestpractical.com
Wed Jun 22 18:19:21 EDT 2016
The branch, 4.4/show-assets-action-menu has been created
at f88d7704e894c6f7477cd43115ffc855336927b8 (commit)
- Log -----------------------------------------------------------------
commit 15980c85c38b5b1aa25c7a30704e5fa29ea24c09
Author: Dustin Graves <dustin at bestpractical.com>
Date: Tue May 31 21:55:26 2016 +0000
refactor RT menu building logic into own library module
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
new file mode 100644
index 0000000..2468aef
--- /dev/null
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -0,0 +1,1190 @@
+# BEGIN BPS TAGGED BLOCK {{{
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+# <sales at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# END BPS TAGGED BLOCK }}}
+
+=head1 NAME
+
+RT::Interface::Web::MenuBuilder
+
+=cut
+
+use strict;
+use warnings;
+
+package RT::Interface::Web::MenuBuilder;
+
+sub QueryString {
+ my %args = @_;
+ my $u = URI->new();
+ $u->query_form(map { $_ => $args{$_} } sort keys %args);
+ return $u->query;
+}
+
+sub BuildMainNav {
+ my $request_path = shift;
+ my $query_string = shift;
+ my $query_args = shift;
+
+ if ($request_path =~ m{^/Asset/}) {
+ HTML::Mason::Commands::PageWidgets()->child( asset_search => raw_html => $HTML::Mason::Commands::m->scomp('/Asset/Elements/Search') );
+ } else {
+ HTML::Mason::Commands::PageWidgets()->child( simple_search => raw_html => $HTML::Mason::Commands::m->scomp('SimpleSearch') );
+ HTML::Mason::Commands::PageWidgets()->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket') );
+ }
+
+ my $home = HTML::Mason::Commands::Menu()->child( home => title => HTML::Mason::Commands::loc('Homepage'), path => '/' );
+ unless ($HTML::Mason::Commands::session{'dashboards_in_menu'}) {
+ my $dashboards_in_menu = $HTML::Mason::Commands::session{CurrentUser}->UserObj->Preferences(
+ 'DashboardsInMenu',
+ {},
+ );
+
+ unless ($dashboards_in_menu->{dashboards}) {
+ my ($default_dashboards) =
+ RT::System->new( $HTML::Mason::Commands::session{'CurrentUser'} )
+ ->Attributes
+ ->Named('DashboardsInMenu');
+ if ($default_dashboards) {
+ $dashboards_in_menu = $default_dashboards->Content;
+ }
+ }
+
+ $HTML::Mason::Commands::session{'dashboards_in_menu'} = $dashboards_in_menu->{dashboards} || [];
+ }
+
+ my @dashboards;
+ for my $id ( @{$HTML::Mason::Commands::session{'dashboards_in_menu'}} ) {
+ my $dash = RT::Dashboard->new( $HTML::Mason::Commands::session{CurrentUser} );
+ my ( $status, $msg ) = $dash->LoadById($id);
+ if ( $status ) {
+ push @dashboards, $dash;
+ } else {
+ $RT::Logger->warning( "Failed to load dashboard $id: $msg" );
+ }
+ }
+
+ my $dashes = HTML::Mason::Commands::Menu()->child('home');
+ if (@dashboards) {
+ for my $dash (@dashboards) {
+ $home->child( 'dashboard-' . $dash->id,
+ title => $dash->Name,
+ path => '/Dashboards/' . $dash->id . '/' . $dash->Name
+ );
+ }
+ }
+ $dashes->child( edit => title => HTML::Mason::Commands::loc('Update This Menu'), path => 'Prefs/DashboardsInMenu.html' );
+ $dashes->child( more => title => HTML::Mason::Commands::loc('All Dashboards'), path => 'Dashboards/index.html' );
+ my $dashboard = RT::Dashboard->new( $HTML::Mason::Commands::session{CurrentUser} );
+ if ( $dashboard->CurrentUserCanCreateAny ) {
+ $dashes->child('dashboard_create' => title => HTML::Mason::Commands::loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" );
+ }
+
+ my $search = HTML::Mason::Commands::Menu()->child( search => title => HTML::Mason::Commands::loc('Search'), path => '/Search/Simple.html' );
+
+ my $tickets = $search->child( tickets => title => HTML::Mason::Commands::loc('Tickets'), path => '/Search/Build.html' );
+ $tickets->child( simple => title => HTML::Mason::Commands::loc('Simple Search'), path => "/Search/Simple.html" );
+ $tickets->child( new => title => HTML::Mason::Commands::loc('New Search'), path => "/Search/Build.html?NewQuery=1" );
+
+ $search->child( articles => title => HTML::Mason::Commands::loc('Articles'), path => "/Articles/Article/Search.html" )
+ if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
+
+ $search->child( users => title => HTML::Mason::Commands::loc('Users'), path => "/User/Search.html" );
+
+ $search->child( assets => title => HTML::Mason::Commands::loc("Assets"), path => "/Asset/Search/" )
+ if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
+
+ if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
+ my $articles = HTML::Mason::Commands::Menu()->child( articles => title => HTML::Mason::Commands::loc('Articles'), path => "/Articles/index.html");
+ $articles->child( articles => title => HTML::Mason::Commands::loc('Overview'), path => "/Articles/index.html" );
+ $articles->child( topics => title => HTML::Mason::Commands::loc('Topics'), path => "/Articles/Topics.html" );
+ $articles->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Articles/Article/PreCreate.html" );
+ $articles->child( search => title => HTML::Mason::Commands::loc('Search'), path => "/Articles/Article/Search.html" );
+ }
+
+ if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System )) {
+ my $assets = HTML::Mason::Commands::Menu()->child( "assets", title => HTML::Mason::Commands::loc("Assets"), path => "/Asset/Search/" );
+ $assets->child( "create", title => HTML::Mason::Commands::loc("Create"), path => "/Asset/CreateInCatalog.html" );
+ $assets->child( "search", title => HTML::Mason::Commands::loc("Search"), path => "/Asset/Search/" );
+ }
+
+ my $tools = HTML::Mason::Commands::Menu()->child( tools => title => HTML::Mason::Commands::loc('Tools'), path => '/Tools/index.html' );
+
+ $tools->child( my_day =>
+ title => HTML::Mason::Commands::loc('My Day'),
+ description => HTML::Mason::Commands::loc('Easy updating of your open tickets'),
+ path => '/Tools/MyDay.html',
+ );
+
+ if ( RT->Config->Get('EnableReminders') ) {
+ $tools->child( my_reminders =>
+ title => HTML::Mason::Commands::loc('My Reminders'),
+ description => HTML::Mason::Commands::loc('Easy viewing of your reminders'),
+ path => '/Tools/MyReminders.html',
+ );
+ }
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) {
+ $tools->child( approval =>
+ title => HTML::Mason::Commands::loc('Approval'),
+ description => HTML::Mason::Commands::loc('My Approvals'),
+ path => '/Approvals/',
+ );
+ }
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
+ {
+ BuildAdminMenu($request_path, HTML::Mason::Commands::Menu());
+ }
+
+ my $username = '<span class="current-user">'
+ . $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
+ . '</span>';
+ my $about_me = HTML::Mason::Commands::Menu()->child( 'preferences' =>
+ title => HTML::Mason::Commands::loc('Logged in as [_1]', $username),
+ escape_title => 0,
+ path => '/User/Summary.html?id=' . $HTML::Mason::Commands::session{CurrentUser}->id,
+ sort_order => 99,
+ );
+
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->UserObj
+ && $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System )) {
+ my $settings = $about_me->child( settings => title => HTML::Mason::Commands::loc('Settings'), path => '/Prefs/Other.html' );
+ $settings->child( options => title => HTML::Mason::Commands::loc('Preferences'), path => '/Prefs/Other.html' );
+ $settings->child( about_me => title => HTML::Mason::Commands::loc('About me'), path => '/Prefs/AboutMe.html' );
+ $settings->child( search_options => title => HTML::Mason::Commands::loc('Search options'), path => '/Prefs/SearchOptions.html' );
+ $settings->child( myrt => title => HTML::Mason::Commands::loc('RT at a glance'), path => '/Prefs/MyRT.html' );
+ $settings->child( dashboards_in_menu =>
+ title => HTML::Mason::Commands::loc('Dashboards in menu'),
+ path => '/Prefs/DashboardsInMenu.html',
+ );
+ $settings->child( queue_list => title => HTML::Mason::Commands::loc('Queue list'), path => '/Prefs/QueueList.html' );
+
+ my $search_menu = $settings->child( 'saved-searches' => title => HTML::Mason::Commands::loc('Saved Searches') );
+ my $searches = [ $HTML::Mason::Commands::m->comp( "/Search/Elements/SearchesForObject",
+ Object => RT::System->new( $HTML::Mason::Commands::session{'CurrentUser'} )) ];
+ my $i = 0;
+
+ for my $search (@$searches) {
+ $search_menu->child( "search-" . $i++ =>
+ title => $search->[1],
+ path => "/Prefs/Search.html?"
+ . QueryString( name => ref( $search->[2] ) . '-' . $search->[2]->Id ),
+ );
+
+ }
+ }
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->Name
+ && ( !RT->Config->Get('WebRemoteUserAuth')
+ || RT->Config->Get('WebFallbackToRTLogin') )) {
+ $about_me->child( logout => title => HTML::Mason::Commands::loc('Logout'), path => '/NoAuth/Logout.html' );
+ }
+ if ( $request_path =~ m{^/Dashboards/(\d+)?}) {
+ if ( my $id = ( $1 || $HTML::Mason::Commands::DECODED_ARGS->{'id'} ) ) {
+ my $obj = RT::Dashboard->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->LoadById($id);
+ if ( $obj and $obj->id ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id);
+ $tabs->child( content => title => HTML::Mason::Commands::loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id);
+ $tabs->child( subscription => title => HTML::Mason::Commands::loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id)
+ if $obj->CurrentUserCanSubscribe;
+ $tabs->child( show => title => HTML::Mason::Commands::loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
+ }
+ }
+ }
+
+
+ if ( $request_path =~ m{^/Ticket/} ) {
+ if ( ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
+ my $id = $1;
+ my $obj = RT::Ticket->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ if ( $obj and $obj->id ) {
+ my $actions = HTML::Mason::Commands::PageMenu()->child( actions => title => HTML::Mason::Commands::loc('Actions'), sort_order => 95 );
+
+ my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
+ $can{'_ModifyOwner'} = $obj->CurrentUserCanSetOwner();
+ my $can = sub {
+ unless ($_[0] eq 'ExecuteCode') {
+ return $can{$_[0]} || $can{'SuperUser'};
+ } else {
+ return !RT->Config->Get('DisallowExecuteCode')
+ && ( $can{'ExecuteCode'} || $can{'SuperUser'} );
+ }
+ };
+
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( bookmark => raw_html => $HTML::Mason::Commands::m->scomp( '/Ticket/Elements/Bookmark', id => $id ), sort_order => 98 );
+
+ if ($can->('ModifyTicket')) {
+ $tabs->child( timer => raw_html => $HTML::Mason::Commands::m->scomp( '/Ticket/Elements/PopupTimerLink', id => $id ), sort_order => 99 );
+ }
+
+ $tabs->child( display => title => HTML::Mason::Commands::loc('Display'), path => "/Ticket/Display.html?id=" . $id );
+ $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Ticket/History.html?id=" . $id );
+
+ # comment out until we can do it for an individual custom field
+ #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') ) {
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Ticket/Modify.html?id=" . $id );
+
+ #}
+
+ if ( $can->('ModifyTicket') || $can->('_ModifyOwner') || $can->('Watch') || $can->('WatchAsAdminCc') ) {
+ $tabs->child( people => title => HTML::Mason::Commands::loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id );
+ }
+
+ if ( $can->('ModifyTicket') ) {
+ $tabs->child( dates => title => HTML::Mason::Commands::loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id );
+ $tabs->child( links => title => HTML::Mason::Commands::loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id );
+ }
+
+ #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') || $can->('_ModifyOwner') ) {
+ $tabs->child( jumbo => title => HTML::Mason::Commands::loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id );
+ #}
+
+ if ( RT->Config->Get('EnableReminders') ) {
+ $tabs->child( reminders => title => HTML::Mason::Commands::loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id );
+ }
+
+ if ( $can->('ModifyTicket') or $can->('ReplyToTicket') ) {
+ $actions->child( reply => title => HTML::Mason::Commands::loc('Reply'), path => "/Ticket/Update.html?Action=Respond;id=" . $id );
+ }
+
+ if ( $can->('ModifyTicket') or $can->('CommentOnTicket') ) {
+ $actions->child( comment => title => HTML::Mason::Commands::loc('Comment'), path => "/Ticket/Update.html?Action=Comment;id=" . $id );
+ }
+
+ if ( $can->('ForwardMessage') ) {
+ $actions->child( forward => title => HTML::Mason::Commands::loc('Forward'), path => "/Ticket/Forward.html?id=" . $id );
+ }
+
+ my $hide_resolve_with_deps = RT->Config->Get('HideResolveActionsWithDependencies')
+ && $obj->HasUnresolvedDependencies;
+
+ my $current = $obj->Status;
+ my $lifecycle = $obj->LifecycleObj;
+ my $i = 1;
+ foreach my $info ( $lifecycle->Actions($current) ) {
+ my $next = $info->{'to'};
+ next unless $lifecycle->IsTransition( $current => $next );
+
+ my $check = $lifecycle->CheckRight( $current => $next );
+ next unless $can->($check);
+
+ next if $hide_resolve_with_deps
+ && $lifecycle->IsInactive($next)
+ && !$lifecycle->IsInactive($current);
+
+ my $action = $info->{'update'} || '';
+ my $url = '/Ticket/';
+ $url .= "Update.html?". QueryString(
+ $action
+ ? (Action => $action)
+ : (SubmitTicket => 1, Status => $next),
+ DefaultStatus => $next,
+ id => $id,
+ );
+ my $key = $info->{'label'} || ucfirst($next);
+ $actions->child( $key => title => HTML::Mason::Commands::loc( $key ), path => $url);
+ }
+
+ my ($can_take, $tmsg) = $obj->CurrentUserCanSetOwner( Type => 'Take' );
+ my ($can_steal, $smsg) = $obj->CurrentUserCanSetOwner( Type => 'Steal' );
+ if ( $can_take ){
+ $actions->child( take => title => HTML::Mason::Commands::loc('Take'), path => "/Ticket/Display.html?Action=Take;id=" . $id );
+ }
+ elsif ( $can_steal ){
+ $actions->child( steal => title => HTML::Mason::Commands::loc('Steal'), path => "/Ticket/Display.html?Action=Steal;id=" . $id );
+ }
+
+ # TODO needs a "Can extract article into a class applied to this queue" check
+ $actions->child( 'extract-article' =>
+ title => HTML::Mason::Commands::loc('Extract Article'),
+ path => "/Articles/Article/ExtractIntoClass.html?Ticket=".$obj->id,
+ ) if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
+
+ if ( defined $HTML::Mason::Commands::session{"tickets"} ) {
+ # we have to update session data if we get new ItemMap
+ my $updatesession = 1 unless ( $HTML::Mason::Commands::session{"tickets"}->{'item_map'} );
+
+ my $item_map = $HTML::Mason::Commands::session{"tickets"}->ItemMap;
+
+ if ($updatesession) {
+ $HTML::Mason::Commands::session{"tickets"}->PrepForSerialization();
+ }
+
+ my $search = HTML::Mason::Commands::Menu()->child('search')->child('tickets');
+ # Don't display prev links if we're on the first ticket
+ if ( $item_map->{$id}->{prev} ) {
+ $search->child( first =>
+ title => '<< ' . HTML::Mason::Commands::loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first});
+ $search->child( prev =>
+ title => '< ' . HTML::Mason::Commands::loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev});
+ }
+ # Don't display next links if we're on the last ticket
+ if ( $item_map->{$id}->{next} ) {
+ $search->child( next =>
+ title => HTML::Mason::Commands::loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
+ if ( $item_map->{last} ) {
+ $search->child( last =>
+ title => HTML::Mason::Commands::loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (
+ (
+ $request_path =~ m{^/(?:Ticket|Search)/}
+ && $request_path !~ m{^/Search/Simple\.html}
+ )
+ || ( $request_path =~ m{^/Search/Simple\.html}
+ && $HTML::Mason::Commands::DECODED_ARGS->{'q'} )
+ )
+ {
+ my $search = HTML::Mason::Commands::Menu()->child('search')->child('tickets');
+ my $args = '';
+ my $has_query = '';
+ my $current_search = $HTML::Mason::Commands::session{"CurrentSearchHash"} || {};
+ my $search_id = $HTML::Mason::Commands::DECODED_ARGS->{'SavedSearchLoad'} || $HTML::Mason::Commands::DECODED_ARGS->{'SavedSearchId'} || $current_search->{'SearchId'} || '';
+ my $chart_id = $HTML::Mason::Commands::DECODED_ARGS->{'SavedChartSearchId'} || $current_search->{SavedChartSearchId};
+
+ $has_query = 1 if ( $HTML::Mason::Commands::DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
+
+ my %query_args;
+ 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)
+ ),
+ RowsPerPage => (
+ defined $HTML::Mason::Commands::DECODED_ARGS->{'RowsPerPage'}
+ ? $HTML::Mason::Commands::DECODED_ARGS->{'RowsPerPage'}
+ : $current_search->{'RowsPerPage'}
+ ),
+ );
+
+ if ($query_string) {
+ $args = '?' . $query_string;
+ }
+ else {
+ my %final_query_args = ();
+ # key => callback to avoid unnecessary work
+
+ for my $param (keys %fallback_query_args) {
+ $final_query_args{$param} = defined($query_args->{$param})
+ ? $query_args->{$param}
+ : $fallback_query_args{$param};
+ }
+
+ for my $field (qw(Order OrderBy)) {
+ if ( ref( $final_query_args{$field} ) eq 'ARRAY' ) {
+ $final_query_args{$field} = join( "|", @{ $final_query_args{$field} } );
+ } elsif (not defined $final_query_args{$field}) {
+ delete $final_query_args{$field};
+ }
+ else {
+ $final_query_args{$field} ||= '';
+ }
+ }
+
+ $args = '?' . QueryString(%final_query_args);
+ }
+
+ my $current_search_menu;
+ if ( $request_path =~ m{^/Ticket} ) {
+ $current_search_menu = $search->child( current_search => title => HTML::Mason::Commands::loc('Current Search') );
+ $current_search_menu->path("/Search/Results.html$args") if $has_query;
+ } else {
+ $current_search_menu = HTML::Mason::Commands::PageMenu();
+ }
+
+ $current_search_menu->child( edit_search =>
+ title => HTML::Mason::Commands::loc('Edit Search'), path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) );
+ $current_search_menu->child( advanced =>
+ title => HTML::Mason::Commands::loc('Advanced'), path => "/Search/Edit.html$args" );
+ if ($has_query) {
+ $current_search_menu->child( results => title => HTML::Mason::Commands::loc('Show Results'), path => "/Search/Results.html$args" );
+ }
+
+ if ( $has_query ) {
+ $current_search_menu->child( bulk => title => HTML::Mason::Commands::loc('Bulk Update'), path => "/Search/Bulk.html$args" );
+ $current_search_menu->child( chart => title => HTML::Mason::Commands::loc('Chart'), path => "/Search/Chart.html$args" );
+
+ my $more = $current_search_menu->child( more => title => HTML::Mason::Commands::loc('Feeds') );
+
+ $more->child( spreadsheet => title => HTML::Mason::Commands::loc('Spreadsheet'), path => "/Search/Results.tsv$args" );
+
+ my %rss_data = map {
+ $_ => $query_args->{$_} || $fallback_query_args{$_} || '' }
+ qw(Query Order OrderBy);
+ my $RSSQueryString = "?"
+ . QueryString( Query => $rss_data{Query},
+ Order => $rss_data{Order},
+ OrderBy => $rss_data{OrderBy}
+ );
+ my $RSSPath = join '/', map $HTML::Mason::Commands::m->interp->apply_escapes( $_, 'u' ),
+ $HTML::Mason::Commands::session{'CurrentUser'}->UserObj->Name,
+ $HTML::Mason::Commands::session{'CurrentUser'}
+ ->UserObj->GenerateAuthString( $rss_data{Query}
+ . $rss_data{Order}
+ . $rss_data{OrderBy} );
+
+ $more->child( rss => title => HTML::Mason::Commands::loc('RSS'), path => "/NoAuth/rss/$RSSPath/$RSSQueryString");
+ my $ical_path = join '/', map $HTML::Mason::Commands::m->interp->apply_escapes($_, 'u'),
+ $HTML::Mason::Commands::session{'CurrentUser'}->UserObj->Name,
+ $HTML::Mason::Commands::session{'CurrentUser'}->UserObj->GenerateAuthString( $rss_data{Query} ),
+ $rss_data{Query};
+ $more->child( ical => title => HTML::Mason::Commands::loc('iCal'), path => '/NoAuth/iCal/'.$ical_path);
+
+ if ($request_path =~ m{^/Search/Results.html}
+ && #XXX TODO better abstraction
+ $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
+ my $shred_args = QueryString(
+ Search => 1,
+ Plugin => 'Tickets',
+ 'Tickets:query' => $rss_data{'Query'},
+ 'Tickets:limit' => $query_args->{'Rows'},
+ );
+
+ $more->child( shredder => title => HTML::Mason::Commands::loc('Shredder'), path => '/Admin/Tools/Shredder/?' . $shred_args);
+ }
+
+ }
+ }
+
+ if ( $request_path =~ m{^/Article/} ) {
+ if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
+ my $tabs = HTML::Mason::Commands::PageMenu();
+
+ $tabs->child( display => title => HTML::Mason::Commands::loc('Display'), path => "/Articles/Article/Display.html?id=".$id );
+ $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Articles/Article/History.html?id=".$id );
+ $tabs->child( modify => title => HTML::Mason::Commands::loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id );
+ }
+ }
+
+ if ( $request_path =~ m{^/Articles/} ) {
+ HTML::Mason::Commands::PageWidgets()->child( article_search => raw_html => $HTML::Mason::Commands::m->scomp('/Articles/Elements/GotoArticle') );
+ HTML::Mason::Commands::PageWidgets()->delete('create_ticket');
+ HTML::Mason::Commands::PageWidgets()->delete('simple_search');
+
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( search => title => HTML::Mason::Commands::loc("Search"), path => "/Articles/Article/Search.html" );
+ $tabs->child( create => title => HTML::Mason::Commands::loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
+ if ( $request_path =~ m{^/Articles/Article/} and ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
+ my $id = $1;
+ my $obj = RT::Article->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ if ( $obj and $obj->id ) {
+ $tabs->child( display => title => HTML::Mason::Commands::loc("Display"), path => "/Articles/Article/Display.html?id=" . $id );
+ $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => '/Articles/Article/History.html?id=' . $id );
+
+ if ( $obj->CurrentUserHasRight('ModifyArticle') ) {
+ $tabs->child(modify => title => HTML::Mason::Commands::loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
+ }
+ }
+ }
+
+ }
+
+ if ($request_path =~ m{^/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id} and $HTML::Mason::Commands::DECODED_ARGS->{id} !~ /\D/) {
+ my $page = HTML::Mason::Commands::PageMenu();
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
+ my $asset = RT::Asset->new( $HTML::Mason::Commands::session{CurrentUser} );
+ $asset->Load($id);
+
+ if ($asset->id) {
+ $page->child("display", title => HTML::Mason::Commands::loc("Display"), path => "/Asset/Display.html?id=$id");
+ $page->child("history", title => HTML::Mason::Commands::loc("History"), path => "/Asset/History.html?id=$id");
+ $page->child("basics", title => HTML::Mason::Commands::loc("Basics"), path => "/Asset/Modify.html?id=$id");
+ $page->child("links", title => HTML::Mason::Commands::loc("Links"), path => "/Asset/ModifyLinks.html?id=$id");
+ $page->child("people", title => HTML::Mason::Commands::loc("People"), path => "/Asset/ModifyPeople.html?id=$id");
+ $page->child("dates", title => HTML::Mason::Commands::loc("Dates"), path => "/Asset/ModifyDates.html?id=$id");
+
+ for my $grouping (RT::CustomField->CustomGroupings($asset)) {
+ my $cfs = $asset->CustomFields;
+ $cfs->LimitToGrouping( $asset => $grouping );
+ next unless $cfs->Count;
+ $page->child(
+ "cf-grouping-$grouping",
+ title => HTML::Mason::Commands::loc($grouping),
+ path => "/Asset/ModifyCFs.html?id=$id;Grouping=" . $HTML::Mason::Commands::m->interp->apply_escapes($grouping, 'u'),
+ );
+ }
+
+ my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
+ $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
+
+ my $status = $asset->Status;
+ my $lifecycle = $asset->LifecycleObj;
+ for my $action ( $lifecycle->Actions($status) ) {
+ my $next = $action->{'to'};
+ next unless $lifecycle->IsTransition( $status => $next );
+
+ my $check = $lifecycle->CheckRight( $status => $next );
+ next unless $asset->CurrentUserHasRight($check);
+
+ my $label = $action->{'label'} || ucfirst($next);
+ $actions->child(
+ $label,
+ title => HTML::Mason::Commands::loc($label),
+ path => "/Asset/Modify.html?id=$id;Update=1;DisplayAfter=1;Status="
+ . $HTML::Mason::Commands::m->interp->apply_escapes($next, 'u'),
+
+ class => "asset-lifecycle-action",
+ attributes => {
+ 'data-current-status' => $status,
+ 'data-next-status' => $next,
+ },
+ );
+ }
+ }
+ } elsif ($request_path =~ m{^/Asset/Search/}) {
+ my $page = HTML::Mason::Commands::PageMenu();
+ my %search = map @{$_},
+ grep defined $_->[1] && length $_->[1],
+ map {ref $HTML::Mason::Commands::DECODED_ARGS->{$_} ? [$_, $HTML::Mason::Commands::DECODED_ARGS->{$_}[0]] : [$_, $HTML::Mason::Commands::DECODED_ARGS->{$_}] }
+ grep /^(?:q|SearchAssets|!?(Name|Description|Catalog|Status|Role\..+|CF\..+)|Order(?:By)?|Page)$/,
+ keys %$HTML::Mason::Commands::DECODED_ARGS;
+ if ( $request_path =~ /Bulk/) {
+ $page->child('search',
+ title => HTML::Mason::Commands::loc('Show Results'),
+ path => '/Asset/Search/?' . (keys %search ? QueryString(%search) : ''),
+ );
+ } else {
+ $page->child('bulk',
+ title => HTML::Mason::Commands::loc('Bulk Update'),
+ path => '/Asset/Search/Bulk.html?' . (keys %search ? QueryString(%search) : ''),
+ );
+ }
+ $page->child('csv',
+ title => HTML::Mason::Commands::loc('Download Spreadsheet'),
+ path => '/Asset/Search/Results.tsv?' . (keys %search ? QueryString(%search) : ''),
+ );
+ } elsif ($request_path =~ m{^/Admin/Global/CustomFields/Catalog-Assets\.html$}) {
+ my $page = HTML::Mason::Commands::PageMenu();
+ $page->child("create", title => HTML::Mason::Commands::loc("Create New"), path => "/Admin/CustomFields/Modify.html?Create=1;LookupType=" . RT::Asset->CustomFieldLookupType);
+ } elsif ($request_path =~ m{^/Admin/CustomFields(/|/index\.html)?$}
+ and $HTML::Mason::Commands::DECODED_ARGS->{'Type'} and $HTML::Mason::Commands::DECODED_ARGS->{'Type'} eq RT::Asset->CustomFieldLookupType) {
+ my $page = HTML::Mason::Commands::PageMenu();
+ $page->child("create")->path( $page->child("create")->path . "&LookupType=" . RT::Asset->CustomFieldLookupType );
+ } elsif ($request_path =~ m{^/Admin/Assets/Catalogs/}) {
+ my $page = HTML::Mason::Commands::PageMenu();
+ my $actions = $request_path =~ m{/((index|Create)\.html)?$}
+ ? $page
+ : $page->child("catalogs", title => HTML::Mason::Commands::loc("Catalogs"), path => "/Admin/Assets/Catalogs/");
+
+ $actions->child("select", title => HTML::Mason::Commands::loc("Select"), path => "/Admin/Assets/Catalogs/");
+ $actions->child("create", title => HTML::Mason::Commands::loc("Create"), path => "/Admin/Assets/Catalogs/Create.html");
+
+ my $catalog = RT::Catalog->new( $HTML::Mason::Commands::session{CurrentUser} );
+ $catalog->Load($HTML::Mason::Commands::DECODED_ARGS->{id}) if $HTML::Mason::Commands::DECODED_ARGS->{id};
+
+ if ($catalog->id and $catalog->CurrentUserCanSee) {
+ my $query = "id=" . $catalog->id;
+ $page->child("modify", title => HTML::Mason::Commands::loc("Basics"), path => "/Admin/Assets/Catalogs/Modify.html?$query");
+ $page->child("people", title => HTML::Mason::Commands::loc("Roles"), path => "/Admin/Assets/Catalogs/Roles.html?$query");
+
+ $page->child("cfs", title => HTML::Mason::Commands::loc("Asset Custom Fields"), path => "/Admin/Assets/Catalogs/CustomFields.html?$query");
+
+ $page->child("group-rights", title => HTML::Mason::Commands::loc("Group Rights"), path => "/Admin/Assets/Catalogs/GroupRights.html?$query");
+ $page->child("user-rights", title => HTML::Mason::Commands::loc("User Rights"), path => "/Admin/Assets/Catalogs/UserRights.html?$query");
+ }
+ }
+
+ if ( $request_path =~ m{^/User/(Summary|History)\.html} ) {
+ if (HTML::Mason::Commands::PageMenu()->child('summary')) {
+ # Already set up from having AdminUser and ShowConfigTab;
+ # but rename "Basics" to "Edit" in this context
+ HTML::Mason::Commands::PageMenu()->child( 'basics' )->title( HTML::Mason::Commands::loc('Edit') );
+ } elsif ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'ShowUserHistory' ) ) {
+ HTML::Mason::Commands::PageMenu()->child( display => title => HTML::Mason::Commands::loc('Summary'), path => '/User/Summary.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
+ HTML::Mason::Commands::PageMenu()->child( history => title => HTML::Mason::Commands::loc('History'), path => '/User/History.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
+ }
+ }
+
+ if ( $request_path =~ /^\/(?:index.html|$)/ ) {
+ HTML::Mason::Commands::PageMenu()->child( edit => title => HTML::Mason::Commands::loc('Edit'), path => '/Prefs/MyRT.html' );
+ }
+
+ $HTML::Mason::Commands::m->callback( CallbackName => 'Privileged', Path => $request_path );
+}
+
+sub BuildAdminMenu {
+ my $request_path = shift;
+ my $top = shift;
+
+ my $admin = $top->child( admin => title => HTML::Mason::Commands::loc('Admin'), path => '/Admin/' );
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) {
+ my $users = $admin->child( users =>
+ title => HTML::Mason::Commands::loc('Users'),
+ description => HTML::Mason::Commands::loc('Manage users and passwords'),
+ path => '/Admin/Users/',
+ );
+ $users->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Users/" );
+ $users->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Users/Modify.html?Create=1" );
+ }
+ my $groups = $admin->child( groups =>
+ title => HTML::Mason::Commands::loc('Groups'),
+ description => HTML::Mason::Commands::loc('Manage groups and group membership'),
+ path => '/Admin/Groups/',
+ );
+ $groups->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Groups/" );
+ $groups->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Groups/Modify.html?Create=1" );
+
+ my $queues = $admin->child( queues =>
+ title => HTML::Mason::Commands::loc('Queues'),
+ description => HTML::Mason::Commands::loc('Manage queues and queue-specific properties'),
+ path => '/Admin/Queues/',
+ );
+ $queues->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Queues/" );
+ $queues->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" );
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomField' ) ) {
+ my $cfs = $admin->child( 'custom-fields' =>
+ title => HTML::Mason::Commands::loc('Custom Fields'),
+ description => HTML::Mason::Commands::loc('Manage custom fields and custom field values'),
+ path => '/Admin/CustomFields/',
+ );
+ $cfs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/CustomFields/" );
+ $cfs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/CustomFields/Modify.html?Create=1" );
+ }
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomRoles' ) ) {
+ my $roles = $admin->child( 'custom-roles' =>
+ title => HTML::Mason::Commands::loc('Custom Roles'),
+ description => HTML::Mason::Commands::loc('Manage custom roles'),
+ path => '/Admin/CustomRoles/',
+ );
+ $roles->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/CustomRoles/" );
+ $roles->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/CustomRoles/Modify.html?Create=1" );
+ }
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'ModifyScrips' ) ) {
+ my $scrips = $admin->child( 'scrips' =>
+ title => HTML::Mason::Commands::loc('Scrips'),
+ description => HTML::Mason::Commands::loc('Manage scrips'),
+ path => '/Admin/Scrips/',
+ );
+ $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Scrips/" );
+ $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html" );
+ }
+
+ my $admin_global = $admin->child( global =>
+ title => HTML::Mason::Commands::loc('Global'),
+ description => HTML::Mason::Commands::loc('Manage properties and configuration which apply to all queues'),
+ path => '/Admin/Global/',
+ );
+
+ my $scrips = $admin_global->child( scrips =>
+ title => HTML::Mason::Commands::loc('Scrips'),
+ description => HTML::Mason::Commands::loc('Modify scrips which apply to all queues'),
+ path => '/Admin/Global/Scrips.html',
+ );
+ $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Scrips.html" );
+ $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
+
+ my $templates = $admin_global->child( templates =>
+ title => HTML::Mason::Commands::loc('Templates'),
+ description => HTML::Mason::Commands::loc('Edit system templates'),
+ path => '/Admin/Global/Templates.html',
+ );
+ $templates->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Templates.html" );
+ $templates->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
+
+ my $cfadmin = $admin_global->child( 'custom-fields' =>
+ title => HTML::Mason::Commands::loc('Custom Fields'),
+ description => HTML::Mason::Commands::loc('Modify global custom fields'),
+ path => '/Admin/Global/CustomFields/index.html',
+ );
+ $cfadmin->child( users =>
+ title => HTML::Mason::Commands::loc('Users'),
+ description => HTML::Mason::Commands::loc('Select custom fields for all users'),
+ path => '/Admin/Global/CustomFields/Users.html',
+ );
+ $cfadmin->child( groups =>
+ title => HTML::Mason::Commands::loc('Groups'),
+ description => HTML::Mason::Commands::loc('Select custom fields for all user groups'),
+ path => '/Admin/Global/CustomFields/Groups.html',
+ );
+ $cfadmin->child( queues =>
+ title => HTML::Mason::Commands::loc('Queues'),
+ description => HTML::Mason::Commands::loc('Select custom fields for all queues'),
+ path => '/Admin/Global/CustomFields/Queues.html',
+ );
+ $cfadmin->child( tickets =>
+ title => HTML::Mason::Commands::loc('Tickets'),
+ description => HTML::Mason::Commands::loc('Select custom fields for tickets in all queues'),
+ path => '/Admin/Global/CustomFields/Queue-Tickets.html',
+ );
+ $cfadmin->child( transactions =>
+ title => HTML::Mason::Commands::loc('Ticket Transactions'),
+ description => HTML::Mason::Commands::loc('Select custom fields for transactions on tickets in all queues'),
+ path => '/Admin/Global/CustomFields/Queue-Transactions.html',
+ );
+ $cfadmin->child( 'custom-fields' =>
+ title => HTML::Mason::Commands::loc('Articles'),
+ description => HTML::Mason::Commands::loc('Select Custom Fields for Articles in all Classes'),
+ path => '/Admin/Global/CustomFields/Class-Article.html',
+ );
+ $cfadmin->child( 'assets' =>
+ title => HTML::Mason::Commands::loc('Assets'),
+ description => HTML::Mason::Commands::loc('Select Custom Fields for Assets in all Catalogs'),
+ path => '/Admin/Global/CustomFields/Catalog-Assets.html',
+ );
+
+ my $article_admin = $admin->child( articles => title => HTML::Mason::Commands::loc('Articles'), path => "/Admin/Articles/index.html" );
+ my $class_admin = $article_admin->child(classes => title => HTML::Mason::Commands::loc('Classes'), path => '/Admin/Articles/Classes/' );
+ $class_admin->child( select =>
+ title => HTML::Mason::Commands::loc('Select'),
+ description => HTML::Mason::Commands::loc('Modify and Create Classes'),
+ path => '/Admin/Articles/Classes/',
+ );
+ $class_admin->child( create =>
+ title => HTML::Mason::Commands::loc('Create'),
+ description => HTML::Mason::Commands::loc('Modify and Create Custom Fields for Articles'),
+ path => '/Admin/Articles/Classes/Modify.html?Create=1',
+ );
+
+
+ my $cfs = $article_admin->child( 'custom-fields' =>
+ title => HTML::Mason::Commands::loc('Custom Fields'),
+ path => '/Admin/CustomFields/index.html?'.$HTML::Mason::Commands::m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
+ );
+ $cfs->child( select =>
+ title => HTML::Mason::Commands::loc('Select'),
+ path => '/Admin/CustomFields/index.html?'.$HTML::Mason::Commands::m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
+ );
+ $cfs->child( create =>
+ title => HTML::Mason::Commands::loc('Create'),
+ path => '/Admin/CustomFields/Modify.html?'.$HTML::Mason::Commands::m->comp("/Elements/QueryString", Create=>1, LookupType=> "RT::Class-RT::Article" ),
+ );
+
+ my $assets_admin = $admin->child( assets => title => HTML::Mason::Commands::loc("Assets"), path => '/Admin/Assets/' );
+ my $catalog_admin = $assets_admin->child( catalogs =>
+ title => HTML::Mason::Commands::loc("Catalogs"),
+ description => HTML::Mason::Commands::loc("Modify asset catalogs"),
+ path => "/Admin/Assets/Catalogs/"
+ );
+ $catalog_admin->child( "select", title => HTML::Mason::Commands::loc("Select"), path => $catalog_admin->path );
+ $catalog_admin->child( "create", title => HTML::Mason::Commands::loc("Create"), path => "Create.html" );
+
+
+ my $assets_cfs = $assets_admin->child( "cfs",
+ title => HTML::Mason::Commands::loc("Custom Fields"),
+ description => HTML::Mason::Commands::loc("Modify asset custom fields"),
+ path => "/Admin/CustomFields/?Type=" . RT::Asset->CustomFieldLookupType
+ );
+ $assets_cfs->child( "select", title => HTML::Mason::Commands::loc("Select"), path => $assets_cfs->path );
+ $assets_cfs->child( "create", title => HTML::Mason::Commands::loc("Create"), path => "/Admin/CustomFields/Modify.html?Create=1&LookupType=" . RT::Asset->CustomFieldLookupType);
+
+ $admin_global->child( 'group-rights' =>
+ title => HTML::Mason::Commands::loc('Group Rights'),
+ description => HTML::Mason::Commands::loc('Modify global group rights'),
+ path => '/Admin/Global/GroupRights.html',
+ );
+ $admin_global->child( 'user-rights' =>
+ title => HTML::Mason::Commands::loc('User Rights'),
+ description => HTML::Mason::Commands::loc('Modify global user rights'),
+ path => '/Admin/Global/UserRights.html',
+ );
+ $admin_global->child( 'my-rt' =>
+ title => HTML::Mason::Commands::loc('RT at a glance'),
+ description => HTML::Mason::Commands::loc('Modify the default "RT at a glance" view'),
+ path => '/Admin/Global/MyRT.html',
+ );
+ $admin_global->child( 'dashboards-in-menu' =>
+ title => HTML::Mason::Commands::loc('Dashboards in menu'),
+ description => HTML::Mason::Commands::loc('Customize dashboards in menu'),
+ path => '/Admin/Global/DashboardsInMenu.html',
+ );
+ $admin_global->child( 'topics' =>
+ title => HTML::Mason::Commands::loc('Topics'),
+ description => HTML::Mason::Commands::loc('Modify global article topics'),
+ path => '/Admin/Global/Topics.html',
+ );
+
+ my $admin_tools = $admin->child( tools =>
+ title => HTML::Mason::Commands::loc('Tools'),
+ description => HTML::Mason::Commands::loc('Use other RT administrative tools'),
+ path => '/Admin/Tools/',
+ );
+ $admin_tools->child( configuration =>
+ title => HTML::Mason::Commands::loc('System Configuration'),
+ description => HTML::Mason::Commands::loc('Detailed information about your RT setup'),
+ path => '/Admin/Tools/Configuration.html',
+ );
+ $admin_tools->child( theme =>
+ title => HTML::Mason::Commands::loc('Theme'),
+ description => HTML::Mason::Commands::loc('Customize the look of your RT'),
+ path => '/Admin/Tools/Theme.html',
+ );
+ if (RT->Config->Get('StatementLog')
+ && $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
+ $admin_tools->child( 'sql-queries' =>
+ title => HTML::Mason::Commands::loc('SQL Queries'),
+ description => HTML::Mason::Commands::loc('Browse the SQL queries made in this process'),
+ path => '/Admin/Tools/Queries.html',
+ );
+ }
+ $admin_tools->child( shredder =>
+ title => HTML::Mason::Commands::loc('Shredder'),
+ description => HTML::Mason::Commands::loc('Permanently wipeout data from RT'),
+ path => '/Admin/Tools/Shredder',
+ );
+
+ if ( $request_path =~ m{^/Admin/(Queues|Users|Groups|CustomFields|CustomRoles)} ) {
+ my $type = $1;
+ my $tabs = HTML::Mason::Commands::PageMenu();
+
+ my %labels = (
+ Queues => HTML::Mason::Commands::loc("Queues"),
+ Users => HTML::Mason::Commands::loc("Users"),
+ Groups => HTML::Mason::Commands::loc("Groups"),
+ CustomFields => HTML::Mason::Commands::loc("Custom Fields"),
+ CustomRoles => HTML::Mason::Commands::loc("Custom Roles"),
+ );
+
+ my $section;
+ if ( $request_path =~ m|^/Admin/$type/?(?:index.html)?$|
+ || ( $request_path =~ m|^/Admin/$type/(?:Modify.html)$|
+ && $HTML::Mason::Commands::DECODED_ARGS->{'Create'} )
+ )
+ {
+ $section = $tabs;
+
+ } else {
+ $section = $tabs->child( select => title => $labels{$type},
+ path => "/Admin/$type/" );
+ }
+
+ $section->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/$type/" );
+ $section->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/$type/Modify.html?Create=1" );
+ }
+
+ if ( $request_path =~ m{^/Admin/Queues} ) {
+ if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/
+ ||
+ $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} && $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} =~ /^\d+$/
+ ) {
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} || $HTML::Mason::Commands::DECODED_ARGS->{'id'};
+ my $queue_obj = RT::Queue->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $queue_obj->Load($id);
+
+ if ( $queue_obj and $queue_obj->id ) {
+ my $queue = HTML::Mason::Commands::PageMenu();
+ $queue->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Queues/Modify.html?id=" . $id );
+ $queue->child( people => title => HTML::Mason::Commands::loc('Watchers'), path => "/Admin/Queues/People.html?id=" . $id );
+
+ my $templates = $queue->child(templates => title => HTML::Mason::Commands::loc('Templates'), path => "/Admin/Queues/Templates.html?id=" . $id);
+ $templates->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Queues/Templates.html?id=".$id);
+ $templates->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Queues/Template.html?Create=1;Queue=".$id);
+
+ my $scrips = $queue->child( scrips => title => HTML::Mason::Commands::loc('Scrips'), path => "/Admin/Queues/Scrips.html?id=" . $id);
+ $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Queues/Scrips.html?id=" . $id );
+ $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html?Queue=" . $id);
+
+ my $cfs = $queue->child( 'custom-fields' => title => HTML::Mason::Commands::loc('Custom Fields') );
+ my $ticket_cfs = $cfs->child( 'tickets' => title => HTML::Mason::Commands::loc('Tickets'),
+ path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket&id=' . $id );
+
+ my $txn_cfs = $cfs->child( 'transactions' => title => HTML::Mason::Commands::loc('Transactions'),
+ path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id );
+
+ $queue->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/Queues/GroupRights.html?id=".$id );
+ $queue->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/Queues/UserRights.html?id=" . $id );
+ $queue->child( 'history' => title => HTML::Mason::Commands::loc('History'), path => "/Admin/Queues/History.html?id=" . $id );
+ $queue->child( 'default-values' => title => HTML::Mason::Commands::loc('Default Values'), path => "/Admin/Queues/DefaultValues.html?id=" . $id );
+
+ $HTML::Mason::Commands::m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue);
+ }
+ }
+ }
+ if ( $request_path =~ m{^(/Admin/Users|/User/(Summary|History)\.html)} and $admin->child("users") ) {
+ if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
+ my $obj = RT::User->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ if ( $obj and $obj->id ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id );
+ $tabs->child( memberships => title => HTML::Mason::Commands::loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id );
+ $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Admin/Users/History.html?id=" . $id );
+ $tabs->child( 'my-rt' => title => HTML::Mason::Commands::loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id );
+ $tabs->child( 'dashboards-in-menu' =>
+ title => HTML::Mason::Commands::loc('Dashboards in menu'),
+ path => '/Admin/Users/DashboardsInMenu.html?id=' . $id,
+ );
+ if ( RT->Config->Get('Crypt')->{'Enable'} ) {
+ $tabs->child( keys => title => HTML::Mason::Commands::loc('Private keys'), path => "/Admin/Users/Keys.html?id=" . $id );
+ }
+ $tabs->child( 'summary' => title => HTML::Mason::Commands::loc('User Summary'), path => "/User/Summary.html?id=" . $id );
+ }
+ }
+
+ }
+
+ if ( $request_path =~ m{^/Admin/Groups} ) {
+ if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
+ my $obj = RT::Group->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ if ( $obj and $obj->id ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id );
+ $tabs->child( members => title => HTML::Mason::Commands::loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id );
+ $tabs->child( memberships => title => HTML::Mason::Commands::loc('Memberships'), path => "/Admin/Groups/Memberships.html?id=" . $obj->id );
+ $tabs->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id );
+ $tabs->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id );
+ $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id );
+ }
+ }
+ }
+
+ if ( $request_path =~ m{^/Admin/CustomFields/} ) {
+ if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
+ my $obj = RT::CustomField->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ if ( $obj and $obj->id ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id );
+ $tabs->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id );
+ $tabs->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id );
+ unless ( $obj->IsOnlyGlobal ) {
+ $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id );
+ }
+ }
+ }
+ }
+
+ if ( $request_path =~ m{^/Admin/CustomRoles} ) {
+ if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
+ my $obj = RT::CustomRole->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ if ( $obj and $obj->id ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/CustomRoles/Modify.html?id=".$id );
+ $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/CustomRoles/Objects.html?id=" . $id );
+ }
+ }
+ }
+
+ if ( $request_path =~ m{^/Admin/Scrips/} ) {
+ if ( $HTML::Mason::Commands::m->request_args->{'id'} && $HTML::Mason::Commands::m->request_args->{'id'} =~ /^\d+$/ ) {
+ my $id = $HTML::Mason::Commands::m->request_args->{'id'};
+ my $obj = RT::Scrip->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ my $tabs = HTML::Mason::Commands::PageMenu();
+
+ my ( $admin_cat, $create_path_arg, $from_query_param );
+ my $from_arg = $HTML::Mason::Commands::DECODED_ARGS->{'From'} || q{};
+ my ($from_queue) = $from_arg =~ /^(\d+)$/;
+ if ( $from_queue ) {
+ $admin_cat = "Queues/Scrips.html?id=$from_queue";
+ $create_path_arg = "?Queue=$from_queue";
+ $from_query_param = "&From=$from_queue";
+ }
+ elsif ( $from_arg eq 'Global' ) {
+ $admin_cat = 'Global/Scrips.html';
+ $create_path_arg = '?Global=1';
+ $from_query_param = '&From=Global';
+ }
+ else {
+ $admin_cat = 'Scrips';
+ $from_query_param = $create_path_arg = q{};
+ }
+ my $scrips = $tabs->child( scrips => title => HTML::Mason::Commands::loc('Scrips'), path => "/Admin/${admin_cat}" );
+ $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/${admin_cat}" );
+ $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html${create_path_arg}" );
+
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics') => path => "/Admin/Scrips/Modify.html?id=" . $id . $from_query_param );
+ $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id . $from_query_param );
+ }
+ elsif ( $request_path =~ m{^/Admin/Scrips/(index\.html)?$} ) {
+ HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Scrips/" );
+ HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html" );
+ }
+ elsif ( $request_path =~ m{^/Admin/Scrips/Create\.html$} ) {
+ my ($queue) = $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} && $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} =~ /^(\d+)$/;
+ my $global_arg = $HTML::Mason::Commands::DECODED_ARGS->{'Global'};
+ if ($queue) {
+ HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Queues/Scrips.html?id=$queue" );
+ HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html?Queue=$queue" );
+ } elsif ($global_arg) {
+ HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Global/Scrips.html" );
+ HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html?Global=1" );
+ } else {
+ HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Scrips" );
+ HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html" );
+ }
+ }
+ }
+
+ if ( $request_path =~ m{^/Admin/Global/Scrips\.html} ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Scrips.html" );
+ $tabs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
+ }
+
+ if ( $request_path =~ m{^/Admin/Global/Templates?\.html} ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ $tabs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Templates.html" );
+ $tabs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
+ }
+
+ if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
+ my $tabs = HTML::Mason::Commands::PageMenu();
+ if ( my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'} ) {
+ my $obj = RT::Class->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $obj->Load($id);
+
+ if ( $obj and $obj->id ) {
+ my $section = $tabs->child( select => title => HTML::Mason::Commands::loc("Classes"), path => "/Admin/Articles/Classes/" );
+ $section->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Articles/Classes/" );
+ $section->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
+
+ $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id );
+ $tabs->child( topics => title => HTML::Mason::Commands::loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id );
+ $tabs->child( 'custom-fields' => title => HTML::Mason::Commands::loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id );
+ $tabs->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id );
+ $tabs->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id );
+ $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" );
+ }
+ } else {
+ $tabs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Articles/Classes/" );
+ $tabs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
+ }
+ }
+}
+
+sub BuildSelfServiceNav {
+ my $request_path = shift;
+
+ my $queues = RT::Queues->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ $queues->UnLimit;
+
+ my $queue_count = 0;
+ my $queue_id;
+
+ while ( my $queue = $queues->Next ) {
+ next unless $queue->CurrentUserHasRight('CreateTicket');
+ $queue_id = $queue->id;
+ $queue_count++;
+ last if ( $queue_count > 1 );
+ }
+
+
+ if ( $queue_count > 1 ) {
+ HTML::Mason::Commands::Menu()->child( new => title => HTML::Mason::Commands::loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
+ } elsif ( $queue_id ) {
+ HTML::Mason::Commands::Menu()->child( new => title => HTML::Mason::Commands::loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
+ }
+ my $tickets = HTML::Mason::Commands::Menu()->child( tickets => title => HTML::Mason::Commands::loc('Tickets'), path => '/SelfService/' );
+ $tickets->child( open => title => HTML::Mason::Commands::loc('Open tickets'), path => '/SelfService/' );
+ $tickets->child( closed => title => HTML::Mason::Commands::loc('Closed tickets'), path => '/SelfService/Closed.html' );
+
+ HTML::Mason::Commands::Menu()->child( "assets", title => HTML::Mason::Commands::loc("Assets"), path => "/SelfService/Asset/" )
+ if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
+
+ my $username = '<span class="current-user">'
+ . $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
+ . '</span>';
+ my $about_me = HTML::Mason::Commands::Menu()->child( preferences =>
+ title => HTML::Mason::Commands::loc('Logged in as [_1]', $username),
+ escape_title => 0,
+ sort_order => 99,
+ );
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System ) ) {
+ $about_me->child( prefs => title => HTML::Mason::Commands::loc('Preferences'), path => '/SelfService/Prefs.html' );
+ }
+
+ if ( $HTML::Mason::Commands::session{'CurrentUser'}->Name
+ && ( !RT->Config->Get('WebRemoteUserAuth')
+ || RT->Config->Get('WebFallbackToRTLogin') )) {
+ $about_me->child( logout => title => HTML::Mason::Commands::loc('Logout'), path => '/NoAuth/Logout.html' );
+ }
+
+ if ($HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowArticle', Object => RT->System )) {
+ HTML::Mason::Commands::PageWidgets()->child( 'goto-article' => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/SearchArticle') );
+ }
+
+ HTML::Mason::Commands::PageWidgets()->child( goto => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/GotoTicket') );
+
+ if ($request_path =~ m{^/SelfService/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id}) {
+ my $page = HTML::Mason::Commands::PageMenu();
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
+ $page->child("display", title => HTML::Mason::Commands::loc("Display"), path => "/SelfService/Asset/Display.html?id=$id");
+ $page->child("history", title => HTML::Mason::Commands::loc("History"), path => "/SelfService/Asset/History.html?id=$id");
+
+ if (Menu->child("new")) {
+ my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
+ $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id");
+ }
+ }
+
+ $HTML::Mason::Commands::m->callback( CallbackName => 'SelfService', Path => $request_path );
+}
+
+1;
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 866e8f2..4cdf0a1 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -52,1135 +52,11 @@
my $request_path = $HTML::Mason::Commands::r->path_info;
$request_path =~ s!/{2,}!/!g;
-my $query_string = sub {
- my %args = @_;
- my $u = URI->new();
- $u->query_form(map { $_ => $args{$_} } sort keys %args);
- return $u->query;
-};
-
-my $build_admin_menu = sub {
- my $top = shift;
- my $admin = $top->child( admin => title => loc('Admin'), path => '/Admin/' );
- if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) {
- my $users = $admin->child( users =>
- title => loc('Users'),
- description => loc('Manage users and passwords'),
- path => '/Admin/Users/',
- );
- $users->child( select => title => loc('Select'), path => "/Admin/Users/" );
- $users->child( create => title => loc('Create'), path => "/Admin/Users/Modify.html?Create=1" );
- }
- my $groups = $admin->child( groups =>
- title => loc('Groups'),
- description => loc('Manage groups and group membership'),
- path => '/Admin/Groups/',
- );
- $groups->child( select => title => loc('Select'), path => "/Admin/Groups/" );
- $groups->child( create => title => loc('Create'), path => "/Admin/Groups/Modify.html?Create=1" );
-
- my $queues = $admin->child( queues =>
- title => loc('Queues'),
- description => loc('Manage queues and queue-specific properties'),
- path => '/Admin/Queues/',
- );
- $queues->child( select => title => loc('Select'), path => "/Admin/Queues/" );
- $queues->child( create => title => loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" );
-
- if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomField' ) ) {
- my $cfs = $admin->child( 'custom-fields' =>
- title => loc('Custom Fields'),
- description => loc('Manage custom fields and custom field values'),
- path => '/Admin/CustomFields/',
- );
- $cfs->child( select => title => loc('Select'), path => "/Admin/CustomFields/" );
- $cfs->child( create => title => loc('Create'), path => "/Admin/CustomFields/Modify.html?Create=1" );
- }
-
- if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomRoles' ) ) {
- my $roles = $admin->child( 'custom-roles' =>
- title => loc('Custom Roles'),
- description => loc('Manage custom roles'),
- path => '/Admin/CustomRoles/',
- );
- $roles->child( select => title => loc('Select'), path => "/Admin/CustomRoles/" );
- $roles->child( create => title => loc('Create'), path => "/Admin/CustomRoles/Modify.html?Create=1" );
- }
-
- if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'ModifyScrips' ) ) {
- my $scrips = $admin->child( 'scrips' =>
- title => loc('Scrips'),
- description => loc('Manage scrips'),
- path => '/Admin/Scrips/',
- );
- $scrips->child( select => title => loc('Select'), path => "/Admin/Scrips/" );
- $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html" );
- }
-
- my $admin_global = $admin->child( global =>
- title => loc('Global'),
- description => loc('Manage properties and configuration which apply to all queues'),
- path => '/Admin/Global/',
- );
-
- my $scrips = $admin_global->child( scrips =>
- title => loc('Scrips'),
- description => loc('Modify scrips which apply to all queues'),
- path => '/Admin/Global/Scrips.html',
- );
- $scrips->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
- $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
-
- my $templates = $admin_global->child( templates =>
- title => loc('Templates'),
- description => loc('Edit system templates'),
- path => '/Admin/Global/Templates.html',
- );
- $templates->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
- $templates->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
-
- my $cfadmin = $admin_global->child( 'custom-fields' =>
- title => loc('Custom Fields'),
- description => loc('Modify global custom fields'),
- path => '/Admin/Global/CustomFields/index.html',
- );
- $cfadmin->child( users =>
- title => loc('Users'),
- description => loc('Select custom fields for all users'),
- path => '/Admin/Global/CustomFields/Users.html',
- );
- $cfadmin->child( groups =>
- title => loc('Groups'),
- description => loc('Select custom fields for all user groups'),
- path => '/Admin/Global/CustomFields/Groups.html',
- );
- $cfadmin->child( queues =>
- title => loc('Queues'),
- description => loc('Select custom fields for all queues'),
- path => '/Admin/Global/CustomFields/Queues.html',
- );
- $cfadmin->child( tickets =>
- title => loc('Tickets'),
- description => loc('Select custom fields for tickets in all queues'),
- path => '/Admin/Global/CustomFields/Queue-Tickets.html',
- );
- $cfadmin->child( transactions =>
- title => loc('Ticket Transactions'),
- description => loc('Select custom fields for transactions on tickets in all queues'),
- path => '/Admin/Global/CustomFields/Queue-Transactions.html',
- );
- $cfadmin->child( 'custom-fields' =>
- title => loc('Articles'),
- description => loc('Select Custom Fields for Articles in all Classes'),
- path => '/Admin/Global/CustomFields/Class-Article.html',
- );
- $cfadmin->child( 'assets' =>
- title => loc('Assets'),
- description => loc('Select Custom Fields for Assets in all Catalogs'),
- path => '/Admin/Global/CustomFields/Catalog-Assets.html',
- );
-
- my $article_admin = $admin->child( articles => title => loc('Articles'), path => "/Admin/Articles/index.html" );
- my $class_admin = $article_admin->child(classes => title => loc('Classes'), path => '/Admin/Articles/Classes/' );
- $class_admin->child( select =>
- title => loc('Select'),
- description => loc('Modify and Create Classes'),
- path => '/Admin/Articles/Classes/',
- );
- $class_admin->child( create =>
- title => loc('Create'),
- description => loc('Modify and Create Custom Fields for Articles'),
- path => '/Admin/Articles/Classes/Modify.html?Create=1',
- );
-
-
- my $cfs = $article_admin->child( 'custom-fields' =>
- title => loc('Custom Fields'),
- path => '/Admin/CustomFields/index.html?'.$m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
- );
- $cfs->child( select =>
- title => loc('Select'),
- path => '/Admin/CustomFields/index.html?'.$m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
- );
- $cfs->child( create =>
- title => loc('Create'),
- path => '/Admin/CustomFields/Modify.html?'.$m->comp("/Elements/QueryString", Create=>1, LookupType=> "RT::Class-RT::Article" ),
- );
-
- my $assets_admin = $admin->child( assets => title => loc("Assets"), path => '/Admin/Assets/' );
- my $catalog_admin = $assets_admin->child( catalogs =>
- title => loc("Catalogs"),
- description => loc("Modify asset catalogs"),
- path => "/Admin/Assets/Catalogs/"
- );
- $catalog_admin->child( "select", title => loc("Select"), path => $catalog_admin->path );
- $catalog_admin->child( "create", title => loc("Create"), path => "Create.html" );
-
-
- my $assets_cfs = $assets_admin->child( "cfs",
- title => loc("Custom Fields"),
- description => loc("Modify asset custom fields"),
- path => "/Admin/CustomFields/?Type=" . RT::Asset->CustomFieldLookupType
- );
- $assets_cfs->child( "select", title => loc("Select"), path => $assets_cfs->path );
- $assets_cfs->child( "create", title => loc("Create"), path => "/Admin/CustomFields/Modify.html?Create=1&LookupType=" . RT::Asset->CustomFieldLookupType);
-
- $admin_global->child( 'group-rights' =>
- title => loc('Group Rights'),
- description => loc('Modify global group rights'),
- path => '/Admin/Global/GroupRights.html',
- );
- $admin_global->child( 'user-rights' =>
- title => loc('User Rights'),
- description => loc('Modify global user rights'),
- path => '/Admin/Global/UserRights.html',
- );
- $admin_global->child( 'my-rt' =>
- title => loc('RT at a glance'),
- description => loc('Modify the default "RT at a glance" view'),
- path => '/Admin/Global/MyRT.html',
- );
- $admin_global->child( 'dashboards-in-menu' =>
- title => loc('Dashboards in menu'),
- description => loc('Customize dashboards in menu'),
- path => '/Admin/Global/DashboardsInMenu.html',
- );
- $admin_global->child( 'topics' =>
- title => loc('Topics'),
- description => loc('Modify global article topics'),
- path => '/Admin/Global/Topics.html',
- );
-
- my $admin_tools = $admin->child( tools =>
- title => loc('Tools'),
- description => loc('Use other RT administrative tools'),
- path => '/Admin/Tools/',
- );
- $admin_tools->child( configuration =>
- title => loc('System Configuration'),
- description => loc('Detailed information about your RT setup'),
- path => '/Admin/Tools/Configuration.html',
- );
- $admin_tools->child( theme =>
- title => loc('Theme'),
- description => loc('Customize the look of your RT'),
- path => '/Admin/Tools/Theme.html',
- );
- if (RT->Config->Get('StatementLog')
- && $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
- $admin_tools->child( 'sql-queries' =>
- title => loc('SQL Queries'),
- description => loc('Browse the SQL queries made in this process'),
- path => '/Admin/Tools/Queries.html',
- );
- }
- $admin_tools->child( shredder =>
- title => loc('Shredder'),
- description => loc('Permanently wipeout data from RT'),
- path => '/Admin/Tools/Shredder',
- );
-
- if ( $request_path =~ m{^/Admin/(Queues|Users|Groups|CustomFields|CustomRoles)} ) {
- my $type = $1;
- my $tabs = PageMenu();
-
- my %labels = (
- Queues => loc("Queues"),
- Users => loc("Users"),
- Groups => loc("Groups"),
- CustomFields => loc("Custom Fields"),
- CustomRoles => loc("Custom Roles"),
- );
-
- my $section;
- if ( $request_path =~ m|^/Admin/$type/?(?:index.html)?$|
- || ( $request_path =~ m|^/Admin/$type/(?:Modify.html)$|
- && $DECODED_ARGS->{'Create'} )
- )
- {
- $section = $tabs;
-
- } else {
- $section = $tabs->child( select => title => $labels{$type},
- path => "/Admin/$type/" );
- }
-
- $section->child( select => title => loc('Select'), path => "/Admin/$type/" );
- $section->child( create => title => loc('Create'), path => "/Admin/$type/Modify.html?Create=1" );
- }
-
- if ( $request_path =~ m{^/Admin/Queues} ) {
- if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/
- ||
- $DECODED_ARGS->{'Queue'} && $DECODED_ARGS->{'Queue'} =~ /^\d+$/
- ) {
- my $id = $DECODED_ARGS->{'Queue'} || $DECODED_ARGS->{'id'};
- my $queue_obj = RT::Queue->new( $session{'CurrentUser'} );
- $queue_obj->Load($id);
-
- if ( $queue_obj and $queue_obj->id ) {
- my $queue = PageMenu();
- $queue->child( basics => title => loc('Basics'), path => "/Admin/Queues/Modify.html?id=" . $id );
- $queue->child( people => title => loc('Watchers'), path => "/Admin/Queues/People.html?id=" . $id );
-
- my $templates = $queue->child(templates => title => loc('Templates'), path => "/Admin/Queues/Templates.html?id=" . $id);
- $templates->child( select => title => loc('Select'), path => "/Admin/Queues/Templates.html?id=".$id);
- $templates->child( create => title => loc('Create'), path => "/Admin/Queues/Template.html?Create=1;Queue=".$id);
-
- my $scrips = $queue->child( scrips => title => loc('Scrips'), path => "/Admin/Queues/Scrips.html?id=" . $id);
- $scrips->child( select => title => loc('Select'), path => "/Admin/Queues/Scrips.html?id=" . $id );
- $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Queue=" . $id);
-
- my $cfs = $queue->child( 'custom-fields' => title => loc('Custom Fields') );
- my $ticket_cfs = $cfs->child( 'tickets' => title => loc('Tickets'),
- path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket&id=' . $id );
-
- my $txn_cfs = $cfs->child( 'transactions' => title => loc('Transactions'),
- path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id );
-
- $queue->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Queues/GroupRights.html?id=".$id );
- $queue->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Queues/UserRights.html?id=" . $id );
- $queue->child( 'history' => title => loc('History'), path => "/Admin/Queues/History.html?id=" . $id );
- $queue->child( 'default-values' => title => loc('Default Values'), path => "/Admin/Queues/DefaultValues.html?id=" . $id );
-
- $m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue);
- }
- }
- }
- if ( $request_path =~ m{^(/Admin/Users|/User/(Summary|History)\.html)} and $admin->child("users") ) {
- if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
- my $id = $DECODED_ARGS->{'id'};
- my $obj = RT::User->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- if ( $obj and $obj->id ) {
- my $tabs = PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id );
- $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id );
- $tabs->child( history => title => loc('History'), path => "/Admin/Users/History.html?id=" . $id );
- $tabs->child( 'my-rt' => title => loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id );
- $tabs->child( 'dashboards-in-menu' =>
- title => loc('Dashboards in menu'),
- path => '/Admin/Users/DashboardsInMenu.html?id=' . $id,
- );
- if ( RT->Config->Get('Crypt')->{'Enable'} ) {
- $tabs->child( keys => title => loc('Private keys'), path => "/Admin/Users/Keys.html?id=" . $id );
- }
- $tabs->child( 'summary' => title => loc('User Summary'), path => "/User/Summary.html?id=" . $id );
- }
- }
-
- }
-
- if ( $request_path =~ m{^/Admin/Groups} ) {
- if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
- my $id = $DECODED_ARGS->{'id'};
- my $obj = RT::Group->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- if ( $obj and $obj->id ) {
- my $tabs = PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id );
- $tabs->child( members => title => loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id );
- $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Groups/Memberships.html?id=" . $obj->id );
- $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id );
- $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id );
- $tabs->child( history => title => loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id );
- }
- }
- }
-
- if ( $request_path =~ m{^/Admin/CustomFields/} ) {
- if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
- my $id = $DECODED_ARGS->{'id'};
- my $obj = RT::CustomField->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- if ( $obj and $obj->id ) {
- my $tabs = PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id );
- $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id );
- $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id );
- unless ( $obj->IsOnlyGlobal ) {
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id );
- }
- }
- }
- }
-
- if ( $request_path =~ m{^/Admin/CustomRoles} ) {
- if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
- my $id = $DECODED_ARGS->{'id'};
- my $obj = RT::CustomRole->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- if ( $obj and $obj->id ) {
- my $tabs = PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomRoles/Modify.html?id=".$id );
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomRoles/Objects.html?id=" . $id );
- }
- }
- }
-
- if ( $request_path =~ m{^/Admin/Scrips/} ) {
- if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
- my $id = $m->request_args->{'id'};
- my $obj = RT::Scrip->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- my $tabs = PageMenu();
-
- my ( $admin_cat, $create_path_arg, $from_query_param );
- my $from_arg = $DECODED_ARGS->{'From'} || q{};
- my ($from_queue) = $from_arg =~ /^(\d+)$/;
- if ( $from_queue ) {
- $admin_cat = "Queues/Scrips.html?id=$from_queue";
- $create_path_arg = "?Queue=$from_queue";
- $from_query_param = "&From=$from_queue";
- }
- elsif ( $from_arg eq 'Global' ) {
- $admin_cat = 'Global/Scrips.html';
- $create_path_arg = '?Global=1';
- $from_query_param = '&From=Global';
- }
- else {
- $admin_cat = 'Scrips';
- $from_query_param = $create_path_arg = q{};
- }
- my $scrips = $tabs->child( scrips => title => loc('Scrips'), path => "/Admin/${admin_cat}" );
- $scrips->child( select => title => loc('Select'), path => "/Admin/${admin_cat}" );
- $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html${create_path_arg}" );
-
- $tabs->child( basics => title => loc('Basics') => path => "/Admin/Scrips/Modify.html?id=" . $id . $from_query_param );
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id . $from_query_param );
- }
- elsif ( $request_path =~ m{^/Admin/Scrips/(index\.html)?$} ) {
- PageMenu->child( select => title => loc('Select') => path => "/Admin/Scrips/" );
- PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html" );
- }
- elsif ( $request_path =~ m{^/Admin/Scrips/Create\.html$} ) {
- my ($queue) = $DECODED_ARGS->{'Queue'} && $DECODED_ARGS->{'Queue'} =~ /^(\d+)$/;
- my $global_arg = $DECODED_ARGS->{'Global'};
- if ($queue) {
- PageMenu->child( select => title => loc('Select') => path => "/Admin/Queues/Scrips.html?id=$queue" );
- PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html?Queue=$queue" );
- } elsif ($global_arg) {
- PageMenu->child( select => title => loc('Select') => path => "/Admin/Global/Scrips.html" );
- PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html?Global=1" );
- } else {
- PageMenu->child( select => title => loc('Select') => path => "/Admin/Scrips" );
- PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html" );
- }
- }
- }
-
- if ( $request_path =~ m{^/Admin/Global/Scrips\.html} ) {
- my $tabs = PageMenu();
- $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
- $tabs->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
- }
-
- if ( $request_path =~ m{^/Admin/Global/Templates?\.html} ) {
- my $tabs = PageMenu();
- $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
- $tabs->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
- }
-
- if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
- my $tabs = PageMenu();
- if ( my $id = $DECODED_ARGS->{'id'} ) {
- my $obj = RT::Class->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- if ( $obj and $obj->id ) {
- my $section = $tabs->child( select => title => loc("Classes"), path => "/Admin/Articles/Classes/" );
- $section->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
- $section->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
-
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id );
- $tabs->child( topics => title => loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id );
- $tabs->child( 'custom-fields' => title => loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id );
- $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id );
- $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id );
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" );
- }
- } else {
- $tabs->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
- $tabs->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
- }
- }
-};
-
-my $build_main_nav = sub {
-
- if ($request_path =~ m{^/Asset/}) {
- PageWidgets()->child( asset_search => raw_html => $m->scomp('/Asset/Elements/Search') );
- } else {
- PageWidgets()->child( simple_search => raw_html => $m->scomp('SimpleSearch') );
- PageWidgets()->child( create_ticket => raw_html => $m->scomp('CreateTicket') );
- }
-
- my $home = Menu->child( home => title => loc('Homepage'), path => '/' );
- unless ($session{'dashboards_in_menu'}) {
- my $dashboards_in_menu = $session{CurrentUser}->UserObj->Preferences(
- 'DashboardsInMenu',
- {},
- );
-
- unless ($dashboards_in_menu->{dashboards}) {
- my ($default_dashboards) =
- RT::System->new( $session{'CurrentUser'} )
- ->Attributes
- ->Named('DashboardsInMenu');
- if ($default_dashboards) {
- $dashboards_in_menu = $default_dashboards->Content;
- }
- }
-
- $session{'dashboards_in_menu'} = $dashboards_in_menu->{dashboards} || [];
- }
-
- my @dashboards;
- for my $id ( @{$session{'dashboards_in_menu'}} ) {
- my $dash = RT::Dashboard->new( $session{CurrentUser} );
- my ( $status, $msg ) = $dash->LoadById($id);
- if ( $status ) {
- push @dashboards, $dash;
- } else {
- $RT::Logger->warning( "Failed to load dashboard $id: $msg" );
- }
- }
-
- my $dashes = Menu()->child('home');
- if (@dashboards) {
- for my $dash (@dashboards) {
- $home->child( 'dashboard-' . $dash->id,
- title => $dash->Name,
- path => '/Dashboards/' . $dash->id . '/' . $dash->Name
- );
- }
- }
- $dashes->child( edit => title => loc('Update This Menu'), path => 'Prefs/DashboardsInMenu.html' );
- $dashes->child( more => title => loc('All Dashboards'), path => 'Dashboards/index.html' );
- my $dashboard = RT::Dashboard->new( $session{CurrentUser} );
- if ( $dashboard->CurrentUserCanCreateAny ) {
- $dashes->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" );
- }
-
- my $search = Menu->child( search => title => loc('Search'), path => '/Search/Simple.html' );
-
- my $tickets = $search->child( tickets => title => loc('Tickets'), path => '/Search/Build.html' );
- $tickets->child( simple => title => loc('Simple Search'), path => "/Search/Simple.html" );
- $tickets->child( new => title => loc('New Search'), path => "/Search/Build.html?NewQuery=1" );
-
- $search->child( articles => title => loc('Articles'), path => "/Articles/Article/Search.html" )
- if $session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
-
- $search->child( users => title => loc('Users'), path => "/User/Search.html" );
-
- $search->child( assets => title => loc("Assets"), path => "/Asset/Search/" )
- if $session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
-
- if ($session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
- my $articles = Menu->child( articles => title => loc('Articles'), path => "/Articles/index.html");
- $articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" );
- $articles->child( topics => title => loc('Topics'), path => "/Articles/Topics.html" );
- $articles->child( create => title => loc('Create'), path => "/Articles/Article/PreCreate.html" );
- $articles->child( search => title => loc('Search'), path => "/Articles/Article/Search.html" );
- }
-
- if ($session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System )) {
- my $assets = Menu->child( "assets", title => loc("Assets"), path => "/Asset/Search/" );
- $assets->child( "create", title => loc("Create"), path => "/Asset/CreateInCatalog.html" );
- $assets->child( "search", title => loc("Search"), path => "/Asset/Search/" );
- }
-
- my $tools = Menu->child( tools => title => loc('Tools'), path => '/Tools/index.html' );
-
- $tools->child( my_day =>
- title => loc('My Day'),
- description => loc('Easy updating of your open tickets'),
- path => '/Tools/MyDay.html',
- );
-
- if ( RT->Config->Get('EnableReminders') ) {
- $tools->child( my_reminders =>
- title => loc('My Reminders'),
- description => loc('Easy viewing of your reminders'),
- path => '/Tools/MyReminders.html',
- );
- }
-
- if ( $session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) {
- $tools->child( approval =>
- title => loc('Approval'),
- description => loc('My Approvals'),
- path => '/Approvals/',
- );
- }
-
- if ( $session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
- {
- $build_admin_menu->(Menu());
- }
-
- my $username = '<span class="current-user">'
- . $m->interp->apply_escapes($session{'CurrentUser'}->Name, 'h')
- . '</span>';
- my $about_me = Menu->child( 'preferences' =>
- title => loc('Logged in as [_1]', $username),
- escape_title => 0,
- path => '/User/Summary.html?id=' . $session{CurrentUser}->id,
- sort_order => 99,
- );
-
-
- if ( $session{'CurrentUser'}->UserObj
- && $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System )) {
- my $settings = $about_me->child( settings => title => loc('Settings'), path => '/Prefs/Other.html' );
- $settings->child( options => title => loc('Preferences'), path => '/Prefs/Other.html' );
- $settings->child( about_me => title => loc('About me'), path => '/Prefs/AboutMe.html' );
- $settings->child( search_options => title => loc('Search options'), path => '/Prefs/SearchOptions.html' );
- $settings->child( myrt => title => loc('RT at a glance'), path => '/Prefs/MyRT.html' );
- $settings->child( dashboards_in_menu =>
- title => loc('Dashboards in menu'),
- path => '/Prefs/DashboardsInMenu.html',
- );
- $settings->child( queue_list => title => loc('Queue list'), path => '/Prefs/QueueList.html' );
-
- my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') );
- my $searches = [ $m->comp( "/Search/Elements/SearchesForObject",
- Object => RT::System->new( $session{'CurrentUser'} )) ];
- my $i = 0;
-
- for my $search (@$searches) {
- $search_menu->child( "search-" . $i++ =>
- title => $search->[1],
- path => "/Prefs/Search.html?"
- . $query_string->( name => ref( $search->[2] ) . '-' . $search->[2]->Id ),
- );
-
- }
- }
- if ( $session{'CurrentUser'}->Name
- && ( !RT->Config->Get('WebRemoteUserAuth')
- || RT->Config->Get('WebFallbackToRTLogin') )) {
- $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
- }
- if ( $request_path =~ m{^/Dashboards/(\d+)?}) {
- if ( my $id = ( $1 || $DECODED_ARGS->{'id'} ) ) {
- my $obj = RT::Dashboard->new( $session{'CurrentUser'} );
- $obj->LoadById($id);
- if ( $obj and $obj->id ) {
- my $tabs = PageMenu;
- $tabs->child( basics => title => loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id);
- $tabs->child( content => title => loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id);
- $tabs->child( subscription => title => loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id)
- if $obj->CurrentUserCanSubscribe;
- $tabs->child( show => title => loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
- }
- }
- }
-
-
- if ( $request_path =~ m{^/Ticket/} ) {
- if ( ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
- my $id = $1;
- my $obj = RT::Ticket->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- if ( $obj and $obj->id ) {
- my $actions = PageMenu()->child( actions => title => loc('Actions'), sort_order => 95 );
-
- my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
- $can{'_ModifyOwner'} = $obj->CurrentUserCanSetOwner();
- my $can = sub {
- unless ($_[0] eq 'ExecuteCode') {
- return $can{$_[0]} || $can{'SuperUser'};
- } else {
- return !RT->Config->Get('DisallowExecuteCode')
- && ( $can{'ExecuteCode'} || $can{'SuperUser'} );
- }
- };
-
- my $tabs = PageMenu();
- $tabs->child( bookmark => raw_html => $m->scomp( '/Ticket/Elements/Bookmark', id => $id ), sort_order => 98 );
-
- if ($can->('ModifyTicket')) {
- $tabs->child( timer => raw_html => $m->scomp( '/Ticket/Elements/PopupTimerLink', id => $id ), sort_order => 99 );
- }
-
- $tabs->child( display => title => loc('Display'), path => "/Ticket/Display.html?id=" . $id );
- $tabs->child( history => title => loc('History'), path => "/Ticket/History.html?id=" . $id );
-
- # comment out until we can do it for an individual custom field
- #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') ) {
- $tabs->child( basics => title => loc('Basics'), path => "/Ticket/Modify.html?id=" . $id );
-
- #}
-
- if ( $can->('ModifyTicket') || $can->('_ModifyOwner') || $can->('Watch') || $can->('WatchAsAdminCc') ) {
- $tabs->child( people => title => loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id );
- }
-
- if ( $can->('ModifyTicket') ) {
- $tabs->child( dates => title => loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id );
- $tabs->child( links => title => loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id );
- }
-
- #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') || $can->('_ModifyOwner') ) {
- $tabs->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id );
- #}
-
- if ( RT->Config->Get('EnableReminders') ) {
- $tabs->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id );
- }
-
- if ( $can->('ModifyTicket') or $can->('ReplyToTicket') ) {
- $actions->child( reply => title => loc('Reply'), path => "/Ticket/Update.html?Action=Respond;id=" . $id );
- }
-
- if ( $can->('ModifyTicket') or $can->('CommentOnTicket') ) {
- $actions->child( comment => title => loc('Comment'), path => "/Ticket/Update.html?Action=Comment;id=" . $id );
- }
-
- if ( $can->('ForwardMessage') ) {
- $actions->child( forward => title => loc('Forward'), path => "/Ticket/Forward.html?id=" . $id );
- }
-
- my $hide_resolve_with_deps = RT->Config->Get('HideResolveActionsWithDependencies')
- && $obj->HasUnresolvedDependencies;
-
- my $current = $obj->Status;
- my $lifecycle = $obj->LifecycleObj;
- my $i = 1;
- foreach my $info ( $lifecycle->Actions($current) ) {
- my $next = $info->{'to'};
- next unless $lifecycle->IsTransition( $current => $next );
-
- my $check = $lifecycle->CheckRight( $current => $next );
- next unless $can->($check);
-
- next if $hide_resolve_with_deps
- && $lifecycle->IsInactive($next)
- && !$lifecycle->IsInactive($current);
-
- my $action = $info->{'update'} || '';
- my $url = '/Ticket/';
- $url .= "Update.html?". $query_string->(
- $action
- ? (Action => $action)
- : (SubmitTicket => 1, Status => $next),
- DefaultStatus => $next,
- id => $id,
- );
- my $key = $info->{'label'} || ucfirst($next);
- $actions->child( $key => title => loc( $key ), path => $url);
- }
-
- my ($can_take, $tmsg) = $obj->CurrentUserCanSetOwner( Type => 'Take' );
- my ($can_steal, $smsg) = $obj->CurrentUserCanSetOwner( Type => 'Steal' );
- if ( $can_take ){
- $actions->child( take => title => loc('Take'), path => "/Ticket/Display.html?Action=Take;id=" . $id );
- }
- elsif ( $can_steal ){
- $actions->child( steal => title => loc('Steal'), path => "/Ticket/Display.html?Action=Steal;id=" . $id );
- }
-
- # TODO needs a "Can extract article into a class applied to this queue" check
- $actions->child( 'extract-article' =>
- title => loc('Extract Article'),
- path => "/Articles/Article/ExtractIntoClass.html?Ticket=".$obj->id,
- ) if $session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
-
- if ( defined $session{"tickets"} ) {
- # we have to update session data if we get new ItemMap
- my $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} );
-
- my $item_map = $session{"tickets"}->ItemMap;
-
- if ($updatesession) {
- $session{"tickets"}->PrepForSerialization();
- }
-
- my $search = Menu()->child('search')->child('tickets');
- # Don't display prev links if we're on the first ticket
- if ( $item_map->{$id}->{prev} ) {
- $search->child( first =>
- title => '<< ' . loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first});
- $search->child( prev =>
- title => '< ' . loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev});
- }
- # Don't display next links if we're on the last ticket
- if ( $item_map->{$id}->{next} ) {
- $search->child( next =>
- title => loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
- if ( $item_map->{last} ) {
- $search->child( last =>
- title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
- }
- }
- }
- }
- }
- }
-
- if (
- (
- $request_path =~ m{^/(?:Ticket|Search)/}
- && $request_path !~ m{^/Search/Simple\.html}
- )
- || ( $request_path =~ m{^/Search/Simple\.html}
- && $DECODED_ARGS->{'q'} )
- )
- {
- my $search = Menu()->child('search')->child('tickets');
- my $args = '';
- my $has_query = '';
- my $current_search = $session{"CurrentSearchHash"} || {};
- 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 ( $DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
-
- my %query_args;
- my %fallback_query_args = (
- SavedSearchId => ( $search_id eq 'new' ) ? undef : $search_id,
- SavedChartSearchId => $chart_id,
- (
- map {
- my $p = $_;
- $p => $DECODED_ARGS->{$p} || $current_search->{$p}
- } qw(Query Format OrderBy Order Page)
- ),
- RowsPerPage => (
- defined $DECODED_ARGS->{'RowsPerPage'}
- ? $DECODED_ARGS->{'RowsPerPage'}
- : $current_search->{'RowsPerPage'}
- ),
- );
-
- if ($QueryString) {
- $args = '?' . $QueryString;
- }
- else {
- my %final_query_args = ();
- # key => callback to avoid unnecessary work
-
- for my $param (keys %fallback_query_args) {
- $final_query_args{$param} = defined($QueryArgs->{$param})
- ? $QueryArgs->{$param}
- : $fallback_query_args{$param};
- }
-
- for my $field (qw(Order OrderBy)) {
- if ( ref( $final_query_args{$field} ) eq 'ARRAY' ) {
- $final_query_args{$field} = join( "|", @{ $final_query_args{$field} } );
- } elsif (not defined $final_query_args{$field}) {
- delete $final_query_args{$field};
- }
- else {
- $final_query_args{$field} ||= '';
- }
- }
-
- $args = '?' . $query_string->(%final_query_args);
- }
-
- my $current_search_menu;
- if ( $request_path =~ m{^/Ticket} ) {
- $current_search_menu = $search->child( current_search => title => loc('Current Search') );
- $current_search_menu->path("/Search/Results.html$args") if $has_query;
- } else {
- $current_search_menu = PageMenu();
- }
-
- $current_search_menu->child( edit_search =>
- title => loc('Edit Search'), path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) );
- $current_search_menu->child( advanced =>
- title => loc('Advanced'), path => "/Search/Edit.html$args" );
- if ($has_query) {
- $current_search_menu->child( results => title => loc('Show Results'), path => "/Search/Results.html$args" );
- }
-
- if ( $has_query ) {
- $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" );
-
- my $more = $current_search_menu->child( more => title => loc('Feeds') );
-
- $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Search/Results.tsv$args" );
-
- my %rss_data = map {
- $_ => $QueryArgs->{$_} || $fallback_query_args{$_} || '' }
- qw(Query Order OrderBy);
- my $RSSQueryString = "?"
- . $query_string->( Query => $rss_data{Query},
- Order => $rss_data{Order},
- OrderBy => $rss_data{OrderBy}
- );
- my $RSSPath = join '/', map $m->interp->apply_escapes( $_, 'u' ),
- $session{'CurrentUser'}->UserObj->Name,
- $session{'CurrentUser'}
- ->UserObj->GenerateAuthString( $rss_data{Query}
- . $rss_data{Order}
- . $rss_data{OrderBy} );
-
- $more->child( rss => title => loc('RSS'), path => "/NoAuth/rss/$RSSPath/$RSSQueryString");
- my $ical_path = join '/', map $m->interp->apply_escapes($_, 'u'),
- $session{'CurrentUser'}->UserObj->Name,
- $session{'CurrentUser'}->UserObj->GenerateAuthString( $rss_data{Query} ),
- $rss_data{Query};
- $more->child( ical => title => loc('iCal'), path => '/NoAuth/iCal/'.$ical_path);
-
- if ($request_path =~ m{^/Search/Results.html}
- && #XXX TODO better abstraction
- $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
- my $shred_args = $query_string->(
- Search => 1,
- Plugin => 'Tickets',
- 'Tickets:query' => $rss_data{'Query'},
- 'Tickets:limit' => $QueryArgs->{'Rows'},
- );
-
- $more->child( shredder => title => loc('Shredder'), path => '/Admin/Tools/Shredder/?' . $shred_args);
- }
-
- }
- }
-
- if ( $request_path =~ m{^/Article/} ) {
- 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 );
- $tabs->child( history => title => loc('History'), path => "/Articles/Article/History.html?id=".$id );
- $tabs->child( modify => title => loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id );
- }
- }
-
- if ( $request_path =~ m{^/Articles/} ) {
- PageWidgets()->child( article_search => raw_html => $m->scomp('/Articles/Elements/GotoArticle') );
- PageWidgets()->delete('create_ticket');
- PageWidgets()->delete('simple_search');
-
- 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 ( $request_path =~ m{^/Articles/Article/} and ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
- my $id = $1;
- my $obj = RT::Article->new( $session{'CurrentUser'} );
- $obj->Load($id);
-
- if ( $obj and $obj->id ) {
- $tabs->child( display => title => loc("Display"), path => "/Articles/Article/Display.html?id=" . $id );
- $tabs->child( history => title => loc('History'), path => '/Articles/Article/History.html?id=' . $id );
-
- if ( $obj->CurrentUserHasRight('ModifyArticle') ) {
- $tabs->child(modify => title => loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
- }
- }
- }
-
- }
-
- if ($request_path =~ m{^/Asset/} and $DECODED_ARGS->{id} and $DECODED_ARGS->{id} !~ /\D/) {
- my $page = PageMenu();
- my $id = $DECODED_ARGS->{id};
- my $asset = RT::Asset->new( $session{CurrentUser} );
- $asset->Load($id);
-
- if ($asset->id) {
- $page->child("display", title => loc("Display"), path => "/Asset/Display.html?id=$id");
- $page->child("history", title => loc("History"), path => "/Asset/History.html?id=$id");
- $page->child("basics", title => loc("Basics"), path => "/Asset/Modify.html?id=$id");
- $page->child("links", title => loc("Links"), path => "/Asset/ModifyLinks.html?id=$id");
- $page->child("people", title => loc("People"), path => "/Asset/ModifyPeople.html?id=$id");
- $page->child("dates", title => loc("Dates"), path => "/Asset/ModifyDates.html?id=$id");
-
- for my $grouping (RT::CustomField->CustomGroupings($asset)) {
- my $cfs = $asset->CustomFields;
- $cfs->LimitToGrouping( $asset => $grouping );
- next unless $cfs->Count;
- $page->child(
- "cf-grouping-$grouping",
- title => loc($grouping),
- path => "/Asset/ModifyCFs.html?id=$id;Grouping=" . $m->interp->apply_escapes($grouping, 'u'),
- );
- }
-
- my $actions = $page->child("actions", title => loc("Actions"));
- $actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
-
- my $status = $asset->Status;
- my $lifecycle = $asset->LifecycleObj;
- for my $action ( $lifecycle->Actions($status) ) {
- my $next = $action->{'to'};
- next unless $lifecycle->IsTransition( $status => $next );
-
- my $check = $lifecycle->CheckRight( $status => $next );
- next unless $asset->CurrentUserHasRight($check);
-
- my $label = $action->{'label'} || ucfirst($next);
- $actions->child(
- $label,
- title => loc($label),
- path => "/Asset/Modify.html?id=$id;Update=1;DisplayAfter=1;Status="
- . $m->interp->apply_escapes($next, 'u'),
-
- class => "asset-lifecycle-action",
- attributes => {
- 'data-current-status' => $status,
- 'data-next-status' => $next,
- },
- );
- }
- }
- } elsif ($request_path =~ m{^/Asset/Search/}) {
- my $page = PageMenu();
- my %search = map @{$_},
- grep defined $_->[1] && length $_->[1],
- map {ref $DECODED_ARGS->{$_} ? [$_, $DECODED_ARGS->{$_}[0]] : [$_, $DECODED_ARGS->{$_}] }
- grep /^(?:q|SearchAssets|!?(Name|Description|Catalog|Status|Role\..+|CF\..+)|Order(?:By)?|Page)$/,
- keys %$DECODED_ARGS;
- if ( $request_path =~ /Bulk/) {
- $page->child('search',
- title => loc('Show Results'),
- path => '/Asset/Search/?' . (keys %search ? $query_string->(%search) : ''),
- );
- } else {
- $page->child('bulk',
- title => loc('Bulk Update'),
- path => '/Asset/Search/Bulk.html?' . (keys %search ? $query_string->(%search) : ''),
- );
- }
- $page->child('csv',
- title => loc('Download Spreadsheet'),
- path => '/Asset/Search/Results.tsv?' . (keys %search ? $query_string->(%search) : ''),
- );
- } elsif ($request_path =~ m{^/Admin/Global/CustomFields/Catalog-Assets\.html$}) {
- my $page = PageMenu();
- $page->child("create", title => loc("Create New"), path => "/Admin/CustomFields/Modify.html?Create=1;LookupType=" . RT::Asset->CustomFieldLookupType);
- } elsif ($request_path =~ m{^/Admin/CustomFields(/|/index\.html)?$}
- and $DECODED_ARGS->{'Type'} and $DECODED_ARGS->{'Type'} eq RT::Asset->CustomFieldLookupType) {
- my $page = PageMenu();
- $page->child("create")->path( $page->child("create")->path . "&LookupType=" . RT::Asset->CustomFieldLookupType );
- } elsif ($request_path =~ m{^/Admin/Assets/Catalogs/}) {
- my $page = PageMenu();
- my $actions = $request_path =~ m{/((index|Create)\.html)?$}
- ? $page
- : $page->child("catalogs", title => loc("Catalogs"), path => "/Admin/Assets/Catalogs/");
-
- $actions->child("select", title => loc("Select"), path => "/Admin/Assets/Catalogs/");
- $actions->child("create", title => loc("Create"), path => "/Admin/Assets/Catalogs/Create.html");
-
- my $catalog = RT::Catalog->new( $session{CurrentUser} );
- $catalog->Load($DECODED_ARGS->{id}) if $DECODED_ARGS->{id};
-
- if ($catalog->id and $catalog->CurrentUserCanSee) {
- my $query = "id=" . $catalog->id;
- $page->child("modify", title => loc("Basics"), path => "/Admin/Assets/Catalogs/Modify.html?$query");
- $page->child("people", title => loc("Roles"), path => "/Admin/Assets/Catalogs/Roles.html?$query");
-
- $page->child("cfs", title => loc("Asset Custom Fields"), path => "/Admin/Assets/Catalogs/CustomFields.html?$query");
-
- $page->child("group-rights", title => loc("Group Rights"), path => "/Admin/Assets/Catalogs/GroupRights.html?$query");
- $page->child("user-rights", title => loc("User Rights"), path => "/Admin/Assets/Catalogs/UserRights.html?$query");
- }
- }
-
- if ( $request_path =~ m{^/User/(Summary|History)\.html} ) {
- if (PageMenu()->child('summary')) {
- # Already set up from having AdminUser and ShowConfigTab;
- # but rename "Basics" to "Edit" in this context
- PageMenu()->child( 'basics' )->title( loc('Edit') );
- } elsif ( $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'ShowUserHistory' ) ) {
- PageMenu()->child( display => title => loc('Summary'), path => '/User/Summary.html?id=' . $DECODED_ARGS->{'id'} );
- PageMenu()->child( history => title => loc('History'), path => '/User/History.html?id=' . $DECODED_ARGS->{'id'} );
- }
- }
-
- if ( $request_path =~ /^\/(?:index.html|$)/ ) {
- PageMenu()->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' );
- }
-
- $m->callback( CallbackName => 'Privileged', Path => $request_path );
-};
-
-my $build_selfservice_nav = sub {
- my $queues = RT::Queues->new( $session{'CurrentUser'} );
- $queues->UnLimit;
-
- my $queue_count = 0;
- my $queue_id;
-
- while ( my $queue = $queues->Next ) {
- next unless $queue->CurrentUserHasRight('CreateTicket');
- $queue_id = $queue->id;
- $queue_count++;
- last if ( $queue_count > 1 );
- }
-
-
- if ( $queue_count > 1 ) {
- 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' );
-
- Menu->child( "assets", title => loc("Assets"), path => "/SelfService/Asset/" )
- if $session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
-
- my $username = '<span class="current-user">'
- . $m->interp->apply_escapes($session{'CurrentUser'}->Name, 'h')
- . '</span>';
- my $about_me = Menu->child( preferences =>
- title => loc('Logged in as [_1]', $username),
- escape_title => 0,
- sort_order => 99,
- );
-
- if ( $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System ) ) {
- $about_me->child( prefs => title => loc('Preferences'), path => '/SelfService/Prefs.html' );
- }
-
- if ( $session{'CurrentUser'}->Name
- && ( !RT->Config->Get('WebRemoteUserAuth')
- || RT->Config->Get('WebFallbackToRTLogin') )) {
- $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
- }
-
- if ($session{'CurrentUser'}->HasRight( Right => 'ShowArticle', Object => RT->System )) {
- PageWidgets->child( 'goto-article' => raw_html => $m->scomp('/SelfService/Elements/SearchArticle') );
- }
-
- PageWidgets->child( goto => raw_html => $m->scomp('/SelfService/Elements/GotoTicket') );
-
- if ($request_path =~ m{^/SelfService/Asset/} and $DECODED_ARGS->{id}) {
- my $page = PageMenu();
- my $id = $DECODED_ARGS->{id};
- $page->child("display", title => loc("Display"), path => "/SelfService/Asset/Display.html?id=$id");
- $page->child("history", title => loc("History"), path => "/SelfService/Asset/History.html?id=$id");
-
- if (Menu->child("new")) {
- my $actions = $page->child("actions", title => loc("Actions"));
- $actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id");
- }
- }
-
- $m->callback( CallbackName => 'SelfService', Path => $request_path );
-};
-
-
-
+use RT::Interface::Web::MenuBuilder;
if ( $request_path !~ m{^/SelfService/} ) {
- $build_main_nav->();
+ RT::Interface::Web::MenuBuilder::BuildMainNav( $request_path, $QueryString, $QueryArgs );
} else {
- $build_selfservice_nav->();
+ RT::Interface::Web::MenuBuilder::BuildSelfServiceNav( $request_path );
}
commit 76af288e36942b3231bab0c34527708499531a15
Author: Dustin Graves <dustin at bestpractical.com>
Date: Tue May 31 22:04:57 2016 +0000
refactor asset menu logic into own function
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 2468aef..af675f3 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -542,57 +542,7 @@ sub BuildMainNav {
}
if ($request_path =~ m{^/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id} and $HTML::Mason::Commands::DECODED_ARGS->{id} !~ /\D/) {
- my $page = HTML::Mason::Commands::PageMenu();
- my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
- my $asset = RT::Asset->new( $HTML::Mason::Commands::session{CurrentUser} );
- $asset->Load($id);
-
- if ($asset->id) {
- $page->child("display", title => HTML::Mason::Commands::loc("Display"), path => "/Asset/Display.html?id=$id");
- $page->child("history", title => HTML::Mason::Commands::loc("History"), path => "/Asset/History.html?id=$id");
- $page->child("basics", title => HTML::Mason::Commands::loc("Basics"), path => "/Asset/Modify.html?id=$id");
- $page->child("links", title => HTML::Mason::Commands::loc("Links"), path => "/Asset/ModifyLinks.html?id=$id");
- $page->child("people", title => HTML::Mason::Commands::loc("People"), path => "/Asset/ModifyPeople.html?id=$id");
- $page->child("dates", title => HTML::Mason::Commands::loc("Dates"), path => "/Asset/ModifyDates.html?id=$id");
-
- for my $grouping (RT::CustomField->CustomGroupings($asset)) {
- my $cfs = $asset->CustomFields;
- $cfs->LimitToGrouping( $asset => $grouping );
- next unless $cfs->Count;
- $page->child(
- "cf-grouping-$grouping",
- title => HTML::Mason::Commands::loc($grouping),
- path => "/Asset/ModifyCFs.html?id=$id;Grouping=" . $HTML::Mason::Commands::m->interp->apply_escapes($grouping, 'u'),
- );
- }
-
- my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
- $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
-
- my $status = $asset->Status;
- my $lifecycle = $asset->LifecycleObj;
- for my $action ( $lifecycle->Actions($status) ) {
- my $next = $action->{'to'};
- next unless $lifecycle->IsTransition( $status => $next );
-
- my $check = $lifecycle->CheckRight( $status => $next );
- next unless $asset->CurrentUserHasRight($check);
-
- my $label = $action->{'label'} || ucfirst($next);
- $actions->child(
- $label,
- title => HTML::Mason::Commands::loc($label),
- path => "/Asset/Modify.html?id=$id;Update=1;DisplayAfter=1;Status="
- . $HTML::Mason::Commands::m->interp->apply_escapes($next, 'u'),
-
- class => "asset-lifecycle-action",
- attributes => {
- 'data-current-status' => $status,
- 'data-next-status' => $next,
- },
- );
- }
- }
+ _BuildAssetMenu();
} elsif ($request_path =~ m{^/Asset/Search/}) {
my $page = HTML::Mason::Commands::PageMenu();
my %search = map @{$_},
@@ -664,6 +614,69 @@ sub BuildMainNav {
$HTML::Mason::Commands::m->callback( CallbackName => 'Privileged', Path => $request_path );
}
+sub _BuildAssetMenu {
+ my $page = HTML::Mason::Commands::PageMenu();
+ my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
+ my $asset = RT::Asset->new( $HTML::Mason::Commands::session{CurrentUser} );
+ $asset->Load($id);
+
+ if ($asset->id) {
+ $page->child("display", title => HTML::Mason::Commands::loc("Display"), path => "/Asset/Display.html?id=$id");
+ $page->child("history", title => HTML::Mason::Commands::loc("History"), path => "/Asset/History.html?id=$id");
+ $page->child("basics", title => HTML::Mason::Commands::loc("Basics"), path => "/Asset/Modify.html?id=$id");
+ $page->child("links", title => HTML::Mason::Commands::loc("Links"), path => "/Asset/ModifyLinks.html?id=$id");
+ $page->child("people", title => HTML::Mason::Commands::loc("People"), path => "/Asset/ModifyPeople.html?id=$id");
+ $page->child("dates", title => HTML::Mason::Commands::loc("Dates"), path => "/Asset/ModifyDates.html?id=$id");
+
+ for my $grouping (RT::CustomField->CustomGroupings($asset)) {
+ my $cfs = $asset->CustomFields;
+ $cfs->LimitToGrouping( $asset => $grouping );
+ next unless $cfs->Count;
+ $page->child(
+ "cf-grouping-$grouping",
+ title => HTML::Mason::Commands::loc($grouping),
+ path => "/Asset/ModifyCFs.html?id=$id;Grouping=" . $HTML::Mason::Commands::m->interp->apply_escapes($grouping, 'u'),
+ );
+ }
+
+ _BuildAssetMenuActionSubmenu($asset);
+ }
+}
+
+sub _BuildAssetMenuActionSubmenu {
+ my $asset = shift;
+
+ my $page = HTML::Mason::Commands::PageMenu();
+ my $id = $asset->id;
+
+ my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
+ $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
+
+ my $status = $asset->Status;
+ my $lifecycle = $asset->LifecycleObj;
+ for my $action ( $lifecycle->Actions($status) ) {
+ my $next = $action->{'to'};
+ next unless $lifecycle->IsTransition( $status => $next );
+
+ my $check = $lifecycle->CheckRight( $status => $next );
+ next unless $asset->CurrentUserHasRight($check);
+
+ my $label = $action->{'label'} || ucfirst($next);
+ $actions->child(
+ $label,
+ title => HTML::Mason::Commands::loc($label),
+ path => "/Asset/Modify.html?id=$id;Update=1;DisplayAfter=1;Status="
+ . $HTML::Mason::Commands::m->interp->apply_escapes($next, 'u'),
+
+ class => "asset-lifecycle-action",
+ attributes => {
+ 'data-current-status' => $status,
+ 'data-next-status' => $next,
+ },
+ );
+ }
+}
+
sub BuildAdminMenu {
my $request_path = shift;
my $top = shift;
commit c4a93c20111b3103a4719615c97558b790bdb5b7
Author: Dustin Graves <dustin at bestpractical.com>
Date: Tue May 31 22:09:18 2016 +0000
add asset display menu actions to ShowAssets template
diff --git a/share/html/Ticket/Elements/ShowAssets b/share/html/Ticket/Elements/ShowAssets
index de3aebb..d99a61d 100644
--- a/share/html/Ticket/Elements/ShowAssets
+++ b/share/html/Ticket/Elements/ShowAssets
@@ -144,6 +144,9 @@ if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
</%perl>
<a href="<% $delete_url %>" class="unlink-asset ui-icon ui-icon-circle-close" title="Unlink asset">X</a>
% }
+% HTML::Mason::Commands::PageMenu()->{children} = undef; # clear previous settings from page load
+% RT::Interface::Web::MenuBuilder::_BuildAssetMenuActionSubmenu($asset);
+<& /Elements/Menu, menu => PageMenu(), id => 'asset-actions-menu', parent_id => 'asset' &>
</h3>
<div class="details">
<& /Elements/ShowRecord,
commit 714afb202535a0876a8e340e343f811cf62a273f
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 1 19:33:13 2016 +0000
style assets action menu on ShowAssets element
diff --git a/share/html/Ticket/Elements/ShowAssets b/share/html/Ticket/Elements/ShowAssets
index d99a61d..e2614d2 100644
--- a/share/html/Ticket/Elements/ShowAssets
+++ b/share/html/Ticket/Elements/ShowAssets
@@ -144,9 +144,19 @@ if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
</%perl>
<a href="<% $delete_url %>" class="unlink-asset ui-icon ui-icon-circle-close" title="Unlink asset">X</a>
% }
-% HTML::Mason::Commands::PageMenu()->{children} = undef; # clear previous settings from page load
+
+%# show asset actions menu
+% HTML::Mason::Commands::PageMenu()->{children} = undef; # clear previous settings from page load so we can show just the actions
% RT::Interface::Web::MenuBuilder::_BuildAssetMenuActionSubmenu($asset);
-<& /Elements/Menu, menu => PageMenu(), id => 'asset-actions-menu', parent_id => 'asset' &>
+<& /Elements/Menu, menu => PageMenu(), id => 'asset-'.$asset->id.'-actions-menu', parent_id => 'asset-'.$asset->id &>
+<script>
+jQuery("#assets-accordion ul.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition()
+ .find('a').click(function(ev){
+ ev.stopPropagation();
+ return true;
+ });
+</script>
+
</h3>
<div class="details">
<& /Elements/ShowRecord,
diff --git a/share/static/css/base/assets.css b/share/static/css/base/assets.css
index c09a8a7..f951889 100644
--- a/share/static/css/base/assets.css
+++ b/share/static/css/base/assets.css
@@ -227,3 +227,32 @@ body#comp-Asset-Search .collection-as-table td {
width: 10em;
}
}
+
+#assets-accordion ul.toplevel {
+ position: absolute;
+ top: 0;
+ right: 20px;
+ width: auto;
+ font-size: .9em;
+}
+
+#assets-accordion li.has-children {
+ background: transparent;
+}
+
+#assets-accordion li.has-children ul {
+ min-width: 12em;
+}
+
+#assets-accordion a {
+ border: none;
+ color: #000;
+}
+
+#assets-accordion a.sf-with-ul {
+ padding-top: .3em;
+}
+
+#assets-accordion .sf-sub-indicator {
+ top: .2em;
+}
commit b1d00fbe859f3652794a31fd1c88ac0fba2105f1
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:30:58 2016 +0000
pass %ARGS to BuildMainNav and BuildSelfServiceNav
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index af675f3..8024e91 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -66,8 +66,11 @@ sub QueryString {
sub BuildMainNav {
my $request_path = shift;
- my $query_string = shift;
- my $query_args = shift;
+
+ my %args = ( @_ );
+
+ my $query_string = $args{QueryString};
+ my $query_args = $args{QueryArgs};
if ($request_path =~ m{^/Asset/}) {
HTML::Mason::Commands::PageWidgets()->child( asset_search => raw_html => $HTML::Mason::Commands::m->scomp('/Asset/Elements/Search') );
@@ -1134,6 +1137,8 @@ sub BuildAdminMenu {
sub BuildSelfServiceNav {
my $request_path = shift;
+ my %args = ( @_ );
+
my $queues = RT::Queues->new( $HTML::Mason::Commands::session{'CurrentUser'} );
$queues->UnLimit;
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 4cdf0a1..60b485c 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -54,9 +54,9 @@ $request_path =~ s!/{2,}!/!g;
use RT::Interface::Web::MenuBuilder;
if ( $request_path !~ m{^/SelfService/} ) {
- RT::Interface::Web::MenuBuilder::BuildMainNav( $request_path, $QueryString, $QueryArgs );
+ RT::Interface::Web::MenuBuilder::BuildMainNav( $request_path, %ARGS );
} else {
- RT::Interface::Web::MenuBuilder::BuildSelfServiceNav( $request_path );
+ RT::Interface::Web::MenuBuilder::BuildSelfServiceNav( $request_path, %ARGS );
}
commit 20f48e5dc4506d99785d8a6db6c6ba5784a242fa
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:31:13 2016 +0000
remove extra whitespace
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 60b485c..3257474 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -58,10 +58,6 @@ if ( $request_path !~ m{^/SelfService/} ) {
} else {
RT::Interface::Web::MenuBuilder::BuildSelfServiceNav( $request_path, %ARGS );
}
-
-
-
-
</%INIT>
<%ARGS>
$show_menu => 1
commit e816d03171b5524e4ed4c2143e1e4f5d515d2b14
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:37:38 2016 +0000
make BuildAdminMenu private function
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 8024e91..58f281c 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -180,7 +180,7 @@ sub BuildMainNav {
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
{
- BuildAdminMenu($request_path, HTML::Mason::Commands::Menu());
+ _BuildAdminMenu($request_path, HTML::Mason::Commands::Menu());
}
my $username = '<span class="current-user">'
@@ -680,7 +680,7 @@ sub _BuildAssetMenuActionSubmenu {
}
}
-sub BuildAdminMenu {
+sub _BuildAdminMenu {
my $request_path = shift;
my $top = shift;
commit 00a905f66fbcbb47c96ae5187c20432cc844616e
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:38:21 2016 +0000
clarify legacy callbacks in RT::Interface::Web::MenuBuilder and pass CallbackPage
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 58f281c..bf16a39 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -614,7 +614,8 @@ sub BuildMainNav {
HTML::Mason::Commands::PageMenu()->child( edit => title => HTML::Mason::Commands::loc('Edit'), path => '/Prefs/MyRT.html' );
}
- $HTML::Mason::Commands::m->callback( CallbackName => 'Privileged', Path => $request_path );
+ # due to historical reasons of always having been in /Elements/Tabs
+ $HTML::Mason::Commands::m->callback( CallbackName => 'Privileged', Path => $request_path, CallbackPage => '/Elements/Tabs' );
}
sub _BuildAssetMenu {
@@ -966,7 +967,8 @@ sub _BuildAdminMenu {
$queue->child( 'history' => title => HTML::Mason::Commands::loc('History'), path => "/Admin/Queues/History.html?id=" . $id );
$queue->child( 'default-values' => title => HTML::Mason::Commands::loc('Default Values'), path => "/Admin/Queues/DefaultValues.html?id=" . $id );
- $HTML::Mason::Commands::m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue);
+ # due to historical reasons of always having been in /Elements/Tabs
+ $HTML::Mason::Commands::m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue, CallbackPage => '/Elements/Tabs' );
}
}
}
@@ -1202,7 +1204,8 @@ sub BuildSelfServiceNav {
}
}
- $HTML::Mason::Commands::m->callback( CallbackName => 'SelfService', Path => $request_path );
+ # due to historical reasons of always having been in /Elements/Tabs
+ $HTML::Mason::Commands::m->callback( CallbackName => 'SelfService', Path => $request_path, CallbackPage => '/Elements/Tabs' );
}
1;
commit e89f3080f32a4e7ec69eebd981bd957cd67914f8
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:39:50 2016 +0000
add local "loc" function to remove HTML::Mason::Commands noise
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index bf16a39..48b5c29 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -57,6 +57,8 @@ use warnings;
package RT::Interface::Web::MenuBuilder;
+sub loc { HTML::Mason::Commands::loc( @_ ); }
+
sub QueryString {
my %args = @_;
my $u = URI->new();
@@ -79,7 +81,7 @@ sub BuildMainNav {
HTML::Mason::Commands::PageWidgets()->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket') );
}
- my $home = HTML::Mason::Commands::Menu()->child( home => title => HTML::Mason::Commands::loc('Homepage'), path => '/' );
+ my $home = HTML::Mason::Commands::Menu()->child( home => title => loc('Homepage'), path => '/' );
unless ($HTML::Mason::Commands::session{'dashboards_in_menu'}) {
my $dashboards_in_menu = $HTML::Mason::Commands::session{CurrentUser}->UserObj->Preferences(
'DashboardsInMenu',
@@ -119,61 +121,61 @@ sub BuildMainNav {
);
}
}
- $dashes->child( edit => title => HTML::Mason::Commands::loc('Update This Menu'), path => 'Prefs/DashboardsInMenu.html' );
- $dashes->child( more => title => HTML::Mason::Commands::loc('All Dashboards'), path => 'Dashboards/index.html' );
+ $dashes->child( edit => title => loc('Update This Menu'), path => 'Prefs/DashboardsInMenu.html' );
+ $dashes->child( more => title => loc('All Dashboards'), path => 'Dashboards/index.html' );
my $dashboard = RT::Dashboard->new( $HTML::Mason::Commands::session{CurrentUser} );
if ( $dashboard->CurrentUserCanCreateAny ) {
- $dashes->child('dashboard_create' => title => HTML::Mason::Commands::loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" );
+ $dashes->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" );
}
- my $search = HTML::Mason::Commands::Menu()->child( search => title => HTML::Mason::Commands::loc('Search'), path => '/Search/Simple.html' );
+ my $search = HTML::Mason::Commands::Menu()->child( search => title => loc('Search'), path => '/Search/Simple.html' );
- my $tickets = $search->child( tickets => title => HTML::Mason::Commands::loc('Tickets'), path => '/Search/Build.html' );
- $tickets->child( simple => title => HTML::Mason::Commands::loc('Simple Search'), path => "/Search/Simple.html" );
- $tickets->child( new => title => HTML::Mason::Commands::loc('New Search'), path => "/Search/Build.html?NewQuery=1" );
+ my $tickets = $search->child( tickets => title => loc('Tickets'), path => '/Search/Build.html' );
+ $tickets->child( simple => title => loc('Simple Search'), path => "/Search/Simple.html" );
+ $tickets->child( new => title => loc('New Search'), path => "/Search/Build.html?NewQuery=1" );
- $search->child( articles => title => HTML::Mason::Commands::loc('Articles'), path => "/Articles/Article/Search.html" )
+ $search->child( articles => title => loc('Articles'), path => "/Articles/Article/Search.html" )
if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
- $search->child( users => title => HTML::Mason::Commands::loc('Users'), path => "/User/Search.html" );
+ $search->child( users => title => loc('Users'), path => "/User/Search.html" );
- $search->child( assets => title => HTML::Mason::Commands::loc("Assets"), path => "/Asset/Search/" )
+ $search->child( assets => title => loc("Assets"), path => "/Asset/Search/" )
if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
- my $articles = HTML::Mason::Commands::Menu()->child( articles => title => HTML::Mason::Commands::loc('Articles'), path => "/Articles/index.html");
- $articles->child( articles => title => HTML::Mason::Commands::loc('Overview'), path => "/Articles/index.html" );
- $articles->child( topics => title => HTML::Mason::Commands::loc('Topics'), path => "/Articles/Topics.html" );
- $articles->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Articles/Article/PreCreate.html" );
- $articles->child( search => title => HTML::Mason::Commands::loc('Search'), path => "/Articles/Article/Search.html" );
+ my $articles = HTML::Mason::Commands::Menu()->child( articles => title => loc('Articles'), path => "/Articles/index.html");
+ $articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" );
+ $articles->child( topics => title => loc('Topics'), path => "/Articles/Topics.html" );
+ $articles->child( create => title => loc('Create'), path => "/Articles/Article/PreCreate.html" );
+ $articles->child( search => title => loc('Search'), path => "/Articles/Article/Search.html" );
}
if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System )) {
- my $assets = HTML::Mason::Commands::Menu()->child( "assets", title => HTML::Mason::Commands::loc("Assets"), path => "/Asset/Search/" );
- $assets->child( "create", title => HTML::Mason::Commands::loc("Create"), path => "/Asset/CreateInCatalog.html" );
- $assets->child( "search", title => HTML::Mason::Commands::loc("Search"), path => "/Asset/Search/" );
+ my $assets = HTML::Mason::Commands::Menu()->child( "assets", title => loc("Assets"), path => "/Asset/Search/" );
+ $assets->child( "create", title => loc("Create"), path => "/Asset/CreateInCatalog.html" );
+ $assets->child( "search", title => loc("Search"), path => "/Asset/Search/" );
}
- my $tools = HTML::Mason::Commands::Menu()->child( tools => title => HTML::Mason::Commands::loc('Tools'), path => '/Tools/index.html' );
+ my $tools = HTML::Mason::Commands::Menu()->child( tools => title => loc('Tools'), path => '/Tools/index.html' );
$tools->child( my_day =>
- title => HTML::Mason::Commands::loc('My Day'),
- description => HTML::Mason::Commands::loc('Easy updating of your open tickets'),
+ title => loc('My Day'),
+ description => loc('Easy updating of your open tickets'),
path => '/Tools/MyDay.html',
);
if ( RT->Config->Get('EnableReminders') ) {
$tools->child( my_reminders =>
- title => HTML::Mason::Commands::loc('My Reminders'),
- description => HTML::Mason::Commands::loc('Easy viewing of your reminders'),
+ title => loc('My Reminders'),
+ description => loc('Easy viewing of your reminders'),
path => '/Tools/MyReminders.html',
);
}
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) {
$tools->child( approval =>
- title => HTML::Mason::Commands::loc('Approval'),
- description => HTML::Mason::Commands::loc('My Approvals'),
+ title => loc('Approval'),
+ description => loc('My Approvals'),
path => '/Approvals/',
);
}
@@ -187,7 +189,7 @@ sub BuildMainNav {
. $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
. '</span>';
my $about_me = HTML::Mason::Commands::Menu()->child( 'preferences' =>
- title => HTML::Mason::Commands::loc('Logged in as [_1]', $username),
+ title => loc('Logged in as [_1]', $username),
escape_title => 0,
path => '/User/Summary.html?id=' . $HTML::Mason::Commands::session{CurrentUser}->id,
sort_order => 99,
@@ -196,18 +198,18 @@ sub BuildMainNav {
if ( $HTML::Mason::Commands::session{'CurrentUser'}->UserObj
&& $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System )) {
- my $settings = $about_me->child( settings => title => HTML::Mason::Commands::loc('Settings'), path => '/Prefs/Other.html' );
- $settings->child( options => title => HTML::Mason::Commands::loc('Preferences'), path => '/Prefs/Other.html' );
- $settings->child( about_me => title => HTML::Mason::Commands::loc('About me'), path => '/Prefs/AboutMe.html' );
- $settings->child( search_options => title => HTML::Mason::Commands::loc('Search options'), path => '/Prefs/SearchOptions.html' );
- $settings->child( myrt => title => HTML::Mason::Commands::loc('RT at a glance'), path => '/Prefs/MyRT.html' );
+ my $settings = $about_me->child( settings => title => loc('Settings'), path => '/Prefs/Other.html' );
+ $settings->child( options => title => loc('Preferences'), path => '/Prefs/Other.html' );
+ $settings->child( about_me => title => loc('About me'), path => '/Prefs/AboutMe.html' );
+ $settings->child( search_options => title => loc('Search options'), path => '/Prefs/SearchOptions.html' );
+ $settings->child( myrt => title => loc('RT at a glance'), path => '/Prefs/MyRT.html' );
$settings->child( dashboards_in_menu =>
- title => HTML::Mason::Commands::loc('Dashboards in menu'),
+ title => loc('Dashboards in menu'),
path => '/Prefs/DashboardsInMenu.html',
);
- $settings->child( queue_list => title => HTML::Mason::Commands::loc('Queue list'), path => '/Prefs/QueueList.html' );
+ $settings->child( queue_list => title => loc('Queue list'), path => '/Prefs/QueueList.html' );
- my $search_menu = $settings->child( 'saved-searches' => title => HTML::Mason::Commands::loc('Saved Searches') );
+ my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') );
my $searches = [ $HTML::Mason::Commands::m->comp( "/Search/Elements/SearchesForObject",
Object => RT::System->new( $HTML::Mason::Commands::session{'CurrentUser'} )) ];
my $i = 0;
@@ -224,7 +226,7 @@ sub BuildMainNav {
if ( $HTML::Mason::Commands::session{'CurrentUser'}->Name
&& ( !RT->Config->Get('WebRemoteUserAuth')
|| RT->Config->Get('WebFallbackToRTLogin') )) {
- $about_me->child( logout => title => HTML::Mason::Commands::loc('Logout'), path => '/NoAuth/Logout.html' );
+ $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
}
if ( $request_path =~ m{^/Dashboards/(\d+)?}) {
if ( my $id = ( $1 || $HTML::Mason::Commands::DECODED_ARGS->{'id'} ) ) {
@@ -232,11 +234,11 @@ sub BuildMainNav {
$obj->LoadById($id);
if ( $obj and $obj->id ) {
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id);
- $tabs->child( content => title => HTML::Mason::Commands::loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id);
- $tabs->child( subscription => title => HTML::Mason::Commands::loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id)
+ $tabs->child( basics => title => loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id);
+ $tabs->child( content => title => loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id);
+ $tabs->child( subscription => title => loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id)
if $obj->CurrentUserCanSubscribe;
- $tabs->child( show => title => HTML::Mason::Commands::loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
+ $tabs->child( show => title => loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
}
}
}
@@ -249,7 +251,7 @@ sub BuildMainNav {
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $actions = HTML::Mason::Commands::PageMenu()->child( actions => title => HTML::Mason::Commands::loc('Actions'), sort_order => 95 );
+ my $actions = HTML::Mason::Commands::PageMenu()->child( actions => title => loc('Actions'), sort_order => 95 );
my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
$can{'_ModifyOwner'} = $obj->CurrentUserCanSetOwner();
@@ -269,42 +271,42 @@ sub BuildMainNav {
$tabs->child( timer => raw_html => $HTML::Mason::Commands::m->scomp( '/Ticket/Elements/PopupTimerLink', id => $id ), sort_order => 99 );
}
- $tabs->child( display => title => HTML::Mason::Commands::loc('Display'), path => "/Ticket/Display.html?id=" . $id );
- $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Ticket/History.html?id=" . $id );
+ $tabs->child( display => title => loc('Display'), path => "/Ticket/Display.html?id=" . $id );
+ $tabs->child( history => title => loc('History'), path => "/Ticket/History.html?id=" . $id );
# comment out until we can do it for an individual custom field
#if ( $can->('ModifyTicket') || $can->('ModifyCustomField') ) {
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Ticket/Modify.html?id=" . $id );
+ $tabs->child( basics => title => loc('Basics'), path => "/Ticket/Modify.html?id=" . $id );
#}
if ( $can->('ModifyTicket') || $can->('_ModifyOwner') || $can->('Watch') || $can->('WatchAsAdminCc') ) {
- $tabs->child( people => title => HTML::Mason::Commands::loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id );
+ $tabs->child( people => title => loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id );
}
if ( $can->('ModifyTicket') ) {
- $tabs->child( dates => title => HTML::Mason::Commands::loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id );
- $tabs->child( links => title => HTML::Mason::Commands::loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id );
+ $tabs->child( dates => title => loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id );
+ $tabs->child( links => title => loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id );
}
#if ( $can->('ModifyTicket') || $can->('ModifyCustomField') || $can->('_ModifyOwner') ) {
- $tabs->child( jumbo => title => HTML::Mason::Commands::loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id );
+ $tabs->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id );
#}
if ( RT->Config->Get('EnableReminders') ) {
- $tabs->child( reminders => title => HTML::Mason::Commands::loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id );
+ $tabs->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id );
}
if ( $can->('ModifyTicket') or $can->('ReplyToTicket') ) {
- $actions->child( reply => title => HTML::Mason::Commands::loc('Reply'), path => "/Ticket/Update.html?Action=Respond;id=" . $id );
+ $actions->child( reply => title => loc('Reply'), path => "/Ticket/Update.html?Action=Respond;id=" . $id );
}
if ( $can->('ModifyTicket') or $can->('CommentOnTicket') ) {
- $actions->child( comment => title => HTML::Mason::Commands::loc('Comment'), path => "/Ticket/Update.html?Action=Comment;id=" . $id );
+ $actions->child( comment => title => loc('Comment'), path => "/Ticket/Update.html?Action=Comment;id=" . $id );
}
if ( $can->('ForwardMessage') ) {
- $actions->child( forward => title => HTML::Mason::Commands::loc('Forward'), path => "/Ticket/Forward.html?id=" . $id );
+ $actions->child( forward => title => loc('Forward'), path => "/Ticket/Forward.html?id=" . $id );
}
my $hide_resolve_with_deps = RT->Config->Get('HideResolveActionsWithDependencies')
@@ -334,21 +336,21 @@ sub BuildMainNav {
id => $id,
);
my $key = $info->{'label'} || ucfirst($next);
- $actions->child( $key => title => HTML::Mason::Commands::loc( $key ), path => $url);
+ $actions->child( $key => title => loc( $key ), path => $url);
}
my ($can_take, $tmsg) = $obj->CurrentUserCanSetOwner( Type => 'Take' );
my ($can_steal, $smsg) = $obj->CurrentUserCanSetOwner( Type => 'Steal' );
if ( $can_take ){
- $actions->child( take => title => HTML::Mason::Commands::loc('Take'), path => "/Ticket/Display.html?Action=Take;id=" . $id );
+ $actions->child( take => title => loc('Take'), path => "/Ticket/Display.html?Action=Take;id=" . $id );
}
elsif ( $can_steal ){
- $actions->child( steal => title => HTML::Mason::Commands::loc('Steal'), path => "/Ticket/Display.html?Action=Steal;id=" . $id );
+ $actions->child( steal => title => loc('Steal'), path => "/Ticket/Display.html?Action=Steal;id=" . $id );
}
# TODO needs a "Can extract article into a class applied to this queue" check
$actions->child( 'extract-article' =>
- title => HTML::Mason::Commands::loc('Extract Article'),
+ title => loc('Extract Article'),
path => "/Articles/Article/ExtractIntoClass.html?Ticket=".$obj->id,
) if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
@@ -366,17 +368,17 @@ sub BuildMainNav {
# Don't display prev links if we're on the first ticket
if ( $item_map->{$id}->{prev} ) {
$search->child( first =>
- title => '<< ' . HTML::Mason::Commands::loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first});
+ title => '<< ' . loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first});
$search->child( prev =>
- title => '< ' . HTML::Mason::Commands::loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev});
+ title => '< ' . loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev});
}
# Don't display next links if we're on the last ticket
if ( $item_map->{$id}->{next} ) {
$search->child( next =>
- title => HTML::Mason::Commands::loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
+ title => loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
if ( $item_map->{last} ) {
$search->child( last =>
- title => HTML::Mason::Commands::loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+ title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
}
}
}
@@ -448,27 +450,27 @@ sub BuildMainNav {
my $current_search_menu;
if ( $request_path =~ m{^/Ticket} ) {
- $current_search_menu = $search->child( current_search => title => HTML::Mason::Commands::loc('Current Search') );
+ $current_search_menu = $search->child( current_search => title => loc('Current Search') );
$current_search_menu->path("/Search/Results.html$args") if $has_query;
} else {
$current_search_menu = HTML::Mason::Commands::PageMenu();
}
$current_search_menu->child( edit_search =>
- title => HTML::Mason::Commands::loc('Edit Search'), path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) );
+ title => loc('Edit Search'), path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) );
$current_search_menu->child( advanced =>
- title => HTML::Mason::Commands::loc('Advanced'), path => "/Search/Edit.html$args" );
+ title => loc('Advanced'), path => "/Search/Edit.html$args" );
if ($has_query) {
- $current_search_menu->child( results => title => HTML::Mason::Commands::loc('Show Results'), path => "/Search/Results.html$args" );
+ $current_search_menu->child( results => title => loc('Show Results'), path => "/Search/Results.html$args" );
}
if ( $has_query ) {
- $current_search_menu->child( bulk => title => HTML::Mason::Commands::loc('Bulk Update'), path => "/Search/Bulk.html$args" );
- $current_search_menu->child( chart => title => HTML::Mason::Commands::loc('Chart'), path => "/Search/Chart.html$args" );
+ $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" );
- my $more = $current_search_menu->child( more => title => HTML::Mason::Commands::loc('Feeds') );
+ my $more = $current_search_menu->child( more => title => loc('Feeds') );
- $more->child( spreadsheet => title => HTML::Mason::Commands::loc('Spreadsheet'), path => "/Search/Results.tsv$args" );
+ $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Search/Results.tsv$args" );
my %rss_data = map {
$_ => $query_args->{$_} || $fallback_query_args{$_} || '' }
@@ -485,12 +487,12 @@ sub BuildMainNav {
. $rss_data{Order}
. $rss_data{OrderBy} );
- $more->child( rss => title => HTML::Mason::Commands::loc('RSS'), path => "/NoAuth/rss/$RSSPath/$RSSQueryString");
+ $more->child( rss => title => loc('RSS'), path => "/NoAuth/rss/$RSSPath/$RSSQueryString");
my $ical_path = join '/', map $HTML::Mason::Commands::m->interp->apply_escapes($_, 'u'),
$HTML::Mason::Commands::session{'CurrentUser'}->UserObj->Name,
$HTML::Mason::Commands::session{'CurrentUser'}->UserObj->GenerateAuthString( $rss_data{Query} ),
$rss_data{Query};
- $more->child( ical => title => HTML::Mason::Commands::loc('iCal'), path => '/NoAuth/iCal/'.$ical_path);
+ $more->child( ical => title => loc('iCal'), path => '/NoAuth/iCal/'.$ical_path);
if ($request_path =~ m{^/Search/Results.html}
&& #XXX TODO better abstraction
@@ -502,7 +504,7 @@ sub BuildMainNav {
'Tickets:limit' => $query_args->{'Rows'},
);
- $more->child( shredder => title => HTML::Mason::Commands::loc('Shredder'), path => '/Admin/Tools/Shredder/?' . $shred_args);
+ $more->child( shredder => title => loc('Shredder'), path => '/Admin/Tools/Shredder/?' . $shred_args);
}
}
@@ -513,9 +515,9 @@ sub BuildMainNav {
my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( display => title => HTML::Mason::Commands::loc('Display'), path => "/Articles/Article/Display.html?id=".$id );
- $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Articles/Article/History.html?id=".$id );
- $tabs->child( modify => title => HTML::Mason::Commands::loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id );
+ $tabs->child( display => title => loc('Display'), path => "/Articles/Article/Display.html?id=".$id );
+ $tabs->child( history => title => loc('History'), path => "/Articles/Article/History.html?id=".$id );
+ $tabs->child( modify => title => loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id );
}
}
@@ -525,19 +527,19 @@ sub BuildMainNav {
HTML::Mason::Commands::PageWidgets()->delete('simple_search');
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( search => title => HTML::Mason::Commands::loc("Search"), path => "/Articles/Article/Search.html" );
- $tabs->child( create => title => HTML::Mason::Commands::loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
+ $tabs->child( search => title => loc("Search"), path => "/Articles/Article/Search.html" );
+ $tabs->child( create => title => loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
if ( $request_path =~ m{^/Articles/Article/} and ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
my $obj = RT::Article->new( $HTML::Mason::Commands::session{'CurrentUser'} );
$obj->Load($id);
if ( $obj and $obj->id ) {
- $tabs->child( display => title => HTML::Mason::Commands::loc("Display"), path => "/Articles/Article/Display.html?id=" . $id );
- $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => '/Articles/Article/History.html?id=' . $id );
+ $tabs->child( display => title => loc("Display"), path => "/Articles/Article/Display.html?id=" . $id );
+ $tabs->child( history => title => loc('History'), path => '/Articles/Article/History.html?id=' . $id );
if ( $obj->CurrentUserHasRight('ModifyArticle') ) {
- $tabs->child(modify => title => HTML::Mason::Commands::loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
+ $tabs->child(modify => title => loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
}
}
}
@@ -555,22 +557,22 @@ sub BuildMainNav {
keys %$HTML::Mason::Commands::DECODED_ARGS;
if ( $request_path =~ /Bulk/) {
$page->child('search',
- title => HTML::Mason::Commands::loc('Show Results'),
+ title => loc('Show Results'),
path => '/Asset/Search/?' . (keys %search ? QueryString(%search) : ''),
);
} else {
$page->child('bulk',
- title => HTML::Mason::Commands::loc('Bulk Update'),
+ title => loc('Bulk Update'),
path => '/Asset/Search/Bulk.html?' . (keys %search ? QueryString(%search) : ''),
);
}
$page->child('csv',
- title => HTML::Mason::Commands::loc('Download Spreadsheet'),
+ title => loc('Download Spreadsheet'),
path => '/Asset/Search/Results.tsv?' . (keys %search ? QueryString(%search) : ''),
);
} elsif ($request_path =~ m{^/Admin/Global/CustomFields/Catalog-Assets\.html$}) {
my $page = HTML::Mason::Commands::PageMenu();
- $page->child("create", title => HTML::Mason::Commands::loc("Create New"), path => "/Admin/CustomFields/Modify.html?Create=1;LookupType=" . RT::Asset->CustomFieldLookupType);
+ $page->child("create", title => loc("Create New"), path => "/Admin/CustomFields/Modify.html?Create=1;LookupType=" . RT::Asset->CustomFieldLookupType);
} elsif ($request_path =~ m{^/Admin/CustomFields(/|/index\.html)?$}
and $HTML::Mason::Commands::DECODED_ARGS->{'Type'} and $HTML::Mason::Commands::DECODED_ARGS->{'Type'} eq RT::Asset->CustomFieldLookupType) {
my $page = HTML::Mason::Commands::PageMenu();
@@ -579,23 +581,23 @@ sub BuildMainNav {
my $page = HTML::Mason::Commands::PageMenu();
my $actions = $request_path =~ m{/((index|Create)\.html)?$}
? $page
- : $page->child("catalogs", title => HTML::Mason::Commands::loc("Catalogs"), path => "/Admin/Assets/Catalogs/");
+ : $page->child("catalogs", title => loc("Catalogs"), path => "/Admin/Assets/Catalogs/");
- $actions->child("select", title => HTML::Mason::Commands::loc("Select"), path => "/Admin/Assets/Catalogs/");
- $actions->child("create", title => HTML::Mason::Commands::loc("Create"), path => "/Admin/Assets/Catalogs/Create.html");
+ $actions->child("select", title => loc("Select"), path => "/Admin/Assets/Catalogs/");
+ $actions->child("create", title => loc("Create"), path => "/Admin/Assets/Catalogs/Create.html");
my $catalog = RT::Catalog->new( $HTML::Mason::Commands::session{CurrentUser} );
$catalog->Load($HTML::Mason::Commands::DECODED_ARGS->{id}) if $HTML::Mason::Commands::DECODED_ARGS->{id};
if ($catalog->id and $catalog->CurrentUserCanSee) {
my $query = "id=" . $catalog->id;
- $page->child("modify", title => HTML::Mason::Commands::loc("Basics"), path => "/Admin/Assets/Catalogs/Modify.html?$query");
- $page->child("people", title => HTML::Mason::Commands::loc("Roles"), path => "/Admin/Assets/Catalogs/Roles.html?$query");
+ $page->child("modify", title => loc("Basics"), path => "/Admin/Assets/Catalogs/Modify.html?$query");
+ $page->child("people", title => loc("Roles"), path => "/Admin/Assets/Catalogs/Roles.html?$query");
- $page->child("cfs", title => HTML::Mason::Commands::loc("Asset Custom Fields"), path => "/Admin/Assets/Catalogs/CustomFields.html?$query");
+ $page->child("cfs", title => loc("Asset Custom Fields"), path => "/Admin/Assets/Catalogs/CustomFields.html?$query");
- $page->child("group-rights", title => HTML::Mason::Commands::loc("Group Rights"), path => "/Admin/Assets/Catalogs/GroupRights.html?$query");
- $page->child("user-rights", title => HTML::Mason::Commands::loc("User Rights"), path => "/Admin/Assets/Catalogs/UserRights.html?$query");
+ $page->child("group-rights", title => loc("Group Rights"), path => "/Admin/Assets/Catalogs/GroupRights.html?$query");
+ $page->child("user-rights", title => loc("User Rights"), path => "/Admin/Assets/Catalogs/UserRights.html?$query");
}
}
@@ -603,15 +605,15 @@ sub BuildMainNav {
if (HTML::Mason::Commands::PageMenu()->child('summary')) {
# Already set up from having AdminUser and ShowConfigTab;
# but rename "Basics" to "Edit" in this context
- HTML::Mason::Commands::PageMenu()->child( 'basics' )->title( HTML::Mason::Commands::loc('Edit') );
+ HTML::Mason::Commands::PageMenu()->child( 'basics' )->title( loc('Edit') );
} elsif ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'ShowUserHistory' ) ) {
- HTML::Mason::Commands::PageMenu()->child( display => title => HTML::Mason::Commands::loc('Summary'), path => '/User/Summary.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
- HTML::Mason::Commands::PageMenu()->child( history => title => HTML::Mason::Commands::loc('History'), path => '/User/History.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
+ HTML::Mason::Commands::PageMenu()->child( display => title => loc('Summary'), path => '/User/Summary.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
+ HTML::Mason::Commands::PageMenu()->child( history => title => loc('History'), path => '/User/History.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
}
}
if ( $request_path =~ /^\/(?:index.html|$)/ ) {
- HTML::Mason::Commands::PageMenu()->child( edit => title => HTML::Mason::Commands::loc('Edit'), path => '/Prefs/MyRT.html' );
+ HTML::Mason::Commands::PageMenu()->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' );
}
# due to historical reasons of always having been in /Elements/Tabs
@@ -625,12 +627,12 @@ sub _BuildAssetMenu {
$asset->Load($id);
if ($asset->id) {
- $page->child("display", title => HTML::Mason::Commands::loc("Display"), path => "/Asset/Display.html?id=$id");
- $page->child("history", title => HTML::Mason::Commands::loc("History"), path => "/Asset/History.html?id=$id");
- $page->child("basics", title => HTML::Mason::Commands::loc("Basics"), path => "/Asset/Modify.html?id=$id");
- $page->child("links", title => HTML::Mason::Commands::loc("Links"), path => "/Asset/ModifyLinks.html?id=$id");
- $page->child("people", title => HTML::Mason::Commands::loc("People"), path => "/Asset/ModifyPeople.html?id=$id");
- $page->child("dates", title => HTML::Mason::Commands::loc("Dates"), path => "/Asset/ModifyDates.html?id=$id");
+ $page->child("display", title => loc("Display"), path => "/Asset/Display.html?id=$id");
+ $page->child("history", title => loc("History"), path => "/Asset/History.html?id=$id");
+ $page->child("basics", title => loc("Basics"), path => "/Asset/Modify.html?id=$id");
+ $page->child("links", title => loc("Links"), path => "/Asset/ModifyLinks.html?id=$id");
+ $page->child("people", title => loc("People"), path => "/Asset/ModifyPeople.html?id=$id");
+ $page->child("dates", title => loc("Dates"), path => "/Asset/ModifyDates.html?id=$id");
for my $grouping (RT::CustomField->CustomGroupings($asset)) {
my $cfs = $asset->CustomFields;
@@ -638,7 +640,7 @@ sub _BuildAssetMenu {
next unless $cfs->Count;
$page->child(
"cf-grouping-$grouping",
- title => HTML::Mason::Commands::loc($grouping),
+ title => loc($grouping),
path => "/Asset/ModifyCFs.html?id=$id;Grouping=" . $HTML::Mason::Commands::m->interp->apply_escapes($grouping, 'u'),
);
}
@@ -653,8 +655,8 @@ sub _BuildAssetMenuActionSubmenu {
my $page = HTML::Mason::Commands::PageMenu();
my $id = $asset->id;
- my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
- $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
+ my $actions = $page->child("actions", title => loc("Actions"));
+ $actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
my $status = $asset->Status;
my $lifecycle = $asset->LifecycleObj;
@@ -668,7 +670,7 @@ sub _BuildAssetMenuActionSubmenu {
my $label = $action->{'label'} || ucfirst($next);
$actions->child(
$label,
- title => HTML::Mason::Commands::loc($label),
+ title => loc($label),
path => "/Asset/Modify.html?id=$id;Update=1;DisplayAfter=1;Status="
. $HTML::Mason::Commands::m->interp->apply_escapes($next, 'u'),
@@ -685,222 +687,222 @@ sub _BuildAdminMenu {
my $request_path = shift;
my $top = shift;
- my $admin = $top->child( admin => title => HTML::Mason::Commands::loc('Admin'), path => '/Admin/' );
+ my $admin = $top->child( admin => title => loc('Admin'), path => '/Admin/' );
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) {
my $users = $admin->child( users =>
- title => HTML::Mason::Commands::loc('Users'),
- description => HTML::Mason::Commands::loc('Manage users and passwords'),
+ title => loc('Users'),
+ description => loc('Manage users and passwords'),
path => '/Admin/Users/',
);
- $users->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Users/" );
- $users->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Users/Modify.html?Create=1" );
+ $users->child( select => title => loc('Select'), path => "/Admin/Users/" );
+ $users->child( create => title => loc('Create'), path => "/Admin/Users/Modify.html?Create=1" );
}
my $groups = $admin->child( groups =>
- title => HTML::Mason::Commands::loc('Groups'),
- description => HTML::Mason::Commands::loc('Manage groups and group membership'),
+ title => loc('Groups'),
+ description => loc('Manage groups and group membership'),
path => '/Admin/Groups/',
);
- $groups->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Groups/" );
- $groups->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Groups/Modify.html?Create=1" );
+ $groups->child( select => title => loc('Select'), path => "/Admin/Groups/" );
+ $groups->child( create => title => loc('Create'), path => "/Admin/Groups/Modify.html?Create=1" );
my $queues = $admin->child( queues =>
- title => HTML::Mason::Commands::loc('Queues'),
- description => HTML::Mason::Commands::loc('Manage queues and queue-specific properties'),
+ title => loc('Queues'),
+ description => loc('Manage queues and queue-specific properties'),
path => '/Admin/Queues/',
);
- $queues->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Queues/" );
- $queues->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" );
+ $queues->child( select => title => loc('Select'), path => "/Admin/Queues/" );
+ $queues->child( create => title => loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" );
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomField' ) ) {
my $cfs = $admin->child( 'custom-fields' =>
- title => HTML::Mason::Commands::loc('Custom Fields'),
- description => HTML::Mason::Commands::loc('Manage custom fields and custom field values'),
+ title => loc('Custom Fields'),
+ description => loc('Manage custom fields and custom field values'),
path => '/Admin/CustomFields/',
);
- $cfs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/CustomFields/" );
- $cfs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/CustomFields/Modify.html?Create=1" );
+ $cfs->child( select => title => loc('Select'), path => "/Admin/CustomFields/" );
+ $cfs->child( create => title => loc('Create'), path => "/Admin/CustomFields/Modify.html?Create=1" );
}
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomRoles' ) ) {
my $roles = $admin->child( 'custom-roles' =>
- title => HTML::Mason::Commands::loc('Custom Roles'),
- description => HTML::Mason::Commands::loc('Manage custom roles'),
+ title => loc('Custom Roles'),
+ description => loc('Manage custom roles'),
path => '/Admin/CustomRoles/',
);
- $roles->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/CustomRoles/" );
- $roles->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/CustomRoles/Modify.html?Create=1" );
+ $roles->child( select => title => loc('Select'), path => "/Admin/CustomRoles/" );
+ $roles->child( create => title => loc('Create'), path => "/Admin/CustomRoles/Modify.html?Create=1" );
}
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'ModifyScrips' ) ) {
my $scrips = $admin->child( 'scrips' =>
- title => HTML::Mason::Commands::loc('Scrips'),
- description => HTML::Mason::Commands::loc('Manage scrips'),
+ title => loc('Scrips'),
+ description => loc('Manage scrips'),
path => '/Admin/Scrips/',
);
- $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Scrips/" );
- $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html" );
+ $scrips->child( select => title => loc('Select'), path => "/Admin/Scrips/" );
+ $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html" );
}
my $admin_global = $admin->child( global =>
- title => HTML::Mason::Commands::loc('Global'),
- description => HTML::Mason::Commands::loc('Manage properties and configuration which apply to all queues'),
+ title => loc('Global'),
+ description => loc('Manage properties and configuration which apply to all queues'),
path => '/Admin/Global/',
);
my $scrips = $admin_global->child( scrips =>
- title => HTML::Mason::Commands::loc('Scrips'),
- description => HTML::Mason::Commands::loc('Modify scrips which apply to all queues'),
+ title => loc('Scrips'),
+ description => loc('Modify scrips which apply to all queues'),
path => '/Admin/Global/Scrips.html',
);
- $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Scrips.html" );
- $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
+ $scrips->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
+ $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
my $templates = $admin_global->child( templates =>
- title => HTML::Mason::Commands::loc('Templates'),
- description => HTML::Mason::Commands::loc('Edit system templates'),
+ title => loc('Templates'),
+ description => loc('Edit system templates'),
path => '/Admin/Global/Templates.html',
);
- $templates->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Templates.html" );
- $templates->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
+ $templates->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
+ $templates->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
my $cfadmin = $admin_global->child( 'custom-fields' =>
- title => HTML::Mason::Commands::loc('Custom Fields'),
- description => HTML::Mason::Commands::loc('Modify global custom fields'),
+ title => loc('Custom Fields'),
+ description => loc('Modify global custom fields'),
path => '/Admin/Global/CustomFields/index.html',
);
$cfadmin->child( users =>
- title => HTML::Mason::Commands::loc('Users'),
- description => HTML::Mason::Commands::loc('Select custom fields for all users'),
+ title => loc('Users'),
+ description => loc('Select custom fields for all users'),
path => '/Admin/Global/CustomFields/Users.html',
);
$cfadmin->child( groups =>
- title => HTML::Mason::Commands::loc('Groups'),
- description => HTML::Mason::Commands::loc('Select custom fields for all user groups'),
+ title => loc('Groups'),
+ description => loc('Select custom fields for all user groups'),
path => '/Admin/Global/CustomFields/Groups.html',
);
$cfadmin->child( queues =>
- title => HTML::Mason::Commands::loc('Queues'),
- description => HTML::Mason::Commands::loc('Select custom fields for all queues'),
+ title => loc('Queues'),
+ description => loc('Select custom fields for all queues'),
path => '/Admin/Global/CustomFields/Queues.html',
);
$cfadmin->child( tickets =>
- title => HTML::Mason::Commands::loc('Tickets'),
- description => HTML::Mason::Commands::loc('Select custom fields for tickets in all queues'),
+ title => loc('Tickets'),
+ description => loc('Select custom fields for tickets in all queues'),
path => '/Admin/Global/CustomFields/Queue-Tickets.html',
);
$cfadmin->child( transactions =>
- title => HTML::Mason::Commands::loc('Ticket Transactions'),
- description => HTML::Mason::Commands::loc('Select custom fields for transactions on tickets in all queues'),
+ title => loc('Ticket Transactions'),
+ description => loc('Select custom fields for transactions on tickets in all queues'),
path => '/Admin/Global/CustomFields/Queue-Transactions.html',
);
$cfadmin->child( 'custom-fields' =>
- title => HTML::Mason::Commands::loc('Articles'),
- description => HTML::Mason::Commands::loc('Select Custom Fields for Articles in all Classes'),
+ title => loc('Articles'),
+ description => loc('Select Custom Fields for Articles in all Classes'),
path => '/Admin/Global/CustomFields/Class-Article.html',
);
$cfadmin->child( 'assets' =>
- title => HTML::Mason::Commands::loc('Assets'),
- description => HTML::Mason::Commands::loc('Select Custom Fields for Assets in all Catalogs'),
+ title => loc('Assets'),
+ description => loc('Select Custom Fields for Assets in all Catalogs'),
path => '/Admin/Global/CustomFields/Catalog-Assets.html',
);
- my $article_admin = $admin->child( articles => title => HTML::Mason::Commands::loc('Articles'), path => "/Admin/Articles/index.html" );
- my $class_admin = $article_admin->child(classes => title => HTML::Mason::Commands::loc('Classes'), path => '/Admin/Articles/Classes/' );
+ my $article_admin = $admin->child( articles => title => loc('Articles'), path => "/Admin/Articles/index.html" );
+ my $class_admin = $article_admin->child(classes => title => loc('Classes'), path => '/Admin/Articles/Classes/' );
$class_admin->child( select =>
- title => HTML::Mason::Commands::loc('Select'),
- description => HTML::Mason::Commands::loc('Modify and Create Classes'),
+ title => loc('Select'),
+ description => loc('Modify and Create Classes'),
path => '/Admin/Articles/Classes/',
);
$class_admin->child( create =>
- title => HTML::Mason::Commands::loc('Create'),
- description => HTML::Mason::Commands::loc('Modify and Create Custom Fields for Articles'),
+ title => loc('Create'),
+ description => loc('Modify and Create Custom Fields for Articles'),
path => '/Admin/Articles/Classes/Modify.html?Create=1',
);
my $cfs = $article_admin->child( 'custom-fields' =>
- title => HTML::Mason::Commands::loc('Custom Fields'),
+ title => loc('Custom Fields'),
path => '/Admin/CustomFields/index.html?'.$HTML::Mason::Commands::m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
);
$cfs->child( select =>
- title => HTML::Mason::Commands::loc('Select'),
+ title => loc('Select'),
path => '/Admin/CustomFields/index.html?'.$HTML::Mason::Commands::m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
);
$cfs->child( create =>
- title => HTML::Mason::Commands::loc('Create'),
+ title => loc('Create'),
path => '/Admin/CustomFields/Modify.html?'.$HTML::Mason::Commands::m->comp("/Elements/QueryString", Create=>1, LookupType=> "RT::Class-RT::Article" ),
);
- my $assets_admin = $admin->child( assets => title => HTML::Mason::Commands::loc("Assets"), path => '/Admin/Assets/' );
+ my $assets_admin = $admin->child( assets => title => loc("Assets"), path => '/Admin/Assets/' );
my $catalog_admin = $assets_admin->child( catalogs =>
- title => HTML::Mason::Commands::loc("Catalogs"),
- description => HTML::Mason::Commands::loc("Modify asset catalogs"),
+ title => loc("Catalogs"),
+ description => loc("Modify asset catalogs"),
path => "/Admin/Assets/Catalogs/"
);
- $catalog_admin->child( "select", title => HTML::Mason::Commands::loc("Select"), path => $catalog_admin->path );
- $catalog_admin->child( "create", title => HTML::Mason::Commands::loc("Create"), path => "Create.html" );
+ $catalog_admin->child( "select", title => loc("Select"), path => $catalog_admin->path );
+ $catalog_admin->child( "create", title => loc("Create"), path => "Create.html" );
my $assets_cfs = $assets_admin->child( "cfs",
- title => HTML::Mason::Commands::loc("Custom Fields"),
- description => HTML::Mason::Commands::loc("Modify asset custom fields"),
+ title => loc("Custom Fields"),
+ description => loc("Modify asset custom fields"),
path => "/Admin/CustomFields/?Type=" . RT::Asset->CustomFieldLookupType
);
- $assets_cfs->child( "select", title => HTML::Mason::Commands::loc("Select"), path => $assets_cfs->path );
- $assets_cfs->child( "create", title => HTML::Mason::Commands::loc("Create"), path => "/Admin/CustomFields/Modify.html?Create=1&LookupType=" . RT::Asset->CustomFieldLookupType);
+ $assets_cfs->child( "select", title => loc("Select"), path => $assets_cfs->path );
+ $assets_cfs->child( "create", title => loc("Create"), path => "/Admin/CustomFields/Modify.html?Create=1&LookupType=" . RT::Asset->CustomFieldLookupType);
$admin_global->child( 'group-rights' =>
- title => HTML::Mason::Commands::loc('Group Rights'),
- description => HTML::Mason::Commands::loc('Modify global group rights'),
+ title => loc('Group Rights'),
+ description => loc('Modify global group rights'),
path => '/Admin/Global/GroupRights.html',
);
$admin_global->child( 'user-rights' =>
- title => HTML::Mason::Commands::loc('User Rights'),
- description => HTML::Mason::Commands::loc('Modify global user rights'),
+ title => loc('User Rights'),
+ description => loc('Modify global user rights'),
path => '/Admin/Global/UserRights.html',
);
$admin_global->child( 'my-rt' =>
- title => HTML::Mason::Commands::loc('RT at a glance'),
- description => HTML::Mason::Commands::loc('Modify the default "RT at a glance" view'),
+ title => loc('RT at a glance'),
+ description => loc('Modify the default "RT at a glance" view'),
path => '/Admin/Global/MyRT.html',
);
$admin_global->child( 'dashboards-in-menu' =>
- title => HTML::Mason::Commands::loc('Dashboards in menu'),
- description => HTML::Mason::Commands::loc('Customize dashboards in menu'),
+ title => loc('Dashboards in menu'),
+ description => loc('Customize dashboards in menu'),
path => '/Admin/Global/DashboardsInMenu.html',
);
$admin_global->child( 'topics' =>
- title => HTML::Mason::Commands::loc('Topics'),
- description => HTML::Mason::Commands::loc('Modify global article topics'),
+ title => loc('Topics'),
+ description => loc('Modify global article topics'),
path => '/Admin/Global/Topics.html',
);
my $admin_tools = $admin->child( tools =>
- title => HTML::Mason::Commands::loc('Tools'),
- description => HTML::Mason::Commands::loc('Use other RT administrative tools'),
+ title => loc('Tools'),
+ description => loc('Use other RT administrative tools'),
path => '/Admin/Tools/',
);
$admin_tools->child( configuration =>
- title => HTML::Mason::Commands::loc('System Configuration'),
- description => HTML::Mason::Commands::loc('Detailed information about your RT setup'),
+ title => loc('System Configuration'),
+ description => loc('Detailed information about your RT setup'),
path => '/Admin/Tools/Configuration.html',
);
$admin_tools->child( theme =>
- title => HTML::Mason::Commands::loc('Theme'),
- description => HTML::Mason::Commands::loc('Customize the look of your RT'),
+ title => loc('Theme'),
+ description => loc('Customize the look of your RT'),
path => '/Admin/Tools/Theme.html',
);
if (RT->Config->Get('StatementLog')
&& $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
$admin_tools->child( 'sql-queries' =>
- title => HTML::Mason::Commands::loc('SQL Queries'),
- description => HTML::Mason::Commands::loc('Browse the SQL queries made in this process'),
+ title => loc('SQL Queries'),
+ description => loc('Browse the SQL queries made in this process'),
path => '/Admin/Tools/Queries.html',
);
}
$admin_tools->child( shredder =>
- title => HTML::Mason::Commands::loc('Shredder'),
- description => HTML::Mason::Commands::loc('Permanently wipeout data from RT'),
+ title => loc('Shredder'),
+ description => loc('Permanently wipeout data from RT'),
path => '/Admin/Tools/Shredder',
);
@@ -909,11 +911,11 @@ sub _BuildAdminMenu {
my $tabs = HTML::Mason::Commands::PageMenu();
my %labels = (
- Queues => HTML::Mason::Commands::loc("Queues"),
- Users => HTML::Mason::Commands::loc("Users"),
- Groups => HTML::Mason::Commands::loc("Groups"),
- CustomFields => HTML::Mason::Commands::loc("Custom Fields"),
- CustomRoles => HTML::Mason::Commands::loc("Custom Roles"),
+ Queues => loc("Queues"),
+ Users => loc("Users"),
+ Groups => loc("Groups"),
+ CustomFields => loc("Custom Fields"),
+ CustomRoles => loc("Custom Roles"),
);
my $section;
@@ -929,8 +931,8 @@ sub _BuildAdminMenu {
path => "/Admin/$type/" );
}
- $section->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/$type/" );
- $section->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/$type/Modify.html?Create=1" );
+ $section->child( select => title => loc('Select'), path => "/Admin/$type/" );
+ $section->child( create => title => loc('Create'), path => "/Admin/$type/Modify.html?Create=1" );
}
if ( $request_path =~ m{^/Admin/Queues} ) {
@@ -944,28 +946,28 @@ sub _BuildAdminMenu {
if ( $queue_obj and $queue_obj->id ) {
my $queue = HTML::Mason::Commands::PageMenu();
- $queue->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Queues/Modify.html?id=" . $id );
- $queue->child( people => title => HTML::Mason::Commands::loc('Watchers'), path => "/Admin/Queues/People.html?id=" . $id );
+ $queue->child( basics => title => loc('Basics'), path => "/Admin/Queues/Modify.html?id=" . $id );
+ $queue->child( people => title => loc('Watchers'), path => "/Admin/Queues/People.html?id=" . $id );
- my $templates = $queue->child(templates => title => HTML::Mason::Commands::loc('Templates'), path => "/Admin/Queues/Templates.html?id=" . $id);
- $templates->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Queues/Templates.html?id=".$id);
- $templates->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Queues/Template.html?Create=1;Queue=".$id);
+ my $templates = $queue->child(templates => title => loc('Templates'), path => "/Admin/Queues/Templates.html?id=" . $id);
+ $templates->child( select => title => loc('Select'), path => "/Admin/Queues/Templates.html?id=".$id);
+ $templates->child( create => title => loc('Create'), path => "/Admin/Queues/Template.html?Create=1;Queue=".$id);
- my $scrips = $queue->child( scrips => title => HTML::Mason::Commands::loc('Scrips'), path => "/Admin/Queues/Scrips.html?id=" . $id);
- $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Queues/Scrips.html?id=" . $id );
- $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html?Queue=" . $id);
+ my $scrips = $queue->child( scrips => title => loc('Scrips'), path => "/Admin/Queues/Scrips.html?id=" . $id);
+ $scrips->child( select => title => loc('Select'), path => "/Admin/Queues/Scrips.html?id=" . $id );
+ $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Queue=" . $id);
- my $cfs = $queue->child( 'custom-fields' => title => HTML::Mason::Commands::loc('Custom Fields') );
- my $ticket_cfs = $cfs->child( 'tickets' => title => HTML::Mason::Commands::loc('Tickets'),
+ my $cfs = $queue->child( 'custom-fields' => title => loc('Custom Fields') );
+ my $ticket_cfs = $cfs->child( 'tickets' => title => loc('Tickets'),
path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket&id=' . $id );
- my $txn_cfs = $cfs->child( 'transactions' => title => HTML::Mason::Commands::loc('Transactions'),
+ my $txn_cfs = $cfs->child( 'transactions' => title => loc('Transactions'),
path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id );
- $queue->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/Queues/GroupRights.html?id=".$id );
- $queue->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/Queues/UserRights.html?id=" . $id );
- $queue->child( 'history' => title => HTML::Mason::Commands::loc('History'), path => "/Admin/Queues/History.html?id=" . $id );
- $queue->child( 'default-values' => title => HTML::Mason::Commands::loc('Default Values'), path => "/Admin/Queues/DefaultValues.html?id=" . $id );
+ $queue->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Queues/GroupRights.html?id=".$id );
+ $queue->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Queues/UserRights.html?id=" . $id );
+ $queue->child( 'history' => title => loc('History'), path => "/Admin/Queues/History.html?id=" . $id );
+ $queue->child( 'default-values' => title => loc('Default Values'), path => "/Admin/Queues/DefaultValues.html?id=" . $id );
# due to historical reasons of always having been in /Elements/Tabs
$HTML::Mason::Commands::m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue, CallbackPage => '/Elements/Tabs' );
@@ -980,18 +982,18 @@ sub _BuildAdminMenu {
if ( $obj and $obj->id ) {
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id );
- $tabs->child( memberships => title => HTML::Mason::Commands::loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id );
- $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Admin/Users/History.html?id=" . $id );
- $tabs->child( 'my-rt' => title => HTML::Mason::Commands::loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id );
+ $tabs->child( basics => title => loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id );
+ $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id );
+ $tabs->child( history => title => loc('History'), path => "/Admin/Users/History.html?id=" . $id );
+ $tabs->child( 'my-rt' => title => loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id );
$tabs->child( 'dashboards-in-menu' =>
- title => HTML::Mason::Commands::loc('Dashboards in menu'),
+ title => loc('Dashboards in menu'),
path => '/Admin/Users/DashboardsInMenu.html?id=' . $id,
);
if ( RT->Config->Get('Crypt')->{'Enable'} ) {
- $tabs->child( keys => title => HTML::Mason::Commands::loc('Private keys'), path => "/Admin/Users/Keys.html?id=" . $id );
+ $tabs->child( keys => title => loc('Private keys'), path => "/Admin/Users/Keys.html?id=" . $id );
}
- $tabs->child( 'summary' => title => HTML::Mason::Commands::loc('User Summary'), path => "/User/Summary.html?id=" . $id );
+ $tabs->child( 'summary' => title => loc('User Summary'), path => "/User/Summary.html?id=" . $id );
}
}
@@ -1005,12 +1007,12 @@ sub _BuildAdminMenu {
if ( $obj and $obj->id ) {
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id );
- $tabs->child( members => title => HTML::Mason::Commands::loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id );
- $tabs->child( memberships => title => HTML::Mason::Commands::loc('Memberships'), path => "/Admin/Groups/Memberships.html?id=" . $obj->id );
- $tabs->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id );
- $tabs->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id );
- $tabs->child( history => title => HTML::Mason::Commands::loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id );
+ $tabs->child( basics => title => loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id );
+ $tabs->child( members => title => loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id );
+ $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Groups/Memberships.html?id=" . $obj->id );
+ $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id );
+ $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id );
+ $tabs->child( history => title => loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id );
}
}
}
@@ -1023,11 +1025,11 @@ sub _BuildAdminMenu {
if ( $obj and $obj->id ) {
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id );
- $tabs->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id );
- $tabs->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id );
+ $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id );
+ $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id );
+ $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id );
unless ( $obj->IsOnlyGlobal ) {
- $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id );
+ $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id );
}
}
}
@@ -1041,8 +1043,8 @@ sub _BuildAdminMenu {
if ( $obj and $obj->id ) {
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/CustomRoles/Modify.html?id=".$id );
- $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/CustomRoles/Objects.html?id=" . $id );
+ $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomRoles/Modify.html?id=".$id );
+ $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomRoles/Objects.html?id=" . $id );
}
}
}
@@ -1072,43 +1074,43 @@ sub _BuildAdminMenu {
$admin_cat = 'Scrips';
$from_query_param = $create_path_arg = q{};
}
- my $scrips = $tabs->child( scrips => title => HTML::Mason::Commands::loc('Scrips'), path => "/Admin/${admin_cat}" );
- $scrips->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/${admin_cat}" );
- $scrips->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html${create_path_arg}" );
+ my $scrips = $tabs->child( scrips => title => loc('Scrips'), path => "/Admin/${admin_cat}" );
+ $scrips->child( select => title => loc('Select'), path => "/Admin/${admin_cat}" );
+ $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html${create_path_arg}" );
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics') => path => "/Admin/Scrips/Modify.html?id=" . $id . $from_query_param );
- $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id . $from_query_param );
+ $tabs->child( basics => title => loc('Basics') => path => "/Admin/Scrips/Modify.html?id=" . $id . $from_query_param );
+ $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id . $from_query_param );
}
elsif ( $request_path =~ m{^/Admin/Scrips/(index\.html)?$} ) {
- HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Scrips/" );
- HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html" );
+ HTML::Mason::Commands::PageMenu->child( select => title => loc('Select') => path => "/Admin/Scrips/" );
+ HTML::Mason::Commands::PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html" );
}
elsif ( $request_path =~ m{^/Admin/Scrips/Create\.html$} ) {
my ($queue) = $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} && $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} =~ /^(\d+)$/;
my $global_arg = $HTML::Mason::Commands::DECODED_ARGS->{'Global'};
if ($queue) {
- HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Queues/Scrips.html?id=$queue" );
- HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html?Queue=$queue" );
+ HTML::Mason::Commands::PageMenu->child( select => title => loc('Select') => path => "/Admin/Queues/Scrips.html?id=$queue" );
+ HTML::Mason::Commands::PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html?Queue=$queue" );
} elsif ($global_arg) {
- HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Global/Scrips.html" );
- HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html?Global=1" );
+ HTML::Mason::Commands::PageMenu->child( select => title => loc('Select') => path => "/Admin/Global/Scrips.html" );
+ HTML::Mason::Commands::PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html?Global=1" );
} else {
- HTML::Mason::Commands::PageMenu->child( select => title => HTML::Mason::Commands::loc('Select') => path => "/Admin/Scrips" );
- HTML::Mason::Commands::PageMenu->child( create => title => HTML::Mason::Commands::loc('Create') => path => "/Admin/Scrips/Create.html" );
+ HTML::Mason::Commands::PageMenu->child( select => title => loc('Select') => path => "/Admin/Scrips" );
+ HTML::Mason::Commands::PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html" );
}
}
}
if ( $request_path =~ m{^/Admin/Global/Scrips\.html} ) {
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Scrips.html" );
- $tabs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
+ $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
+ $tabs->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
}
if ( $request_path =~ m{^/Admin/Global/Templates?\.html} ) {
my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Global/Templates.html" );
- $tabs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
+ $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
+ $tabs->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
}
if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
@@ -1118,20 +1120,20 @@ sub _BuildAdminMenu {
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $section = $tabs->child( select => title => HTML::Mason::Commands::loc("Classes"), path => "/Admin/Articles/Classes/" );
- $section->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Articles/Classes/" );
- $section->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
-
- $tabs->child( basics => title => HTML::Mason::Commands::loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id );
- $tabs->child( topics => title => HTML::Mason::Commands::loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id );
- $tabs->child( 'custom-fields' => title => HTML::Mason::Commands::loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id );
- $tabs->child( 'group-rights' => title => HTML::Mason::Commands::loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id );
- $tabs->child( 'user-rights' => title => HTML::Mason::Commands::loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id );
- $tabs->child( 'applies-to' => title => HTML::Mason::Commands::loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" );
+ my $section = $tabs->child( select => title => loc("Classes"), path => "/Admin/Articles/Classes/" );
+ $section->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
+ $section->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
+
+ $tabs->child( basics => title => loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id );
+ $tabs->child( topics => title => loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id );
+ $tabs->child( 'custom-fields' => title => loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id );
+ $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id );
+ $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id );
+ $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" );
}
} else {
- $tabs->child( select => title => HTML::Mason::Commands::loc('Select'), path => "/Admin/Articles/Classes/" );
- $tabs->child( create => title => HTML::Mason::Commands::loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
+ $tabs->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
+ $tabs->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
}
}
}
@@ -1156,34 +1158,34 @@ sub BuildSelfServiceNav {
if ( $queue_count > 1 ) {
- HTML::Mason::Commands::Menu()->child( new => title => HTML::Mason::Commands::loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
+ HTML::Mason::Commands::Menu()->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
} elsif ( $queue_id ) {
- HTML::Mason::Commands::Menu()->child( new => title => HTML::Mason::Commands::loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
+ HTML::Mason::Commands::Menu()->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
}
- my $tickets = HTML::Mason::Commands::Menu()->child( tickets => title => HTML::Mason::Commands::loc('Tickets'), path => '/SelfService/' );
- $tickets->child( open => title => HTML::Mason::Commands::loc('Open tickets'), path => '/SelfService/' );
- $tickets->child( closed => title => HTML::Mason::Commands::loc('Closed tickets'), path => '/SelfService/Closed.html' );
+ my $tickets = HTML::Mason::Commands::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' );
- HTML::Mason::Commands::Menu()->child( "assets", title => HTML::Mason::Commands::loc("Assets"), path => "/SelfService/Asset/" )
+ HTML::Mason::Commands::Menu()->child( "assets", title => loc("Assets"), path => "/SelfService/Asset/" )
if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
my $username = '<span class="current-user">'
. $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
. '</span>';
my $about_me = HTML::Mason::Commands::Menu()->child( preferences =>
- title => HTML::Mason::Commands::loc('Logged in as [_1]', $username),
+ title => loc('Logged in as [_1]', $username),
escape_title => 0,
sort_order => 99,
);
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System ) ) {
- $about_me->child( prefs => title => HTML::Mason::Commands::loc('Preferences'), path => '/SelfService/Prefs.html' );
+ $about_me->child( prefs => title => loc('Preferences'), path => '/SelfService/Prefs.html' );
}
if ( $HTML::Mason::Commands::session{'CurrentUser'}->Name
&& ( !RT->Config->Get('WebRemoteUserAuth')
|| RT->Config->Get('WebFallbackToRTLogin') )) {
- $about_me->child( logout => title => HTML::Mason::Commands::loc('Logout'), path => '/NoAuth/Logout.html' );
+ $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
}
if ($HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowArticle', Object => RT->System )) {
@@ -1195,12 +1197,12 @@ sub BuildSelfServiceNav {
if ($request_path =~ m{^/SelfService/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id}) {
my $page = HTML::Mason::Commands::PageMenu();
my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
- $page->child("display", title => HTML::Mason::Commands::loc("Display"), path => "/SelfService/Asset/Display.html?id=$id");
- $page->child("history", title => HTML::Mason::Commands::loc("History"), path => "/SelfService/Asset/History.html?id=$id");
+ $page->child("display", title => loc("Display"), path => "/SelfService/Asset/Display.html?id=$id");
+ $page->child("history", title => loc("History"), path => "/SelfService/Asset/History.html?id=$id");
if (Menu->child("new")) {
- my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
- $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id");
+ my $actions = $page->child("actions", title => loc("Actions"));
+ $actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id");
}
}
commit d5d95f972773f338324ffaf9028cf7dcd56e972f
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:42:31 2016 +0000
replace repeated calls to HTML::Mason::Commands::Menu() with $top variable
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 48b5c29..11c2402 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -74,6 +74,8 @@ sub BuildMainNav {
my $query_string = $args{QueryString};
my $query_args = $args{QueryArgs};
+ my $top = HTML::Mason::Commands::Menu();
+
if ($request_path =~ m{^/Asset/}) {
HTML::Mason::Commands::PageWidgets()->child( asset_search => raw_html => $HTML::Mason::Commands::m->scomp('/Asset/Elements/Search') );
} else {
@@ -81,7 +83,7 @@ sub BuildMainNav {
HTML::Mason::Commands::PageWidgets()->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket') );
}
- my $home = HTML::Mason::Commands::Menu()->child( home => title => loc('Homepage'), path => '/' );
+ my $home = $top->child( home => title => loc('Homepage'), path => '/' );
unless ($HTML::Mason::Commands::session{'dashboards_in_menu'}) {
my $dashboards_in_menu = $HTML::Mason::Commands::session{CurrentUser}->UserObj->Preferences(
'DashboardsInMenu',
@@ -112,7 +114,7 @@ sub BuildMainNav {
}
}
- my $dashes = HTML::Mason::Commands::Menu()->child('home');
+ my $dashes = $top->child('home');
if (@dashboards) {
for my $dash (@dashboards) {
$home->child( 'dashboard-' . $dash->id,
@@ -128,7 +130,7 @@ sub BuildMainNav {
$dashes->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" );
}
- my $search = HTML::Mason::Commands::Menu()->child( search => title => loc('Search'), path => '/Search/Simple.html' );
+ my $search = $top->child( search => title => loc('Search'), path => '/Search/Simple.html' );
my $tickets = $search->child( tickets => title => loc('Tickets'), path => '/Search/Build.html' );
$tickets->child( simple => title => loc('Simple Search'), path => "/Search/Simple.html" );
@@ -143,7 +145,7 @@ sub BuildMainNav {
if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
- my $articles = HTML::Mason::Commands::Menu()->child( articles => title => loc('Articles'), path => "/Articles/index.html");
+ my $articles = $top->child( articles => title => loc('Articles'), path => "/Articles/index.html");
$articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" );
$articles->child( topics => title => loc('Topics'), path => "/Articles/Topics.html" );
$articles->child( create => title => loc('Create'), path => "/Articles/Article/PreCreate.html" );
@@ -151,12 +153,12 @@ sub BuildMainNav {
}
if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System )) {
- my $assets = HTML::Mason::Commands::Menu()->child( "assets", title => loc("Assets"), path => "/Asset/Search/" );
+ my $assets = $top->child( "assets", title => loc("Assets"), path => "/Asset/Search/" );
$assets->child( "create", title => loc("Create"), path => "/Asset/CreateInCatalog.html" );
$assets->child( "search", title => loc("Search"), path => "/Asset/Search/" );
}
- my $tools = HTML::Mason::Commands::Menu()->child( tools => title => loc('Tools'), path => '/Tools/index.html' );
+ my $tools = $top->child( tools => title => loc('Tools'), path => '/Tools/index.html' );
$tools->child( my_day =>
title => loc('My Day'),
@@ -182,13 +184,13 @@ sub BuildMainNav {
if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
{
- _BuildAdminMenu($request_path, HTML::Mason::Commands::Menu());
+ _BuildAdminMenu($request_path, $top);
}
my $username = '<span class="current-user">'
. $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
. '</span>';
- my $about_me = HTML::Mason::Commands::Menu()->child( 'preferences' =>
+ my $about_me = $top->child( 'preferences' =>
title => loc('Logged in as [_1]', $username),
escape_title => 0,
path => '/User/Summary.html?id=' . $HTML::Mason::Commands::session{CurrentUser}->id,
@@ -364,7 +366,7 @@ sub BuildMainNav {
$HTML::Mason::Commands::session{"tickets"}->PrepForSerialization();
}
- my $search = HTML::Mason::Commands::Menu()->child('search')->child('tickets');
+ my $search = $top->child('search')->child('tickets');
# Don't display prev links if we're on the first ticket
if ( $item_map->{$id}->{prev} ) {
$search->child( first =>
@@ -395,7 +397,7 @@ sub BuildMainNav {
&& $HTML::Mason::Commands::DECODED_ARGS->{'q'} )
)
{
- my $search = HTML::Mason::Commands::Menu()->child('search')->child('tickets');
+ my $search = $top->child('search')->child('tickets');
my $args = '';
my $has_query = '';
my $current_search = $HTML::Mason::Commands::session{"CurrentSearchHash"} || {};
@@ -1143,6 +1145,8 @@ sub BuildSelfServiceNav {
my %args = ( @_ );
+ my $top = HTML::Mason::Commands::Menu();
+
my $queues = RT::Queues->new( $HTML::Mason::Commands::session{'CurrentUser'} );
$queues->UnLimit;
@@ -1158,21 +1162,21 @@ sub BuildSelfServiceNav {
if ( $queue_count > 1 ) {
- HTML::Mason::Commands::Menu()->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
+ $top->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
} elsif ( $queue_id ) {
- HTML::Mason::Commands::Menu()->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
+ $top->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
}
- my $tickets = HTML::Mason::Commands::Menu()->child( tickets => title => loc('Tickets'), path => '/SelfService/' );
+ my $tickets = $top->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' );
- HTML::Mason::Commands::Menu()->child( "assets", title => loc("Assets"), path => "/SelfService/Asset/" )
+ $top->child( "assets", title => loc("Assets"), path => "/SelfService/Asset/" )
if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
my $username = '<span class="current-user">'
. $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
. '</span>';
- my $about_me = HTML::Mason::Commands::Menu()->child( preferences =>
+ my $about_me = $top->child( preferences =>
title => loc('Logged in as [_1]', $username),
escape_title => 0,
sort_order => 99,
commit ede0a8fd0a18ee0fa9365a882f1679332f345cb1
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:44:38 2016 +0000
replace repeated calls to HTML::Mason::Commands::PageWidgets() with $widgets variable
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 11c2402..34d0983 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -74,13 +74,14 @@ sub BuildMainNav {
my $query_string = $args{QueryString};
my $query_args = $args{QueryArgs};
- my $top = HTML::Mason::Commands::Menu();
+ my $top = HTML::Mason::Commands::Menu();
+ my $widgets = HTML::Mason::Commands::PageWidgets();
if ($request_path =~ m{^/Asset/}) {
- HTML::Mason::Commands::PageWidgets()->child( asset_search => raw_html => $HTML::Mason::Commands::m->scomp('/Asset/Elements/Search') );
+ $widgets->child( asset_search => raw_html => $HTML::Mason::Commands::m->scomp('/Asset/Elements/Search') );
} else {
- HTML::Mason::Commands::PageWidgets()->child( simple_search => raw_html => $HTML::Mason::Commands::m->scomp('SimpleSearch') );
- HTML::Mason::Commands::PageWidgets()->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket') );
+ $widgets->child( simple_search => raw_html => $HTML::Mason::Commands::m->scomp('SimpleSearch') );
+ $widgets->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket') );
}
my $home = $top->child( home => title => loc('Homepage'), path => '/' );
@@ -524,9 +525,9 @@ sub BuildMainNav {
}
if ( $request_path =~ m{^/Articles/} ) {
- HTML::Mason::Commands::PageWidgets()->child( article_search => raw_html => $HTML::Mason::Commands::m->scomp('/Articles/Elements/GotoArticle') );
- HTML::Mason::Commands::PageWidgets()->delete('create_ticket');
- HTML::Mason::Commands::PageWidgets()->delete('simple_search');
+ $widgets->child( article_search => raw_html => $HTML::Mason::Commands::m->scomp('/Articles/Elements/GotoArticle') );
+ $widgets->delete('create_ticket');
+ $widgets->delete('simple_search');
my $tabs = HTML::Mason::Commands::PageMenu();
$tabs->child( search => title => loc("Search"), path => "/Articles/Article/Search.html" );
@@ -1145,7 +1146,8 @@ sub BuildSelfServiceNav {
my %args = ( @_ );
- my $top = HTML::Mason::Commands::Menu();
+ my $top = HTML::Mason::Commands::Menu();
+ my $widgets = HTML::Mason::Commands::PageWidgets();
my $queues = RT::Queues->new( $HTML::Mason::Commands::session{'CurrentUser'} );
$queues->UnLimit;
@@ -1193,10 +1195,10 @@ sub BuildSelfServiceNav {
}
if ($HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowArticle', Object => RT->System )) {
- HTML::Mason::Commands::PageWidgets()->child( 'goto-article' => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/SearchArticle') );
+ $widgets->child( 'goto-article' => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/SearchArticle') );
}
- HTML::Mason::Commands::PageWidgets()->child( goto => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/GotoTicket') );
+ $widgets->child( goto => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/GotoTicket') );
if ($request_path =~ m{^/SelfService/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id}) {
my $page = HTML::Mason::Commands::PageMenu();
commit d4eb9e9bed4ef3bf750bd9f47cf28e4a1c1508b0
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 20:51:19 2016 +0000
replace repeated calls to $HTML::Mason::Commands::session{CurrentUser} with $current_user variable
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 34d0983..1f01aa3 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -77,6 +77,8 @@ sub BuildMainNav {
my $top = HTML::Mason::Commands::Menu();
my $widgets = HTML::Mason::Commands::PageWidgets();
+ my $current_user = $HTML::Mason::Commands::session{CurrentUser};
+
if ($request_path =~ m{^/Asset/}) {
$widgets->child( asset_search => raw_html => $HTML::Mason::Commands::m->scomp('/Asset/Elements/Search') );
} else {
@@ -86,14 +88,14 @@ sub BuildMainNav {
my $home = $top->child( home => title => loc('Homepage'), path => '/' );
unless ($HTML::Mason::Commands::session{'dashboards_in_menu'}) {
- my $dashboards_in_menu = $HTML::Mason::Commands::session{CurrentUser}->UserObj->Preferences(
+ my $dashboards_in_menu = $current_user->UserObj->Preferences(
'DashboardsInMenu',
{},
);
unless ($dashboards_in_menu->{dashboards}) {
my ($default_dashboards) =
- RT::System->new( $HTML::Mason::Commands::session{'CurrentUser'} )
+ RT::System->new( $current_user )
->Attributes
->Named('DashboardsInMenu');
if ($default_dashboards) {
@@ -106,7 +108,7 @@ sub BuildMainNav {
my @dashboards;
for my $id ( @{$HTML::Mason::Commands::session{'dashboards_in_menu'}} ) {
- my $dash = RT::Dashboard->new( $HTML::Mason::Commands::session{CurrentUser} );
+ my $dash = RT::Dashboard->new( $current_user );
my ( $status, $msg ) = $dash->LoadById($id);
if ( $status ) {
push @dashboards, $dash;
@@ -126,7 +128,7 @@ sub BuildMainNav {
}
$dashes->child( edit => title => loc('Update This Menu'), path => 'Prefs/DashboardsInMenu.html' );
$dashes->child( more => title => loc('All Dashboards'), path => 'Dashboards/index.html' );
- my $dashboard = RT::Dashboard->new( $HTML::Mason::Commands::session{CurrentUser} );
+ my $dashboard = RT::Dashboard->new( $current_user );
if ( $dashboard->CurrentUserCanCreateAny ) {
$dashes->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" );
}
@@ -138,14 +140,14 @@ sub BuildMainNav {
$tickets->child( new => title => loc('New Search'), path => "/Search/Build.html?NewQuery=1" );
$search->child( articles => title => loc('Articles'), path => "/Articles/Article/Search.html" )
- if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
+ if $current_user->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
$search->child( users => title => loc('Users'), path => "/User/Search.html" );
$search->child( assets => title => loc("Assets"), path => "/Asset/Search/" )
- if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
+ if $current_user->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
- if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
+ if ($current_user->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
my $articles = $top->child( articles => title => loc('Articles'), path => "/Articles/index.html");
$articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" );
$articles->child( topics => title => loc('Topics'), path => "/Articles/Topics.html" );
@@ -153,7 +155,7 @@ sub BuildMainNav {
$articles->child( search => title => loc('Search'), path => "/Articles/Article/Search.html" );
}
- if ($HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System )) {
+ if ($current_user->HasRight( Right => 'ShowAssetsMenu', Object => RT->System )) {
my $assets = $top->child( "assets", title => loc("Assets"), path => "/Asset/Search/" );
$assets->child( "create", title => loc("Create"), path => "/Asset/CreateInCatalog.html" );
$assets->child( "search", title => loc("Search"), path => "/Asset/Search/" );
@@ -175,7 +177,7 @@ sub BuildMainNav {
);
}
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) {
+ if ( $current_user->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) {
$tools->child( approval =>
title => loc('Approval'),
description => loc('My Approvals'),
@@ -183,24 +185,24 @@ sub BuildMainNav {
);
}
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
+ if ( $current_user->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
{
_BuildAdminMenu($request_path, $top);
}
my $username = '<span class="current-user">'
- . $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
+ . $HTML::Mason::Commands::m->interp->apply_escapes($current_user->Name, 'h')
. '</span>';
my $about_me = $top->child( 'preferences' =>
title => loc('Logged in as [_1]', $username),
escape_title => 0,
- path => '/User/Summary.html?id=' . $HTML::Mason::Commands::session{CurrentUser}->id,
+ path => '/User/Summary.html?id=' . $current_user->id,
sort_order => 99,
);
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->UserObj
- && $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System )) {
+ if ( $current_user->UserObj
+ && $current_user->HasRight( Right => 'ModifySelf', Object => RT->System )) {
my $settings = $about_me->child( settings => title => loc('Settings'), path => '/Prefs/Other.html' );
$settings->child( options => title => loc('Preferences'), path => '/Prefs/Other.html' );
$settings->child( about_me => title => loc('About me'), path => '/Prefs/AboutMe.html' );
@@ -214,7 +216,7 @@ sub BuildMainNav {
my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') );
my $searches = [ $HTML::Mason::Commands::m->comp( "/Search/Elements/SearchesForObject",
- Object => RT::System->new( $HTML::Mason::Commands::session{'CurrentUser'} )) ];
+ Object => RT::System->new( $current_user )) ];
my $i = 0;
for my $search (@$searches) {
@@ -226,14 +228,14 @@ sub BuildMainNav {
}
}
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->Name
+ if ( $current_user->Name
&& ( !RT->Config->Get('WebRemoteUserAuth')
|| RT->Config->Get('WebFallbackToRTLogin') )) {
$about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
}
if ( $request_path =~ m{^/Dashboards/(\d+)?}) {
if ( my $id = ( $1 || $HTML::Mason::Commands::DECODED_ARGS->{'id'} ) ) {
- my $obj = RT::Dashboard->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::Dashboard->new( $current_user );
$obj->LoadById($id);
if ( $obj and $obj->id ) {
my $tabs = HTML::Mason::Commands::PageMenu();
@@ -250,7 +252,7 @@ sub BuildMainNav {
if ( $request_path =~ m{^/Ticket/} ) {
if ( ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
- my $obj = RT::Ticket->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::Ticket->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
@@ -355,7 +357,7 @@ sub BuildMainNav {
$actions->child( 'extract-article' =>
title => loc('Extract Article'),
path => "/Articles/Article/ExtractIntoClass.html?Ticket=".$obj->id,
- ) if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
+ ) if $current_user->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
if ( defined $HTML::Mason::Commands::session{"tickets"} ) {
# we have to update session data if we get new ItemMap
@@ -484,22 +486,22 @@ sub BuildMainNav {
OrderBy => $rss_data{OrderBy}
);
my $RSSPath = join '/', map $HTML::Mason::Commands::m->interp->apply_escapes( $_, 'u' ),
- $HTML::Mason::Commands::session{'CurrentUser'}->UserObj->Name,
- $HTML::Mason::Commands::session{'CurrentUser'}
+ $current_user->UserObj->Name,
+ $current_user
->UserObj->GenerateAuthString( $rss_data{Query}
. $rss_data{Order}
. $rss_data{OrderBy} );
$more->child( rss => title => loc('RSS'), path => "/NoAuth/rss/$RSSPath/$RSSQueryString");
my $ical_path = join '/', map $HTML::Mason::Commands::m->interp->apply_escapes($_, 'u'),
- $HTML::Mason::Commands::session{'CurrentUser'}->UserObj->Name,
- $HTML::Mason::Commands::session{'CurrentUser'}->UserObj->GenerateAuthString( $rss_data{Query} ),
+ $current_user->UserObj->Name,
+ $current_user->UserObj->GenerateAuthString( $rss_data{Query} ),
$rss_data{Query};
$more->child( ical => title => loc('iCal'), path => '/NoAuth/iCal/'.$ical_path);
if ($request_path =~ m{^/Search/Results.html}
&& #XXX TODO better abstraction
- $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
+ $current_user->HasRight( Right => 'SuperUser', Object => RT->System )) {
my $shred_args = QueryString(
Search => 1,
Plugin => 'Tickets',
@@ -534,7 +536,7 @@ sub BuildMainNav {
$tabs->child( create => title => loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
if ( $request_path =~ m{^/Articles/Article/} and ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
- my $obj = RT::Article->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::Article->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
@@ -589,7 +591,7 @@ sub BuildMainNav {
$actions->child("select", title => loc("Select"), path => "/Admin/Assets/Catalogs/");
$actions->child("create", title => loc("Create"), path => "/Admin/Assets/Catalogs/Create.html");
- my $catalog = RT::Catalog->new( $HTML::Mason::Commands::session{CurrentUser} );
+ my $catalog = RT::Catalog->new( $current_user );
$catalog->Load($HTML::Mason::Commands::DECODED_ARGS->{id}) if $HTML::Mason::Commands::DECODED_ARGS->{id};
if ($catalog->id and $catalog->CurrentUserCanSee) {
@@ -609,7 +611,7 @@ sub BuildMainNav {
# Already set up from having AdminUser and ShowConfigTab;
# but rename "Basics" to "Edit" in this context
HTML::Mason::Commands::PageMenu()->child( 'basics' )->title( loc('Edit') );
- } elsif ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'ShowUserHistory' ) ) {
+ } elsif ( $current_user->HasRight( Object => $RT::System, Right => 'ShowUserHistory' ) ) {
HTML::Mason::Commands::PageMenu()->child( display => title => loc('Summary'), path => '/User/Summary.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
HTML::Mason::Commands::PageMenu()->child( history => title => loc('History'), path => '/User/History.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
}
@@ -625,8 +627,10 @@ sub BuildMainNav {
sub _BuildAssetMenu {
my $page = HTML::Mason::Commands::PageMenu();
+ my $current_user = $HTML::Mason::Commands::session{CurrentUser};
+
my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
- my $asset = RT::Asset->new( $HTML::Mason::Commands::session{CurrentUser} );
+ my $asset = RT::Asset->new( $current_user );
$asset->Load($id);
if ($asset->id) {
@@ -690,8 +694,10 @@ sub _BuildAdminMenu {
my $request_path = shift;
my $top = shift;
+ my $current_user = $HTML::Mason::Commands::session{CurrentUser};
+
my $admin = $top->child( admin => title => loc('Admin'), path => '/Admin/' );
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) {
+ if ( $current_user->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) {
my $users = $admin->child( users =>
title => loc('Users'),
description => loc('Manage users and passwords'),
@@ -716,7 +722,7 @@ sub _BuildAdminMenu {
$queues->child( select => title => loc('Select'), path => "/Admin/Queues/" );
$queues->child( create => title => loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" );
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomField' ) ) {
+ if ( $current_user->HasRight( Object => RT->System, Right => 'AdminCustomField' ) ) {
my $cfs = $admin->child( 'custom-fields' =>
title => loc('Custom Fields'),
description => loc('Manage custom fields and custom field values'),
@@ -726,7 +732,7 @@ sub _BuildAdminMenu {
$cfs->child( create => title => loc('Create'), path => "/Admin/CustomFields/Modify.html?Create=1" );
}
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomRoles' ) ) {
+ if ( $current_user->HasRight( Object => RT->System, Right => 'AdminCustomRoles' ) ) {
my $roles = $admin->child( 'custom-roles' =>
title => loc('Custom Roles'),
description => loc('Manage custom roles'),
@@ -736,7 +742,7 @@ sub _BuildAdminMenu {
$roles->child( create => title => loc('Create'), path => "/Admin/CustomRoles/Modify.html?Create=1" );
}
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'ModifyScrips' ) ) {
+ if ( $current_user->HasRight( Object => RT->System, Right => 'ModifyScrips' ) ) {
my $scrips = $admin->child( 'scrips' =>
title => loc('Scrips'),
description => loc('Manage scrips'),
@@ -896,7 +902,7 @@ sub _BuildAdminMenu {
path => '/Admin/Tools/Theme.html',
);
if (RT->Config->Get('StatementLog')
- && $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
+ && $current_user->HasRight( Right => 'SuperUser', Object => RT->System )) {
$admin_tools->child( 'sql-queries' =>
title => loc('SQL Queries'),
description => loc('Browse the SQL queries made in this process'),
@@ -944,7 +950,7 @@ sub _BuildAdminMenu {
$HTML::Mason::Commands::DECODED_ARGS->{'Queue'} && $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} =~ /^\d+$/
) {
my $id = $HTML::Mason::Commands::DECODED_ARGS->{'Queue'} || $HTML::Mason::Commands::DECODED_ARGS->{'id'};
- my $queue_obj = RT::Queue->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $queue_obj = RT::Queue->new( $current_user );
$queue_obj->Load($id);
if ( $queue_obj and $queue_obj->id ) {
@@ -980,7 +986,7 @@ sub _BuildAdminMenu {
if ( $request_path =~ m{^(/Admin/Users|/User/(Summary|History)\.html)} and $admin->child("users") ) {
if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
- my $obj = RT::User->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::User->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
@@ -1005,7 +1011,7 @@ sub _BuildAdminMenu {
if ( $request_path =~ m{^/Admin/Groups} ) {
if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
- my $obj = RT::Group->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::Group->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
@@ -1023,7 +1029,7 @@ sub _BuildAdminMenu {
if ( $request_path =~ m{^/Admin/CustomFields/} ) {
if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
- my $obj = RT::CustomField->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::CustomField->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
@@ -1041,7 +1047,7 @@ sub _BuildAdminMenu {
if ( $request_path =~ m{^/Admin/CustomRoles} ) {
if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
- my $obj = RT::CustomRole->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::CustomRole->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
@@ -1055,7 +1061,7 @@ sub _BuildAdminMenu {
if ( $request_path =~ m{^/Admin/Scrips/} ) {
if ( $HTML::Mason::Commands::m->request_args->{'id'} && $HTML::Mason::Commands::m->request_args->{'id'} =~ /^\d+$/ ) {
my $id = $HTML::Mason::Commands::m->request_args->{'id'};
- my $obj = RT::Scrip->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::Scrip->new( $current_user );
$obj->Load($id);
my $tabs = HTML::Mason::Commands::PageMenu();
@@ -1119,7 +1125,7 @@ sub _BuildAdminMenu {
if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
my $tabs = HTML::Mason::Commands::PageMenu();
if ( my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'} ) {
- my $obj = RT::Class->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $obj = RT::Class->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
@@ -1149,7 +1155,9 @@ sub BuildSelfServiceNav {
my $top = HTML::Mason::Commands::Menu();
my $widgets = HTML::Mason::Commands::PageWidgets();
- my $queues = RT::Queues->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+ my $current_user = $HTML::Mason::Commands::session{CurrentUser};
+
+ my $queues = RT::Queues->new( $current_user );
$queues->UnLimit;
my $queue_count = 0;
@@ -1173,10 +1181,10 @@ sub BuildSelfServiceNav {
$tickets->child( closed => title => loc('Closed tickets'), path => '/SelfService/Closed.html' );
$top->child( "assets", title => loc("Assets"), path => "/SelfService/Asset/" )
- if $HTML::Mason::Commands::session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
+ if $current_user->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
my $username = '<span class="current-user">'
- . $HTML::Mason::Commands::m->interp->apply_escapes($HTML::Mason::Commands::session{'CurrentUser'}->Name, 'h')
+ . $HTML::Mason::Commands::m->interp->apply_escapes($current_user->Name, 'h')
. '</span>';
my $about_me = $top->child( preferences =>
title => loc('Logged in as [_1]', $username),
@@ -1184,17 +1192,17 @@ sub BuildSelfServiceNav {
sort_order => 99,
);
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System ) ) {
+ if ( $current_user->HasRight( Right => 'ModifySelf', Object => RT->System ) ) {
$about_me->child( prefs => title => loc('Preferences'), path => '/SelfService/Prefs.html' );
}
- if ( $HTML::Mason::Commands::session{'CurrentUser'}->Name
+ if ( $current_user->Name
&& ( !RT->Config->Get('WebRemoteUserAuth')
|| RT->Config->Get('WebFallbackToRTLogin') )) {
$about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
}
- if ($HTML::Mason::Commands::session{'CurrentUser'}->HasRight( Right => 'ShowArticle', Object => RT->System )) {
+ if ($current_user->HasRight( Right => 'ShowArticle', Object => RT->System )) {
$widgets->child( 'goto-article' => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/SearchArticle') );
}
commit 581f1b2ca9a96e7e66f8d19205059aa7f1861717
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 21:09:00 2016 +0000
replace repeated calls to HTML::Mason::Commands::PageMenu() with $page variable
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 1f01aa3..0f2b679 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -76,6 +76,7 @@ sub BuildMainNav {
my $top = HTML::Mason::Commands::Menu();
my $widgets = HTML::Mason::Commands::PageWidgets();
+ my $page = HTML::Mason::Commands::PageMenu();
my $current_user = $HTML::Mason::Commands::session{CurrentUser};
@@ -238,12 +239,11 @@ sub BuildMainNav {
my $obj = RT::Dashboard->new( $current_user );
$obj->LoadById($id);
if ( $obj and $obj->id ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id);
- $tabs->child( content => title => loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id);
- $tabs->child( subscription => title => loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id)
+ $page->child( basics => title => loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id);
+ $page->child( content => title => loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id);
+ $page->child( subscription => title => loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id)
if $obj->CurrentUserCanSubscribe;
- $tabs->child( show => title => loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
+ $page->child( show => title => loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
}
}
}
@@ -256,7 +256,7 @@ sub BuildMainNav {
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $actions = HTML::Mason::Commands::PageMenu()->child( actions => title => loc('Actions'), sort_order => 95 );
+ my $actions = $page->child( actions => title => loc('Actions'), sort_order => 95 );
my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
$can{'_ModifyOwner'} = $obj->CurrentUserCanSetOwner();
@@ -269,37 +269,36 @@ sub BuildMainNav {
}
};
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( bookmark => raw_html => $HTML::Mason::Commands::m->scomp( '/Ticket/Elements/Bookmark', id => $id ), sort_order => 98 );
+ $page->child( bookmark => raw_html => $HTML::Mason::Commands::m->scomp( '/Ticket/Elements/Bookmark', id => $id ), sort_order => 98 );
if ($can->('ModifyTicket')) {
- $tabs->child( timer => raw_html => $HTML::Mason::Commands::m->scomp( '/Ticket/Elements/PopupTimerLink', id => $id ), sort_order => 99 );
+ $page->child( timer => raw_html => $HTML::Mason::Commands::m->scomp( '/Ticket/Elements/PopupTimerLink', id => $id ), sort_order => 99 );
}
- $tabs->child( display => title => loc('Display'), path => "/Ticket/Display.html?id=" . $id );
- $tabs->child( history => title => loc('History'), path => "/Ticket/History.html?id=" . $id );
+ $page->child( display => title => loc('Display'), path => "/Ticket/Display.html?id=" . $id );
+ $page->child( history => title => loc('History'), path => "/Ticket/History.html?id=" . $id );
# comment out until we can do it for an individual custom field
#if ( $can->('ModifyTicket') || $can->('ModifyCustomField') ) {
- $tabs->child( basics => title => loc('Basics'), path => "/Ticket/Modify.html?id=" . $id );
+ $page->child( basics => title => loc('Basics'), path => "/Ticket/Modify.html?id=" . $id );
#}
if ( $can->('ModifyTicket') || $can->('_ModifyOwner') || $can->('Watch') || $can->('WatchAsAdminCc') ) {
- $tabs->child( people => title => loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id );
+ $page->child( people => title => loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id );
}
if ( $can->('ModifyTicket') ) {
- $tabs->child( dates => title => loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id );
- $tabs->child( links => title => loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id );
+ $page->child( dates => title => loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id );
+ $page->child( links => title => loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id );
}
#if ( $can->('ModifyTicket') || $can->('ModifyCustomField') || $can->('_ModifyOwner') ) {
- $tabs->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id );
+ $page->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id );
#}
if ( RT->Config->Get('EnableReminders') ) {
- $tabs->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id );
+ $page->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id );
}
if ( $can->('ModifyTicket') or $can->('ReplyToTicket') ) {
@@ -458,7 +457,7 @@ sub BuildMainNav {
$current_search_menu = $search->child( current_search => title => loc('Current Search') );
$current_search_menu->path("/Search/Results.html$args") if $has_query;
} else {
- $current_search_menu = HTML::Mason::Commands::PageMenu();
+ $current_search_menu = $page;
}
$current_search_menu->child( edit_search =>
@@ -518,11 +517,9 @@ sub BuildMainNav {
if ( $request_path =~ m{^/Article/} ) {
if ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} && $HTML::Mason::Commands::DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'};
- my $tabs = HTML::Mason::Commands::PageMenu();
-
- $tabs->child( display => title => loc('Display'), path => "/Articles/Article/Display.html?id=".$id );
- $tabs->child( history => title => loc('History'), path => "/Articles/Article/History.html?id=".$id );
- $tabs->child( modify => title => loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id );
+ $page->child( display => title => loc('Display'), path => "/Articles/Article/Display.html?id=".$id );
+ $page->child( history => title => loc('History'), path => "/Articles/Article/History.html?id=".$id );
+ $page->child( modify => title => loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id );
}
}
@@ -531,20 +528,19 @@ sub BuildMainNav {
$widgets->delete('create_ticket');
$widgets->delete('simple_search');
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( search => title => loc("Search"), path => "/Articles/Article/Search.html" );
- $tabs->child( create => title => loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
+ $page->child( search => title => loc("Search"), path => "/Articles/Article/Search.html" );
+ $page->child( create => title => loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
if ( $request_path =~ m{^/Articles/Article/} and ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
my $obj = RT::Article->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
- $tabs->child( display => title => loc("Display"), path => "/Articles/Article/Display.html?id=" . $id );
- $tabs->child( history => title => loc('History'), path => '/Articles/Article/History.html?id=' . $id );
+ $page->child( display => title => loc("Display"), path => "/Articles/Article/Display.html?id=" . $id );
+ $page->child( history => title => loc('History'), path => '/Articles/Article/History.html?id=' . $id );
if ( $obj->CurrentUserHasRight('ModifyArticle') ) {
- $tabs->child(modify => title => loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
+ $page->child(modify => title => loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
}
}
}
@@ -554,7 +550,6 @@ sub BuildMainNav {
if ($request_path =~ m{^/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id} and $HTML::Mason::Commands::DECODED_ARGS->{id} !~ /\D/) {
_BuildAssetMenu();
} elsif ($request_path =~ m{^/Asset/Search/}) {
- my $page = HTML::Mason::Commands::PageMenu();
my %search = map @{$_},
grep defined $_->[1] && length $_->[1],
map {ref $HTML::Mason::Commands::DECODED_ARGS->{$_} ? [$_, $HTML::Mason::Commands::DECODED_ARGS->{$_}[0]] : [$_, $HTML::Mason::Commands::DECODED_ARGS->{$_}] }
@@ -576,14 +571,11 @@ sub BuildMainNav {
path => '/Asset/Search/Results.tsv?' . (keys %search ? QueryString(%search) : ''),
);
} elsif ($request_path =~ m{^/Admin/Global/CustomFields/Catalog-Assets\.html$}) {
- my $page = HTML::Mason::Commands::PageMenu();
$page->child("create", title => loc("Create New"), path => "/Admin/CustomFields/Modify.html?Create=1;LookupType=" . RT::Asset->CustomFieldLookupType);
} elsif ($request_path =~ m{^/Admin/CustomFields(/|/index\.html)?$}
and $HTML::Mason::Commands::DECODED_ARGS->{'Type'} and $HTML::Mason::Commands::DECODED_ARGS->{'Type'} eq RT::Asset->CustomFieldLookupType) {
- my $page = HTML::Mason::Commands::PageMenu();
$page->child("create")->path( $page->child("create")->path . "&LookupType=" . RT::Asset->CustomFieldLookupType );
} elsif ($request_path =~ m{^/Admin/Assets/Catalogs/}) {
- my $page = HTML::Mason::Commands::PageMenu();
my $actions = $request_path =~ m{/((index|Create)\.html)?$}
? $page
: $page->child("catalogs", title => loc("Catalogs"), path => "/Admin/Assets/Catalogs/");
@@ -607,18 +599,18 @@ sub BuildMainNav {
}
if ( $request_path =~ m{^/User/(Summary|History)\.html} ) {
- if (HTML::Mason::Commands::PageMenu()->child('summary')) {
+ if ($page->child('summary')) {
# Already set up from having AdminUser and ShowConfigTab;
# but rename "Basics" to "Edit" in this context
- HTML::Mason::Commands::PageMenu()->child( 'basics' )->title( loc('Edit') );
+ $page->child( 'basics' )->title( loc('Edit') );
} elsif ( $current_user->HasRight( Object => $RT::System, Right => 'ShowUserHistory' ) ) {
- HTML::Mason::Commands::PageMenu()->child( display => title => loc('Summary'), path => '/User/Summary.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
- HTML::Mason::Commands::PageMenu()->child( history => title => loc('History'), path => '/User/History.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
+ $page->child( display => title => loc('Summary'), path => '/User/Summary.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
+ $page->child( history => title => loc('History'), path => '/User/History.html?id=' . $HTML::Mason::Commands::DECODED_ARGS->{'id'} );
}
}
if ( $request_path =~ /^\/(?:index.html|$)/ ) {
- HTML::Mason::Commands::PageMenu()->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' );
+ $page->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' );
}
# due to historical reasons of always having been in /Elements/Tabs
@@ -694,6 +686,7 @@ sub _BuildAdminMenu {
my $request_path = shift;
my $top = shift;
+ my $page = HTML::Mason::Commands::PageMenu();
my $current_user = $HTML::Mason::Commands::session{CurrentUser};
my $admin = $top->child( admin => title => loc('Admin'), path => '/Admin/' );
@@ -917,7 +910,6 @@ sub _BuildAdminMenu {
if ( $request_path =~ m{^/Admin/(Queues|Users|Groups|CustomFields|CustomRoles)} ) {
my $type = $1;
- my $tabs = HTML::Mason::Commands::PageMenu();
my %labels = (
Queues => loc("Queues"),
@@ -933,10 +925,10 @@ sub _BuildAdminMenu {
&& $HTML::Mason::Commands::DECODED_ARGS->{'Create'} )
)
{
- $section = $tabs;
+ $section = $page;
} else {
- $section = $tabs->child( select => title => $labels{$type},
+ $section = $page->child( select => title => $labels{$type},
path => "/Admin/$type/" );
}
@@ -954,7 +946,7 @@ sub _BuildAdminMenu {
$queue_obj->Load($id);
if ( $queue_obj and $queue_obj->id ) {
- my $queue = HTML::Mason::Commands::PageMenu();
+ my $queue = $page;
$queue->child( basics => title => loc('Basics'), path => "/Admin/Queues/Modify.html?id=" . $id );
$queue->child( people => title => loc('Watchers'), path => "/Admin/Queues/People.html?id=" . $id );
@@ -990,19 +982,18 @@ sub _BuildAdminMenu {
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id );
- $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id );
- $tabs->child( history => title => loc('History'), path => "/Admin/Users/History.html?id=" . $id );
- $tabs->child( 'my-rt' => title => loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id );
- $tabs->child( 'dashboards-in-menu' =>
+ $page->child( basics => title => loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id );
+ $page->child( memberships => title => loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id );
+ $page->child( history => title => loc('History'), path => "/Admin/Users/History.html?id=" . $id );
+ $page->child( 'my-rt' => title => loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id );
+ $page->child( 'dashboards-in-menu' =>
title => loc('Dashboards in menu'),
path => '/Admin/Users/DashboardsInMenu.html?id=' . $id,
);
if ( RT->Config->Get('Crypt')->{'Enable'} ) {
- $tabs->child( keys => title => loc('Private keys'), path => "/Admin/Users/Keys.html?id=" . $id );
+ $page->child( keys => title => loc('Private keys'), path => "/Admin/Users/Keys.html?id=" . $id );
}
- $tabs->child( 'summary' => title => loc('User Summary'), path => "/User/Summary.html?id=" . $id );
+ $page->child( 'summary' => title => loc('User Summary'), path => "/User/Summary.html?id=" . $id );
}
}
@@ -1015,13 +1006,12 @@ sub _BuildAdminMenu {
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id );
- $tabs->child( members => title => loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id );
- $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Groups/Memberships.html?id=" . $obj->id );
- $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id );
- $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id );
- $tabs->child( history => title => loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id );
+ $page->child( basics => title => loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id );
+ $page->child( members => title => loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id );
+ $page->child( memberships => title => loc('Memberships'), path => "/Admin/Groups/Memberships.html?id=" . $obj->id );
+ $page->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id );
+ $page->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id );
+ $page->child( history => title => loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id );
}
}
}
@@ -1033,12 +1023,11 @@ sub _BuildAdminMenu {
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id );
- $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id );
- $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id );
+ $page->child( basics => title => loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id );
+ $page->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id );
+ $page->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id );
unless ( $obj->IsOnlyGlobal ) {
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id );
+ $page->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id );
}
}
}
@@ -1051,9 +1040,8 @@ sub _BuildAdminMenu {
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomRoles/Modify.html?id=".$id );
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomRoles/Objects.html?id=" . $id );
+ $page->child( basics => title => loc('Basics'), path => "/Admin/CustomRoles/Modify.html?id=".$id );
+ $page->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomRoles/Objects.html?id=" . $id );
}
}
}
@@ -1064,8 +1052,6 @@ sub _BuildAdminMenu {
my $obj = RT::Scrip->new( $current_user );
$obj->Load($id);
- my $tabs = HTML::Mason::Commands::PageMenu();
-
my ( $admin_cat, $create_path_arg, $from_query_param );
my $from_arg = $HTML::Mason::Commands::DECODED_ARGS->{'From'} || q{};
my ($from_queue) = $from_arg =~ /^(\d+)$/;
@@ -1083,12 +1069,12 @@ sub _BuildAdminMenu {
$admin_cat = 'Scrips';
$from_query_param = $create_path_arg = q{};
}
- my $scrips = $tabs->child( scrips => title => loc('Scrips'), path => "/Admin/${admin_cat}" );
+ my $scrips = $page->child( scrips => title => loc('Scrips'), path => "/Admin/${admin_cat}" );
$scrips->child( select => title => loc('Select'), path => "/Admin/${admin_cat}" );
$scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html${create_path_arg}" );
- $tabs->child( basics => title => loc('Basics') => path => "/Admin/Scrips/Modify.html?id=" . $id . $from_query_param );
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id . $from_query_param );
+ $page->child( basics => title => loc('Basics') => path => "/Admin/Scrips/Modify.html?id=" . $id . $from_query_param );
+ $page->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id . $from_query_param );
}
elsif ( $request_path =~ m{^/Admin/Scrips/(index\.html)?$} ) {
HTML::Mason::Commands::PageMenu->child( select => title => loc('Select') => path => "/Admin/Scrips/" );
@@ -1111,38 +1097,35 @@ sub _BuildAdminMenu {
}
if ( $request_path =~ m{^/Admin/Global/Scrips\.html} ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
- $tabs->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
+ $page->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
+ $page->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" );
}
if ( $request_path =~ m{^/Admin/Global/Templates?\.html} ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
- $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
- $tabs->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
+ $page->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
+ $page->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
}
if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
- my $tabs = HTML::Mason::Commands::PageMenu();
if ( my $id = $HTML::Mason::Commands::DECODED_ARGS->{'id'} ) {
my $obj = RT::Class->new( $current_user );
$obj->Load($id);
if ( $obj and $obj->id ) {
- my $section = $tabs->child( select => title => loc("Classes"), path => "/Admin/Articles/Classes/" );
+ my $section = $page->child( select => title => loc("Classes"), path => "/Admin/Articles/Classes/" );
$section->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
$section->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
- $tabs->child( basics => title => loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id );
- $tabs->child( topics => title => loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id );
- $tabs->child( 'custom-fields' => title => loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id );
- $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id );
- $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id );
- $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" );
+ $page->child( basics => title => loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id );
+ $page->child( topics => title => loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id );
+ $page->child( 'custom-fields' => title => loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id );
+ $page->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id );
+ $page->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id );
+ $page->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" );
}
} else {
- $tabs->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
- $tabs->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
+ $page->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
+ $page->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
}
}
}
@@ -1154,6 +1137,7 @@ sub BuildSelfServiceNav {
my $top = HTML::Mason::Commands::Menu();
my $widgets = HTML::Mason::Commands::PageWidgets();
+ my $page = HTML::Mason::Commands::PageMenu();
my $current_user = $HTML::Mason::Commands::session{CurrentUser};
@@ -1209,7 +1193,6 @@ sub BuildSelfServiceNav {
$widgets->child( goto => raw_html => $HTML::Mason::Commands::m->scomp('/SelfService/Elements/GotoTicket') );
if ($request_path =~ m{^/SelfService/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id}) {
- my $page = HTML::Mason::Commands::PageMenu();
my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
$page->child("display", title => loc("Display"), path => "/SelfService/Asset/Display.html?id=$id");
$page->child("history", title => loc("History"), path => "/SelfService/Asset/History.html?id=$id");
commit 3561f38ad4660eae084196d4b4125e922bfc65c5
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 21:51:41 2016 +0000
define a new calling convention for menu building functions
passing $request_path, $top, $page, and %ARGS to each for consistency
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 0f2b679..da2c5f4 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -188,7 +188,7 @@ sub BuildMainNav {
if ( $current_user->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
{
- _BuildAdminMenu($request_path, $top);
+ _BuildAdminMenu( $request_path, $top, $page, %args );
}
my $username = '<span class="current-user">'
@@ -548,7 +548,7 @@ sub BuildMainNav {
}
if ($request_path =~ m{^/Asset/} and $HTML::Mason::Commands::DECODED_ARGS->{id} and $HTML::Mason::Commands::DECODED_ARGS->{id} !~ /\D/) {
- _BuildAssetMenu();
+ _BuildAssetMenu( $request_path, $top, $page, %args );
} elsif ($request_path =~ m{^/Asset/Search/}) {
my %search = map @{$_},
grep defined $_->[1] && length $_->[1],
@@ -618,7 +618,12 @@ sub BuildMainNav {
}
sub _BuildAssetMenu {
- my $page = HTML::Mason::Commands::PageMenu();
+ my $request_path = shift;
+ my $top = shift;
+ my $page = shift;
+
+ my %args = ( @_ );
+
my $current_user = $HTML::Mason::Commands::session{CurrentUser};
my $id = $HTML::Mason::Commands::DECODED_ARGS->{id};
@@ -644,14 +649,21 @@ sub _BuildAssetMenu {
);
}
- _BuildAssetMenuActionSubmenu($asset);
+ _BuildAssetMenuActionSubmenu( $request_path, $top, $page, %args, Asset => $asset );
}
}
sub _BuildAssetMenuActionSubmenu {
- my $asset = shift;
+ my $request_path = shift;
+ my $top = shift;
+ my $page = shift;
- my $page = HTML::Mason::Commands::PageMenu();
+ my %args = (
+ Asset => undef,
+ @_
+ );
+
+ my $asset = $args{Asset};
my $id = $asset->id;
my $actions = $page->child("actions", title => loc("Actions"));
@@ -684,9 +696,11 @@ sub _BuildAssetMenuActionSubmenu {
sub _BuildAdminMenu {
my $request_path = shift;
- my $top = shift;
+ my $top = shift;
+ my $page = shift;
+
+ my %args = ( @_ );
- my $page = HTML::Mason::Commands::PageMenu();
my $current_user = $HTML::Mason::Commands::session{CurrentUser};
my $admin = $top->child( admin => title => loc('Admin'), path => '/Admin/' );
diff --git a/share/html/Ticket/Elements/ShowAssets b/share/html/Ticket/Elements/ShowAssets
index e2614d2..de1e4fa 100644
--- a/share/html/Ticket/Elements/ShowAssets
+++ b/share/html/Ticket/Elements/ShowAssets
@@ -147,7 +147,9 @@ if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
%# show asset actions menu
% HTML::Mason::Commands::PageMenu()->{children} = undef; # clear previous settings from page load so we can show just the actions
-% RT::Interface::Web::MenuBuilder::_BuildAssetMenuActionSubmenu($asset);
+% my $request_path = $HTML::Mason::Commands::r->path_info;
+% $request_path =~ s!/{2,}!/!g;
+% RT::Interface::Web::MenuBuilder::_BuildAssetMenuActionSubmenu( $request_path, Menu(), PageMenu(), Asset => $asset );
<& /Elements/Menu, menu => PageMenu(), id => 'asset-'.$asset->id.'-actions-menu', parent_id => 'asset-'.$asset->id &>
<script>
jQuery("#assets-accordion ul.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition()
commit 3b132dfd15fa2f7cafbc1fa5d5f91992abe41a33
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 22:02:18 2016 +0000
replace ugly hack with new RT::Interface::Web::Menu object now that we have our refactored menu functions
diff --git a/share/html/Ticket/Elements/ShowAssets b/share/html/Ticket/Elements/ShowAssets
index de1e4fa..8b08af6 100644
--- a/share/html/Ticket/Elements/ShowAssets
+++ b/share/html/Ticket/Elements/ShowAssets
@@ -146,11 +146,11 @@ if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
% }
%# show asset actions menu
-% HTML::Mason::Commands::PageMenu()->{children} = undef; # clear previous settings from page load so we can show just the actions
% my $request_path = $HTML::Mason::Commands::r->path_info;
% $request_path =~ s!/{2,}!/!g;
-% RT::Interface::Web::MenuBuilder::_BuildAssetMenuActionSubmenu( $request_path, Menu(), PageMenu(), Asset => $asset );
-<& /Elements/Menu, menu => PageMenu(), id => 'asset-'.$asset->id.'-actions-menu', parent_id => 'asset-'.$asset->id &>
+% my $page = RT::Interface::Web::Menu->new();
+% RT::Interface::Web::MenuBuilder::_BuildAssetMenuActionSubmenu( $request_path, Menu(), $page, Asset => $asset );
+<& /Elements/Menu, menu => $page, id => 'asset-'.$asset->id.'-actions-menu', parent_id => 'asset-'.$asset->id &>
<script>
jQuery("#assets-accordion ul.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition()
.find('a').click(function(ev){
commit f88d7704e894c6f7477cd43115ffc855336927b8
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Jun 22 22:19:03 2016 +0000
remove hover delay on ShowAssets action menu
diff --git a/share/html/Ticket/Elements/ShowAssets b/share/html/Ticket/Elements/ShowAssets
index 8b08af6..efca473 100644
--- a/share/html/Ticket/Elements/ShowAssets
+++ b/share/html/Ticket/Elements/ShowAssets
@@ -152,7 +152,7 @@ if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
% RT::Interface::Web::MenuBuilder::_BuildAssetMenuActionSubmenu( $request_path, Menu(), $page, Asset => $asset );
<& /Elements/Menu, menu => $page, id => 'asset-'.$asset->id.'-actions-menu', parent_id => 'asset-'.$asset->id &>
<script>
-jQuery("#assets-accordion ul.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition()
+jQuery("#assets-accordion ul.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ dropShadows: false, speed: 'fast', delay: 0 }).supposition()
.find('a').click(function(ev){
ev.stopPropagation();
return true;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list