import rt 3.8.8
[freeside.git] / rt / html / Search / Elements / DisplayOptions
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
6 %#                                          <jesse@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("Display Columns") &>
49 <table width="100%">
50 <tr>
51 <td>
52 <& EditFormat, %ARGS &>
53 </td>
54 <td valign="top">
55 <table valign="top">
56
57 % for my $o (0..3) {
58 <tr>
59 <td class="label">
60 % if ($o == 0) {
61 <&|/l&>Order by</&>:
62 % }
63 </td>
64 <td class="value">
65 <select name="OrderBy">
66 % if ($o > 0) {
67 <option value=""><&|/l&>~[none~]</&></option>
68 % }
69 % foreach my $field (sort keys %fields) {
70 %    next unless $field;
71 <option value="<%$field%>"
72 % if (defined $OrderBy[$o] and $field eq $OrderBy[$o]) {
73 selected
74 % }
75 ><&|/l&><%$field%></&></option>
76 % }
77 </select>
78 <select name="Order">
79 <option value="ASC"
80 % unless ( ($Order[$o]||'') eq "DESC" ) {
81 selected
82 % }
83 ><&|/l&>Asc</&></option>
84 <option value="DESC"
85 % if ( ($Order[$o]||'') eq "DESC" ) {
86 selected
87 % }
88 ><&|/l&>Desc</&></option>
89 </select>
90 </td>
91 </tr>
92 % }
93 <tr>
94 <td class="label">
95 <&|/l&>Rows per page</&>:
96 </td><td class="value">
97 <& /Elements/SelectResultsPerPage, 
98     Name => "RowsPerPage", 
99     Default => $RowsPerPage &>
100 </td>
101 </tr>
102 </table>
103 </td>
104 </tr>
105 </table>
106 </&>
107
108 <%INIT>
109 my $tickets = new RT::Tickets($session{'CurrentUser'});
110 my %fields = %{$tickets->FIELDS};
111 map { $fields{$_}->[0] =~ /^(?:ENUM|INT|DATE|STRING)$/ || delete $fields{$_} } keys %fields;
112 delete $fields{'EffectiveId'};
113 $fields{'Owner'} = 1;
114 $fields{ $_ . '.EmailAddress' } = 1 foreach( qw(Requestor Cc AdminCc) );
115
116 # Add all available CustomFields to the list of sortable columns.
117 my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}};
118 $fields{$_}=1 for @cfs;
119
120 # Add PAW sort
121 $fields{'Custom.Ownership'} = 1;
122
123 my @Order;
124 my @OrderBy;
125 if ($OrderBy =~ /\|/) {
126     @OrderBy = split /\|/, $OrderBy;
127 } else {
128     @OrderBy = ( $OrderBy );
129 }
130 if ($Order =~ /\|/) {
131     @Order = split /\|/, $Order;
132 } else {
133     @Order = ( $Order );
134 }
135
136 </%INIT>
137
138 <%ARGS>
139 $Order => undef
140 $OrderBy => undef
141 $RowsPerPage => undef
142 $Format => undef
143 $GroupBy => 'id'
144 </%ARGS>