[Bps-public-commit] r20176 - in RT-BugTracker/html/Dist: .

ruz at bestpractical.com ruz at bestpractical.com
Wed Dec 2 03:01:34 EST 2009


Author: ruz
Date: Wed Dec  2 03:01:34 2009
New Revision: 20176

Added:
   RT-BugTracker/html/Dist/Elements/BeginsWith
Modified:
   RT-BugTracker/html/Dist/BeginsWith.html

Log:
* borrow new BeginsWith implementation out of BT-Public

Modified: RT-BugTracker/html/Dist/BeginsWith.html
==============================================================================
--- RT-BugTracker/html/Dist/BeginsWith.html	(original)
+++ RT-BugTracker/html/Dist/BeginsWith.html	Wed Dec  2 03:01:34 2009
@@ -45,18 +45,25 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-<& /Elements/Header, Title => loc("Distributions starting with [_1]", $Name) &>
+<& /Elements/Header, Title => $title &>
 <& /Dist/Elements/Tabs,
-    Title => loc("Distributions starting with [_1]", $Name),
+    Title => $title,
     current_tab => 'Dist/Browse.html',
-    &>
+&>
 
-<& /Dist/Elements/DistributionList, queues => $queues &>
+<& /Dist/Elements/BeginsWith, Name => $Name &>
+
+% if ( $queues ) {
+<& /Public/Elements/DistributionList, queues => $queues &>
+% }
 
 <%init>
-my $queues = RT::Queues->new($session{CurrentUser});
 
-$queues->Limit(FIELD => 'Name', VALUE => $Name, OPERATOR => 'STARTSWITH');
+my ($queues, $title) = $m->comp(
+    '/Dist/Elements/BeginsWith:Process',
+    Name => $Name,
+);
+
 </%init>
 <%args>
 $Name => undef

Added: RT-BugTracker/html/Dist/Elements/BeginsWith
==============================================================================
--- (empty file)
+++ RT-BugTracker/html/Dist/Elements/BeginsWith	Wed Dec  2 03:01:34 2009
@@ -0,0 +1,37 @@
+<form action="<% RT->Config->Get('WebPath') %><% $m->request_path %>" method="GET">
+<p>
+<% loc('First letter is') %>
+% for my $letter ("A".."Z") {
+<a href="<% $RT::WebPath %><% $m->request_path %>?Name=<% $letter %>">
+<% $letter eq $Name ? "<strong>$letter</strong>" : $letter |n %>
+</a>
+% }
+ <% loc('or prefix is') %> <input type="text" name="Name" value="<% length($Name) > 1? $Name : '' %>" />
+</p>
+</form>
+<%ARGS>
+$Name => undef
+</%ARGS>
+<%INIT>
+$Name = '' unless defined $Name;
+</%INIT>
+
+<%METHOD Process>
+<%ARGS>
+$Name => undef
+</%ARGS>
+<%INIT>
+return (undef, loc("Browse Distributions"))
+    unless defined $Name && length $Name;
+
+
+my $queues = RT::Queues->new( $session{CurrentUser} );
+$queues->Limit(
+    FIELD => 'Name',
+    OPERATOR => 'STARTSWITH',
+    VALUE => $Name,
+);
+return ( $queues, loc("Distributions starting with '[_1]'", $Name) );
+</%INIT>
+</%METHOD>
+



More information about the Bps-public-commit mailing list