[Bps-public-commit] RT-Extension-rt_cpan_org branch, rt4, updated. 833f926a00b327e6839143537aa6ff9f8c1b2ab1

Thomas Sibley trs at bestpractical.com
Wed Feb 27 20:31:43 EST 2013


The branch, rt4 has been updated
       via  833f926a00b327e6839143537aa6ff9f8c1b2ab1 (commit)
       via  ae2ee8d6ee995fecbc1a84c1ff40218fe02404f7 (commit)
       via  5616716a1554966def240a6bccd8fcde496c596c (commit)
       via  1b7c5e57e21dc0a4bafad758fe8be66caf28dc39 (commit)
       via  e09df798fa23247492fdeabdc31267f271b54902 (commit)
       via  255217fb101378389785a9bf932995e0441812c1 (commit)
       via  e15fbc301c5dc546fe24bdb6016293bcbf7b5db8 (commit)
      from  2630ea4bd54f9915c6185a9845ca234073ebd3c8 (commit)

Summary of changes:
 META.yml                                           |   1 +
 etc/CPAN_Config.pm                                 | 137 +++++++++++++++
 .../Elements/QueueSummaryByLifecycle/LinkBuilders  |  19 +++
 .../Elements/QueueSummaryByLifecycle/SQLFilter     |   7 +
 .../Elements/QueueSummaryByStatus/LinkBuilders     |  19 +++
 .../Elements/QueueSummaryByStatus/SQLFilter        |   7 +
 .../Callbacks/rt_cpan_org/Elements/Tabs/Privileged |   4 -
 .../Prefs/Quicksearch.html/ModifyQueues            |   8 +
 html/Elements/Logo                                 |  66 --------
 html/Elements/MySupportQueues                      |  60 -------
 html/Elements/QueueSummary                         |  91 ----------
 html/Elements/Quicksearch                          |  60 -------
 html/Elements/SelectOwner                          | 122 --------------
 html/Elements/SelectQueue                          | 113 +++++--------
 html/Helpers/Autocomplete/Queues                   |  34 ++++
 html/Prefs/Quicksearch.html                        |  53 ------
 patches/4.0.10-quicksearch-links.patch             | 187 +++++++++++++++++++++
 patches/4.0.10-quicksearch-prefs.patch             |  37 ++++
 18 files changed, 494 insertions(+), 531 deletions(-)
 create mode 100644 etc/CPAN_Config.pm
 create mode 100644 html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/LinkBuilders
 create mode 100644 html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/SQLFilter
 create mode 100644 html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/LinkBuilders
 create mode 100644 html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/SQLFilter
 create mode 100644 html/Callbacks/rt_cpan_org/Prefs/Quicksearch.html/ModifyQueues
 delete mode 100644 html/Elements/Logo
 delete mode 100644 html/Elements/MySupportQueues
 delete mode 100644 html/Elements/QueueSummary
 delete mode 100755 html/Elements/Quicksearch
 delete mode 100755 html/Elements/SelectOwner
 mode change 100755 => 100644 html/Elements/SelectQueue
 create mode 100644 html/Helpers/Autocomplete/Queues
 delete mode 100644 html/Prefs/Quicksearch.html
 create mode 100644 patches/4.0.10-quicksearch-links.patch
 create mode 100644 patches/4.0.10-quicksearch-prefs.patch

- Log -----------------------------------------------------------------
commit e15fbc301c5dc546fe24bdb6016293bcbf7b5db8
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Feb 26 17:27:45 2013 -0800

    Custom Logo handling is unnecessary in RT 4

diff --git a/html/Elements/Logo b/html/Elements/Logo
deleted file mode 100644
index 76a5a9d..0000000
--- a/html/Elements/Logo
+++ /dev/null
@@ -1,66 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%# 
-%# COPYRIGHT:
-%# 
-%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-%#                                          <jesse at 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 }}}
-<div id="logo">
-<a href="<% RT->Config->Get('WebBaseURL') %>"><img
-    src="<% $ARGS{'LogoURL'} || RT->Config->Get('LogoURL') %>"
-    alt="<% loc("RT for CPAN") %>"
-    width="195" height="60" /></a>
-% if ( $ShowName ) {
-    <span class="rtname"><% $Name || loc("RT for [_1]", RT->Config->Get('rtname')) %></span>
-% }
-</div>
-<%INIT>
-if ( exists $ARGS{'show_name'} ) {
-    RT->Logger->warning('show_name argument was renamed, use ShowName');
-    $ShowName = delete $ARGS{'show_name'};
-}
-</%INIT>
-<%ARGS>
-$ShowName => 1
-$Name => undef
-</%ARGS>

commit 255217fb101378389785a9bf932995e0441812c1
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Feb 26 18:54:33 2013 -0800

    Remove "quick search" and queue summary overlays in favor of callback
    
    Preserves the removal of the link to /Prefs/Quicksearch.html via CSS.
    
    The LinkBuilders callbacks require the 4.0/queue-summary-link-callbacks
    RT branch, and preserve the custom links to /Dist/Display.html instead
    of /Search/Results.html.  Without the callbacks, we'll need to overlay
    the entire files.

