rt 4.0.23
[freeside.git] / rt / share / html / Ticket / Graphs / Elements / EditGraphProperties
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 <&| /Widgets/TitleBox, title => loc('Graph Properties') &>
49
50 <% loc('Direction') %> <select name="Direction">
51 <option value="TB" <% ($Direction||'TB') eq 'TB'? 'selected="selected"': '' |n %>><% loc('top to bottom') %></option>
52 <option value="LR" <% ($Direction||'TB') eq 'LR'? 'selected="selected"': '' |n %>><% loc('left to right') %></option>
53 %# XXX: not supported by GraphViz perl module
54 %#<option value="BT" <% ($Direction||'TB') eq 'BT'? 'selected="selected"': '' |n %>><% loc('bottom to top') %></option>
55 %#<option value="RL" <% ($Direction||'TB') eq 'RL'? 'selected="selected"': '' |n %>><% loc('right to left') %></option>
56 </select><br />
57
58 <% loc('Main type of links') %> <select name="LeadingLink">
59 % foreach ( @link_types ) {
60 <option value="<% $_ %>" <% ($LeadingLink||'Members') eq $_? 'selected="selected"': '' |n %>><% loc($_) %></option>
61 % }
62 </select>
63
64 <% loc('maximum depth') %> <select name="MaxDepth">
65 <option value="0"><% loc('Unlimit') %></option>
66 % foreach ( 1..6 ) {
67 <option value="<% $_ %>" <% ($MaxDepth||0) == $_? 'selected="selected"': '' %>><% $_ %></option>
68 % }
69 </select><br />
70
71 <% loc('Show as well') %>:
72 % foreach my $type ( @link_types ) {
73 % my $checked = '';
74 % $checked = 'checked="checked"' if grep $type eq $_, @ShowLinks;
75 <input type="checkbox" name="ShowLinks" value="<% $type %>" <% $checked |n %> /><% loc($type) %>
76 % }
77 <br />
78
79 % my @properties = RT::Graph::Tickets->TicketProperties( $session{'CurrentUser'} );
80
81 <% loc('Fill boxes with color using') %>:
82 <select name="FillUsing">
83 <option value=""><% loc('nothing') %></option>
84 <%PERL>
85 my @tmp = @properties;
86 while ( my ($group, $list) = (splice @tmp, 0, 2) ) {
87     # coloring by links and dates sounds stupid
88     next if $group eq 'Dates' || $group eq 'Links';
89
90     foreach my $prop ( @$list ) {
91         my $selected = '';
92         $selected = 'selected="selected"' if $prop eq ($FillUsing||'');
93 </%PERL>
94 <option value="<% $prop %>" <% $selected |n %>><% loc($prop) %></option>
95 % } }
96 </select><br />
97
98 % if ( RT::Link->can('Description' ) ) {
99 % my $checked = '';
100 % $checked = 'checked="checked"' if $ShowLinkDescriptions;
101 <% loc('Show link descriptions') %>:
102 <input type="checkbox" name="ShowLinkDescriptions" value="1" <% $checked |n %> />
103 <br />
104 % }
105
106 <%PERL>
107 for my $i ( 1..($MaxDepth||6) ) {
108     my @default;
109     if ( my $tmp = $ARGS{ 'Level-'. $i .'-Properties' } ) {
110         @default = ref $tmp? @$tmp : ($tmp);
111     }
112
113     $m->comp('SELF:Properties',
114         Level => $i,
115         Available => \@properties,
116         Default => \@default,
117     );
118 }
119 </%PERL>
120
121 <& /Elements/Submit, Label => loc('Update Graph'), Name => 'Update' &>
122
123 </&>
124
125 <%ARGS>
126 $id => undef
127 $Direction => 'TB'
128 $LeadingLink => 'Members'
129 @ShowLinks => ('MemberOf', 'DependsOn', 'RefersTo')
130 $MaxDepth => 3
131 $FillUsing => ''
132 $ShowLinkDescriptions => 0
133 </%ARGS>
134 <%INIT>
135 require RT::Graph::Tickets;
136 require RT::Link;
137
138 my @link_types = qw(Members MemberOf RefersTo ReferredToBy DependsOn DependedOnBy); #loc_qw
139 @ShowLinks = grep $_ ne $LeadingLink, @ShowLinks;
140 </%INIT>
141
142 <%METHOD Properties>
143 <%ARGS>
144 @Available => ()
145 @Default   => ()
146 $Level     => 1,
147 </%ARGS>
148 <%INIT>
149 my $id = "graph-properties-box-$Level";
150 my $class = '';
151 $class = 'class="hidden"' if $Level != 1 && !@Default;
152 </%INIT>
153 <% loc('Show Tickets Properties on [_1] level', $Level) %>
154 (<small><a href="#" onclick="hideshow(<% $id |n,j%>); return false;"><% loc('open/close') %></a></small>):
155 <table id="<% $id %>" <% $class |n %>>
156 % while ( my ($group, $list) = (splice @Available, 0, 2) ) {
157 <tr><td><% loc($group) %>:</td><td>
158 % foreach my $prop ( @$list ) {
159 % my $checked = '';
160 % $checked = 'checked="checked"' if grep $_ eq $prop, @Default;
161 <input type="checkbox" class="checkbox" name="Level-<% $Level %>-Properties" value="<% $prop %>" <% $checked |n %> /><% loc($prop) %>
162 % }
163 </td></tr>
164 % }
165 </table>
166 <br />
167 </%METHOD>