Upgrade to 4.2.2
[usit-rt.git] / share / html / Elements / Tabs
CommitLineData
84fb5b46
MKG
1%# BEGIN BPS TAGGED BLOCK {{{
2%#
3%# COPYRIGHT:
4%#
320f0092 5%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
84fb5b46
MKG
6%# <sales@bestpractical.com>
7%#
8%# (Except where explicitly superseded by other copyright notices)
9%#
10%#
11%# LICENSE:
12%#
13%# This work is made available to you under the terms of Version 2 of
14%# the GNU General Public License. A copy of that license should have
15%# been provided with this software, but in any event can be snarfed
16%# from www.gnu.org.
17%#
18%# This work is distributed in the hope that it will be useful, but
19%# WITHOUT ANY WARRANTY; without even the implied warranty of
20%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21%# General Public License for more details.
22%#
23%# You should have received a copy of the GNU General Public License
24%# along with this program; if not, write to the Free Software
25%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26%# 02110-1301 or visit their web page on the internet at
27%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
28%#
29%#
30%# CONTRIBUTION SUBMISSION POLICY:
31%#
32%# (The following paragraph is not intended to limit the rights granted
33%# to you to modify and distribute this software under the terms of
34%# the GNU General Public License and is only of importance to you if
35%# you choose to contribute your changes and enhancements to the
36%# community by submitting them to Best Practical Solutions, LLC.)
37%#
38%# By intentionally submitting any modifications, corrections or
39%# derivatives to this work, or any other work intended for use with
40%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41%# you are the copyright holder for those contributions and you grant
42%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43%# royalty-free, perpetual, license to use, copy, create derivative
44%# works based on those contributions, and sublicense and distribute
45%# those contributions and any derivatives thereof.
46%#
47%# END BPS TAGGED BLOCK }}}
48<& /Elements/PageLayout, show_menu => $show_menu &>
49<a name="skipnav" id="skipnav" accesskey="8"></a>
50<%INIT>
51
52my $request_path = $HTML::Mason::Commands::r->path_info;
dab09ea8 53$request_path =~ s!/{2,}!/!g;
84fb5b46
MKG
54
55my $query_string = sub {
56 my %args = @_;
57 my $u = URI->new();
01e3b242 58 $u->query_form(map { $_ => $args{$_} } sort keys %args);
84fb5b46
MKG
59 return $u->query;
60};
61
62my $build_admin_menu = sub {
63 my $top = shift;
af59614d 64 my $admin = $top->child( admin => title => loc('Admin'), path => '/Admin/' );
84fb5b46
MKG
65 if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) {
66 my $users = $admin->child( users =>
67 title => loc('Users'),
68 description => loc('Manage users and passwords'),
69 path => '/Admin/Users/',
70 );
71 $users->child( select => title => loc('Select'), path => "/Admin/Users/" );
72 $users->child( create => title => loc('Create'), path => "/Admin/Users/Modify.html?Create=1" );
73 }
74 my $groups = $admin->child( groups =>
75 title => loc('Groups'),
76 description => loc('Manage groups and group membership'),
77 path => '/Admin/Groups/',
78 );
79 $groups->child( select => title => loc('Select'), path => "/Admin/Groups/" );
80 $groups->child( create => title => loc('Create'), path => "/Admin/Groups/Modify.html?Create=1" );
81
82 my $queues = $admin->child( queues =>
83 title => loc('Queues'),
84 description => loc('Manage queues and queue-specific properties'),
85 path => '/Admin/Queues/',
86 );
87 $queues->child( select => title => loc('Select'), path => "/Admin/Queues/" );
88 $queues->child( create => title => loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" );
89
90 if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomField' ) ) {
91 my $cfs = $admin->child( 'custom-fields' =>
92 title => loc('Custom Fields'),
93 description => loc('Manage custom fields and custom field values'),
94 path => '/Admin/CustomFields/',
95 );
96 $cfs->child( select => title => loc('Select'), path => "/Admin/CustomFields/" );
97 $cfs->child( create => title => loc('Create'), path => "/Admin/CustomFields/Modify.html?Create=1" );
98 }
99
af59614d
MKG
100 if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'ModifyScrips' ) ) {
101 my $scrips = $admin->child( 'scrips' =>
102 title => loc('Scrips'),
103 description => loc('Manage scrips'),
104 path => '/Admin/Scrips/',
105 );
106 $scrips->child( select => title => loc('Select'), path => "/Admin/Scrips/" );
107 $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html" );
108 }
109
84fb5b46
MKG
110 my $admin_global = $admin->child( global =>
111 title => loc('Global'),
112 description => loc('Manage properties and configuration which apply to all queues'),
113 path => '/Admin/Global/',
114 );
115
116 my $scrips = $admin_global->child( scrips =>
117 title => loc('Scrips'),
118 description => loc('Modify scrips which apply to all queues'),
119 path => '/Admin/Global/Scrips.html',
120 );
121 $scrips->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
af59614d 122 $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html" );
84fb5b46
MKG
123
124 my $templates = $admin_global->child( templates =>
125 title => loc('Templates'),
126 description => loc('Edit system templates'),
127 path => '/Admin/Global/Templates.html',
128 );
129 $templates->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
130 $templates->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
131
132 my $cfadmin = $admin_global->child( 'custom-fields' =>
133 title => loc('Custom Fields'),
134 description => loc('Modify global custom fields'),
135 path => '/Admin/Global/CustomFields/index.html',
136 );
137 $cfadmin->child( users =>
138 title => loc('Users'),
139 description => loc('Select custom fields for all users'),
140 path => '/Admin/Global/CustomFields/Users.html',
141 );
142 $cfadmin->child( groups =>
143 title => loc('Groups'),
144 description => loc('Select custom fields for all user groups'),
145 path => '/Admin/Global/CustomFields/Groups.html',
146 );
147 $cfadmin->child( queues =>
148 title => loc('Queues'),
149 description => loc('Select custom fields for all queues'),
150 path => '/Admin/Global/CustomFields/Queues.html',
151 );
152 $cfadmin->child( tickets =>
153 title => loc('Tickets'),
154 description => loc('Select custom fields for tickets in all queues'),
155 path => '/Admin/Global/CustomFields/Queue-Tickets.html',
156 );
157 $cfadmin->child( transactions =>
158 title => loc('Ticket Transactions'),
159 description => loc('Select custom fields for transactions on tickets in all queues'),
160 path => '/Admin/Global/CustomFields/Queue-Transactions.html',
161 );
162 $cfadmin->child( 'custom-fields' =>
163 title => loc('Articles'),
164 description => loc('Select Custom Fields for Articles in all Classes'),
165 path => '/Admin/Global/CustomFields/Class-Article.html',
166 );
167
168 my $article_admin = $admin->child( articles => title => loc('Articles'), path => "/Admin/Articles/index.html" );
169 my $class_admin = $article_admin->child(classes => title => loc('Classes'), path => '/Admin/Articles/Classes/' );
170 $class_admin->child( select =>
171 title => loc('Select'),
172 description => loc('Modify and Create Classes'),
173 path => '/Admin/Articles/Classes/',
174 );
175 $class_admin->child( create =>
176 title => loc('Create'),
177 description => loc('Modify and Create Custom Fields for Articles'),
178 path => '/Admin/Articles/Classes/Modify.html?Create=1',
179 );
180
181
182 my $cfs = $article_admin->child( 'custom-fields' =>
183 title => loc('Custom Fields'),
af59614d 184 path => '/Admin/CustomFields/index.html?'.$m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
84fb5b46
MKG
185 );
186 $cfs->child( select =>
187 title => loc('Select'),
af59614d 188 path => '/Admin/CustomFields/index.html?'.$m->comp('/Elements/QueryString', Type => 'RT::Class-RT::Article'),
84fb5b46
MKG
189 );
190 $cfs->child( create =>
191 title => loc('Create'),
192 path => '/Admin/CustomFields/Modify.html?'.$m->comp("/Elements/QueryString", Create=>1, LookupType=> "RT::Class-RT::Article" ),
193 );
194
195 $admin_global->child( 'group-rights' =>
196 title => loc('Group Rights'),
197 description => loc('Modify global group rights'),
198 path => '/Admin/Global/GroupRights.html',
199 );
200 $admin_global->child( 'user-rights' =>
201 title => loc('User Rights'),
202 description => loc('Modify global user rights'),
203 path => '/Admin/Global/UserRights.html',
204 );
205 $admin_global->child( 'my-rt' =>
206 title => loc('RT at a glance'),
207 description => loc('Modify the default "RT at a glance" view'),
208 path => '/Admin/Global/MyRT.html',
209 );
af59614d
MKG
210 $admin_global->child( 'dashboards-in-menu' =>
211 title => loc('Dashboards in menu'),
212 description => loc('Customize dashboards in menu'),
213 path => '/Admin/Global/DashboardsInMenu.html',
214 );
84fb5b46
MKG
215 $admin_global->child( 'topics' =>
216 title => loc('Topics'),
217 description => loc('Modify global article topics'),
218 path => '/Admin/Global/Topics.html',
219 );
220
221 my $admin_tools = $admin->child( tools =>
222 title => loc('Tools'),
223 description => loc('Use other RT administrative tools'),
224 path => '/Admin/Tools/',
225 );
226 $admin_tools->child( configuration =>
227 title => loc('System Configuration'),
228 description => loc('Detailed information about your RT setup'),
229 path => '/Admin/Tools/Configuration.html',
230 );
231 $admin_tools->child( theme =>
232 title => loc('Theme'),
233 description => loc('Customize the look of your RT'),
234 path => '/Admin/Tools/Theme.html',
235 );
236 if (RT->Config->Get('StatementLog')
237 && $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
238 $admin_tools->child( 'sql-queries' =>
239 title => loc('SQL Queries'),
240 description => loc('Browse the SQL queries made in this process'),
241 path => '/Admin/Tools/Queries.html',
242 );
243 }
244 $admin_tools->child( shredder =>
245 title => loc('Shredder'),
246 description => loc('Permanently wipeout data from RT'),
247 path => '/Admin/Tools/Shredder',
248 );
249
250 if ( $request_path =~ m{^/Admin/(Queues|Users|Groups|CustomFields)} ) {
251 my $type = $1;
252 my $tabs = PageMenu();
253
254 my %labels = (
255 Queues => loc("Queues"),
256 Users => loc("Users"),
257 Groups => loc("Groups"),
258 CustomFields => loc("Custom Fields"),
259 );
260
261 my $section;
262 if ( $request_path =~ m|^/Admin/$type/?(?:index.html)?$|
263 || ( $request_path =~ m|^/Admin/$type/(?:Modify.html)$|
b5747ff2 264 && $DECODED_ARGS->{'Create'} )
84fb5b46
MKG
265 )
266 {
267 $section = $tabs;
268
269 } else {
270 $section = $tabs->child( select => title => $labels{$type},
271 path => "/Admin/$type/" );
272 }
273
274 $section->child( select => title => loc('Select'), path => "/Admin/$type/" );
275 $section->child( create => title => loc('Create'), path => "/Admin/$type/Modify.html?Create=1" );
276 }
277
278 if ( $request_path =~ m{^/Admin/Queues} ) {
b5747ff2 279 if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/
84fb5b46 280 ||
b5747ff2 281 $DECODED_ARGS->{'Queue'} && $DECODED_ARGS->{'Queue'} =~ /^\d+$/
84fb5b46 282 ) {
b5747ff2 283 my $id = $DECODED_ARGS->{'Queue'} || $DECODED_ARGS->{'id'};
84fb5b46
MKG
284 my $queue_obj = RT::Queue->new( $session{'CurrentUser'} );
285 $queue_obj->Load($id);
286
403d7b0b
MKG
287 if ( $queue_obj and $queue_obj->id ) {
288 my $queue = PageMenu();
289 $queue->child( basics => title => loc('Basics'), path => "/Admin/Queues/Modify.html?id=" . $id );
290 $queue->child( people => title => loc('Watchers'), path => "/Admin/Queues/People.html?id=" . $id );
84fb5b46 291
403d7b0b
MKG
292 my $templates = $queue->child(templates => title => loc('Templates'), path => "/Admin/Queues/Templates.html?id=" . $id);
293 $templates->child( select => title => loc('Select'), path => "/Admin/Queues/Templates.html?id=".$id);
294 $templates->child( create => title => loc('Create'), path => "/Admin/Queues/Template.html?Create=1;Queue=".$id);
84fb5b46 295
403d7b0b
MKG
296 my $scrips = $queue->child( scrips => title => loc('Scrips'), path => "/Admin/Queues/Scrips.html?id=" . $id);
297 $scrips->child( select => title => loc('Select'), path => "/Admin/Queues/Scrips.html?id=" . $id );
af59614d 298 $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html?Queue=" . $id);
84fb5b46 299
af59614d
MKG
300 my $cfs = $queue->child( 'custom-fields' => title => loc('Custom Fields') );
301 my $ticket_cfs = $cfs->child( 'tickets' => title => loc('Tickets'),
403d7b0b 302 path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket&id=' . $id );
84fb5b46 303
af59614d 304 my $txn_cfs = $cfs->child( 'transactions' => title => loc('Transactions'),
403d7b0b 305 path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id );
84fb5b46 306
403d7b0b
MKG
307 $queue->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Queues/GroupRights.html?id=".$id );
308 $queue->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Queues/UserRights.html?id=" . $id );
309 $queue->child( 'history' => title => loc('History'), path => "/Admin/Queues/History.html?id=" . $id );
84fb5b46 310
403d7b0b
MKG
311 $m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue);
312 }
84fb5b46
MKG
313 }
314 }
af59614d 315 if ( $request_path =~ m{^(/Admin/Users|/User/(Summary|History)\.html)} and $admin->child("users") ) {
b5747ff2
MKG
316 if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
317 my $id = $DECODED_ARGS->{'id'};
84fb5b46
MKG
318 my $obj = RT::User->new( $session{'CurrentUser'} );
319 $obj->Load($id);
320
403d7b0b
MKG
321 if ( $obj and $obj->id ) {
322 my $tabs = PageMenu();
323 $tabs->child( basics => title => loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id );
324 $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id );
325 $tabs->child( history => title => loc('History'), path => "/Admin/Users/History.html?id=" . $id );
326 $tabs->child( 'my-rt' => title => loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id );
af59614d
MKG
327 $tabs->child( 'dashboards-in-menu' =>
328 title => loc('Dashboards in menu'),
329 path => '/Admin/Users/DashboardsInMenu.html?id=' . $id,
330 );
331 if ( RT->Config->Get('Crypt')->{'Enable'} ) {
332 $tabs->child( keys => title => loc('Private keys'), path => "/Admin/Users/Keys.html?id=" . $id );
403d7b0b 333 }
af59614d 334 $tabs->child( 'summary' => title => loc('User Summary'), path => "/User/Summary.html?id=" . $id );
84fb5b46
MKG
335 }
336 }
337
338 }
339
340 if ( $request_path =~ m{^/Admin/Groups} ) {
b5747ff2
MKG
341 if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
342 my $id = $DECODED_ARGS->{'id'};
84fb5b46
MKG
343 my $obj = RT::Group->new( $session{'CurrentUser'} );
344 $obj->Load($id);
345
af59614d 346 if ( $obj and $obj->id ) {
403d7b0b
MKG
347 my $tabs = PageMenu();
348 $tabs->child( basics => title => loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id );
349 $tabs->child( members => title => loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id );
af59614d 350 $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Groups/Memberships.html?id=" . $obj->id );
403d7b0b
MKG
351 $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id );
352 $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id );
353 $tabs->child( history => title => loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id );
354 }
84fb5b46
MKG
355 }
356 }
357
358 if ( $request_path =~ m{^/Admin/CustomFields/} ) {
b5747ff2
MKG
359 if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
360 my $id = $DECODED_ARGS->{'id'};
84fb5b46
MKG
361 my $obj = RT::CustomField->new( $session{'CurrentUser'} );
362 $obj->Load($id);
363
403d7b0b
MKG
364 if ( $obj and $obj->id ) {
365 my $tabs = PageMenu();
af59614d
MKG
366 $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id );
367 $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id );
368 $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id );
369 unless ( $obj->IsOnlyGlobal ) {
370 $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id );
371 }
403d7b0b 372 }
84fb5b46
MKG
373 }
374 }
375
af59614d
MKG
376 if ( $request_path =~ m{^/Admin/Scrips/} ) {
377 if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
378 my $id = $m->request_args->{'id'};
379 my $obj = RT::Scrip->new( $session{'CurrentUser'} );
380 $obj->Load($id);
381
382 my $tabs = PageMenu();
383 $tabs->child( basics => title => loc('Basics') => path => "/Admin/Scrips/Modify.html?id=".$id );
384 $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id );
385 }
386 elsif ( $request_path =~ m{^/Admin/Scrips/(index\.html)?$} ) {
387 PageMenu->child( select => title => loc('Select') => path => "/Admin/Scrips/" );
388 PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html" );
389 }
390 elsif ( $request_path =~ m{^/Admin/Scrips/Create\.html$} ) {
391 my ($queue) = $DECODED_ARGS->{'Queue'} && $DECODED_ARGS->{'Queue'} =~ /^(\d+)$/;
392 if ($queue) {
393 PageMenu->child( select => title => loc('Select') => path => "/Admin/Queues/Scrips.html?id=$queue" );
394 PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html?Queue=$queue" );
395 } else {
396 PageMenu->child( select => title => loc('Select') => path => "/Admin/Global/Scrips.html" );
397 PageMenu->child( create => title => loc('Create') => path => "/Admin/Scrips/Create.html" );
398 }
399 }
400 }
84fb5b46 401
af59614d
MKG
402 if ( $request_path =~ m{^/Admin/Global/Scrips\.html} ) {
403 my $tabs = PageMenu();
404 $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" );
405 $tabs->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html" );
406 }
84fb5b46 407
af59614d
MKG
408 if ( $request_path =~ m{^/Admin/Global/Templates?\.html} ) {
409 my $tabs = PageMenu();
410 $tabs->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" );
411 $tabs->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" );
84fb5b46
MKG
412 }
413
414 if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
415 my $tabs = PageMenu();
b5747ff2 416 if ( my $id = $DECODED_ARGS->{'id'} ) {
c36a7e1d 417 my $obj = RT::Class->new( $session{'CurrentUser'} );
84fb5b46
MKG
418 $obj->Load($id);
419
403d7b0b
MKG
420 if ( $obj and $obj->id ) {
421 my $section = $tabs->child( select => title => loc("Classes"), path => "/Admin/Articles/Classes/" );
422 $section->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
423 $section->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
424
425 $tabs->child( basics => title => loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id );
426 $tabs->child( topics => title => loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id );
427 $tabs->child( 'custom-fields' => title => loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id );
428 $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id );
429 $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id );
430 $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" );
431 }
84fb5b46
MKG
432 } else {
433 $tabs->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" );
434 $tabs->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" );
435 }
436 }
437};
438
84fb5b46
MKG
439my $build_main_nav = sub {
440
c36a7e1d
MKG
441 PageWidgets()->child( simple_search => raw_html => $m->scomp('SimpleSearch') );
442 PageWidgets()->child( create_ticket => raw_html => $m->scomp('CreateTicket') );
443
84fb5b46 444 my $home = Menu->child( home => title => loc('Homepage'), path => '/' );
af59614d
MKG
445 unless ($session{'dashboards_in_menu'}) {
446 my $dashboards_in_menu = $session{CurrentUser}->UserObj->Preferences(
447 'DashboardsInMenu',
448 {},
449 );
84fb5b46 450
af59614d
MKG
451 unless ($dashboards_in_menu->{dashboards}) {
452 my ($default_dashboards) =
453 RT::System->new( $session{'CurrentUser'} )
454 ->Attributes
455 ->Named('DashboardsInMenu');
456 if ($default_dashboards) {
457 $dashboards_in_menu = $default_dashboards->Content;
458 }
459 }
460
461 $session{'dashboards_in_menu'} = $dashboards_in_menu->{dashboards} || [];
462 }
463
464 my @dashboards;
465 for my $id ( @{$session{'dashboards_in_menu'}} ) {
466 my $dash = RT::Dashboard->new( $session{CurrentUser} );
467 my ( $status, $msg ) = $dash->LoadById($id);
468 if ( $status ) {
469 push @dashboards, $dash;
470 } else {
471 $RT::Logger->warning( "Failed to load dashboard $id: $msg" );
472 }
84fb5b46
MKG
473 }
474
475 my $dashes = Menu()->child('home');
476 if (@dashboards) {
477 for my $dash (@dashboards) {
478 $home->child( 'dashboard-' . $dash->id,
479 title => $dash->Name,
480 path => '/Dashboards/' . $dash->id . '/' . $dash->Name
481 );
482 }
84fb5b46 483 }
af59614d
MKG
484 $dashes->child( edit => title => loc('Update This Menu'), path => 'Prefs/DashboardsInMenu.html' );
485 $dashes->child( more => title => loc('All Dashboards'), path => 'Dashboards/index.html' );
84fb5b46
MKG
486 my $dashboard = RT::Dashboard->new( $session{CurrentUser} );
487 if ( $dashboard->CurrentUserCanCreateAny ) {
488 $dashes->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" );
489 }
490
af59614d
MKG
491 my $search = Menu->child( search => title => loc('Search'), path => '/Search/Simple.html' );
492
493 my $tickets = $search->child( tickets => title => loc('Tickets'), path => '/Search/Build.html' );
84fb5b46
MKG
494 $tickets->child( simple => title => loc('Simple Search'), path => "/Search/Simple.html" );
495 $tickets->child( new => title => loc('New Search'), path => "/Search/Build.html?NewQuery=1" );
496
af59614d
MKG
497 $search->child( articles => title => loc('Articles'), path => "/Articles/Article/Search.html" )
498 if $session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
499
500 $search->child( users => title => loc('Users'), path => "/User/Search.html" );
501
502 if ($session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
503 my $articles = Menu->child( articles => title => loc('Articles'), path => "/Articles/index.html");
504 $articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" );
505 $articles->child( topics => title => loc('Topics'), path => "/Articles/Topics.html" );
506 $articles->child( create => title => loc('Create'), path => "/Articles/Article/PreCreate.html" );
507 $articles->child( search => title => loc('Search'), path => "/Articles/Article/Search.html" );
508 }
84fb5b46
MKG
509
510 my $tools = Menu->child( tools => title => loc('Tools'), path => '/Tools/index.html' );
84fb5b46
MKG
511
512 $tools->child( my_day =>
513 title => loc('My Day'),
514 description => loc('Easy updating of your open tickets'),
515 path => '/Tools/MyDay.html',
516 );
517
518 if ( RT->Config->Get('EnableReminders') ) {
519 $tools->child( my_reminders =>
520 title => loc('My Reminders'),
521 description => loc('Easy viewing of your reminders'),
522 path => '/Tools/MyReminders.html',
523 );
524 }
525
84fb5b46
MKG
526 if ( $session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) {
527 $tools->child( approval =>
528 title => loc('Approval'),
529 description => loc('My Approvals'),
530 path => '/Approvals/',
531 );
532 }
533
534 if ( $session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) )
535 {
af59614d 536 $build_admin_menu->(Menu());
84fb5b46
MKG
537 }
538
539 my $username = '<span class="current-user">'
540 . $m->interp->apply_escapes($session{'CurrentUser'}->Name, 'h')
541 . '</span>';
542 my $about_me = Menu->child( 'preferences' =>
543 title => loc('Logged in as [_1]', $username),
544 escape_title => 0,
af59614d 545 path => '/User/Summary.html?id=' . $session{CurrentUser}->id,
84fb5b46
MKG
546 sort_order => 99,
547 );
548
549
550 if ( $session{'CurrentUser'}->UserObj
551 && $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System )) {
552 my $settings = $about_me->child( settings => title => loc('Settings'), path => '/Prefs/Other.html' );
af59614d 553 $settings->child( options => title => loc('Preferences'), path => '/Prefs/Other.html' );
84fb5b46
MKG
554 $settings->child( about_me => title => loc('About me'), path => '/User/Prefs.html' );
555 $settings->child( search_options => title => loc('Search options'), path => '/Prefs/SearchOptions.html' );
556 $settings->child( myrt => title => loc('RT at a glance'), path => '/Prefs/MyRT.html' );
af59614d
MKG
557 $settings->child( dashboards_in_menu =>
558 title => loc('Dashboards in menu'),
559 path => '/Prefs/DashboardsInMenu.html',
560 );
84fb5b46
MKG
561 $settings->child( quicksearch => title => loc('Quick search'), path => '/Prefs/Quicksearch.html' );
562
563 my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') );
564 my $searches = [ $m->comp( "/Search/Elements/SearchesForObject",
565 Object => RT::System->new( $session{'CurrentUser'} )) ];
566 my $i = 0;
567
568 for my $search (@$searches) {
569 $search_menu->child( "search-" . $i++ =>
5b0d0914 570 title => $search->[1],
84fb5b46 571 path => "/Prefs/Search.html?"
5b0d0914 572 . $query_string->( name => ref( $search->[2] ) . '-' . $search->[2]->Id ),
84fb5b46
MKG
573 );
574
575 }
576 }
577 if ( $session{'CurrentUser'}->Name
af59614d
MKG
578 && ( !RT->Config->Get('WebRemoteUserAuth')
579 || RT->Config->Get('WebFallbackToRTLogin') )) {
84fb5b46
MKG
580 $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
581 }
582 if ( $request_path =~ m{^/Dashboards/(\d+)?}) {
b5747ff2 583 if ( my $id = ( $1 || $DECODED_ARGS->{'id'} ) ) {
84fb5b46
MKG
584 my $obj = RT::Dashboard->new( $session{'CurrentUser'} );
585 $obj->LoadById($id);
586 if ( $obj and $obj->id ) {
587 my $tabs = PageMenu;
588 $tabs->child( basics => title => loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id);
589 $tabs->child( content => title => loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id);
590 $tabs->child( subscription => title => loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id)
591 if $obj->CurrentUserCanSubscribe;
592 $tabs->child( show => title => loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
593 }
594 }
595 }
596
597
598 if ( $request_path =~ m{^/Ticket/} ) {
b5747ff2 599 if ( ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
84fb5b46
MKG
600 my $id = $1;
601 my $obj = RT::Ticket->new( $session{'CurrentUser'} );
602 $obj->Load($id);
603
403d7b0b
MKG
604 if ( $obj and $obj->id ) {
605 my $actions = PageMenu()->child( actions => title => loc('Actions'), sort_order => 95 );
606 my $tabs = PageMenu();
607 $tabs->child( bookmark => raw_html => $m->scomp( '/Ticket/Elements/Bookmark', id => $id ), sort_order => 99 );
608 $tabs->child( display => title => loc('Display'), path => "/Ticket/Display.html?id=" . $id );
609 $tabs->child( history => title => loc('History'), path => "/Ticket/History.html?id=" . $id );
610
611 my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) };
af59614d 612 $can{'_ModifyOwner'} = $obj->CurrentUserCanSetOwner();
403d7b0b
MKG
613 my $can = sub {
614 unless ($_[0] eq 'ExecuteCode') {
615 return $can{$_[0]} || $can{'SuperUser'};
616 } else {
617 return !RT->Config->Get('DisallowExecuteCode')
618 && ( $can{'ExecuteCode'} || $can{'SuperUser'} );
619 }
620 };
621
622 # comment out until we can do it for an individual custom field
623 #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') ) {
624 $tabs->child( basics => title => loc('Basics'), path => "/Ticket/Modify.html?id=" . $id );
625
626 #}
627
628 if ( $can->('ModifyTicket') || $can->('_ModifyOwner') || $can->('Watch') || $can->('WatchAsAdminCc') ) {
629 $tabs->child( people => title => loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id );
84fb5b46 630 }
84fb5b46 631
403d7b0b
MKG
632 if ( $can->('ModifyTicket') ) {
633 $tabs->child( dates => title => loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id );
634 $tabs->child( links => title => loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id );
635 }
84fb5b46 636
403d7b0b
MKG
637 #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') || $can->('_ModifyOwner') ) {
638 $tabs->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id );
639 #}
84fb5b46 640
403d7b0b
MKG
641 if ( RT->Config->Get('EnableReminders') ) {
642 $tabs->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id );
84fb5b46 643 }
84fb5b46 644
403d7b0b
MKG
645 if ( $can->('ModifyTicket') or $can->('ReplyToTicket') ) {
646 $actions->child( reply => title => loc('Reply'), path => "/Ticket/Update.html?Action=Respond;id=" . $id );
84fb5b46
MKG
647 }
648
403d7b0b
MKG
649 if ( $can->('ModifyTicket') or $can->('CommentOnTicket') ) {
650 $actions->child( comment => title => loc('Comment'), path => "/Ticket/Update.html?Action=Comment;id=" . $id );
84fb5b46 651 }
84fb5b46 652
403d7b0b
MKG
653 if ( $can->('ForwardMessage') ) {
654 $actions->child( forward => title => loc('Forward'), path => "/Ticket/Forward.html?id=" . $id );
655 }
84fb5b46 656
403d7b0b
MKG
657 my $hide_resolve_with_deps = RT->Config->Get('HideResolveActionsWithDependencies')
658 && $obj->HasUnresolvedDependencies;
659
660 my $current = $obj->Status;
af59614d 661 my $lifecycle = $obj->LifecycleObj;
403d7b0b
MKG
662 my $i = 1;
663 foreach my $info ( $lifecycle->Actions($current) ) {
664 my $next = $info->{'to'};
665 next unless $lifecycle->IsTransition( $current => $next );
666
667 my $check = $lifecycle->CheckRight( $current => $next );
668 next unless $can->($check);
669
670 next if $hide_resolve_with_deps
671 && $lifecycle->IsInactive($next)
672 && !$lifecycle->IsInactive($current);
673
674 my $action = $info->{'update'} || '';
675 my $url = '/Ticket/';
af59614d
MKG
676 $url .= "Update.html?". $query_string->(
677 $action
678 ? (Action => $action)
679 : (SubmitTicket => 1, Status => $next),
680 DefaultStatus => $next,
681 id => $id,
682 );
403d7b0b
MKG
683 my $key = $info->{'label'} || ucfirst($next);
684 $actions->child( $key => title => loc( $key ), path => $url);
84fb5b46
MKG
685 }
686
af59614d
MKG
687 my ($can_take, $tmsg) = $obj->CurrentUserCanSetOwner( Type => 'Take' );
688 my ($can_steal, $smsg) = $obj->CurrentUserCanSetOwner( Type => 'Steal' );
689 if ( $can_take ){
690 $actions->child( take => title => loc('Take'), path => "/Ticket/Display.html?Action=Take;id=" . $id );
691 }
692 elsif ( $can_steal ){
693 $actions->child( steal => title => loc('Steal'), path => "/Ticket/Display.html?Action=Steal;id=" . $id );
84fb5b46 694 }
403d7b0b
MKG
695
696 # TODO needs a "Can extract article into a class applied to this queue" check
697 $actions->child( 'extract-article' =>
698 title => loc('Extract Article'),
699 path => "/Articles/Article/ExtractIntoClass.html?Ticket=".$obj->id,
af59614d 700 ) if $session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
403d7b0b
MKG
701
702 if ( defined $session{"tickets"} ) {
703 # we have to update session data if we get new ItemMap
704 my $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} );
705
706 my $item_map = $session{"tickets"}->ItemMap;
707
708 if ($updatesession) {
709 $session{"tickets"}->PrepForSerialization();
710 }
711
af59614d 712 my $search = Menu()->child('search')->child('tickets');
403d7b0b
MKG
713 # Don't display prev links if we're on the first ticket
714 if ( $item_map->{$id}->{prev} ) {
715 $search->child( first =>
716 title => '<< ' . loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first});
717 $search->child( prev =>
718 title => '< ' . loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev});
719 }
720 # Don't display next links if we're on the last ticket
721 if ( $item_map->{$id}->{next} ) {
722 $search->child( next =>
723 title => loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
320f0092
MKG
724 if ( $item_map->{last} ) {
725 $search->child( last =>
726 title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
727 }
403d7b0b 728 }
84fb5b46
MKG
729 }
730 }
731 }
732 }
733
734 if (
735 (
736 $request_path =~ m{^/(?:Ticket|Search)/}
737 && $request_path !~ m{^/Search/Simple\.html}
738 )
739 || ( $request_path =~ m{^/Search/Simple\.html}
b5747ff2 740 && $DECODED_ARGS->{'q'} )
84fb5b46
MKG
741 )
742 {
af59614d 743 my $search = Menu()->child('search')->child('tickets');
84fb5b46
MKG
744 my $args = '';
745 my $has_query = '';
746 my $current_search = $session{"CurrentSearchHash"} || {};
b5747ff2
MKG
747 my $search_id = $DECODED_ARGS->{'SavedSearchLoad'} || $DECODED_ARGS->{'SavedSearchId'} || $current_search->{'SearchId'} || '';
748 my $chart_id = $DECODED_ARGS->{'SavedChartSearchId'} || $current_search->{SavedChartSearchId};
84fb5b46 749
b5747ff2 750 $has_query = 1 if ( $DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
84fb5b46
MKG
751
752 my %query_args;
753 my %fallback_query_args = (
754 SavedSearchId => ( $search_id eq 'new' ) ? undef : $search_id,
755 SavedChartSearchId => $chart_id,
756 (
757 map {
758 my $p = $_;
b5747ff2 759 $p => $DECODED_ARGS->{$p} || $current_search->{$p}
84fb5b46
MKG
760 } qw(Query Format OrderBy Order Page)
761 ),
762 RowsPerPage => (
b5747ff2
MKG
763 defined $DECODED_ARGS->{'RowsPerPage'}
764 ? $DECODED_ARGS->{'RowsPerPage'}
84fb5b46
MKG
765 : $current_search->{'RowsPerPage'}
766 ),
767 );
768
769 if ($QueryString) {
770 $args = '?' . $QueryString;
771 }
772 else {
773 my %final_query_args = ();
774 # key => callback to avoid unnecessary work
775
776 for my $param (keys %fallback_query_args) {
777 $final_query_args{$param} = defined($QueryArgs->{$param})
778 ? $QueryArgs->{$param}
779 : $fallback_query_args{$param};
780 }
781
782 for my $field (qw(Order OrderBy)) {
783 if ( ref( $final_query_args{$field} ) eq 'ARRAY' ) {
784 $final_query_args{$field} = join( "|", @{ $final_query_args{$field} } );
785 } elsif (not defined $final_query_args{$field}) {
786 delete $final_query_args{$field};
787 }
788 else {
789 $final_query_args{$field} ||= '';
790 }
791 }
792
793 $args = '?' . $query_string->(%final_query_args);
794 }
795
796 my $current_search_menu;
797 if ( $request_path =~ m{^/Ticket} ) {
798 $current_search_menu = $search->child( current_search => title => loc('Current Search') );
799 $current_search_menu->path("/Search/Results.html$args") if $has_query;
800 } else {
801 $current_search_menu = PageMenu();
802 }
803
804 $current_search_menu->child( edit_search =>
805 title => loc('Edit Search'), path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) );
806 $current_search_menu->child( advanced =>
807 title => loc('Advanced'), path => "/Search/Edit.html$args" );
808 if ($has_query) {
809 $current_search_menu->child( results => title => loc('Show Results'), path => "/Search/Results.html$args" );
810 }
811
812 if ( $has_query ) {
813 $current_search_menu->child( bulk => title => loc('Bulk Update'), path => "/Search/Bulk.html$args" );
814 $current_search_menu->child( chart => title => loc('Chart'), path => "/Search/Chart.html$args" );
815
816 my $more = $current_search_menu->child( more => title => loc('Feeds') );
817
818 $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Search/Results.tsv$args" );
819
820 my %rss_data = map {
821 $_ => $QueryArgs->{$_} || $fallback_query_args{$_} || '' }
822 qw(Query Order OrderBy);
823 my $RSSQueryString = "?"
824 . $query_string->( Query => $rss_data{Query},
825 Order => $rss_data{Order},
826 OrderBy => $rss_data{OrderBy}
827 );
828 my $RSSPath = join '/', map $m->interp->apply_escapes( $_, 'u' ),
829 $session{'CurrentUser'}->UserObj->Name,
830 $session{'CurrentUser'}
831 ->UserObj->GenerateAuthString( $rss_data{Query}
832 . $rss_data{Order}
833 . $rss_data{OrderBy} );
834
835 $more->child( rss => title => loc('RSS'), path => "/NoAuth/rss/$RSSPath/$RSSQueryString");
836 my $ical_path = join '/', map $m->interp->apply_escapes($_, 'u'),
837 $session{'CurrentUser'}->UserObj->Name,
838 $session{'CurrentUser'}->UserObj->GenerateAuthString( $rss_data{Query} ),
839 $rss_data{Query};
840 $more->child( ical => title => loc('iCal'), path => '/NoAuth/iCal/'.$ical_path);
841
842 if ($request_path =~ m{^/Search/Results.html}
843 && #XXX TODO better abstraction
844 $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) {
845 my $shred_args = $query_string->(
c36a7e1d
MKG
846 Search => 1,
847 Plugin => 'Tickets',
84fb5b46
MKG
848 'Tickets:query' => $rss_data{'Query'},
849 'Tickets:limit' => $QueryArgs->{'Rows'},
850 );
851
852 $more->child( shredder => title => loc('Shredder'), path => '/Admin/Tools/Shredder/?' . $shred_args);
853 }
854
855 }
856 }
857
858 if ( $request_path =~ m{^/Article/} ) {
b5747ff2
MKG
859 if ( $DECODED_ARGS->{'id'} && $DECODED_ARGS->{'id'} =~ /^\d+$/ ) {
860 my $id = $DECODED_ARGS->{'id'};
84fb5b46
MKG
861 my $tabs = PageMenu();
862
863 $tabs->child( display => title => loc('Display'), path => "/Articles/Article/Display.html?id=".$id );
864 $tabs->child( history => title => loc('History'), path => "/Articles/Article/History.html?id=".$id );
865 $tabs->child( modify => title => loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id );
866 $tabs->child( delete => title => loc('Delete'), path => "/Articles/Article/Delete.html?id=".$id );
867 }
868 }
869
870 if ( $request_path =~ m{^/Articles/} ) {
c36a7e1d
MKG
871 PageWidgets()->child( article_search => raw_html => $m->scomp('/Articles/Elements/GotoArticle') );
872 PageWidgets()->delete('create_ticket');
873 PageWidgets()->delete('simple_search');
874
84fb5b46
MKG
875 my $tabs = PageMenu();
876 $tabs->child( search => title => loc("Search"), path => "/Articles/Article/Search.html" );
877 $tabs->child( create => title => loc("New Article" ), path => "/Articles/Article/PreCreate.html" );
b5747ff2 878 if ( $request_path =~ m{^/Articles/Article/} and ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
84fb5b46
MKG
879 my $id = $1;
880 my $obj = RT::Article->new( $session{'CurrentUser'} );
881 $obj->Load($id);
882
403d7b0b
MKG
883 if ( $obj and $obj->id ) {
884 $tabs->child( display => title => loc("Display"), path => "/Articles/Article/Display.html?id=" . $id );
885 $tabs->child( history => title => loc('History'), path => '/Articles/Article/History.html?id=' . $id );
84fb5b46 886
403d7b0b
MKG
887 if ( $obj->CurrentUserHasRight('ModifyArticle') ) {
888 $tabs->child(modify => title => loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id );
889 }
890 if ( $obj->CurrentUserHasRight('DeleteArticle') ) {
891 $tabs->child(delete => title => loc('Delete'), path => '/Articles/Article/Delete.html?id=' . $id );
892 }
84fb5b46
MKG
893 }
894 }
895
896 }
897
af59614d
MKG
898 if ( $request_path =~ m{^/User/(Summary|History)\.html} ) {
899 if (PageMenu()->child('summary')) {
900 # Already set up from having AdminUser and ShowConfigTab;
901 # but rename "Basics" to "Edit" in this context
902 PageMenu()->child( 'basics' )->title( loc('Edit') );
903 } elsif ( $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'ShowUserHistory' ) ) {
904 PageMenu()->child( display => title => loc('Summary'), path => '/User/Summary.html?id=' . $DECODED_ARGS->{'id'} );
905 PageMenu()->child( history => title => loc('History'), path => '/User/History.html?id=' . $DECODED_ARGS->{'id'} );
906 }
907 }
908
84fb5b46
MKG
909 if ( $request_path =~ /^\/(?:index.html|$)/ ) {
910 PageMenu()->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' );
911 }
912
af59614d 913 $m->callback( CallbackName => 'Privileged', Path => $request_path );
84fb5b46
MKG
914};
915
916my $build_selfservice_nav = sub {
917 my $queues = RT::Queues->new( $session{'CurrentUser'} );
918 $queues->UnLimit;
919
920 my $queue_count = 0;
b5747ff2 921 my $queue_id;
84fb5b46
MKG
922
923 while ( my $queue = $queues->Next ) {
924 next unless $queue->CurrentUserHasRight('CreateTicket');
925 $queue_id = $queue->id;
926 $queue_count++;
927 last if ( $queue_count > 1 );
928 }
929
930
b5747ff2
MKG
931 if ( $queue_count > 1 ) {
932 Menu->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
933 } elsif ( $queue_id ) {
934 Menu->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
935 }
dab09ea8 936 my $tickets = Menu->child( tickets => title => loc('Tickets'), path => '/SelfService/' );
84fb5b46
MKG
937 $tickets->child( open => title => loc('Open tickets'), path => '/SelfService/' );
938 $tickets->child( closed => title => loc('Closed tickets'), path => '/SelfService/Closed.html' );
84fb5b46
MKG
939
940
941 my $username = '<span class="current-user">'
942 . $m->interp->apply_escapes($session{'CurrentUser'}->Name, 'h')
943 . '</span>';
944 my $about_me = Menu->child( preferences =>
945 title => loc('Logged in as [_1]', $username),
946 escape_title => 0,
947 sort_order => 99,
948 );
949
950 if ( $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System ) ) {
951 $about_me->child( prefs => title => loc('Preferences'), path => '/SelfService/Prefs.html' );
952 }
953
954 if ( $session{'CurrentUser'}->Name
af59614d
MKG
955 && ( !RT->Config->Get('WebRemoteUserAuth')
956 || RT->Config->Get('WebFallbackToRTLogin') )) {
84fb5b46
MKG
957 $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' );
958 }
959
960 if ($session{'CurrentUser'}->HasRight( Right => 'ShowArticle', Object => RT->System )) {
961 PageWidgets->child( 'goto-article' => raw_html => $m->scomp('/SelfService/Elements/SearchArticle') );
962 }
963
964 PageWidgets->child( goto => raw_html => $m->scomp('/SelfService/Elements/GotoTicket') );
965
af59614d 966 $m->callback( CallbackName => 'SelfService', Path => $request_path );
84fb5b46
MKG
967};
968
969
970
971if ( $request_path !~ m{^/SelfService/} ) {
972 $build_main_nav->();
973} else {
974 $build_selfservice_nav->();
975}
976
977
978
979
980</%INIT>
981<%ARGS>
982$show_menu => 1
983$QueryString => ''
984$QueryArgs => {}
985</%ARGS>