diff --git a/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/LinkBuilders b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/LinkBuilders
new file mode 100644
index 0000000..fcd4893
--- /dev/null
+++ b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/LinkBuilders
@@ -0,0 +1,19 @@
+<%args>
+$link_all
+$link_status
+</%args>
+<%init>
+$$link_all = sub {
+    my ($queue, $all_statuses) = @_; 
+    return RT->Config->Get("WebPath") . '/Dist/Display.html'
+         . '?Status=Active'
+         . '&Queue=' . $m->interp->apply_escapes($queue->{Name}, 'u');
+};
+
+$$link_status = sub {
+    my ($queue, $status) = @_;
+    return RT->Config->Get("WebPath") . '/Dist/Display.html'
+         . '?Status=' . $m->interp->apply_escapes($status, 'u')
+         . '&Queue='  . $m->interp->apply_escapes($queue->{Name}, 'u');
+};
+</%init>
diff --git a/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/SQLFilter b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/SQLFilter
new file mode 100644
index 0000000..7d1cf18
--- /dev/null
+++ b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByLifecycle/SQLFilter
@@ -0,0 +1,7 @@
+<%args>
+$Queues
+</%args>
+<%init>
+my $WatchedQueues = $session{'CurrentUser'}->UserObj->WatchedQueues('AdminCc', 'Cc');
+%$Queues = %$WatchedQueues;
+</%init>
diff --git a/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/LinkBuilders b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/LinkBuilders
new file mode 100644
index 0000000..fcd4893
--- /dev/null
+++ b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/LinkBuilders
@@ -0,0 +1,19 @@
+<%args>
+$link_all
+$link_status
+</%args>
+<%init>
+$$link_all = sub {
+    my ($queue, $all_statuses) = @_; 
+    return RT->Config->Get("WebPath") . '/Dist/Display.html'
+         . '?Status=Active'
+         . '&Queue=' . $m->interp->apply_escapes($queue->{Name}, 'u');
+};
+
+$$link_status = sub {
+    my ($queue, $status) = @_;
+    return RT->Config->Get("WebPath") . '/Dist/Display.html'
+         . '?Status=' . $m->interp->apply_escapes($status, 'u')
+         . '&Queue='  . $m->interp->apply_escapes($queue->{Name}, 'u');
+};
+</%init>
diff --git a/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/SQLFilter b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/SQLFilter
new file mode 100644
index 0000000..7d1cf18
--- /dev/null
+++ b/html/Callbacks/rt_cpan_org/Elements/QueueSummaryByStatus/SQLFilter
@@ -0,0 +1,7 @@
+<%args>
+$Queues
+</%args>
+<%init>
+my $WatchedQueues = $session{'CurrentUser'}->UserObj->WatchedQueues('AdminCc', 'Cc');
+%$Queues = %$WatchedQueues;
+</%init>
diff --git a/html/Elements/MySupportQueues b/html/Elements/MySupportQueues
deleted file mode 100644
index 3db069d..0000000
--- a/html/Elements/MySupportQueues
+++ /dev/null
@@ -1,60 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%#                                          <sales at 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 }}}
-<&|/Widgets/TitleBox, title => loc("Queues I'm an AdminCc for"), bodyclass => "" &>
-<& /Elements/QueueSummary,
-   cache => 'my_support_queues',
-   queue_filter => sub { $_->IsAdminCc($session{'CurrentUser'}->Id) },
-   conditions => \@conditions,
-&>
-</&>
-<%INIT>
-my @conditions = ();
-foreach ( RT::Queue->ActiveStatusArray ) {
-    push @conditions, { cond => "Status = '$_'", name => loc($_), status => $_ };
-}
-</%INIT>
diff --git a/html/Elements/QueueSummary b/html/Elements/QueueSummary
deleted file mode 100644
index c93015a..0000000
--- a/html/Elements/QueueSummary
+++ /dev/null
@@ -1,91 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%# 
-%# COPYRIGHT:
-%#  
-%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
-%#                                          <jesse at 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/copyleft/gpl.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 border="0" cellspacing="0" cellpadding="1" width="100%">
-<tr>
-       <th class="collection-as-table"><&|/l&>Queue</&></th>
-% for my $condition (@$conditions) {
-       <th class="collection-as-table"><% $condition->{name} %></th>
-% }
-</tr>
-% my $i;
-% for my $queue (@queues) {
-%   $i++;
-%   my $queue_cond = "Queue = '$queue->{Name}' AND ";
-%   my $all_q = $queue_cond . "(Status = 'open' OR Status = 'new' OR Status = 'stalled')";
-<tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
-<td><a href="<% RT->Config->Get("WebPath")%>/Dist/Display.html?Status=Active&Queue=<% $queue->{Name} |u %>"><% $queue->{Name} %></a></td>
-%   for my $condition (@$conditions) {
-%       $Tickets->FromSQL( "Queue = $queue->{id} AND ". $condition->{cond} );
-<td align="right"><a href="<% RT->Config->Get("WebPath")%>/Dist/Display.html?Status=<% $condition->{status} |u %>&Queue=<% $queue->{Name} |u %>"><% $Tickets->Count %></a></td>
-%   }
-</tr>
-% }
-</table>
-<%INIT>
-my @queues;
-
-if ($cache && exists $session{$cache}) {
-    @queues = @{$session{$cache}};
-}
-else {
-    my $WatchedQueues = $session{'CurrentUser'}->UserObj->WatchedQueues('AdminCc', 'Cc');
-    @queues = map {
-	{ Name => $_->Name, Description => $_->Description,
-	  id => $_->Id } }
-	grep $queue_filter->($_), @{$WatchedQueues->ItemsArrayRef};
-
-    $session{$cache} = \@queues if $cache;
-}
-
-my $Tickets = RT::Tickets->new($session{'CurrentUser'});
-</%INIT>
-<%ARGS>
-$cache => undef
-$queue_filter => undef
-$conditions => ()
-</%ARGS>
diff --git a/html/Elements/Quicksearch b/html/Elements/Quicksearch
deleted file mode 100755
index 868fb9c..0000000
--- a/html/Elements/Quicksearch
+++ /dev/null
@@ -1,60 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%# 
-%# COPYRIGHT:
-%#  
-%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
-%#                                          <jesse at 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/copyleft/gpl.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 }}}
-<div class="ticket-overview">
-<&|/Widgets/TitleBox, title => loc("Quick search"), bodyclass => "" &>
-<& /Elements/QueueSummary,
-   cache => 'quick_search_queues',
-   queue_filter => sub { $_->CurrentUserHasRight('ShowTicket') && !exists $unwanted->{$_->Name} },
-   conditions => [ {cond => "Status = 'new'",  name => loc ('new'), status => 'new'  },
-		   {cond => "Status = 'open'", name => loc ('open'), status => 'open' },
-		   {cond => "Status = 'stalled'", name => loc ('stalled'), status => 'stalled' }] &>
-</&>
-</div>
-<%INIT>
-my $unwanted = $session{'CurrentUser'}->UserObj->Preferences('QuickSearch', {});
-</%INIT>
diff --git a/html/NoAuth/css/rt.cpan.org.css b/html/NoAuth/css/rt.cpan.org.css
index d46a06a..7a3a748 100644
--- a/html/NoAuth/css/rt.cpan.org.css
+++ b/html/NoAuth/css/rt.cpan.org.css
@@ -106,3 +106,8 @@ tt {
 }
 
 a { text-decoration: underline; }
