[Rt-commit] rt branch, 4.2/user-ticket-list-refactor, created. rt-4.1.6-290-g65e0ca7

Kevin Falcone falcone at bestpractical.com
Thu Feb 28 18:38:08 EST 2013


The branch, 4.2/user-ticket-list-refactor has been created
        at  65e0ca7ab99a4a8517729f926ed95bcefa93db96 (commit)

- Log -----------------------------------------------------------------
commit f2c481f0c3501acfac3c702a67ec1718009cda0e
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 28 13:12:40 2013 -0500

    Refactor ShowRequestorTickets
    
    This starts to convert it to be a generic "Tickets related to a
    user" list.  Aside from the copy, it changes:
        Title passed in
        renames the Requestor argument to User
        Changes the default search to Watcher rather than Requestor

diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTickets
index 9a62530..a301e30 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTickets
@@ -45,53 +45,15 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<span class="label"><a href="<% $url %>"><% $title %>:</a></span>
-
-<& /Elements/CollectionList,
-    %QueryProperties,
-
-    Class          => 'RT::Tickets',
-    Page           => 1,
-    AllowSorting   => 0,
-    ShowNavigation => 0,
+<& /User/Elements/TicketList,
+    User => $Requestor,
+    conditions => $conditions,
+    Rows => $Rows,
+    Title => $Title,
+    WatcherTypes => ['Requestor'],
 &>
 <%INIT>
-
-my $title = loc("This user's [_1] highest priority [_2] tickets", $Rows, $Description );
-
-my $sql = "Requestor.id = ". $Requestor->id;
-if (@$conditions) {
-    $sql .= " AND (".join( " OR ", map $_->{cond}, @$conditions).")";
-}
-
-my %QueryProperties = (
-    Query      => $sql,
-    OrderBy    => 'Priority',
-    Order      => 'DESC',
-    Rows       => $Rows || 10,
-    ShowHeader => 0,
-    Format     => qq{
-       '<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>',
-       '(__OwnerName__)',
-       '<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>',
-       __Status__
-    },
-);
-
-my $url  = RT->Config->Get('WebPath') . '/Search/Results.html?';
-   $url .= $m->comp('/Elements/QueryString',
-                    Query       => $QueryProperties{'Query'},
-                    OrderBy     => $QueryProperties{'OrderBy'},
-                    Order       => $QueryProperties{'Order'},
-           );
-
-$m->callback(
-    %ARGS,
-
-    Title           => \$title,
-    QueryProperties => \%QueryProperties,
-);
-
+my $Title = loc("This user's [_1] highest priority [_2] tickets", $Rows, $Description );
 </%INIT>
 <%ARGS>
 $Requestor => undef
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/User/Elements/TicketList
similarity index 92%
copy from share/html/Ticket/Elements/ShowRequestorTickets
copy to share/html/User/Elements/TicketList
index 9a62530..e430b54 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/User/Elements/TicketList
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<span class="label"><a href="<% $url %>"><% $title %>:</a></span>
+<span class="label"><a href="<% $url %>"><% $Title %>:</a></span>
 
 <& /Elements/CollectionList,
     %QueryProperties,
@@ -57,9 +57,12 @@
 &>
 <%INIT>
 
-my $title = loc("This user's [_1] highest priority [_2] tickets", $Rows, $Description );
+my $sql = '';
+
+$sql = join(' OR ', map { "$_.id = ".$User->Id } @WatcherTypes );
+$sql = "( $sql )";
+
 
-my $sql = "Requestor.id = ". $Requestor->id;
 if (@$conditions) {
     $sql .= " AND (".join( " OR ", map $_->{cond}, @$conditions).")";
 }
@@ -88,13 +91,15 @@ my $url  = RT->Config->Get('WebPath') . '/Search/Results.html?';
 $m->callback(
     %ARGS,
 
-    Title           => \$title,
+    Title => \$Title,
     QueryProperties => \%QueryProperties,
 );
 
 </%INIT>
 <%ARGS>
-$Requestor => undef
+$Title => ''
+ at WatcherTypes => (qw(Watcher))
+$User => undef
 $conditions
 $Rows => 10
 $Description => ''

commit b9fadf56428f1ce00c22817168309507789a1249
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 28 13:40:53 2013 -0500

    Rename a callback we added to master in 225eb0970a85
    
    This pushes the title modification part of it up into
    ShowRequestorTickets and gives a name to the remaining QueryProperty
    callback in TicketList

diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTickets
index a301e30..4f5832e 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTickets
@@ -54,6 +54,11 @@
 &>
 <%INIT>
 my $Title = loc("This user's [_1] highest priority [_2] tickets", $Rows, $Description );
+
+$m->callback( CallbackName => 'ModifyTitle',
+    %ARGS,
+    Title => \$Title
+);
 </%INIT>
 <%ARGS>
 $Requestor => undef
diff --git a/share/html/User/Elements/TicketList b/share/html/User/Elements/TicketList
index e430b54..270a7dc 100644
--- a/share/html/User/Elements/TicketList
+++ b/share/html/User/Elements/TicketList
@@ -62,7 +62,6 @@ my $sql = '';
 $sql = join(' OR ', map { "$_.id = ".$User->Id } @WatcherTypes );
 $sql = "( $sql )";
 
