rt 4.2.15
[freeside.git] / rt / share / html / Articles / Article / Elements / ShowSearchCriteria
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2018 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 % if ($ARGS{'HideOptions'}) {
49 <& /Widgets/TitleBoxStart, title => loc('Advanced search'), class => "rolled-up", bodyclass => "hidden" &>
50 % } else {
51 <& /Widgets/TitleBoxStart, title => loc('Advanced search') &>
52 % }
53 <table>
54 <tr>
55 <td class="label" colspan="2"><h2><&|/l&>Basics</&></h2></td>
56 </tr>
57 <tr>
58 <td class="label"><&|/l&>Class</&></td><td class="value">is <& /Articles/Elements/SelectClass, Name => 'Class', Multiple =>1, Size => 5 , ShowNullOption => undef,  Default => $ARGS{'Class'} &> 
59 <&|/l&>and not</&>
60 <& /Articles/Elements/SelectClass, Name => 'Class!', Multiple =>1, Size => 5 , ShowNullOption => undef, Default => $ARGS{'Class!'} &></td>
61 </tr>
62 <tr>
63 <td class="label"><&|/l&>Name</&></td>
64 <td class="value"><&|/l&>matches</&> <input name="Name~" value="<%$ARGS{'Name~'}%>" /> <&|/l&>and not</&> <input name="Name!~" value="<%$ARGS{'Name!~'}%>" /></td>
65 </tr>
66 <tr>
67 <td class="label"><&|/l&>Summary</&></td>
68 <td class="value"><&|/l&>matches</&> <input name="Summary~" value="<%$ARGS{'Summary~'}%>" /> <&|/l&>and not</&> <input name="Summary!~" value="<%$ARGS{'Summary!~'}%>" /></td>
69 </tr>
70 <tr>
71 <td class="label" colspan="2"><h2><&|/l&>Content</&></h2></td>
72 </tr>
73 <tr>
74 <td class="label"><&|/l&>Any field</&></td><td class="value"> <&|/l&>matches</&> <input name="Article~" value="<%$ARGS{'Article~'}%>" /> <&|/l&>and not</&> <input name="Article!~" value="<%$ARGS{'Article!~'}%>" /></td>
75 </tr>
76 % while (my $field = $customfields->Next ) {
77 <tr>
78 <td class="label"><% $field->Name %></td>
79 <td class="value"><&|/l&>matches</&> 
80 % my $matches = $field->Name."~";
81 % my $nomatches = $field->Name."!~";
82 <& /Articles/Article/Elements/SearchByCustomField, 
83     Field => $field, 
84     Name => $matches,
85     Values => $ARGS{$matches} &>
86     <&|/l&>and not</&>
87 <& /Articles/Article/Elements/SearchByCustomField, 
88     Field => $field, 
89     Name => $nomatches,
90     Values => $ARGS{$nomatches}
91     &>
92 </td>
93 </tr>
94 % }
95 <tr>
96 <td class="label" colspan="2"><h2><&|/l&>Dates</&></h2></td>
97 </tr>
98 <tr>
99 <td class="label"><&|/l&>Created</&></td>
100 <td class="value"><&|/l&>after</&>
101 <& /Elements/SelectDate, Name=>"Created>", Default => ($dates->{'Created>'} ? $dates->{'Created>'}->ISO : '') &>
102 <&|/l&>and before</&>
103 <& /Elements/SelectDate, Name=>"Created<", Default => ($dates->{'Created<'} ? $dates->{'Created<'}->ISO:'')&>
104 </td>
105 </tr>
106 <tr>
107 <td class="label"><&|/l&>Last updated</&></td>
108 <td class="value"><&|/l&>after</&>
109 <& /Elements/SelectDate, Name=>"LastUpdated>", Default =>
110 ($dates->{'LastUpdated>'} ? $dates->{'LastUpdated>'}->AsString:'')&>
111 <&|/l&>and before</&>
112 <& /Elements/SelectDate, Name=>"LastUpdated<", Default => 
113 ($dates->{'LastUpdated<'} ? $dates->{'LastUpdated<'}->AsString:'')&>
114 </td>
115 </tr>
116 <tr>
117 <td class="label" colspan="2"><h2><&|/l&>Links</&></h2></td>
118 </tr>
119 <tr>
120 <td class="label"></td>
121 <td><& LinkEntryInstructions &></td>
122 </tr>
123 <tr>
124 <td class="label"><&|/l&>Refer to</&></td>
125 <td class="value"><input type=text size=50 name="RefersTo" value="<%$RefersTo%>" /></td>
126 </tr>
127 <tr>
128 <td class="label"><&|/l&>Referred to by</&></td>
129 <td class="value"><input type=text size=50 name="ReferredToBy" value="<%$ReferredToBy%>" /></td>
130 </tr>
131 <tr>
132 <td class="label" colspan="2"><h2><&|/l&>Topics</&></h2></td>
133 </tr>
134 <tr>
135 <td class="label"></td>
136 <td>
137 <& /Articles/Article/Elements/EditTopics, %ARGS, Classes => \@Classes, OnlyThisClass => 1 &>
138 <br />
139 <input type="checkbox" id="ExpandTopics" name="ExpandTopics" <% $ARGS{'ExpandTopics'} ? 'checked="checked"' : "" %> />
140 <label for="ExpandTopics"><&|/l&>Include subtopics</&></label>
141 </td>
142 </tr>
143 </table>
144 <& /Elements/Submit, Label => loc('Search') &>
145 <& /Widgets/TitleBoxEnd &>
146 <%init>
147 my @Classes =
148  ( ref $ARGS{'Class'} eq 'ARRAY' )
149       ? @{ $ARGS{'Class'} }
150       : ( $ARGS{'Class'} );
151 for (@Classes) {
152   my $class = RT::Class->new( $session{'CurrentUser'} );
153   $class->LoadById($_);
154   $_ = $class;
155 }
156
157 for my $field ( qw/Class Name Summary Article/ ) {
158     $ARGS{"$field~"} = '' unless defined $ARGS{"$field~"};
159     $ARGS{"$field!~"} = '' unless defined $ARGS{"$field!~"};
160 }
161 $RefersTo = '' unless defined $RefersTo;
162 $ReferredToBy = '' unless defined $ReferredToBy;
163
164 </%init>
165
166 <%ARGS>
167 $dates =>undef
168 $RefersTo => ''
169 $ReferredToBy => ''
170 $customfields => undef
171 </%ARGS>