summaryrefslogtreecommitdiff
path: root/rt/share/html/m/_elements/menu
blob: 54e7fe9a32c0004482b59119628914fb051b6a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<&| /Widgets/TitleBox, class => 'menu'&>
<ul class="menu">
% for my $item (@menu) {
% if (exists $item->{html}) {
<li><%$item->{html} |n%></li>
% } else {
<li><a href="<%RT->Config->Get('WebPath')%><%$item->{url}%>"><%$item->{label}%></a></li>
% }
% }
</ul>
</&>
<%init>
use RT::SavedSearches;
my @menu = (
    {         html => '<form method="GET" id="search" action="'
            . RT->Config->Get('WebPath')
            . '/m/tickets/search">'
            . loc("Search")
            . ': <input type="text" name="q" id="q" value=""/>'
            . '<input type="submit" value="'
            . loc("Go")
            . '"/></form>'
    },
    {   label => loc("New ticket"),
        url   => '/m/ticket/select_create_queue',
    },
    {   label => loc("Bookmarked tickets"),
        url   => '/m/tickets/search?name=Bookmarked%20Tickets',
    },
    {   label => loc("Tickets I own"),
        url   => '/m/tickets/search?name=My%20Tickets',
    },
    {   label => loc("Unowned tickets"),
        url   => '/m/tickets/search?name=Unowned%20Tickets',
    },
    {   label => loc("All tickets"),
        url   => '/m/tickets/search?query=id!%3d0&order_by=id&order=DESC'
    },
);


if ( $session{'CurrentUser'}->HasRight( Right  => 'LoadSavedSearch', Object => $RT::System))
    {

        my @Objects = RT::SavedSearches->new( $session{CurrentUser} )->_PrivacyObjects;
        push @Objects, RT::System->new( $session{'CurrentUser'} )
            if $session{'CurrentUser'}->HasRight(
            Object => $RT::System,
            Right  => 'SuperUser'
            );

        foreach my $object (@Objects) {
            my @searches = $object->Attributes->Named('SavedSearch');
            foreach my $search (@searches) {
                next unless $search->SubValue("SearchType") eq 'Ticket';
                push @menu, { label => $search->Description, url => '/m/tickets/search?query=' . $search->SubValue("Query").'&order='.$search->SubValue("Order").'&order_by='.$search->SubValue("OrderBy") };

            }
        }
}
push @menu,  {   label => loc("Logout"), url   => '/m/logout', } 
  if !RT->Config->Get('WebExternalAuth');
</%init>