1 # $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/Watchers.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
2 # (c) 1996-2000 Jesse Vincent <jesse@fsck.com>
3 # This software is redistributable under the terms of the GNU GPL
7 RT::Watchers - Collection of RT Watcher objects
12 my $watchers = new RT::Watchers($CurrentUser);
13 while (my $watcher = $watchers->Next()) {
14 print $watcher->Id . "is a watcher";
19 This module should never be called directly by client code. it's an internal module which
20 should only be accessed through exported APIs in Ticket, Queue and other similar objects.
27 ok(require RT::TestHarness);
28 ok(require RT::Watchers);
40 require RT::EasySearch;
42 @ISA= qw(RT::EasySearch);
49 $self->{'table'} = "Watchers";
50 $self->{'primary_key'} = "id";
51 return($self->SUPER::_Init(@_));
59 A wrapper around RT::EasySearch::Limit which sets
60 the default entry aggregator to 'AND'
66 my %args = ( ENTRYAGGREGATOR => 'AND',
69 $self->SUPER::Limit(%args);
73 # {{{ sub LimitToTicket
77 Takes a single arg which is a ticket id
78 Limits to watchers of that ticket
85 $self->Limit( ENTRYAGGREGATOR => 'OR',
88 $self->Limit (ENTRYAGGREGATOR => 'AND',
94 # {{{ sub LimitToQueue
98 Takes a single arg, which is a queue id
99 Limits to watchers of that queue.
106 $self->Limit (ENTRYAGGREGATOR => 'OR',
109 $self->Limit (ENTRYAGGREGATOR => 'AND',
115 # {{{ sub LimitToType
119 Takes a single string as its argument. That string is a watcher type
120 which is one of 'Requestor', 'Cc' or 'AdminCc'
121 Limits to watchers of that type
129 $self->Limit(FIELD => 'Type',
134 # {{{ sub LimitToRequestors
136 =head2 LimitToRequestors
138 Limits to watchers of type 'Requestor'
142 sub LimitToRequestors {
144 $self->LimitToType("Requestor");
152 Limits to watchers of type 'Cc'
158 $self->LimitToType("Cc");
162 # {{{ sub LimitToAdminCc
164 =head2 LimitToAdminCc
166 Limits to watchers of type AdminCc
172 $self->LimitToType("AdminCc");
180 # Return a (reference to a) list of emails
186 my @list; # List is a list of watcher email addresses
188 # $watcher is an RT::Watcher object
189 while (my $watcher=$self->Next()) {
190 push(@list, $watcher->Email);
196 # {{{ sub EmailsAsString
198 =head2 EmailsAsString
200 # Returns the RT::Watchers->Emails as a comma seperated string
206 return(join(", ",@{$self->Emails}));
218 my $item = new RT::Watcher($self->CurrentUser);