summaryrefslogtreecommitdiff
path: root/rt/share/html/Elements/Tabs
diff options
context:
space:
mode:
Diffstat (limited to 'rt/share/html/Elements/Tabs')
-rwxr-xr-xrt/share/html/Elements/Tabs382
1 files changed, 200 insertions, 182 deletions
diff --git a/rt/share/html/Elements/Tabs b/rt/share/html/Elements/Tabs
index d899071..a82cdd1 100755
--- a/rt/share/html/Elements/Tabs
+++ b/rt/share/html/Elements/Tabs
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -270,29 +270,31 @@ my $build_admin_menu = sub {
my $queue_obj = RT::Queue->new( $session{'CurrentUser'} );
$queue_obj->Load($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 );
+ 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 $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/Queues/Scrip.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/Queues/Scrip.html?Create=1;Queue=" . $id);
- my $ticket_cfs = $queue->child( 'ticket-custom-fields' => title => loc('Ticket Custom Fields'),
- path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket&id=' . $id );
+ my $ticket_cfs = $queue->child( 'ticket-custom-fields' => title => loc('Ticket Custom Fields'),
+ path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket&id=' . $id );
- my $txn_cfs = $queue->child( 'transaction-custom-fields' => title => loc('Transaction Custom Fields'),
- path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id );
+ my $txn_cfs = $queue->child( 'transaction-custom-fields' => title => loc('Transaction Custom Fields'),
+ 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( '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 );
-
- $m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue);
+ $m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue);
+ }
}
}
if ( $request_path =~ m{^/Admin/Users} ) {
@@ -301,13 +303,15 @@ my $build_admin_menu = sub {
my $obj = RT::User->new( $session{'CurrentUser'} );
$obj->Load($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 );
- if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
- $tabs->child( pgp => title => loc('GnuPG'), path => "/Admin/Users/GnuPG.html?id=" . $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 );
+ if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
+ $tabs->child( pgp => title => loc('GnuPG'), path => "/Admin/Users/GnuPG.html?id=" . $id );
+ }
}
}
@@ -319,12 +323,14 @@ my $build_admin_menu = sub {
my $obj = RT::Group->new( $session{'CurrentUser'} );
$obj->Load($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( '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 ( $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( '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 );
+ }
}
}
@@ -334,11 +340,13 @@ my $build_admin_menu = sub {
my $obj = RT::CustomField->new( $session{'CurrentUser'} );
$obj->Load($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 );
+ 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 );
+ }
}
}
@@ -356,19 +364,21 @@ my $build_admin_menu = sub {
if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
my $tabs = PageMenu();
if ( my $id = $DECODED_ARGS->{'id'} ) {
- my $obj = RT::CustomField->new( $session{'CurrentUser'} );
+ my $obj = RT::Class->new( $session{'CurrentUser'} );
$obj->Load($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" );
+ 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" );
@@ -379,6 +389,9 @@ 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
@@ -479,9 +492,9 @@ my $build_main_nav = sub {
for my $search (@$searches) {
$search_menu->child( "search-" . $i++ =>
- title => $search->[0],
+ title => $search->[1],
path => "/Prefs/Search.html?"
- . $query_string->( name => ref( $search->[1] ) . '-' . $search->[1]->Id ),
+ . $query_string->( name => ref( $search->[2] ) . '-' . $search->[2]->Id ),
);
}
@@ -513,141 +526,143 @@ my $build_main_nav = sub {
my $obj = RT::Ticket->new( $session{'CurrentUser'} );
$obj->Load($id);
- my $actions = PageMenu()->child( actions => title => loc('Actions'), sort_order => 95 );
- my $tabs = PageMenu();
- $tabs->child( bookmark => raw_html => $m->scomp( '/Ticket/Elements/Bookmark', 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 );
-
- my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
- $can{'_ModifyOwner'} = $can{'OwnTicket'} || $can{'TakeTicket'} || $can{'StealTicket'};
- my $can = sub {
- unless ($_[0] eq 'ExecuteCode') {
- return $can{$_[0]} || $can{'SuperUser'};
- } else {
- return !RT->Config->Get('DisallowExecuteCode')
- && ( $can{'ExecuteCode'} || $can{'SuperUser'} );
+ if ( $obj and $obj->id ) {
+ my $actions = PageMenu()->child( actions => title => loc('Actions'), sort_order => 95 );
+ my $tabs = PageMenu();
+ $tabs->child( bookmark => raw_html => $m->scomp( '/Ticket/Elements/Bookmark', 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 );
+
+ my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
+ $can{'_ModifyOwner'} = $can{'OwnTicket'} || $can{'TakeTicket'} || $can{'StealTicket'};
+ my $can = sub {
+ unless ($_[0] eq 'ExecuteCode') {
+ return $can{$_[0]} || $can{'SuperUser'};
+ } else {
+ return !RT->Config->Get('DisallowExecuteCode')
+ && ( $can{'ExecuteCode'} || $can{'SuperUser'} );
+ }
+ };
+
+ # 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 );
+
+ #}
+
+ #ACL?
+ $tabs->child( customers => title => loc('Customers'), path => "/Ticket/ModifyCustomers.html?id=" . $id );
+
+ if ( $can->('ModifyTicket') || $can->('_ModifyOwner') || $can->('Watch') || $can->('WatchAsAdminCc') ) {
+ $tabs->child( people => title => loc('People'), path => "/Ticket/ModifyPeople.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 );
-
- #}
-
- #ACL?
- $tabs->child( customers => title => loc('Customers'), path => "/Ticket/ModifyCustomers.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') ) {
+ $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') or $can->('CommentOnTicket') ) {
- $actions->child( comment => title => loc('Comment'), path => "/Ticket/Update.html?Action=Comment;id=" . $id );
- }
+ #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') || $can->('_ModifyOwner') ) {
+ $tabs->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?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->QueueObj->Lifecycle;
- 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/';
- if ($action) {
- $url .= "Update.html?"
- . $query_string->(
- Action => $action,
- DefaultStatus => $next,
- id => $id,
- );
- } else {
- $url .= "Display.html?"
- . $query_string->(
- Status => $next,
- id => $id,
- );
+ if ( RT->Config->Get('EnableReminders') ) {
+ $tabs->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?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 );
+ if ( $can->('ModifyTicket') or $can->('ReplyToTicket') ) {
+ $actions->child( reply => title => loc('Reply'), path => "/Ticket/Update.html?Action=Respond;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 );
+ if ( $can->('ModifyTicket') or $can->('CommentOnTicket') ) {
+ $actions->child( comment => title => loc('Comment'), path => "/Ticket/Update.html?Action=Comment;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 ( 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 ( $can->('ForwardMessage') ) {
+ $actions->child( forward => title => loc('Forward'), path => "/Ticket/Forward.html?id=" . $id );
+ }
- if ($updatesession) {
- $session{"tickets"}->PrepForSerialization();
+ my $hide_resolve_with_deps = RT->Config->Get('HideResolveActionsWithDependencies')
+ && $obj->HasUnresolvedDependencies;
+
+ my $current = $obj->Status;
+ my $lifecycle = $obj->QueueObj->Lifecycle;
+ 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/';
+ if ($action) {
+ $url .= "Update.html?"
+ . $query_string->(
+ Action => $action,
+ DefaultStatus => $next,
+ id => $id,
+ );
+ } else {
+ $url .= "Display.html?"
+ . $query_string->(
+ Status => $next,
+ id => $id,
+ );
+ }
+ my $key = $info->{'label'} || ucfirst($next);
+ $actions->child( $key => title => loc( $key ), path => $url);
}
- my $search = Menu()->child('search');
- # 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});
+ 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 );
+ }
}
- # 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});
- $search->child( last =>
- title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+
+ # 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 ( 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');
+ # 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});
+ $search->child( last =>
+ title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+ }
}
}
}
@@ -770,8 +785,8 @@ my $build_main_nav = sub {
&& #XXX TODO better abstraction
$session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
my $shred_args = $query_string->(
- search => 1,
- plugin => 'Tickets',
+ Search => 1,
+ Plugin => 'Tickets',
'Tickets:query' => $rss_data{'Query'},
'Tickets:limit' => $QueryArgs->{'Rows'},
);
@@ -795,6 +810,10 @@ my $build_main_nav = sub {
}
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" );
@@ -803,14 +822,16 @@ my $build_main_nav = sub {
my $obj = RT::Article->new( $session{'CurrentUser'} );
$obj->Load($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 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 ( $obj->CurrentUserHasRight('DeleteArticle') ) {
- $tabs->child(delete => title => loc('Delete'), path => '/Articles/Article/Delete.html?id=' . $id );
+ if ( $obj->CurrentUserHasRight('ModifyArticle') ) {
+ $tabs->child(modify => title => loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
+ }
+ if ( $obj->CurrentUserHasRight('DeleteArticle') ) {
+ $tabs->child(delete => title => loc('Delete'), path => '/Articles/Article/Delete.html?id=' . $id );
+ }
}
}
@@ -820,9 +841,6 @@ my $build_main_nav = sub {
PageMenu()->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' );
}
- PageWidgets()->child( simple_search => raw_html => $m->scomp('SimpleSearch') );
- PageWidgets()->child( create_ticket => raw_html => $m->scomp('CreateTicket') );
-
$m->callback( CallbackName => 'Privileged' );
};