X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FTabs;h=19744111ea26ed831022dd8dfafbfc77accddf45;hp=6eae81d39964e0cef9f9a7798cf003d855376b64;hb=44dd00a3ff974a17999e86e64488e996edc71e3c;hpb=45d35d5739d05e602bc317739485693e0e9ff0b5 diff --git a/rt/share/html/Elements/Tabs b/rt/share/html/Elements/Tabs index 6eae81d39..19744111e 100755 --- a/rt/share/html/Elements/Tabs +++ b/rt/share/html/Elements/Tabs @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -62,7 +62,7 @@ my $query_string = sub { my $build_admin_menu = sub { my $top = shift; - my $admin = $top->child( config => title => loc('Configuration'), path => '/Admin/', sort_order => 99 ); + 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'), @@ -98,6 +98,16 @@ my $build_admin_menu = sub { $cfs->child( create => title => loc('Create'), path => "/Admin/CustomFields/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'), @@ -110,7 +120,7 @@ my $build_admin_menu = sub { path => '/Admin/Global/Scrips.html', ); $scrips->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" ); - $scrips->child( create => title => loc('Create'), path => "/Admin/Global/Scrip.html?Create=1" ); + $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Global=1" ); my $templates = $admin_global->child( templates => title => loc('Templates'), @@ -172,11 +182,11 @@ my $build_admin_menu = sub { 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'), + 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'), + path => '/Admin/CustomFields/index.html?'.$m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'), ); $cfs->child( create => title => loc('Create'), @@ -198,6 +208,11 @@ my $build_admin_menu = sub { 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'), @@ -281,14 +296,17 @@ my $build_admin_menu = sub { 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/Queues/Scrip.html?Create=1;Queue=" . $id); + $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Queue=" . $id); - my $ticket_cfs = $queue->child( 'ticket-custom-fields' => title => loc('Ticket Custom Fields'), + 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 = $queue->child( 'transaction-custom-fields' => title => loc('Transaction Custom Fields'), + my $txn_cfs = $cfs->child( 'transactions' => title => loc('Transactions'), path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id ); + $queue->child( 'tasks' => title => loc('Subtasks'), path => "Admin/Queues/Tasks.html?Queue=".$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 ); @@ -297,7 +315,7 @@ my $build_admin_menu = sub { } } } - if ( $request_path =~ m{^/Admin/Users} ) { + 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'} ); @@ -309,9 +327,14 @@ my $build_admin_menu = sub { $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 ); - if ( RT->Config->Get('GnuPG')->{'Enable'} ) { - $tabs->child( pgp => title => loc('GnuPG'), path => "/Admin/Users/GnuPG.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 ); } } @@ -323,10 +346,11 @@ my $build_admin_menu = sub { my $obj = RT::Group->new( $session{'CurrentUser'} ); $obj->Load($id); - if ( $obj and $obj->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 ); @@ -342,23 +366,78 @@ my $build_admin_menu = sub { 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 ); - $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomFields/Objects.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 => loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id ); + } } } } - if ( $request_path =~ m{^/Admin/Global/(Scrip|Template)s?\.html} ) { - my $type = $1; - my $tabs = PageMenu(); + 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); - # With only two elements, swapping between dropdown and menu is kinda dumb - # In the glorious future this should be cleaner. + my $tabs = PageMenu(); - $tabs->child( select => title => loc('Select'), path => "/Admin/Global/${type}s.html" ); - $tabs->child( create => title => loc('Create'), path => "/Admin/Global/${type}.html?Create=1" ); + 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/} ) { @@ -386,24 +465,42 @@ my $build_admin_menu = sub { } }; - my $build_main_nav = sub { 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 => '/' ); - # We explicitly exclude superusers; otherwise the dashboards for - # groups you're not in (but can see the dashboards of by dint of - # being a superuser) would push the useful ones from the groups - # you're actually in off of the stack. - my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards", IncludeSuperuserGroups => 0); - my $limit = 7; + 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 $more = 0; - if ( @dashboards > $limit ) { - $more = 1; - splice @dashboards, $limit; + 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->debug( "Failed to load dashboard $id: $msg, removing from menu" ); + $home->RemoveDashboardMenuItem( DashboardId => $id, CurrentUser => $session{CurrentUser}->UserObj ); + @{$session{'dashboards_in_menu'}} = grep { $_ != $id } @{$session{'dashboards_in_menu'}}; + } } my $dashes = Menu()->child('home'); @@ -414,24 +511,34 @@ my $build_main_nav = sub { path => '/Dashboards/' . $dash->id . '/' . $dash->Name ); } - - $dashes->child( more => title => 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( $session{CurrentUser} ); if ( $dashboard->CurrentUserCanCreateAny ) { $dashes->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" ); } - my $tickets = Menu->child( search => title => loc('Tickets'), path => '/Search/Build.html' ); + 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" ); + + 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" ); + } my $tools = Menu->child( tools => title => loc('Tools'), path => '/Tools/index.html' ); - my $articles = $tools->child( articles => title => loc('Articles'), path => "/Articles/index.html"); - $articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" ); - $articles->child( search => title => loc('Search'), path => "/Articles/Article/Search.html" ); - $articles->child( topics => title => loc('Topics'), path => "/Articles/Topics.html" ); $tools->child( my_day => title => loc('My Day'), @@ -447,12 +554,6 @@ my $build_main_nav = sub { ); } - $tools->child( offline => - title => loc('Offline'), - description => loc('Create tickets offline'), - path => '/Tools/Offline.html', - ); - if ( $session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) { $tools->child( approval => title => loc('Approval'), @@ -463,7 +564,7 @@ my $build_main_nav = sub { if ( $session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) ) { - $build_admin_menu->($tools); + $build_admin_menu->(Menu()); } my $username = '' @@ -472,6 +573,7 @@ my $build_main_nav = sub { 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, ); @@ -479,10 +581,14 @@ my $build_main_nav = sub { 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('Options'), path => '/Prefs/Other.html' ); + $settings->child( options => title => loc('Preferences'), path => '/Prefs/Other.html' ); $settings->child( about_me => title => loc('About me'), path => '/User/Prefs.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( quicksearch => title => loc('Quick search'), path => '/Prefs/Quicksearch.html' ); my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') ); @@ -500,8 +606,8 @@ my $build_main_nav = sub { } } if ( $session{'CurrentUser'}->Name - && ( !RT->Config->Get('WebExternalAuth') - || RT->Config->Get('WebFallbackToInternalAuth') )) { + && ( !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+)?}) { @@ -516,10 +622,15 @@ my $build_main_nav = sub { if $obj->CurrentUserCanSubscribe; $tabs->child( show => title => loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name) } + } else { + my $tabs = PageMenu(); + if ( $dashboard->CurrentUserCanCreateAny ) { + # FREESIDE: provide a way to create dashboards + $tabs->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1"); + } } } - if ( $request_path =~ m{^/Ticket/} ) { if ( ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) { my $id = $1; @@ -534,7 +645,7 @@ my $build_main_nav = sub { $tabs->child( history => title => loc('History'), path => "/Ticket/History.html?id=" . $id ); my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) }; - $can{'_ModifyOwner'} = $can{'OwnTicket'} || $can{'TakeTicket'} || $can{'StealTicket'}; + $can{'_ModifyOwner'} = $obj->CurrentUserCanSetOwner(); my $can = sub { unless ($_[0] eq 'ExecuteCode') { return $can{$_[0]} || $can{'SuperUser'}; @@ -586,7 +697,7 @@ my $build_main_nav = sub { && $obj->HasUnresolvedDependencies; my $current = $obj->Status; - my $lifecycle = $obj->QueueObj->Lifecycle; + my $lifecycle = $obj->LifecycleObj; my $i = 1; foreach my $info ( $lifecycle->Actions($current) ) { my $next = $info->{'to'}; @@ -601,42 +712,31 @@ my $build_main_nav = sub { my $action = $info->{'update'} || ''; my $url = '/Ticket/'; - if ($action) { - $url .= "Update.html?" - . $query_string->( - Action => $action, - DefaultStatus => $next, - id => $id, - ); - } else { - $url .= "Display.html?" - . $query_string->( - Status => $next, - id => $id, - ); - } + $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); } - if ( $can->('OwnTicket') ) { - if ( $obj->OwnerObj->Id == RT->Nobody->id - && ( $can->('ModifyTicket') or $can->('TakeTicket') ) ) { - $actions->child( take => title => loc('Take'), path => "/Ticket/Display.html?Action=Take;id=" . $id ); - } - - elsif ( $obj->OwnerObj->id != RT->Nobody->id - && $obj->OwnerObj->id != $session{CurrentUser}->id - && ( $can->('ModifyTicket') or $can->('StealTicket') ) ) { - $actions->child( steal => title => loc('Steal'), path => "/Ticket/Display.html?Action=Steal;id=" . $id ); - } + 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 @@ -648,7 +748,7 @@ my $build_main_nav = sub { $session{"tickets"}->PrepForSerialization(); } - my $search = Menu()->child('search'); + 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 => @@ -670,6 +770,9 @@ my $build_main_nav = sub { } } + # Scope here so we can share in the Privileged callback + my $args = ''; + my $has_query = ''; if ( ( $request_path =~ m{^/(?:Ticket|Search)/} @@ -679,9 +782,7 @@ my $build_main_nav = sub { && $DECODED_ARGS->{'q'} ) ) { - my $search = Menu()->child('search'); - my $args = ''; - my $has_query = ''; + my $search = Menu()->child('search')->child('tickets'); 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}; @@ -749,7 +850,10 @@ my $build_main_nav = sub { } if ( $has_query ) { - $current_search_menu->child( bulk => title => loc('Bulk Update'), path => "/Search/Bulk.html$args" ); + #freeside + if ( $session{'CurrentUser'}->HasRight( Right => 'BulkUpdateTickets', Object => RT->System ) ) { + $current_search_menu->child( bulk => title => loc('Bulk Update'), path => "/Search/Bulk.html$args" ); + } $current_search_menu->child( chart => title => loc('Chart'), path => "/Search/Chart.html$args" ); #formerly Callbacks/RTx-Calendar/Ticket/Element/Tabs/Default @@ -839,11 +943,22 @@ my $build_main_nav = sub { } + 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' ); + $m->callback( CallbackName => 'Privileged', Path => $request_path, Search_Args => $args, Has_Query => $has_query ); }; my $build_selfservice_nav = sub { @@ -885,8 +1000,8 @@ my $build_selfservice_nav = sub { } if ( $session{'CurrentUser'}->Name - && ( !RT->Config->Get('WebExternalAuth') - || RT->Config->Get('WebFallbackToInternalAuth') )) { + && ( !RT->Config->Get('WebRemoteUserAuth') + || RT->Config->Get('WebFallbackToRTLogin') )) { $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' ); } @@ -896,7 +1011,7 @@ my $build_selfservice_nav = sub { PageWidgets->child( goto => raw_html => $m->scomp('/SelfService/Elements/GotoTicket') ); - $m->callback( CallbackName => 'SelfService' ); + $m->callback( CallbackName => 'SelfService', Path => $request_path ); };