summaryrefslogtreecommitdiff
path: root/rt/lib
diff options
context:
space:
mode:
authorcvs2git <cvs2git>2002-08-12 06:17:10 +0000
committercvs2git <cvs2git>2002-08-12 06:17:10 +0000
commit160be29a0dc62e79a4fb95d2ab8c0c7e5996760e (patch)
tree94ebadb17321b138fd7bfd9a5c379eec97c5d328 /rt/lib
parent3ef62a0570055da710328937e7f65dbb2c027c62 (diff)
This commit was manufactured by cvs2svn to create branch 'BESTPRACTICAL'.
Diffstat (limited to 'rt/lib')
-rw-r--r--rt/lib/MANIFEST57
-rw-r--r--rt/lib/MANIFEST.SKIP1
-rw-r--r--rt/lib/Makefile.PL49
-rw-r--r--rt/lib/RT/Action/OpenDependent.pm55
-rwxr-xr-xrt/lib/RT/Action/SendPasswordEmail.pm170
-rw-r--r--rt/lib/RT/Action/StallDependent.pm68
-rw-r--r--rt/lib/RT/Condition/NewDependency.pm0
-rwxr-xr-xrt/lib/RT/EasySearch.pm115
-rw-r--r--rt/lib/RT/Keyword.pm446
-rw-r--r--rt/lib/RT/KeywordSelect.pm452
-rw-r--r--rt/lib/RT/KeywordSelects.pm143
-rw-r--r--rt/lib/RT/Keywords.pm106
-rw-r--r--rt/lib/RT/ObjectKeyword.pm192
-rw-r--r--rt/lib/RT/ObjectKeywords.pm234
-rw-r--r--rt/lib/RT/TestHarness.pm14
-rwxr-xr-xrt/lib/RT/Watcher.pm313
-rwxr-xr-xrt/lib/RT/Watchers.pm226
-rw-r--r--rt/lib/test.pl52
18 files changed, 0 insertions, 2693 deletions
diff --git a/rt/lib/MANIFEST b/rt/lib/MANIFEST
deleted file mode 100644
index cda386b..0000000
--- a/rt/lib/MANIFEST
+++ /dev/null
@@ -1,57 +0,0 @@
-MANIFEST
-MANIFEST.SKIP
-Makefile.PL
-RT.pm
-test.pl
-RT/ACE.pm
-RT/ACL.pm
-RT/Action/Generic.pm
-RT/Action/NotifyAsComment.pm
-RT/Action/OpenDependent.pm
-RT/Action/SendEmail.pm
-RT/Action/StallDependent.pm
-RT/Action/Notify.pm
-RT/Action/ResolveMembers.pm
-RT/Attachment.pm
-RT/Attachments.pm
-RT/Condition/AnyTransaction.pm
-RT/Condition/Generic.pm
-RT/Condition/NewDependency.pm
-RT/CurrentUser.pm
-RT/Date.pm
-RT/EasySearch.pm
-RT/Group.pm
-RT/GroupMember.pm
-RT/GroupMembers.pm
-RT/Groups.pm
-RT/Handle.pm
-RT/Interface/CLI.pm
-RT/Interface/Email.pm
-RT/Interface/Web.pm
-RT/Keyword.pm
-RT/Keywords.pm
-RT/KeywordSelect.pm
-RT/KeywordSelects.pm
-RT/Link.pm
-RT/Links.pm
-RT/ObjectKeyword.pm
-RT/ObjectKeywords.pm
-RT/Queue.pm
-RT/Queues.pm
-RT/Record.pm
-RT/Scrip.pm
-RT/Scrips.pm
-RT/ScripAction.pm
-RT/ScripActions.pm
-RT/ScripCondition.pm
-RT/ScripConditions.pm
-RT/Template.pm
-RT/Templates.pm
-RT/Ticket.pm
-RT/Tickets.pm
-RT/Transaction.pm
-RT/Transactions.pm
-RT/User.pm
-RT/Users.pm
-RT/Watcher.pm
-RT/Watchers.pm
diff --git a/rt/lib/MANIFEST.SKIP b/rt/lib/MANIFEST.SKIP
deleted file mode 100644
index ae335e7..0000000
--- a/rt/lib/MANIFEST.SKIP
+++ /dev/null
@@ -1 +0,0 @@
-CVS/
diff --git a/rt/lib/Makefile.PL b/rt/lib/Makefile.PL
deleted file mode 100644
index c0e1af2..0000000
--- a/rt/lib/Makefile.PL
+++ /dev/null
@@ -1,49 +0,0 @@
-use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-WriteMakefile(
- 'NAME' => 'RT',
- 'VERSION_FROM' => 'RT.pm', # finds $VERSION
- 'PREREQ_PM' => {
- 'DBI' => 1.16,
- 'DBIx::SearchBuilder' => '0.48',
- 'Date::Parse' => 0,
- 'Date::Format' => 0,
- 'MIME::Entity' => 5.108,
- 'Mail::Mailer' => '1.20',
- 'Log::Dispatch' => 1.6,
- 'HTML::Entities' => 0,
- 'Text::Wrapper' => 0,
- 'Text::Template' => 0,
- 'Getopt::Long' => 2.24,
- },
-);
-
- {
- package MY;
- sub top_targets {
- my($self) = @_;
- my $out = "POD2TEST_EXE = pod2test\n";
-
- $out .= $self->SUPER::top_targets(@_);
- # $out =~ s/^(pure_all\b.*)/$1 testifypods/m;
-
- $out .= "\n\ntestifypods : \n";
-
- my @pods = (keys %{$self->{MAN1PODS}},
- keys %{$self->{MAN3PODS}});
-
- foreach my $pod (@pods) {
- (my $test = $pod) =~ s/\.(pm|pod)$//;
- $test =~ s/^lib\W//;
- $test =~ s/\W/-/;
- $test =~ s/\//__/g;
- $test = "autogen-$test.t";
- $out .= "\t$self->{NOECHO}\$(POD2TEST_EXE) ".
- "$pod t/$test \n";
- }
-
- return $out;
- }
- }
-
diff --git a/rt/lib/RT/Action/OpenDependent.pm b/rt/lib/RT/Action/OpenDependent.pm
deleted file mode 100644
index b271e47..0000000
--- a/rt/lib/RT/Action/OpenDependent.pm
+++ /dev/null
@@ -1,55 +0,0 @@
-# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Attic/OpenDependent.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-# This Action will open the BASE if a dependent is resolved.
-
-package RT::Action::OpenDependent;
-require RT::Action::Generic;
-require RT::Links;
-@ISA=qw(RT::Action::Generic);
-
-#Do what we need to do and send it out.
-
-#What does this type of Action does
-
-# {{{ sub Describe
-sub Describe {
- my $self = shift;
- return (ref $self . " will stall a [local] BASE if it's open and a dependency link is created.");
-}
-# }}}
-
-
-# {{{ sub Prepare
-sub Prepare {
- # nothing to prepare
- return 1;
-}
-# }}}
-
-sub Commit {
- my $self = shift;
-
- my $Links=RT::Links->new($RT::SystemUser);
- $Links->Limit(FIELD => 'Type', VALUE => 'DependsOn');
- $Links->Limit(FIELD => 'Target', VALUE => $self->TicketObj->id);
-
- while (my $Link=$Links->Next()) {
- next unless $Link->BaseIsLocal;
- my $base=RT::Ticket->new($self->TicketObj->CurrentUser);
- # Todo: Only work if Base is a plain ticket num:
- $base->Load($Link->Base);
- $base->Open if $base->Status eq 'stalled';
- }
-}
-
-
-# Applicability checked in Commit.
-
-# {{{ sub IsApplicable
-sub IsApplicable {
- my $self = shift;
- 1;
- return 1;
-}
-# }}}
-
-1;
diff --git a/rt/lib/RT/Action/SendPasswordEmail.pm b/rt/lib/RT/Action/SendPasswordEmail.pm
deleted file mode 100755
index 91bb3c1..0000000
--- a/rt/lib/RT/Action/SendPasswordEmail.pm
+++ /dev/null
@@ -1,170 +0,0 @@
-# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Attic/SendPasswordEmail.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-# Copyright 2001 Jesse Vincent <jesse@fsck.com>
-# Released under the terms of the GNU Public License
-
-package RT::Action::SendPasswordEmail;
-require RT::Action::Generic;
-
-@ISA = qw(RT::Action::Generic);
-
-
-=head1 NAME
-
- RT::Action::SendGenericEmail - An Action which users can use to send mail
- or can subclassed for more specialized mail sending behavior.
-
-
-
-=head1 SYNOPSIS
-
- require RT::Action::SendPasswordEmail;
-
-
-=head1 DESCRIPTION
-
-Basically, you create another module RT::Action::YourAction which ISA
-RT::Action::SendEmail.
-
-If you want to set the recipients of the mail to something other than
-the addresses mentioned in the To, Cc, Bcc and headers in
-the template, you should subclass RT::Action::SendEmail and override
-either the SetRecipients method or the SetTo, SetCc, etc methods (see
-the comments for the SetRecipients sub).
-
-
-=begin testing
-
-ok (require RT::TestHarness);
-ok (require RT::Action::SendPasswordEmail);
-
-=end testing
-
-
-=head1 AUTHOR
-
-Jesse Vincent <jesse@bestpractical.com>
-
-=head1 SEE ALSO
-
-perl(1).
-
-=cut
-
-# {{{ Scrip methods (_Init, Commit, Prepare, IsApplicable)
-
-# {{{ sub Commit
-
-#Do what we need to do and send it out.
-
-sub Commit {
- my $self = shift;
- #send the email
-
-
-
-
-
- my $MIMEObj = $self->TemplateObj->MIMEObj;
-
-
- $MIMEObj->make_singlepart;
-
- #If we don\'t have any recipients to send to, don\'t send a message;
- unless ($MIMEObj->head->get('To')) {
- $RT::Logger->debug("$self: No recipients found. Not sending.\n");
- return(1);
- }
-
- if ($RT::MailCommand eq 'sendmailpipe') {
- open (MAIL, "|$RT::SendmailPath $RT::SendmailArguments") || return(0);
- print MAIL $MIMEObj->as_string;
- close(MAIL);
- }
- else {
- unless ($MIMEObj->send($RT::MailCommand, $RT::MailParams)) {
- $RT::Logger->crit("$self: Could not send mail for ".
- $self->TransactionObj . "\n");
- return(0);
- }
- }
-
- return (1);
-
-}
-# }}}
-
-# {{{ sub Prepare
-
-sub Prepare {
- my $self = shift;
-
- # This actually populates the MIME::Entity fields in the Template Object
-
- unless ($self->TemplateObj) {
- $RT::Logger->warning("No template object handed to $self\n");
- }
-
-
- unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {
- $self->SetHeader('Reply-To',$RT::CorrespondAddress );
- }
-
-
- $self->SetHeader('Precedence', "bulk");
- $self->SetHeader('X-RT-Loop-Prevention', $RT::rtname);
- $self->SetHeader
- ('Managed-by',"Request Tracker $RT::VERSION (http://www.fsck.com/projects/rt/)");
-
- $self->TemplateObj->Parse(Argument => $self->Argument);
-
-
- return 1;
-}
-
-# }}}
-
-# }}}
-
-
-# {{{ sub SetTo
-
-=head2 SetTo EMAIL
-
-Sets this message's "To" field to EMAIL
-
-=cut
-
-sub SetTo {
- my $self = shift;
- my $to = shift;
- $self->SetHeader('To',$to);
-}
-
-# }}}
-
-# {{{ sub SetHeader
-
-sub SetHeader {
- my $self = shift;
- my $field = shift;
- my $val = shift;
-
- chomp $val;
- chomp $field;
- $self->TemplateObj->MIMEObj->head->fold_length($field,10000);
- $self->TemplateObj->MIMEObj->head->add($field, $val);
- return $self->TemplateObj->MIMEObj->head->get($field);
-}
-
-# }}}
-
-
-
-__END__
-
-# {{{ POD
-
-# }}}
-
-1;
-
diff --git a/rt/lib/RT/Action/StallDependent.pm b/rt/lib/RT/Action/StallDependent.pm
deleted file mode 100644
index 09d3448..0000000
--- a/rt/lib/RT/Action/StallDependent.pm
+++ /dev/null
@@ -1,68 +0,0 @@
-# This Action will stall the BASE if a dependency or membership link
-# (according to argument) is created and if BASE is open.
-
-# TODO: Rename this .pm
-
-package RT::Action::StallDependent;
-require RT::Action::Generic;
-@ISA=qw|RT::Action::Generic|;
-
-# {{{ sub Describe
-sub Describe {
- my $self = shift;
- return (ref $self . " will stall a [local] BASE if it's dependent [or member] of a linked up request.");
-}
-# }}}
-
-
-# {{{ sub Prepare
-sub Prepare {
- # nothing to prepare
- return 1;
-}
-# }}}
-
-sub Commit {
- my $self = shift;
- # Find all Dependent
- my $arg=$self->Argument || "DependsOn";
- unless ($self->TransactionObj->Data =~ /^([^ ]+) $arg /) {
- warn; return 0;
- }
- my $base_id=$1;
- my $base;
- if ($1 eq "THIS") {
- $base=$self->TicketObj;
- } else {
- $base_id=&RT::Link::_IsLocal(undef, $base_id) || return 0;
- $base=RT::Ticket->new($self->TicketObj->CurrentUser);
- $base->Load($base_id);
- }
- $base->Stall if $base->Status eq 'open';
- return 0;
-}
-
-
-# {{{ sub IsApplicable
-
-# Only applicable if:
-# 1. the link action is a dependency
-# 2. BASE is a local ticket
-
-sub IsApplicable {
- my $self = shift;
-
- my $arg=$self->Argument || "DependsOn";
-
- # 1:
- $self->TransactionObj->Data =~ /^([^ ]*) $arg / || return 0;
-
- # 2:
- # (dirty!)
- &RT::Link::_IsLocal(undef,$1) || return 0;
-
- return 1;
-}
-# }}}
-
-1;
diff --git a/rt/lib/RT/Condition/NewDependency.pm b/rt/lib/RT/Condition/NewDependency.pm
deleted file mode 100644
index e69de29..0000000
--- a/rt/lib/RT/Condition/NewDependency.pm
+++ /dev/null
diff --git a/rt/lib/RT/EasySearch.pm b/rt/lib/RT/EasySearch.pm
deleted file mode 100755
index bcbfa01..0000000
--- a/rt/lib/RT/EasySearch.pm
+++ /dev/null
@@ -1,115 +0,0 @@
-#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/EasySearch.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-
-=head1 NAME
-
- RT::EasySearch - a baseclass for RT collection objects
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-
-=head1 METHODS
-
-
-=begin testing
-
-ok (require RT::EasySearch);
-
-=end testing
-
-
-=cut
-
-package RT::EasySearch;
-use DBIx::SearchBuilder;
-@ISA= qw(DBIx::SearchBuilder);
-
-# {{{ sub _Init
-sub _Init {
- my $self = shift;
-
- $self->{'user'} = shift;
- unless(defined($self->CurrentUser)) {
- use Carp;
- Carp::confess("$self was created without a CurrentUser");
- $RT::Logger->err("$self was created without a CurrentUser\n");
- return(0);
- }
- $self->SUPER::_Init( 'Handle' => $RT::Handle);
-}
-# }}}
-
-# {{{ sub LimitToEnabled
-
-=head2 LimitToEnabled
-
-Only find items that haven\'t been disabled
-
-=cut
-
-sub LimitToEnabled {
- my $self = shift;
-
- $self->Limit( FIELD => 'Disabled',
- VALUE => '0',
- OPERATOR => '=' );
-}
-# }}}
-
-# {{{ sub LimitToDisabled
-
-=head2 LimitToDeleted
-
-Only find items that have been deleted.
-
-=cut
-
-sub LimitToDeleted {
- my $self = shift;
-
- $self->{'find_disabled_rows'} = 1;
- $self->Limit( FIELD => 'Disabled',
- OPERATOR => '=',
- VALUE => '1'
- );
-}
-# }}}
-
-
-# {{{ sub Limit
-
-=head2 Limit PARAMHASH
-
-This Limit sub calls SUPER::Limit, but defaults "CASESENSITIVE" to 1, thus
-making sure that by default lots of things don't do extra work trying to
-match lower(colname) agaist lc($val);
-
-=cut
-
-sub Limit {
- my $self = shift;
- my %args = ( CASESENSITIVE => 1,
- @_ );
-
- return $self->SUPER::Limit(%args);
-}
-
-# {{{ sub CurrentUser
-
-=head2 CurrentUser
-
- Returns the current user as an RT::User object.
-
-=cut
-
-sub CurrentUser {
- my $self = shift;
- return ($self->{'user'});
-}
-# }}}
-
-
-1;
-
-
diff --git a/rt/lib/RT/Keyword.pm b/rt/lib/RT/Keyword.pm
deleted file mode 100644
index a41e0a5..0000000
--- a/rt/lib/RT/Keyword.pm
+++ /dev/null
@@ -1,446 +0,0 @@
-#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/Keyword.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-
-=head1 NAME
-
- RT::Keyword - Manipulate an RT::Keyword record
-
-=head1 SYNOPSIS
-
- use RT::Keyword;
-
- my $keyword = RT::Keyword->new($CurrentUser);
- $keyword->Create( Name => 'tofu',
- Description => 'fermented soy beans',
- );
-
-
- my $keyword2 = RT::Keyword->new($CurrentUser);
- $keyword2->Create( Name => 'beast',
- Description => 'a wild animal',
- Parent => $keyword->id(),
- );
-
-=head1 DESCRIPTION
-
-An B<RT::Keyword> object is an arbitrary string.
-
-=head1 METHODS
-
-=begin testing
-
-ok (require RT::TestHarness);
-ok (require RT::Scrip);
-
-=end testing
-
-
-=cut
-package RT::Keyword;
-
-use strict;
-use vars qw(@ISA);
-use Tie::IxHash;
-use RT::Record;
-use RT::Keywords;
-
-@ISA = qw(RT::Record);
-
-# {{{ Core methods
-
-sub _Init {
- my $self = shift;
- $self->{'table'} = "Keywords";
- $self->SUPER::_Init(@_);
-}
-
-sub _Accessible {
- my $self = shift;
- my %cols = (
- Name => 'read/write', #the keyword itself
- Description => 'read/write', #a description of the keyword
- Parent => 'read/write', #optional id of another B<RT::Keyword>, allowing keywords to be arranged hierarchically
- Disabled => 'read/write'
- );
- return ($self->SUPER::_Accessible( @_, %cols));
-
-}
-
-# }}}
-
-
-=over 4
-
-=item new CURRENT_USER
-
-Takes a single argument, an RT::CurrentUser object. Instantiates a new
-(uncreated) RT::Keyword object.
-
-=cut
-
-# {{{ sub Create
-
-=item Create KEY => VALUE, ...
-
-Takes a list of key/value pairs and creates a the object. Returns the id of
-the newly created record, or false if there was an error.
-
-Keys are:
-
-Name - the keyword itself
-Description - (not yet used)
-Parent - optional link to another B<RT::Keyword>, allowing keyword to be arranged in a hierarchical fashion. Can be specified by id or Name.
-
-=cut
-
-sub Create {
- my $self = shift;
- my %args = (Name => undef,
- Description => undef,
- Parent => 0,
- @_);
-
- unless ($self->CurrentUserHasRight('AdminKeywords')) {
- return (0, 'Permission Denied');
- }
-
- if ( $args{'Parent'} && $args{'Parent'} !~ /^\d+$/ ) {
- $RT::Logger->err( "can't yet specify parents by name, sorry: ". $args{'Parent'});
- return(0,'Parent must be specified by id');
- }
-
- my $val = $self->SUPER::Create(Name => $args{'Name'},
- Description => $args{'Description'},
- Parent => $args{'Parent'}
- );
- if ($val) {
- return ($val, 'Keyword created');
- }
- else {
- return(0,'Could not create keyword');
- }
-}
-
-# }}}
-
-# {{{ sub Delete
-
-sub Delete {
- my $self = shift;
-
- return (0, 'Deleting this object would break referential integrity.');
-}
-
-# }}}
-
-# {{{ sub LoadByPath
-
-=head2 LoadByPath STRING
-
-LoadByPath takes a string. Whatever character starts the string is assumed to be a delimter. The routine parses the keyword path description and tries to load the keyword
-described by that path. It returns a numerical status and a textual message.
-A non-zero status means 'Success'.
-
-=cut
-
-sub LoadByPath {
- my $self = shift;
-
- my $path = shift;
-
- my $delimiter = substr($path,0,1);
- my @path_elements = split($delimiter, $path);
-
- #throw awya the first bogus path element
- shift @path_elements;
-
- my $parent = 0;
- my ($tempkey);
- #iterate through all the path elements loading up a
- #keyword object. when we're done, this object becomes
- #whatever the last tempkey object was.
- while (my $name = shift @path_elements) {
-
- $tempkey = new RT::Keyword($self->CurrentUser);
-
- my $loaded = $tempkey->LoadByNameAndParentId($name, $parent);
-
- #Set the new parent for loading its child.
- $parent = $tempkey->Id;
-
- #If the parent Id is 0, then we're not recursing through the tree
- # time to bail
- return (0, "Couldn't find keyword") unless ($tempkey->id());
-
- }
- #Now that we're through with the loop, the last keyword loaded
- # is the the one we wanted.
- # we shouldn't need to explicitly load it like this. but we do. Thanks SQL
-
- $self->Load($tempkey->Id);
-
- return (1, 'Keyword loaded');
-}
-
-
-# }}}
-
-# {{{ sub LoadByNameAndParentId
-
-=head2 LoadByNameAndParentId NAME PARENT_ID
-
-Takes two arguments, a keyword name and a parent id. Loads a keyword into
- the current object.
-
-=cut
-
-sub LoadByNameAndParentId {
- my $self = shift;
- my $name = shift;
- my $parentid = shift;
-
- my $val = $self->LoadByCols( Name => $name, Parent => $parentid);
- if ($self->Id) {
- return ($self->Id, 'Keyword loaded');
- }
- else {
- return (0, 'Keyword could not be found');
- }
- }
-
-# }}}
-
-
-# {{{ sub Load
-
-=head2 Load KEYWORD
-
-Loads KEYWORD, either by id if it's an integer or by Path, otherwise
-
-=cut
-
-sub Load {
- my $self = shift;
- my $id = shift;
-
- if (!$id) {
- return (0, 'No keyword defined');
- }
- if ($id =~ /^(\d+)$/) {
- return ($self->SUPER::Load($id));
- }
- else {
- return($self->LoadByPath($id));
- }
-}
-
-
-# }}}
-
-# {{{ sub Path
-
-=item Path
-
- Returns this Keyword's full path going back to the root. (eg /OS/Unix/Linux/Redhat if
-this keyword is "Redhat" )
-
-=cut
-
-sub Path {
- my $self = shift;
-
- if ($self->Parent == 0) {
- return ("/".$self->Name);
- }
- else {
- return ( $self->ParentObj->Path . "/" . $self->Name);
- }
-
-}
-
-# }}}
-
-# {{{ sub RelativePath
-
-=head2 RelativePath KEYWORD_OBJ
-
-Takes a keyword object. Returns this keyword's path relative to that
-keyword.
-
-=item Bugs
-
-Currently assumes that the "other" keyword is a predecessor of this keyword
-
-=cut
-
-sub RelativePath {
- my $self = shift;
- my $OtherKey = shift;
-
- my $OtherPath = $OtherKey->Path();
- my $MyPath = $self->Path;
- $MyPath =~ s/^$OtherPath\///g;
- return ($MyPath);
-}
-
-
-# }}}
-
-# {{{ sub ParentObj
-
-=item ParentObj
-
- Returns an RT::Keyword object of this Keyword's 'parents'
-
-=cut
-
-sub ParentObj {
- my $self = shift;
-
- my $ParentObj = new RT::Keyword($self->CurrentUser);
- $ParentObj->Load($self->Parent);
- return ($ParentObj);
-}
-
-# }}}
-
-# {{{ sub Children
-
-=item Children
-
-Return an RT::Keywords object this Object's children.
-
-=cut
-
-sub Children {
- my $self = shift;
-
- my $Children = new RT::Keywords($self->CurrentUser);
- $Children->LimitToParent($self->id);
- return ($Children);
-}
-
-# }}}
-
-# {{{ sub Descendents
-
-=item Descendents [ NUM_GENERATIONS [ EXCLUDE_HASHREF ] ]
-
-Returns an ordered (see L<Tie::IxHash>) hash reference of the descendents of
-this keyword, possibly limited to a given number of generations. The keys
-are B<RT::Keyword> I<id>s, and the values are strings containing the I<Name>s
-of those B<RT::Keyword>s.
-
-=cut
-
-sub Descendents {
- my $self = shift;
- my $generations = shift || 0;
- my $exclude = shift || {};
- my %results;
-
-
- tie %results, 'Tie::IxHash';
- my $Keywords = new RT::Keywords($self->CurrentUser);
- $Keywords->LimitToParent($self->id || 0 ); #If we have no id, start at the top
-
- while ( my $Keyword = $Keywords->Next ) {
-
- next if defined $exclude->{ $Keyword->id };
- $results{ $Keyword->id } = $Keyword->Name;
-
- if ( $generations == 0 || $generations > 1 ) {
- #if we're limiting to some number of generations,
- # decrement the number of generations
-
- my $nextgen = $generations;
- $nextgen-- if ( $nextgen > 1 );
-
- my $kids = $Keyword->Descendents($nextgen, \%results);
-
- foreach my $kid ( keys %{$kids}) {
- $results{"$kid"} = $Keyword->Name. "/". $kids->{"$kid"};
- }
- }
- }
- return(\%results);
-}
-
-# }}}
-
-# {{{ ACL related methods
-
-# {{{ sub _Set
-
-# does an acl check and then passes off the call
-sub _Set {
- my $self = shift;
-
- unless ($self->CurrentUserHasRight('AdminKeywords')) {
- return (0,'Permission Denied');
- }
- return $self->SUPER::_Set(@_);
-}
-
-# }}}
-
-# {{{ sub CurrentUserHasRight
-
-=head2 CurrentUserHasRight
-
-Helper menthod for HasRight. Presets Principal to CurrentUser then
-calls HasRight.
-
-=cut
-
-sub CurrentUserHasRight {
- my $self = shift;
- my $right = shift;
- return ($self->HasRight( Principal => $self->CurrentUser->UserObj,
- Right => $right ));
-
-}
-
-# }}}
-
-# {{{ sub HasRight
-
-=head2 HasRight
-
-Takes a param-hash consisting of "Right" and "Principal" Principal is
-an RT::User object or an RT::CurrentUser object. "Right" is a textual
-Right string that applies to Keywords.
-
-=cut
-
-sub HasRight {
- my $self = shift;
- my %args = ( Right => undef,
- Principal => undef,
- @_ );
-
- return( $args{'Principal'}->HasSystemRight( $args{'Right'}) );
-
-}
-# }}}
-
-# }}}
-
-=back
-
-=head1 AUTHOR
-
-Ivan Kohler <ivan-rt@420.am>
-
-=head1 BUGS
-
-Yes.
-
-=head1 SEE ALSO
-
-L<RT::Keywords>, L<RT::ObjectKeyword>, L<RT::ObjectKeywords>, L<RT::Ticket>,
-L<RT::Record>
-
-[A=cut
-
-1;
-
diff --git a/rt/lib/RT/KeywordSelect.pm b/rt/lib/RT/KeywordSelect.pm
deleted file mode 100644
index 6865216..0000000
--- a/rt/lib/RT/KeywordSelect.pm
+++ /dev/null
@@ -1,452 +0,0 @@
-#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/KeywordSelect.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-
-package RT::KeywordSelect;
-
-use strict;
-use vars qw(@ISA);
-use RT::Record;
-use RT::Keyword;
-
-@ISA = qw(RT::Record);
-
-# {{{ POD
-
-=head1 NAME
-
- RT::KeywordSelect - Manipulate an RT::KeywordSelect record
-
-=head1 SYNOPSIS
-
- use RT::KeywordSelect;
-
- my $keyword_select = RT::KeywordSelect->new($CurrentUser);
- $keyword_select->Create(
- Keyword => 20,
- ObjectType => 'Ticket',
- Name => 'Choices'
- );
-
- my $keyword_select = RT::KeywordSelect->new($CurrentUser);
- $keyword_select->Create(
- Name => 'Choices',
- Keyword => 20,
- ObjectType => 'Ticket',
- ObjectField => 'Queue',
- ObjectValue => 1,
- Single => 1,
- Depth => 4,
- );
-
-=head1 DESCRIPTION
-
-An B<RT::KeywordSelect> object is a link between a Keyword and a object
-type (one of: Ticket), titled by the I<Name> field of the B<RT::Keyword> such
-that:
-
-=over 4
-
-=item Object display will contain a field, titled with the I<Name> field and
- showing any descendent keywords which are related to this object via the
- B<RT::ObjectKeywords> table.
-
-=item Object creation for this object will contain a field titled with the
- I<Name> field and containing the descendents of the B<RT::Keyword> as
- choices. If the I<Single> field of this B<RT::KeywordSelect> is true, each
- object must be associated (via an B<RT::ObjectKeywords> record) to a single
- descendent. If the I<Single> field is false, each object may be connect to
- zero, one, or many descendents.
-
-=item Searches for this object type will contain a selection field titled with
- the I<Name> field and containing the descendents of the B<RT::Keyword> as
- choices.
-
-=item If I<ObjectField> is defined (one of: Queue), all of the above apply only
- when the value of I<ObjectField> (Queue) in B<ObjectType> (Ticket) matches
- I<ObjectValue>.
-
-=back
-
-
-=begin testing
-
-ok (require RT::TestHarness);
-ok (require RT::KeywordSelects);
-
-=end testing
-
-
-=head1 METHODS
-
-
-=cut
-
-
-=over 4
-
-=item new CURRENT_USER
-
-Takes a single argument, an RT::CurrentUser object. Instantiates a new
-(uncreated) RT::KeywordSelect object.
-
-=cut
-# }}}
-
-# {{{ sub _Init
-sub _Init {
- my $self = shift;
- $self->{'table'} = "KeywordSelects";
- $self->SUPER::_Init(@_);
-}
-# }}}
-
-# {{{ sub _Accessible
-sub _Accessible {
- my $self = shift;
- my %Cols = (
- Name => 'read/write',
- Keyword => 'read/write', # link to Keywords. Can be specified by id
- Single => 'read/write', # bool (described below)
-
- Depth => 'read/write', #- If non-zero, limits the descendents to this number of levels deep.
- ObjectType => 'read/write', # currently only C<Ticket>
- ObjectField => 'read/write', #optional, currently only C<Queue>
- ObjectValue => 'read/write', #constrains KeywordSelect function to when B<ObjectType>.I<ObjectField> equals I<ObjectValue>
- Disabled => 'read/write'
- );
- return($self->SUPER::_Accessible(@_, %Cols));
-}
-# }}}
-
-# {{{ sub LoadByName
-
-=head2 LoadByName( Name => [NAME], Queue => [QUEUE_ID])
-. Takes a queue id and a keyword select name.
- tries to load the keyword select for that queue. if that fails, it tries to load it
- without a queue specified.
-
-=cut
-
-
-sub LoadByName {
- my $self = shift;
- my %args = ( Name => undef,
- Queue => undef,
- @_
- );
- if ($args{'Queue'}) {
- #Try to get the keyword select for this queue
- $self->LoadByCols( Name => $args{'Name'},
- ObjectType => 'Ticket',
- ObjectField => 'Queue',
- ObjectValue => $args{'Queue'});
- }
- unless ($self->Id) { #if that failed to load an object
- #Try to get the keyword select of that name that's global
- $self->LoadByCols( Name => $args{'Name'},
- ObjectType => 'Ticket',
- ObjectField => 'Queue',
- ObjectValue => '0');
- }
-
- return($self->Id);
-
-}
-
-# }}}
-
-# {{{ sub Create
-=item Create KEY => VALUE, ...
-
-Takes a list of key/value pairs and creates a the object. Returns the id of
-the newly created record, or false if there was an error.
-
-Keys are:
-
-Keyword - link to Keywords. Can be specified by id.
-Name - A name for this KeywordSelect
-Single - bool (described above)
-Depth - If non-zero, limits the descendents to this number of levels deep.
-ObjectType - currently only C<Ticket>
-ObjectField - optional, currently only C<Queue>
-ObjectValue - constrains KeywordSelect function to when B<ObjectType>.I<ObjectField> equals I<ObjectValue>
-
-=cut
-
-sub Create {
- my $self = shift;
- my %args = ( Keyword => undef,
- Single => 1,
- Depth => 0,
- Name => undef,
- ObjectType => undef,
- ObjectField => undef,
- ObjectValue => undef,
- @_);
-
- #If we're talking about a keyword select based on a ticket's 'Queue' field
- if ( ($args{'ObjectField'} eq 'Queue') and
- ($args{'ObjectType'} eq 'Ticket')) {
-
- #If we're talking about a keywordselect for all queues
- if ($args{'ObjectValue'} == 0) {
- unless( $self->CurrentUserHasSystemRight('AdminKeywordSelects')) {
- return (0, 'Permission Denied');
- }
- }
- #otherwise, we're talking about a keywordselect for a specific queue
- else {
- unless ($self->CurrentUserHasQueueRight( Right => 'AdminKeywordSelects',
- Queue => $args{'ObjectValue'})) {
- return (0, 'Permission Denied');
- }
- }
- }
- else {
- return (0, "Can't create a KeywordSelect for that object/field combo");
- }
-
- my $Keyword = new RT::Keyword($self->CurrentUser);
-
- if ( $args{'Keyword'} && $args{'Keyword'} !~ /^\d+$/ ) {
- $Keyword->LoadByPath($args{'Keyword'});
- }
- else {
- $Keyword->Load($args{'Keyword'});
- }
-
- unless ($Keyword->Id) {
- $RT::Logger->debug("Keyword ".$args{'Keyword'} ." not found\n");
- return(0, 'Keyword not found');
- }
-
- $args{'Name'} = $Keyword->Name if (!$args{'Name'});
-
- my $val = $self->SUPER::Create( Name => $args{'Name'},
- Keyword => $Keyword->Id,
- Single => $args{'Single'},
- Depth => $args{'Depth'},
- ObjectType => $args{'ObjectType'},
- ObjectField => $args{'ObjectField'},
- ObjectValue => $args{'ObjectValue'});
- if ($val) {
- return ($val, 'KeywordSelect Created');
- }
- else {
- return (0, 'System error. KeywordSelect not created');
-
- }
-}
-# }}}
-
-# {{{ sub Delete
-
-sub Delete {
- my $self = shift;
-
- return (0, 'Deleting this object would break referential integrity.');
-}
-
-# }}}
-
-
-# {{{ sub SetDisabled
-
-=head2 Sub SetDisabled
-
-Toggles the KeywordSelect's disabled flag.
-
-
-=cut
-
-sub SetDisabled {
- my $self = shift;
- my $value = shift;
-
- unless ($self->CurrentUserHasRight('AdminKeywordSelects')) {
- return (0, "Permission Denied");
- }
- return($self->_Set(Field => 'Disabled', Value => $value));
-}
-
-# }}}
-
-# {{{ sub KeywordObj
-
-=item KeywordObj
-
-Returns the B<RT::Keyword> referenced by the I<Keyword> field.
-
-=cut
-
-sub KeywordObj {
- my $self = shift;
-
- my $Keyword = new RT::Keyword($self->CurrentUser);
- $Keyword->Load( $self->Keyword ); #or ?
- return($Keyword);
-}
-# }}}
-
-# {{{ sub Object
-
-=item Object
-
-Returns the object (currently only RT::Queue) specified by ObjectField and ObjectValue.
-
-=cut
-
-sub Object {
- my $self = shift;
- if ( $self->ObjectField eq 'Queue' ) {
- my $Queue = new RT::Queue($self->CurrentUser);
- $Queue->Load( $self->ObjectValue );
- return ($Queue);
- } else {
- $RT::Logger->error("$self trying to load an object value for a non-queue object");
- return (undef);
- }
-}
-
-# }}}
-
-# {{{ sub _Set
-
-# does an acl check, then passes off the call
-sub _Set {
- my $self = shift;
-
- unless ($self->CurrentUserHasRight('AdminKeywordSelects')) {
- return (0, "Permission Denied");
- }
-
- return ($self->SUPER::_Set(@_));
-
-}
-
-# }}}
-
-
-# {{{ sub CurrentUserHasQueueRight
-
-=head2 CurrentUserHasQueueRight ( Queue => QUEUEID, Right => RIGHTNANAME )
-
-Check to see whether the current user has the specified right for the specified queue.
-
-=cut
-
-sub CurrentUserHasQueueRight {
- my $self = shift;
- my %args = (Queue => undef,
- Right => undef,
- @_
- );
- return ($self->HasRight( Right => $args{'Right'},
- Principal => $self->CurrentUser->UserObj,
- Queue => $args{'Queue'}));
-}
-
-# }}}
-
-# {{{ sub CurrentUserHasSystemRight
-
-=head2 CurrentUserHasSystemRight RIGHTNAME
-
-Check to see whether the current user has the specified right for the 'system' scope.
-
-=cut
-
-sub CurrentUserHasSystemRight {
- my $self = shift;
- my $right = shift;
- $RT::Logger->debug("$self in hashsysright for right $right\n");
- return ($self->HasRight( Right => $right,
- System => 1,
- Principal => $self->CurrentUser->UserObj));
-}
-
-# }}}
-
-# {{{ sub CurrentUserHasRight
-
-=item CurrentUserHasRight RIGHT [QUEUEID]
-
-Takes a rightname as a string. Can take a queue id as a second
-optional parameter, which can be useful to a routine like create.
-Helper menthod for HasRight. Presets Principal to CurrentUser then
-calls HasRight.
-
-=cut
-
-sub CurrentUserHasRight {
- my $self = shift;
- my $right = shift;
- return ($self->HasRight( Principal => $self->CurrentUser->UserObj,
- Right => $right,
- ));
-}
-
-# }}}
-
-# {{{ sub HasRight
-
-=item HasRight
-
-Takes a param-hash consisting of "Right" and "Principal" Principal is
-an RT::User object or an RT::CurrentUser object. "Right" is a textual
-Right string that applies to KeywordSelects
-
-=cut
-
-sub HasRight {
- my $self = shift;
- my %args = ( Right => undef,
- Principal => undef,
- Queue => undef,
- System => undef,
- @_ );
-
- #If we're explicitly specifying a queue, as we need to do on create
- if ($args{'Queue'}) {
- return ($args{'Principal'}->HasQueueRight(Right => $args{'Right'},
- Queue => $args{'Queue'}));
- }
- #else if we're specifying to check a system right
- elsif ($args{'System'}) {
- return( $args{'Principal'}->HasSystemRight( $args{'Right'} ));
- }
-
- #else if we 're using the object's queue
- elsif (($self->__Value('ObjectField') eq 'Queue') and
- ($self->__Value('ObjectValue') > 0 )) {
- return ($args{'Principal'}->HasQueueRight(Right => $args{'Right'},
- Queue => $self->__Value('ObjectValue') ));
- }
-
- #If the object is system scoped.
- else {
- return( $args{'Principal'}->HasSystemRight( $args{'Right'} ));
- }
-}
-
-# }}}
-
-=back
-
-=head1 AUTHORS
-
-Ivan Kohler <ivan-rt@420.am>, Jesse Vincent <jesse@fsck.com>
-
-=head1 BUGS
-
-The ACL system for this object is more byzantine than it should be. reworking it eventually
-would be a good thing.
-
-=head1 SEE ALSO
-
-L<RT::KeywordSelects>, L<RT::Keyword>, L<RT::Keywords>, L<RT::ObjectKeyword>,
-L<RT::ObjectKeywords>, L<RT::Record>
-
-=cut
-
-1;
-
diff --git a/rt/lib/RT/KeywordSelects.pm b/rt/lib/RT/KeywordSelects.pm
deleted file mode 100644
index c220b39..0000000
--- a/rt/lib/RT/KeywordSelects.pm
+++ /dev/null
@@ -1,143 +0,0 @@
-#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/KeywordSelects.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-
-
-
-=begin testing
-
-ok (require RT::TestHarness);
-ok (require RT::Scrip);
-
-=end testing
-
-=cut
-
-
-package RT::KeywordSelects;
-
-use strict;
-use vars qw( @ISA );
-use RT::EasySearch;
-use RT::KeywordSelect;
-
-@ISA = qw( RT::EasySearch );
-
-# {{{ _Init
-sub _Init {
- my $self = shift;
- $self->{'table'} = 'KeywordSelects';
- $self->{'primary_key'} = 'id';
- return ($self->SUPER::_Init(@_));
-}
-# }}}
-
-# {{{ sub _DoSearch
-
-=head2 _DoSearch
-
- A subclass of DBIx::SearchBuilder::_DoSearch that makes sure that _Disabled rows never get seen unless
-we're explicitly trying to see them.
-
-=cut
-
-sub _DoSearch {
- my $self = shift;
-
- #unless we really want to find disabled rows, make sure we\'re only finding enabled ones.
- unless($self->{'find_disabled_rows'}) {
- $self->LimitToEnabled();
- }
-
- return($self->SUPER::_DoSearch(@_));
-
-}
-
-# }}}
-
-# {{{ sub LimitToQueue
-=head2 LimitToQueue
-
-Takes a queue id. Limits the returned set to KeywordSelects for that queue.
-Repeated calls will be OR'd together.
-
-=cut
-
-sub LimitToQueue {
- my $self = shift;
- my $queue = shift;
-
- $self->Limit( FIELD => 'ObjectValue',
- VALUE => $queue,
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'OR'
- );
-
- $self->Limit( FIELD => 'ObjectType',
- VALUE => 'Ticket',
- OPERATOR => '=');
-
- $self->Limit( FIELD => 'ObjectField',
- VALUE => 'Queue',
- OPERATOR => '=');
-
-
-}
-# }}}
-
-# {{{ sub LimitToGlobals
-
-=head2 LimitToGlobals
-
-Limits the returned set to KeywordSelects for all queues.
-Repeated calls will be OR'd together.
-
-=cut
-
-sub LimitToGlobals {
- my $self = shift;
-
- $self->Limit( FIELD => 'ObjectType',
- VALUE => 'Ticket',
- OPERATOR => '=');
-
- $self->Limit( FIELD => 'ObjectField',
- VALUE => 'Queue',
- OPERATOR => '=');
-
- $self->Limit( FIELD => 'ObjectValue',
- VALUE => '0',
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'OR'
- );
-
-}
-# }}}
-
-# {{{ sub IncludeGlobals
-=head2 IncludeGlobals
-
-Include KeywordSelects which apply globally in the set of returned results
-
-=cut
-
-
-sub IncludeGlobals {
- my $self = shift;
- $self->Limit( FIELD => 'ObjectValue',
- VALUE => '0',
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'OR'
- );
-
-
-}
-# }}}
-
-# {{{ sub NewItem
-sub NewItem {
- my $self = shift;
- #my $Handle = shift;
- return (new RT::KeywordSelect($self->CurrentUser));
-}
-# }}}
-1;
-
diff --git a/rt/lib/RT/Keywords.pm b/rt/lib/RT/Keywords.pm
deleted file mode 100644
index a9ecda2..0000000
--- a/rt/lib/RT/Keywords.pm
+++ /dev/null
@@ -1,106 +0,0 @@
-#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/Keywords.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-
-=head1 NAME
-
- RT::Keywords - a collection of RT::Keyword objects
-
-=head1 SYNOPSIS
-
- use RT::Keywords;
- my $keywords = RT::Keywords->new($user);
- $keywords->LimitToParent(0);
- while my ($keyword = $keywords->Next()) {
- print $keyword->Name ."\n";
- }
-
-
-=head1 DESCRIPTION
-
-
-=head1 METHODS
-
-=begin testing
-
-ok (require RT::TestHarness);
-ok (require RT::Keywords);
-
-=end testing
-
-=cut
-
-package RT::Keywords;
-
-use strict;
-use vars qw( @ISA );
-use RT::EasySearch;
-use RT::Keyword;
-
-@ISA = qw( RT::EasySearch );
-
-
-# {{{ sub _Init
-
-sub _Init {
- my $self = shift;
- $self->{'table'} = 'Keywords';
- $self->{'primary_key'} = 'id';
-
- # By default, order by name
- $self->OrderBy( ALIAS => 'main',
- FIELD => 'Name',
- ORDER => 'ASC');
-
- return ($self->SUPER::_Init(@_));
-}
-# }}}
-
-# {{{ sub _DoSearch
-
-=head2 _DoSearch
-
- A subclass of DBIx::SearchBuilder::_DoSearch that makes sure that _Disabled rows never get seen unless
-we're explicitly trying to see them.
-
-=cut
-
-sub _DoSearch {
- my $self = shift;
-
- #unless we really want to find disabled rows, make sure we\'re only finding enabled ones.
- unless($self->{'find_disabled_rows'}) {
- $self->LimitToEnabled();
- }
-
- return($self->SUPER::_DoSearch(@_));
-
-}
-
-# }}}
-
-# {{{ sub NewItem
-sub NewItem {
- my $self = shift;
- return (RT::Keyword->new($self->CurrentUser));
-}
-# }}}
-
-# {{{ sub LimitToParent
-
-=head2 LimitToParent
-
-Takes a parent id and limits the returned keywords to children of that parent.
-
-=cut
-
-sub LimitToParent {
- my $self = shift;
- my $parent = shift;
- $self->Limit( FIELD => 'Parent',
- VALUE => $parent,
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'OR' );
-}
-# }}}
-
-1;
-
diff --git a/rt/lib/RT/ObjectKeyword.pm b/rt/lib/RT/ObjectKeyword.pm
deleted file mode 100644
index 287d41f..0000000
--- a/rt/lib/RT/ObjectKeyword.pm
+++ /dev/null
@@ -1,192 +0,0 @@
-#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/ObjectKeyword.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-# Released under the terms of the GNU Public License
-
-=head1 NAME
-
- RT::ObjectKeyword -- a keyword tied to an object in the database
-
-=head1 SYNOPSIS
-
- use RT::ObjectKeyword;
-
-
-=head1 DESCRIPTION
-
-This module should never be called directly by client code. it's an internal module which
-should only be accessed through exported APIs in Ticket, Queue and other similar objects.
-
-
-=begin testing
-
-ok (require RT::TestHarness);
-ok (require RT::ObjectKeyword);
-
-=end testing
-
-=head1 METHODS
-
-=cut
-
-package RT::ObjectKeyword;
-
-use strict;
-use vars qw(@ISA);
-use RT::Record;
-
-@ISA = qw(RT::Record);
-
-sub _Init {
- my $self = shift;
- $self->{'table'} = "ObjectKeywords";
- $self->SUPER::_Init(@_);
-}
-
-sub _Accessible {
- my $self = shift;
-
- my %cols = (
- Keyword => 'read/write', #link to the B<RT::Keyword>
- KeywordSelect => 'read/write', #link to the B<RT::KeywordSelect>
- ObjectType => 'read/write', #currently only C<Ticket>
- ObjectId => 'read/write', #link to the object specified in I<ObjectType>
- );
- return ($self->SUPER::_Accessible( @_, %cols));
-}
-
-
-
-# TODO - post 2.0. add in _Set and _Value, so we can ACL them. protected at another API level
-
-
-=head1 NAME
-
- RT::ObjectKeyword - Manipulate an RT::ObjectKeyword record
-
-=head1 SYNOPSIS
-
- use RT::ObjectKeyword;
-
- my $keyword = RT::ObjectKeyword->new($CurrentUser);
- $keyword->Create;
-
-=head1 DESCRIPTION
-
-An B<RT::ObjectKeyword> object associates an B<RT::Keyword> with another
-object (currently only B<RT::Ticket>.
-
-This module should B<NEVER> be called directly by client code. its API is entirely through RT ticket or other objects which can have keywords assigned.
-
-
-=head1 METHODS
-
-=over 4
-
-=item new CURRENT_USER
-
-Takes a single argument, an RT::CurrentUser object. Instantiates a new
-(uncreated) RT::ObjectKeyword object.
-
-=cut
-
-# {{{ sub Create
-
-=item Create KEY => VALUE, ...
-
-Takes a list of key/value pairs and creates a the object. Returns the id of
-the newly created record, or false if there was an error.
-
-Keys are:
-
-Keyword - link to the B<RT::Keyword>
-ObjectType - currently only C<Ticket>
-ObjectId - link to the object specified in I<ObjectType>
-
-=cut
-
-
-sub Create {
- my $self = shift;
- my %args = (Keyword => undef,
- KeywordSelect => undef,
- ObjectType => undef,
- ObjectId => undef,
- @_);
-
- #TODO post 2.0 ACL check
-
- return ($self->SUPER::Create( Keyword => $args{'Keyword'},
- KeywordSelect => $args{'KeywordSelect'},
- ObjectType => $args{'ObjectType'},
- ObjectId => $args{'ObjectId'}))
-}
-# }}}
-
-# {{{ sub KeywordObj
-
-=item KeywordObj
-
-Returns an B<RT::Keyword> object of the Keyword associated with this ObjectKeyword.
-
-=cut
-
-sub KeywordObj {
- my $self = shift;
- my $keyword = new RT::Keyword($self->CurrentUser);
- $keyword->Load($self->Keyword);
- return ($keyword);
-}
-# }}}
-
-# {{{ sub KeywordSelectObj
-
-=item KeywordSelectObj
-
-Returns an B<RT::KeywordSelect> object of the KeywordSelect associated with this ObjectKeyword.
-
-=cut
-
-sub KeywordSelectObj {
- my $self = shift;
- my $keyword_sel = new RT::KeywordSelect($self->CurrentUser);
- $keyword_sel->Load($self->KeywordSelect);
- return ($keyword_sel);
-}
-# }}}
-
-# {{{ sub KeywordRelativePath
-
-=item KeywordRelativePath
-
-Returns a string of the Keyword's path relative to this ObjectKeyword's KeywordSelect
-
-
-
-=cut
-
-sub KeywordRelativePath {
- my $self = shift;
- return($self->KeywordObj->RelativePath(
- $self->KeywordSelectObj->KeywordObj->Path));
-
-}
-# }}}
-
-=back
-
-=head1 AUTHOR
-
-Ivan Kohler <ivan-rt@420.am>
-
-=head1 BUGS
-
-Yes.
-
-=head1 SEE ALSO
-
-L<RT::ObjectKeywords>, L<RT::Keyword>, L<RT::Keywords>, L<RT::Ticket>,
-L<RT::Record>
-
-=cut
-
-1;
-
diff --git a/rt/lib/RT/ObjectKeywords.pm b/rt/lib/RT/ObjectKeywords.pm
deleted file mode 100644
index 5df996e..0000000
--- a/rt/lib/RT/ObjectKeywords.pm
+++ /dev/null
@@ -1,234 +0,0 @@
-#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/ObjectKeywords.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-
-package RT::ObjectKeywords;
-
-use strict;
-use vars qw( @ISA );
-
-=head1 NAME
-
- RT::ObjectKeywords - note warning
-
-=head1 WARNING
-
-This module should B<NEVER> be called directly by client code. its API is entirely through RT ticket or other objects which can have keywords assigned.
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-=begin testing
-
-ok (require RT::TestHarness);
-ok (require RT::ObjectKeywords);
-
-=end testing
-
-=cut
-
-use RT::EasySearch;
-use RT::ObjectKeyword;
-
-@ISA = qw( RT::EasySearch );
-
-# {{{ sub _Init
-sub _Init {
- my $self = shift;
- $self->{'table'} = 'ObjectKeywords';
- $self->{'primary_key'} = 'id';
- return ($self->SUPER::_Init(@_));
-}
-# }}}
-
-# {{{ sub NewItem
-sub NewItem {
- my $self = shift;
- return (new RT::ObjectKeyword($self->CurrentUser));
-}
-# }}}
-
-# {{{ sub LimitToKeywordSelect
-
-=head2 LimitToKeywordSelect
-
- Takes a B<RT::KeywordSelect> id or Nameas its single argument. limits the returned set of ObjectKeywords
-to ObjectKeywords which apply to that ticket
-
-=cut
-
-
-sub LimitToKeywordSelect {
- my $self = shift;
- my $keywordselect = shift;
-
- if ($keywordselect =~ /^\d+$/) {
-
- $self->Limit(FIELD => 'KeywordSelect',
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'OR',
- VALUE => "$keywordselect");
- }
-
- #We're limiting by name. time to be klever
- else {
- my $ks = $self->NewAlias('KeywordSelects');
- $self->Join(ALIAS1 => $ks, FIELD1 => 'id',
- ALIAS2 => 'main', FIELD2 => 'KeywordSelect');
-
- $self->Limit( ALIAS => "$ks",
- FIELD => 'Name',
- VALUE => "$keywordselect",
- OPERATOR => "=",
- ENTRYAGGREGATOR => "OR");
-
- $self->Limit ( ALIAS => "$ks",
- FIELD => 'ObjectType',
- VALUE => 'Ticket',
- OPERATOR => '=',
- );
-
- $self->Limit ( ALIAS => "$ks",
- FIELD => 'ObjectField',
- VALUE => 'Queue',
- OPERATOR => '=',
- );
-
-
- # TODO +++ we need to be able to limit the returned
- # keywordselects to ones that apply only to this queue
- # $self->Limit( ALIAS => "$ks",
- # FIELD => 'ObjectValue',
- # VALUE => $self->QueueObj->Id,
- # OPERATOR => "=",
- # ENTRYAGGREGATOR => "OR");
-
- }
-
-
-
-}
-
-# }}}
-
-# {{{ LimitToTicket
-
-=head2 LimitToTicket TICKET_ID
-
- Takes an B<RT::Ticket> id as its single argument. limits the returned set of ObjectKeywords
-to ObjectKeywords which apply to that ticket
-
-=cut
-
-sub LimitToTicket {
- my $self = shift;
- my $ticket = shift;
- $self->Limit(FIELD => 'ObjectId',
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'OR',
- VALUE => "$ticket");
-
- $self->Limit(FIELD => 'ObjectType',
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'OR',
- VALUE => "Ticket");
-
-}
-
-# }}}
-
-# {{{ sub _DoSearch
-#wrap around _DoSearch so that we can build the hash of returned
-#values
-
-sub _DoSearch {
- my $self = shift;
- # $RT::Logger->debug("Now in ".$self."->_DoSearch");
- my $return = $self->SUPER::_DoSearch(@_);
- # $RT::Logger->debug("In $self ->_DoSearch. return from SUPER::_DoSearch was $return\n");
- $self->_BuildHash();
- return ($return);
-}
-# }}}
-
-# {{{ sub _BuildHash
-#Build a hash of this ACL's entries.
-sub _BuildHash {
- my $self = shift;
-
- while (my $entry = $self->Next) {
-
- my $hashkey = $entry->Keyword;
- $self->{'as_hash'}->{"$hashkey"} =1;
- }
-
-}
-# }}}
-
-# {{{ HasEntry
-
-=head2 HasEntry KEYWORD_ID
-
- Takes a keyword id and returns true if this ObjectKeywords object has an entry for that
-keyword. Returns undef otherwise.
-
-=cut
-
-sub HasEntry {
-
- my $self = shift;
- my $keyword = shift;
-
-
- #if we haven't done the search yet, do it now.
- $self->_DoSearch();
-
- # $RT::Logger->debug("Now in ".$self."->HasEntry\n");
-
-
- if ($self->{'as_hash'}->{ $keyword } == 1) {
- return(1);
- }
- else {
- return(undef);
- }
-}
-
-# }}}
-
-# {{{ sub RelativePaths
-
-=head2 RelativePaths
-
-# Return a (reference to a) list of KeywordRelativePaths
-
-=cut
-
-sub RelativePaths {
- my $self = shift;
-
- my @list;
-
- # Here $key is a RT::ObjectKeyword
- while (my $key=$self->Next()) {
- push(@list, $key->KeywordRelativePath);
- }
- return(\@list);
-}
-# }}}
-
-# {{{ sub RelativePathsAsString
-
-=head2 RelativePathsAsString
-
-# Returns the RT::ObjectKeywords->RelativePaths as a comma seperated string
-
-=cut
-
-sub RelativePathsAsString {
- my $self = shift;
- return(join(", ",@{$self->KeywordRelativePaths}));
-}
-# }}}
-
-1;
-
diff --git a/rt/lib/RT/TestHarness.pm b/rt/lib/RT/TestHarness.pm
deleted file mode 100644
index 160e9e6..0000000
--- a/rt/lib/RT/TestHarness.pm
+++ /dev/null
@@ -1,14 +0,0 @@
-use lib "/opt/rt2/etc/";
-
-use RT::Interface::CLI qw(CleanEnv LoadConfig DBConnect
- GetCurrentUser GetMessageContent);
-
-#Clean out all the nasties from the environment
-CleanEnv();
-
-#Load etc/config.pm and drop privs
-LoadConfig();
-
-
-use RT;
-RT::Init;
diff --git a/rt/lib/RT/Watcher.pm b/rt/lib/RT/Watcher.pm
deleted file mode 100755
index c7c6100..0000000
--- a/rt/lib/RT/Watcher.pm
+++ /dev/null
@@ -1,313 +0,0 @@
-# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/Watcher.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-# (c) 1996-2001 Jesse Vincent <jesse@fsck.com>
-# This software is redistributable under the terms of the GNU GPL
-
-=head1 NAME
-
- RT::Watcher - RT Watcher object
-
-=head1 SYNOPSIS
-
- use RT::Watcher;
-
-
-=head1 DESCRIPTION
-
-This module should never be called directly by client code. it\'s an internal module which
-should only be accessed through exported APIs in Ticket, Queue and other similar objects.
-
-=head1 METHODS
-
-=begin testing
-
-ok(require RT::TestHarness);
-ok(require RT::Watcher);
-
-=end testing
-
-=cut
-
-package RT::Watcher;
-use RT::Record;
-@ISA= qw(RT::Record);
-
-
-# {{{ sub _Init
-
-sub _Init {
- my $self = shift;
-
- $self->{'table'} = "Watchers";
- return ($self->SUPER::_Init(@_));
-
-}
-# }}}
-
-# {{{ sub Create
-
-=head2 Create PARAMHASH
-
-Create a new watcher object with the following Attributes:
-
-Scope: Ticket or Queue
-Value: Ticket or queue id
-Type: Requestor, Cc or AdminCc. Requestor is not supported for a scope of \'Queue\'
-Email: The email address of the watcher. If the email address maps to an RT User, this is resolved
-to an Owner object instead.
-Owner: The RT user id of the \'owner\' of this watcher object.
-
-=cut
-
-sub Create {
- my $self = shift;
- my %args = (
- Owner => undef,
- Email => undef,
- Value => undef,
- Scope => undef,
- Type => undef,
- Quiet => 0,
- @_ # get the real argumentlist
- );
-
- #Do we have someone this applies to?
- unless (($args{'Owner'} =~ /^(\d+)$/) || ($args{'Email'} =~ /\@/)) {
- return (0, "No user or email address specified");
- }
-
- #if we only have an email address, try to resolve it to an owner
- if ($args{'Owner'} == 0) {
- my $User = new RT::User($RT::SystemUser);
- $User->LoadByEmail($args{'Email'});
- if ($User->id) {
- $args{'Owner'} = $User->id;
- delete $args{'Email'};
- }
- }
-
-
- if ($args{'Type'} eq "Requestor" and $args{'Owner'} == 0) {
- # Requestors *MUST* have an account
-
- my $Address = RT::CanonicalizeAddress($args{'Email'});
-
- my $NewUser = RT::User->new($RT::SystemUser);
- my ($Val, $Message) =
- $NewUser->Create(Name => $Address,
- EmailAddress => $Address,
- RealName => $Address,
- Password => undef,
- Privileged => 0,
- Comments => 'Autocreated on ticket submission'
- );
- return (0, "Could not create watcher for requestor")
- unless $Val;
- if ($NewUser->id) {
- $args{'Owner'} = $NewUser->id;
- delete $args{'Email'};
- }
- }
-
-
-
-
- #Make sure we\'ve got a valid type
- #TODO --- move this to ValidateType
- return (0, "Invalid Type")
- unless ($args{'Type'} =~ /^(Requestor|Cc|AdminCc)$/i);
-
- my $id = $self->SUPER::Create(%args);
- if ($id) {
- return (1,"Interest noted");
- }
- else {
- return (0, "Error adding watcher");
- }
-}
-# }}}
-
-# {{{ sub Load
-
-=head2 Load ID
-
- Loads a watcher by the primary key of the watchers table ($Watcher->id)
-
-=cut
-
-sub Load {
- my $self = shift;
- my $identifier = shift;
-
- if ($identifier !~ /\D/) {
- $self->SUPER::LoadById($identifier);
- }
- else {
- return (0, "That's not a numerical id");
- }
-}
-
-# }}}
-
-# {{{ sub LoadByValue
-
-=head2 LoadByValue PARAMHASH
-
-LoadByValue takes a parameter hash with the following attributes:
-
- Email, Owner, Scope, Type, Value
-
-The same rules enforced at create are enforced by Load.
-
-Returns a tuple of (retval, msg). Retval is 1 on success and 0 on failure.
-msg describes what happened in a human readable form.
-
-=cut
-
-sub LoadByValue {
- my $self = shift;
- my %args = ( Email => undef,
- Owner => undef,
- Scope => undef,
- Type => undef,
- Value => undef,
- @_);
-
- #TODO: all this code is being copied from Create. that\'s silly
-
- #Do we have someone this applies to?
- unless (($args{'Owner'} =~ /^(\d*)$/) || ($args{'Email'} =~ /\@/)) {
- return (0, "No user or email address specified");
- }
-
- #if we only have an email address, try to resolve it to an owner
- unless ($args{'Owner'}) {
- my $User = new RT::User($RT::SystemUser);
- $User->LoadByEmail($args{'Email'});
- if ($User->id > 0) {
- $args{'Owner'} = $User->id;
- delete $args{'Email'};
- }
- }
-
- if ((defined ($args{'Type'})) and
- ($args{'Type'} !~ /^(Requestor|Cc|AdminCc)$/i)) {
- return (0, "Invalid Type");
- }
- if ($args{'Owner'}) {
- $self->LoadByCols( Type => $args{'Type'},
- Value => $args{'Value'},
- Owner => $args{'Owner'},
- Scope => $args{'Scope'},
- );
- }
- else {
- $self->LoadByCols( Type => $args{'Type'},
- Email => $args{'Email'},
- Value => $args{'Value'},
- Scope => $args{'Scope'},
- );
- }
- unless ($self->Id) {
- return(0, "Couldn\'t find that watcher");
- }
- return (1, "Watcher loaded");
-}
-
-# }}}
-
-# {{{ sub OwnerObj
-
-=head2 OwnerObj
-
-Return an RT Owner Object for this Watcher, if we have one
-
-=cut
-
-sub OwnerObj {
- my $self = shift;
- if (!defined $self->{'OwnerObj'}) {
- require RT::User;
- $self->{'OwnerObj'} = RT::User->new($self->CurrentUser);
- if ($self->Owner) {
- $self->{'OwnerObj'}->Load($self->Owner);
- } else {
- return $RT::Nobody->UserObj;
- }
- }
- return ($self->{'OwnerObj'});
-}
-# }}}
-
-# {{{ sub Email
-
-=head2 Email
-
-This custom data accessor does the right thing and returns
-the 'Email' attribute of this Watcher object. If that's undefined,
-it returns the 'EmailAddress' attribute of its 'Owner' object, which is
-an RT::User object.
-
-=cut
-
-sub Email {
- my $self = shift;
-
- # IF Email is defined, return that. Otherwise, return the Owner's email address
- if (defined($self->__Value('Email'))) {
- return ($self->__Value('Email'));
- }
- elsif ($self->Owner) {
- return ($self->OwnerObj->EmailAddress);
- }
- else {
- return ("Data error");
- }
-}
-# }}}
-
-# {{{ sub IsUser
-
-=head2 IsUser
-
-Returns true if this watcher object is tied to a user object. (IE it
-isn't sending to some other email address).
-Otherwise, returns undef
-
-=cut
-
-sub IsUser {
- my $self = shift;
- # if this watcher has an email address glued onto it,
- # return undef
-
- if (defined($self->__Value('Email'))) {
- return undef;
- }
- else {
- return 1;
- }
-}
-
-# }}}
-
-# {{{ sub _Accessible
-sub _Accessible {
- my $self = shift;
- my %Cols = (
- Email => 'read/write',
- Scope => 'read/write',
- Value => 'read/write',
- Type => 'read/write',
- Quiet => 'read/write',
- Owner => 'read/write',
- Creator => 'read/auto',
- Created => 'read/auto',
- LastUpdatedBy => 'read/auto',
- LastUpdated => 'read/auto'
- );
- return($self->SUPER::_Accessible(@_, %Cols));
-}
-# }}}
-
-1;
-
diff --git a/rt/lib/RT/Watchers.pm b/rt/lib/RT/Watchers.pm
deleted file mode 100755
index c55adda..0000000
--- a/rt/lib/RT/Watchers.pm
+++ /dev/null
@@ -1,226 +0,0 @@
-# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/Watchers.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
-# (c) 1996-2000 Jesse Vincent <jesse@fsck.com>
-# This software is redistributable under the terms of the GNU GPL
-
-=head1 NAME
-
- RT::Watchers - Collection of RT Watcher objects
-
-=head1 SYNOPSIS
-
- use RT::Watchers;
- my $watchers = new RT::Watchers($CurrentUser);
- while (my $watcher = $watchers->Next()) {
- print $watcher->Id . "is a watcher";
- }
-
-=head1 DESCRIPTION
-
-This module should never be called directly by client code. it's an internal module which
-should only be accessed through exported APIs in Ticket, Queue and other similar objects.
-
-
-=head1 METHODS
-
-=begin testing
-
-ok(require RT::TestHarness);
-ok(require RT::Watchers);
-
-=end testing
-
-=cut
-
-package RT::Watchers;
-
-use strict;
-use vars qw( @ISA );
-
-
-require RT::EasySearch;
-require RT::Watcher;
-@ISA= qw(RT::EasySearch);
-
-
-# {{{ sub _Init
-sub _Init {
- my $self = shift;
-
- $self->{'table'} = "Watchers";
- $self->{'primary_key'} = "id";
- return($self->SUPER::_Init(@_));
-}
-# }}}
-
-# {{{ sub Limit
-
-=head2 Limit
-
- A wrapper around RT::EasySearch::Limit which sets
-the default entry aggregator to 'AND'
-
-=cut
-
-sub Limit {
- my $self = shift;
- my %args = ( ENTRYAGGREGATOR => 'AND',
- @_);
-
- $self->SUPER::Limit(%args);
-}
-# }}}
-
-# {{{ sub LimitToTicket
-
-=head2 LimitToTicket
-
-Takes a single arg which is a ticket id
-Limits to watchers of that ticket
-
-=cut
-
-sub LimitToTicket {
- my $self = shift;
- my $ticket = shift;
- $self->Limit( ENTRYAGGREGATOR => 'OR',
- FIELD => 'Value',
- VALUE => $ticket);
- $self->Limit (ENTRYAGGREGATOR => 'AND',
- FIELD => 'Scope',
- VALUE => 'Ticket');
-}
-# }}}
-
-# {{{ sub LimitToQueue
-
-=head2 LimitToQueue
-
-Takes a single arg, which is a queue id
-Limits to watchers of that queue.
-
-=cut
-
-sub LimitToQueue {
- my $self = shift;
- my $queue = shift;
- $self->Limit (ENTRYAGGREGATOR => 'OR',
- FIELD => 'Value',
- VALUE => $queue);
- $self->Limit (ENTRYAGGREGATOR => 'AND',
- FIELD => 'Scope',
- VALUE => 'Queue');
-}
-# }}}
-
-# {{{ sub LimitToType
-
-=head2 LimitToType
-
-Takes a single string as its argument. That string is a watcher type
-which is one of 'Requestor', 'Cc' or 'AdminCc'
-Limits to watchers of that type
-
-=cut
-
-
-sub LimitToType {
- my $self = shift;
- my $type = shift;
- $self->Limit(FIELD => 'Type',
- VALUE => "$type");
-}
-# }}}
-
-# {{{ sub LimitToRequestors
-
-=head2 LimitToRequestors
-
-Limits to watchers of type 'Requestor'
-
-=cut
-
-sub LimitToRequestors {
- my $self = shift;
- $self->LimitToType("Requestor");
-}
-# }}}
-
-# {{{ sub LimitToCc
-
-=head2 LimitToCc
-
-Limits to watchers of type 'Cc'
-
-=cut
-
-sub LimitToCc {
- my $self = shift;
- $self->LimitToType("Cc");
-}
-# }}}
-
-# {{{ sub LimitToAdminCc
-
-=head2 LimitToAdminCc
-
-Limits to watchers of type AdminCc
-
-=cut
-
-sub LimitToAdminCc {
- my $self = shift;
- $self->LimitToType("AdminCc");
-}
-# }}}
-
-# {{{ sub Emails
-
-=head2 Emails
-
-# Return a (reference to a) list of emails
-
-=cut
-
-sub Emails {
- my $self = shift;
- my @list; # List is a list of watcher email addresses
-
- # $watcher is an RT::Watcher object
- while (my $watcher=$self->Next()) {
- push(@list, $watcher->Email);
- }
- return \@list;
-}
-# }}}
-
-# {{{ sub EmailsAsString
-
-=head2 EmailsAsString
-
-# Returns the RT::Watchers->Emails as a comma seperated string
-
-=cut
-
-sub EmailsAsString {
- my $self = shift;
- return(join(", ",@{$self->Emails}));
-}
-# }}}
-
-# {{{ sub NewItem
-
-
-
-sub NewItem {
- my $self = shift;
-
- use RT::Watcher;
- my $item = new RT::Watcher($self->CurrentUser);
- return($item);
-}
-# }}}
-1;
-
-
-
-
diff --git a/rt/lib/test.pl b/rt/lib/test.pl
deleted file mode 100644
index f0da5df..0000000
--- a/rt/lib/test.pl
+++ /dev/null
@@ -1,52 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-######################### We start with some black magic to print on failure.
-
-# Change 1..1 below to 1..last_test_to_print .
-# (It may become useful if the test is moved to ./t subdirectory.)
-
-BEGIN { $| = 1; print "1..1\n"; }
-END {print "not ok 1\n" unless $loaded;}
-use RT;
-$loaded = 1;
-print "ok 1\n";
-
-######################### End of black magic.
-
-# Insert your test code below (better if it prints "ok 13"
-# (correspondingly "not ok 13") depending on the success of chunk 13
-# of the test code):
-
-use RT::Record;
-use RT::EasySearch;
-use RT::Handle;
-use RT::Ticket;
-use RT::Tickets;
-use RT::ACE;
-use RT::ACL;
-use RT::Watcher;
-use RT::Watchers;
-use RT::Scrip;
-use RT::Scrips;
-use RT::ScripAction;
-use RT::ScripCondition;
-use RT::ScripActions;
-use RT::ScripConditions;
-use RT::Transaction;
-use RT::Transactions;
-use RT::Group;
-use RT::GroupMembers;
-use RT::User;
-use RT::Users;
-use RT::CurrentUser;
-use RT::Attachment;
-use RT::Attachments;
-use RT::Keyword;
-use RT::Keywords;
-use RT::KeywordSelect;
-use RT::KeywordSelects;
-use RT::ObjectKeyword;
-use RT::ObjectKeywords;
-use RT::Date;
-