rt 4.0.23
[freeside.git] / rt / share / html / Admin / Tools / Configuration.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2015 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 <%init>
49 require  Module::Versions::Report;
50 my $title = loc('System Configuration');
51 unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) {
52  Abort(loc('This feature is only available to system administrators'));
53 }
54 </%init>
55 <& /Admin/Elements/Header, Title => $title &>
56 <& /Elements/Tabs &>
57
58 <&|/Widgets/TitleBox, title => loc("RT Configuration") &>
59 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
60 <tr class="collection-as-table">
61 <th class="collection-as-table"><&|/l&>Option</&></th>
62 <th class="collection-as-table"><&|/l&>Value</&></th>
63 <th class="collection-as-table"><&|/l&>Source</&></th>
64 </tr>
65 <%PERL>
66 my $index_conf;
67 foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
68     my $val = RT->Config->GetObfuscated( $key, $session{'CurrentUser'} );
69     next unless defined $val;
70
71     my $meta = RT->Config->Meta( $key );
72     my $description = '';
73     if ( $meta->{'Source'}{'Extension'} && $meta->{'Source'}{'SiteConfig'} ) {
74         $description = loc("[_1] site config", $meta->{'Source'}{'Extension'});
75     }
76     elsif ( $meta->{'Source'}{'Extension'} ) {
77         $description = loc("[_1] core config", $meta->{'Source'}{'Extension'});
78     }
79     elsif ( $meta->{'Source'}{'SiteConfig'} ) {
80         $description = loc("site config");
81     }
82     else {
83         $description = loc("core config");
84     }
85     $index_conf++;
86 </%PERL>
87 <tr class="<% $index_conf%2 ? 'oddline' : 'evenline'%>">
88 <td class="collection-as-table"><% $key %></td>
89 <td class="collection-as-table">
90 % if ( $key =~ /Password(?!Length)/i ) { 
91 <em><% loc('Password not printed' ) %></em>\
92 % } else {
93 <% stringify($val) |n %>\
94 % }
95 </td>
96 <td class="collection-as-table" style="white-space: nowrap">
97 % if ( $meta->{'Source'}{'SiteConfig'} ) {
98 <span style="font-weight: bold"><% $description %></span>
99 % } else {
100 <% $description %>
101 % }
102 </td>
103 </tr>
104 % }
105 </table>
106 </&>
107 <table width="100%">
108     <tr>
109         <td valign="top" width="60%" class="boxcontainer">
110 <&|/Widgets/TitleBox, title=> loc("RT core variables") &>
111 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
112 <tr class="collection-as-table">
113 <th class="collection-as-table"><&|/l&>Variable</&></th>
114 <th class="collection-as-table"><&|/l&>Value</&></th>
115 </tr>
116 <%PERL>
117 { no strict qw/refs/;
118 my %config_opt = map { $_ => 1 } RT->Config->Options( Overridable => undef );
119 my $index_var;
120 foreach my $key ( sort keys %{*RT::} ) {
121     next if !${'RT::'.$key} || ref ${'RT::'.$key} || $config_opt{ $key };
122     $index_var++;
123 </%PERL>
124 <tr class="collection-as-table <% $index_var%2 ? 'oddline' : 'evenline'%>">
125 <td class="collection-as-table">RT::<% $key %></td>
126 <td class="collection-as-table">
127 % if ( $key =~ /Password(?!Length)/i ) { 
128 <em><% loc('Password not printed' ) %></em>\
129 % } else {
130 <% ${'RT::'.$key} %>
131 % }
132 </td>
133 </tr>
134 % }
135 % }
136 </table>
137 </&>
138
139 <&|/Widgets/TitleBox, title => loc("RT Size") &>
140 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
141 <tr class="collection-as-table">
142 <th class="collection-as-table"><&|/l&>Object</&></th>
143 <th class="collection-as-table"><&|/l&>Size</&></th>
144 </tr>
145 <%PERL>
146 my ($index_size, $user_count, $privileged_count);
147 for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers UnprivilegedUsers/) {
148     my $count;
149     my $class = 'RT::' . $type;
150     $class =~ s/Privileged|Unprivileged//;
151     my $collection = $class->new(RT->SystemUser);
152     $collection->UnLimit;
153     if ($type =~ /PrivilegedUsers/) {
154         $user_count = $collection->CountAll;
155         $collection->LimitToPrivileged;
156         $count = $privileged_count = $collection->CountAll;
157     } elsif ($type =~ /UnprivilegedUsers/) {
158         $count = $user_count - $privileged_count;
159     } else {
160         $count = $collection->CountAll;
161     }
162     $index_size++;
163 </%PERL>
164 <tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>">
165 <td class="collection-as-table"><% $type %></td>
166 <td class="collection-as-table"><% $count %></td>
167 </tr>
168 % }
169 </table>
170 </&>
171 </td>
172 <td valign="top" class="boxcontainer">
173
174 <&|/Widgets/TitleBox, title => loc("Mason template search order") &>
175 <ol>
176 % foreach my $path ( RT::Interface::Web->ComponentRoots ) {
177 <li><% $path %></li>
178 % }
179 </ol>
180 </&>
181
182 <&|/Widgets/TitleBox, title => loc("Perl library search order") &>
183 <ol>
184 % foreach my $inc (@INC) {
185 <li><% $inc %></li>
186 % }
187 </ol>
188 </&>
189
190 </td>
191 </table>
192
193 <&|/Widgets/TitleBox, title => loc("Global Attributes") &>
194 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
195 <tr class="collection-as-table">
196 <th class="collection-as-table"><&|/l&>Name</&></th>
197 <th class="collection-as-table"><&|/l&>Value</&></th>
198 </tr>
199 % my $attrs = $RT::System->Attributes;
200 % my $index_size = 0;
201 % while ( my $attr = $attrs->Next ) {
202 <tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>">
203 % if ($attr->Name eq 'UserLogo') {
204 %   my $content = $attr->Content;
205 %   $content->{data} = defined $content->{data} ? 'DATA' : 'undef'
206 %       if exists $content->{data};
207 <td><% $attr->Name %></td><td><% stringify($content) |n %></td>
208 % } else {
209 <td><% $attr->Name %></td><td><% stringify($attr->Content) |n %></td>
210 % }
211 </tr>
212 % $index_size++;
213 % }
214 </table>
215 </&>
216
217 <&|/Widgets/TitleBox, title => loc("Loaded perl modules")&>
218 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
219 <tr class="collection-as-table">
220 <th class="collection-as-table"><&|/l&>Module</&></th>
221 <th class="collection-as-table"><&|/l&>Version</&></th>
222 <th class="collection-as-table"><&|/l&>Source</&></th>
223
224
225 <%perl>
226 my $i = 0;
227 my $report = Module::Versions::Report::report();
228 my @report = grep /v\d/, split("\n",$report);
229 shift @report; # throw away the perl version
230 my ($ver, $source, $distfile);
231 foreach my $item (@report) {
232 if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
233     $item = $1;
234     $ver = $2;
235     $distfile = $item.".pm";
236     $distfile =~ s|::|/|g;
237 }
238 </%perl>
239 <tr class="<% $i++ %2 ? 'oddline' : 'evenline'%>">
240 <td class="collection-as-table"><% $item %></td>
241     <td class="collection-as-table">
242         <%$ver%>
243     </td>
244     <td class="collection-as-table">
245         <% $INC{$distfile} || '' %>
246     </td>
247 </tr>
248 % }
249 </table>
250 </&>
251
252 <&|/Widgets/TitleBox, title => loc("Perl configuration") &>
253 % require Config;
254 <pre>
255 <% Config::myconfig() %>
256 </pre>
257 </&>
258
259 <%INIT>
260 use Data::Dumper;
261 local $Data::Dumper::Terse = 1;
262 local $Data::Dumper::Indent = 2;
263
264 sub stringify {
265     my $value = shift;
266     my $output = Dumper $value;
267     RT::Interface::Web::EscapeUTF8(\$output);
268     $output =~ s/ /&nbsp;/g;
269     $output =~ s!\n!<br />!g;
270     return $output;
271 }
272 </%INIT>