+
+/* Let me count the ways to name "Quicksearch"... */
+.ticket-overview .titlebox-title .right {
+    display: none;
+}

commit e09df798fa23247492fdeabdc31267f271b54902
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Feb 26 20:34:06 2013 -0800

    Replace custom SelectOwner with the $AutocompleteOwnersForSearch option
    
    The option forces autocomplete for any cases which would generate a huge
    dropdown.  The upshot of this is that when editing individual tickets,
    a nice dropdown is available!

diff --git a/META.yml b/META.yml
index 6e28978..59f9b2c 100644
--- a/META.yml
+++ b/META.yml
@@ -16,6 +16,7 @@ meta-spec:
 name: RT-Extension-rt_cpan_org
 no_index:
   directory:
+    - etc
     - html
     - inc
 requires:
diff --git a/etc/CPAN_Config.pm b/etc/CPAN_Config.pm
new file mode 100644
index 0000000..01f7eb9
--- /dev/null
+++ b/etc/CPAN_Config.pm
@@ -0,0 +1,4 @@
+# There are too many potential owners when not limited to a specific ticket/queue.
+Set($AutocompleteOwnersForSearch, 1);
+
+1;
diff --git a/html/Elements/SelectOwner b/html/Elements/SelectOwner
deleted file mode 100755
index ec5cfb6..0000000
--- a/html/Elements/SelectOwner
+++ /dev/null
@@ -1,122 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%# 
-%# COPYRIGHT:
-%#  
-%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
-%#                                          <jesse at 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/copyleft/gpl.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 }}}
-% if ($Lite) {
-<input name="<% $Name %>" type="text" />
-% }
-% else {
-<select name="<%$Name%>">
-%     if ($DefaultValue) {
-  <option<% !$Default ? q[ selected="selected"] : '' |n %> value=""><%$DefaultLabel%></option>
-%     }
-%     foreach my $User (@users)  {
-  <option<% ($User->Id == $Default) ? q[ selected="selected"] : '' |n %>
-%         if ($ValueAttribute eq 'id') {
-        value="<%$User->Id%>">
-%         }
-%         elsif ($ValueAttribute eq 'Name') {
-        value="<%$User->Name%>">
-%         }
-     <% $User->Name %>
-   </option>
-%     }
-</select>
-% }
-
-<%INIT>
-my @objects;
-my @users;
-
-if (not $Lite) {
-    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;
-
-    foreach my $object (@objects) {
-        my $Users = RT::Users->new($session{CurrentUser});
-        
-        $Users->WhoHaveRight(Right                  => 'OwnTicket',
-                             Object                 => $object,
-                             IncludeSystemRights    => 1,
-                             IncludeSuperusers      => 0);
-
-        while (my $User = $Users->Next) {
-            next if ($User->id == RT->Nobody->id); # skip nobody here, so we can make them first later
-            $user_uniq_hash{$User->Id()} = $User;
-        }
-    }
-
-    @users = sort { uc($a->Name) cmp uc($b->Name) } values %user_uniq_hash; 
-    unshift @users, RT->Nobody;
-}
-</%INIT>
-
-<%ARGS>
-$QueueObj => undef
-$Name => undef
-$Default => 0
-$User => undef
-$TicketObj => undef
-$DefaultValue => 1
-$DefaultLabel => "-"
-$ValueAttribute => 'id'
-$cfqueues => undef
-$Lite => 1
-</%ARGS>