-
 if (@$conditions) {
     $sql .= " AND (".join( " OR ", map $_->{cond}, @$conditions).")";
 }
@@ -88,10 +87,8 @@ my $url  = RT->Config->Get('WebPath') . '/Search/Results.html?';
                     Order       => $QueryProperties{'Order'},
            );
 
-$m->callback(
+$m->callback( CallbackName => 'ModifyQueryProperties',
     %ARGS,
-
-    Title => \$Title,
     QueryProperties => \%QueryProperties,
 );
 

commit 46ddd271b5d430b2b29af7bcd16a3f2fb734ffa8
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 28 15:32:15 2013 -0500

    Allow extensions to modify what kind and which Users we search for.
    
    This also allows some arbitrary FromSQL frobbing if you really want it.

diff --git a/share/html/User/Elements/TicketList b/share/html/User/Elements/TicketList
index 270a7dc..b073cde 100644
--- a/share/html/User/Elements/TicketList
+++ b/share/html/User/Elements/TicketList
@@ -62,6 +62,11 @@ my $sql = '';
 $sql = join(' OR ', map { "$_.id = ".$User->Id } @WatcherTypes );
 $sql = "( $sql )";
 
+$m->callback( CallbackName => 'ModifyWatcherSQL',
+        %ARGS,
+        sql => \$sql,
+);
+
 if (@$conditions) {
     $sql .= " AND (".join( " OR ", map $_->{cond}, @$conditions).")";
 }

commit d311f41e55559d5d1b0e4c414049835360920dec
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 28 16:09:44 2013 -0500

    Allow the ticket list to optionally be in a Title Box

diff --git a/share/html/User/Elements/TicketList b/share/html/User/Elements/TicketList
index b073cde..b867dd7 100644
--- a/share/html/User/Elements/TicketList
+++ b/share/html/User/Elements/TicketList
@@ -45,7 +45,11 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<span class="label"><a href="<% $url %>"><% $Title %>:</a></span>
+% if ( $TitleBox ) {
+    <& /Widgets/TitleBoxStart, title => $Title, title_href => $url, &>
+% } else {
+    <span class="label"><a href="<% $url %>"><% $Title %>:</a></span>
+% }
 
 <& /Elements/CollectionList,
     %QueryProperties,
@@ -55,6 +59,10 @@
     AllowSorting   => 0,
     ShowNavigation => 0,
 &>
+
+% if ( $TitleBox ) {
+    <& /Widgets/TitleBoxEnd &>
+% }
 <%INIT>
 
 my $sql = '';
@@ -105,4 +113,5 @@ $User => undef
 $conditions
 $Rows => 10
 $Description => ''
+$TitleBox => 0
 </%ARGS>

commit 65e0ca7ab99a4a8517729f926ed95bcefa93db96
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 28 18:06:59 2013 -0500

    Pull format out into MoreAboutRequestorTicketListFormat
    
    This lets you reformat your More About Requestor lists from the config
    file.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 42a812d..833c768 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1266,6 +1266,20 @@ Ticket/Display.html.  This option can be controlled by users also.
 
 Set($MoreAboutRequestorTicketList, "Active");
 
+=item C<$MoreAboutRequestorTicketListFormat>
+
+Control the appearance of the ticket lists in the 'More About Requestors' box.
+
+=cut
+
+Set($MoreAboutRequestorTicketListFormat, q{
+       '<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>',
+       '(__OwnerName__)',
+       '<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>',
+       '__Status__',
+});
+
+
 =item C<$MoreAboutRequestorExtraInfo>
 
 By default, the 'More about requestor' box on Ticket/Display.html
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTickets
index 4f5832e..19aeb7d 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTickets
@@ -51,7 +51,8 @@
     Rows => $Rows,
     Title => $Title,
     WatcherTypes => ['Requestor'],
-&>
+    Format =>  => RT->Config->Get('MoreAboutRequestorTicketListFormat'),
+ &>
 <%INIT>
 my $Title = loc("This user's [_1] highest priority [_2] tickets", $Rows, $Description );
 
diff --git a/share/html/User/Elements/TicketList b/share/html/User/Elements/TicketList
index b867dd7..652a16f 100644
--- a/share/html/User/Elements/TicketList
+++ b/share/html/User/Elements/TicketList
@@ -85,12 +85,7 @@ my %QueryProperties = (
     Order      => 'DESC',
     Rows       => $Rows || 10,
     ShowHeader => 0,
-    Format     => qq{
-       '<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>',
-       '(__OwnerName__)',
-       '<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>',
-       __Status__
-    },
+    Format     => $Format,
 );
 
 my $url  = RT->Config->Get('WebPath') . '/Search/Results.html?';
@@ -114,4 +109,5 @@ $conditions
 $Rows => 10
 $Description => ''
 $TitleBox => 0
+$Format => ''
 </%ARGS>

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


More information about the Rt-commit mailing list