[Rt-commit] rt branch, owner-autocomplete, created. rt-3.8.8-482-g6439a2b

Thomas Sibley trs at bestpractical.com
Thu Aug 19 14:18:57 EDT 2010


The branch, owner-autocomplete has been created
        at  6439a2bb3b13071a38da5d03502904209e3a2be6 (commit)

- Log -----------------------------------------------------------------
commit 2bde4cb7519912eca21df69314e5071a3ec48f3c
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Aug 19 14:06:24 2010 -0400

    Add the config option to turn on owner autocomplete

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index ed8a8c3..089924b 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -892,6 +892,16 @@ not all the attributes are supported in this display because we're not building
 
 Set($MoreAboutRequestorExtraInfo, '');
 
+=item C<$AutocompleteOwners>
+
+If true, the owner dropdowns for ticket update/modify and the query builder are
+replaced by text fields that autocomplete.  This can alleviate the sometimes
+huge owner list for installations where many users have the OwnTicket right.
+
+=cut
+
+Set( $AutocompleteOwners, 0 );
+
 =item C<$WebDomain>
 
 Domain name of the RT server, eg 'www.example.com'. It should not contain

commit 6439a2bb3b13071a38da5d03502904209e3a2be6
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Aug 19 14:16:08 2010 -0400

    Refactor into SelectOwnerDropdown so we can choose our widget

diff --git a/share/html/Elements/SelectOwner b/share/html/Elements/SelectOwner
index ee1d981..75b3951 100755
--- a/share/html/Elements/SelectOwner
+++ b/share/html/Elements/SelectOwner
@@ -45,87 +45,7 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-<select name="<%$Name%>" id="<%$Name%>">
-%if ($DefaultValue) {
-<option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel%></option>
-%}
-% $Default = 0 unless defined $Default && $Default =~ /^\d+$/;
-% my @formatednames = sort {lc $a->[1] cmp lc $b->[1]} map {[$_, $m->scomp('/Elements/ShowUser', User => $_)]} grep { $_->id != $RT::Nobody->id } @users;
-% my $nobody = [$RT::Nobody, $m->scomp('/Elements/ShowUser', User => $RT::Nobody)];
-% unshift @formatednames, $nobody;
-%foreach my $UserRef ( @formatednames)  {
-%my $User = $UserRef->[0];
-<option <% ( $User->Id == $Default) ? qq[ selected="selected"] : '' |n %>
-%if ($ValueAttribute eq 'id') {
-    value="<%$User->id%>"
-%} elsif ($ValueAttribute eq 'Name') {
-    value="<%$User->Name%>"
-%}
-><% $UserRef->[1] |n %></option>
-%}
-</select>
+<& "SelectOwner$Widget", %ARGS &>
 <%INIT>
-
-my @objects;
-if ($TicketObj) {
-    @objects = ($TicketObj);
-} elsif ($QueueObj) {
-    @objects = ($QueueObj);
-} elsif ($cfqueues) {
-    @objects = keys %{$cfqueues};
-} else {
-# Let's check rights on an empty queue object. that will do a search
-# for any queue.
-    my $queue = RT::Queue->new( $session{'CurrentUser'} );
-    push( @objects, $queue );
-}
-
-my %user_uniq_hash;
-
-$m->callback(
-    %ARGS,
-    objects      => \@objects,
-    CallbackName => 'UpdateObjectList'
-);
-
-my $isSU = $session{CurrentUser}
-    ->HasRight( Right => 'SuperUser', Object => $RT::System );
-foreach my $object (@objects) {
-    my $Users = RT::Users->new( $session{CurrentUser} );
-    $Users->WhoHaveRight(
-        Right               => 'OwnTicket',
-        Object              => $object,
-        IncludeSystemRights => 1,
-        IncludeSuperusers   => $isSU
-    );
-    while ( my $User = $Users->Next() ) {
-        $user_uniq_hash{ $User->Id() } = $User;
-    }
-}
-if ($Default && $Default != $RT::Nobody->id && !$user_uniq_hash{$Default}) {
-    $user_uniq_hash{$Default} = RT::User->new($session{CurrentUser});
-    $user_uniq_hash{$Default}->Load($Default);
-}
-
-my @users = values %user_uniq_hash;
-
-$m->callback(
-    %ARGS,
-    objects      => \@objects,
-    CallbackName => 'UpdateObjectList'
-);
-
-
+my $Widget = RT->Config->Get('AutocompleteOwner') ? 'Autocomplete' : 'Dropdown';
 </%INIT>
-
-<%ARGS>
-$QueueObj => undef
-$Name => undef
-$Default => 0
-$User => undef
-$TicketObj => undef
-$DefaultValue => 1
-$DefaultLabel => "-"
-$ValueAttribute => 'id'
-$cfqueues => undef
-</%ARGS>
diff --git a/share/html/Elements/SelectOwner b/share/html/Elements/SelectOwnerDropdown
similarity index 100%
copy from share/html/Elements/SelectOwner
copy to share/html/Elements/SelectOwnerDropdown

-----------------------------------------------------------------------


More information about the Rt-commit mailing list