[Bps-public-commit] r12911 - RT-Extension-rt_cpan_org/html/Elements

ruz at bestpractical.com ruz at bestpractical.com
Thu Jun 5 04:06:16 EDT 2008


Author: ruz
Date: Thu Jun  5 04:06:16 2008
New Revision: 12911

Added:
   RT-Extension-rt_cpan_org/html/Elements/MyBugs

Log:
* add MyBugs portlet that show all tickets the current user own or not owned
  in queues(distributions) where he is AdminCc (maintainer)

Added: RT-Extension-rt_cpan_org/html/Elements/MyBugs
==============================================================================
--- (empty file)
+++ RT-Extension-rt_cpan_org/html/Elements/MyBugs	Thu Jun  5 04:06:16 2008
@@ -0,0 +1,61 @@
+<&|/Elements/TitleBox,
+    title => loc('All my or unowned tickets in my distributions'),
+&>
+<& /Elements/TicketList,
+        Collection     => $tickets,
+        Format         => $Format,
+        OrderBy        => 'Priority',
+        Order          => 'DESC',
+        Rows           => 0,
+        ShowNavigation => 0
+&>
+</&>
+<%ARGS>
+$Format => undef
+</%ARGS>
+<%INIT>
+
+$Format ||= "'<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', Priority, QueueName, ExtendedStatus";
+
+my $base_query =
+    "( Owner = ". $session{'CurrentUser'}->Id ." OR Owner = ". $RT::Nobody->id .")"
+    ." AND ( Status = 'new' OR Status = 'open' OR Status = 'stalled')";
+
+my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
+$tickets->FromSQL( $base_query );
+my $grp_alias = $tickets->Join(
+    ALIAS1 => 'main',
+    FIELD1 => 'Queue',
+    TABLE2 => 'Groups',
+    FIELD2 => 'Instance',
+);
+my $cgm_alias = $tickets->Join(
+    ALIAS1 => $grp_alias,
+    FIELD1 => 'id',
+    TABLE2 => 'CachedGroupMembers',
+    FIELD2 => 'GroupId',
+);
+$tickets->_OpenParen;
+$tickets->_SQLLimit(
+    ENTRYAGGREGATOR => 'AND',
+    ALIAS           => $grp_alias,
+    FIELD           => 'Domain',
+    OPERATOR        => '=',
+    VALUE           => 'RT::Queue-Role',
+);
+$tickets->_SQLLimit(
+    ENTRYAGGREGATOR => 'AND',
+    ALIAS           => $grp_alias,
+    FIELD           => 'Type',
+    OPERATOR        => '=',
+    VALUE           => 'AdminCc',
+);
+$tickets->_SQLLimit(
+    ENTRYAGGREGATOR => 'AND',
+    ALIAS           => $cgm_alias,
+    FIELD           => 'MemberId',
+    OPERATOR        => '=',
+    VALUE           => $session{'CurrentUser'}->id,
+);
+$tickets->_CloseParen;
+</%INIT>



More information about the Bps-public-commit mailing list