File: CustomFieldTabs

package info (click to toggle)
rtfm 2.0.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 812 kB
  • ctags: 220
  • sloc: perl: 3,426; sh: 153; makefile: 144
file content (83 lines) | stat: -rw-r--r-- 2,650 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
%# BEGIN LICENSE BLOCK
%# 
%#  Copyright (c) 2002-2003 Jesse Vincent <jesse@bestpractical.com>
%#  
%#  This program is free software; you can redistribute it and/or modify
%#  it under the terms of version 2 of the GNU General Public License 
%#  as published by the Free Software Foundation.
%# 
%#  A copy of that license should have arrived with this
%#  software, but in any event can be snarfed from www.gnu.org.
%# 
%#  This program is distributed in the hope that it will be useful,
%#  but WITHOUT ANY WARRANTY; without even the implied warranty of
%#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%#  GNU General Public License for more details.
%# 
%# END LICENSE BLOCK

<& /RTFM/Admin/Elements/Tabs, 
    subtabs => $tabs, 
    current_tab => 'RTFM/Admin/CustomFields/index.html', 
    current_subtab => 
            "RTFM/Admin/CustomFields/Basics.html?id=" . $id,
    Title => $Title &>
<%INIT>
my $tabs;

if ($id) {
    my $cf = RT::FM::CustomField->new( $session{'CurrentUser'} );
    $cf->Load($id);
    $tabs = {
        C => {
            title => $cf->Name,
            path  => "RTFM/Admin/CustomFields/Basics.html?id=" . $id,

            subtabs => {

                C => { title => loc('Basics'),
                       path  => "RTFM/Admin/CustomFields/Basics.html?id=" . $id,
                },

                F => { title => loc('Group Rights'),
                       path  => "RTFM/Admin/CustomFields/GroupRights.html?id="
                         . $id, },
                G => {
                    title => loc('User Rights'),
                    path => "RTFM/Admin/CustomFields/UserRights.html?id=" . $id,
                },

            } }

    };
}

if ($session{'CurrentUser'}->HasRight( Object => $RT::FM::System, Right => 'AdminCustomField')) {
  $tabs->{"A"} = { title => loc('Select custom field'),
                        path => "RTFM/Admin/CustomFields/index.html",
                           };
  $tabs->{"B"} = { title => loc('New custom field'),
                        path => "RTFM/Admin/CustomFields/Basics.html?Create=1",
                        separator => 1,
                           };
}
  foreach my $tab (sort keys %{$tabs}) {
    if ($tabs->{$tab}->{'path'} eq $current_tab) {
      $tabs->{$tab}->{"current_subtab"} = $current_tab;
    }
  foreach my $subtab (sort keys %{$tabs->{'subtabs'}}) {
    if ($tabs->{$tab}->{subtabs}->{$subtab}->{'path'} eq $current_tab) {
      $tabs->{$tab}->{subtabs}->{$subtab}->{"current_subtab"} = $current_subtab;
    }
  }

  }


</%INIT>
<%ARGS>
$id => undef
$current_subtab => undef
$current_tab => undef
$Title => undef
</%ARGS>