]>
Commit | Line | Data |
---|---|---|
1 | %# BEGIN BPS TAGGED BLOCK {{{ | |
2 | %# | |
3 | %# COPYRIGHT: | |
4 | %# | |
5 | %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC | |
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 | <script type="text/javascript"> | |
49 | jQuery(function() { | |
50 | jQuery("#requestor-accordion").accordion({ | |
51 | active: <% $count == 1 ? 0 : 'false' %>, | |
52 | collapsible: true, | |
53 | autoHeight: false | |
54 | }); | |
55 | ||
56 | % if ($ShowTickets) { | |
57 | jQuery(".more-about-requestor-tickets").tabs({ | |
58 | cache: true, | |
59 | collapsible: true, | |
60 | selected: <% $selected %> | |
61 | }); | |
62 | % } | |
63 | }); | |
64 | </script> | |
65 | ||
66 | <&| /Widgets/TitleBox, | |
67 | title_raw => loc("More about the requestors"), | |
68 | class => 'ticket-info-requestor' | |
69 | &> | |
70 | ||
71 | <div id="requestor-accordion"> | |
72 | ||
73 | % while ( my $requestor = $people->Next ) { | |
74 | <h3><a href="#"><& /Elements/ShowUser, User => $requestor &></a></h3> | |
75 | <div class="details"> | |
76 | ||
77 | %# Additional information about this user. Empty by default. | |
78 | % $m->callback( requestor => $requestor, %ARGS, CallbackName => 'AboutThisUser' ); | |
79 | <& ShowRequestorExtraInfo, Requestor => $requestor &> | |
80 | ||
81 | % if ( $ShowComments ) { | |
82 | <div class="comments-about-user"> | |
83 | <span class="label"><&|/l&>Comments about this user</&>:</span> | |
84 | <span class="value"><% ($requestor->Comments || loc("No comment entered about this user")) %></span> | |
85 | </div> | |
86 | % } | |
87 | ||
88 | % if ( $ShowTickets ) { | |
89 | <div class="more-about-requestor-tickets ui-tabs" id="more-about-requestor-tickets-<%$requestor->Id%>"> | |
90 | <ul> | |
91 | % my $index = 1; | |
92 | % for my $status ( @$status_order ) { | |
93 | <li> | |
94 | % if ( $status eq $DefaultTicketsTab ) { | |
95 | <a href="#requestor-<%$requestor->Id%>-ticket-tab-default">\ | |
96 | % } else { | |
97 | % my $url = RT->Config->Get('WebPath').'/Helpers/Toggle/ShowRequestor?'. | |
98 | % $m->comp('/Elements/QueryString', Requestor => $requestor->Id , Status => $status); | |
99 | <a href="<% $url | n %>" title="requestor-<%$requestor->Id%>-ticket-tab-<% $index++ %>">\ | |
100 | % } | |
101 | <% $status_link_text->{$status} %></a> | |
102 | </li> | |
103 | % } | |
104 | </ul> | |
105 | % $index = 1; | |
106 | % for my $status (@$status_order) { | |
107 | % if ( $status eq $DefaultTicketsTab ) { | |
108 | <div id="requestor-<%$requestor->Id%>-ticket-tab-default"> | |
109 | <& $TicketTemplate, Requestor => $requestor &> | |
110 | % } else { | |
111 | <div id="requestor-<%$requestor->Id%>-ticket-tab-<% $index++ %>" class="ui-tabs-hide"> | |
112 | <span class="label"><&|/l&>Loading...</&></span> | |
113 | % } | |
114 | </div> | |
115 | % } | |
116 | </div> | |
117 | % } | |
118 | ||
119 | % my $grouplimit = RT->Config->Get('MoreAboutRequestorGroupsLimit'); | |
120 | % if ( $ShowGroups and defined $grouplimit ) { | |
121 | <div class="more-about-user-groups"> | |
122 | <span class="label"> | |
123 | <&|/l&>Groups this user belongs to</&> | |
124 | ||
125 | % if ( $session{CurrentUser}->HasRight( Right => 'AdminUsers', Object => $RT::System ) && | |
126 | % $session{CurrentUser}->HasRight( Right => 'ShowConfigTab', Object =>$RT::System ) ) { | |
127 | [<a href=<% RT->Config->Get('WebPath') . '/Admin/Users/Memberships.html?id=' . $requestor->id %> ><&|/l&>Edit</&></a>] | |
128 | % } | |
129 | </span> | |
130 | <span class="value"><& /Elements/ShowMemberships, UserObj => $requestor, Limit => $grouplimit &></span> | |
131 | </div> | |
132 | % } | |
133 | ||
134 | % if ( $has_right_adminusers ) { | |
135 | <a class="modify-user" href="<% RT->Config->Get('WebPath')."/Admin/Users/Modify.html?id=".$requestor->id %>"><&|/l&>Modify this user</&></a> | |
136 | % } | |
137 | ||
138 | %# end of individual requestor details <div> | |
139 | </div> | |
140 | % } | |
141 | %# end of requestors loop | |
142 | ||
143 | </div> | |
144 | </&> | |
145 | <%INIT> | |
146 | my $show_privileged = RT->Config->Get('ShowMoreAboutPrivilegedUsers'); | |
147 | ||
148 | my $people = $Ticket->Requestors->UserMembersObj; | |
149 | $people->LimitToUnprivileged unless $show_privileged; | |
150 | ||
151 | my $count = $people->Count; | |
152 | return unless $count; | |
153 | ||
154 | my $has_right_adminusers = $session{'CurrentUser'}->HasRight( | |
155 | Object => $RT::System, Right => 'AdminUsers' | |
156 | ); | |
157 | $has_right_adminusers &&= $session{'CurrentUser'}->HasRight( | |
158 | Object => $RT::System, Right => 'ShowConfigTab' | |
159 | ); | |
160 | ||
161 | # Ticket list tabs | |
162 | my $selected = -1; | |
163 | $DefaultTicketsTab ||= RT->Config->Get('MoreAboutRequestorTicketList', $session{CurrentUser}) || 'Active'; | |
164 | my $status_link_text = {Active => loc('Active Tickets'), | |
165 | Inactive => loc('Inactive Tickets'), | |
166 | All => loc('All Tickets')}; | |
167 | my $status_order = [qw/Active Inactive All/]; | |
168 | $m->callback( CallbackName => 'AddStatus', status_link_text => \$status_link_text, status_order => \$status_order ); | |
169 | ||
170 | unless ( $DefaultTicketsTab eq 'None' ) { | |
171 | for (0 .. (@$status_order - 1)) { | |
172 | $selected = $_ && last | |
173 | if $status_order->[$_] eq $DefaultTicketsTab; | |
174 | } | |
175 | } | |
176 | ||
177 | my $TicketTemplate = "ShowRequestorTickets$DefaultTicketsTab"; | |
178 | $TicketTemplate = "ShowRequestorTicketsActive" | |
179 | unless RT::Interface::Web->ComponentPathIsSafe($TicketTemplate) | |
180 | and $m->comp_exists($TicketTemplate); | |
181 | </%INIT> | |
182 | <%ARGS> | |
183 | $Ticket=>undef | |
184 | $DefaultTicketsTab => undef | |
185 | $ShowComments => 1 | |
186 | $ShowTickets => 1 | |
187 | $ShowGroups => 1 | |
188 | $Title => 'More about [_1]' | |
189 | </%ARGS> |