commit 1b7c5e57e21dc0a4bafad758fe8be66caf28dc39
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Feb 27 13:21:15 2013 -0800

    Keep most of rt.cpan.org's config in this extension
    
    Now only site-specific values like passwords and database hosts can be
    in a private RT_SiteConfig.pm.

diff --git a/etc/CPAN_Config.pm b/etc/CPAN_Config.pm
index 01f7eb9..c68c2e8 100644
--- a/etc/CPAN_Config.pm
+++ b/etc/CPAN_Config.pm
@@ -1,4 +1,137 @@
+# This is an RT configuration file, loaded when the RT::Extension::rt_cpan_org
+# plugin is loaded.
+
+Set( $Organization, "rt.cpan.org" );
+
+# Reminders add much complexity for not much value.
+Set( $EnableReminders, 0 );
+
 # There are too many potential owners when not limited to a specific ticket/queue.
-Set($AutocompleteOwnersForSearch, 1);
+Set( $AutocompleteOwnersForSearch, 1 );
+
+# This username format is forced and spam-protects email addresses.
+Set( $UsernameFormat, 'public' );
+
+# Email defaults; queues get their own dynamic addresses too
+Set( $CorrespondAddress, 'bugs at rt.cpan.org' );
+Set( $CommentAddress,    'comments at rt.cpan.org' );
+
+# The old $rtname used to be "cpan"; accept it
+Set( $EmailSubjectTagRegex, qr/(?:\Q$rtname\E|cpan)/i );
+
+# Too many deep links into rt.cpan.org.
+Set( $RestrictReferrer, 0 );
+
+# Don't require ModifyTicket for _both_ tickets, so bugs can be linked cross-queues.
+Set( $StrictLinkACL, 0 );
+
+# The internet expects formatting preserved and links clickable.
+Set( $PlainTextMono, 1 );
+Set( @Active_MakeClicky, qw(httpurl_overwrite) );
+
+# Fancy-pants WYSIWYG usually mangles pasted terminal and log output.
+Set( $MessageBoxRichText, 0 );
+
+# Show severity, broken in, and fixed in by default.
+Set( $DefaultSearchResultFormat, <<'EOT');
+'<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>/TITLE:ID',
+'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
+'__Status__',
+'__CustomField.{Severity}__',
+'<small>__LastUpdatedRelative__</small>',
+'__CustomField.{Broken in}__',
+'__CustomField.{Fixed in}__'
+EOT
+
+# Allow unauth'd access to robots.txt.
+Set( $WebNoAuthRegex, qr{(?: $WebNoAuthRegex | ^/+robots\.txt$ )}x );
+
+# Development mode should always be off for production.
+Set( $DevelMode, 0 );
+
+# Add "patched" to the default lifecycle.
+Set( %Lifecycles,
+    cpan => {
+        initial         => [ 'new' ],
+        active          => [ 'open', 'stalled', 'patched' ],
+        inactive        => [ 'resolved', 'rejected', 'deleted' ],
+
+        defaults => {
+            on_create => 'new',
+            on_merge  => 'resolved',
+            approved  => 'open',
+            denied    => 'rejected',
+            reminder_on_open     => 'open',
+            reminder_on_resolve  => 'resolved',
+        },
+
+        transitions => {
+            ''       => [qw(new open resolved)],
+
+            # from   => [ to list ],
+            new      => [qw(open stalled patched resolved rejected deleted)],
+            open     => [qw(new stalled patched resolved rejected deleted)],
+            stalled  => [qw(new open patched rejected resolved deleted)],
+            patched  => [qw(new open stalled rejected resolved deleted)],
+            resolved => [qw(new open stalled patched rejected deleted)],
+            rejected => [qw(new open stalled patched resolved deleted)],
+            deleted  => [qw(new open stalled patched rejected resolved)],
+        },
+        rights => {
+            '* -> deleted'  => 'DeleteTicket',
+            '* -> *'        => 'ModifyTicket',
+        },
+        actions => [
+            'new -> open'      => {
+                label  => 'Open It', # loc
+                update => 'Respond',
+            },
+            'new -> resolved'  => {
+                label  => 'Resolve', # loc
+                update => 'Respond',
+            },
+            'new -> rejected'  => {
+                label  => 'Reject', # loc
+                update => 'Respond',
+            },
+            'new -> deleted'   => {
+                label  => 'Delete', # loc
+            },
+
+            'open -> stalled'  => {
+                label  => 'Stall', # loc
+                update => 'Respond',
+            },
+            'open -> resolved' => {
+                label  => 'Resolve', # loc
+                update => 'Respond',
+            },
+            'open -> rejected' => {
+                label  => 'Reject', # loc
+                update => 'Respond',
+            },
+
+            'stalled -> open'  => {
+                label  => 'Open It', # loc
+            },
+            'resolved -> open' => {
+                label  => 'Re-open', # loc
+                update => 'Respond',
+            },
+            'rejected -> open' => {
+                label  => 'Re-open', # loc
+                update => 'Respond',
+            },
+            'deleted -> open'  => {
+                label  => 'Undelete', # loc
+            },
+        ],
+    },
+);
+
+# Horrible horrible hack to keep the lifecycles overriding in this config
+# instead of RT_SiteConfig.pm.  Relies on internals of RT::Config.
+my %lifecycles = RT->Config->Get("Lifecycles");
+%{ $lifecycles{default} } = %{ $lifecycles{cpan} };
 
 1;

