[rt-users] CONTRIB: MyQueues v0.0.2

Jim Meyer purp at wildbrain.com
Thu Feb 7 22:17:54 EST 2002


Howdy again!

As Ryan Morben was kind enough to point out, MyQueues was showing all
queues to anyone who wasn't a watcher on any queue. Further poking at it
also taught me that I don't know as much about how Queue->IsWatcher() as
I thought I did. I didn't spot this myself as there aren't any queues
here I don't watch...more's the pity.

However, an hour of learning enabled me to figure out a hack to solve
the problem while I go learn more about Queue->IsWatcher(). I've tested
this one on a couple of people who watch fewer queues than I do, and
it's working. Really. =]

It also notes in the title of the box how many queues you're watching; I
toyed with having it be invisible if you watch no queues, but I decided
that since MyTickets and MyRequests show up even if empty, it made more
sense to follow that behavior.

Anyway, enjoy!

--j

On Thu, 2002-02-07 at 12:29, Jim Meyer wrote:
> Howdy!
> 
> In line with the MyTickets and MyRequests portions of WebRT, here's a
> MyQueues module which displays the 25 highest priority unclaimed (e.g.
> owned by Nobody) tickets in all queues that the current user is a
> watcher on.
> 
> To use this module:
> 
> * Copy it into your RT dir under WebRT/html/Elements/MyQueues.pm
> * Add it to your WebRT/html/index.html:
> 
>   <TD WIDTH=70%>
>   <& /Elements/CustomHomepageHeader, %ARGS &>
>   <& /Elements/MyTickets &>
>   <BR>
> + <& /Elements/MyQueues &>
> + <BR>
>   <& /Elements/MyRequests &>
>   </TD>
>   <TD>
> 
> And it should just work. =]
> 
> Enjoy!
> 
> --j
> -- 
> Jim Meyer, Geek At Large                              purp at wildbrain.com
> 
> 
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
-- 
Jim Meyer, Geek At Large                              purp at wildbrain.com
-------------- next part --------------
<!-- MyQueues v0.0.2, 2002.02.07, purp at wildbrain.com -->
<& /Elements/TitleBoxStart, title => "25 highest priority unclaimed tickets in the $queueCount queue(s) I watch..." &>
% if ($queueCount > 0) {
<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
<TR>
<TH ALIGN=RIGHT>#</TH>
<TH ALIGN=LEFT>Subject</TH>
<TH ALIGN=LEFT>Queue</TH>
<TH ALIGN=LEFT>Status</TH>
<TH ALIGN=LEFT> </TH>
</TR>
% while (my $Ticket = $Tickets->Next) {
<TR>
<TD ALIGN=RIGHT>
<%$Ticket->Id%>
</TD>
<TD>
<A HREF="<% $RT::WebPath %>/Ticket/Display.html?id=<%$Ticket->Id%>">
<%$Ticket->Subject || '[no subject]'%>
</A>
</TD>
<TD>
<%$Ticket->QueueObj->Name%>
</TD><TD>
<%$Ticket->Status%>
</TD>
<TD ALIGN=RIGHT>
[<A HREF="<% $RT::WebPath %>/Ticket/Display.html?id=<%$Ticket->Id%>&Action=Take&Status=open">Take</A>]
</TD>
<TD ALIGN=RIGHT>
[<A HREF="<% $RT::WebPath %>/Ticket/Update.html?Action=Respond&DefaultStatus=resolved&id=<%$Ticket->Id%>">Resolve</A>]
</TD>
</TR>
% }
</TABLE>
% }
<& /Elements/TitleBoxEnd &>


<%INIT>
my $userEmail = $session{'CurrentUser'}->EmailAddress;
my $queueCount = 0;
my $Queues = new RT::Queues($session{'CurrentUser'});
$Queues->UnLimit();

my $Tickets = new RT::Tickets ($session{'CurrentUser'});
$Tickets->ClearRestrictions;                                           
$Tickets->LimitOwner(VALUE => "Nobody");
$Tickets->LimitStatus(VALUE => "resolved", OPERATOR => '!=');
$Tickets->LimitStatus(VALUE => "dead", OPERATOR => '!=');

while (my $queue = $Queues->Next) {
		 my $watcherEmails = $queue->Watchers()->EmailsAsString();
     next if $watcherEmails !~ /\b$userEmail/;
     $queueCount++;
     $Tickets->LimitQueue(VALUE => $queue->id);          
}

$Tickets->OrderBy(FIELD => 'Priority', ORDER => 'DESC');
$Tickets->RowsPerPage(25);
</%INIT>


More information about the rt-users mailing list