1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
%# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2025 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%#
%# LICENSE:
%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
%#
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%# General Public License for more details.
%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
%#
%#
%# CONTRIBUTION SUBMISSION POLICY:
%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
%# you are the copyright holder for those contributions and you grant
%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => $title &>
<& /Elements/Tabs
&>
% $m->callback( %ARGS, CallbackName => 'PreForm' );
<div id="SimpleSearchForm">
<form action="Simple.html" method="get">
<div class="form-row justify-content-center mt-4 mb-4">
<div class="col-4">
<input class="form-control" type="text" name="q" />
</div>
<div class="col-auto">
<input type="submit" class="button btn btn-primary form-control" value="<&|/l&>Search</&>" />
</div>
</div>
<div class="form-row justify-content-center">
<div class="col-md-8">
<h5><&|/l&>Simple Search Help</&></h5>
<p>
<&|/l&>Ticket simple search is available above, and in the menu bar at the top of every page. This search box accepts various keywords followed by a colon to refine your search. These options are described below.</&>
</p>
<p>
% if ( $config->{'Enable'} && $config->{'Indexed'} ) {
<&|/l&>Any word not matching a keyword is searched for in the ticket transaction history.</&>
% }
% else {
<&|/l&>Any word not matching a keyword is searched for in ticket subjects.</&>
% }
</p>
</div>
</div>
<div class="form-row justify-content-center">
<div class="col-md-8">
<table class="table table-responsive" cellspacing="0">
<thead>
<tr>
<th class="col-md-2"><% loc('Ticket search field') %></th>
<th class="col-md-7"></th>
<th class="col-md-3"><% loc('Examples') %></th>
</tr>
</thead>
<tbody>
<tr>
<td class="align-top"><strong>id</strong></td>
<td class="align-top"><% loc('Enter a ticket id. Takes you directly to the ticket.') %></td>
<td class="align-top">
<p>12345</p>
<p>id:12345</p>
</td>
</tr>
<tr>
<td class="align-top"><strong>subject</strong></td>
<td class="align-top">
<p><&|/l_unsafe, '<strong>subject:</strong>' &>Enter [_1] followed by the search value.</&></p>
<p><% loc('If the search value contains spaces, enclose it in quotes.') %></p>
<p>
% unless ( $config->{'Enable'} && $config->{'Indexed'} ) {
<&|/l&>Also, any word not matching a keyword is searched for in ticket subjects.</&>
% }
</p>
</td>
<td class="align-top">
<p>subject:avacado</p>
<p>subject:"ripe avacado"</p>
</td>
</tr>
% if ( $config->{'Enable'} ) {
<tr>
<td class="align-top"><strong>history</strong></td>
<td class="align-top">
% if ( $config->{'Indexed'} ) {
<p>
<&|/l, $fulltext_keyword &>Search for any word in the ticket transaction history by typing <strong>[_1]<i>word</i></strong>.</&>
</p>
% }
% else {
<p>
<&|/l, $fulltext_keyword &>Searching the full text of every ticket can take a long time, but if you need to do it, you can search for any word in full ticket history by typing <strong>[_1]<i>word</i></strong>.</&>
</p>
% }
<p>
<&|/l, $fulltext_keyword &>Search for multiple words by enclosing the words in quotes <strong>[_1]<i>"multiple search words"</i></strong>.</&>
</p>
<p>
% if ( $config->{'Enable'} && $config->{'Indexed'} ) {
<&|/l&>Also, any word not matching a keyword is searched for in ticket history.</&>
% }
</p>
</td>
<td class="align-top">
<p>fulltext:coffee</p>
<p>fulltext:"need coffee"</p>
</td>
</tr>
% }
<tr>
<td class="align-top"><strong>queue</strong></td>
<td class="align-top">
<p><% loc('Enter a queue name.') %></p>
<p><&|/l_unsafe, '<strong>queue:</strong>' &>If the queue name contains spaces, enter [_1] followed by the queue name in quotes.</&></p>
</td>
<td class="align-top">
<p>General</p>
<p>queue:"IT Support"</p>
</td>
</tr>
<tr>
<td class="align-top"><strong>owner</strong></td>
<td class="align-top"><% loc("Enter an RT username.") %></td>
<td class="align-top">
<p>jsmith</p>
<p>owner:jsmith</p>
</td>
</tr>
<tr>
<td class="align-top"><strong>requestor</strong></td>
<td class="align-top"><% loc('Enter an email address.') %></td>
<td class="align-top">
<p>jsmith@example.com</p>
<p>requestor:jsmith@example.com</p>
</td>
</tr>
<tr>
<td class="align-top"><strong>status</strong></td>
<td class="align-top">
<p>
<&|/l_unsafe, map { "<strong>$_</strong>" } qw(initial active inactive any) &>Add [_1], [_2], [_3], or [_4] to the end of a search to limit results to tickets with matching statuses.</&>
</p>
</td>
<td class="align-top">
<p>status:any</p>
<p>subject:avacado open</p>
<p>owner:jsmith active<p>
</td>
</tr>
<tr>
<td class="align-top"><strong>custom field</strong></td>
<td class="align-top">
<p><&|/l_unsafe, '<strong>cf.Name:</strong>' &>Enter [_1] followed by the search value.</&></p>
<p><% loc('If the custom field name or the search value have spaces, enclose them in quotes.') %></p>
</td>
<td class="align-top">
<p>cf.Color:blue<p>
<p>cf."Favorite Color":"hunter green"<p>
</td>
</tr>
<tr>
<td class="align-top"><strong>email domain</strong></td>
<td class="align-top"><% loc('To search for tickets with watchers who match a domain, enter the domain, including the @ symbol.') %></td>
<td class="align-top">
<p>@example.com</p>
<p>domain:@example.com</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="form-row justify-content-center">
<div class="col-md-8">
<p>
% if (RT->Config->Get('OnlySearchActiveTicketsInSimpleSearch', $session{'CurrentUser'})) {
% my $status_str = join ', ', map { loc($_) } RT::Queue->ActiveStatusArray;
<&|/l, $status_str &>By default, tickets with active statuses ([_1]) are searched.</&>
% }
</p>
<p>
<&|/l_unsafe, '<strong>queue:<i>"Queue Name"</i> open</strong>', '<strong>queue:<i>"Queue Name"</i> active</strong>' &>To search on a specific status, add it to the end of any other search, as in [_1] or [_2]. See "status" above for examples.</&></p>
</p>
% my $link_start = '<a href="' . RT->Config->Get('WebPath') . '/Search/Build.html"><u>';
% my $link_end = '</u></a>';
<p><&|/l_unsafe, $link_start, $link_end &>For the full power of RT's searches, use the [_1]query builder[_2].</&></p>
</div>
</div>
</form>
% $m->callback( %ARGS, CallbackName => 'PostForm' );
</div>
<%INIT>
my $title = loc("Search for tickets");
use RT::Search::Simple;
my $config = RT->Config->Get('FullTextSearch') || {};
my $fulltext_keyword = 'fulltext:';
if ($q) {
my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
$m->callback( %ARGS, query => \$q, CallbackName => 'ModifyQuery' );
if ($q =~ /^#?(\d+)$/) {
RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Ticket/Display.html?id=".$1);
}
my %args = (
Argument => $q,
TicketsObj => $tickets,
);
$m->callback( %ARGS, CallbackName => 'SearchArgs', args => \%args);
my $search = RT::Search::Simple->new(%args);
my $query = $m->comp('/Elements/QueryString', %ARGS, Query => $search->QueryToSQL() );
my $result_path = RT->Config->Get('WebURL') . "Search/Results.html?$query";
RT::Interface::Web::Redirect( $result_path );
$m->abort();
}
</%INIT>
<%ARGS>
$q => undef
</%ARGS>
|