commit 5616716a1554966def240a6bccd8fcde496c596c
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Feb 27 16:38:59 2013 -0800

    Replace SelectQueue with an autocompleting text input

diff --git a/html/Elements/SelectQueue b/html/Elements/SelectQueue
old mode 100755
new mode 100644
index 539a8c3..8ae687f
--- a/html/Elements/SelectQueue
+++ b/html/Elements/SelectQueue
@@ -1,40 +1,40 @@
 %# BEGIN BPS TAGGED BLOCK {{{
-%# 
+%#
 %# COPYRIGHT:
-%#  
-%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
-%#                                          <jesse at bestpractical.com>
-%# 
+%#
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%#                                          <sales at 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/copyleft/gpl.html.
-%# 
-%# 
+%# 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
@@ -43,70 +43,33 @@
 %# 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 }}}
-% if ($Lite) {
-%     my $d = new RT::Queue($session{'CurrentUser'});
-%     $d->Load($Default);
-%     my $dname = $d->Name; $dname = '' unless defined $dname;
-<input name="<% $Name %>" size="25" value="<% $dname %>" />
-% }
-% else {
-<select name="<%$Name%>">
-%     if ($ShowNullOption) {
-  <option value="">-</option>
-%     }
-%     for my $queue (@{$session{$cache_key}}) {
-  <option value="<% ($NamedValues ? $queue->{Name} : $queue->{Id}) %>" <% ($queue->{Id} eq $Default ? 'selected="selected"' : '') |n %>>
-    <%$queue->{Name}%>
-%             if ($Verbose and $queue->{Description}) {
-    (<%$queue->{Description}%>)
-%             }
-  </option>
-%     }
-</select>
-% }
 <%args>
-$ShowOnlyWatchedQueues => 0
-$CheckQueueRight => 'CreateTicket'
-$ShowNullOption => 1
-$ShowAllQueues => 0
-$ShowDisabledQueues => 0
-$Name => undef
-$Verbose => undef
-$NamedValues => 0
+$Name    => 'Queue'
 $Default => 0
-$Lite => 1
+$Class   => 'select-queue'
+
+$ShowAllQueues   => 1
+$CheckQueueRight => 'CreateTicket'
 </%args>
 <%init>
-my $cache_key = "SelectQueue---"
-                . $session{'CurrentUser'}->Id
-                . "---$CheckQueueRight---$ShowAllQueues---$ShowDisabledQueues"
-                . "---$ShowOnlyWatchedQueues";
+my $DefaultQueue = RT::Queue->new($session{'CurrentUser'});
+$DefaultQueue->Load( $Default );
 
-if (not defined $session{$cache_key} and not $Lite) {
-    my $q;
-    
-    if ($ShowOnlyWatchedQueues) {
-        $q = $session{'CurrentUser'}->UserObj->WatchedQueues;
-    }
-    else {
-        $q = new RT::Queues($session{'CurrentUser'});
-        $q->UnLimit;
-    }
-    
-    if ($ShowDisabledQueues) {
-        $q->{'find_disabled_rows'} = 1;
-    }
-    
-    while (my $queue = $q->Next) {
-        if ($ShowAllQueues || $queue->CurrentUserHasRight($CheckQueueRight)) {
-            push @{$session{$cache_key}}, {
-                Id          => $queue->Id,
-                Name        => $queue->Name,
-                Description => $queue->Description,
-            };
-        }
-    }
-}
+undef $CheckQueueRight if $ShowAllQueues;
 </%init>
