[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.7-10-g07751b5
Alex Vandiver
alexmv at bestpractical.com
Thu Sep 25 18:05:52 EDT 2014
The branch, 4.2-trunk has been updated
via 07751b502be67e3631c9b5bf85ae7218e32cdd4c (commit)
from feafe669ef1628d22cb79371ea61e15c034b8e44 (commit)
Summary of changes:
share/html/Helpers/Autocomplete/Groups | 5 ++++-
share/html/Helpers/Autocomplete/Owners | 5 ++++-
share/html/Helpers/Autocomplete/Tickets | 5 ++++-
share/html/Helpers/Autocomplete/Users | 5 ++++-
4 files changed, 16 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 07751b502be67e3631c9b5bf85ae7218e32cdd4c
Author: Jerome Charaoui <jcharaoui at cmaisonneuve.qc.ca>
Date: Wed Sep 24 18:41:16 2014 -0400
Implement ModifyMaxResults callback
This adds the ModifyMaxResults callback, which permits changing the
maximum number of results returned in Groups, Owners, Users and Tickets
autocomplete endpoints.
diff --git a/share/html/Helpers/Autocomplete/Groups b/share/html/Helpers/Autocomplete/Groups
index 89d1bd2..ef999ff 100644
--- a/share/html/Helpers/Autocomplete/Groups
+++ b/share/html/Helpers/Autocomplete/Groups
@@ -50,7 +50,7 @@
% $m->abort;
<%ARGS>
$term => undef
-$max => 10
+$max => undef
$exclude => ''
$op => 'LIKE'
</%ARGS>
@@ -66,6 +66,9 @@ $m->abort unless $CurrentUser->Privileged;
# Sanity check the operator
$op = 'LIKE' unless $op =~ /^(?:LIKE|(?:START|END)SWITH|=|!=)$/i;
+$m->callback( CallbackName => 'ModifyMaxResults', max => \$max );
+$max //= 10;
+
my $groups = RT::Groups->new( $CurrentUser );
$groups->RowsPerPage( $max );
$groups->LimitToUserDefinedGroups();
diff --git a/share/html/Helpers/Autocomplete/Owners b/share/html/Helpers/Autocomplete/Owners
index 9819818..6b8147f 100644
--- a/share/html/Helpers/Autocomplete/Owners
+++ b/share/html/Helpers/Autocomplete/Owners
@@ -52,7 +52,7 @@
$return => 'Name'
$limit => undef
$term => undef
-$max => 10
+$max => undef
</%ARGS>
<%INIT>
# Only allow certain return fields
@@ -69,6 +69,9 @@ my %user_uniq_hash;
my $isSU = $session{CurrentUser}
->HasRight( Right => 'SuperUser', Object => $RT::System );
+$m->callback( CallbackName => 'ModifyMaxResults', max => \$max );
+$max //= 10;
+
# Turn RT::Ticket-1|RT::Queue-2 into ['RT::Ticket', 1], ['RT::Queue', 2]
foreach my $spec (map { [split /\-/, $_, 2] } split /\|/, $limit) {
next unless $spec->[0] =~ /^RT::(Ticket|Queue)$/;
diff --git a/share/html/Helpers/Autocomplete/Tickets b/share/html/Helpers/Autocomplete/Tickets
index 83d4b9e..62506a9 100644
--- a/share/html/Helpers/Autocomplete/Tickets
+++ b/share/html/Helpers/Autocomplete/Tickets
@@ -51,7 +51,7 @@
<%ARGS>
$return => ''
$term => undef
-$max => 10
+$max => undef
$exclude => ''
</%ARGS>
<%INIT>
@@ -93,6 +93,9 @@ if ( @excludes ) { # exclude ids already these
$sql = join ' AND ', "($sql)", map { qq{id != '$_'} } @excludes;
}
+$m->callback( CallbackName => 'ModifyMaxResults', max => \$max );
+$max //= 10;
+
$tickets->FromSQL($sql);
$tickets->RowsPerPage( $max );
diff --git a/share/html/Helpers/Autocomplete/Users b/share/html/Helpers/Autocomplete/Users
index 097b9c2..f72aece 100644
--- a/share/html/Helpers/Autocomplete/Users
+++ b/share/html/Helpers/Autocomplete/Users
@@ -52,7 +52,7 @@
$return => ''
$term => undef
$delim => undef
-$max => 10
+$max => undef
$privileged => undef
$exclude => ''
$op => undef
@@ -88,6 +88,9 @@ $m->abort unless $CurrentUser->Privileged
my @exclude = split /\s*,\s*/, $exclude;
push @exclude, RT->SystemUser->id, RT->Nobody->id;
+$m->callback( CallbackName => 'ModifyMaxResults', max => \$max );
+$max //= 10;
+
my $users = RT::Users->new($CurrentUser);
$users->SimpleSearch( Privileged => $privileged,
Return => $return,
-----------------------------------------------------------------------
More information about the rt-commit
mailing list