[Rt-commit] rt branch, owner-autocomplete, updated. rt-3.8.8-484-g30e2594

Thomas Sibley trs at bestpractical.com
Thu Aug 19 16:03:30 EDT 2010


The branch, owner-autocomplete has been updated
       via  30e25947e6a656f55ffb7167b936f2e61ba665f9 (commit)
      from  f24b585dcb3092e381084ab4078c5fcb2bb4a671 (commit)

Summary of changes:
 share/html/Elements/SelectOwner             |   27 +++++++++++++++++++-
 share/html/Elements/SelectOwnerAutocomplete |    5 +---
 share/html/Elements/SelectOwnerDropdown     |   36 +-------------------------
 3 files changed, 29 insertions(+), 39 deletions(-)

- Log -----------------------------------------------------------------
commit 30e25947e6a656f55ffb7167b936f2e61ba665f9
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Aug 19 16:05:20 2010 -0400

    Refactor how limiting objects are passed into SelectOwner widgets

diff --git a/share/html/Elements/SelectOwner b/share/html/Elements/SelectOwner
index 75b3951..16fbfce 100755
--- a/share/html/Elements/SelectOwner
+++ b/share/html/Elements/SelectOwner
@@ -45,7 +45,32 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-<& "SelectOwner$Widget", %ARGS &>
+<& "SelectOwner$Widget", %ARGS, Objects => \@objects &>
 <%INIT>
 my $Widget = RT->Config->Get('AutocompleteOwner') ? 'Autocomplete' : 'Dropdown';
+
+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 );
+}
+
+$m->callback(
+    %ARGS,
+    objects      => \@objects,
+    CallbackName => 'UpdateObjectList'
+);
 </%INIT>
+<%ARGS>
+$TicketObj  => undef
+$QueueObj   => undef
+$cfqueues   => undef
+</%ARGS>
diff --git a/share/html/Elements/SelectOwnerAutocomplete b/share/html/Elements/SelectOwnerAutocomplete
index d624cd9..bfbcd1d 100644
--- a/share/html/Elements/SelectOwnerAutocomplete
+++ b/share/html/Elements/SelectOwnerAutocomplete
@@ -47,10 +47,7 @@
 %# END BPS TAGGED BLOCK }}}
 <%ARGS>
 $Name           => undef
-$User           => undef
-$TicketObj      => undef
-$QueueObj       => undef
-$cfqueues       => undef
+$Objects        => []
 $Default        => 0
 $ValueAttribute => 'id'
 </%ARGS>
diff --git a/share/html/Elements/SelectOwnerDropdown b/share/html/Elements/SelectOwnerDropdown
index ee1d981..c4ca718 100755
--- a/share/html/Elements/SelectOwnerDropdown
+++ b/share/html/Elements/SelectOwnerDropdown
@@ -65,32 +65,11 @@
 %}
 </select>
 <%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) {
+foreach my $object (@$Objects) {
     my $Users = RT::Users->new( $session{CurrentUser} );
     $Users->WhoHaveRight(
         Right               => 'OwnTicket',
@@ -108,24 +87,13 @@ if ($Default && $Default != $RT::Nobody->id && !$user_uniq_hash{$Default}) {
 }
 
 my @users = values %user_uniq_hash;
-
-$m->callback(
-    %ARGS,
-    objects      => \@objects,
-    CallbackName => 'UpdateObjectList'
-);
-
-
 </%INIT>
 
 <%ARGS>
-$QueueObj => undef
 $Name => undef
+$Objects => []
 $Default => 0
-$User => undef
-$TicketObj => undef
 $DefaultValue => 1
 $DefaultLabel => "-"
 $ValueAttribute => 'id'
-$cfqueues => undef
 </%ARGS>

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


More information about the Rt-commit mailing list