diff options
Diffstat (limited to 'rt/share/html/Search/Elements')
25 files changed, 335 insertions, 200 deletions
diff --git a/rt/share/html/Search/Elements/Article b/rt/share/html/Search/Elements/Article new file mode 100644 index 000000000..46c13d79e --- /dev/null +++ b/rt/share/html/Search/Elements/Article @@ -0,0 +1,64 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2012 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/CollectionList, %ARGS, + Collection => $articles, + Class => 'RT::Articles', + Format => q{ + '<a href="/Articles/Article/Display.html?id=__id__">__id__</a>/TITLE:#', + '<a href="/Articles/Article/Display.html?id=__id__">__Name__</a>/TITLE:Name', + '__ClassName__', + '__CreatedRelative__', + '__LastUpdatedRelative__', + '__Summary__', + '__Topics__', } + &> +<%INIT> +my $QueryString = "?".$m->comp('/Elements/QueryString', %{$ARGS{args}}); +my $articles = RT::Articles->new( $session{CurrentUser} ); +$articles->Search( %{$ARGS{args}} ); +</%INIT> diff --git a/rt/share/html/Search/Elements/BuildFormatString b/rt/share/html/Search/Elements/BuildFormatString index 57c767911..a39287bff 100644 --- a/rt/share/html/Search/Elements/BuildFormatString +++ b/rt/share/html/Search/Elements/BuildFormatString @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -48,7 +48,7 @@ <%ARGS> $Format => RT->Config->Get('DefaultSearchResultFormat') -%cfqueues => () +%queues => () $Face => undef $Size => undef @@ -104,23 +104,18 @@ my @fields = ( Bookmark NEWLINE + NBSP ) ); # loc_qw $m->callback( CallbackOnce => 1, CallbackName => 'SetFieldsOnce', Fields => \@fields ); my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); -foreach my $id (keys %cfqueues) { +foreach my $id (keys %queues) { # Gotta load up the $queue object, since queues get stored by name now. my $id my $queue = RT::Queue->new($session{'CurrentUser'}); $queue->Load($id); - unless ($queue->id) { - # XXX TODO: This ancient code dates from a former developer - # we have no idea what it means or why cfqueues are so encoded. - $id =~ s/^.'*(.*).'*$/$1/; - $queue->Load($id); - } - $CustomFields->LimitToQueue($queue->Id); + $CustomFields->LimitToQueue($queue->Id) if $queue->Id; } $CustomFields->LimitToGlobal; diff --git a/rt/share/html/Search/Elements/Chart b/rt/share/html/Search/Elements/Chart index e25a9efd0..be05da315 100644 --- a/rt/share/html/Search/Elements/Chart +++ b/rt/share/html/Search/Elements/Chart @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -48,7 +48,6 @@ <%args> $Query => "id > 0" $PrimaryGroupBy => 'Queue' -$SecondaryGroupBy => undef $ChartStyle => 'bars' </%args> <%init> @@ -89,65 +88,66 @@ my %loc_keys; foreach my $key (@keys) { $data{$key} = shift @values; $loc_keys{$key} = loc($key); } my @sorted_keys = map { $loc_keys{$_}} sort { $loc_keys{$a} cmp $loc_keys{$b} } keys %loc_keys; my @sorted_values = map { $data{$_}} sort { $loc_keys{$a} cmp $loc_keys{$b} } keys %loc_keys; - - my $query_string = $m->comp('/Elements/QueryString', %ARGS); -</%init> - -<% loc('Query:') %> <% $Query %><br /> +my ($i,$total); +</%init> +<div class="chart-wrapper"> +<span class="chart image"> % if (RT->Config->Get('DisableGD')) { <% loc('Graphical charts are not available.') %><br /> % } else { -<img src="<%RT->Config->Get('WebPath')%>/Search/Chart?<%$query_string|n%>" /><br /> +<img src="<%RT->Config->Get('WebPath')%>/Search/Chart?<%$query_string|n%>" /> % } - -<table class="collection-as-table"> +</span> +<table class="collection-as-table chart"> <tr> <th class="collection-as-table"><% loc($tix->Label($PrimaryGroupBy)) %> </th> <th class="collection-as-table"><&|/l&>Tickets</&> </th> </tr> -% my ($i,$total); -% while (my $key = shift @sorted_keys) { -% $i++; -% my $value = shift @sorted_values; -% $total += $value; -<tr class="<%$i%2 ? 'evenline' : 'oddline' %>"> +<%perl> + while (my $key = shift @sorted_keys) { + $i++; + my $value = shift @sorted_values; + $total += $value; +</%perl> +<tr class="<% $i%2 ? 'evenline' : 'oddline' %>"> +<%perl> +# TODO sadly we don't have "creator.city is null" or alike support yet +# so no link if the key is undef for now + if ( $PrimaryGroupBy !~ /(Hourly|Daily|Monthly|Annually)$/ + && $key ne loc('(no value)') ) { + my $group = $PrimaryGroupBy; $group =~ s! !.!; + my %orig_keys = reverse %loc_keys; + my $QueryString = $m->comp('/Elements/QueryString', + Query => "$Query and $group = '$orig_keys{$key}'", + Format => $ARGS{Format}, + Rows => $ARGS{Rows}, + OrderBy => $ARGS{OrderBy}, + Order => $ARGS{Order}, + ); +</%perl> <td class="label collection-as-table"> -%# TODO sadly we don't have "creator.city is null" or alike support yet -%# so no link if the key is undef for now -% if ( $PrimaryGroupBy !~ /(Hourly|Daily|Monthly|Annually)$/ -% && $key ne loc('(no value)') ) { -% my $group = $PrimaryGroupBy; $group =~ s! !.!; -% my %orig_keys = reverse %loc_keys; -% my $QueryString = $m->comp('/Elements/QueryString', -% Query => "$Query and $group = '$orig_keys{$key}'", -% Format => $ARGS{Format}, -% Rows => $ARGS{Rows}, -% OrderBy => $ARGS{OrderBy}, -% Order => $ARGS{Order}, -% ); -<a href=<% RT->Config->Get('WebURL') %>Search/Results.html?<%$QueryString%>><%$key%></a> -% } else { -<% $key %> -% } +<a href=<% RT->Config->Get('WebPath') %>/Search/Results.html?<%$QueryString%>><%$key%></a> </td> <td class="value collection-as-table"> -<%$value%> +<a href=<% RT->Config->Get('WebPath') %>/Search/Results.html?<%$QueryString%>><%$value%></a> </td> +% } else { +<td class="label collection-as-table"><% $key %></td> +<td class="value collection-as-table"><% $value %></td> +% } </tr> % } %$i++; -<tr class="<%$i%2 ? 'evenline' : 'oddline' %>"> -<td class="label collection-as-table"> -<%loc('Total')%> -</td> -<td class="value collection-as-table"> -<%$total||''%> -</td> +<tr class="<%$i%2 ? 'evenline' : 'oddline' %> total"> +<td class="label collection-as-table"><%loc('Total')%></td> +<td class="value collection-as-table"><%$total||'0'%></td> </tr> </table> +<div class="query"><span class="label"><% loc('Query') %>:</span><span class="value"><% $Query %></span></div> +</div> diff --git a/rt/share/html/Search/Elements/ConditionRow b/rt/share/html/Search/Elements/ConditionRow index 65e217639..9d68b0925 100644 --- a/rt/share/html/Search/Elements/ConditionRow +++ b/rt/share/html/Search/Elements/ConditionRow @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/DisplayOptions b/rt/share/html/Search/Elements/DisplayOptions index c83035884..fbd497eb8 100644 --- a/rt/share/html/Search/Elements/DisplayOptions +++ b/rt/share/html/Search/Elements/DisplayOptions @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,91 +46,8 @@ %# %# END BPS TAGGED BLOCK }}} <&| /Widgets/TitleBox, title => loc("Sorting"), id => 'sorting' &> -<table valign="top"> - -% for my $o (0..3) { -% $Order[$o] ||= ''; $OrderBy[$o] ||= ''; -<tr> -<td class="label"> -% if ($o == 0) { -<&|/l&>Order by</&>: -% } -</td> -<td class="value"> -<select name="OrderBy"> -% if ($o > 0) { -<option value=""><&|/l&>~[none~]</&></option> -% } -% foreach my $field (sort keys %fields) { -% next unless $field; -<option value="<%$field%>" -% if (defined $OrderBy[$o] and $field eq $OrderBy[$o]) { -selected="selected" -% } -><% loc($field) %></option> -% } -</select> -<select name="Order"> -<option value="ASC" -% unless ( ($Order[$o]||'') eq "DESC" ) { -selected="selected" -% } -><&|/l&>Asc</&></option> -<option value="DESC" -% if ( ($Order[$o]||'') eq "DESC" ) { -selected="selected" -% } -><&|/l&>Desc</&></option> -</select> -</td> -</tr> -% } -<tr> -<td class="label"> -<&|/l&>Rows per page</&>: -</td><td class="value"> -<& /Elements/SelectResultsPerPage, - Name => "RowsPerPage", - Default => $RowsPerPage &> -</td> -</tr> -</table> +<& EditSort, %ARGS &> </&> <&| /Widgets/TitleBox, title => loc("Display Columns"), id => 'columns' &> <& EditFormat, %ARGS &> </&> - -<%INIT> -my $tickets = new RT::Tickets($session{'CurrentUser'}); -my %fields = %{$tickets->FIELDS}; -map { $fields{$_}->[0] =~ /^(?:ENUM|INT|DATE|STRING|ID)$/ || delete $fields{$_} } keys %fields; -delete $fields{'EffectiveId'}; -$fields{'Owner'} = 1; -$fields{ $_ . '.EmailAddress' } = 1 foreach( qw(Requestor Cc AdminCc) ); - -# Add all available CustomFields to the list of sortable columns. -my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}}; -$fields{$_}=1 for @cfs; - -# Add PAW sort -$fields{'Custom.Ownership'} = 1; - -$fields{"Customer.$_"} = 1 foreach qw( Number Name ); #Freeside - -my @Order = split /\|/, $Order; -my @OrderBy = split /\|/, $OrderBy; -if ($Order =~ /\|/) { - @Order = split /\|/, $Order; -} else { - @Order = ( $Order ); -} - -</%INIT> - -<%ARGS> -$Order => undef -$OrderBy => undef -$RowsPerPage => undef -$Format => undef -$GroupBy => 'id' -</%ARGS> diff --git a/rt/share/html/Search/Elements/EditFormat b/rt/share/html/Search/Elements/EditFormat index bb869fe66..3eb5a9100 100644 --- a/rt/share/html/Search/Elements/EditFormat +++ b/rt/share/html/Search/Elements/EditFormat @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,7 +45,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<table> +<table class="edit-columns"> <tr> <th><&|/l&>Add Columns</&>:</th> @@ -62,8 +62,10 @@ <option value="<% $field %>"><% loc($field) %></option> % } </select></td> - -<td><&|/l&>Link</&>: +<td> +<div class="row"> +<span class="label"><&|/l&>Link</&>:</span> +<span class="value"> <select name="Link"> <option value="None">-</option> <option value="Display"><&|/l&>Display</&></option> @@ -72,19 +74,30 @@ <option value="Comment"><&|/l&>Comment</&></option> <option value="Resolve"><&|/l&>Resolve</&></option> </select> -<br /><&|/l&>Title</&>: <input name="Title" size="10" /> -<br /><&|/l&>Size</&>: -<select name="Size"> +</span> +</div> +<div class="row"> +<span class="label"><&|/l&>Title</&>:</span> +<span class="value"><input name="Title" size="10" /></span> +</div> +<div class="row"> +<span class="label"><&|/l&>Size</&>:</span> +<span class="value"><select name="Size"> <option value="">-</option> <option value="Small"><&|/l&>Small</&></option> <option value="Large"><&|/l&>Large</&></option> </select> -<br /><&|/l&>Style</&>: -<select name="Face"> +</span> +</div> +<div class="row"> +<span class="label"><&|/l&>Style</&>:</span> +<span class="value"><select name="Face"> <option value="">-</option> <option value="Bold"><&|/l&>Bold</&></option> <option value="Italic"><&|/l&>Italic</&></option> </select> +</span> +</div> </td> <td><input type="submit" class="button" name="AddCol" value=" → " /></td> diff --git a/rt/share/html/Search/Elements/EditQuery b/rt/share/html/Search/Elements/EditQuery index e6f649ea8..cfa8e0d1b 100644 --- a/rt/share/html/Search/Elements/EditQuery +++ b/rt/share/html/Search/Elements/EditQuery @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/EditSearches b/rt/share/html/Search/Elements/EditSearches index 08f84c70c..64309cb00 100644 --- a/rt/share/html/Search/Elements/EditSearches +++ b/rt/share/html/Search/Elements/EditSearches @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,14 +45,15 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} +<div class="edit-saved-searches"> <&| /Widgets/TitleBox, title => loc($Title)&> %# Hide all the save functionality if the user shouldn't see it. % if ( $can_modify ) { -<&|/l&>Privacy:</&> +<span class="label"><&|/l&>Privacy</&>:</span> <& SelectSearchObject, Name => 'SavedSearchOwner', Objects => \@Objects, Object => ( $Object && $Object->id ) ? $Object->Object : '' &> <br /> -<&|/l&>Description</&>: +<span class="label"><&|/l&>Description</&>:</span> <input size="25" name="SavedSearchDescription" value="<% $Description || '' %>" /> % if ($Id ne 'new') { @@ -67,19 +68,19 @@ </nobr> % } % if ( $Object && $Object->Id ) { -<input type="submit" class="button" name="SavedSearchSave" value="<%loc('Update')%>" /> +<input type="submit" class="button" id="SavedSearchSave" name="SavedSearchSave" value="<%loc('Update')%>" /> % } else { -<input type="submit" class="button" name="SavedSearchSave" value="<%loc('Save')%>" /> +<input type="submit" class="button" id="SavedSearchSave" name="SavedSearchSave" value="<%loc('Save')%>" /> %} % } <br /> <hr /> -<&|/l&>Load saved search:</&> +<span class="label"><&|/l&>Load saved search</&>:</span> <& SelectSearchesForObjects, Name => 'SavedSearchLoad', Objects => \@Objects, SearchType => $Type &> -<input type="submit" value="<% loc('Load') %>" class="button" /> +<input type="submit" value="<% loc('Load') %>" id="SavedSearchLoadSubmit" name="SavedSearchLoadSubmit" class="button" /> </&> - +</div> <%INIT> return unless $session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch', @@ -91,8 +92,8 @@ my $can_modify = $session{'CurrentUser'}->HasRight( Object => $RT::System, ); -use RT::SavedSearches; -my @Objects = RT::SavedSearches->new($session{CurrentUser})->_PrivacyObjects; +use RT::SavedSearch; +my @Objects = RT::SavedSearch->new($session{CurrentUser})->_PrivacyObjects; push @Objects, RT::System->new( $session{'CurrentUser'} ) if $session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser' ); diff --git a/rt/share/html/Search/Elements/EditSort b/rt/share/html/Search/Elements/EditSort new file mode 100644 index 000000000..497611e13 --- /dev/null +++ b/rt/share/html/Search/Elements/EditSort @@ -0,0 +1,142 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2012 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 }}} +<table valign="top"> + +% for my $o (0..3) { +% $Order[$o] ||= ''; $OrderBy[$o] ||= ''; +<tr> +<td class="label"> +% if ($o == 0) { +<&|/l&>Order by</&>: +% } +</td> +<td class="value"> +<select name="OrderBy"> +% if ($o > 0) { +<option value=""><&|/l&>~[none~]</&></option> +% } +% # %fields maps display name to SQL column/function +% foreach my $field (sort keys %fields) { +% next unless $field; +% my $fieldval = $fields{$field}; +<option value="<%$fieldval%>" +% if (defined $OrderBy[$o] and $fieldval eq $OrderBy[$o]) { +selected="selected" +% } +><% loc($field) %></option> +% } +</select> +<select name="Order"> +<option value="ASC" +% unless ( ($Order[$o]||'') eq "DESC" ) { +selected="selected" +% } +><&|/l&>Asc</&></option> +<option value="DESC" +% if ( ($Order[$o]||'') eq "DESC" ) { +selected="selected" +% } +><&|/l&>Desc</&></option> +</select> +</td> +</tr> +% } +<tr> +<td class="label"> +<&|/l&>Rows per page</&>: +</td><td class="value"> +<& /Elements/SelectResultsPerPage, + Name => "RowsPerPage", + Default => $RowsPerPage &> +</td> +</tr> +</table> + +<%INIT> +my $tickets = RT::Tickets->new($session{'CurrentUser'}); +my %FieldDescriptions = %{$tickets->FIELDS}; +my %fields; + +for my $field (keys %FieldDescriptions) { + next if $field eq 'EffectiveId'; + next unless $FieldDescriptions{$field}->[0] =~ /^(?:ENUM|INT|DATE|STRING|ID)$/; + $fields{$field} = $field; +} + +$fields{'Owner'} = 'Owner'; +$fields{ $_ . '.EmailAddress' } = $_ . '.EmailAddress' + for qw(Requestor Cc AdminCc); + +# Add all available CustomFields to the list of sortable columns. +my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}}; +$fields{$_} = $_ for @cfs; + +# Add PAW sort +$fields{'Custom.Ownership'} = 'Custom.Ownership'; + +$fields{"Customer.$_"} = 1 foreach qw( Number Name ); #Freeside + +$m->callback(CallbackName => 'MassageSortFields', Fields => \%fields ); + +my @Order = split /\|/, $Order; +my @OrderBy = split /\|/, $OrderBy; +if ($Order =~ /\|/) { + @Order = split /\|/, $Order; +} else { + @Order = ( $Order ); +} + +</%INIT> + +<%ARGS> +$Order => '' +$OrderBy => '' +$RowsPerPage => undef +$Format => undef +$GroupBy => 'id' +</%ARGS> diff --git a/rt/share/html/Search/Elements/Graph b/rt/share/html/Search/Elements/Graph index 1cf1f1baa..ba2f4dbb8 100644 --- a/rt/share/html/Search/Elements/Graph +++ b/rt/share/html/Search/Elements/Graph @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/NewListActions b/rt/share/html/Search/Elements/NewListActions index 8c7846a19..db185da3b 100644 --- a/rt/share/html/Search/Elements/NewListActions +++ b/rt/share/html/Search/Elements/NewListActions @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/PickBasics b/rt/share/html/Search/Elements/PickBasics index e9534237b..db7d9f5c1 100644 --- a/rt/share/html/Search/Elements/PickBasics +++ b/rt/share/html/Search/Elements/PickBasics @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -103,7 +103,7 @@ my @lines = ( Value => { Type => 'component', Path => '/Elements/SelectStatus', - Arguments => { SkipDeleted => 1 }, + Arguments => { SkipDeleted => 1, Queues => \%queues }, }, }, { @@ -124,7 +124,7 @@ my @lines = ( Value => { Type => 'component', Path => '/Elements/SelectOwner', - Arguments => { ValueAttribute => 'Name' }, + Arguments => { ValueAttribute => 'Name', Queues => \%queues }, }, }, { @@ -214,3 +214,6 @@ my @lines = ( $m->callback( Conditions => \@lines ); </%INIT> +<%ARGS> +%queues => () +</%ARGS> diff --git a/rt/share/html/Search/Elements/PickCFs b/rt/share/html/Search/Elements/PickCFs index 9abab4443..f2dc21f68 100644 --- a/rt/share/html/Search/Elements/PickCFs +++ b/rt/share/html/Search/Elements/PickCFs @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -50,21 +50,11 @@ % } <%INIT> my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); -foreach my $id (keys %cfqueues) { - # Gotta load up the $queue object, since queues get stored by name now. my $id +foreach my $id (keys %queues) { + # Gotta load up the $queue object, since queues get stored by name now. my $queue = RT::Queue->new($session{'CurrentUser'}); $queue->Load($id); - unless ($queue->id) { - # XXX TODO: This ancient code dates from a former developer - # we have no idea what it means or why cfqueues are so encoded. - $id =~ s/^.'*(.*).'*$/$1/; - - # unescape internal quotes - $id =~ s/(\\(.))/$2 eq "'" ? "'" : $1/eg; - - $queue->Load($id); - } - $CustomFields->LimitToQueue($queue->Id); + $CustomFields->LimitToQueue($queue->Id) if $queue->Id; } $CustomFields->LimitToGlobal; $m->callback( @@ -80,12 +70,19 @@ while ( my $CustomField = $CustomFields->Next ) { $line{'Field'} = $CustomField->Name; # Op - if ($CustomField->Type eq 'Date') { + if ($CustomField->Type =~ /^Date(Time)?$/ ) { $line{'Op'} = { Type => 'component', Path => '/Elements/SelectDateRelation', Arguments => {}, }; + } + elsif ($CustomField->Type =~ /^IPAddress(Range)?$/ ) { + $line{'Op'} = { + Type => 'component', + Path => '/Elements/SelectIPRelation', + Arguments => {}, + }; } else { $line{'Op'} = { Type => 'component', @@ -99,11 +96,12 @@ while ( my $CustomField = $CustomFields->Next ) { } # Value - if ($CustomField->Type eq 'Date') { + if ($CustomField->Type =~ /^Date(Time)?$/) { + my $is_datetime = $1 ? 1 : 0; $line{'Value'} = { Type => 'component', Path => '/Elements/SelectDate', - Arguments => {}, + Arguments => { $is_datetime ? (ShowTime => 1) : (ShowTime => 0), }, }; } else { $line{'Value'} = { @@ -116,10 +114,10 @@ while ( my $CustomField = $CustomFields->Next ) { push @lines, \%line; } -$m->callback( Conditions => \@lines, Queues => \%cfqueues ); +$m->callback( Conditions => \@lines, Queues => \%queues ); </%INIT> <%ARGS> -%cfqueues => undef +%queues => () </%ARGS> diff --git a/rt/share/html/Search/Elements/PickCriteria b/rt/share/html/Search/Elements/PickCriteria index 5eb112d17..74547c7da 100644 --- a/rt/share/html/Search/Elements/PickCriteria +++ b/rt/share/html/Search/Elements/PickCriteria @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -53,7 +53,7 @@ <& PickBasics &> <& PickCustomerFields &> -<& PickCFs, cfqueues => \%cfqueues &> +<& PickCFs, queues => \%queues &> <tr class="separator"><td colspan="3"><hr /></td></tr> <tr> @@ -69,5 +69,5 @@ <%ARGS> $addquery => 0 $query => undef -%cfqueues => undef +%queues => () </%ARGS> diff --git a/rt/share/html/Search/Elements/ResultsRSSView b/rt/share/html/Search/Elements/ResultsRSSView index f3b416a4e..5033c8c64 100644 --- a/rt/share/html/Search/Elements/ResultsRSSView +++ b/rt/share/html/Search/Elements/ResultsRSSView @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -70,7 +70,7 @@ if ( $m->request_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) { # convert to perl strings $name = Encode::decode_utf8($name); - my $user = RT::User->new($RT::SystemUser); + my $user = RT::User->new(RT->SystemUser); $user->Load($name); $notfound->("Invalid user: $user") unless $user->id; @@ -102,7 +102,7 @@ $r->content_type('application/rss+xml'); # create an RSS 1.0 file (http://purl.org/rss/1.0/) use XML::RSS; - my $rss = new XML::RSS (version => '1.0'); + my $rss = XML::RSS->new(version => '1.0'); $rss->channel( title => RT->Config->Get('rtname').": Search " . $ARGS{'Query'}, link => RT->Config->Get('WebURL'), diff --git a/rt/share/html/Search/Elements/SearchPrivacy b/rt/share/html/Search/Elements/SearchPrivacy index f943af143..f36c1c894 100644 --- a/rt/share/html/Search/Elements/SearchPrivacy +++ b/rt/share/html/Search/Elements/SearchPrivacy @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SearchesForObject b/rt/share/html/Search/Elements/SearchesForObject index 35007bde5..efbf22078 100644 --- a/rt/share/html/Search/Elements/SearchesForObject +++ b/rt/share/html/Search/Elements/SearchesForObject @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SelectAndOr b/rt/share/html/Search/Elements/SelectAndOr index a644a71d8..ec19271b2 100644 --- a/rt/share/html/Search/Elements/SelectAndOr +++ b/rt/share/html/Search/Elements/SelectAndOr @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SelectChartType b/rt/share/html/Search/Elements/SelectChartType index 42cd4e4b2..aeee7cdbc 100644 --- a/rt/share/html/Search/Elements/SelectChartType +++ b/rt/share/html/Search/Elements/SelectChartType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SelectGroup b/rt/share/html/Search/Elements/SelectGroup index 2ed965d42..ff5fc0786 100644 --- a/rt/share/html/Search/Elements/SelectGroup +++ b/rt/share/html/Search/Elements/SelectGroup @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -55,7 +55,7 @@ </select> <%INIT> -my $groups = new RT::Groups($session{'CurrentUser'}); +my $groups = RT::Groups->new($session{'CurrentUser'}); $groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => $Domain); </%INIT> diff --git a/rt/share/html/Search/Elements/SelectGroupBy b/rt/share/html/Search/Elements/SelectGroupBy index fbf19addb..9a6951a82 100644 --- a/rt/share/html/Search/Elements/SelectGroupBy +++ b/rt/share/html/Search/Elements/SelectGroupBy @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SelectLinks b/rt/share/html/Search/Elements/SelectLinks index 20c0dd311..0b7ce1251 100644 --- a/rt/share/html/Search/Elements/SelectLinks +++ b/rt/share/html/Search/Elements/SelectLinks @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SelectPersonType b/rt/share/html/Search/Elements/SelectPersonType index 6454acff3..d07e49c22 100644 --- a/rt/share/html/Search/Elements/SelectPersonType +++ b/rt/share/html/Search/Elements/SelectPersonType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SelectSearchObject b/rt/share/html/Search/Elements/SelectSearchObject index d1b38abf0..6a511027e 100644 --- a/rt/share/html/Search/Elements/SelectSearchObject +++ b/rt/share/html/Search/Elements/SelectSearchObject @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Search/Elements/SelectSearchesForObjects b/rt/share/html/Search/Elements/SelectSearchesForObjects index eafe88843..5f3169bbd 100644 --- a/rt/share/html/Search/Elements/SelectSearchesForObjects +++ b/rt/share/html/Search/Elements/SelectSearchesForObjects @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -51,10 +51,11 @@ $Name => undef $SearchType => 'Ticket', </%args> <select id="<%$Name%>" name="<%$Name%>"> -<option value="" selected> </option> +<option value="">-</option> % foreach my $object (@Objects) { -<optgroup label="<& SearchPrivacy, Object => $object &>"> % my @searches = $object->Attributes->Named('SavedSearch'); +% if ( @searches ) { +<optgroup label="<& SearchPrivacy, Object => $object &>"> % foreach my $search (@searches) { % # Skip it if it is not of search type we want. % next if ($search->SubValue('SearchType') @@ -63,4 +64,5 @@ $SearchType => 'Ticket', % } </optgroup> % } +% } </select> |