+<input name="<% $Name %>" size="25" value="<% $DefaultQueue->id ? $DefaultQueue->Name : "" %>" class="<% $Class %>" />
+<script type="text/javascript">
+    jQuery("input[name="+<% $Name |n,j %>+"]").autocomplete({
+        source: <% RT->Config->Get('WebPath') |n,j%>
+                + "/Helpers/Autocomplete/Queues?max=20&right="
+                + <% $CheckQueueRight ? $CheckQueueRight : "" |n,u,j %>,
+
+        // Auto-submit once a user is chosen
+        select: function( event, ui ) {
+            jQuery(event.target).val(ui.item.value);
+            jQuery(event.target).closest("form").submit();
+        }
+    });
+</script>
diff --git a/html/Helpers/Autocomplete/Queues b/html/Helpers/Autocomplete/Queues
new file mode 100644
index 0000000..afaeff4
--- /dev/null
+++ b/html/Helpers/Autocomplete/Queues
@@ -0,0 +1,34 @@
+% $r->content_type('application/json');
+<% JSON( \@suggestions ) |n %>
+% $m->abort;
+<%ARGS>
+$term   => undef
+$max    => 10
+$op     => 'STARTSWITH'
+$right  => undef
+</%ARGS>
+<%INIT>
+$m->abort unless defined $term
+             and length $term;
+
+my $variant = $term;
+   $variant =~ s/::/-/g;
+
+# Sanity check the operator
+$op = 'STARTSWITH' unless $op =~ /^(?:LIKE|(?:START|END)SWITH|=|!=)$/i;
+
+my $queues = RT::Queues->new( $session{CurrentUser} );
+$queues->RowsPerPage( $max );
+$queues->Limit(
+    FIELD           => 'Name',
+    OPERATOR        => $op,
+    VALUE           => $_,
+    ENTRYAGGREGATOR => 'OR',
+) for ($term, $variant);
+
+my @suggestions;
+while (my $q = $queues->Next) {
+    next if $right and not $q->CurrentUserHasRight($right);
+    push @suggestions, $q->Name;
+}
+</%INIT>

commit ae2ee8d6ee995fecbc1a84c1ff40218fe02404f7
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Feb 27 17:30:13 2013 -0800

    Allow editing of quicksearch preferences again, thanks to an RT patch
    
    The patch is from the RT branch 4.0/quicksearch-prefs-callback.

diff --git a/html/Callbacks/rt_cpan_org/Elements/Tabs/Privileged b/html/Callbacks/rt_cpan_org/Elements/Tabs/Privileged
index 79d5837..1860be0 100644
--- a/html/Callbacks/rt_cpan_org/Elements/Tabs/Privileged
+++ b/html/Callbacks/rt_cpan_org/Elements/Tabs/Privileged
@@ -2,8 +2,4 @@
 if (my $actions = PageMenu->child("actions")) {
     $actions->delete("comment");
 }
-
-if (my $settings = Menu->child("preferences")->child("settings")) {
-    $settings->delete("quicksearch");
-}
 </%init>
diff --git a/html/Callbacks/rt_cpan_org/Prefs/Quicksearch.html/ModifyQueues b/html/Callbacks/rt_cpan_org/Prefs/Quicksearch.html/ModifyQueues
new file mode 100644
index 0000000..4bff5dc
--- /dev/null
+++ b/html/Callbacks/rt_cpan_org/Prefs/Quicksearch.html/ModifyQueues
@@ -0,0 +1,8 @@
+<%args>
+$Queues
+$Right
+</%args>
+<%init>
+$$Right  = undef; # Don't check ShowTicket
+$$Queues = $session{CurrentUser}->UserObj->WatchedQueues('AdminCc', 'Cc');
+</%init>
diff --git a/html/NoAuth/css/rt.cpan.org.css b/html/NoAuth/css/rt.cpan.org.css
index 7a3a748..d46a06a 100644
--- a/html/NoAuth/css/rt.cpan.org.css
+++ b/html/NoAuth/css/rt.cpan.org.css
@@ -106,8 +106,3 @@ tt {
 }
 
 a { text-decoration: underline; }
