Putting 4.2.0 on top of 4.0.17
[usit-rt.git] / share / html / Search / Chart.html
CommitLineData
84fb5b46
MKG
1%# BEGIN BPS TAGGED BLOCK {{{
2%#
3%# COPYRIGHT:
4%#
403d7b0b 5%# This software is Copyright (c) 1996-2013 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<%args>
af59614d 49@GroupBy => 'Status'
84fb5b46 50$ChartStyle => 'bars'
af59614d 51@ChartFunction => ('COUNT')
84fb5b46 52$Description => undef
af59614d
MKG
53$Width => undef
54$Height => undef
84fb5b46
MKG
55</%args>
56<%init>
57$ARGS{Query} ||= 'id > 0';
58
af59614d 59my $title = loc( "Grouped search results");
84fb5b46
MKG
60
61my $saved_search = $m->comp( '/Widgets/SavedSearch:new',
62 SearchType => 'Chart',
af59614d 63 SearchFields => [qw(Query GroupBy ChartStyle ChartFunction Width Height)] );
84fb5b46
MKG
64
65my @actions = $m->comp( '/Widgets/SavedSearch:process', args => \%ARGS, self => $saved_search );
66
67my %query;
68
69{
70 if ($saved_search->{'CurrentSearch'}->{'Object'}) {
71 foreach my $search_field (@{ $saved_search->{'SearchFields'} }) {
72 $query{$search_field} = $saved_search->{'CurrentSearch'}->{'Object'}->Content->{$search_field};
73 }
74 }
75
76 my $current = $session{'CurrentSearchHash'};
77
78 my @session_fields = qw(
79 Query
80 SavedChartSearchId
81 SavedSearchDescription
82 SavedSearchLoad
83 SavedSearchLoadButton
84 SavedSearchOwner
85 );
86
87 for(@session_fields) {
dab09ea8 88 $query{$_} = $DECODED_ARGS->{$_} unless defined $query{$_};
af59614d 89 $query{$_} = $current->{$_} unless defined $query{$_};
84fb5b46
MKG
90 }
91
dab09ea8
MKG
92 if ($DECODED_ARGS->{'SavedSearchLoadSubmit'}) {
93 $query{'SavedChartSearchId'} = $DECODED_ARGS->{'SavedSearchLoad'};
84fb5b46
MKG
94 }
95
dab09ea8 96 if ($DECODED_ARGS->{'SavedSearchSave'}) {
84fb5b46
MKG
97 $query{'SavedChartSearchId'} = $saved_search->{'SearchId'};
98 }
99
100}
101
102</%init>
103<& /Elements/Header, Title => $title &>
104<& /Elements/Tabs, QueryArgs => \%query &>
105<& /Elements/ListActions, actions => \@actions &>
106<& /Search/Elements/Chart, %ARGS &>
107
108<div class="chart-meta">
109<div class="chart-type">
af59614d
MKG
110
111<form method="get" action="<% RT->Config->Get('WebPath') %>/Search/Chart.html">
84fb5b46
MKG
112<input type="hidden" class="hidden" name="Query" value="<% $ARGS{Query} %>" />
113<input type="hidden" class="hidden" name="SavedChartSearchId" value="<% $saved_search->{SearchId} || 'new' %>" />
114
af59614d
MKG
115<&| /Widgets/TitleBox, title => loc('Group by'), class => "chart-group-by" &>
116<fieldset><legend><% loc('Group tickets by') %></legend>
117<& Elements/SelectGroupBy,
118 Name => 'GroupBy',
119 Query => $ARGS{Query},
120 Default => $GroupBy[0],
121 &>
122</fieldset>
123<fieldset><legend><% loc('and then') %></legend>
124<& Elements/SelectGroupBy,
125 Name => 'GroupBy',
126 Query => $ARGS{Query},
127 Default => $GroupBy[1],
128 ShowEmpty => 1,
129 &>
130</fieldset>
131<fieldset><legend><% loc('and then') %></legend>
132<& Elements/SelectGroupBy,
133 Name => 'GroupBy',
134 Query => $ARGS{Query},
135 Default => $GroupBy[2],
136 ShowEmpty => 1,
137 &>
138</fieldset>
139</&>
140
141<&| /Widgets/TitleBox, title => loc("Calculate"), class => "chart-calculate" &>
142
143<fieldset><legend><% loc('Calculate values of') %></legend>
144<& Elements/SelectChartFunction, Default => $ChartFunction[0] &>
145</fieldset>
146<fieldset><legend><% loc('and then') %></legend>
147<& Elements/SelectChartFunction, Default => $ChartFunction[1], ShowEmpty => 1 &>
148</fieldset>
149<fieldset><legend><% loc('and then') %></legend>
150<& Elements/SelectChartFunction, Default => $ChartFunction[2], ShowEmpty => 1 &>
151</fieldset>
152
153</&>
154
155<&| /Widgets/TitleBox, title => loc('Picture'), class => "chart-picture" &>
156<label><% loc('Style') %>: <& Elements/SelectChartType, Default => $ChartStyle, Name => 'ChartStyle' &></label>
157<label><% loc("Width") %>: <input type="text" name="Width" value="<% $Width || "" %>"> <% loc("px") %></label>
158<span class="height">
159 &#x00d7;
160 <label><% loc("Height") %>: <input type="text" name="Height" value="<% $Height || "" %>"> <% loc("px") %></label>
161</span>
84fb5b46 162</&>
af59614d
MKG
163<script type="text/javascript">
164jQuery(".chart-picture [name=ChartStyle]").change(function(){
165 var t = jQuery(this);
166 t.closest("form").find("[name=Height]").closest(".height").toggle( t.val() !== "pie" );
167}).change();
168</script>
169
170<& /Elements/Submit, Label => loc('Update Chart'), Name => 'Update' &>
171</form>
172
84fb5b46
MKG
173</div>
174<div class="saved-search">
175 <& /Widgets/SavedSearch:show, %ARGS, Action => 'Chart.html', self => $saved_search, Title => loc('Saved charts') &>
176</div>
177</div>