-
-/* Let me count the ways to name "Quicksearch"... */
-.ticket-overview .titlebox-title .right {
-    display: none;
-}
diff --git a/html/Prefs/Quicksearch.html b/html/Prefs/Quicksearch.html
deleted file mode 100644
index 4744875..0000000
--- a/html/Prefs/Quicksearch.html
+++ /dev/null
@@ -1,53 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
-%#                                          <sales at 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 => loc("Customize").' '.loc("Quick search") &>
-<& /Elements/Tabs &>
-
-<p>
-  <&|/l&>Customization of the Quick Search is disabled due to the number of queues.</&>
-</p>
diff --git a/patches/4.0.10-quicksearch-prefs.patch b/patches/4.0.10-quicksearch-prefs.patch
new file mode 100644
index 0000000..cec0625
--- /dev/null
+++ b/patches/4.0.10-quicksearch-prefs.patch
@@ -0,0 +1,37 @@
+From 97ee6ca5811e9b68c5c7a3a52b24677a301bf78b Mon Sep 17 00:00:00 2001
+From: Thomas Sibley <trs at bestpractical.com>
+Date: Wed, 27 Feb 2013 17:19:22 -0800
+Subject: [PATCH] Add a callback for modifying the displayed queues on the
+ quicksearch prefs
+
+This also lets the callback skip the ShowTicket rights check or specify
+a different right.
+---
+ share/html/Prefs/Quicksearch.html | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/share/html/Prefs/Quicksearch.html b/share/html/Prefs/Quicksearch.html
+index 02b88ab..93b026f 100644
+--- a/share/html/Prefs/Quicksearch.html
++++ b/share/html/Prefs/Quicksearch.html
+@@ -71,7 +71,16 @@ my $user = $session{'CurrentUser'}->UserObj;
+ my $unwanted = $user->Preferences('QuickSearch', {});
+ my $Queues = RT::Queues->new($session{'CurrentUser'});
+ $Queues->UnLimit;
+-my @queues = grep {$_->CurrentUserHasRight('ShowTicket')} @{$Queues->ItemsArrayRef};
++
++my $right = 'ShowTicket';
++$m->callback(
++    CallbackName    => 'ModifyQueues',
++    Queues          => \$Queues,
++    Right           => \$right,
++    Unwanted        => $unwanted,
++);
++
++my @queues = grep { $right ? $_->CurrentUserHasRight($right) : 1 } @{$Queues->ItemsArrayRef};
+ 
+ if ($ARGS{'Save'}) {
+     for my $queue (@queues) {
+-- 
+1.7.11.3
+

commit 833f926a00b327e6839143537aa6ff9f8c1b2ab1
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Feb 27 17:31:10 2013 -0800

    Add the patch needed by 255217f

diff --git a/patches/4.0.10-quicksearch-links.patch b/patches/4.0.10-quicksearch-links.patch
new file mode 100644
index 0000000..c1b34df
--- /dev/null
+++ b/patches/4.0.10-quicksearch-links.patch
@@ -0,0 +1,187 @@
+From 292dd3bf6fb7371593a8a978868308a1f1cc75d1 Mon Sep 17 00:00:00 2001
+From: Thomas Sibley <trs at bestpractical.com>
+Date: Tue, 26 Feb 2013 18:57:04 -0800
+Subject: [PATCH 1/2] Use a tiny comment to fix vim's syntax highlighting
+
+---
+ share/html/Elements/QueueSummaryByLifecycle | 2 +-
+ share/html/Elements/QueueSummaryByStatus    | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
+index 01514f1..6e5e0cb 100644
+--- a/share/html/Elements/QueueSummaryByLifecycle
++++ b/share/html/Elements/QueueSummaryByLifecycle
+@@ -67,7 +67,7 @@ for my $queue (@queues) {
+ 
+     $i++;
+     my $name = $queue->{Name};
+-    $name =~ s/(['\\])/\\$1/g;
++    $name =~ s/(['\\])/\\$1/g; #'
+     my $queue_cond = "Queue = '$name' AND ";
+     my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", @cur_statuses ) . ')';
+ </%PERL>
+diff --git a/share/html/Elements/QueueSummaryByStatus b/share/html/Elements/QueueSummaryByStatus
+index b843bba..082a5dc 100644
+--- a/share/html/Elements/QueueSummaryByStatus
++++ b/share/html/Elements/QueueSummaryByStatus
+@@ -59,7 +59,7 @@ my $i = 0;
+ for my $queue (@queues) {
+     $i++;
+     my $name = $queue->{Name};
+-    $name =~ s/(['\\])/\\$1/g;
++    $name =~ s/(['\\])/\\$1/g; #'
+     my $queue_cond = "Queue = '$name' AND ";
+     my $lifecycle = $lifecycle{ lc $queue->{'Lifecycle'} };
+     my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", grep $lifecycle->IsValid($_), @statuses ) . ')';
+-- 
+1.7.11.3
+
+
+From 5c0efc3773eaba35d9853fa45691d8c7b506d8b2 Mon Sep 17 00:00:00 2001
+From: Thomas Sibley <trs at bestpractical.com>
+Date: Tue, 26 Feb 2013 19:29:10 -0800
+Subject: [PATCH 2/2] Callbacks for changing the link destinations in the
+ queue summaries
+
+While likely to be used only rarely, these callbacks are very useful for
+extensions which provide a richer "queue dashboard" than the vanilla
+search results normally linked to by the queue summary portlets.
+Without the callbacks, such extensions are forced to overlay the entire
+files just to change some URLs.
+
+The duplication between the two types of queue summaries is unfortunate,
+but large scale refactoring is out of scope for the simple goal of this
+commit.  A future refactoring isn't hampered any by the additional
+duplication.
+---
+ share/html/Elements/QueueSummaryByLifecycle | 33 +++++++++++++++++++++++-----
+ share/html/Elements/QueueSummaryByStatus    | 34 ++++++++++++++++++++++++-----
+ 2 files changed, 55 insertions(+), 12 deletions(-)
+
+diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
+index 6e5e0cb..44d6b5a 100644
+--- a/share/html/Elements/QueueSummaryByLifecycle
++++ b/share/html/Elements/QueueSummaryByLifecycle
+@@ -66,20 +66,16 @@ for my $queue (@queues) {
+     next if lc($queue->{Lifecycle} || '') ne lc $lifecycle->Name;
+ 
+     $i++;
+-    my $name = $queue->{Name};
+-    $name =~ s/(['\\])/\\$1/g; #'
+-    my $queue_cond = "Queue = '$name' AND ";
+-    my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", @cur_statuses ) . ')';
+ </%PERL>
+ <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
+ 
+ <td>
+-    <a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $all_q |u,n %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
++    <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
+ </td>
+ 
+ %   for my $status (@cur_statuses) {
+ <td align="right">
+-    <a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $queue_cond ."Status = '$status'" |u,n %>"><% $data->{$queue->{id}}->{$status } || '-' %></a>
++    <a href="<% $link_status->($queue, $status) %>"><% $data->{$queue->{id}}->{$status } || '-' %></a>
+ </td>
+ %   }
+ </tr>
+@@ -87,6 +83,31 @@ for my $queue (@queues) {
+ </table>
+ % }
+ <%INIT>
++my $build_search_link = sub {
++    my ($queue_name, $extra_query) = @_;
++    $queue_name =~ s/(['\\])/\\$1/g; #'
++
++    return RT->Config->Get('WebPath')
++         . "/Search/Results.html?Query="
++         . $m->interp->apply_escapes("Queue = '$queue_name' AND $extra_query", 'u');
++};
++
++my $link_all = sub {
++    my ($queue, $all_statuses) = @_;
++    return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @$all_statuses).")");
++};
++
++my $link_status = sub {
++    my ($queue, $status) = @_;
++    return $build_search_link->($queue->{Name}, "Status = '$status'");
++};
++
++$m->callback(
++    CallbackName        => 'LinkBuilders',
++    build_search_link   => \$build_search_link,
++    link_all            => \$link_all,
++    link_status         => \$link_status,
++);
+ 
+ my $Queues = RT::Queues->new( $session{'CurrentUser'} );
+ $Queues->UnLimit();
+diff --git a/share/html/Elements/QueueSummaryByStatus b/share/html/Elements/QueueSummaryByStatus
+index 082a5dc..2a8dc53 100644
+--- a/share/html/Elements/QueueSummaryByStatus
++++ b/share/html/Elements/QueueSummaryByStatus
+@@ -58,16 +58,13 @@
+ my $i = 0;
+ for my $queue (@queues) {
+     $i++;
+-    my $name = $queue->{Name};
+-    $name =~ s/(['\\])/\\$1/g; #'
+-    my $queue_cond = "Queue = '$name' AND ";
+     my $lifecycle = $lifecycle{ lc $queue->{'Lifecycle'} };
+-    my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", grep $lifecycle->IsValid($_), @statuses ) . ')';
++    my @queue_statuses = grep { $lifecycle->IsValid($_) } @statuses;
+ </%PERL>
+ <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
+ 
+ <td>
+-    <a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $all_q |u,n %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
++    <a href="<% $link_all->($queue, \@queue_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
+ </td>
+ 
+ <%perl>
+@@ -75,7 +72,7 @@ for my $queue (@queues) {
+    if ( $lifecycle->IsValid( $status ) ) {
+ </%perl>
+ <td align="right">
+-    <a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $queue_cond ."Status = '$status'" |u,n %>"><% $data->{$queue->{id}}->{$status } || '-' %></a>
++    <a href="<% $link_status->($queue, $status) %>"><% $data->{$queue->{id}}->{$status } || '-' %></a>
+ </td>
+ %   } else {
+ <td align="right">-</td>
+@@ -85,6 +82,31 @@ for my $queue (@queues) {
+ % }
+ </table>
+ <%INIT>
++my $build_search_link = sub {
++    my ($queue_name, $extra_query) = @_;
++    $queue_name =~ s/(['\\])/\\$1/g; #'
++
++    return RT->Config->Get('WebPath')
++         . "/Search/Results.html?Query="
++         . $m->interp->apply_escapes("Queue = '$queue_name' AND $extra_query", 'u');
++};
++
++my $link_all = sub {
++    my ($queue, $all_statuses) = @_;
++    return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @$all_statuses).")");
++};
++
++my $link_status = sub {
++    my ($queue, $status) = @_;
++    return $build_search_link->($queue->{Name}, "Status = '$status'");
++};
++
++$m->callback(
++    CallbackName        => 'LinkBuilders',
++    build_search_link   => \$build_search_link,
++    link_all            => \$link_all,
++    link_status         => \$link_status,
++);
+ 
+ my $Queues = RT::Queues->new( $session{'CurrentUser'} );
+ $Queues->UnLimit();
+-- 
+1.7.11.3
+

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



More information about the Bps-public-commit mailing list