import rt 2.0.14
authorivan <ivan>
Mon, 12 Aug 2002 06:17:09 +0000 (06:17 +0000)
committerivan <ivan>
Mon, 12 Aug 2002 06:17:09 +0000 (06:17 +0000)
263 files changed:
rt/COPYING [new file with mode: 0755]
rt/ChangeLog [new file with mode: 0644]
rt/Makefile [new file with mode: 0644]
rt/README [new file with mode: 0755]
rt/TODO [new file with mode: 0755]
rt/bin/initacls.Oracle [new file with mode: 0644]
rt/bin/initacls.Pg [new file with mode: 0755]
rt/bin/initacls.mysql [new file with mode: 0755]
rt/bin/mason_handler.fcgi [new file with mode: 0755]
rt/bin/mason_handler.scgi [new file with mode: 0755]
rt/bin/rt [new file with mode: 0755]
rt/bin/rt-mailgate [new file with mode: 0755]
rt/bin/rtadmin [new file with mode: 0644]
rt/bin/webmux.pl [new file with mode: 0755]
rt/docs/README.docs [new file with mode: 0755]
rt/docs/Security [new file with mode: 0644]
rt/docs/design_docs/CARS [new file with mode: 0755]
rt/docs/design_docs/TransactionTypes.txt [new file with mode: 0755]
rt/docs/design_docs/acls [new file with mode: 0644]
rt/docs/design_docs/basic-definitions.txt [new file with mode: 0644]
rt/docs/design_docs/cli_spec [new file with mode: 0644]
rt/docs/design_docs/cvs_integration [new file with mode: 0644]
rt/docs/design_docs/evil_plans [new file with mode: 0644]
rt/docs/design_docs/link-definitions.txt [new file with mode: 0644]
rt/docs/design_docs/local_hacking [new file with mode: 0644]
rt/docs/design_docs/subscription-definitions.txt [new file with mode: 0755]
rt/docs/design_docs/users [new file with mode: 0644]
rt/docs/rt.gif [new file with mode: 0755]
rt/etc/acl.Oracle [new file with mode: 0644]
rt/etc/acl.Pg [new file with mode: 0755]
rt/etc/acl.mysql [new file with mode: 0755]
rt/etc/config.pm [new file with mode: 0755]
rt/etc/rt.spec [new file with mode: 0644]
rt/etc/schema.Oracle [new file with mode: 0644]
rt/etc/schema.Pg [new file with mode: 0755]
rt/etc/schema.mysql [new file with mode: 0755]
rt/etc/schema.pm [new file with mode: 0644]
rt/lib/MANIFEST [new file with mode: 0644]
rt/lib/MANIFEST.SKIP [new file with mode: 0644]
rt/lib/Makefile.PL [new file with mode: 0644]
rt/lib/RT.pm [new file with mode: 0644]
rt/lib/RT/ACE.pm [new file with mode: 0755]
rt/lib/RT/ACL.pm [new file with mode: 0755]
rt/lib/RT/Action/Autoreply.pm [new file with mode: 0755]
rt/lib/RT/Action/Generic.pm [new file with mode: 0755]
rt/lib/RT/Action/Notify.pm [new file with mode: 0755]
rt/lib/RT/Action/NotifyAsComment.pm [new file with mode: 0755]
rt/lib/RT/Action/OpenDependent.pm [new file with mode: 0644]
rt/lib/RT/Action/ResolveMembers.pm [new file with mode: 0644]
rt/lib/RT/Action/SendEmail.pm [new file with mode: 0755]
rt/lib/RT/Action/SendPasswordEmail.pm [new file with mode: 0755]
rt/lib/RT/Action/StallDependent.pm [new file with mode: 0644]
rt/lib/RT/Attachment.pm [new file with mode: 0755]
rt/lib/RT/Attachments.pm [new file with mode: 0755]
rt/lib/RT/Condition/AnyTransaction.pm [new file with mode: 0644]
rt/lib/RT/Condition/Generic.pm [new file with mode: 0755]
rt/lib/RT/Condition/NewDependency.pm [new file with mode: 0644]
rt/lib/RT/Condition/StatusChange.pm [new file with mode: 0644]
rt/lib/RT/CurrentUser.pm [new file with mode: 0755]
rt/lib/RT/Date.pm [new file with mode: 0644]
rt/lib/RT/EasySearch.pm [new file with mode: 0755]
rt/lib/RT/Group.pm [new file with mode: 0755]
rt/lib/RT/GroupMember.pm [new file with mode: 0755]
rt/lib/RT/GroupMembers.pm [new file with mode: 0755]
rt/lib/RT/Groups.pm [new file with mode: 0755]
rt/lib/RT/Handle.pm [new file with mode: 0644]
rt/lib/RT/Interface/CLI.pm [new file with mode: 0644]
rt/lib/RT/Interface/Email.pm [new file with mode: 0755]
rt/lib/RT/Interface/Web.pm [new file with mode: 0644]
rt/lib/RT/Keyword.pm [new file with mode: 0644]
rt/lib/RT/KeywordSelect.pm [new file with mode: 0644]
rt/lib/RT/KeywordSelects.pm [new file with mode: 0644]
rt/lib/RT/Keywords.pm [new file with mode: 0644]
rt/lib/RT/Link.pm [new file with mode: 0644]
rt/lib/RT/Links.pm [new file with mode: 0644]
rt/lib/RT/ObjectKeyword.pm [new file with mode: 0644]
rt/lib/RT/ObjectKeywords.pm [new file with mode: 0644]
rt/lib/RT/Queue.pm [new file with mode: 0755]
rt/lib/RT/Queues.pm [new file with mode: 0755]
rt/lib/RT/Record.pm [new file with mode: 0755]
rt/lib/RT/Scrip.pm [new file with mode: 0755]
rt/lib/RT/ScripAction.pm [new file with mode: 0755]
rt/lib/RT/ScripActions.pm [new file with mode: 0755]
rt/lib/RT/ScripCondition.pm [new file with mode: 0755]
rt/lib/RT/ScripConditions.pm [new file with mode: 0755]
rt/lib/RT/Scrips.pm [new file with mode: 0755]
rt/lib/RT/Template.pm [new file with mode: 0755]
rt/lib/RT/Templates.pm [new file with mode: 0755]
rt/lib/RT/TestHarness.pm [new file with mode: 0644]
rt/lib/RT/Ticket.pm [new file with mode: 0755]
rt/lib/RT/Tickets.pm [new file with mode: 0755]
rt/lib/RT/Transaction.pm [new file with mode: 0755]
rt/lib/RT/Transactions.pm [new file with mode: 0755]
rt/lib/RT/User.pm [new file with mode: 0755]
rt/lib/RT/Users.pm [new file with mode: 0755]
rt/lib/RT/Watcher.pm [new file with mode: 0755]
rt/lib/RT/Watchers.pm [new file with mode: 0755]
rt/lib/test.pl [new file with mode: 0644]
rt/tools/cpan2rpm [new file with mode: 0644]
rt/tools/initdb [new file with mode: 0644]
rt/tools/insertdata [new file with mode: 0755]
rt/tools/testdeps [new file with mode: 0644]
rt/webrt/Admin/Elements/CreateQueueCalled [new file with mode: 0755]
rt/webrt/Admin/Elements/CreateUserCalled [new file with mode: 0755]
rt/webrt/Admin/Elements/EditUserComments [new file with mode: 0755]
rt/webrt/Admin/Elements/GrantQueueRightsTo [new file with mode: 0755]
rt/webrt/Admin/Elements/GroupTabs [new file with mode: 0755]
rt/webrt/Admin/Elements/Header [new file with mode: 0755]
rt/webrt/Admin/Elements/ListGlobalKeywordSelects [new file with mode: 0644]
rt/webrt/Admin/Elements/ListGlobalScrips [new file with mode: 0755]
rt/webrt/Admin/Elements/ModifyKeyword [new file with mode: 0644]
rt/webrt/Admin/Elements/ModifyKeywordSelect [new file with mode: 0644]
rt/webrt/Admin/Elements/ModifyQueue [new file with mode: 0755]
rt/webrt/Admin/Elements/ModifyTemplate [new file with mode: 0755]
rt/webrt/Admin/Elements/ModifyUser [new file with mode: 0755]
rt/webrt/Admin/Elements/QueueRightsForUser [new file with mode: 0644]
rt/webrt/Admin/Elements/QueueTabs [new file with mode: 0755]
rt/webrt/Admin/Elements/SelectKeywordSelect [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectModifyGroup [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectModifyKeyword [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectModifyKeywordSelect [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectModifyQueue [new file with mode: 0755]
rt/webrt/Admin/Elements/SelectModifyUser [new file with mode: 0755]
rt/webrt/Admin/Elements/SelectQueueRights [new file with mode: 0755]
rt/webrt/Admin/Elements/SelectRights [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectScrip [new file with mode: 0755]
rt/webrt/Admin/Elements/SelectScripAction [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectScripCondition [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectSingleOrMultiple [new file with mode: 0644]
rt/webrt/Admin/Elements/SelectTemplate [new file with mode: 0755]
rt/webrt/Admin/Elements/SelectUsers [new file with mode: 0644]
rt/webrt/Admin/Elements/SystemTabs [new file with mode: 0755]
rt/webrt/Admin/Elements/Tabs [new file with mode: 0755]
rt/webrt/Admin/Elements/UserTabs [new file with mode: 0755]
rt/webrt/Admin/Global/GroupRights.html [new file with mode: 0755]
rt/webrt/Admin/Global/Keywords.html [new file with mode: 0644]
rt/webrt/Admin/Global/Scrips.html [new file with mode: 0755]
rt/webrt/Admin/Global/Template.html [new file with mode: 0755]
rt/webrt/Admin/Global/Templates.html [new file with mode: 0755]
rt/webrt/Admin/Global/UserRights.html [new file with mode: 0755]
rt/webrt/Admin/Global/index.html [new file with mode: 0755]
rt/webrt/Admin/Groups/Members.html [new file with mode: 0644]
rt/webrt/Admin/Groups/Modify.html [new file with mode: 0644]
rt/webrt/Admin/Groups/Rights.html [new file with mode: 0644]
rt/webrt/Admin/Groups/index.html [new file with mode: 0644]
rt/webrt/Admin/KeywordSelects/Modify.html [new file with mode: 0644]
rt/webrt/Admin/KeywordSelects/index.html [new file with mode: 0644]
rt/webrt/Admin/Keywords/Modify.html [new file with mode: 0644]
rt/webrt/Admin/Keywords/index.html [new file with mode: 0644]
rt/webrt/Admin/Queues/Create.html [new file with mode: 0755]
rt/webrt/Admin/Queues/GroupRights.html [new file with mode: 0755]
rt/webrt/Admin/Queues/Keywords.html [new file with mode: 0644]
rt/webrt/Admin/Queues/Modify.html [new file with mode: 0755]
rt/webrt/Admin/Queues/People.html [new file with mode: 0755]
rt/webrt/Admin/Queues/Scrips.html [new file with mode: 0755]
rt/webrt/Admin/Queues/Template.html [new file with mode: 0755]
rt/webrt/Admin/Queues/Templates.html [new file with mode: 0755]
rt/webrt/Admin/Queues/UserRights.html [new file with mode: 0755]
rt/webrt/Admin/Queues/index.html [new file with mode: 0755]
rt/webrt/Admin/Users/Modify.html [new file with mode: 0755]
rt/webrt/Admin/Users/Prefs.html [new file with mode: 0755]
rt/webrt/Admin/Users/Rights.html [new file with mode: 0644]
rt/webrt/Admin/Users/index.html [new file with mode: 0755]
rt/webrt/Admin/index.html [new file with mode: 0755]
rt/webrt/Elements/Checkbox [new file with mode: 0755]
rt/webrt/Elements/CreateTicket [new file with mode: 0644]
rt/webrt/Elements/CustomHomepageHeader [new file with mode: 0644]
rt/webrt/Elements/Error [new file with mode: 0755]
rt/webrt/Elements/Footer [new file with mode: 0755]
rt/webrt/Elements/GotoTicket [new file with mode: 0644]
rt/webrt/Elements/Header [new file with mode: 0755]
rt/webrt/Elements/ListActions [new file with mode: 0755]
rt/webrt/Elements/Login [new file with mode: 0755]
rt/webrt/Elements/MessageBox [new file with mode: 0644]
rt/webrt/Elements/MyRequests [new file with mode: 0644]
rt/webrt/Elements/MyTickets [new file with mode: 0644]
rt/webrt/Elements/Quicksearch [new file with mode: 0644]
rt/webrt/Elements/Refresh [new file with mode: 0644]
rt/webrt/Elements/Section [new file with mode: 0755]
rt/webrt/Elements/SelectBoolean [new file with mode: 0755]
rt/webrt/Elements/SelectDate [new file with mode: 0755]
rt/webrt/Elements/SelectDateRelation [new file with mode: 0755]
rt/webrt/Elements/SelectDateType [new file with mode: 0755]
rt/webrt/Elements/SelectEqualityOperator [new file with mode: 0755]
rt/webrt/Elements/SelectKeyword [new file with mode: 0644]
rt/webrt/Elements/SelectKeywordOptions [new file with mode: 0644]
rt/webrt/Elements/SelectLinkType [new file with mode: 0644]
rt/webrt/Elements/SelectMatch [new file with mode: 0644]
rt/webrt/Elements/SelectNewTicketQueue [new file with mode: 0755]
rt/webrt/Elements/SelectOwner [new file with mode: 0755]
rt/webrt/Elements/SelectQueue [new file with mode: 0755]
rt/webrt/Elements/SelectResultsPerPage [new file with mode: 0644]
rt/webrt/Elements/SelectSortOrder [new file with mode: 0644]
rt/webrt/Elements/SelectStatus [new file with mode: 0755]
rt/webrt/Elements/SelectTicketSortBy [new file with mode: 0644]
rt/webrt/Elements/SelectUsers [new file with mode: 0755]
rt/webrt/Elements/SelectWatcherType [new file with mode: 0644]
rt/webrt/Elements/ShadedBox [new file with mode: 0755]
rt/webrt/Elements/Submit [new file with mode: 0755]
rt/webrt/Elements/Tabs [new file with mode: 0755]
rt/webrt/Elements/TitleBoxEnd [new file with mode: 0755]
rt/webrt/Elements/TitleBoxStart [new file with mode: 0755]
rt/webrt/Elements/ViewUser [new file with mode: 0644]
rt/webrt/Elements/dayMenu [new file with mode: 0755]
rt/webrt/Elements/monthMenu [new file with mode: 0755]
rt/webrt/Elements/yearMenu [new file with mode: 0755]
rt/webrt/NoAuth/Logout.html [new file with mode: 0755]
rt/webrt/NoAuth/Reminder.html [new file with mode: 0755]
rt/webrt/NoAuth/images/rt.jpg [new file with mode: 0644]
rt/webrt/NoAuth/images/spacer.gif [new file with mode: 0644]
rt/webrt/NoAuth/webrt.css [new file with mode: 0755]
rt/webrt/Search/Bulk.html [new file with mode: 0755]
rt/webrt/Search/Listing.html [new file with mode: 0755]
rt/webrt/Search/PickRestriction [new file with mode: 0755]
rt/webrt/Search/RestrictSearch.html [new file with mode: 0755]
rt/webrt/Search/TicketCell [new file with mode: 0644]
rt/webrt/SelfService/Attachment/dhandler [new file with mode: 0644]
rt/webrt/SelfService/Closed.html [new file with mode: 0644]
rt/webrt/SelfService/Create.html [new file with mode: 0755]
rt/webrt/SelfService/Display.html [new file with mode: 0755]
rt/webrt/SelfService/Elements/GotoTicket [new file with mode: 0755]
rt/webrt/SelfService/Elements/Header [new file with mode: 0755]
rt/webrt/SelfService/Elements/MyRequests [new file with mode: 0644]
rt/webrt/SelfService/Elements/Tabs [new file with mode: 0644]
rt/webrt/SelfService/Error.html [new file with mode: 0755]
rt/webrt/SelfService/Prefs.html [new file with mode: 0755]
rt/webrt/SelfService/Update.html [new file with mode: 0755]
rt/webrt/SelfService/index.html [new file with mode: 0644]
rt/webrt/Ticket/Attachment/dhandler [new file with mode: 0644]
rt/webrt/Ticket/Create.html [new file with mode: 0755]
rt/webrt/Ticket/Display.html [new file with mode: 0755]
rt/webrt/Ticket/Elements/AddWatchers [new file with mode: 0755]
rt/webrt/Ticket/Elements/EditBasics [new file with mode: 0755]
rt/webrt/Ticket/Elements/EditDates [new file with mode: 0755]
rt/webrt/Ticket/Elements/EditKeywordSelects [new file with mode: 0644]
rt/webrt/Ticket/Elements/EditLinks [new file with mode: 0755]
rt/webrt/Ticket/Elements/EditPeople [new file with mode: 0755]
rt/webrt/Ticket/Elements/EditWatchers [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowBasics [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowDates [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowDependencies [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowHistory [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowKeywordSelects [new file with mode: 0644]
rt/webrt/Ticket/Elements/ShowLinks [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowMemberOf [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowMembers [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowPeople [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowReferences [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowRequestor [new file with mode: 0644]
rt/webrt/Ticket/Elements/ShowSummary [new file with mode: 0755]
rt/webrt/Ticket/Elements/ShowTransaction [new file with mode: 0755]
rt/webrt/Ticket/Elements/Tabs [new file with mode: 0755]
rt/webrt/Ticket/Elements/ToolBar [new file with mode: 0755]
rt/webrt/Ticket/History.html [new file with mode: 0755]
rt/webrt/Ticket/Modify.html [new file with mode: 0755]
rt/webrt/Ticket/ModifyAll.html [new file with mode: 0755]
rt/webrt/Ticket/ModifyDates.html [new file with mode: 0755]
rt/webrt/Ticket/ModifyLinks.html [new file with mode: 0755]
rt/webrt/Ticket/ModifyPeople.html [new file with mode: 0755]
rt/webrt/Ticket/Update.html [new file with mode: 0755]
rt/webrt/User/Prefs.html [new file with mode: 0755]
rt/webrt/autohandler [new file with mode: 0755]
rt/webrt/index.html [new file with mode: 0644]

diff --git a/rt/COPYING b/rt/COPYING
new file mode 100755 (executable)
index 0000000..e77696a
--- /dev/null
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/rt/ChangeLog b/rt/ChangeLog
new file mode 100644 (file)
index 0000000..549a5ca
--- /dev/null
@@ -0,0 +1,16016 @@
+2002-07-19 22:47  jesse
+
+       * README:
+
+       Fixed the readme about fastcgi
+       
+2002-07-19 22:42  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.14
+       
+2002-07-19 01:22  jesse
+
+       * Makefile, bin/rt, webrt/Search/Bulk.html:
+
+       RT-Ticket: 1547
+       
+       Bumping the version to 2.0.14-pre4
+       Fixing a typo that pdh caught in Tickets/Bulk.html
+       
+2002-07-13 00:22  jesse
+
+       * Makefile:
+
+       Bumped to 2.0.14-pre3
+       
+2002-07-13 00:19  jesse
+
+       * bin/webmux.pl:
+
+       modperl handler now speaks Mason 1.11 properly.
+       
+2002-07-13 00:00  jesse
+
+       * etc/config.pm:
+
+       Shifted some config defaults to make things easier for newbie users
+       
+2002-07-12 13:31  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Now we properly strip long pathnames from attachments uploaded from windows boxes.
+       
+2002-07-11 01:41  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Fixing a typo in the mason 11 handler
+       
+2002-07-10 14:41  jesse
+
+       * Makefile:
+
+       Bumping the version to 2.0.14-pre2
+       
+2002-07-10 14:36  jesse
+
+       * lib/RT/User.pm:
+
+       [no log message]
+       
+2002-07-10 14:35  jesse
+
+       * lib/RT/: Queue.pm, Ticket.pm:
+
+       RT-Ticket: 1418
+       RT-Status: resolved
+       
+       minor perldoc cleanups from pdh@snapgear
+       
+2002-07-10 14:32  jesse
+
+       * bin/rt-mailgate, lib/RT/Action/SendEmail.pm:
+
+       RT-Ticket: 1425
+       RT-Status: resolved
+       RT-Milestone: 2.0.x
+       RT-Subsystem: Mail Sending
+       
+       Fixes to create more proper message ids.
+       
+2002-07-10 14:28  jesse
+
+       * lib/RT/Ticket.pm:
+
+       RT-Ticket: 1431
+       RT-Status: resolved
+       
+       Importing tickets now lets you set the "Resolved" date
+       
+2002-07-10 14:17  jesse
+
+       * lib/RT/Tickets.pm:
+
+       RT-Ticket: 1434
+       RT-Status: resolved
+       RT-Subsystem: Core
+       RT-Milestone: 2.0.x
+       
+       RT is now smarter about letting you do "or" searches on single-value
+       keyword selections. Thanks to sam hartman.
+       
+2002-07-10 14:15  jesse
+
+       * webrt/Ticket/: Display.html, ModifyAll.html:
+
+       RT-Ticket: 1433
+       RT-Status: resolved
+       RT-Milestone: 2.0.x
+       RT-Subsystem: HTML::Mason frontend
+       RT-Severity: Nice to have
+       RT-Broken In: 2.0.13
+       RT-Broken In: 2.0.12
+       RT-Broken In: 2.0.11
+       RT-Broken In: 2.0.10
+       RT-Broken In: 2.0.0
+       RT-Broken In: 2.0.1
+       RT-Broken In: 2.0.2
+       RT-Broken In: 2.0.3
+       RT-Broken In: 2.0.4
+       RT-Broken In: 2.0.5
+       RT-Broken In: 2.0.6
+       RT-Broken In: 2.0.7
+       RT-Broken In: 2.0.8
+       RT-Broken In: 2.0.9
+       
+       Some signatures weren't setting off the "don't record comments if the update
+       is only a signature" code. Fixed.
+       
+2002-07-10 13:59  jesse
+
+       * lib/RT/Transaction.pm:
+
+       RT-Ticket: 1501
+       RT-Status: resolved
+       
+       Fixing docs in Transaction.pm's Message method
+       
+2002-07-10 13:19  jesse
+
+       * bin/rt:
+
+       RT-Ticket: 1528
+       RT-Milestone: 2.0.x
+       RT-Subsystem: CLI
+       RT-Severity: Normal
+       RT-Status: resolved
+       
+       Fixed docs for cli to say that --limit-status=dead isn't a valid option
+       
+2002-06-26 15:22  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       support for mason 1.1
+       
+2002-06-26 15:19  jesse
+
+       * Makefile, bin/mason_handler.fcgi, bin/webmux.pl,
+       webrt/Admin/Queues/GroupRights.html,
+       webrt/Admin/Queues/UserRights.html, webrt/Elements/ListActions,
+       webrt/Ticket/Elements/ShowBasics, webrt/Ticket/Elements/ToolBar:
+
+       Adding support for mason 1.10
+       
+2002-06-26 15:15  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       Fixed notify cc behavior
+       
+2002-06-26 15:13  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       Fixed pseudo-list syntax in To: lines
+       
+2002-06-26 15:09  jesse
+
+       * webrt/Search/Bulk.html:
+
+       Added support for bulk comment/reply
+       
+2002-05-03 02:07  jesse
+
+       * lib/RT/Ticket.pm:
+
+       RT-Ticket: 1369
+       RT-Status: resolved
+       
+       When a ticket has another merged into it, it now has its "LastUpdated" date
+       updated
+       
+2002-05-03 01:58  jesse
+
+       * lib/RT/Ticket.pm:
+
+       RT-Ticket: 1412
+       RT-status: resolved
+       
+       Fixed a docs bug in Ticket->Import which didn't make it clear that Import
+       took an "Id" parameter and "Create" didn't.
+       
+2002-05-03 01:54  jesse
+
+       * webrt/autohandler:
+
+       rt-ticket: 1410
+       rt-status: resolved
+       
+       Applied a patch from rich lafferty which prevented NoAuth from not
+       requiring authentication on some fastcgi setups.
+       
+       A similar bug bit SelfService.
+       
+       This commit fixes that one too.
+       
+2002-05-03 01:51  jesse
+
+       * Makefile:
+
+       RT-Ticket: 1272
+       rt-status: resolved
+       
+       Applied a patch from Ilya Martynov which allows make insert to work
+       in a scenario where DESTDIR is being set to something funny This may be necessary when installing into AFS
+       
+2002-05-03 01:36  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       RT-Ticket: 1367
+       RT-Status: resolved
+       
+       Added a check which only sets precedence to bulk if it's not already set,
+       say by a template.
+       
+2002-05-03 01:30  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       RT-Ticket: 1370
+       RT-Status: resolved
+       
+       From: Jason Edgecombe <jedgecombe@carolina.rr.com>
+       To: rt-devel@lists.fsck.com
+       Subject: [rt-devel] An oversite in Interface/Email.pm
+       
+       Hi,
+       
+          I found an problem in Interface/Email.pm when I was modifying
+          enhanced mailgate. I have attached a diff of the modifications.
+       
+          In the function MailError, it assumes MIMIEOBJ is defined. I added a
+          simple "if" test to only run $MIMEOBJ->sync_headers if $MIMEOBJ is defined.
+       
+2002-05-03 01:24  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       RT-Ticket: 1348
+       RT-Status: resolved
+       
+       Fixed a bug in mail sending that improperly quoted the usernames of users
+       who had " in their names
+       
+2002-04-29 00:39  jesse
+
+       * lib/RT.pm:
+
+       Fixed a tiny typo
+       
+2002-04-28 23:46  jesse
+
+       * lib/RT.pm:
+
+       Fixed up the rt log messages.
+       
+2002-04-21 02:14  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Fixed a couple bugs in setting owners that were only revealed by the poor data
+       validation on rt.cpan.org
+       
+2002-04-21 02:06  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Fixed a couple bugs in setting owners that were only revealed by the poor data
+       validation on rt.cpan.org
+       
+2002-04-19 00:32  jesse
+
+       * Makefile:
+
+       Adding a new Makefile target to ease packaging.
+       
+2002-04-18 12:47  jesse
+
+       * lib/RT/GroupMember.pm:
+
+       RT-Ticket: 1385
+       RT-Broken-In: 2.0.0
+       RT-Broken-In: 2.0.1
+       RT-Broken-In: 2.0.2
+       RT-Broken-In: 2.0.3
+       RT-Broken-In: 2.0.4
+       RT-Broken-In: 2.0.5
+       RT-Broken-In: 2.0.6
+       RT-Broken-In: 2.0.7
+       RT-Broken-In: 2.0.8
+       RT-Broken-In: 2.0.9
+       RT-Broken-In: 2.0.10
+       RT-Broken-In: 2.0.11
+       RT-Broken-In: 2.0.12
+       RT-Broken-In: 2.0.13
+       RT-Status: resolved
+       
+       GroupMemmber was looking for the "ModifyGroups" right, when it should have
+       been looking for the "AdminGroups" right
+       
+2002-04-05 10:24  jesse
+
+       * webrt/Ticket/Update.html:
+
+       RT-Ticket: 1330
+       RT-Status: Resolved
+       
+       Fixed an html escaping bug in Ticket/Update.html
+       
+2002-03-27 22:59  jesse
+
+       * Makefile, lib/RT/User.pm:
+
+       Fixed a CRITICAL security bug that allowed remote administrative access
+       to RT without a password.  (Security advisory to follow)
+       
+2002-03-14 16:15  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.12
+       
+2002-03-06 18:57  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.12pre6
+       
+2002-03-06 18:57  jesse
+
+       * lib/RT/Transaction.pm:
+
+       Added an update that will make dates changed as parts of transaction updates show up in local time
+       
+2002-03-06 18:56  jesse
+
+       * webrt/Admin/Queues/Modify.html:
+
+       Added a note to the queue creation screen about defaults.
+       
+2002-03-01 01:41  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       This patch fixes a small problem with printing a message.It checks if themessage is true, not if it has length, so a message containing 0 will notbe printed.  From Blair Zajac <blair@orcaware.com>
+       
+2002-03-01 01:39  jesse
+
+       * bin/rt:
+
+       RT-Ticket:438
+       RT-Status: resolved
+       
+       Added brandon's patch to allow searching for tickets by keyword on the commandline
+       
+2002-02-28 02:03  jesse
+
+       * bin/rt:
+
+       RT-Ticket: 1258
+       RT-Milestone: 2.0.x
+       RT-Subsystem: CLI
+       RT-Severity: normal
+       RT-Broken in: 2.0-beta3
+       RT-Broken in: 2.0.1
+       RT-Broken in: 2.0.2
+       RT-Broken in: 2.0.3
+       RT-Broken in: 2.0.4
+       RT-Broken in: 2.0.5
+       RT-Broken in: 2.0.6
+       RT-Broken in: 2.0.7
+       RT-Broken in: 2.0.8
+       RT-Broken in: 2.0.9
+       RT-Broken in: 2.0.10
+       RT-Broken in: 2.0.11
+       
+       Removed a line that make --limit-priority and --limit-final-priority not
+       work
+       
+2002-02-28 01:49  jesse
+
+       * lib/RT/Action/: Autoreply.pm, SendEmail.pm:
+
+       RT-Ticket: 1196
+       RT-Status: resolved
+       
+2002-02-28 01:38  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       RT-Ticket: 1246
+       RT-Status: resolved
+       
+2002-02-28 01:38  jesse
+
+       * tools/testdeps:
+
+       Added a couple explicit dependencies to testdeps that should have been there
+       forever ago. you'll only run into this if your cpan doesn't do recursive deps.
+       
+2002-02-20 20:45  jesse
+
+       * Makefile, lib/RT/Interface/Web.pm, webrt/Admin/Users/index.html,
+       webrt/Ticket/Update.html:
+
+       Bumped the version to 2.0.12-pre5.
+       
+       Web: Fixed a typo in user administration that prevented user listing
+       
+       Web: fixed recieve to receive in ticket/update
+       
+2002-02-19 03:23  jesse
+
+       * lib/RT/Scrips.pm:
+
+       Fixed a typo. (Added a missing ;)
+       
+2002-02-19 01:04  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.12pre4
+       
+2002-02-18 18:35  jesse
+
+       * lib/RT/Condition/Generic.pm:
+
+       RT-Ticket: 1194
+       
+       cleaned up a reference to "ApplicableTypes", a nonexistent parameter to Condition->new
+       
+2002-02-18 18:30  jesse
+
+       * webrt/Elements/Login:
+
+       RT-Ticket: 1226
+       RT-Status: resolved
+       
+       Added an explicit reset of the content-type to 'text/html' when displaying hte login page
+       
+2002-02-18 18:25  jesse
+
+       * webrt/Admin/Users/index.html:
+
+       rt-ticket: 1190
+       rt-status: resolved
+       
+       Modified administrative userlist to make it easier to click on users who have no Name attribute defined
+       
+2002-02-18 18:18  jesse
+
+       * webrt/: Elements/Header, SelfService/Elements/Header:
+
+       rt-ticket: 1176
+       rt-status: resolved
+       
+       Applied tom's patch which hides the preferences link if the user doesn't have the right to "modify self"
+       
+2002-02-18 18:14  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       RT-Ticket: 1165
+       RT-Status: resolved
+       
+       exporting the ParseAddressFromHeader subroutine so others can play with it
+       
+2002-02-18 18:06  jesse
+
+       * webrt/Ticket/Update.html:
+
+       RT-Ticket:1209
+       RT-Milestone: 2.0.x
+       RT-Status: resolved
+       
+       Removed  a bogus font tag from the Ticket update screen
+       
+2002-02-18 18:00  jesse
+
+       * lib/RT/Interface/Web.pm, webrt/Search/Listing.html:
+
+       RT-Ticket: 1243
+       RT-Status: resolved
+       RT-Milestone: 2.0.x
+       RT-Broken-In: 2.0.8
+       RT-Broken-In: 2.0.9
+       RT-Broken-In: 2.0.10
+       RT-Broken-In: 2.0.11
+       RT-Subsystem: HTML::Mason Frontend
+       RT-Severity: Normal
+       
+       Switched the web frontend to use an in-core scalar for uploaded attachment content,
+       rather than a tempfile which wasn't getting cleaned up properly
+       
+2002-02-18 16:53  jesse
+
+       * webrt/Search/Listing.html:
+
+       RT-Ticket: 1245
+       Rt-status: resolved
+       
+       Applied a patch to nuke duplicate restrictions in the webui.
+       
+2002-02-18 16:47  jesse
+
+       * webrt/Admin/Groups/Members.html:
+
+       RT-Ticket: 1421
+       RT-Status: resolved
+       
+       moved a label inside a loop to make the ui easier to understand
+       
+2002-02-18 16:36  jesse
+
+       * etc/config.pm:
+
+       Set Default for UseFriendlyToLines to 0 by default, to deal with users running
+       redhat who have trouble configuring RT.
+       
+2002-02-18 16:31  jesse
+
+       * Makefile, lib/RT/Scrip.pm, tools/insertdata:
+
+       Edited insertdata to insert scrips by default, so that users don't need
+       to go through the configuration task themselves.
+       
+       Change the Makefile's WEB_GROUP to www by default for redhat and OSX.
+       
+       Correced docs for lib/RT/Scrip new() method
+       
+2002-02-08 01:23  jesse
+
+       * webrt/SelfService/Display.html:
+
+       cleanup to "last trans" in SelfService
+       
+2002-02-08 00:53  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Generalized "Abort" function to allow other non-html error messages with
+       proper handlers
+       
+2002-02-08 00:49  jesse
+
+       * etc/: schema.Pg, schema.mysql:
+
+       removed duplicate indices
+       
+2002-02-07 16:41  jesse
+
+       * etc/config.pm:
+
+       Added some docs to the config file from Rich Lafferty
+       
+2002-02-04 12:37  jesse
+
+       * lib/RT/Template.pm:
+
+       Output template content to core rather than disk when parsing.
+       
+2002-01-28 01:01  jesse
+
+       * webrt/Ticket/Elements/ShowHistory:
+
+       closing lasttrans anchor
+       
+2002-01-28 00:59  jesse
+
+       * webrt/Ticket/Elements/ShowHistory:
+
+       Closing the #lasttrans anchor
+       
+2002-01-28 00:58  jesse
+
+       * lib/RT/Record.pm:
+
+       RT-Ticket: 1156
+       
+       Pulling forward the patch for 1156
+       
+2002-01-28 00:57  jesse
+
+       * lib/RT/Record.pm:
+
+       RT-Ticket: 1156
+       RT-Status: resolved
+       
+2002-01-28 00:47  jesse
+
+       * bin/mason_handler.fcgi:
+
+       Small fix to the fastcgi handler to make attachment display work better,
+       thanks to rich lafferty.
+       
+2002-01-28 00:47  jesse
+
+       * etc/config.pm:
+
+       Removed some extraneous slashes from the config file.
+       
+2002-01-28 00:46  jesse
+
+       * README:
+
+       Clarified some readme stuff
+       
+2002-01-28 00:44  jesse
+
+       * bin/rt-commit-handler:
+
+       Bringing forward a fix to the cvs commit handler to deal with branched
+       version #s.
+       
+2002-01-28 00:40  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.1.1
+       
+2002-01-28 00:27  jesse
+
+       * etc/RT_Config.pm:
+
+       file RT_Config.pm was initially added on branch rt-2-1.
+       
+2002-01-28 00:27  jesse
+
+       * bin/enhanced-mailgate:
+
+       file enhanced-mailgate was initially added on branch rt-2-1.
+       
+2002-01-28 00:27  jesse
+
+       * bin/rt-commit-handler:
+
+       file rt-commit-handler was initially added on branch rt-2-1.
+       
+2002-01-28 00:27  jesse
+
+       * Makefile, bin/enhanced-mailgate, bin/mason_handler.fcgi, bin/rt,
+       bin/rt-commit-handler, bin/rt-mailgate, bin/rtadmin, bin/webmux.pl,
+       etc/RT_Config.pm, etc/acl.Oracle, etc/acl.Pg, etc/acl.mysql,
+       etc/config.pm, lib/RT.pm, lib/RT/Handle.pm, lib/RT/User.pm,
+       lib/RT/Watcher.pm, lib/RT/Interface/CLI.pm,
+       lib/RT/Interface/Email.pm, tools/cpan2rpm, tools/initdb,
+       tools/insertdata, tools/testdeps:
+
+       First RT 2.1 checkin. don't expect this to run.  (though it does here)
+       
+2002-01-25 17:37  jesse
+
+       * README:
+
+       Added a warning to the readme that 2.1 is scary and people shouldn't use it
+       
+2002-01-25 17:24  jesse
+
+       * Makefile:
+
+       Branching 2.1.0  and incrementing the makefile to 2.1.
+       
+       Welcome to the future.
+       
+2002-01-24 13:30  jesse
+
+       * lib/RT/Transaction.pm:
+
+       RT-Ticket: 1201
+       RT-Status: resolved
+       
+       Better transaction display for "text" and "message" parts.
+       
+2002-01-24 13:00  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       RT-Ticket: 1166
+       RT-Status: resolved
+       
+       Implemented better URL regexp matching.
+       
+2002-01-24 10:39  jesse
+
+       * bin/rt-mailgate:
+
+       Fixed a typo in a debug message in rt-mailgate
+       
+2002-01-24 10:34  jesse
+
+       * lib/RT/Template.pm:
+
+       Switched from bogus mime parsing to using MIME::Parser like we should have
+       from the get-go.
+       
+       Used perltidy to clean up template.pm before we started working on it.
+       
+2002-01-24 10:28  jesse
+
+       * lib/RT/Record.pm:
+
+       Added a check to LoadByCols which causes postgres mode to not try to lookup
+       lc(undef)
+       
+2002-01-24 10:23  jesse
+
+       * webrt/NoAuth/webrt.css:
+
+       Added a new style to the stylesheet to support some new reports
+       
+2002-01-24 10:21  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       mail gateway now unfolds long headers on parse.
+       
+2002-01-11 15:20  jesse
+
+       * Makefile, lib/RT/Transaction.pm:
+
+       RT-Ticket: 950
+       
+       Aoolyed the recommended patch to make blank bodies not get
+       mailed in lieu of the real message
+       
+2002-01-11 15:00  jesse
+
+       * Makefile, webrt/Ticket/ModifyAll.html:
+
+       Fixed a small bug that broke the "jumbo" page after 2.0.11
+       
+2002-01-11 01:17  jesse
+
+       * bin/rt-mailgate:
+
+       Added a new flag to rt-mailgate to enable setting the owner of new tickets based on +extension
+       
+2002-01-11 01:13  jesse
+
+       * webrt/Ticket/: Modify.html, ModifyAll.html:
+
+       Adding a couple ACL checks to better deal with moving tickets to queues the user can't see
+       
+2002-01-11 01:11  jesse
+
+       * webrt/Admin/Queues/index.html:
+
+       Fixed typo in ACL check that resulted in "Create Queue" being more restrictive than
+       it needed to be
+       
+2002-01-10 19:07  jesse
+
+       * webrt/Ticket/Update.html:
+
+       more tweaking
+       
+2002-01-10 19:05  jesse
+
+       * webrt/Ticket/Update.html:
+
+       Cleaned up the Ticekt Update ui some
+       
+2002-01-10 19:02  jesse
+
+       * lib/RT/: Attachment.pm, Action/Notify.pm, Condition/Generic.pm:
+
+       Cleanups to make Also-Cc and Also-Bcc go
+       
+2002-01-10 19:01  jesse
+
+       * lib/RT/Queue.pm:
+
+       Changed a test to work the way that Test::Inline does now
+       
+2002-01-10 18:34  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Changes to attachment to provide the header frobbing necessary to send mail to ccs and bccs
+       
+2002-01-10 18:32  jesse
+
+       * Makefile, README, lib/RT/Ticket.pm, tools/insertdata,
+       webrt/Ticket/Update.html, lib/RT/Action/Notify.pm:
+
+       Work on "Explicit Cc" and "Explicit Bcc" for a client
+       
+2002-01-10 18:27  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       abstracting out a number to a named variable
+       
+2002-01-09 02:24  jesse
+
+       * webrt/Admin/: Groups/index.html, Keywords/index.html:
+
+       A couple tiny ui cleanups (removed some object ids from the UI where they were just being clutter
+       
+2002-01-02 21:58  jesse
+
+       * Makefile, README, webrt/Elements/Login:
+
+       Bumped some copyright notices to 2002. bumped version to 2.0.11
+       
+2001-12-26 14:59  jesse
+
+       * Makefile:
+
+       Bumping version to 2.0.11pre1
+       
+2001-12-26 14:51  jesse
+
+       * lib/RT/Tickets.pm:
+
+       Merges were being over-zealous in what they twiddled the effective id of.
+       
+       this meant that far too many tickets would show up in ticket listings.
+       
+2001-12-24 18:58  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.10
+       
+2001-12-19 00:24  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.10pre4
+       
+       fix to makefile to genereate changelog for head
+       
+2001-12-18 03:58  jesse
+
+       * lib/RT/Tickets.pm:
+
+       The "null search" was finding all tickets in 2.0.10pre3.  Fixed in CVS
+       
+2001-12-18 03:53  jesse
+
+       * bin/rt:
+
+       fixed typos in bin/rt that stopped --limit-subject --limit-requestors and --limit-body from
+       working
+       
+2001-12-17 15:13  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.10-test3
+       
+2001-12-17 14:58  jesse
+
+       * lib/RT/User.pm, tools/insertdata, webrt/Admin/Users/Modify.html:
+
+       RT-Ticket: 935
+       RT-Status: resolved
+       
+       cleaned up seph's patch. this enabled me to actually really properly support
+       users with no email address, which meant there were a couple other cleanups
+       to go through too.
+       
+2001-12-17 14:26  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Some small cleanups to the IsWatcher stuff.
+       
+       Added checks to make sure that watchers aren't duplicated to ticket.pm
+       
+2001-12-17 13:04  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       Fixed an unclosed anchor which caused IE to render ticket listings wrong.
+       
+2001-12-14 18:29  jesse
+
+       * lib/Makefile.PL, tools/testdeps:
+
+       Bumped DBIx::SearchBuilder dependency to 0.48
+       
+2001-12-14 18:28  jesse
+
+       * tools/testdeps, webrt/Elements/Login:
+
+       Removed code to special case for bugs in mason < 1.01.
+       Moved us up to a mason 1.02 dependency
+       
+2001-12-14 18:26  jesse
+
+       * bin/rt:
+
+       bin/rt: added support for --version, fixed --status = !closed, docced --merge-into
+       
+2001-12-14 18:25  jesse
+
+       * Makefile:
+
+       Some stylistic cleanups  to the makefile from blair.
+       
+2001-12-14 16:42  jesse
+
+       * bin/rtadmin:
+
+       rtadmin had some issues where it would assume a 'name' if called without --name for user group and queue editing.
+       
+2001-12-14 16:06  jesse
+
+       * lib/RT/Tickets.pm:
+
+       
+       Ticket listings will no longer show tickets which have been merged into others.
+       
+               -j
+       
+2001-12-14 15:27  jesse
+
+       * lib/RT/User.pm:
+
+       Prevent users from futzing with nobody or rt_System, unless you're setting an email address.
+       (Arguably, that's a bug too)
+       
+2001-12-14 14:03  jesse
+
+       * lib/RT/: ACE.pm, Group.pm, GroupMember.pm, Keyword.pm,
+       KeywordSelect.pm, Queue.pm, Scrip.pm, Template.pm, Ticket.pm:
+
+       Standardised on "Permission Denied" instead of having some "Permission denied". Thanks simon.
+       
+               -j
+       
+2001-12-14 13:46  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Reordered the order that Basics actions are committed, so that Queue changes
+       come after other changes, so that users don't move tickets out of a queue before they have a
+       chance to update them.
+       
+2001-12-13 02:18  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Addition to Ticket->Import, so you can set owner by name.
+       
+       Fix for a bug in Ticket->AddWatcher that would let privileged watchers without
+       email addresses add others as watchers.
+       
+2001-12-03 20:13  jesse
+
+       * Makefile, lib/RT/EasySearch.pm, lib/RT/Keyword.pm,
+       lib/RT/Record.pm, lib/RT/Tickets.pm, lib/RT/User.pm:
+
+       more work on making sure that only the things we want are case sensitive
+       (IE name, content email address should always be insensitive.  when loading a row by any field other than ID, that should be case-insensitive)
+       
+2001-12-03 19:17  jesse
+
+       * Makefile:
+
+       bumped the version  to 2.0.10-test1
+       
+2001-12-03 19:14  jesse
+
+       * lib/RT/EasySearch.pm:
+
+       We now default to case sensitive searches, rather than case-insensitive ones.
+       (This should speed up Pg a LOT. We'll be adding in case-insensitive searching
+       for the 13 attributes that matter:
+       
+       Watcher->Email
+       User->name
+       User->email
+       User->gecos
+       Ticket->Subject
+       Queue->name
+       KeywordSelect->name
+       Keyword->Name
+       ObjectKeyword->Name
+       Attachment->Subject
+       Attachment->Content
+       Attachment->Headers
+       
+2001-12-03 19:13  jesse
+
+       * webrt/: Admin/Queues/Modify.html, Admin/Queues/People.html,
+       Elements/GotoTicket:
+
+       Some small UI cleanups from Hakke
+       
+2001-11-29 03:50  jesse
+
+       * webrt/: Elements/SelectEqualityOperator, Elements/SelectOwner,
+       Search/PickRestriction:
+
+       SelectOwner now passes a ticket up the line.
+       
+       Priority can now have = and != searches
+       
+2001-11-29 03:49  jesse
+
+       * tools/insertdata:
+
+       Cleaned up a template to display Ticket subject, if no transaction subject is given.
+       
+2001-11-29 03:48  jesse
+
+       * webrt/Ticket/: Update.html, Elements/EditPeople:
+
+       Now pass in ticket Id, so that "owner" can be someone who only has rights to that tikcet.
+       
+2001-11-29 03:47  jesse
+
+       * lib/RT/Ticket.pm:
+
+       FinalPriority should never get set to null if a ticket doesn't have the attribute set on create
+       
+       Untake's arguments were debognifed
+       
+2001-11-29 03:45  jesse
+
+       * webrt/SelfService/Elements/Header:
+
+       "Logout" no longer shows up when using external auth with SelfService
+       
+2001-11-29 03:44  jesse
+
+       * bin/rt:
+
+       Fix for setting priority when creating tickets with the cli
+       
+2001-11-29 03:42  jesse
+
+       * bin/rt-mailgate:
+
+       Added support for --ticket-id-from-extension to rt-mailgate
+       
+2001-11-14 14:28  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.9
+       
+2001-11-13 11:33  jesse
+
+       * Makefile, bin/initacls.Pg, bin/rt:
+
+       rt-ticket:1007
+       rt-status: resolved
+       
+       initacls.pg no longer has extranious spaces which break variable assignment for port and host.
+       
+       Bumped version to 2.0.9pre9
+       
+2001-11-12 13:19  jesse
+
+       * Makefile, bin/initacls.Pg:
+
+       Fix for #1007 (Typo in bin/initacls.Pg)
+       Bumped version to 2.0.9pre8
+       
+2001-11-09 18:24  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       URL higlighting should now work with mailto: urls
+       
+2001-11-09 18:15  jesse
+
+       * Makefile, webrt/Ticket/Elements/ShowTransaction:
+
+       Cleaned up the url highlighting code
+       
+       Bumped the version to 2.0.9pre7
+       
+2001-11-09 17:27  jesse
+
+       * Makefile:
+
+       Fixing the new taggy stuff
+       
+2001-11-09 17:23  jesse
+
+       * Makefile:
+
+       Fixing the new branchy stuff
+       
+2001-11-09 17:07  jesse
+
+       * Makefile, bin/rtadmin, etc/config.pm,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Added a bit of doc to etc/config.pm
+       
+       Modified ShowTransaction to more properly escape html
+       
+       Fixed some of the cli help for rtadmin
+       
+       Added support for branch specification to the makefile
+       
+2001-11-08 15:15  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       I can commit on the head. really.
+       
+2001-11-08 15:06  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Dealing with defined but blank Owner fields
+       
+2001-11-06 18:06  jesse
+
+       * tools/cpan2rpm, tools/initdb, tools/insertdata, tools/testdeps,
+       webrt/autohandler, webrt/index.html, webrt/Admin/index.html,
+       webrt/Admin/Elements/CreateQueueCalled,
+       webrt/Admin/Elements/CreateUserCalled,
+       webrt/Admin/Elements/EditUserComments,
+       webrt/Admin/Elements/GrantQueueRightsTo,
+       webrt/Admin/Elements/GroupTabs, webrt/Admin/Elements/Header,
+       webrt/Admin/Elements/ListGlobalKeywordSelects,
+       webrt/Admin/Elements/ListGlobalScrips,
+       webrt/Admin/Elements/ModifyKeyword,
+       webrt/Admin/Elements/ModifyKeywordSelect,
+       webrt/Admin/Elements/ModifyQueue,
+       webrt/Admin/Elements/ModifyTemplate,
+       webrt/Admin/Elements/ModifyUser,
+       webrt/Admin/Elements/QueueRightsForUser,
+       webrt/Admin/Elements/QueueTabs,
+       webrt/Admin/Elements/SelectKeywordSelect,
+       webrt/Admin/Elements/SelectModifyGroup,
+       webrt/Admin/Elements/SelectModifyKeyword,
+       webrt/Admin/Elements/SelectModifyKeywordSelect,
+       webrt/Admin/Elements/SelectModifyQueue,
+       webrt/Admin/Elements/SelectModifyUser,
+       webrt/Admin/Elements/SelectQueueRights,
+       webrt/Admin/Elements/SelectRights,
+       webrt/Admin/Elements/SelectScrip,
+       webrt/Admin/Elements/SelectScripAction,
+       webrt/Admin/Elements/SelectScripCondition,
+       webrt/Admin/Elements/SelectSingleOrMultiple,
+       webrt/Admin/Elements/SelectTemplate,
+       webrt/Admin/Elements/SelectUsers, webrt/Admin/Elements/SystemTabs,
+       webrt/Admin/Elements/Tabs, webrt/Admin/Elements/UserTabs,
+       webrt/Admin/Global/GroupRights.html,
+       webrt/Admin/Global/Keywords.html, webrt/Admin/Global/Scrips.html,
+       webrt/Admin/Global/Template.html,
+       webrt/Admin/Global/Templates.html,
+       webrt/Admin/Global/UserRights.html, webrt/Admin/Global/index.html,
+       webrt/Admin/Groups/Members.html, webrt/Admin/Groups/Modify.html,
+       webrt/Admin/Groups/Rights.html, webrt/Admin/Groups/index.html,
+       webrt/Admin/KeywordSelects/Modify.html,
+       webrt/Admin/KeywordSelects/index.html,
+       webrt/Admin/Keywords/Modify.html, webrt/Admin/Keywords/index.html,
+       webrt/Admin/Queues/Create.html,
+       webrt/Admin/Queues/GroupRights.html,
+       webrt/Admin/Queues/Keywords.html, webrt/Admin/Queues/Modify.html,
+       webrt/Admin/Queues/People.html, webrt/Admin/Queues/Scrips.html,
+       webrt/Admin/Queues/Template.html,
+       webrt/Admin/Queues/Templates.html,
+       webrt/Admin/Queues/UserRights.html, webrt/Admin/Queues/index.html,
+       webrt/Admin/Users/Modify.html, webrt/Admin/Users/Prefs.html,
+       webrt/Admin/Users/Rights.html, webrt/Admin/Users/index.html,
+       webrt/Elements/Checkbox, webrt/Elements/CreateTicket,
+       webrt/Elements/CustomHomepageHeader, webrt/Elements/Error,
+       webrt/Elements/Footer, webrt/Elements/GotoTicket,
+       webrt/Elements/Header, webrt/Elements/ListActions,
+       webrt/Elements/Login, webrt/Elements/MessageBox,
+       webrt/Elements/MyRequests, webrt/Elements/MyTickets,
+       webrt/Elements/Quicksearch, webrt/Elements/Refresh,
+       webrt/Elements/Section, webrt/Elements/SelectBoolean,
+       webrt/Elements/SelectDate, webrt/Elements/SelectDateRelation,
+       webrt/Elements/SelectDateType, webrt/Elements/SelectKeyword,
+       webrt/Elements/SelectKeywordOptions, webrt/Elements/SelectLinkType,
+       webrt/Elements/SelectMatch, webrt/Elements/SelectNewTicketQueue,
+       webrt/Elements/SelectOwner, webrt/Elements/SelectQueue,
+       webrt/Elements/SelectResultsPerPage,
+       webrt/Elements/SelectSortOrder, webrt/Elements/SelectStatus,
+       webrt/Elements/SelectTicketSortBy, webrt/Elements/SelectUsers,
+       webrt/Elements/SelectWatcherType, webrt/Elements/ShadedBox,
+       webrt/Elements/Submit, webrt/Elements/Tabs,
+       webrt/Elements/TitleBoxEnd, webrt/Elements/TitleBoxStart,
+       webrt/Elements/ViewUser, webrt/Elements/dayMenu,
+       webrt/Elements/monthMenu, webrt/Elements/yearMenu,
+       webrt/NoAuth/Logout.html, webrt/NoAuth/Reminder.html,
+       webrt/NoAuth/webrt.css, webrt/NoAuth/images/rt.jpg,
+       webrt/NoAuth/images/spacer.gif, webrt/Search/Bulk.html,
+       webrt/Search/Listing.html, webrt/Search/PickRestriction,
+       webrt/Search/RestrictSearch.html, webrt/Search/TicketCell,
+       webrt/SelfService/Closed.html, webrt/SelfService/Create.html,
+       webrt/SelfService/Display.html, webrt/SelfService/Error.html,
+       webrt/SelfService/Prefs.html, webrt/SelfService/Update.html,
+       webrt/SelfService/index.html,
+       webrt/SelfService/Attachment/dhandler,
+       webrt/SelfService/Elements/GotoTicket,
+       webrt/SelfService/Elements/Header,
+       webrt/SelfService/Elements/MyRequests,
+       webrt/SelfService/Elements/Tabs, webrt/Ticket/Create.html,
+       webrt/Ticket/Display.html, webrt/Ticket/History.html,
+       webrt/Ticket/Modify.html, webrt/Ticket/ModifyAll.html,
+       webrt/Ticket/ModifyDates.html, webrt/Ticket/ModifyLinks.html,
+       webrt/Ticket/ModifyPeople.html, webrt/Ticket/Update.html,
+       webrt/Ticket/Attachment/dhandler,
+       webrt/Ticket/Elements/AddWatchers,
+       webrt/Ticket/Elements/EditBasics, webrt/Ticket/Elements/EditDates,
+       webrt/Ticket/Elements/EditKeywordSelects,
+       webrt/Ticket/Elements/EditLinks, webrt/Ticket/Elements/EditPeople,
+       webrt/Ticket/Elements/EditWatchers,
+       webrt/Ticket/Elements/ShowBasics, webrt/Ticket/Elements/ShowDates,
+       webrt/Ticket/Elements/ShowDependencies,
+       webrt/Ticket/Elements/ShowHistory,
+       webrt/Ticket/Elements/ShowKeywordSelects,
+       webrt/Ticket/Elements/ShowLinks,
+       webrt/Ticket/Elements/ShowMemberOf,
+       webrt/Ticket/Elements/ShowMembers,
+       webrt/Ticket/Elements/ShowPeople,
+       webrt/Ticket/Elements/ShowReferences,
+       webrt/Ticket/Elements/ShowRequestor,
+       webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction, webrt/Ticket/Elements/Tabs,
+       webrt/Ticket/Elements/ToolBar, webrt/User/Prefs.html:
+
+       Merging rt-1-1 to the head.
+       
+       RT 1.0 now lives on the rt-1-0 branch.
+       
+2001-11-06 18:03  jesse
+
+       * Makefile, NEWS, README, TODO, bin/initacls.Oracle,
+       bin/initacls.Pg, bin/initacls.mysql, bin/mason_handler.fcgi,
+       bin/mason_handler.scgi, bin/rt, bin/rt-mailgate, bin/rtadmin,
+       bin/rtmux.pl, bin/testdeps.pl, bin/webmux.pl, docs/FAQ,
+       docs/FAQ.html, docs/README.docs, docs/Security,
+       docs/rt-templates.html, docs/rt_users_guide.html,
+       docs/design_docs/CARS, docs/design_docs/TransactionTypes.txt,
+       docs/design_docs/acls, docs/design_docs/basic-definitions.txt,
+       docs/design_docs/cli_spec, docs/design_docs/cvs_integration,
+       docs/design_docs/evil_plans, docs/design_docs/link-definitions.txt,
+       docs/design_docs/local_hacking,
+       docs/design_docs/subscription-definitions.txt,
+       docs/design_docs/users, etc/acl.Oracle, etc/acl.Pg, etc/acl.mysql,
+       etc/config.pm, etc/mysql.acl, etc/rt.spec, etc/schema,
+       etc/schema.Oracle, etc/schema.Pg, etc/schema.mysql, etc/schema.pm,
+       etc/suidrt.c, lib/MANIFEST, lib/MANIFEST.SKIP, lib/Makefile.PL,
+       lib/RT.pm, lib/test.pl, lib/RT/ACE.pm, lib/RT/ACL.pm,
+       lib/RT/Attachment.pm, lib/RT/Attachments.pm, lib/RT/CurrentUser.pm,
+       lib/RT/Date.pm, lib/RT/EasySearch.pm, lib/RT/Group.pm,
+       lib/RT/GroupMember.pm, lib/RT/GroupMembers.pm, lib/RT/Groups.pm,
+       lib/RT/Handle.pm, lib/RT/Keyword.pm, lib/RT/KeywordSelect.pm,
+       lib/RT/KeywordSelects.pm, lib/RT/Keywords.pm, lib/RT/Link.pm,
+       lib/RT/Links.pm, lib/RT/ObjectKeyword.pm, lib/RT/ObjectKeywords.pm,
+       lib/RT/Queue.pm, lib/RT/Queues.pm, lib/RT/Record.pm,
+       lib/RT/Scrip.pm, lib/RT/ScripAction.pm, lib/RT/ScripActions.pm,
+       lib/RT/ScripCondition.pm, lib/RT/ScripConditions.pm,
+       lib/RT/Scrips.pm, lib/RT/Template.pm, lib/RT/Templates.pm,
+       lib/RT/TestHarness.pm, lib/RT/Ticket.pm, lib/RT/Tickets.pm,
+       lib/RT/Transaction.pm, lib/RT/Transactions.pm, lib/RT/User.pm,
+       lib/RT/Users.pm, lib/RT/Watcher.pm, lib/RT/Watchers.pm,
+       lib/RT/Action/Autoreply.pm, lib/RT/Action/Generic.pm,
+       lib/RT/Action/Notify.pm, lib/RT/Action/NotifyAsComment.pm,
+       lib/RT/Action/OpenDependent.pm, lib/RT/Action/README.hackers,
+       lib/RT/Action/ResolveMembers.pm, lib/RT/Action/SendEmail.pm,
+       lib/RT/Action/SendPasswordEmail.pm,
+       lib/RT/Action/StallDependent.pm,
+       lib/RT/Condition/AnyTransaction.pm, lib/RT/Condition/Generic.pm,
+       lib/RT/Condition/NewDependency.pm,
+       lib/RT/Condition/StatusChange.pm, lib/RT/Interface/CLI.pm,
+       lib/RT/Interface/Email.pm, lib/RT/Interface/Web.pm:
+
+       Merging rt-1-1 to the head.
+       
+       RT 1.0 now lives on the rt-1-0 branch.
+       
+2001-11-06 17:57  jesse
+
+       * rt.spec, etc/rt.spec:
+
+       Cleaned up spec file goodness
+       
+2001-11-06 16:28  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.9pre5
+       
+2001-11-05 00:55  jesse
+
+       * rt.spec, lib/Makefile.PL, tools/testdeps:
+
+       Bumped the searchbuilder dependency to 0.47
+       
+2001-11-05 00:54  jesse
+
+       * webrt/Ticket/Update.html:
+
+       Named the ticket update form.
+       
+2001-11-05 00:52  jesse
+
+       * etc/config.pm, lib/RT/Handle.pm:
+
+       Added support for postgres' connections-over-ssl
+       
+2001-11-05 00:49  jesse
+
+       * webrt/Admin/Elements/SelectRights:
+
+       Updated ACL selecting UI to work properly with browsers that try to auto-select
+       a value in a SELECT
+       
+2001-11-02 01:39  jesse
+
+       * Makefile:
+
+       bumped the version to 2.0.9pre4
+       
+2001-11-02 01:31  jesse
+
+       * webrt/Ticket/: Display.html, ModifyAll.html:
+
+       Fix to not automatically record comments if nothing was typed.
+       
+2001-11-02 00:52  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Fix for duplicated requestors on merge. #791
+       
+2001-11-01 17:40  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       More tweaking transaction display
+       
+2001-11-01 17:36  jesse
+
+       * webrt/: Admin/Users/Modify.html, Ticket/Elements/ShowTransaction:
+
+       Fixed newlines between ticket body and headers.
+       
+       Fix for 934: creating users doesn't completely fail (new)
+       
+2001-11-01 17:24  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       Cleanups to ShowTransaction
+       
+2001-11-01 17:10  jesse
+
+       * lib/RT/: Keyword.pm, Interface/Web.pm:
+
+       Fix for loading queue (post 2.0.8) when called by name
+       Fix for _not_ trying to load keywords when called with no value.
+       
+2001-10-31 17:38  jesse
+
+       * Makefile:
+
+       Fixed the make dist
+       
+2001-10-31 02:56  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.9pre3
+       
+2001-10-31 02:54  jesse
+
+       * lib/RT/Action/SendPasswordEmail.pm:
+
+       file SendPasswordEmail.pm was initially added on branch rt-1-1.
+       
+2001-10-31 02:54  jesse
+
+       * lib/RT/Action/SendPasswordEmail.pm:
+
+       Added an action to mail a password to the user.
+       
+2001-10-31 02:54  jesse
+
+       * bin/rt-mailgate:
+
+       added support to rt-mailgate for putting the queue name in a +extension
+       
+2001-10-31 02:52  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Tickets which are created in a "resolved" state will now have their "resolved"
+       date set right.
+       
+2001-10-31 02:51  jesse
+
+       * lib/RT/User.pm:
+
+       Started work on "Email password to user"
+       
+2001-10-31 02:48  jesse
+
+       * lib/RT/Watcher.pm:
+
+       Added a patch from Simon Cozens which makes sure that a requestor is always a user, rather than an email address.
+       
+2001-10-31 02:47  jesse
+
+       * lib/RT/Keyword.pm:
+
+       Added a helper Load function to Keyword to load by Id or Path
+       
+2001-10-31 02:42  jesse
+
+       * lib/RT/Template.pm:
+
+       
+       Template got new helper functions for loading queue and system templates.
+       
+2001-10-31 02:40  jesse
+
+       * bin/rt, bin/rtadmin, lib/RT/Interface/CLI.pm,
+       lib/RT/Interface/Email.pm:
+
+       Bringing forward a security fix from 2.0.8_01.  (nonusers could get superuser permissions from the CLI)
+       
+2001-10-31 02:37  jesse
+
+       * webrt/: Elements/MyRequests, Elements/MyTickets,
+       Ticket/Create.html:
+
+       Fixed a display bug in mytickets and myrequests which prevented clicking on
+       subjectless email
+       
+2001-10-31 02:04  jesse
+
+       * etc/: config.pm, schema.Pg, schema.mysql, schema.pm:
+
+       Lengthened queue name and email addresses in the default DB schema
+       
+2001-10-31 02:02  jesse
+
+       * webrt/Ticket/Update.html, lib/RT/Interface/Web.pm:
+
+       Now show the current ticket subject by default in the update subject box.
+       But don't include it in the transaction if it hasn't changed.
+       
+2001-10-31 01:09  jesse
+
+       * Makefile, bin/rt, bin/rt-mailgate, bin/rtadmin,
+       lib/RT/Interface/CLI.pm, lib/RT/Interface/Email.pm:
+
+       Security fixes per Jay at mojomole
+       
+2001-10-25 17:40  jesse
+
+       * webrt/Search/Listing.html:
+
+       Fixed a bug in new listing display. introduced after 2.0.8
+       
+2001-10-24 14:10  jesse
+
+       * Makefile, lib/RT/Ticket.pm:
+
+       Fixed the ticket status changes from open to open bug, thanks to raphael
+       at linkvest.
+       
+2001-10-23 17:34  jesse
+
+       * webrt/Ticket/Create.html:
+
+       Some cleanups to the Create form. No new functionality, just a little bit prettier
+       
+2001-10-23 17:34  jesse
+
+       * webrt/Elements/SelectTicketSortBy:
+
+       Elements/SelectTicketsSortBy now uses new list of sortable Tickets fields
+       in Tickets.pm
+       
+2001-10-23 17:32  jesse
+
+       * webrt/Search/Listing.html:
+
+       Column headings in searches are now clicky, where possible
+       
+2001-10-23 17:31  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       URLs in ticket history should now be clicky
+       
+2001-10-23 17:26  jesse
+
+       * webrt/Elements/CustomHomepageHeader:
+
+       file CustomHomepageHeader was initially added on branch rt-1-1.
+       
+2001-10-23 17:26  jesse
+
+       * webrt/: index.html, Elements/CustomHomepageHeader:
+
+       Added a hook for sites to put their own html in the top of the "Home" page
+       
+2001-10-23 17:24  jesse
+
+       * webrt/Elements/: SelectNewTicketQueue, SelectQueue:
+
+       Frefactored SelectQueue to elimintate dupicate code and enable a "too many queues" option
+       
+2001-10-23 17:22  jesse
+
+       * lib/: RT.pm, RT/Date.pm, RT/Keyword.pm, RT/KeywordSelect.pm,
+       RT/Keywords.pm, RT/Link.pm, RT/Links.pm, RT/ObjectKeywords.pm,
+       RT/Record.pm, RT/Scrip.pm, RT/ScripActions.pm,
+       RT/ScripConditions.pm, RT/Ticket.pm, RT/Action/SendEmail.pm,
+       RT/Condition/Generic.pm, RT/Interface/CLI.pm,
+       RT/Interface/Email.pm:
+
+       Simple fixes to POD from Feargal Reilly to fix complaints from pod2man
+       
+2001-10-23 17:08  jesse
+
+       * lib/RT/Tickets.pm:
+
+       Refactored Tickets.pm a bit to provide better access to fields
+       that tickets can be sorted on.
+       
+2001-10-23 17:06  jesse
+
+       * etc/: config.pm, schema.Pg, schema.mysql, schema.pm:
+
+       Added some new indices, based on recommendations from Nobel Tse at Outblaze
+       
+       Started to cleanup config.pm to not use deprecated methods when displaying
+       ticket columns.
+       
+2001-10-19 15:44  jesse
+
+       * Makefile, bin/initacls.Pg, bin/initacls.mysql, tools/initdb:
+
+       Reverting last patch. it lead to too much brokenness
+       
+2001-10-19 15:16  jesse
+
+       * Makefile, bin/initacls.Pg, bin/initacls.mysql, tools/initdb:
+
+       Work on the install procedure to automate it some more. (automatically supply
+       passwords defined in the makefile)
+       
+2001-10-19 00:49  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.9pre1
+       
+2001-10-19 00:46  jesse
+
+       * docs/design_docs/cvs_integration:
+
+       file cvs_integration was initially added on branch rt-1-1.
+       
+2001-10-19 00:46  jesse
+
+       * webrt/NoAuth/images/rt.jpg:
+
+       file rt.jpg was initially added on branch rt-1-1.
+       
+2001-10-19 00:46  jesse
+
+       * rt.spec, docs/design_docs/cvs_integration, etc/config.pm,
+       webrt/rt.jpg, webrt/Elements/Header, webrt/Elements/TitleBoxEnd,
+       webrt/Elements/TitleBoxStart, webrt/NoAuth/images/rt.jpg,
+       webrt/SelfService/Elements/Header:
+
+       Refactored images path to have a configurable URL, so it will work with fastcgi ;)
+       
+2001-10-19 00:37  jesse
+
+       * webrt/: Elements/Footer, autohandler:
+
+       Added support for timing of page display with &Debug=1
+       
+2001-10-19 00:29  jesse
+
+       * lib/RT/User.pm:
+
+       User.pm: a fix to allow you to create multiple users with no email address.
+       
+2001-10-19 00:25  jesse
+
+       * lib/RT/Tickets.pm:
+
+       Added sub Due to Tickets.pm. fixes #910
+       
+2001-10-19 00:17  jesse
+
+       * etc/rt.spec:
+
+       file rt.spec was initially added on branch rt-1-1.
+       
+2001-10-19 00:17  jesse
+
+       * Makefile, rt.spec, etc/rt.spec:
+
+       Some work on the rpm build infrastructure
+       
+2001-10-19 00:03  jesse
+
+       * tools/cpan2rpm:
+
+       cpan2rpm doesn't repeat builds of the same distribution, even if we're looking for differnet  modules
+       
+2001-10-18 23:30  jesse
+
+       * tools/cpan2rpm:
+
+       cpan2rpm has been cleaned up a whole lot. it should actually be somewhat smarter about not doing the same work twice
+       
+2001-10-18 22:42  jesse
+
+       * tools/cpan2rpm:
+
+       Added cpan2rpm to the tools directory, for autogenerating rpms of cpan modules
+       
+2001-10-18 22:42  jesse
+
+       * tools/cpan2rpm:
+
+       file cpan2rpm was initially added on branch rt-1-1.
+       
+2001-10-18 21:20  jesse
+
+       * Makefile, rt.spec:
+
+       Added support for autobuilding an rpm with "make rpm"
+       
+2001-10-18 02:15  jesse
+
+       * tools/insertdata:
+
+       Fixed templates to include the ticket subject if it was otherwise blank
+       
+2001-10-18 02:14  jesse
+
+       * lib/RT/Interface/Web.pm, webrt/Ticket/Display.html:
+
+       work on web-based ticket creation. fixed bugs setting due dates, etc
+       
+2001-10-18 02:13  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       fixed a user creation race condition in the mail gateway
+       
+2001-10-18 02:11  jesse
+
+       * webrt/Elements/SelectStatus:
+
+       use the new status abstraction in the web ui
+       
+2001-10-18 02:08  jesse
+
+       * tools/testdeps:
+
+       moved to a dbix::searchbuilder 0.46 dependency
+       
+2001-10-18 02:07  jesse
+
+       * lib/RT/Tickets.pm:
+
+       Movign away from a deprecated API
+       
+2001-10-18 02:07  jesse
+
+       * tools/initdb:
+
+       initdb won't whine if you don't set a host
+       
+2001-10-18 02:05  jesse
+
+       * docs/design_docs/evil_plans:
+
+       Added some docs about what 2.2 might hold
+       
+2001-10-18 02:00  jesse
+
+       * lib/RT/: Ticket.pm, Queue.pm:
+
+       Abstracted out status enumeration and validation
+       
+2001-10-18 01:57  jesse
+
+       * webrt/Ticket/Elements/EditLinks:
+
+       added WebPath to fix some links in showlinks
+       
+2001-10-17 16:34  jesse
+
+       * lib/Makefile.PL:
+
+       Bumped searchbuilder dependency to 0.46
+       
+2001-10-17 16:33  jesse
+
+       * webrt/Ticket/Elements/ShowHistory:
+
+       Added an optional bit of configuration to not show the "History" header
+       
+2001-10-06 03:01  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       Added a new option "Show commands" to show tranasaction
+       
+2001-10-06 03:00  jesse
+
+       * webrt/Admin/: Keywords/index.html, Queues/index.html:
+
+       Added support for reenabling deleted queues and keywords
+       
+2001-10-06 02:57  jesse
+
+       * lib/RT/Condition/Generic.pm:
+
+       Added test harness glue
+       
+2001-10-06 02:55  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Added code to detect bogus ticket update types
+       
+2001-10-06 02:54  jesse
+
+       * lib/RT/Interface/: CLI.pm, Email.pm:
+
+       Added support for unit testing
+       
+2001-10-06 02:51  jesse
+
+       * lib/RT/Handle.pm:
+
+       Added support for unit testing
+       
+       Added a test for Database Port definition to stop perl from whining
+       
+2001-10-06 02:49  jesse
+
+       * lib/RT/: ACE.pm, ACL.pm, Action/Generic.pm, Action/SendEmail.pm,
+       Attachment.pm, Attachments.pm:
+
+       Added support for unit testing
+       
+2001-10-06 02:46  jesse
+
+       * lib/RT/: Tickets.pm, Transaction.pm, Transactions.pm, User.pm,
+       Users.pm, Watcher.pm, Watchers.pm, Queues.pm, Record.pm, Scrip.pm,
+       ScripAction.pm, ScripActions.pm, ScripCondition.pm,
+       ScripConditions.pm, Scrips.pm, Template.pm, Templates.pm:
+
+       Added support for unit testing
+       
+2001-10-06 02:43  jesse
+
+       * lib/RT/: Keyword.pm, KeywordSelect.pm, KeywordSelects.pm,
+       Keywords.pm, Link.pm, Links.pm, ObjectKeyword.pm,
+       ObjectKeywords.pm, CurrentUser.pm, Date.pm, EasySearch.pm,
+       Group.pm, GroupMember.pm, GroupMembers.pm, Groups.pm:
+
+       Added support for unit testing
+       
+2001-10-06 02:38  jesse
+
+       * lib/RT.pm:
+
+       Added the beginnings of test support to RT.pm
+       
+2001-10-06 02:22  jesse
+
+       * lib/RT/TestHarness.pm:
+
+       file TestHarness.pm was initially added on branch rt-1-1.
+       
+2001-10-06 02:22  jesse
+
+       * lib/: Makefile.PL, RT/TestHarness.pm:
+
+       First bits of glue for new RT unit testing infrastructure
+       
+2001-10-06 02:19  jesse
+
+       * bin/rt:
+
+       bin/rt: Documentation cleanups. removing an unnecessary data tainting check
+       
+2001-10-06 02:18  jesse
+
+       * bin/initacls.Pg:
+
+       Fixes to initacls.Pg to allow installation with Unix Domain sockets
+       
+2001-10-04 02:01  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.8
+       
+2001-10-01 02:44  jesse
+
+       * rt.spec:
+
+       Revved the version of DBIx::SearchBuilder needed in the .spec file
+       
+2001-10-01 02:42  jesse
+
+       * Makefile, lib/RT/Interface/Email.pm:
+
+       Fixed the call to MIME::Entity::Build in Email.pm
+       
+       Bumped the version to 2.0.8pre3
+       
+2001-09-30 23:03  jesse
+
+       * README, bin/rt, lib/RT/Tickets.pm, lib/RT/Interface/Email.pm,
+       webrt/Search/PickRestriction, webrt/Ticket/History.html,
+       webrt/Ticket/Elements/EditBasics,
+       webrt/Ticket/Elements/ShowHistory:
+
+       Code refactoring to allow searching for nonlocal links
+       Cleanup to the Loop prevention stuff (v. 2.0.8pre2)
+       Readme cleanup
+       CLI cleanups.  changed "return" to "exit"
+       
+2001-09-26 16:31  jesse
+
+       * tools/testdeps:
+
+       Bumped the searchbuilder dependency.  to 0.43
+       
+2001-09-26 16:28  jesse
+
+       * Makefile, bin/rt, lib/RT/Tickets.pm,
+       webrt/Admin/Queues/Scrips.html:
+
+       Added a fix for ItemsArrayRef to Tickets which causes the Next/Prev links in
+       the web ui to be smarter.
+       
+       Fixed a typo in SCrips.html
+       
+       Bumped the version to 2.0.8pre2
+       
+2001-09-24 20:10  jesse
+
+       * rt.spec:
+
+       file rt.spec was initially added on branch rt-1-1.
+       
+2001-09-24 20:10  jesse
+
+       * Makefile, rt.spec:
+
+       Added destdir support to allow building of RPMS.
+       added rt.spec for building of RPMS.
+       
+2001-09-21 16:51  jesse
+
+       * Makefile:
+
+       Bumped makefule version to 2.0.8pre1
+       
+2001-09-21 16:45  jesse
+
+       * bin/rt, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Interface/Web.pm, webrt/Ticket/Elements/ShowTransaction:
+
+       Fixed a typo in the bin/rt docs
+       Allowed "Force owner change" from bulk update screen.
+       
+2001-09-20 22:34  jesse
+
+       * bin/rt, lib/RT/Action/SendEmail.pm, lib/RT/Interface/Email.pm,
+       webrt/Search/Bulk.html, webrt/Ticket/Elements/ShowTransaction:
+
+       Fixes for:
+       
+       888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888862 Re: [rt-users] how does rt --limit-last-updated work?
+       
+       863 Ticket/Elements/ShowTransaction doesn't show headers sometimes
+       
+       Fix for a bug in the code that prevents RT from looping with itself.
+       
+       Start of work for "force change owner" in Bulk.html
+       
+2001-09-19 16:49  jesse
+
+       * bin/initacls.Pg, bin/rt, etc/config.pm, lib/RT/Queue.pm,
+       lib/RT/Ticket.pm, lib/RT/Tickets.pm, webrt/Elements/Header,
+       webrt/Search/Listing.html, webrt/Ticket/Create.html,
+       webrt/Ticket/Display.html, webrt/Ticket/ModifyAll.html,
+       webrt/Ticket/Update.html, webrt/Ticket/Elements/ShowLinks:
+
+       Fixed a bug that would cause installation on postgres to lose if $PORT wasn't
+       specified
+       
+       Changed " to ' in a few places in the config file, to make file and variable
+       names with embedded metacharacters not lose as badly
+       
+       Set some logical defaults for Queue->Create, so it's not as likely to fail
+       to create a queue if you leave out some fields
+       
+       Ticket->Create: now takes a Starts date.  Also, fixed some API docs.
+       
+       Tickets: Negative searching on fields like "subject" should now work
+       
+       WebUI:  Added a pragma NO-CACHE pseudo-header, to stop overzealous browsers from caching RT's pages
+       
+       WebUI: changed the "Bookmark this search" link to "Bookmarkable URL for this search"
+       
+       WebUI: ticket create now has a "more detail" section
+       
+       WebUI: ticket updates no longer have a default subject preset.
+       
+       WebUI: fixed a bug in ShowLinks that generated bogus urls within RT if RT wasn't at / on your server
+       
+2001-09-13 00:03  jesse
+
+       * Makefile:
+
+       Bumping the version to 2.0.7
+       
+2001-09-10 02:18  jesse
+
+       * Makefile:
+
+       Bumped the makefile version to 2.0.7pre1
+       
+2001-09-10 02:11  jesse
+
+       * bin/mason_handler.fcgi, lib/RT/User.pm:
+
+       Fixed #883, a permissions caching bug.
+       
+       Added the Text::Wrapper dependency to mason_handler.fcgi
+       
+2001-09-06 15:59  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Reverted reopen on correspondence to 1.0 behaviour
+       
+2001-09-06 15:41  jesse
+
+       * webrt/SelfService/Display.html:
+
+       make row coloring alternate in selfservice transaction history
+       
+2001-09-06 15:39  jesse
+
+       * webrt/SelfService/Display.html:
+
+       Fixed cell spacing in selfservice transaction display
+       
+2001-09-06 15:33  jesse
+
+       * bin/webmux.pl, webrt/SelfService/Display.html,
+       webrt/Ticket/Display.html, webrt/Ticket/Elements/ShowHistory,
+       webrt/Ticket/Elements/ShowKeywordSelects,
+       webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Cleaned up the web ticket transaction display.
+       
+2001-09-06 15:32  jesse
+
+       * lib/RT/: ObjectKeyword.pm, Queue.pm:
+
+       Added some docs.
+       Started refactoring Ticket statuses.
+       
+2001-09-06 15:32  jesse
+
+       * lib/RT/Ticket.pm:
+
+       $Ticket->SetTold  now optionally takes a date to set it to.
+       
+2001-09-06 15:30  jesse
+
+       * bin/rt:
+
+       Fixing some docs in bin/rt
+       
+2001-09-05 11:00  jesse
+
+       * webrt/Elements/: Header, Refresh:
+
+       Fix for #823 from martin@schapendonk.org
+               Refresh now allows you to turn off refresh.
+       
+2001-09-01 19:01  jesse
+
+       * webrt/Elements/MessageBox:
+
+       Fix for [fsck.com #803] Jumbo recording comments accidentally
+       
+2001-09-01 18:23  jesse
+
+       * Makefile:
+
+       Bumped the version to 2.0.6
+       
+2001-08-28 15:49  jesse
+
+       * Makefile:
+
+       Bumped the version to pre7, fixed a typo in the makefile's install instructions.
+       
+2001-08-24 00:13  jesse
+
+       * lib/RT/Attachment.pm:
+
+       importing the Crit->crit typo fix from 2.0.5_01
+       
+2001-08-24 00:08  jesse
+
+       * Makefile, lib/RT/Interface/Email.pm:
+
+       Rolled in the 2.05 perl 5.005 compatibility fix.
+       bumped the version to 2.0.6pre6
+       
+2001-08-23 19:49  jesse
+
+       * bin/rt-mailgate, tools/initdb:
+
+       fixed initdb to not append a port= to the db connect string unless it needs one.
+       
+       added support for $SenderMustExistInExternalDatabase to mailgate.
+       
+2001-08-23 19:46  jesse
+
+       * lib/RT/Groups.pm:
+
+       Added a default alphabetical sort order to lib/RT/Groups
+       
+2001-08-23 19:45  jesse
+
+       * etc/: config.pm, schema.Pg, schema.mysql, schema.pm:
+
+       Added new indices to schema. Regenerated mysql and postgres schema.
+       
+       Cleaned up etc/config.pm's docs some more, based on comments from Christian Gimore
+       Added a default value for RT::OwnerEmail, which was documented by not defined
+       by default
+       
+2001-08-22 18:48  jesse
+
+       * bin/rt, lib/RT/Ticket.pm, webrt/Ticket/Update.html:
+
+       bin/rt --create now deals with watchers.
+       
+       fixed a typo in Ticket/Update.html introduced after 2.0.5_03
+       
+2001-08-22 01:37  jesse
+
+       * Makefile, lib/RT/Tickets.pm, webrt/Admin/Global/Keywords.html:
+
+       Bumped version to 2.0.6-pre5
+       
+       Fixed 'deep' merges.
+       
+       Fixed a typo in Global/Keywords
+       
+2001-08-22 00:41  jesse
+
+       * Makefile, lib/RT/Interface/Email.pm:
+
+       Fixed a couple of bugs in the new email db lookups
+       
+2001-08-21 23:57  jesse
+
+       * Makefile, bin/initacls.Oracle, bin/initacls.Pg,
+       bin/initacls.mysql, tools/initdb:
+
+       Added support for setting the database port for postgres and mysql
+       
+2001-08-21 23:48  jesse
+
+       * README:
+
+       Updated jesse's email address and shuffled things around a bit.
+       
+2001-08-21 23:45  jesse
+
+       * etc/config.pm:
+
+       Added more docs and updated the default config for the external db lookups
+       
+2001-08-21 23:35  jesse
+
+       * webrt/: index.html, NoAuth/webrt.css, Search/Listing.html,
+       Search/PickRestriction, Ticket/ModifyDates.html,
+       Ticket/Update.html, Ticket/Elements/ShowHistory,
+       Ticket/Elements/ShowTransaction:
+
+       Added support for autorefresh to / and /Search/Listing.html
+       
+       Tightened up Transaction display. Fixed 'full headers' display.
+       
+       Cleaned up the ui in ModifyDates a bit
+       
+       Cleaned up the ui in Ticket/Update.html
+       
+       fixed a few typos in the css file
+       
+2001-08-21 23:30  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Added some documentation
+       
+2001-08-21 23:25  jesse
+
+       * bin/rt-mailgate:
+
+       Bringing forward a patch to the mailgate from 2.0.5_01
+       
+2001-08-21 23:19  jesse
+
+       * webrt/Elements/Refresh:
+
+       file Refresh was initially added on branch rt-1-1.
+       
+2001-08-21 23:19  jesse
+
+       * webrt/Elements/Refresh:
+
+       Commiting a Refresh control to cvs
+       
+2001-08-21 23:17  jesse
+
+       * bin/rtadmin:
+
+       Fixed cli group creation
+       
+2001-08-21 23:12  jesse
+
+       * webrt/Elements/MessageBox:
+
+       Fixed transaction quoting to use the new transaction content quoting method.
+       
+2001-08-21 23:07  jesse
+
+       * webrt/Elements/Login:
+
+       Display a version string in the login box.
+       
+2001-08-21 23:06  jesse
+
+       * webrt/Elements/Header:
+
+       Added support for refresh to webrt/Elements/Header
+       Don't display the logout link if using external auth.
+       
+2001-08-21 23:05  jesse
+
+       * webrt/Admin/Users/Modify.html:
+
+       Little bit of ui and code cleanup to the User editing page
+       
+2001-08-21 23:04  jesse
+
+       * lib/RT/Record.pm:
+
+       Fixed broken caching of the CreatorObj
+       
+2001-08-21 23:03  jesse
+
+       * lib/RT/Handle.pm:
+
+       Added support for Database port to Handle.pm
+       
+2001-08-21 22:50  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Added vivek khera's patch to clean up newline processing for incoming messages
+       
+       Removed debugging output from file attachment subroutine
+       
+       Added support for setting refresh interval to the search page
+       
+2001-08-21 22:46  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       Fixed the bug fixed in 2.0.5_?? which called the wrong function for finding
+       sender name
+       
+       Altered the mail interface's external user lookup function to be returned
+        a hash of parameters
+       
+2001-08-21 22:43  jesse
+
+       * lib/RT/Transaction.pm:
+
+       Added support for Quoting a transaction to the Content sub.
+       
+2001-08-16 00:23  jesse
+
+       * Makefile, tools/testdeps:
+
+       dependency on CGI::Cookie 1.20 had reverted.
+       Bumped version to 2.0.5_03
+       
+2001-08-15 16:44  jesse
+
+       * Makefile, bin/rt-mailgate, lib/RT/Interface/Email.pm:
+
+       A couple of fixes to the mail gateway to deal with proper processing
+       of sender email addresses
+       
+2001-08-15 16:12  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       Trying for 2.0.5-01 again
+       Fixed a perl 5.6ism in Interface/Email
+       Fixed a bug in Attachment.pm that would cause a DIE on a fatal error
+       
+2001-08-15 16:12  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Trying for 2.0.5-01 again
+       Fixed a bug in Attachment.pm that would cause a DIE on a fatal error
+       
+2001-08-15 16:12  jesse
+
+       * Makefile:
+
+       Trying for 2.0.5-01 again
+       
+2001-08-15 15:44  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       Fixed an error message in Attachment that should never be reached
+       Bumped the Makefile version to 2.0.5_01
+       Fixed an inadvertent perl 5.6ism in the mail gateway.
+       
+2001-08-15 15:42  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Fixed an error message in Attachment that should never be reached
+       
+       Bumped the Makefile version to 2.0.5_01
+       
+2001-08-15 15:42  jesse
+
+       * Makefile:
+
+       Bumped the Makefile version to 2.0.5_01
+       
+2001-08-15 01:01  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.6-pre1
+       
+2001-08-15 01:00  jesse
+
+       * webrt/: autohandler, Admin/Users/Modify.html, Elements/Login,
+       SelfService/Prefs.html, User/Prefs.html:
+
+       Added support for external authentication to the web ui
+       
+2001-08-15 01:00  jesse
+
+       * bin/rt-mailgate, lib/RT/Interface/Email.pm:
+
+       Added support for looking up new users in an external datasource
+       
+2001-08-15 00:58  jesse
+
+       * etc/config.pm:
+
+       Added new configuration variables for external authentication for the web ui and
+       to support looking up new users in the mail gateway from a site-defined external datasource.
+       
+2001-08-15 00:17  jesse
+
+       * tools/testdeps:
+
+       Fixed testdeps to depend on the right version of CGI.pm
+       
+2001-08-14 23:55  jesse
+
+       * Makefile:
+
+       Released RT 2.0.5  No changes since 2.0.5-test3.
+       
+2001-08-12 21:13  jesse
+
+       * Makefile, bin/webmux.pl:
+
+       Fixed a typo in webmux.pl created after 2.0.4
+       Bumped the version to 2.0.5-test3
+       
+2001-08-12 20:00  jesse
+
+       * docs/manual.pod, lib/RT/Transaction.pm:
+
+       Core:  Updated Transaction->Content to be smarter about showing the first
+       message in the transaction.
+       
+       Removed the old manual skeleton in docs in favor of the web based docs.
+       
+2001-08-12 19:58  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Core: Added a convenience function to RT::Attachemnt to find Children of this attachment.
+       Core: Added code to RT::Attachemnt to allow access to the 'Parent' attribute
+       
+2001-08-12 19:55  jesse
+
+       * lib/RT/Attachments.pm:
+
+       Core: A convenience function to search for Attachments by ContentType.
+       Core: Added some docs to RT::Attachments
+       
+2001-08-12 19:53  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       WebUI: Show 'comment' and 'correspond' for multipart messages in the per-transaction listing.
+       
+2001-08-10 23:59  jesse
+
+       * README:
+
+       README: added more pointers to the 'complete' docs.
+       README: Removed the little bit of configuration info in the readme in favor of the 'complete' docs on the web
+       
+2001-08-10 23:58  jesse
+
+       * bin/rt-mailgate:
+
+       mailgate: RT is now less likely to try to send mail to senders which will cause loops
+       
+2001-08-10 23:57  jesse
+
+       * webrt/index.html:
+
+       Webui: [home] now gets greyed out when you're there
+       
+2001-08-10 15:32  jesse
+
+       * Makefile, webrt/Elements/MessageBox:
+
+       Added a pair of () in webrt/Elements/MessageBox to correct a typo in an if
+       Bumped version to 2.0.5-test2
+       
+2001-08-10 00:24  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.5test1
+       
+2001-08-10 00:24  jesse
+
+       * lib/RT/Users.pm, webrt/Elements/MessageBox,
+       webrt/Ticket/Elements/AddWatchers, webrt/Ticket/Elements/EditDates:
+
+       Cleanup to date editing ui
+       
+       Code cleanups to Elements/MessageBox for more readable and maintainable code
+       Code cleanups to TicketElements/AddWatchers for more readable and maintainable code
+       
+2001-08-10 00:23  jesse
+
+       * webrt/Ticket/Elements/: EditLinks, ShowLinks:
+
+       Cleanup to Relationship editing and display ui
+       
+2001-08-10 00:21  jesse
+
+       * webrt/Ticket/ModifyDates.html:
+
+       UI cleanups in Ticket/ModifyDates.html
+       
+2001-08-10 00:20  jesse
+
+       * webrt/Ticket/ModifyAll.html:
+
+       Jumbo no longer loses ticket update contents.
+       
+2001-08-09 20:07  jesse
+
+       * webrt/Admin/Users/index.html:
+
+       Cleaned up Admin/Users search functionality and made it look more like
+       other user searching screens and enables searching for disabled users.
+       
+2001-08-09 20:02  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Properly strip trailing spaces from things we're trying to link to.
+       
+2001-08-09 20:00  jesse
+
+       * lib/RT/Links.pm:
+
+       By default, try to sort Links by something intelligent when displaying them
+       
+2001-08-03 01:52  jesse
+
+       * lib/RT/Action/Autoreply.pm:
+
+       Autoreplies are now from "Queuename" rather than from "RT"
+       
+2001-08-02 04:57  jesse
+
+       * webrt/: Admin/Queues/People.html, Elements/Quicksearch,
+       Elements/SelectResultsPerPage, Elements/SelectStatus,
+       Search/PickRestriction:
+
+       WebUI: Fixed a typo in hte 'bookmark this search' link display.
+       WebUI: By default, limit displayed results to 50 per page.
+       
+2001-08-02 04:57  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Documented a function in the web ui library
+       
+2001-08-02 04:56  jesse
+
+       * etc/config.pm:
+
+       Fixed a typo in the docs in the config file, thanks to sheeri.
+       
+2001-08-02 04:55  jesse
+
+       * bin/rt-mailgate:
+
+       rt-mailgate: bug-fix to properly grab 'from' addresses for purposes of determinigng whether something's a mailer-daemon
+       
+2001-08-02 04:54  jesse
+
+       * bin/rt:
+
+       Added support for merging to the CLI
+       Cli now works as described when linking tickets. Formerly, you couldn't admit the "+" before an added link
+       
+2001-08-02 04:53  jesse
+
+       * webrt/User/Prefs.html:
+
+       Bugfix to allow users to fully delete their rt signatures
+       
+2001-07-30 03:54  jesse
+
+       * docs/design_docs/evil_plans:
+
+       file evil_plans was initially added on branch rt-1-1.
+       
+2001-07-30 03:54  jesse
+
+       * Makefile, docs/design_docs/evil_plans:
+
+       bumped the version, so as not to get confused users complaining to the lists
+       
+       added some notes about what may happen for 2.2
+       
+2001-07-30 03:52  jesse
+
+       * webrt/SelfService/Display.html:
+
+       file Display.html was initially added on branch rt-1-1.
+       
+2001-07-30 03:52  jesse
+
+       * bin/mason_handler.fcgi, bin/webmux.pl, lib/RT/Interface/Web.pm,
+       webrt/SelfService/Create.html, webrt/SelfService/Details.html,
+       webrt/SelfService/Display.html, webrt/SelfService/Update.html,
+       webrt/SelfService/Elements/GotoTicket,
+       webrt/SelfService/Elements/MyRequests, webrt/Ticket/Create.html,
+       webrt/Ticket/Display.html, webrt/Ticket/Modify.html,
+       webrt/Ticket/ModifyAll.html, webrt/Ticket/ModifyDates.html,
+       webrt/Ticket/ModifyLinks.html, webrt/Ticket/ModifyPeople.html,
+       webrt/Ticket/Update.html, webrt/Ticket/Elements/EditBasics,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Switched SelfService/Details to SelfService/Display  to better jibe
+       with the regular UI.
+       
+       Added better current-page navigation hints to most per-ticket pages.
+       
+       Added support for uploading attachments on ticket create or update.
+       
+2001-07-30 03:51  jesse
+
+       * webrt/Admin/Elements/ListGlobalScrips:
+
+       file ListGlobalScrips was initially added on branch rt-1-1.
+       
+2001-07-30 03:51  jesse
+
+       * webrt/Admin/: Elements/ListGlobalKeywordSelects,
+       Elements/ListGlobalScrips, Global/Scrips.html,
+       Queues/Keywords.html, Queues/Scrips.html:
+
+       Added some ui to show global scrips and keywordselects in the queue
+       uis for adminning the same.
+       
+2001-07-30 03:51  jesse
+
+       * webrt/Admin/Elements/ListGlobalKeywordSelects:
+
+       file ListGlobalKeywordSelects was initially added on branch rt-1-1.
+       
+2001-07-30 03:49  jesse
+
+       * TODO:
+
+       Clarified the errata urls
+       
+2001-07-30 03:48  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Cleaned up the return values from Ticket->CreateLink. (always return $status, $msg);
+       
+2001-07-30 03:48  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       changed the case of the Managed-by header to be less grating
+       
+2001-07-30 03:45  jesse
+
+       * bin/rt-mailgate, lib/RT/Interface/Email.pm:
+
+       Moving a bunch of mail gateway library routines to the library where they
+       belong
+       
+2001-07-27 01:06  jesse
+
+       * README:
+
+       fixed a typo in the cronjob
+       
+2001-07-25 01:05  jesse
+
+       * bin/rt-mailgate, lib/RT/Tickets.pm:
+
+       Fix for mailgateway being unable to send error mail with 'sendmailpipe' mailing
+       Fix for 'blank' searches when using search bookmarking.
+       
+2001-07-25 01:00  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.4
+       Fixed bookmarkable searches
+       Fix for sendmailpipe errors in mailgateway
+       
+2001-07-24 12:10  jesse
+
+       * Makefile, webrt/Search/PickRestriction:
+
+       Fixed a bug in Search/PickRestriction, thanks to Vivek Khera
+       Bumped version to 2.0.3
+       
+2001-07-24 00:28  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.2
+       
+2001-07-24 00:21  jesse
+
+       * lib/RT/Tickets.pm, webrt/Elements/Submit,
+       webrt/Search/Listing.html, webrt/Search/PickRestriction:
+
+       Bookmarked searches now keep track of sorting and record count limits
+       New "Refine" button to allow faster updates of search criteria.
+       
+2001-07-24 00:01  jesse
+
+       * bin/rt:
+
+       Added support for --limit-queue to  RT cli tool
+       
+2001-07-23 10:43  jesse
+
+       * Makefile, tools/testdeps:
+
+       Testdeps was accidentally looking for Freeze::Thaw, rather than FreezeThaw
+       
+2001-07-23 00:31  jesse
+
+       * Makefile:
+
+       bumped version to 2.0.2test2
+       
+2001-07-23 00:30  jesse
+
+       * lib/RT/Tickets.pm, lib/RT/Interface/Web.pm, tools/testdeps,
+       webrt/Search/Listing.html:
+
+       Added support for bookmarkable searches.
+       
+2001-07-22 22:12  jesse
+
+       * lib/RT/: KeywordSelect.pm, User.pm:
+
+       Better error checking in User ACL checking
+       
+       Fixed an ACL check bug in KeywordSelect.pm, thanks to Matthew Stock.
+       
+2001-07-22 22:09  jesse
+
+       * webrt/Admin/Users/index.html:
+
+       Fix for a users search bug and a clarification of another search option.
+       
+2001-07-22 22:06  jesse
+
+       * lib/RT/: Keywords.pm, Queues.pm, Users.pm:
+
+       By default, order Queues, Users and Keywords alphabetically
+       
+2001-07-22 22:05  jesse
+
+       * Makefile:
+
+       Permissions fix for the data dirs for the fastcgi handler
+       
+       rt/etc is now mode 755, rather than 555.
+       
+2001-07-22 22:03  jesse
+
+       * bin/mason_handler.fcgi:
+
+       fastcgi handler no longer drops setgidness, so it can deal with session files.
+       
+2001-07-22 21:55  jesse
+
+       * etc/config.pm:
+
+       Cleaned up the config file a bit to make installation easier.
+       
+2001-07-22 21:52  jesse
+
+       * webrt/Elements/MyRequests:
+
+       Clean up phrasing of the "Tickets I own dialogbox"
+       
+2001-07-19 00:57  jesse
+
+       * Makefile:
+
+       Changed Makefile to not use MAN[13]INSTALLSITEPATH per Robert Shaw's changes
+       
+2001-07-18 16:20  jesse
+
+       * Makefile, lib/RT/Queue.pm:
+
+       Added a newline to Queue.pm to fix a pod bug
+       
+       Bumped version to 2.0.2-test1  to get some feedback
+       
+2001-07-18 16:16  jesse
+
+       * lib/RT/User.pm:
+
+       RT should now honor queue-level pseudogroup memebership for ACL checks.
+       Also, simplified some of the queue related ACL checking code.
+       
+       Reduced the ACL permissions cache from 30sec to 10sec.
+       
+2001-07-18 16:13  jesse
+
+       * lib/RT/Transaction.pm:
+
+       Added BriefDescription, which is just like Description without the "By actor"
+       at the end
+       
+       Descriptions Keyword operations should include _which_ keyword select from
+       here on in (also touched the last update to Ticket.pm)
+       
+2001-07-18 16:06  jesse
+
+       * lib/RT/Ticket.pm:
+
+       TTicket->Create no longer just adds admin ccs..unless the person doing the add
+       has the right to do so.  otherwise, there was an ACL related attack that
+       could happen. luckily none of the UI exposedd this hole yet.
+       
+       Ticket->Create should now be able to set keywords on create
+       
+       Ticket->Create now reports back non-fatal errors and how they were dealt with
+       
+       Ticket->AddKeyword got split into AddKeyword and _AddKeyword. The former
+       has the acl check and calls the latter. the latter just does the adding.
+       
+       Ticket->AddKeyword got a Silent flag, which causes a transaction not
+       to be written. useful on ticket create.
+       
+2001-07-18 15:59  jesse
+
+       * tools/testdeps:
+
+       Added tests for Apache::Cookie
+       and DBI 1.18 to testdeps
+       
+2001-07-18 15:53  jesse
+
+       * webrt/SelfService/: Details.html, Update.html:
+
+       Added the ability for requestors to use the self-service ui to comment on / reply to tickets.
+       
+2001-07-18 15:53  jesse
+
+       * webrt/SelfService/Update.html:
+
+       file Update.html was initially added on branch rt-1-1.
+       
+2001-07-17 22:12  jesse
+
+       * webrt/Admin/Queues/People.html:
+
+       Fixed a link to Users/Modify.html in Queue/People.html
+       
+2001-07-17 22:01  jesse
+
+       * bin/webmux.pl:
+
+       Fix to the solaris chown problem
+       
+2001-07-17 18:37  jesse
+
+       * README:
+
+       Fixed typo in the cron job description
+       
+2001-07-13 02:17  jesse
+
+       * lib/RT/Tickets.pm:
+
+       Work on tickets.pm to support some new searching options
+       
+2001-07-12 19:43  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0.1
+       
+2001-07-11 23:17  jesse
+
+       * etc/config.pm:
+
+       No longer log things of less than 'error' to the logfile
+       
+2001-07-11 23:16  jesse
+
+       * Makefile, bin/mason_handler.fcgi, bin/rt, bin/rt-mailgate,
+       bin/rtadmin, lib/Makefile.PL, lib/RT.pm, lib/RT/Interface/CLI.pm,
+       lib/RT/Interface/Email.pm:
+
+       Make sure that the setgid programs don't drop setgidness before trying to open logfiles
+       
+2001-07-10 20:15  jesse
+
+       * Makefile, lib/Makefile.PL, lib/RT/Tickets.pm,
+       lib/RT/Interface/Web.pm, tools/testdeps:
+
+       Fixes to allow search-by-requestor to search for requestors who don't have RT accounts
+       
+2001-07-10 13:53  jesse
+
+       * bin/webmux.pl:
+
+       Fix for the weird sessiondata permissions bug folks have seen on solaris
+       
+2001-07-10 11:47  jesse
+
+       * lib/RT/Tickets.pm:
+
+       Change to Tickets.pm to fix description of watcher limits
+       
+2001-07-10 11:36  jesse
+
+       * bin/webmux.pl, webrt/Elements/SelectMatch:
+
+       Fixed a bug in webmux.pl that prevented Apache::Cookie support from working
+       
+       Fixed a bug in the enw SelectMatch code
+       
+2001-07-10 11:20  jesse
+
+       * lib/RT/Ticket.pm, webrt/Elements/SelectMatch,
+       webrt/Search/PickRestriction:
+
+       Cleanup to SelectMatch and PickRestriction to clear up the UI issues
+       with searching for Tickets from a give nrequestor
+       
+2001-07-09 10:36  jesse
+
+       * lib/RT/Template.pm:
+
+       Fixed a typo in Template.pm that squashed templates on outgoing mail. (Bug in my untainting fix)
+       
+       Bumped version to 2.0.1-test2
+       
+2001-07-09 10:36  jesse
+
+       * Makefile:
+
+       Fixed a typo in Template.pm that squashed templates on outgoing mail. (Bug in my untainting fix)
+       
+2001-07-08 22:31  jesse
+
+       * README:
+
+       Added some polite comments about supporting the development of RT
+       with contracts, cash or gifts
+       
+2001-07-08 20:14  jesse
+
+       * Makefile, bin/mason_handler.fcgi,
+       webrt/SelfService/Elements/ShowTransaction:
+
+       Bumped version to 2.01pre1
+       
+       Fixed mason_handler header newlines
+       
+2001-07-08 20:12  jesse
+
+       * lib/RT/: ScripAction.pm, ScripCondition.pm, Template.pm,
+       Ticket.pm:
+
+       Taint fixes for ScripAction, ScripCondtion,Template.
+       Header wrapping fix in Template.pm.
+       Fix in Ticket.pm to make EffectiveId a public field.
+       
+2001-07-06 18:32  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Applied a patch from ivan to deal with poorly formed mime messages
+       and clean up the attachment proccessing code.
+       
+2001-07-06 18:26  jesse
+
+       * webrt/SelfService/Attachment/dhandler:
+
+       file dhandler was initially added on branch rt-1-1.
+       
+2001-07-06 18:26  jesse
+
+       * webrt/: SelfService/Details.html,
+       Ticket/Elements/ShowTransaction, SelfService/Attachment/dhandler:
+
+       ShowTransaction now no longer displays 'Comment' and 'Reply' if the user
+       doesn't have the right rights.
+       
+       SelfService uses the 'standard' ShowTransaction.
+       
+       SelfService now displays Attachments
+       
+2001-07-06 18:21  jesse
+
+       * etc/schema.mysql:
+
+       Switched mysql to use LONGTEXT rather than LONGBLOB to get
+       case insensitive searching.
+       
+2001-07-06 18:19  jesse
+
+       * bin/mason_handler.fcgi, lib/RT/Interface/Web.pm,
+       webrt/NoAuth/Logout.html:
+
+       Cleanups to deal better with the fastcgi handler.
+       
+       Switched to CGI::Fast from FCGI
+       
+       ContentType fixes.
+       
+       Logging out now clears the session hash, rather than detaching a perfectly good session. (This gets around an obnoxious tainting issue too)
+       
+2001-07-06 16:14  jesse
+
+       * webrt/Ticket/Attachment/dhandler:
+
+       Changed default attachment type to text/plain from text/html
+       
+2001-07-05 16:48  jesse
+
+       * bin/rt-mailgate, lib/RT/Ticket.pm:
+
+       Updates to make Correspondence on a closed or stalled ticket reopen the ticket
+       
+2001-07-04 00:51  jesse
+
+       * bin/rt:
+
+       bin/rt will now show transactions of type 'text'
+       
+2001-07-04 00:36  jesse
+
+       * bin/webmux.pl:
+
+       Minor fixes to webmux.pl for content type stuff.
+       
+2001-07-03 23:15  jesse
+
+       * lib/RT/Interface/Web.pm, webrt/Admin/Queues/index.html,
+       webrt/Search/PickRestriction:
+
+       Web ui now supports 'SearchByPriority'
+       
+2001-07-03 23:14  jesse
+
+       * etc/config.pm:
+
+       Added a few comments about configuration variables
+       
+2001-07-03 23:12  jesse
+
+       * webrt/SelfService/Elements/ShowTransaction:
+
+       Now SelfService displays attachments of type 'text'
+       
+2001-07-03 23:08  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       With the web ticket display, now display attachments of type 'text' properly.
+       Also, always have a download link.
+       
+2001-07-03 23:00  jesse
+
+       * webrt/Ticket/Elements/ShowLinks:
+
+       Changed SubTickets/SuperTickets to Parents/Children
+       
+2001-07-03 22:57  jesse
+
+       * Makefile:
+
+       Added notes to the effect that the speedycgi and fastcgi handlers aren't
+       supported.
+       
+2001-07-03 22:52  jesse
+
+       * bin/webmux.pl, bin/mason_handler.fcgi,
+       webrt/Ticket/Attachment/dhandler:
+
+       Switched mod_perl hander to use Apache::Cookie
+       
+       Refactored mime type handling to properly set the mime type with the modperl
+       handler and the fastcgi handler
+       
+       Added untainting for the requirred parts of the fastcgi wrapper.
+       I'm not yet confident that it works properly, but it does the right
+       thing in the trivial case.
+       
+2001-06-27 00:11  jesse
+
+       * Makefile:
+
+       Bumped version to 2.0 for release to the unsuspecting masses
+       
+2001-06-25 16:28  jesse
+
+       * Makefile, lib/RT/Ticket.pm:
+
+       Fix for a bug introduced by RC2  (while fixing another bug with _Links)
+        which caused Links listings to recurse rather infinitely.
+       
+       Bumped RC2 to RC3
+       
+2001-06-25 16:25  jesse
+
+       * webrt/Admin/Elements/SelectRights:
+
+       Fix for a crashing bug when editing ACLs without permission
+       
+2001-06-25 12:19  jesse
+
+       * Makefile, lib/RT/Ticket.pm:
+
+       Fixed bug in Ticket.pm -> _Links that caused it to return an error
+       rather than an empty links object if permission denied.
+       
+       Bumped version to RC2
+       
+2001-06-23 02:48  jesse
+
+       * Makefile, README, tools/import-1.0-to-2.0:
+
+       removed 1.0-2.0 importer. (it's now in the contrib archive)
+       updated readme and makefile to know about the change.
+       
+       Bumped the version to 2.0.0-RC1. Yeah. That's right. the major version
+       number just got incremented.
+       
+2001-06-22 14:50  jesse
+
+       * Makefile, lib/RT/Ticket.pm:
+
+       hopefully a fix for everyone's favorite import bug.
+       
+2001-06-20 23:56  jesse
+
+       * webrt/Search/Bulk.html:
+
+       Display cleanups to Bulk.html.
+       Removed bogus nav items
+       
+2001-06-20 17:33  jesse
+
+       * NEWS, lib/Makefile.PL:
+
+       Removed the out of date NEWS file. It's been superceeded by the changelog
+       
+2001-06-20 17:27  jesse
+
+       * Makefile, README, lib/RT/Ticket.pm, lib/RT/User.pm,
+       lib/RT/Interface/Web.pm, tools/import-1.0-to-2.0, tools/testdeps,
+       webrt/Ticket/Display.html, webrt/Ticket/History.html:
+
+       Fixes for the import problems some folks have been seeing
+       Fixes for the Can't click on URL issues reported by mixo and Carl Potter.
+       Turned off some overly verbose debugging.
+       
+       Bumped the version to 1.3.105
+       
+2001-06-19 00:34  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.104
+       
+2001-06-19 00:25  jesse
+
+       * lib/RT/Tickets.pm:
+
+       A fix for search based on keywords that don't exist. (Some rows would be lost, due to poorly constructed SELECT statements.  This change requires DBIx::SearchBuilder 0.39
+       
+2001-06-18 15:39  jesse
+
+       * Makefile, README, webrt/Ticket/Elements/ShowTransaction:
+
+       Updated README to note new RT2 Errata list
+       Bumped version to 1.3.103
+       Added comments in ShowTransaction to let you see exact transaction / ticket Ids
+       if you view source.
+       
+2001-06-18 15:32  jesse
+
+       * bin/rt:
+
+       Better fomating for cli queue listing.
+       
+2001-06-17 16:45  jesse
+
+       * lib/RT/: Transaction.pm, User.pm:
+
+       Added PurgeTransaction datatype for Transactions.
+       
+       Removed debugging code from User.pm
+       
+2001-06-17 14:36  jesse
+
+       * webrt/Ticket/Elements/Tabs:
+
+       Fix for webui error when displaying next/prev tabs on new tix.
+       
+2001-06-15 22:23  jesse
+
+       * Makefile, README:
+
+       Bumped the version to a private pre-test 1.3.103
+       
+2001-06-15 22:19  jesse
+
+       * README, lib/RT/Ticket.pm, lib/RT/User.pm:
+
+       Debugging fixes for import oddness folks are having
+       
+2001-06-15 01:13  jesse
+
+       * webrt/Search/Bulk.html:
+
+       removed debugging output from bulk.html
+       
+2001-06-14 15:53  jesse
+
+       * Makefile, lib/RT/Transactions.pm,
+       webrt/Ticket/Elements/AddWatchers:
+
+       Installation path of man pages is now configurable
+       By default Transactions should now be ordered by date, no matter what their id sequence is.
+       Fixed an html typo in Tickets/Elements/AddWatchers
+       
+       Bumped version to 1.3.102
+       
+2001-06-14 03:21  jesse
+
+       * Makefile:
+
+       Bumped the version to 1.3.101
+       
+2001-06-14 02:47  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Interface/Web.pm, webrt/Elements/Tabs,
+       webrt/Ticket/Elements/Tabs:
+
+       Comments in Ticket.pm about less than optimal design
+       Enhancments to Interface/Web for the bulk ticket manipulation tool.
+       Search navigation was cleaned up a bunch.
+       
+2001-06-14 01:52  jesse
+
+       * webrt/Search/Bulk.html:
+
+       file Bulk.html was initially added on branch rt-1-1.
+       
+2001-06-14 01:52  jesse
+
+       * webrt/Search/: BuildSearch, Bulk.html, Listing.html, QueueFooter,
+       QueueHeader, QueueItem:
+
+       Be vewwy vewwy quiet. I'm hunting cweeping features.
+       Like the brand new Bulk Ticket manipulator
+       
+       Removed some cruft from the repository. (unused files from tobix' first
+       search implementation)
+       
+2001-06-13 03:53  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.100
+       
+2001-06-13 03:52  jesse
+
+       * bin/mason_handler.fcgi:
+
+       The fastcgi handler works for everything except attachment viewing.  I'm going to have to think a bit about how to set
+       content type properly in a nice handler-agnostic manner.
+       
+2001-06-13 03:51  jesse
+
+       * bin/rt-mailgate:
+
+       Fixed a warn -> warning in mailgate's logging
+       
+2001-06-13 03:50  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Adjusting spacing
+       
+2001-06-13 03:50  jesse
+
+       * webrt/Ticket/Elements/Tabs:
+
+       
+       Added an error check to the new navigation bars to deal with a possible lack of active search
+       
+2001-06-12 21:28  jesse
+
+       * etc/config.pm:
+
+       Clarified required permissions for the RT Logdir
+       
+2001-06-12 19:12  jesse
+
+       * etc/config.pm, lib/RT/Queue.pm, lib/RT/Transaction.pm:
+
+       Cleaned up some docs in config.pm and Queue.pm
+       Updated the Transaction Descriptions in transaction.pm to make sure
+       that the Actor is listed.
+       
+2001-06-12 18:08  jesse
+
+       * webrt/Ticket/Elements/Tabs:
+
+       Added links to navigate within an existing search.
+       
+2001-06-08 23:57  jesse
+
+       * webrt/Ticket/Elements/EditKeywordSelects:
+
+       Made "(empty)" the same between "EditKeywordSelects" and "SearchByKeywordSelect"
+       
+2001-06-08 23:51  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Ability to set owner by name when creating tickets.
+       Ability to set timeleft when creating tickets
+       
+2001-06-08 23:00  jesse
+
+       * Makefile, README, etc/schema.Pg, lib/RT/Ticket.pm:
+
+       Added an index to etc/schema.Pg
+       Ticket.pm->Create now passes through a few more values that were missing.
+       
+       Added doc on imports w/ postgres to the readme.
+       
+       bumped the version to 1.3.99
+       
+2001-06-08 18:32  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Fix for merging more than one ticket.
+       Fix for req2rt which imported transactions in reverse order.
+       
+2001-06-07 16:02  jesse
+
+       * Makefile, lib/RT/Queue.pm, tools/import-1.0-to-2.0:
+
+       Catch a possibly undefined value in Queue::AddWatcher
+       Bumped verion to 1.3.97
+       another attempt at fixing the owner change generation code in import.
+       
+2001-06-07 14:59  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       The importer now imports the root user and the general queue.
+       
+2001-06-07 12:44  jesse
+
+       * Makefile, etc/config.pm, lib/RT/Interface/Web.pm:
+
+       Support for a seperate local component root for local WebRT mods and additions.
+       
+2001-06-06 17:25  jesse
+
+       * README:
+
+       Added instructions for migrating  1.0 instances to 2.0
+       
+2001-06-06 16:15  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.95
+       
+2001-06-06 16:15  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       Importer should now import tickets created by the req importer
+       
+2001-06-06 16:12  jesse
+
+       * bin/initacls.Pg:
+
+       initacls.Pg should now handle pg database on remote machine
+       
+2001-06-06 16:05  jesse
+
+       * webrt/Ticket/Elements/ShowRequestor:
+
+       Don't show the 'About this Requestor' box if the user is privileged.
+       
+2001-06-06 15:37  jesse
+
+       * lib/RT/Date.pm:
+
+       Now date comparisons against never dtrt.
+       
+2001-06-06 15:30  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Search by content now works on the web
+       
+2001-06-06 14:22  jesse
+
+       * webrt/Admin/Groups/Members.html:
+
+       Fix for #552: spurious warning when going into group membership editor
+       
+2001-06-06 14:14  jesse
+
+       * webrt/Ticket/Elements/EditKeywordSelects:
+
+       keywordSelect selction fix (fsck #555)
+       
+2001-06-06 10:57  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Removed spurious 'u' from line 1 of importer.
+       bumped version to 1.3.95-test2
+       
+2001-06-06 09:39  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Possible fix for jens' user import troubles.
+       bounced version to 1.3.95-test1
+       
+2001-06-06 02:12  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Importer wasn't properly grabbing ACLs. Bumped version to 1.3.94
+       
+2001-06-06 01:33  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       Fixed a bug in the 'Make users superusers' code in the importer
+       
+2001-06-06 00:41  jesse
+
+       * lib/RT/Ticket.pm:
+
+       fixed a missing =cut (end of perldoc in ticket.pm
+       
+2001-06-06 00:40  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       fixing a typo in importer's mime parser
+       
+2001-06-06 00:19  jesse
+
+       * Makefile, lib/Makefile.PL, lib/RT/Action/Notify.pm,
+       lib/RT/Action/SendEmail.pm, tools/testdeps:
+
+       Cleaned up some dependencies
+       RT should no longer send mail when there are no recipients. thanks to the nice folks at Sensarray.com for some good debugging.
+       
+2001-06-05 23:16  jesse
+
+       * Makefile, bin/webmux.pl, tools/import-1.0-to-2.0:
+
+       Fixed some bogus header parsing in import.
+       web mux now tries to chown files again. (christian's going to test it again ;)
+       Bumped to 1.3.91 for a release
+       
+2001-06-05 11:34  jesse
+
+       * webrt/Admin/Users/Modify.html:
+
+       Rephrased the "Privileged" checkbox in AdminUsers.
+       
+2001-06-05 11:18  jesse
+
+       * Makefile, bin/webmux.pl, tools/import-1.0-to-2.0,
+       webrt/NoAuth/Logout.html:
+
+       webmux no longer tries to chown its data directories on startup
+       import now handles final_priority
+       Logout.html now refreshes to a login page
+       
+2001-06-05 10:42  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       When we added support for 'priority' transactions, we accidentally broke
+       support for 'subject' transactions.  fixed now.
+       
+2001-06-05 03:25  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Import tool now handles priority changes.
+       
+2001-06-05 02:56  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Minor tweak to importer to try even harder to find users in the database before creating new ones.
+       
+2001-06-05 02:32  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       importer is now less likely to try to greate nonexitent empty users.
+       
+       Makefile now chgrps web ui datafiles
+       
+2001-06-05 00:06  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Removed out of date comments in the importer
+       Made the importer grab its libraries from the makefile. (Turned off testing code)
+       
+2001-06-05 00:01  jesse
+
+       * Makefile:
+
+       Bumped the version # to 1.3.84 for immediate release
+       
+2001-06-04 23:50  jesse
+
+       * Makefile, lib/RT/Ticket.pm, tools/import-1.0-to-2.0:
+
+       Cleanups to Ticket->Import
+       import-1.0-to-2.0 now deals with dates right.
+       
+2001-06-04 20:52  jesse
+
+       * lib/RT/Link.pm, lib/RT/Ticket.pm, lib/RT/User.pm,
+       tools/import-1.0-to-2.0:
+
+       Cleanup to Ticket, Link and User.
+       
+       merge now works on import.
+       
+       most everything in import other than ticket dates should work now.
+       
+2001-06-04 01:34  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       more cleanup
+       
+2001-06-04 00:03  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       First cut at importing queue adminccs and acls
+       
+2001-06-03 22:16  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       Cleanup and better progress indication
+       
+2001-06-03 13:33  jesse
+
+       * lib/RT/Record.pm, lib/RT/Ticket.pm, tools/import-1.0-to-2.0:
+
+       More work on the importer. now it gets transaction creators right and catches requestor email addreses.
+       
+2001-06-03 03:43  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Transaction.pm, tools/import-1.0-to-2.0:
+
+       Transaction.pm now allows the caller to turn off scrips (for import)
+       Ticket.pm now has a mostly working import method.
+       import-1.0-to-2.0 seems to have some basic functionality.  it's not _working_ yet, but it
+       will do most of what we want it to.
+       
+2001-06-02 20:36  jesse
+
+       * webrt/Ticket/Display.html:
+
+       Fix for Ticket #537 Crash when creating ticket without permission to view ticket
+       
+2001-06-02 14:22  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       added a couple of todos to the import tool
+       
+2001-06-02 14:14  jesse
+
+       * Makefile, tools/import-1.0-to-2.0:
+
+       Work on the importer. it now runs.  (note that it probably won't yet _import_ anything)
+       
+2001-06-02 12:58  jesse
+
+       * Makefile, bin/webmux.pl, lib/RT/Ticket.pm, lib/RT/Transaction.pm:
+
+       Bumped the version to 1.3.84
+       
+       Once again chown mason data directory in webmux.pl, this time
+       using more reliable, dynamic userids, rather than compiled in defaults.
+       
+       Added an 'import' method to Ticket, for the RT1 importer.
+       
+       Added a Subject method to transaction, to simplify the lives of template authors
+       
+2001-06-01 23:38  jesse
+
+       * tools/: import-1.0-to-2.0, insertdata:
+
+       Cleaned up some names and descriptions in insertdata
+       
+       First checkin of outline of code of import tool. It's never been run.
+       It's incomplete.
+       
+2001-06-01 23:38  jesse
+
+       * tools/import-1.0-to-2.0:
+
+       file import-1.0-to-2.0 was initially added on branch rt-1-1.
+       
+2001-05-31 23:27  jesse
+
+       * lib/RT/Tickets.pm:
+
+       Cleaned up Tickets->LimitQueue a bit
+       
+2001-05-31 21:22  jesse
+
+       * Makefile, tools/testdeps:
+
+       Fixed testdeps to use new searchbuilder. bumped version to 1.3.83
+       
+2001-05-31 21:14  jesse
+
+       * lib/RT/Tickets.pm, lib/RT/Interface/Web.pm,
+       webrt/Elements/SelectKeyword:
+
+       Logic fixes for keyword select negation
+       
+2001-05-31 20:30  jesse
+
+       * lib/RT/Tickets.pm, lib/RT/Interface/Web.pm,
+       webrt/Elements/SelectKeyword:
+
+       Added support for "Tickets without keyword 'foo'.
+       
+2001-05-31 17:32  jesse
+
+       * bin/webmux.pl, lib/RT/Interface/Web.pm,
+       webrt/Ticket/Attachment/dhandler:
+
+       Fix for #522: attachments without names got short shrift.
+       webRT now dies rather than run when users can't log in due to a permissions
+       bug.
+       
+2001-05-31 02:57  jesse
+
+       * etc/: schema.Pg, schema.mysql:
+
+       Cleaned up the table indices a bit. for mysql, yanked duplicate indices.
+       for Pg, added an index (we need to regen the schema for pg soon)
+       
+2001-05-31 02:46  jesse
+
+       * Makefile, lib/RT/Interface/Web.pm, webrt/Ticket/ModifyAll.html,
+       webrt/Ticket/ModifyPeople.html, webrt/Ticket/Elements/AddWatchers,
+       webrt/Ticket/Elements/EditPeople:
+
+       You can now add watchers by email address
+       Bumped version to 1.3.82
+       
+2001-05-29 15:58  jesse
+
+       * webrt/Ticket/Attachment/dhandler:
+
+       Fixed the attachments display bug.
+       
+2001-05-29 15:48  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Fix for #513 - status update without permissions returns no error message
+       
+2001-05-29 00:38  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.81
+       
+2001-05-28 20:39  jesse
+
+       * bin/webmux.pl:
+
+       Removed a bogus line from webmux
+       
+2001-05-28 20:29  jesse
+
+       * lib/RT/: Ticket.pm, Interface/Web.pm:
+
+       Work to solve 325: updating detritus in update listing
+       
+2001-05-28 17:35  jesse
+
+       * bin/rt, etc/schema.mysql, etc/schema.pm, lib/RT/Ticket.pm,
+       lib/RT/Interface/CLI.pm, webrt/Ticket/Attachment/dhandler:
+
+       Work on the CLI to resolve #482.  Can't add content when creating tix with the CLI
+       Do a bunch of better error checking on ticket creation.
+       
+       Generalized the ticket status checking code.
+       
+       Added another index on Attachments for increased speed.
+       
+2001-05-28 15:49  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Removed code which auto-opened tickets that were new.  It should
+       be a scrip and it's too late in teh release cycle to do this right now.
+       
+2001-05-28 15:24  jesse
+
+       * webrt/SelfService/: Details.html, Elements/MyRequests:
+
+       Fixed #506. Non-priv user can't see tickets
+       
+2001-05-23 23:53  jesse
+
+       * webrt/SelfService/Elements/MyRequests:
+
+       Fixed MyRequest so it shows your tickets.
+       
+2001-05-23 23:18  jesse
+
+       * Makefile:
+
+       Bumped the version to 1.3.80
+       
+2001-05-23 23:01  jesse
+
+       * bin/webmux.pl, docs/manual.pod, webrt/Elements/MyRequests,
+       webrt/Elements/MyTickets, webrt/NoAuth/Logout.html,
+       webrt/Ticket/ModifyAll.html:
+
+       Fixed logout bug from 1.3.79 http://fsck.com/rt2/Ticket/Display.html?id=500
+       Fixed bug in jumbo from 1.3.79 http://fsck.com/rt2/Ticket/Display.html?id=496
+       Added a bit of docs about templates to the manual
+       
+       Cleaned up the ui for MyRequests and MyTickets a bit.
+       
+2001-05-23 12:34  jesse
+
+       * webrt/SelfService/: Prefs.html, index.html:
+
+       Little bit of cleanup to SelfService. added prefs.
+       
+2001-05-23 12:34  jesse
+
+       * webrt/SelfService/Prefs.html:
+
+       file Prefs.html was initially added on branch rt-1-1.
+       
+2001-05-23 12:07  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.79.
+       
+2001-05-23 12:06  jesse
+
+       * README, tools/testdeps:
+
+       Added dependecy on DBIx::SearchBuilder 0.34
+       
+2001-05-23 11:43  jesse
+
+       * bin/: rt-mailgate, webmux.pl:
+
+       Made sure that the webui always writes sessions to disk
+       Fixed a typo in the mail gateway.
+       
+2001-05-23 00:09  jesse
+
+       * Makefile, bin/rt-mailgate:
+
+       Added a bit of code to rt-mailgate to deal with not properly loading users on
+       ticket creation.
+       
+2001-05-22 23:01  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Within Ticket->Create, always get a Queue object as SystemUser for like, defaults and stuff.
+       
+2001-05-21 18:12  jesse
+
+       * etc/config.pm:
+
+       Added comments from Feargal about how to configure RT for http urls.
+       
+2001-05-21 16:37  jesse
+
+       * Makefile:
+
+       bumped version to 1.3.78
+       
+2001-05-21 16:36  jesse
+
+       * lib/RT/Ticket.pm, webrt/Ticket/Display.html:
+
+       Tickets now open when they're new and get acted on.
+       
+2001-05-21 16:09  jesse
+
+       * lib/RT/Action/: Autoreply.pm, SendEmail.pm:
+
+       Fix for Ticket #481 $CorrespondAddress= variable in config.pm doesn't work
+       
+2001-05-21 15:54  jesse
+
+       * webrt/Elements/MessageBox:
+
+       Added a space at teh end of the line, per the standard convention for signature
+       dashes.
+       
+2001-05-21 15:54  jesse
+
+       * webrt/Elements/MessageBox:
+
+       If the user doesn't have a signature, don't include signature dashes
+       
+2001-05-21 15:17  jesse
+
+       * lib/RT/Tickets.pm, webrt/Ticket/ModifyAll.html:
+
+       Dead tickets aren't searchable via the ui anymore.
+       ModifyAll is a bit smarter about what to let people do.
+       
+2001-05-21 14:02  jesse
+
+       * lib/RT/Keyword.pm, webrt/Admin/Keywords/index.html:
+
+       Editing keywords without permission now actually tells you so.
+       
+2001-05-21 13:32  jesse
+
+       * webrt/Admin/: Global/Scrips.html, Queues/Scrips.html:
+
+       Users without permission to delete scrips now get a proper permission denied.
+       
+2001-05-21 13:20  jesse
+
+       * webrt/Ticket/: Update.html, Elements/Tabs:
+
+       The ticket update form is now a little smarter about only letting people perform
+       updates that they have the right to perform.
+       
+2001-05-17 23:09  jesse
+
+       * Makefile:
+
+       Chmod the makefile in the make dist procedure.
+       
+2001-05-17 23:05  jesse
+
+       * README:
+
+       Cleaned up some instructions. Thanks Feargal.
+       
+2001-05-17 22:50  jesse
+
+       * Makefile, lib/RT/Transaction.pm, lib/RT/Action/SendEmail.pm,
+       tools/insertdata:
+
+       Fixed scrip actions to activate when there's a missing scripcontent.
+       
+       Added a Content method to Transaction.pm
+       Fixed Tempates to use new Content method.
+       
+2001-05-17 16:19  jesse
+
+       * lib/RT/Transaction.pm, lib/RT/Action/SendEmail.pm,
+       webrt/Ticket/Display.html, webrt/Ticket/Update.html:
+
+       Better debugging info for some scrips.
+       
+       Fixed bugs which prevented status and owner to change on correspondence
+       and comment.
+       
+2001-05-17 12:36  jesse
+
+       * Makefile, README:
+
+       Bumped the version. Added Mark Vevers to the thansk in the readme.
+       
+2001-05-17 12:34  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Removed some obsolete code. fixed a bug in Comment recording from Mark Vevers
+       
+2001-05-16 18:51  jesse
+
+       * Makefile, tools/testdeps:
+
+       Fixed testdeps to not install bogus new DBD::mysql rev.
+       Bumped rev to 1.3.75
+       
+2001-05-16 17:30  jesse
+
+       * Makefile:
+
+       bumped to 1.3.74
+       
+2001-05-16 17:30  jesse
+
+       * webrt/Admin/Groups/Modify.html:
+
+       Fixed a small bug in Groups editing
+       
+2001-05-16 17:21  jesse
+
+       * tools/testdeps:
+
+       Bumped version to 1.3.73.
+       Bumped dependency on searchbuilder to 0.33
+       
+2001-05-16 17:15  jesse
+
+       * webrt/: Elements/TitleBoxStart, Ticket/Update.html,
+       Ticket/Elements/Tabs:
+
+       The quick link for 'Resolve' now requests that the user enter a ticket update
+       
+2001-05-16 15:45  jesse
+
+       * README, lib/RT/Interface/Web.pm, tools/testdeps,
+       webrt/Ticket/Display.html:
+
+       Added some documentation about what to do if the install fails.
+       
+       Specified a minimum working version of DBD::mysql.
+       
+       Fixed support for entering updates via the webui.
+       
+2001-05-15 00:55  jesse
+
+       * lib/RT/Action/Autoreply.pm:
+
+       Fixed a typo that broke autoreplies
+       
+2001-05-15 00:37  jesse
+
+       * tools/testdeps:
+
+       added Errno dependency
+       
+2001-05-14 23:44  jesse
+
+       * etc/config.pm, tools/insertdata, webrt/Admin/Queues/People.html:
+
+       Cleaned up a bit of phrasing. cleaned up some extra /s in urls.
+       
+2001-05-14 22:49  jesse
+
+       * Makefile, bin/mason_handler.fcgi, bin/mason_handler.scgi, bin/rt,
+       bin/webmux.pl, lib/Makefile.PL, lib/RT/Date.pm,
+       lib/RT/Interface/Web.pm, tools/testdeps:
+
+       Switched from Date::Manip To Graham Barr's Date::Parse
+       
+2001-05-14 18:58  jesse
+
+       * lib/RT/Scrips.pm, lib/RT/Ticket.pm, lib/RT/Interface/Web.pm,
+       webrt/Ticket/Display.html, webrt/Ticket/Elements/Tabs:
+
+       Work on the web frontend. the "quick" links have been cleaned up and decomplexified.
+       
+2001-05-14 17:11  jesse
+
+       * lib/RT/User.pm, lib/RT/Interface/Web.pm,
+       webrt/Admin/Groups/Modify.html, webrt/Admin/Users/Modify.html:
+
+       Cleaned up bugs related to spurious extra display of information in user and group modification and ACL deletion
+       when the user didn't have the right to do so.
+       
+2001-05-13 23:05  jesse
+
+       * webrt/Admin/Users/index.html:
+
+       no longer provide a link to create a new user to someone who doesn't have rights to do so.
+       
+2001-05-13 22:49  jesse
+
+       * lib/RT/Ticket.pm, tools/insertdata, webrt/Ticket/Modify.html:
+
+       yanked bogus Ticket Queue caching
+       rephrased ticket creation autoreply
+       
+2001-05-13 22:15  jesse
+
+       * webrt/User/Prefs.html:
+
+       Added a hack to make sure that session gets written to disk
+       
+2001-05-13 22:11  jesse
+
+       * webrt/User/Prefs.html:
+
+       more work on letting users edit their own passwords
+       
+2001-05-13 21:40  jesse
+
+       * webrt/Ticket/: Attachment/dhandler, Elements/ShowTransaction:
+
+       Fix for #433. now attachements are displayable after merges.
+       
+2001-05-12 17:46  jesse
+
+       * Makefile, lib/Makefile.PL, tools/testdeps, webrt/User/Prefs.html:
+
+       Started work on user prefs. password changing is untested
+       
+       Fixed dependency on SB to .31 and bumped version
+       
+2001-05-11 12:32  jesse
+
+       * lib/RT/Record.pm:
+
+       turned on use of DBIx::SearchBuilder::Record::Cachable
+       
+2001-05-11 12:30  jesse
+
+       * lib/RT/User.pm, webrt/Elements/Quicksearch:
+
+       Redid how the ACL checking works for great perf gains.
+       Added stalled lists to quicksearch.
+       
+2001-05-09 20:11  jesse
+
+       * Makefile:
+
+       Bumping the version # so people working off cvs get less confused.
+       
+2001-05-09 20:11  jesse
+
+       * bin/rt-mailgate, lib/RT/Queue.pm, lib/RT/Action/Autoreply.pm,
+       lib/RT/Action/Notify.pm, lib/RT/Action/NotifyAsComment.pm,
+       lib/RT/Action/SendEmail.pm:
+
+       Cleanup in the mail sending stuff.
+               fix for ticket 403:  RT should no longer send mail when it has
+               no recipients
+       
+               fix for #404: Squelch-Replies-To should be a bit more intelligent,
+               since it was rewritten from scratch
+       
+               RT should now properly send mail to queue ccs and queue admin ccs
+               when you ask it to
+       
+               internally, RT's mail sending stuff now lets you pass around
+               arrays of addresses to send mail to, rather than comma delimited
+               strings. More flexible down the line.
+       
+2001-05-09 16:39  jesse
+
+       * README:
+
+       Updated the readme to note the dependency on setuid perl
+       
+2001-05-09 16:08  jesse
+
+       * webrt/Ticket/Elements/ShowLinks:
+
+       fix for RT/fsck.com: Ticket #440 [rt-devel] 'Depended on by' doesn't work
+       
+2001-05-08 20:48  jesse
+
+       * etc/schema.mysql, etc/schema.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, webrt/Admin/Elements/UserTabs,
+       webrt/Admin/Queues/People.html, webrt/Elements/MyRequests,
+       webrt/Elements/MyTickets, webrt/Elements/Tabs,
+       webrt/Ticket/Elements/ShowBasics,
+       webrt/Ticket/Elements/ShowRequestor:
+
+       Schema.pm now has a few more indices. the mysql schema has been regenerated, but not
+       the Pg or oracle schemas.
+       
+       in Ticket.pm, a message got the queue id replaced with the queue name
+       
+       removed a spurious variable localization in Transaction.pm
+       
+       Removed a pointer to a nonexistent page  on admin/user/modify
+       
+       Modifying queue watchers now has a more coherent title
+       
+       "This user's tickets, My requests and My tickets are now limited to the 25 highest priority items
+       attached to you.
+       
+       The "Administration" tab has been changed to the "Configuration" tab
+       
+2001-04-04 16:55  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Fixing a comment in the web interface. no functional changes.
+       
+2001-04-04 16:52  jesse
+
+       * Makefile:
+
+       
+       Bumping the version to 1.3.70 for release
+       
+2001-04-04 16:51  jesse
+
+       * lib/RT/User.pm:
+
+       lib/RT/User no longer treats "ModifySelf" as equivalent to "AdminUsers" for the current user.
+       
+2001-04-04 15:08  jesse
+
+       * lib/RT/KeywordSelect.pm, lib/RT/Action/Autoreply.pm,
+       webrt/Admin/Global/Keywords.html, webrt/Admin/Queues/Keywords.html:
+
+       Fixed a crashing bug and an ACL violation on keywordselect deletion
+       
+2001-04-04 00:19  jesse
+
+       * Makefile:
+
+       bumping version for release
+       
+2001-04-03 21:14  jesse
+
+       * Makefile:
+
+       Bumped the version
+       
+2001-04-03 21:08  jesse
+
+       * etc/config.pm, lib/RT/Action/Notify.pm:
+
+       Added configuration tweak to not set a :; To header if the user doesn't want it.
+       
+2001-04-03 17:32  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       Fix for sendmail null list syntax.  : ;  is not the same as :; to sendmail
+       
+2001-04-03 17:05  jesse
+
+       * webrt/Admin/Queues/: GroupRights.html, UserRights.html:
+
+       removed a couple of stray 's in the html
+       
+2001-04-03 16:50  jesse
+
+       * webrt/Elements/Header:
+
+       Dropped doctype back to 4.0 because 4.01 makes mozilla render things funny
+       
+2001-04-03 16:47  jesse
+
+       * webrt/Elements/Quicksearch:
+
+       <TABLE>
+       should have been </TABLE>
+       
+2001-04-03 16:30  jesse
+
+       * webrt/Elements/Quicksearch:
+
+       Added a feature request/patch from nick@netability.ie
+       http://fsck.com/rt2/Ticket/Display.html?id=345
+       
+2001-04-03 16:01  jesse
+
+       * tools/testdeps:
+
+       Adding in testing for params::validate 0.02
+       
+2001-04-03 15:46  jesse
+
+       * Makefile:
+
+       Bumped the version slightly for a prerelease
+       
+2001-04-03 15:40  jesse
+
+       * lib/RT/Action/Autoreply.pm, lib/RT/Action/SendEmail.pm,
+       tools/insertdata:
+
+       Fixed autoreply by adding a new scrip. some misc. cleanup in SendEmail (method calls were on the wrong object)
+       
+2001-04-03 15:40  jesse
+
+       * lib/RT/Action/Autoreply.pm:
+
+       file Autoreply.pm was initially added on branch rt-1-1.
+       
+2001-04-03 15:15  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       Fixed a bug in the 'blacklist' regexp
+       
+2001-04-03 15:04  jesse
+
+       * etc/config.pm, lib/RT/Action/SendEmail.pm,
+       lib/RT/Interface/Web.pm, webrt/Ticket/Elements/ShowRequestor:
+
+       Two seperate fixes for the "RT doesn't send mail" problem. One that helps fix Mail::Internet->send
+       and one that provides an alternative.
+       
+       A fix for a bad link in ShowRequestor.
+       
+       Updating fields via the web ui should now be a bit more descriptive
+       
+2001-04-03 02:31  jesse
+
+       * webrt/Ticket/ModifyPeople.html:
+
+       Missed one of the mason fixes
+       
+2001-04-03 02:31  jesse
+
+       * Makefile, bin/rt-mailgate, etc/config.pm, lib/RT/Date.pm,
+       lib/RT/Ticket.pm, lib/RT/Transaction.pm, lib/RT/Watcher.pm,
+       lib/RT/Interface/Web.pm, webrt/Admin/Global/GroupRights.html,
+       webrt/Admin/Global/Keywords.html, webrt/Admin/Global/Scrips.html,
+       webrt/Admin/Global/UserRights.html,
+       webrt/Admin/Keywords/index.html,
+       webrt/Admin/Queues/GroupRights.html,
+       webrt/Admin/Queues/Keywords.html, webrt/Admin/Queues/People.html,
+       webrt/Admin/Queues/Scrips.html, webrt/Admin/Queues/UserRights.html,
+       webrt/Ticket/Modify.html, webrt/Ticket/ModifyAll.html,
+       webrt/Ticket/ModifyDates.html, webrt/Ticket/ModifyPeople.html:
+
+       Added support for parsing Cc and To in the mail gateway
+       (resolves the last work item for beta 2 - #219)
+       
+       Ticket due date is no longer set to "right now" if the queue has an
+       undefined "default due in"
+       
+       Cleanup warnings in date, ticket and watcher
+       
+       fixes for a bunch of mason 1.01 related bugs (Mason changed handling of combined GET and POST, thus breaking RT)
+       
+2001-04-02 23:15  jesse
+
+       * README, bin/webmux.pl:
+
+       Cleanup for mason 1.01.
+       Moved Apache::DBI out of the webmux into the instructions
+       
+2001-04-02 17:56  jesse
+
+       * tools/initdb:
+
+       Typo fix from  "Nick Hilliard" <nick@netability.ie>
+       
+2001-04-02 15:32  jesse
+
+       * Makefile, lib/RT/Keyword.pm, webrt/NoAuth/Logout.html:
+
+       Makefile cleanup.
+       Fix for #342 - reported by ivan
+       
+       Fix for a bug that clobbered logouts.
+       
+2001-04-02 03:09  jesse
+
+       * Makefile:
+
+       Bumped version for release
+       
+2001-04-01 19:19  jesse
+
+       * bin/rtadmin, lib/RT/ACE.pm, lib/RT/Interface/Web.pm,
+       webrt/Admin/Elements/SelectRights,
+       webrt/Admin/Global/GroupRights.html,
+       webrt/Admin/Global/UserRights.html,
+       webrt/Admin/Queues/GroupRights.html,
+       webrt/Admin/Queues/UserRights.html:
+
+       Redid the ACL editor so that it's much much faster. and easier to use...if not quite as pretty.
+       
+2001-04-01 17:31  jesse
+
+       * webrt/Ticket/Elements/: ShowDates, ShowRequestor:
+
+       fixing a couple of html typos
+       
+2001-03-31 03:07  jesse
+
+       * Makefile:
+
+       fixing Changelog generation
+       
+2001-03-31 02:52  jesse
+
+       * Makefile:
+
+       Bumped the version.
+       
+2001-03-31 02:52  jesse
+
+       * webrt/User/Prefs.html:
+
+       Cleaned up user preferences somewhat. removed things that don't do anything.
+       
+               -j
+       
+2001-03-31 01:59  jesse
+
+       * bin/rt:
+
+       Fix for #88   RT now lets you use the CLI to search for tickets, based on links to other tickets
+       
+2001-03-31 01:20  jesse
+
+       * README:
+
+       Fix for #216: Web session files need better handling and cleanup
+       
+2001-03-31 00:49  jesse
+
+       * Makefile, README, bin/rtadmin, bin/webmux.pl, etc/config.pm:
+
+       Moved RT Session data out of /tmp to somewhere that makes more sense.
+       This is the first half of the fix for #216.  Now we just need to document the cronjob reaper to kill old sessions
+       
+       Cleaned up creation of queues and users in bin/rtadmin
+       
+       Updates to the README
+       
+2001-03-30 23:44  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Fix for http://fsck.com/rt2/Ticket/Display.html?id=324
+       mail from requestors does not reopen ticket
+       
+2001-03-30 23:19  jesse
+
+       * bin/rtadmin, lib/RT/Queue.pm, lib/RT/Watcher.pm:
+
+       Work on Watchers and editing watchers from the CLI tool.  added support for --list-{queues|users|groups}
+       
+2001-03-30 19:31  jesse
+
+       * bin/rt, lib/RT/ACE.pm, lib/RT/Queue.pm, lib/RT/Ticket.pm,
+       lib/RT/Tickets.pm, lib/RT/Watcher.pm, lib/RT/Action/SendEmail.pm,
+       lib/RT/Interface/Web.pm:
+
+       A bunch of reworking of access control for watchers. should be much more robust
+       and more flexible.
+       
+       Resolves http://fsck.com/rt2/Ticket/Display.html?id=253 by adding the "Watch" and "WatchAsAdminCc" rights.
+       
+2001-03-30 15:41  jesse
+
+       * lib/RT/: Action/Notify.pm, Interface/Web.pm:
+
+       Tiny cleanup in Interface/Web.pm.  no functional difference there just being more explicit.
+       
+       Fix for #292: Sender of a message is no longer notified of that message.
+       
+2001-03-30 02:55  jesse
+
+       * Makefile:
+
+       Bumped the version
+       
+2001-03-30 02:37  jesse
+
+       * webrt/Elements/SelectDate:
+
+       Fixed an as-yet-untickled bug in SelectDate that incremented things too much
+       
+2001-03-30 02:32  jesse
+
+       * lib/RT/Template.pm, webrt/Admin/Global/Scrips.html:
+
+       Fixes to template creation. stupid typo.
+       Global scrips creation should now work better
+       
+2001-03-30 02:12  jesse
+
+       * webrt/: Admin/Elements/GroupTabs, Admin/Groups/Members.html,
+       Admin/Groups/Modify.html, Admin/Users/Modify.html,
+       Elements/ListActions:
+
+       Fix for PseudoGroups having a prompt to add members.
+       some cleanups to not make the "Results" box pop up when it's not wanted.
+       
+2001-03-30 01:41  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Attached is a patch to implement the ShowTicketComments in the
+       display of transactions of a ticket.
+       
+                       Arthur de Jong <arthur@West.NL>
+       
+2001-03-30 01:34  jesse
+
+       * lib/RT/Scrip.pm, webrt/Admin/Global/Scrips.html,
+       webrt/Admin/Queues/Scrips.html:
+
+       Fix for 328: Re: [rt-users] 1.3.64 & postgres & scrips
+       there was an ACL bug.
+       
+2001-03-28 22:15  jesse
+
+       * Makefile, webrt/autohandler:
+
+       Fixed a tiny bug in the new authandler that caused logout to fail
+       
+2001-03-27 22:30  jesse
+
+       * webrt/index.html:
+
+       fixed index.html
+       
+2001-03-27 22:26  jesse
+
+       * Makefile, webrt/Admin/Groups/Members.html,
+       webrt/Ticket/Update.html:
+
+       Added a couple of fixes from Arthur at west.nl
+       Groups/Members deals better with multiple selections
+       Ticket/Update now displays queue watchers.
+       bumped the version to 1.3.63
+       
+2001-03-27 04:25  jesse
+
+       * docs/manual.pod, webrt/autohandler, webrt/index.html,
+       webrt/Admin/Users/index.html, webrt/Elements/ShadedBox,
+       webrt/Search/Listing.html:
+
+       Lots of cleanup of the auothandler.
+       a tiny bit of doc about an alternative apache configuration.
+       some web ui cleanup so that when you are on a page, your location is more properly hilighted.
+       admin/users includes some more verbiage explaining what's going on.
+       
+2001-03-25 00:44  jesse
+
+       * Makefile, lib/RT/Interface/Web.pm:
+
+       Bumped the version.
+       cosmetic fix in Interface/Web.pm
+       
+2001-03-23 20:33  jesse
+
+       * lib/RT/: Action/SendEmail.pm, Interface/Web.pm:
+
+       Fixed for TEXTAREA newline bug and Correspondence subject bug.
+       
+2001-03-23 00:34  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       : goes outside the '' in undisclosed recipients
+       
+2001-03-23 00:30  jesse
+
+       * lib/RT/: ACL.pm, ObjectKeywords.pm:
+
+       Removed some very loud uneccesary debugging statements
+       
+2001-03-23 00:27  jesse
+
+       * Makefile, lib/RT/Action/Notify.pm, lib/RT/Action/SendEmail.pm:
+
+       Work on mail sending routines to be more careful about newlines in subjects.
+       And about Undisclosed recipients
+       
+2001-03-22 23:17  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       yet another typo in notify.pm
+       
+2001-03-22 23:12  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       typo fix
+       
+2001-03-22 23:09  jesse
+
+       * lib/RT/Action/: Notify.pm, SendEmail.pm:
+
+       Cleanups and fixes to Notify and SendEmail
+       
+2001-03-22 19:46  jesse
+
+       * webrt/Ticket/ModifyAll.html:
+
+       TicketObj->Ticket
+       
+2001-03-22 19:42  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       A more functional Undisclosed Recipients;
+       
+2001-03-22 19:28  jesse
+
+       * webrt/Ticket/: ModifyAll.html, Elements/Tabs:
+
+       Elements/Tabs now does better access control checking before making
+       buttons available to people.
+       
+       ModifyAll.html has a better title and should now update objectkeywords.
+       
+2001-03-22 18:18  jesse
+
+       * lib/RT/: Date.pm, Ticket.pm:
+
+       Added  a routine to Date.pm to advance the date N days
+       
+       Started using queue defaults on Ticket->Create
+       
+2001-03-22 18:17  jesse
+
+       * webrt/: autohandler, Elements/Login, NoAuth/Login.html,
+       Search/autohandler, Ticket/autohandler:
+
+       Cleanup of the login process. now you can't accidentally call "Login.html"
+       when you're already logged in.
+       removed a couple of bogus old autohandlers
+       
+2001-03-22 18:17  jesse
+
+       * webrt/Elements/Login:
+
+       file Login was initially added on branch rt-1-1.
+       
+2001-03-22 14:45  jesse
+
+       * webrt/Ticket/Elements/EditPeople:
+
+       EditPeople should now enforce a list of possible owners reasonably
+       
+2001-03-21 21:40  jesse
+
+       * Makefile:
+
+       bumped the version to .60
+       
+2001-03-21 21:22  jesse
+
+       * docs/manual.pod:
+
+       Adding some content to the manual. and even more places where the manual is
+       missing content. :/
+       
+2001-03-21 12:21  jesse
+
+       * lib/RT/Action/NotifyAsComment.pm:
+
+       NotifyAsComment should now DTRT and send mail from the comments email address
+       
+2001-03-21 02:46  jesse
+
+       * Makefile:
+
+       yanked some cruft from the ChangeLog creator
+       
+2001-03-21 02:44  jesse
+
+       * Makefile, README:
+
+       Bumped the version. added some people to the readme
+       
+2001-03-21 02:39  jesse
+
+       * webrt/Ticket/Elements/ShowBasics:
+
+       Fix for 242: time left displayed via the web ui is now more intuitive
+       
+2001-03-21 02:37  jesse
+
+       * bin/rt, bin/rt-mailgate, lib/RT.pm, lib/RT/Attachment.pm,
+       lib/RT/Date.pm, lib/RT/Tickets.pm, lib/RT/User.pm:
+
+       Added more error checking and error handling to the mail gateway
+       finished code in Attachment.pm to handle too-long attachments
+       
+       added support for limiting by date to the CLI
+       
+       fixed little bugs in user, date and tickets.
+       
+2001-03-20 19:02  jesse
+
+       * docs/manual.pod:
+
+       file manual.pod was initially added on branch rt-1-1.
+       
+2001-03-20 19:02  jesse
+
+       * docs/manual.pod:
+
+       actually adding the outline of the manual
+       
+2001-03-20 19:01  jesse
+
+       * Makefile, bin/rt, docs/API, docs/README.docs, docs/Security,
+       docs/keywords, etc/config.pm:
+
+       Starting the doc cleanup
+       
+2001-03-20 15:26  jesse
+
+       * webrt/Elements/SelectTicketSortBy:
+
+       LastUpdated, not LastUpdate
+       
+2001-03-20 15:21  jesse
+
+       * webrt/Elements/: SelectDate, SelectTicketSortBy:
+
+       more things to sort by.
+       select date shouldn't insert spurious null dates.
+       
+2001-03-20 13:27  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       fixed a typo. $defined is not useful perl ;)
+       
+2001-03-20 13:21  jesse
+
+       * lib/RT/Action/: Notify.pm, SendEmail.pm:
+
+       Fixed a couple bugs in Notify and SendEmail that should get mail flowing
+       for transactions without content.
+       
+2001-03-20 13:08  jesse
+
+       * webrt/Ticket/: Attachment/dhandler, Elements/ShowTransaction:
+
+       Making web based attachment display deal nicely with too-long message bodies
+       
+2001-03-20 04:26  jesse
+
+       * Makefile:
+
+       bumping the version
+       
+2001-03-20 04:20  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       regexps with three /s need a leading s ;)
+       
+2001-03-20 04:16  jesse
+
+       * bin/rt-mailgate, lib/RT/Template.pm:
+
+       fixing scrips-related mailing stuff. some transaction mailing used to bomb out.
+       
+2001-03-20 02:46  jesse
+
+       * Makefile, bin/rt-mailgate, etc/config.pm,
+       lib/RT/Action/SendEmail.pm, tools/insertdata:
+
+       Work on robustification of the mail gateway. including single-transaction
+       blacklisting of addresses that might generate bounces.
+       
+2001-03-20 00:41  jesse
+
+       * lib/RT/User.pm:
+
+       Work on user.pm to allow users to be disabled.
+       
+2001-03-19 18:03  jesse
+
+       * webrt/: autohandler, Elements/MyRequests, NoAuth/Login.html,
+       NoAuth/Reminder.html:
+
+       fixed the MyRequests bug that caused them not to be listed.
+       nonexistent users no longer get shunted to SelfService.
+       
+2001-03-19 15:30  jesse
+
+       * Makefile, bin/mason_handler.fcgi, bin/mason_handler.scgi, bin/rt,
+       bin/rt-mailgate, bin/rtadmin, webrt/Admin/Elements/ModifyTemplate,
+       webrt/Admin/Elements/ModifyUser, webrt/Admin/Global/Template.html,
+       webrt/Admin/Queues/Template.html, webrt/Admin/Users/Modify.html,
+       webrt/Elements/MessageBox:
+
+       Fixes for perl path and textarea bugs noted by Arthur de Jong
+       
+2001-03-18 14:58  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Removed an extra signature attachment
+       
+2001-03-17 14:57  jesse
+
+       * Makefile:
+
+       bumped version
+       
+2001-03-17 14:55  jesse
+
+       * lib/Makefile.PL, lib/RT/Tickets.pm, lib/RT/Interface/Web.pm,
+       webrt/Elements/Quicksearch, webrt/Elements/SelectDate,
+       webrt/Elements/SelectDateType, webrt/Elements/TitleBoxEnd,
+       webrt/Search/PickRestriction:
+
+       Fixed a bug on simple actions reported by christian.
+       Implemented search by date via web ui
+       
+2001-03-16 03:55  jesse
+
+       * Makefile, lib/RT/Interface/Web.pm, webrt/Elements/Header:
+
+       Fixed a tiny typo that prevented objectkeyword editing
+       
+2001-03-16 02:29  jesse
+
+       * Makefile:
+
+       Bumped the version.
+       
+2001-03-16 02:27  jesse
+
+       * Makefile, README, bin/initacls.Oracle, bin/initacls.Pg,
+       bin/initacls.mysql, bin/initdb.Oracle, tools/initdb:
+
+       some clarifications to the install procedure.
+       
+2001-03-16 02:10  jesse
+
+       * lib/RT/Tickets.pm, webrt/Search/Listing.html:
+
+       Fixed #2 WebRT doesn't refresh searches properly. the oldest bug in the bug tracking
+       system ;)
+       
+       Fixed Tickets->Count
+       
+2001-03-16 01:39  jesse
+
+       * webrt/Admin/: Global/Template.html, Global/Templates.html,
+       Queues/Modify.html, Queues/Template.html, Queues/Templates.html:
+
+       now you can create templates with the web ui.
+       
+2001-03-16 00:39  jesse
+
+       * webrt/Ticket/Elements/EditLinks:
+
+       file EditLinks was initially added on branch rt-1-1.
+       
+2001-03-16 00:39  jesse
+
+       * webrt/Ticket/ModifyAll.html:
+
+       file ModifyAll.html was initially added on branch rt-1-1.
+       
+2001-03-16 00:39  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Interface/Web.pm, webrt/Elements/Tabs,
+       webrt/Ticket/Modify.html, webrt/Ticket/ModifyAll.html,
+       webrt/Ticket/ModifyDates.html, webrt/Ticket/ModifyLinks.html,
+       webrt/Ticket/ModifyPeople.html, webrt/Ticket/ValidateUpdate.html,
+       webrt/Ticket/Elements/EditKeywordSelects,
+       webrt/Ticket/Elements/EditLinks, webrt/Ticket/Elements/EditPeople,
+       webrt/Ticket/Elements/Tabs:
+
+       A bunch of Ticket modification refactoring and cleanup.
+       Added a "ModifyAll" at sam hartman's suggestion
+       
+2001-03-14 21:20  jesse
+
+       * bin/rt:
+
+       --id=43-45 should now work. there was a regex typo
+       
+2001-03-14 04:37  jesse
+
+       * Makefile, bin/initacls.Oracle, etc/acl.Oracle, etc/acl.mysql,
+       etc/schema.Oracle, etc/user.Oracle, tools/initdb, tools/testdeps:
+
+       reworked init procedures, oracle schema and
+       acl setup for mysql and postgres and oracle.
+       
+       RT2 now runs on oracle.
+       
+2001-03-14 02:08  jesse
+
+       * etc/acl.Oracle, etc/schema.Oracle, tools/initdb:
+
+       hacking to make oracle work. we're much of the way there. next up:
+       schema updates
+       
+2001-03-14 02:08  jesse
+
+       * etc/acl.Oracle:
+
+       file acl.Oracle was initially added on branch rt-1-1.
+       
+2001-03-14 01:03  jesse
+
+       * webrt/Admin/Queues/GroupRights.html:
+
+       file GroupRights.html was initially added on branch rt-1-1.
+       
+2001-03-14 01:03  jesse
+
+       * webrt/Admin/Queues/UserRights.html:
+
+       file UserRights.html was initially added on branch rt-1-1.
+       
+2001-03-14 01:03  jesse
+
+       * Makefile, lib/RT/ACE.pm, lib/RT/Interface/Web.pm, tools/initdb,
+       webrt/Admin/Elements/QueueTabs,
+       webrt/Admin/Global/GroupRights.html, webrt/Admin/Queues/ACL.html,
+       webrt/Admin/Queues/GroupRights.html,
+       webrt/Admin/Queues/UserRights.html, webrt/Elements/Tabs,
+       webrt/NoAuth/webrt.css:
+
+       Cleanup to the ACL editors (consistency)
+       a bit of web ui tuning.
+       
+       fixes for initdb issues (thanks, jhutz)
+       
+       minor cleanups to ACE.pm
+       
+2001-03-13 22:44  jesse
+
+       * lib/RT/Transaction.pm, lib/RT/Transactions.pm, tools/testdeps:
+
+       Updated DBIx::SearchBuilder dependency
+       
+       code cleanup and sketching in Transaction.pm and Transactions.pm
+       
+2001-03-12 21:14  jesse
+
+       * Makefile, etc/schema.Pg, etc/schema.mysql, tools/initdb,
+       tools/testdeps:
+
+       initdb now caches schema, eliminating the install-time dependency on DBIx::DBSchema.
+       
+       this is 1.3.50, folks. it has what I believe to be functional postgres support
+       
+2001-03-11 21:58  jesse
+
+       * etc/config.pm, etc/schema.pm, lib/RT/Attachment.pm,
+       lib/RT/Ticket.pm, tools/initdb:
+
+       Cleanup in Ticket.pm
+       Bugfixes to Attachment.pm (for postgres mimencoding supporT)
+       
+       reconfigured to use the new DBIx::DBSchema (which isn't out yet. but should
+       be soon)
+       
+       still need to do a bit more work on attachments configuration.
+       
+2001-03-11 02:45  jesse
+
+       * bin/rt-mailgate:
+
+       file rt-mailgate was initially added on branch rt-1-1.
+       
+2001-03-11 02:45  jesse
+
+       * Makefile, README, bin/rt-mailgate, bin/rtmux.pl, bin/webmux.pl,
+       etc/config.pm, etc/schema.Oracle, etc/schema.pm, lib/RT.pm,
+       lib/RT/Attachment.pm, lib/RT/ScripAction.pm, lib/RT/Ticket.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Interface/CLI.pm,
+       lib/RT/Interface/Email.pm, tools/insertdata:
+
+       This is a bit more of a 'comprehensive' diff than I'd intended. That's what
+       I get for working for 1/2 a week at my parents place without real net ;)
+       
+       Cleanups in the makefile and readme to make installation simpler and more
+       sensical.
+       
+       removed outdated rtmux.pl
+       moved old Interface/Email.pm to bin/rt-mailgate
+       started new baseclass for new mail gateways (Interface/Email.pm)
+       
+       first cut implementation of attachment size limits.
+       
+       switched mysql to use 'longblob' rather than just 'blob', so
+       that users can submit > 64k attachments.  with the next release
+       of DBIx::DBSchema, we should have what we need to get
+       PG attachmetns of more reasonable sizes working.
+       
+       first cut implementation of base64 encoding for MIME objects
+       on databases that don't support BLOBs (postgres)
+       
+       restructured initdb so we'll be able to support databases
+       for which we need to hand-hack schema.
+       
+       added the 'Owner' pseudogroup to insertdata
+       
+       fixed the bug in logging for the mail gateway that caused
+       lots of warnings about joins.
+       
+       lots of work on the mail gateway to start to clean up and restructure
+       things.
+       
+2001-03-10 18:53  jesse
+
+       * tools/initdb:
+
+       Refactoring initdb to make it easier to do things like add oracle support. yay
+       
+2001-03-09 15:19  jesse
+
+       * lib/RT/Condition/StatusChange.pm:
+
+       file StatusChange.pm was initially added on branch rt-1-1.
+       
+2001-03-09 15:19  jesse
+
+       * Makefile, etc/config.pm, lib/RT/Attachment.pm, lib/RT/Link.pm,
+       lib/RT/Ticket.pm, lib/RT/Transaction.pm, lib/RT/Watcher.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Condition/AnyTransaction.pm,
+       lib/RT/Condition/Generic.pm, lib/RT/Condition/StatusChange.pm,
+       tools/insertdata, tools/testdeps:
+
+       OnResolve scrip now works.
+       some cleanup on Scrips and Watchers.
+       commented out some debug messages that aren't immediately useful
+       
+2001-03-09 15:15  jesse
+
+       * webrt/Ticket/: ModifyDates.html, Elements/EditWatchers:
+
+       Two bugfixes:
+               one, editdates no longer errors out on 5.005
+               two, links from watchers to the ModifyUser page now work properly
+       
+2001-03-08 15:21  jesse
+
+       * Makefile, lib/RT/User.pm, tools/insertdata:
+
+       
+       Fixed a bootstrapping bug introduced with the new acls on Create.
+       bumped version to 1.3.49_01
+       
+2001-03-07 00:40  jesse
+
+       * lib/: test.pl, RT/ACE.pm, RT/CurrentUser.pm, RT/Group.pm,
+       RT/GroupMember.pm, RT/Keyword.pm, RT/KeywordSelect.pm, RT/Link.pm,
+       RT/Queue.pm, RT/Scrip.pm, RT/ScripAction.pm, RT/Template.pm,
+       RT/Ticket.pm, RT/Transaction.pm, RT/User.pm, RT/Watcher.pm:
+
+       acls for Delete methods that needed them.
+       flat lockouts on Delete methods that needed them.
+       
+       test.pl got 'use *' added to it
+       
+2001-03-06 18:07  jesse
+
+       * lib/RT/Attachment.pm:
+
+       Backing out changes that broke ->Content
+       
+2001-03-06 17:42  jesse
+
+       * Makefile, lib/RT/Attachment.pm, lib/RT/Record.pm,
+       lib/RT/Interface/Web.pm, webrt/Elements/SelectSortOrder,
+       webrt/Search/Listing.html, webrt/Search/PickRestriction:
+
+       work on Attachments.
+       cleanup on sorting and limiting.
+       
+2001-03-06 16:26  jesse
+
+       * webrt/Search/PickRestriction:
+
+       adding a header
+       
+2001-03-04 19:46  jesse
+
+       * etc/schema.pm:
+
+       Schema change to support postgres
+       
+2001-03-04 19:44  jesse
+
+       * lib/RT/Record.pm:
+
+       Small change for new DBIx::SearchBuilder::Record PrimaryKey behaviors..
+       
+2001-03-04 19:15  jesse
+
+       * bin/rt:
+
+       rt --id=<int> should work now
+       
+2001-03-02 00:26  jesse
+
+       * etc/config.pm, lib/RT/Date.pm, lib/RT/Ticket.pm,
+       webrt/Ticket/ModifyDates.html:
+
+       first pass on dates and timezones...seems to work. for common ops
+       
+2001-02-28 16:34  jesse
+
+       * lib/RT/User.pm:
+
+       fix for RT/fsck.com: Ticket #208 User->Create needs more argument checking
+               added a check to User->Create to make sure a name was specified
+       
+2001-02-28 08:56  jesse
+
+       * Makefile, bin/rtadmin:
+
+       Enabled the ability to set a user's password via the CLI
+       
+2001-02-27 22:09  jesse
+
+       * lib/Makefile.PL, tools/testdeps:
+
+       Bumping required version of searchbuilder in testdeps and lib/Makefile.pl
+       
+2001-02-27 22:00  jesse
+
+       * webrt/Elements/SelectKeyword:
+
+       allowing undef keywords
+       
+2001-02-27 21:43  jesse
+
+       * webrt/Admin/Queues/Scrips.html:
+
+       Fix for ticket #50. grammar in per queue scrip descriptions
+       
+2001-02-27 21:41  jesse
+
+       * tools/insertdata:
+
+       resolving ticket #181- extra \s in the autoreply template
+       
+2001-02-27 21:36  jesse
+
+       * Makefile, lib/RT/Transaction.pm, tools/testdeps:
+
+       testdeps now erorrs out if you don't specify a db type.
+       
+       queue change transaction descriptions are better.
+       
+       bumped the version
+       
+2001-02-27 21:12  jesse
+
+       * webrt/Elements/SelectTicketSortBy:
+
+       file SelectTicketSortBy was initially added on branch rt-1-1.
+       
+2001-02-27 21:12  jesse
+
+       * webrt/Elements/SelectSortOrder:
+
+       file SelectSortOrder was initially added on branch rt-1-1.
+       
+2001-02-27 21:12  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Tickets.pm, lib/RT/Interface/Web.pm,
+       webrt/Elements/SelectKeyword, webrt/Elements/SelectResultsPerPage,
+       webrt/Elements/SelectSortOrder, webrt/Elements/SelectTicketSortBy,
+       webrt/Search/Listing.html, webrt/Search/PickRestriction:
+
+       Basic ticket sorting has been implemented.
+       Ticket listing by pages works too.
+       
+       a bit of cleanup in the ticket listing.  now select by keywords uses the component designed for that purpose
+       
+2001-02-26 15:44  jesse
+
+       * lib/RT/Ticket.pm:
+
+       No longer generate spurious watchers transactions when merging tickets.
+       
+2001-02-26 03:08  jesse
+
+       * lib/RT/Ticket.pm:
+
+       fixed a typo in a debug message that prevented compilation
+       
+2001-02-26 02:53  jesse
+
+       * Makefile:
+
+       bumped the version for release. again.
+       
+2001-02-26 02:52  jesse
+
+       * lib/RT/: ACE.pm, Ticket.pm:
+
+       Fixed a variable redef in ticket and an acl granting bug in ACE
+       
+2001-02-26 01:24  jesse
+
+       * Makefile, webrt/Ticket/ModifyLinks.html:
+
+       A bit more merging support.
+       Bumped version for release
+       
+2001-02-25 22:28  jesse
+
+       * webrt/Ticket/Elements/: ShowHistory, ShowTransaction:
+
+       Cleaning up the transaction display.
+       
+2001-02-25 22:22  jesse
+
+       * lib/RT/: Scrip.pm, ScripCondition.pm, Ticket.pm:
+
+       Some bug fixes for merging.
+       Fixed a bug in Scrips that caused an infinite loop if the user had no rights.
+       
+2001-02-24 02:42  jesse
+
+       * Makefile, lib/RT/Ticket.pm:
+
+       Fixed a bug that prevented ticket loading from appearing to work
+       
+2001-02-23 19:17  jesse
+
+       * Makefile, lib/RT/Ticket.pm, lib/RT/Interface/Web.pm:
+
+       Fixed a typo in Ticket.pm that prevented transaction lists from working
+       fixed a paste error in Web.pm
+       
+2001-02-23 17:41  jesse
+
+       * Makefile:
+
+       Bumped the version # for release
+       
+2001-02-23 17:31  jesse
+
+       * Makefile, README, bin/initacls.mysql, bin/webmux.pl,
+       lib/RT/ACE.pm, lib/RT/ACL.pm, lib/RT/Link.pm, lib/RT/Queue.pm,
+       lib/RT/Ticket.pm, lib/RT/User.pm, lib/RT/Interface/Web.pm,
+       tools/initdb, tools/testdeps:
+
+       Fixed a bug that made a first install with mysql fail
+       yanked a UNIVERSAL::AUTOLOADER handler I inserted to test things out.
+       Fixed several ACL creation bugs.
+       Initial implementation of merge for the core.
+       Testdeps now does database testing.
+       
+       Made Ticket->Load smarter. (nolonger needs a seperate LoadByURI sub.
+       
+       fixed bugs in the readme
+       
+2001-02-22 01:03  jesse
+
+       * tools/testdeps:
+
+       Updated dependencies.
+       
+2001-02-21 17:49  jesse
+
+       * lib/RT/: Ticket.pm, Tickets.pm:
+
+       Cache Queue in Ticket.pm for added perf.
+       formatting cleanup in Tickets.pm
+       
+2001-02-20 14:38  jesse
+
+       * webrt/Ticket/Display.html:
+
+       Uncompressed history on summary page...
+       
+2001-02-20 14:18  jesse
+
+       * lib/RT/ScripCondition.pm:
+
+       fixed a pod typo
+       
+2001-02-20 14:07  jesse
+
+       * Makefile, etc/schema.pm, lib/MANIFEST, tools/insertdata,
+       webrt/Admin/Users/Modify.html,
+       webrt/SelfService/Elements/ShowTransaction,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       removed a false unique index from schema. pm.
+       make web interface and insertdata deal properly with the fact that email addresses
+       should be unique.
+       
+       cleaned up ShowTransaction for the webui. (now uses CreatorObj rather than Creator,
+       as it was confusing
+       
+2001-02-20 01:42  jesse
+
+       * lib/RT/: ACE.pm, ACL.pm, Attachment.pm, Attachments.pm,
+       CurrentUser.pm, EasySearch.pm, Group.pm, GroupMember.pm,
+       GroupMembers.pm, Groups.pm, Keyword.pm, KeywordSelect.pm,
+       Keywords.pm, Link.pm, Links.pm, ObjectKeyword.pm,
+       ObjectKeywords.pm, Queue.pm, Queues.pm, Record.pm, Scrip.pm,
+       ScripAction.pm, ScripActions.pm, ScripCondition.pm,
+       ScripConditions.pm, Scrips.pm, Template.pm, Templates.pm,
+       Ticket.pm, Tickets.pm, Transaction.pm, Transactions.pm, User.pm,
+       Users.pm, Utils.pm, Watcher.pm, Watchers.pm, Action/SendEmail.pm:
+
+       A major security audit of the codebase has taken place.  I was primarily out for
+       ACL related issues, but took care of a number of other minor cleanups at the same time.
+       
+2001-02-19 17:16  jesse
+
+       * NEWS:
+
+       fixed a typo in cli_respond_req
+       
+2001-02-15 18:02  jesse
+
+       * webrt/SelfService/: Details.html, Error.html:
+
+       fixing bug #90: SelfService calls to Abort use the 'standard' handler. which includes the wrong header.
+       
+2001-02-15 18:02  jesse
+
+       * webrt/SelfService/Error.html:
+
+       file Error.html was initially added on branch rt-1-1.
+       
+2001-02-15 17:39  jesse
+
+       * webrt/Admin/Elements/SelectSingleOrMultiple:
+
+       file SelectSingleOrMultiple was initially added on branch rt-1-1.
+       
+2001-02-15 17:39  jesse
+
+       * lib/RT/Keyword.pm, lib/RT/KeywordSelect.pm,
+       webrt/Admin/Elements/SelectKeywordSelect,
+       webrt/Admin/Elements/SelectSingleOrMultiple,
+       webrt/Admin/Global/Keywords.html, webrt/Admin/Queues/Keywords.html,
+       webrt/Elements/SelectKeyword, webrt/Elements/SelectKeywordOptions,
+       webrt/Ticket/Elements/ModifyTicket:
+
+       KeywordSelect.pm got an ACL bug fixed.
+       Keyword.pm now does recursive searches in Descendants properly.
+       
+       KeyworSelect editing via the webui is now much smarter. and cleaner. and better. and faster, and resolving bug 123
+       
+2001-02-15 17:39  jesse
+
+       * webrt/Admin/Elements/SelectKeywordSelect:
+
+       file SelectKeywordSelect was initially added on branch rt-1-1.
+       
+2001-02-13 22:54  jesse
+
+       * lib/: Makefile.PL, RT/ACE.pm, RT/Keyword.pm, RT/KeywordSelect.pm,
+       RT/Scrip.pm:
+
+       Better ACL handling for ACEs, Keywords and KeywordSelects.
+       specified more accurate versions of some dependencies in lib/Makefile.PL
+       
+2001-02-13 12:51  jesse
+
+       * bin/rtadmin, etc/schema.pm, lib/RT/Keyword.pm,
+       lib/RT/KeywordSelect.pm, lib/RT/KeywordSelects.pm,
+       lib/RT/Keywords.pm, lib/RT/Queue.pm, lib/RT/Queues.pm,
+       lib/RT/User.pm, lib/RT/Users.pm, webrt/Admin/Global/Keywords.html,
+       webrt/Admin/Keywords/index.html, webrt/Admin/Queues/Keywords.html,
+       webrt/Admin/Queues/Modify.html, webrt/Admin/Users/Modify.html:
+
+       Implemented 'Disabled' for Keywords, KeywordSelects, Queues and Users.
+       This supplants 'Delete' for these objects which need to exist to guarantee
+       referential integrity.
+       
+       Implemented cli and web interfaces to support the new code.
+       
+2001-02-12 18:27  jesse
+
+       * README, bin/rtadmin, etc/schema.pm, lib/RT/Attachment.pm,
+       lib/RT/EasySearch.pm, lib/RT/Link.pm, lib/RT/ObjectKeyword.pm,
+       lib/RT/Queue.pm, lib/RT/Queues.pm, lib/RT/Record.pm,
+       lib/RT/ScripAction.pm, lib/RT/ScripCondition.pm,
+       lib/RT/Template.pm, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Watcher.pm, tools/testdeps:
+
+       Cleaned up LastUpdated / Created/ LastUpdatedBy / Creator to all get set on
+       create for all relevant objects.
+       
+       Based on discussions with ivan, changed the 'Deleted' flag on various objects to 'Disabled'
+       to better represent its purpose.
+       
+       Fully implemented Disable for queue as a prototype.
+       
+       fixed queue attribute editing in cli.
+       
+2001-02-12 13:59  jesse
+
+       * tools/testdeps:
+
+       specified a minimum known good version of Getopt::Long
+       
+2001-02-12 12:38  jesse
+
+       * lib/RT/Queue.pm, webrt/Ticket/Elements/ShowTransaction:
+
+       transaction links work again.
+       admin ccs get listed.
+       
+2001-02-11 22:16  jesse
+
+       * Makefile:
+
+       bumped the version # for a new release
+       
+2001-02-11 22:13  jesse
+
+       * lib/RT/Queue.pm, lib/RT/Template.pm, tools/insertdata:
+
+       cleaning up queue create.
+       
+2001-02-11 22:12  jesse
+
+       * etc/schema.pm:
+
+       started the work on dealing with Deleting records that need to exist to guarantee ref. integrity
+       
+2001-02-11 18:40  jesse
+
+       * NEWS:
+
+       imported brandon's url importing code
+       
+2001-02-06 22:59  jesse
+
+       * lib/RT/Queue.pm, webrt/Admin/Queues/Modify.html,
+       webrt/Admin/Users/index.html:
+
+       Fixes to Queue.pm to stop it from clobbering the Name.
+       
+       fixed a typo in the webui Admin/Users/index.html
+       
+2001-02-06 15:22  jesse
+
+       * lib/RT/Queue.pm, webrt/Admin/Elements/QueueRightsForUser,
+       webrt/Admin/Elements/SelectRights,
+       webrt/Ticket/Elements/ShowMembers:
+
+       ACL fixes in Queue.pm.
+       ACL search fies for the web ui.
+       fixed a recursive subticket display bug.
+       
+2001-02-06 12:49  jesse
+
+       * Makefile:
+
+       removed the old rt 1.0 lib/rt directory forever. yay
+       
+2001-02-06 12:48  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       Added a tiny patch from ivan to not extract nested messages. not totally sure about this one yet.
+       
+2001-02-02 01:26  jesse
+
+       * Makefile:
+
+       version bumpin
+       
+2001-02-02 01:11  jesse
+
+       * bin/rtadmin, lib/RT/Keyword.pm:
+
+       keyword creation, editing and deletion now works via the cli tool.
+       
+       This means that for alpha 4, we're *gasp* feature complete.  now to fix lots of bugs.
+       
+2001-02-01 02:46  jesse
+
+       * bin/rtadmin, lib/RT/Group.pm, lib/RT/Keyword.pm,
+       lib/RT/KeywordSelect.pm, tools/testdeps, webrt/Ticket/Display.html,
+       webrt/Ticket/Elements/ShowHistory,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Commandline editing of keywordselects now works.
+       
+       Added in a patch to collapse history on the ticket listing
+       page from Byron Ellacott
+       
+       Bumped a few dependecy versions. added a File::Spec dependency, since File::Temp
+       gets it not quote right.
+       
+2001-01-31 02:08  jesse
+
+       * bin/rtadmin, lib/RT/Group.pm, webrt/Admin/Groups/Members.html:
+
+       Commandline group editing now works. yay. group membership even.
+       the api changed to be easier to work with and more consistent with other functions
+       
+2001-01-30 23:12  jesse
+
+       * lib/RT/Interface/Email.pm, webrt/Ticket/Elements/ShowLinks,
+       webrt/Ticket/Elements/ShowRequestor:
+
+       The email interface now uses tempdir from File::Temp for increased security.
+       
+       A couple of webui cleanups to display more sensible things.
+       
+2001-01-30 16:42  jesse
+
+       * etc/config.pm, lib/RT/User.pm, lib/RT/Interface/Email.pm:
+
+       Added mail-on-error to the mail gateway. now it should tell you when it fails.
+       
+       turned off debugging output from ACLs....
+       
+2001-01-29 23:58  jesse
+
+       * bin/rtadmin, lib/RT/ACE.pm, lib/RT/ACL.pm, lib/RT/Scrip.pm,
+       lib/RT/ScripAction.pm, lib/RT/ScripCondition.pm, lib/RT/Scrips.pm,
+       lib/RT/Template.pm, lib/RT/Templates.pm, lib/RT/User.pm,
+       lib/RT/Interface/CLI.pm, lib/RT/Interface/Web.pm,
+       webrt/Admin/Elements/SelectTemplate,
+       webrt/Admin/Global/Template.html,
+       webrt/Admin/Global/Templates.html,
+       webrt/Admin/Queues/Template.html:
+
+       A bunch of work on the admin cli (acl editor now works)
+       
+       a couple API changes to standardize method names across classes
+       template editing via the web should work better now.
+       
+2001-01-29 23:56  jesse
+
+       * webrt/Elements/: TitleBoxEnd, TitleBoxStart:
+
+       Futzing with the title box to make it a bit more consistent
+       
+2001-01-29 23:54  jesse
+
+       * lib/RT/Record.pm:
+
+       Removed a redundant sub new
+       
+2001-01-29 22:22  jesse
+
+       * lib/RT/Group.pm:
+
+       Groups can now be loaded by name.
+       
+2001-01-23 15:46  jesse
+
+       * bin/rtadmin, etc/schema.pm, lib/RT/Queue.pm, lib/RT/Template.pm,
+       lib/RT/Ticket.pm, lib/RT/User.pm, lib/RT/Interface/CLI.pm,
+       tools/initdb:
+
+       initdb now punts on database creation for oracle.
+       
+       Ticket->Name removed from code (retargeted to post 2.0 and its own table)
+       Some better error checking in User and Queue.
+       
+       Can now edit templates (And create them) from the CLI.
+       
+2001-01-22 12:51  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       
+       It's amazing how much effect 3 little letters can have. with this patch,
+       scrips that depend on notify (most everything other than autoreply)
+       just work. woo!
+       
+2001-01-22 06:18  jesse
+
+       * lib/RT/Template.pm:
+
+       Fixed a couple ACL bugs in Template::_Set
+       
+2001-01-22 05:04  jesse
+
+       * Makefile:
+
+       Bumped the version # because of the schema change
+       
+2001-01-22 04:51  jesse
+
+       * lib/RT/Interface/CLI.pm:
+
+       file CLI.pm was initially added on branch rt-1-1.
+       
+2001-01-22 04:51  jesse
+
+       * lib/RT/Interface/CLI.pm:
+
+       Added CLI.pm, which rt and adminrt are dependant on
+       
+2001-01-22 04:46  jesse
+
+       * bin/rtadmin, lib/MANIFEST, lib/RT/Template.pm:
+
+       a bit more work on rtadmin (the start of template editing)
+       
+       added Interface/CLI to the manifest.
+       added a comment to Template.pm
+       
+2001-01-22 02:51  jesse
+
+       * Makefile, TODO, bin/mason_handler.scgi, bin/rt, bin/rtadmin,
+       bin/rtmux.pl, bin/webmux.pl, etc/config.pm, etc/schema.Oracle,
+       etc/schema.pm, lib/RT.pm, lib/RT/Attachment.pm,
+       lib/RT/CurrentUser.pm, lib/RT/Group.pm, lib/RT/Link.pm,
+       lib/RT/ObjectKeywords.pm, lib/RT/Queue.pm, lib/RT/Template.pm,
+       lib/RT/Ticket.pm, lib/RT/Tickets.pm, lib/RT/Transaction.pm,
+       lib/RT/User.pm, lib/RT/Users.pm, lib/RT/Watchers.pm,
+       lib/RT/Interface/Email.pm, tools/insertdata,
+       webrt/Admin/Elements/CreateQueueCalled,
+       webrt/Admin/Elements/CreateUserCalled,
+       webrt/Admin/Elements/GrantQueueRightsTo,
+       webrt/Admin/Elements/ModifyKeywordSelect,
+       webrt/Admin/Elements/ModifyQueue,
+       webrt/Admin/Elements/ModifyTemplate,
+       webrt/Admin/Elements/ModifyUser,
+       webrt/Admin/Elements/SelectModifyQueue,
+       webrt/Admin/Elements/SelectModifyUser,
+       webrt/Admin/Elements/SelectTemplate,
+       webrt/Admin/Elements/SelectUsers, webrt/Admin/Global/Scrips.html,
+       webrt/Admin/Global/Template.html,
+       webrt/Admin/Global/Templates.html,
+       webrt/Admin/Global/UserRights.html,
+       webrt/Admin/Groups/Members.html,
+       webrt/Admin/KeywordSelects/index.html, webrt/Admin/Queues/ACL.html,
+       webrt/Admin/Queues/Create.html, webrt/Admin/Queues/Keywords.html,
+       webrt/Admin/Queues/Modify.html, webrt/Admin/Queues/People.html,
+       webrt/Admin/Queues/Scrips.html, webrt/Admin/Queues/Template.html,
+       webrt/Admin/Queues/Templates.html, webrt/Admin/Queues/index.html,
+       webrt/Admin/Users/Modify.html, webrt/Admin/Users/Prefs.html,
+       webrt/Admin/Users/index.html, webrt/Elements/Header,
+       webrt/Elements/MyRequests, webrt/Elements/MyTickets,
+       webrt/Elements/Quicksearch, webrt/Elements/SelectNewTicketQueue,
+       webrt/Elements/SelectOwner, webrt/Elements/SelectQueue,
+       webrt/Elements/SelectUsers, webrt/SelfService/Details.html,
+       webrt/SelfService/Elements/Header,
+       webrt/SelfService/Elements/MyRequests,
+       webrt/SelfService/Elements/ShowTransaction,
+       webrt/Ticket/Create.html, webrt/Ticket/ModifyLinks.html,
+       webrt/Ticket/autohandler, webrt/Ticket/Elements/AddWatchers,
+       webrt/Ticket/Elements/ShowBasics, webrt/Ticket/Elements/ShowDates,
+       webrt/Ticket/Elements/ShowDependencies,
+       webrt/Ticket/Elements/ShowLinks, webrt/Ticket/Elements/ShowPeople,
+       webrt/Ticket/Elements/ShowReferences,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       In prep for a true schema freeze, I fixed a number of attribute names that were troublesome for
+       one reason or another.
+       
+               Queue->QueueId and User->UserId have been changed to Queue->Name and User->Name, so
+               as not to conflict with queue->id and user->id any more.  A number of tables
+               used "Alias" and "Title" and things like that, rather than the somewhat
+               more standard "Name" and "Description"
+       
+       Abstracted a bunch of the CLI setup stuff out into lib/RT/Interface/CLI
+       
+       Abstracted some of the core DB startup code into RT.pm
+       
+       fixed the makefile to handle the new rtadmin.
+       
+       lots of updates to the new rtadmin (which works for user editing!)
+       
+       fixed a bug in ObjectKeywords->LoadByName....
+       
+2001-01-19 04:23  jesse
+
+       * bin/rtadmin:
+
+       A bit of cleanup and a bit more docs.  it's now actually implementable with getopt::long
+       
+2001-01-19 04:16  jesse
+
+       * bin/rtadmin:
+
+       file rtadmin was initially added on branch rt-1-1.
+       
+2001-01-19 04:16  jesse
+
+       * bin/rtadmin:
+
+       Docced the proposed cli for the new rtadmin tool. It's rather more intense than I'd intended
+       
+2001-01-19 02:15  jesse
+
+       * lib/RT/User.pm:
+
+       Fixed ACL bug that prevented by-group auth from working
+       
+2001-01-19 00:52  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/User.pm, webrt/SelfService/Details.html:
+
+       Work on SelfService (fixing the a permission denied bug)
+       
+2001-01-19 00:21  jesse
+
+       * webrt/NoAuth/webrt.css:
+
+       file webrt.css was initially added on branch rt-1-1.
+       
+2001-01-19 00:21  jesse
+
+       * webrt/: webrt.css, Elements/Header, NoAuth/webrt.css,
+       SelfService/Details.html, SelfService/Elements/Header:
+
+       webui cleanups
+       
+2001-01-19 00:07  jesse
+
+       * bin/rt:
+
+       bug-fixing in bin/rt
+       
+2001-01-18 23:47  jesse
+
+       * lib/RT/Link.pm, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       webrt/Ticket/ModifyLinks.html, webrt/Ticket/Elements/ShowLinks,
+       webrt/Ticket/Elements/ShowMembers,
+       webrt/Ticket/Elements/ShowReferences,
+       webrt/Ticket/Elements/ShowSummary:
+
+       A bunch of work on links.
+       API cleanups.
+       Ticket-> Members and MemberOf  now return Links objects rather than Tickets Objects
+       Edit links via the webui works now
+       
+2001-01-18 15:11  jesse
+
+       * HACKING, docs/API:
+
+       Added a bit more documentation and philosophy
+       to the API file. yanked tobix' old out of date "HACKING"
+       doc
+       
+2001-01-18 03:18  jesse
+
+       * Makefile, NEWS:
+
+       Headers in incoming mail are now parsed case insensitively.
+       
+       Version is now 1.0.7
+       
+2001-01-17 16:41  jesse
+
+       * Makefile, tools/testdeps:
+
+       updated searchbuilder dependency in testdeps
+       
+       revved version in Makefile for release.
+       
+2001-01-17 14:27  jesse
+
+       * Makefile, bin/rt, lib/RT/Date.pm:
+
+       Fixed #45 Permissions bug on redhat 6.0
+       Fixed #51 RT CLI doesn't check for valid user
+       
+       Implemented a bunch more searching in bin/rt
+       
+       Refactored RT::Date a bit.
+       
+       Fixed some unreported permissions eits.
+       
+2001-01-16 11:43  jesse
+
+       * webrt/Ticket/Elements/: ShowLinks, ShowMemberOf, ShowMembers,
+       ShowPeople, ShowSummary:
+
+       Cleaned up and shortened the Ticket Display screen
+       
+2001-01-16 10:56  jesse
+
+       * lib/RT/Ticket.pm, webrt/Ticket/Modify.html:
+
+       Cleaned up and better documented Ticket->SetStatus
+       Ticket/Modify.html got rid of a whole bunch of evals.
+       
+2001-01-15 23:57  jesse
+
+       * Makefile, lib/MANIFEST, lib/RT/Tickets.pm:
+
+       Removed a deleted file from the manifest. revved the version
+       
+2001-01-15 15:19  jesse
+
+       * lib/RT/: KeywordSelect.pm, Queue.pm:
+
+       Adding the ability to load keyword selects by name.
+       
+2001-01-15 03:49  jesse
+
+       * lib/RT/Ticket.pm, webrt/Ticket/Elements/EditKeywordSelects:
+
+       keyword display now cleaner. doesn't force you to select a keyword if none
+       is selected yet.
+       
+2001-01-15 03:36  jesse
+
+       * lib/RT/Ticket.pm:
+
+       SetQueue is no-longer heinously broken. thanks eoin
+       
+2001-01-15 03:10  jesse
+
+       * lib/RT/: Queue.pm, User.pm, Action/Notify.pm, Action/Spam.pm:
+
+       removed an old RT::Action that didn't actually do anything useful these days.  it'll get replaced later.
+       
+       Scrips which sign watchers up for things _actually seem to work_
+       (required some frobbing of watchers)
+       
+2001-01-15 02:44  jesse
+
+       * bin/rt, etc/schema.pm, lib/RT/ObjectKeywords.pm, lib/RT/Queue.pm,
+       lib/RT/Template.pm, lib/RT/Ticket.pm, lib/RT/Tickets.pm,
+       lib/RT/Watchers.pm, webrt/Elements/ViewUser,
+       webrt/Ticket/Elements/ShowRequestor:
+
+       Added a 'Type' column to templates, to more easily allow for insertable templates for quick responses from customer service folks ,etc.
+       Reworked a bunch of the watchers code to not do its own potentially very bogus caching and to reuse more core code.
+       Oh. and it always returns the expected object type now.
+       
+       Redid tobias' old "ViewUser" box to use a set of tickets, rather than a bogus search for watchers (ignoring tickets).
+       
+       Fixed a bug in searching for tickets by watcher.
+       
+2001-01-15 00:53  jesse
+
+       * bin/rt, webrt/Elements/SelectOwner, webrt/Elements/TitleBoxStart,
+       webrt/NoAuth/Login.html, webrt/Ticket/Elements/ShowSummary:
+
+       Added a bunch of doc to bin/rt. probably should have check to see if it runs ;)
+       TitleBoxStart got the attributes:  class, title_href and titleright_href. makes calls to it cleaner.
+       showsummary got a few more links to the places things should go.
+       selectOwner now will actually default to nobody if that's the right value.
+       
+2001-01-13 03:22  jesse
+
+       * TODO:
+
+       Changed the TODO file to point to the current TODO list
+       
+2001-01-13 03:18  jesse
+
+       * Makefile:
+
+       Bumped version # for release
+       
+2001-01-13 03:11  jesse
+
+       * bin/rtmux.pl, lib/RT/Queue.pm, lib/RT/Action/SendEmail.pm:
+
+       Fixing a couple minor things in rtmux and Queue.pm so that the mail interfaces work ok.
+       
+2001-01-13 02:34  jesse
+
+       * lib/RT/User.pm:
+
+       Added the ability to generate a random password to RT::User.  we don't yet
+       have a nice way to email this information to the user. which is a real bummer.
+       
+2001-01-12 17:35  jesse
+
+       * etc/config.pm, lib/RT/Ticket.pm, lib/RT/User.pm,
+       lib/RT/Interface/Web.pm, webrt/Admin/Users/Modify.html,
+       webrt/SelfService/Create.html, webrt/SelfService/Details.html,
+       webrt/SelfService/Elements/Header, webrt/SelfService/Elements/Tabs:
+
+       Made ACLs for 'Everyone' work. fixed a few other small ACL bugs.
+       Made the 'Requestor-mode' ticket create tool work.
+       
+2001-01-12 12:27  jesse
+
+       * webrt/Elements/: SelectDate, SelectOwner:
+
+       Commented out unimplemented select relative date bits.
+       SelectOwner now lets you pick nobody.
+       
+2001-01-12 03:16  jesse
+
+       * bin/rt, bin/rtmux.pl, lib/RT/Ticket.pm, tools/testdeps:
+
+       Comments and Correspondence work from the cli now. with and without --source (for source data) and --no-edit (to disable invocation of $EDITOR)
+       
+       rt and rtmux.pl now drop setgidness as soon as they can. it's happier this
+       way. really :)
+       
+       testdeps now installs File::Temp, which is needed to do safe tempfile usage.
+       
+2001-01-12 00:11  jesse
+
+       * webrt/Elements/: MyRequests, MyTickets:
+
+       Bug fix for #47 (Id flows into subject on 'home' screen)
+       
+2001-01-11 03:34  jesse
+
+       * webrt/Elements/Header:
+
+       Removed extra spaces from the header
+       
+2001-01-11 02:57  jesse
+
+       * webrt/Elements/SelectOwner:
+
+       Made SelectOwner actually show all the right people
+       
+2001-01-11 02:53  jesse
+
+       * tools/testdeps:
+
+       Added a requirement for the current DBIx::SearchBuilder to testdeps
+       
+2001-01-11 02:28  jesse
+
+       * Makefile:
+
+       revved the version for distribution
+       
+2001-01-11 02:28  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Interface/Web.pm,
+       webrt/Elements/Quicksearch, webrt/Elements/TitleBoxStart,
+       webrt/Ticket/Display.html, webrt/Ticket/Elements/EditBasics:
+
+       fixed a couple of UI bugs. the 'quick' links in the web ticket view should now all work.
+       Logger->warn  -> Logger->warning in the web ui
+       
+2001-01-10 17:42  jesse
+
+       * Makefile:
+
+       Bumped to 1.3.33
+       
+2001-01-10 01:46  jesse
+
+       * webrt/Ticket/Attachment/dhandler:
+
+       Date: Wed, 10 Jan 2001 16:22:43 +1000 (EST)                                     From: Byron Ellacott <bje@apnic.net>                                            To: rt-devel@fsck.com                                                           Subject: Re: [rt-devel] [rt-announce] RT 1.3.30 released                        List-Id: RT Development <rt-devel.lists.fsck.com>                                                                                                               [-- Attachment #1 --]                                                           [-- Type: text/PLAIN, Encoding: 7bit, Size: 0.7K --]                                                                                                            On Wed, 3 Jan 2001, Jesse wrote:                                                                                                                                [snip]                                                                                                                                                          I noticed 1-3-31 sitting around, so I installed that.  I'm giving a             demonstration tomorrow, so I've been running through the web UI.  I             noticed a problem with attachments - HTML::Mason was munging everything to      be HTML-nice, but a jpg doesn't display if its < characters are changed to      &lt;, and it's not good to have </BODY></HTML> on the end of binary             attachments.
+       
+2001-01-10 00:24  jesse
+
+       * Makefile:
+
+       Revved the version to 1.3.32
+       
+2001-01-09 23:57  jesse
+
+       * webrt/Admin/Users/Rights.html:
+
+       file Rights.html was initially added on branch rt-1-1.
+       
+2001-01-09 23:57  jesse
+
+       * lib/RT/Record.pm, lib/RT/User.pm, lib/RT/Interface/Email.pm,
+       tools/insertdata, webrt/Admin/Elements/UserTabs,
+       webrt/Admin/Users/Modify.html, webrt/Admin/Users/Rights.html,
+       webrt/Elements/Quicksearch, webrt/Elements/TitleBoxEnd,
+       webrt/Elements/TitleBoxStart:
+
+       Did some work on User creation to check for duplicate userids on create.
+       Better user create error checking.
+       Switched the TitleBox UI to a compromise between new and old.
+       
+       Did a bit of ui work on web based user modification
+       
+2001-01-09 02:15  jesse
+
+       * Makefile, lib/RT/User.pm, tools/insertdata,
+       webrt/Admin/Users/Modify.html:
+
+       shuffling around hte user password stuff. hopefully the user modification issues seen in 1.3.30 will be fixed.
+       
+2001-01-09 00:48  jesse
+
+       * webrt/Ticket/History.html:
+
+       file History.html was initially added on branch rt-1-1.
+       
+2001-01-09 00:48  jesse
+
+       * docs/keywords:
+
+       file keywords was initially added on branch rt-1-1.
+       
+2001-01-09 00:48  jesse
+
+       * bin/mason_handler.scgi:
+
+       file mason_handler.scgi was initially added on branch rt-1-1.
+       
+2001-01-09 00:48  jesse
+
+       * Makefile, bin/mason_handler.scgi, bin/webmux.pl, docs/keywords,
+       lib/RT/Tickets.pm, lib/RT/Interface/Web.pm,
+       webrt/Admin/Elements/GrantQueueRightsTo~,
+       webrt/Ticket/History.html:
+
+       Started to write out notes on a testsuite.
+       Started work on a CGI/SpeedyCGI frontend
+       added a file that was missing in 1.3.30
+       
+2001-01-08 14:04  jesse
+
+       * NEWS, README:
+
+       Added a web based due-date patch.
+       
+2001-01-06 15:17  jesse
+
+       * etc/schema.pm:
+
+       Added 'Deleted' attributes for tables whose entries can not be safely
+       removed from the database for ref. integrity problems.
+       
+2001-01-03 23:07  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.30
+       
+2001-01-03 23:02  jesse
+
+       * tools/testdeps:
+
+       file testdeps was initially added on branch rt-1-1.
+       
+2001-01-03 23:02  jesse
+
+       * README, bin/testdeps.pl, lib/Makefile.PL, tools/testdeps,
+       webrt/Elements/TitleBoxStart:
+
+       a bit of quick UI work.
+       an update to depend on DBIx::SearchBuilder 0.15 (just releaseD)
+       testdeps moved to tools
+       
+2001-01-03 03:21  jesse
+
+       * bin/rt, lib/RT/Tickets.pm:
+
+       ticket searches for integers are a bit more flexible now (and the code's tighter)
+       
+       the rtq section of the new bin/rt appears functional, if underdocced.
+       
+2001-01-02 22:55  jesse
+
+       * lib/RT/Tickets.pm, lib/RT/Interface/Web.pm,
+       webrt/Search/PickRestriction:
+
+       Imported ivan's keyword search patch, along with a modification to allow
+       for _not_ selecting keywords.
+       
+2001-01-02 21:45  jesse
+
+       * Makefile, bin/testdeps.pl, lib/RT/KeywordSelect.pm,
+       lib/RT/ObjectKeyword.pm, lib/RT/ObjectKeywords.pm,
+       lib/RT/Ticket.pm, lib/RT/Tickets.pm, lib/RT/Watchers.pm,
+       lib/RT/Interface/Web.pm, tools/insertdata, webrt/webrt.css,
+       webrt/Elements/Header, webrt/Elements/TitleBoxStart,
+       webrt/Elements/ViewUser, webrt/Search/Listing.html,
+       webrt/Search/PickRestriction, webrt/Ticket/Create.html,
+       webrt/Ticket/Display.html, webrt/Ticket/Elements/ShowBasics,
+       webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction, webrt/Ticket/Elements/Tabs:
+
+       Fixed a warning in testdeps (Well, worked around it, anyway)
+       Added some helper functions for keywords and keyword selects.
+       
+       did a bunch of UI cleanup. started to color-code the webui
+       
+       started work on a generic queue listing format in Tickets.pm
+       
+2001-01-02 15:02  jesse
+
+       * webrt/SelfService/Elements/ShowTransaction:
+
+       file ShowTransaction was initially added on branch rt-1-1.
+       
+2001-01-02 15:02  jesse
+
+       * webrt/SelfService/: Create.html, Details.html,
+       Elements/GotoTicket, Elements/Header, Elements/ShowTransaction,
+       Elements/Tabs:
+
+       Fleshed out more of the requestor UI.
+       It's good enough for the alpha. yay!
+       
+2001-01-02 15:02  jesse
+
+       * webrt/SelfService/Elements/GotoTicket:
+
+       file GotoTicket was initially added on branch rt-1-1.
+       
+2001-01-01 19:06  jesse
+
+       * webrt/Ticket/: Modify.html, ModifyDates.html, ModifyPeople.html,
+       Elements/EditBasics, Elements/EditKeywordSelects,
+       Elements/ShowDates, Elements/ShowSummary:
+
+       Even yet still more Technicolor!
+       
+2001-01-01 18:42  jesse
+
+       * webrt/NoAuth/images/spacer.gif:
+
+       file spacer.gif was initially added on branch rt-1-1.
+       
+2001-01-01 18:42  jesse
+
+       * webrt/NoAuth/Reminder.html:
+
+       file Reminder.html was initially added on branch rt-1-1.
+       
+2001-01-01 18:42  jesse
+
+       * webrt/Elements/Section:
+
+       file Section was initially added on branch rt-1-1.
+       
+2001-01-01 18:42  jesse
+
+       * lib/RT/CurrentUser.pm, lib/RT/KeywordSelect.pm, webrt/webrt.css,
+       webrt/Admin/Keywords/index.html, webrt/Admin/Queues/People.html,
+       webrt/Elements/Header, webrt/Elements/ListActions,
+       webrt/Elements/MyRequests, webrt/Elements/MyTickets,
+       webrt/Elements/Section, webrt/Elements/Submit,
+       webrt/Elements/TitleBoxEnd, webrt/Elements/TitleBoxStart,
+       webrt/NoAuth/Login.html, webrt/NoAuth/Reminder.html,
+       webrt/NoAuth/images/spacer.gif, webrt/Ticket/Display.html,
+       webrt/Ticket/ModifyPeople.html, webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       A bunch of UI work.
+       Ticket Display is significantly different. and _much_ faster loading.
+       A color style guide for the web ui is forthcoming.
+       
+       removed a Die from CurrentUser.
+       
+2000-12-30 03:27  jesse
+
+       * webrt/Elements/Tabs:
+
+       fixed a ui nit from ivan
+       
+2000-12-30 03:03  jesse
+
+       * webrt/Ticket/Elements/ShowSummary:
+
+       fixed a hyperlink.
+       
+2000-12-30 00:07  jesse
+
+       * Makefile:
+
+       bumped version for release
+       
+2000-12-30 00:03  jesse
+
+       * etc/config.pm, lib/RT/User.pm,
+       webrt/Admin/Elements/ModifyKeywordSelect,
+       webrt/Admin/Global/Keywords.html,
+       webrt/Admin/KeywordSelects/index.html,
+       webrt/Admin/Keywords/Modify.html, webrt/Admin/Keywords/index.html,
+       webrt/Admin/Queues/Keywords.html, webrt/Admin/Users/index.html:
+
+       Fixed a bug in keyword creation that caused urls and param values to get buggered.
+       
+       Passwords are now encrypted in the database
+       
+2000-12-29 05:54  jesse
+
+       * bin/rt, lib/RT/Link.pm, lib/RT/Ticket.pm,
+       lib/RT/Interface/Web.pm, webrt/Ticket/Display.html,
+       webrt/Ticket/Elements/ShowDependencies,
+       webrt/Ticket/Elements/ShowLinks:
+
+       Did a bunch of work on the linking interface. It's now got
+       a much easier API. and it's twice as functional (you can delete links)
+       
+       Did the proof-of concept for the link code in the CLI. it'll need
+       fleshing out tomorrow.
+       
+       Fleshed out other parts of the CLI.
+       
+       stayed up way too late.
+       
+2000-12-29 00:30  jesse
+
+       * Makefile, bin/rt, lib/RT/Keyword.pm, lib/RT/Ticket.pm:
+
+       Added keyword support to the CLI.
+       fixed a couple of Keyword core bugs
+       
+2000-12-28 03:56  jesse
+
+       * bin/rt, bin/testdeps.pl, lib/RT/Keyword.pm,
+       lib/RT/KeywordSelect.pm, lib/RT/User.pm:
+
+       Removed unused keyword related code. added in a bit of
+       new keyword related code to get "relative" paths of keywords.
+       
+       fixed a longstanding warning in ACL checking.
+       
+       first 1/2 of keywords support for the new rt cli.
+       
+       added Tie::IxHash to testdeps.pl (keywords needs it)
+       
+2000-12-27 02:19  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       missed a comma
+       
+2000-12-27 01:21  jesse
+
+       * webrt/Admin/Global/Keywords.html:
+
+       file Keywords.html was initially added on branch rt-1-1.
+       
+2000-12-27 01:21  jesse
+
+       * etc/schema.pm, lib/RT/ACE.pm, lib/RT/KeywordSelect.pm,
+       lib/RT/KeywordSelects.pm, lib/RT/Queue.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, webrt/Admin/Elements/SystemTabs,
+       webrt/Admin/Global/Keywords.html, webrt/Admin/Queues/Keywords.html,
+       webrt/Ticket/Create.html, webrt/Ticket/ModifyPeople.html,
+       webrt/Ticket/Elements/EditKeywordSelects,
+       webrt/Ticket/Elements/ShowKeywordSelects,
+       webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Added the ability to name keyword selects.
+       first round of ACLing for keywords.
+       
+       Added the ability to create KeywordSelects which apply to all queues (Rather than just
+       a single queue)
+       
+       misc bigfixes.
+       
+2000-12-26 02:56  jesse
+
+       * webrt/Elements/SelectKeywordOptions:
+
+       file SelectKeywordOptions was initially added on branch rt-1-1.
+       
+2000-12-26 02:56  jesse
+
+       * webrt/Admin/Keywords/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-12-26 02:56  jesse
+
+       * webrt/Admin/Queues/Keywords.html:
+
+       file Keywords.html was initially added on branch rt-1-1.
+       
+2000-12-26 02:56  jesse
+
+       * webrt/Elements/SelectKeyword:
+
+       file SelectKeyword was initially added on branch rt-1-1.
+       
+2000-12-26 02:56  jesse
+
+       * bin/webmux.pl, etc/schema.pm, lib/RT/Keyword.pm,
+       lib/RT/KeywordSelect.pm, lib/RT/KeywordSelects.pm,
+       lib/RT/Keywords.pm, lib/RT/ObjectKeyword.pm,
+       lib/RT/ObjectKeywords.pm, lib/RT/Queue.pm, lib/RT/Ticket.pm,
+       lib/RT/Watchers.pm, webrt/Admin/Elements/ModifyKeyword,
+       webrt/Admin/Elements/ModifyKeywordSelect,
+       webrt/Admin/Elements/QueueTabs, webrt/Admin/Elements/Tabs,
+       webrt/Admin/KeywordSelects/index.html,
+       webrt/Admin/Keywords/Modify.html, webrt/Admin/Keywords/index.html,
+       webrt/Admin/Queues/Keywords.html, webrt/Elements/SelectKeyword,
+       webrt/Elements/SelectKeywordOptions, webrt/Ticket/Modify.html,
+       webrt/Ticket/Elements/EditKeywordSelects,
+       webrt/Ticket/Elements/ShowKeywordSelects:
+
+       My first pass at making the keywords stuff work more like the rest of the RT core.
+       A couple of minor fixes on non-keywords things, but mostly this was an
+       edit of the keywords code to:
+               1. make the admin UI work more like the rest of the admin ui
+               (still need to do "global" keyword selections)
+       
+               2. bring the coding style of the keywords stuff more into line
+               with the rest of the codebase
+       
+               3. flesh out the helper methods in the keywords modules.
+       
+2000-12-24 02:04  jesse
+
+       * lib/RT/: Keyword.pm, KeywordSelect.pm, ObjectKeyword.pm:
+
+       A first round of commentary and cleanup on a few modules
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Ticket/Elements/ShowKeywordSelects:
+
+       file ShowKeywordSelects was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Ticket/Elements/EditKeywordSelects:
+
+       file EditKeywordSelects was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Admin/: KeywordSelects/Modify.html, Keywords/Modify.html:
+
+       file Modify.html was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Admin/KeywordSelects/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Admin/Elements/ModifyKeyword:
+
+       file ModifyKeyword was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Admin/Elements/ModifyKeywordSelect:
+
+       file ModifyKeywordSelect was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Admin/Elements/SelectModifyKeyword:
+
+       file SelectModifyKeyword was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * webrt/Admin/Elements/SelectModifyKeywordSelect:
+
+       file SelectModifyKeywordSelect was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/RT/ObjectKeyword.pm:
+
+       file ObjectKeyword.pm was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/RT/Keyword.pm:
+
+       file Keyword.pm was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/RT/KeywordSelect.pm:
+
+       file KeywordSelect.pm was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/test.pl:
+
+       file test.pl was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/RT/ObjectKeywords.pm:
+
+       file ObjectKeywords.pm was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/RT/KeywordSelects.pm:
+
+       file KeywordSelects.pm was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/RT/Keywords.pm:
+
+       file Keywords.pm was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * Makefile, etc/acl.Pg, etc/schema.pm, lib/MANIFEST,
+       lib/MANIFEST.SKIP, lib/Makefile.PL, lib/RT.pm, lib/test.pl,
+       lib/RT/Keyword.pm, lib/RT/KeywordSelect.pm,
+       lib/RT/KeywordSelects.pm, lib/RT/Keywords.pm,
+       lib/RT/ObjectKeyword.pm, lib/RT/ObjectKeywords.pm,
+       lib/RT/Ticket.pm, webrt/Admin/Elements/ModifyKeyword,
+       webrt/Admin/Elements/ModifyKeywordSelect,
+       webrt/Admin/Elements/SelectModifyKeyword,
+       webrt/Admin/Elements/SelectModifyKeywordSelect,
+       webrt/Admin/Elements/Tabs, webrt/Admin/KeywordSelects/Modify.html,
+       webrt/Admin/KeywordSelects/index.html,
+       webrt/Admin/Keywords/Modify.html, webrt/Ticket/Modify.html,
+       webrt/Ticket/Elements/EditBasics,
+       webrt/Ticket/Elements/EditKeywordSelects,
+       webrt/Ticket/Elements/ShowKeywordSelects,
+       webrt/Ticket/Elements/ShowSummary:
+
+       Importing two largish patches from ivan@420.am:
+               First up, ivan switched lib/RT over to using MakeMaker..so now
+               we get man pages for the core modules and a bunch of other cool stuff.
+       
+               Second: ivan handed us an almost complete keywords system.  Over the next
+               week or two, I'm going to be adding ACL support to the keywords system
+               and starting to integrate bits of it better into the rest of the core
+               (though it's nearly all done already).
+       
+                       Thanks, ivan!
+       
+2000-12-24 01:34  jesse
+
+       * lib/MANIFEST:
+
+       file MANIFEST was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/Makefile.PL:
+
+       file Makefile.PL was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/RT.pm:
+
+       file RT.pm was initially added on branch rt-1-1.
+       
+2000-12-24 01:34  jesse
+
+       * lib/MANIFEST.SKIP:
+
+       file MANIFEST.SKIP was initially added on branch rt-1-1.
+       
+2000-12-23 23:45  jesse
+
+       * Makefile, webrt/Ticket/Elements/Tabs:
+
+       made the links in the ticket tool bar point to the right places.
+       
+2000-12-23 23:15  jesse
+
+       * lib/RT/Ticket.pm:
+
+       fixing a typo and the docs.
+       
+2000-12-23 23:12  jesse
+
+       * lib/RT/Ticket.pm:
+
+       the internal function _SetTold shouldn't be hitting an ACL check.
+       
+2000-12-23 17:37  jesse
+
+       * lib/RT/Ticket.pm, webrt/Ticket/Display.html,
+       webrt/Ticket/Modify.html, webrt/Ticket/ModifyDates.html,
+       webrt/Ticket/ModifyLinks.html, webrt/Ticket/ModifyPeople.html,
+       webrt/Ticket/Update.html, webrt/Ticket/Elements/Tabs,
+       webrt/Ticket/Elements/TicketToolBox:
+
+       Cleaned up a bit of date diff related functionality.
+       
+       Did work on the ticket tool bar.
+       
+2000-12-23 16:46  jesse
+
+       * lib/RT/Record.pm:
+
+       Lets try that again..
+       
+2000-12-23 16:39  jesse
+
+       * lib/RT/Record.pm:
+
+       LongSinceUpdatedAsString is now actually relative :)
+       
+2000-12-23 16:09  jesse
+
+       * lib/RT/Tickets.pm:
+
+       added a default to LimitStatus.
+       
+2000-12-23 01:47  jesse
+
+       * bin/: rt, testdeps.pl:
+
+       updated testdeps to require the latest mason (for ease of debugging)
+       the new combined bin/rt actually implements the behavior of rtq and rt -show
+       fully (I believe). next up, more ticket modification and a code cleanup
+       
+2000-12-22 18:37  jesse
+
+       * Makefile:
+
+       bumped to 1.3.28 for release
+       
+2000-12-19 22:38  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Tickets.pm, lib/RT/Transaction.pm,
+       lib/RT/Interface/Web.pm, webrt/Elements/Tabs,
+       webrt/Ticket/ModifyPeople.html, webrt/Ticket/Elements/EditPeople,
+       webrt/User/Prefs.html:
+
+       Removed outdated CC request to and BCC request to
+       did some UI touchups.
+       
+       started a bit of work in tickets.pm for the new CLI (more explicit searching)
+       
+2000-12-19 21:50  jesse
+
+       * bin/rt:
+
+       Modifying ticket requestors from the commandline works. yay.
+       Simplified the commandline arguments a bit too.
+       
+2000-12-19 18:37  jesse
+
+       * bin/: mason_handler.fcgi, webmux.pl:
+
+       updaes to webmux.pl to work on with new versions of HTML::Mason
+       
+2000-12-19 14:05  jesse
+
+       * webrt/Ticket/Display.html:
+
+       Fixed a bug in Ticket/Display.html that caused navigation not to work within new tickets.
+       
+2000-12-19 04:03  jesse
+
+       * bin/rt:
+
+       implemented --history (show ticket history)
+       and --limit-status (limit to a ticket status)
+       just to make sure that this works at all.  it does.
+       
+       With the new ui, you'll be able to trivially perform actions on large #s of tickets.
+       
+2000-12-19 03:38  jesse
+
+       * bin/rt:
+
+       After playing with a few Getopt variants, I've settled on Getopt::Long for now...
+       and implemented the skeleton of the new RT cli.  I suspect that with another day's work,
+       it should be mostly functional. yay.
+       
+2000-12-19 03:38  jesse
+
+       * bin/rt:
+
+       file rt was initially added on branch rt-1-1.
+       
+2000-12-18 19:34  jesse
+
+       * docs/design_docs/cli_spec:
+
+       file cli_spec was initially added on branch rt-1-1.
+       
+2000-12-18 19:34  jesse
+
+       * docs/design_docs/cli_spec:
+
+       Added the CLI spec from deborah.
+       
+2000-12-18 02:11  jesse
+
+       * webrt/Elements/: CreateTicket, GotoTicket:
+
+       Fixed a basepath error.
+       
+2000-12-18 01:19  jesse
+
+       * webrt/Elements/CreateTicket:
+
+       file CreateTicket was initially added on branch rt-1-1.
+       
+2000-12-18 01:19  jesse
+
+       * webrt/Elements/GotoTicket:
+
+       file GotoTicket was initially added on branch rt-1-1.
+       
+2000-12-18 01:19  jesse
+
+       * README, webrt/Admin/Queues/Modify.html,
+       webrt/Admin/Users/Modify.html, webrt/Elements/CreateTicket,
+       webrt/Elements/GotoTicket, webrt/Search/Listing.html:
+
+       A few more changes from Lee Ann and a couple of files I missed on the earlier  checkins.
+       
+2000-12-18 01:14  jesse
+
+       * webrt/Admin/Groups/Rights.html:
+
+       file Rights.html was initially added on branch rt-1-1.
+       
+2000-12-18 01:14  jesse
+
+       * webrt/Admin/Groups/: Members.html, Rights.html:
+
+       a couple UI tweaks from Lee Ann Goldstein
+       
+2000-12-18 00:51  jesse
+
+       * webrt/: Admin/Elements/SystemTabs, Admin/Groups/index.html,
+       Admin/Users/index.html, Elements/Submit, Elements/Tabs:
+
+       More UI hacking. whee
+       
+2000-12-17 23:55  jesse
+
+       * webrt/: Elements/SelectNewTicketQueue, Elements/SelectOwner,
+       Elements/Tabs, Ticket/Create.html, Ticket/Elements/Tabs:
+
+       ui hacking to add the "Create Ticket" and "Goto Ticket" ui elements at the top.
+       
+2000-12-17 22:17  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       webrt/Elements/MessageBox, webrt/Ticket/Modify.html,
+       webrt/Ticket/ModifyPeople.html:
+
+       Fixing bugs 7,8,28
+       
+2000-12-17 02:38  jesse
+
+       * webrt/Ticket/Elements/ShowDates:
+
+       *sigh* typo in ShowDates.
+       
+2000-12-17 02:34  jesse
+
+       * lib/RT/Date.pm, webrt/Ticket/Elements/EditDates,
+       webrt/Ticket/Elements/ShowDates:
+
+       A bit of work on Dates. a postgres fix from ivan and some display prettification.
+       
+2000-12-17 02:15  jesse
+
+       * Makefile, webrt/Ticket/Elements/TicketToolBox:
+
+       commeted out some toolbar actions which don't work yet.
+       
+       bumped the version to 1.3.27 for imminent release.
+       
+2000-12-17 01:51  jesse
+
+       * lib/RT/Attachment.pm:
+
+       The ACL problem on attachments was a bootstrapping issue. couldn't check acls because it
+       couldn't necessarily see what to check
+       
+2000-12-17 01:44  jesse
+
+       * lib/RT/Attachment.pm:
+
+       acl fix for attachments.
+       
+2000-12-17 01:15  jesse
+
+       * lib/RT/Ticket.pm:
+
+       fixing ugly disgusting ACL bugs
+       
+2000-12-17 00:35  jesse
+
+       * lib/RT/Transaction.pm, lib/RT/User.pm,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Fixing bugs in Transaction ACLs.
+       
+2000-12-16 03:56  jesse
+
+       * webrt/Admin/Groups/Members.html:
+
+       ui nit in admin/groups/members.
+       
+2000-12-16 03:31  jesse
+
+       * lib/RT/: Group.pm, GroupMember.pm:
+
+       $object->$SUPER::Foo is wrong. $object->SUPER::Foo is not.
+       
+2000-12-16 03:28  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Rights checks for ticket ownership work best when the right that's set is the same
+       as the right that's checked for *sigh*
+       
+2000-12-16 03:26  jesse
+
+       * webrt/Admin/Groups/Members.html:
+
+       Fixed a couple bugs in Group mebership administration code.
+       
+2000-12-16 03:04  jesse
+
+       * webrt/: Admin/Elements/GroupTabs, Admin/Elements/QueueTabs,
+       Admin/Elements/SystemTabs, Admin/Elements/Tabs,
+       Admin/Elements/UserTabs, Admin/Global/index.html,
+       Admin/Groups/Modify.html, Admin/Groups/index.html,
+       Admin/Queues/People.html, Admin/Queues/index.html,
+       Admin/Users/Modify.html, Admin/Users/index.html,
+       Elements/SelectWatcherType, Elements/Tabs, Ticket/Create.html,
+       Ticket/Display.html, Ticket/Elements/Tabs:
+
+       Bugfix in user admin (no longer automatically revokes "privileged status)
+       a bunch of tab-related UI cleanup. the start of tabs that reflect the current page.
+       
+       added the ability to configure queue watchers from the web ui
+       
+2000-12-16 03:04  jesse
+
+       * webrt/Admin/Queues/People.html:
+
+       file People.html was initially added on branch rt-1-1.
+       
+2000-12-16 00:58  jesse
+
+       * webrt/Admin/Users/index.html:
+
+       typo fixing.
+       
+2000-12-15 19:12  jesse
+
+       * webrt/Admin/Global/GroupRights.html:
+
+       file GroupRights.html was initially added on branch rt-1-1.
+       
+2000-12-15 19:12  jesse
+
+       * webrt/Admin/Global/UserRights.html:
+
+       file UserRights.html was initially added on branch rt-1-1.
+       
+2000-12-15 19:12  jesse
+
+       * webrt/Admin/Elements/GroupTabs:
+
+       file GroupTabs was initially added on branch rt-1-1.
+       
+2000-12-15 19:12  jesse
+
+       * lib/RT/ACE.pm, lib/RT/Group.pm, lib/RT/Groups.pm,
+       lib/RT/Record.pm, lib/RT/Scrip.pm, lib/RT/ScripAction.pm,
+       lib/RT/Ticket.pm, lib/RT/Transaction.pm, lib/RT/User.pm,
+       lib/RT/Users.pm, tools/insertdata, webrt/Admin/Elements/GroupTabs,
+       webrt/Admin/Elements/SystemTabs, webrt/Admin/Global/ACL.html,
+       webrt/Admin/Global/GroupRights.html,
+       webrt/Admin/Global/UserRights.html,
+       webrt/Admin/Groups/Members.html, webrt/Admin/Groups/Modify.html,
+       webrt/Admin/Groups/index.html, webrt/Admin/Users/Modify.html,
+       webrt/Admin/Users/index.html:
+
+       A bunch of cleanup work on Users and Groups (and a couple of small bugfixes, one
+       which might prevent install of Alpha 2) mostly aimed at improving the admin ui.
+       
+       We now have two levels of "Privileged" for a user, 1 which means "can be granted rights"
+       and 2 which means "should not be futzed with by the user"
+       
+2000-12-14 23:04  jesse
+
+       * webrt/Ticket/Attachment/dhandler:
+
+       Accidentally left out of the last rev. sorry about that.
+       
+2000-12-14 23:04  jesse
+
+       * webrt/Ticket/Attachment/dhandler:
+
+       file dhandler was initially added on branch rt-1-1.
+       
+2000-12-12 20:44  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.26. This is RT2 Alpha 2, folks.
+       
+2000-12-12 20:34  jesse
+
+       * lib/RT/Attachment.pm, lib/RT/Record.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, lib/RT/User.pm,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Attachment display in the webui now just works [tm] RT2 Alpha 2 will be rolled later tonight.
+       
+2000-12-12 19:03  jesse
+
+       * webrt/Admin/Global/Template.html:
+
+       file Template.html was initially added on branch rt-1-1.
+       
+2000-12-12 19:03  jesse
+
+       * webrt/Admin/Global/Templates.html:
+
+       file Templates.html was initially added on branch rt-1-1.
+       
+2000-12-12 19:03  jesse
+
+       * README, bin/webmux.pl, lib/RT/Attachment.pm, lib/RT/Template.pm,
+       lib/RT/Transaction.pm, webrt/Admin/Elements/SelectTemplate,
+       webrt/Admin/Elements/SystemTabs, webrt/Admin/Global/Template.html,
+       webrt/Admin/Global/Templates.html,
+       webrt/Admin/Queues/Templates.html,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Working on attachments support.
+       
+       did some work on global templates
+       
+2000-12-12 15:15  jesse
+
+       * lib/RT/Template.pm, lib/RT/Templates.pm, tools/insertdata:
+
+       Core support for system-scoped templates
+       
+2000-12-12 14:12  jesse
+
+       * webrt/Admin/: Queues/Modify.html, Users/Create.html,
+       Users/Modify.html:
+
+       Fixed queue and user creation problems.
+       
+2000-12-12 03:05  jesse
+
+       * webrt/Ticket/: Link.html, ModifyLinks.html, Elements/ShowSummary,
+       Elements/Tabs:
+
+       Brought the still basic link editing ui into conformance with the rest of the ticket ui
+       
+2000-12-12 03:05  jesse
+
+       * webrt/Ticket/ModifyLinks.html:
+
+       file ModifyLinks.html was initially added on branch rt-1-1.
+       
+2000-12-12 02:41  jesse
+
+       * webrt/Ticket/: ModifyDates.html, ModifyPeople.html:
+
+       split out the ticket modify screen into 3 more bite-sized pages.
+       
+2000-12-12 02:41  jesse
+
+       * webrt/Ticket/ModifyPeople.html:
+
+       file ModifyPeople.html was initially added on branch rt-1-1.
+       
+2000-12-12 02:41  jesse
+
+       * webrt/Ticket/ModifyDates.html:
+
+       file ModifyDates.html was initially added on branch rt-1-1.
+       
+2000-12-12 02:41  jesse
+
+       * webrt/Ticket/: Modify.html, Elements/Tabs:
+
+       [no log message]
+       
+2000-12-11 15:01  jesse
+
+       * webrt/NoAuth/Login.html:
+
+       file Login.html was initially added on branch rt-1-1.
+       
+2000-12-11 15:01  jesse
+
+       * webrt/NoAuth/Logout.html:
+
+       file Logout.html was initially added on branch rt-1-1.
+       
+2000-12-11 15:01  jesse
+
+       * webrt/: Login.html, Logout.html, autohandler, Elements/Footer,
+       Elements/Header, NoAuth/Login.html, NoAuth/Logout.html:
+
+       Moving Login and Logout around so they work right with the new NoAuth scheme
+       
+2000-12-11 05:00  jesse
+
+       * webrt/: Login.html, autohandler:
+
+       fixed a couple login bugs. implemented some logic to deal with different auth classes:
+       /NoAuth/ and /SelfService/
+       
+2000-12-11 01:46  jesse
+
+       * webrt/: rt.jpg, Elements/Header, Elements/MyRequests,
+       Elements/MyTickets, Search/Listing.html, Ticket/Create.html,
+       Ticket/Create_Detail.html, Ticket/Display.html, Ticket/Modify.html,
+       Ticket/Update.html, Ticket/Elements/ShowTransaction,
+       Ticket/Elements/Tabs, Ticket/Elements/TicketToolBox:
+
+        Work on ticket display. we're getting there.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/Queues/Template.html:
+
+       file Template.html was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/Queues/Templates.html:
+
+       file Templates.html was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/Elements/QueueTabs:
+
+       file QueueTabs was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/Elements/SystemTabs:
+
+       file SystemTabs was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/: Global/Scrips.html, Queues/Scrips.html:
+
+       file Scrips.html was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/Elements/UserTabs:
+
+       file UserTabs was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/: Global/ACL.html, Queues/ACL.html:
+
+       file ACL.html was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * webrt/Admin/Global/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-12-10 23:53  jesse
+
+       * Makefile, webrt/index.html, webrt/Admin/ModifyUser,
+       webrt/Admin/index.html, webrt/Admin/Elements/Header,
+       webrt/Admin/Elements/QueueTabs, webrt/Admin/Elements/SystemTabs,
+       webrt/Admin/Elements/Tabs, webrt/Admin/Elements/UserTabs,
+       webrt/Admin/Global/ACL.html, webrt/Admin/Global/Scrips.html,
+       webrt/Admin/Global/index.html, webrt/Admin/Queues/ACL.html,
+       webrt/Admin/Queues/Modify.html, webrt/Admin/Queues/Scrips.html,
+       webrt/Admin/Queues/Template.html,
+       webrt/Admin/Queues/Templates.html, webrt/Admin/Queues/index.html,
+       webrt/Admin/Users/Modify.html, webrt/Admin/Users/index.html,
+       webrt/Elements/Header, webrt/Elements/Tabs:
+
+       Bunch of work on the web administration framework.
+       Lots of stuff should be much cleaner now.
+       
+2000-12-10 01:21  jesse
+
+       * Makefile:
+
+       Bumped version to 1.3.25 for release
+       
+2000-12-10 01:15  jesse
+
+       * webrt/: Elements/TitleBoxEnd, Elements/TitleBoxStart,
+       SelfService/Elements/MyRequests, SelfService/Elements/Tabs,
+       Ticket/Update.html, User/Prefs.html:
+
+       Work on SSRI and a bit of overall UI tweaking
+       
+2000-12-09 22:48  jesse
+
+       * webrt/SelfService/Elements/Header:
+
+       file Header was initially added on branch rt-1-1.
+       
+2000-12-09 22:48  jesse
+
+       * webrt/SelfService/Elements/: Header, MyRequests, Tabs:
+
+       Missed a couple files for SSRI
+       
+2000-12-09 22:48  jesse
+
+       * webrt/SelfService/Elements/MyRequests:
+
+       file MyRequests was initially added on branch rt-1-1.
+       
+2000-12-09 22:48  jesse
+
+       * webrt/SelfService/Elements/Tabs:
+
+       file Tabs was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * webrt/SelfService/Create.html:
+
+       file Create.html was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * webrt/SelfService/Details.html:
+
+       file Details.html was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * webrt/SelfService/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * webrt/SelfService/Closed.html:
+
+       file Closed.html was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * webrt/Elements/SelectNewTicketQueue:
+
+       file SelectNewTicketQueue was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * webrt/Admin/Groups/Members.html:
+
+       file Members.html was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * webrt/Admin/Elements/SelectUsers:
+
+       file SelectUsers was initially added on branch rt-1-1.
+       
+2000-12-09 22:43  jesse
+
+       * lib/RT/CurrentUser.pm, lib/RT/Group.pm, lib/RT/GroupMember.pm,
+       lib/RT/Record.pm, lib/RT/User.pm, lib/RT/Users.pm,
+       webrt/Login.html, webrt/autohandler,
+       webrt/Admin/Elements/SelectModifyGroup,
+       webrt/Admin/Elements/SelectUsers, webrt/Admin/Groups/Members.html,
+       webrt/Admin/Groups/Modify.html, webrt/Admin/Groups/index.html,
+       webrt/Admin/Users/Modify.html, webrt/Admin/Users/index.html,
+       webrt/Elements/Header, webrt/Elements/SelectNewTicketQueue,
+       webrt/SelfService/Closed.html, webrt/SelfService/Create.html,
+       webrt/SelfService/Details.html, webrt/SelfService/index.html,
+       webrt/User/Prefs.html:
+
+       First rev of SSRI, the Self Service Requestor Interface.
+       Did a bunch of work on groups and the admin UI
+       
+2000-12-05 23:24  jesse
+
+       * webrt/Admin/Groups/Modify.html:
+
+       file Modify.html was initially added on branch rt-1-1.
+       
+2000-12-05 23:24  jesse
+
+       * webrt/Admin/Groups/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-12-05 23:24  jesse
+
+       * webrt/Admin/Elements/SelectModifyGroup:
+
+       file SelectModifyGroup was initially added on branch rt-1-1.
+       
+2000-12-05 23:24  jesse
+
+       * lib/RT/Action/NotifyAsComment.pm:
+
+       file NotifyAsComment.pm was initially added on branch rt-1-1.
+       
+2000-12-05 23:24  jesse
+
+       * lib/RT/Group.pm, lib/RT/GroupMembers.pm, lib/RT/Scrip.pm,
+       lib/RT/Action/Notify.pm, lib/RT/Action/NotifyAsComment.pm,
+       lib/RT/Action/SendEmail.pm, tools/insertdata,
+       webrt/Admin/Elements/SelectModifyGroup,
+       webrt/Admin/Groups/Modify.html, webrt/Admin/Groups/index.html,
+       webrt/Admin/Queues/Modify.html, webrt/Admin/Queues/index.html:
+
+       Lots of work on groups. I think the core is basically set.  UI has been started
+       
+       Scrips got even more work and more code. they now work at least as well as
+       they ever have _and_ they now do it for the right reasons.
+       
+2000-12-02 13:44  jesse
+
+       * Makefile:
+
+       
+       fixed a local customization in the makefile
+       
+2000-12-02 13:34  jesse
+
+       * Makefile:
+
+       bumped version to 1.0.6
+       
+2000-12-02 03:22  jesse
+
+       * webrt/Ticket/Link.html:
+
+       file Link.html was initially added on branch rt-1-1.
+       
+2000-12-02 03:22  jesse
+
+       * lib/RT/Scrip.pm, lib/RT/ScripActions.pm, lib/RT/Scrips.pm,
+       webrt/Ticket/Link.html:
+
+       catching some stragglers.
+       
+2000-12-02 03:22  jesse
+
+       * lib/RT/ScripActions.pm:
+
+       file ScripActions.pm was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * webrt/Admin/Elements/SelectScripAction:
+
+       file SelectScripAction was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * webrt/Admin/Elements/SelectScripCondition:
+
+       file SelectScripCondition was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * lib/RT/: Action/Generic.pm, Condition/Generic.pm:
+
+       file Generic.pm was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * lib/RT/Condition/AnyTransaction.pm:
+
+       file AnyTransaction.pm was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * lib/RT/Condition/NewDependency.pm:
+
+       file NewDependency.pm was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * lib/RT/ScripAction.pm:
+
+       file ScripAction.pm was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * lib/RT/ScripCondition.pm:
+
+       file ScripCondition.pm was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * lib/RT/ScripConditions.pm:
+
+       file ScripConditions.pm was initially added on branch rt-1-1.
+       
+2000-12-02 03:20  jesse
+
+       * bin/webmux.pl, docs/design_docs/subscription-definitions.txt,
+       etc/schema.pm, lib/RT/Action.pm, lib/RT/Scrip.pm,
+       lib/RT/ScripAction.pm, lib/RT/ScripCondition.pm,
+       lib/RT/ScripConditions.pm, lib/RT/ScripScope.pm,
+       lib/RT/ScripScopes.pm, lib/RT/Scrips.pm, lib/RT/Transaction.pm,
+       lib/RT/Action/Generic.pm, lib/RT/Action/Notify.pm,
+       lib/RT/Action/OpenDependent.pm, lib/RT/Action/ResolveMembers.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Action/SendEmailOnResolve.pm,
+       lib/RT/Action/StallDependent.pm,
+       lib/RT/Condition/AnyTransaction.pm, lib/RT/Condition/Generic.pm,
+       lib/RT/Condition/NewDependency.pm, tools/insertdata,
+       webrt/Admin/Elements/SelectScripAction,
+       webrt/Admin/Elements/SelectScripCondition:
+
+       Major major major work on scrips
+       scrips now specify a 'Stage' which has only one value for now but should be easier to add in other
+       points in the code where they get called
+       
+       What used to be called Scrip got split into ScripCondition and ScripAction
+       
+       ScripScope got renamed 'Scrip', like it should have been from the getgo.
+       
+       Did some work to the scrip mailing routines.All in all, scrips are much
+       cleaner and more flexible. and at least as functional as they were last night.
+       
+       I'll be adjusting the templates as I get to them
+       
+2000-12-01 14:02  jesse
+
+       * NEWS:
+
+       fixed a display bug in how we split messages for the webui
+       
+2000-11-30 02:18  jesse
+
+       * lib/RT/Action/AutoReply.pm, lib/RT/Action/SendEmail.pm,
+       tools/insertdata:
+
+       Working on cleaning up the Scrips system.  The whole templating system
+       was really, really incredibly overdesigned and badly implemented on the first go-round.
+       Over the next few checkins, I'll be cleaning it up and cleaning it out...
+       
+2000-11-29 16:31  jesse
+
+       * bin/testdeps.pl:
+
+       updated apache::session dependency
+       
+2000-11-29 01:32  jesse
+
+       * lib/RT/ACE.pm, lib/RT/ScripScope.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, lib/RT/User.pm, lib/RT/Action/AutoReply.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Interface/Email.pm,
+       webrt/Admin/Elements/SelectScrip,
+       webrt/Admin/Elements/SelectTemplate,
+       webrt/Ticket/Create_Detail.html:
+
+       Work on scrips all around:
+               web ui cleanups
+               Action::SendEmail cleanups
+       
+       work on acls for Ticket creation.
+       now users who only have "CreateTicket" can actually create tickets,
+       even if they can't see the ticket once created.
+       RT1's "allow nonmembers to create requests" can be replicated by
+       granting  the metagroup 'requestors' the right "CreateTicket".
+       
+       Mail gateway got a lot of debugging stubs. mail gateway now uses
+       modern semantics for Create.
+       
+2000-11-28 17:46  jesse
+
+       * lib/RT/User.pm:
+
+       cacheed acl decisions are now properly granular.
+       
+2000-11-28 17:39  jesse
+
+       * lib/RT/User.pm:
+
+       Cached ACL decisions are now expire after 2 minutes.
+       
+2000-11-28 03:37  jesse
+
+       * etc/config.pm, lib/RT/Ticket.pm, webrt/Ticket/Update.html,
+       webrt/Ticket/Elements/ShowReferences,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       fixed a small bug in ticket update.
+       fixed a set of bugs in "external" links that were discovered when my roommate suggested
+       that RT could be used as an mp3 playlist server.  Now it can. no, you really don't want to.
+       At least until we have asset managment.
+       
+2000-11-28 00:20  jesse
+
+       * Makefile, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Action/SendEmail.pm:
+
+       a couple little tweask to transaction and sendemail.
+       
+       bumped the version #
+       
+2000-11-28 00:12  jesse
+
+       * webrt/Ticket/: Display.html, LinkIt.html, ProcessUpdate.html,
+       Update.html, Elements/ShowSummary, Elements/ShowTransaction,
+       Elements/TicketToolBox:
+
+       Work on cleaning up the web ui. got rid of processupdate.html.
+       cleaned up the code in display.html..  linking is no longer nearly as offensive.
+       
+2000-11-27 20:26  jesse
+
+       * webrt/Ticket/Elements/ShowRequestor:
+
+       small display fix to not show nobody as a possible requestor
+       
+2000-11-27 20:05  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/User.pm, webrt/Ticket/Display.html:
+
+       Updates to how Create handles Requestor, Cc and Admin Cc.
+       it's now much more flexible, cleaner and simpler. yay.
+       
+2000-11-27 04:01  jesse
+
+       * webrt/Elements/: Error, Header, MyRequests:
+
+       Web error reporting tweaks.
+       added MyRequests to the front page
+       
+2000-11-27 04:01  jesse
+
+       * webrt/Elements/MyRequests:
+
+       file MyRequests was initially added on branch rt-1-1.
+       
+2000-11-27 03:30  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Interface/Web.pm,
+       webrt/Ticket/Display.html, webrt/Ticket/Elements/ShowHistory:
+
+       more work on ACLs
+       
+       Ticket.pm has been fully ACLed.
+       Did work on web ticket create.  it's no longer a festering pile of garbage.
+       Now it's more of an office wastepaper basket full of clean white 20lb paper.
+       Seriously, though, it's cleaner. I got rid of some of Tobias' temporary ticket creation
+       code.
+       
+2000-11-26 23:45  jesse
+
+       * lib/RT/ACE.pm, lib/RT/GroupMember.pm, lib/RT/Queue.pm,
+       lib/RT/Queues.pm, lib/RT/Template.pm, lib/RT/Ticket.pm,
+       lib/RT/User.pm, lib/RT/Interface/Web.pm, tools/insertdata,
+       webrt/Admin/Elements/ModifyQueue, webrt/Elements/Header,
+       webrt/Elements/Tabs:
+
+       
+       
+       lots more ACL work.
+       a little bit of UI cleanup.
+       
+2000-11-25 01:56  jesse
+
+       * lib/RT/Tickets.pm, webrt/index.html,
+       webrt/Ticket/Elements/ShowDates:
+
+       made "my requests" doable.
+       fixed some ui in showdates.
+       
+2000-11-24 20:14  jesse
+
+       * lib/RT/: Queue.pm, User.pm:
+
+       Fixed a couple of bugs in HasSystemRight that make RT install correctly again.
+       
+2000-11-24 19:21  jesse
+
+       * etc/schema.pm:
+
+       schema fix to make pg happy
+       
+2000-11-22 03:08  jesse
+
+       * webrt/Ticket/Update.html:
+
+       cleaned up the ticket udpdate form. made it more concise.::
+       
+2000-11-22 03:04  jesse
+
+       * webrt/Ticket/Update.html:
+
+       cleaning up the ticket update form
+       
+2000-11-22 02:49  jesse
+
+       * bin/testdeps.pl:
+
+       bumped searchbuilder dependency to the version now in CPAN...
+       
+2000-11-22 02:31  jesse
+
+       * Makefile, lib/RT/ACE.pm, lib/RT/ACL.pm, lib/RT/Action.pm,
+       lib/RT/Attachment.pm, lib/RT/Attachments.pm, lib/RT/CurrentUser.pm,
+       lib/RT/Date.pm, lib/RT/EasySearch.pm, lib/RT/Group.pm,
+       lib/RT/GroupMember.pm, lib/RT/GroupMembers.pm, lib/RT/Groups.pm,
+       lib/RT/Handle.pm, lib/RT/Link.pm, lib/RT/Links.pm, lib/RT/Queue.pm,
+       lib/RT/Queues.pm, lib/RT/Record.pm, lib/RT/Scrip.pm,
+       lib/RT/ScripScope.pm, lib/RT/ScripScopes.pm, lib/RT/Scrips.pm,
+       lib/RT/Template.pm, lib/RT/Templates.pm, lib/RT/Ticket.pm,
+       lib/RT/Tickets.pm, lib/RT/Transaction.pm, lib/RT/Transactions.pm,
+       lib/RT/User.pm, lib/RT/Users.pm, lib/RT/Utils.pm,
+       lib/RT/Watcher.pm, lib/RT/Watchers.pm:
+
+       Bumped version to 1.3.23
+       Added pod headers to most core modules?
+       
+2000-11-21 23:05  jesse
+
+       * webrt/Ticket/Elements/ShowSummary:
+
+       removed a dead link
+       
+2000-11-21 04:07  jesse
+
+       * Makefile, lib/RT/Queue.pm, lib/RT/Scrip.pm, lib/RT/ScripScope.pm,
+       lib/RT/Transaction.pm, lib/RT/User.pm:
+
+       tmp logfiles now go in /tmp
+       oh. and SCRIPS NOW WORK. RT can send mail.
+       and recieve mail. life is good.
+       
+2000-11-21 02:55  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Implemented Ticket->IsWatcher.
+       This is what we needed to make pseudogroup based ACLs work
+       
+2000-11-21 00:55  jesse
+
+       * lib/RT/Queue.pm, lib/RT/Ticket.pm, lib/RT/User.pm,
+       webrt/Elements/Tabs:
+
+       fixed a couple of bugs while I was out and about.
+       Oh. and most of the rest of the ACL core is implemented now.
+       rights for requestor/owner/cc/admincc should now work.
+       
+2000-11-20 11:59  jesse
+
+       * lib/RT/ACE.pm, lib/RT/User.pm, tools/insertdata:
+
+       Added "Requestor" and "Everyone" metagroups to tools/insertdata
+       
+       Fixed a bug with yet another way to call HasQueueRight.
+       
+2000-11-20 00:39  jesse
+
+       * Makefile:
+
+       bumped to 1.3.22 for release
+       
+2000-11-20 00:24  jesse
+
+       * webrt/Search/Listing.html:
+
+       fixed a big triggered when clearing empty ticket searches
+       
+2000-11-19 23:55  jesse
+
+       * bin/webmux.pl, lib/RT/User.pm:
+
+       fixed a bug that stopped you from specifying an owner on ticket create
+       Watcher and Watchers are now preloaded in the App server.
+       
+2000-11-19 23:20  jesse
+
+       * webrt/Ticket/Elements/Tabs:
+
+       file Tabs was initially added on branch rt-1-1.
+       
+2000-11-19 23:20  jesse
+
+       * webrt/: index.html, Admin/Elements/Tabs, Elements/Header,
+       Elements/Tabs, Search/Listing.html, Search/RestrictSearch.html,
+       Ticket/Create.html, Ticket/Create_Detail.html, Ticket/Display.html,
+       Ticket/EditWatchers.html, Ticket/Modify.html, Ticket/Update.html,
+       Ticket/Elements/Tabs:
+
+       more UI tweaking. yay.
+       
+2000-11-19 17:57  jesse
+
+       * webrt/Elements/Quicksearch:
+
+       file Quicksearch was initially added on branch rt-1-1.
+       
+2000-11-19 17:57  jesse
+
+       * webrt/Elements/MyTickets:
+
+       file MyTickets was initially added on branch rt-1-1.
+       
+2000-11-19 17:57  jesse
+
+       * webrt/rt.jpg:
+
+       file rt.jpg was initially added on branch rt-1-1.
+       
+2000-11-19 17:57  jesse
+
+       * lib/RT/ACE.pm, lib/RT/Ticket.pm, lib/RT/Tickets.pm,
+       lib/RT/Interface/Web.pm, webrt/index.html, webrt/rt.jpg,
+       webrt/Elements/MyTickets, webrt/Elements/Quicksearch,
+       webrt/Search/Listing.html:
+
+       A bunch of UI work. we now have a placeholder logo
+       
+2000-11-18 03:03  jesse
+
+       * lib/RT/: User.pm, Interface/Web.pm:
+
+       ACL  change messages are now properly scoped. so now they don't hang out
+       between sessions
+       
+       if a user has a system right, that right now applies to all queues.
+       
+2000-11-17 00:19  jesse
+
+       * Makefile:
+
+       Rolled rev 1.3.21. now with an ACL editor.
+       
+2000-11-17 00:15  jesse
+
+       * webrt/Admin/Elements/SelectRights:
+
+       file SelectRights was initially added on branch rt-1-1.
+       
+2000-11-17 00:15  jesse
+
+       * lib/RT/ACE.pm, lib/RT/Group.pm, lib/RT/Queue.pm,
+       lib/RT/Template.pm, lib/RT/Ticket.pm, lib/RT/User.pm,
+       lib/RT/Interface/Web.pm, webrt/Admin/Elements/SelectRights:
+
+       Woo! the ACL editor is now much cleaner. and it works. :)
+       
+2000-11-16 01:17  jesse
+
+       * lib/RT/: ACE.pm, ACL.pm, Attachment.pm, Attachments.pm,
+       CurrentUser.pm, EasySearch.pm, Group.pm, GroupMember.pm,
+       GroupMembers.pm, Groups.pm, Link.pm, Links.pm, Queue.pm, Queues.pm,
+       Record.pm, Scrip.pm, ScripScope.pm, ScripScopes.pm, Scrips.pm,
+       Template.pm, Templates.pm, Ticket.pm, Transaction.pm,
+       Transactions.pm, User.pm, Users.pm, Watcher.pm, Watchers.pm,
+       Interface/Web.pm:
+
+       
+       LEANED UP A WHOLE BUNCH OF NEW ROUTINES. FIXED A FREW ACL BUGS.
+       
+2000-11-15 02:29  jesse
+
+       * lib/RT/ACE.pm, lib/RT/ACL.pm, lib/RT/CurrentUser.pm,
+       lib/RT/Queue.pm, lib/RT/Ticket.pm, lib/RT/User.pm,
+       webrt/Admin/Elements/Tabs, webrt/Elements/Submit:
+
+       refactored ACLS to take out a layer of complexity or two.
+       
+2000-11-14 13:17  jesse
+
+       * Makefile:
+
+       bumped the makefuile version
+       
+2000-11-13 23:19  jesse
+
+       * bin/webmux.pl, lib/RT/ACL.pm, lib/RT/EasySearch.pm,
+       lib/RT/Group.pm, lib/RT/GroupMember.pm, lib/RT/Record.pm,
+       lib/RT/User.pm:
+
+       A bunch of refactoring to make ACL editable. Lots of work on the ACL editor.
+       Basic user ACLs are now editable.
+       It needs some more refactoring, since I stopped being on quite as much crack
+       over the wekeend and figured out a much less intense way to do a bunch of stuff. Yay.
+       
+2000-11-08 14:55  jesse
+
+       * Makefile, NEWS:
+
+       all mail sent out is now sent out precedence "bulk" like it should be.
+       
+2000-11-08 01:24  jesse
+
+       * webrt/Admin/Elements/SelectScrip:
+
+       file SelectScrip was initially added on branch rt-1-1.
+       
+2000-11-08 01:24  jesse
+
+       * webrt/Admin/Elements/SelectTemplate:
+
+       file SelectTemplate was initially added on branch rt-1-1.
+       
+2000-11-08 01:24  jesse
+
+       * etc/schema.pm, lib/RT/ACE.pm, lib/RT/ACL.pm,
+       lib/RT/CurrentUser.pm, lib/RT/Group.pm, lib/RT/Ticket.pm,
+       lib/RT/Tickets.pm, lib/RT/Transaction.pm, lib/RT/User.pm,
+       lib/RT/Users.pm, tools/insertdata,
+       webrt/Admin/Elements/SelectScrip,
+       webrt/Admin/Elements/SelectTemplate:
+
+       A whole slew of work on ACLs and assorted other related things.
+       This involved a lot of cleanup of ACL related code and things it touched.
+       ACL decisions are now being made. (Yes, you're all still superusers) but I
+       think I've got a bunch of the infrastructure cleaned up, so it should be
+       easier to finish off the ACL editor. yay!
+       
+       As part of this, I had to add more groups support. all you groups-maniacs should be pleased ;)
+       
+2000-11-06 11:55  jesse
+
+       * Makefile:
+
+       Fixed yet another typo in manipulate.pm.
+       
+       Bumped version to 1.0.5
+       
+2000-11-05 15:24  jesse
+
+       * Makefile:
+
+       A fix for action vs actions in mail manipulate.
+       fixed a typo normailize -> normalize in database/manipulate.pm
+       
+2000-11-03 17:54  jesse
+
+       * README, etc/schema.pm, lib/RT/ACE.pm, lib/RT/ACL.pm,
+       lib/RT/CurrentUser.pm, lib/RT/GroupMember.pm, lib/RT/Queue.pm,
+       lib/RT/Ticket.pm, lib/RT/User.pm, lib/RT/Users.pm,
+       lib/RT/Interface/Email.pm, lib/RT/Interface/Web.pm,
+       tools/insertdata, webrt/Admin/ModifyUser,
+       webrt/Admin/Elements/QueueRightsForUser, webrt/Admin/Elements/Tabs,
+       webrt/Elements/SelectOwner:
+
+       A bunch of work on the ACLs. we're getting closer to having a workable ACL
+       editor.
+       
+2000-11-03 15:37  jesse
+
+       * Makefile, NEWS:
+
+       We now deal better with merging merged tickets.
+       
+       We now properly ignore Precedence: {junk|bulk} headers
+       
+2000-10-31 00:06  jesse
+
+       * lib/RT/: ACE.pm, ScripScope.pm:
+
+       Added ACL support to the ScripScope system.
+       
+2000-10-29 21:31  jesse
+
+       * Makefile, README, bin/webmux.pl, lib/RT/ACE.pm, lib/RT/Group.pm,
+       lib/RT/Groups.pm, lib/RT/Queue.pm, lib/RT/ScripScope.pm,
+       lib/RT/ScripScopes.pm, lib/RT/Scrips.pm, lib/RT/Template.pm,
+       lib/RT/Templates.pm, lib/RT/Transaction.pm, tools/insertdata:
+
+       A bunch of hacking to the ScripScopes system.
+       
+       You can now edit scrips for a given queue.
+       but hey, scrips have no ACL checking yet.
+       
+2000-10-29 17:51  jesse
+
+       * etc/schema.pm:
+
+       Added a whole lot of documentation to schema.pm.
+       
+2000-10-25 21:09  jesse
+
+       * Makefile, bin/testdeps.pl, etc/schema.pm:
+
+       Updated schema.pm and testdeps to jibe with the current CPAN versions of things.
+       And I bumped the version to 1.3.20
+       
+2000-10-23 16:53  jesse
+
+       * Makefile, lib/RT/Date.pm:
+
+       Reverted to using mysql by default.
+       Finished off the postgresql support in the rt core. (well, at least finished the initial support)
+       
+2000-10-23 16:35  jesse
+
+       * Makefile, lib/RT/ACE.pm, lib/RT/Ticket.pm, tools/insertdata:
+
+       Cleanups related to making postgres support work right.
+       
+2000-10-22 20:57  jesse
+
+       * Makefile, bin/initacls.Pg, bin/testdeps.pl, etc/acl.Pg,
+       etc/config.pm, etc/schema.pm, lib/RT/Link.pm, lib/RT/Ticket.pm,
+       lib/RT/Tickets.pm, tools/initdb, tools/insertdata,
+       webrt/Ticket/Display.html:
+
+       merged in ivan's postgres patches.
+       made local ticket links work again. *sigh* SQL evil. eeeeevil.
+       
+2000-10-16 16:32  jesse
+
+       * docs/Security:
+
+       file Security was initially added on branch rt-1-1.
+       
+2000-10-16 16:32  jesse
+
+       * docs/Security:
+
+       some initial notes on security. targetted at RT admins.
+       
+2000-10-16 03:01  jesse
+
+       * lib/RT/: Link.pm, Links.pm, Ticket.pm:
+
+       Fixed a couple of typos in link and links.
+       Ticket->Load will now do the right hting with ticket uris or aliases.
+       
+2000-10-16 00:47  jesse
+
+       * etc/config.pm, lib/RT/Link.pm, lib/RT/Links.pm, lib/RT/Ticket.pm:
+
+       The linking interface now uses URIs internally. and it does lots of
+       sanity checking.
+       
+       Tickets now understand what their uris should be. you can load tickets by
+       uri. and by alias.
+       
+       We need a bit more work to make alias support just transparent, but we're
+       getting really close.
+       
+       You shouldn't be able to link to nonexistent local objects any mroe.
+       
+2000-10-15 01:57  jesse
+
+       * lib/RT/CurrentUser.pm:
+
+       Added CurrentUser->LoadByGecos.
+       The CLI now uses LoadByGecos to load the currentuser.
+       This means that users other than root might actually be able to use the cli now
+       VS: ----------------------------------------------------------------------
+       
+2000-10-15 01:11  jesse
+
+       * Makefile:
+
+       Significantly redid the installation procedure. we're now _much_
+       more careful about what gets installed where and what's owned by whom.
+       
+       Oh. and RT's now setgid, rather than setuid. and there's no setuid wrapper anymore
+       
+2000-10-15 01:08  jesse
+
+       * etc/: config.pm, suidrt.c:
+
+       Yanked suidrt.c, since we now run setgid.
+       
+       rt now logs to /tmp/rt.log.pid.userid
+       
+2000-10-14 02:56  jesse
+
+       * bin/rtmux.pl, bin/webmux.pl, etc/schema.pm,
+       lib/RT/CurrentUser.pm, lib/RT/Interface/Email.pm, tools/initdb,
+       tools/insertdata:
+
+       CurrentUser.pm had LoadByEmail and LoadByUserId methods added and they're now
+       actually used most everywhere.
+       
+       insertdata doesn't force ids for users now.
+       
+       the schema now actually enforces a lot of important uniqueness constraints.
+       
+2000-10-13 10:59  jesse
+
+       * etc/schema.mysql:
+
+       Removed the old schema.mysql, lest it lead people astray
+       
+2000-10-13 02:27  jesse
+
+       * webrt/Ticket/Elements/: EditPeople, ShowMembers:
+
+       Removed some old warning text that's not true any more.
+       Fixed a relative url problem in "show memebers"
+       
+2000-10-12 23:22  jesse
+
+       * Makefile, bin/testdeps.pl:
+
+       updated testdeps.
+       Makefile now defaults to installing rt2 in /opt/rt2
+       
+2000-10-12 22:54  jesse
+
+       * Makefile, lib/RT/ACL.pm, lib/RT/Queue.pm, lib/RT/Ticket.pm,
+       lib/RT/User.pm, lib/RT/Users.pm, tools/insertdata,
+       webrt/index.html:
+
+       A couple of links on the front page.
+       Makefile now assumes www-data instead of nobody as the web user. this is not quite right.
+       
+       Fixed a little bit of the POD in User.pm.
+       
+       Redid how Ticket.pm deals with Owner on create. the new logic should actually catch errors
+       instead of easily letting referential integrity checks just _fail_.
+       
+       Insertdata got cleaned up a little bit.
+       
+       ACL got its cleaned up a bit
+       
+2000-10-11 23:22  jesse
+
+       * webrt/Admin/Elements/QueueRightsForUser:
+
+       file QueueRightsForUser was initially added on branch rt-1-1.
+       
+2000-10-11 23:22  jesse
+
+       * lib/RT/Users.pm, webrt/Admin/Elements/QueueRightsForUser:
+
+       Work on ACLs. and the ACL editor
+       
+2000-10-11 21:23  jesse
+
+       * tools/insertdata:
+
+       gave root a password
+       
+2000-10-11 12:28  jesse
+
+       * Makefile, tools/initdb:
+
+       Databasename changed from RT2 to rt2 to make postgres happier.
+       
+       initdb quoting bug fixed.
+       
+       debug mode in initdb turned off.
+       
+       If you're using mysql and running with ivan's current CVS version of DBIx::DBSchema, RT should once again work.
+       
+2000-10-09 02:32  jesse
+
+       * etc/schema.pm, tools/initdb:
+
+       a debugging hook in initdb and defaults (though they don't work just right yet)
+       in schema.pm. Note that we now need DBIx::DBSchema from CVS.
+       
+2000-10-09 01:59  jesse
+
+       * Makefile, NEWS, etc/suidrt.c:
+
+       Jan Kujawa fixed a bug in the setuid wrapper
+       Jan Okrouhly fixed some bugs in the merged ticket resolution in the cli.
+       
+       Rolled 1.0.5pre3
+       
+2000-10-05 17:30  jesse
+
+       * lib/RT/: ACE.pm, ACL.pm:
+
+       more work on RT's acl core
+       
+2000-10-05 17:30  jesse
+
+       * webrt/Admin/Elements/: GrantQueueRightsTo, GrantQueueRightsTo~,
+       SelectQueueRights:
+
+       more acl work
+       
+2000-10-05 17:30  jesse
+
+       * webrt/Admin/Elements/GrantQueueRightsTo~:
+
+       file GrantQueueRightsTo~ was initially added on branch rt-1-1.
+       
+2000-10-05 17:30  jesse
+
+       * webrt/Admin/Elements/GrantQueueRightsTo:
+
+       file GrantQueueRightsTo was initially added on branch rt-1-1.
+       
+2000-10-05 17:30  jesse
+
+       * webrt/Admin/Elements/SelectQueueRights:
+
+       file SelectQueueRights was initially added on branch rt-1-1.
+       
+2000-10-05 15:49  jesse
+
+       * etc/suidrt.c:
+
+       reordering things in suidrt.c seemed to make them happier.
+       
+2000-10-05 15:39  jesse
+
+       * etc/suidrt.c:
+
+       missed a comma
+       
+2000-10-05 15:03  jesse
+
+       * bin/testdeps.pl:
+
+       added a dependency test script to make installation by newbies easier.
+       
+2000-10-05 15:03  jesse
+
+       * Makefile, README, etc/suidrt.c:
+
+       Major rewrite of suidrt.c by jan kujawa.
+       A couple of bugfixes from Jan Okrouhly
+               Public history should now work right in the cli
+               Web viewing of merged tickets by their old # should now work better.
+       
+2000-10-03 20:22  jesse
+
+       * bin/testdeps.pl:
+
+       cleaned up testedeps.pl output
+       
+2000-10-03 02:41  jesse
+
+       * tools/insertdata:
+
+       file insertdata was initially added on branch rt-1-1.
+       
+2000-10-03 02:41  jesse
+
+       * tools/initdb:
+
+       file initdb was initially added on branch rt-1-1.
+       
+2000-10-03 02:41  jesse
+
+       * etc/schema.pm:
+
+       file schema.pm was initially added on branch rt-1-1.
+       
+2000-10-03 02:41  jesse
+
+       * Makefile, bin/initdb.Oracle, bin/initdb.Pg, bin/initdb.mysql,
+       bin/testdeps.pl, etc/schema.Pg, etc/schema.pm, lib/RT/ACE.pm,
+       lib/RT/Queue.pm, lib/RT/Scrip.pm, lib/RT/User.pm, tools/initdb,
+       tools/insertdata:
+
+       Fairly massive installation changes.
+               We now use ivan's really cool DBIx::DBschema, which, when things
+       settle out a bit mean that the oracle and postgres (and possibly other) ports
+       get their schema updated automatically.
+       
+       The initial seed data is now inserted by tools/insertdata through the RT API.
+       
+       ACE::Create now actually works.
+       Same with Scrip::Create.
+       and Queue::Create.
+       
+       There are a couple of new installation-only dependencies. One of them (DBSchema) may become a build-only
+       dependency if people whine enough :)
+       
+       date/time handling was a casualty of the changes. some things will be handled oddly for now.
+       Once Ivan releases the next DBSchema update, this should get better again. it was
+       the result of a namespace collision between pg and mysql. the timestamp column has
+       different behavior. go fig.
+       
+       This version will require DBIx::SearchBuilder 0.06 (aka what I'm about to check in)
+       
+2000-10-03 02:07  jesse
+
+       * tools/test:
+
+       blew away old, crufty "extras"
+       
+2000-09-28 13:55  jesse
+
+       * lib/RT/Group.pm:
+
+       file Group.pm was initially added on branch rt-1-1.
+       
+2000-09-28 13:55  jesse
+
+       * lib/RT/: Group.pm, GroupMember.pm, GroupMembers.pm, Groups.pm:
+
+       Long overdue adding of completely untested (and unused) code for groups in RT.
+       note that this implementation does not assume recursive group membership
+       
+2000-09-28 13:55  jesse
+
+       * lib/RT/GroupMember.pm:
+
+       file GroupMember.pm was initially added on branch rt-1-1.
+       
+2000-09-28 13:55  jesse
+
+       * lib/RT/GroupMembers.pm:
+
+       file GroupMembers.pm was initially added on branch rt-1-1.
+       
+2000-09-28 13:55  jesse
+
+       * lib/RT/Groups.pm:
+
+       file Groups.pm was initially added on branch rt-1-1.
+       
+2000-09-18 01:57  jesse
+
+       * lib/RT/: ACE.pm, Queue.pm, Ticket.pm:
+
+       Lots of work on Queue.pm  Most cleanups related to queue watchers, but I
+       also added a bit more documentation and fixed a bug that could cause DelWatcher
+       in ticket.pm to delete watchers it shouldn't
+       
+2000-09-18 00:03  jesse
+
+       * docs/API, docs/FAQ, docs/README.oracle, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm:
+
+       More documentation. removed outdated docs.
+       
+       docs/API now talks about what those of you writing your own RT client
+       code shouldn't be doing. (Which objects you shouldn't touch).
+       
+2000-09-18 00:00  jesse
+
+       * README:
+
+       Clarified license terms. RT is available under Version 2 of the GPL.
+       Not version 1. Not some as-yet-unwritten version 3 that says you can only
+       use it if you agree to license your children under the GPL. Version 2.
+       
+2000-09-17 19:57  jesse
+
+       * lib/RT/: TicketCollection.pm, User.pm, Interface/Email.pm:
+
+       Removed bogus signature code.
+       Documented User->IsPassword
+       removed --area flag from Mailgateway (We ain't got no stinking areas)
+       
+2000-09-17 19:21  jesse
+
+       * etc/schema.Oracle, etc/schema.mysql, lib/RT/ACE.pm,
+       lib/RT/ACL.pm, lib/RT/Scrip.pm, lib/RT/User.pm:
+
+       Ugh. Mysql isn't respecting SQL92 reserved words. which meant that I didn't
+       notice that I was using "Type" and "Action" in my schema.
+       This required a bit of churn to the ACE and User modules.
+       
+2000-09-17 17:38  jesse
+
+       * Makefile:
+
+       Ok. I think I've got it now. This is RT 1.3.18. aka RT2 - Alpha 1.
+               The "Bear Suit" Release.
+       
+               A formal release announcement is forthcoming.
+       
+2000-09-17 17:29  jesse
+
+       * Makefile:
+
+       work on the changelog generator
+       
+2000-09-17 17:19  jesse
+
+       * HACKING, Makefile, README, bin/initdb.mysql, bin/testdeps.pl:
+
+       Bumped the required version of SearchBuilder in testdeps, now that it's
+       propagated throughout CPAN
+       
+       Replaced initdb.mysql with ivan's new version.
+       
+       Tweaked ivan's initdb.mysql to be a little friendlier, create the schema
+       (it was missing a FILEHANDLE in a print statement and deal
+       better with omitted passwords.
+       
+       Updated the readme some more.
+       
+       Added experimental ChangeLog generation to the make dist process
+       
+       Bumped the version number to 1.3.18 for release as alpha1 for RT2 today.
+       
+2000-09-17 01:40  jesse
+
+       * Makefile, README, bin/initacls.mysql, bin/testdeps.pl,
+       bin/webmux.pl:
+
+       Bumped the Mason version requirement up, so we avoid the poisoned v 0.88
+       Applied ivan's alpha-1 patches.
+       Did some tweaking for the alpha 1 release.
+       Cleaned up the readme a bit
+       
+2000-09-15 01:21  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+2000-09-15 01:17  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       Mail gateway now handles followup correspondence properly
+       (It gets the ticket # right)
+       
+2000-09-15 01:06  jesse
+
+       * lib/RT/Watcher.pm:
+
+       fixed a typo (left off a > ) in Watcher.pm
+       
+2000-09-15 00:59  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Watcher.pm, webrt/Ticket/Modify.html:
+
+       Editing ticket watchers from the webui now works.
+       this required a bunch of work on the internal wathers stuff
+       in ticket.pm.
+       Also added documentation and watcher-related sanity checks
+       
+2000-09-14 00:04  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/Watcher.pm,
+       webrt/Elements/SelectWatcherType, webrt/Ticket/Elements/EditPeople,
+       webrt/Ticket/Elements/EditWatchers,
+       webrt/Ticket/Elements/ModifyTicket:
+
+       Some cleanup to Watcher and Ticket. (mainly documentation updates)
+       Added an IsUser sub to Watcher.pm (which tells you if the watcher
+       object refers to a local user or a remote email address)
+       
+       the ui for editing tickets should work now.
+       note that the backend for the watchers side of this isn't there
+       yet.
+       
+               -j
+       
+2000-09-13 18:10  jesse
+
+       * etc/config.pm:
+
+       fixed a configfile typo that would break a new installation
+       
+2000-09-12 01:28  jesse
+
+       * lib/RT/Date.pm, lib/RT/Ticket.pm, webrt/Elements/ListActions,
+       webrt/Elements/SelectDate, webrt/Elements/SelectUsers,
+       webrt/Elements/SelectWatcherType, webrt/Ticket/Modify.html,
+       webrt/Ticket/Elements/AddWatchers, webrt/Ticket/Elements/EditDates,
+       webrt/Ticket/Elements/EditPeople,
+       webrt/Ticket/Elements/ModifyTicket:
+
+       TimeWorked is now read/write (which may be a bad idea. but I'm willing to try it.
+       RT::Date now better understands that "never" doesn't mean 1970.
+       
+       The web modify interface is getting closer to working.
+       I mainly need to finish making the watchers column go.
+       
+2000-09-11 00:37  jesse
+
+       * etc/config.pm:
+
+       Some sanity cleanups to the web queue listing.
+       
+2000-09-11 00:35  jesse
+
+       * webrt/Ticket/Elements/EditDates:
+
+       file EditDates was initially added on branch rt-1-1.
+       
+2000-09-11 00:35  jesse
+
+       * webrt/Ticket/Elements/EditWatchers:
+
+       file EditWatchers was initially added on branch rt-1-1.
+       
+2000-09-11 00:35  jesse
+
+       * webrt/Ticket/Elements/AddWatchers:
+
+       file AddWatchers was initially added on branch rt-1-1.
+       
+2000-09-11 00:35  jesse
+
+       * webrt/Ticket/Elements/EditBasics:
+
+       file EditBasics was initially added on branch rt-1-1.
+       
+2000-09-11 00:35  jesse
+
+       * webrt/Ticket/Elements/EditPeople:
+
+       file EditPeople was initially added on branch rt-1-1.
+       
+2000-09-11 00:35  jesse
+
+       * webrt/Ticket/Elements/ModifyTicket:
+
+       file ModifyTicket was initially added on branch rt-1-1.
+       
+2000-09-11 00:35  jesse
+
+       * webrt/: Login.html, webrt.css, Elements/SelectDate,
+       Elements/SelectMatch, Elements/SelectQueue, Elements/SelectUsers,
+       Elements/ShadedBox, Ticket/EditWatchers.html, Ticket/Modify.html,
+       Ticket/Elements/AddWatchers, Ticket/Elements/EditBasics,
+       Ticket/Elements/EditDates, Ticket/Elements/EditPeople,
+       Ticket/Elements/EditWatcherList, Ticket/Elements/EditWatchers,
+       Ticket/Elements/ModifyTicket, Ticket/Elements/ShowBasics,
+       Ticket/Elements/ShowDates, Ticket/Elements/ShowDependencies,
+       Ticket/Elements/ShowHistory, Ticket/Elements/ShowPeople,
+       Ticket/Elements/ShowSummary, Ticket/Elements/TicketToolBox:
+
+       Lots and lots of work on the webui.
+       The display UI has been cleaned up a bit and the modify UI has been started.
+       It's not in its final for yet, nor is there any logic backing many of the new ui features, but those will come next.
+       
+       If I'm remebering my list correctly, this is the one "biggie" before Alpha 1.
+       
+       Yay!
+       
+2000-09-11 00:35  jesse
+
+       * webrt/Elements/SelectUsers:
+
+       file SelectUsers was initially added on branch rt-1-1.
+       
+2000-09-07 00:52  jesse
+
+       * webrt/: Login.html, autohandler, Ticket/Elements/ShowSummary:
+
+       Replaced tobias' web arg preservation code with something that's actually based on _mason_ rather than the external apache object. This should make the fastcgi port easier
+       
+       Fixed a bug in showsummary (unqualified WebPath)
+       
+2000-09-07 00:30  jesse
+
+       * Makefile, bin/rtmux.pl, lib/RT/Handle.pm:
+
+       Look ma! it should install again (i'd flubbed a bit of the
+       fastcgi mason handler install.
+       
+       Oh. and oracle support should work now.
+       
+2000-09-06 00:52  jesse
+
+       * webrt/Logout.html:
+
+       Logout.html links you to the right place now
+       
+2000-09-05 23:47  jesse
+
+       * webrt/Search/Listing.html:
+
+       YA typo fix
+       
+2000-09-05 23:45  jesse
+
+       * webrt/Search/Listing.html:
+
+       Damn I wish I could type tonight. :/ missed an $RT::
+       
+2000-09-05 23:43  jesse
+
+       * webrt/: Search/Listing.html, Ticket/Elements/ShowSummary:
+
+       Fixed a few more Absolute url bugs
+       
+2000-09-05 23:35  jesse
+
+       * webrt/Elements/Tabs:
+
+       Tabs needed / as the final character for transparent proxying
+       
+2000-09-05 22:39  jesse
+
+       * webrt/: Login.html, Admin/Elements/CreateUserCalled,
+       Admin/Elements/ModifyQueue, Admin/Elements/ModifyTemplate,
+       Admin/Elements/ModifyUser, Admin/Users/index.html:
+
+       more work on proper absolute pathing
+       
+2000-09-05 22:08  jesse
+
+       * webrt/: Login.html, Admin/Elements/CreateQueueCalled,
+       Admin/Elements/CreateUserCalled, Admin/Elements/ModifyUser,
+       Admin/Users/index.html:
+
+       A bunch of the admin tools weren't properly dealing with absolute pathed requests. it made it impossible to have RT2 anywhere other than at the / of your webserver
+       
+2000-09-05 21:40  jesse
+
+       * lib/RT/Handle.pm:
+
+       file Handle.pm was initially added on branch rt-1-1.
+       
+2000-09-05 21:40  jesse
+
+       * bin/mason_handler.fcgi:
+
+       file mason_handler.fcgi was initially added on branch rt-1-1.
+       
+2000-09-05 21:40  jesse
+
+       * Makefile, bin/mason_handler.fcgi, bin/testdeps.pl,
+       lib/RT/Handle.pm:
+
+       Updated testdeps to ask for the new version of mailtools
+       Added in the new fastcgi handler (not working yet)
+       and RT::Handle, which is a wrapper for SearchBuilder::Handle
+       
+2000-09-04 22:52  jesse
+
+       * Makefile, TODO, bin/rtmux.pl, bin/webmux.pl, etc/config.pm,
+       lib/RT/Record.pm, lib/RT/User.pm, lib/RT/Interface/Web.pm,
+       webrt/Ticket/Display.html, webrt/Ticket/Elements/ShowRequestor,
+       webrt/Ticket/Elements/TicketToolBox:
+
+       A couple of bugfixes related to the switch to SearchBuilder.
+       A few webui cleanups.
+       A bit of abstraction to make the eventual fastcgi port easier.
+       
+2000-09-04 12:48  jesse
+
+       * bin/testdeps.pl, lib/RT/Attachments.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, lib/RT/Watcher.pm, lib/RT/Watchers.pm,
+       lib/RT/Interface/Web.pm, webrt/Ticket/Elements/ShowDates:
+
+       Several batched updates from when pallas was off-net
+       
+       UpdateTold changed to SetTold.
+       A bunch of work to get Scrips working.
+       Lots more POD in Ticket.pm
+       Transaction->Describe  is better about printing what really happened.
+       Attachments.pm had a typo that prevented it from dealing with multipart messages.
+       
+2000-08-31 02:18  jesse
+
+       * Makefile, NEWS, etc/suidrt.c:
+
+       Added ENV squashing to suidrt.c
+       
+2000-08-30 14:46  jesse
+
+       * bin/rtmux.pl:
+
+       Rolling in some oracle changes...they're not done yet, but nothing should
+       break with mysql. fixed a typo in rtmux.pl that was introduced with the switch to searchbuilder.
+       
+2000-08-29 17:02  jesse
+
+       * README, bin/rtmux.pl, bin/testdeps.pl, bin/webmux.pl,
+       lib/RT/EasySearch.pm, lib/RT/Record.pm:
+
+       MAJOR CHANGE: Switched to the new name of the DBIx:: modules.
+       We now use DBIx::SearchBuilder rather than DBIx::EasySearch and friends.
+       Note that this is only a name and structure change for the module set.
+       The functionality is the same...though seperating out oracle and mysql
+       specific features comes soon.
+       
+2000-08-29 16:57  jesse
+
+       * etc/schema.Oracle:
+
+       updated the schema.Oracle
+       
+2000-08-29 02:02  jesse
+
+       * webrt/: Elements/SelectWatcherType, Ticket/EditWatchers.html,
+       Ticket/Update.html:
+
+       Started hacking on watchers and ticket update webui a bit.
+       they need a lot more work
+       
+2000-08-29 01:51  jesse
+
+       * webrt/Ticket/: Display.html, DisplayHistory, DisplayTransaction,
+       Elements/ShowHistory, Elements/ShowTransaction:
+
+       Made FullHeaders/BriefHeaders work in the webui
+       
+2000-08-28 01:46  jesse
+
+       * webrt/Admin/Elements/: CreateUserCalled, ModifyUser:
+
+       Fixed some display buglets from tobi oetiker
+       
+2000-08-28 01:31  jesse
+
+       * webrt/Ticket/Update.html:
+
+       Removed some text that harassed the user. that's generally bad policy
+       
+2000-08-27 23:56  jesse
+
+       * webrt/: Admin/Elements/Header, Admin/Elements/ModifyTemplate,
+       Admin/Elements/Tabs, Elements/ListActions, Elements/Tabs:
+
+       A few more added helper elements from the webui
+       
+2000-08-27 23:56  jesse
+
+       * webrt/Admin/Elements/Header:
+
+       file Header was initially added on branch rt-1-1.
+       
+2000-08-27 23:56  jesse
+
+       * webrt/: Admin/Elements/Tabs, Elements/Tabs:
+
+       file Tabs was initially added on branch rt-1-1.
+       
+2000-08-27 23:56  jesse
+
+       * webrt/Admin/Elements/ModifyTemplate:
+
+       file ModifyTemplate was initially added on branch rt-1-1.
+       
+2000-08-27 23:56  jesse
+
+       * webrt/Elements/ListActions:
+
+       file ListActions was initially added on branch rt-1-1.
+       
+2000-08-27 23:54  jesse
+
+       * webrt/Admin/Users/Prefs.html:
+
+       file Prefs.html was initially added on branch rt-1-1.
+       
+2000-08-27 23:54  jesse
+
+       * webrt/Admin/: Queues/Create.html, Users/Create.html:
+
+       file Create.html was initially added on branch rt-1-1.
+       
+2000-08-27 23:54  jesse
+
+       * webrt/Admin/: Queues/Modify.html, Users/Modify.html:
+
+       file Modify.html was initially added on branch rt-1-1.
+       
+2000-08-27 23:54  jesse
+
+       * webrt/Admin/: Queues/index.html, Users/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-08-27 23:54  jesse
+
+       * bin/webmux.pl, lib/RT/Area.pm, lib/RT/Areas.pm, lib/RT/Queue.pm,
+       lib/RT/ScripScopes.pm, lib/RT/Template.pm, lib/RT/Templates.pm,
+       webrt/Admin/CreateQueue.html, webrt/Admin/CreateUser.html,
+       webrt/Admin/EditUser.html, webrt/Admin/ModifyQueue.html,
+       webrt/Admin/ModifyUser.html, webrt/Admin/index.html,
+       webrt/Admin/Elements/CreateQueueCalled,
+       webrt/Admin/Elements/CreateUserCalled,
+       webrt/Admin/Elements/ModifyQueue, webrt/Admin/Elements/ModifyUser,
+       webrt/Admin/Elements/SelectModifyQueue,
+       webrt/Admin/Elements/SelectModifyUser,
+       webrt/Admin/Queues/Create.html, webrt/Admin/Queues/Modify.html,
+       webrt/Admin/Queues/index.html, webrt/Admin/Users/Create.html,
+       webrt/Admin/Users/Modify.html, webrt/Admin/Users/Prefs.html,
+       webrt/Admin/Users/index.html:
+
+       Lots of work on the web admin ui. basic user and queue editing working.
+       and template editing
+       
+2000-08-24 15:53  jesse
+
+       * Makefile, README, bin/rtmux.pl, etc/config.pm,
+       lib/RT/Action/SendEmail.pm, webrt/Elements/Footer,
+       webrt/Elements/Header, webrt/Elements/ViewUser,
+       webrt/Ticket/Elements/EditWatcherList:
+
+       The first cut at better configuration.
+       
+       Updated the readme
+       
+       Made the mail send routine in lib/RT/Action/Email.pm somewhat
+       more configurable (though we're still using printing to a pipe
+       because Mail::Mailer is busted :/)
+       
+       Most options moved out of the makefile..this will make packaging
+       possible.
+       
+       Fixed a couple places where tobias had been using a non-relative
+       url unnecessarily.
+       
+2000-08-22 03:08  jesse
+
+       * Makefile:
+
+       Getting version #s in sync for RT 1.3.15
+       
+2000-08-22 03:05  jesse
+
+       * lib/RT/: Scrip.pm, Transaction.pm, Action/AutoReply.pm,
+       Action/SendEmail.pm:
+
+       Work on making sure mail gets sent. It's not "right" yet but it's getting
+       closer.
+       
+2000-08-21 19:46  jesse
+
+       * webrt/autohandler:
+
+       Fixed a minor issue that let people "log in as ''"
+       
+2000-08-21 01:12  jesse
+
+       * bin/rtmux.pl, etc/config.pm, lib/RT/Ticket.pm, lib/RT/Tickets.pm:
+
+       Set a default type in ticket.pm
+       allowed restriction based on type in tickets.pm
+       
+       now set the timezone in the config file rather than the rtmux.
+       means it effects webmux.pl too.
+       
+2000-08-20 23:41  jesse
+
+       * etc/schema.mysql, lib/RT/Date.pm, webrt/Elements/SelectOwner:
+
+       Standardized StartsBy to Starts.
+       Removed a warning from SelectOwner
+       Fixed a bug in RT::Date->Set(Format => 'unknown')
+       
+2000-08-20 01:46  jesse
+
+       * lib/RT/Ticket.pm, webrt/Search/Listing.html,
+       webrt/Ticket/Elements/ShowMemberOf,
+       webrt/Ticket/Elements/ShowMembers:
+
+       Work on MemberOf and Members in Ticket.pm
+       they're both now Tickets objects rather than links objects.
+       and the things that use them have been updated
+       
+2000-08-19 03:03  jesse
+
+       * Makefile:
+
+       Bumped the version 1.3.14
+       
+2000-08-19 02:49  jesse
+
+       * README, etc/config.pm, lib/RT/Ticket.pm:
+
+       Did some work on logging. switched some carping to some logging.
+       
+2000-08-18 02:04  jesse
+
+       * Makefile, README:
+
+       Minor readme updates.
+       
+       Bumped the version to 1.3.13
+       
+2000-08-18 01:04  jesse
+
+       * lib/RT/Transaction.pm:
+
+       CurrentUser objects act on things. not user Objects.  Thanks, Jens
+       
+2000-08-17 23:55  jesse
+
+       * webrt/Elements/: SelectOwner, Submit:
+
+       notes in select owner. a bit of tweaking in submit ot make it more visible
+       
+2000-08-17 16:16  jesse
+
+       * Makefile:
+
+       Changes to rt-mailgate to properly respect authenticated users
+       when performing %RT RESOLVE commands.
+       
+2000-08-17 03:01  jesse
+
+       * lib/RT/Interface/Web.pm:
+
+       Missed a checkin on Web.pm. sorry about that
+       
+2000-08-17 02:53  jesse
+
+       * bin/webmux.pl, lib/RT/Database.pm, lib/RT/Date.pm,
+       lib/RT/Ticket.pm, lib/RT/Interface/Web.pm:
+
+       Yanked the ancient lib/RT/Database.pm. It  never served any purpose
+       added some functionality to RT::Date. it can now take a date type
+       of 'unknown.'  This will "require" Date::Manip and parse it into
+       an ISO style date.  note that this should NEVER be called from RT's
+       core due to overhead. It is useful from web interfaces and CLI tools....
+       
+       added date::manip as a requirement to webmux.pl (so it gets loaded before
+       client hits)
+       
+       cleaned up Interface/Web.pm
+       
+       rationalized some of the routines dealing with date stuff in ticket.pm.
+       
+       Actual working web date changing should be coming "soon." (where soon is
+       defined as sometime this week)
+       
+2000-08-16 14:46  jesse
+
+       * webrt/Elements/Submit:
+
+       file Submit was initially added on branch rt-1-1.
+       
+2000-08-16 14:46  jesse
+
+       * webrt/: Login.html, index.html, Elements/Footer, Elements/Header,
+       Elements/Submit, Ticket/Elements/ShowBasics,
+       Ticket/Elements/ShowTransaction:
+
+       Various bits of webui cleanup
+       
+2000-08-16 14:16  jesse
+
+       * lib/RT/: Tickets.pm, Interface/Email.pm:
+
+       We can now search for tickets by relationship
+       
+2000-08-16 13:18  jesse
+
+       * lib/RT/CurrentUser.pm:
+
+       the real oneline patch that should make rt-mailgate work for new users again.
+       
+2000-08-15 01:17  jesse
+
+       * lib/RT/: Tickets.pm, Interface/Web.pm:
+
+       The first round of convenience methods in RT/Tickets.pm
+       Still need to do the ticket relations methods and the
+       date methods
+       
+2000-08-14 23:47  jesse
+
+       * webrt/Elements/SelectDateType:
+
+       file SelectDateType was initially added on branch rt-1-1.
+       
+2000-08-14 23:47  jesse
+
+       * webrt/Elements/SelectDateType:
+
+       ack. missed this in the wackiness with tonight's earlier checkin.
+       
+2000-08-14 19:35  jesse
+
+       * webrt/: Elements/Header, Elements/SelectDate,
+       Elements/SelectQueue, Elements/TitleBoxStart, Search/Listing.html,
+       Search/PickRestriction:
+
+       The rest of the previous commit.
+       
+2000-08-14 19:27  jesse
+
+       * etc/config.pm, webrt/Login.html, webrt/Logout.html,
+       webrt/autohandler, webrt/index.html, webrt/webrt.css,
+       webrt/Ticket/autohandler, webrt/Ticket/Elements/ShowMemberOf,
+       webrt/Ticket/Elements/ShowMembers,
+       webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Cleaned up the ticket display a bit.
+       made logout actually properly erase session data
+       protected _everything_ with an autohandler in /
+       prettified Login.html
+       added some options to /Elements/TitleBoxHead...which seems to have been missed
+       
+2000-08-14 14:37  jesse
+
+       * README:
+
+       Added a warning about postmaster from JD
+       
+2000-08-13 21:57  jesse
+
+       * lib/RT/TicketCollection.pm, lib/RT/Tickets.pm,
+       lib/RT/Interface/Web.pm, webrt/Elements/SelectBoolean,
+       webrt/Elements/SelectDate, webrt/Elements/SelectMatch,
+       webrt/Elements/SelectOwner, webrt/Elements/SelectQueue,
+       webrt/Elements/SelectStatus, webrt/Elements/SelectWatcherType,
+       webrt/Search/Listing.html, webrt/Search/PickRestriction,
+       webrt/Search/TicketCell:
+
+       Significant work on the search and display code.
+       I'm not convinced that this doesn't introduce new bugs.
+       However, you can now search by ticket content.
+       
+       I will be reworking Tickets.pm a bit more to add a bunch of convenience methods
+       over then next week or so.
+       
+2000-08-12 18:07  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Fixed a bug in WatchersAsString. (RT::Watchers wasn't required early enough)
+       this whole routine needs to be redone :/
+       
+2000-08-12 18:06  jesse
+
+       * lib/RT/User.pm:
+
+       User->Create CanManipulate now defaults to 0.
+       
+2000-08-12 18:05  jesse
+
+       * etc/schema.mysql:
+
+       Updated the default user entries in schema.mysql to have the "CanManipulate"
+       flag set so they'd show up in owner lists.
+       
+2000-08-10 19:16  jesse
+
+       * README:
+
+       updated instructions for Apache install
+       
+2000-08-10 18:59  jesse
+
+       * etc/schema.mysql:
+
+       the queue values for the first queue were wrong
+       
+2000-08-10 17:55  jesse
+
+       * lib/RT/Ticket.pm:
+
+       BUGFIX: _UpdateTold now doesn't record a transaction, as things should be
+       
+2000-08-10 15:43  jesse
+
+       * etc/config.pm, etc/schema.Oracle, etc/schema.mysql,
+       lib/RT/Attachment.pm, lib/RT/Record.pm, lib/RT/Scrip.pm,
+       lib/RT/ScripScope.pm, lib/RT/Ticket.pm, lib/RT/TicketCollection.pm,
+       lib/RT/Tickets.pm, lib/RT/Transaction.pm, lib/RT/User.pm,
+       lib/RT/Action/AutoReply.pm, lib/RT/Action/Notify.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Interface/Web.pm,
+       webrt/autohandler, webrt/Elements/Error,
+       webrt/Elements/SelectStatus, webrt/Ticket/Update.html,
+       webrt/Ticket/Elements/ShowBasics,
+       webrt/Ticket/Elements/ShowDependencies,
+       webrt/Ticket/Elements/ShowMemberOf,
+       webrt/Ticket/Elements/ShowMembers,
+       webrt/Ticket/Elements/ShowPeople,
+       webrt/Ticket/Elements/ShowReferences,
+       webrt/Ticket/Elements/ShowRequestor,
+       webrt/Ticket/Elements/TicketToolBox:
+
+       Fixed ACL caching bugs
+       Finished adding status "new"
+       cli searching based on status works better.
+       
+       API Change. Queue is NO LONGER the Queue Object for a ticket
+       API Change. Owner is NO LONGER the Owner Object for a ticket
+       
+       instead, both point to their proper database values and OwnerObj and QueueObj
+       do the right thing throughout. This was rather more code churn than I was hoping for, but we've now got a cleaner, more consistent API that's easier to work
+       with.
+       
+       little bits of POD update.
+       
+       Cleaned out some unused code.
+       
+       Made some error messages more professional.
+       
+       We now keep track of date started as well as a "start by" date.  these both
+       need a bit more work.
+       
+       Calling convention for _Set changed. Rather than three different calling
+       conventions which weren't very extensible, DBIx::Record::_Set and all its
+       subclasses now use paramhash style calling. it's much more extensible and
+       flexible now. (This was necessary for some ACL work, among other things)
+       
+2000-08-09 01:11  jesse
+
+       * lib/RT/Record.pm, lib/RT/Ticket.pm, lib/RT/User.pm,
+       webrt/Elements/SelectStatus, webrt/Elements/dayMenu,
+       webrt/Elements/monthMenu, webrt/Elements/yearMenu:
+
+       ACL Decisions are now cached
+       date menus have a "never" option in the webui
+       added a new status. "new" for tickets that aren't yet open
+       
+2000-08-08 01:45  jesse
+
+       * etc/schema.mysql, lib/RT/Queue.pm:
+
+       schema updates.
+       fixed queue->Create
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/ModifyQueue.html:
+
+       file ModifyQueue.html was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/: CreateQueue.html, CreateUser.html,
+       ModifyQueue.html, ModifyUser.html, index.html,
+       Elements/CreateQueueCalled, Elements/CreateUserCalled,
+       Elements/ModifyQueue, Elements/ModifyUser,
+       Elements/SelectModifyQueue, Elements/SelectModifyUser:
+
+       Started the new web admin interface.
+       it can now edit queues and users and create queues and users
+       I'm fairly leery of its user handling stuff. particularly passwords
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/CreateUser.html:
+
+       file CreateUser.html was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/Elements/SelectModifyUser:
+
+       file SelectModifyUser was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/Elements/ModifyUser:
+
+       file ModifyUser was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/Elements/CreateUserCalled:
+
+       file CreateUserCalled was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/ModifyUser.html:
+
+       file ModifyUser.html was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/CreateQueue.html:
+
+       file CreateQueue.html was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/Elements/ModifyQueue:
+
+       file ModifyQueue was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/Elements/SelectModifyQueue:
+
+       file SelectModifyQueue was initially added on branch rt-1-1.
+       
+2000-08-08 01:44  jesse
+
+       * webrt/Admin/Elements/CreateQueueCalled:
+
+       file CreateQueueCalled was initially added on branch rt-1-1.
+       
+2000-08-07 22:28  jesse
+
+       * etc/schema.mysql, lib/RT/Date.pm, lib/RT/Ticket.pm,
+       lib/RT/Users.pm:
+
+       added a few ticket attributes for forwards compatibility
+       fixed another ACL problem in users.pm
+       fixed a date display bug
+       
+2000-08-07 01:03  jesse
+
+       * lib/RT/Transaction.pm, webrt/Ticket/Create.html,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Transaction.pm had some lingering ACL bugs ($CurrentUser) isn't a reasonable
+       global in core library routines :/
+       
+       Working on spawning subtickets.
+       
+2000-08-07 00:31  jesse
+
+       * webrt/User/Prefs.html:
+
+       file Prefs.html was initially added on branch rt-1-1.
+       
+2000-08-07 00:31  jesse
+
+       * webrt/Ticket/Elements/ShowDependencies:
+
+       file ShowDependencies was initially added on branch rt-1-1.
+       
+2000-08-07 00:31  jesse
+
+       * webrt/Ticket/Elements/ShowReferences:
+
+       file ShowReferences was initially added on branch rt-1-1.
+       
+2000-08-07 00:31  jesse
+
+       * webrt/Ticket/Elements/ShowMembers:
+
+       file ShowMembers was initially added on branch rt-1-1.
+       
+2000-08-07 00:31  jesse
+
+       * webrt/Ticket/Elements/ShowMemberOf:
+
+       file ShowMemberOf was initially added on branch rt-1-1.
+       
+2000-08-07 00:31  jesse
+
+       * webrt/Admin/EditUser.html:
+
+       file EditUser.html was initially added on branch rt-1-1.
+       
+2000-08-07 00:31  jesse
+
+       * webrt/Admin/Elements/EditUserComments:
+
+       file EditUserComments was initially added on branch rt-1-1.
+       
+2000-08-07 00:31  jesse
+
+       * etc/config.pm, lib/RT/Ticket.pm, webrt/EditUserComments.html,
+       webrt/ViewUser.html, webrt/webrt.css, webrt/Admin/EditUser.html,
+       webrt/Admin/ModifyUser, webrt/Admin/Elements/EditUserComments,
+       webrt/Elements/Error, webrt/Elements/Header,
+       webrt/Elements/SelectOwner, webrt/Ticket/Create.html,
+       webrt/Ticket/Create_Detail.html, webrt/Ticket/Display.html,
+       webrt/Ticket/Elements/EditWatcherList,
+       webrt/Ticket/Elements/ShowDependencies,
+       webrt/Ticket/Elements/ShowMemberOf,
+       webrt/Ticket/Elements/ShowMembers,
+       webrt/Ticket/Elements/ShowPeople,
+       webrt/Ticket/Elements/ShowReferences,
+       webrt/Ticket/Elements/ShowSummary, webrt/User/Prefs.html:
+
+       Did a bunch of work on the webui. cleaned up a lot of the link display stuff
+       did some work on ticket create
+       
+       dependencies and subtickets are now listed in the ticketview. yay!
+       
+2000-08-05 19:47  jesse
+
+       * lib/RT/Ticket.pm, webrt/Ticket/Elements/ShowSummary:
+
+       more Nobody fixes in Ticket.pm
+       justification fixes in ShowSummary
+       
+2000-08-05 18:50  jesse
+
+       * webrt/Ticket/ProcessUpdate.html:
+
+       The webui can now process updates.
+       it needed YA currentuser fix
+       
+2000-08-05 18:43  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Ticket::Create(Owner =>  now takes either a user object or a userid.
+       and defaults to nobody.
+       
+2000-08-05 17:51  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+2000-08-05 17:49  jesse
+
+       * lib/RT/: Date.pm, Interface/Email.pm:
+
+       fixed a few more bugs in the mailgateway. it can create tickets now.
+       fixed an undefined default in the cli query
+       made the date routine not spit out a stupid warning
+       
+2000-08-05 17:21  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       fixed typos in the mailgate. thanks gary
+       
+2000-08-05 00:16  jesse
+
+       * Makefile, NEWS, webrt/Login.html, webrt/autohandler,
+       webrt/webrt.css:
+
+       little tweaks to the webui.
+       bumped the version to 1.3.11 for distribution
+       
+2000-08-04 18:45  jesse
+
+       * README, bin/rtmux.pl, bin/webmux.pl, lib/RT/Areas.pm,
+       lib/RT/Attachments.pm, lib/RT/Date.pm, lib/RT/Link.pm,
+       lib/RT/Links.pm, lib/RT/Queue.pm, lib/RT/Queues.pm,
+       lib/RT/Record.pm, lib/RT/ScripScopes.pm, lib/RT/Scrips.pm,
+       lib/RT/Template.pm, lib/RT/Ticket.pm, lib/RT/Tickets.pm,
+       lib/RT/Transaction.pm, lib/RT/Transactions.pm, lib/RT/Users.pm,
+       lib/RT/Watchers.pm, lib/RT/Interface/Web.pm,
+       webrt/Admin/ModifyUser, webrt/Elements/SelectOwner,
+       webrt/Elements/SelectQueue, webrt/Elements/ViewUser,
+       webrt/Ticket/Display.html, webrt/Ticket/LinkIt.html,
+       webrt/Ticket/Elements/ShowPeople:
+
+       When creating an object, you ALWAYS need to pass in the current user
+       or acls break. we were a bit too lax about this before.
+       
+       this was a major round of bugfixing for the webui
+       
+2000-08-04 15:41  jesse
+
+       * Makefile, lib/RT/CurrentUser.pm, lib/RT/User.pm, webrt/webrt.css,
+       webrt/Elements/Header, webrt/Search/Listing.html,
+       webrt/Search/autohandler, webrt/Ticket/autohandler:
+
+       Queue listing doesn't have that ugly blue any more. And its code for
+       setting row color is a bit cleaner.
+       
+       we now actually _check_ passwords for web logins.
+       
+       webrt.css now has slightly darker hyperlinks.
+       
+       CurrentUser->IsPassword now uses the UserObj
+       
+       users can't use null passwords for authentication.
+       
+2000-08-03 02:19  jesse
+
+       * lib/RT/Interface/Web.pm, webrt/Elements/ShadedBox,
+       webrt/Elements/TitleBoxStart:
+
+       misc fixes to the webui and a leftover fix to the cli.
+       
+       the webui needs to have some of its internals gutted and
+       put back together. it feels very kludgy and not really "planned"
+       
+2000-08-03 02:04  jesse
+
+       * lib/RT/: Record.pm, Scrip.pm, Ticket.pm, Tickets.pm,
+       Transaction.pm, Action/SendEmail.pm:
+
+       made status changes work. (RT::Action::SendEmail was being stupid
+       and not error checking until it was too late)
+       
+       removed more use of hardwired SQL "now()"
+       
+       moved the handling of LastUpdated into RT::Record. from DBIx::Record
+       
+2000-08-03 01:09  jesse
+
+       * lib/RT/Queue.pm:
+
+       fixed a bug in the cli that kept ticket creates from working.
+       queue->hasright's calling convention changed.
+       
+2000-08-03 00:59  jesse
+
+       * Makefile:
+
+       fixed a makefile typo. added back the comment about pg
+       
+2000-08-03 00:42  jesse
+
+       * docs/design_docs/users:
+
+       file users was initially added on branch rt-1-1.
+       
+2000-08-03 00:42  jesse
+
+       * etc/user.Oracle:
+
+       file user.Oracle was initially added on branch rt-1-1.
+       
+2000-08-03 00:42  jesse
+
+       * etc/schema.Oracle:
+
+       file schema.Oracle was initially added on branch rt-1-1.
+       
+2000-08-03 00:42  jesse
+
+       * bin/initacls.Oracle, bin/initdb.Oracle, docs/README.oracle,
+       docs/design_docs/users, etc/schema.Oracle, etc/user.Oracle:
+
+       A first cut at oracle support from Dave Morgan <dmorgan@bartertrust.com>.
+       It is pretty much untested and guaranteed to break. Among other
+       things, the schema isn't current. but it's a start.
+       Thanks, Dave!
+       
+2000-08-03 00:42  jesse
+
+       * docs/README.oracle:
+
+       file README.oracle was initially added on branch rt-1-1.
+       
+2000-08-03 00:42  jesse
+
+       * bin/initacls.Oracle:
+
+       file initacls.Oracle was initially added on branch rt-1-1.
+       
+2000-08-03 00:42  jesse
+
+       * bin/initdb.Oracle:
+
+       file initdb.Oracle was initially added on branch rt-1-1.
+       
+2000-08-03 00:31  jesse
+
+       * docs/design_docs/local_hacking:
+
+       file local_hacking was initially added on branch rt-1-1.
+       
+2000-08-03 00:31  jesse
+
+       * HACKING, Makefile, docs/FAQ.html, docs/actions.html,
+       docs/admin.html, docs/attributes.html, docs/outline.html,
+       docs/rt_users_guide.html, docs/design_docs/local_hacking:
+
+       doc updates. removed outdated 1.x docs
+       
+2000-08-02 23:53  jesse
+
+       * etc/config.pm:
+
+       added some comments from tobias
+       
+2000-08-02 00:20  jesse
+
+       * Makefile, NEWS, TODO, etc/config.pm, etc/schema.mysql,
+       lib/RT/ACE.pm, lib/RT/ACL.pm, lib/RT/CurrentUser.pm,
+       lib/RT/Date.pm, lib/RT/Queue.pm, lib/RT/Record.pm,
+       lib/RT/Ticket.pm, lib/RT/Tickets.pm, lib/RT/User.pm,
+       lib/RT/Interface/Email.pm:
+
+       
+       Weekend of 1 Aug 2000
+       ---------------------
+       I spent the weekend in DC visiting family.   This meant I got a bit of
+       code written ;)  Sadly, I have no access to the CVS server,
+       so I'll be batching a bunch of commits.
+       
+       1. Enabled CLI admin tool
+       2. Added ACL listing functionality to the CLI admin tool.
+       3. Enhanced RT::Queue->Grant such that it works with the structure of RT2
+          ACLs
+       4. Made the Logging framework actually log errors to STDERR.
+          (This makes debugging the CLI tools much easier. It also means
+           that the cli tools explain _why_ they're dying.)
+       5. Fully expunged use of Mysql's SQL keyword "now()". I'd have left this
+          stuff in, except mysql doesn't seem to deal well with the idea that the
+          entire world isn't one timezone.  On top of that, it doesn't seem to
+          have a way to force it into GMT mode that doesn't involve modifying init
+          scripts. *sigh*
+       6. Did a whole bunch more work on the ACL checking in RT::User
+       7. Wrote up some preliminary docs on local hacks to RT
+       8. Added in a routine to allow local canonicalization of email addresses
+       9. Added in the concept of "Disabled users"  To preserve RT2's database
+          Integrity, whacking user accounts would be a bad thing. So, instead,
+          we've got the concept of 'disabled' users. A disabled user fails ANY
+          ACL check, ANY password check and doesn't appear in any lists of ACLs.
+          (note that the lastmost statement isn't yet true)
+       
+       10. rtadmin user -enable and rtadmin user -disable now work.
+       11. ACLs are now enforced for many ticket related actions.
+           (this does mean that you'll want to insert some acls like those below)
+       
+       INSERT INTO ACL VALUES (1,0,'User','SuperUser','Queue',0);
+       INSERT INTO ACL VALUES (2,3,'User','CreateTicket','Queue',0);
+       INSERT INTO ACL VALUES (3,3,'User','ShowTicket','Ticket',0);
+       INSERT INTO ACL VALUES (4,3,'User','ShowTicketHistory','Ticket',0);
+       INSERT INTO ACL VALUES (6,3,'User','CreateTicket','Queue',1);
+       INSERT INTO ACL VALUES (7,3,'User','ModifyTicket','Ticket',1);
+       INSERT INTO ACL VALUES (8,1,'User','Superuser','System',0);
+       INSERT INTO ACL VALUES (9,0,'Everyone','Superuser','System',0);
+       
+2000-08-02 00:17  jesse
+
+       * bin/: rtmux.pl, testdeps.pl:
+
+       Bumped us up to requiring Log::Dispatch 1.6.
+       Cleaned up testdeps a bit. Now, you knwo it passes.
+       
+2000-07-27 03:01  jesse
+
+       * Makefile:
+
+       Bumped the version to 1.3.9
+       Rolled RT 1.3.9
+       
+2000-07-27 02:37  jesse
+
+       * lib/RT/Date.pm, lib/RT/Ticket.pm, webrt/Elements/ViewUser,
+       webrt/Ticket/Elements/ShowDates, webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction, bin/webmux.pl:
+
+       Fixed a bug with null due dates.
+       Made RT/Date deal with a time of -1 as "Never"
+       made html escaping on included entities on webrt default.
+       
+2000-07-27 02:01  jesse
+
+       * lib/RT/Date.pm:
+
+       file Date.pm was initially added on branch rt-1-1.
+       
+2000-07-27 02:01  jesse
+
+       * README, lib/RT/Date.pm, lib/RT/Record.pm, lib/RT/Ticket.pm,
+       bin/testdeps.pl:
+
+       Moved Date managment routines from DBIx::Record to RT::Record.
+       Initial Checkin of RT::Date, a lightweight Date object capable
+       of doing everything RT needs. Oh. and it's fully documented in POD.
+       
+       Converted RT::Record and RT::Ticket and the cli to use RT::Date instead
+       of Date::Kronos.  The CLI now feels _much_ zippier and code within
+       RT::Ticket is a bit easier to read.
+       
+2000-07-27 01:55  jesse
+
+       * etc/schema.mysql:
+
+       removed extraneous whitespace
+       
+2000-07-27 01:51  jesse
+
+       * lib/RT/Attachment.pm:
+
+       changed the header on attachment.pm
+       
+2000-07-24 10:17  tobiasb
+
+       * lib/RT/Interface/Web.pm, webrt/ViewUser.html,
+       webrt/Search/TicketCell, webrt/Ticket/Display.html,
+       webrt/Ticket/ProcessUpdate.html, webrt/Ticket/Update.html:
+
+       Moved some things to Web.pm, made some nifty options for getting tickets from the listing in a new window
+       
+2000-07-24 06:56  tobiasb
+
+       * lib/RT/User.pm:
+
+       Some TODOs
+       
+2000-07-24 06:54  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       Some comments and TODOs.
+       
+       I fixed one simple TODO about putting in pid + rand into the name of
+       the temp directory needed for parsing the mime entity.
+       
+2000-07-24 00:52  jesse
+
+       * lib/RT/User.pm:
+
+       Added a few comments where they really should be
+       
+2000-07-24 00:48  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       Did a bunch of cleanup work on Interface/Email.pm
+               It could still use more.
+       
+2000-07-23 03:50  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Added the method 'TimeWorkedAsString'.  Ok, I'll start looking into Date::Kronos shortly :)
+       
+2000-07-22 20:10  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       [no log message]
+       
+2000-07-22 20:05  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       Inserted a reference to [fsck 290] in a TODO-comment.
+       
+2000-07-22 13:06  tobiasb
+
+       * lib/RT/Interface/Web.pm, webrt/Search/Listing.html:
+
+       Moved stuff from Listing.html to Web.pm, sub ProcessSearchQuery (suggestions to a better name for the sub?)
+       
+2000-07-21 15:11  tobiasb
+
+       * lib/RT/Ticket.pm, lib/RT/Interface/Web.pm,
+       webrt/Search/Listing.html:
+
+       bugfixing
+       
+2000-07-21 11:09  tobiasb
+
+       * etc/schema.mysql:
+
+       Bugfix
+       
+2000-07-21 10:57  tobiasb
+
+       * webrt/index.html:
+
+       Now it's possible to select queue from the start page
+       
+2000-07-21 10:35  tobiasb
+
+       * lib/RT/Attachment.pm, lib/RT/Ticket.pm, webrt/Elements/Header,
+       webrt/Elements/SelectOwner, webrt/Ticket/Elements/EditWatcherList:
+
+       bugfixes, comments.  I restricted the Owner-list to those that CanManipulate - this should eventually go away when we have proper access control.  Tiny improvement of EditWatcherList - it's now possible to edit user information if the user is found.
+       
+2000-07-21 05:48  tobiasb
+
+       * lib/RT/CurrentUser.pm:
+
+       bugfix
+       
+2000-07-21 00:08  jesse
+
+       * lib/RT/ACE.pm, lib/RT/Attachment.pm, lib/RT/Queue.pm,
+       lib/RT/Ticket.pm, lib/RT/User.pm, webrt/EditUserComments.html:
+
+       Cleaned up language in EditUserComments
+       
+       did work on watchers in ui/cli/admin and Ticket.pm and User.pm
+       cleaned up code in Ticket.pm
+       
+       Start of some work on acls in Queue.pm
+       
+2000-07-20 22:13  tobiasb
+
+       * lib/RT/Interface/Web.pm, webrt/Elements/SelectWatcherType,
+       webrt/Ticket/Display.html, webrt/Ticket/EditWatchers.html,
+       webrt/Ticket/Elements/EditWatcherList,
+       webrt/Ticket/Elements/ShowHistory, webrt/Ticket/Elements/ShowLinks,
+       webrt/Ticket/Elements/TicketToolBox:
+
+       Some code improvements, added one popular demand here; to avoid spending too much time clicking around, it should be possible to show all histoies of member requests at the same page.
+       
+2000-07-20 18:31  tobiasb
+
+       * lib/RT/CurrentUser.pm:
+
+       Fixing a bit.  Please try to remember to test code before committing
+       it :)
+       
+2000-07-20 18:09  tobiasb
+
+       * webrt/Ticket/ProcessUpdate.html:
+
+       once more I've committed without testing..
+       
+2000-07-20 18:02  tobiasb
+
+       * lib/RT/CurrentUser.pm:
+
+       Removed a compile-time bug
+       
+2000-07-20 17:48  tobiasb
+
+       * lib/RT/User.pm:
+
+       bugfix
+       
+2000-07-20 17:39  tobiasb
+
+       * etc/config.pm, lib/RT/Ticket.pm, lib/RT/User.pm,
+       lib/RT/Watcher.pm, lib/RT/Interface/Web.pm,
+       webrt/Ticket/Display.html:
+
+       bugfixes + conflict resolving at the signature + moved something to Web.pm from Display.html
+       
+2000-07-20 17:31  jesse
+
+       * lib/RT/: CurrentUser.pm, User.pm:
+
+       Culled some not-for-now signature stuff.
+       Cleaned up and optimised CurrentUser->UserObj
+       
+2000-07-20 16:39  jesse
+
+       * Makefile, NEWS:
+
+       doing some work for a customer.  rt-mailgate --help should tell you
+       about the fabulous new mail mode
+       
+2000-07-20 15:39  tobiasb
+
+       * lib/RT/Interface/Web.pm, webrt/Ticket/Display.html:
+
+       moving things from the template to Web.pm was not as straight-forwarded as I had hoped.
+       
+2000-07-20 15:20  tobiasb
+
+       * lib/RT/Attachment.pm, lib/RT/CurrentUser.pm, lib/RT/User.pm,
+       lib/RT/Interface/Web.pm, webrt/Ticket/Display.html:
+
+       Started moving stuff to Web.pm, fixed and tested signatures
+       
+2000-07-20 14:50  tobiasb
+
+       * lib/RT/: CurrentUser.pm, User.pm:
+
+       moved signature from currentuser to user (but does it make sense, anyway?  Signatures is something 'personal' that belongs only to the current user?)
+       
+2000-07-20 14:43  tobiasb
+
+       * webrt/ViewUser.html:
+
+       bugfix ... hmpf, always test before committing .. always test before committing ...
+       
+2000-07-20 14:33  tobiasb
+
+       * lib/RT/Interface/Web.pm, webrt/ViewUser.html:
+
+       bugfix
+       
+2000-07-20 14:11  tobiasb
+
+       * lib/RT/Interface/Web.pm:
+
+       file Web.pm was initially added on branch rt-1-1.
+       
+2000-07-20 14:11  tobiasb
+
+       * lib/RT/Interface/Web.pm:
+
+       I'm considering to move things from Display.html and ProcessUpdate.html to Web.pm.  Comments?
+       
+2000-07-20 14:06  jesse
+
+       * lib/RT/Watcher.pm:
+
+       Removed the bogus code frol lib/RT/Watcher.pm
+       
+2000-07-20 13:39  jesse
+
+       * lib/RT/User.pm:
+
+       reversed some bogus code
+       
+2000-07-20 11:44  tobiasb
+
+       * webrt/Ticket/Elements/EditWatcherList:
+
+       file EditWatcherList was initially added on branch rt-1-1.
+       
+2000-07-20 11:44  tobiasb
+
+       * webrt/Elements/SelectWatcherType:
+
+       file SelectWatcherType was initially added on branch rt-1-1.
+       
+2000-07-20 11:44  tobiasb
+
+       * webrt/: Elements/SelectWatcherType,
+       Ticket/Elements/EditWatcherList:
+
+       Now it's possible to edit ticket and queue watchers.  It's really horrible, but at least it works
+       
+2000-07-20 11:43  tobiasb
+
+       * webrt/Ticket/: EditWatchers.html, Update.html:
+
+       Small comment
+       
+2000-07-20 11:40  tobiasb
+
+       * webrt/Ticket/Update.html:
+
+       Linked in the 'edit watchers' functionality
+       
+2000-07-20 11:27  tobiasb
+
+       * lib/RT/Ticket.pm, lib/RT/Watcher.pm,
+       webrt/Ticket/EditWatchers.html:
+
+       Now it's possible to edit ticket and queue watchers.  It's really horrible, but at least it works
+       
+2000-07-20 11:27  tobiasb
+
+       * lib/RT/User.pm:
+
+       bugfix
+       
+2000-07-20 11:23  tobiasb
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       This is sort of a local hack, I guess it should be separated ... but maybe not.  if content-type =~ /^text/(?\!plain)/, there is now a link for 'view this as plain text', which might be useful for unknown text formats and for viewing 'code'
+       
+2000-07-20 02:59  jesse
+
+       * lib/RT/: ACE.pm, ACL.pm:
+
+       I'm committing ACE.pm and ACL.pm so people can get a bit of a taste of what I'm doing. They don't work, they probably don't even compile yet, but they're not getting called from the rest of the code yet.
+       
+       These aren't the droids you're looking for.
+       
+2000-07-20 02:58  jesse
+
+       * lib/RT/User.pm:
+
+       updated User.pm to match the schema
+       
+2000-07-19 16:45  tobiasb
+
+       * webrt/Ticket/EditWatchers.html:
+
+       file EditWatchers.html was initially added on branch rt-1-1.
+       
+2000-07-19 16:45  tobiasb
+
+       * webrt/Ticket/EditWatchers.html:
+
+       This should be a template for adding and removing watchers; will be completed tomorrow
+       
+2000-07-19 16:10  tobiasb
+
+       * webrt/: Logout.html, ViewUser.html, Search/Listing.html,
+       Ticket/Display.html, Ticket/Update.html,
+       Ticket/Elements/ShowPeople, Ticket/Elements/ShowSummary:
+
+       It's now possible to edit user data (realname, userid, email) from the web ui
+       
+2000-07-19 16:04  tobiasb
+
+       * lib/RT/: CurrentUser.pm, Ticket.pm, Watcher.pm,
+       Interface/Email.pm:
+
+       Worked a bit with requestors; 1) if we already have a user object at the requestor, we should use it.  2) it should be possible to edit the users email without also updating the watcher email if those are the same.  3) if a user enters an email with a different from address, but can be identified as a previous user (by equal real name or other means of authentication), the email field in the watcher table should be used
+       
+2000-07-19 10:06  tobiasb
+
+       * webrt/Elements/Header:
+
+       bugfixing
+       
+2000-07-19 08:53  tobiasb
+
+       * webrt/webrt.css:
+
+       Our web designer didn't like red table borders
+       
+2000-07-19 08:52  tobiasb
+
+       * webrt/: Elements/Header, Search/Listing.html:
+
+       Fun #440: Popular wish: Fixed alternating colours at the lines in Listing.html
+       
+2000-07-19 07:41  tobiasb
+
+       * webrt/webrt.css:
+
+       oddline for use in Listing.html
+       
+2000-07-19 06:54  tobiasb
+
+       * webrt/Elements/Header:
+
+       nicer
+       
+2000-07-19 06:51  tobiasb
+
+       * webrt/: index.html, Elements/Header:
+
+       Fun #666; Form 'view bug #xxx' from display and the front page
+       
+2000-07-18 04:17  tobiasb
+
+       * etc/schema.mysql:
+
+       bug #286; two nines in schema.sql
+       
+2000-07-14 11:40  tobiasb
+
+       * webrt/Search/TicketCell:
+
+       I'm currently trying to fix it so that each user can put in options in the session information (or should it rather be in the DB?) about whether they want tickets to pop up in separate windows or not.
+       
+2000-07-14 10:47  tobiasb
+
+       * etc/schema.mysql, lib/RT/Link.pm, lib/RT/Ticket.pm,
+       lib/RT/Action/StallDependent.pm,
+       webrt/Ticket/Elements/TicketToolBox:
+
+       added a scrip for stalling members upon membership linking ... now it's impossible for a request to make a link to itself ... now it's possible to open a request from the ticket display
+       
+2000-07-14 09:29  tobiasb
+
+       * webrt/Ticket/ProcessUpdate.html:
+
+       TODO: Public comments are currently beeing threated as private
+       comments (that's better than it beeing ignored ... at least at the
+       moment)
+       
+       Now it skips trying to build a MIME entity if there are no message.
+       
+2000-07-14 09:11  tobiasb
+
+       * webrt/ViewUser.html:
+
+       Bugfix
+       
+2000-07-14 09:09  tobiasb
+
+       * webrt/Search/Listing.html:
+
+       Killed a warning
+       
+2000-07-13 13:31  tobiasb
+
+       * webrt/index.html:
+
+       Typo
+       
+2000-07-13 11:44  tobiasb
+
+       * webrt/Elements/Header:
+
+       huh?  seems like I've lost the control of CVS a bit today :)
+       
+2000-07-13 11:43  tobiasb
+
+       * webrt/Elements/Header:
+
+       [no log message]
+       
+2000-07-13 11:36  jesse
+
+       * webrt/index.html:
+
+       tobix missed a &>
+       
+2000-07-13 11:08  tobiasb
+
+       * webrt/: Search/RestrictSearch.html, Ticket/Display.html,
+       Ticket/ProcessUpdate.html, Ticket/Update.html:
+
+       Dealt with the footer; it does not need overriding anywhere, and is thus placed in the autohandler
+       
+2000-07-13 11:04  tobiasb
+
+       * webrt/: Logout.html, ViewUser.html, autohandler, index.html,
+       Elements/Header, Search/Listing.html, Ticket/Modify.html,
+       Ticket/ValidateUpdate.html:
+
+       Dealt with the header module; it's now in the .html templates, not in autohandler ... the title should be nice and informative in all the templates ... and the instance name is viewed along with the header
+       
+2000-07-13 07:26  tobiasb
+
+       * lib/RT/Link.pm, lib/RT/Ticket.pm, webrt/index.html,
+       webrt/Elements/SelectResultsPerPage, webrt/Search/Listing.html,
+       webrt/Search/PickRestriction:
+
+       small bugfix + better handling of LimitResultsOnPage
+       
+2000-07-12 14:09  tobiasb
+
+       * lib/RT/: Ticket.pm, Transaction.pm:
+
+       bugfix'es.  duplicated linking actions are now turned down.
+       
+2000-07-12 01:39  jesse
+
+       * etc/schema.mysql:
+
+       updated the schema for User objects. now they've got _even more_ data.
+       and better extension capabilities.
+       
+2000-07-12 00:10  tobiasb
+
+       * lib/RT/Attachment.pm, lib/RT/Scrip.pm, lib/RT/ScripScope.pm,
+       lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Action/StallDependent.pm,
+       webrt/Elements/SelectResultsPerPage, webrt/Elements/ViewUser,
+       webrt/Ticket/Create.html, webrt/Ticket/Elements/ShowTransaction:
+
+       Debugged a bit and removed some critical bugs
+       
+2000-07-11 14:43  tobiasb
+
+       * webrt/Elements/ViewUser:
+
+               <% $User->Comments || "No comment entered about this user" |h %>
+       
+       "|h" seems like some random noise, or have I misunderstood something?
+       
+2000-07-11 12:19  tobiasb
+
+       * etc/schema.mysql:
+
+       Comments
+       
+2000-07-11 11:30  tobiasb
+
+       * lib/RT/Transaction.pm, lib/RT/Action/AutoReply.pm,
+       webrt/Logout.html, webrt/ViewUser.html:
+
+       more debug logging + some bugfixing (exception handling)
+       
+2000-07-10 20:09  jesse
+
+       * bin/testdeps.pl, etc/schema.mysql, lib/RT/Ticket.pm:
+
+       work on ACLs. some acl decisions are now made.
+       
+2000-07-10 17:13  jesse
+
+       * etc/schema.mysql, lib/RT/ACL.pm, lib/RT/CurrentUser.pm,
+       lib/RT/Queue.pm, lib/RT/Record.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, lib/RT/User.pm, lib/RT/Interface/Email.pm,
+       webrt/Ticket/Display.html:
+
+       Wow. all kinds of work.
+       
+       Beginning of implementation of ACLs. lots of code cleanup.
+       
+       schema changes for Groups and Acls.
+       
+       we now use MIMEObj EVERYWHERE instead of MIMEEntity.
+       
+2000-06-29 20:36  jesse
+
+       * Makefile:
+
+       bumped to 1.0.4pre2
+       fixed perms issue for lib/templates
+       
+2000-06-29 16:11  jesse
+
+       * Makefile, etc/schema:
+
+       makefile fixes. bump to 1.0.4pre1
+       schema.mysql has a longer phone number field
+       
+2000-06-26 15:35  jesse
+
+       * README:
+
+       [no log message]
+       
+2000-06-26 15:10  jesse
+
+       * Makefile, bin/rtmux.pl, bin/testdeps.pl:
+
+       added Date::Manip to testdeps.pl
+       set $ENV{'TZ'} in bin/rtmux.pl to deal with a bug in Date::Manip
+       bumped the version to 1.3.8
+       
+2000-06-26 14:38  jesse
+
+       * bin/testdeps.pl:
+
+       added Date::Kronos to testdeps.pl
+       
+2000-06-26 14:36  jesse
+
+       * bin/testdeps.pl:
+
+       added Time::Seconds to testdeps.pl
+       
+2000-06-26 14:31  jesse
+
+       * bin/testdeps.pl, webrt/autohandler, webrt/webrt.css,
+       webrt/Elements/ViewUser, webrt/Ticket/Elements/ShowTransaction:
+
+       various hacking for RTCon pilsen. a much enhanced testdeps.pl
+       
+2000-06-16 10:51  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       some commentary.
+       
+2000-06-16 08:57  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       Sort of a bugfix
+       
+2000-06-16 08:56  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       Removed some old garbage
+       
+       TODO: Fix message trailer
+       
+2000-06-16 04:37  tobiasb
+
+       * lib/RT/: Attachment.pm, Record.pm, Ticket.pm, Transaction.pm:
+
+       It's no longer mandatory to have a Creator in every RT table.  It's just to set them 'read/auto'-accessible.  This should fix bug #275
+       
+2000-06-15 16:43  tobiasb
+
+       * etc/config.pm, lib/RT/Attachment.pm, lib/RT/Link.pm,
+       lib/RT/Ticket.pm, webrt/Elements/MessageBox,
+       webrt/Ticket/Display.html, webrt/Ticket/LinkIt.html,
+       webrt/Ticket/ProcessUpdate.html, webrt/Ticket/Update.html,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       some few bugfixes + some work to get 'reply-linking' working.  In my local version of RT (only changes in the config.pm) people can now enter a 'FAQ-tag', and the right article from KB is automaticly inserted in the reply.
+       
+2000-06-15 12:22  tobiasb
+
+       * webrt/ViewUser.html:
+
+       file ViewUser.html was initially added on branch rt-1-1.
+       
+2000-06-15 12:22  tobiasb
+
+       * lib/RT/Attachment.pm, lib/RT/CurrentUser.pm, lib/RT/Ticket.pm,
+       lib/RT/User.pm, lib/RT/Interface/Email.pm, webrt/ViewUser.html,
+       webrt/autohandler, webrt/Elements/Error, webrt/Elements/Footer,
+       webrt/Elements/Header, webrt/Elements/ViewUser,
+       webrt/Ticket/ProcessUpdate.html, webrt/Ticket/Update.html,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       lots of bugfixes and some enhancements:
+       - signature in replies
+       - Creator, LastUpdated etc. should be updated in User.pm
+       - The message headers of inbound requests is now decoded ... this is
+         some sort of a hack as it discards charset information in the header.
+         Anyway, in those cases where the header data will be in the same charset
+         as the body, this works out nicely.
+       - I'm allowing a user to see what data is stored at him.  We might need ACLs
+         for the user comment.  Also, this one is placed directly on the root, so
+         it will break if the user is not logged in.  Also, the page and the module
+         is 'ViewUser', 'ShowUser' would be more consistent.
+       - Prettified the ShowTransaction header
+       
+2000-06-15 09:02  tobiasb
+
+       * etc/schema.mysql:
+
+       Added "Signature" to the Users table and worked a bit at the comments
+       
+2000-06-14 09:24  tobiasb
+
+       * lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       webrt/Ticket/Display.html, webrt/Ticket/Elements/TicketToolBox:
+
+       Tons of minor bugfixes and enhancements
+       
+2000-06-14 09:19  tobiasb
+
+       * etc/schema.mysql:
+
+       Added this:
+       
+       ##TODO: Get Notify.pm to support OldOwner + fix a template
+       #INSERT INTO Scrips VALUES (20, 'NotifyOldOwnerOnSteal',
+       #                         'Sends mail to the old owner when the ticket is stolen',
+       #                         'Steal','Notify',10,'OldOwner',1,NULL,1,NULL);
+       
+2000-06-14 06:54  tobiasb
+
+       * etc/schema.mysql, lib/RT/Attachment.pm, lib/RT/Record.pm,
+       lib/RT/Ticket.pm, webrt/Ticket/Display.html,
+       webrt/Ticket/Elements/ShowDates:
+
+       minor enhancements and bugfixes
+       
+2000-06-14 03:30  tobiasb
+
+       * etc/schema.mysql:
+
+       I just noticed that Jesse already had a 'resolution' attribute in the ticket.  I guess that covers the same as my 'state' attribute
+       
+2000-06-14 00:12  tobiasb
+
+       * lib/RT/Attachment.pm, webrt/Elements/ViewUser,
+       webrt/Search/Listing.html, webrt/Search/PickRestriction,
+       webrt/Ticket/Elements/ShowDates:
+
+       Some enhancements and bugfixes
+       
+2000-06-13 23:26  tobiasb
+
+       * webrt/Ticket/Elements/ShowDates:
+
+       improved
+       
+2000-06-13 20:42  tobiasb
+
+       * etc/schema.mysql:
+
+       Bugfix
+       
+2000-06-13 15:53  tobiasb
+
+       * lib/RT/TicketCollection.pm, webrt/Search/Listing.html:
+
+       Trying to get search on requestor to work - unsuccessful so far :/
+       
+2000-06-13 10:23  tobiasb
+
+       * webrt/: autohandler, Ticket/Display.html,
+       Ticket/Elements/TicketToolBox:
+
+       Some bugfixes
+       
+2000-06-13 06:41  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Bugfix
+       
+2000-06-09 14:43  tobiasb
+
+       * webrt/EditUserComments.html:
+
+       Hm, aaaalways check if everything is working before committing.  Argh.
+       
+2000-06-09 14:30  tobiasb
+
+       * webrt/: EditUserComments.html, autohandler, Elements/Error,
+       Elements/ViewUser:
+
+       added a minimum interface for editing comments about users
+       
+2000-06-09 12:53  tobiasb
+
+       * webrt/Ticket/Elements/ShowRequestor:
+
+       file ShowRequestor was initially added on branch rt-1-1.
+       
+2000-06-09 12:53  tobiasb
+
+       * webrt/Elements/ViewUser:
+
+       file ViewUser was initially added on branch rt-1-1.
+       
+2000-06-09 12:53  tobiasb
+
+       * webrt/EditUserComments.html:
+
+       file EditUserComments.html was initially added on branch rt-1-1.
+       
+2000-06-09 12:53  tobiasb
+
+       * etc/schema.mysql, lib/RT/Ticket.pm, lib/RT/User.pm,
+       lib/RT/Users.pm, lib/RT/Watcher.pm, lib/RT/Interface/Email.pm,
+       webrt/EditUserComments.html, webrt/Elements/ViewUser,
+       webrt/Ticket/ProcessUpdate.html, webrt/Ticket/Elements/ShowPeople,
+       webrt/Ticket/Elements/ShowRequestor,
+       webrt/Ticket/Elements/ShowSummary:
+
+       added a large section in the ticket view for earlier requests (stubbed) by the same requestor and comments about the requestor (the interface for editing those comments are stubbed)
+       
+2000-06-09 04:32  tobiasb
+
+       * etc/schema.mysql:
+
+       Added "Lang" to the users table
+       
+2000-06-08 10:17  tobiasb
+
+       * etc/config.pm, etc/schema.mysql, lib/RT/Ticket.pm,
+       webrt/Elements/SelectMatch, webrt/Ticket/Display.html,
+       webrt/Ticket/Elements/TicketToolBox:
+
+       Added 'UpdateTold' sub to Tickets.  Some minor bugfixes and enhancements.  Not much testing done.
+       
+2000-06-08 08:19  tobiasb
+
+       * lib/RT/Ticket.pm, lib/RT/Transaction.pm, lib/RT/Watcher.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Interface/Email.pm,
+       webrt/Ticket/Update.html:
+
+       A bit of debugging, and I managed to remove some annoying warnings
+       
+2000-06-08 08:10  tobiasb
+
+       * etc/schema.mysql:
+
+       bugfix
+       
+2000-06-08 07:59  tobiasb
+
+       * etc/schema.mysql:
+
+       Removed the area in one template.
+       
+2000-06-08 07:55  tobiasb
+
+       * etc/schema.mysql:
+
+       # I think it might make sense replacing "TIMESTAMP" with "DATETIME"
+       # for mysql.  Yes, indeed, I'll do that right away.
+       
+2000-06-08 06:53  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Removed some redundant lines.
+       
+2000-06-08 06:38  tobiasb
+
+       * etc/schema.mysql:
+
+       Inserted table AlternateEmails (commented out as for now).
+       
+       One bugfix (typo) in the ACL table.
+       
+2000-06-08 06:31  tobiasb
+
+       * etc/schema.mysql:
+
+       Grouped into folders
+       
+2000-06-08 05:47  tobiasb
+
+       * lib/RT/Attachment.pm, lib/RT/Ticket.pm, webrt/Login.html,
+       webrt/Search/Listing.html, webrt/Ticket/ProcessUpdate.html,
+       webrt/Ticket/Elements/ShowTransaction,
+       webrt/Ticket/Elements/TicketToolBox:
+
+       bugfixes + improvements requested from the support team; kill & take link from the front page, table borders in listing, reduced header printing ...
+       
+2000-06-07 16:15  tobiasb
+
+       * lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       webrt/Elements/MessageBox, webrt/Ticket/Elements/ShowTransaction:
+
+       bugfixes
+       
+2000-06-07 15:46  tobiasb
+
+       * etc/schema.mysql:
+
+       bugfix
+       
+2000-06-07 15:42  tobiasb
+
+       * lib/RT/: Ticket.pm, Transaction.pm:
+
+       bugfixes
+       
+2000-06-07 15:22  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Now, if some Record decendant can _Accessible('Created', auto) and _Accessible('LastUpdated', auto), they will be set automaticly (at least, that's the theory)
+       
+2000-06-07 14:16  tobiasb
+
+       * etc/schema.mysql:
+
+       mysql autosets the first TIMESTAMP in the table on every
+       update/insert.
+       
+2000-06-07 12:33  tobiasb
+
+       * webrt/autohandler:
+
+       The error handling here seems to work now ... but only for documents
+       at the root.  I thought those autohandlers were called recursively?
+       
+2000-06-07 12:12  tobiasb
+
+       * etc/config.pm, lib/RT/Record.pm, lib/RT/Ticket.pm:
+
+       working with those pesky dates
+       
+2000-06-07 11:51  tobiasb
+
+       * bin/webmux.pl:
+
+       bugfix
+       
+2000-06-07 08:37  tobiasb
+
+       * README:
+
+       Added Date::Kronos (not on CPAN yet) to README
+       
+2000-06-07 08:17  tobiasb
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       Different Comment and Reply links.  They link to the same page, but the default
+       action is changed.
+       
+2000-06-07 07:36  tobiasb
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       Now it doesn't display looooong text/plain attachments.
+       
+       We have a lot of ~1M text/plain attachments in our RT queue.
+       
+       I'm trying to hack my webrt.cgi to show attachments upon a
+       "PickUpTransaction" parameter.  I don't know how to do it in the
+       mason/mod_perl model.
+       
+2000-06-07 04:09  tobiasb
+
+       * webrt/Elements/MessageBox:
+
+       bugfix
+       
+2000-06-06 18:44  jesse
+
+       * etc/schema.mysql:
+
+       removed an outdated table
+       
+2000-06-06 15:42  jesse
+
+       * webrt/Login.html:
+
+       changed the name of the mason package to RT::Mason, so it didn't conflict with other instances
+       on the same webserver
+       
+       fixed a couple of Log::Dispatch(warn)s to (warning)s
+       
+       removed tobix' weird session crunching code that was messign me up
+       
+2000-06-06 15:42  jesse
+
+       * etc/config.pm, lib/RT/Ticket.pm:
+
+       changed the name of the mason package to RT::Mason, so it didn't conflict with other instances
+       on the same webserver
+       
+       fixed a couple of Log::Dispatch(warn)s to (warning)s
+       
+2000-06-06 15:41  jesse
+
+       * bin/webmux.pl:
+
+       changed the name of the mason package to RT::Mason, so it didn't conflict with other instances
+       on the same webserver
+       
+       f
+       
+2000-06-06 15:41  jesse
+
+       * README:
+
+       changed the name of the mason package to RT::Mason, so it didn't conflict with other instances
+       on the same webserver
+       
+2000-06-06 14:40  tobiasb
+
+       * webrt/Ticket/: Update.html, Elements/TicketToolBox:
+
+       I'm trying to set default action in Update.html dependent on which link the
+       user clicked at (update, comment or reply).  I'll continue tomorrow (dinnertime
+       now :)
+       
+2000-06-06 14:11  tobiasb
+
+       * webrt/Ticket/ProcessUpdate.html:
+
+       bugfix
+       
+2000-06-06 13:48  jesse
+
+       * etc/config.pm:
+
+       changed Log::Dispatch::VERSION (1.2) which didn't work
+       to the more standard perl syntax:  use Log::Dispatch 1.2;
+       
+       \ed an @ that tobix left in rtmux.pl
+       
+2000-06-06 13:47  jesse
+
+       * bin/rtmux.pl:
+
+       \ed an @ that tobix left in rtmux.pl
+       
+2000-06-06 13:32  jesse
+
+       * Makefile:
+
+       :%s/        /   / in the makefile (convert spaces to tabs)
+       
+2000-06-06 13:15  tobiasb
+
+       * README:
+
+       Mostly doc changes
+       
+2000-06-06 11:36  tobiasb
+
+       * etc/config.pm:
+
+       bugfix
+       
+2000-06-06 11:15  tobiasb
+
+       * docs/FAQ:
+
+       Added some few tips
+       
+2000-06-06 11:05  tobiasb
+
+       * bin/rtmux.pl:
+
+       putted in some warnings about things that doesn't work
+       
+2000-06-06 04:21  tobiasb
+
+       * README:
+
+       added comments about DBMS'es
+       
+2000-06-05 16:54  tobiasb
+
+       * Makefile:
+
+       more bugfixes
+       
+2000-06-05 16:46  tobiasb
+
+       * Makefile:
+
+       bgfx
+       
+2000-06-05 14:01  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+2000-06-05 09:26  tobiasb
+
+       * README, etc/config.pm, etc/schema.mysql, webrt/autohandler:
+
+       done some documentation fixes
+       
+2000-06-05 07:14  tobiasb
+
+       * README:
+
+       updated the STATUS
+       
+2000-06-02 03:32  tobiasb
+
+       * etc/schema.mysql, lib/RT/Action/SendEmail.pm,
+       lib/RT/Interface/Email.pm, webrt/autohandler, webrt/Elements/Error:
+
+       bugfix
+       
+2000-06-01 23:28  tobiasb
+
+       * webrt/Ticket/Elements/TicketToolBox:
+
+       file TicketToolBox was initially added on branch rt-1-1.
+       
+2000-06-01 23:28  tobiasb
+
+       * etc/config.pm, etc/schema.mysql, lib/RT/Link.pm,
+       lib/RT/Ticket.pm, lib/RT/Action/SendEmail.pm,
+       lib/RT/Interface/Email.pm, webrt/autohandler, webrt/Elements/Error,
+       webrt/Elements/SelectOwner, webrt/Ticket/Create_Detail.html,
+       webrt/Ticket/Display.html, webrt/Ticket/ProcessUpdate.html,
+       webrt/Ticket/Update.html, webrt/Ticket/Elements/TicketToolBox:
+
+        ... better logging (logs a warning when it's dieing during an eval) ... maybe the URL in the mails will work now ... misc bugfixes ... some better foldings ... better error handling in the WebUI (not tested!  You should absolutely see this, I have a feeling it's unsmart.  Check autohandler and Elements/Error) ... misc features added (default values on selectowners now work, auto-fill-in of requestor on create, auto-fill-in of subject on spawn, viewing actions on the ProcessUpdate, ProcessUpdate fixed up a bit ... hm, that's it)
+       
+2000-06-01 20:54  tobiasb
+
+       * bin/testdeps.pl:
+
+       Added Text::Wrapper for quoting of wide messages
+       
+2000-06-01 20:50  tobiasb
+
+       * lib/RT/Transaction.pm, lib/RT/Action/StallDependent.pm,
+       lib/RT/Interface/Email.pm, webrt/Login.html,
+       webrt/Ticket/autohandler, webrt/Ticket/Elements/ShowLinks:
+
+       lots of bugfixes and minor enhancements
+       
+2000-06-01 02:58  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+2000-06-01 02:20  jesse
+
+       * Makefile, NEWS:
+
+       work on the web ui. cleanups to the comment and reply pages as well as the
+       queue view and the ticket detail page
+       
+2000-05-31 14:28  tobiasb
+
+       * etc/config.pm, webrt/Search/Listing.html,
+       webrt/Search/TicketCell, webrt/Ticket/Display.html:
+
+       Popular demand: A link for taking an action from the listing page (reduces the change for concurrency problems)
+       
+2000-05-31 13:59  tobiasb
+
+       * webrt/Search/autohandler:
+
+       Uh, some weird debugging stuff came into the last commit - I should
+       have checked better.
+       
+       Some of those autohandlers seems like copies of each other.  There
+       must be better ways to do this (i.e. separating all the common stuff
+       into some module)?
+       
+2000-05-31 13:52  tobiasb
+
+       * lib/RT/Transaction.pm, lib/RT/Interface/Email.pm,
+       webrt/Search/Listing.html, webrt/Search/PickRestriction,
+       webrt/Search/autohandler, webrt/Ticket/Display.html,
+       webrt/Ticket/Elements/ShowHistory:
+
+       popular demands; more navigation ({back to listing} and {last transaction}) and misc details
+       
+2000-05-31 12:20  tobiasb
+
+       * webrt/Elements/SelectMatch:
+
+       This one is plain ugly at the moment.  Anyway, it's ment for a more advanced 'regexp match / glob match / word match / substring match / total match'
+       
+2000-05-31 12:20  tobiasb
+
+       * webrt/Elements/SelectMatch:
+
+       file SelectMatch was initially added on branch rt-1-1.
+       
+2000-05-31 11:55  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       bugfix
+       
+2000-05-31 09:53  tobiasb
+
+       * webrt/: Elements/SelectStatus, Ticket/Update.html:
+
+       Some popular demands from the support dept;
+       
+       I've made it possible to kill by selecting status dead
+       
+       Response is the default action.  I've added a cryptical line which
+       might or might not give a warning.  Ideally, I guess we should do the comment /
+       reply selection through submit buttons rather than through a select menu - what
+       di you think?
+       
+2000-05-30 22:46  tobiasb
+
+       * etc/config.pm, lib/RT/Attachment.pm:
+
+       Ah ... I had forgotten signatures.  Some stubbed work, I'll continue tomorrow
+       
+2000-05-30 22:31  tobiasb
+
+       * lib/RT/Attachment.pm, lib/RT/Attachments.pm, lib/RT/Record.pm,
+       lib/RT/Ticket.pm, lib/RT/Transaction.pm, webrt/Login.html,
+       webrt/Elements/MessageBox, webrt/Search/Listing.html,
+       webrt/Ticket/autohandler, webrt/Ticket/Elements/ShowTransaction:
+
+       Quoting works now ... fixed some other misc details + bugfixes ... and I've moved the date handling to RT::Record, it will be completed tomorrow (I hopecvs diff -uw | less)
+       
+2000-05-30 20:31  tobiasb
+
+       * webrt/Ticket/Create_Detail.html:
+
+       Removed those annoying blink tags.. :)
+       
+2000-05-30 20:14  tobiasb
+
+       * webrt/: Elements/MessageBox, Ticket/Create_Detail.html:
+
+       Still working on that MessageBox
+       
+2000-05-30 20:09  tobiasb
+
+       * webrt/: Elements/MessageBox, Ticket/Update.html:
+
+       Separated out the MessageBox
+       
+2000-05-30 20:09  tobiasb
+
+       * webrt/Elements/MessageBox:
+
+       file MessageBox was initially added on branch rt-1-1.
+       
+2000-05-30 19:56  tobiasb
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       Changed <BLOCKQUOTE> to <pre> for the message content.
+       
+       TODO: We really should HTML'ify and/or HTML-escape the Content.
+       
+2000-05-29 06:59  tobiasb
+
+       * Makefile:
+
+       Some bugfixes, but absolutely not tested.
+       
+2000-05-26 12:11  tobiasb
+
+       * webrt/Search/Listing.html:
+
+       Now it runs /Elements/Header - I was a bit annoyed because it was missing Title
+       
+2000-05-26 10:11  tobiasb
+
+       * webrt/Ticket/Display.html:
+
+       Seems like I had introduced an error here
+       
+2000-05-24 21:50  jesse
+
+       * lib/RT/Ticket.pm, lib/RT/TicketCollection.pm, lib/RT/Tickets.pm,
+       webrt/Search/Listing.html, webrt/Ticket/Display.html:
+
+       Working on persistable web queries. Introduced RT::TicketCollection
+       Arguably this should be in RT::Tickets. and may be some day
+       
+2000-05-24 21:50  jesse
+
+       * lib/RT/TicketCollection.pm:
+
+       file TicketCollection.pm was initially added on branch rt-1-1.
+       
+2000-05-24 08:00  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       It should also be possible to "unlink" something (i.e. if a link was
+       wrongly set).  This is not implemented, but at least mails with
+       an "unlink" command will not bounce now.
+       
+2000-05-23 18:49  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       Made the transaction text from a link action a bit more readable,
+       though this still needs quite some work.
+       
+2000-05-23 16:57  jesse
+
+       * Makefile:
+
+       Bumped to 1.3.7
+       
+2000-05-23 10:12  tobiasb
+
+       * etc/config.pm, lib/RT/Link.pm, lib/RT/Ticket.pm,
+       lib/RT/Interface/Email.pm, webrt/Ticket/Display.html:
+
+       I've started looking at the mail interface.  Now linking works through the mailgate, though we need some info in the docs.  I'm proposing that it should accept both commands in the headerlines ("RT-Command: Link/Resolve/Whatever blahblah") and traditional commands in the mail ("%RT Link", "%RT Resolve", etc), though I've only supported the first one yet.  Look at the comments in Email.pm for details.
+       
+2000-05-23 10:04  tobiasb
+
+       * lib/RT/Scrip.pm:
+
+       Bugfix/optimalization or something?
+       
+2000-05-22 19:09  tobiasb
+
+       * lib/RT/Ticket.pm, webrt/Ticket/Create_Detail.html,
+       webrt/Ticket/Display.html, webrt/Ticket/LinkIt.html:
+
+       I'm not very happy about some comprimises, choises and short-cuts I've done here, but anyway linking & spawning seems to work now.
+       
+2000-05-22 18:05  tobiasb
+
+       * lib/RT/Transaction.pm, lib/RT/Action/AutoReply.pm,
+       webrt/Ticket/Create.html, webrt/Ticket/Create_Detail.html,
+       webrt/Ticket/Display.html, webrt/Ticket/LinkIt.html:
+
+       all changes here are either related to getting the Create working from the web, or harmless details
+       
+2000-05-22 17:39  tobiasb
+
+       * webrt/Ticket/Display.html:
+
+       $Subject => $Subject||(no subject given)
+       
+       TODO: HTML-escape
+       
+2000-05-22 17:38  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Removed VerboseSubject and HTMLSubject
+       
+2000-05-22 17:24  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       I do use $Ticket->Subject (and other stuff as well) frequently when
+       I'm editing Mason.  There is two issues;
+       
+       1) Things might look freaked if the ticket has no subject, i.e. Display.html
+       
+       2) Things might get totally whacko if the subject contains HTML code.
+       
+       I could ensure the "right" behaviour all the places by using
+       HTML::Entities::encode (I've done it one place), and by always using
+       $Subject||"(No subject)".  Anyway, I think it might be more
+       appropriate to have a sub RT::Ticket::VerboseSubject and
+       RT::Ticket::HTMLSubject.
+       
+       What do you think?
+       
+2000-05-22 16:51  tobiasb
+
+       * webrt/Ticket/Display.html:
+
+       It seems like it can create and view new transactions now.
+       
+       My next step will be to fix linking
+       
+2000-05-22 16:47  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       I should never commit before testing ... I should never commit before testing ... I should never commit before ...
+       
+       bugfix.
+       
+2000-05-22 16:38  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       I'm trying to get a better propagation of error messages.  I'm a bit
+       amused to find lots of things that shouldn't pass `perl -w' and `use
+       strict'?
+       
+2000-05-22 15:52  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Removed a debug (?) line that was commented out:
+       
+       #      print "From is $From\n";
+       
+       ...and inserted some other logging:
+       
+       - logs an info message with ticket id, subject and queue upon
+       successful message creation.
+       
+       - logs a warning if it couldn't be created.
+       
+2000-05-22 14:11  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       In RT::Ticket::Create: Defaulting queue to 'general', and warning when it's not set
+       
+2000-05-22 14:06  tobiasb
+
+       * README:
+
+       Added a 'rt-comment' to the recommended mail configuration
+       
+2000-05-22 14:04  tobiasb
+
+       * Makefile:
+
+       added a comment-mail-alias
+       
+2000-05-22 14:03  tobiasb
+
+       * etc/config.pm:
+
+       Hm ... $RT::CorrespondAddress is used in AutoReply.pm, while only
+       $MailAlias is set in config.pm.  I'm not sure if this is the Right(tm)
+       solution, but anyway ... I added those two lines, additions to the
+       Makefile and README file is coming up shortly ...
+       
+       $CorrespondAddress=$MailAlias;
+       $CommentAddress="!!RT_COMMENT_MAIL_ALIAS!!";
+       
+2000-05-22 12:53  tobiasb
+
+       * webrt/Ticket/Create_Detail.html:
+
+       fixed up a bug caused by too quick usage of cut&paste
+       
+2000-05-22 12:01  tobiasb
+
+       * webrt/Ticket/Create_Detail.html:
+
+       Done some work making this page look OK.  Now I will put in some logic
+       in Display.html for creating and linking requests.
+       
+2000-05-22 05:30  tobiasb
+
+       * webrt/Elements/SelectOwner:
+
+       # TODO: respect the ACLs!!
+       # This will be a list of some thousands requestors with the current scheme.
+       
+2000-05-19 12:37  tobiasb
+
+       * webrt/Ticket/Create.html:
+
+       Added a box for setting link information.  Only a web mockup, the
+       logic doesn't work yet.  Feel free to do whatever you'd like with this
+       one.  It might make sense to move this to the details page.
+       
+2000-05-19 12:17  jesse
+
+       * webrt/Ticket/LinkIt.html:
+
+       Code and formatting cleanups
+       
+2000-05-19 11:23  tobiasb
+
+       * etc/config.pm:
+
+       Removed some weird stuff
+       
+2000-05-19 10:59  jesse
+
+       * webrt/: index.html, Search/PickRestriction:
+
+       fixed some typos
+       
+2000-05-19 10:59  jesse
+
+       * etc/config.pm:
+
+       cleaned up the config file a bit
+       
+       <M-}>CVS:       etc/config.pm
+       
+2000-05-19 08:42  tobiasb
+
+       * bin/testdeps.pl, bin/webmux.pl, webrt/Elements/SelectLinkType,
+       webrt/Ticket/Display.html, webrt/Ticket/LinkIt.html,
+       webrt/Ticket/ProcessUpdate.html, webrt/Ticket/Elements/ShowSummary,
+       webrt/Ticket/Elements/ShowTransaction:
+
+       Started the work getting links to work.  While the linking doesn't work yet, this is a hint about how I think things might work
+       
+2000-05-19 08:42  tobiasb
+
+       * webrt/Elements/SelectLinkType:
+
+       file SelectLinkType was initially added on branch rt-1-1.
+       
+2000-05-19 08:42  tobiasb
+
+       * webrt/Ticket/LinkIt.html:
+
+       file LinkIt.html was initially added on branch rt-1-1.
+       
+2000-05-18 14:46  jesse
+
+       * lib/RT/Ticket.pm:
+
+       a tiny bit of doc added to Ticket.pm
+       still not happy with the format
+       
+2000-05-18 10:56  tobiasb
+
+       * webrt/Ticket/autohandler:
+
+       undo of last commit; only local modifications for debugging
+       
+2000-05-18 10:51  tobiasb
+
+       * webrt/: Search/Listing.html, Ticket/Elements/ShowTransaction:
+
+       the previous commit had wrong loginfo; those files are modified according to the latest changes in etc/config.pm
+       
+2000-05-18 10:42  jesse
+
+       * webrt/Elements/SelectResultsPerPage:
+
+       adding missing file
+       
+2000-05-18 10:41  tobiasb
+
+       * webrt/: index.html, Search/Listing.html, Ticket/autohandler,
+       Ticket/Elements/ShowTransaction:
+
+       A front page for navigation.  This one needs work; Masonifying, generalizing and possibilities for customizations needs to be implemented
+       
+2000-05-18 10:41  tobiasb
+
+       * webrt/index.html:
+
+       file index.html was initially added on branch rt-1-1.
+       
+2000-05-18 10:36  tobiasb
+
+       * webrt/Elements/SelectResultsPerPage:
+
+       Added an empty file as for now
+       
+2000-05-18 10:36  tobiasb
+
+       * webrt/Elements/SelectResultsPerPage:
+
+       file SelectResultsPerPage was initially added on branch rt-1-1.
+       
+2000-05-18 05:48  tobiasb
+
+       * etc/config.pm:
+
+       I'm planning to deal with web customizations with one hash RT::WebOptions in config.pm.  This hash might contain callbacks and maybe names of extra Mason modules to pull in.  What do you think?
+       
+2000-05-17 19:08  jesse
+
+       * webrt/Search/autohandler:
+
+       file autohandler was initially added on branch rt-1-1.
+       
+2000-05-17 19:08  jesse
+
+       * webrt/Search/: Listing.html, PickRestriction, autohandler:
+
+       Work on searches. in the cli  -maxitems <n> now does the right thing
+       
+2000-05-16 17:48  jesse
+
+       * webrt/Ticket/Elements/ShowLinks:
+
+       file ShowLinks was initially added on branch rt-1-1.
+       
+2000-05-16 17:48  jesse
+
+       * bin/rtmux.pl, bin/webmux.pl, lib/RT/Link.pm, lib/RT/Ticket.pm,
+       lib/RT/Action/OpenDependent.pm, lib/RT/Action/ResolveMembers.pm,
+       lib/RT/Action/Spam.pm, lib/RT/Action/StallDependent.pm,
+       webrt/Elements/Error, webrt/Ticket/Elements/ShowLinks,
+       webrt/Ticket/Elements/ShowSummary:
+
+       Converted the new link code to a fully oo setup, rahter than a mishmash of
+       procedural and oo.  seperated out webrt/Ticket/Elements/ShowLinks
+       
+       It's by no means done, but it does seem to work.
+       
+       jesse
+       
+2000-05-16 12:30  tobiasb
+
+       * Makefile, etc/config.pm, lib/RT/Link.pm, lib/RT/Ticket.pm,
+       webrt/Ticket/Elements/ShowSummary:
+
+       Done quite some work at the right hand 'Other Links' window (well, it's not good enough, and it also lists dependencies as for now).  Jesse, you might want to do something with ShowSummary, my Mason code seems horribly ugly.
+       
+2000-05-16 09:18  tobiasb
+
+       * etc/config.pm:
+
+       (...)
+       # A hash table of convertion subs to be used for transforming RT Link
+       # URIs to URLs in the web interface.  If you want to use RT towards
+       # locally installed databases, this is the right place to configure it.
+       # (TODO!)
+       my %URI2HTML=
+           (
+            'fsck.com-rt' => sub {warn "stub!";},
+            'mozilla.com-bugzilla' => sub {warn "stub!";},
+            'fsck.com-kb' => sub {warn "stub!"}
+            );
+       (...)
+       
+       I will also make a sub RT::Links::URI2HTML which gives smart links to
+       internal references, and passes other URIs to this hash table, and
+       eventually we should make default subs for KB and RT.
+       
+       What do you think of this idea?
+       
+2000-05-16 04:58  tobiasb
+
+       * lib/RT/: Link.pm, Ticket.pm:
+
+       Enabled link display in the CLI
+       
+2000-05-16 04:43  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       Seems like I had broken something...(bugfix)
+       
+2000-05-13 19:56  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Right, we need to work a bit with the links API.
+       
+       - we need an AllLinks sub.  How to tell EasySearch to give both links
+       where we're BASE and were we're TARGET?
+       
+       - we need an "unresolved dependencies" according to the current
+       design.  How to tell if a dependency is unresolved?  Dependencies can
+       point out of this RT instance!
+       
+       - we might need more subs, but not right now anyway.
+       
+2000-05-12 11:32  tobiasb
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       partly a bugfix; 'QouteTransaction=attachment-id' doesn't work very well for transactions without attachment.  Maybe that link should only be for attachments, and not for transactions.  Anyway, I changed it to transaction-id instead.  And I also added 'spawn' to the title; I think 'spawning' should be done through the same page.  'spawn' is when creating a new request that is linked up somehow to the old one.  Maybe it rather should be titled 'forward' or 'create new' or something?
+       
+2000-05-12 07:54  tobiasb
+
+       * webrt/: Elements/Error, Ticket/Display.html:
+
+       Bugfixing ... ehrm, why don't I test things before committing? :)
+       
+2000-05-12 07:34  tobiasb
+
+       * webrt/Elements/Error:
+
+       It logs errors now
+       
+2000-05-12 07:32  tobiasb
+
+       * webrt/Ticket/Display.html:
+
+       dies if element can't be loaded
+       
+2000-05-12 06:55  tobiasb
+
+       * webrt/Login.html:
+
+       seems like CGI won't take a combined get+post
+       
+2000-05-12 06:51  tobiasb
+
+       * etc/config.pm:
+
+       bugfix
+       
+2000-05-11 12:45  jesse
+
+       * webrt/Elements/ShadedBox:
+
+       file ShadedBox was initially added on branch rt-1-1.
+       
+2000-05-11 12:45  jesse
+
+       * webrt/Elements/ShadedBox:
+
+       missed this one before. it's somewhat misnamed right now. basically, it
+       prints a title and content.
+       
+2000-05-11 12:39  jesse
+
+       * webrt/Elements/: TitleBoxEnd, TitleBoxStart:
+
+       the title box for webui
+       
+2000-05-11 12:39  jesse
+
+       * webrt/Elements/TitleBoxStart:
+
+       file TitleBoxStart was initially added on branch rt-1-1.
+       
+2000-05-11 12:39  jesse
+
+       * webrt/Elements/TitleBoxEnd:
+
+       file TitleBoxEnd was initially added on branch rt-1-1.
+       
+2000-05-11 12:37  jesse
+
+       * webrt/Ticket/: Display.html, Elements/ShowSummary:
+
+       hrml cleanup. it's not as pretty, but man does it render faster
+       
+2000-05-11 01:07  jesse
+
+       * webrt/: Elements/Footer, Elements/Header, Ticket/Display.html,
+       Ticket/Elements/ShowHistory, Ticket/Elements/ShowSummary,
+       Ticket/Elements/ShowTransaction:
+
+       
+       Cleanup
+       \
+       
+2000-05-11 00:46  tobiasb
+
+       * TODO:
+
+       Added a list
+       
+2000-05-10 23:43  jesse
+
+       * webrt/webrt.css:
+
+       file webrt.css was initially added on branch rt-1-1.
+       
+2000-05-10 23:43  jesse
+
+       * webrt/webrt.css:
+
+       The base stylesheet.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/Ticket/Elements/ShowSummary:
+
+       file ShowSummary was initially added on branch rt-1-1.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/Ticket/Elements/ShowTransaction:
+
+       file ShowTransaction was initially added on branch rt-1-1.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/Ticket/Elements/ShowDates:
+
+       file ShowDates was initially added on branch rt-1-1.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/Ticket/Elements/ShowHistory:
+
+       file ShowHistory was initially added on branch rt-1-1.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/Ticket/Elements/ToolBar:
+
+       file ToolBar was initially added on branch rt-1-1.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/Ticket/Elements/ShowBasics:
+
+       file ShowBasics was initially added on branch rt-1-1.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/Ticket/Elements/ShowPeople:
+
+       file ShowPeople was initially added on branch rt-1-1.
+       
+2000-05-10 23:41  jesse
+
+       * webrt/: Elements/Header, Ticket/Display.html,
+       Ticket/DisplayHeader, Ticket/DisplaySummary, Ticket/DisplayTicket,
+       Ticket/ProcessUpdate.html, Ticket/ToolBar, Ticket/autohandler,
+       Ticket/Elements/ShowBasics, Ticket/Elements/ShowDates,
+       Ticket/Elements/ShowHistory, Ticket/Elements/ShowPeople,
+       Ticket/Elements/ShowSummary, Ticket/Elements/ShowTransaction,
+       Ticket/Elements/ToolBar:
+
+       Work on the web ui. mostly on the ticket display interface
+       
+2000-05-10 15:43  tobiasb
+
+       * README:
+
+       Added a comment about how to do the CGI :) Well:
+       
+               To get it up running even without mod_perl, you will need to
+       consult Tobix or the rt-devel mailinglist.  Tobix is actively working
+       on a (Fast)CGI version, but as for now he has been too lazy to update
+       the template for the cgi executable.
+       
+2000-05-10 15:39  tobiasb
+
+       * webrt/Ticket/Create_Detail.html:
+
+       added a require statement.  No effect for the mod_perl version, but makes sense for a CGI version.
+       
+2000-05-09 05:35  tobiasb
+
+       * bin/webmux.pl:
+
+       Better formatting
+       
+2000-05-08 05:01  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       bugfix
+       
+2000-05-05 19:20  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       This one shouldn't loop now - though it's not tested :)
+       
+2000-05-05 19:15  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       Fixing up the loop control.  When a possible loop occurs, an error
+       flag is set, and a new header field RT-Loop-Alarm appears.  I feel a
+       bit bad about the latter, we are indeed changing an email after it
+       arrived to the system, which I think is a bad thing - but anyway not
+       as bad as dropping the email completely.  My idea is that the Actions,
+       particularly the SendEmail.pm Action remain silent when this header
+       field is set.
+       
+2000-05-05 19:01  tobiasb
+
+       * etc/config.pm:
+
+       Added this about logging to the comments:
+       
+       # It might generally make sense to send error and higher by email to
+       # some administrator.  For heavens sake; be sure that the email goes
+       # directly to a mailbox, and not via RT :) Mail loops will generate a
+       # critical log message.
+       
+2000-05-05 16:47  jesse
+
+       * bin/testdeps.pl:
+
+       Added Log::Dispatch to testdeps.pl
+       
+2000-05-05 13:04  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       bugfix
+       
+2000-05-05 12:47  tobiasb
+
+       * etc/config.pm:
+
+       I need help, I can't really figure out from this;
+       
+       When commenting out the $SIG{__DIE__} stuff, everything works fine.
+       
+       When having this line in the config:
+       
+       $SIG{__DIE__}  = sub {$RT::Logger->log(level=>'crit',message=>$_[0]); print STDERR $_[0]; exit(-1);};
+       
+       I get this error:
+       
+       Can't locate Mail/Field/addrlist.pm in @INC (@INC contains: /tmp/FunRT /tmp/DBIx /etc/rt /usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/site_perl/5.6.0/i686-linux /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .) at (eval 115)[/usr/local/lib/perl5/site_perl/5.6.0/Mail/Field.pm:87] line 3.
+       
+       WTF???
+       
+2000-05-05 10:29  tobiasb
+
+       * bin/rtmux.pl:
+
+       I guess this should block that stupid warnings
+       
+2000-05-05 10:01  tobiasb
+
+       * etc/config.pm:
+
+       Added Log::Dispatch.  I also have added those comments, which I would
+       like comments on (:
+       
+       # Most (if not all?) $RT:: global variables should be here.  I'd
+       # suggest putting session information in another Namespace (main:: or
+       # RT::main or maybe something like that).
+       
+       #use strict;
+       
+       #use vars qw/%SitePolicy $dirmode $transactionmode $DatabasePassword $rtname $domain $host $DatabaseHost $DatabaseUser $RT::DatabaseName $DatabaseType $user_passwd_min $MailAlias $WebrtImagePath $web_auth_mechanism $web_auth_cookies_allow_no_path $DefaultLocale $LocalePath $Nobody $Logger/;
+       
+       I'm not sure if "use strict" breaks, but at least "use vars" breaks
+       bigtime as we are using it other places (like rtmux.pl).  I suggest
+       using another package name for the execution logic.  What do you
+       think?
+       
+2000-05-05 08:07  tobiasb
+
+       * Makefile:
+
+       Added RT_LOGFILE, and comments on how to fix advanced logging
+       
+2000-05-05 02:31  jesse
+
+       * bin/rtmux.pl:
+
+       a bit of performance hacking. now require mason and cgi rather than 'use'ing them
+       
+2000-05-05 02:22  jesse
+
+       * lib/RT/: Action.pm, Scrip.pm, ScripScope.pm, Template.pm,
+       Ticket.pm, Transaction.pm, Action/AutoReply.pm,
+       Action/SendEmail.pm, Action/Spam.pm:
+
+       Cleaned up a couple minor things (like precedence, again) and changed "FixSubject" to "SetSubjectTag"
+       
+       Fixed the memory leak in Transaction.pm (it wasn't letting go of Scrip objects)
+       The fix was a bit of a "large mallet on a small nail" in that I'm now _explicitly_ destroying ScripObjects two different ways and don't quite understand why I have to do it. It does, however, work.
+       
+2000-05-04 09:00  tobiasb
+
+       * lib/RT/Action/Spam.pm:
+
+       Completely untested - but I guess this should do real spamming, that
+       is one email for each request(or).
+       
+2000-05-04 08:59  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       bugfix
+       
+2000-05-04 07:04  tobiasb
+
+       * lib/RT/Action/: AutoReply.pm, SendEmail.pm:
+
+       Precedence: Bulk should only be set for AutoReply
+       
+2000-05-04 05:29  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       sub FixSubject sets the RT tag (unless it is already there).  I moved
+       it out from Prepare because I need to override this behaviour when
+       Spamming people.
+       
+2000-05-04 01:34  jesse
+
+       * etc/schema.mysql:
+
+       spec some defaults in the schema
+       
+2000-05-04 01:32  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Bugfix to ticket.pm for better handling of default values for some queue fields
+       
+2000-05-03 14:19  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Sorry, the last commit on this file was not really a bugfix.  I'd say all Ticket (Transaction) Actions should return status, message and eventually optional things after the message.
+       
+2000-05-03 14:16  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Bugfix
+       
+2000-05-03 14:13  tobiasb
+
+       * lib/RT/Action/: ResolveMembers.pm, Spam.pm:
+
+       Those actually seems to work :)
+       
+2000-05-03 14:13  tobiasb
+
+       * lib/RT/Action/Spam.pm:
+
+       file Spam.pm was initially added on branch rt-1-1.
+       
+2000-05-03 14:13  tobiasb
+
+       * lib/RT/Action/ResolveMembers.pm:
+
+       file ResolveMembers.pm was initially added on branch rt-1-1.
+       
+2000-05-03 14:13  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       gubfix
+       
+2000-05-03 14:00  tobiasb
+
+       * etc/schema.mysql:
+
+       Bugfix
+       
+2000-05-03 13:29  tobiasb
+
+       * etc/schema.mysql:
+
+       Commented out the AutoReplies table.
+       
+2000-05-03 13:17  tobiasb
+
+       * lib/RT/Action/AutoReply.pm:
+
+       Putted in "#TODO: " comments for avoiding duplicate AutoReplies.
+       
+2000-05-03 13:15  tobiasb
+
+       * etc/schema.mysql:
+
+       Added a table AutoReplies to avoid sending the same autoreply template
+       more than once to each requestor.
+       
+       Eventually entries should be removed (i.e. after a week) through the
+       (upcoming?) timer system (eventually through the good, old crontab(5))
+       
+2000-05-03 11:48  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       LinkTo and LinkFrom are tested a bit, and they seem to work OK now.
+       
+2000-05-03 11:02  tobiasb
+
+       * etc/schema.mysql:
+
+       Bugfix.
+       
+2000-05-03 07:40  tobiasb
+
+       * etc/schema.mysql:
+
+       I'm putting ResolveGroupTicket on hold.  It's just not important.
+       
+2000-05-02 18:05  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Starting to add a bit of inline pod documentation. the style isn't finalized yet
+       
+2000-05-02 14:30  tobiasb
+
+       * lib/RT/Action/OpenDependent.pm:
+
+       file OpenDependent.pm was initially added on branch rt-1-1.
+       
+2000-05-02 14:30  tobiasb
+
+       * etc/schema.mysql, lib/RT/Link.pm, lib/RT/Ticket.pm,
+       lib/RT/Action/OpenDependent.pm, lib/RT/Action/StallDependent.pm:
+
+       I just got DependsOn Links to work as they should in the CLI :)
+       
+2000-05-02 13:36  tobiasb
+
+       * lib/RT/Links.pm:
+
+       file Links.pm was initially added on branch rt-1-1.
+       
+2000-05-02 13:36  tobiasb
+
+       * lib/RT/: Links.pm, Ticket.pm, Action/StallDependent.pm:
+
+       [no log message]
+       
+2000-05-02 13:07  tobiasb
+
+       * lib/RT/Action/StallDependent.pm:
+
+       Bugfix.  Also, only Open requests should be Stalled.
+       
+2000-05-02 13:01  tobiasb
+
+       * lib/RT/: Ticket.pm, Action/StallDependent.pm:
+
+       Bugfixing
+       
+2000-05-02 12:21  tobiasb
+
+       * lib/RT/: Ticket.pm, Action/StallDependent.pm:
+
+       bugfixes
+       
+2000-05-02 11:55  tobiasb
+
+       * etc/schema.mysql:
+
+       Added TobiX-style logic scrips for DependsOn link and MemberOf link.
+       
+2000-05-02 07:55  tobiasb
+
+       * lib/RT/: Link.pm, Ticket.pm:
+
+       oup, forgot to keep a consistant style
+       base => Base
+       target => Target
+       etc
+       
+2000-05-02 07:55  tobiasb
+
+       * Makefile, etc/config.pm:
+
+       forgot to commit those changes ... configuration for the URI method
+       
+2000-05-02 05:45  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Agh, compile error.
+       
+2000-05-02 05:30  tobiasb
+
+       * lib/RT/Action/StallDependent.pm:
+
+       file StallDependent.pm was initially added on branch rt-1-1.
+       
+2000-05-02 05:30  tobiasb
+
+       * lib/RT/Action/: README.hackers, StallDependent.pm:
+
+       Ok, so lets put all Actions into one directory - though I'd say it would be better for future hackers to orient themselves if we grouped them somehow.
+       
+2000-05-02 00:11  jesse
+
+       * Makefile:
+
+       Version bumping
+       
+2000-05-01 17:16  jesse
+
+       * lib/RT/Ticket.pm:
+
+       moved URIIsLocal closer to other linking routines.
+       
+2000-05-01 10:16  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Made the transaction data a bit "nicer", should look something like:
+       
+       THIS DependsOn 4323 as of 342
+       <URI> DependsOn THIS as of 343
+       
+2000-05-01 08:58  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Changed URL -> URI
+       
+       Changed NewLink and ReverseLink to LinkTo and LinkFrom
+       
+       Added one byte to indicate if it's a From-link or a To-link in the
+       transaction data.
+       
+2000-05-01 01:52  jesse
+
+       * etc/schema.mysql:
+
+       fixed a few typos in the schema
+       
+2000-05-01 01:50  jesse
+
+       * lib/RT/ACL.pm:
+
+       Initial sketches at RT::ACL.pm. there's no running code here yet.
+       
+2000-05-01 01:48  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Fixed Ticket->URL. changed queue->load to queue->Load
+       
+2000-05-01 01:04  jesse
+
+       * bin/rtmux.pl:
+
+       Fixed improper rt program selection code.
+       
+2000-05-01 00:14  jesse
+
+       * lib/RT/Queue.pm:
+
+       a stub for ACL work.
+       
+2000-04-30 13:28  tobiasb
+
+       * lib/RT/Link.pm:
+
+       file Link.pm was initially added on branch rt-1-1.
+       
+2000-04-30 13:28  tobiasb
+
+       * lib/RT/: Link.pm, Ticket.pm:
+
+       Link.pm
+       
+2000-04-30 13:13  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Added a static method URIIsLocal which checks if it's a local URI or not.
+       
+2000-04-28 14:20  jesse
+
+       * lib/RT/Transaction.pm:
+
+       Cleaned up some comments and formatting. and did a bit of reorganizing
+       of routines to more closely model other files. Oh. i finally have
+       emacs doing proper indenting per perlstyle. so we'll hopefully start
+       to get better about that :) Tobix has only been bugging me for a year
+       
+2000-04-28 09:05  tobiasb
+
+       * lib/RT/Action/README.hackers:
+
+       Just some documentation for future hackers :)
+       
+2000-04-28 09:05  tobiasb
+
+       * lib/RT/Action/README.hackers:
+
+       file README.hackers was initially added on branch rt-1-1.
+       
+2000-04-28 08:20  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Started the work of implementing links
+       
+2000-04-28 04:40  tobiasb
+
+       * etc/schema.mysql:
+
+       Didn't we once agree that we needed "state" (user-configurable logic)
+       and "status" (fixed open/stalled/resolved/dead)? :)
+       
+2000-04-28 01:17  jesse
+
+       * lib/RT/Ticket.pm:
+
+       didn't balance parens. grr
+       
+2000-04-28 00:54  jesse
+
+       * lib/RT/Ticket.pm:
+
+       a bunch of cleanup.. a bunch more folding mode braces.
+       a few minor (still not in any codepath) changes for the start of some
+       acls work
+       
+2000-04-28 00:51  jesse
+
+       * docs/design_docs/link-definitions.txt:
+
+       a few comments, additions and clarifications. nothing really major
+       
+2000-04-27 02:06  jesse
+
+       * docs/design_docs/acls:
+
+       more thoughts on ACLs. this time including some code snippits.
+       
+2000-04-27 02:01  jesse
+
+       * etc/schema.mysql:
+
+       added the schema for the new ACL system.
+       responded to tobix' comments about GECOS.
+       
+2000-04-26 14:58  tobiasb
+
+       * docs/design_docs/subscription-definitions.txt:
+
+       marginal updates to reflect that scrips/actions can be used for more things than subscriptions (the whole document might need a rename)
+       
+2000-04-26 14:50  tobiasb
+
+       * docs/design_docs/link-definitions.txt, etc/schema.mysql:
+
+       only insignificant comments - some made weeks ago
+       
+2000-04-26 12:59  jesse
+
+       * docs/design_docs/link-definitions.txt:
+
+       some comments on link definitions
+       my comments are marked with # as the first character of the line.
+       
+2000-04-26 02:27  tobiasb
+
+       * docs/design_docs/: link-definitions.txt,
+       subscription-definitions.txt:
+
+       updates
+       
+2000-04-26 00:14  jesse
+
+       * docs/design_docs/acls:
+
+       some more hacking on acls design
+       
+2000-04-25 17:58  jesse
+
+       * docs/design_docs/acls:
+
+       thoughts on acls
+       
+2000-04-24 00:17  jesse
+
+       * webrt/Ticket/Create_Detail.html:
+
+       file Create_Detail.html was initially added on branch rt-1-1.
+       
+2000-04-24 00:17  jesse
+
+       * webrt/Ticket/Create_Detail.html:
+
+       some work on create. nothing ready for consumption yet.
+       
+2000-04-24 00:16  jesse
+
+       * webrt/: Logout.html, Elements/Footer, Elements/Header,
+       Elements/SelectQueue, Ticket/Create.html, Ticket/Display.html,
+       Ticket/ProcessUpdate.html, Ticket/SetOwner, Ticket/SetStatus,
+       Ticket/Update.html, Ticket/autohandler:
+
+       Look ma, $session{'CurrentUser'} contains the current user object.
+       you can depend on this being set if the user's authenticated.
+       
+2000-04-24 00:16  jesse
+
+       * webrt/Logout.html:
+
+       file Logout.html was initially added on branch rt-1-1.
+       
+2000-04-24 00:14  jesse
+
+       * Makefile, bin/testdeps.pl, bin/webmux.pl:
+
+       Added Apache::Session support to the HTML::Mason version of things.
+       
+2000-04-23 19:45  jesse
+
+       * bin/testdeps.pl:
+
+       added a little script to test perl dependencies.
+       it should probably get integrated into the makefile
+       
+2000-04-23 19:45  jesse
+
+       * bin/testdeps.pl:
+
+       file testdeps.pl was initially added on branch rt-1-1.
+       
+2000-04-23 17:28  jesse
+
+       * Makefile, docs/design_docs/acls, etc/schema.mysql:
+
+       installation seems to work a bit better now
+       
+2000-04-20 02:18  jesse
+
+       * webrt/Login.html:
+
+       Removing cruft from login.html
+       
+2000-04-20 02:17  jesse
+
+       * webrt/Ticket/autohandler:
+
+       Look ma! this autohandler seems to make webauth (with $pass = $user ) work.
+       
+2000-04-20 02:09  jesse
+
+       * webrt/: autohandler, Ticket/autohandler:
+
+       file autohandler was initially added on branch rt-1-1.
+       
+2000-04-20 02:09  jesse
+
+       * webrt/Login.html:
+
+       file Login.html was initially added on branch rt-1-1.
+       
+2000-04-20 02:09  jesse
+
+       * Makefile, bin/webmux.pl, webrt/Login.html, webrt/autohandler,
+       webrt/Ticket/autohandler:
+
+       Doing work on cookie-based authentication for WebRT. The basic idea
+       is that the autohandler in each directory (unless the global handlers can be made to work) will check to see if the user is authenticated. If they are, then it keeps going happily. otherwise, it forces the user to login with the form in /Login.html, which should eventually be smart enough to put them back to where they want to go.
+       
+2000-04-18 02:43  jesse
+
+       * docs/design_docs/acls:
+
+       checking in design work on ACLs. a bit more work, such as notes
+       on order of evaluation and a rough implementation plan and then I'll
+       implement
+       
+2000-04-13 11:58  tobiasb
+
+       * etc/config.pm:
+
+       Introduced all columns we need locally, that is all columns as of RT
+       1.0, except due, area and priorities.  I guess somebody might want to
+       add those columns as well :)
+       
+2000-04-13 11:52  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       hrmwell, you did introduse a slight bug here.. :)
+       
+2000-04-13 11:26  tobiasb
+
+       * webrt/Search/: Listing.html, TicketCell:
+
+       Looks gruesome, but hey - it works\!
+       
+2000-04-13 11:26  tobiasb
+
+       * webrt/Search/TicketCell:
+
+       file TicketCell was initially added on branch rt-1-1.
+       
+2000-04-13 10:52  tobiasb
+
+       * etc/config.pm:
+
+       agh..
+       
+2000-04-13 10:50  tobiasb
+
+       * etc/config.pm:
+
+       Added the site configurable option "QueueListingCols".  It should also
+       be possible to override this one at least through the query, but it
+       might not be trivial.  (maybe you have better suggestions?)
+       
+2000-04-13 10:23  tobiasb
+
+       * webrt/Search/QueueItem:
+
+       I think I want to remove this one, I have other thoughts about how to
+       handle this - let's discuss it more when I've made some implementation :)
+       
+2000-04-13 10:05  tobiasb
+
+       * webrt/Search/Listing.html:
+
+       Added this:
+       
+       # TODO: This one should _not_ be here, rather somewhere else
+       # (suggestions?).  It might eventually read the cookies, user
+       # configuration information from the DB, queue configuration information
+       # from the DB, etc.  It should be object oriented.  But what object can
+       # it belong to, and how should it get access to all this data?
+       
+       sub _cfg {
+         my $key=shift;
+         return $ARGS{$key} || $RT::SitePolicy{$key};
+       }
+       
+2000-04-13 10:05  tobiasb
+
+       * etc/config.pm:
+
+       Added a hash for "tunable" configurations:
+       
+       # This is where RT's preferences are kept track of
+       
+       package RT;
+       
+       # Different "tunable" configuration options should be in this hash:
+       %SitePolicy=();
+       
+2000-04-13 02:30  jesse
+
+       * lib/RT/Ticket.pm:
+
+       Ticket::clean became Ticket::_CleanAddressesAsString
+       references to clean changed accordingly. i feel a bit dirty not
+       making this $self->_CleanAddressesAsString.
+       
+2000-04-12 08:53  tobiasb
+
+       * webrt/: Elements/SelectStatus, Ticket/ProcessUpdate.html,
+       Ticket/Update.html:
+
+       bugfixes and insignificant enhancements
+       
+2000-04-12 07:14  tobiasb
+
+       * webrt/Elements/yearMenu:
+
+       "Last year" is now (by default) available
+       
+2000-04-12 07:11  tobiasb
+
+       * webrt/Search/PickRestriction:
+
+       Changed the default to select one queue, not select "anything but" a queue.
+       
+2000-04-12 07:07  tobiasb
+
+       * webrt/Search/PickRestriction:
+
+       Added a stupid "under construction" message.
+       
+2000-04-12 07:00  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       Ehm .. the last commit message should be more descriptive;
+       
+       From the README:
+       
+               rt:     |"/path/to/rt/bin/rt-mailgate general correspond"
+                                                           |          |
+                                          <<queue-name>----/          |
+                                                                      |
+                       <<correspond or comment depending on whether   |
+                        the mail shoud be resent to the requestor>---/
+                        "action" here will make this address only
+                         parse actions in the message without
+                         recording the message as a transaction
+                         of its own"
+       
+       ...while the implementation required "correspond general"
+       
+2000-04-12 06:58  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       This was not in sync with the README
+       
+2000-04-12 06:50  tobiasb
+
+       * webrt/Search/PickRestriction:
+
+       Bugfix
+       
+2000-04-12 06:45  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Agh, should have tested before committing :)
+       
+2000-04-12 06:44  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Fixd SetOwner to allow stealing and to respect the new Nobody user
+       
+2000-04-12 05:19  tobiasb
+
+       * webrt/Elements/SelectQueue:
+
+       Now this one actually works
+       
+2000-04-11 07:30  tobiasb
+
+       * webrt/Elements/SelectQueue:
+
+       This won't work yet.
+       
+2000-04-11 07:17  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       Ehr...right.  Still fixing at the same bug; the IsInbound sub didn't work....well
+       
+2000-04-11 07:08  tobiasb
+
+       * lib/RT/: Ticket.pm, Transaction.pm:
+
+       argh .. I should learn to test the bugfixes before committing
+       
+2000-04-11 06:46  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       bugfix
+       
+2000-04-11 06:42  tobiasb
+
+       * lib/RT/Template.pm, lib/RT/Ticket.pm, webrt/Elements/SelectOwner,
+       webrt/Ticket/ProcessUpdate.html:
+
+       bugfixes
+       
+2000-04-11 05:47  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       bugfixing
+       
+2000-04-11 04:46  tobiasb
+
+       * lib/RT/Watchers.pm:
+
+       Bugfix
+       
+2000-04-11 04:41  tobiasb
+
+       * etc/config.pm, lib/RT/Ticket.pm:
+
+       I'm trying to fix this nobody user..
+       
+2000-04-11 04:36  tobiasb
+
+       * etc/schema.mysql:
+
+       I'm trying to fix this nobody user..
+       
+2000-04-11 04:29  tobiasb
+
+       * lib/RT/Queue.pm, webrt/Ticket/ProcessUpdate.html:
+
+       Bugfixing
+       
+2000-04-11 03:16  tobiasb
+
+       * webrt/Search/Listing.html:
+
+       Insignificant.  Oh, how should errors be trapped?
+       
+2000-04-11 00:40  jesse
+
+       * lib/RT/: Queue.pm, Ticket.pm, Watchers.pm:
+
+       all the watcher types now have AsString methods. this was done by dropping
+       an EmailsAsString method into RT::Watcher
+       
+2000-04-10 23:04  tobiasb
+
+       * webrt/Ticket/ProcessUpdate.html:
+
+       Added those use statements
+       
+       This page seems very broken in Netscape.
+       
+2000-04-10 23:00  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Darn, I thought I had tested this.  Well, now it should work!?
+       
+2000-04-10 22:54  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       ...some work is needed to get Watchers work OK.  I commented out my
+       try on it, so now it will ignore queue watchers (it simply ignored all
+       watchers as it was).
+       
+2000-04-10 14:29  tobiasb
+
+       * webrt/Ticket/: DisplayTicket, DisplayTransaction:
+
+       Update and Modify-links
+       
+2000-04-10 14:20  tobiasb
+
+       * webrt/Ticket/DisplayTransaction:
+
+       Added an "act" link and touched the comments
+       
+2000-04-10 14:11  tobiasb
+
+       * webrt/Ticket/DisplaySummary:
+
+       Reinserted the "Last Contact" and "Last Update" lines, but they're "cleaned" a bit.
+       
+       (btw, this seems like a crude copy from the cli, does the cli have similar problems?)
+       
+2000-04-10 13:51  tobiasb
+
+       * webrt/Ticket/DisplaySummary:
+
+       Hacking a bit on this
+       
+2000-04-10 13:48  tobiasb
+
+       * webrt/Ticket/: DisplayTransaction, Update.html:
+
+       Hacking a bit on this
+       
+2000-04-10 13:18  tobiasb
+
+       * webrt/Ticket/Modify.html:
+
+       'undo' (well, not really :)
+       
+2000-04-10 13:13  tobiasb
+
+       * webrt/Ticket/Update.html:
+
+       This 'fix' is maybe only temporary?
+       
+2000-04-10 13:08  tobiasb
+
+       * webrt/Ticket/Modify.html:
+
+       I'd daresay this one is superceded by Update.html?
+       
+2000-04-10 13:07  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       just added some comments
+       
+2000-04-10 12:52  tobiasb
+
+       * webrt/Ticket/DisplaySummary:
+
+       This 'fix' is maybe only temporary?
+       
+2000-04-10 10:35  tobiasb
+
+       * webrt/: Elements/SelectBoolean, Search/Listing.html:
+
+       insignificant changes
+       
+2000-04-10 06:53  tobiasb
+
+       * webrt/Elements/SelectOwner:
+
+       Insignificant fix (wouldn't work here without)
+       
+2000-04-10 05:38  tobiasb
+
+       * bin/rtmux.pl:
+
+       Might be a bugfix
+       
+2000-04-09 16:56  jesse
+
+       * lib/RT/Users.pm, webrt/Elements/SelectBoolean,
+       webrt/Elements/SelectOwner, webrt/Search/Listing.html,
+       webrt/Search/PickRestriction:
+
+       I can now get a listing of tickets whose owner is or isn't a given owner.
+       and it even lists them. Next, I'll probably make searches for
+       other attributes work.
+       the plan of attack is requestor, then probably ticket content (as a test
+       of whether this whole system works ;)
+       
+2000-04-07 20:41  jesse
+
+       * webrt/Search/Listing.html:
+
+       Added the first bit of code to support queue/owner/requestor/subject search.
+       This will make up the core of the  web search functionality of the first release of the webui. (not the 2.0 release, but the "tobix needs it now) release.
+       
+2000-04-07 14:53  tobiasb
+
+       * etc/schema.mysql, lib/RT/Ticket.pm, lib/RT/Watchers.pm,
+       lib/RT/Action/SendEmail.pm:
+
+       hm ... seems like I forgot to commit my last work
+       
+2000-04-07 03:55  tobiasb
+
+       * lib/RT/: Ticket.pm, Transaction.pm:
+
+       it almost works now
+       
+2000-04-06 17:40  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       development
+       
+2000-04-06 17:21  tobiasb
+
+       * lib/RT/: Ticket.pm, Transaction.pm, Action/Notify.pm,
+       Action/SendEmail.pm:
+
+       ouch, found a lot of fatal stubs
+       
+2000-04-06 16:54  tobiasb
+
+       * etc/schema.mysql, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Action/Notify.pm, lib/RT/Action/SendEmail.pm:
+
+       still fighting with the mail handling
+       
+2000-04-06 16:12  tobiasb
+
+       * etc/schema.mysql, lib/RT/Scrips.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, lib/RT/Action/Notify.pm:
+
+       New snapshot of development.  Note the change I've done in the Type recognizion
+       when selecting the right Scrips in Transaction::Create - it should be more
+       flexible this way (replaced "ne" with "!~").  Check the change to schema for
+       an example of how this is more flexible.
+       
+2000-04-06 15:36  tobiasb
+
+       * lib/RT/Action/Notify.pm:
+
+       Recipient finder
+       
+2000-04-06 15:35  tobiasb
+
+       * etc/schema.mysql, lib/RT/Template.pm, lib/RT/Action/SendEmail.pm:
+
+       Snapshot; I'm not finished debugging yet, but this should (hopefully) be
+       very close to actually work.
+       
+2000-04-06 11:38  tobiasb
+
+       * docs/FAQ:
+
+       this clearly needs a lot more work ...
+       
+2000-04-06 11:31  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       ...ah, this felt good.
+       
+       Checked the recent version of Mailtools at CPAN, so I used the "right"
+       method for sending emails.
+       
+       I also added back again the SetRecipients method, and documented it in
+       the POD.
+       
+       I think I will get this working in a couple of hours, so please don't
+       disturb me saying that you disagree very much to those changes.. :)
+       
+2000-04-06 10:46  tobiasb
+
+       * etc/schema.mysql:
+
+       Bugfixing
+       
+2000-04-06 10:40  tobiasb
+
+       * etc/schema.mysql:
+
+       I think that I will get this up working during the next few hours.
+       
+       If I eventually get it working, I'd really appreciate that you don't
+       wreck it until the web interface is working and until we've discussed
+       the design thoroughly and come down to some consensus about it.
+       
+2000-04-06 06:22  tobiasb
+
+       * webrt/Elements/Checkbox:
+
+       This is not my turf ... and I don't know what I'm doing ... anyway, it didn't work, but now it works (?) :)
+       
+2000-04-06 01:49  jesse
+
+       * lib/RT/Action/SendEmailOnResolve.pm:
+
+       file SendEmailOnResolve.pm was initially added on branch rt-1-1.
+       
+2000-04-06 01:49  jesse
+
+       * Makefile, etc/schema.mysql, lib/RT/Template.pm,
+       lib/RT/Action/MailComment.pm, lib/RT/Action/MailCorrespondence.pm,
+       lib/RT/Action/Notify.pm, lib/RT/Action/NotifyOnResolve.pm,
+       lib/RT/Action/SendEmail.pm, lib/RT/Action/SendEmailOnResolve.pm:
+
+       Ok, i think i significantly cut down the complexity of the actions we've got
+       so far. I nuked the old notify rules, as they were superceeded by my more
+       capable SendEmail.pm There are still a few things I'm not happy with...
+       like, the way that scrips, scripscopes and templates are related. it needs
+       some thought and cleanup. but i think it'll work just fine for now.
+       
+       I redid the templates and scrips to fit with the revised actions and added
+       some more docs to SendEmail.pm
+       
+       the generic RT::Action should deal with templates, not SendEmail, I think,
+       but I'm leaving that abstraction for another day.
+       
+       Oh, the Argument from the scrip is now passed into the template as $T::Argument.
+       
+2000-04-05 23:24  jesse
+
+       * webrt/Elements/Checkbox:
+
+       stylistic cleanup
+       using an explicit defined ($foo)
+       
+2000-04-05 18:02  tobiasb
+
+       * webrt/: Elements/Checkbox, Search/PickRestriction:
+
+       Only minor corrections
+       
+2000-04-05 17:43  tobiasb
+
+       * webrt/Search/PickRestriction:
+
+       It certainly doesn't work okay ... I think I should look into it a bit ...
+       
+2000-04-05 17:08  tobiasb
+
+       * webrt/Search/PickRestriction:
+
+       Added ugly submit button
+       
+2000-04-05 10:34  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Temporary implementation of kill
+       
+       As mentionated earlier, I think the right thing is to just set status
+       'dead' and then eventually do some garbage collection later.
+       
+2000-04-05 08:55  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       More error handling
+       
+2000-04-05 08:51  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       added some comments around the dies pointing out that we need better error handling.
+       
+2000-04-05 05:34  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       Doh...I'm really stupid sometimes...
+       
+2000-04-05 05:31  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       For some weird reason (perl 5.6.0 bug?) it wouldn't work here without this fix.
+       
+2000-04-05 00:35  jesse
+
+       * docs/design_docs/acls:
+
+       initial musings on acls for 2.0
+       
+2000-04-05 00:35  jesse
+
+       * docs/design_docs/acls:
+
+       file acls was initially added on branch rt-1-1.
+       
+2000-04-04 09:52  tobiasb
+
+       * etc/schema.mysql:
+
+       Language idea
+       
+2000-04-04 02:17  jesse
+
+       * Makefile, README, bin/rtmux.pl, etc/config.pm:
+
+       The first little bits of structure for future L10n support
+       
+2000-04-03 12:40  tobiasb
+
+       * Makefile, bin/rtmux.pl:
+
+       Cleaned out yet some more visible configuration bugs
+       
+2000-04-03 12:29  tobiasb
+
+       * README:
+
+       Some fixes
+       
+2000-04-03 10:44  tobiasb
+
+       * Makefile, bin/rtmux.pl:
+
+       Just a configuration fix.
+       
+2000-04-03 01:26  jesse
+
+       * Makefile, bin/rtmux.pl:
+
+       Ok, I've modified rtmux.pl and Makefile to add in the first bits of stub
+       code for running Mason as a cgi. it compiles and appears to invoke.
+       but I haven't tested it under a webserver. I've gotta get to sleep now, but
+       figured this would give tobias a leg up with his testing today.
+       
+       Subject:      RE: [Mason] Mason under CGI (was: replacing storyserver)
+       Author:       Ilmari Karonen <iltzu@sci.fi>
+       Date:         Fri, 17 Sep 1999 15:10:20 +0300 (EET DST)
+       
+       On Thu, 16 Sep 1999, Ben Munoz wrote:
+       > I'm running Apache 1.3.6 on NT.  I'm looking to install HTML::Mason and see
+       > what it can do, but from what I've read, I can't install mod_perl with the
+       > current version of ActiveState's Perl, which I have installed on my machine.
+       
+       I realize this is probably not what you were asking for, but I'd like to
+       mention here my recent (yesterday) experience in setting up Mason under
+       plain ol' CGI.
+       
+       Setting: One Mason top level component plus a few subcomponents on a
+       development server with mod_perl and Mason. One production server with the
+       least possible selection of modules. (Not even mod_so!)
+       
+       Needed to quickly get the Mason component up and running on the second
+       server. Installing Mason itself and a few other perl modules was easy.
+       But adding mod_perl was definitely out of the question.
+       
+       What I did was take the usual handler.pl, copy it to cgi-bin, deleting
+       everything from "my $ah = new HTML::Mason::ApacheHandler" onward
+       inclusive, and replacing it with the following:
+       
+           use CGI;
+           my $q = new CGI;
+       
+           # This routine comes from ApacheHandler.pm:
+           my (%args);
+           foreach my $key ( $q->param ) {
+             foreach my $value ( $q->param($key) ) {
+               if (exists($args{$key})) {
+                 if (ref($args{$key})) {
+                   $args{$key} = [@{$args{$key}}, $value];
+                 } else {
+                   $args{$key} = [$args{$key}, $value];
+                 }
+               } else {
+                 $args{$key} = $value;
+               }
+           }
+       
+           my $comp = $ENV{'PATH_TRANSLATED'};
+           my $root = $interp->comp_root;
+           $comp ~= s/^$root//  or die "Component outside comp_root";
+       
+           $interp->exec($comp, %args);
+       
+       This, plus an Action line in httpd.conf mapping *.mas to this script, has
+       so far done the job just fine.
+       
+       One problem I noticed was that this all would've been much harder if I
+       hadn't been familiar with the way ApacheHandler.pm uses CGI.pm and hadn't
+       known where to find that parsing routine. IMHO it'd be a good idea to
+       separate this loop into a user-callable subroutine.
+       
+       (Note: this was Mason 0.6.mumble - I have no experience with the newer
+       versions.)
+       
+       --
+       Ilmari Karonen (iltzu@sci.fi)
+       http://www.sci.fi/~iltzu/
+       
+       _______________________________________________
+       Mason maillist  -  Mason@netizen.com.au
+       http://netizen.com.au/mailman/listinfo/mason
+       
+2000-04-03 00:49  jesse
+
+       * bin/rtmux.pl, etc/schema.mysql, lib/RT/Action.pm,
+       lib/RT/CurrentUser.pm, lib/RT/Scrip.pm, lib/RT/ScripScopes.pm,
+       lib/RT/Template.pm, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Watchers.pm, lib/RT/Action/AutoReply.pm,
+       lib/RT/Action/SendEmail.pm:
+
+       Well, that was an exciting afternoon! Er, an exciting evening!
+       *grin* AutoReply now works. which means that all the infrastructure for
+       scrips is back in place.  It required refactoring things a bit. as cool
+       as making RT::Template a MIME::Entity seemed, I just couldn't get it to work
+       right, so now, it just creates a MIME::Entity when it needs it, which is
+       probably better anyway.  I simplified templates a bit. Now they only have
+       access to the Ticket and Transaction. This may not be wise, but we'll see.
+       
+       Also, I merged the two blobs per template (headers and body).
+       
+2000-03-31 08:25  tobiasb
+
+       * bin/webmux.pl:
+
+       rmvd dupl line
+       
+2000-03-31 02:47  jesse
+
+       * Makefile:
+
+       removed old webui hooks from the makefile. bumped the version to 1.3.0
+       
+2000-03-31 02:32  jesse
+
+       * webrt/Elements/Error:
+
+       file Error was initially added on branch rt-1-1.
+       
+2000-03-31 02:32  jesse
+
+       * webrt/Ticket/DisplayTicket:
+
+       file DisplayTicket was initially added on branch rt-1-1.
+       
+2000-03-31 02:32  jesse
+
+       * webrt/: Elements/Error, Elements/SelectStatus,
+       Ticket/Display.html, Ticket/DisplayTicket,
+       Ticket/DisplayTransaction, Ticket/ProcessUpdate.html,
+       Ticket/Update.html:
+
+       Ticket/Update.html will now allow you to submit a ticket update.
+       It's the RT2 equivalent of RT1.0's "comment" and "correspond" pages...
+       with a bit of added value. it's not a global "modify ticket" page. that comes
+       next. but it's where 90% of your single-ticket action will take place.
+       
+2000-03-31 02:28  jesse
+
+       * lib/RT/Ticket.pm:
+
+       TimeTaken should increment now
+       
+2000-03-31 02:26  jesse
+
+       * README:
+
+       added the mason dependency to the README
+       
+2000-03-31 02:25  jesse
+
+       * bin/webmux.pl:
+
+       added some uses to the webmux so I don't have to add them to each page that
+       calls them
+       
+2000-03-30 00:44  jesse
+
+       * webrt/Search/PickRestriction:
+
+       made the variable names in PickRestriction look more like the parameter names
+       in EasySearch. Wanna guess why?
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Search/RestrictSearch.html:
+
+       file RestrictSearch.html was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Search/PickRestriction:
+
+       file PickRestriction was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/Footer:
+
+       file Footer was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/: Elements/Checkbox, Elements/Footer, Elements/Header,
+       Elements/SelectBoolean, Elements/SelectDate,
+       Elements/SelectDateRelation, Elements/SelectOwner,
+       Elements/SelectQueue, Elements/SelectStatus, Elements/dayMenu,
+       Elements/monthMenu, Elements/yearMenu, Search/PickRestriction,
+       Search/RestrictSearch.html:
+
+       A bunch of infrasturcture work on the Ticket Search interface. it doesn't
+       have any real logic behind it. that's next.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/SelectBoolean:
+
+       file SelectBoolean was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/dayMenu:
+
+       file dayMenu was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/SelectStatus:
+
+       file SelectStatus was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/SelectQueue:
+
+       file SelectQueue was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/yearMenu:
+
+       file yearMenu was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/Checkbox:
+
+       file Checkbox was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/Header:
+
+       file Header was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/SelectOwner:
+
+       file SelectOwner was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/monthMenu:
+
+       file monthMenu was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/SelectDateRelation:
+
+       file SelectDateRelation was initially added on branch rt-1-1.
+       
+2000-03-29 23:52  jesse
+
+       * webrt/Elements/SelectDate:
+
+       file SelectDate was initially added on branch rt-1-1.
+       
+2000-03-29 00:33  jesse
+
+       * etc/schema.mysql:
+
+       added a generic "RefersTo" ticket type to the comments.
+       changed the types of Link.Base and Link.Target to VARCHAR(255) from INT(11)
+       
+2000-03-28 05:16  tobiasb
+
+       * README, tools/test:
+
+       darn, it seems like I'll need to install mod-perl ... actually I haven't done that earlier..
+       
+2000-03-28 00:13  jesse
+
+       * Makefile, lib/RT/Record.pm, lib/RT/Transaction.pm,
+       webrt/Search/Listing.html, webrt/Search/QueueItem:
+
+       webrt/Search/Listing.html now gives a basic listing of all open tickets
+       It even has links to the _still display only_ Display.html for each ticket
+       
+2000-03-27 23:55  jesse
+
+       * webrt/Ticket/DisplayTransaction:
+
+       missed this one. sorry.
+       
+2000-03-27 23:55  jesse
+
+       * webrt/Ticket/DisplayTransaction:
+
+       file DisplayTransaction was initially added on branch rt-1-1.
+       
+2000-03-27 23:54  jesse
+
+       * webrt/Ticket/: Display.html, DisplayHistory:
+
+       Hey. Look Ticket/Display.html?id=<int> works!
+       
+2000-03-27 22:35  jesse
+
+       * webrt/Ticket/ToolBar:
+
+       file ToolBar was initially added on branch rt-1-1.
+       
+2000-03-27 22:35  jesse
+
+       * webrt/Ticket/DisplaySummary:
+
+       file DisplaySummary was initially added on branch rt-1-1.
+       
+2000-03-27 22:35  jesse
+
+       * webrt/Ticket/DisplayHistory:
+
+       file DisplayHistory was initially added on branch rt-1-1.
+       
+2000-03-27 22:35  jesse
+
+       * README, webrt/Ticket/DisplayHistory, webrt/Ticket/DisplaySummary,
+       webrt/Ticket/ToolBar:
+
+       Work on WebRT, including a README update!
+       
+       check out  http://s.ly/~jesse/2000_03_28_171606_shot.jpg
+       
+2000-03-27 22:31  jesse
+
+       * lib/RT/Watchers.pm:
+
+       Bugfix in Watchers AdministrativeCc -> AdminCc
+       
+2000-03-27 22:30  jesse
+
+       * webrt/Ticket/: Display.html, Displaysummary, Update.html:
+
+       Work on WebUI. Display.html has slight functionality
+       
+2000-03-27 22:13  tobiasb
+
+       * docs/design_docs/basic-definitions.txt, tools/test:
+
+       minor
+       
+2000-03-27 21:50  tobiasb
+
+       * tools/test:
+
+       added some stuff to the test script
+       
+2000-03-27 21:32  tobiasb
+
+       * lib/RT/: ScripScope.pm, Transaction.pm:
+
+       bugfixing
+       
+2000-03-27 21:22  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       ...well, even more bugs...
+       
+2000-03-27 21:09  tobiasb
+
+       * lib/RT/: Scrip.pm, ScripScope.pm, Template.pm, Transaction.pm:
+
+       First level bugfixing completed; Now the create (from the cli) calls up the action (though as earlier mentionated no emails are sent).
+       
+2000-03-27 20:54  tobiasb
+
+       * lib/RT/Scrip.pm:
+
+       bgfx
+       
+2000-03-27 20:47  tobiasb
+
+       * lib/RT/Scrip.pm:
+
+       Bugfix
+       
+2000-03-27 20:22  tobiasb
+
+       * lib/RT/ScripScope.pm:
+
+       bugfix
+       
+2000-03-27 20:19  tobiasb
+
+       * docs/design_docs/basic-definitions.txt:
+
+       clarified
+       
+2000-03-27 18:58  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       The recipients aren't set anywhere as far as I can see ... and I'm really uncertain what you've thought of with SetEnvelopeTo vs SetTo, etc.  You'd better take a look.  Obviously, this won't work until the recipients are set somehow
+       
+2000-03-27 18:40  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       I've mostly only added comments.  Anyway, I must say that I like this
+       code. (maybe I'll say something different when I've tried debugging it
+       ;)
+       
+2000-03-27 17:59  tobiasb
+
+       * lib/RT/ScripScope.pm:
+
+       bugfix
+       
+2000-03-27 17:57  tobiasb
+
+       * lib/RT/Action.pm:
+
+       comment/folding bugfix
+       
+2000-03-27 17:56  tobiasb
+
+       * docs/design_docs/basic-definitions.txt:
+
+       file basic-definitions.txt was initially added on branch rt-1-1.
+       
+2000-03-27 17:56  tobiasb
+
+       * docs/design_docs/basic-definitions.txt:
+
+       (no comment :)
+       
+2000-03-27 17:55  tobiasb
+
+       * docs/design_docs/link-definitions.txt:
+
+       I think maybe those additions might be appreciated by Rouillard ... and this was (hopefully) the last thing I do with design documentation/discussion until 1.3 is finished :)
+       
+2000-03-27 17:33  tobiasb
+
+       * docs/design_docs/link-definitions.txt:
+
+       Doh ... I really shouldn't waste my time on this now ...
+       
+2000-03-27 17:17  tobiasb
+
+       * lib/RT/Scrip.pm:
+
+       Did you ever try to see if those modules would pass `perl -c'? :)
+       
+2000-03-27 16:44  jesse
+
+       * etc/schema.mysql, lib/RT/Action.pm, lib/RT/Scrip.pm,
+       lib/RT/ScripScope.pm, lib/RT/Action/AutoReply.pm,
+       lib/RT/Action/SendEmail.pm:
+
+       Lots of works on Scrip, ScripScope, Action. Tobias: wanna take a look?
+       Basically, now Templates are autoloaded by RT::Scrip.pm and passed into
+       the Action as TemplateObj.  Also, Templates are now of type MIME::Entity,
+       which means that they have all the attributes of mail messages and can
+       just be sent.
+       
+2000-03-27 16:20  tobiasb
+
+       * docs/design_docs/: TransactionTypes.txt, link-definitions.txt:
+
+       Linking definitions
+       
+2000-03-27 16:20  tobiasb
+
+       * docs/design_docs/link-definitions.txt:
+
+       file link-definitions.txt was initially added on branch rt-1-1.
+       
+2000-03-27 16:01  tobiasb
+
+       * docs/README.docs:
+
+       Updated the README to reflect that the docs are old :)
+       
+2000-03-27 15:45  tobiasb
+
+       * README:
+
+       status update
+       
+2000-03-27 15:41  tobiasb
+
+       * lib/RT/ScripScope.pm:
+
+       minor string fix
+       
+2000-03-27 15:36  tobiasb
+
+       * docs/design_docs/subscription-definitions.txt:
+
+       How does the system determinate whom to send mail to?
+       
+       The ScripScope table in the DB should indicate whether a Scrip is relevant
+       for a queue or not /* TobiX thinks that this might eventually be extended to
+       keywords, tickets, etc, and not only Queues */ ... the Scope table should
+       indicate whether the Scrip is relevant for a given transaction type ... then
+       the given Action should determinate whether it applies or not, and finally
+       the Action has to find out (via the Watchers table) whom it applies to, and
+       how to contact them ... and the Template tells how the mails that are sent
+       out should look like.
+       
+2000-03-27 12:33  jesse
+
+       * lib/RT/ScripScopes.pm:
+
+       file ScripScopes.pm was initially added on branch rt-1-1.
+       
+2000-03-27 12:33  jesse
+
+       * lib/RT/: ScripScope.pm, ScripScopes.pm:
+
+       a bit more stub work on ScripScopes for tobias.
+       more work after lunch
+       
+2000-03-27 07:18  tobiasb
+
+       * lib/RT/ScripScope.pm:
+
+       test..?
+       
+2000-03-27 07:04  tobiasb
+
+       * lib/RT/: ScripScope.pm, Scrips.pm:
+
+       Initiated work to get the code understand the Scrips/Scripscope split
+       
+2000-03-27 07:04  tobiasb
+
+       * lib/RT/ScripScope.pm:
+
+       file ScripScope.pm was initially added on branch rt-1-1.
+       
+2000-03-27 06:55  tobiasb
+
+       * etc/schema.mysql:
+
+       Added yet a stupid design thought as a comment:
+       
+       # {{{ TABLE ScripScope
+         (...)
+         Queue INT(11), #Queue Id 0 for global
+                        # (maybe there might be conditions where otherb
+                        # Scopes apply, i.e. a ticket, keyword, owner, etc?)
+       
+2000-03-27 00:45  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       Oops. forgot to commit Notify.pm
+       
+2000-03-27 00:45  jesse
+
+       * lib/RT/Action/Notify.pm:
+
+       file Notify.pm was initially added on branch rt-1-1.
+       
+2000-03-27 00:44  jesse
+
+       * lib/RT/Action/NotifyOnResolve.pm:
+
+       file NotifyOnResolve.pm was initially added on branch rt-1-1.
+       
+2000-03-27 00:44  jesse
+
+       * etc/schema.mysql, lib/RT/Ticket.pm,
+       lib/RT/Action/NotifyOnResolve.pm, lib/RT/Action/NotifyWatchers.pm:
+
+       Work on Notify (Formerly NotifyWatchers)
+       Work on NotifyOnResolve (Formerly NotifyWatchersOnResolve)
+       
+       They don't _work_ per se. But they're getting closer. I'm wondering
+       whether we want to do something smarter with all the addresses we're passing
+       in to make it easier to remove specific ones...for example, we currently
+       have no way to _not_ send mail to the reuqestor.
+       
+2000-03-26 18:13  jesse
+
+       * lib/RT/Action/: AutoReply.pm, SendEmail.pm:
+
+       AutoReply is now a proper subclass of SendEmail.pm
+       Maybe tonight, I'll try to get through some work on the Scrips and ScripScope stuff to make it work again.
+       then to wrok on NotifyWatchers.pm
+       
+2000-03-25 01:03  jesse
+
+       * Makefile, lib/RT/Template.pm, lib/RT/Ticket.pm,
+       lib/RT/Action/SendEmail.pm:
+
+       Work on the templating system. I actually gutted Template.pm and SendEmail.pm
+       (sorry tobix :/)  Basically RT::Template is now A MIME::Entity object, which
+       means that the various things one can do to mail messages can now be done to
+       RT::Template objects, once you run $TemplateObj->Parse on them..
+       SendEmail was cleaned up somewhat to be less intimidating to people who aren't
+       as comfortable with big chunks of fairly dense perl.  Oh and it's a heck of a
+       lot more subclassable now ;)
+       
+       Fixed a tiny bug in Ticket.pm resulting from the changes to Watchers.
+       
+2000-03-24 08:29  tobiasb
+
+       * tools/test:
+
+       I'm making a test suite which is intended to be run off from the Makefile after an install
+       
+2000-03-24 08:29  tobiasb
+
+       * tools/test:
+
+       file test was initially added on branch rt-1-1.
+       
+2000-03-24 08:06  tobiasb
+
+       * etc/schema.mysql:
+
+       Added some more noise
+       
+2000-03-23 23:41  jesse
+
+       * subscription-definitions.txt,
+       docs/design_docs/subscription-definitions.txt, etc/schema.mysql,
+       lib/RT/Action/NotifyWatchers.pm, lib/RT/Action/SendEmail.pm:
+
+       A little bit of cleanup to the SendEmail and NotifyWatchers actions.
+       I probably did more damage than good, but that's what I get for messing
+       with code that makes little sense to me.
+       
+2000-03-23 23:41  jesse
+
+       * docs/design_docs/subscription-definitions.txt:
+
+       file subscription-definitions.txt was initially added on branch rt-1-1.
+       
+2000-03-23 22:19  jesse
+
+       * webrt/Search/BuildSearch:
+
+       Testing the setgid repository. commiting an empty file
+       
+2000-03-23 22:19  jesse
+
+       * webrt/Search/BuildSearch:
+
+       file BuildSearch was initially added on branch rt-1-1.
+       
+2000-03-23 00:50  jesse
+
+       * webrt/Search/QueueFooter:
+
+       file QueueFooter was initially added on branch rt-1-1.
+       
+2000-03-23 00:50  jesse
+
+       * webrt/Search/QueueItem:
+
+       file QueueItem was initially added on branch rt-1-1.
+       
+2000-03-23 00:50  jesse
+
+       * webrt/Search/QueueHeader:
+
+       file QueueHeader was initially added on branch rt-1-1.
+       
+2000-03-23 00:50  jesse
+
+       * webrt/Admin/ModifyUser:
+
+       file ModifyUser was initially added on branch rt-1-1.
+       
+2000-03-23 00:50  jesse
+
+       * lib/RT/Action/NotifyWatchers.pm:
+
+       file NotifyWatchers.pm was initially added on branch rt-1-1.
+       
+2000-03-23 00:50  jesse
+
+       * Makefile, bin/rtmux.pl, etc/schema.mysql, lib/RT/Queue.pm,
+       lib/RT/Scrip.pm, lib/RT/Ticket.pm, lib/RT/Watcher.pm,
+       lib/RT/Action/NotifyWatchers.pm, webrt/Admin/ModifyUser,
+       webrt/Search/Listing.html, webrt/Search/QueueFooter,
+       webrt/Search/QueueHeader, webrt/Search/QueueItem,
+       webrt/Ticket/Displaysummary:
+
+       Did a bit of hacking on webrt2
+       Redid the watchers system according to what I posted earlier to rt-devel
+       Scrips have now broken..but we'll get them working again really soon.
+       Queue Cc and AdminCc now exist in cli adminrt.
+       
+2000-03-22 14:56  tobiasb
+
+       * subscription-definitions.txt:
+
+       definitions in the subscription system
+       
+2000-03-22 14:56  tobiasb
+
+       * subscription-definitions.txt:
+
+       file subscription-definitions.txt was initially added on branch rt-1-1.
+       
+2000-03-22 14:42  tobiasb
+
+       * etc/schema.mysql:
+
+       This is a suggestion about a simple splitting of the Scrips table.  I
+       think the admin tools will be significantly easier to set up if we do
+       it this way.  An administrator can through some UI just add and remove
+       Scrips from a queue.
+       
+2000-03-22 01:02  jesse
+
+       * lib/RT/: ACE.pm, ACL.pm, Action.pm, Area.pm, Areas.pm,
+       Attachment.pm, Attachments.pm, CurrentUser.pm, EasySearch.pm,
+       Queue.pm, Queues.pm, Record.pm, Scrip.pm, Scrips.pm, Template.pm,
+       Templates.pm, Ticket.pm, Tickets.pm, Transaction.pm,
+       Transactions.pm, User.pm, Users.pm, Utils.pm, Watcher.pm,
+       Watchers.pm, Action/AutoReply.pm, Action/MailComment.pm,
+       Action/SendEmail.pm, Interface/Email.pm:
+
+       This may look like a lot of code. but it's not.
+       It's merely the result of running
+       
+       perl -pi.bak -e 's/sub (.*?){\n/# {{{ sub $1\nsub $1 {\n/; s/^}$/}\n# }}}/'
+       
+       basically, this adds # {{{ sub function
+                        and # }}}
+       around all the function names. The main reason to do this is for
+       emacs fold-minor-mode.  It makes things a lot easier to read.
+       In an ideal world, we'd have perl-aware folding editor and there'd be
+       no need for this markup
+       
+2000-03-21 20:38  jesse
+
+       * lib/RT/: Queue.pm, Ticket.pm, Watcher.pm, Watchers.pm:
+
+       Work on watchers.
+       
+2000-03-20 15:21  jesse
+
+       * etc/schema.mysql:
+
+       Modified the schema for my "New Improved Watchers" system. Basically,
+       now you'll be able to tie a template to a given watch. along with a
+       boolean "send mail" flag.  We'll need a special "Mail Watchers" action to
+       make this all work..but the code should be pretty easy.
+       
+               jesse
+       
+2000-03-20 05:27  tobiasb
+
+       * bin/initdb.mysql:
+
+       bugfix
+       
+2000-03-17 15:20  jesse
+
+       * webrt/Ticket/Create.html:
+
+       file Create.html was initially added on branch rt-1-1.
+       
+2000-03-17 15:20  jesse
+
+       * webrt/Ticket/DisplayHeader:
+
+       file DisplayHeader was initially added on branch rt-1-1.
+       
+2000-03-17 15:20  jesse
+
+       * webrt/Ticket/SetOwner:
+
+       file SetOwner was initially added on branch rt-1-1.
+       
+2000-03-17 15:20  jesse
+
+       * webrt/Ticket/SetStatus:
+
+       file SetStatus was initially added on branch rt-1-1.
+       
+2000-03-17 15:20  jesse
+
+       * webrt/Ticket/: Create.html, Display.html, DisplayHeader,
+       Displaysummary, SetOwner, SetStatus, Update.html:
+
+       More work on the basic webui
+       
+2000-03-17 15:20  jesse
+
+       * webrt/Ticket/Displaysummary:
+
+       file Displaysummary was initially added on branch rt-1-1.
+       
+2000-03-17 11:32  tobiasb
+
+       * bin/initdb.mysql:
+
+       Bugfix, the password passing didn't work as it should.
+       
+2000-03-17 10:52  tobiasb
+
+       * etc/schema.mysql:
+
+       - Slashed away the old "MailQueueMembersOn..." junk.
+       
+       - Added Scrips to the Watchers table.  ... the Watchers/Scrips system
+       seems quite flexible .. BUT .. I have a certain feeling that it might
+       be hard to make administration tools that helps a non-hacking
+       administrator to find out which mails are sent where, etc.  Well,
+       that's something we'll have to worry about later :)
+       
+2000-03-17 08:47  tobiasb
+
+       * Makefile, etc/schema.mysql:
+
+       removed some instanses of 'su' that really shouldn't be needed, and which also broke on anything but GNU shellutils
+       
+2000-03-17 07:32  tobiasb
+
+       * README:
+
+       Some additions and changes to reflect that this is, after all, a
+       development version.  Meri, do you subscribe to cvs-commit? :)
+       
+2000-03-17 06:01  tobiasb
+
+       * etc/schema.mysql:
+
+       # Those subscription field are not used in RT 1.1 as I see it.
+       # I think we should modify the Scrips system so it by default
+       # respects those fields.
+        MailOwnerOnTransaction INT,             # notify owner on transaction
+        MailMembersOnTransaction INT,          # notify list members on transaction
+        MailRequestorOnTransaction INT,        # notify requestor on transaction
+        MailRequestorOnCreation INT,           # notify user on creation
+        MailMembersOnCorrespondence INT,               # notify members on creation
+        MailMembersOnComment INT,              # notify members on comment
+       
+2000-03-16 16:31  jesse
+
+       * webrt/: Search/Listing.html, Ticket/Display.html,
+       Ticket/Modify.html, Ticket/ProcessUpdate.html, Ticket/Update.html,
+       Ticket/ValidateUpdate.html:
+
+       The beginnings of the All New! Web UI based around HTML::Mason
+       There's nothing functional here yet. but it's a start at a framework.
+       Ticket/Update.html is probably the closest to "real" code so far.
+       
+2000-03-16 16:31  jesse
+
+       * webrt/Ticket/ValidateUpdate.html:
+
+       file ValidateUpdate.html was initially added on branch rt-1-1.
+       
+2000-03-16 16:31  jesse
+
+       * webrt/Ticket/Display.html:
+
+       file Display.html was initially added on branch rt-1-1.
+       
+2000-03-16 16:31  jesse
+
+       * webrt/Ticket/Modify.html:
+
+       file Modify.html was initially added on branch rt-1-1.
+       
+2000-03-16 16:31  jesse
+
+       * webrt/Search/Listing.html:
+
+       file Listing.html was initially added on branch rt-1-1.
+       
+2000-03-16 16:31  jesse
+
+       * webrt/Ticket/ProcessUpdate.html:
+
+       file ProcessUpdate.html was initially added on branch rt-1-1.
+       
+2000-03-16 16:31  jesse
+
+       * webrt/Ticket/Update.html:
+
+       file Update.html was initially added on branch rt-1-1.
+       
+2000-03-16 14:46  tobiasb
+
+       * Makefile:
+
+       Changed the default database name from rt to RT to avoid confusion with previously installed versions of rt
+       
+2000-03-16 02:34  tobiasb
+
+       * lib/RT/User.pm:
+
+       Bugfixes:  It was impossible not to give requests to somebody.
+       
+2000-03-16 01:32  tobiasb
+
+       * lib/RT/Interface/Email.pm:
+
+       Bugfixes
+       
+       was
+       
+         if ($CurrentUser->Id == 0) {
+           #If it fails, create a user
+       
+       now
+       
+         unless ($CurrentUser->Id) {
+           #If it fails, create a user
+       
+       as Id returned undef.
+       
+       Changed 'Queue' to 'QueueTag'.
+       
+       Added some few comments
+       
+2000-03-14 00:40  jesse
+
+       * README:
+
+       Modified the README for the beginnings of the new webui
+       
+2000-03-14 00:39  jesse
+
+       * bin/: rtmux.pl, webmux.pl:
+
+       added webmux. modified rtmux.pl to clean out some cruft
+       
+2000-03-14 00:39  jesse
+
+       * bin/webmux.pl:
+
+       file webmux.pl was initially added on branch rt-1-1.
+       
+2000-03-13 12:53  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       rt-mailgate has now recieved and logged correspondence and comments with current schema.
+       
+2000-03-08 23:26  jesse
+
+       * lib/RT/: Ticket.pm, Transaction.pm:
+
+       DBIx cleanups to deal with load by id when id is null
+       Work on comment and correspond. Eventually, we'll get the
+       per-transaction cc and bcc working.
+       
+2000-03-08 18:22  jesse
+
+       * bin/rtmux.pl, lib/RT/Queue.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, lib/RT/User.pm:
+
+       rtq works a bit better
+       rtadmin works again.
+       rtadmin -user create
+               -user modify
+        both seem to work ok
+       
+       rt -create now makes sure a queue exists and permits ticket creation
+       rt -create now make sure a prospective owner has queue membership.
+       
+2000-03-02 17:23  tobiasb
+
+       * lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Action/SendEmail.pm, etc/schema.mysql:
+
+       resolve, open, take (if unowned, at least) seems to work
+       
+2000-03-02 16:10  tobiasb
+
+       * lib/RT/: Ticket.pm, Ticket.pm:
+
+       Bugfixing
+       
+2000-03-02 14:35  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Correspondence almost works
+       
+2000-03-02 13:26  tobiasb
+
+       * lib/RT/Ticket.pm, lib/RT/Action/MailComment.pm, etc/schema.mysql:
+
+       Comments almost work now (from the cli)
+       
+2000-03-02 12:38  tobiasb
+
+       * lib/RT/Action/: MailComment.pm, MailCorrespondence.pm:
+
+       one minor bugfix + some comments
+       
+2000-03-01 23:58  jesse
+
+       * NEWS:
+
+       brought the news up to date.
+       nuked old /contrib
+       nuked old /etc/templates.
+       
+       bedtime now.
+       
+2000-03-01 23:57  jesse
+
+       * NEWS:
+
+       brought the news up to date (a bit)
+       
+2000-03-01 23:50  jesse
+
+       * Makefile:
+
+       removed a lot of outdated cruft.
+       Bumped the version to 1.1.11 for a release later this week.
+       
+2000-03-01 23:18  jesse
+
+       * lib/RT/: Ticket.pm, Interface/Email.pm:
+
+       The mail gateway now lets you create, comment and correspond on tickets.
+       Ticket->Owner now deals better when the owner is NULL
+       
+2000-03-01 21:27  jesse
+
+       * HACKING:
+
+       minor comments added to hacking
+       
+2000-03-01 21:20  jesse
+
+       * HACKING:
+
+       Trivial change to HACKING to test commitinfo
+       
+2000-03-01 21:09  jesse
+
+       * lib/RT/Interface/Email.pm:
+
+       file Email.pm was initially added on branch rt-1-1.
+       
+2000-03-01 21:09  jesse
+
+       * bin/rtmux.pl, lib/RT/Interface/Email.pm:
+
+       work on mailgate
+       
+2000-03-01 18:36  tobiasb
+
+       * docs/design_docs/TransactionTypes.txt, etc/schema.mysql:
+
+       Some loose thoughts only ... as comments and a doc which I'm not sure
+       if it's possible to understand by others than me anyway :)
+       
+       Anyway, it is too complex.  We'll just continue following the current design.
+       
+2000-03-01 18:36  tobiasb
+
+       * docs/design_docs/TransactionTypes.txt:
+
+       file TransactionTypes.txt was initially added on branch rt-1-1.
+       
+2000-03-01 17:51  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Seems like it's a lot of things that doesn't work here.
+       
+2000-03-01 16:26  tobiasb
+
+       * etc/schema.mysql:
+
+       Ehm ... maybe I forgot to commit this one.  It contains some fixes.
+       
+2000-03-01 16:08  jesse
+
+       * TODO:
+
+       ripped a bit of obsolete code from rtmux.pl
+       updated the TODO to reference the production instance of RT.
+       
+2000-03-01 14:48  jesse
+
+       * bin/rtmux.pl:
+
+       removed the old web ui hooks from rtmux.pl
+       
+2000-03-01 12:12  tobiasb
+
+       * lib/RT/: Action.pm, Scrip.pm, Template.pm, Ticket.pm,
+       Watchers.pm, Action/AutoReply.pm, Action/SendEmail.pm:
+
+       I've done some debugging and polishing.  I hope it won't break with stuff you're eventually working with
+       
+2000-02-29 16:58  tobiasb
+
+       * lib/RT/: Queue.pm, Ticket.pm, Watchers.pm:
+
+       One sort of bugfix..
+       
+2000-02-29 16:35  tobiasb
+
+       * lib/RT/: Queue.pm, Template.pm, Ticket.pm, Watcher.pm,
+       Watchers.pm, Action/SendEmail.pm:
+
+       Scrips work for me.  Well, I'm not that sure anyway.  I had actually
+       expected one email to drop in for each Scrip - but I only got the
+       AutoReply and the Correspondence.  Maybe I should debug even more.
+       
+2000-02-29 14:29  tobiasb
+
+       * lib/RT/Watchers.pm:
+
+       LimitToTicket updated (not tested, though)
+       LimitToQueue added     (not tested, though)
+       
+2000-02-29 14:27  tobiasb
+
+       * etc/schema.mysql:
+
+       
+       # Primarly used by RT::Actions::SendEmail as well as some subclasses
+       # to determinate whom to send emails to.  This scheme should work out
+       # better than the scheme under RT 1.0, and should suit most users.
+       # For more fine grained control, it's possible to create tables as you
+       # like and make a new subclass of RT::Actions::SendEmail where the
+       # SetRecepients sub is overloaded :)
+       
+       CREATE TABLE Watchers (
+          id int(11) AUTO_INCREMENT PRIMARY KEY,
+          Value int(11),
+          Scope varchar(16), # Might be "Queue" and "Ticket" as for now
+                             # ... might be extended to "Keywords", "Owners", etc.
+          Email VARCHAR(255),
+          Type VARCHAR(16), #Requestor, Cc, Bcc
+          Creator INT(11),
+          Created TIMESTAMP,
+          LastUpdatedBy INT(11),
+          LastUpdated TIMESTAMP
+       )\g
+       
+2000-02-29 13:40  tobiasb
+
+       * etc/schema.mysql:
+
+       CREATE TABLE Watchers (
+          id int(11) AUTO_INCREMENT PRIMARY KEY,
+          Ticket int(11), # 0 for all
+          Queue int(11), # 0 for all
+               # We might consider adding more power here,
+               # i.e. TransactionType, Scrip, etc
+          Email VARCHAR(255),
+          Type VARCHAR(16), #Requestor, Cc, Bcc
+          Creator INT(11),
+          Created TIMESTAMP,
+          LastUpdatedBy INT(11),
+          LastUpdated TIMESTAMP
+       )\g
+       
+2000-02-29 10:43  tobiasb
+
+       * etc/schema.mysql:
+
+       Template.{content and title} => Content and Title - since we use
+       UpperCase in the rest of the DD.
+       
+2000-02-29 10:31  tobiasb
+
+       * etc/schema.mysql:
+
+       Blob, that is..
+       
+2000-02-29 10:12  tobiasb
+
+       * etc/schema.mysql:
+
+       Added ExtraHeaders as VARCHAR(255).  255 characters should be enough
+       for storing some few extra header lines, but anyway maybe it should
+       have been blob instead?
+       
+2000-02-29 09:51  tobiasb
+
+       * lib/RT/: Attachment.pm, Action/AutoReply.pm, Action/SendEmail.pm:
+
+       I've continued the work on mail sending.  There is still some missing
+       stuff:
+       
+       1. EasySearch/Scrips issue - currently it doesn't properly output "
+       all scrips that has (queue=0 or queue=this) and (type="any" or type=this)".
+       
+       2. A serious stub in RT::Action::SendEmail - I don't know where to find
+       "interessted parties".  I think it could be nice putting queue watchers
+       in the same table as ticket watchers.
+       
+2000-02-29 09:42  tobiasb
+
+       * lib/RT/Scrips.pm:
+
+       Hack - everything that applies for a Correspondence action also
+       applies for a Create action (I'd daresay).
+       
+2000-02-29 07:02  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       Some insignificant changes.  Well, one marginally significant; it
+       shouldn't $Scrip->Commit unless $Scrip->Prepare()
+       
+2000-02-29 04:12  tobiasb
+
+       * etc/schema.mysql:
+
+       I've started at general transaction emails.
+       
+2000-02-29 03:58  tobiasb
+
+       * lib/RT/Watchers.pm:
+
+       Added an Emails method.  It can be used like:
+       
+          print join(",", @{$Watchers->Emails("Requestors")});
+       
+       or
+       
+          $Watchers->LimitToRequestors;
+          $Emails=$Watchers->Emails;
+       
+       ...
+       
+2000-02-29 02:31  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       Sender => RT-Originator
+       
+2000-02-29 00:40  jesse
+
+       * README:
+
+       Added Into Netowrks and Funcom to the thanks at the top of the readme
+       `
+       
+2000-02-28 23:20  jesse
+
+       * Makefile:
+
+       RT 1.1.10 released. Tobix has autoreply basically working :)
+       
+2000-02-28 22:49  jesse
+
+       * Makefile, NEWS, README:
+
+       Fixed a longstanding bug in the WebRT administrator
+       added a note about stripmime to the readme.
+       added a bit of code from curl.com that adds functionality to rtq for reporting
+       
+2000-02-28 22:17  jesse
+
+       * Makefile, NEWS:
+
+       bumped the version for release of 1.0.2
+       
+2000-02-28 11:33  tobiasb
+
+       * lib/RT/: Template.pm, Transaction.pm, Action/AutoReply.pm,
+       Action/SendEmail.pm:
+
+       AutoReply seems to work now ... except that rtadmin didn't set email
+       aliases for the queue, so the mail bounces with invalid from address.
+       I won't look more at this until tomorrow.  You're very welcome to take
+       over for a while if you feel like it :)
+       
+2000-02-28 11:29  tobiasb
+
+       * etc/schema.mysql:
+
+       AutoReply seems to work now
+       
+2000-02-28 08:18  tobiasb
+
+       * HACKING:
+
+       Added some hints and misc.  Please look through.
+       
+2000-02-28 05:25  tobiasb
+
+       * lib/RT/: Ticket.pm, Transaction.pm, Action/AutoReply.pm,
+       Action/SendEmail.pm:
+
+       - The queue tag rather than queue id is delievered from the cli, this
+         broke in Ticket::Create.  Fixed.
+       
+       - The Attachments have to be assigned to a transaction before Scrips
+          is run.  Now the Attachments are delievered as a part of the parameters
+          to Transaction::Create
+       
+2000-02-27 23:28  tobiasb
+
+       * etc/schema.mysql:
+
+       Fixed the AutoReply template ... still not tested, though.
+       
+2000-02-27 22:04  tobiasb
+
+       * lib/RT/Action/: AutoReply.pm, SendEmail.pm:
+
+       I think we can nuke the old rt/lib/rt/support/mail.pm now - everything
+       should be located in SendEmail.pm, AutoReply.pm and Template.pm by now :)
+       
+       It's not tested yet, and the templates needs upgrading.  Anyway, I will
+       probably not mess more around with the perl code as for now.
+       
+2000-02-27 21:43  tobiasb
+
+       * bin/rtmux.pl:
+
+       Seems like $rtversion="!!RT_VERSION!!" had disappeared.  I renamed the
+       variable to $VERSION.
+       
+2000-02-27 21:22  jesse
+
+       * lib/RT/Ticket.pm:
+
+       dates now display in the cli.
+       
+2000-02-27 20:53  tobiasb
+
+       * lib/RT/Templates.pm:
+
+       Fixed DBIx::EasySearch => RT::EasySearch
+       
+2000-02-27 20:53  tobiasb
+
+       * lib/RT/Template.pm:
+
+       Method Template::Parse added, Text::Template used for the moment.
+       
+       (sigh ... that means my next worktask will be to update the
+       templates...)
+       
+2000-02-27 20:49  jesse
+
+       * lib/RT/Ticket.pm:
+
+       so. Ticket->Create now actually figures out ccs and bccs and requestors from the mime
+       object passed in to it.
+       
+2000-02-27 19:05  jesse
+
+       * lib/RT/Transaction.pm:
+
+       added a comment for tobias about a new line that didn't make sense.
+       
+2000-02-27 18:46  jesse
+
+       * lib/RT/: Ticket.pm, Watchers.pm:
+
+       watchers updates.
+       
+2000-02-27 17:25  tobiasb
+
+       * lib/RT/Template.pm:
+
+       file Template.pm was initially added on branch rt-1-1.
+       
+2000-02-27 17:25  tobiasb
+
+       * lib/RT/: Attachment.pm, Template.pm, Templates.pm,
+       Action/AutoReply.pm, Action/SendEmail.pm:
+
+       Development snapshot.  I guess I'll have it working in half an hour
+       with _efficient_ working, that is some four hours working at my
+       current efficiency rate :/
+       
+2000-02-27 17:25  tobiasb
+
+       * lib/RT/Templates.pm:
+
+       file Templates.pm was initially added on branch rt-1-1.
+       
+2000-02-27 16:43  tobiasb
+
+       * etc/schema.mysql:
+
+       Added some templates
+       
+2000-02-27 11:19  tobiasb
+
+       * lib/RT/: Scrip.pm, Transaction.pm:
+
+       development snapshot
+       
+2000-02-27 10:31  tobiasb
+
+       * lib/RT/Action/: AutoReply.pm, MailComment.pm,
+       MailCorrespondence.pm, SendEmail.pm:
+
+       I've started bashing at the mail sending functionallity.  It seemed quite
+       stubbed to me.
+       
+2000-02-24 03:44  tobiasb
+
+       * etc/schema.mysql:
+
+       minor bug in comment
+       
+2000-02-24 03:24  tobiasb
+
+       * lib/RT/Action/SendEmail.pm:
+
+       clearing out a potential weird bug
+       
+2000-02-24 00:27  jesse
+
+       * lib/RT/Scrips.pm:
+
+       Fixed a typo in my code near tobix' changes to Scrips.pm. his changes look good.
+       
+2000-02-24 00:03  jesse
+
+       * Makefile, NEWS, README:
+
+       little fix to mail manipulate from "Heather L. Sherman" <heather@idealab.com>
+       
+2000-02-23 17:06  tobiasb
+
+       * lib/RT/: Scrips.pm, Action/SendEmail.pm:
+
+       Some small fixes.  You'd better look through it, as I'm not completely sure what I'm doing :)
+       
+2000-02-23 16:07  tobiasb
+
+       * etc/schema.mysql:
+
+       An insert entry here reffers to SendMail.pm, while the file is SendEmail.pm
+       
+2000-02-23 15:26  jesse
+
+       * docs/rt-templates.html:
+
+       [no log message]
+       
+2000-02-23 11:38  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Could not get 'rt -create' working.  It seems more sane now, but I'm not really sure what I'm doing ... so you should have a peek at it.  I changed  $Id->SUPER::_Set("EffectiveId",$id); to $self->SUPER::_Set etc
+       
+2000-02-22 23:35  jesse
+
+       * lib/RT/InterestedParty.pm:
+
+       removed vestigal code
+       
+2000-02-22 23:25  jesse
+
+       * etc/schema.mysql, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/Transactions.pm, lib/RT/Watchers.pm:
+
+       A bit more work on watchers. we're getting close.
+       rtq works today.
+       rt -create basically works.
+       rt -take works.
+       
+       rt -show will now start to show ownership changes.
+       
+2000-02-22 08:06  jesse
+
+       * Makefile, etc/schema.mysql, lib/RT/Ticket.pm:
+
+       Work on Watchers.  Most of the code needed to make this work is now
+       present. sadly I haven't even _tried_ to run it yet.
+       
+2000-02-21 01:33  jesse
+
+       * lib/RT/Watcher.pm:
+
+       file Watcher.pm was initially added on branch rt-1-1.
+       
+2000-02-21 01:33  jesse
+
+       * lib/RT/: InterestedParties.pm, InterestedParties.pm~,
+       Notification.pm, Ticket.pm, Watcher.pm, Watchers.pm:
+
+       Renamed interested parties to "Watchers"
+       Watchers are now keyed by EmailAddress rather than UserId. Not every CC will have an rt account, i think
+       
+2000-02-21 01:33  jesse
+
+       * lib/RT/Watchers.pm:
+
+       file Watchers.pm was initially added on branch rt-1-1.
+       
+2000-02-20 18:28  jesse
+
+       * lib/RT/InterestedParties.pm~:
+
+       file InterestedParties.pm~ was initially added on branch rt-1-1.
+       
+2000-02-20 18:28  jesse
+
+       * lib/RT/InterestedParties.pm:
+
+       file InterestedParties.pm was initially added on branch rt-1-1.
+       
+2000-02-20 18:28  jesse
+
+       * lib/RT/InterestedParty.pm:
+
+       file InterestedParty.pm was initially added on branch rt-1-1.
+       
+2000-02-20 18:28  jesse
+
+       * lib/RT/: InterestedParties.pm, InterestedParties.pm~,
+       InterestedParty.pm:
+
+       [no log message]
+       
+2000-02-20 18:24  jesse
+
+       * etc/schema.mysql, lib/RT/Ticket.pm:
+
+       [no log message]
+       
+2000-02-20 15:27  jesse
+
+       * etc/schema.mysql, lib/RT/Action.pm, lib/RT/Scrip.pm,
+       lib/RT/Action/AutoReply.pm, lib/RT/Action/SendEmail.pm:
+
+       Work on scrips. stubs for the webui
+       
+2000-02-19 17:45  jesse
+
+       * lib/RT/: Action.pm, Scrip.pm:
+
+       work on actions. checking in for eric to take a look
+       
+2000-02-19 16:48  jesse
+
+       * lib/RT/Action/AutoReply.pm:
+
+       file AutoReply.pm was initially added on branch rt-1-1.
+       
+2000-02-19 16:48  jesse
+
+       * lib/RT/Action/MailCorrespondence.pm:
+
+       file MailCorrespondence.pm was initially added on branch rt-1-1.
+       
+2000-02-19 16:48  jesse
+
+       * lib/RT/Action.pm:
+
+       file Action.pm was initially added on branch rt-1-1.
+       
+2000-02-19 16:48  jesse
+
+       * lib/RT/Action/MailComment.pm:
+
+       file MailComment.pm was initially added on branch rt-1-1.
+       
+2000-02-19 16:48  jesse
+
+       * lib/RT/: Action.pm, Action/AutoReply.pm, Action/MailComment.pm,
+       Action/MailCorrespondence.pm, Action/SendEmail.pm:
+
+       As it turns out, Action needed to be abstracted a bit and renamed.
+       
+       I'm also making the Object syntax a bit.
+       
+2000-02-19 16:48  jesse
+
+       * lib/RT/Action/SendEmail.pm:
+
+       file SendEmail.pm was initially added on branch rt-1-1.
+       
+2000-02-17 09:19  jesse
+
+       * etc/schema.mysql, lib/RT/Scrip.pm, lib/RT/Scrips.pm,
+       lib/RT/Transaction.pm:
+
+       The base architecture for Scrips to work should now be in place.
+       Next up: write example "Actions" (gotta move the Scrips directory to Actions)
+       for the scrip handlers to use.
+       
+2000-02-16 09:59  jesse
+
+       * lib/RT/: Scrip.pm, Transaction.pm:
+
+       Starting to make scrips actually work
+       
+2000-02-10 23:24  jesse
+
+       * lib/RT/Scrips.pm:
+
+       file Scrips.pm was initially added on branch rt-1-1.
+       
+2000-02-10 23:24  jesse
+
+       * lib/RT/: Scrip.pm, Scrips.pm, Transaction.pm:
+
+       more work stubbing scrips. but now my arms hurt badly enough that i'm going to log out.
+       
+2000-02-10 23:24  jesse
+
+       * lib/RT/Scrip.pm:
+
+       file Scrip.pm was initially added on branch rt-1-1.
+       
+2000-01-31 02:38  tobiasb
+
+       * README, lib/RT/Attachments.pm:
+
+       does the commit automail work now?
+       
+2000-01-30 23:54  jesse
+
+       * NEWS, README, etc/schema.mysql, lib/RT/CurrentUser.pm,
+       lib/RT/Record.pm, lib/RT/User.pm:
+
+       Work on the User object.
+       The mail gateway now autocreates users. (This will make more sense
+       once we start tying tickets to users by means of the InterestedParties table.
+       
+2000-01-29 01:33  jesse
+
+       * Makefile:
+
+       makefile cleanup. including removing the C compiler and template and
+       transaction directories
+       
+2000-01-29 01:30  jesse
+
+       * Makefile:
+
+       removed C compiler from the makefile
+       
+2000-01-29 01:25  jesse
+
+       * Makefile:
+
+       Removed C compiler from the makefile. we just don't need it anymore
+       
+2000-01-29 01:22  jesse
+
+       * Makefile:
+
+       bumped version to 1-1-8
+       
+2000-01-29 01:20  jesse
+
+       * Makefile:
+
+       removed template and transaction paths from the makefile.
+       (to test new cvs wrappers and cuz they should be gona anyway)
+       
+2000-01-29 00:26  jesse
+
+       * etc/schema.mysql:
+
+       Started to do work on scrips. see the schema for how it would work.
+       
+2000-01-28 20:04  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Some modifications and bugfixes on the messages popping up after a `successful' correspondence/comment
+       
+2000-01-28 19:47  tobiasb
+
+       * lib/RT/Ticket.pm:
+
+       Removed some annoying warnings.  I don't know if this is the "right"
+       way to remove them, but it works (for me, at least), it's an easy
+       way to do it, and it's harmless;
+       
+       instead of writing
+               $var_that_might_be_undef
+       I write
+               $var_that_might_be_undef || ""
+       eventually with parantheses, and eventually with "" replaced by 0, or maybe
+       (not tested) even undef.
+       
+2000-01-28 13:22  tobiasb
+
+       * Makefile:
+
+       Two substitution parameters was forgotten in config.pm
+       
+2000-01-28 13:12  tobiasb
+
+       * etc/schema.mysql:
+
+       Oups, committed the wrong file
+       
+2000-01-28 13:10  tobiasb
+
+       * Makefile, etc/schema.mysql:
+
+       Two substitution parameters was forgotten in config.pm
+       
+2000-01-27 04:09  tobiasb
+
+       * Makefile, bin/initdb.mysql:
+
+       small password fix
+       
+2000-01-25 23:26  jesse
+
+       * Makefile:
+
+       bumped the version to 1.1.7 for tonight's release.
+       
+2000-01-25 23:12  jesse
+
+       * lib/RT/: Attachments.pm, Ticket.pm, Transaction.pm:
+
+       DBIx::EasySearch now has a -> First method. which is like -> Next, but picks
+       the first element
+       
+       DBIx::Record -> now returns '' rather than undef for null values. it's less
+       likely to break interfaces.
+       
+2000-01-25 16:36  tobiasb
+
+       * README:
+
+       aargh
+       
+2000-01-25 16:31  tobiasb
+
+       * TODO:
+
+       test
+       
+2000-01-25 14:57  tobiasb
+
+       * etc/schema.mysql:
+
+       bugfix
+       
+2000-01-25 14:44  tobiasb
+
+       * Makefile:
+
+       removed obsoleteness
+       
+2000-01-25 14:37  tobiasb
+
+       * README:
+
+       The UPGRADE section of the README was inaccurate
+       
+2000-01-25 14:31  tobiasb
+
+       * lib/RT/Transaction.pm:
+
+       comment bug
+       
+2000-01-24 01:45  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+2000-01-24 01:43  jesse
+
+       * Makefile, NEWS, lib/RT/Attachment.pm, lib/RT/Attachments.pm,
+       lib/RT/Record.pm, lib/RT/Ticket.pm, lib/RT/Tickets.pm,
+       lib/RT/Transaction.pm, lib/RT/Transactions.pm:
+
+       
+       * Attachments support in code. rtq now basically works
+         Mailgate creates new tickets
+         rt -show now works a bit (doesn't display transaction content yet)
+         rt -subject works. several other commandline tools work
+       
+2000-01-23 18:32  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+2000-01-23 18:27  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+2000-01-23 18:19  jesse
+
+       * etc/schema.mysql, lib/RT/Attachment.pm, lib/RT/Attachments.pm,
+       lib/RT/Ticket.pm, lib/RT/Transaction.pm:
+
+       Work to make attachments work. So far we've got something that puts attachments
+       in the database.
+       
+2000-01-21 12:25  tobiasb
+
+       * README:
+
+       doc-bugfix
+       
+2000-01-18 23:56  jesse
+
+       * lib/RT/Ticket.pm:
+
+       work on the mail gateway. (mainly disemboweled it)
+       
+2000-01-18 00:34  jesse
+
+       * lib/RT/Attachments.pm:
+
+       file Attachments.pm was initially added on branch rt-1-1.
+       
+2000-01-18 00:34  jesse
+
+       * docs/API:
+
+       file API was initially added on branch rt-1-1.
+       
+2000-01-18 00:34  jesse
+
+       * lib/RT/Attachment.pm:
+
+       file Attachment.pm was initially added on branch rt-1-1.
+       
+2000-01-18 00:34  jesse
+
+       * HACKING:
+
+       file HACKING was initially added on branch rt-1-1.
+       
+2000-01-18 00:34  jesse
+
+       * HACKING, Makefile, docs/API, etc/schema.mysql,
+       lib/RT/Attachment.pm, lib/RT/Attachments.pm, lib/RT/CurrentUser.pm,
+       lib/RT/Queue.pm, lib/RT/Record.pm, lib/RT/Ticket.pm,
+       lib/RT/Transaction.pm, lib/RT/Utils.pm:
+
+       work on attachments.
+       work on structure
+       
+2000-01-17 12:59  jesse
+
+       * Makefile, etc/schema.mysql, lib/RT/ACE.pm, lib/RT/ACL.pm,
+       lib/RT/CurrentUser.pm, lib/RT/Queue.pm, lib/RT/Queues.pm,
+       lib/RT/Ticket.pm, lib/RT/Tickets.pm, lib/RT/Transaction.pm,
+       lib/RT/Transactions.pm, lib/RT/User.pm, lib/RT/Users.pm:
+
+       work on create. work on attachments. upcased the table names.
+       
+2000-01-14 15:34  jesse
+
+       * etc/schema.mysql:
+
+       work on schema
+       
+2000-01-14 14:47  jesse
+
+       * NEWS, etc/schema:
+
+       schema change to make long email addresses work better for queue members.
+       
+2000-01-14 01:07  jesse
+
+       * lib/RT/: EasySearch.pm, Record.pm, Ticket.pm, Tickets.pm,
+       Transaction.pm:
+
+       basic searches now work.
+       comments almost work.
+       creates are having an issue with effectiveid not getting set.
+       
+2000-01-13 18:04  jesse
+
+       * Makefile, lib/RT/EasySearch.pm, lib/RT/Tickets.pm:
+
+       [no log message]
+       
+2000-01-13 15:03  jesse
+
+       * lib/RT/Utils.pm:
+
+       file Utils.pm was initially added on branch rt-1-1.
+       
+2000-01-13 15:03  jesse
+
+       * lib/RT/Utils.pm:
+
+       [no log message]
+       
+2000-01-09 20:38  jesse
+
+       * lib/RT/EasySearch.pm:
+
+       file EasySearch.pm was initially added on branch rt-1-1.
+       
+2000-01-09 20:38  jesse
+
+       * lib/RT/: EasySearch.pm, Queue.pm, Queues.pm, Record.pm,
+       Tickets.pm:
+
+       added RT/EasySearch.pm
+       
+       rtadmin queue -list will now show all queues.
+       removed some debugging output
+       
+2000-01-04 01:21  jesse
+
+       * etc/schema.mysql, lib/RT/CurrentUser.pm, lib/RT/Queue.pm,
+       lib/RT/Record.pm, lib/RT/Ticket.pm, lib/RT/Transaction.pm,
+       lib/RT/User.pm:
+
+       Lots of work. first working ticket update.
+       
+2000-01-04 01:21  jesse
+
+       * lib/RT/CurrentUser.pm:
+
+       file CurrentUser.pm was initially added on branch rt-1-1.
+       
+2000-01-03 07:40  tobiasb
+
+       * README, README:
+
+       bugfix
+       
+2000-01-03 01:39  jesse
+
+       * lib/RT/: Record.pm, Ticket.pm, User.pm:
+
+       basic create support working.
+       more boackend and abstraction work
+       
+2000-01-02 22:04  jesse
+
+       * lib/RT/Ticket.pm:
+
+       [no log message]
+       
+2000-01-02 20:31  jesse
+
+       * lib/RT/: ACE.pm, Area.pm, Queue.pm, Record.pm, Ticket.pm,
+       Transaction.pm, User.pm:
+
+       work on a buit more abstraction
+       
+2000-01-01 19:01  jesse
+
+       * etc/schema.mysql, lib/RT/ACE.pm, lib/RT/Ticket.pm,
+       lib/RT/User.pm:
+
+       work on Ticket.pm, schema.
+       things are starting to use immutable ids when referring to other tables.
+       
+1999-12-30 02:13  jesse
+
+       * Makefile, etc/schema.mysql, lib/RT/Queue.pm, lib/RT/Record.pm,
+       lib/RT/User.pm:
+
+       reworked things to use autoloaded functions.
+       
+1999-12-29 00:24  jesse
+
+       * Makefile, bin/rtmux.pl, etc/schema.mysql, lib/RT/ACE.pm,
+       lib/RT/Area.pm, lib/RT/Queue.pm, lib/RT/Record.pm,
+       lib/RT/Ticket.pm, lib/RT/Transaction.pm, lib/RT/User.pm:
+
+       lots of changes. some of them not quite done perfectly.
+       but admin is closer
+       
+1999-12-28 01:39  jesse
+
+       * bin/rtmux.pl, etc/config.pm, lib/RT/ACE.pm, lib/RT/ACL.pm,
+       lib/RT/Area.pm, lib/RT/Areas.pm, lib/RT/Notification.pm,
+       lib/RT/Queue.pm, lib/RT/Queues.pm, lib/RT/Record.pm,
+       lib/RT/Ticket.pm, lib/RT/Tickets.pm, lib/RT/Transaction.pm,
+       lib/RT/Transactions.pm, lib/RT/User.pm, lib/RT/Users.pm:
+
+       rtadmin will now invoke and exit.
+       
+1999-12-27 19:54  jesse
+
+       * Makefile, bin/initacls.mysql, bin/rtmux.pl, etc/acl.mysql,
+       etc/config.pm, lib/RT/Record.pm:
+
+       first steps toward runability
+       
+1999-12-27 01:51  jesse
+
+       * Makefile, bin/rtmux.pl, etc/config.pm:
+
+       trying to get the config worked out
+       
+1999-12-26 21:58  jesse
+
+       * Makefile, Makefile:
+
+       [no log message]
+       
+1999-12-26 21:55  jesse
+
+       * Makefile, Makefile:
+
+       [no log message]
+       
+1999-12-26 21:53  jesse
+
+       * Makefile, Makefile, Makefile:
+
+       [no log message]
+       
+1999-12-26 21:51  jesse
+
+       * Makefile, Makefile, Makefile:
+
+       [no log message]
+       
+1999-12-26 21:45  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1999-12-26 21:42  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1999-12-26 21:34  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1999-12-26 21:19  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1999-12-26 18:35  jesse
+
+       * Makefile:
+
+       work on the makefile
+       
+1999-12-26 17:42  jesse
+
+       * lib/RT/User.pm:
+
+       more fixes for the new Handle object
+       
+1999-12-26 17:03  jesse
+
+       * bin/rtmux.pl, lib/RT/ACL.pm, lib/RT/Areas.pm, lib/RT/Queues.pm,
+       lib/RT/Tickets.pm, lib/RT/Transactions.pm, lib/RT/Users.pm:
+
+       more work on making everything use DBIx::Handle
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Ticket.pm:
+
+       file Ticket.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Queue.pm:
+
+       file Queue.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Transaction.pm:
+
+       file Transaction.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Notification.pm:
+
+       file Notification.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/ACE.pm:
+
+       file ACE.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Areas.pm:
+
+       file Areas.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/ACL.pm:
+
+       file ACL.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Users.pm:
+
+       file Users.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Database.pm:
+
+       file Database.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Tickets.pm:
+
+       file Tickets.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Queues.pm:
+
+       file Queues.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Transactions.pm:
+
+       file Transactions.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Area.pm:
+
+       file Area.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/: ACE.pm, ACL.pm, Area.pm, Areas.pm, Database.pm,
+       Notification.pm, Queue.pm, Queues.pm, Record.pm, Ticket.pm,
+       Tickets.pm, Transaction.pm, Transactions.pm, User.pm, Users.pm:
+
+       moving things to a more sane directory
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/Record.pm:
+
+       file Record.pm was initially added on branch rt-1-1.
+       
+1999-12-26 15:58  jesse
+
+       * lib/RT/User.pm:
+
+       file User.pm was initially added on branch rt-1-1.
+       
+1999-12-23 01:05  jesse
+
+       * Makefile, NEWS:
+
+       23 Dec 1999
+       -----------
+       
+       * Enabled a status = unresolved option for the web ui. thanks to
+         brandon allbery <allbery@ece.cmu.edu> and Marion Hakanson <hakanson@cse.ogi.edu>
+       
+       * Made most of the permissions and directory changes from Marion
+         Hakanson <hakanson@cse.ogi.edu> generally cleaned things up. but DID not
+         include the changes to the directory creation, file copying and permission
+         fixing code to enable RT_VAR_DIR
+       
+       * Made the web ui use $MESSAGE_FONT when putting up the compose window.
+           Marion Hakanson <hakanson@cse.ogi.edu>
+       
+       * Genericised the templates to not mention the mythical "systems group"
+       
+1999-12-19 01:54  jesse
+
+       * Makefile, etc/schema.mysql:
+
+       work on ticket, transaction.
+       schema cleanup
+       
+1999-12-18 13:25  jesse
+
+       * etc/schema:
+
+       removed obsolete schema
+       
+1999-12-17 01:28  jesse
+
+       * Makefile:
+
+       set version
+       
+1999-12-17 01:27  jesse
+
+       * etc/: config.pm, schema.mysql:
+
+       more cleanup. we're getting there. just another zillion hours or so
+       
+1999-12-15 23:56  jesse
+
+       * docs/: FAQ, FAQ.html:
+
+       faq updates committed
+       
+1999-12-15 23:26  jesse
+
+       * README:
+
+       updates to tobix' additions
+       
+1999-12-15 18:32  tobiasb
+
+       * README:
+
+       duh
+       
+1999-12-15 18:04  tobiasb
+
+       * README:
+
+       Some few pitfalls mentionated
+       
+1999-12-09 00:38  jesse
+
+       * etc/schema.mysql:
+
+       work on Ticket and Transaction.
+       we're getting there.
+       
+1999-12-08 03:40  tobiasb
+
+       * etc/suidrt.c:
+
+       bugfixes
+       
+1999-12-06 21:41  jesse
+
+       * Makefile, NEWS:
+
+       [no log message]
+       
+1999-12-06 06:27  tobiasb
+
+       * Makefile:
+
+       insignificant output fix
+       
+1999-12-04 03:30  jesse
+
+       * NEWS, etc/schema.mysql:
+
+       [no log message]
+       
+1999-12-04 01:46  jesse
+
+       * NEWS:
+
+       Fixed tobix-induced bug in lib/rt/database/manipulate.pm
+       that'll teach him to make untested fixes to the stable branch.
+       
+1999-12-02 13:18  tobiasb
+
+       * etc/schema:
+
+       I'm unfortunately not even half on the way in my merging. I'm in a hurry, some small notes:
+       
+       1.1:
+       - work on dependencies done
+       - work on mail distribution done.
+       - requires sub dist_list
+       - requires sub open_parents
+       - requires sub add_link
+       
+       Dependencies & linking in general.
+       
+       Mail distribution. The distribution list is set by a &dist_list
+       sub. The transaction mail is never sent out for comments and
+       correspondence, but people who subscribe all transactions will get the
+       comments and correspondence.
+       
+1999-12-02 03:10  tobiasb
+
+       * etc/mysql.acl:
+
+       This file is renamed
+       
+1999-12-02 03:05  tobiasb
+
+       * etc/: schema.Pg, schema.mysql:
+
+       This file was fucked up, I don't know why. I'll just truncate it for now
+       
+1999-12-02 02:56  jesse
+
+       * Makefile:
+
+       bumped version
+       
+1999-12-02 02:54  tobiasb
+
+       * etc/schema:
+
+       Added links (dependency + knowledge db)
+       
+1999-12-02 01:42  jesse
+
+       * Makefile:
+
+       some makefile cleanup
+       
+1999-12-01 23:16  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-12-01 23:10  jesse
+
+       * bin/rtmux.pl, etc/schema.mysql:
+
+       mots of work on the new backend.
+       cliadmin is mostly up to date.
+       no, i haven't run any of the code :)
+       
+1999-11-30 21:52  jesse
+
+       * etc/: acl.Pg, schema.mysql:
+
+       [no log message]
+       
+1999-11-23 17:21  jesse
+
+       * docs/design_docs/CARS:
+
+       file CARS was initially added on branch rt-1-1.
+       
+1999-11-23 17:21  jesse
+
+       * README, docs/design_docs/CARS, etc/schema.mysql:
+
+       schema hacking for rt-1-1 features.
+       
+1999-11-18 21:40  jesse
+
+       * Makefile, Makefile, Makefile:
+
+       [no log message]
+       
+1999-11-17 17:36  tobiasb
+
+       * NEWS:
+
+       merged in changes from 1.0
+       
+1999-11-16 23:09  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1999-11-08 20:54  jesse
+
+       * NEWS:
+
+       fixed a longstanding bug in cli/query
+       
+1999-11-08 18:02  jesse
+
+       * Makefile, NEWS, etc/config.pm:
+
+       [no log message]
+       
+1999-11-05 03:50  tobiasb
+
+       * Makefile, NEWS, README, bin/initacls.mysql, bin/initdb.mysql,
+       etc/acl.mysql, etc/config.pm:
+
+       patch from khamer integrated - no testing done, however
+       
+1999-10-22 14:09  tobiasb
+
+       * etc/schema:
+
+       merged 1.1-changes
+       
+1999-10-22 12:14  tobiasb
+
+       * NEWS, etc/mysql.acl, etc/schema:
+
+       Merged in changes from 1.0. I haven't checked that things works quite well, anyway.
+       
+1999-10-21 16:21  jesse
+
+       * Makefile, NEWS:
+
+       changes to date_diff, some of the oldest code in RT
+       
+1999-10-21 07:07  tobiasb
+
+       * docs/actions.txt, docs/admin.txt, docs/attributes.txt,
+       docs/outline.txt, docs/rt_users_guide.html, etc/config.pm:
+
+       merged from 1.0
+       
+1999-10-20 23:16  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-10-20 22:25  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-10-20 21:58  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-10-20 21:43  jesse
+
+       * Makefile, NEWS:
+
+       [no log message]
+       
+1999-10-20 10:33  tobiasb
+
+       * Makefile, NEWS, README, README.91UPGRADE, TODO,
+       bin/initacls.mysql, bin/initdb.mysql, docs/README.docs:
+
+       Merged 1.0-development into 1.1
+       
+1999-10-20 01:23  jesse
+
+       * Makefile, NEWS:
+
+       
+       20 Oct 1999
+       -----------
+       * RT now uses a queue's mail alias when sending mail.
+       
+1999-10-20 00:44  jesse
+
+       * Makefile, NEWS:
+
+       
+       20 Oct 1999
+       -----------
+       
+       * Using the web UI to send correspondence should no longer not
+         sent the correspondence if there are CCs, BCCs or the actor is
+         the same as the requestor. thanks to <douglas@arepa.com> for
+         pointing out the deficiency.
+       
+1999-10-13 19:32  jesse
+
+       * Makefile, TODO:
+
+       Released version 1.0 Updated the TODO file.
+       
+1999-10-06 18:01  jesse
+
+       * Makefile:
+
+       bumped version
+       
+1999-10-06 17:57  jesse
+
+       * Makefile, NEWS, README, docs/README.docs:
+
+       [no log message]
+       
+1999-10-06 17:48  jesse
+
+       * docs/: FAQ, FAQ.html, README.docs, actions.html, actions.txt,
+       admin.html, admin.txt, attributes.html, attributes.txt,
+       outline.html, outline.txt, rt_users_guide.html:
+
+       major documentation updates from mbrader
+       
+1999-10-04 14:22  jesse
+
+       * Makefile, NEWS:
+
+       bumped the version to 1.0.0pre2
+       
+1999-10-01 01:39  jesse
+
+       * Makefile:
+
+       fixed a makefile typo
+       
+1999-10-01 01:37  jesse
+
+       * NEWS, README, README.91UPGRADE:
+
+       updated readme
+       
+1999-10-01 01:07  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-10-01 00:22  jesse
+
+       * NEWS, etc/config.pm:
+
+       
+       30 Sep 1999
+       -----------
+       
+       *  Fixed a bug which caused RT to go crazy when comments were submitted
+          by may without a ticket #.
+       
+       The following changes are from johnl@microware.com
+       
+          1. Directories were not getting created with the correct modes under            /usr/local/rt/transactions.                                                         The umask() takes an octal file mode mask, not a file mode.                                                                                                     In addition I read the comments about $dirmode not working when             doing the mkdir's in content.pm.  I also fixed content.pm to use                $dirmode.  The main problem was the $dirmode was being set to a string          instead of an octal number.
+       
+         Fixes to database.pm
+           1.  The first hunk fixes problem where the call to write_content is             passing $time.  This variable does not exist.   It looked like $time was        supposed to be the current time.  ($time always == 0).  I changed all           occurances of $time to time (IE: time()).                                                                                                                       2.  The first hunk also passes $in_time instead of $time.                                                                                                       3.  The rest of the hunks fix $time and replace them with time().
+       
+       27 Sep 1999
+       -----------
+       Fixed a bug which caused the priority not to get set to the default
+       when requests were created in the webui. Thanks to <Elmar.Knipp@knipp.de>
+       
+1999-09-23 23:16  anoncvs
+
+       * Makefile:
+
+       [no log message]
+       
+1999-09-23 23:09  anoncvs
+
+       * Makefile, Makefile:
+
+       [no log message]
+       
+1999-09-23 23:07  anoncvs
+
+       * Makefile:
+
+       [no log message]
+       
+1999-09-23 23:01  anoncvs
+
+       * Makefile:
+
+       [no log message]
+       
+1999-09-23 22:52  anoncvs
+
+       * Makefile:
+
+       [no log message]
+       
+1999-08-08 22:20  tobiasb
+
+       * etc/schema:
+
+       ups
+       
+1999-08-07 02:27  tobiasb
+
+       * etc/schema:
+
+       in-work
+       
+1999-08-04 02:48  tobiasb
+
+       * Makefile, NEWS:
+
+       Merge
+       
+1999-08-03 22:38  jesse
+
+       * NEWS:
+
+       first cut of -trans
+       
+1999-08-03 22:27  jesse
+
+       * Makefile, NEWS:
+
+       reved the version to .99.9. tiny mail manipulate fix
+       
+1999-08-03 11:31  tobiasb
+
+       * bin/initdb.mysql:
+
+       file initdb.mysql was initially added on branch rt-1-1.
+       
+1999-08-03 11:31  tobiasb
+
+       * bin/initdb.Pg:
+
+       file initdb.Pg was initially added on branch rt-1-1.
+       
+1999-08-03 11:31  tobiasb
+
+       * bin/initacls.mysql:
+
+       file initacls.mysql was initially added on branch rt-1-1.
+       
+1999-08-03 11:31  tobiasb
+
+       * bin/: initacls.Pg, initacls.mysql, initdb.Pg, initdb.mysql:
+
+       Scripts for initing the DB
+       
+1999-08-03 11:31  tobiasb
+
+       * bin/initacls.Pg:
+
+       file initacls.Pg was initially added on branch rt-1-1.
+       
+1999-08-03 10:31  tobiasb
+
+       * etc/schema.mysql:
+
+       file schema.mysql was initially added on branch rt-1-1.
+       
+1999-08-03 10:31  tobiasb
+
+       * etc/schema.Pg:
+
+       file schema.Pg was initially added on branch rt-1-1.
+       
+1999-08-03 10:31  tobiasb
+
+       * etc/acl.mysql:
+
+       file acl.mysql was initially added on branch rt-1-1.
+       
+1999-08-03 10:31  tobiasb
+
+       * etc/acl.Pg:
+
+       file acl.Pg was initially added on branch rt-1-1.
+       
+1999-08-03 10:31  tobiasb
+
+       * Makefile, etc/acl.Pg, etc/acl.mysql, etc/mysql.acl, etc/schema,
+       etc/schema.Pg, etc/schema.mysql:
+
+       More work on the move to a DBMS-independent RT. The Makefile and executables _really_ need some testing and eventually debugging.
+       
+1999-08-03 02:14  tobiasb
+
+       * Makefile, etc/config.pm:
+
+       It seems to me that I've somehow managed to go to DBI...WebRT seems to work locally, but that's the only testing I've done
+       
+1999-08-02 07:07  tobiasb
+
+       * etc/schema:
+
+       in-work
+       
+1999-07-29 02:55  tobiasb
+
+       * etc/schema:
+
+       uuuurghh
+       
+1999-07-28 10:42  tobiasb
+
+       * README:
+
+       One small update on the work to link requests...
+       
+1999-07-27 07:08  tobiasb
+
+       * NEWS:
+
+       1.0-gospel
+       
+1999-07-27 06:48  tobiasb
+
+       * etc/schema:
+
+       asdfjlsadfhjkhdfawhi
+       
+1999-07-26 21:21  jesse
+
+       * Makefile, NEWS:
+
+       fixes to the mail gateway header handling
+       added cli rtq flags to the help
+       
+1999-07-26 07:03  tobiasb
+
+       * NEWS:
+
+       Merge
+       
+1999-07-24 20:43  jesse
+
+       * Makefile:
+
+       bumpted the version
+       
+1999-07-24 20:40  jesse
+
+       * NEWS:
+
+       added a few options to the cli query engine. area limitying and display of due dates.
+       
+1999-07-23 03:20  tobiasb
+
+       * NEWS:
+
+       Some merges
+       
+1999-07-23 02:56  tobiasb
+
+       * etc/schema:
+
+       With generic links
+       
+1999-07-22 23:13  jesse
+
+       * Makefile, NEWS:
+
+       22 Jul 99 (Jesse)
+       -----------------
+       Inital cleanup to the web ticket view. I'd like to significantly
+       compact and simplify that display.  More tables are probably in
+       order.  Additionally, I want to get rid of all those buttons "I
+       changed this." There's just no need for them. we can write logic
+       to do that for us.  Also, I bumped the version to 1.1.1.  I'd like
+       to do this 'linux-kernel-esque' The 1.1.x
+       series will be a development series leading toward 1.2.  Once we
+       get the DB changes in, I'll feel comfortable rolling a 'releaseable'
+       1.1 version for people who like pain.
+       
+1999-07-21 23:47  jesse
+
+       * Makefile, NEWS:
+
+       21 July 1999
+       ------------
+       
+       Fix for [fsck #102] Better checks in is_not_a_requestor. this should fix
+               issues with external users being equated with queue members.
+       
+       Fix for [fsck #114] Comment from bin/rt was accidentaly access controlled.
+       
+       Fix for [fsck #113] Display of requests users can't manipulate should now give
+               ian error
+       
+1999-07-20 23:40  tobiasb
+
+       * etc/schema:
+
+       For a general way of linking WebRT requests to other web-based DBs
+       
+1999-07-20 21:42  tobiasb
+
+       * NEWS:
+
+       [no log message]
+       
+1999-07-20 21:11  tobiasb
+
+       * NEWS:
+
+       Hmf.
+       
+1999-07-20 21:07  tobiasb
+
+       * README, etc/config.pm:
+
+       updated for Internet::Mail
+       
+1999-07-20 21:01  tobiasb
+
+       * Makefile:
+
+       updated for Internet::Mail
+       
+1999-07-20 01:21  jesse
+
+       * NEWS:
+
+       Fix for [fsck #88] WebUI area SELECT bug.
+       
+       Fix for [fsck #90] A small html bug in WebRT
+       
+       Fix for [fsck #92] "Allow non-members to create requests" appeared twice
+               in the WebAdmin
+       
+       Fix for [fsck #94] web ui forms are now 78 chars wide
+       
+1999-07-20 00:09  jesse
+
+       * NEWS:
+
+       19 July 1999
+       ------------
+       Fix for [fsck #104]  We no longer try to reset the user's uid after writing
+               transaction content to the filesystem. This should help out Net/OpenBSD
+               compatibility
+       
+       Removed some legacy support for glimpse searching
+       
+       Fix for [fsck #115] The web ticket list should now wrap reasonably, so it's
+               printable.
+       
+1999-07-19 03:26  tobiasb
+
+       * NEWS:
+
+       some updates
+       
+1999-07-17 13:14  tobiasb
+
+       * NEWS:
+
+       Updated a bit
+       
+1999-07-16 23:42  tobiasb
+
+       * Makefile:
+
+       Version number 1.pre1.1 - what do you think about it?
+       
+1999-07-16 22:49  tobiasb
+
+       * bin/rtmux.pl:
+
+       Filled in a missing comment
+       
+1999-07-16 22:46  tobiasb
+
+       * Makefile:
+
+       Set version to 1.1.0pre1, and changed /opt/rt to /usr/local/rt, I'd
+       daresay the next is more widely preffered.
+       
+1999-07-16 18:36  tobiasb
+
+       * COPYING, Makefile, NEWS, README, README.91UPGRADE, TODO,
+       bin/rtmux.pl, docs/FAQ, docs/FAQ.html, docs/README.docs,
+       docs/actions.html, docs/actions.txt, docs/admin.html,
+       docs/admin.txt, docs/attributes.html, docs/attributes.txt,
+       docs/outline.html, docs/outline.txt, etc/config.pm, etc/mysql.acl,
+       etc/schema, etc/suidrt.c:
+
+       Imported Tobix' current version
+       
+1999-07-08 02:10  jesse
+
+       * Makefile, NEWS, TODO:
+
+       Rolled .99.8
+       
+1999-07-07 15:37  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-07-07 00:45  jesse
+
+       * Makefile, NEWS:
+
+       updated makefile and news.
+       
+1999-07-06 22:58  jesse
+
+       * NEWS:
+
+       6 Jul 99
+       --------
+       Now, if you move a request to a new queue, it won't disown it if the same person can own reqs in the new queue. [fsck #75] (untested)
+       
+       Fixed a problem with cli create not properly handling due dates ([fsck #67])
+       Fixed a duplicate --help entry for bin/rt [fsck #69]
+       Fixed bugs fsck  #68/77: Odness Merging RT requests
+       
+       Transactions from merged requests will now be displayed along with the request id of the request that transaction was originially associated with.
+       
+       Fixed [fsck #74], which was reported by charlie brady:
+          Messages are sent out from the mail interface with content first, then
+          "--- Headers Follow ---", then the headers. In our vanilla sendmail setup,
+          before the headers is a UUCP style deliver notification "From blah Tue Jul
+          6 18:13:01 1999" line. This is interpreted by many mail agents as a
+          message delimiter, so that what is seen in the mail agent is not one, but
+          two messages. This is easily fixed by using the conventional quoting
+          mechanism...
+       Fixed [fsck #71] WebRT: "User" should be "Requestor"
+       
+1999-07-06 21:35  jesse
+
+       * NEWS:
+
+       resovled #71, #74. worked on merge functionality
+       
+1999-06-29 17:39  jesse
+
+       * Makefile, NEWS:
+
+       [no log message]
+       
+1999-06-29 17:20  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1999-06-24 00:52  jesse
+
+       * Makefile, NEWS, README, TODO:
+
+       lots of touchups.
+       
+1999-06-23 23:29  jesse
+
+       * NEWS:
+
+       moved to CGI.pm's form parser.
+       
+1999-06-17 01:49  jesse
+
+       * NEWS:
+
+       edited news
+       
+1999-06-16 23:21  jesse
+
+       * Makefile, NEWS:
+
+       Fixed an auth bug.
+       
+1999-06-15 02:13  jesse
+
+       * Makefile:
+
+       upped the version to .99.8pre5
+       
+1999-06-15 02:09  jesse
+
+       * Makefile, NEWS:
+
+       lots of misc changes. see the diff to the news file
+       
+1999-05-12 20:37  jesse
+
+       * Makefile, NEWS:
+
+       cookies hacked to deal with the fact that netscape can't handle path=/
+       
+1999-05-12 01:57  jesse
+
+       * Makefile:
+
+       bumped the version number to .99.8pre3
+       
+1999-05-12 01:56  jesse
+
+       * NEWS:
+
+       Made error messages on the web admin interface more prominent.
+       
+       All the following changes are from tobix:
+       
+               Correspondence from RT now properly reflect the name of the sender
+               in the "from" header.
+       
+               Automated messages now properly have a "Precedence: bulk" header
+       
+               A stupid error with rt::mail_alias has been fixed
+       
+               Tobix' patch removes headers from all correspondence.  I'm relatively
+               afraid of this change, so I'm going to comment it out for now.
+       
+               rtadmin (the commandline has a new tool) :
+                    -update <passwd> <admin> [<users>]  updates user(s) from the
+                          /etc/passwd file. If no users are specified, ALL
+                          of /etc/passwd will be processed.
+       
+1999-05-11 16:46  jesse
+
+       * Makefile, NEWS, README:
+
+       mail loop fix from toby
+       
+1999-05-09 20:35  jesse
+
+       * Makefile:
+
+       bumped version numbers
+       
+1999-05-09 20:35  jesse
+
+       * Makefile, NEWS, README:
+
+       updated makefile and news
+       
+1999-05-09 20:17  jesse
+
+       * bin/rtmux.pl:
+
+       modifications to cookies support to md5 hash the password.
+       modification to allow non-nph web ui
+       
+1999-05-05 02:39  jesse
+
+       * NEWS:
+
+       fixed some cookies/frames problems
+       
+1999-05-05 02:10  jesse
+
+       * Makefile, NEWS:
+
+       fixed bugs in web auth from charlie brady
+       
+1999-05-03 21:44  jesse
+
+       * Makefile:
+
+       bumped the version #
+       
+1999-04-28 16:03  jesse
+
+       * Makefile:
+
+       bumped version
+       
+1999-04-28 16:03  jesse
+
+       * NEWS:
+
+       updated content.pm to spit errors.
+       
+1999-04-27 02:58  jesse
+
+       * Makefile:
+
+       downed the makefile version
+       
+1999-04-27 02:57  jesse
+
+       * Makefile:
+
+       fixed a makefile bug
+       
+1999-04-26 21:57  jesse
+
+       * NEWS, README:
+
+       added configuration info about mod_auth_mysql
+       
+1999-04-26 21:45  jesse
+
+       * Makefile, etc/config.pm:
+
+       Updated authetication stuff with patches from ingo. updated them further.
+       Added the ability to configure whether external authentication is done for webrt
+       added the ability to turn off ie compatibility mode
+       
+1999-04-23 19:31  jesse
+
+       * Makefile, NEWS, README, TODO:
+
+       started to update the README and Makefile
+       
+1999-04-13 04:00  jesse
+
+       * Makefile:
+
+       fixed totally fuxored makefile
+       
+1999-04-13 03:28  jesse
+
+       * README:
+
+       noted that there's a dependency on gnu make
+       
+1999-04-13 03:07  jesse
+
+       * Makefile:
+
+       bumped version
+       
+1999-04-13 03:06  jesse
+
+       * NEWS:
+
+       updated news
+       
+1999-04-08 04:36  jesse
+
+       * docs/rt.gif:
+
+       added the gif to the docs
+       
+1999-04-08 04:35  jesse
+
+       * NEWS:
+
+       fixes for new mysql modules
+       
+1999-04-07 23:57  jesse
+
+       * NEWS:
+
+       updates
+       
+1999-04-07 02:14  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-04-07 02:09  jesse
+
+       * Makefile, README:
+
+       fixes for cookie auth from charlie brady
+       
+1999-04-06 06:30  jesse
+
+       * Makefile, NEWS, README:
+
+       misc changes to support cookie authentication
+       
+1999-04-03 04:57  jesse
+
+       * NEWS, docs/FAQ, docs/FAQ.html, docs/README.docs,
+       docs/actions.html, docs/actions.txt, docs/admin.html,
+       docs/admin.txt, docs/attributes.html, docs/attributes.txt,
+       docs/outline.html, docs/outline.txt:
+
+       major update of the docs from adam.
+       
+1999-04-03 04:49  jesse
+
+       * Makefile:
+
+       makefile hackery to ease installs slightly.
+       
+1999-03-21 20:24  jesse
+
+       * Makefile:
+
+       updated makefile
+       
+1999-03-21 20:22  jesse
+
+       * NEWS, README:
+
+       mail changes
+       
+1999-03-08 14:50  jesse
+
+       * NEWS:
+
+       turned off the troll
+       
+1999-03-08 14:02  jesse
+
+       * Makefile:
+
+       fixed makefile bogosity for ACLs
+       
+1999-03-04 01:50  jesse
+
+       * Makefile, NEWS:
+
+       fixed a subject line parsing error.
+       
+1999-02-26 22:29  jesse
+
+       * NEWS:
+
+       added a check to make sure you don't merge ar equest into a non-existent other request
+       
+1999-02-26 21:43  jesse
+
+       * README.91UPGRADE, README.FIRST, TODO:
+
+       moved readme.fdirst to readmne.91upgrade
+       
+1999-02-26 19:59  jesse
+
+       * Makefile, NEWS:
+
+       updated makefile: added upgrade-noclobber
+       
+1999-02-24 19:11  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-02-23 14:41  jesse
+
+       * NEWS:
+
+       updated bnews
+       
+1999-02-23 03:20  jesse
+
+       * docs/: actions.txt, admin.txt, attributes.txt:
+
+       added updates for adam for the docs.
+       
+       updated the news
+       
+1999-02-23 03:20  jesse
+
+       * NEWS:
+
+       updated the news
+       
+1999-02-21 01:56  jesse
+
+       * Makefile:
+
+       fixed the .4
+       
+1999-02-21 01:53  jesse
+
+       * Makefile:
+
+       fixed make pre
+       
+1999-02-20 23:27  jesse
+
+       * Makefile:
+
+       addded back predist
+       
+1999-02-20 16:36  jesse
+
+       * NEWS:
+
+       edited the news to reflect changes
+       
+1999-02-20 14:56  jesse
+
+       * Makefile, NEWS:
+
+       bumped the version to .99.4 for testing.
+       
+1999-02-20 14:48  jesse
+
+       * etc/mysql.acl:
+
+       updated acls so they'll work with newer versions of mysql 3.22
+       
+1999-01-20 02:21  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1999-01-20 02:13  jesse
+
+       * Makefile:
+
+       On another note, here is a fix for the "HTML turd" reported by Benji
+       Cline in lib/rt/ui/web/forms.pm:
+       ==========                                                                      diff -r0.99.2 forms.pm
+       87c87                                                                           <               $u = 0;
+       ---                                                                             >               $u = 1;
+       91c91                                                                           <                       $u = 1;                                                 ---                                                                             >                       $u = 0;
+       ==========
+       
+       With this patch applied, v0.99.2 (0.99.3?)                                      appears to be as solid as v0.9.18, if not more
+       so.
+       
+       Upgraded the version to .99.3
+       
+1999-01-16 20:44  jesse
+
+       * NEWS:
+
+       [no log message]
+       
+1999-01-16 20:39  jesse
+
+       * Makefile:
+
+       fixed a web acls bug. incremented the version.
+       
+1999-01-16 01:22  jesse
+
+       * Makefile:
+
+       bumped version to .99.1
+       
+1999-01-16 01:20  jesse
+
+       * Makefile, NEWS:
+
+       fixed some web admin sillyness..acls work better.
+       we no longer dump back to the main menu quite as gratuitously.
+       acls are no longer broken on the CLI either.
+       
+1998-12-16 01:31  jesse
+
+       * Makefile:
+
+       fixed the following things:
+       
+       From owner-rt-users@horked.fsck.com  Tue Nov 24 02:24:03 1998
+       Return-Path: <owner-rt-users@lists.fsck.com>
+       Received: (from majordomo@localhost)
+               by horked.fsck.com (8.8.7/8.8.7) id CAA11181
+               for rt-users-outgoing; Tue, 24 Nov 1998 02:24:01 -0500
+       X-Authentication-Warning: horked.fsck.com: majordomo set sender to owner-rt-users@lists.fsck.com using -f
+       Received: from modgud.nordicdms.com (h21-168-107.nordicdms.com [207.21.168.107] (may be forged))
+               by horked.fsck.com (8.8.7/8.8.7) with SMTP id CAA11177
+               for <rt-users@lists.fsck.com>; Tue, 24 Nov 1998 02:23:58 -0500
+       Received: (qmail 6211 invoked by alias); 24 Nov 1998 07:25:59 -0000
+       Message-ID: <19981124072559.6209.qmail@modgud.nordicdms.com>
+       Received: (qmail 6197 invoked from network); 24 Nov 1998 07:25:59 -0000
+       Received: from mail-ftp.nordicdms.com (HELO mail-ftp) (207.21.168.100)
+         by mail.nordicdms.com with SMTP; 24 Nov 1998 07:25:59 -0000
+       From: "Dave Walton" <walton@nordicdms.com>
+       Organization: Nordic Entertainment Worldwide
+       To: Jesse <jrvincent@wesleyan.edu>, rt-users@lists.fsck.com
+       Date: Mon, 23 Nov 1998 23:25:58 -0800
+       MIME-Version: 1.0
+       Content-type: text/plain; charset=US-ASCII
+       Content-transfer-encoding: 7BIT
+       Subject: Two bugfixes
+       Reply-to: walton@nordicdms.com
+       In-reply-to: <19981013013318.H18644@horked.fsck.com>
+       References: <19981013042506.9798.qmail@modgud.nordicdms.com>; from Dave Walton on Mon, Oct 12, 1998 at 09:25:06PM -0700
+       X-mailer: Pegasus Mail for Win32 (v3.01d)
+       Sender: owner-rt-users@lists.fsck.com
+       Precedence: bulk
+       
+       1.  A backwards search was causing lib/rt/ui/web/support.pm to
+       crash when data that looks like an invalid regex is present in the
+       message headers.
+       ------------------------------------------------------------
+       # diff support.old.pm support.pm
+       44c44
+       <               ($headers_ignore !~ /$field/i)) {
+       ---
+       >               ($field !~ /$headers_ignore/i)) {
+       ------------------------------------------------------------
+       
+       2.  HTML buglet in lib/rt/ui/web/manipulate.pm.
+       ------------------------------------------------------------
+       # diff manipulate.old.pm manipulate.pm
+       894c894
+       < <font color=\"\$fg_color\">
+       ---
+       > <font color=\"$fg_color\">
+       ------------------------------------------------------------
+       
+       Dave
+       
+       ----------------------------------------------------------------------
+       Dave Walton
+       Webmaster, Postmaster                   Nordic Entertainment Worldwide
+       walton@nordicdms.com                          http://www.nordicdms.com
+       ----------------------------------------------------------------------
+       
+       From benji@hnt.com  Fri Nov 20 14:28:44 1998
+       Return-Path: <benji@hnt.com>
+       Received: from horked.fsck.com (jesse@localhost [127.0.0.1])
+               by horked.fsck.com (8.8.7/8.8.7) with ESMTP id OAA04739
+               for <jesse@localhost>; Fri, 20 Nov 1998 14:28:44 -0500
+       Received: from mail.wesleyan.edu
+               by horked.fsck.com (fetchmail-4.3.2 POP3 run by jrvincent)
+               for <jesse@localhost> (single-drop); Fri Nov 20 14:28:44 1998
+       Received: from columbus.hnt.com (columbus.hnt.com [208.221.11.10]) by mail.wesleyan.edu (8.8.6/8.7.3) with ESMTP id OAA18408 for <jrvincent@wesleyan.edu>; Fri, 20 Nov 1998 14:30:34 -0500 (EST)
+       Received: from peppermint.hnt.com (peppermint.hnt.com [208.221.11.51])
+               by columbus.hnt.com (8.9.1/8.9.1/HnT-980729) with ESMTP id OAA26134
+               for <jrvincent@wesleyan.edu>; Fri, 20 Nov 1998 14:30:32 -0500 (EST)
+       Received: from localhost by peppermint.hnt.com (8.9.1/8.9.1/HnT-nullclient-980724) with ESMTP id OAA02733
+               for <jrvincent@wesleyan.edu>; Fri, 20 Nov 1998 14:30:32 -0500 (EST)
+       X-Authentication-Warning: peppermint.hnt.com: benji owned process doing -bs
+       Date: Fri, 20 Nov 1998 14:30:31 -0500 (EST)
+       From: Benjamin Cline <benji@hnt.com>
+       To: Jesse <jrvincent@mail.wesleyan.edu>
+       Subject: Re: 0.9.20 is out
+       In-Reply-To: <19981120005718.F28841@horked.fsck.com>
+       Message-ID: <Pine.GSO.4.05.9811201427100.2438-100000@peppermint.hnt.com>
+       MIME-Version: 1.0
+       Content-Type: TEXT/PLAIN; charset=US-ASCII
+       X-UIDL: 4f1695a69f7cdbefcfce9198121fef95
+       
+       I think I've found a buglet in 0.9.20, I had to add an extra curly bracket
+       ("}") to the end of lib/rt/database/admin.pm (just before the "1;") to get
+       it to work right.
+       
+               benji
+       
+       P.S. Sorry if that's not the most coherent bug report/fix, I'm afraid I'm
+       not much of a perl hacker.
+       
+       On Fri, 20 Nov 1998, Jesse wrote:
+       
+       > ftp://horked.fsck.com/pub/rt/devel/rt-0.9.20.tar.gz
+       >
+       > 19 Nov 98
+       > ---------
+       >
+       > Incorportated patches from Dave Walton to fix a typo, replace an
+       > accidentally
+       > blown away library and add a "last acted" column to the web ui.
+       > incremented version to .9.20
+       >
+       >
+       >       jesse
+       >
+       > --
+       > jesse reed vincent -- jrvincent@wesleyan.edu -- jesse@fsck.com
+       > pgp keyprint:  50 41 9C 03 D0 BC BC C8 2C B9 77 26 6F E1 EB 91
+       > --------------------------------------------------------------
+       > They'll take my private key when they pry it from my cold dead fingers!
+       >
+       
+       --
+       Benjamin R. Cline       Harrison & Troxell, Inc.         benji@hnt.com
+                            Quis Custodiet Ipsos Custodes?
+       
+       From adam@baz.org  Fri Nov 13 17:07:09 1998
+       Return-Path: <adam@baz.org>
+       Received: from horked.fsck.com (jesse@localhost [127.0.0.1])
+               by horked.fsck.com (8.8.7/8.8.7) with ESMTP id RAA10943
+               for <jesse@localhost>; Fri, 13 Nov 1998 17:07:09 -0500
+       Received: from mail.wesleyan.edu
+               by horked.fsck.com (fetchmail-4.3.2 POP3 run by jrvincent)
+               for <jesse@localhost> (single-drop); Fri Nov 13 17:07:09 1998
+       Received: from impei.baz.org (adam@impei.baz.org [139.167.64.229]) by mail.wesleyan.edu (8.8.6/8.7.3) with ESMTP id RAA08425 for <jrvincent@wesleyan.edu>; Fri, 13 Nov 1998 17:08:38 -0500 (EST)
+       Received: (from adam@localhost)
+               by impei.baz.org (8.8.7/8.8.8) id RAA18674
+               for jrvincent@wesleyan.edu; Fri, 13 Nov 1998 17:08:38 -0500
+       Message-ID: <19981113170837.A18668@baz.org>
+       Date: Fri, 13 Nov 1998 17:08:37 -0500
+       From: secret agent man <adam@baz.org>
+       To: "J.R.Ewing" <jrvincent@mail.wesleyan.edu>
+       Subject: RT bug, mebbe?
+       Mime-Version: 1.0
+       X-Mailer: Mutt 0.93.2i
+       Content-Type: text/plain; charset=us-ascii
+       X-UIDL: 5563064ca159a5eee88e16843932a45f
+       
+       <jailbait> q: If you leave the field blank when clicking on "create new
+       (queue|user) named", it goes to the create screen with an empty field that
+       can't be filled. It should either be editable there or it should reject
+       you.
+       
+       A
+       
+       --
+       Everything I needed to know about life I learned       <adam@baz.org>
+       from killing smarter people and eating their brains.    adam hirsch
+       
+1998-11-20 00:45  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1998-11-20 00:28  jesse
+
+       * Makefile, NEWS:
+
+       19 Nov 98
+       ---------
+       
+       Incorportated patches from Dave Walton to fix a typo, replace an accidentally
+       blown away library and add a "last acted" column to the web ui.
+       incremented version to .9.20
+       
+1998-11-18 02:26  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1998-10-13 03:37  jesse
+
+       * Makefile, README, etc/mysql.acl:
+
+       shiny:% cat >> changes                                          ~ 10:53PM:tt
+       2.  Made comments and replies update date_acted.
+       
+               -- Dave Walton
+       
+       Ok.. I know this is being picky, but, in rt/lib/ui/web/support.pm, the
+       subroutine "content_header", at line 290, should have:
+           print "<head><title>WebRT</title></head>\n";
+       
+       Otherwise, when running in frames, you never get a title on the page. :(
+       
+       No biggie...
+       
+       -Rich
+       
+       Oh, one other.
+       
+       8.  etc/mysql.acl, line 5
+       The RT_MYSQL_HOST entry on that line doesn't make any sense
+       when MySQL is on a different host than RT.  That should be
+       RT_HOST, or some such thing.
+       
+       Dave
+       
+       After just upgrading to Apache 1.3.0 from 1.2.5, I figured I would make it
+       known that, in the file <apache_src_dir>/src/main/util_script.c, you have
+       to define SECURITY_HOLE_PASS_AUTHORIZATION to allow for RT's authorization
+       to work properly.
+       -Rich
+       
+       On Tue, Oct 06, 1998 at 09:19:07PM -0700, Dave Walton wrote:
+       > I just discovered that if there is an error in add_correspondence, the
+       > mail interface discards the incoming mail without comment.  To
+       > correct this, I took the following steps:
+       >
+       In mail.pm, there's a space before :
+       
+       From: $rt::mail_alias
+       
+       This causes problems in some mail clients, putting the From: line on the
+       same line as the subject.  If the spaces are removed this is fixed.
+       
+       Regards,
+       From: "Andrew Foster" <adf@fl.net.au>
+       
+1998-09-11 01:15  jesse
+
+       * docs/README.docs:
+
+       updated lists for rt docs.
+       
+1998-09-08 03:23  jesse
+
+       * NEWS:
+
+       updated news\18
+       
+1998-09-08 03:18  jesse
+
+       * Makefile, NEWS, README, etc/config.pm:
+
+       Final bug fixes for .9.18
+       
+1998-08-09 17:43  jesse
+
+       * NEWS, README, TODO:
+
+       All kinds of crazy updates for .9.18. Mostly from serge zhuk
+       
+1998-08-04 03:09  jesse
+
+       * NEWS:
+
+       first round of updates from serge
+       
+1998-06-26 17:07  jesse
+
+       * Makefile, NEWS:
+
+       modified makefile and news
+       
+1998-06-26 16:34  jesse
+
+       * docs/: README.docs, actions.txt, admin.txt, attributes.txt,
+       outline.txt:
+
+       Added documentation from <adam@apocalypse.org>
+       
+1998-06-25 17:06  jesse
+
+       * Makefile, README, etc/config.pm:
+
+       removed refs to glimpse
+       
+1998-06-25 15:46  jesse
+
+       * Makefile:
+
+       dist fixes
+       
+1998-06-25 15:44  jesse
+
+       * Makefile:
+
+       dist fixes
+       
+1998-06-25 14:09  jesse
+
+       * Makefile:
+
+       edited dist. maker
+       
+1998-05-21 22:40  jesse
+
+       * Makefile:
+
+       added httpd.conf configurator for cern
+       
+1998-04-27 20:17  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1998-04-20 14:53  jesse
+
+       * Makefile:
+
+       bumped version to .9.14.
+       
+1998-04-20 14:53  jesse
+
+       * Makefile:
+
+       bumped version to .9.13.1
+       
+1998-04-19 03:14  jesse
+
+       * Makefile:
+
+       updated version number.
+       now explicitly create rt-etc-dir
+       
+1998-04-16 21:40  jesse
+
+       * bin/rtmux.pl:
+
+       removed a spurious addition to the lib path from the mux
+       abstracted a bunch of stuff out of the mux and throughout the makefile.
+       like program names.
+       
+1998-04-16 21:39  jesse
+
+       * Makefile:
+
+       abstracted a bunch of stuff out of the mux and throughout the makefile.
+       like program names.
+       
+1998-04-16 19:47  jesse
+
+       * COPYING, Makefile, NEWS, README, README.FIRST, TODO:
+
+       commiting updates
+       
+1998-04-08 13:35  jesse
+
+       * etc/config.pm:
+
+       fixed typos in config.pm that prevented mail from working with .9.11
+       bumped version to .12
+       
+1998-04-08 13:34  jesse
+
+       * Makefile:
+
+       bumped version to .12
+       
+1998-04-02 21:30  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1998-04-02 21:27  jesse
+
+       * Makefile:
+
+       fixed make dist
+       
+1998-04-02 15:36  jesse
+
+       * Makefile, Makefile:
+
+       [no log message]
+       
+1998-04-02 15:29  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1998-04-02 15:25  jesse
+
+       * etc/config.pm:
+
+       split mail program and mail program flags
+       hopefully fixed make dist
+       
+1998-04-02 15:25  jesse
+
+       * Makefile:
+
+       hopefully fixed make dist
+       
+1998-04-02 11:02  jesse
+
+       * Makefile, NEWS:
+
+       updated news
+       
+1998-04-02 10:55  jesse
+
+       * Makefile:
+
+       [no log message]
+       
+1998-04-02 10:31  jesse
+
+       * etc/config.pm:
+
+       reshuffled files that the user won't be changing out of etc and into lib
+       this includes generic templates and images for the web ui
+       updated src and makefiles accordingly.
+       verbosifoed part of config.pm
+       
+1998-04-02 10:31  jesse
+
+       * Makefile:
+
+       reshuffled files that the user won't be changing out of etc and into lib
+       this includes generic templates and images for the web ui
+       updated src and makefiles accordingly.
+       
+1998-04-02 10:20  jesse
+
+       * Makefile:
+
+       built more auto-dist stuff
+       
+1998-04-02 03:22  jesse
+
+       * README:
+
+       added apache patch to readme
+       
+1998-04-02 03:13  jesse
+
+       * Makefile, README, TODO, etc/config.pm:
+
+       updated makefile and readme and todo
+       added toggle for mysql 3.21
+       moved sendmail flags to makefile for compat w 8.6
+       
+1998-02-08 21:12  jesse
+
+       * Makefile:
+
+       make upgrade now calls mux-install
+       
+1998-01-30 22:31  jesse
+
+       * Makefile, README, README.FIRST:
+
+       added bits to upgrade from .9.1
+       made make upgrade upgrade the conf file
+       
+1998-01-27 01:56  jesse
+
+       * NEWS:
+
+       updated news
+       
+1998-01-27 01:48  jesse
+
+       * Makefile:
+
+       started a make dist
+       
+1998-01-26 17:59  jesse
+
+       * Makefile, README, README.FIRST:
+
+       updated readme
+       
+1998-01-21 18:37  jesse
+
+       * Makefile:
+
+       fixes to makefile to allow for proper specification of database as local.
+       added "you are logged in as..." to web/support...
+       changed sendmail options in mail.pm/
+       
+1998-01-14 23:49  jesse
+
+       * Makefile, etc/mysql.acl:
+
+       incremented version number
+       
+1998-01-09 14:48  jesse
+
+       * bin/rtmux.pl:
+
+       added taint safeness for $ENV{'ENV}
+       updated makefile version number
+       
+1998-01-09 14:47  jesse
+
+       * Makefile:
+
+       updated makefile version number
+       
+1998-01-08 16:17  jesse
+
+       * README.FIRST:
+
+       ipdated readme.first.
+       
+1998-01-08 14:53  jesse
+
+       * etc/suidrt.c:
+
+       made suidrt.c work
+       updated the mux
+       
+1998-01-08 14:53  jesse
+
+       * bin/rtmux.pl:
+
+       updated the mux
+       
+1998-01-08 13:10  jesse
+
+       * Makefile:
+
+       more fixes to make suid wrapper stuff work.
+       
+1998-01-08 12:51  jesse
+
+       * bin/rtmux.pl:
+
+       made rtmux attempt to work with the suid wrapper
+       
+1998-01-08 12:48  jesse
+
+       * etc/suidrt.c:
+
+       added back suidrt.c. blech.
+       
+1998-01-08 12:44  jesse
+
+       * Makefile, bin/rtmux.pl:
+
+       brought back suidrt.c
+       bleck.
+       
+1998-01-07 18:06  jesse
+
+       * Makefile:
+
+       added a sane mode for $(RT_PATH)
+       
+1998-01-07 00:37  jesse
+
+       * Makefile, README.FIRST:
+
+       added basic old upgrade instructions.
+       added info to README.FIRST about upgrading.
+       
+1998-01-07 00:31  jesse
+
+       * bin/rtmux.pl:
+
+       made mailing work.
+       
+1998-01-06 10:27  jesse
+
+       * bin/rtmux.pl:
+
+       made the mux require ui::mail before it tried to invoke it.
+       
+1998-01-04 02:26  jesse
+
+       * README:
+
+       told users to read readme.first.
+       
+1998-01-04 02:25  jesse
+
+       * README, README.FIRST:
+
+       added readme.first
+       
+1998-01-04 02:12  jesse
+
+       * Makefile:
+
+       updated webadmin interface. fixed some logout problems. fixed an html bug in web-manip.
+       
+1998-01-02 01:14  jesse
+
+       * Makefile, bin/rtmux.pl:
+
+       fixed more problems w/ making cliadmin run
+       merged mux-install and mux-links into one section of makefile
+       
+1998-01-02 00:59  jesse
+
+       * Makefile, NEWS, README, TODO, bin/rtmux.pl, etc/config.pm:
+
+       fixed typo in Makefile: install-libs -> libs-install
+       
+1998-01-01 03:07  jesse
+
+       * Makefile, bin/rtmux.pl:
+
+       commented makefile better
+       added more stuff for taint checks to rtmux.pl
+       fixed a non-frames web bug in FormComment
+       
+1997-12-31 01:55  jesse
+
+       * Makefile, bin/rtmux.pl, etc/config.pm:
+
+       lots of cleanup to get web interface running.
+       beginnigs of taint-safe scripts.
+       
+1997-12-30 23:49  jesse
+
+       * Makefile, bin/rtmux.pl:
+
+       cleanup in cli admin.pm, cli query.pm, the mux, the makefile
+       database routines now assign an effective serial # to a request when you get
+       the fact's serial number
+       
+1997-12-30 22:56  jesse
+
+       * Makefile, README, bin/rtmux.pl:
+
+       remodded rtmux to use correct vars for command line arguments.
+       moved RT_VERSION to makefile.
+       updated README for new install procedure
+       
+1997-12-30 01:09  jesse
+
+       * Makefile, etc/config.pm, etc/mysql.acl:
+
+       fixed typo in web/admin.pm
+       set up config.pm mysql.acl and rtmux.pl to get themselves parsed from the makefile.
+       removed last vestiges of C
+       
+1997-12-28 18:59  jesse
+
+       * Makefile, etc/schema:
+
+       removed suidrt for a preparation to move to a c-free system
+       added provisions for token-parsing to makefile
+       
+1997-12-28 03:10  jesse
+
+       * etc/schema:
+
+       added tags to schema
+       
+1997-12-28 02:48  jesse
+
+       * Makefile:
+
+       started to modify toplevel makefile
+       
+1997-12-19 03:04  jesse
+
+       * lib/rtmux.pl:
+
+       moved the executable rtmux.pl to bin, where it belongs.
+       made sure bin/cgi gets created on checkout
+       
+1997-12-19 03:03  jesse
+
+       * bin/rtmux.pl:
+
+       moved the executable rtmux.pl to bin, where it belongs.
+       
+1997-12-18 19:05  jesse
+
+       * lib/rtmux.pl:
+
+       worked on the mux
+       
+1997-12-09 15:14  jesse
+
+       * TODO:
+
+       added things for v1.0 to the todo list
+       
+1997-12-09 02:03  jesse
+
+       * etc/config.pm:
+
+       broke configuration out into config.pm
+       
+1997-12-09 01:54  jesse
+
+       * COPYING, Makefile, NEWS, README, TODO, etc/mysql.acl, etc/schema:
+
+       initial commit after i nuked the repository
+       
+1997-12-09 01:54  jesse
+
+       * COPYING, Makefile, NEWS, README, TODO, etc/mysql.acl, etc/schema:
+
+       Initial revision
+       
diff --git a/rt/Makefile b/rt/Makefile
new file mode 100644 (file)
index 0000000..fe01b71
--- /dev/null
@@ -0,0 +1,418 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/Makefile,v 1.1 2002-08-12 06:17:06 ivan Exp $
+# RT is Copyright 1996-2002 Jesse Vincent <jesse@bestpractical.com>
+# It is distributed under the terms of the GNU General Public License, version 2
+
+PERL                   =       /usr/bin/perl
+
+RT_VERSION_MAJOR       =       2
+RT_VERSION_MINOR       =       0
+RT_VERSION_PATCH       =       14
+
+
+RT_VERSION =   $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
+TAG       =    rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)
+
+BRANCH                 =       HEAD
+
+# This is the group that all of the installed files will be chgrp'ed to.
+RTGROUP                        =       rt
+
+
+# User which should own rt binaries.
+BIN_OWNER              =       root
+
+# User that should own all of RT's libraries, generally root.
+LIBS_OWNER             =       root
+
+# Group that should own all of RT's libraries, generally root.
+LIBS_GROUP             =       bin
+
+
+
+# {{{ Files and directories 
+
+# DESTDIR allows you to specify that RT be installed somewhere other than
+# where it will eventually reside
+
+DESTDIR                        =       
+
+
+# RT_PATH is the name of the directory you want make to install RT in
+# RT must be installed in its own directory (don't set this to /usr/local)
+
+RT_PATH                        =       /opt/rt2
+
+# The rest of these paths are all configurable, but you probably don't want to 
+# put them elsewhere
+
+RT_LIB_PATH            =       $(RT_PATH)/lib
+RT_ETC_PATH            =       $(RT_PATH)/etc
+RT_CONFIG_PATH         =       $(RT_ETC_PATH)
+RT_BIN_PATH            =       $(RT_PATH)/bin
+RT_MAN_PATH            =       $(RT_PATH)/man
+MASON_HTML_PATH                =       $(RT_PATH)/WebRT/html
+
+
+# RT allows sites to overlay the default web ui with 
+# local customizations Those files can be placed in MASON_LOCAL_HTML_PATH
+
+MASON_LOCAL_HTML_PATH  =       $(RT_PATH)/local/WebRT/html
+
+# RT needs to be able to write to MASON_DATA_PATH and MASON_SESSION_PATH
+# RT will create and chown these directories. Don't just set them to /tmp
+MASON_DATA_PATH                =       $(RT_PATH)/WebRT/data
+MASON_SESSION_PATH     =       $(RT_PATH)/WebRT/sessiondata
+
+RT_LOG_PATH             =       /tmp
+
+# RT_READABLE_DIR_MODE is the mode of directories that are generally meant
+# to be accessable
+RT_READABLE_DIR_MODE   =       0755
+
+
+
+# The location of your rt configuration file
+RT_CONFIG              =       $(RT_CONFIG_PATH)/config.pm
+
+# RT_MODPERL_HANDLER is the mason handler script for mod_perl
+RT_MODPERL_HANDLER     =       $(RT_BIN_PATH)/webmux.pl
+
+# RT_FASTCGI_HANDLER is the mason handler script for FastCGI
+# THIS HANDLER IS NOT CURRENTLY SUPPORTED
+RT_FASTCGI_HANDLER     =       $(RT_BIN_PATH)/mason_handler.fcgi
+
+# RT_SPEEDYCGI_HANDLER is the mason handler script for SpeedyCGI
+# THIS HANDLER IS NOT CURRENTLY SUPPORTED
+RT_SPEEDYCGI_HANDLER   =       $(RT_BIN_PATH)/mason_handler.scgi
+
+# The following are the names of the various binaries which make up RT 
+
+RT_CLI_BIN             =       $(RT_BIN_PATH)/rt
+RT_CLI_ADMIN_BIN       =       $(RT_BIN_PATH)/rtadmin
+RT_MAILGATE_BIN                =       $(RT_BIN_PATH)/rt-mailgate
+
+# }}}
+
+# {{{ Database setup
+
+#
+# DB_TYPE defines what sort of database RT trys to talk to
+# "mysql" is known to work.
+# "Pg" is known to work
+# "Oracle" is in the early stages of working.
+
+DB_TYPE                        =       mysql
+
+# DB_HOME is where the Database's commandline tools live.  $DB_HOME/bin
+# should contain the binaries themselves, e.g. if "which mysql" gives
+# "/usr/local/mysql/bin/mysql", $DB_HOME should be "/usr/local/mysql"
+
+DB_HOME                        = /usr
+
+# Set DBA to the name of a unix account with the proper permissions and 
+# environment to run your commandline SQL tools
+
+# Set DB_DBA to the name of a DB user with permission to create new databases 
+# Set DB_DBA_PASSWORD to that user's password (if you don't, you'll be prompted
+# later)
+
+# For mysql, you probably want 'root'
+# For Pg, you probably want 'postgres' 
+# For oracle, you want 'system'
+
+DB_DBA                 =       root
+DB_DBA_PASSWORD                =       
+#
+# Set this to the Fully Qualified Domain Name of your database server.
+# If the database is local, rather than on a remote host, using "localhost" 
+# will greatly enhance performance.
+
+DB_HOST                        =       localhost
+
+# If you're not running your database server on its default port, 
+# specifiy the port the database server is running on below.
+# It's generally safe to leave this blank 
+
+DB_PORT                        =       
+
+#
+# Set this to the canonical name of the interface RT will be talking to the 
+# database on.  If you said that the RT_DB_HOST above was "localhost," this 
+# should be too. This value will be used to grant rt access to the database.
+# If you want to access the RT database from multiple hosts, you'll need
+# to grant those database rights by hand.
+#
+
+DB_RT_HOST             =       localhost
+
+# set this to the name you want to give to the RT database in 
+# your database server. For Oracle, this should be the name of your sid
+
+DB_DATABASE            =       rt2
+
+# Set this to the name of the rt database user
+
+DB_RT_USER             =       rt_user
+
+# Set this to the password used by the rt database user
+# *** Change This Before Installation***
+
+DB_RT_PASS             =       rt_pass
+
+# }}}
+
+# {{{ Web configuration 
+
+# The user your webserver runs as. needed so that webrt can cache mason
+# objectcode
+
+WEB_USER               =       www
+WEB_GROUP              =       rt
+
+# }}}
+
+
+####################################################################
+# No user servicable parts below this line.  Frob at your own risk #
+####################################################################
+
+default:
+       @echo "Please read RT's readme before installing. Not doing so could"
+       @echo "be dangerous."
+
+install: dirs initialize.$(DB_TYPE) upgrade insert instruct
+
+instruct:
+       @echo "Congratulations. RT has been installed. "
+       @echo "You must now configure it by editing $(RT_CONFIG)."
+       @echo "From here on in, you should refer to the users guide."
+
+
+insert: insert-install
+       $(PERL) -I$(DESTDIR)/$(RT_ETC_PATH) -I$(DESTDIR)/$(RT_LIB_PATH) $(DESTDIR)/$(RT_ETC_PATH)/insertdata
+
+upgrade: dirs config-replace upgrade-noclobber  upgrade-instruct
+
+upgrade-instruct: 
+       @echo "Congratulations. RT has been upgraded. You should now check-over"
+       @echo "$(RT_CONFIG) for any necessary site customization. Additionally,"
+       @echo "you should update RT's system database objects by running "
+       @echo "    $(RT_ETC_PATH)/insertdata <version>"
+       @echo "where <version> is the version of RT you're upgrading from."
+
+upgrade-noclobber: insert-install libs-install html-install bin-install nondestruct
+
+nondestruct: fixperms
+
+testdeps:
+       $(PERL) ./tools/testdeps -warn $(DB_TYPE)
+
+fixdeps:
+       $(PERL) ./tools/testdeps -fix $(DB_TYPE)
+
+
+
+all:
+       @echo "Read the readme."
+
+fixperms:
+       # Make the libraries readable
+       chmod -R $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_PATH)
+       chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
+       chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)
+
+       chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_BIN_PATH)
+       chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_BIN_PATH)
+
+
+       chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
+       chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH) 
+
+       chmod 0755 $(DESTDIR)/$(RT_ETC_PATH)
+       chmod 0500 $(DESTDIR)/$(RT_ETC_PATH)/*
+
+       #TODO: the config file should probably be able to have its
+       # owner set seperately from the binaries.
+       chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_ETC_PATH)
+       chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_ETC_PATH)
+
+       chmod 0550 $(DESTDIR)/$(RT_CONFIG)
+
+       # Make the interfaces executable and setgid rt
+       chown $(BIN_OWNER) $(DESTDIR)/$(RT_MAILGATE_BIN) \
+                       $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_CLI_BIN) \
+                       $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
+
+       chgrp $(RTGROUP) $(DESTDIR)/$(RT_MAILGATE_BIN) \
+                       $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_CLI_BIN) \
+                       $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
+
+       chmod 0755      $(DESTDIR)/$(RT_MAILGATE_BIN) \
+                       $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_CLI_BIN) \
+                       $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
+
+       chmod g+s       $(DESTDIR)/$(RT_MAILGATE_BIN) \
+                       $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
+                       $(DESTDIR)/$(RT_CLI_BIN) \
+                       $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
+
+       # Make the web ui readable by all. 
+       chmod -R  u+rwX,go-w,go+rX      $(DESTDIR)/$(MASON_HTML_PATH) \
+                                       $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
+       chown -R $(LIBS_OWNER)  $(DESTDIR)/$(MASON_HTML_PATH) \
+                               $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
+       chgrp -R $(LIBS_GROUP)  $(DESTDIR)/$(MASON_HTML_PATH) \
+                               $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
+
+       # Make the web ui's data dir writable
+       chmod 0770      $(DESTDIR)/$(MASON_DATA_PATH) \
+                       $(DESTDIR)/$(MASON_SESSION_PATH)
+       chown -R $(WEB_USER)    $(DESTDIR)/$(MASON_DATA_PATH) \
+                               $(DESTDIR)/$(MASON_SESSION_PATH)
+       chgrp -R $(WEB_GROUP)   $(DESTDIR)/$(MASON_DATA_PATH) \
+                               $(DESTDIR)/$(MASON_SESSION_PATH)
+dirs:
+       mkdir -p $(DESTDIR)/$(RT_BIN_PATH)
+       mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)
+       mkdir -p $(DESTDIR)/$(MASON_SESSION_PATH)
+       mkdir -p $(DESTDIR)/$(RT_ETC_PATH)
+       mkdir -p $(DESTDIR)/$(RT_LIB_PATH)
+       mkdir -p $(DESTDIR)/$(MASON_HTML_PATH)
+       mkdir -p $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
+
+libs-install: 
+       [ -d $(DESTDIR)/$(RT_LIB_PATH) ] || mkdir $(DESTDIR)/$(RT_LIB_PATH)
+       chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
+       chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)
+       chmod -R $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_LIB_PATH)
+       ( cd ./lib; \
+         $(PERL) Makefile.PL INSTALLSITELIB=$(DESTDIR)/$(RT_LIB_PATH) \
+                             INSTALLMAN1DIR=$(DESTDIR)/$(RT_MAN_PATH)/man1 \
+                             INSTALLMAN3DIR=$(DESTDIR)/$(RT_MAN_PATH)/man3 \
+           && make \
+           && make test \
+           && $(PERL) -p -i -e " s'!!RT_VERSION!!'$(RT_VERSION)'g;" blib/lib/RT.pm ;\
+           make install \
+                          INSTALLSITEMAN1DIR=$(DESTDIR)/$(RT_MAN_PATH)/man1 \
+                          INSTALLSITEMAN3DIR=$(DESTDIR)/$(RT_MAN_PATH)/man3 \
+       )
+
+html-install:
+       cp -rp ./webrt/* $(DESTDIR)/$(MASON_HTML_PATH)
+
+
+
+genschema:
+       $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' generate
+
+
+initialize.Pg: createdb initdb.dba acls 
+
+initialize.mysql: createdb acls initdb.rtuser
+
+initialize.Oracle: acls initdb.rtuser
+
+acls:
+       cp etc/acl.$(DB_TYPE) '$(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)'
+       $(PERL) -p -i -e " s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\
+                               s'!!DB_HOST!!'"$(DB_HOST)"'g;\
+                               s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\
+                               s'!!DB_RT_HOST!!'"$(DB_RT_HOST)"'g;\
+                               s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\
+                               s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;" $(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)
+       bin/initacls.$(DB_TYPE) '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DBA_PASSWORD)' '$(DB_DATABASE)' '$(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)' 
+
+
+
+dropdb: 
+       $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' drop
+
+
+createdb: 
+       $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' create
+initdb.dba:
+       $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' insert
+
+initdb.rtuser:
+       $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_RT_USER)' '$(DB_DATABASE)' insert
+
+
+
+insert-install:
+       cp -rp ./tools/insertdata \
+                $(DESTDIR)/$(RT_ETC_PATH)
+       $(PERL) -p -i -e " s'!!RT_ETC_PATH!!'$(RT_ETC_PATH)'g;\
+                          s'!!RT_LIB_PATH!!'$(RT_LIB_PATH)'g;"\
+               $(DESTDIR)/$(RT_ETC_PATH)/insertdata
+
+bin-install:
+       cp -p ./bin/webmux.pl $(DESTDIR)/$(RT_MODPERL_HANDLER)
+       cp -p ./bin/rt-mailgate $(DESTDIR)/$(RT_MAILGATE_BIN)
+       cp -p ./bin/rtadmin $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
+       cp -p ./bin/rt $(DESTDIR)/$(RT_CLI_BIN)
+       cp -p ./bin/mason_handler.fcgi $(DESTDIR)/$(RT_FASTCGI_HANDLER)
+       cp -p ./bin/mason_handler.scgi $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER)
+
+       $(PERL) -p -i -e "s'!!RT_PATH!!'"$(RT_PATH)"'g;\
+                               s'!!PERL!!'"$(PERL)"'g;\
+                               s'!!RT_VERSION!!'"$(RT_VERSION)"'g;\
+                               s'!!RT_ETC_PATH!!'"$(RT_CONFIG_PATH)"'g;\
+                               s'!!RT_LIB_PATH!!'"$(RT_LIB_PATH)"'g;"\
+               $(DESTDIR)/$(RT_MODPERL_HANDLER) \
+               $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
+               $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
+               $(DESTDIR)/$(RT_CLI_BIN) \
+               $(DESTDIR)/$(RT_CLI_ADMIN_BIN) \
+               $(DESTDIR)/$(RT_MAILGATE_BIN)
+
+
+config-replace:
+       -[ -f $(DESTDIR)/$(RT_CONFIG) ] && \
+               mv $(DESTDIR)/$(RT_CONFIG) $(DESTDIR)/$(RT_CONFIG).old && \
+               chmod 000 $(DESTDIR)/$(RT_CONFIG).old
+       cp -rp ./etc/config.pm $(DESTDIR)/$(RT_CONFIG)
+       $(PERL) -p -i -e "\
+       s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\
+       s'!!DB_HOST!!'"$(DB_HOST)"'g;\
+       s'!!DB_PORT!!'"$(DB_PORT)"'g;\
+       s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\
+       s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\
+       s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;\
+       s'!!MASON_HTML_PATH!!'"$(MASON_HTML_PATH)"'g;\
+       s'!!MASON_LOCAL_HTML_PATH!!'"$(MASON_LOCAL_HTML_PATH)"'g;\
+       s'!!MASON_SESSION_PATH!!'"$(MASON_SESSION_PATH)"'g;\
+       s'!!MASON_DATA_PATH!!'"$(MASON_DATA_PATH)"'g;\
+       s'!!RT_LOG_PATH!!'"$(RT_LOG_PATH)"'g;\
+       s'!!RT_VERSION!!'"$(RT_VERSION)"'g;\
+       " $(DESTDIR)/$(RT_CONFIG)
+
+
+commit:
+       cvs commit
+
+predist: commit
+       cvs tag -r $(BRANCH) -F $(TAG)
+       rm -rf /tmp/$(TAG)
+       cvs co -d /tmp/$(TAG) -r $(TAG) rt
+       cd /tmp/$(TAG); chmod 600 Makefile; /usr/local/bin/cvs2cl.pl \
+               --no-wrap --separate-header \
+               --window 120
+       cd /tmp; tar czvf /home/ftp/pub/rt/devel/$(TAG).tar.gz $(TAG)/
+       chmod 644 /home/ftp/pub/rt/devel/$(TAG).tar.gz
+
+dist: commit predist
+       rm -rf /home/ftp/pub/rt/devel/rt.tar.gz
+       ln -s ./$(TAG).tar.gz /home/ftp/pub/rt/devel/rt.tar.gz
+
+
+rpm:
+       (cd ..; tar czvf /usr/src/redhat/SOURCES/rt.tar.gz rt)
+       rpm -ba etc/rt.spec
diff --git a/rt/README b/rt/README
new file mode 100755 (executable)
index 0000000..d16100c
--- /dev/null
+++ b/rt/README
@@ -0,0 +1,336 @@
+$Header: /home/cvs/cvsroot/freeside/rt/README,v 1.1 2002-08-12 06:17:06 ivan Exp $
+RT is (c) 1996-2002 by Jesse Vincent <jesse@bestpractical.com>
+
+RT is licensed to you under the terms of version 2 of the GNU General 
+Public License. 
+
+If you don't have a copy of the GPL, you've been living in a cave,
+but one should be included in this distribution.
+
+
+INSTALLATION INSTRUCTIONS
+-------------------------
+
+These instructions are a summary of those at http://www.fsck.com/rtfm/
+The docs on the web at www.fsck.com/rtfm/ are likely to be more up to
+date and complete than this document. You should consult them before 
+proceeding.
+
+REQUIRED PACKAGES:
+------------------
+
+o   Perl5.005_03 or later with support for setgid perl scripts
+        RT's command line and mail gateway tools run setgid to the 'rt' group
+       to protect RT's database password.  You may need to install a special 
+       "suidperl" package or reconfigure your perl setup to support
+        "setuid scripts".
+
+o   A DB backend; MySQL is recommended ( http://www.mysql.com ) 
+        Currently supported:    Mysql 3.23.38 or newer. 
+                                (Some older releases had crippling SQL bugs)
+                               Postgres 7.1 or newer.
+
+o   Apache + mod_perl -- ( http://perl.apache.org) 
+    or A webserver with FastCGI support (www.fastcgi.com)
+
+       If you compile mod_perl as a DSO, you're on your own. It's known
+       to have massive stability problems. 
+        mod_perl must be build with EVERYTHING=1
+
+o    Various and sundry perl modules
+        RT takes care of the installation of most of these automatically
+        during the "make testdeps" and "make fixdeps" stages below
+
+
+GENERAL INSTALLATION
+--------------------
+
+1   Unpack this distribution SOMWHERE OTHER THAN where you want to install RT
+
+        Granted, you've already got it open. To do this cleanly:
+
+               tar xzvf rt.tar.gz -C /tmp
+
+2   Check over /tmp/rt/Makefile
+
+       There are many variables you NEED to customize for your site.
+       Even if you are just upgrading, you must set ALL variables.
+
+3   Satisfy RT's myriad dependencies.  There's a perl script in rt/tools
+    called testdeps that uses CPAN to automate all of this.
+
+3.1   Check for compliance:
+       make testdeps
+
+3.2   If there are unsatisfied dependencies, install them by hand or run
+       make fixdeps
+       
+       (You may need to install Apache::Session and Apache::DBI by hand.
+
+       You might need to install Msql-Mysql-Modules by hand.
+       perl -MCPAN -e'install DBD::mysql::Install' should do it for you.
+       )
+
+3.3   Check to make sure everything was installed properly:
+       make testdeps
+
+4   Create a group called 'rt'
+
+5a  FOR A NEW INSTALLATION: 
+        
+        As root, type:
+                make install   (replace "make" with the local name for 
+                                Make, if you need to)
+
+       If the make fails, type:
+               make dropdb 
+       and start over from step 5a
+
+5b  FOR UPGRADING: (Within the RT 2.0.x series)
+
+       Make a backup of /path/to/rt/etc/config.pm
+        As root, type: 
+               make upgrade     (replace "make" with the local name for 
+                                 Make, if you need to)
+
+       This will build new binaries, config files and libraries without
+       overwriting your RT database. 
+
+        WARNING: This WILL clobber your existing configuration file!
+        
+        The install process will then instruct you to update your RT system 
+        database objects by running rt/etc/insertdata <version> where 
+        <version> is the version of RT you're upgrading from.
+
+        
+       
+5c  FOR UPGRADING (From 1.0.x):
+
+       Follow the instructions for installing RT 2.0.
+
+       Once you have installed RT 2.0, download import-1.0-to-2.0
+       from http://www.fsck.com/pub/rt/contrib/2.0/rt-addons
+
+       Edit the configuration defaults in import-1.0-to-2.0
+
+       If you don't set $DEFAULTQUEUE to the name of one of your
+       RT 1.0 queues, THE IMPORT WILL FAIL.
+
+       perl ./import-1.0-to-2.0
+
+       The import tool will do its thing. If you're using postgres, you'll
+       need to execute the following SQL statement within your RT2 database:
+
+       select setval('tickets_id_seq', (select max(id) from tickets));
+       
+       It imports:
+               Queues, Areas, Users, Acls, Mailing Rules, Queue Members,
+               Tickets and Transactions.
+
+       It DOES NOT IMPORT:
+               Attachments removed by stripmime or Templates.
+       
+6   Edit etc/config.pm in your RT installation directory.  In many
+    cases sensible defaults have been included. In others, you MUST
+    supply a value.
+
+7   Configure the email and web gateways, as described below. 
+
+8   Stop and start your webserver, so it picks up your configuration changes.
+
+    NOTE: root's password for the web interface is "password" 
+    (without the quotes.)  Not changing this is a SECURITY risk
+    
+9   Configure RT per the instructions at http://www.fsck.com/rtfm/
+
+    Until you do this, RT will not be able to send or recieve email,
+    nor will it be more than marginally functional.  This is not an
+    optional step.
+
+
+SETTING UP THE MAIL GATEWAY 
+---------------------------
+
+An alias for the initial queue will need to be made in either your
+global mail aliases file (if you are using NIS) or locally on your
+machine.
+Add the following lines to /etc/aliases (or your local equivalent) :
+
+rt:         "|/path/to/rt2/bin/rt-mailgate --queue general --action correspond"
+rt-comment: "|/path/to/rt2/bin/rt-mailgate --queue general --action comment"
+                                                   |                |
+                                   <queue-name>----/                |
+                                                                    |
+                      <correspond or comment depending on whether   |
+                      the mail should be resent to the requestor>---/
+
+
+
+THE WEB UI
+----------
+
+RT's web ui is based around HTML::Mason, which works well with the mod_perl
+perl interpreter within Apache httpd as well as with a webserver which
+supports FastCGI. (Instructions for configuring RT for use with FastCGI
+are available at http://www.fsck.com/rtfm/ )
+
+Apache 
+        RT Uses HTML::Mason.  You'll need to add a few lines to your
+        httpd.conf telling it to use rt's web ui.  If you have mod-perl
+       (you should, the perl scripts will go quite a bit faster around with
+       it), you can do something like this:
+
+
+<VirtualHost your.ip.address>
+DocumentRoot /path/to/rt2/WebRT/html
+ServerName your.rt.server.hostname
+PerlModule Apache::DBI
+PerlFreshRestart On
+PerlRequire /path/to/rt2/bin/webmux.pl
+<Location />
+ SetHandler perl-script
+ PerlHandler RT::Mason
+</Location>
+</VirtualHost>
+
+Additionally, you should set up a cron job to remove stale session data.
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ WARNING: Don't install this cron job or run this find command if your
+ MASON_SESSION_PATH (known in config.pm as $MasonSessionDir) 
+ points to a directory that could  EVER contain any file that's not 
+ a Apache::Session datafile.
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+# Every hour, nuke session files and lockfiles that haven't been 
+# touched in 10 hours
+
+0 * * * * find /path/to/rt2/WebRT/sessiondata -type f -amin +600 -exec rm {} \;
+
+
+THE CLI
+-------
+        Binaries for the CLI are located in rt/bin
+        You've got:
+
+                "rt" (manipulate or display requests) 
+                "rtadmin" (modify queues, users and acls)
+
+        Both of these programs take --help as an option.
+
+
+BUGS
+----
+
+Known issues with releases of RT2 are listed at 
+<URL:http://fsck.com/rt2/NoAuth/Errata.html>.  This includes every bug known
+to exist in each release of RT.  (When prompted, login as guest/guest)
+
+To find out more about currently open bugs, check out the live 
+Buglist at  <URL:http://fsck.com/rt2/NoAuth/Buglist.html>.
+(When prompted, login as guest/guest)
+
+To report a bug, send an email to rt-2.0-bugs@fsck.com.
+
+GETTING HELP
+------------
+
+If RT is mission-critical for you or if you use it heavily, we recommend that
+you purchase a commercial support contract.  Details on support contracts
+are available at http://www.bestpractical.com.
+
+If you're interested in having RT extended or customized or would like more
+information about commercial support options, please send email to 
+<sales@bestpractical.com> to discuss rates and availability.
+
+
+RT-USERS MAILINGLIST
+--------------------
+
+To keep up to date on the latest RT tips, techniques and extections,
+you probably want to join the rt-users mailinglist.  Send a message to:
+
+         rt-users-request@lists.fsck.com 
+
+With the body of the message consisting of only the word:
+
+        subscribe
+
+If you're interested in hacking on rt, you'll want to subscribe to
+rt-devel@lists.fsck.com.  Subscribe to it with instructions similar to
+those above.
+
+Address questions about the stable release to the rt-users list, and
+questions about the development version to the rt-devel list.  If you feel
+your questions are best not asked publically, send them personally to
+<jesse@bestpractical.com>.
+
+If you want to be informed of every commit to the CVS repository,
+subscribe to rt-commit@fsck.com using similar instructions to those above.
+
+
+RT WEBSITE
+----------
+
+For current information about RT, check out the RT website at 
+http://www.bestpractical.com/rt  You'll find screenshots, a pointer
+to the current version of rt, contributed patches and lots of other great
+stuff.
+
+
+TROUBLESHOOTING
+---------------
+
+All errors will be appended to a logfile, which lives in /tmp/rt.log.* unless 
+you've reconfigured it.  Check etc/config.pm for details.
+
+If the solution to the problem you're running into isn't obvious and you've 
+checked the FAQ, feel free to send mail to rt-users@fsck.com (for release 
+versions of RT) or rt-devel@fsck.com (for development versions).
+
+GIVING SOMETHING BACK
+---------------------
+
+RT is free software. You are not obligated to pay for it.  You should be 
+aware, however, that bestpractical.com's sole source of revenue is commercial
+work related to RT. If you are able, either a contract to extend RT in some 
+way that would be useful to your organization, a financial contribution, or 
+even something off the author's amazon wishlist 
+       ( http://www.amazon.com/exec/obidos/wishlist/2GMHUDAFBT2XR/ )
+would be much appreciated. 
+
+Thanks!
+
+
+CREDITS
+-------
+
+A lot of people are responsible for making RT a better program.  Many
+thanks to Lauren Burka, who originally tasked me with writing this beast.
+She forced me to use a database backend.  I've thanked her for it every
+day since.  Rich West rewrote this readme and did some UI hacking.  Adam
+Hirsch, Kit Kraysha, Robin Garner, Jens Glaser, John Adams, Trey Belew, 
+Sean Dague, Nathan Mehl, Kee Hinckley, Rich West, Dale Bewley, Serge Zhuk,
+John Lengeling, Elmar Knipp, Gerald Abshez, Dave Hull, Dave Schenet,
+Dave Walton, Jan Okrouhly, Tobias Brox, Lamont Lucas, Charlie Brady,
+Robin Shostack, Eric Mumpower, Jerrod Wiesman, Adam Hammer, Ivan Kohler, Alex
+Pilosov, Mary Alderdice, Deborah Kaplan, Jens von Bülow, Tristan Horn,
+Lee Ann Goldstein, Karel P Kerezman, Feargal Reilly, Christian Steger,
+Christian Kurz, JD Falk, Arthur de Jong, Ben Carter, Mark Vevers
+and many others
+have all contributed bug reports, code or ideas that have helped RT along.  
+
+Arepa, Inc, Utopia Inc, Wesleyan University and The Leftbank Operation 
+have paid me to maintain RT and release it to the public.  Without their 
+support RT would not exist.  
+
+If I've left you out, please drop me a line ....it wasn't intentional. 
+
+        Enjoy
+
+        Jesse Vincent
+       <jesse@bestpractical.com>
+        Best Practical Solutions, LLC
diff --git a/rt/TODO b/rt/TODO
new file mode 100755 (executable)
index 0000000..3d1b7d0
--- /dev/null
+++ b/rt/TODO
@@ -0,0 +1,9 @@
+Errata for RT 2.x can be found at http://fsck.com/rt2/NoAuth/Errata.html
+
+A list of all open issues, including those which haven't been added
+to the official Errata lists,  can be found at 
+http://fsck.com/rt2/NoAuth/Buglist.html
+
+If you want to look at bugs in more detail, you may need to login as guest with a password of 'guest'
+
+
diff --git a/rt/bin/initacls.Oracle b/rt/bin/initacls.Oracle
new file mode 100644 (file)
index 0000000..8d05f45
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+DATABASEHOME=$1
+HOSTNAME=$2
+PORT=$3
+DATABASEADMIN=$4
+DBAPASSWD=$5
+DATABASENAME=$6
+DATABASEACLS=$7
+
+BINDIR=${DATABASEHOME}/bin
+
+echo "DBHOME = $DATABASEHOME"
+echo "HOSTNAME = $HOSTNAME"
+echo "PORT = $PORT"
+echo "DATABASEADMIN = $DATABASEADMIN"
+echo "DBAPASSWD = $DBAPASSWD"
+echo "DATABASENAME = $DATABASENAME"
+
+PATH=$PATH:$BINDIR
+export PATH
+
+echo "Please enter ${DATABASEADMIN}'s  password for the SID ${DATABASENAME} to create an rt user";
+
+$BINDIR/sqlplus ${DATABASEADMIN}@${DATABASENAME}  @$DATABASEACLS
+
diff --git a/rt/bin/initacls.Pg b/rt/bin/initacls.Pg
new file mode 100755 (executable)
index 0000000..82e32de
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+DATABASEHOME=$1
+HOSTNAME=$2
+PORT=$3
+DATABASEADMIN=$4
+DBAPASSWD=$5
+DATABASENAME=$6
+DATABASEACLS=$7
+
+BINDIR=${DATABASEHOME}/bin
+
+
+PATH=$PATH:$BINDIR
+export PATH
+
+echo "Enter the postgres administrator's database password to create a new user for rt"
+
+if [ "fnord$PORT" != "fnord" ]; then
+       PORT="-p $PORT"
+fi;
+
+if [ "fnord$HOSTNAME" != "fnord" ]; then
+       HOSTNAME="-h $HOSTNAME"
+fi;
+
+psql $HOSTNAME $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN
+
diff --git a/rt/bin/initacls.mysql b/rt/bin/initacls.mysql
new file mode 100755 (executable)
index 0000000..17e63f8
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+DATABASEHOME=$1
+HOSTNAME=$2
+PORT=$3
+DATABASEADMIN=$4
+DBAPASSWD=$5
+DATABASENAME=$6
+DATABASEACLS=$7
+
+BINDIR=${DATABASEHOME}/bin
+
+PATH=$PATH:$BINDIR
+export PATH
+
+echo "Enter the mysql administrator's database password to create a new user for RT"
+$BINDIR/mysql --host=${HOSTNAME} --port=${PORT} --user=${DATABASEADMIN} -p${DBAPASSWD} mysql < $DATABASEACLS
+
+echo "Enter the mysql administrator's database password to nondestructively reload the database"
+$BINDIR/mysqladmin --host=${HOSTNAME} --port=${PORT} --user=${DATABASEADMIN} -p${DBAPASSWD} reload
diff --git a/rt/bin/mason_handler.fcgi b/rt/bin/mason_handler.fcgi
new file mode 100755 (executable)
index 0000000..e8a4e12
--- /dev/null
@@ -0,0 +1,221 @@
+#!!!PERL!!
+# $Header: /home/cvs/cvsroot/freeside/rt/bin/mason_handler.fcgi,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# RT is (c) 1996-2001 Jesse Vincent (jesse@fsck.com);
+
+use strict;
+$ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
+$ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
+$ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
+$ENV{'ENV'} = '' if defined $ENV{'ENV'};
+$ENV{'IFS'} = ''          if defined $ENV{'IFS'};
+
+
+# We really don't want apache to try to eat all vm
+# see http://perl.apache.org/guide/control.html#Preventing_mod_perl_Processes_Fr
+
+
+package RT::Mason;
+#use CGI qw(-private_tempfiles);   # pull in CGI with the private tempfiles
+                                 #option predefined
+use HTML::Mason;  # brings in subpackages: Parser, Interp, etc.
+
+use vars qw($VERSION %session $Nobody $SystemUser $cgi);
+
+# List of modules that you want to use from components (see Admin
+# manual for details)
+
+#Clean up our umask...so that the session files aren't world readable, writable or executable
+umask(0077);
+
+
+  
+$VERSION="!!RT_VERSION!!";
+
+use lib "!!RT_LIB_PATH!!";
+use lib "!!RT_ETC_PATH!!";
+
+#This drags in  RT's config.pm
+use config;
+use Carp;
+
+{  
+    package HTML::Mason::Commands;
+    use vars qw(%session $ContentType);
+    
+    use RT; 
+    use RT::Ticket;
+    use RT::Tickets;
+    use RT::Transaction;
+    use RT::Transactions;
+    use RT::User;
+    use RT::Users;
+    use RT::CurrentUser;
+    use RT::Template;
+    use RT::Templates;
+    use RT::Queue;
+    use RT::Queues;
+    use RT::ScripAction;
+    use RT::ScripActions;
+    use RT::ScripCondition;
+    use RT::ScripConditions;
+    use RT::Scrip;
+    use RT::Scrips;
+    use RT::Group;
+    use RT::Groups;
+    use RT::Keyword;
+    use RT::Keywords;
+    use RT::ObjectKeyword;
+    use RT::ObjectKeywords;
+    use RT::KeywordSelect;
+    use RT::KeywordSelects;
+    use RT::GroupMember;
+    use RT::GroupMembers;
+    use RT::Watcher;
+    use RT::Watchers;
+    use RT::Handle;
+    use RT::Interface::Web;    
+    use MIME::Entity;
+    use CGI::Cookie;
+    use Date::Parse;
+    use HTML::Entities;
+    use Text::Wrapper;
+    #TODO: make this use DBI
+    use Apache::Session::File;
+    use CGI::Fast;
+
+    # set the page's content type.
+    # In this case, just save it to a variable that we can pull later;
+    sub SetContentType {
+       $ContentType = shift;
+    }
+    sub CGIObject {
+       return $RT::Mason::cgi;
+    }
+}
+
+
+my ($output, $parser, $interp);
+if ($HTML::Mason::VERSION < 1.0902) {
+        require HTML::Mason::ApacheHandler;
+
+         $parser = &RT::Interface::Web::NewParser(allow_globals => [%session]);
+
+         $interp = &RT::Interface::Web::NewInterp(parser=>$parser,
+                                             allow_recursive_autohandlers => 1,
+                                           out_method => \$output);
+}
+else {
+         $interp = &RT::Interface::Web::NewInterp(
+                                                  allow_globals => [%session],
+                                                  default_escape_flags => 'h',
+
+                                           out_method => \$output);
+}
+# Die if WebSessionDir doesn't exist or we can't write to it
+
+stat ($RT::MasonSessionDir);
+die "Can't read and write $RT::MasonSessionDir"
+  unless (( -d _ ) and ( -r _ ) and ( -w _ ));
+
+
+RT::Init();
+
+# Response loop
+while ($RT::Mason::cgi = new CGI::Fast) {
+    
+    $HTML::Mason::Commands::ContentType = 'text/html';
+        
+    # This routine comes from ApacheHandler.pm:
+    my (%args, $cookie);
+    foreach my $key ( $cgi->param ) {
+       foreach my $value ( $cgi->param($key) ) {
+           if (exists($args{$key})) {
+               if (ref($args{$key})) {
+                   $args{$key} = [@{$args{$key}}, $value];
+               } else {
+                   $args{$key} = [$args{$key}, $value];
+               }
+           } else {
+               $args{$key} = $value;
+           }
+
+       }
+       
+    }
+    
+
+    my $comp = $ENV{'PATH_INFO'};
+    
+    if ($comp =~ /^(.*)$/) {  # untaint the path info. apache should
+                             # never hand us a bogus path. 
+                             # We should be more careful here.
+       $comp = $1;
+    }    
+    
+    if ($comp =~ /\/$/) {
+       $comp .= "index.html";
+    }  
+    
+    #This is all largely cut and pasted from mason's session_handler.pl
+    
+    # {{{ Cookies
+    my %cookies = fetch CGI::Cookie();
+    
+    eval {
+       my $session_id = undef;
+
+       #Get the session id and untaint it
+       if ($cookies{'AF_SID'} && $cookies{'AF_SID'}->value() =~ /^(.*)$/) {
+               $session_id = $1;
+       }
+       tie %HTML::Mason::Commands::session, 'Apache::Session::File',
+               $session_id, 
+           { Directory => $RT::MasonSessionDir,
+             LockDirectory => $RT::MasonSessionDir,
+           }   ;
+    };
+    
+    if ( $@ ) {
+       # If the session is invalid, create a new session.
+       if ( $@ =~ m#^Object does not exist in the data store# ) {
+            tie %HTML::Mason::Commands::session, 'Apache::Session::File', undef,
+            { Directory => $RT::MasonSessionDir,
+              LockDirectory => $RT::MasonSessionDir,
+            };
+            undef $cookies{'AF_SID'};
+       }
+         else {
+             die "$@ \nProbably means that RT Couldn't write to session directory '$RT::MasonSessionDir'. Check that this directory's permissions are correct.";
+         }
+    }
+    
+    if ( !$cookies{'AF_SID'} ) {
+       $cookie = new CGI::Cookie
+         (-name=>'AF_SID', 
+          -value=>$HTML::Mason::Commands::session{_session_id}, 
+          -path => '/',);
+       
+    } else {
+       $cookie = undef;
+    }
+    
+    # }}}
+    
+    $output = '';
+    eval {
+           my $status = $interp->exec($comp, %args);
+    };
+    if ($@) {
+       $output = "<PRE>$@</PRE>";
+    }
+    print "Content-Type: $HTML::Mason::Commands::ContentType\r\n";
+    print "Set-Cookie: $cookie\r\n" if ($cookie);
+    print "\r\n";
+    print $output;
+    untie %HTML::Mason::Commands::session;
+    
+}
diff --git a/rt/bin/mason_handler.scgi b/rt/bin/mason_handler.scgi
new file mode 100755 (executable)
index 0000000..b9846c8
--- /dev/null
@@ -0,0 +1,193 @@
+#!!!PERL!! -w
+
+#!/usr/bin/speedy -- -t600 -M8
+# $Header: /home/cvs/cvsroot/freeside/rt/bin/mason_handler.scgi,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# RT is (c) 1996-2001 Jesse Vincent (jesse@fsck.com);
+#
+# Contains code derived from mason.cgi
+# mason.cgi is Copyright December 2000 Joshua Kronengold (mneme@io.com, 
+# mneme@cyberspace.org).  All Rights Reserved.
+
+use strict;
+# {{{ Clean out the environment a little bit
+$ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
+$ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
+$ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
+$ENV{'ENV'} = '' if defined $ENV{'ENV'};
+$ENV{'IFS'} = ''          if defined $ENV{'IFS'};
+# }}}
+
+package RT::Mason;
+use HTML::Mason;  # brings in subpackages: Parser, Interp, etc.
+use vars qw($VERSION %session $Nobody $SystemUser);
+
+# List of modules that you want to use from components (see Admin
+# manual for details)
+
+$VERSION="!!RT_VERSION!!";
+
+use lib "!!RT_LIB_PATH!!";
+use lib "!!RT_ETC_PATH!!";
+
+
+#This drags in  RT's config.pm
+use config;
+use Carp;
+
+use HTML::Mason::FakeApache;
+use CGI;
+
+# {{{ Set up CGI environment and grab CGI params:
+
+my $r=new HTML::Mason::FakeApache;
+
+$|=1; # set output to non-buffered.
+
+my %cgi;
+CGI::ReadParse(\%cgi); # %cgi is now a tied hash containing our params.
+
+my $q=$cgi{CGI}; # $q now contains the object tied to %cgi.
+# }}}
+
+# {{{ require what we need
+{  
+    package HTML::Mason::Commands;
+
+    use vars qw(%session);
+
+    use RT::Ticket;
+    use RT::Tickets;
+    use RT::Transaction;
+    use RT::Transactions;
+    use RT::User;
+    use RT::Users;
+    use RT::CurrentUser;
+    use RT::Template;
+    use RT::Templates;
+    use RT::Queue;
+    use RT::Queues;
+    use RT::ScripAction;
+    use RT::ScripActions;
+    use RT::ScripCondition;
+    use RT::ScripConditions;
+    use RT::Scrip;
+    use RT::Scrips;
+    use RT::Group;
+    use RT::Groups;
+    use RT::Keyword;
+    use RT::Keywords;
+    use RT::ObjectKeyword;
+    use RT::ObjectKeywords;
+    use RT::KeywordSelect;
+    use RT::KeywordSelects;
+    use RT::GroupMember;
+    use RT::GroupMembers;
+    use RT::Watcher;
+    use RT::Watchers;
+    use RT::Handle;
+    use RT::Interface::Web;    
+    use MIME::Entity;
+    use CGI::Cookie;
+    use Date::Parse;
+    use HTML::Entities;
+
+    
+    use Apache::Session::File;
+
+    
+}
+# }}}
+
+# {{{ RT Database setup
+    $RT::Handle = new RT::Handle;
+    
+    $RT::Handle->Connect;
+   
+    use RT::CurrentUser;
+    
+    #RT's system user is a genuine database user. its id lives here
+    $RT::SystemUser = new RT::CurrentUser();
+    $RT::SystemUser->LoadByName('RT_System');
+
+    #RT's "nobody user" is a genuine database user. its ID lives here.
+    $RT::Nobody = new RT::CurrentUser();
+    $RT::Nobody->LoadByName('Nobody'); 
+     
+
+# }}}
+
+
+
+
+# {{{ Deal with cookies
+
+my %cookies = fetch CGI::Cookie();
+eval { 
+    tie %HTML::Mason::Commands::session, 'Apache::Session::File',
+      ( $cookies{'AF_SID'} ? $cookies{'AF_SID'}->value() : undef );
+};
+
+if ( $@ ) {
+    # If the session is invalid, create a new session.
+    if ( $@ =~ m#^Object does not exist in the data store# ) {
+        tie %HTML::Mason::Commands::session, 'Apache::Session::File', undef;
+        undef $cookies{'AF_SID'};
+    }
+}
+
+if ( !$cookies{'AF_SID'} ) {
+    my $cookie = new CGI::Cookie(
+        -name=>'AF_SID', 
+        -value=>$HTML::Mason::Commands::session{_session_id}, 
+         -path => '/');
+    print 'Set-Cookie: '. $cookie."\r\n";
+}
+
+# }}}
+
+my $path=$ENV{PATH_INFO} || "/"; $path=~s/\'/\\\'/g;
+
+my $type=`/usr/bin/file '$RT::MasonComponentRoot/$path'`;
+
+# {{{ if it's a text file, handle it with mason.
+if($type=~/text|directory/) { 
+       my ($out, %mason_params);
+        my $parser = RT::Interface::Web::NewParser(allow_globals=>[qw($r)]);
+       $mason_params{parser}=$parser;
+       $r->content_type('text/html');
+       # (get cookies line) ...
+       $r->access_hash('headers_in','Cookie',$ENV{HTTP_COOKIE});
+       $r->{'args@'}=[];
+       $mason_params{out_method}=\$out;
+
+       my $interp = RT::Interface::Web::NewInterp(%mason_params);
+
+       $interp->set_global(r=>$r);
+       $interp->exec($path,%cgi);
+       $r->send_http_header();
+        print $out;
+} 
+# }}} 
+
+# {{{ if it's not a text file, just stream it out.
+
+else { # file is binary, damn it
+       my $mime_type;
+       if ( $mime_type=
+            eval{ use MIME::Types;
+                  my($type,$encoding)=MIME::Types::by_suffix($path);
+                  $type; }) {
+           print $q->header($mime_type);       
+           $path=~s/[\|\>\<\&]//g;
+           open F,"$RT::MasonComponentRoot/$path" or 
+             die "couldn't open $path -- $!";
+           print while <F>; 
+           close F;
+       } else {
+           die "couldn't resolve type of non-text file (!@; $type) -- install Mime::Types\n";
+       }
+    }
+
+# }}}
+
+untie %HTML::Mason::Commands::session;
diff --git a/rt/bin/rt b/rt/bin/rt
new file mode 100755 (executable)
index 0000000..41220bb
--- /dev/null
+++ b/rt/bin/rt
@@ -0,0 +1,1391 @@
+#!!!PERL!! -w
+#
+# $Header: /home/cvs/cvsroot/freeside/rt/bin/Attic/rt,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# RT is (c) 1996-2001 Jesse Vincent <jesse@bestpractical.com>
+
+use strict;
+use Carp;
+use Getopt::Long;
+
+use lib "!!RT_LIB_PATH!!";
+use lib "!!RT_ETC_PATH!!";
+
+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();
+
+#Connect to the database and get RT::SystemUser and RT::Nobody loaded
+DBConnect();
+
+#Drop setgid permissions
+RT::DropSetGIDPermissions();
+
+#Get the current user all loaded
+my $CurrentUser = GetCurrentUser();
+
+unless ($CurrentUser->Id) {
+       print "No RT user found. Please consult your RT administrator.\n";
+       exit(1);
+}
+
+
+# {{{ commandline flags 
+
+my ( @id,
+     @limit_queue,
+     @limit_status,
+     @limit_owner,
+     @limit_priority,
+     @limit_final_priority,
+     @limit_requestor,
+     @limit_subject,
+     @limit_body,
+     @limit_created,
+     @limit_resolved,
+     @limit_lastupdated,
+     @limit_dependson,
+     @limit_dependedonby,
+     @limit_memberof,
+     @limit_hasmember,
+     @limit_refersto,
+     @limit_referredtoby,
+     @limit_keyword,
+     
+     @limit_due,
+     @limit_starts,
+     @limit_started,
+     $limit_first,
+     $limit_rows,
+     $history,
+     $summary,
+     $create,
+     @requestors,
+     @cc,
+     @admincc,
+     $status,
+     $subject,
+     $owner,
+     $steal,
+     $queue,
+     $time_left,
+     $priority,
+     $final_priority,
+     $due,
+     $starts,
+     $started,
+     $contacted,
+     $comment,
+     $reply,
+     $source,
+     $edit,
+     @dependson,
+     @memberof, 
+     @refersto,
+     $mergeinto,
+     @keywords,
+     $time_taken,
+     $verbose,
+     $debug,
+   $help,
+   $version);
+
+# }}}
+
+# Set defaults for cli args
+
+$edit = 1; # Assume the user wants to edit replies and comments 
+           # unless they specify --noedit
+
+# {{{    args
+
+my @args =("id=s" => \@id,
+          "limit-queue=s" => \@limit_queue,
+          "limit-status=s" => \@limit_status,
+          "limit-owner=s" => \@limit_owner,
+          "limit-priority=s" => \@limit_priority,
+          "limit-final-priority=s" => \@limit_final_priority,
+          "limit-requestor=s" => \@limit_requestor,
+          "limit-subject=s" => \@limit_subject,
+          "limit-body=s",      \@limit_body,
+          "limit-created=s" => \@limit_created,
+          "limit-due=s" =>     \@limit_due,
+          "limit-last-updated=s" => \@limit_lastupdated,
+          "limit-keyword=s" => \@limit_keyword,
+
+          "limit-member-of=s" => \@limit_memberof,
+          "limit-has-member=s" => \@limit_hasmember,
+          "limit-depended-on-by=s" => \@limit_dependedonby,
+          "limit-depends-on=s" => \@limit_dependson,
+          "limit-referred-to-by=s" => \@limit_referredtoby,
+          "limit-refers-to=s" => \@limit_refersto,
+
+          "limit-starts=s" => \@limit_starts,
+          "limit-started=s" => \@limit_started,
+          "limit-first=i" => \$limit_first,
+          "limit-rows=i" => \$limit_rows,
+          "history|show" => \$history,
+          "summary:s" => \$summary,
+          "create" => \$create,
+          "keywords=s" => \@keywords,
+          "requestor|requestors=s" => \@requestors,
+          "cc=s" => \@cc,
+          "admincc=s" => \@admincc,
+          "status=s" => \$status,
+          "subject=s" => \$subject,
+          "owner=s" => \$owner,
+          "steal" => \$steal,
+          "queue=s" => \$queue,
+
+          
+          "priority=i" => \$priority,
+          "final-priority=i" => \$final_priority,
+          "due=s" => \$due,
+          "starts=s" => \$starts,
+          "started=s" => \$started,
+          "contacted=s" => \$contacted,
+          "comment", \$comment,
+          "reply|respond", \$reply,
+          "source=s" => \$source,
+          "edit!" => \$edit,
+          "depends-on=s" => \@dependson,
+          "member-of=s" => \@memberof, 
+          "merge-into=s" => \$mergeinto, 
+          "refers-to=s" => \@refersto,
+          "time-left=i" => \$time_left,
+          "time-taken=i" => \$time_taken,
+          "verbose+" => \$verbose,
+          "debug" => \$debug,
+          "version" => \$version,
+          "help|h|usage" => \$help
+         );
+
+# }}}
+
+
+
+GetOptions(@args);
+
+print join(':',@keywords);
+# {{{ If they want it, print a usage message and get out
+
+if ($help) {
+
+
+print <<EOUSAGE;
+
+Limit the set of records returned:
+
+--id=[first][-][last]
+  Specify a single ticket, a range, or to start with (n-) or end with (-n)
+a specific ticket.
+  
+  --limit-queue=<queue>
+         --limit-status=[!](new|open|stalled|resolved)
+
+         --limit-owner=[!]<userid>
+         --limit-priority=[starts][-][ends]
+         --limit-final-priority=[starts][-][ends]
+           starts is less than ends
+         --limit-requestor=[!]<userid>|<email>
+         --limit-subject=[!]<text>
+         --limit-body=[!]<text>
+         --limit-keyword=[!]<select>/<keyword>
+        
+       Links
+          --limit-member-of=<ticketid>
+          --limit-has-member=<ticketid>
+          --limit-refers-to=<ticketid>
+          --limit-referred-to-by=<ticketid>
+          --limit-depends-on=<ticketid>
+          --limit-depended-on-by=<ticketid>
+
+
+       Dates
+         --limit-created=[starts][-][ends]
+         --limit-due=[starts][-][ends]
+         --limit-starts=[starts][-][ends]
+         --limit-started=[starts][-][ends]
+          --limit-resolved=[starts][-][ends]
+          --limit-last-updated=[starts][-][ends]
+           starts and ends are dates.  starts can not be less than ends
+
+         --limit-first=<first row returned>
+         --limit-rows=<row count>
+
+         --history | --show
+            show a history of the tickets found
+
+         --summary [format-string]
+             show a listing-style summary of the tickets found. If format string
+             is ommitted, uses \$RT_SUMMARY_FORMAT or an internal default
+            
+
+             #TODO: doc summary 
+             format: <atom>%<format>
+             atom:   <name><size>
+             size: <integer>
+             name:  (grep for # {{{ attribs for the array of ok values)
+
+
+         --create
+            create a new ticket. Any attributes that you can modify on an existing ticket
+            can also be used for ticket creation.
+
+
+
+Attributes
+  Basics
+         --status=<new|open|stalled|resolved|dead>
+           sets status
+          --subject=<subject>
+           sets subject
+          --owner=<userid>
+           set owner to 
+           --steal
+           Become the owner, even if someone else owns the ticket
+          --queue=<queueid>
+           set queue to
+          
+          --priority=<int>
+         
+           --final-priority=<int>
+
+  Watchers
+         --requestors=[+|-]<userid|email address>
+          add or remove this user as a ticket requestor 
+         --cc=[+|-]<userid|email address>
+          add or remove this user as a ticket cc
+         --admincc=[+|-]<userid|email address>
+          add or remove this user as a ticket admincc
+
+       (When creating tickets, just leave off the + or - )
+
+  Keywords
+         --keywords[+|-]<keyword_select>/<keyword>
+          Add or remove a keyword.
+
+
+
+  Dates
+          --due=<date>
+          --starts=<date>
+          --started=<date>
+          --contacted=<date>
+
+          --time-left=<int>
+            
+          --time-taken=<int>
+
+
+   Link related manipulation:
+
+          --depends-on=[+|-]<ticketid>
+          --member-of=[+|-]<ticketid>
+          --refers-to=[+|-]<ticketid>
+           --merge-into=<ticketid>
+
+Comments and replies
+
+          --comment
+          --reply|respond
+            --source <path>
+                Specify the path to the source file for this ticket update
+
+             --noedit
+                Don't invoke \$EDITOR to edit the content of this update
+
+
+
+
+   Condiments
+
+          --verbose
+          --debug
+          --version
+          --help|h|usage
+             You're reading it.
+
+EOUSAGE
+
+    exit(0);
+}
+
+# Print version, and leave
+if ($version) {
+       print "RT $RT::VERSION for $RT::rtname. Copyright 1996-2001 Jesse Vincent <jesse\@fsck.com>\n";
+       exit(0);
+}
+
+# }}}
+
+# {{{ Validate any options that were passed in. normalize them.
+
+#if a queue was specified
+if ($queue) {
+    # make sure that $queue is a valid queue and load it into $queue_obj
+}
+
+#For each date in: $due, $starts, $started
+
+# load up an RT::Date object and parse it into a normalized form
+# if it can't parse it, log an error and null out the variable
+
+# }}}
+
+# {{{ Check if we're creating, if so, create the ticket and be done
+
+if ($create) {
+    $RT::Logger->debug("Creating a new ticket");
+
+    #Make sure the current user can create tickets in this queue
+    
+    #Make sure that the owner specified can own tickets in this queue
+
+
+           
+    my $linesref = GetMessageContent( Edit => $edit, Source => $source,
+                                     CurrentUser => $CurrentUser
+                                   );
+    
+    require MIME::Entity;
+    my $MIMEObj;
+    
+    if ($linesref) {
+       $MIMEObj = MIME::Entity->build(Data => $linesref);
+    }  
+    
+    use RT::Ticket;
+    my $Ticket=new RT::Ticket($CurrentUser);
+    my ($ticket, $trans, $msg) =
+      $Ticket->Create(Queue => $queue,
+                     Owner => $owner,
+                     Status => $status || 'new' ,
+                     Subject => $subject,
+                     Requestor => \@requestors,
+                     Cc => \@cc,
+                     AdminCc => \@admincc,
+                     Due => $due,
+                     Starts => $starts,
+                     Started => $started,
+                     TimeLeft => $time_left,
+                     InitialPriority => $priority,
+                     FinalPriority => $final_priority,
+                     MIMEObj => $MIMEObj
+                    );
+    print $msg . "\n";
+}
+
+# }}}
+
+else {
+    #Apply restrictions
+    use RT::Tickets;
+    my $Tickets = new RT::Tickets($CurrentUser);
+    
+    # {{{ Limit our search
+    my $value;                 #to use when iterating through restrictions
+    my $queue_id;              #to use when limiting by keyword
+    
+    # {{{ limit on id
+
+    foreach $value (@id) {
+       if ($value =~ /^(\d+)$/) {
+           $Tickets->LimitId ( VALUE => $1,
+                               OPERATOR => '=');
+       }       
+       elsif ($value =~ /^(\d*)\D?(\d*)$/) {
+           my $start = $1;
+           my $end = $2;
+           $Tickets->LimitId(
+                             VALUE => "$start",
+                             OPERATOR => '>=') if ($start);
+           $Tickets->LimitId(
+                             VALUE => "$end",
+                             OPERATOR => '<=') if ($end);
+       }       
+    }
+
+
+    # }}}
+    
+    # {{{ limit on status
+
+    foreach $value (@limit_status) {
+       if ($value =~ /^(=|!=|!|)(.*)$/) {
+           my $op = $1;
+           my $val = $2;
+                
+
+           $op = ParseBooleanOp($op);
+           $Tickets->LimitStatus(VALUE => "$val",
+                                 OPERATOR => "$op");
+       }       
+    }
+
+    # }}}
+
+
+
+    # {{{ limit on queue
+    foreach $value (@limit_queue) {
+       if ($value =~ /^(\W?)(.*?)$/i) {
+           my $op = $1;
+           my $val = $2;
+               
+           $op = ParseBooleanOp($op);
+
+           my $queue_obj = new RT::Queue($RT::SystemUser);
+               
+           unless ($queue_obj->Load($val)) {
+               $RT::Logger->debug("Queue '$val' not found");
+               print STDERR "Queue '$val' not found\n";        
+               exit(-1);
+           }
+           $RT::Logger->debug ("Limiting queue to $op ".$queue_obj->Name);
+           $Tickets->LimitQueue(VALUE => $queue_obj->Name,
+                                OPERATOR => $op);
+           $queue_id=$queue_obj->id;
+       }       
+    }  
+
+    # {{{ limit on keyword
+    foreach $value (@limit_keyword) {
+       if ($value =~ /^(\W?)(.*?)\/(.*)$/i) {
+           my $op = $1;
+           my $select = $2;
+           my $keyword = $3;
+
+           $op = ParseBooleanOp($op);
+
+           # load the keyword select
+           my $keyselect = RT::KeywordSelect->new($RT::SystemUser);
+           unless ($keyselect->LoadByName(Name=>$select, Queue=>$queue_id)) {
+               $RT::Logger->debug("KeywordSelect '$select' not found");
+               print STDERR "KeywordSelect '$select' not fount\n";
+               exit(-1);
+           }
+
+           # load the keyword
+           my $k = RT::Keyword->new($RT::SystemUser);
+           unless ($k->LoadByNameAndParentId($keyword, $keyselect->Keyword)) {
+               $RT::Logger->debug("Keyword '$keyword' not found");
+               print STDERR "Keyword '$keyword' not found\n";
+               exit(-1);
+           }
+           $Tickets->LimitKeyword(OPERATOR => $op,
+                                  KEYWORDSELECT => $keyselect->id,
+                                  KEYWORD => $k->id);
+           $RT::Logger->debug ("Limiting keyword to $op ".$k->Path);
+       }
+    }
+    # }}}
+    # {{{ limit on owner
+    foreach $value (@limit_owner) {
+       if ($value =~ /^(\W?)(.*?)$/i) {
+           my $op = $1;
+           my $val = $2;
+               
+           $op = ParseBooleanOp($op);
+
+           my $user_obj = new RT::User($RT::SystemUser);
+               
+           unless ($user_obj->Load($val)) {
+               $RT::Logger->debug("User '$val' not found");
+               print STDERR "User '$val' not found\n"; 
+               exit(-1);
+           }
+           $val = $user_obj->id();
+               
+           $RT::Logger->debug ("Limiting owner to $op $val");
+           $Tickets->LimitOwner(VALUE => "$val",
+                                OPERATOR => "$op");
+       }       
+    }  
+    # }}}
+    # {{{ limt on priority
+
+    foreach $value (@limit_priority) {
+       my ($start, $end) = ParseRange($value);
+       if ($start == $end) {
+           $Tickets->LimitPriority( VALUE => $start,
+                                    OPERATOR => '=');
+       } elsif ($start) {
+           $Tickets->LimitPriority( VALUE => $start,
+                                    OPERATOR => '>=');
+       } elsif ($end) {
+           $Tickets->LimitPriority( VALUE => $end,
+                                    OPERATOR => '<=');
+       }       
+           
+    }
+    foreach $value (@limit_final_priority) {
+       my ($start, $end) = ParseRange($value);
+       if ($start == $end) {
+           $Tickets->LimitFinalPriority( VALUE => $start,
+                                         OPERATOR => '=');
+       } elsif ($start) {
+           $Tickets->LimitFinalPriority( VALUE => $start,
+                                         OPERATOR => '>=');
+       } elsif ($end) {
+           $Tickets->LimitFinalPriority( VALUE => $end,
+                                         OPERATOR => '<=');
+       }       
+    }
+    # }}}
+
+    foreach $value (@limit_requestor) {
+       if ($value =~ /^(\W?)(.*?)$/i) {
+           my $op = $1;
+           my $val = $2;
+               
+           $op = ParseBooleanOp($op);
+           $Tickets->LimitRequestor(VALUE => $val,
+                                    OPERATOR => $op );
+       }
+           
+    }
+    foreach $value (@limit_subject) {
+       
+       if ($value =~ /^(\W?)(.*?)$/i) {
+           my $op = $1;
+           my $val = $2;
+           
+           $op = ParseLikeOp($op);
+           
+           $Tickets->LimitSubject(VALUE => $val,
+                                  OPERATOR => $op );
+           }
+    }
+    
+    foreach $value (@limit_body) {
+       if ($value =~ /^(\W?)(.*?)$/i) {
+           my $op = $1;
+           my $val = $2;
+           
+           $op = ParseLikeOp($op);
+           
+               $Tickets->LimitBody(VALUE => $val,
+                                   OPERATOR => $op );
+       }       
+       
+    }
+    
+    
+    
+    # Dates
+    foreach my $date (@limit_created) {
+       my ($start, $end) = ParseDateRange($date);
+       $Tickets->LimitCreated ( VALUE => $start,
+                                OPERATOR => '>=' ) if ($start);
+       $Tickets->LimitCreated ( VALUE => $end,
+                                OPERATOR => '<=' ) if ($end);
+    }
+
+    foreach my $date (@limit_due) {
+       my ($start, $end) = ParseDateRange($date);
+       $Tickets->LimitDue ( VALUE => $start,
+                                OPERATOR => '>=' ) if ($start);
+       $Tickets->LimitDue ( VALUE => $end,
+                                OPERATOR => '<=' ) if ($end);
+    }
+
+    foreach my $date (@limit_starts) {
+       my ($start, $end) = ParseDateRange($date);
+       $Tickets->LimitStarts ( VALUE => $start,
+                                OPERATOR => '>=' ) if ($start);
+       $Tickets->LimitStarts ( VALUE => $end,
+                                OPERATOR => '<=' ) if ($end);
+    }
+
+    foreach my $date (@limit_started) {
+       my ($start, $end) = ParseDateRange($date);
+       $Tickets->LimitStarted ( VALUE => $start,
+                                OPERATOR => '>=' ) if ($start);
+       $Tickets->LimitStarted ( VALUE => $end,
+                                OPERATOR => '<=' ) if ($end);
+    }
+
+    foreach my $date (@limit_resolved) {
+       my ($start, $end) = ParseDateRange($date);
+       $Tickets->LimitResolved ( VALUE => $start,
+                                OPERATOR => '>=' ) if ($start);
+       $Tickets->LimitResolved ( VALUE => $end,
+                                OPERATOR => '<=' ) if ($end);
+    }
+
+    foreach my $date (@limit_lastupdated) {
+       my ($start, $end) = ParseDateRange($date);
+       $Tickets->LimitLastUpdated( VALUE => $start,
+                                OPERATOR => '>=' ) if ($start);
+       $Tickets->LimitLastUpdated ( VALUE => $end,
+                                OPERATOR => '<=' ) if ($end);
+    }
+
+    foreach my $link (@limit_memberof) {
+       $Tickets->LimitMemberOf($link);
+    }  
+
+    foreach my $link (@limit_hasmember) {
+       $Tickets->LimitHasMember($link);
+    }  
+
+    foreach my $link (@limit_dependson) {
+       $Tickets->LimitDependsOn($link);
+    }  
+
+    foreach my $link (@limit_dependedonby) {
+       $Tickets->LimitDependedOnBy($link);
+    }
+    foreach my $link (@limit_refersto) {
+       $Tickets->LimitRefersTo($link);
+    }  
+    
+    foreach my $link (@limit_referredtoby) {
+       $Tickets->LimitReferredToBy($link);
+    }  
+
+    
+    if ($limit_first){
+    }
+    if ($limit_rows){
+    }
+
+# }}}
+    
+    # {{{ Iterate through all tickets we found
+
+
+    my ($format, $titles, $code);
+    
+    #Set up the summary format if we need to
+    if (defined $summary) {
+       my $format_string = $summary || $ENV{'RT_SUMMARY_FORMAT'} || "%id4%status4%queue7%subject40%requestor16";
+
+       ($format, $titles, $code) = BuildListingFormat($format_string);
+        printf "$format\n", eval "$titles";
+   }   
+
+
+    while (my $Ticket = $Tickets->Next()) {
+       $RT::Logger->debug ("Now working on ticket ". $Ticket->id);
+    
+       #Run through all the ticket modifications we might want to do
+       #TODO: these are all insufficiently lazy and should be replaced with some 
+       # nice foreaches.
+
+
+       # {{{ deal with watchers
+       
+       # add / delete requestors
+       foreach $value (@requestors) {
+           if ($value =~ /^(\W?)(.*)$/) {
+               my $op = $1;
+               my $addr = $2;
+               
+               $Ticket->AddRequestor(Email => $addr) if ($op eq '+');
+               $Ticket->DeleteRequestor( $addr) if ($op eq '-');
+           }   
+       }
+       
+       # add / delete ccs
+       foreach $value (@cc) {
+           if ($value =~ /^(\W?)(.*)$/) {
+               my $op = $1;
+               my $addr = $2;
+               $Ticket->AddCc(Email => $addr) if ($op eq '+');
+               $Ticket->DeleteCc($addr) if ($op eq '-');
+           }   
+       }       
+       
+       # add / delete adminccs
+        $RT::Logger->debug("Looking at admin ccs");
+       foreach $value (@admincc) {
+           if ($value =~ /^(\W?)(.*)$/) {
+               my $op = $1;
+               my $addr = $2;
+               $Ticket->AddAdminCc(Email => $addr) if ($op eq '+');
+               $Ticket->DeleteAdminCc($addr) if ($op eq '-');
+           }   
+       }       
+
+       # }}}
+       
+       # {{{ Deal with ticket keywords
+
+       my $KeywordSelects = $Ticket->QueueObj->KeywordSelects();
+        $RT::Logger->debug ("Looking at keywords");
+       foreach $value (@keywords) {
+           $RT::Logger->debug("Looking at --keyword=$value");
+           if ($value =~ /^(\W?)(.*?)\/(.*)$/) {
+               my $op = $1;
+               my $select = $2;
+               my $keyword = $3;
+               
+               $RT::Logger->debug("Going to $op Keyword $select / $keyword");  
+               while (my $ks = $KeywordSelects->Next) {
+                    $RT::Logger->debug("$select is select ".$ks->Name." is found");
+                   next unless ($ks->Name =~ /$select/i);
+                   $RT::Logger->debug ("Found a match for $select\n"); 
+                   my $kids = $ks->KeywordObj->Descendents;
+    
+                    my ($kid);
+                   foreach $kid (keys %{$kids}) {
+                        $RT::Logger->debug("Now comparing $keyword with ".$kids->{$kid}. "\n");
+                       next unless ($kids->{$kid} =~ /^$keyword$/i);
+                       $RT::Logger->debug("Going to $op $select / $keyword (".$kids->{$kid} .")");     
+                       $Ticket->DeleteKeyword(KeywordSelect => $ks->id,
+                                           Keyword => $kid) if ($op eq '-');
+                       
+                       $Ticket->AddKeyword(KeywordSelect => $ks->id,
+                                           Keyword => $kid) if ($op eq '+');
+                   }
+                   
+               }
+           }
+       }
+       # }}}
+       
+       # {{{ deal with links
+
+       # Deal with merging {
+       if ($mergeinto) {
+               my ($trans, $msg) =$Ticket->MergeInto($mergeinto);
+               print $msg."\n";
+       }       
+       # add /delete depends-ons
+
+       foreach my $value (@dependson) {
+           if ($value =~ /^(\W?)(.*)$/) {
+               my $op = $1;
+               my $ticket = $2;
+               if (!$op or ($op eq '+')) {
+                   my ($trans, $msg) =
+                     $Ticket->AddLink(Type => 'DependsOn', Target => $ticket);
+                   print $msg."\n";
+               }
+               elsif ($op eq '-') {
+                   my ($trans, $msg) = 
+                     $Ticket->DeleteLink(Type => 'DependsOn', Target => $ticket);
+                   print $msg."\n";
+               }
+
+           }
+       }
+       # add /delete member-of
+       foreach my $value (@memberof) {
+           if ($value =~ /^(\W?)(.*)$/) {
+               my $op = $1;
+               my $ticket = $2;
+               if ($op eq '+') {
+                   my ($trans, $msg) =
+                     $Ticket->AddLink(Type => 'MemberOf', Target => $ticket);
+                   print $msg;
+               }
+               elsif ($op eq '-') {
+                   my ($trans, $msg) = 
+                     $Ticket->DeleteLink(Type => 'MemberOf', Target => $ticket);
+                   print $msg;
+               }
+
+           }
+       }       
+       # add / delete refers-to
+               foreach my $value (@refersto) {
+           if ($value =~ /^(\W?)(.*)$/) {
+               my $op = $1;
+               my $ticket = $2;
+               if ($op eq '+') {
+                   my ($trans, $msg) =
+                     $Ticket->AddLink(Type => 'RefersTo', Target => $ticket);
+                   print $msg;
+               }
+               elsif ($op eq '-') {
+                   my ($trans, $msg) = 
+                     $Ticket->DeleteLink(Type => 'RefersTo', Target => $ticket);
+                   print $msg;
+               }
+
+           }
+       }
+
+       # }}}
+       
+       # {{{ deal with dates
+       
+       #set due 
+       if ($due) {
+           my $iso = ParseDateToISO($due);
+           if ($iso) {
+               $RT::Logger->debug("Setting due date to $iso ($due)");
+               my ($trans, $msg) = 
+                 $Ticket->SetDue($iso);
+               print $msg;
+           }
+           else {
+               print "Due date '$due' could not be parsed";
+           }
+       }
+
+       #set starts
+       if ($starts) {
+           my $iso = ParseDateToISO($due);
+           if ($iso) {
+               my ($trans, $msg) = 
+                 $Ticket->SetStarts($iso);
+               print $msg."\n";
+           }
+           else {
+               print "Starts date '$starts' could not be parsed";
+           }
+       }
+       #set started
+               if ($started) {
+           my $iso = ParseDateToISO($started);
+           if ($iso) {
+               my ($trans, $msg) = 
+                 $Ticket->SetStarted($iso);
+               print $msg."\n";
+           }
+           else {
+               print "Started date '$started' could not be parsed";
+           }
+       }
+       #set contacted
+               if ($contacted) {
+           my $iso = ParseDateToISO($contacted);
+           if ($iso) {
+               my ($trans, $msg) = 
+                 $Ticket->SetContacted($iso);
+               print $msg."\n";
+           }
+           else {
+               print "Contacted date '$contacted' could not be parsed";
+           }
+       }
+
+    # }}}
+       
+       # {{{ set other attributes
+
+       #Set subject
+       if ($subject) {
+           my ($trans, $msg) = $Ticket->SetSubject($subject);
+           print $msg."\n";
+       }
+       
+       #Set priority
+       if ($priority) {
+           my ($trans, $msg) = 
+             $Ticket->SetPriority($priority);
+           print $msg."\n";
+       }
+       
+       #Set final priority
+       if ($final_priority) {
+           my ($trans, $msg) =
+             $Ticket->SetFinalPriority($final_priority);
+           print $msg."\n";
+       }
+
+       #Set status
+       if ($status) {
+           my ($trans, $msg) = 
+             $Ticket->SetStatus($status);
+           print $msg."\n";
+       }
+       
+       #Set time left
+       if ($time_left) {
+           my ($trans, $msg) = 
+             $Ticket->SetTimeLeft($time_left);
+           print $msg."\n";
+       }
+
+       #Set time_taken 
+       if ($time_taken) {
+           my ($trans, $msg) = 
+             $Ticket->SetTimeTaken($time_taken);
+           print $msg."\n";
+       }
+       
+       #Set owner
+       if ($owner) {
+           my ($trans, $msg) =
+             $Ticket->SetOwner($owner);
+           print $msg."\n";
+       }
+
+        # Steal
+        if ($steal) {
+                my ($trans, $msg) =
+                 $Ticket->Steal();
+                 print $msg . "\n";
+        }
+       #Set queue 
+       if ($queue) {
+           my ($trans, $msg) = 
+             $Ticket->SetQueue($queue);
+           print $msg."\n";
+       }
+
+    # }}}
+       
+
+
+       # {{{ Perform ticket comments/replies
+       if ($reply) {
+           $RT::Logger->debug("Replying to ticket ".$Ticket->Id);
+           
+           my $linesref = GetMessageContent( Edit => $edit, Source => $source,
+                                            CurrentUser => $CurrentUser
+                                          );
+           
+           #TODO build this entity
+           require MIME::Entity;
+           my $MIMEObj = MIME::Entity->build(Data => $linesref);
+           
+           $Ticket->Correspond( MIMEObj => $MIMEObj ,
+                                TimeTaken => $time_taken);
+       }       
+       
+       elsif ($comment) {
+           $RT::Logger->debug("Commenting on ticket ".$Ticket->Id);
+       
+           my $linesref =GetMessageContent(Edit => $edit, Source => $source,
+                                           CurrentUser => $CurrentUser);
+           #TODO build this entity
+           require MIME::Entity;
+           my $MIMEObj = MIME::Entity->build(Data => $linesref);
+           
+           $Ticket->Comment( MIMEObj => $MIMEObj,
+                             TimeTaken => $time_taken);
+       }
+
+    # }}}
+       
+       # {{{ Display whatever we need to display
+
+       # {{{ Display a full ticket listing and history
+       if ($history) {
+           #Display the history
+           $RT::Logger->debug("Show history for ".$Ticket->id);
+           
+           if ($Ticket->CurrentUserHasRight("ShowTicket")) {
+               &ShowSummary($Ticket);
+               print "\n";
+               &ShowHistory($Ticket);
+           }
+           else {
+               print "You don't have permission to view that ticket.\n";
+           }
+       }       
+
+       # }}}
+       
+       # {{{ Display a summary if we need to
+       if (defined $summary) {
+           $RT::Logger->debug ("Show ticket summary with format $format");
+           
+           printf $format."\n", eval $code;
+           
+       }       
+       # }}}
+
+       # }}}
+       
+    }
+
+    # }}}
+    
+}
+
+
+$RT::Handle->Disconnect();
+
+
+
+
+
+
+
+# {{{ sub ParseBooleanOp
+
+=head2 ParseBooleanOp
+
+  Takes an option modifier. returns the apropriate SQL operator.
+  If it's handed ! or -, returns !=.  Otherwise returns =.
+
+=cut
+
+sub ParseBooleanOp {
+    
+    my $op = shift;
+    
+    #so that !new limits to not new, etc
+    if ($op =~ /^(\!|-)/) {
+       $op = "!=";
+    }
+    else {
+       $op = "=";
+    }
+    
+    return($op);
+}
+
+# }}}
+
+# {{{ sub ParseLikeOp
+=head2 ParseLikeOp
+
+  Takes an option modifier. returns the apropriate SQL operator.
+  If it's handed ! or -, returns NOT  LIKE.  Otherwise returns LIKE
+
+=cut
+
+sub ParseLikeOp {
+    
+    my $op = shift;
+    
+    #so that !new limits to not new, etc
+    if ($op =~ /^(\!|-)/) {
+       $op = "NOT LIKE";
+    }
+    else {
+       $op = "LIKE";
+    }
+    
+    return($op);
+}
+# }}}
+
+# {{{ sub ParseDateToISO
+
+=head2 ParseDateToISO
+
+Takes a date in an arbitrary format.
+Returns an ISO date and time in GMT
+
+=cut
+
+sub ParseDateToISO {
+    my $date = shift;
+
+       my $date_obj = new RT::Date($CurrentUser);
+       $date_obj->Set( Format => 'unknown',
+                       Value => $date
+                     );
+       return ($date_obj->ISO);
+}
+
+# }}}
+
+# {{{ sub ParseDateRange
+
+=head2 ParseDateRange [RANGE]
+
+Takes a range of dates of the form [<date>][-][<date>] and returns 
+starting and ending dates (as ISOs) If a date is specified as neither a starting nor ending 
+date, we parse it it as "midnight tonight to midnight tomorrow"
+
+=cut
+
+sub ParseDateRange {
+    my $in = shift;
+    my ($start, $end);
+    
+    
+    use RT::Date;
+    my $start_obj = new RT::Date($CurrentUser);
+    my $end_obj = new RT::Date($CurrentUser);
+    
+    if ($in =~ /^(.*?)-(.*?)$/) {
+       $start = $1;
+       $end = $2;
+
+       if ($start) {
+           $start_obj->Set(Format => 'unknown', 
+                           Value => $start);
+       }
+       if ($end) {
+           $end_obj->Set(Format => 'unknown', 
+                         Value => $end);
+       }
+    }
+    else {
+       $start = $in;
+       $end = $in;
+
+       $start_obj->Set(Format => 'unknown', 
+                       Value => $start);
+       
+       $end_obj->Set(Format => 'unknown', 
+                     Value => $end);
+       
+       $start_obj->SetToMidnight();
+       $end_obj->SetToMidnight();
+       $end_obj->AddDay();
+    }  
+    
+    if ($start) {
+       $start = $start_obj->ISO;
+    }
+    if ($end) {
+       $end = $end_obj->ISO;
+    }
+
+    return ($start, $end);
+}
+
+# }}}
+
+# {{{ ParseRange
+=head2 ParseRange [RANGE]
+
+Takes a range of the form [<int>][-][<int>] and returns 
+a first and a last value. If the - is omitted, both $start and $end are the same.
+=cut
+
+sub ParseRange {
+    my $in = shift;
+    my ($start, $end);
+    
+    if ($in =~ /(.*?)-(.*?)/) {
+       $start = $1;
+       $end = $2;
+    }
+    else {
+       $start = $in;
+       $end = $in;
+    }  
+    
+    return ($start, $end);
+    
+
+    
+}
+
+# }}}
+         
+# {{{ sub ShowSummary 
+
+sub ShowSummary  {
+    my $Ticket = shift;
+
+
+    print <<EOFORM;
+Serial Number: @{[$Ticket->Id]}   Status:@{[$Ticket->Status]} Worked: @{[$Ticket->TimeWorked]} minutes  Queue:@{[$Ticket->QueueObj->Name]}
+      Subject: @{[$Ticket->Subject]}
+   Requestors: @{[$Ticket->RequestorsAsString]}
+           Cc: @{[$Ticket->CcAsString]}
+     Admin Cc: @{[$Ticket->AdminCcAsString]}
+        Owner: @{[$Ticket->OwnerObj->Name]}
+     Priority: @{[$Ticket->Priority]} / @{[$Ticket->FinalPriority]}
+          Due: @{[$Ticket->DueAsString]}
+      Created: @{[$Ticket->CreatedAsString]} (@{[$Ticket->AgeAsString]})
+ Last Contact: @{[$Ticket->ToldAsString]} (@{[$Ticket->LongSinceToldAsString]})
+  Last Update: @{[$Ticket->LastUpdatedAsString]} by @{[$Ticket->LastUpdatedByObj->Name]}
+                
+EOFORM
+
+my $selects = $Ticket->QueueObj->KeywordSelects();
+    #get the keyword selects
+    print "Keywords:\n";
+    while (my $select = $selects->Next) {
+       print "\t" .$select->Name .": ";
+       my $keys = $Ticket->KeywordsObj($select->id);   
+       while (my $key = $keys->Next) {
+           print $key->KeywordObj->RelativePath($select->KeywordObj) . "  ";
+           
+       }       
+       print "\n";
+    }
+    
+#iterate through the keyword selects.
+#print the keyword select and all the related keywords
+
+
+
+#TODO: finish link  descriptions
+print "Dependencies: \n";
+   while (my $l=$Ticket->DependedOnBy->Next) {
+       print $l->BaseObj->id," (",$l->BaseObj->Subject,") ",$l->Type," this ticket\n";
+   }
+   while (my $l=$Ticket->DependsOn->Next) {
+       print "This ticket ",$l->Type," ",$l->TargetObj->Id," (",$l->TargetObj->Subject,")\n";
+   }
+}
+
+# }}}
+
+# {{{ sub ShowHistory 
+sub ShowHistory  {
+    my $Ticket = shift;
+    my $Transaction;    
+    my $Transactions = $Ticket->Transactions;
+
+    while ($Transaction = $Transactions->Next) {
+      &ShowTransaction($Transaction);
+    }   
+  }
+# }}}
+
+# {{{ sub ShowTransaction 
+sub ShowTransaction  {
+  my $transaction = shift;
+  
+print <<EOFORM;
+==========================================================================
+Date: @{[$transaction->CreatedAsString]} (@{[$transaction->TimeTaken]} minutes)
+@{[$transaction->Description]}
+EOFORM
+    ;
+  my $attachments=$transaction->Attachments();
+  while (my $message=$attachments->Next) {
+    print <<EOFORM;
+--------------------------------------------------------------------------
+@{[$message->Headers]}
+EOFORM
+
+    if ($message->ContentType =~ m{^(text/plain|message|text$)}) {
+       print $message->Content;
+    } else {
+       print $message->ContentType, " not shown";
+    }
+  }
+  print "\n";
+  return();
+}
+# }}}
+
+
+# {{{ sub BuildListingFormat
+
+sub BuildListingFormat {
+    my $format_string = shift;
+
+    my ($id, @format, @code, @titles);
+    my ($field,$titles,$length, $format);
+
+    my $code = "";
+
+    # {{{ attribs
+    my $attribs = { id => { chars => '4',
+                           justify => 'r',
+                           title => 'id',
+                           value => '$Ticket->id',
+                         },
+                   
+                   queue => { chars => '8',
+                              justify => 'l',
+                              title => 'Queue',
+                              value => '$Ticket->QueueObj->Name' 
+                            },
+                   subject => { chars => '30',
+                                justify => 'l',
+                                title => 'Subject',
+                                value => '$Ticket->Subject',
+                              },
+                   priority => { chars => '2',
+                                 justify => 'r',
+                                 title => 'Pri',
+                                 value => '$Ticket->Priority',
+                               },
+                   final_priority => {  chars => '2',
+                                        justify => 'r',
+                                        title => 'Fin',
+                                        value => '$Ticket->FinalPriority',
+                                     },
+                   time_worked => { chars => '6',
+                                    justify => 'r',
+                                    title => 'Worked',
+                                    value => '$Ticket->TimeWorked',
+                                  },
+                   time_left => { chars => '5',
+                                  justify => 'r',
+                                  title => 'Left',
+                                  value => '$Ticket->TimeLeft',
+                              
+                                },
+               
+                   status => {  chars => '6',
+                                justify => 'r',
+                                title => 'Status',
+                                value => '$Ticket->Status',
+                             },
+                   owner => {  chars => '10',
+                               justify => 'r',
+                               title => 'Owner',
+                               value => '$Ticket->OwnerObj->Name'
+                            },
+                   requestor => {  chars => '10',
+                                   justify => 'r',
+                                   title => 'Requestor',
+                                   value => '$Ticket->RequestorsAsString'
+                                },
+                   created => {  chars => '12',
+                                 justify => 'r',
+                                 title => 'Created',
+                                 value => '$Ticket->CreatedAsString'
+                              },
+                   updated => {  chars => '12',
+                                 justify => 'r',
+                                 title => 'Updated',
+                                 value => '$Ticket->LastUpdatedAsString'
+                              },
+                   due => {  chars => '12',
+                             justify => 'r',
+                             title => 'Due',
+                             value => '$Ticket->DueAsString'
+                          },
+                   told => {  chars => '12',
+                              justify => 'r',
+                              title => 'Told',
+                              value => '$Ticket->ToldAsString'
+                           },
+               
+               
+               
+                 };
+
+    # }}}
+    
+
+    foreach $field (split ('%',$format_string)) {
+       
+       if ($field =~ /^(\D*?)(\d*?)$/) {
+           $id = $1;
+           $length = $2;
+       }
+       else {  
+           $RT::Logger->debug ("Error parsing $field\n");
+       }
+       if ($length) {
+           push (@format, "%".$length.".".$length."s ");
+           
+           push (@code,  $attribs->{"$id"}->{'value'});
+                 
+           push (@titles, "'". $attribs->{"$id"}->{title}. "'");
+       }
+       
+       
+    }
+     $code = join (',', @code);
+     $format = join (" ", @format);
+     $titles = join (', ', @titles);
+    
+  
+    return ($format, $titles, $code);
+}
+
+# }}}
+
+
+
+1;
diff --git a/rt/bin/rt-mailgate b/rt/bin/rt-mailgate
new file mode 100755 (executable)
index 0000000..e6f0d95
--- /dev/null
@@ -0,0 +1,367 @@
+#!!!PERL!! -w
+
+# $Header: /home/cvs/cvsroot/freeside/rt/bin/rt-mailgate,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
+
+
+package RT;
+use strict;
+use vars qw($VERSION $Handle $Nobody $SystemUser);
+
+$VERSION="!!RT_VERSION!!";
+
+
+use lib "!!RT_LIB_PATH!!";
+use lib "!!RT_ETC_PATH!!";
+
+use RT::Interface::Email  qw(CleanEnv LoadConfig DBConnect
+                            GetCurrentUser
+                            GetMessageContent
+                            CheckForLoops 
+                            CheckForSuspiciousSender
+                            CheckForAutoGenerated 
+                            ParseMIMEEntityFromSTDIN
+                            ParseTicketId 
+                            MailError 
+                            ParseCcAddressesFromHead
+                            ParseSenderAddressFromHead 
+                            ParseErrorsToAddressFromHead
+                           );
+
+#Clean out all the nasties from the environment
+CleanEnv();
+
+#Load etc/config.pm and drop privs
+LoadConfig();
+
+#Connect to the database and get RT::SystemUser and RT::Nobody loaded
+DBConnect();
+
+#Drop setgid permissions
+RT::DropSetGIDPermissions();
+
+use RT::Ticket;
+use RT::Queue;
+use MIME::Parser;
+use File::Temp;
+use Mail::Address;
+
+
+#Set some sensible defaults 
+my $Queue = 1;
+my $time = time;
+my $Action = "correspond";  
+
+my ($Verbose, $ReturnTid, $Debug);
+my ($From, $TicketId, $Subject,$SquelchReplies);
+
+# using --owner-from-extension, this will let you set ticket owner on create
+my $AssignTicketTo = undef;
+my ($status, $msg);
+
+# {{{ parse commandline 
+
+while (my $flag = shift @ARGV) {
+    if (($flag eq '-v') or ($flag eq '--verbose')) {
+       $Verbose = 1;
+    }
+    if (($flag eq '-t') or ($flag eq '--ticketid')) {
+       $ReturnTid = 1;
+    }
+    
+    if (($flag eq '-d') or ($flag eq '--debug')) {
+       $RT::Logger->debug("Debug mode enabled\n");
+       $Debug = 1;
+      }
+    
+    if (($flag eq '-q') or ($flag eq '--queue')) {
+       $Queue = shift @ARGV;
+    } 
+    if ($flag eq '--ticket-id-from-extension') {
+       $TicketId = $ENV{'EXTENSION'};
+    }
+    if ($flag eq '--queue-from-extension') {
+       $Queue = $ENV{'EXTENSION'};
+    }
+    if ($flag eq '--owner-from-extension') {
+        $AssignTicketTo = $ENV{'EXTENSION'};
+    }
+
+    if (($flag eq '-a') or ($flag eq '--action')) {
+         $Action = shift @ARGV;
+    } 
+    
+    
+}
+
+# }}}
+
+# get the current mime entity from stdin
+my ($entity, $head) = ParseMIMEEntityFromSTDIN();
+
+#Get someone to send runtime errors to;
+my $ErrorsTo = ParseErrorsToAddressFromHead($head);
+
+#Get us a current user object.
+my $CurrentUser = GetCurrentUser($head, $entity, $ErrorsTo);
+
+# We've already performed a warning and sent the mail off to somewhere safe ($RTOwner).
+#  this is _exceedingly_ unlikely but we don't want to keep going if we don't have a current user
+
+unless ($CurrentUser->Id) {
+       exit(1);
+}
+
+my $MessageId = $head->get('Message-Id') || 
+  "<no-message-id-".time.rand(2000)."\@.$RT::Organization>";
+
+#Pull apart the subject line
+$Subject = $head->get('Subject') || "[no subject]";
+chomp $Subject;
+
+# Get the ticket ID unless it's already set
+$TicketId = ParseTicketId($Subject) unless ($TicketId);
+
+#Set up a queue object
+my $QueueObj = RT::Queue->new($CurrentUser);
+$QueueObj->Load($Queue);
+unless ($QueueObj->id ) {
+
+  MailError(To => $RT::OwnerEmail,
+                  Subject => "RT Bounce: $Subject",
+                  Explanation => "RT couldn't find the queue: $Queue",
+                  MIMEObj => $entity);
+
+}
+
+# {{{ Lets check for mail loops of various sorts.
+
+my $IsAutoGenerated = CheckForAutoGenerated($head);
+
+my $IsSuspiciousSender = CheckForSuspiciousSender($head);
+
+my $IsALoop = CheckForLoops($head);
+
+
+#If the message is autogenerated, we need to know, so we can not 
+# send mail to the sender
+if ($IsSuspiciousSender || $IsAutoGenerated || $IsALoop) {
+    $SquelchReplies = 1;
+
+    $ErrorsTo = $RT::OwnerEmail;
+    
+    #TODO: Is what we want to do here really 
+    #  "Make the requestor cease to get mail from RT"?
+    # This might wreak havoc with vacation-mailing users.
+    # Maybe have a "disabled for bouncing" state that gets
+    # turned off when we get a legit incoming message
+
+}
+
+
+# {{{ Warn someone  if it's a loop
+
+# Warn someone if it's a loop, before we drop it on the ground
+if ($IsALoop) {
+    $RT::Logger->crit("RT Received mail ($MessageId) from itself.");
+    
+    #Should we mail it to RTOwner?
+    if ($RT::LoopsToRTOwner) {
+       MailError(To => $RT::OwnerEmail,
+                 Subject => "RT Bounce: $Subject",
+                 Explanation => "RT thinks this message may be a bounce",
+                 MIMEObj => $entity);
+       
+       #Do we actually want to store it?
+       exit unless ($RT::StoreLoops);
+    }
+}
+
+# }}}
+
+
+   #Don't let the user stuff the RT-Squelch-Replies-To header.
+    if ($head->get('RT-Squelch-Replies-To')) {
+        $head->add('RT-Relocated-Squelch-Replies-To',
+                   $head->get('RT-Squelch-Replies-To'));
+        $head->delete('RT-Squelch-Replies-To')
+    }
+
+
+if ($SquelchReplies) {
+    ## TODO: This is a hack.  It should be some other way to
+    ## indicate that the transaction should be "silent".
+
+    my ($Sender, $junk) = ParseSenderAddressFromHead($head);
+    $head->add('RT-Squelch-Replies-To', $Sender);
+}
+
+# }}}
+
+
+# {{{ If we require that the sender be found in an external DB and they're not
+# forward this message to RTOwner
+
+
+
+if ($RT::LookupSenderInExternalDatabase && 
+    $RT::SenderMustExistInExternalDatabase )  {
+
+    MailError(To => $RT::OwnerEmail,
+             Subject => "RT Bounce: $Subject",
+             Explanation => "RT couldn't find requestor via its external database lookup",
+             MIMEObj => $entity);
+    
+}
+
+# }}}
+
+# {{{ elsif we don't have a ticket Id, we're creating a new ticket
+
+
+
+elsif (!defined($TicketId)) {
+    
+    # {{{ Create a new ticket
+    if ($Action =~ /correspond/) {
+       
+       #    open a new ticket 
+       my @Requestors = ($CurrentUser->id);
+       
+       my @Cc;
+       if ($RT::ParseNewMessageForTicketCcs) {
+               @Cc = ParseCcAddressesFromHead(Head => $head, 
+                                       CurrentUser => $CurrentUser,
+                                       QueueObj => $QueueObj );
+       }
+
+       my $Ticket = new RT::Ticket($CurrentUser);
+       my ($id, $Transaction, $ErrStr) = 
+         $Ticket->Create ( Queue => $Queue,
+                           Subject => $Subject,
+                            Owner => $AssignTicketTo,
+                           Requestor => \@Requestors,
+                           Cc => \@Cc,
+                           MIMEObj => $entity
+                         );
+       if ($id == 0 ) {
+           MailError( To => $ErrorsTo,
+                      Subject => "Ticket creation failed",
+                      Explanation => $ErrStr,
+                      MIMEObj => $entity
+                    );
+           $RT::Logger->error("Create failed: $id / $Transaction / $ErrStr ");
+       }       
+    }
+
+    # }}}
+    
+    else {
+       #TODO Return an error message
+       MailError( To => $ErrorsTo,
+                  Subject => "No ticket id specified",
+                  Explanation => "$Action aliases require a TicketId to work on",
+                  MIMEObj => $entity
+                );
+       
+       $RT::Logger->crit("$Action aliases require a TicketId to work on ".
+                         "(from ".$CurrentUser->UserObj->EmailAddress.") ".
+                         $MessageId);
+    }
+}
+
+# }}}
+
+# {{{ If we've got a ticket ID, update the ticket
+
+else {
+    
+    #   If the action is comment, add a comment.
+    if ($Action =~ /comment/i){
+       
+       my $Ticket = new RT::Ticket($CurrentUser);
+       $Ticket->Load($TicketId);
+       unless ($Ticket->Id) {
+           MailError( To => $ErrorsTo,
+                      Subject => "Comment not recorded",
+                      Explanation => "Could not find a ticket with id $TicketId",
+                      MIMEObj => $entity
+                    );
+           #Return an error message saying that Ticket "#foo" wasn't found.
+       }
+       
+       ($status, $msg) = $Ticket->Comment(MIMEObj=>$entity);
+       unless ($status) {
+           #Warn the sender that we couldn't actually submit the comment.
+           MailError( To => $ErrorsTo,
+                      Subject => "Comment not recorded",
+                      Explanation => $msg,
+                      MIMEObj => $entity
+                    );
+       }       
+    }
+
+    # If the message is correspondence, add it to the ticket
+    elsif ($Action =~ /correspond/i) {
+       my $Ticket = RT::Ticket->new($CurrentUser);
+       $Ticket->Load($TicketId);
+       
+       #TODO: Check for error conditions
+       ($status, $msg) = $Ticket->Correspond(MIMEObj => $entity);
+       unless ($status) {
+
+           #Return mail to the sender with an error
+           MailError( To => $ErrorsTo,
+                      Subject => "Correspondence not recorded",
+                      Explanation => $msg,
+                      MIMEObj => $entity
+                    );
+       }
+    }
+
+    else {
+       #Return mail to the sender with an error
+           MailError( To => $ErrorsTo,
+                      Subject => "RT Configuration error",
+                      Explanation => "'$Action' not a recognized action.".
+                                     " Your RT administrator has misconfigured ".
+                                     "the mail aliases which invoke RT" ,
+                      MIMEObj => $entity
+                    );
+
+       $RT::Logger->crit("$Action type unknown for $MessageId");
+       
+    }
+    
+}
+
+# }}}
+
+$RT::Handle->Disconnect();
+
+
+# Everything below this line is a helper sub. most of them will eventually
+# move to Interface::Email
+
+#When we call die, trap it and log->crit with the value of the die.
+$SIG{__DIE__}  = sub {
+    unless ($^S || !defined $^S ) {
+        $RT::Logger->crit("$_[0]");
+       MailError( To => $ErrorsTo,  
+                  Bcc => $RT::OwnerEmail,
+                  Subject => "RT Critical error. Message not recorded!",
+                  Explanation => "$_[0]",
+                  MIMEObj => $entity
+                );
+       exit(-1);
+    }
+    else {
+        #Get out of here if we're in an eval
+        die $_[0];
+    }
+};
+
+
+
+1;
diff --git a/rt/bin/rtadmin b/rt/bin/rtadmin
new file mode 100644 (file)
index 0000000..25ba1b0
--- /dev/null
@@ -0,0 +1,1040 @@
+#!!!PERL!! -w
+#
+# $Header: /home/cvs/cvsroot/freeside/rt/bin/Attic/rtadmin,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# RT is (c) 1996-2001 Jesse Vincent <jesse@fsck.com>
+
+use strict;
+use Carp;
+use Getopt::Long qw(:config pass_through);
+
+use lib "!!RT_LIB_PATH!!";
+use lib "!!RT_ETC_PATH!!";
+
+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();
+
+#Connect to the database and get RT::SystemUser and RT::Nobody loaded
+DBConnect();
+
+#Drop setgid permissions
+RT::DropSetGIDPermissions();
+
+#Get the current user all loaded
+my $CurrentUser = GetCurrentUser();
+
+unless ($CurrentUser->Id) {
+        print "No RT user found. Please consult your RT administrator.\n";   
+        exit(1);
+}
+
+
+
+
+PickMode();
+
+
+# {{{ Help
+
+sub Help {
+
+    # {{{ help_acl
+my $help_acl ="
+        Access control
+       --grant-right <right> 
+       --revoke-right <right>
+         --userid <user>
+          --groupid <group>
+       --list-rights";
+
+# }}}
+    
+    # {{{ help_keyword_sel
+my $help_keyword_sel = "
+       Keyword Selections
+       --add-keyword-select
+       --modify-keyword-select <name>
+          --ks-name <name>
+          --ks-keyword <keyword>
+          --ks-single 
+          --ks-multiple
+          --ks-depth  <int>
+
+        --disable-keyword-select <name>";
+# }}}
+    
+    # {{{ help_scrip
+my $help_scrip = "
+        Scrips
+        --create-scrip
+           --scrip-condition <condition name or id>
+           --scrip-action <action name or id>
+           --scrip-template <template name or id>
+
+        --delete-scrip <id>
+       --list-scrips";
+
+# }}}
+    
+    # {{{ help_template  
+my $help_template = "      
+        Templates
+        --delete-template [<id>|<name>]
+        --display-template [<id>|<name>]
+
+         --create-template
+         --modify-template [<id>|<name>]
+           Flags for --create-template and --modify-template
+           --template-name
+           --template-description
+           --template-edit-content
+         
+         --list-templates";
+
+# }}}
+    
+    
+print <<EOF;
+
+USAGE:  rtadmin --user <userid> [Userflags]
+       rtadmin --list-users
+       rtadmin --queue <queueid> [Queueflags]
+       rtadmin --list-queues
+       rtadmin --group [groupflags]
+       rtadmin --list-groups
+       rtadmin --system  [SystemFlags]
+       rtadmin --keyword [keywordflags]
+
+User configuration for --user <userid>
+   
+       --disable
+       --create
+       --display
+
+  Core Attributes
+       --userid
+       --gecos
+       --password
+       --emailaddress
+       --privileged
+       --comments
+       --signature
+       --organization
+
+  Names        
+       --realname
+       --nickname
+       
+  Auth and external info
+       --externalcontactinfoid
+       --contactinfosystem
+       --externalauthid
+       --authsystem
+
+  Phone numbers
+       --pagerphone
+       --workphone
+       --mobilemphone
+       --homephone
+
+  Paper address
+       --address1
+       --address2
+       --city
+       --state
+       --zip
+       --country
+       --freeformcontactqinfo  
+
+
+Group Configuration for --group <groupid>
+       --create 
+       --delete
+       --display
+
+       --name <new name>
+       --description <new description>
+
+
+
+       --add-member <userid>
+       --delete-member <userid>
+       --list-members  
+
+Queue Configuration for --queue <queueid>
+       --create
+       --disable
+       --display
+
+       --name <name>
+       --correspondaddress <email address>
+       --commentaddress <email address>
+       --initialpriority <int>
+       --finalpriority <int>
+       --defaultduein <days>
+
+       --add-cc <email address>
+       --delete-cc <email address>
+       --add-admincc <email address>
+       --delete-admincc <email address>
+        --list-watchers
+
+       
+
+$help_acl
+
+$help_keyword_sel
+
+$help_template
+
+$help_scrip
+
+
+System configuration for --system 
+
+$help_acl
+
+$help_keyword_sel
+
+$help_template
+
+$help_scrip
+
+
+Keyword configuration for --keyword  <fully qualified name>
+       --list-children
+       --create-child <name>
+       --disable
+       --name <new name>
+       --description <new description>
+
+EOF
+
+
+
+}
+
+# }}}
+
+# {{{ PickMode
+
+sub PickMode {
+    my ($user,$group, $queue, $system, $keyword, $listusers, 
+       $listgroups, $listqueues, $help);
+
+
+    GetOptions ('help|h|usage' => \$help,
+               'user=s' => \$user,
+               'queue=s' => \$queue,
+               'group=s' => \$group,
+               'system' => \$system,
+               'keyword=s', => \$keyword,
+               'list-users' => \$listusers,
+               'list-queues' => \$listqueues,
+               'list-groups' => \$listgroups,
+              );
+    
+
+    
+    if ($user)          { AdminUser($user) }  
+    elsif ($group)      { AdminGroup($group) }
+    elsif ($queue)      { AdminQueue($queue) }
+    elsif ($system)     { AdminSystem($system) }
+    elsif ($keyword)    { AdminKeywords($keyword) }
+    elsif ($listusers)  { ListUsers() }
+    elsif ($listgroups) { ListGroups()  }
+    elsif ($listqueues) { ListQueues() }
+    elsif ($help)       { Help()}
+    else {
+       print "No command found\n";
+    }
+    exit(0);
+}      
+
+# }}}
+
+# {{{ AdminUser
+
+sub AdminUser {
+    my $user=shift;
+    my %args;
+
+    GetOptions(\%args,
+          'create', 'disable|delete', 'display',
+          'Name=s', 'Gecos=s', 'Password=s',
+          'EmailAddress=s', 'Privileged=s', 'Comments=s', 'Signature=s',
+          'Organization=s', 'RealName=s', 'NickName=s',  
+          'ExternalContactInfoId=s', 'ContactInfoSystem=s', 
+           'ExternalAuthId=s', 'AuthSystem=s',
+          'HomePhone=s', 'WorkPhone=s', 'MobilePhone=s', 'PagerPhone=s',
+           'Address1=s', 'Address2=s', 'City=s', 'State=s', 'Zip=s', 
+           'Country=s', 'FreeformContactInfo=s');
+
+    my $user_obj = new RT::User($CurrentUser);
+    
+    #Create the user if we need to 
+    if ($args{'create'}) {
+       my ($status, $msg) = 
+         $user_obj->Create( Name => ($args{'Name'} || $user),
+                            Gecos => $args{'Gecos'},
+                            Password => $args{'Password'},
+                            EmailAddress => $args{'EmailAddress'},
+                            Privileged => $args{'Privileged'},
+                            Comments => $args{'Comments'},
+                            Signature => $args{'Signature'},
+                            Organization => $args{'Organization'},
+                            RealName => $args{'RealName'},
+                            NickName => $args{'NickName'},
+                            ExternalContactInfoId => $args{'ExternalContactInfoId'},
+                            ContactInfoSystem => $args{'ContactInfoSystem'},
+                            ExternalAuthId => $args{'ExternalAuthId'},
+                            AuthSystem => $args{'AuthSystem'},
+                            HomePhone => $args{'HomePhone'},
+                            WorkPhone => $args{'WorkPhone'},
+                            MobilePhone => $args{'MobilePhone'},
+                            PagerPhone => $args{'PagerPhone'},
+                            Address1 => $args{'Address1'},
+                            Address2 => $args{'Address2'},
+                            City  => $args{'City'},
+                            State => $args{'State'},
+                            Zip => $args{'Zip'},
+                            FreeformContactInfo => $args{'FreeformContactInfo'}
+                          );
+       
+       print "$msg\n";
+       return();
+       
+    }
+    else {
+       
+       
+       #Load the user
+       $user_obj->Load($user);
+       
+       unless ($user_obj->id) {
+           print "User '$user' not found\n";
+           return();
+       }       
+       
+       
+       
+       #modify the user if we need to
+       my @attributes = ('Name', 'Gecos',
+                         'EmailAddress', 'Privileged', 'Comments', 'Signature',
+                         'Organization', 'RealName', 'NickName',  
+                         'ExternalContactInfoId', 'ContactInfoSystem', 
+                         'ExternalAuthId', 'AuthSystem',
+                         'HomePhone', 'WorkPhone', 'MobilePhone', 'PagerPhone',
+                         'Address1', 'Address2', 'City', 'State', 'Zip', 
+                         'Country', 'FreeformContactInfo');
+       foreach my $attrib (@attributes) {
+           if ( (exists ($args{"$attrib"})) and
+                ($user_obj->$attrib() ne $args{"$attrib"})) {
+               
+               my $method = "Set$attrib";
+               my ($val, $msg) = $user_obj->$method($args{"$attrib"});
+               print "User ".$user_obj->Name. " $attrib:  $msg\n";
+               
+           }
+       }               
+       
+       if (exists ($args{'Password'})) {
+           my ($code, $msg);
+           ($code, $msg) = $user_obj->SetPassword($args{'Password'});
+           print "User ". $user_obj->Name. ' Password: '. $msg . "\n";
+       }
+       
+       #Check if we need to display the user
+       if ($args{'display'}) {
+           foreach my $attrib (@attributes) {
+               next if ($attrib eq 'Password'); #Can't see the password
+               printf("%22.22s %-64s\n",$attrib, ($user_obj->$attrib()||'(undefined)'));
+               
+           }   
+       }       
+       
+       #Check if we need to delete the user
+       if ($args{'disable'}) {
+           my ($val, $msg) = $user_obj->SetDisabled(1);
+           print "$msg\n";
+       }       
+       
+    }
+}
+
+# }}}
+
+# {{{ AdminQueue
+
+sub AdminQueue {
+    my $queue=shift;
+    my %args;
+
+    GetOptions(\%args,
+              'create', 'disable|delete', 'display',
+              'Name=s', 'CorrespondAddress=s', 'Description=s',
+              'CommentAddress=s', 'InitialPriority=n', 'FinalPriority=n',
+              'DefaultDueIn=n',
+              
+              'add-cc=s@', 'add-admincc=s@', 
+              'delete-cc=s@', 'delete-admincc=s@',
+              'list-watchers', 'create-template'
+              );
+
+    use RT::Queue;
+    my $queue_obj = new RT::Queue($CurrentUser);
+    
+    #Create the queue if we need to 
+    if ($args{'create'}) {
+       my ($status, $msg) = 
+         $queue_obj->Create(
+                            Name => ($args{'Name'} || $queue) ,
+                            CorrespondAddress => $args{'CorrespondAddress'},
+                            Description => $args{'Description'},
+                            CommentAddress  => $args{'CommentAddress'},
+                            InitialPriority => $args{'InitialPriority'},
+                            FinalPriority => $args{'FinalPriority'},
+                            DefaultDueIn => $args{'DefaultDueIn'}
+                           );
+       
+       print "$msg\n";
+    }
+    else {
+       #Load the queue
+       $queue_obj->Load($queue);
+       
+       unless ($queue_obj->id) {
+           print "Queue '$queue' not found\n";
+           return();
+       }       
+               
+        #modify if we need to
+       my @attributes = qw(Name CorrespondAddress Description
+                           CommentAddress InitialPriority FinalPriority
+                           DefaultDueIn
+                        );
+       foreach my $attrib (@attributes) {
+           if ( (exists ($args{"$attrib"})) and
+                ($queue_obj->$attrib() ne $args{"$attrib"})) {
+               
+               my $method = "Set$attrib";
+               my ($val, $msg) = $queue_obj->$method($args{"$attrib"});
+               print "Queue ".$queue_obj->Name. " $attrib:  $msg\n";
+               
+           }
+       }               
+           
+       
+       #Check if we need to display the queue
+       if ($args{'display'}) {
+           foreach my $attrib (@attributes) {
+               printf("%22.22s %-64s\n",$attrib, ($queue_obj->$attrib()||'(undefined)'));
+               
+           }   
+       }       
+               
+       foreach my $person (@{$args{'add-cc'}}) {
+           my ($val, $msg) = $queue_obj->AddCc(Email => $person);
+           print "$msg\n";
+       }
+       foreach my $person (@{$args{'add-admincc'}}) {
+           my ($val, $msg) = $queue_obj->AddAdminCc(Email => $person);
+           print "$msg\n";
+       }
+
+       foreach my $person (@{$args{'delete-cc'}}) {
+           my ($val, $msg) = $queue_obj->DeleteCc($person);
+           print "$msg\n";
+       }
+       foreach my $person (@{$args{'delete-admincc'}}) {
+           my ($val, $msg) = $queue_obj->DeleteAdminCc($person);
+           print "$msg\n";
+       }
+
+       if ($args{'list-watchers'}) {
+           require RT::Watchers;
+           my $watchers = new RT::Watchers($CurrentUser);
+           $watchers->LimitToQueue($queue_obj->id);
+           while (my $watcher = $watchers->Next()) {
+               printf("%10s %-60s\n",
+                      $watcher->Type, $watcher->Email );
+           }   
+       }       
+
+        AdminTemplates($queue_obj->Id());
+        AdminScrips($queue_obj->Id());
+       AdminRights($queue_obj->Id());
+       AdminKeywordSelects($queue_obj->Id());
+
+       #Check if we need to delete the queue
+       if ($args{'disable'}) {
+           my ($val, $msg) = $queue_obj->SetDisabled(1);
+           print "$msg\n";
+       }       
+       
+    }
+}
+
+# }}}
+
+# {{{ AdminKeywords
+
+sub AdminKeywords {
+    my $keyword = shift;
+    
+    my %args;
+    GetOptions(\%args, 'list-children', 'create-child=s', 'disable|delete', 'Name=s', 'Description=s');
+    
+    use RT::Keyword;
+    
+    my $key_obj = new RT::Keyword($CurrentUser);
+    my $key_id;
+    
+    #If we're dealing with the root of the keyword list
+    if ($keyword eq '/') {
+       $key_id=0;
+    }  
+    else {
+       my ($val, $msg) = $key_obj->LoadByPath( $keyword );
+       unless ($val) {
+           print $msg ."\n";
+       }
+       $key_id = $key_obj->Id();
+    }  
+    
+    if ($args{'create-child'}) {
+       my $child = new RT::Keyword($CurrentUser);
+       
+       my ($val, $msg) = $child->Create( Parent => $key_id,
+                                         Name => $args{'create-child'},
+                                       );
+       print $msg ."\n";
+    }  
+    
+    elsif ($args{'list-children'}) {
+       my $keywords;
+       if ($key_obj->id) {
+           $keywords = $key_obj->Children();
+       }       
+       #If we didn't actually have a keyword object, we need to create our own Keywords object.
+       else {
+           $keywords = new RT::Keywords($CurrentUser);
+           $keywords->LimitToParent(0); 
+       }
+       
+       while (my $key=$keywords->Next) {
+           print $key->Name;
+           if ($key->Description) {
+               print " (" . $key->Description .")";
+           }   
+           print "\n";
+       }       
+             
+
+    }  
+    
+    #Else we wanna do some modification.
+    else {
+       
+       #If we didn't load a keyword, get out
+       return(undef) unless ($key_obj->Id);
+       
+       
+       my @attributes = qw( Name Description );
+       foreach my $attrib (@attributes) {
+           if ( (exists ($args{"$attrib"})) and
+                ($key_obj->$attrib() ne $args{"$attrib"})) {
+               
+               my $method = "Set$attrib";
+               my ($val, $msg) = $key_obj->$method($args{"$attrib"});
+               
+               print "Keyword ".$key_obj->Name. " $attrib:  $msg\n";       }
+       }
+       
+       if ($args{'disable'}) {
+           $key_obj->SetDisabled(1);
+           
+       }
+       
+    }
+}
+
+# }}}
+
+# {{{ AdminKeywordSelects
+
+sub AdminKeywordSelects {
+    my $queue = shift;
+    # O for queue means global
+
+    my %args;
+    GetOptions(\%args, 'add-keyword-select','disable-keyword-select|delete-keyword-select=s',
+              'modify-keyword-select=s', 
+              'keyword-select-Keyword|ks-keyword=s', 
+              'keyword-select-Single|ks-single', 
+              'keyword-select-Multiple|ks-multiple', 
+              'keyword-select-Depth|ks-depth=i', 
+              'keyword-select-Name|ks-name=s'
+             );
+
+    # sanitize single vs multiple.
+    if ($args{'keyword-select-Multiple'}) {
+       $args{'keyword-select-Single'} = 0;
+    }
+    
+    use RT::KeywordSelect;
+    my $keysel_obj = new RT::KeywordSelect($CurrentUser);
+    if ($args{'add-keyword-select'}) {
+       
+       my ($val, $msg) = $keysel_obj->Create( Keyword => $args{'keyword-select-Keyword'},
+                                              Depth => $args{'keyword-select-Depth'},
+                                              Single => $args{'keyword-select-Single'},
+                                              Name => $args{'keyword-select-Name'},
+                                              ObjectType => 'Ticket',
+                                              ObjectField => 'Queue',
+                                              ObjectValue => $queue);
+       print $msg ."\n";
+    }  
+    elsif ($args{'modify-keyword-select'}) {
+       $keysel_obj->LoadByName(Name => $args{'modify-keyword-select'},
+                               Queue => $queue
+                              );
+       
+       unless ($keysel_obj->Id()) {
+           print "Keyword select not found\n";
+           return();
+       }       
+       my @attributes = qw( Name Keyword Single Depth );
+       foreach my $attrib (@attributes) {
+           if ( (exists ($args{"keyword-select-$attrib"})) and
+                ($keysel_obj->$attrib() ne $args{"keyword-select-$attrib"})) {
+               
+               my $method = "Set$attrib";
+               my ($val, $msg) = $keysel_obj->$method($args{"keyword-select-$attrib"});
+                               
+               print "Keyword select ".$keysel_obj->Name. " $attrib:  $msg\n";     }
+       }
+
+
+    }  
+
+    
+    elsif ($args{'disable-keyword-select'}) {
+       $keysel_obj->LoadByName(Name => $args{'disable-keyword-select'},
+                               Queue => $queue);
+       
+       $keysel_obj->SetDisabled(1);
+       
+    }
+}
+
+# }}}
+
+# {{{ AdminGroup
+
+sub AdminGroup {
+    my $group = shift;
+
+    my (%args);
+
+    GetOptions(\%args,
+              'create', 'delete', 'display',
+              'Name=s', 'Description=s',
+                      
+              'add-member=s@', 'delete-member=s@',
+              'list-members'
+              );
+
+
+    use RT::Group;
+    my $group_obj = new RT::Group($CurrentUser);
+    unless ($group) {
+       print "Group not specified.\n";
+       return();
+    }  
+    
+
+    #Create the group if we need to
+    if ($args{'create'}) {
+       my ($val, $msg) = $group_obj->Create( Name => ($args{'Name'} || $group),
+                                             Description => $args{'Description'} );
+       print $msg ."\n";
+    }  
+    #otherwise we load it
+    else {
+       $group_obj->Load($group);
+    }  
+    
+    #If we have no group object, get the hell out
+    unless ($group_obj->Id) {
+       print "Group not found.\n";
+    }
+
+    if ($args{'delete'}) {
+       my ($val, $msg) = $group_obj->Delete();
+       print $msg ."\n";
+       return();
+    }  
+
+
+    
+    #modify if we need to
+    my @attributes = qw(Name Description
+                       
+                      );
+    foreach my $attrib (@attributes) {
+       if ( (exists ($args{"$attrib"})) and
+            ($group_obj->$attrib() ne $args{"$attrib"})) {
+               
+           my $method = "Set$attrib";
+           my ($val, $msg) = $group_obj->$method($args{"$attrib"});
+           print "Group ".$group_obj->Name. " $attrib:  $msg\n";
+           
+           }
+    }          
+    
+    foreach my $user (@{$args{'add-member'}}) {
+       my ($val, $msg) = $group_obj->AddMember($user);
+       print $msg. "\n";
+    }
+    foreach my $user (@{$args{'delete-member'}}) {
+       my ($val, $msg) = $group_obj->DeleteMember($user);
+       print $msg ."\n";
+    }
+    
+    if ($args{'list-members'}) {
+       my $members = $group_obj->MembersObj();
+       while (my $member = $members->Next()) {
+           print $member->UserObj->Name() ."\n";
+       }
+    }  
+    
+}
+
+# }}}
+
+# {{{ AdminSystem
+sub AdminSystem {
+    print "In AdminSystem\n";
+
+    AdminTemplates(0);
+    AdminScrips(0);
+    AdminRights(0);
+    AdminKeywordSelects(0);
+}
+# }}}
+
+# {{{ sub AdminTemplates
+
+sub AdminTemplates {
+    my $queue = shift;
+    #Queue = 0 means 'global';
+
+    my %args;
+
+    
+    GetOptions(\%args, 'list-templates', 'create-template','modify-template=s',
+              'delete-template=s', 'display-template=s',
+              'template-Name=s', 'template-Description=s',
+              'template-edit-content!');
+    
+    # {{{ List templates
+    if ($args{'list-templates'}) {
+       print "Templates for $queue\n";
+       require RT::Templates;
+       my $templates = new RT::Templates($CurrentUser);
+       if ($queue != 0) {
+           $templates->LimitToQueue($queue);
+       }       
+       else {
+           $templates->LimitToGlobal();
+       }       
+       while (my $template = $templates->Next) {
+           print $template->Id.": ".$template->Name." - " . $template->Description ."\n";
+       }       
+    }
+
+    # }}}
+
+    require RT::Template;      
+    my $template = new RT::Template($CurrentUser);
+    if ($args{'delete-template'}) {
+       $template->Load($args{'delete-template'});
+       unless ($template->id) {
+           print "Couldn't load template";
+           return(undef);
+       }
+       my ($val, $msg) = $template->Delete();
+       print "$msg\n";
+    }
+    elsif ($args{'create-template'}) {
+       #TODO edit the template content
+       my $content;
+
+       my $linesref = GetMessageContent(CurrentUser => $CurrentUser,
+                                     Edit => 1);
+       
+       $content = join("\n", @{$linesref});
+       
+
+       my ($val, $msg) = $template->Create(Name => $args{'template-Name'},
+                                           Description => $args{'template-Description'},
+                                           Content => $content,
+                                           Queue => $queue);
+       print "$msg\n";
+    }  
+    elsif ($args{'modify-template'}) {
+       
+       $template->Load($args{'modify-template'});
+       unless ($template->Id()) {
+           print "Template not found\n";
+           return();
+       }       
+       my @attributes = qw( Name Description );
+       foreach my $attrib (@attributes) {
+           if ( (exists ($args{"template-$attrib"})) and
+                ($template->$attrib() ne $args{"template-$attrib"})) {
+               
+               my $method = "Set$attrib";
+               my $val = $template->$method($args{"template-$attrib"});
+                               
+           }
+       }
+       if ($args{'template-edit-content'}) {
+           
+           my $linesref = GetMessageContent(CurrentUser => $CurrentUser,
+                                            Content => $template->Content,
+                                            Edit => 1);
+           
+           my $content = join("\n", @{$linesref});         
+           my ($val) = $template->SetContent($content);
+           print $val."\n";
+       }       
+
+    }  
+    if ($args{'display-template'}) {
+       $template->Load($args{'display-template'});
+       print $template->Name . "\n". $template->Description ."\n". $template->Content."\n";
+    }  
+}      
+
+# }}}
+
+# {{{ sub AdminScrips
+
+sub AdminScrips {
+    my $queue = shift;
+    #Queue = 0 means 'global';
+
+    my %args;
+
+    
+    GetOptions(\%args, 'list-scrips', 'create-scrip','modify-scrip=s',
+              'scrip-action=s', 'scrip-template=s', 'scrip-condition=s',
+              'delete-scrip=s');
+
+    
+    # {{{ List entries
+    if ($args{'list-scrips'}) {
+       print "Scrips for $queue\n";
+       require RT::Scrips;
+       my $scrips = new RT::Scrips($CurrentUser);
+       if ($queue != 0) {
+           $scrips->LimitToQueue($queue);
+       }       
+       else {
+           $scrips->LimitToGlobal();
+       }       
+       while (my $scrip = $scrips->Next) {
+           print $scrip->Id.": If ".
+             $scrip->ConditionObj->Name." then " .
+               $scrip->ActionObj->Name." with template " .
+                 $scrip->TemplateObj->Name."\n";
+       }       
+    }
+
+    # }}}
+
+    require RT::Scrip;
+    my $scrip = new RT::Scrip($CurrentUser);
+    if ($args{'delete-scrip'}) {
+       $scrip->Load($args{'delete-scrip'});
+       unless ($scrip->id) {
+           print "Couldn't load scrip";
+             return(undef);
+       }
+       my ($val, $msg) = $scrip->Delete();
+       print "$msg\n";
+    }
+    elsif ($args{'create-scrip'}) {
+       my ($val, $msg) = $scrip->Create( ScripAction => $args{'scrip-action'},
+                                         ScripCondition => $args{'scrip-condition'},
+                                         Template => $args{'scrip-template'},
+                                         Queue => $queue);
+
+       print "$msg\n";
+    }  
+}      
+
+# }}}
+
+# {{{ sub AdminRights
+
+sub AdminRights {
+    my $queue = shift;
+    #Queue = 0 means 'global';
+
+    my ($scope, $appliesto);
+    if ($queue == 0) {
+       $scope = 'System';
+       $appliesto = 0;
+    }  
+    else {
+       $scope =  'Queue';
+       $appliesto = $queue;
+    }  
+
+    my %args;    
+    GetOptions(\%args, 
+              'grant-right|add-right|new-right|create-right=s@',
+              'revoke-right|del-right|delete-right=s@',
+              'list-rights', 'userid=s@', 'groupid=s@',
+             );
+    
+    
+    # {{{ List entries
+    if ($args{'list-rights'}) {
+       require RT::ACL;
+       my $acl = new RT::ACL($CurrentUser);
+       if ($queue != 0) {
+           $acl->LimitToQueue($queue);
+       }       
+       else {
+           $acl->LimitToSystem();
+       }       
+       while (my $ace = $acl->Next) {
+           print $ace->RightScope;
+           
+           #Print the queue name if we have it.
+           print " " . $ace->AppliesToObj->Name if (defined $ace->AppliesToObj);
+           
+           print ": ". $ace->PrincipalType . " " .$ace->PrincipalObj->Name .
+             " has right " . $ace->RightName ."\n";
+             
+       }       
+    }
+
+    # }}}
+
+    require RT::ACE;    
+
+    # {{{ Build up an array of principals
+    my (@principals);
+    my $i = 0;
+    foreach my $group (@{$args{'groupid'}}) { 
+
+
+       my $princ = new RT::Group($CurrentUser);
+       $princ->Load("$group");
+       if ($princ->id) {
+           $principals[$i]->{'type'} = 'Group';
+           $principals[$i]->{'id'} = $princ->id();
+           $i++;
+       }       
+       else {
+           print "Could not find group $group\n";
+       }       
+    }  
+
+
+    foreach my $user (@{$args{'userid'}}) { 
+       my $princ = new RT::User($CurrentUser);
+       $princ->Load("$user");
+       if ($princ->id) {
+           $principals[$i]->{'type'} = 'User';
+           $principals[$i]->{'id'} = $princ->id();
+           $i++;
+       }       
+       else {
+           print "Could not find user $user.\n";
+           }
+    }
+    # }}}
+
+
+    foreach my $principal (@principals) {
+
+       # {{{ Delete rights that need deleting
+       foreach my $right (@{$args{'revoke-right'}}) {
+           my $ace = new RT::ACE($CurrentUser);
+           $RT::Logger->debug("Trying to delete a right: $right \n");
+           my ($val, $msg) = $ace->LoadByValues( RightName => $right,
+                                                 RightScope => $scope,
+                                                 PrincipalType => $principal->{'type'},
+                                                 PrincipalId => $principal->{'id'},
+                                                 RightAppliesTo => $appliesto);
+           
+           unless ($val) {
+               print "Right $right not found for" . $principal->{'type'} . " " .
+                 $principal->{'id'} . " in scope $scope ($appliesto)\n";
+               next;
+           }   
+           my ($delval, $delmsg) =$ace->Delete;
+           print "$delmsg\n";
+           
+           
+       }
+
+       # }}}
+       
+       # {{{ grant rights that need granting
+       foreach my $right (@{$args{'grant-right'}}) {
+           my $ace = new RT::ACE($CurrentUser);
+           my ($val, $msg) = $ace->Create(RightName => $right,
+                                          PrincipalType => $principal->{'type'},
+                                          PrincipalId => $principal->{'id'},
+                                          RightScope => $scope,
+                                          RightAppliesTo => $appliesto);
+           
+           print $msg . "\n";
+       }
+
+       # }}}
+    }  
+
+}
+
+# }}}
+
+
+sub ListUsers {
+    require RT::Users;
+    my $users = new RT::Users($CurrentUser);
+    $users->UnLimit();
+    while (my $user = $users->Next()) {
+       printf ("%16s %-16s\n",$user->Name(), $user->EmailAddress());
+    }
+}
+sub ListQueues {
+    require RT::Queues;
+    my $queues = new RT::Queues($CurrentUser);
+    $queues->UnLimit();
+    while (my $queue = $queues->Next()) {
+       printf ("%16s %-16s\n",$queue->Name(), $queue->Description());
+    }
+}
+
+sub ListGroups {
+    require RT::Groups;
+    my $groups = new RT::Groups($CurrentUser);
+    $groups->UnLimit();
+    while (my $group = $groups->Next()) {
+       printf ("%16s %-16s\n",$group->Name(), $group->Description());
+    }  
+}
diff --git a/rt/bin/webmux.pl b/rt/bin/webmux.pl
new file mode 100755 (executable)
index 0000000..6e1ae06
--- /dev/null
@@ -0,0 +1,177 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/bin/Attic/webmux.pl,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# RT is (c) 1996-2000 Jesse Vincent (jesse@fsck.com);
+
+use strict;
+$ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
+$ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
+$ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
+$ENV{'ENV'} = '' if defined $ENV{'ENV'};
+$ENV{'IFS'} = ''          if defined $ENV{'IFS'};
+
+
+# We really don't want apache to try to eat all vm
+# see http://perl.apache.org/guide/control.html#Preventing_mod_perl_Processes_Fr
+
+
+package RT::Mason;
+
+use CGI qw(-private_tempfiles); #bring this in before mason, to make sure we
+                               #set private_tempfiles
+use HTML::Mason::ApacheHandler (args_method => 'CGI');
+use HTML::Mason;  # brings in subpackages: Parser, Interp, etc.
+
+use vars qw($VERSION %session $Nobody $SystemUser $r $m);
+
+# List of modules that you want to use from components (see Admin
+# manual for details)
+
+#Clean up our umask...so that the session files aren't world readable, writable or executable
+umask(0077);
+
+
+         
+$VERSION="!!RT_VERSION!!";
+
+use lib "!!RT_LIB_PATH!!";
+use lib "!!RT_ETC_PATH!!";
+
+#This drags in  RT's config.pm
+use config;
+use Carp;
+
+{  
+           package HTML::Mason::Commands;
+           use vars qw(%session $m);
+         
+           use RT; 
+           use RT::Ticket;
+           use RT::Tickets;
+           use RT::Transaction;
+           use RT::Transactions;
+           use RT::User;
+           use RT::Users;
+           use RT::CurrentUser;
+           use RT::Template;
+           use RT::Templates;
+           use RT::Queue;
+           use RT::Queues;
+           use RT::ScripAction;
+           use RT::ScripActions;
+           use RT::ScripCondition;
+           use RT::ScripConditions;
+           use RT::Scrip;
+           use RT::Scrips;
+           use RT::Group;
+           use RT::Groups;
+           use RT::Keyword;
+           use RT::Keywords;
+           use RT::ObjectKeyword;
+           use RT::ObjectKeywords;
+           use RT::KeywordSelect;
+           use RT::KeywordSelects;
+           use RT::GroupMember;
+           use RT::GroupMembers;
+           use RT::Watcher;
+           use RT::Watchers;
+           use RT::Handle;
+           use RT::Interface::Web;    
+           use MIME::Entity;
+           use Text::Wrapper;
+           use Apache::Cookie;
+           use Date::Parse;
+           use HTML::Entities;
+           
+           #TODO: make this use DBI
+           use Apache::Session::File;
+
+           # Set this page's content type to whatever we are called with
+           sub SetContentType {
+               my $type = shift;
+               $RT::Mason::r->content_type($type);
+           }
+
+           sub CGIObject {
+               $m->cgi_object();
+           }
+
+       }
+my ($parser, $interp, $ah);
+if ($HTML::Mason::VERSION < 1.0902) {
+ $parser = &RT::Interface::Web::NewParser(allow_globals => [%session]);
+
+ $interp = &RT::Interface::Web::NewInterp(parser=>$parser,
+                                          allow_recursive_autohandlers => 1,
+                                                              );
+
+ $ah = &RT::Interface::Web::NewApacheHandler($interp);
+} else {
+ $ah = &RT::Interface::Web::NewMason11ApacheHandler();
+}
+# Activate the following if running httpd as root (the normal case).
+# Resets ownership of all files created by Mason at startup.
+#
+chown (Apache->server->uid, Apache->server->gid, 
+               [$RT::MasonSessionDir]);
+
+
+chown (Apache->server->uid, Apache->server->gid, 
+               $ah->interp->files_written);
+
+# Die if WebSessionDir doesn't exist or we can't write to it
+
+stat ($RT::MasonSessionDir);
+die "Can't read and write $RT::MasonSessionDir"
+  unless (( -d _ ) and ( -r _ ) and ( -w _ ));
+
+
+sub handler {
+    ($r) = @_;
+    
+    RT::Init();
+    # We don't need to handle non-text items
+    return -1 if defined($r->content_type) && $r->content_type !~ m|^text/|io;
+    
+    #This is all largely cut and pasted from mason's session_handler.pl
+    
+    my %cookies = Apache::Cookie::parse($r->header_in('Cookie'));
+    
+    eval { 
+       tie %HTML::Mason::Commands::session, 'Apache::Session::File',
+         ( $cookies{'AF_SID'} ? $cookies{'AF_SID'}->value() : undef ), 
+           { Directory => $RT::MasonSessionDir,
+             LockDirectory => $RT::MasonSessionDir,
+           }   ;
+    };
+    
+    if ( $@ ) {
+       # If the session is invalid, create a new session.
+       if ( $@ =~ m#^Object does not exist in the data store# ) {
+            tie %HTML::Mason::Commands::session, 'Apache::Session::File', undef,
+            { Directory => $RT::MasonSessionDir,
+              LockDirectory => $RT::MasonSessionDir,
+            };
+            undef $cookies{'AF_SID'};
+       }
+         else {
+            die "RT Couldn't write to session directory '$RT::MasonSessionDir'. Check that this directory's permissions are correct.";
+         }
+    }
+    
+    if ( !$cookies{'AF_SID'} ) {
+       my $cookie = new Apache::Cookie
+         ($r,
+          -name=>'AF_SID', 
+          -value=>$HTML::Mason::Commands::session{_session_id}, 
+          -path => '/',);
+       $cookie->bake;
+
+    }
+    my $status = $ah->handle_request($r);
+    untie %HTML::Mason::Commands::session;
+    
+    return $status;
+    
+  }
+1;
+
diff --git a/rt/docs/README.docs b/rt/docs/README.docs
new file mode 100755 (executable)
index 0000000..38866b3
--- /dev/null
@@ -0,0 +1,2 @@
+Questions about docs should be sent to the RT Documentation Team (rt-docs@fsck.com)
+which is led by Meri.
diff --git a/rt/docs/Security b/rt/docs/Security
new file mode 100644 (file)
index 0000000..c9787ac
--- /dev/null
@@ -0,0 +1,25 @@
+RT2 runs setgid to some group (it defaults to 'rt').
+
+rt's configuration file, 'config.pm', is not world readable because it 
+contains rt's database password. If  a user gets access to this file, he
+can arbitrarily manipulate the RT database. This is bad. You don't want
+this to happen.  config.pm is mode 550. No users should be members of 
+the 'rt' group unless you want them to be able to obtain your rt password.
+
+If you're running the web interface, you'll need to make sure your webserver
+has access to config.pm.  You could do this by letting your webserver's user
+be a member of the 'rt' group. This has the disadvantage of letting 
+any mod_perl code on your web server have access to your RT password.
+
+Alternatively, you can run RT2 on its own apache instance bound to a high
+port on 127.0.0.1
+which runs as a non-priviledged user which is a member of the group 'rt'.  
+
+Configure your webserver to proxy requests to RT's 
+virtual directory to the apache instance you just set up.
+
+TODO: doc the apache configs needed to do this.
+
+The same technique can be used to run multiple RT2 instances on the same host.
+
+
diff --git a/rt/docs/design_docs/CARS b/rt/docs/design_docs/CARS
new file mode 100755 (executable)
index 0000000..a4d2a78
--- /dev/null
@@ -0,0 +1,66 @@
+Conditional Automated Request Shuffler 
+Initial Design.                <jesse@fsck.com> 9 Nov 99
+
+#Try to find out what queue the incoming ticket is in
+#Try to find out the default action for this invocation
+#Read the ticket from STDIN
+#Obtain the actor
+#Obtain the serial # if we have one
+#If the ticket has a ticket-id
+       #if this is a 'comment'
+               #add the current mime objects as a 'comment'
+
+       #if this is 'correspondence'
+               #add the current mime object as 'correspondence'
+
+
+#if this ticket does not yet have a ticket id
+
+  #For now:
+       #Create a new ticket
+
+  #In the distant future
+
+       #load the regexp table matching this queue
+       #check the message agains the regexp table, ordered by precedence
+               #when we get a match
+                       #get the ruleset for that regexp from the actions table
+                       #evaluate the ruleset in order of precedence.
+                          #if we get an 'exit' stop proccesing ALL rulesets
+wpw                       #if we get a 'forward,' forward it to 'value'.
+
+                          #if we get a 'create,' create a request in 'value'
+                          #elseif we get a 'map', add this as additional correspondence on ticket 'value'
+
+    
+                          #if we get an 'associate', associate the ticket number returned from the 
+                          'create' or 'map' with the master ticket from 'value'
+
+                          #if we get a 'reply', 
+                               #load the reply template with id 'value'      
+                               #replace strings in the template
+                               #send the template
+
+
+
+
+CREATE TABLE Rules {
+ID int AUTO_INCREMENT,
+Desc varchar(120),
+Regexp varchar(80),
+Precedence int,
+MatchField varchar(20), #Can be a headername or 'any' all header names
+                        #end in :
+
+
+CREATE TABLE Actions {
+Rule int,
+Action varchar(20), # Create, Forward, Squelch, Owner, Area, Associate
+Value varchar(20), #queue or email address
+Desc varchar(120)
+}
+
+CREATE TABLE Autoreplies {
+ID int AUTO_INCREMENT,
+Content text
+);
\ No newline at end of file
diff --git a/rt/docs/design_docs/TransactionTypes.txt b/rt/docs/design_docs/TransactionTypes.txt
new file mode 100755 (executable)
index 0000000..942b723
--- /dev/null
@@ -0,0 +1,48 @@
+This is some loose scrabbling made by TobiX, they might eventually be relevant
+for 2.1.
+
+INTERFACES, in general
+
+should:
+
+- provide the user (client?) with a list of possible actions (methods).
+- let the user execute those actions (methods).
+- Return information to the user/client.
+
+There are two kind of actions/methods:
+
+- Information retrieval
+- Transactions
+
+For the first, I think the best thing is to just provide a lot of
+methods for it in the libraries, and let it be an Interface Design
+Issue what to show and how to show it.
+
+For the second, I think we can win in the long run on having a
+generalized methods for 
+
+- listing transaction types.
+- creating & committing transactions.
+
+..with the possibility of just deploying new custom-developed modules
+when new transaction types are needed.
+
+
+$RT::TransactionTypes  ...and...
+%RT::TransactionTypes
+   - global object which contains all TransactionTypes
+   - used by all UIs to create menues of possible (user) actions (one TransactionType is a user action)
+
+The UIs should call sth like
+$Ticket->AddTransaction($TransactionName), which should be equivalent
+with i.e.  $Ticket->Correspond when $TransactionName is 'Correspond'
+(AUTOLOAD should call the do-sub if exists
+$RT::TransactionTypes{$TransactionName})
+
+The RT::Ticket::AddTransaction will create a new transaction of the
+right TransactionClass (maybe via a sub
+RT::TransactionTypes::NewTransaction).  Then $Transaction->do is
+called.
+
+TransactionType->do initializes a new object of the right TransactionClass, and 
+
diff --git a/rt/docs/design_docs/acls b/rt/docs/design_docs/acls
new file mode 100644 (file)
index 0000000..3b9d856
--- /dev/null
@@ -0,0 +1,206 @@
+$Header: /home/cvs/cvsroot/freeside/rt/docs/design_docs/acls,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+
+
+# {{{ Requirements 
+
+Here's the rough scheme I was thinking of for RT2 acls. Thoughts? I think
+it's a lot more flexible than RT 1.0, but not so crazily complex that
+it will be impossible to implement.  One of the "interesting" features
+is the ability to grant acls based on watcher status. This now lives
+in design-docs/acls
+
+        jesse
+
+Who can rights be granted to:
+
+       users whose id is <foo>
+       users who are watchers of type <requestor/cc/admincc> for <queue/ticket> <id>
+       users who are watchers of type <requestor/cc/admincc> for <this ticket / this queue>
+
+
+what scope do these rights apply to
+       queue <id>
+       system
+       
+
+What rights can be granted
+       Display Ticket
+       Manipulate Ticket
+               Only users with manipulate ticket level access will see comments
+       Maniplulate Ticket Status
+       Create Ticket   
+
+       Admin Queue Watchers 
+       Admin Ticket Watchers
+       Admin user accounts
+       Admin scrips
+       Admin scripscopes
+       Admin Queue ACLS
+       Admin System ACLs
+
+# }}}
+
+
+# {{{ Prinicpals  These are the entities in your Access Control Element
+#
+
+Principal: What user does this right apply to
+
+       Made up of: 
+               PrincipalScope, PrincipalType and PrincipalId
+
+       
+       User:   
+               Scope:  User    
+               Type:   null
+               Id:     A userid or 0
+
+       Owner:
+               Scope:  Owner
+               Type:   null
+               Id:     none
+
+
+       Watchers:
+
+               Scope: Ticket
+               Type:   Requestors; Cc; AdminCc
+               Id:     A ticket id or 0 for "this ticket"
+
+               Scope: Queue
+               Type:   Cc; AdminCc
+               Id:     A queue id or 0 for "this queue"
+
+
+# }}}
+
+# {{{ Object: What object does this right apply to
+
+       Object is composed of an ObjectType and an ObjectId
+
+       Type:   System  
+       Id:     NULL
+
+       Type:   Queue
+       Id:     Integer ref to queue id or 0 for all queues
+       
+# }}}
+
+# {{{ Right: (What does this entry give the principal the right to do)
+
+
+
+       For the Object System:
+               System::SetACL
+               System::AdminScrips
+
+               User::Display
+               User::Create
+               User::Destroy
+               User::Modify
+               User::SetPassword
+
+
+
+       For the Object "Queue":
+               Queue::Admin
+               Queue::SetACL
+               Queue::Create
+               Queue::Display
+               Queue::Destroy
+               Queue::ModifyWatchers
+               Ticket::Create
+               Ticket::Destory
+               Ticket::Display
+               Ticket::Update
+               Ticket::UpdateRequestors
+               Ticket::UpdateCc
+               Ticket::UpdateAdminCc
+               Ticket::NotifyWatchers
+
+               
+               DEFERRED
+
+               Ticket::SetStatus:      (Values)
+                                       Open
+                                       Resolved
+                                       Stalled
+                                       <null> means any
+
+
+# }}}
+
+
+# {{{ Implementation:
+
+# {{{ SQL Schema 
+CREATE TABLE ACL (
+       id int not null primary_key autoincrement,
+       PrinicpalId INT(11),
+       PrincipalType VARCHAR(16),
+       PrincipalScope VARCHAR(16),
+       ObjectType VARCHAR(16),
+       ObjectId  INT,
+       Right VARCHAR(16)
+);
+
+# }}}
+
+# {{{ perl implementation of rights searches
+
+sub Principals {
+if (defined $Ticket) {
+       return "($UserPrincipal) OR ($OwnerPrincipal) OR ($WatchersPrincipal)";
+       }
+else {
+       return   "($UserPrincipal) OR ($WatchersPrincipal)";
+       }  
+}
+       
+$Principals = " ($UserPrincipal) OR ($OwnerPrincipal) OR ($WatchersPrincipal)";
+
+$UserPrincipal = " ( ACE.PrincipalScope = 'User') AND 
+                  ( ACE.PrincipalId = $User OR ACE.PrincipalId = 0)";
+
+$OwnerPrincipal = " ( ACE.PrinciaplScope = 'Owner') AND 
+                     ( Tickets.Owner = "$User ) AND    
+                     ( Tickets.Id = $Ticket)";
+
+$WatchersPrincipal = " ( ACE.PrincipalScope = Watchers.Scope ) AND 
+                     ( ACE.PrincipalType = Watchers.Type ) AND 
+                     ( ACL.PrincipalId = Watchers.Value ) AND 
+                     ( Watchers.Owner = $User )";
+
+$QueueObject = "( ACE.ObjectType = 'Queue' and (ACE.ObjectId = $Queue OR ACE.ObjectId = 0)";
+
+$SystemObject = "( ACE.ObjectType = 'System' )";
+
+
+# This select statement would figure out if A user has $Right at the queue level
+
+SELECT ACE.id from ACE, Watchers, Tickets WHERE ( 
+            $QueueObject
+            AND ( ACE.Right = $Right) 
+            AND ($Principals))
+
+# This select statement would figure outif a user has $Right for the "System"
+
+SELECT ACE.id from ACE, Watchers, Tickets WHERE ( 
+            ($SystemObject) AND ( ACE.Right = $Right ) AND ($Principals))
+
+# }}}
+
+# }}}
+
+# {{{ Examples
+#
+
+# }}}  
+
+
+
+Unaddressed issues:
+
+       There needs to be a more refined method for grouping users, such that members of the customer service department
+can't change sysadmins' passwords.
diff --git a/rt/docs/design_docs/basic-definitions.txt b/rt/docs/design_docs/basic-definitions.txt
new file mode 100644 (file)
index 0000000..23d2c57
--- /dev/null
@@ -0,0 +1,54 @@
+(todo ... basically, those are untouched from 1.0)
+Ticket
+Queue
+(...more?)
+
+Requestor
+
+  (...definition of a requestor .. blahblah)
+
+  I'm often doing a distinction between "Internal Requestors" and "External
+  Requestors" (see below).  The system doesn't make any difference between
+  requestors, but the distinction might be useful to discuss usage patterns,
+  templates and configurations.
+
+
+External Requestor
+
+  Might be a customer or a potential customer.  The External Requestor
+  should be treated as a VIP.  (S)he shouldn't need to see too much of RT.
+  The support (s)he gets should be as personal as possible.  The external
+  requestor might eventually get access to the Web UI, but only to track
+  her/his own requests.  If you're not planning to use RT for handling
+  external customers, all your requestors are probably "Internal
+  Requestors".
+
+
+Watcher
+
+  Somebody that are "subscribing" to a queue or a ticket (or something
+  differently).  Basicly, somebody watching a queue or a ticket should get
+  all updates by email.  A requestor is a (special) watcher.
+
+
+Regular Watcher
+
+  People within the same organization, people that have read access to whole
+  queues.
+
+  I consider "Regular Watchers" as well as "Internal Requestors" as more
+  robust and capable human beeings than the fragile customers.  We don't
+  mind letting them get entagled with RT, and we let them access the Web UI.
+  They can live with beeing just the Cc or Bcc at an email.
+
+
+Internal Requestor
+
+  An Internal Requestor is usually internal to the company.  He might be 1st
+  line support sending matters to tech support or similar. Might be an
+  internal employee sending matters to tech support (or even 1st line
+  support if he's not sure where to send matters).  It might also be that
+  "ordinary" requestors actually might be treated as intelligent human
+  beeings rather than VIPs, i.e. in open source projects ... we'll still
+  call them "Internal Requestors" as they don't need the special VIP
+  treatment.
diff --git a/rt/docs/design_docs/cli_spec b/rt/docs/design_docs/cli_spec
new file mode 100644 (file)
index 0000000..48a7f34
--- /dev/null
@@ -0,0 +1,354 @@
+
+Find tickets to operate on:
+        --id=<tickets>          Find only tickets in the range <tickets>
+                synonyms:
+                --limit-id, --tickets, --limit-tickets
+        --limit-queue=<queue>
+        --limit-status=<status>
+        --limit-owner=<owner>
+        --limit-priority=<priority>
+        --limit-requestor=<email>
+        --limit-subject=<string>      (Subject contains)
+        --limit-body=<string>         (body contains)
+        --limit-created=(before/after) <date>
+        --limit-due=(before/after) <date>
+        --limit-starts=(before/after) <date>
+        --limit-started=(before/after) <date>
+
+        --limit-first=<int>           Start on the <int>th row returned by the
+                                database  
+        --limit-rows=<int>      Find only <int> rows
+
+Display:
+        --show                  shows a ticket history
+        --history               ditto
+
+        --summary               default option. shows a ticket summary
+                --format        Optional format string. If not specified,
+                                uses the value of ENV{'RT_LISTING_FORMAT'}
+                                or an internal default
+        
+
+Basic ticket editing:
+
+       --status=(open|stall|resolve|kill)
+       --subject=<string>
+        --owner=<owner>
+       --queue=<queue>
+       --time-left=<minutes>
+
+Watcher-related editing:
+
+       --add-requestor=<email>
+       --del-requestor=<email>
+       --add-cc=<email>
+       --del-cc=<email>
+       --add-admincc=<email>
+       --del-admincc=<email>
+
+Priority related editing:
+
+       --priority=<int>
+       --final-priority=<int>
+
+Date related editing:
+
+       --due=date
+       --starts=date
+       --started=date
+       --contacted=date
+
+
+
+Ticket updates:
+
+       --comment 
+       --reply | --respond 
+
+
+Links
+
+       --add-link 
+               --type=<DependsOn|MemberOf|RelatedTo>
+               needs one of:
+                  --target=<ticketid> 
+                  --base=<ticketid>
+
+       --del-link <link-id>
+
+
+
+Condiments:
+       any update can take:
+
+               --time-taken <minutes>
+
+       Ticket updates can take:
+
+               --source        -- specify a source file to read the content from
+               --edit          = give me an editor to edit the message
+               --no-edit       = don't give me an editor to edit the message.
+
+
+
+
+----- Forwarded message from deborah kaplan <deborah@curl.com> -----
+
+Date: Fri, 14 Apr 2000 11:43:18 -0400 (EDT)
+From: deborah kaplan <deborah@curl.com>
+To: Jesse <jesse@fsck.com>
+Subject: Re: [rt-devel] RT Projects list
+
+Finally, here is the functional spec for the command line
+interface.  This is for the user interface only; if you think
+this is right, I will add the administrative interface as well.
+Should I post to rt-devel, add to the ticket, or just modify
+based on your kibbitzing?  When you are happy with it I'll start
+the code.
+
+-deborah
+
+
+RT command line interface functional specification
+Author: Deborah Kaplan (Deborah@suberic.net)
+Version:0.1
+
+Requirements: 
+
+RT needs a CLI for various reasons.  If a user is restricted to a
+dumb terminal, she needs to be able to access the RT database and
+manipulate it fully.  The full functionality of both the RT
+database and the RT administrative interface should be available
+from this CLI.
+
+There are two possible types of CLI which I will discuss here.
+The first is a curses-style interface, which allows the user to
+move about a series of menus and choices, usually using arrow
+keys.  As RT supplies a Web interface, there is no need for this
+curses-style interface to be written as part of RT.  Instead, the
+RT developers should pick one tty-based Web browser (e.g. lynx,
+w3m) and make sure that all of the RT pages are easily readable
+with that tty based browser.  Installation of that browser should
+be recommended in the RT installation documentation as a
+supported method of accessing RT from a tty.
+
+The second possible type of CLI is more minimal: a series of
+commands which can be run at a UNIX command prompt which provide
+full functionality to the RT database and administrative
+interface.  There are two major benefits to this second type of
+CLI.  First of all, in order to use this CLI, you need no extra
+tools (Web browsers, etc.).  All that is required is a UNIX
+command line prompt and an installation of RT.  Secondly, a user
+of RT who has a very specific command to run and who knows the
+appropriate CLI commands can accomplish her task much more
+quickly with a single command then she could navigating through a
+menu based interface.
+
+In the specification, I will describe the second type of CLI.
+
+Caveats:
+
+This specification draws heavily on the structure of formatting
+command line options for cvs.  RT faces a smaller version of the
+same kinds of problems cvs faces: we want to create a very rich
+command set without sacrificing ease-of-use. 
+
+I am not wedded to any specific command names if they seem
+impractical; I merely am proposing the command names that seem
+reasonable to me at this moment.
+
+Finally, I am finding the functioning of the web UI from RT 1.
+If the functionality differs greatly in RT 2, I will need to
+modify this specification.
+
+Specification:
+
+There are two commands: "rt", which is the primary interface to
+the database, and "rtadmin", which is the administrative
+interface to the database.
+
+The format of an rt command is as follows:
+
+ rt <command> 
+    <command> is one of:
+
+    - help
+      print an overview of the commands which can be run
+
+    - print <queue> <options> 
+      with no options, dump to the screen a list of all open
+      requests in <queue> -- the equivalent of "Display Queue" in
+      the existing Web interface.
+
+      <queue> is the name of an RT queue
+      <option> is either:
+
+        -f <filename> |  --filename <filename>
+          where <filename> is the name of a file (defaulting to
+          ~/.rtrc) in which the options described below can be
+          placed in the format "^ <long option name> <option value>
+          $".
+
+        Or a series of the following options:
+
+        -o <owner name> |  --owner <owner name>: restrict tickets
+       viewed to those owned by <owner name>.
+          This option can be used multiple times in one call of
+          the rt command in order to produce a list which
+          contains tickets owned by multiple owners.  Giving the
+          empty string ("") as an option to this switch will
+          restrict tickets viewed to those which have no owner.
+          If this switch is given with no argument, the option
+          defaults to the user name of the currently running
+          process.
+
+        -r <requestor name> | --requestor <requestor name>:
+       restrict tickets viewed to those requested by <requestor
+       name>.
+          This option can be used multiple times in one call of
+          the rt command in order to produce a list which
+          contains tickets requested by multiple requesters.  If
+          this switch is given with no arguments, it produces an
+          error.
+
+        -s <status> | --status <status>: restrict tickets viewed
+       to those with the status named in <status>.
+          This option can be used multiple times in one call of
+          the rt command in order to produce a list which
+          contains tickets with multiple statuses (statii?
+          Dragon NaturallySpeaking recognizes "statuses" as a
+          word).  This option defaults to status "open".
+
+        -j <subject> | --subject <subject>: restrict tickets
+       viewed to those which contain <subject> as a substring in
+       the subject field of the ticket.
+          This command can be used multiple times in one call of
+          the rt command in order to produce a list which
+          contains tickets with various subject substrings.  If
+          the option is called with no argument, the result is
+          an error.
+
+        -h | --help: print a usage message.
+
+        -n | --number: print out a specific ticket.
+          This command can be used multiple times to produce a
+          list which contains multiple tickets.  If the option
+          is called with no argument, the result is an error.
+
+    This completes all of the print options which are available
+    in the Web interface, except the sort options.  I maintain
+    that this command is already excessively complex, and that
+    adding functionality which can be replicated easily by
+    standard UNIX tools is unnecessary added complexity.  I
+    recommend that the man pages and documentation for this
+    option contain an example of a command line run (e.g. of rt |
+    awk) which replicates the sorting functionality provided by
+    the Web interface.
+
+    - edit <ticket> <options>
+      with no options, or with no <ticket>, produces the same
+      output as the --help option.
+      Otherwise, edits the ticket with number <ticket> as
+      indicated in the options given.  All options listed below
+      except for --help and --number can be used in conjunction
+      with one another to change many features of the same ticket
+      all at once.
+
+        -h | --help: print usage message
+
+        -s <status> | --status <status>: change the status to the
+       status listed in <status>.
+          No <status> listed, or 1 listed it does not come from
+          a list of approve statuses, produces an error.
+
+        -o <owner name> |  --owner <owner name>: set to the owner
+       of the ticket the owner named.
+          Follows whatever convention is finally decided on for
+          the requirement to steal a ticket that is owned by
+          somebody else.  No <owner named> listed has the user
+          who is running the rt program take the ticket.  If
+          that user is not a valid owner, or the 1 listed does
+          not come from a list of approve names, produces an
+          error.
+
+        -r <requestor name> | --requestor <requestor name>: sets
+       the requestor to <requestor name>.
+          Follows any conventions that the Web UI follows to
+          make sure that this is a legal name.  If not legal, or
+          left blank, produces an error.
+
+        -j <subject> | --subject <subject>:  sets the subject of
+       the ticket to <subject>.
+          If the option is called with no argument, the result
+          is an error.
+
+        -n <number one> <number 2> | --number <number one>
+       <number 2>: merges ticket number <number one> into ticket
+       <number 2>.
+          If both arguments are not provided, the result is an
+          error.
+
+        -q <queue> | --queue <queue>: set the queue to that
+       named.
+          If <queue> is not listed, or the 1 listed does not
+          come from a list of approve queues, produces an
+          error.
+
+        -a <area> | --area <area>: set the area of the ticket to
+       that named.
+          If <area> is not listed, or the 1 listed does not come
+          from a list of approve areas, produces an error.
+
+        -c <time stamp> | --contact <time stamp>: sets the last
+       user contact field, and produces an error if the format
+       is invalid.
+          If the argument is left blank, sets the last user
+          contact field to now.
+
+        -p <priority> | --priority <priority>: sets the current
+       priority to the 1 listed.
+          Produces an error if the argument is left blank.
+
+        -f <priority> | --final <priority>: sets the final
+       priority to the 1 listed.
+          Produces an error if the arguments left blank.
+
+        -d <date due> | --datedue <date due>: sets the due date
+       to the 1 listed.
+          Produces an error if the argument is left blank, or if
+          the format is invalid.
+
+    - comment <options>
+      with no options, this command reads from standard input
+      until it sees EOF and appends that to the ticket as a
+      comment.
+
+        -h | --help: print usage message
+
+        -c | --comment: append as a comment.  This is the default behavior.
+
+        -r | --reply: append as a reply.
+
+        -f <filename> | --file <filename>: can be used with
+       either the comment or reply options.  Instead of reading
+       from standard input, read the text of the comment or
+       reply from the file <filename>.
+
+    - report <options>
+      this command is a place holder for reporting functionality
+      which does not yet exist.  It will probably have the
+      default behavior to select reports at the command line or
+      choose default reports from a .rtrc file.  In a future
+      version, it can output graphs in some graphical format.
+
+
+
+----- End forwarded message -----
+
+-- 
+jesse reed vincent -- root@eruditorum.org -- jesse@fsck.com 
+70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90
+
+"If IBM _wanted_ to make clones, we could make them cheaper and faster than
+anyone else!"  - An IBM Rep. visiting Vassar College's Comp Sci Department.
+
diff --git a/rt/docs/design_docs/cvs_integration b/rt/docs/design_docs/cvs_integration
new file mode 100644 (file)
index 0000000..35c8737
--- /dev/null
@@ -0,0 +1,164 @@
+jesse@FSCK.COM: ok. anyone here
+       interested in having RT as a bug tracker integrated with CVS? ()
+
+marc: in principle, sure. ()
+
+jesse@FSCK.COM: want to write up your
+       ideal of how such a beast would work? ()
+
+alex_c: what sort of integration are you thinking of, Jesse? ()
+
+jesse@FSCK.COM: well, that's what I want
+       to know, alex. lots of people want their bug trackers tied to their
+       version control. I want to know what people want it to _do_ ;) ()
+
+alex_c: weird. :) ()
+
+marc: similarly to what the debian bts does. 
+       you put a magic string ("rt-closes#123") and it causes the bug in rt to
+       be closed (or appended with a different magic string) with the commit
+       message.  also nice would be if rt would then generate links to a
+       webcvs server. ()
+
+jhawk: Hrmm. cvs front-end that strips 'em out?
+       Perhaps with RT:  lines instead of CVS: lines in the commit
+       interaction? ()
+
+marc: the magic string goes in the commit
+       message, that is. no, use one of the magic post-commit scripts. ()
+
+
+jesse@FSCK.COM: well, there's also the
+       pre-commit script to lock out commits wihtout a ticket id ()
+
+jhawk: Personally, I don't want to force special
+       magic strings to the bug-tracking system, some of which may be
+       confidential, to appear in the cvs logs. ()
+
+marc: I could see wanting that on a release
+       branch. ()
+
+jhawk: I also think it would be cool to supply
+       template stuff for you to edit. ()
+
+jesse@FSCK.COM: I'm not sure cvs can be
+       made to do that. can it? (generate templates) ()
+
+jhawk: It would be reasonable, in my model, to
+       turn some kinds of RT: lines into things that fell in the commit
+       message, but not all kinds. ()
+
+marc: I don't quite see jhawk's objection. ()
+
+ghudson: In my observation, locking out commits
+       without a ticket ID is usually an impediment to development, and leads
+       to developers having the one bug which all commits cite. ()
+
+jhawk: If you had a CVS frontend, it could geneate
+       the template and feed it to 'cvs commit -m' ()
+
+ghudson: CVS can generate templates and verify
+       that they have been filled in. ()
+
+jhawk: What Greg says sounds cool; greg, what do
+    you mean? marc: one sec. ()
+
+marc: I think assuming a frontend is a terrible
+       idea. ()
+
+jesse@FSCK.COM: greg: agreed. but people
+       seem to want it. the idea would be only for a locked down release
+       branch. ()
+
+jhawk: marc: So, I might want to close an open
+       ticket as part of a commit message without that showing up in the
+       coommit message. Or to insert a splufty long comment into a ticket
+       while I do the commit but not close or really change the state, and
+       that comment might want to ramble a lot but not include that ramble in
+       the commit message. ()
+
+jesse@FSCK.COM: well, then arguably, you
+       might want to not use the commit message for that update, but instead
+       just go straight to the bts ()
+
+marc: I think the idea is to force you to
+       mention the ticket closing in the commit message. ()
+
+jesse@FSCK.COM: but yeah, state changing
+       and 'update messages' are seperate concepts that should both be
+       supported. ()
+
+jesse@FSCK.COM: part of the idea is to
+       drag the commit message into the BTS ()
+
+jhawk: Err, I think it quite frequent that I want
+       to put seperate info in both the commit message and the ticket system,
+       and entering them at the same time seems cool. ()
+
+jesse@FSCK.COM: ok. noted. I'll see if
+       that's doable, when i get around to this. ()
+
+marc: so I think you want a custom front-end,
+       but I don't think what you want is what jesse is talking about. ()
+
+jesse@FSCK.COM: the thing that would be
+       really cool that scare the pants off me is tracking which branches bugs
+       exist in / are fixed in ()
+
+jesse@FSCK.COM: what jhawk wants should
+       be doable, now that I understand his reqts. ()
+
+marc: that would require the bts to understand
+       branches in some fundamental way. ()
+
+jesse@FSCK.COM: yes. see above, about
+       the pants. ()
+
+sly: uh oh, not more people losing their pants... ..
+
+
+ghudson: RT needs to know the names of branches
+       and their structure (so that you can tell it "fixed in foo" and it
+       knows that the bug is still fixed in anything that branches off of foo,
+       but not necessarily in other new branches), but nothing more than that.
+
+jhawk: So, note that what I'm describing is how
+       I'd like the UI to be, from a generic architectural level, and not
+       really thinking terribly specific. Greg, can you explain the CVS
+       template thing? ()
+
+jesse@FSCK.COM: and it needs to know
+       exactly "when" a branch happens. because "fixed in foo" won't fix
+       something that branched off foo yesterday ()
+
+marc: jesse was talking about integrating rt
+       with cvs.  building a new developent+repository+bts from scratch would
+       be a problem with larger scope :-) ()
+
+jesse@FSCK.COM: marc: was that in
+       response to jhawk? ()
+
+ghudson: CVS and templates: "rcsinfo" lets you
+       specify a template for log messages, and "commitinfo" lets you check
+       them. ()
+
+ghudson: Er, sorry, my bad. 
+       s/commitinfo/verifymsg/ ()
+
+marc: with cvs, if you have the revision number
+       of the fix (which you should). you can use the branch version number to
+       get a date and see when the branch happened relative to the fix. ()
+
+marc: jesse: yes. ()
+
+jesse@FSCK.COM: Ok. would people
+       consider "integration with CVS" to be subpar or incomplete if it didn't
+       deal with tracking branches? ()
+
+marc: incomplete relative to an ideal, but not
+       subpar, as it would still be useful. ()
+
+allbery@CS.CMU.EDU: CVS's branch
+       support sucks so much that failure to work with it is hardly a bug ()
+
+
diff --git a/rt/docs/design_docs/evil_plans b/rt/docs/design_docs/evil_plans
new file mode 100644 (file)
index 0000000..34b9f81
--- /dev/null
@@ -0,0 +1,167 @@
+Current planned 2.2 feature list. subject to change.
+
+
+Core
+
+Should Make "Owner" a watcher type, rather than a special ticket attribute,
+       under the hood.  This wins for ACL and code consistency reasons.
+
+Web UI
+
+Should New "Tools" top level menu
+Should         "This week in RT" at a glance.
+Nice           "RT Stats" overview.
+Nice   recent and favorite items
+
+
+per-user configuration
+
+Must           Saveable user preferences.
+
+               The ideal implementation would be "saveable user metadata",
+               including things like "Alternate Email Addresses".  To 
+               do this right, not all user metadata would be directly
+               editable by the user who has "ModifySelf"  it may be that
+               this is a "system" datastore that gets accessed by various
+               functions, some of which the user has access to modify and
+               some of which only the system does.
+               
+               API:    Set field "FOO" to value "BAR" for user BAZ
+                       What values does field "FOO" have for user BAZ?
+                       Clear all values of "FOO" for user BAZ
+                       What users have value "BAR" for field "FOO"
+
+               Example usages:
+
+                       What users have the alternative email address matching 
+                       "boo@fsck.com"
+                       What custom searches does user BAZ have defined?
+                       What is baz's default queue?
+
+               Actually, I feel a little sketchy about Alternative Email 
+               Addresses in there. I'm not quite sure why yet.
+
+               The same would really be useful for queues. Damn it. I think
+               I want a registry.
+
+
+
+Searching
+
+Must   Ability to define search result format.
+should         Saveable user searches.
+nice   Sharable searches.
+
+
+Scrips
+
+must   Include more Conditions; at least those contributed so far
+       that make sense in my grand scheme of things
+
+should The name should change to something that people don't think is
+       spelled wrong.  ("I will not invent words\n" x 1000)
+
+nice   Scrips could apply to a list of queues, rather than just one queue or 
+       all of them.
+
+
+Custom fields
+
+Must   "KeywordSelects" become "Custom Fields"
+Should String and multi-string custom fields.
+Nice   Date custom fields
+Nice   Some way to order and group custom fields.
+Nice   Default values
+Nice   Required values
+Nice   Make custom fields apply to an enumerated list of queues, 
+       rather than just one. 
+
+
+Web infrastructure
+
+Must   Full fastcgi support.
+
+
+Installation 
+
+Should Better FSSTD conformance:
+               bins in /bin
+               admin tools in /sbin (does this include rtadmin?)
+               ephemeral data in /var
+               rename config file      
+               force local RT search path?     
+
+Mail gateway
+
+must   Integrate gpg-authenticated command-by-mail mode
+       
+
+
+Core
+
+should Use apache logging, if available
+should Use syslog, if available.
+should Mail user new password, as an Action, so it can be invoked either 
+       as a scripaction or from the web ui.
+
+
+
+Web Services Framework
+
+Should Expose an API to create a ticket by HTTP posting an XML document.
+Should  Provide an RSS feed to display tickets matching certain criteria
+Nice   Allow ticket updates via the web ui
+Nice   Export full ticket metadata and history as XML
+
+Note:  I currently favor the REST philosophy that GET and POST to specific,
+       defined URLs provides everything one needs to build comprehensive
+       web services without the massive added complexity of a SOAP or XML-RPC
+       framework.
+
+
+ACLs:
+
+Wish   New ACL primitives for:
+
+               List all users who have right "FOO" on object "BAR"
+               List all rights user "BAZ" has for object "BAR"
+               List all objects for which user "BAR" has right "FOO"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+For the near future:
+
+       Use case:
+               Jesse wants to get notified of all tickets in queue 'RT Bugs'
+               with a severity of 'critical' and also have a requestor whcih matches 'fsck.com'.  
+               I'm not sure this is the best idea.
+
+
+       Site admins define a number of subscriptions and can sign up individual
+       users, groups or metagroups to get mail on that subscription.
+
+       Basically, an admin would define "On Condition, notify as comment with
+       template _template_"
+
+       There would be a new table called "subscriptions"(?) that would have
+       the structure:
+
+               id
+               ScripId
+               PrincipalType  ENUM: User, Group, Owner, Requestors, AdminCcs, Ccs
+               PrincipalId --  UserId or GroupId.  For Owner, Requestors, AdminCcs, Ccs, it doesn't really make a lick of difference.  
diff --git a/rt/docs/design_docs/link-definitions.txt b/rt/docs/design_docs/link-definitions.txt
new file mode 100644 (file)
index 0000000..30b9035
--- /dev/null
@@ -0,0 +1,143 @@
+For 2.0, those Linking actions should be supported:
+
+1. DependentOn; TobiX-style.
+
+ BASE is dependent on TARGET.
+ ...meaning that TARGET has to be resolved before BASE (really) is
+ resolved.
+ According to TobiX, those "weird action" makes sense:
+ ...when the link and/or TARGET is created, the BASE might be stalled.
+ Alternatively, this should be very trivial to request through the UIs.
+ ...when the TARGET is resolved, BASE will be reopened if it's stalled.
+
+ An alternative to those "weird actions" is to have some run-time logic that
+ takes care of this; i.e. letting the search interface handle "please hide
+ all requests with unresolved dependencies"
+ TobiX will need to make dependency links into Bugzilla.
+
+ Dependency links should be made when more work to BASE should be done
+ after the TARGET is resolved and/or BASE can't be resolved before TARGET is
+ resolved.
+
+ Dependency links are often 1:1, but n:n links makes sense; one ticket can
+ depend on several others, several tickets can depend on one ticket, etc.
+
+ Loops don't make sense at all, but the system above won't break if it
+ encounter loops.
+
+ Dependency links is more for workflow than anything else.  When a new
+ TARGET is created, some of the work might be passed over to another
+ department/person ... but _not_ the responsibility for the communication
+ with the external requestor.
+
+2. MemberOf link (grouping)
+
+ BASE is a member of TARGET.
+
+ TobiX-style "weird actions":
+ ...when TARGET is beeing replied to, all BASE requestors should get the
+ reply.
+
+ ...when TARGET is resolved, all BASE tickets should be resolved (unless
+ they have other unresolved Dependencies/MemberOf links).
+
+ ...when all BASEs to one TARGET are resolved, TARGET should be resolved.
+ The alternative is to let the user choose "reply to all" and "resolve all"
+ through the user interfaces.
+
+ MemberOf should be used when BASE ticket states more or less the same as
+ the TARGET ticket, and we do want to give a reply to all requestors, but we
+ don't want to merge them (Individual tickets from individual external
+ requestors should be respected as separate entities). If BASE tickets from
+ more than one external requestor is linked to a TARGET ticket, we denote
+ the TARGET ticket as a "Group ticket".  This is only a documentation
+ definition, you won't find any references to "Group tickets" in the source.
+
+ I think the proper etiquette should be to clearly state in a reply to a
+ group ticket that the mail is going to several persons, and that the
+ requestor should reply back if they feel their Ticket hasn't got the
+ attention it deserves.  The user documentation should reflect this.
+
+ MemberOf links can also be used to hand away the work flow. The person in
+ charge of the TARGET ticket will also be in charge of the BASE tickets and
+ the communication with the end user.
+
+ If a work task needs to be splitted into two subtasks, MemberOf might also be
+ used.
+
+ 1:n links makes more sense, but n:n can also work in some cases.
+ The reply stuff might break seriously upon loops.  Recursement might be
+ handy for splitting a work task into subtasks (making a hierarchical tree
+ of the worktasks).
+
+
+3. Merge (connecting)
+
+ BASE is the same as TARGET.
+
+ ...the system should somehow merge together transactions for both tickets.
+ ...BASE should be more or less deleted, only the TARGET should apply.
+ ...actions done toward BASE should be redirected to TARGET.
+
+ I think MergeLinks should be used when two tickets accidentally has
+ appeared twice in the system, and/or there is no reason to keep the two
+ tickets separately.  It might be that it's the same requestor (i.e.
+ clicking the "send" button twice in a web environment) or that we don't
+ care much about giving the requestor individual follow-up (typically
+ "internal" requestors, etc.)
+
+ Based on user feedback, merged tickets will be displayed as the same ticket
+within RT's user interfaces. but the original tickets' transactions will be
+kept seperated in the database. this may require some magic.
+4. RefersTo / No Action link (linking)
+
+ BASE is somewhat related to TARGET
+
+ No special actions will be taken.
+ Loops might maybe make sense
+
+BASE and TARGET are usually Tickets within one RT instance, but it
+might also point to external RT instances, other DB systems, etc.
+
+
+
+
+In future revisions, it should be very easy to set up site-specific link action types.
+We should also consider to include more linking actions in the box.
+
+An example stolen from John Rouillard.  Eventually the [comments] should be
+removed, and the text modified to fit the planned 2.0 link actions:
+
+  ticket  problem
+    1         can't connect to hosts with netscape
+    2         ping is broken
+    3         Can't send email: error no space on spool/mqueue
+         
+  You have the above in the queue. You realize that DNS is down. Spawn
+  a ticket
+         
+    4         DNS is down
+
+  mergelink 1 and 2 to it [I would rather say "make a MemberOf link _or_ a
+  dependency link from 1 and 2 to 4" --TobiX] (if you choose to stall 1 and
+  2 automatically feel free, its just a shell script change) [well, you
+  might choose dependency instead of MemberOf --TobiX]. The person working
+  on 3 has come to the conclusion that outgoing mail is backing up because
+  of the DNS failure. She has cleared space by copying the mail queue to
+  another disk, but can't really get email working till DNS is up. So she
+  creates a Dependency linkon  ticket 4 stalling ticket 3.
+
+  We finally get DNS working and resolve ticket 3. What happens?  Tickets 1
+  and 2 are resolved and email is sent to requestors notifying them of the
+  resolution [This is the default behaviour for 2.0 MemberOf-linked tickets.
+  Remember that if we send Replies to "Group Tickets" (that is, the target
+  of several "MemberOf" links) --TobiX]. Ticket 4 [should be 3? --TobiX] is
+  reopened and the person working on it starts flushing the mail queue and
+  the moved mailq by hand. 
+
diff --git a/rt/docs/design_docs/local_hacking b/rt/docs/design_docs/local_hacking
new file mode 100644 (file)
index 0000000..c06d112
--- /dev/null
@@ -0,0 +1,32 @@
+To facilitate local hacking, RT needs a mechanism to allow site administrators
+to easily add HTML templates for the web ui and to replace sections
+of code in RT's core modules _without_ having to modify those modules
+
+We'll use several methods to achieve this goal.
+
+       Webui
+               HTML::Mason allows users to create multiple
+component hierarchies.  RT should ship with a local component root
+defined and available. This root should be configured as the "primary"
+component root.
+
+
+       Core modules
+
+       This gets a bit trickier. we want to allow people to trivially
+subclass core modules and to use those subclasses throughout the code.
+
+The way we're going to handle this is by setting up a number of subroutines
+in config.pm that look something like this:
+
+sub NewTicketObj {
+       eval "require $TicketClass";
+       my $object = new $TicketClass;
+       return ($object);
+}
+
+# This variable is used for ref type checking
+$TicketClass = "RT::Ticket";
+
+we could use an eval around the require and thus completely avoid specifying
+the object in two places. which feels like a win. but i'm worried about perf.
diff --git a/rt/docs/design_docs/subscription-definitions.txt b/rt/docs/design_docs/subscription-definitions.txt
new file mode 100755 (executable)
index 0000000..deda35c
--- /dev/null
@@ -0,0 +1,113 @@
+NEW SCRIP NOTES
+
+
+RT Actions:
+
+
+   EmailOwnerAsComment
+       Send mail to the ticket owner from the queue's comment address
+       
+   EmailOwnerOrAdminWatchersAsComment
+       Send mail to the ticket owner, or if there is no owner, the ticket's admin watchers
+       from the queue's comment addresses
+
+   EmailAdminWatchersAsComment
+       Send mail to the ticket's adminstrative watchers from the queue's comment address
+
+
+
+   EmailOwner
+       Send mail to the ticket owner from the queue's correspond address
+       
+   EmailOwnerOrAdminWatchers
+       Send mail to the ticket owner, or if there is no owner, the ticket's admin watchers
+       from the queue's correspond addresses
+
+   EmailAdminWatchers
+       Send mail to the ticket's adminstrative watchers from the queue's correspond address
+
+   EmailWatchers
+       Send mail to the ticket watchers from the queue's correspond address
+
+   AutoReply 
+       Sendmail to the requestor from the queue's correspond address.
+            
+   
+
+RT Conditions:
+   OnCreate
+   OnEachTransaction
+   OnComment
+   OnCorrespond
+   
+
+
+
+
+What is an Action?
+
+...some piece of code that can do something whenever a transaction is done.
+The actions shipped with RT sends email and can handle some logic that makes
+sense for some instances.  site-specific modules can be dropped in to
+perform special actions.
+
+
+What can an Action do?
+
+- decide whether it's applicable or not
+- prepare
+- commit
+- describe itself
+
+...and if it's a subclass of SendEmail, you can also override a lot.
+
+Currently the schema.mysql contains a list of the basic subscription-related
+actions that will be bundled with RT.
+
+
+What is a Scrip?
+
+...it's an entry in the database that tells that an action is to be
+performed with a certain template and argument.  Template and argument
+doesn't make sense in all contexts.  A scrip can be limited to transaction
+types; the current implementation allows a comma-separated list (though for
+a "cleaner" schema design, it should be a separate table for this?).  It has
+a name and a description.
+
+
+What is a ScripScope?
+
+...an indication of what queues the different Scrips applies to.  It should
+be easy to remove/insert ScripScope objects by the admin tools.
+
+
+What is a Watcher?
+
+...it's a request for beeing kept updated on a ticket and/or a queue
+and/or whatever.  It is to be used by the Actions.  Watcher items can
+easily be enabled/disabled through the `Quiet' attribute.  `Type' might
+indicate what emails the watcher wants to get and how to get them.
+
+The Bcc/Cc watchers should be handled by the NotifyWatchers action which is
+run regardless of the Scrips.
+
+
+What is a Template?
+
+...A template is a text template that is to be used for outgoing email -
+or for different use for different actions.  One template can be used by
+several Scrips.
+
+
+How does the system determinate whom to send mail to?
+
+The ScripScope table in the DB should indicate whether a Scrip is relevant
+for a queue or not /* TobiX thinks that this might eventually be extended to
+keywords, tickets, etc, and not only Queues */ ... the Scope table should
+indicate whether the Scrip is relevant for a given transaction type ... then
+the given Action should determinate whether it applies or not, and finally
+the Action has to find out (via the Watchers table) whom it applies to, and
+how to contact them ... and the Template tells how the mails that are sent
+out should look like.
+
+
diff --git a/rt/docs/design_docs/users b/rt/docs/design_docs/users
new file mode 100644 (file)
index 0000000..71c4476
--- /dev/null
@@ -0,0 +1,14 @@
+RT2 makes everybody a user. some sites won't like this. there
+should be away to make an "anonymous" user who the mailgate makes
+the requestor for all mailed in tickets. it would then set the
+ticket 'requestor' watcher's alternate email address to the real
+requestor's email.
+
+additionally, eventually, users will need to be deleted. RT doesn't
+want any user deleted. Instead, there will be a flag in the user's
+entry in the users table called 'Disabled.'  Disabled users will
+not be able to be granted rights.
+
+       The process of disabling a user should remove their acls and
+should force the giving away of their tickets or reject the disabling.
+
diff --git a/rt/docs/rt.gif b/rt/docs/rt.gif
new file mode 100755 (executable)
index 0000000..693b062
Binary files /dev/null and b/rt/docs/rt.gif differ
diff --git a/rt/etc/acl.Oracle b/rt/etc/acl.Oracle
new file mode 100644 (file)
index 0000000..59d35a0
--- /dev/null
@@ -0,0 +1,9 @@
+CREATE USER !!DB_RT_USER!! identified by !!DB_RT_PASS!!
+temporary tablespace TEMP
+default tablespace USERS
+quota unlimited on USERS;
+
+grant connect, resource to !!DB_RT_USER!!;
+
+exit;
+
diff --git a/rt/etc/acl.Pg b/rt/etc/acl.Pg
new file mode 100755 (executable)
index 0000000..13ac41d
--- /dev/null
@@ -0,0 +1,39 @@
+drop user !!DB_RT_USER!!;
+create user !!DB_RT_USER!! with password '!!DB_RT_PASS!!' NOCREATEDB NOCREATEUSER;
+
+grant select, insert, update, delete on Groups to !!DB_RT_USER!!;
+grant select, insert, update, delete on Groups_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on ACL to !!DB_RT_USER!!;
+grant select, insert, update, delete on ACL_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Watchers to !!DB_RT_USER!!;
+grant select, insert, update, delete on Watchers_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Links to !!DB_RT_USER!!;
+grant select, insert, update, delete on Links_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Users to !!DB_RT_USER!!;
+grant select, insert, update, delete on Users_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Tickets to !!DB_RT_USER!!;
+grant select, insert, update, delete on Tickets_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on GroupMembers to !!DB_RT_USER!!;
+grant select, insert, update, delete on GroupMembers_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Queues to !!DB_RT_USER!!;
+grant select, insert, update, delete on Queues_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Transactions to !!DB_RT_USER!!;
+grant select, insert, update, delete on Transactions_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on ScripActions to !!DB_RT_USER!!;
+grant select, insert, update, delete on ScripActions_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on ScripConditions to !!DB_RT_USER!!;
+grant select, insert, update, delete on ScripConditions_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Scrips to !!DB_RT_USER!!;
+grant select, insert, update, delete on Scrips_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Attachments to !!DB_RT_USER!!;
+grant select, insert, update, delete on Attachments_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Templates to !!DB_RT_USER!!;
+grant select, insert, update, delete on Templates_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on Keywords to !!DB_RT_USER!!;
+grant select, insert, update, delete on Keywords_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on ObjectKeywords to !!DB_RT_USER!!;
+grant select, insert, update, delete on ObjectKeywords_id_seq to !!DB_RT_USER!!;
+grant select, insert, update, delete on KeywordSelects to !!DB_RT_USER!!;
+grant select, insert, update, delete on KeywordSelects_id_seq to !!DB_RT_USER!!;
+
+
diff --git a/rt/etc/acl.mysql b/rt/etc/acl.mysql
new file mode 100755 (executable)
index 0000000..7feb376
--- /dev/null
@@ -0,0 +1,4 @@
+
+DELETE FROM user WHERE user like '!!DB_RT_USER!!';
+DELETE FROM db where db LIKE '!!DB_DATABASE!!';
+GRANT SELECT,INSERT,CREATE,INDEX,UPDATE,DELETE ON !!DB_DATABASE!!.* TO !!DB_RT_USER!!@!!DB_RT_HOST!! IDENTIFIED BY '!!DB_RT_PASS!!';
diff --git a/rt/etc/config.pm b/rt/etc/config.pm
new file mode 100755 (executable)
index 0000000..52b1a0b
--- /dev/null
@@ -0,0 +1,473 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/etc/Attic/config.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $      
+
+package RT;
+
+# {{{ Base Configuration
+
+# $rtname the string that RT will look for in mail messages to
+# figure out what ticket a new piece of mail belongs to
+
+# Your domain name is recommended, so as not to pollute the namespace.
+# once you start using a given tag, you should probably never change it. 
+# (otherwise, mail for existing tickets won't get put in the right place
+
+$rtname="example.com";  
+
+# You should set this to your organization's DNS domain. For example,
+# fsck.com or asylum.arkham.ma.us. It's used by the linking interface to 
+# guarantee that ticket URIs are unique and easy to construct.
+
+$Organization = "example.com";
+
+# $user_passwd_min defines the minimum length for user passwords. Setting
+# it to 0 disables this check
+$MinimumPasswordLength = "5";
+
+# $Timezone is used to convert times entered by users into GMT and back again
+# It should be set to a timezone recognized by your local unix box.
+$Timezone =  'US/Eastern'; 
+
+# LogDir is where RT writes its logfiles.
+# This directory should be writable by your rt group
+$LogDir = "!!RT_LOG_PATH!!";
+
+# }}}
+
+# {{{ Database Configuration
+
+# Database driver beeing used - i.e. MySQL.
+$DatabaseType="!!DB_TYPE!!";
+
+# The domain name of your database server
+# If you're running mysql and it's on localhost,
+# leave it blank for enhanced performance
+$DatabaseHost="!!DB_HOST!!";
+
+# The port that your database server is running on.  Ignored unless it's 
+# a positive integer. It's usually safe to leave this blank
+$DatabasePort="!!DB_PORT!!";
+
+
+#The name of the database user (inside the database) 
+$DatabaseUser='!!DB_RT_USER!!';
+
+# Password the DatabaseUser should use to access the database
+$DatabasePassword='!!DB_RT_PASS!!';
+
+
+# The name of the RT's database on your database server
+$DatabaseName='!!DB_DATABASE!!';
+
+# If you're using Postgres and have compiled in SSL support, 
+# set DatabaseRequireSSL to 1 to turn on SSL communication
+$DatabaseRequireSSL=undef;
+
+# }}}
+
+# {{{ Incoming mail gateway configuration
+
+
+# OwnerEmail is the address of a human who manages RT. RT will send
+# errors generated by the mail gateway to this address.  This address
+# should _not_ be an address that's managed by your RT instance.
+
+$OwnerEmail = 'root';
+
+# If $LoopsToRTOwner is defined, RT will send mail that it believes 
+# might be a loop to $RT::OwnerEmail 
+
+$LoopsToRTOwner = 1;
+
+# If $StoreLoopss is defined, RT will record messages that it believes 
+# to be part of mail loops.
+# As it does this, it will try to be careful not to send mail to the 
+# sender of these messages 
+
+$StoreLoops = undef;
+
+
+# $MaxAttachmentSize sets the maximum size (in bytes) of attachments stored
+# in the database. 
+
+# For mysql and oracle, we set this size at 10 megabytes.
+# If you're running a postgres version earlier than 7.1, you will need
+# to drop this to 8192. (8k)
+
+$MaxAttachmentSize = 10000000;  
+
+# $TruncateLongAttachments: if this is set to a non-undef value,
+# RT will truncate attachments longer than MaxAttachmentLength. 
+
+$TruncateLongAttachments = undef;
+
+
+# $DropLongAttachments: if this is set to a non-undef value,
+# RT will silently drop attachments longer than MaxAttachmentLength. 
+
+$DropLongAttachments = undef;
+
+# If $ParseNewMessageForTicketCcs is true, RT will attempt to divine
+# Ticket 'Cc' watchers from the To and Cc lines of incoming messages
+# Be forewarned that if you have _any_ addresses which forward mail to
+# RT automatically and you enable this option without modifying 
+# "IsRTAddress" below, you will get yourself into a heap of trouble.
+# And well, this is free software, so there isn't a warrantee, but
+# I disclaim all ability to help you if you do enable this without
+# modifying IsRTAddress below.
+
+$ParseNewMessageForTicketCcs = undef;
+
+# IsRTAddress is used to make sure RT doesn't add itself as a ticket CC if
+# the setting above is enabled.
+
+sub IsRTAddress {
+    my $address = shift;
+
+    # Example: the following rule would tell RT not to Cc 
+    #  "tickets@noc.example.com"
+    # return(1) if ($address =~ /^tickets\@noc.example.com$/i);
+    
+    return(undef)
+}
+
+# CanonicalizeAddress converts email addresses into canonical form.
+# it takes one email address in and returns the proper canonical
+# form. You can dump whatever your proper local config is in here
+
+sub CanonicalizeAddress {
+    my $email = shift;
+    # Example: the following rule would treat all email
+    # coming from a subdomain as coming from second level domain
+    # foo.com
+    #$email =~ s/\@(.*).foo.com/\@foo.com/;
+    return ($email)
+}
+
+# If $LookupSenderInExternalDatabase is defined, RT will attempt to
+# verify the incoming message sender with a known source, using the 
+# LookupExternalUserInfo routine below
+
+$LookupSenderInExternalDatabase = undef;
+
+# If $SenderMustExistInExternalDatabase is true, RT will refuse to
+# create non-privileged accounts for unknown users if you are using 
+# the "LookupSenderInExternalDatabase" option.
+# Instead, an error message will be mailed and RT will forward the 
+# message to $RTOwner.
+#
+# If you are not using $LookupSenderInExternalDatabase, this option
+# has no effect.
+#
+# If you define an AutoRejectRequest template, RT will use this   
+# template for the rejection message.
+
+$SenderMustExistInExternalDatabase = undef;
+
+# LookupExternalUserInfo is a site-definable method for synchronizing
+# incoming users with an external data source. 
+#
+# This routine takes a tuple of EmailAddress and FriendlyName
+#      EmailAddress is the user's email address, ususally taken from
+#              an email message's From: header.
+#      FriendlyName is a freeform string, ususally taken from the "comment" 
+#              portion of an email message's From: header.
+#
+# It returns (FoundInExternalDatabase, ParamHash);
+#
+#   FoundInExternalDatabase must  be set to 1 before return if the user was
+#   found in the external database.
+#
+#   ParamHash is a Perl parameter hash which can contain at least the following
+#   fields. These fields are used to populate RT's users database when the user 
+#   is created
+#
+#      EmailAddress is the email address that RT should use for this user.  
+#      Name is the 'Name' attribute RT should use for this user. 
+#           'Name' is used for things like access control and user lookups.
+#      RealName is what RT should display as the user's name when displaying 
+#           'friendly' names
+
+sub LookupExternalUserInfo {
+  my ($EmailAddress, $RealName) = @_;
+
+  my $FoundInExternalDatabase = 1;
+  my %params = {};
+  
+  #Name is the RT username you want to use for this user.
+  $params{'Name'} = $EmailAddress;
+  $params{'EmailAddress'} = $EmailAddress;
+  $params{'RealName'} = $RealName;
+
+  # See RT's contributed code for examples.
+  # http://www.fsck.com/pub/rt/contrib/
+  return ($FoundInExternalDatabase, %params); 
+}
+
+# }}}
+
+# {{{ Outgoing mail configuration
+
+# RT is designed such that any mail which already has a ticket-id associated
+# with it will get to the right place automatically.
+
+# $CorrespondAddress and $CommentAddress are the default addresses 
+# that will be listed in From: and Reply-To: headers of correspondence
+# and comment mail tracked by RT, unless overridden by a queue-specific
+# address. 
+
+$CorrespondAddress='RT::CorrespondAddress.not.set';
+
+$CommentAddress='RT::CommentAddress.not.set';
+
+
+#Sendmail Configuration
+
+# $MailCommand defines which method RT will use to try to send mail
+# We know that 'sendmailpipe' works fairly well.
+# If 'sendmailpipe' doesn't work well for you, try 'sendmail' 
+#
+# Note that you should remove the '-t' from $SendmailArguments 
+# if you use 'sendmail rather than 'sendmailpipe'
+
+$MailCommand = 'sendmailpipe';
+
+# $SendmailArguments defines what flags to pass to $Sendmail
+# assuming you picked 'sendmail' or 'sendmailpipe' as the $MailCommand above.
+# If you picked 'sendmailpipe', you MUST add a -t flag to $SendmailArguments
+
+# These options are good for most sendmail wrappers and workalikes
+$SendmailArguments="-oi -t";
+
+# These arguments are good for sendmail brand sendmail 8 and newer
+#$SendmailArguments="-oi -t -ODeliveryMode=b -OErrorMode=m";
+
+# If you selected 'sendmailpipe' above, you MUST specify the path
+# to your sendmail binary in $SendmailPath.  
+# !! If you did not # select 'sendmailpipe' above, this has no effect!!
+$SendmailPath = "/usr/sbin/sendmail";
+
+# RT can optionally set a "Friendly" 'To:' header when sending messages to 
+# Ccs or AdminCcs (rather than having a blank 'To:' header.
+
+# This feature DOES NOT WORK WITH SENDMAIL[tm] BRAND SENDMAIL
+# If you are using sendmail, rather than postfix, qmail, exim or some other MTA,
+# you _must_ disable this option.
+
+$UseFriendlyToLine = 0;
+
+
+# }}}
+
+# {{{ Logging
+
+# Logging.  The default is to log anything except debugging
+# information to a logfile.  Check the Log::Dispatch POD for
+# information about how to get things by syslog, mail or anything
+# else, get debugging info in the log, etc. 
+
+#  It might generally make
+# sense to send error and higher by email to some administrator. 
+# If you do this, be careful that this email isn't sent to this RT instance.
+
+
+# the minimum level error that will be logged to the specific device.
+# levels from lowest to highest:  
+#  debug info notice warning error critical alert emergency 
+
+
+#  Mail loops will generate a critical log message.
+
+$LogToScreen = 'error';
+$LogToFile = 'error';
+#$LogToFileNamed = "$LogDir/rt.log.".$$.".".$<; #log to rt.log.<pid>.<user>
+$LogToFileNamed = "$LogDir/rt.log".$<; #log to rt.log.user;
+
+# }}}
+
+# {{{ Web interface configuration
+
+
+
+# Define the directory name to be used for images in rt web
+# documents.
+
+# If you're putting the web ui somewhere other than at the root of
+# your server
+# $WebPath requires a leading / but no trailing /     
+
+$WebPath = "";
+
+# This is the Scheme, server and port for constructing urls to webrt
+# $WebBaseURL doesn't need a trailing /                                                                            
+
+$WebBaseURL = "http://RT::WebBaseURL.not.configured:80";
+
+$WebURL = $WebBaseURL . $WebPath . "/";
+
+
+
+# $WebImagesURL points to the base URL where RT can find its images.
+# If you're running the FastCGI version of the RT web interface,
+# you should make RT's WebRT/html/NoAuth/images directory available on 
+# a static web server and supply that URL as $WebImagesURL.
+
+$WebImagesURL = $WebURL."NoAuth/images/";
+
+# $RTLogoURL points to the URL of the RT logo displayed in the web UI
+
+$LogoURL = $WebImagesURL."rt.jpg";
+
+# If $WebExternalAuth is defined, RT will defer to the environment's
+# REMOTE_USER variable.
+
+$WebExternalAuth = undef;
+
+# $MasonComponentRoot is where your rt instance keeps its mason html files
+# (this should be autoconfigured during 'make install' or 'make upgrade')
+
+$MasonComponentRoot = "!!MASON_HTML_PATH!!";
+
+# $MasonLocalComponentRoot is where your rt instance keeps its site-local
+# mason html files.
+# (this should be autoconfigured during 'make install' or 'make upgrade')
+
+$MasonLocalComponentRoot = "!!MASON_LOCAL_HTML_PATH!!";
+
+# $MasonDataDir Where mason keeps its datafiles
+# (this should be autoconfigured during 'make install' or 'make upgrade')
+
+$MasonDataDir = "!!MASON_DATA_PATH!!";
+
+# RT needs to put session data (for preserving state between connections
+# via the web interface)
+$MasonSessionDir = "!!MASON_SESSION_PATH!!";
+
+
+
+#This is from tobias' prototype web search UI. it may stay and it may go.
+%WebOptions=
+    (
+     # This is for putting in more user-actions at the Transaction
+     # bar.  I will typically add "Enter bug in Bugzilla" here.:
+     ExtraTransactionActions => sub { return ""; },
+
+     # Here you can modify the list view.  Be aware that the web
+     # interface might crash if TicketAttribute is wrongly set.
+     
+     QueueListingCols => 
+      [
+       { Header     => 'Id',
+        TicketLink => 1,
+        TicketAttribute => 'Id'
+        },
+
+      { Header     => 'Subject',
+        TicketAttribute => 'Subject'
+        },
+       { Header => 'Requestor(s)',
+        TicketAttribute => 'RequestorsAsString'
+        },
+       { Header => 'Status',
+        TicketAttribute => 'Status'
+        },
+
+
+       { Header => 'Queue',
+        TicketAttribute => 'QueueObj->Name'
+        },
+
+
+
+       { Header => 'Told',
+        TicketAttribute => 'ToldObj->AgeAsString'
+        },
+
+       { Header => 'Age',
+        TicketAttribute => 'CreatedObj->AgeAsString'
+        },
+
+       { Header => 'Last',
+        TicketAttribute => 'LastUpdatedObj->AgeAsString'
+        },
+
+       # TODO: It would be nice with a link here to the Owner and all
+       # other request owned by this Owner.
+       { Header => 'Owner',
+        TicketAttribute => 'OwnerObj->Name'
+       },
+   
+       { Header     => 'Take',
+        TicketLink => 1,
+        Constant   => 'Take',
+        ExtraLinks => '&Action=Take'
+        },
+
+      ]
+     );
+
+# }}}
+
+# {{{ RT Linking Interface
+
+# $TicketBaseURI is the Base path of the URI for local tickets
+
+# You shouldn't need to touch this. it's used to link tickets both locally
+# and remotely
+
+$TicketBaseURI = "fsck.com-rt://$Organization/$rtname/ticket/";
+
+# A hash table of conversion subs to be used for transforming RT Link
+# URIs to URLs in the web interface.  If you want to use RT towards
+# locally installed databases, this is the right place to configure it.
+
+%URI2HTTP=
+    (
+      'http' => sub {return @_;},
+      'https' => sub {return @_;},
+      'ftp' => sub {return @_;},
+     'fsck.com-rt' => sub {warn "stub!";},
+     'mozilla.org-bugzilla' => sub {warn "stub!"},
+     'fsck.com-kb' => sub {warn "stub!"}
+     );
+
+
+# A hash table of subs for fetching content from an URI
+%ContentFromURI=   
+    (
+     'fsck.com-rt' => sub {warn "stub!";},
+     'mozilla.org-bugzilla' => sub {warn "stub!"},
+     'fsck.com-kb' => sub {warn "stub!"}
+     );
+
+# }}}
+
+# {{{ No User servicable parts inside 
+
+############################################
+############################################
+############################################
+#
+#  Don't edit anything below this line unless you really know
+#  what you're doing
+#
+#
+############################################
+############################################
+
+# TODO: get this stuff out of the config file and into RT.pm
+
+#Set up us the timezone
+$ENV{'TZ'} = $Timezone; #TODO: Bogus hack to deal with Date::Manip whining
+
+# Configure sendmail if we're using Entity->send('sendmail')
+if ($MailCommand eq 'sendmail') {
+    $MailParams = $SendmailArguments;
+}
+
+
+
+# }}}
+
+
+1;
diff --git a/rt/etc/rt.spec b/rt/etc/rt.spec
new file mode 100644 (file)
index 0000000..14200c1
--- /dev/null
@@ -0,0 +1,137 @@
+Summary: rt Request Tracker
+
+Name: rt
+Version: 2.0.9pre5
+Release: 1
+Group: Applications/Web
+Packager: Jesse Vincent <jesse@bestpractical.com>
+Vendor: http://www.fsck.com/projects/rt
+Requires: perl
+Requires: mod_perl > 1.22
+Requires: perl-DBI >= 1.18
+Requires: perl-DBIx-DataSource >= 0.02
+Requires: perl-DBIx-SearchBuilder >= 0.47
+Requires: perl-HTML-Parser
+Requires: perl-MLDBM
+Requires: perl-libnet
+Requires: perl-CGI.pm >= 2.78
+Requires: perl-Params-Validate >= 0.02
+Requires: perl-HTML-Mason >= 0.896
+Requires: perl-libapreq
+Requires: perl-Apache-Session >= 1.53
+Requires: perl-MIME-tools >= 5.411
+Requires: perl-MailTools >= 1.20
+Requires: perl-Getopt-Long >= 2.24
+Requires: perl-Tie-IxHash
+Requires: perl-TimeDate
+Requires: perl-Time-HiRes
+Requires: perl-Text-Wrapper
+Requires: perl-Text-Template
+Requires: perl-File-Spec >= 0.8
+Requires: perl-FreezeThaw
+Requires: perl-Storable
+Requires: perl-File-Temp
+Requires: perl-Log-Dispatch >= 1.6                     
+
+Source: http://www.fsck.com/pub/rt/release/%{name}.tar.gz
+Copyright: GPL 
+BuildRoot: /var/tmp/rt-root
+
+%description
+RT is an industrial-grade ticketing system. It lets a group
+of people intelligently and efficiently manage requests
+submitted by a community of users. RT is used by systems
+administrators, customer support staffs, NOCs, developers
+and even marketing departments at over a thousand sites
+around the world. 
+
+%prep
+groupadd rt || true
+%setup -q -n %{name}
+
+%build
+
+%install
+
+if [ x$RPM_BUILD_ROOT != x ]; then
+rm -rf $RPM_BUILD_ROOT
+fi
+
+#
+# Perform all the non-site specfic steps whilst building the package
+#
+make dirs libs-install html-install bin-install  DESTDIR=$RPM_BUILD_ROOT
+#
+# fixperms needs these, so make fake empty files
+touch $RPM_BUILD_ROOT/opt/rt2/etc/insertdata $RPM_BUILD_ROOT/opt/rt2/etc/config.pm
+make fixperms insert-install WEB_USER=www DESTDIR=$RPM_BUILD_ROOT
+
+#
+# Copy in the files needed again after install
+#
+mkdir -p $RPM_BUILD_ROOT/opt/rt2/postinstall/bin
+cp -rp Makefile etc tools $RPM_BUILD_ROOT/opt/rt2/postinstall
+cp -rp bin/initacls.* $RPM_BUILD_ROOT/opt/rt2/postinstall/bin
+
+# logging in /var/log/rt2
+mkdir -p $RPM_BUILD_ROOT/var/log/rt2
+chown www $RPM_BUILD_ROOT/var/log/rt2
+chgrp rt $RPM_BUILD_ROOT/var/log/rt2
+chmod ug=rwx,o= $RPM_BUILD_ROOT/var/log/rt2
+
+%clean
+if [ x$RPM_BUILD_ROOT != x ]; then
+rm -rf $RPM_BUILD_ROOT
+fi
+
+#
+# A new rt groups is required
+#
+%pre
+groupadd rt || true
+
+#
+# Show the user the site specific steps required after install
+#
+%post
+cat <<EOF
+-----------------------------------------------------------------------
+rt2 installation is complete. Now create the rt2 database by running:
+-----------------------------------------------------------------------
+
+# cd /opt/rt2/postinstall
+# make config-replace initialize.mysql insert RT_LOG_PATH=/var/log/rt2 DB_RT_PASS=new_rt_user_password
+
+Choose your own new_rt_user_password. You will need the mysql root password.
+You can try Pg or Oracle instead of mysql - untested.
+
+Review and configure your site specific details in /opt/rt2/etc/config.pm
+EOF
+
+%preun
+
+%files
+%dir /opt/rt2
+/opt/rt2/bin
+/opt/rt2/WebRT
+/opt/rt2/lib
+/opt/rt2/local
+/opt/rt2/man
+/opt/rt2/postinstall
+%dir /opt/rt2/etc
+/opt/rt2/etc/insertdata
+%config /opt/rt2/etc/config.pm
+%dir /var/log/rt2
+
+%changelog
+* Mon Sep 24 2001 Jesse Vincent <jesse@bestpractical.com>
+  Switch to rt DESTDIR support
+* Fri Sep 14 2001 Cris Bailiff <c.bailiff@devsecure.com>
+  Fix permissions on created /var/log/rt2 and roll in 2.0.7
+* Tue Sep 4 2001 Cris Bailiff <c.bailiff@devsecure.com>
+- created initial spec file
+* Tue Sep 4 2001 Cris Bailiff <c.bailiff@devsecure.com>
+- created initial spec file
+* Tue Sep 4 2001 Cris Bailiff <c.bailiff@devsecure.com>
+- created initial spec file
diff --git a/rt/etc/schema.Oracle b/rt/etc/schema.Oracle
new file mode 100644 (file)
index 0000000..0c14cb3
--- /dev/null
@@ -0,0 +1,287 @@
+CREATE SEQUENCE KEYWORDSELECTS_seq;
+CREATE TABLE KeywordSelects (
+       id              NUMBER(11, 0) PRIMARY KEY,
+       Name            VARCHAR2(255),
+       Keyword         NUMBER(11, 0),
+       Single          NUMBER(11, 0),
+       Depth           NUMBER(11, 0) DEFAULT 0,
+       ObjectType      VARCHAR2(32) NOT NULL,
+       ObjectField     VARCHAR2(32),
+       ObjectValue     VARCHAR2(255),
+       Disabled                NUMBER(11, 0) DEFAULT 0
+);
+
+CREATE INDEX KeywordSelects1 ON KeywordSelects (Keyword);
+CREATE INDEX KeywordSelects2 ON 
+       KeywordSelects(ObjectType, ObjectField, ObjectValue);
+
+
+CREATE SEQUENCE ATTACHMENTS_seq;
+CREATE TABLE Attachments (
+       id              NUMBER(11,0) PRIMARY KEY,
+       TransactionId   NUMBER(11,0) NOT NULL,
+       Parent          NUMBER(11,0),           
+       MessageId       VARCHAR2(160),
+       Subject         VARCHAR2(255),
+       Filename        VARCHAR2(255),
+       ContentType     VARCHAR2(80),
+       ContentEncoding         VARCHAR2(80),
+       Content         CLOB,
+       Headers         CLOB,
+       Creator         NUMBER(11,0),
+       Created         DATE,
+       Disabled        NUMBER(11,0) DEFAULT 0
+);
+
+CREATE SEQUENCE QUEUES_seq;
+CREATE TABLE Queues (
+       id                      NUMBER(11, 0) PRIMARY KEY,
+       Name                    VARCHAR2(40) NOT NULL UNIQUE,
+       Description             VARCHAR2(120),
+       CorrespondAddress       VARCHAR2(40),
+       CommentAddress          VARCHAR2(40),
+       InitialPriority         NUMBER(11, 0),          
+       FinalPriority           NUMBER(11, 0),
+       DefaultDueIn            NUMBER(11, 0),
+       Creator                 NUMBER(11, 0),
+       Created                 DATE,
+       LastUpdatedBy           NUMBER(11, 0),
+       LastUpdated             DATE,
+       Disabled                NUMBER(11,0) DEFAULT 0
+);
+
+CREATE SEQUENCE LINKS_seq;
+CREATE TABLE Links (
+       id              NUMBER(11,0) PRIMARY KEY,
+       Base            VARCHAR2(255),
+       Target          VARCHAR2(255),
+       Type            VARCHAR2(20) NOT NULL,
+       LocalTarget     NUMBER(11,0),
+       LocalBase       NUMBER(11,0),
+       LastUpdatedBy   NUMBER(11,0),
+       LastUpdated     DATE,
+       Creator         NUMBER(11,0),
+       Created         DATE
+);
+
+CREATE UNIQUE INDEX Links1 ON Links (Base, Target, Type);
+
+
+
+CREATE SEQUENCE GROUPS_seq;
+CREATE TABLE Groups (
+       id              NUMBER(11,0) PRIMARY KEY,
+       Name            VARCHAR2(16) UNIQUE,
+       Description     VARCHAR(64),
+       Pseudo          NUMBER(11,0) DEFAULT 0
+);
+
+CREATE SEQUENCE WATCHERS_seq;
+CREATE TABLE Watchers (
+       id              NUMBER(11,0) PRIMARY KEY,
+       Type            VARCHAR2(16),   
+       Scope           VARCHAR2(16),   
+       Value           NUMBER(11,0),   
+       Email           VARCHAR2(255),  
+       Quiet           NUMBER(11,0),   
+       Owner           NUMBER(11,0),   
+       Creator         NUMBER(11,0),
+       Created         DATE,
+       LastUpdatedBy   NUMBER(11,0),
+       LastUpdated     DATE
+);
+
+
+
+CREATE SEQUENCE SCRIPCONDITIONS_seq;
+CREATE TABLE ScripConditions (
+       id                      NUMBER(11, 0) PRIMARY KEY,
+       Name                    VARCHAR2(255),
+       Description             VARCHAR2(255),
+       ExecModule              VARCHAR2(60),
+       Argument                VARCHAR2(255),
+       ApplicableTransTypes    VARCHAR2(60),
+       Creator                 NUMBER(11, 0),
+       Created                 DATE,
+       LastUpdatedBy           NUMBER(11, 0),
+       LastUpdated             DATE
+);
+
+
+CREATE SEQUENCE TRANSACTIONS_seq;
+CREATE TABLE Transactions (
+       id                      NUMBER(11,0) PRIMARY KEY,
+       EffectiveTicket         NUMBER(11,0),
+       Ticket                  NUMBER(11,0),
+       TimeTaken               NUMBER(11,0),
+       Type                    VARCHAR2(20),
+       Field                   VARCHAR2(40),
+       OldValue                VARCHAR2(255),
+       NewValue                VARCHAR2(255),
+       Data                    VARCHAR2(100),
+       Creator                 NUMBER(11,0),
+       Created                 DATE,
+       Disabled                NUMBER(11,0) DEFAULT 0
+);
+
+CREATE SEQUENCE SCRIPS_seq;
+CREATE TABLE Scrips (
+       id              NUMBER(11,0) PRIMARY KEY,       
+       ScripCondition  NUMBER(11,0),
+       ScripAction     NUMBER(11,0),
+       Stage           VARCHAR2(32),
+       Queue           NUMBER(11,0),
+       Template        NUMBER(11,0),
+       Creator         NUMBER(11,0),
+       Created         DATE,
+       LastUpdatedBy   NUMBER(11,0),
+       LastUpdated     DATE  
+);
+
+
+
+
+CREATE SEQUENCE ACL_seq;
+CREATE TABLE ACL (
+       id              NUMBER(11,0) PRIMARY KEY,
+       PrincipalId     NUMBER(11,0),
+       PrincipalType   VARCHAR2(25),
+       RightName       VARCHAR2(25),
+       RightScope      VARCHAR2(25),
+       RightAppliesTo  NUMBER(11,0)
+);
+
+CREATE SEQUENCE GROUPMEMBERS_seq;
+CREATE TABLE GroupMembers (
+       id              NUMBER(11,0) PRIMARY KEY,
+       GroupId         NUMBER(11,0),
+       UserId          NUMBER(11,0) 
+);
+
+CREATE UNIQUE INDEX GroupMembers1 ON GroupMembers (GroupId, UserId);
+
+
+CREATE SEQUENCE OBJECTKEYWORDS_seq;
+CREATE TABLE ObjectKeywords (
+  id           NUMBER(11,0)  PRIMARY KEY,
+  Keyword      NUMBER(11,0) NOT NULL,
+  KeywordSelect NUMBER(11,0)  NOT NULL,
+  ObjectType   VARCHAR2(32) NOT NULL,
+  ObjectId     NUMBER(11,0) NOT NULL
+);
+
+CREATE UNIQUE INDEX ObjectKeywords1 ON ObjectKeywords
+       (ObjectId, ObjectType, KeywordSelect, Keyword);
+CREATE INDEX ObjectKeywords3 ON ObjectKeywords (Keyword);
+
+CREATE SEQUENCE KEYWORDS_seq;
+CREATE TABLE Keywords (
+       id              NUMBER(11, 0) PRIMARY KEY,
+       Name            VARCHAR2(255) NOT NULL,
+       Description     VARCHAR2(255),
+       Parent          NUMBER(11, 0),
+       Disabled                NUMBER(11, 0) DEFAULT 0
+);
+
+CREATE UNIQUE INDEX Keywords1 ON Keywords (Name, Parent);
+CREATE INDEX Keywords3 ON Keywords (Parent);
+
+CREATE SEQUENCE USERS_seq;
+CREATE TABLE Users (
+       id                      NUMBER(11,0) PRIMARY KEY,
+       Name                    VARCHAR2(120) NOT NULL UNIQUE,
+       Password                VARCHAR2(40),
+       Comments                CLOB,
+       Signature               CLOB,
+       EmailAddress            VARCHAR2(120),
+       FreeFormContactInfo     CLOB,
+       Organization            VARCHAR2(200),
+       Privileged              NUMBER(11,0),
+       RealName                VARCHAR2(120),
+       NickName                VARCHAR2(16),
+       Lang                    VARCHAR2(16),
+       EmailEncoding           VARCHAR2(16),
+       WebEncoding             VARCHAR2(16),
+       ExternalContactInfoId   VARCHAR2(100),
+       ContactInfoSystem       VARCHAR2(30),
+       ExternalAuthId          VARCHAR2(100),
+       AuthSystem              VARCHAR2(30),
+       Gecos                   VARCHAR2(16),
+       HomePhone               VARCHAR2(30),
+       WorkPhone               VARCHAR2(30),
+       MobilePhone             VARCHAR2(30),
+       PagerPhone              VARCHAR2(30),
+       Address1                VARCHAR2(200),
+       Address2                VARCHAR2(200),
+       City                    VARCHAR2(100),
+       State                   VARCHAR2(100),
+       Zip                     VARCHAR2(16),
+       Country                 VARCHAR2(50),
+       Creator                 NUMBER(11,0),
+       Created                 DATE,
+       LastUpdatedBy           NUMBER(11,0),
+       LastUpdated             DATE,
+       Disabled                        NUMBER(11,0) DEFAULT 0
+);
+
+
+
+
+CREATE SEQUENCE TICKETS_seq;
+CREATE TABLE Tickets (
+       id                      NUMBER(11, 0) PRIMARY KEY,
+       EffectiveId             NUMBER(11, 0),
+       Queue                   NUMBER(11,0),
+       Type                    VARCHAR2(16),           
+       IssueStatement          NUMBER(11,0),   
+       Resolution              NUMBER(11,0),           
+       Owner                   NUMBER(11,0),           
+       Subject                 VARCHAR2(200) DEFAULT '', 
+       InitialPriority         NUMBER(11,0) DEFAULT 0,
+       FinalPriority           NUMBER(11,0) DEFAULT 0,
+       Priority                NUMBER(11,0) DEFAULT 0,
+       Status                  VARCHAR2(10),           
+       TimeWorked              NUMBER(11,0) DEFAULT 0,
+       TimeLeft                NUMBER(11,0) DEFAULT 0,
+       Told                    DATE,
+       Starts                  DATE,
+       Started                 DATE,
+       Due                     DATE,
+       Resolved                DATE,
+       LastUpdatedBy           NUMBER(11,0),
+       LastUpdated             DATE,
+       Creator                 NUMBER(11,0),
+       Created                 DATE,
+       Disabled                NUMBER(11,0) DEFAULT 0
+);
+
+CREATE SEQUENCE SCRIPACTIONS_seq;
+CREATE TABLE ScripActions (
+  id           NUMBER(11,0) PRIMARY KEY,
+  Name         VARCHAR2(255),
+  Description  VARCHAR2(255),
+  ExecModule   VARCHAR2(60),
+  Argument     VARCHAR2(255),
+  Creator      NUMBER(11,0),
+  Created      DATE,
+  LastUpdatedBy        NUMBER(11,0),
+  LastUpdated  DATE
+);
+
+
+CREATE SEQUENCE TEMPLATES_seq;
+CREATE TABLE Templates (
+       id              NUMBER(11,0) PRIMARY KEY,
+       Queue           NUMBER(11,0) DEFAULT 0 NOT NULL,
+       Name            VARCHAR2(40) NOT NULL UNIQUE,
+       Description     VARCHAR2(120),
+       Type            VARCHAR2(16),
+       Language        VARCHAR2(16), 
+       TranslationOf   NUMBER(11,0),
+       Content         CLOB,
+       LastUpdated     DATE,
+       LastUpdatedBy   NUMBER(11,0),
+       Creator         NUMBER(11,0),
+       Created         DATE
+);
+
diff --git a/rt/etc/schema.Pg b/rt/etc/schema.Pg
new file mode 100755 (executable)
index 0000000..21d981b
--- /dev/null
@@ -0,0 +1,267 @@
+CREATE TABLE KeywordSelects (
+  id serial NOT NULL  ,
+  Name varchar(255)   ,
+  Keyword integer   ,
+  Single integer   ,
+  Depth integer NOT NULL DEFAULT 0 ,
+  ObjectType varchar(32) NOT NULL  ,
+  ObjectField varchar(32)   ,
+  ObjectValue varchar(255)   ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX KeywordSelects1 ON KeywordSelects (Keyword);
+CREATE INDEX KeywordSelects2 ON KeywordSelects (ObjectType, ObjectField, ObjectValue);
+CREATE TABLE Attachments (
+  id serial NOT NULL  ,
+  TransactionId integer NOT NULL  ,
+  Parent integer   ,
+  MessageId varchar(160)   ,
+  Subject varchar(255)   ,
+  Filename varchar(255)   ,
+  ContentType varchar(80)   ,
+  ContentEncoding varchar(80)   ,
+  Content TEXT   ,
+  Headers TEXT   ,
+  Creator integer   ,
+  Created timestamp   ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Attachments1 ON Attachments (Parent);
+CREATE INDEX Attachments2 ON Attachments (TransactionId);
+CREATE INDEX Attachments3 ON Attachments (Parent, TransactionId);
+CREATE TABLE Queues (
+  id serial NOT NULL  ,
+  Name varchar(120) NOT NULL  ,
+  Description varchar(120)   ,
+  CorrespondAddress varchar(120)   ,
+  CommentAddress varchar(120)   ,
+  InitialPriority integer   ,
+  FinalPriority integer   ,
+  DefaultDueIn integer   ,
+  Creator integer   ,
+  Created timestamp   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Queues1 ON Queues (Name);
+CREATE TABLE Links (
+  id serial NOT NULL  ,
+  Base varchar(240)   ,
+  Target varchar(240)   ,
+  Type varchar(20) NOT NULL  ,
+  LocalTarget integer   ,
+  LocalBase integer   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  Creator integer   ,
+  Created timestamp   ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Links1 ON Links (Base, Target, Type);
+CREATE TABLE Groups (
+  id serial NOT NULL  ,
+  Name varchar(16)   ,
+  Description varchar(64)   ,
+  Pseudo integer NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Groups1 ON Groups (Name);
+CREATE TABLE Watchers (
+  id serial NOT NULL  ,
+  Type varchar(16)   ,
+  Scope varchar(16)   ,
+  Value integer   ,
+  Email varchar(255)   ,
+  Quiet integer   ,
+  Owner integer   ,
+  Creator integer   ,
+  Created timestamp   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Watchers1 ON Watchers (Scope, Value, Type, Owner);
+CREATE TABLE ScripConditions (
+  id serial NOT NULL  ,
+  Name varchar(255)   ,
+  Description varchar(255)   ,
+  ExecModule varchar(60)   ,
+  Argument varchar(255)   ,
+  ApplicableTransTypes varchar(60)   ,
+  Creator integer   ,
+  Created timestamp   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  PRIMARY KEY (id)
+);
+CREATE TABLE Transactions (
+  id serial NOT NULL  ,
+  EffectiveTicket integer   ,
+  Ticket integer   ,
+  TimeTaken integer   ,
+  Type varchar(20)   ,
+  Field varchar(40)   ,
+  OldValue varchar(255)   ,
+  NewValue varchar(255)   ,
+  Data varchar(100)   ,
+  Creator integer   ,
+  Created timestamp   ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Transactions1 ON Transactions (Ticket);
+CREATE INDEX Transactions2 ON Transactions (EffectiveTicket);
+CREATE TABLE Scrips (
+  id serial NOT NULL  ,
+  ScripCondition integer   ,
+  ScripAction integer   ,
+  Stage varchar(32)   ,
+  Queue integer   ,
+  Template integer   ,
+  Creator integer   ,
+  Created timestamp   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  PRIMARY KEY (id)
+);
+CREATE TABLE ACL (
+  id serial NOT NULL  ,
+  PrincipalId integer   ,
+  PrincipalType varchar(25)   ,
+  RightName varchar(25)   ,
+  RightScope varchar(25)   ,
+  RightAppliesTo integer   ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX ACL1 ON ACL (RightScope, PrincipalId);
+CREATE INDEX ACL2 ON ACL (RightScope, RightAppliesTo, RightName, PrincipalType, PrincipalId);
+CREATE TABLE GroupMembers (
+  id serial NOT NULL  ,
+  GroupId integer   ,
+  UserId integer   ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX GroupMembers1 ON GroupMembers (GroupId, UserId);
+CREATE TABLE ObjectKeywords (
+  id serial NOT NULL  ,
+  Keyword integer NOT NULL  ,
+  KeywordSelect integer NOT NULL  ,
+  ObjectType varchar(32) NOT NULL  ,
+  ObjectId integer NOT NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX ObjectKeywords1 ON ObjectKeywords (ObjectId, ObjectType, KeywordSelect, Keyword);
+CREATE INDEX ObjectKeywords2 ON ObjectKeywords (ObjectId, ObjectType);
+CREATE INDEX ObjectKeywords3 ON ObjectKeywords (Keyword);
+CREATE TABLE Keywords (
+  id serial NOT NULL  ,
+  Name varchar(255) NOT NULL  ,
+  Description varchar(255)   ,
+  Parent integer   ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Keywords1 ON Keywords (Name, Parent);
+CREATE INDEX Keywords2 ON Keywords (Name);
+CREATE INDEX Keywords3 ON Keywords (Parent);
+CREATE TABLE Users (
+  id serial NOT NULL  ,
+  Name varchar(120) NOT NULL  ,
+  Password varchar(40)   ,
+  Comments TEXT   ,
+  Signature TEXT   ,
+  EmailAddress varchar(120)   ,
+  FreeformContactInfo TEXT   ,
+  Organization varchar(200)   ,
+  Privileged integer   ,
+  RealName varchar(120)   ,
+  Nickname varchar(16)   ,
+  Lang varchar(16)   ,
+  EmailEncoding varchar(16)   ,
+  WebEncoding varchar(16)   ,
+  ExternalContactInfoId varchar(100)   ,
+  ContactInfoSystem varchar(30)   ,
+  ExternalAuthId varchar(100)   ,
+  AuthSystem varchar(30)   ,
+  Gecos varchar(16)   ,
+  HomePhone varchar(30)   ,
+  WorkPhone varchar(30)   ,
+  MobilePhone varchar(30)   ,
+  PagerPhone varchar(30)   ,
+  Address1 varchar(200)   ,
+  Address2 varchar(200)   ,
+  City varchar(100)   ,
+  State varchar(100)   ,
+  Zip varchar(16)   ,
+  Country varchar(50)   ,
+  Creator integer   ,
+  Created timestamp   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Users1 ON Users (Name);
+CREATE INDEX Users3 ON Users (id, EmailAddress);
+CREATE INDEX Users4 ON Users (EmailAddress);
+CREATE TABLE Tickets (
+  id serial NOT NULL  ,
+  EffectiveId integer   ,
+  Queue integer   ,
+  Type varchar(16)   ,
+  IssueStatement integer   ,
+  Resolution integer   ,
+  Owner integer   ,
+  Subject varchar(200)  DEFAULT '[no subject]' ,
+  InitialPriority integer   ,
+  FinalPriority integer   ,
+  Priority integer   ,
+  Status varchar(10)   ,
+  TimeWorked integer   ,
+  TimeLeft integer   ,
+  Told timestamp   ,
+  Starts timestamp   ,
+  Started timestamp   ,
+  Due timestamp   ,
+  Resolved timestamp   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  Creator integer   ,
+  Created timestamp   ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Tickets1 ON Tickets (Queue, Status);
+CREATE INDEX Tickets2 ON Tickets (Owner);
+CREATE INDEX Tickets3 ON Tickets (EffectiveId);
+CREATE INDEX Tickets4 ON Tickets (id, Status);
+CREATE INDEX Tickets5 ON Tickets (id, EffectiveId);
+CREATE TABLE ScripActions (
+  id serial NOT NULL  ,
+  Name varchar(255)   ,
+  Description varchar(255)   ,
+  ExecModule varchar(60)   ,
+  Argument varchar(255)   ,
+  Creator integer   ,
+  Created timestamp   ,
+  LastUpdatedBy integer   ,
+  LastUpdated timestamp   ,
+  PRIMARY KEY (id)
+);
+CREATE TABLE Templates (
+  id serial NOT NULL  ,
+  Queue integer NOT NULL DEFAULT 0 ,
+  Name varchar(40) NOT NULL  ,
+  Description varchar(120)   ,
+  Type varchar(16)   ,
+  Language varchar(16)   ,
+  TranslationOf integer   ,
+  Content TEXT   ,
+  LastUpdated timestamp   ,
+  LastUpdatedBy integer   ,
+  Creator integer   ,
+  Created timestamp   ,
+  PRIMARY KEY (id)
+);
diff --git a/rt/etc/schema.mysql b/rt/etc/schema.mysql
new file mode 100755 (executable)
index 0000000..7e715c2
--- /dev/null
@@ -0,0 +1,267 @@
+CREATE TABLE KeywordSelects (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Name varchar(255) NULL  ,
+  Keyword integer NULL  ,
+  Single integer NULL  ,
+  Depth integer NOT NULL DEFAULT 0 ,
+  ObjectType varchar(32) NOT NULL  ,
+  ObjectField varchar(32) NULL  ,
+  ObjectValue varchar(255) NULL  ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX KeywordSelects1 ON KeywordSelects (Keyword);
+CREATE INDEX KeywordSelects2 ON KeywordSelects (ObjectType, ObjectField, ObjectValue);
+CREATE TABLE Attachments (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  TransactionId integer NOT NULL  ,
+  Parent integer NULL  ,
+  MessageId varchar(160) NULL  ,
+  Subject varchar(255) NULL  ,
+  Filename varchar(255) NULL  ,
+  ContentType varchar(80) NULL  ,
+  ContentEncoding varchar(80) NULL  ,
+  Content LONGTEXT NULL  ,
+  Headers LONGTEXT NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Attachments1 ON Attachments (Parent);
+CREATE INDEX Attachments2 ON Attachments (TransactionId);
+CREATE INDEX Attachments3 ON Attachments (Parent, TransactionId);
+CREATE TABLE Queues (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Name varchar(120) NOT NULL  ,
+  Description varchar(120) NULL  ,
+  CorrespondAddress varchar(120) NULL  ,
+  CommentAddress varchar(120) NULL  ,
+  InitialPriority integer NULL  ,
+  FinalPriority integer NULL  ,
+  DefaultDueIn integer NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Queues1 ON Queues (Name);
+CREATE TABLE Links (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Base varchar(240) NULL  ,
+  Target varchar(240) NULL  ,
+  Type varchar(20) NOT NULL  ,
+  LocalTarget integer NULL  ,
+  LocalBase integer NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Links1 ON Links (Base, Target, Type);
+CREATE TABLE Groups (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Name varchar(16) NULL  ,
+  Description varchar(64) NULL  ,
+  Pseudo integer NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Groups1 ON Groups (Name);
+CREATE TABLE Watchers (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Type varchar(16) NULL  ,
+  Scope varchar(16) NULL  ,
+  Value integer NULL  ,
+  Email varchar(255) NULL  ,
+  Quiet integer NULL  ,
+  Owner integer NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Watchers1 ON Watchers (Scope, Value, Type, Owner);
+CREATE TABLE ScripConditions (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Name varchar(255) NULL  ,
+  Description varchar(255) NULL  ,
+  ExecModule varchar(60) NULL  ,
+  Argument varchar(255) NULL  ,
+  ApplicableTransTypes varchar(60) NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE TABLE Transactions (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  EffectiveTicket integer NULL  ,
+  Ticket integer NULL  ,
+  TimeTaken integer NULL  ,
+  Type varchar(20) NULL  ,
+  Field varchar(40) NULL  ,
+  OldValue varchar(255) NULL  ,
+  NewValue varchar(255) NULL  ,
+  Data varchar(100) NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Transactions1 ON Transactions (Ticket);
+CREATE INDEX Transactions2 ON Transactions (EffectiveTicket);
+CREATE TABLE Scrips (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  ScripCondition integer NULL  ,
+  ScripAction integer NULL  ,
+  Stage varchar(32) NULL  ,
+  Queue integer NULL  ,
+  Template integer NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE TABLE ACL (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  PrincipalId integer NULL  ,
+  PrincipalType varchar(25) NULL  ,
+  RightName varchar(25) NULL  ,
+  RightScope varchar(25) NULL  ,
+  RightAppliesTo integer NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX ACL1 ON ACL (RightScope, PrincipalId);
+CREATE INDEX ACL2 ON ACL (RightScope, RightAppliesTo, RightName, PrincipalType, PrincipalId);
+CREATE TABLE GroupMembers (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  GroupId integer NULL  ,
+  UserId integer NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX GroupMembers1 ON GroupMembers (GroupId, UserId);
+CREATE TABLE ObjectKeywords (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Keyword integer NOT NULL  ,
+  KeywordSelect integer NOT NULL  ,
+  ObjectType varchar(32) NOT NULL  ,
+  ObjectId integer NOT NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX ObjectKeywords1 ON ObjectKeywords (ObjectId, ObjectType, KeywordSelect, Keyword);
+CREATE INDEX ObjectKeywords2 ON ObjectKeywords (ObjectId, ObjectType);
+CREATE INDEX ObjectKeywords3 ON ObjectKeywords (Keyword);
+CREATE TABLE Keywords (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Name varchar(255) NOT NULL  ,
+  Description varchar(255) NULL  ,
+  Parent integer NULL  ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Keywords1 ON Keywords (Name, Parent);
+CREATE INDEX Keywords2 ON Keywords (Name);
+CREATE INDEX Keywords3 ON Keywords (Parent);
+CREATE TABLE Users (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Name varchar(120) NOT NULL  ,
+  Password varchar(40) NULL  ,
+  Comments blob NULL  ,
+  Signature blob NULL  ,
+  EmailAddress varchar(120) NULL  ,
+  FreeformContactInfo blob NULL  ,
+  Organization varchar(200) NULL  ,
+  Privileged integer NULL  ,
+  RealName varchar(120) NULL  ,
+  Nickname varchar(16) NULL  ,
+  Lang varchar(16) NULL  ,
+  EmailEncoding varchar(16) NULL  ,
+  WebEncoding varchar(16) NULL  ,
+  ExternalContactInfoId varchar(100) NULL  ,
+  ContactInfoSystem varchar(30) NULL  ,
+  ExternalAuthId varchar(100) NULL  ,
+  AuthSystem varchar(30) NULL  ,
+  Gecos varchar(16) NULL  ,
+  HomePhone varchar(30) NULL  ,
+  WorkPhone varchar(30) NULL  ,
+  MobilePhone varchar(30) NULL  ,
+  PagerPhone varchar(30) NULL  ,
+  Address1 varchar(200) NULL  ,
+  Address2 varchar(200) NULL  ,
+  City varchar(100) NULL  ,
+  State varchar(100) NULL  ,
+  Zip varchar(16) NULL  ,
+  Country varchar(50) NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX Users1 ON Users (Name);
+CREATE INDEX Users3 ON Users (id, EmailAddress);
+CREATE INDEX Users4 ON Users (EmailAddress);
+CREATE TABLE Tickets (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  EffectiveId integer NULL  ,
+  Queue integer NULL  ,
+  Type varchar(16) NULL  ,
+  IssueStatement integer NULL  ,
+  Resolution integer NULL  ,
+  Owner integer NULL  ,
+  Subject varchar(200) NULL DEFAULT '[no subject]' ,
+  InitialPriority integer NULL  ,
+  FinalPriority integer NULL  ,
+  Priority integer NULL  ,
+  Status varchar(10) NULL  ,
+  TimeWorked integer NULL  ,
+  TimeLeft integer NULL  ,
+  Told DATETIME NULL  ,
+  Starts DATETIME NULL  ,
+  Started DATETIME NULL  ,
+  Due DATETIME NULL  ,
+  Resolved DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  Disabled int2 NOT NULL DEFAULT 0 ,
+  PRIMARY KEY (id)
+);
+CREATE INDEX Tickets1 ON Tickets (Queue, Status);
+CREATE INDEX Tickets2 ON Tickets (Owner);
+CREATE INDEX Tickets3 ON Tickets (EffectiveId);
+CREATE INDEX Tickets4 ON Tickets (id, Status);
+CREATE INDEX Tickets5 ON Tickets (id, EffectiveId);
+CREATE TABLE ScripActions (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Name varchar(255) NULL  ,
+  Description varchar(255) NULL  ,
+  ExecModule varchar(60) NULL  ,
+  Argument varchar(255) NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  LastUpdated DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
+CREATE TABLE Templates (
+  id INTEGER NOT NULL  AUTO_INCREMENT,
+  Queue integer NOT NULL DEFAULT 0 ,
+  Name varchar(40) NOT NULL  ,
+  Description varchar(120) NULL  ,
+  Type varchar(16) NULL  ,
+  Language varchar(16) NULL  ,
+  TranslationOf integer NULL  ,
+  Content blob NULL  ,
+  LastUpdated DATETIME NULL  ,
+  LastUpdatedBy integer NULL  ,
+  Creator integer NULL  ,
+  Created DATETIME NULL  ,
+  PRIMARY KEY (id)
+);
diff --git a/rt/etc/schema.pm b/rt/etc/schema.pm
new file mode 100644 (file)
index 0000000..44e143e
--- /dev/null
@@ -0,0 +1,349 @@
+#   column, type, nullability, length, default, database-local
+
+my $gratuitous = {
+
+'Groups' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'Name', 'varchar', 'NULL', '16', '', '',
+    'Description', 'varchar', 'NULL', '64', '', '',
+    'Pseudo', 'integer', '', '', '0', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ ['Name'] ],
+  'index' => [  ],
+},
+
+'ACL' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'PrincipalId', 'integer', 'NULL', '', '', '',
+    'PrincipalType', 'varchar', 'NULL', '25', '', '',
+    'RightName', 'varchar', 'NULL', '25', '', '',
+    'RightScope', 'varchar', 'NULL', '25', '', '',
+    'RightAppliesTo', 'integer', 'NULL', '', '', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [  ],
+  'index' => [ ['RightScope', 'PrincipalId'], 
+              ['RightScope','RightAppliesTo','RightName','PrincipalType','PrincipalId'] ],
+},
+
+'Watchers' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'Type', 'varchar', 'NULL', '16', '', '',
+    'Scope', 'varchar', 'NULL', '16', '', '',
+    'Value', 'integer', 'NULL', '', '', '',
+    'Email', 'varchar', 'NULL', '255', '', '',
+    'Quiet', 'integer', 'NULL', '', '', '',
+    'Owner', 'integer', 'NULL', '', '', '',
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+    'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+    'LastUpdated', 'timestamp', 'NULL', '', '', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [  ],
+  'index' => [ ['Scope','Value','Type','Owner'] ],
+},
+
+'Links' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'Base', 'varchar', 'NULL', '240', '', '',
+    'Target', 'varchar', 'NULL', '240', '', '',
+    'Type', 'varchar', '', '20', '', '',
+    'LocalTarget', 'integer', 'NULL', '', '', '',
+    'LocalBase', 'integer', 'NULL', '', '', '',
+    'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+    'LastUpdated', 'timestamp', 'NULL', '', '', '',
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ ['Base', 'Target', 'Type'] ],
+  'index' => [  ],
+},
+
+'Users' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'Name', 'varchar', '', '120', '', '',
+    'Password', 'varchar', 'NULL', '40', '', '',
+    'Comments', 'blob', 'NULL', '', '', '',
+    'Signature', 'blob', 'NULL', '', '', '',
+    'EmailAddress', 'varchar', 'NULL', '120', '', '',
+    'FreeformContactInfo', 'blob', 'NULL', '', '', '',
+    'Organization', 'varchar', 'NULL', '200', '', '',
+    'Privileged', 'integer', 'NULL', '', '', '',
+    'RealName', 'varchar', 'NULL', '120', '', '',
+    'Nickname', 'varchar', 'NULL', '16', '', '',
+    'Lang', 'varchar', 'NULL', '16', '', '',
+    'EmailEncoding', 'varchar', 'NULL', '16', '', '',
+    'WebEncoding', 'varchar', 'NULL', '16', '', '',
+    'ExternalContactInfoId', 'varchar', 'NULL', '100', '', '',
+    'ContactInfoSystem', 'varchar', 'NULL', '30', '', '',
+    'ExternalAuthId', 'varchar', 'NULL', '100', '', '',
+    'AuthSystem', 'varchar', 'NULL', '30', '', '',
+    'Gecos', 'varchar', 'NULL', '16', '', '',
+    'HomePhone', 'varchar', 'NULL', '30', '', '',
+    'WorkPhone', 'varchar', 'NULL', '30', '', '',
+    'MobilePhone', 'varchar', 'NULL', '30', '', '',
+    'PagerPhone', 'varchar', 'NULL', '30', '', '',
+    'Address1', 'varchar', 'NULL', '200', '', '',
+    'Address2', 'varchar', 'NULL', '200', '', '',
+    'City', 'varchar', 'NULL', '100', '', '',
+    'State', 'varchar', 'NULL', '100', '', '',
+    'Zip', 'varchar', 'NULL', '16', '', '',
+    'Country', 'varchar', 'NULL', '50', '', '',
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+    'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+    'LastUpdated', 'timestamp', 'NULL', '', '', '',
+    'Disabled', 'int2', '','','0','',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ ['Name'] ],
+  'index' => [ ['Name'], 
+              ['id', 'EmailAddress'],
+              ['EmailAddress'] ],
+},
+
+'Tickets' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'EffectiveId', 'integer', 'NULL', '', '', '',
+    'Queue', 'integer', 'NULL', '', '', '',
+    'Type', 'varchar', 'NULL', '16', '', '',
+    'IssueStatement', 'integer', 'NULL', '', '', '',
+    'Resolution', 'integer', 'NULL', '', '', '',
+    'Owner', 'integer', 'NULL', '', '', '',
+    'Subject', 'varchar', 'NULL', '200', '[no subject]', '',
+    'InitialPriority', 'integer', 'NULL', '', '', '',
+    'FinalPriority', 'integer', 'NULL', '', '', '',
+    'Priority', 'integer', 'NULL', '', '', '',
+    'Status', 'varchar', 'NULL', '10', '', '',
+    'TimeWorked', 'integer', 'NULL', '', '', '',
+    'TimeLeft', 'integer', 'NULL', '', '', '',
+    'Told', 'timestamp', 'NULL', '', '', '',
+    'Starts', 'timestamp', 'NULL', '', '', '',
+    'Started', 'timestamp', 'NULL', '', '', '',
+    'Due', 'timestamp', 'NULL', '', '', '',
+    'Resolved', 'timestamp', 'NULL', '', '', '',
+    'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+    'LastUpdated', 'timestamp', 'NULL', '', '', '',
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+    'Disabled', 'int2', '','','0','',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ [] ],
+  'index' => [ ['Queue', 'Status'], 
+              ['Owner'], 
+              ['EffectiveId'], 
+              ['id', 'Status'], 
+              ['id', 'EffectiveId'] ],
+},
+
+'GroupMembers' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'GroupId', 'integer', 'NULL', '', '', '', #foreign key, Groups::id
+    'UserId', 'integer', 'NULL', '', '', '', #foreign key, Users::id
+  ],
+  'primary_key' => 'id',
+  'unique' => [ ['GroupId', 'UserId']  ],
+  'index' => [  ],
+},
+
+'Queues' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'Name', 'varchar', '', '120', '', '', #Textual 'name' for this queue
+    'Description', 'varchar', 'NULL', '120', '', '', #Textual descr. of this
+    #queue
+    'CorrespondAddress', 'varchar', 'NULL', '120', '', '',
+    'CommentAddress', 'varchar', 'NULL', '120', '', '',
+    'InitialPriority', 'integer', 'NULL', '', '', '',
+    'FinalPriority', 'integer', 'NULL', '', '', '',
+    'DefaultDueIn', 'integer', 'NULL', '', '', '',
+
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+    'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+    'LastUpdated', 'timestamp', 'NULL', '', '', '',
+    'Disabled', 'int2', '','','0','',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ ['Name'] ],
+  'index' => [  ],
+},
+
+'Transactions' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'EffectiveTicket', 'integer', 'NULL', '', '', '', 
+    'Ticket', 'integer', 'NULL', '', '', '',  #Foreign key Ticket::id
+    'TimeTaken', 'integer', 'NULL', '', '', '', #Time spent on this trans in min
+    'Type', 'varchar', 'NULL', '20', '', '',
+    'Field', 'varchar', 'NULL', '40', '', '', #If it's a "Set" transaction, what
+    #field was set.
+    'OldValue', 'varchar', 'NULL', '255', '', '', 
+    'NewValue', 'varchar', 'NULL', '255', '', '',
+    'Data', 'varchar', 'NULL', '100', '', '',
+
+
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+
+  ],
+  'primary_key' => 'id',
+  'unique' => [  ],
+  'index' => [ ['Ticket'], ['EffectiveTicket'] ],
+},
+
+'ScripActions' => {
+  'columns' => [
+               'id', 'serial', '', '', '', '',
+               'Name', 'varchar', 'NULL', '255', '', '',  # Alias
+               'Description', 'varchar', 'NULL', '255', '', '', #Textual description
+               'ExecModule', 'varchar', 'NULL', '60', '', '', #This calles RT::Action::___
+               'Argument', 'varchar', 'NULL', '255', '', '', #We can pass a single argument
+               #to the scrip. sometimes, it's who to send mail to.
+               'Creator', 'integer', 'NULL', '', '', '',
+               'Created', 'timestamp', 'NULL', '', '', '',
+               'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+               'LastUpdated', 'timestamp', 'NULL', '', '', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [  ],
+  'index' => [  ],
+},
+
+'ScripConditions' => {
+  'columns' => [
+               'id', 'serial', '', '', '', '',
+               'Name', 'varchar', 'NULL', '255', '', '',  # Alias
+               'Description', 'varchar', 'NULL', '255', '', '', #Textual description
+               'ExecModule', 'varchar', 'NULL', '60', '', '', #This calles RT::Condition::
+               'Argument', 'varchar', 'NULL', '255', '', '', #We can pass a single argument
+               #to the scrip. sometimes, it's who to send mail to.
+               'ApplicableTransTypes', 'varchar', 'NULL', '60', '', '',#Transaction types this scrip
+               # acts on. comma or / delimited is just great.
+               'Creator', 'integer', 'NULL', '', '', '',
+               'Created', 'timestamp', 'NULL', '', '', '',
+               'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+               'LastUpdated', 'timestamp', 'NULL', '', '', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [  ],
+  'index' => [  ],
+},
+'Scrips' => {
+                'columns' => [
+                              'id', 'serial', '', '', '', '',
+                              'ScripCondition', 'integer', 'NULL', '', '', '', #Foreign key ScripConditions::id
+                              'ScripAction', 'integer', 'NULL', '', '', '', #Foreign key ScripActions::id
+                              'Stage', 'varchar', 'NULL', '32','','', #What stage does this scrip
+                              #Happen in.  for now, everything is 'TransactionCreate',
+                              'Queue', 'integer', 'NULL', '', '', '', #Foreign key Queues::id
+                              'Template', 'integer', 'NULL', '', '', '', #Foreign key Templates::id
+                              
+                              'Creator', 'integer', 'NULL', '', '', '',
+                              'Created', 'timestamp', 'NULL', '', '', '',
+                              'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+                              'LastUpdated', 'timestamp', 'NULL', '', '', '',
+                             ],
+                'primary_key' => 'id',
+                'unique' => [  ],
+                'index' => [  ],
+},
+
+'Attachments' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'TransactionId', 'integer', '', '', '', '', #Foreign key Transactions::Id
+    'Parent', 'integer', 'NULL', '', '', '', # Attachments::Id
+    'MessageId', 'varchar', 'NULL', '160', '', '', #RFC822 messageid, if any
+    'Subject', 'varchar', 'NULL', '255', '', '', 
+    'Filename', 'varchar', 'NULL', '255', '', '',
+    'ContentType', 'varchar', 'NULL', '80', '', '',
+    'ContentEncoding', 'varchar', 'NULL', '80', '', '',
+    'Content', 'long varbinary', 'NULL', '', '', '',
+    'Headers', 'long varbinary', 'NULL', '', '', '',
+
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+
+  ],
+  'primary_key' => 'id',
+  'unique' => [  ],
+  'index' => [ ['Parent'], ['TransactionId'], ['Parent', 'TransactionId'] ],
+},
+
+'Templates' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'Queue', 'integer', 'NOT NULL', '', '0', '',
+    'Name', 'varchar', '', '40', '', '',
+    'Description', 'varchar', 'NULL', '120', '', '',
+    'Type', 'varchar', 'NULL', '16', '','',
+    'Language', 'varchar', 'NULL', '16', '', '',
+    'TranslationOf', 'integer', 'NULL', '', '', '',
+    'Content', 'blob', 'NULL', '', '', '',
+    'LastUpdated', 'timestamp', 'NULL', '', '', '',
+    'LastUpdatedBy', 'integer', 'NULL', '', '', '',
+    'Creator', 'integer', 'NULL', '', '', '',
+    'Created', 'timestamp', 'NULL', '', '', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ [''] ],
+  'index' => [  ],
+},
+
+'Keywords' => {
+  'columns' => [
+    'id', 'serial', '', '', '', '',
+    'Name', 'varchar', 'NOT NULL', '255', '', '',
+    'Description', 'varchar', 'NULL', '255', '', '',
+    'Parent', 'integer', 'NULL', '', '', '',
+    'Disabled', 'int2', '','','0','',
+],
+  'primary_key' => 'id',
+  'unique' => [ [ 'Name', 'Parent' ] ],
+  'index' => [ [ 'Name', ], [ 'Parent' ] ],
+},
+
+'ObjectKeywords' => {
+  'columns' =>  [
+    'id', 'serial', '', '', '', '',
+    'Keyword', 'integer', 'NOT NULL', '', '', '',
+    'KeywordSelect', 'integer', 'NOT NULL', '', '', '',
+    'ObjectType', 'varchar', 'NOT NULL', '32', '', '',
+    'ObjectId', 'integer', 'NOT NULL', '', '', '',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ [  'ObjectId', 'ObjectType','KeywordSelect', 'Keyword' ] ],
+  'index' => [ [ 'ObjectId', 'ObjectType'  ] , ['Keyword'] ],
+
+},
+
+'KeywordSelects' => {
+  'columns' =>  [
+    'id', 'serial', '', '', '', '',
+    'Name','varchar','NULL','255','','',
+    'Keyword', 'integer', 'NULL', '', '', '',
+    'Single', 'integer', 'NULL', '', '', '',
+    'Depth', 'integer', 'NOT NULL', '', 0, '',
+    'ObjectType', 'varchar', 'NOT NULL',  '32', '', '',
+    'ObjectField', 'varchar', 'NULL', '32', '', '',
+    'ObjectValue', 'varchar', 'NULL', '255', '', '',
+    'Disabled', 'int2', '','','0','',
+  ],
+  'primary_key' => 'id',
+  'unique' => [ [ ] ],
+  'index' => [ [ 'Keyword' ], [ 'ObjectType', 'ObjectField', 'ObjectValue'] ],
+},
+
+};
diff --git a/rt/lib/MANIFEST b/rt/lib/MANIFEST
new file mode 100644 (file)
index 0000000..cda386b
--- /dev/null
@@ -0,0 +1,57 @@
+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
new file mode 100644 (file)
index 0000000..ae335e7
--- /dev/null
@@ -0,0 +1 @@
+CVS/
diff --git a/rt/lib/Makefile.PL b/rt/lib/Makefile.PL
new file mode 100644 (file)
index 0000000..c0e1af2
--- /dev/null
@@ -0,0 +1,49 @@
+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.pm b/rt/lib/RT.pm
new file mode 100644 (file)
index 0000000..1cfc428
--- /dev/null
@@ -0,0 +1,155 @@
+package RT;
+use RT::Handle;
+use RT::CurrentUser;
+use strict;
+
+use vars qw($VERSION $SystemUser $Nobody $Handle $Logger);
+
+$VERSION = '!!RT_VERSION!!';
+
+=head1 NAME
+
+       RT - Request Tracker
+
+=head1 SYNOPSIS
+
+       A fully featured request tracker package
+       
+
+=head1 DESCRIPTION
+
+
+=cut
+
+sub Init {
+    #Get a database connection
+    $Handle = new RT::Handle($RT::DatabaseType);
+    $Handle->Connect();
+    
+    
+    #RT's system user is a genuine database user. its id lives here
+    $SystemUser = new RT::CurrentUser();
+    $SystemUser->LoadByName('RT_System');
+    
+    #RT's "nobody user" is a genuine database user. its ID lives here.
+    $Nobody = new RT::CurrentUser();
+    $Nobody->LoadByName('Nobody');
+   
+   InitLogging(); 
+}
+
+=head2 InitLogging
+
+Create the RT::Logger object. 
+
+=cut
+sub InitLogging {
+
+    # We have to set the record seperator ($, man perlvar)
+    # or Log::Dispatch starts getting
+    # really pissy, as some other module we use unsets it.
+
+    $, = '';
+    use Log::Dispatch 1.6;
+    use Log::Dispatch::File;
+    use Log::Dispatch::Screen;
+
+    $Logger=Log::Dispatch->new();
+    
+    if ($RT::LogToFile) {
+       my $filename = $RT::LogToFileNamed || "$RT::LogDir/rt.log";
+
+         $Logger->add(Log::Dispatch::File->new
+                      ( name=>'rtlog',
+                        min_level=> $RT::LogToFile,
+                        filename=> $filename,
+                        mode=>'append',
+            callbacks => sub {my %p=@_; return "[".gmtime(time)."] [".$p{level}."]: $p{message}\n"}
+
+                      ));
+    }
+    if ($RT::LogToScreen) {
+       $Logger->add(Log::Dispatch::Screen->new
+                    ( name => 'screen',
+                      min_level => $RT::LogToScreen,
+                      stderr => 1
+                    ));
+    }
+# {{{ Signal handlers
+
+## This is the default handling of warnings and die'ings in the code
+## (including other used modules - maybe except for errors catched by
+## Mason).  It will log all problems through the standard logging
+## mechanism (see above).
+
+$SIG{__WARN__} = sub {$RT::Logger->warning($_[0])};
+
+#When we call die, trap it and log->crit with the value of the die.
+
+$SIG{__DIE__}  = sub {
+    unless ($^S || !defined $^S ) {
+        $RT::Logger->crit("$_[0]");
+        exit(-1);
+    }
+    else {
+        #Get out of here if we're in an eval
+        die $_[0];
+    }
+};
+
+# }}}
+
+}
+
+# }}}
+
+
+sub SystemUser {
+    return($SystemUser);
+}      
+
+sub Nobody {
+    return ($Nobody);
+}
+
+
+=head2 DropSetGIDPermissions
+
+Drops setgid permissions.
+
+=cut
+
+sub DropSetGIDPermissions {
+    # Now that we got the config read in, we have the database 
+    # password and don't need to be setgid
+    # make the effective group the real group
+    $) = $(;
+}
+
+
+=head1 NAME
+
+RT - Request Tracker
+
+=head1 SYNOPSIS
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+
+ok ($RT::Nobody->Name() eq 'Nobody', "Nobody is nobody");
+ok ($RT::Nobody->Name() ne 'root', "Nobody isn't named root");
+ok ($RT::SystemUser->Name() eq 'RT_System', "The system user is RT_System");
+ok ($RT::SystemUser->Name() ne 'noname', "The system user isn't noname");
+
+
+=end testing
+
+=cut
+
+1;
diff --git a/rt/lib/RT/ACE.pm b/rt/lib/RT/ACE.pm
new file mode 100755 (executable)
index 0000000..d4681cf
--- /dev/null
@@ -0,0 +1,774 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ACE.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::ACE - RT\'s ACE object
+
+=head1 SYNOPSIS
+
+  use RT::ACE;
+  my $ace = new RT::ACE($CurrentUser);
+
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::ACE);
+
+=end testing
+
+=cut
+
+package RT::ACE;
+use RT::Record;
+@ISA= qw(RT::Record);
+
+use vars qw (%SCOPES
+            %QUEUERIGHTS
+            %SYSTEMRIGHTS
+            %LOWERCASERIGHTNAMES
+           ); 
+
+%SCOPES = (
+          System => 'System-level right',
+          Queue => 'Queue-level right'
+         );
+
+# {{{ Descriptions of rights
+
+# Queue rights are the sort of queue rights that can only be granted
+# to real people or groups
+%QUEUERIGHTS = ( 
+               SeeQueue => 'Can this principal see this queue',
+               AdminQueue => 'Create, delete and modify queues', 
+               ShowACL => 'Display Access Control List',
+               ModifyACL => 'Modify Access Control List',
+               ModifyQueueWatchers => 'Modify the queue watchers',
+                AdminKeywordSelects => 'Create, delete and modify keyword selections',
+
+               
+               ModifyTemplate => 'Modify email templates for this queue',
+               ShowTemplate => 'Display email templates for this queue',
+               ModifyScrips => 'Modify Scrips for this queue',
+               ShowScrips => 'Display Scrips for this queue',
+
+               ShowTicket => 'Show ticket summaries',
+               ShowTicketComments => 'Show ticket private commentary',
+
+               Watch => 'Sign up as a ticket Requestor or ticket or queue Cc',
+               WatchAsAdminCc => 'Sign up as a ticket or queue AdminCc',
+               CreateTicket => 'Create tickets in this queue',
+               ReplyToTicket => 'Reply to tickets',
+               CommentOnTicket => 'Comment on tickets',
+               OwnTicket => 'Own tickets',
+               ModifyTicket => 'Modify tickets',
+               DeleteTicket => 'Delete tickets'
+
+              );       
+
+
+# System rights are rights granted to the whole system
+%SYSTEMRIGHTS = (
+                SuperUser => 'Do anything and everything',
+               AdminKeywords => 'Creatte, delete and modify keywords',  
+               AdminGroups => 'Create, delete and modify groups',
+               AdminUsers => 'Create, Delete and Modify users',
+               ModifySelf => 'Modify one\'s own RT account',
+
+               );
+
+# }}}
+
+# {{{ Descriptions of principals
+
+%TICKET_METAPRINCIPALS = ( Owner => 'The owner of a ticket',
+                                  Requestor => 'The requestor of a ticket',
+                                  Cc => 'The CC of a ticket',
+                                      AdminCc => 'The administrative CC of a ticket',
+                        );
+
+# }}}
+
+# {{{ We need to build a hash of all rights, keyed by lower case names
+
+#since you can't do case insensitive hash lookups
+
+foreach $right (keys %QUEUERIGHTS) {
+    $LOWERCASERIGHTNAMES{lc $right}=$right;
+}
+foreach $right (keys %SYSTEMRIGHTS) {
+    $LOWERCASERIGHTNAMES{lc $right}=$right;
+}
+
+# }}}
+
+# {{{ sub _Init
+sub _Init  {
+  my $self = shift;
+  $self->{'table'} = "ACL";
+  return($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub LoadByValues
+
+=head2 LoadByValues PARAMHASH
+
+Load an ACE by specifying a paramhash with the following fields:
+
+              PrincipalId => undef,
+             PrincipalType => undef,
+             RightName => undef,
+             RightScope => undef,
+             RightAppliesTo => undef,
+
+=cut
+
+sub LoadByValues {
+  my $self = shift;
+  my %args = (PrincipalId => undef,
+             PrincipalType => undef,
+             RightName => undef,
+             RightScope => undef,
+             RightAppliesTo => undef,
+             @_);
+  
+  $self->LoadByCols (PrincipalId => $args{'PrincipalId'},
+                    PrincipalType => $args{'PrincipalType'},
+                    RightName => $args{'RightName'},
+                    RightScope => $args{'RightScope'},
+                    RightAppliesTo => $args{'RightAppliesTo'}
+                   );
+  
+  #If we couldn't load it.
+  unless ($self->Id) {
+      return (0, "ACE not found");
+  }
+  # if we could
+  return ($self->Id, "ACE Loaded");
+  
+}
+
+# }}}
+
+# {{{ sub Create
+
+=head2 Create <PARAMS>
+
+PARAMS is a parameter hash with the following elements:
+
+   PrincipalType => "Queue"|"User"
+   PrincipalId => an intentifier you can use to ->Load a user or group
+   RightName => the name of a right. in any case
+   RightScope => "System" | "Queue"
+   RightAppliesTo => a queue id or undef
+
+=cut
+
+sub Create {
+    my $self = shift;
+    my %args = ( PrincipalId => undef,
+                PrincipalType => undef,
+                RightName => undef,
+                RightScope => undef,
+                RightAppliesTo => undef,
+                @_
+              );
+    
+    # {{{ Validate the principal
+    my ($princ_obj);
+    if ($args{'PrincipalType'} eq 'User') {
+       $princ_obj = new RT::User($RT::SystemUser);
+       
+    }  
+    elsif ($args{'PrincipalType'} eq 'Group') {
+       require RT::Group;
+       $princ_obj = new RT::Group($RT::SystemUser);
+    }
+    else {
+       return (0, 'Principal type '.$args{'PrincipalType'} . ' is invalid.');
+    }  
+    
+    $princ_obj->Load($args{'PrincipalId'});
+    my $princ_id = $princ_obj->Id();
+    
+    unless ($princ_id) {
+       return (0, 'Principal '.$args{'PrincipalId'}.' not found.');
+    }
+
+    # }}}
+    
+    #TODO allow loading of queues by name.    
+    
+    # {{{ Check the ACL
+    if ($args{'RightScope'} eq 'System') {
+       
+       unless ($self->CurrentUserHasSystemRight('ModifyACL')) {
+           $RT::Logger->error("Permission Denied.");
+           return(undef);
+       }
+    }
+    
+    elsif ($args{'RightScope'} eq 'Queue') {
+       unless ($self->CurrentUserHasQueueRight( Queue => $args{'RightAppliesTo'},
+                                                Right => 'ModifyACL')) {
+           return (0, 'Permission Denied.');
+       }
+       
+       
+       
+       
+    }
+    #If it's not a scope we recognise, something scary is happening.
+    else {
+       $RT::Logger->err("RT::ACE->Create got a scope it didn't recognize: ".
+                        $args{'RightScope'}." Bailing. \n");
+       return(0,"System error. Unable to grant rights.");
+    }
+
+    # }}}
+
+    # {{{ Canonicalize and check the right name
+    $args{'RightName'} = $self->CanonicalizeRightName($args{'RightName'});
+    
+    #check if it's a valid RightName
+    if ($args{'RightScope'} eq 'Queue') {
+       unless (exists $QUEUERIGHTS{$args{'RightName'}}) {
+           return(0, 'Invalid right');
+       }       
+       }       
+    elsif ($args{'RightScope' eq 'System'}) {
+       unless (exists $SYSTEMRIGHTS{$args{'RightName'}}) {
+           return(0, 'Invalid right');
+       }                   
+    }  
+    # }}}
+    
+    # Make sure the right doesn't already exist.
+    $self->LoadByCols (PrincipalId => $princ_id,
+                      PrincipalType => $args{'PrincipalType'},
+                      RightName => $args{'RightName'},
+                      RightScope => $args {'RightScope'},
+                      RightAppliesTo => $args{'RightAppliesTo'}
+                     );
+    if ($self->Id) {
+       return (0, 'That user already has that right');
+    }  
+
+    my $id = $self->SUPER::Create( PrincipalId => $princ_id,
+                                  PrincipalType => $args{'PrincipalType'},
+                                  RightName => $args{'RightName'},
+                                  RightScope => $args {'RightScope'},
+                                  RightAppliesTo => $args{'RightAppliesTo'}
+                                );
+    
+    
+    if ($id > 0 ) {
+       return ($id, 'Right Granted');
+    }
+    else {
+       $RT::Logger->err('System error. right not granted.');
+       return(0, 'System Error. right not granted');
+    }
+}
+
+# }}}
+
+
+# {{{ sub Delete 
+
+=head2 Delete
+
+Delete this object.
+
+=cut
+
+sub Delete {
+    my $self = shift;
+    
+    unless ($self->CurrentUserHasRight('ModifyACL')) {
+       return (0, 'Permission Denied');
+    }  
+    
+    
+    my ($val,$msg) = $self->SUPER::Delete(@_);
+    if ($val) {
+       return ($val, 'ACE Deleted');
+    }  
+    else {
+       return (0, 'ACE could not be deleted');
+    }
+}
+
+# }}}
+
+# {{{ sub _BootstrapRight 
+
+=head2 _BootstrapRight
+
+Grant a right with no error checking and no ACL. this is _only_ for 
+installation. If you use this routine without jesse@fsck.com's explicit 
+written approval, he will hunt you down and make you spend eternity
+translating mozilla's code into FORTRAN or intercal.
+
+=cut
+
+sub _BootstrapRight {
+    my $self = shift;
+    my %args = @_;
+
+    my $id = $self->SUPER::Create( PrincipalId => $args{'PrincipalId'},
+                                  PrincipalType => $args{'PrincipalType'},
+                                  RightName => $args{'RightName'},
+                                  RightScope => $args {'RightScope'},
+                                  RightAppliesTo => $args{'RightAppliesTo'}
+                                );
+    
+    if ($id > 0 ) {
+       return ($id);
+    }
+    else {
+       $RT::Logger->err('System error. right not granted.');
+       return(undef);
+    }
+    
+}
+
+# }}}
+
+# {{{ sub CanonicalizeRightName
+
+=head2 CanonicalizeRightName <RIGHT>
+
+Takes a queue or system right name in any case and returns it in
+the correct case. If it's not found, will return undef.
+
+=cut
+
+sub CanonicalizeRightName {
+    my $self = shift;
+    my $right = shift;
+    $right = lc $right;
+    if (exists $LOWERCASERIGHTNAMES{"$right"}) {
+       return ($LOWERCASERIGHTNAMES{"$right"});
+    }
+    else {
+       return (undef);
+    }
+}
+
+# }}}
+
+# {{{ sub QueueRights
+
+=head2 QueueRights
+
+Returns a hash of all the possible rights at the queue scope
+
+=cut
+
+sub QueueRights {
+        return (%QUEUERIGHTS);
+}
+
+# }}}
+
+# {{{ sub SystemRights
+
+=head2 SystemRights
+
+Returns a hash of all the possible rights at the system scope
+
+=cut
+
+sub SystemRights {
+       return (%SYSTEMRIGHTS);
+}
+
+
+# }}}
+
+# {{{ sub _Accessible 
+
+sub _Accessible  {
+  my $self = shift;  
+  my %Cols = (
+             PrincipalId => 'read/write',
+             PrincipalType => 'read/write',
+             RightName => 'read/write', 
+             RightScope => 'read/write',
+             RightAppliesTo => 'read/write'
+           );
+  return($self->SUPER::_Accessible(@_, %Cols));
+}
+# }}}
+
+# {{{ sub AppliesToObj
+
+=head2 AppliesToObj
+
+If the AppliesTo is a queue, returns the queue object. If it's 
+the system object, returns undef. If the user has no rights, returns undef.
+
+=cut
+
+sub AppliesToObj {
+    my $self = shift;
+    if ($self->RightScope eq 'Queue') {
+       my $appliesto_obj = new RT::Queue($self->CurrentUser);
+       $appliesto_obj->Load($self->RightAppliesTo);
+       return($appliesto_obj);
+    }
+    elsif ($self->RightScope eq 'System') {
+       return (undef);
+    }  
+    else {
+       $RT::Logger->warning("$self -> AppliesToObj called for an object ".
+                            "of an unknown scope:" . $self->RightScope);
+       return(undef);
+    }
+}      
+
+# }}}
+
+# {{{ sub PrincipalObj
+
+=head2 PrincipalObj
+
+If the AppliesTo is a group, returns the group object.
+If the AppliesTo is a user, returns the user object.
+Otherwise, it logs a warning and returns undef.
+
+=cut
+
+sub PrincipalObj {
+    my $self = shift;
+    my ($princ_obj);
+
+    if ($self->PrincipalType eq 'Group') {
+       use RT::Group;
+       $princ_obj = new RT::Group($self->CurrentUser);
+    }
+    elsif ($self->PrincipalType eq 'User') {
+       $princ_obj = new RT::User($self->CurrentUser);
+    }
+    else {
+       $RT::Logger->warning("$self -> PrincipalObj called for an object ".
+                            "of an unknown principal type:" . 
+                            $self->PrincipalType ."\n");
+       return(undef);
+    }
+    
+    $princ_obj->Load($self->PrincipalId);
+    return($princ_obj);
+
+}      
+
+# }}}
+
+# {{{ ACL related methods
+
+# {{{ sub _Set
+
+sub _Set {
+  my $self = shift;
+  return (0, "ACEs can only be created and deleted.");
+}
+
+# }}}
+
+# {{{ sub _Value
+
+sub _Value {
+    my $self = shift;
+
+    unless ($self->CurrentUserHasRight('ShowACL')) {
+       return (undef);
+    }
+
+    return ($self->__Value(@_));
+}
+
+# }}}
+
+
+# {{{ 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;
+    return ($self->HasRight( Right => $right,
+                            Principal => $self->CurrentUser->UserObj,
+                            System => 1
+                          ));
+}
+
+
+# }}}
+
+# {{{ sub CurrentUserHasRight
+
+=item CurrentUserHasRight RIGHT 
+Takes a rightname as a string.
+
+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 (defined $args{'Queue'}) {
+       return ($args{'Principal'}->HasQueueRight(Right => $args{'Right'},
+                                                 Queue => $args{'Queue'}));
+    }
+    #else if we're specifying to check a system right
+    elsif ((defined $args{'System'}) and (defined $args{'Right'})) {
+        return( $args{'Principal'}->HasSystemRight( $args{'Right'} ));
+    }  
+    
+    elsif ($self->__Value('RightScope') eq 'System') {
+       return $args{'Principal'}->HasSystemRight($args{'Right'});
+    }
+    elsif ($self->__Value('RightScope') eq 'Queue') {
+       return $args{'Principal'}->HasQueueRight( Queue => $self->__Value('RightAppliesTo'),
+                                                 Right => $args{'Right'} );
+    }  
+    else {
+       $RT::Logger->warning("$self: Trying to check an acl for a scope we ".
+                            "don't understand:" . $self->__Value('RightScope') ."\n");
+       return undef;
+    }
+
+
+
+}
+# }}}
+
+# }}}
+
+1;
+
+__DATA__
+
+# {{{ POD
+
+=head1 Out of date docs
+
+=head2 Table Structure
+
+PrincipalType, PrincipalId, Right,Scope,AppliesTo
+
+=head1 The docs are out of date. so you know.
+
+=head1 Scopes
+
+Scope is the scope of the right granted, not the granularity of the grant.
+For example, Queue and Ticket rights are both granted for a "queue." 
+Rights with a scope of 'System' don't have an AppliesTo. (They're global).
+Rights with a scope of "Queue" are rights that act on a queue.
+Rights with a scope of "System" are rights that act on some other aspect
+of the system.
+
+
+=item Queue
+=item System
+
+
+=head1 Rights
+
+=head2 Scope: Queue
+
+=head2 Queue rights that apply to a ticket within a queue
+
+Create Ticket in <queue>
+
+        Name: Create
+       Principals: <user> <group>
+Display Ticket Summary in <queue>
+
+       Name: Show
+       Principals: <user> <group> Owner Requestor Cc AdminCc
+
+Display Ticket History  <queue>
+
+       Name: ShowHistory
+       Principals: <user> <group> Owner Requestor Cc AdminCc
+
+Display Ticket Private Comments  <queue>
+
+       Name: ShowComments
+       Principals: <user> <group> Owner Requestor Cc AdminCc
+
+Reply to Ticket in <queue>
+
+       Name: Reply
+       Principals: <user> <group> Owner Requestor Cc AdminCc
+
+Comment on Ticket in <queue>
+
+       Name: Comment
+       Principals: <user> <group> Owner Requestor Cc AdminCc
+
+Modify Ticket in <queue>
+
+       Name: Modify
+       Principals: <user> <group> Owner Requestor Cc AdminCc
+
+Delete Tickets in <queue>
+
+       Name: Delete
+       Principals: <user> <group> Owner Requestor Cc AdminCc
+
+
+=head2 Queue Rights that apply to a whole queue
+
+These rights can only be granted to "real people"
+
+List Tickets in <queue>
+
+       Name: ListQueue
+       Principals: <user> <group>
+
+Know that <queue> exists
+    
+    Name: See
+    Principals: <user> <group>
+
+Display queue settings
+
+    Name: Explore
+    Principals: <user> <group>
+
+Modify Queue Watchers for <queue>
+
+       Name: ModifyQueueWatchers
+       Principals: <user> <group>
+
+Modify Queue Attributes for <queue> 
+
+       Name: ModifyQueue
+       Principals: <user> <group>
+
+Modify Queue ACL for queue <queue>
+
+       Name: ModifyACL
+       Principals: <user> <group>
+
+
+=head2 Rights that apply to the System scope
+
+=head2 SystemRights
+
+Create Queue
+  
+        Name: CreateQueue
+       Principals: <user> <group>
+Delete Queue
+  
+        Name: DeleteQueue
+       Principals: <user> <group>
+
+Create Users
+  
+        Name: CreateUser
+       Principals: <user> <group>
+
+Delete Users
+  
+        Name: DeleteUser
+       Principals: <user> <group>
+  
+Modify Users
+  
+        Name: ModifyUser
+       Principals: <user> <group>
+
+Modify Self
+        Name: ModifySelf
+       Principals: <user> <group>
+
+Browse Users
+
+        Name: BrowseUsers (NOT IMPLEMENTED in 2.0)
+       Principals: <user> <group>
+
+Modify Self
+                   
+       Name: ModifySelf
+       Principals: <user> <group>
+
+Modify System ACL
+
+       Name: ModifyACL           
+       Principals: <user> <group>
+
+=head1 The Principal Side of the ACE
+
+=head2 PrincipalTypes,PrincipalIds in our Neighborhood
+
+  User,<userid>
+  Group,<groupip>
+  Everyone,NULL
+
+=cut
+
+# }}}
diff --git a/rt/lib/RT/ACL.pm b/rt/lib/RT/ACL.pm
new file mode 100755 (executable)
index 0000000..444a4c2
--- /dev/null
@@ -0,0 +1,308 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ACL.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Distributed under the terms of the GNU GPL
+# Copyright (c) 2000 Jesse Vincent <jesse@fsck.com>
+
+=head1 NAME
+
+  RT::ACL - collection of RT ACE objects
+
+=head1 SYNOPSIS
+
+  use RT::ACL;
+my $ACL = new RT::ACL($CurrentUser);
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::ACL);
+
+=end testing
+
+=cut
+
+package RT::ACL;
+use RT::EasySearch;
+use RT::ACE;
+@ISA= qw(RT::EasySearch);
+
+# {{{ sub _Init 
+sub _Init  {
+  my $self = shift;
+  $self->{'table'} = "ACL";
+  $self->{'primary_key'} = "id";
+  return ( $self->SUPER::_Init(@_));
+  
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+  return(RT::ACE->new($self->CurrentUser));
+}
+# }}}
+
+=head2 Next
+
+Hand out the next ACE that was found
+
+=cut
+
+# {{{ sub Next 
+sub Next {
+    my $self = shift;
+    
+    my $ACE = $self->SUPER::Next();
+    if ((defined($ACE)) and (ref($ACE))) {
+       
+       if ( $ACE->CurrentUserHasRight('ShowACL') or
+            $ACE->CurrentUserHasRight('ModifyACL')
+          ) {
+           return($ACE);
+       }
+       
+       #If the user doesn't have the right to show this ACE
+       else {  
+           return($self->Next());
+       }
+    }
+    #if there never was any ACE
+    else {
+       return(undef);
+    }  
+    
+}
+
+# }}}
+
+
+=head1 Limit the ACL to a specific scope
+
+There are two real scopes right now:
+
+=item Queue is for rights that apply to a single queue
+
+=item System is for rights that apply to the System (rights that aren't queue related)
+
+
+=head2 LimitToQueue
+
+Takes a single queueid as its argument.
+
+Limit the ACL to just a given queue when supplied with an integer queue id.
+
+=cut
+
+sub LimitToQueue {
+    my $self = shift;
+    my $queue = shift;
+    
+    
+    
+    $self->Limit( FIELD =>'RightScope',
+                 ENTRYAGGREGATOR => 'OR',
+                 VALUE => 'Queue');
+    $self->Limit( FIELD =>'RightScope',
+                 ENTRYAGGREGATOR => 'OR',
+               VALUE => 'Ticket');
+    
+    $self->Limit(ENTRYAGGREGATOR => 'OR',
+                FIELD => 'RightAppliesTo',
+                VALUE => $queue );
+  
+}
+
+
+=head2 LimitToSystem()
+
+Limit the ACL to system rights
+
+=cut 
+
+sub LimitToSystem {
+  my $self = shift;
+  
+  $self->Limit( FIELD =>'RightScope',
+               VALUE => 'System');
+}
+
+
+=head2 LimitRightTo
+
+Takes a single RightName as its only argument.
+Limits the search to the right $right.
+$right is a right listed in perldoc RT::ACE
+
+=cut
+
+sub LimitRightTo {
+  my $self = shift;
+  my $right = shift;
+  
+  $self->Limit(ENTRYAGGREGATOR => 'OR',
+              FIELD => 'RightName',
+              VALUE => $right );
+  
+}
+
+=head1 Limit to a specifc set of principals
+
+=head2 LimitPrincipalToUser
+
+Takes a single userid as its only argument.
+Limit the ACL to a just a specific user.
+
+=cut
+
+sub LimitPrincipalToUser {
+  my $self = shift;
+  my $user = shift;
+  
+  $self->Limit(ENTRYAGGREGATOR => 'OR',
+              FIELD => 'PrincipalType',
+              VALUE => 'User' );
+  
+  $self->Limit(ENTRYAGGREGATOR => 'OR',
+              FIELD => 'PrincipalId',
+              VALUE => $user );
+  
+}
+
+
+=head2 LimitPrincipalToGroup
+
+Takes a single group as its only argument.
+Limit the ACL to just a specific group.
+
+=cut
+  
+sub LimitPrincipalToGroup {
+  my $self = shift;
+  my $group = shift;
+  
+  $self->Limit(ENTRYAGGREGATOR => 'OR',
+              FIELD => 'PrincipalType',
+              VALUE => 'Group' );
+
+  $self->Limit(ENTRYAGGREGATOR => 'OR',
+              FIELD => 'PrincipalId',
+              VALUE => $group );
+
+}
+
+=head2 LimitPrincipalToType($type)
+
+Takes a single argument, $type.
+Limit the ACL to just a specific principal type
+
+$type is one of:
+  TicketOwner
+  TicketRequestor
+  TicketCc
+  TicketAdminCc
+  Everyone
+  User
+  Group
+
+=cut
+
+sub LimitPrincipalToType {
+  my $self=shift;
+  my $type=shift;  
+  $self->Limit(ENTRYAGGREGATOR => 'OR',
+               FIELD => 'PrincipalType',
+               VALUE => $type );
+}
+
+
+=head2 LimitPrincipalToId 
+
+Takes a single argument, the numeric Id of the principal to limit this ACL to. Repeated calls to this 
+function will broaden the scope of the search to include all principals listed.
+
+=cut
+
+sub LimitPrincipalToId {
+    my $self = shift;
+    my $id = shift;
+
+    if ($id =~ /^\d+$/) {
+       $self->Limit(ENTRYAGGREGATOR => 'OR',
+                    FIELD => 'PrincipalId',
+                    VALUE => $id );
+    }
+    else {
+       $RT::Logger->warn($self."->LimitPrincipalToId called with '$id' as an id");
+       return undef;
+    }
+}
+
+
+#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);
+}
+
+
+#Build a hash of this ACL's entries.
+sub _BuildHash {
+    my $self = shift;
+
+    while (my $entry = $self->Next) {
+       my $hashkey = $entry->RightScope . "-" .
+                             $entry->RightAppliesTo . "-" . 
+                             $entry->RightName . "-" .
+                             $entry->PrincipalId . "-" .
+                             $entry->PrincipalType;
+
+        $self->{'as_hash'}->{"$hashkey"} =1;
+
+    }
+}
+
+
+# {{{ HasEntry
+
+=head2 HasEntry
+
+=cut
+
+sub HasEntry {
+
+    my $self = shift;
+    my %args = ( RightScope => undef,
+                 RightAppliesTo => undef,
+                 RightName => undef,
+                 PrincipalId => undef,
+                 PrincipalType => undef,
+                 @_ );
+
+    #if we haven't done the search yet, do it now.
+    $self->_DoSearch();
+
+    if ($self->{'as_hash'}->{ $args{'RightScope'} . "-" .
+                             $args{'RightAppliesTo'} . "-" . 
+                             $args{'RightName'} . "-" .
+                             $args{'PrincipalId'} . "-" .
+                             $args{'PrincipalType'}
+                            } == 1) {
+       return(1);
+    }
+    else {
+       return(undef);
+    }
+}
+
+# }}}
+1;
diff --git a/rt/lib/RT/Action/Autoreply.pm b/rt/lib/RT/Action/Autoreply.pm
new file mode 100755 (executable)
index 0000000..624888e
--- /dev/null
@@ -0,0 +1,64 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Autoreply.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+package RT::Action::Autoreply;
+require RT::Action::SendEmail;
+@ISA = qw(RT::Action::SendEmail);
+
+
+# {{{ sub SetRecipients
+
+=head2 SetRecipients
+
+Sets the recipients of this message to this ticket's Requestor.
+
+=cut
+
+
+sub SetRecipients {
+    my $self=shift;
+
+    push(@{$self->{'To'}}, @{$self->TicketObj->Requestors->Emails});
+    
+    return(1);
+}
+
+# }}}
+
+
+# {{{ sub SetReturnAddress 
+
+=head2 SetReturnAddress
+
+Set this message\'s return address to the apropriate queue address
+
+=cut
+
+sub SetReturnAddress {
+    my $self = shift;
+    my %args = ( is_comment => 0,
+                @_
+              );
+    
+    if ($args{'is_comment'}) { 
+       $replyto = $self->TicketObj->QueueObj->CommentAddress || 
+                    $RT::CommentAddress;
+    }
+    else {
+       $replyto = $self->TicketObj->QueueObj->CorrespondAddress ||
+                    $RT::CorrespondAddress;
+    }
+    
+    unless ($self->TemplateObj->MIMEObj->head->get('From')) {
+       my $friendly_name=$self->TicketObj->QueueObj->Name;
+       $self->SetHeader('From', "\"$friendly_name\" <$replyto>");
+    }
+    
+    unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {
+       $self->SetHeader('Reply-To', "$replyto");
+    }
+    
+}
+  
+# }}}
+
+1;
diff --git a/rt/lib/RT/Action/Generic.pm b/rt/lib/RT/Action/Generic.pm
new file mode 100755 (executable)
index 0000000..ecfd4ab
--- /dev/null
@@ -0,0 +1,155 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Generic.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::Action::Generic - a generic baseclass for RT Actions
+
+=head1 SYNOPSIS
+
+  use RT::Action::Generic;
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Action::Generic);
+
+=end testing
+
+=cut
+
+package RT::Action::Generic;
+
+# {{{ sub new 
+sub new  {
+  my $proto = shift;
+  my $class = ref($proto) || $proto;
+  my $self  = {};
+  bless ($self, $class);
+  $self->_Init(@_);
+  return $self;
+}
+# }}}
+
+# {{{ sub _Init 
+sub _Init  {
+  my $self = shift;
+  my %args = ( TransactionObj => undef,
+              TicketObj => undef,
+              ScripObj => undef,
+              TemplateObj => undef,
+              Argument => undef,
+              Type => undef,
+              @_ );
+  
+  
+  $self->{'Argument'} = $args{'Argument'};
+  $self->{'ScripObj'} = $args{'ScripObj'};
+  $self->{'TicketObj'} = $args{'TicketObj'};
+  $self->{'TransactionObj'} = $args{'TransactionObj'};
+  $self->{'TemplateObj'} = $args{'TemplateObj'};
+  $self->{'Type'} = $args{'Type'};
+}
+# }}}
+
+# Access Scripwide data
+
+# {{{ sub Argument 
+sub Argument  {
+  my $self = shift;
+  return($self->{'Argument'});
+}
+# }}}
+
+# {{{ sub TicketObj
+sub TicketObj  {
+  my $self = shift;
+  return($self->{'TicketObj'});
+}
+# }}}
+
+# {{{ sub TransactionObj
+sub TransactionObj  {
+  my $self = shift;
+  return($self->{'TransactionObj'});
+}
+# }}}
+
+# {{{ sub TemplateObj
+sub TemplateObj  {
+  my $self = shift;
+  return($self->{'TemplateObj'});
+}
+# }}}
+
+# {{{ sub Type
+sub Type  {
+  my $self = shift;
+  return($self->{'Type'});
+}
+# }}}
+
+
+# Scrip methods
+
+#Do what we need to do and send it out.
+
+# {{{ sub Commit 
+sub Commit  {
+  my $self = shift;
+  return(0,"Commit Stubbed");
+}
+# }}}
+
+
+#What does this type of Action does
+
+# {{{ sub Describe 
+sub Describe  {
+  my $self = shift;
+  return ("No description for " . ref $self);
+}
+# }}}
+
+
+#Parse the templates, get things ready to go.
+
+# {{{ sub Prepare 
+sub Prepare  {
+  my $self = shift;
+  return (0,"Prepare Stubbed");
+}
+# }}}
+
+
+#If this rule applies to this transaction, return true.
+
+# {{{ sub IsApplicable 
+sub IsApplicable  {
+  my $self = shift;
+  return(undef);
+}
+# }}}
+
+# {{{ sub DESTROY
+sub DESTROY {
+    my $self = shift;
+
+    # We need to clean up all the references that might maybe get
+    # oddly circular
+    $self->{'TemplateObj'} =undef
+    $self->{'TicketObj'} = undef;
+    $self->{'TransactionObj'} = undef;
+    $self->{'ScripObj'} = undef;
+
+
+     
+}
+
+# }}}
+1;
diff --git a/rt/lib/RT/Action/Notify.pm b/rt/lib/RT/Action/Notify.pm
new file mode 100755 (executable)
index 0000000..6dca4fd
--- /dev/null
@@ -0,0 +1,99 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Notify.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+package RT::Action::Notify;
+require RT::Action::SendEmail;
+@ISA = qw(RT::Action::SendEmail);
+
+# {{{ sub SetRecipients
+
+=head2 SetRecipients
+
+Sets the recipients of this meesage to Owner, Requestor, AdminCc, Cc or All. 
+Explicitly B<does not> notify the creator of the transaction.
+
+=cut
+
+sub SetRecipients {
+    my $self = shift;
+
+    $arg = $self->Argument;
+
+    $arg =~ s/\bAll\b/Owner,Requestor,AdminCc,Cc/;
+
+    my ( @To, @PseudoTo, @Cc, @Bcc );
+
+
+    if ($arg =~ /\bOtherRecipients\b/) {
+        if ($self->TransactionObj->Message->First) {
+            push (@Cc, $self->TransactionObj->Message->First->GetHeader('RT-Send-Cc'));
+            push (@Bcc, $self->TransactionObj->Message->First->GetHeader('RT-Send-Bcc'));
+        }
+    }
+
+    if ( $arg =~ /\bRequestor\b/ ) {
+        push ( @To, @{ $self->TicketObj->Requestors->Emails } );
+    }
+
+    
+
+    if ( $arg =~ /\bCc\b/ ) {
+
+        #If we have a To, make the Ccs, Ccs, otherwise, promote them to To
+        if (@To) {
+            push ( @Cc, @{ $self->TicketObj->Cc->Emails } );
+            push ( @Cc, @{ $self->TicketObj->QueueObj->Cc->Emails } );
+        }
+        else {
+            push ( @Cc, @{ $self->TicketObj->Cc->Emails } );
+            push ( @To, @{ $self->TicketObj->QueueObj->Cc->Emails } );
+        }
+    }
+
+    if ( ( $arg =~ /\bOwner\b/ )
+        && ( $self->TicketObj->OwnerObj->id != $RT::Nobody->id ) )
+    {
+
+        # If we're not sending to Ccs or requestors, 
+        # then the Owner can be the To.
+        if (@To) {
+            push ( @Bcc, $self->TicketObj->OwnerObj->EmailAddress );
+        }
+        else {
+            push ( @To, $self->TicketObj->OwnerObj->EmailAddress );
+        }
+
+    }
+
+    if ( $arg =~ /\bAdminCc\b/ ) {
+        push ( @Bcc, @{ $self->TicketObj->AdminCc->Emails } );
+        push ( @Bcc, @{ $self->TicketObj->QueueObj->AdminCc->Emails } );
+    }
+
+    if ($RT::UseFriendlyToLine) {
+        unless (@To) {
+            push ( @PseudoTo,
+                "\"$arg of $RT::rtname Ticket #"
+                  . $self->TicketObj->id . "\":;" );
+        }
+    }
+
+    my $creator = $self->TransactionObj->CreatorObj->EmailAddress();
+
+    #Strip the sender out of the To, Cc and AdminCc and set the 
+    # recipients fields used to build the message by the superclass.
+
+    $RT::Logger->debug("$self: To is ".join(",",@To));
+    $RT::Logger->debug("$self: Cc is ".join(",",@Cc));
+    $RT::Logger->debug("$self: Bcc is ".join(",",@Bcc));
+
+    @{ $self->{'To'} }  = grep ( !/^$creator$/, @To );
+    @{ $self->{'Cc'} }  = grep ( !/^$creator$/, @Cc );
+    @{ $self->{'Bcc'} } = grep ( !/^$creator$/, @Bcc );
+    @{ $self->{'PseudoTo'} } = @PseudoTo;
+    return (1);
+
+}
+
+# }}}
+
+1;
diff --git a/rt/lib/RT/Action/NotifyAsComment.pm b/rt/lib/RT/Action/NotifyAsComment.pm
new file mode 100755 (executable)
index 0000000..c72bfff
--- /dev/null
@@ -0,0 +1,25 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/NotifyAsComment.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+package RT::Action::NotifyAsComment;
+require RT::Action::Notify;
+@ISA = qw(RT::Action::Notify);
+
+
+=head2 SetReturnAddress
+
+Tell SendEmail that this message should come out as a comment. 
+Calls SUPER::SetReturnAddress.
+
+=cut
+
+sub SetReturnAddress {
+       my $self = shift;
+       
+       # Tell RT::Action::SendEmail that this should come 
+       # from the relevant comment email address.
+       $self->{'comment'} = 1;
+       
+       return($self->SUPER::SetReturnAddress(is_comment => 1));
+}
+1;
+
diff --git a/rt/lib/RT/Action/OpenDependent.pm b/rt/lib/RT/Action/OpenDependent.pm
new file mode 100644 (file)
index 0000000..b271e47
--- /dev/null
@@ -0,0 +1,55 @@
+# $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/ResolveMembers.pm b/rt/lib/RT/Action/ResolveMembers.pm
new file mode 100644 (file)
index 0000000..00547eb
--- /dev/null
@@ -0,0 +1,57 @@
+# This Action will resolve all members of a resolved group ticket
+
+package RT::Action::ResolveMembers;
+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 resolve all members of a resolved group ticket.");
+}
+# }}}
+
+
+# {{{ 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 => 'MemberOf');
+    $Links->Limit(FIELD => 'Target', VALUE => $self->TicketObj->id);
+
+    while (my $Link=$Links->Next()) {
+       # Todo: Try to deal with remote URIs as well
+       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);
+       # I'm afraid this might be a major bottleneck if ResolveGroupTicket is on.
+        $base->Resolve;
+    }
+}
+
+
+# Applicability checked in Commit.
+
+# {{{ sub IsApplicable 
+sub IsApplicable  {
+  my $self = shift;
+  1;  
+  return 1;
+}
+# }}}
+
+1;
+
diff --git a/rt/lib/RT/Action/SendEmail.pm b/rt/lib/RT/Action/SendEmail.pm
new file mode 100755 (executable)
index 0000000..e3abb11
--- /dev/null
@@ -0,0 +1,468 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/SendEmail.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Copyright 1996-2002  Jesse Vincent <jesse@bestpractical.com> 
+# Portions Copyright 2000 Tobias Brox <tobix@cpan.org>
+# Released under the terms of version 2 of the GNU Public License
+
+package RT::Action::SendEmail;
+require RT::Action::Generic;
+
+@ISA = qw(RT::Action::Generic);
+
+
+=head1 NAME
+
+  RT::Action::SendEmail - An Action which users can use to send mail 
+  or can subclassed for more specialized mail sending behavior. 
+  RT::Action::AutoReply is a good example subclass.
+
+
+=head1 SYNOPSIS
+
+  require RT::Action::SendEmail;
+  @ISA  = qw(RT::Action::SendEmail);
+
+
+=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::SendEmail);
+
+=end testing
+
+
+=head1 AUTHOR
+
+Jesse Vincent <jesse@bestpractical.com> and Tobias Brox <tobix@cpan.org>
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut
+
+# {{{ Scrip methods (_Init, Commit, Prepare, IsApplicable)
+
+# {{{ sub _Init 
+# We use _Init from RT::Action
+# }}}
+
+# {{{ sub Commit 
+#Do what we need to do and send it out.
+sub Commit  {
+    my $self = shift;
+    #send the email
+    
+    # If there are no recipients, don't try to send the message.
+    # If the transaction has content and has the header RT-Squelch-Replies-To
+    
+    if (defined $self->TransactionObj->Message->First()) { 
+       my $headers = $self->TransactionObj->Message->First->Headers();
+       
+       if ($headers =~ /^RT-Squelch-Replies-To: (.*?)$/si) {
+           my @blacklist = split(/,/,$1);
+           
+           # Cycle through the people we're sending to and pull out anyone on the
+           # system blacklist
+           
+           foreach my $person_to_yank (@blacklist) {
+               $person_to_yank =~ s/\s//g;
+               @{$self->{'To'}} = grep (!/^$person_to_yank$/, @{$self->{'To'}});
+               @{$self->{'Cc'}} = grep (!/^$person_to_yank$/, @{$self->{'Cc'}});
+               @{$self->{'Bcc'}} = grep (!/^$person_to_yank$/, @{$self->{'Bcc'}});
+           }
+       }
+    }
+    
+    # Go add all the Tos, Ccs and Bccs that we need to to the message to 
+    # make it happy, but only if we actually have values in those arrays.
+    
+    $self->SetHeader('To', join(',', @{$self->{'To'}})) 
+      if (@{$self->{'To'}});
+    $self->SetHeader('Cc', join(',' , @{$self->{'Cc'}})) 
+      if (@{$self->{'Cc'}});
+       $self->SetHeader('Bcc', join(',', @{$self->{'Bcc'}})) 
+         if (@{$self->{'Bcc'}});;
+    
+    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') ||
+           $MIMEObj->head->get('Cc') || 
+           $MIMEObj->head->get('Bcc') ) {
+       $RT::Logger->debug("$self: No recipients found. Not sending.\n");
+       return(1);
+    }
+
+    # PseudoTo (fake to headers) shouldn't get matched for message recipients.
+    # If we don't have any 'To' header, drop in the pseudo-to header.
+
+    $self->SetHeader('To', join(',', @{$self->{'PseudoTo'}}))
+      if ( (@{$self->{'PseudoTo'}}) and (! $MIMEObj->head->get('To')));
+    
+    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->TransactionObj) {
+    $RT::Logger->warning("No transaction object handed to $self\n");
+    
+  }
+  
+  unless ($self->TicketObj) {
+    $RT::Logger->warning("No ticket object handed to $self\n");
+      
+  }
+  
+  
+  $self->TemplateObj->Parse(Argument => $self->Argument,
+                           TicketObj => $self->TicketObj, 
+                           TransactionObj => $self->TransactionObj);
+  
+  # Header
+  
+  $self->SetSubject();
+  
+  $self->SetSubjectToken();
+  
+  $self->SetRecipients();  
+  
+  $self->SetReturnAddress();
+
+  $self->SetRTSpecialHeaders();
+  
+  return 1;
+  
+}
+
+# }}}
+
+# }}}
+
+# {{{ Deal with message headers (Set* subs, designed for  easy overriding)
+
+# {{{ sub SetRTSpecialHeaders
+
+# This routine adds all the random headers that RT wants in a mail message
+# that don't matter much to anybody else.
+
+sub SetRTSpecialHeaders {
+    my $self = shift;
+    
+    $self->SetReferences();
+
+    $self->SetMessageID();
+    
+    $self->SetPrecedence();
+
+    $self->SetHeader('X-RT-Loop-Prevention', $RT::rtname); 
+    $self->SetHeader('RT-Ticket', $RT::rtname. " #".$self->TicketObj->id());
+    $self->SetHeader
+      ('Managed-by',"RT $RT::VERSION (http://bestpractical.com/rt/)");
+    
+    $self->SetHeader('RT-Originator', $self->TransactionObj->CreatorObj->EmailAddress);
+    return();
+    
+}
+
+
+
+# {{{ sub SetReferences
+
+=head2 SetReferences 
+  
+  # This routine will set the References: and In-Reply-To headers,
+# autopopulating it with all the correspondence on this ticket so
+# far. This should make RT responses threadable.
+
+=cut
+
+sub SetReferences {
+  my $self = shift;
+  
+  # TODO: this one is broken.  What is this email really a reply to?
+  # If it's a reply to an incoming message, we'll need to use the
+  # actual message-id from the appropriate Attachment object.  For
+  # incoming mails, we would like to preserve the In-Reply-To and/or
+  # References.
+
+  $self->SetHeader
+    ('In-Reply-To', "<rt-".$self->TicketObj->id().
+     "\@".$RT::rtname.">");
+
+
+  # TODO We should always add References headers for all message-ids
+  # of previous messages related to this ticket.
+}
+
+# }}}
+
+# {{{ sub SetMessageID
+
+# Without this one, threading won't work very nice in email agents.
+# Anyway, I'm not really sure it's that healthy if we need to send
+# several separate/different emails about the same transaction.
+
+sub SetMessageID {
+  my $self = shift;
+
+  # TODO this one might be sort of broken.  If we have several scrips +++
+  # sending several emails to several different persons, we need to
+  # pull out different message-ids.  I'd suggest message ids like
+  # "rt-ticket#-transaction#-scrip#-receipient#"
+
+  $self->SetHeader
+    ('Message-ID', "<rt-".$self->TicketObj->id().
+     "-".
+     $self->TransactionObj->id()."." .rand(20) . "\@".$RT::Organization.">")
+      unless $self->TemplateObj->MIMEObj->head->get('Message-ID');
+}
+
+
+# }}}
+
+# }}}
+
+# {{{ sub SetReturnAddress 
+
+sub SetReturnAddress {
+
+  my $self = shift;
+  my %args = ( is_comment => 0,
+              @_ );
+
+  # From and Reply-To
+  # $args{is_comment} should be set if the comment address is to be used.
+  my $replyto;
+
+  if ($args{'is_comment'}) { 
+      $replyto = $self->TicketObj->QueueObj->CommentAddress || 
+                 $RT::CommentAddress;
+  }
+  else {
+      $replyto = $self->TicketObj->QueueObj->CorrespondAddress ||
+                 $RT::CorrespondAddress;
+  }
+    
+  unless ($self->TemplateObj->MIMEObj->head->get('From')) {
+      my $friendly_name=$self->TransactionObj->CreatorObj->RealName;
+
+      if ($friendly_name =~ /^\S+\@\S+$/) { # A "bare" mail address
+          $friendly_name =~ s/"/\\"/g;
+          $friendly_name = qq|"$friendly_name"|;
+      }
+
+
+      # TODO: this "via RT" should really be site-configurable.
+      $self->SetHeader('From', "\"$friendly_name via RT\" <$replyto>");
+  }
+  
+  unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {
+      $self->SetHeader('Reply-To', "$replyto");
+  }
+  
+}
+
+# }}}
+
+# {{{ 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);
+}
+
+# }}}
+
+# {{{ sub SetRecipients
+
+=head2 SetRecipients
+
+Dummy method to be overriden by subclasses which want to set the recipients.
+
+=cut
+
+sub SetRecipients {
+    my $self = shift;
+    return();
+}
+
+# }}}
+
+# {{{ sub SetTo
+
+sub SetTo {
+    my $self=shift;
+    my $addresses = shift;
+    return $self->SetHeader('To',$addresses);
+}
+# }}}
+
+# {{{ sub SetCc
+=head2 SetCc
+
+Takes a string that is the addresses you want to Cc
+
+=cut
+
+sub SetCc {
+    my $self=shift;
+    my $addresses = shift;
+
+    return $self->SetHeader('Cc', $addresses);
+}
+# }}}
+
+# {{{ sub SetBcc
+
+=head2 SetBcc
+
+Takes a string that is the addresses you want to Bcc
+
+=cut
+sub SetBcc {
+    my $self=shift;
+    my $addresses = shift;
+
+    return $self->SetHeader('Bcc', $addresses);
+}
+
+# }}}
+
+# {{{ sub SetPrecedence 
+
+sub SetPrecedence {
+  my $self = shift;
+
+  unless ($self->TemplateObj->MIMEObj->head->get("Precedence")) { 
+    $self->SetHeader('Precedence', "bulk");
+   }
+}
+
+# }}}
+
+# {{{ sub SetSubject
+
+=head2 SetSubject
+
+This routine sets the subject. it does not add the rt tag. that gets done elsewhere
+If $self->{'Subject'} is already defined, it uses that. otherwise, it tries to get
+the transaction's subject.
+
+=cut 
+
+sub SetSubject {
+  my $self = shift;
+  unless ($self->TemplateObj->MIMEObj->head->get('Subject')) {
+    my $message=$self->TransactionObj->Message;
+    my $ticket=$self->TicketObj->Id;
+    
+    my $subject;
+    
+    if ($self->{'Subject'}) {
+      $subject = $self->{'Subject'};
+    }
+    elsif (($message->First()) &&
+          ($message->First->Headers)) {
+      $header = $message->First->Headers();
+      $header =~ s/\n\s+/ /g; 
+      if ( $header =~ /^Subject: (.*?)$/m ) {
+       $subject = $1;
+      }
+      else {
+       $subject = $self->TicketObj->Subject();
+      }
+      
+    }
+    else {
+      $subject = $self->TicketObj->Subject();
+    }
+    
+    $subject =~ s/(\r\n|\n|\s)/ /gi;
+
+    chomp $subject;
+    $self->SetHeader('Subject',$subject);
+    
+    }
+  return($subject);
+}
+# }}}
+
+# {{{ sub SetSubjectToken
+
+=head2 SetSubjectToken
+
+ This routine fixes the RT tag in the subject. It's unlikely that you want to overwrite this.
+
+=cut
+
+sub SetSubjectToken {
+  my $self=shift;
+  my $tag = "[$RT::rtname #".$self->TicketObj->id."]";
+  my $sub = $self->TemplateObj->MIMEObj->head->get('Subject');
+  unless ($sub =~ /\Q$tag\E/) {
+    $sub =~ s/(\r\n|\n|\s)/ /gi;
+    chomp $sub;
+    $self->TemplateObj->MIMEObj->head->replace('Subject', "$tag $sub");
+  }
+}
+
+# }}}
+
+# }}}
+
+__END__
+
+# {{{ POD
+
+# }}}
+
+1;
+
diff --git a/rt/lib/RT/Action/SendPasswordEmail.pm b/rt/lib/RT/Action/SendPasswordEmail.pm
new file mode 100755 (executable)
index 0000000..91bb3c1
--- /dev/null
@@ -0,0 +1,170 @@
+# $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
new file mode 100644 (file)
index 0000000..09d3448
--- /dev/null
@@ -0,0 +1,68 @@
+# 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/Attachment.pm b/rt/lib/RT/Attachment.pm
new file mode 100755 (executable)
index 0000000..916ac35
--- /dev/null
@@ -0,0 +1,423 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attachment.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Copyright 2000 Jesse Vincent <jesse@fsck.com>
+# Released under the terms of the GNU Public License
+
+=head1 NAME
+
+  RT::Attachment -- an RT attachment object
+
+=head1 SYNOPSIS
+
+  use RT::Attachment;
+
+
+=head1 DESCRIPTION
+
+This module should never be instantiated directly by client code. it's an internal 
+module which should only be instantiated through exported APIs in Ticket, Queue and other 
+similar objects.
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Attachment);
+
+=end testing
+
+=cut
+
+package RT::Attachment;
+use RT::Record;
+use MIME::Base64;
+use vars qw|@ISA|;
+@ISA= qw(RT::Record);
+
+# {{{ sub _Init
+sub _Init  {
+    my $self = shift; 
+    $self->{'table'} = "Attachments";
+    return($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _ClassAccessible 
+sub _ClassAccessible {
+    {
+    TransactionId   => { 'read'=>1, 'public'=>1, },
+    MessageId       => { 'read'=>1, },
+    Parent          => { 'read'=>1, },
+    ContentType     => { 'read'=>1, },
+    Subject         => { 'read'=>1, },
+    Content         => { 'read'=>1, },
+    ContentEncoding => { 'read'=>1, },
+    Headers         => { 'read'=>1, },
+    Filename        => { 'read'=>1, },
+    Creator         => { 'read'=>1, 'auto'=>1, },
+    Created         => { 'read'=>1, 'auto'=>1, },
+  };
+}
+# }}}
+
+# {{{ sub TransactionObj 
+
+=head2 TransactionObj
+
+Returns the transaction object asscoiated with this attachment.
+
+=cut
+
+sub TransactionObj {
+    require RT::Transaction;
+    my $self=shift;
+    unless (exists $self->{_TransactionObj}) {
+       $self->{_TransactionObj}=RT::Transaction->new($self->CurrentUser);
+       $self->{_TransactionObj}->Load($self->TransactionId);
+    }
+    return $self->{_TransactionObj};
+}
+
+# }}}
+
+# {{{ sub Create 
+
+=head2 Create
+
+Create a new attachment. Takes a paramhash:
+    
+    'Attachment' Should be a single MIME body with optional subparts
+    'Parent' is an optional Parent RT::Attachment object
+    'TransactionId' is the mandatory id of the Transaction this attachment is associated with.;
+
+=cut
+
+sub Create  {
+    my $self = shift;
+    my ($id);
+    my %args = ( id => 0,
+                TransactionId => 0,
+                Parent => 0,
+                Attachment => undef,
+                @_
+              );
+    
+    
+    #For ease of reference
+    my $Attachment = $args{'Attachment'};
+    
+    #if we didn't specify a ticket, we need to bail
+    if ( $args{'TransactionId'} == 0) {
+       $RT::Logger->crit("RT::Attachment->Create couldn't, as you didn't specify a transaction\n");
+       return (0);
+       
+    }
+    
+    #If we possibly can, collapse it to a singlepart
+    $Attachment->make_singlepart;
+    
+    #Get the subject
+    my $Subject = $Attachment->head->get('subject',0);
+    defined($Subject) or $Subject = '';
+    chomp($Subject);
+  
+    #Get the filename
+    my $Filename = $Attachment->head->recommended_filename;
+    
+    if ($Attachment->parts) {
+       $id = $self->SUPER::Create(TransactionId => $args{'TransactionId'},
+                                  Parent => 0,
+                                  ContentType  => $Attachment->mime_type,
+                                  Headers => $Attachment->head->as_string,
+                                  Subject => $Subject,
+                                  
+                                 );
+       foreach my $part ($Attachment->parts) { 
+           my $SubAttachment = new RT::Attachment($self->CurrentUser);
+           $SubAttachment->Create(TransactionId => $args{'TransactionId'},
+                                  Parent => $id,
+                                  Attachment => $part,
+                                  ContentType  => $Attachment->mime_type,
+                                  Headers => $Attachment->head->as_string(),
+                                  
+                                 );
+       }
+       return ($id);
+    }
+  
+  
+    #If it's not multipart
+    else {
+       
+       my $ContentEncoding = 'none'; 
+       
+       my $Body = $Attachment->bodyhandle->as_string;
+       
+       #get the max attachment length from RT
+       my $MaxSize = $RT::MaxAttachmentSize;
+       
+       #if the current attachment contains nulls and the 
+       #database doesn't support embedded nulls
+       
+       if ( (! $RT::Handle->BinarySafeBLOBs) &&
+            ( $Body =~ /\x00/ ) ) {
+           # set a flag telling us to mimencode the attachment
+           $ContentEncoding = 'base64';
+           
+           #cut the max attchment size by 25% (for mime-encoding overhead.
+           $RT::Logger->debug("Max size is $MaxSize\n");
+           $MaxSize = $MaxSize * 3/4;  
+       }
+       
+       #if the attachment is larger than the maximum size
+       if (($MaxSize) and ($MaxSize < length($Body))) {
+           # if we're supposed to truncate large attachments
+           if ($RT::TruncateLongAttachments) {
+               # truncate the attachment to that length.
+               $Body = substr ($Body, 0, $MaxSize);
+
+           }
+           
+           # elsif we're supposed to drop large attachments on the floor,
+           elsif ($RT::DropLongAttachments) {
+               # drop the attachment on the floor
+               $RT::Logger->info("$self: Dropped an attachment of size ". length($Body).
+                                 "\n". "It started: ". substr($Body, 0, 60) . "\n");
+               return(undef);
+           }
+       }
+       # if we need to mimencode the attachment
+       if ($ContentEncoding eq 'base64') {
+           # base64 encode the attachment
+           $Body = MIME::Base64::encode_base64($Body);
+           
+       }
+       
+       my $id = $self->SUPER::Create(TransactionId => $args{'TransactionId'},
+                                     ContentType  => $Attachment->mime_type,
+                                     ContentEncoding => $ContentEncoding,
+                                     Parent => $args{'Parent'},
+                                     Content => $Body,
+                                     Headers => $Attachment->head->as_string,
+                                     Subject => $Subject,
+                                     Filename => $Filename,
+                                    );
+       return ($id);
+    }
+}
+
+# }}}
+
+
+# {{{ sub Content
+
+=head2 Content
+
+Returns the attachment's content. if it's base64 encoded, decode it 
+before returning it.
+
+=cut
+
+sub Content {
+  my $self = shift;
+  if ( $self->ContentEncoding eq 'none' || ! $self->ContentEncoding ) {
+      return $self->_Value('Content');
+  } elsif ( $self->ContentEncoding eq 'base64' ) {
+      return MIME::Base64::decode_base64($self->_Value('Content'));
+  } else {
+      return( "Unknown ContentEncoding ". $self->ContentEncoding);
+  }
+}
+
+
+# }}}
+
+# {{{ sub Children
+
+=head2 Children
+
+  Returns an RT::Attachments object which is preloaded with all Attachments objects with this Attachment\'s Id as their 'Parent'
+
+=cut
+
+sub Children {
+    my $self = shift;
+    
+    my $kids = new RT::Attachments($self->CurrentUser);
+    $kids->ChildrenOf($self->Id);
+    return($kids);
+}
+
+# }}}
+
+# {{{ UTILITIES
+
+# {{{ sub Quote 
+
+
+
+sub Quote {
+    my $self=shift;
+    my %args=(Reply=>undef, # Prefilled reply (i.e. from the KB/FAQ system)
+             @_);
+
+    my ($quoted_content, $body, $headers);
+    my $max=0;
+
+    # TODO: Handle Multipart/Mixed (eventually fix the link in the
+    # ShowHistory web template?)
+    if ($self->ContentType =~ m{^(text/plain|message)}i) {
+       $body=$self->Content;
+
+       # Do we need any preformatting (wrapping, that is) of the message?
+
+       # Remove quoted signature.
+       $body =~ s/\n-- \n(.*)$//s;
+
+       # What's the longest line like?
+       foreach (split (/\n/,$body)) {
+           $max=length if ( length > $max);
+       }
+
+       if ($max>76) {
+           require Text::Wrapper;
+           my $wrapper=new Text::Wrapper
+               (
+                columns => 70, 
+                body_start => ($max > 70*3 ? '   ' : ''),
+                par_start => ''
+                );
+           $body=$wrapper->wrap($body);
+       }
+
+       $body =~ s/^/> /gm;
+
+       $body = '[' . $self->TransactionObj->CreatorObj->Name() . ' - ' . $self->TransactionObj->CreatedAsString()
+                   . "]:\n\n"
+               . $body . "\n\n";
+
+    } else {
+       $body = "[Non-text message not quoted]\n\n";
+    }
+    
+    $max=60 if $max<60;
+    $max=70 if $max>78;
+    $max+=2;
+
+    return (\$body, $max);
+}
+# }}}
+
+# {{{ sub NiceHeaders - pulls out only the most relevant headers
+
+=head2 NiceHeaders
+
+Returns the To, From, Cc, Date and Subject headers.
+
+It is a known issue that this breaks if any of these headers are not
+properly unfolded.
+
+=cut
+
+sub NiceHeaders {
+    my $self=shift;
+    my $hdrs="";
+    for (split(/\n/,$self->Headers)) {
+           $hdrs.="$_\n" if /^(To|From|RT-Send-Cc|Cc|Date|Subject): /i
+    }
+    return $hdrs;
+}
+# }}}
+
+# {{{ sub Headers
+
+=head2 Headers
+
+Returns this object's headers as a string.  This method specifically
+removes the RT-Send-Bcc: header, so as to never reveal to whom RT sent a Bcc.
+We need to record the RT-Send-Cc and RT-Send-Bcc values so that we can actually send
+out mail. (The mailing rules are seperated from the ticket update code by
+an abstraction barrier that makes it impossible to pass this data directly
+
+=cut
+
+sub Headers {
+    my $self = shift;
+    my $hdrs="";
+    for (split(/\n/,$self->SUPER::Headers)) {
+           $hdrs.="$_\n" unless /^(RT-Send-Bcc): /i
+    }
+    return $hdrs;
+}
+
+
+# }}}
+
+# {{{ sub GetHeader
+
+=head2 GetHeader ( 'Tag')
+
+Returns the value of the header Tag as a string. This bypasses the weeding out
+done in Headers() above.
+
+=cut
+
+sub GetHeader {
+    my $self = shift;
+    my $tag = shift;
+    foreach my $line (split(/\n/,$self->SUPER::Headers)) {
+        $RT::Logger->debug( "Does $line match $tag\n");
+        if ($line =~ /^$tag:\s+(.*)$/i) { #if we find the header, return its value
+            return ($1);
+        }
+    }
+    
+    # we found no header. return an empty string
+    return undef;
+}
+# }}}
+
+# {{{ sub _Value 
+
+=head2 _Value
+
+Takes the name of a table column.
+Returns its value as a string, if the user passes an ACL check
+
+=cut
+
+sub _Value  {
+
+    my $self = shift;
+    my $field = shift;
+    
+    
+    #if the field is public, return it.
+    if ($self->_Accessible($field, 'public')) {
+       #$RT::Logger->debug("Skipping ACL check for $field\n");
+       return($self->__Value($field));
+       
+    }
+    
+    #If it's a comment, we need to be extra special careful
+    elsif ( (($self->TransactionObj->CurrentUserHasRight('ShowTicketComments')) and
+            ($self->TransactionObj->Type eq 'Comment') )  or
+           ($self->TransactionObj->CurrentUserHasRight('ShowTicket'))) {
+       
+       return($self->__Value($field));
+    }
+    #if they ain't got rights to see, don't let em
+    else {
+           return(undef);
+       }
+       
+    
+}
+
+# }}}
+
+# }}}
+
+1;
diff --git a/rt/lib/RT/Attachments.pm b/rt/lib/RT/Attachments.pm
new file mode 100755 (executable)
index 0000000..73cd350
--- /dev/null
@@ -0,0 +1,99 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attachments.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Attachments - a collection of RT::Attachment objects
+
+=head1 SYNOPSIS
+
+  use RT::Attachments;
+
+=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::Attachments);
+
+=end testing
+
+=cut
+
+package RT::Attachments;
+
+use RT::EasySearch;
+
+@ISA= qw(RT::EasySearch);
+
+# {{{ sub _Init  
+sub _Init   {
+  my $self = shift;
+  $self->{'table'} = "Attachments";
+  $self->{'primary_key'} = "id";
+  return ( $self->SUPER::_Init(@_));
+}
+# }}}
+
+
+# {{{ sub ContentType
+
+=head2 ContentType (VALUE => 'text/plain', ENTRYAGGREGATOR => 'OR', OPERATOR => '=' ) 
+
+Limit result set to attachments of ContentType 'TYPE'...
+
+=cut
+
+
+sub ContentType  {
+  my $self = shift;
+  my %args = ( VALUE => 'text/plain',
+              OPERATOR => '=',
+              ENTRYAGGREGATOR => 'OR',
+              @_);
+
+  $self->Limit ( FIELD => 'ContentType',
+                VALUE => $args{'VALUE'},
+                OPERATOR => $args{'OPERATOR'},
+                ENTRYAGGREGATOR => $args{'ENTRYAGGREGATOR'});
+}
+# }}}
+
+# {{{ sub ChildrenOf 
+
+=head2 ChildrenOf ID
+
+Limit result set to children of Attachment ID
+
+=cut
+
+
+sub ChildrenOf  {
+  my $self = shift;
+  my $attachment = shift;
+  $self->Limit ( FIELD => 'Parent',
+                VALUE => $attachment);
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+
+  use RT::Attachment;
+  my $item = new RT::Attachment($self->CurrentUser);
+  return($item);
+}
+# }}}
+  1;
+
+
+
+
diff --git a/rt/lib/RT/Condition/AnyTransaction.pm b/rt/lib/RT/Condition/AnyTransaction.pm
new file mode 100644 (file)
index 0000000..83e5de6
--- /dev/null
@@ -0,0 +1,23 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Condition/AnyTransaction.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com> 
+# Released under the terms of the GNU General Public License
+
+package RT::Condition::AnyTransaction;
+require RT::Condition::Generic;
+
+@ISA = qw(RT::Condition::Generic);
+
+
+=head2 IsApplicable
+
+This happens on every transaction. it's always applicable
+
+=cut
+
+sub IsApplicable {
+    my $self = shift;
+    return(1);
+}
+
+1;
+
diff --git a/rt/lib/RT/Condition/Generic.pm b/rt/lib/RT/Condition/Generic.pm
new file mode 100755 (executable)
index 0000000..393f4b7
--- /dev/null
@@ -0,0 +1,170 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Condition/Generic.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::Condition::Generic - ;
+
+=head1 SYNOPSIS
+
+    use RT::Condition::Generic;
+    my $foo = new RT::Condition::IsApplicable( 
+               TransactionObj => $tr, 
+               TicketObj => $ti, 
+               ScripObj => $scr, 
+               Argument => $arg, 
+               Type => $type);
+
+    if ($foo->IsApplicable) {
+          # do something
+    }
+
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Condition::Generic);
+
+=end testing
+
+
+=cut
+
+package RT::Condition::Generic;
+
+# {{{ sub new 
+sub new  {
+  my $proto = shift;
+  my $class = ref($proto) || $proto;
+  my $self  = {};
+  bless ($self, $class);
+  $self->_Init(@_);
+  return $self;
+}
+# }}}
+
+# {{{ sub _Init 
+sub _Init  {
+  my $self = shift;
+  my %args = ( TransactionObj => undef,
+              TicketObj => undef,
+              ScripObj => undef,
+              TemplateObj => undef,
+              Argument => undef,
+              ApplicableTransTypes => undef,
+              @_ );
+  
+  
+  $self->{'Argument'} = $args{'Argument'};
+  $self->{'ScripObj'} = $args{'ScripObj'};
+  $self->{'TicketObj'} = $args{'TicketObj'};
+  $self->{'TransactionObj'} = $args{'TransactionObj'};
+  $self->{'ApplicableTransTypes'} = $args{'ApplicableTransTypes'};
+}
+# }}}
+
+# Access Scripwide data
+
+# {{{ sub Argument 
+
+=head2 Argument
+
+Return the optional argument associated with this ScripCondition
+
+=cut
+
+sub Argument  {
+  my $self = shift;
+  return($self->{'Argument'});
+}
+# }}}
+
+# {{{ sub TicketObj
+
+=head2 TicketObj
+
+Return the ticket object we're talking about
+
+=cut
+
+sub TicketObj  {
+  my $self = shift;
+  return($self->{'TicketObj'});
+}
+# }}}
+
+# {{{ sub TransactionObj
+
+=head2 TransactionObj
+
+Return the transaction object we're talking about
+
+=cut
+
+sub TransactionObj  {
+  my $self = shift;
+  return($self->{'TransactionObj'});
+}
+# }}}
+
+# {{{ sub Type
+
+=head2 Type 
+
+
+
+=cut
+
+sub ApplicableTransTypes  {
+  my $self = shift;
+  return($self->{'ApplicableTransTypes'});
+}
+# }}}
+
+
+# Scrip methods
+
+
+#What does this type of Action does
+
+# {{{ sub Describe 
+sub Describe  {
+  my $self = shift;
+  return ("No description for " . ref $self);
+}
+# }}}
+
+
+#Parse the templates, get things ready to go.
+
+#If this rule applies to this transaction, return true.
+
+# {{{ sub IsApplicable 
+sub IsApplicable  {
+  my $self = shift;
+  return(undef);
+}
+# }}}
+
+# {{{ sub DESTROY
+sub DESTROY {
+    my $self = shift;
+
+    # We need to clean up all the references that might maybe get
+    # oddly circular
+    $self->{'TemplateObj'} =undef
+    $self->{'TicketObj'} = undef;
+    $self->{'TransactionObj'} = undef;
+    $self->{'ScripObj'} = undef;
+     
+}
+
+# }}}
+1;
diff --git a/rt/lib/RT/Condition/NewDependency.pm b/rt/lib/RT/Condition/NewDependency.pm
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/rt/lib/RT/Condition/StatusChange.pm b/rt/lib/RT/Condition/StatusChange.pm
new file mode 100644 (file)
index 0000000..56419b2
--- /dev/null
@@ -0,0 +1,30 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Condition/StatusChange.pm,v 1.1 2002-08-12 06:17:08 ivan Exp $
+# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com> 
+# Released under the terms of the GNU General Public License
+
+package RT::Condition::StatusChange;
+require RT::Condition::Generic;
+
+@ISA = qw(RT::Condition::Generic);
+
+
+=head2 IsApplicable
+
+If the argument passed in is equivalent to the new value of
+the Status Obj
+
+=cut
+
+sub IsApplicable {
+    my $self = shift;
+    if (($self->TransactionObj->Field eq 'Status') and 
+    ($self->Argument eq $self->TransactionObj->NewValue())) {
+       return(1);
+    } 
+    else {
+       return(undef);
+    }
+}
+
+1;
+
diff --git a/rt/lib/RT/CurrentUser.pm b/rt/lib/RT/CurrentUser.pm
new file mode 100755 (executable)
index 0000000..6997ddb
--- /dev/null
@@ -0,0 +1,270 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/CurrentUser.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# (c) 1996-1999 Jesse Vincent <jesse@fsck.com>
+# This software is redistributable under the terms of the GNU GPL
+
+=head1 NAME
+
+  RT::CurrentUser - an RT object representing the current user
+
+=head1 SYNOPSIS
+
+  use RT::CurrentUser
+
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::CurrentUser);
+
+=end testing
+
+=cut
+
+
+package RT::CurrentUser;
+use RT::Record;
+@ISA= qw(RT::Record);
+
+
+# {{{ sub _Init 
+
+#The basic idea here is that $self->CurrentUser is always supposed
+# to be a CurrentUser object. but that's hard to do when we're trying to load
+# the CurrentUser object
+
+sub _Init  {
+  my $self = shift;
+  my $Name = shift;
+
+  $self->{'table'} = "Users";
+
+  if (defined($Name)) {
+    $self->Load($Name);
+  }
+  
+  $self->_MyCurrentUser($self);
+
+}
+# }}}
+
+# {{{ sub Create
+
+sub Create {
+    return (0, 'Permission Denied');
+}
+
+# }}}
+
+# {{{ sub Delete
+
+sub Delete {
+    return (0, 'Permission Denied');
+}
+
+# }}}
+
+# {{{ sub UserObj
+
+=head2 UserObj
+
+  Returns the RT::User object associated with this CurrentUser object.
+
+=cut
+
+sub UserObj {
+    my $self = shift;
+    
+    unless ($self->{'UserObj'}) {
+       use RT::User;
+       $self->{'UserObj'} = RT::User->new($self);
+       unless ($self->{'UserObj'}->Load($self->Id)) {
+           $RT::Logger->err("Couldn't load ".$self->Id. "from the users database.\n");
+       }
+       
+    }
+    return ($self->{'UserObj'});
+}
+# }}}
+
+# {{{ sub _Accessible 
+sub _Accessible  {
+  my $self = shift;
+  my %Cols = (
+             Name => 'read',
+             Gecos => 'read',
+             RealName => 'read',
+             Password => 'neither',
+             EmailAddress => 'read',
+             Privileged => 'read',
+             IsAdministrator => 'read'
+            );
+  return($self->SUPER::_Accessible(@_, %Cols));
+}
+# }}}
+
+# {{{ sub LoadByEmail
+
+=head2 LoadByEmail
+
+Loads a User into this CurrentUser object.
+Takes the email address of the user to load.
+
+=cut
+
+sub LoadByEmail  {
+    my $self = shift;
+    my $identifier = shift;
+        
+    $self->LoadByCol("EmailAddress",$identifier);
+    
+}
+# }}}
+
+# {{{ sub LoadByGecos
+
+=head2 LoadByGecos
+
+Loads a User into this CurrentUser object.
+Takes a unix username as its only argument.
+
+=cut
+
+sub LoadByGecos  {
+    my $self = shift;
+    my $identifier = shift;
+        
+    $self->LoadByCol("Gecos",$identifier);
+    
+}
+# }}}
+
+# {{{ sub LoadByName
+
+=head2 LoadByName
+
+Loads a User into this CurrentUser object.
+Takes a Name.
+=cut
+
+sub LoadByName {
+    my $self = shift;
+    my $identifier = shift;
+    $self->LoadByCol("Name",$identifier);
+    
+}
+# }}}
+
+# {{{ sub Load 
+
+=head2 Load
+
+Loads a User into this CurrentUser object.
+Takes either an integer (users id column reference) or a Name
+The latter is deprecated. Instead, you should use LoadByName.
+Formerly, this routine also took email addresses. 
+
+=cut
+
+sub Load  {
+  my $self = shift;
+  my $identifier = shift;
+
+  #if it's an int, load by id. otherwise, load by name.
+  if ($identifier !~ /\D/) {
+    $self->SUPER::LoadById($identifier);
+  }
+  else {
+      # This is a bit dangerous, we might get false authen if somebody
+      # uses ambigous userids or real names:
+      $self->LoadByCol("Name",$identifier);
+  }
+}
+
+# }}}
+
+# {{{ sub IsPassword
+
+=head2 IsPassword
+
+Takes a password as a string.  Passes it off to IsPassword in this
+user's UserObj.  If it is the user's password and the user isn't
+disabled, returns 1.
+
+Otherwise, returns undef.
+
+=cut
+
+sub IsPassword { 
+  my $self = shift;
+  my $value = shift;
+  
+  return ($self->UserObj->IsPassword($value)); 
+}
+
+# }}}
+
+# {{{ sub Privileged
+
+=head2 Privileged
+
+Returns true if the current user can be granted rights and be
+a member of groups.
+
+=cut
+
+sub Privileged {
+    my $self = shift;
+    return ($self->UserObj->Privileged());
+}
+
+# }}}
+
+# {{{ Convenient ACL methods
+
+=head2 HasQueueRight
+
+calls $self->UserObj->HasQueueRight with the arguments passed in
+
+=cut
+
+sub HasQueueRight {
+       my $self = shift;
+       return ($self->UserObj->HasQueueRight(@_));
+}
+
+=head2 HasSystemRight
+
+calls $self->UserObj->HasSystemRight with the arguments passed in
+
+=cut
+
+
+sub HasSystemRight {
+       my $self = shift;
+       return ($self->UserObj->HasSystemRight(@_));
+}
+# }}}
+
+# {{{ sub HasRight
+
+=head2 HasSystemRight
+
+calls $self->UserObj->HasRight with the arguments passed in
+
+=cut
+
+sub HasRight {
+  my $self = shift;
+  return ($self->UserObj->HasRight(@_));
+}
+
+# }}}
+
+1;
diff --git a/rt/lib/RT/Date.pm b/rt/lib/RT/Date.pm
new file mode 100644 (file)
index 0000000..d569971
--- /dev/null
@@ -0,0 +1,436 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Date.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::Date - a simple Object Oriented date.
+
+=head1 SYNOPSIS
+
+  use RT::Date
+
+=head1 DESCRIPTION
+
+RT Date is a simple Date Object designed to be speedy and easy for RT to use
+
+The fact that it assumes that a time of 0 means "never" is probably a bug.
+
+=begin testing
+
+ok (require RT::Date);
+
+=end testing
+
+=head1 METHODS
+
+=cut
+
+
+package RT::Date;
+use Time::Local;
+use vars qw($MINUTE $HOUR $DAY $WEEK $MONTH $YEAR);
+
+$MINUTE = 60;
+$HOUR   = 60 * $MINUTE;
+$DAY    = 24 * $HOUR;
+$WEEK   = 7 * $DAY;
+$MONTH  = 4 * $WEEK;
+$YEAR   = 365 * $DAY;
+
+# {{{ sub new 
+
+sub new  {
+  my $proto = shift;
+  my $class = ref($proto) || $proto;
+  my $self  = {};
+  bless ($self, $class);
+  $self->Unix(0);
+  return $self;
+}
+
+# }}}
+
+# {{{ sub Set
+
+=head2 sub Set
+
+takes a param hash with the fields 'Format' and 'Value'
+
+if $args->{'Format'} is 'unix', takes the number of seconds since the epoch 
+
+If $args->{'Format'} is ISO, tries to parse an ISO date.
+
+If $args->{'Format'} is 'unknown', require Date::Parse and make it figure things
+out. This is a heavyweight operation that should never be called from within 
+RT's core. But it's really useful for something like the textbox date entry
+where we let the user do whatever they want.
+
+If $args->{'Value'}  is 0, assumes you mean never.
+
+
+=cut
+
+sub Set {
+    my $self = shift;
+    my %args = ( Format => 'unix',
+                Value => time,
+                @_);
+    if (($args{'Value'} =~ /^\d*$/) and ($args{'Value'} == 0)) {
+       $self->Unix(-1);
+       return($self->Unix());
+    }
+
+    if ($args{'Format'} =~ /^unix$/i) {
+       $self->Unix($args{'Value'});
+    }
+    
+    elsif ($args{'Format'} =~ /^(sql|datemanip|iso)$/i) {
+       
+       if (($args{'Value'} =~ /^(\d{4}?)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) ||
+           ($args{'Value'} =~ /^(\d{4}?)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/) ||
+           ($args{'Value'} =~ /^(\d{4}?)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)\+00$/) ||
+           ($args{'Value'} =~ /^(\d{4}?)(\d\d)(\d\d)(\d\d):(\d\d):(\d\d)$/)) {
+           
+        my $year = $1;
+           my $mon = $2;
+           my $mday = $3;
+           my $hours = $4;
+           my $min = $5;
+           my $sec = $6;
+           
+           #timegm expects month as 0->11
+           $mon--;
+           
+           #now that we've parsed it, deal with the case where everything
+           #was 0
+            if ($mon == -1) {
+                   $self->Unix(-1);
+               } else {
+
+                   #Dateamnip strings aren't in GMT.
+                   if ($args{'Format'} =~ /^datemanip$/i) {
+                       $self->Unix(timelocal($sec,$min,$hours,$mday,$mon,$year));
+                   }
+                   #ISO and SQL dates are in GMT
+                   else {
+                       $self->Unix(timegm($sec,$min,$hours,$mday,$mon,$year));
+                   }
+                   
+                   $self->Unix(-1) unless $self->Unix;
+               }
+   }  
+       else {
+           use Carp;
+           Carp::cluck;
+           $RT::Logger->debug( "Couldn't parse date $args{'Value'} as a $args{'Format'}");
+           
+       }
+    }
+    elsif ($args{'Format'} =~ /^unknown$/i) {
+        require Date::Parse;
+        #Convert it to an ISO format string 
+        
+       my $date = Date::Parse::str2time($args{'Value'});
+        
+       #This date has now been set to a date in the _local_ timezone.
+       #since ISO dates are known to be in GMT (for RT's purposes);
+       
+       $RT::Logger->debug("RT::Date used date::parse to make ".$args{'Value'} . " $date\n");
+        
+       
+       return ($self->Set( Format => 'unix', Value => "$date"));
+    }                                                    
+    else {
+       die "Unknown Date format: ".$args{'Format'}."\n";
+    }
+    
+    return($self->Unix());
+}
+
+# }}}
+
+# {{{ sub SetToMidnight 
+
+=head2 SetToMidnight
+
+Sets the date to midnight (at the beginning of the day) GMT
+Returns the unixtime at midnight.
+
+=cut
+
+sub SetToMidnight {
+    my $self = shift;
+    
+    use Time::Local;
+    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime($self->Unix);
+    $self->Unix(timegm (0,0,0,$mday,$mon,$year,$wday,$yday));
+    
+    return ($self->Unix);
+    
+    
+}
+
+
+# }}}
+
+# {{{ sub SetToNow
+sub SetToNow {
+       my $self = shift;
+       return($self->Set(Format => 'unix', Value => time))
+}
+# }}}
+
+# {{{ sub Diff
+
+=head2 Diff
+
+Takes either an RT::Date object or the date in unixtime format as a string
+
+Returns the differnce between $self and that time as a number of seconds
+
+=cut
+
+sub Diff {
+    my $self = shift;
+    my $other = shift;
+
+    if (ref($other) eq 'RT::Date') {
+       $other=$other->Unix;
+    }
+    return ($self->Unix - $other);
+}
+# }}}
+
+# {{{ sub DiffAsString
+
+=head2 sub DiffAsString
+
+Takes either an RT::Date object or the date in unixtime format as a string
+
+Returns the differnce between $self and that time as a number of seconds as
+as string fit for human consumption
+
+=cut
+
+sub DiffAsString {
+    my $self = shift;
+    my $other = shift;
+
+
+    if ($other < 1) {
+       return ("");
+    }
+    if ($self->Unix < 1) {
+       return("");
+    }
+    my $diff = $self->Diff($other);
+
+    return ($self->DurationAsString($diff));
+}
+# }}}
+
+# {{{ sub DurationAsString
+
+=head2 DurationAsString
+
+Takes a number of seconds. returns a string describing that duration
+
+=cut
+
+sub DurationAsString{
+
+    my $self=shift;
+    my $duration = shift;
+    
+    my ($negative, $s);
+    
+    $negative = 'ago' if ($duration < 0);
+
+    $duration = abs($duration);
+
+    if($duration < $MINUTE) {
+       $s=$duration;
+       $string="sec";
+    } elsif($duration < (2 * $HOUR)) {
+       $s = int($duration/$MINUTE);
+       $string="min";
+    } elsif($duration < (2 * $DAY)) {
+       $s = int($duration/$HOUR);
+       $string="hours";
+    } elsif($duration < (2 * $WEEK)) {
+       $s = int($duration/$DAY);
+       $string="days";
+    } elsif($duration < (2 * $MONTH)) {
+       $s = int($duration/$WEEK);
+       $string="weeks";
+    } elsif($duration < $YEAR) {
+       $s = int($duration/$MONTH);
+       $string="months";
+    } else {
+       $s = int($duration/$YEAR);
+       $string="years";
+    }
+    
+    return ("$s $string $negative");
+}
+
+# }}}
+
+# {{{ sub AgeAsString
+
+=head2 sub AgeAsString
+
+Takes nothing
+
+Returns a string that's the differnce between the time in the object and now
+
+=cut
+
+sub AgeAsString {
+    my $self = shift;
+    return ($self->DiffAsString(time));
+    }
+# }}}
+
+# {{{ sub AsString
+
+=head2 sub AsString
+
+Returns the object\'s time as a string with the current timezone.
+
+=cut
+
+sub AsString {
+    my $self = shift;
+    return ("Not set") if ($self->Unix <= 0);
+
+    return (scalar(localtime($self->Unix)));
+}
+# }}}
+
+# {{{ sub AddSeconds
+
+=head2 sub AddSeconds
+
+Takes a number of seconds as a string
+
+Returns the new time
+
+=cut
+
+sub AddSeconds {
+    my $self = shift;
+    my $delta = shift;
+    
+    $self->Set(Format => 'unix', Value => ($self->Unix + $delta));
+    
+    return ($self->Unix);
+    
+
+}
+
+# }}}
+
+# {{{ sub AddDays
+
+=head2 AddDays $DAYS
+
+Adds 24 hours * $DAYS to the current time
+
+=cut
+
+sub AddDays {
+    my $self = shift;
+    my $days = shift;
+    $self->AddSeconds($days * $DAY);
+    
+}
+
+# }}}
+
+# {{{ sub AddDay
+
+=head2 AddDay
+
+Adds 24 hours to the current time
+
+=cut
+
+sub AddDay {
+    my $self = shift;
+    $self->AddSeconds($DAY);
+    
+}
+
+# }}}
+
+# {{{ sub Unix
+
+=head2 sub Unix [unixtime]
+
+Optionally takes a date in unix seconds since the epoch format.
+Returns the number of seconds since the epoch
+
+=cut
+
+sub Unix {
+    my $self = shift;
+    
+    $self->{'time'} = shift if (@_);
+    
+    return ($self->{'time'});
+}
+# }}}
+
+# {{{ sub ISO
+
+=head2 ISO
+
+Takes nothing
+
+Returns the object's date in ISO format
+
+=cut
+
+sub ISO {
+    my $self=shift;
+    my    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst, $date) ;
+    
+    return ('1970-01-01 00:00:00') if ($self->Unix == -1);
+
+    #  0    1    2     3     4    5     6     7     8
+    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($self->Unix);
+    #make the year YYYY
+    $year+=1900;
+
+    #the month needs incrementing, as gmtime returns 0-11
+    $mon++;
+        
+    $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year,$mon,$mday, $hour,$min,$sec);
+    
+    return ($date);
+}
+
+# }}}
+
+
+# {{{ sub LocalTimezone 
+=head2 LocalTimezone
+
+  Returns the current timezone. For now, draws off a system timezone, RT::Timezone. Eventually, this may
+pull from a 'Timezone' attribute of the CurrentUser
+
+=cut
+
+sub LocalTimezone {
+    my $self = shift;
+    
+    return ($RT::Timezone);
+}
+
+# }}}
+
+
+
+1;
diff --git a/rt/lib/RT/EasySearch.pm b/rt/lib/RT/EasySearch.pm
new file mode 100755 (executable)
index 0000000..bcbfa01
--- /dev/null
@@ -0,0 +1,115 @@
+#$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/Group.pm b/rt/lib/RT/Group.pm
new file mode 100755 (executable)
index 0000000..005601f
--- /dev/null
@@ -0,0 +1,364 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Group.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Copyright 2000 Jesse Vincent <jesse@fsck.com>
+# Released under the terms of the GNU Public License
+#
+#
+
+=head1 NAME
+
+  RT::Group - RT\'s group object
+
+=head1 SYNOPSIS
+
+  use RT::Group;
+my $group = new RT::Group($CurrentUser);
+
+=head1 DESCRIPTION
+
+An RT group object.
+
+=head1 AUTHOR
+
+Jesse Vincent, jesse@fsck.com
+
+=head1 SEE ALSO
+
+RT
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Group);
+
+=end testing
+
+=cut
+
+
+package RT::Group;
+use RT::Record;
+use RT::GroupMember;
+use RT::ACE;
+
+use vars qw|@ISA|;
+@ISA= qw(RT::Record);
+
+
+# {{{ sub _Init
+sub _Init  {
+  my $self = shift; 
+  $self->{'table'} = "Groups";
+  return ($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _Accessible 
+sub _Accessible  {
+    my $self = shift;
+    my %Cols = (
+               Name => 'read/write',
+               Description => 'read/write',
+               Pseudo => 'read'
+              );
+    return $self->SUPER::_Accessible(@_, %Cols);
+}
+# }}}
+
+# {{{ sub Load 
+
+=head2 Load
+
+Load a group object from the database. Takes a single argument.
+If the argument is numerical, load by the column 'id'. Otherwise, load by
+the "Name" column which is the group's textual name
+
+=cut
+
+sub Load  {
+    my $self = shift;
+    my $identifier = shift || return undef;
+    
+    #if it's an int, load by id. otherwise, load by name.
+    if ($identifier !~ /\D/) {
+       $self->SUPER::LoadById($identifier);
+    }
+    else {
+       $self->LoadByCol("Name",$identifier);
+    }
+}
+
+# }}}
+
+# {{{ sub Create
+
+=head2 Create
+
+Takes a paramhash with three named arguments: Name, Description and Pseudo.
+Pseudo is used internally by RT for certain special ACL decisions.
+
+=cut
+
+sub Create {
+    my $self = shift;
+    my %args = ( Name => undef,
+                Description => undef,
+                Pseudo => 0,
+                @_);
+    
+    unless ($self->CurrentUser->HasSystemRight('AdminGroups')) {
+       $RT::Logger->warning($self->CurrentUser->Name ." Tried to create a group without permission.");
+       return(0, 'Permission Denied');
+    }
+    
+    my $retval = $self->SUPER::Create(Name => $args{'Name'},
+                                     Description => $args{'Description'},
+                                     Pseudo => $args{'Pseudo'});
+    
+    return ($retval);
+}
+
+# }}}
+
+# {{{ sub Delete
+
+=head2 Delete
+
+Delete this object
+
+=cut
+
+sub Delete {
+    my $self = shift;
+    
+    unless ($self->CurrentUser->HasSystemRight('AdminGroups')) {
+       return (0, 'Permission Denied');
+    }
+    
+    return($self->SUPER::Delete(@_));    
+}
+
+# }}}
+
+# {{{ MembersObj
+
+=head2 MembersObj
+
+Returns an RT::GroupMembers object of this group's members.
+
+=cut
+
+sub MembersObj {
+    my $self = shift;
+    unless (defined $self->{'members_obj'}) {
+       use RT::GroupMembers;
+        $self->{'members_obj'} = new RT::GroupMembers($self->CurrentUser);
+       
+       #If we don't have rights, don't include any results
+       $self->{'members_obj'}->LimitToGroup($self->id);
+       
+    }
+    return ($self->{'members_obj'});
+    
+}
+
+# }}}
+
+# {{{ AddMember
+
+=head2 AddMember
+
+AddMember adds a user to this group.  It takes a user id.
+Returns a two value array. the first value is true on successful 
+addition or 0 on failure.  The second value is a textual status msg.
+
+=cut
+
+sub AddMember {
+    my $self = shift;
+    my $new_member = shift;
+
+    my $new_member_obj = new RT::User($self->CurrentUser);
+    $new_member_obj->Load($new_member);
+    
+    unless ($self->CurrentUser->HasSystemRight('AdminGroups')) {
+        #User has no permission to be doing this
+        return(0, "Permission Denied");
+    }
+
+    unless ($new_member_obj->Id) {
+       $RT::Logger->debug("Couldn't find user $new_member");
+       return(0, "Couldn't find user");
+    }  
+
+    if ($self->HasMember($new_member_obj->Id)) {
+        #User is already a member of this group. no need to add it
+        return(0, "Group already has member");
+    }
+    
+    my $member_object = new RT::GroupMember($self->CurrentUser);
+    $member_object->Create( UserId => $new_member_obj->Id, 
+                           GroupId => $self->id );
+    return(1, "Member added");
+}
+
+# }}}
+
+# {{{ HasMember
+
+=head2 HasMember
+
+Takes a user Id and returns a GroupMember Id if that user is a member of 
+this group.
+Returns undef if the user isn't a member of the group or if the current
+user doesn't have permission to find out. Arguably, it should differentiate
+between ACL failure and non membership.
+
+=cut
+
+sub HasMember {
+    my $self = shift;
+    my $user_id = shift;
+
+    #Try to cons up a member object using "LoadByCols"
+
+    my $member_obj = new RT::GroupMember($self->CurrentUser);
+    $member_obj->LoadByCols( UserId => $user_id, GroupId => $self->id);
+
+    #If we have a member object
+    if (defined $member_obj->id) {
+        return ($member_obj->id);
+    }
+
+    #If Load returns no objects, we have an undef id. 
+    else {
+        return(undef);
+    } 
+}
+
+# }}}
+
+# {{{ DeleteMember
+
+=head2 DeleteMember
+
+Takes the user id of a member.
+If the current user has apropriate rights,
+removes that GroupMember from this group.
+Returns a two value array. the first value is true on successful 
+addition or 0 on failure.  The second value is a textual status msg.
+
+=cut
+
+sub DeleteMember {
+    my $self = shift;
+    my $member = shift;
+
+    unless ($self->CurrentUser->HasSystemRight('AdminGroups')) {
+        #User has no permission to be doing this
+        return(0,"Permission Denied");
+    }
+
+    my $member_user_obj = new RT::User($self->CurrentUser);
+    $member_user_obj->Load($member);
+    
+    unless ($member_user_obj->Id) {
+       $RT::Logger->debug("Couldn't find user $member");
+       return(0, "User not found");
+    }  
+
+    my $member_obj = new RT::GroupMember($self->CurrentUser);
+    unless ($member_obj->LoadByCols ( UserId => $member_user_obj->Id,
+                                     GroupId => $self->Id )) {
+       return(0, "Couldn\'t load member");  #couldn\'t load member object
+    }
+    
+    #If we couldn't load it, return undef.
+    unless ($member_obj->Id()) {
+       return (0, "Group has no such member");
+    }  
+    
+    #Now that we've checked ACLs and sanity, delete the groupmember
+    my $val = $member_obj->Delete();
+    if ($val) {
+       return ($val, "Member deleted");
+    }
+    else {
+       return (0, "Member not deleted");
+    }
+}
+
+# }}}
+
+# {{{ ACL Related routines
+
+# {{{ GrantQueueRight
+
+=head2 GrantQueueRight
+
+Grant a queue right to this group.  Takes a paramhash of which the elements
+RightAppliesTo and RightName are important.
+
+=cut
+
+sub GrantQueueRight {
+    
+    my $self = shift;
+    my %args = ( RightScope => 'Queue',
+                RightName => undef,
+                RightAppliesTo => undef,
+                PrincipalType => 'Group',
+                PrincipalId => $self->Id,
+                @_);
+   
+    #ACLs get checked in ACE.pm
+    
+    my $ace = new RT::ACE($self->CurrentUser);
+    
+    return ($ace->Create(%args));
+}
+
+# }}}
+
+# {{{ GrantSystemRight
+
+=head2 GrantSystemRight
+
+Grant a system right to this group. 
+The only element that's important to set is RightName.
+
+=cut
+sub GrantSystemRight {
+    
+    my $self = shift;
+    my %args = ( RightScope => 'System',
+                RightName => undef,
+                RightAppliesTo => 0,
+                PrincipalType => 'Group',
+                PrincipalId => $self->Id,
+                @_);
+    
+    # ACLS get checked in ACE.pm
+    
+    my $ace = new RT::ACE($self->CurrentUser);
+    return ($ace->Create(%args));
+}
+
+
+# }}}
+
+
+# {{{ sub _Set
+sub _Set {
+    my $self = shift;
+
+    unless ($self->CurrentUser->HasSystemRight('AdminGroups')) {
+       return (0, 'Permission Denied');
+    }  
+
+    return ($self->SUPER::_Set(@_));
+
+}
+# }}}
diff --git a/rt/lib/RT/GroupMember.pm b/rt/lib/RT/GroupMember.pm
new file mode 100755 (executable)
index 0000000..69de50b
--- /dev/null
@@ -0,0 +1,136 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/GroupMember.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Copyright 2000 Jesse Vincent <jesse@fsck.com>
+# Released under the terms of the GNU Public License
+
+=head1 NAME
+
+  RT::GroupMember - a member of an RT Group
+
+=head1 SYNOPSIS
+
+RT::GroupMember should never be called directly. It should generally
+only be accessed through the helper functions in RT::Group;
+
+=head1 DESCRIPTION
+
+
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::GroupMember);
+
+=end testing
+
+
+=cut
+
+package RT::GroupMember;
+use RT::Record;
+use vars qw|@ISA|;
+@ISA= qw(RT::Record);
+
+# {{{ sub _Init
+sub _Init {
+  my $self = shift; 
+  $self->{'table'} = "GroupMembers";
+  return($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _Accessible 
+sub _Accessible  {
+    my $self = shift;
+    my %Cols = (
+               GroupId => 'read',
+               UserId => 'read'
+               );
+
+    return $self->SUPER::_Accessible(@_, %Cols);
+}
+# }}}
+
+# {{{ sub Create
+
+# a helper method for Add
+
+sub Create {
+    my $self = shift;
+    my %args = ( GroupId => undef,
+                UserId => undef,
+                @_
+              );
+    
+    unless( $self->CurrentUser->HasSystemRight('AdminGroups')) {
+       return (0, 'Permission Denied');
+    }
+
+    return ($self->SUPER::Create(GroupId => $args{'GroupId'},
+                                UserId => $args{'UserId'}))
+}
+# }}}
+
+# {{{ sub Add
+
+=head2 Add
+
+Takes a paramhash of UserId and GroupId.  makes that user a memeber
+of that group
+
+=cut
+
+sub Add {
+    my $self = shift;
+    return ($self->Create(@_));
+}
+# }}}
+
+# {{{ sub Delete
+
+=head2 Delete
+
+Takes no arguments. deletes the currently loaded member from the 
+group in question.
+
+=cut
+
+sub Delete {
+    my $self = shift;
+    unless ($self->CurrentUser->HasSystemRight('AdminGroups')) {
+       return (0, 'Permission Denied');
+    }
+    return($self->SUPER::Delete(@_));
+}
+
+# }}}
+
+# {{{ sub UserObj
+
+=head2 UserObj
+
+Returns an RT::User object for the user specified by $self->UserId
+
+=cut
+
+sub UserObj {
+    my $self = shift;
+    unless (defined ($self->{'user_obj'})) {
+        $self->{'user_obj'} = new RT::User($self->CurrentUser);
+        $self->{'user_obj'}->Load($self->UserId);
+    }
+    return($self->{'user_obj'});
+}
+
+# {{{ sub _Set
+sub _Set {
+    my $self = shift;
+    unless ($self->CurrentUser->HasSystemRight('AdminGroups')) {
+       return (0, 'Permission Denied');
+    }
+    return($self->SUPER::_Set(@_));
+}
+# }}}
diff --git a/rt/lib/RT/GroupMembers.pm b/rt/lib/RT/GroupMembers.pm
new file mode 100755 (executable)
index 0000000..a90a2a8
--- /dev/null
@@ -0,0 +1,73 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/GroupMembers.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::GroupMembers - a collection of RT::GroupMember objects
+
+=head1 SYNOPSIS
+
+  use RT::GroupMembers;
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::GroupMembers);
+
+=end testing
+
+=cut
+
+package RT::GroupMembers;
+use RT::EasySearch;
+use RT::GroupMember;
+
+@ISA= qw(RT::EasySearch);
+
+
+# {{{ sub _Init  
+sub _Init   {
+  my $self = shift;
+  $self->{'table'} = "GroupMembers";
+  $self->{'primary_key'} = "id";
+  return ( $self->SUPER::_Init(@_) );
+}
+# }}}
+
+# {{{ sub LimitToGroup
+
+=head2 LimitToGroup
+
+Takes a group id as its only argument.  Limits the current search to that
+group object
+
+=cut
+
+sub LimitToGroup {
+    my $self = shift;
+    my $group = shift;
+
+    return ($self->Limit( 
+                         VALUE => "$group",
+                         FIELD => 'GroupId',
+                         ENTRYAGGREGATOR => 'OR',
+                         ));
+
+}
+# }}}
+
+# {{{ sub NewItem 
+
+sub NewItem  {
+    my $self = shift;
+    return(RT::GroupMember->new($self->CurrentUser))
+}
+
+# }}}
+1;
diff --git a/rt/lib/RT/Groups.pm b/rt/lib/RT/Groups.pm
new file mode 100755 (executable)
index 0000000..f44f1fd
--- /dev/null
@@ -0,0 +1,100 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Groups.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Groups - a collection of RT::Group objects
+
+=head1 SYNOPSIS
+
+  use RT::Groups;
+  my $groups = $RT::Groups->new($CurrentUser);
+  $groups->LimitToReal();
+  while (my $group = $groups->Next()) {
+     print $group->Id ." is a group id\n";
+  }
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Groups);
+
+=end testing
+
+=cut
+
+package RT::Groups;
+use RT::EasySearch;
+use RT::Groups;
+
+@ISA= qw(RT::EasySearch);
+
+# {{{ sub _Init
+
+sub _Init { 
+  my $self = shift;
+  $self->{'table'} = "Groups";
+  $self->{'primary_key'} = "id";
+
+  $self->OrderBy( ALIAS => 'main',
+                 FIELD => 'Name',
+                 ORDER => 'ASC');
+
+
+  return ( $self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ LimitToReal
+
+=head2 LimitToReal
+
+Make this groups object return only "real" groups, which can be
+granted rights and have members assigned to them
+
+=cut
+
+sub LimitToReal {
+    my $self = shift;
+
+    return ($self->Limit( FIELD => 'Pseudo',
+                         VALUE => '0',
+                         OPERATOR => '='));
+
+}
+# }}}
+
+# {{{ sub LimitToPseudo
+
+=head2 LimitToPseudo
+
+Make this groups object return only "pseudo" groups, which can be
+granted rights but whose membership lists are determined dynamically.
+
+=cut
+  
+  sub LimitToPseudo {
+    my $self = shift;
+
+    return ($self->Limit( FIELD => 'Pseudo',
+                         VALUE => '1',
+                         OPERATOR => '='));
+
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+  return (RT::Group->new($self->CurrentUser));
+}
+# }}}
+
+
+1;
+
diff --git a/rt/lib/RT/Handle.pm b/rt/lib/RT/Handle.pm
new file mode 100644 (file)
index 0000000..6b74f36
--- /dev/null
@@ -0,0 +1,53 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Handle.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Handle - RT's database handle
+
+=head1 SYNOPSIS
+
+  use RT::Handle;
+
+=head1 DESCRIPTION
+
+=begin testing
+
+ok(require RT::Handle);
+
+=end testing
+
+=head1 METHODS
+
+=cut
+
+package RT::Handle;
+
+eval "use DBIx::SearchBuilder::Handle::$RT::DatabaseType;
+
+\@ISA= qw(DBIx::SearchBuilder::Handle::$RT::DatabaseType);";
+
+#TODO check for errors here.
+
+=head2 Connect
+
+Takes nothing. Calls SUPER::Connect with the needed args
+
+=cut
+
+sub Connect {
+my $self=shift;
+
+# Unless the database port is a positive integer, we really don't want to pass it.
+$RT::DatabasePort = undef unless (defined $RT::DatabasePort && $RT::DatabasePort =~ /^(\d+)$/);
+
+$self->SUPER::Connect(Host => $RT::DatabaseHost, 
+                        Database => $RT::DatabaseName, 
+                        User => $RT::DatabaseUser,
+                        Password => $RT::DatabasePassword,
+                        Port => $RT::DatabasePort,
+                        Driver => $RT::DatabaseType,
+                        RequireSSL => $RT::DatabaseRequireSSL,
+                       );
+   
+}
+1;
diff --git a/rt/lib/RT/Interface/CLI.pm b/rt/lib/RT/Interface/CLI.pm
new file mode 100644 (file)
index 0000000..a3bf92d
--- /dev/null
@@ -0,0 +1,224 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Interface/CLI.pm,v 1.1 2002-08-12 06:17:08 ivan Exp $
+# RT is (c) 1996-2001 Jesse Vincent <jesse@fsck.com>
+
+package RT::Interface::CLI;
+
+use strict;
+
+
+BEGIN {
+    use Exporter ();
+    use vars qw ($VERSION  @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+    
+    # set the version for version checking
+    $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+    
+    @ISA         = qw(Exporter);
+    
+    # your exported package globals go here,
+    # as well as any optionally exported functions
+    @EXPORT_OK   = qw(&CleanEnv &LoadConfig &DBConnect 
+                     &GetCurrentUser &GetMessageContent &debug);
+}
+
+=head1 NAME
+
+  RT::Interface::CLI - helper functions for creating a commandline RT interface
+
+=head1 SYNOPSIS
+
+  use lib "!!RT_LIB_PATH!!";
+  use lib "!!RT_ETC_PATH!!";
+
+  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();
+
+  #Connect to the database and get RT::SystemUser and RT::Nobody loaded
+  DBConnect();
+
+
+  #Get the current user all loaded
+  my $CurrentUser = GetCurrentUser();
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::Interface::CLI);
+
+=end testing
+
+=cut
+
+
+=head2 CleanEnv
+
+Removes some of the nastiest nasties from the user\'s environment.
+
+=cut
+
+sub CleanEnv {
+    $ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
+    $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
+    $ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
+    $ENV{'ENV'} = '' if defined $ENV{'ENV'};
+    $ENV{'IFS'} = ''           if defined $ENV{'IFS'};
+}
+
+
+
+=head2 LoadConfig
+
+Loads RT's config file and then drops setgid privileges.
+
+=cut
+
+sub LoadConfig {
+    
+    #This drags in  RT's config.pm
+    use config;
+    
+}      
+
+
+
+=head2 DBConnect
+
+  Calls RT::Init, which creates a database connection and then creates $RT::Nobody
+  and $RT::SystemUser
+
+=cut
+
+
+sub DBConnect {
+    use RT;
+    RT::Init();
+}
+
+
+
+# {{{ sub GetCurrentUser 
+
+=head2 GetCurrentUser
+
+  Figures out the uid of the current user and returns an RT::CurrentUser object
+loaded with that user.  if the current user isn't found, returns a copy of RT::Nobody.
+
+=cut
+sub GetCurrentUser  {
+    
+    my ($Gecos, $CurrentUser);
+    
+    require RT::CurrentUser;
+    
+    #Instantiate a user object
+    
+    $Gecos=(getpwuid($<))[0];
+
+    #If the current user is 0, then RT will assume that the User object
+    #is that of the currentuser.
+
+    $CurrentUser = new RT::CurrentUser();
+    $CurrentUser->LoadByGecos($Gecos);
+    
+    unless ($CurrentUser->Id) {
+       $RT::Logger->debug("No user with a unix login of '$Gecos' was found. ");
+    }
+    return($CurrentUser);
+}
+# }}}
+
+# {{{ sub GetMessageContent
+
+=head2 GetMessageContent
+
+Takes two arguments a source file and a boolean "edit".  If the source file
+is undef or "", assumes an empty file.  Returns an edited file as an 
+array of lines.
+
+=cut
+
+sub GetMessageContent {
+    my %args = (  Source => undef,
+                 Content => undef,
+                 Edit => undef,
+                 CurrentUser => undef,
+                @_);
+    my $source = $args{'Source'};
+
+    my $edit = $args{'Edit'};
+    
+    my $currentuser = $args{'CurrentUser'};
+    my @lines;
+
+    use File::Temp qw/ tempfile/;
+    
+    #Load the sourcefile, if it's been handed to us
+    if ($source) {
+       open (SOURCE, "<$source");
+       @lines = (<SOURCE>);
+       close (SOURCE);
+    }
+    elsif ($args{'Content'}) {
+       @lines = split('\n',$args{'Content'});
+    }
+    #get us a tempfile.
+    my ($fh, $filename) = tempfile();
+       
+    #write to a tmpfile
+    for (@lines) {
+       print $fh $_;
+    }
+    close ($fh);
+    
+    #Edit the file if we need to
+    if ($edit) {       
+
+       unless ($ENV{'EDITOR'}) {
+           $RT::Logger->crit('No $EDITOR variable defined'. "\n");
+           return undef;
+       }
+       system ($ENV{'EDITOR'}, $filename);
+    }  
+    
+    open (READ, "<$filename");
+    my @newlines = (<READ>);
+    close (READ);
+
+    unlink ($filename) unless (debug());
+    return(\@newlines);
+    
+}
+
+# }}}
+
+# {{{ sub debug
+
+sub debug {
+    my $val = shift;
+    my ($debug);
+    if ($val) {
+       $RT::Logger->debug($val."\n");
+       if ($debug) {
+           print STDERR "$val\n";
+       }
+    }
+    if ($debug) {
+       return(1);
+    }  
+}
+
+# }}}
+
+
+1;
diff --git a/rt/lib/RT/Interface/Email.pm b/rt/lib/RT/Interface/Email.pm
new file mode 100755 (executable)
index 0000000..e954360
--- /dev/null
@@ -0,0 +1,581 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Interface/Email.pm,v 1.1 2002-08-12 06:17:08 ivan Exp $
+# RT is (c) 1996-2001 Jesse Vincent <jesse@fsck.com>
+
+package RT::Interface::Email;
+
+use strict;
+use Mail::Address;
+use MIME::Entity;
+
+BEGIN {
+    use Exporter ();
+    use vars qw ($VERSION  @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+    
+    # set the version for version checking
+    $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+    
+    @ISA         = qw(Exporter);
+    
+    # your exported package globals go here,
+    # as well as any optionally exported functions
+    @EXPORT_OK   = qw(&CleanEnv 
+                     &LoadConfig 
+                     &DBConnect 
+                     &GetCurrentUser
+                     &GetMessageContent
+                     &CheckForLoops 
+                     &CheckForSuspiciousSender
+                     &CheckForAutoGenerated 
+                     &ParseMIMEEntityFromSTDIN
+                     &ParseTicketId 
+                     &MailError 
+                     &ParseCcAddressesFromHead
+                     &ParseSenderAddressFromHead 
+                     &ParseErrorsToAddressFromHead
+              &ParseAddressFromHeader
+
+
+                     &debug);
+}
+
+=head1 NAME
+
+  RT::Interface::CLI - helper functions for creating a commandline RT interface
+
+=head1 SYNOPSIS
+
+  use lib "!!RT_LIB_PATH!!";
+  use lib "!!RT_ETC_PATH!!";
+
+  use RT::Interface::Email  qw(CleanEnv LoadConfig DBConnect 
+                             );
+
+  #Clean out all the nasties from the environment
+  CleanEnv();
+
+  #Load etc/config.pm and drop privs
+  LoadConfig();
+
+  #Connect to the database and get RT::SystemUser and RT::Nobody loaded
+  DBConnect();
+
+
+  #Get the current user all loaded
+  my $CurrentUser = GetCurrentUser();
+
+=head1 DESCRIPTION
+
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::Interface::Email);
+
+=end testing
+
+
+=head1 METHODS
+
+=cut
+
+
+=head2 CleanEnv
+
+Removes some of the nastiest nasties from the user\'s environment.
+
+=cut
+
+sub CleanEnv {
+    $ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
+    $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
+    $ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
+    $ENV{'ENV'} = '' if defined $ENV{'ENV'};
+    $ENV{'IFS'} = '' if defined $ENV{'IFS'};
+}
+
+
+
+=head2 LoadConfig
+
+Loads RT's config file and then drops setgid privileges.
+
+=cut
+
+sub LoadConfig {
+    
+    #This drags in  RT's config.pm
+    use config;
+    
+}      
+
+
+
+=head2 DBConnect
+
+  Calls RT::Init, which creates a database connection and then creates $RT::Nobody
+  and $RT::SystemUser
+
+=cut
+
+
+sub DBConnect {
+    use RT;
+    RT::Init();
+}
+
+
+
+# {{{ sub debug
+
+sub debug {
+    my $val = shift;
+    my ($debug);
+    if ($val) {
+       $RT::Logger->debug($val."\n");
+       if ($debug) {
+           print STDERR "$val\n";
+       }
+    }
+    if ($debug) {
+       return(1);
+    }  
+}
+
+# }}}
+
+
+# {{{ sub CheckForLoops 
+
+sub CheckForLoops  {
+    my $head = shift;
+    
+    #If this instance of RT sent it our, we don't want to take it in
+    my $RTLoop = $head->get("X-RT-Loop-Prevention") || "";
+    chomp ($RTLoop); #remove that newline
+    if ($RTLoop eq "$RT::rtname") {
+       return (1);
+    }
+    
+    # TODO: We might not trap the case where RT instance A sends a mail
+    # to RT instance B which sends a mail to ...
+    return (undef);
+}
+
+# }}}
+
+# {{{ sub CheckForSuspiciousSender
+
+sub CheckForSuspiciousSender {
+    my $head = shift;
+
+    #if it's from a postmaster or mailer daemon, it's likely a bounce.
+    
+    #TODO: better algorithms needed here - there is no standards for
+    #bounces, so it's very difficult to separate them from anything
+    #else.  At the other hand, the Return-To address is only ment to be
+    #used as an error channel, we might want to put up a separate
+    #Return-To address which is treated differently.
+    
+    #TODO: search through the whole email and find the right Ticket ID.
+
+    my ($From, $junk) = ParseSenderAddressFromHead($head);
+    
+    if (($From =~ /^mailer-daemon/i) or
+       ($From =~ /^postmaster/i)){
+       return (1);
+       
+    }
+    
+    return (undef);
+
+}
+
+# }}}
+
+# {{{ sub CheckForAutoGenerated
+sub CheckForAutoGenerated {
+    my $head = shift;
+    
+    my $Precedence = $head->get("Precedence") || "" ;
+    if ($Precedence =~ /^(bulk|junk)/i) {
+       return (1);
+    }
+    else {
+       return (0);
+    }
+}
+
+# }}}
+
+# {{{ sub ParseMIMEEntityFromSTDIN
+
+sub ParseMIMEEntityFromSTDIN {
+
+    # Create a new parser object:
+    
+    my $parser = new MIME::Parser;
+    
+    # {{{ Config $parser to store large attacments in temp dir
+
+    ## TODO: Does it make sense storing to disk at all?  After all, we
+    ## need to put each msg as an in-core scalar before saving it to
+    ## the database, don't we?
+
+    ## At the same time, we should make sure that we nuke attachments 
+    ## Over max size and return them
+
+    ## TODO: Remove the temp dir when we don't need it any more.
+
+    my $AttachmentDir = File::Temp::tempdir (TMPDIR => 1, CLEANUP => 1);
+    
+    # Set up output directory for files:
+    $parser->output_dir("$AttachmentDir");
+  
+    #If someone includes a message, don't extract it
+    $parser->extract_nested_messages(0);
+
+   
+    # Set up the prefix for files with auto-generated names:
+    $parser->output_prefix("part");
+
+    # If content length is <= 20000 bytes, store each msg as in-core scalar;
+    # Else, write to a disk file (the default action):
+  
+    $parser->output_to_core(20000);
+
+    # }}} (temporary directory)
+
+    #Ok. now that we're set up, let's get the stdin.
+    my $entity;
+    unless ($entity = $parser->read(\*STDIN)) {
+       die "couldn't parse MIME stream";
+    }
+    #Now we've got a parsed mime object. 
+    
+    # Get the head, a MIME::Head:
+    my $head = $entity->head;
+   
+
+    # Unfold headers that are have embedded newlines
+    $head->unfold; 
+    
+    # TODO - information about the charset is lost here!
+    $head->decode;
+
+    return ($entity, $head);
+
+}
+# }}}
+
+# {{{ sub ParseTicketId 
+
+sub ParseTicketId {
+    my $Subject = shift;
+    my ($Id);
+    
+    if ($Subject =~ s/\[$RT::rtname \#(\d+)\]//i) {
+       $Id = $1;
+       $RT::Logger->debug("Found a ticket ID. It's $Id");
+       return($Id);
+    }
+    else {
+       return(undef);
+    }
+}
+# }}}
+
+# {{{ sub MailError 
+sub MailError {
+    my %args = (To => $RT::OwnerEmail,
+               Bcc => undef,
+               From => $RT::CorrespondAddress,
+               Subject => 'There has been an error',
+               Explanation => 'Unexplained error',
+               MIMEObj => undef,
+               LogLevel => 'crit',
+               @_);
+
+
+    $RT::Logger->log(level => $args{'LogLevel'}, 
+                    message => $args{'Explanation'}
+                   );
+    my $entity = MIME::Entity->build( Type  =>"multipart/mixed",
+                                     From => $args{'From'},
+                                     Bcc => $args{'Bcc'},
+                                     To => $args{'To'},
+                                     Subject => $args{'Subject'},
+                                     'X-RT-Loop-Prevention' => $RT::rtname,
+                                   );
+
+    $entity->attach(  Data => $args{'Explanation'}."\n");
+    
+    my $mimeobj = $args{'MIMEObj'};
+    if ($mimeobj) {
+        $mimeobj->sync_headers();
+        $entity->add_part($mimeobj);
+    } 
+
+    if ($RT::MailCommand eq 'sendmailpipe') {
+        open (MAIL, "|$RT::SendmailPath $RT::SendmailArguments") || return(0);
+        print MAIL $entity->as_string;
+        close(MAIL);
+    }
+    else {
+       $entity->send($RT::MailCommand, $RT::MailParams);
+    }
+}
+
+# }}}
+
+# {{{ sub GetCurrentUser 
+
+sub GetCurrentUser  {
+    my $head = shift;
+    my $entity = shift;
+    my $ErrorsTo = shift;
+
+    my %UserInfo = ();
+
+    #Suck the address of the sender out of the header
+    my ($Address, $Name) = ParseSenderAddressFromHead($head);
+    
+    #This will apply local address canonicalization rules
+    $Address = RT::CanonicalizeAddress($Address);
+  
+    #If desired, synchronize with an external database
+
+    my $UserFoundInExternalDatabase = 0;
+
+    # Username is the 'Name' attribute of the user that RT uses for things
+    # like authentication
+    my $Username = undef;
+    if ($RT::LookupSenderInExternalDatabase) {
+       ($UserFoundInExternalDatabase, %UserInfo) = 
+         RT::LookupExternalUserInfo($Address, $Name);
+   
+       $Address = $UserInfo{'EmailAddress'};
+       $Username = $UserInfo{'Name'}; 
+    }
+    
+    my $CurrentUser = RT::CurrentUser->new();
+    
+    # First try looking up by a username, if we got one from the external
+    # db lookup. Next, try looking up by email address. Failing that,
+    # try looking up by users who have this user's email address as their
+    # username.
+
+    if ($Username) {
+       $CurrentUser->LoadByName($Username);
+    }  
+    
+    unless ($CurrentUser->Id) {
+       $CurrentUser->LoadByEmail($Address);
+    }  
+
+    #If we can't get it by email address, try by name.  
+    unless ($CurrentUser->Id) {
+       $CurrentUser->LoadByName($Address);
+    }
+    
+    
+    unless ($CurrentUser->Id) {
+        #If we couldn't load a user, determine whether to create a user
+
+        # {{{ If we require an incoming address to be found in the external
+       # user database, reject the incoming message appropriately
+        if ( $RT::LookupSenderInExternalDatabase &&
+            $RT::SenderMustExistInExternalDatabase && 
+            !$UserFoundInExternalDatabase) {
+           
+           my $Message = "Sender's email address was not found in the user database.";
+
+           # {{{  This code useful only if you've defined an AutoRejectRequest template
+           
+           require RT::Template;
+           my $template = new RT::Template($RT::Nobody);
+           $template->Load('AutoRejectRequest');
+           $Message = $template->Content || $Message;
+           
+           # }}}
+           
+           MailError( To => $ErrorsTo,
+                      Subject => "Ticket Creation failed: user could not be created",
+                      Explanation => $Message,
+                      MIMEObj => $entity,
+                      LogLevel => 'notice'
+                    );
+
+           return($CurrentUser);
+
+       } 
+       # }}}
+       
+       else {
+           my $NewUser = RT::User->new($RT::SystemUser);
+           
+           my ($Val, $Message) = 
+             $NewUser->Create(Name => ($Username || $Address),
+                              EmailAddress => $Address,
+                              RealName => "$Name",
+                              Password => undef,
+                              Privileged => 0,
+                              Comments => 'Autocreated on ticket submission'
+                             );
+           
+           unless ($Val) {
+               
+               # Deal with the race condition of two account creations at once
+               #
+               if ($Username) {
+                   $NewUser->LoadByName($Username);
+               }
+               
+               unless ($NewUser->Id) {
+                   $NewUser->LoadByEmail($Address);
+               }
+               
+               unless ($NewUser->Id) {  
+                   MailError( To => $ErrorsTo,
+                              Subject => "User could not be created",
+                              Explanation => "User creation failed in mailgateway: $Message",
+                              MIMEObj => $entity,
+                              LogLevel => 'crit'
+                            );
+               }
+           }
+       }
+       
+       #Load the new user object
+       $CurrentUser->LoadByEmail($Address);
+       
+       unless ($CurrentUser->id) {
+           $RT::Logger->warning("Couldn't load user '$Address'.".  "giving up");
+               MailError( To => $ErrorsTo,
+                          Subject => "User could not be loaded",
+                          Explanation => "User  '$Address' could not be loaded in the mail gateway",
+                          MIMEObj => $entity,
+                          LogLevel => 'crit'
+                        );
+           
+       }
+    }
+    
+    return ($CurrentUser);
+    
+}
+# }}}
+
+# {{{ ParseCcAddressesFromHead 
+
+=head2 ParseCcAddressesFromHead HASHREF
+
+Takes a hashref object containing QueueObj, Head and CurrentUser objects.
+Returns a list of all email addresses in the To and Cc 
+headers b<except> the current Queue\'s email addresses, the CurrentUser\'s 
+email address  and anything that the configuration sub RT::IsRTAddress matches.
+
+=cut
+  
+sub ParseCcAddressesFromHead {
+    my %args = ( Head => undef,
+                QueueObj => undef,
+                CurrentUser => undef,
+                @_ );
+    
+    my (@Addresses);
+        
+    my @ToObjs = Mail::Address->parse($args{'Head'}->get('To'));
+    my @CcObjs = Mail::Address->parse($args{'Head'}->get('Cc'));
+    
+    foreach my $AddrObj (@ToObjs, @CcObjs) {
+       my $Address = $AddrObj->address;
+       $Address = RT::CanonicalizeAddress($Address);
+       next if ($args{'CurrentUser'}->EmailAddress =~ /^$Address$/i);
+       next if ($args{'QueueObj'}->CorrespondAddress =~ /^$Address$/i);
+       next if ($args{'QueueObj'}->CommentAddress =~ /^$Address$/i);
+       next if (RT::IsRTAddress($Address));
+       
+       push (@Addresses, $Address);
+    }
+    return (@Addresses);
+}
+
+
+# }}}
+
+# {{{ ParseSenderAdddressFromHead
+
+=head2 ParseSenderAddressFromHead
+
+Takes a MIME::Header object. Returns a tuple: (user@host, friendly name) 
+of the From (evaluated in order of Reply-To:, From:, Sender)
+
+=cut
+
+sub ParseSenderAddressFromHead {
+    my $head = shift;
+    #Figure out who's sending this message.
+    my $From = $head->get('Reply-To') || 
+      $head->get('From') || 
+       $head->get('Sender');
+    return (ParseAddressFromHeader($From));
+}
+# }}}
+
+# {{{ ParseErrorsToAdddressFromHead
+
+=head2 ParseErrorsToAddressFromHead
+
+Takes a MIME::Header object. Return a single value : user@host
+of the From (evaluated in order of Errors-To:,Reply-To:, From:, Sender)
+
+=cut
+
+sub ParseErrorsToAddressFromHead {
+    my $head = shift;
+    #Figure out who's sending this message.
+
+    foreach my $header ('Errors-To' , 'Reply-To', 'From', 'Sender' ) {
+       # If there's a header of that name
+       my $headerobj = $head->get($header);
+       if ($headerobj) {
+               my ($addr, $name ) = ParseAddressFromHeader($headerobj);
+               # If it's got actual useful content...
+               return ($addr) if ($addr);
+       }
+    }
+}
+# }}}
+
+# {{{ ParseAddressFromHeader
+
+=head2 ParseAddressFromHeader ADDRESS
+
+Takes an address from $head->get('Line') and returns a tuple: user@host, friendly name
+
+=cut
+
+
+sub ParseAddressFromHeader{
+    my $Addr = shift;
+    
+    my @Addresses = Mail::Address->parse($Addr);
+    
+    my $AddrObj = $Addresses[0];
+
+    unless (ref($AddrObj)) {
+       return(undef,undef);
+    }
+    my $Name =  ($AddrObj->phrase || $AddrObj->comment || $AddrObj->address);
+
+
+    #Lets take the from and load a user object.
+    my $Address = $AddrObj->address;
+
+    return ($Address, $Name);
+}
+# }}}
+
+
+1;
diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm
new file mode 100644 (file)
index 0000000..6b52728
--- /dev/null
@@ -0,0 +1,1287 @@
+## $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Interface/Web.pm,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+## Portions Copyright 2000 Tobias Brox <tobix@fsck.com>
+## Copyright 1996-2002 Jesse Vincent <jesse@bestpractical.com>
+
+## This is a library of static subs to be used by the Mason web
+## interface to RT
+
+package RT::Interface::Web;
+
+# {{{ sub NewParser
+
+=head2 NewParser
+
+  Returns a new Mason::Parser object. Takes a param hash of things 
+  that get passed to HTML::Mason::Parser. Currently hard coded to only
+  take the parameter 'allow_globals'.
+
+=cut
+
+sub NewParser {
+    my %args = (
+        allow_globals => undef,
+        @_
+    );
+
+    my $parser = new HTML::Mason::Parser(
+        default_escape_flags => 'h',
+        allow_globals        => $args{'allow_globals'}
+    );
+    return ($parser);
+}
+
+# }}}
+
+# {{{ sub NewInterp
+
+=head2 NewInterp 
+
+  Takes a paremeter hash. Needs a param called 'parser' which is a reference
+  to an HTML::Mason::Parser.
+  returns a new Mason::Interp object
+
+=cut
+
+sub NewInterp {
+    my %params = (
+        comp_root                    => [
+            [ local    => $RT::MasonLocalComponentRoot ],
+            [ standard => $RT::MasonComponentRoot ]
+        ],
+        data_dir => "$RT::MasonDataDir",
+        @_
+    );
+
+    #We allow recursive autohandlers to allow for RT auth.
+
+    use HTML::Mason::Interp;
+    my $interp = new HTML::Mason::Interp(%params);
+
+}
+
+# }}}
+
+# {{{ sub NewApacheHandler 
+
+=head2 NewApacheHandler
+
+  Takes a Mason::Interp object
+  Returns a new Mason::ApacheHandler object
+
+=cut
+
+sub NewApacheHandler {
+    my $interp = shift;
+    my $ah = new HTML::Mason::ApacheHandler( interp => $interp );
+    return ($ah);
+}
+
+# }}}
+
+
+# {{{ sub NewMason11ApacheHandler
+
+=head2 NewMason11ApacheHandler
+
+  Returns a new Mason::ApacheHandler object
+
+=cut
+
+sub NewMason11ApacheHandler {
+        my %args = ( default_escape_flags => 'h',
+                    allow_globals        => [%session],
+        comp_root                    => [
+            [ local    => $RT::MasonLocalComponentRoot ],
+            [ standard => $RT::MasonComponentRoot ]
+        ],
+        data_dir => "$RT::MasonDataDir",
+        args_method => 'CGI'
+    );
+    my $ah = new HTML::Mason::ApacheHandler(%args);
+    return ($ah);
+}
+
+# }}}
+
+
+
+
+
+# }}}
+
+package HTML::Mason::Commands;
+
+# {{{ sub Abort
+# Error - calls Error and aborts
+sub Abort {
+
+    if ( $session{'ErrorDocument'} && $session{'ErrorDocumentType'} ) {
+        SetContentType( $session{'ErrorDocumentType'} );
+        $m->comp( $session{'ErrorDocument'}, Why => shift );
+        $m->abort;
+    }
+    else {
+        SetContentType('text/html');
+        $m->comp( "/Elements/Error", Why => shift );
+        $m->abort;
+    }
+}
+
+# }}}
+
+# {{{ sub CreateTicket 
+
+=head2 CreateTicket ARGS
+
+Create a new ticket, using Mason's %ARGS.  returns @results.
+=cut
+
+sub CreateTicket {
+    my %ARGS = (@_);
+
+    my (@Actions);
+
+    my $Ticket = new RT::Ticket( $session{'CurrentUser'} );
+
+    my $Queue = new RT::Queue( $session{'CurrentUser'} );
+    unless ( $Queue->Load( $ARGS{'Queue'} ) ) {
+        Abort('Queue not found');
+    }
+
+    unless ( $Queue->CurrentUserHasRight('CreateTicket') ) {
+        Abort('You have no permission to create tickets in that queue.');
+    }
+
+    my $due = new RT::Date( $session{'CurrentUser'} );
+    $due->Set( Format => 'unknown', Value => $ARGS{'Due'} );
+    my $starts = new RT::Date( $session{'CurrentUser'} );
+    $starts->Set( Format => 'unknown', Value => $ARGS{'Starts'} );
+
+    my @Requestors = split ( /,/, $ARGS{'Requestors'} );
+    my @Cc         = split ( /,/, $ARGS{'Cc'} );
+    my @AdminCc    = split ( /,/, $ARGS{'AdminCc'} );
+
+    my $MIMEObj = MakeMIMEEntity(
+        Subject             => $ARGS{'Subject'},
+        From                => $ARGS{'From'},
+        Cc                  => $ARGS{'Cc'},
+        Body                => $ARGS{'Content'},
+        AttachmentFieldName => 'Attach'
+    );
+
+    my %create_args = (
+        Queue           => $ARGS{Queue},
+        Owner           => $ARGS{Owner},
+        InitialPriority => $ARGS{InitialPriority},
+        FinalPriority   => $ARGS{FinalPriority},
+        TimeLeft        => $ARGS{TimeLeft},
+        TimeWorked      => $ARGS{TimeWorked},
+        Requestor       => \@Requestors,
+        Cc              => \@Cc,
+        AdminCc         => \@AdminCc,
+        Subject         => $ARGS{Subject},
+        Status          => $ARGS{Status},
+        Due             => $due->ISO,
+        Starts          => $starts->ISO,
+        MIMEObj         => $MIMEObj
+    );
+
+    # we need to get any KeywordSelect-<integer> fields into %create_args..
+    grep { $_ =~ /^KeywordSelect-/ &&{ $create_args{$_} = $ARGS{$_} } } %ARGS;
+
+    my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args);
+    unless ( $id && $Trans ) {
+        Abort($ErrMsg);
+    }
+    my @linktypes = qw( DependsOn MemberOf RefersTo );
+
+    foreach my $linktype (@linktypes) {
+        foreach my $luri ( split ( / /, $ARGS{"new-$linktype"} ) ) {
+            $luri =~ s/\s*$//;    # Strip trailing whitespace
+            my ( $val, $msg ) = $Ticket->AddLink(
+                Target => $luri,
+                Type   => $linktype
+            );
+            push ( @Actions, $msg ) unless ($val);
+        }
+
+        foreach my $luri ( split ( / /, $ARGS{"$linktype-new"} ) ) {
+            my ( $val, $msg ) = $Ticket->AddLink(
+                Base => $luri,
+                Type => $linktype
+            );
+
+            push ( @Actions, $msg ) unless ($val);
+        }
+    }
+
+    push ( @Actions, $ErrMsg );
+    unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
+        Abort( "No permission to view newly created ticket #"
+            . $Ticket->id . "." );
+    }
+    return ( $Ticket, @Actions );
+
+}
+
+# }}}
+
+# {{{ sub LoadTicket - loads a ticket
+
+=head2  LoadTicket id
+
+Takes a ticket id as its only variable. if it's handed an array, it takes
+the first value.
+
+Returns an RT::Ticket object as the current user.
+
+=cut
+
+sub LoadTicket {
+    my $id = shift;
+
+    if ( ref($id) eq "ARRAY" ) {
+        $id = $id->[0];
+    }
+
+    unless ($id) {
+        Abort("No ticket specified");
+    }
+
+    my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
+    $Ticket->Load($id);
+    unless ( $Ticket->id ) {
+        Abort("Could not load ticket $id");
+    }
+    return $Ticket;
+}
+
+# }}}
+
+# {{{ sub ProcessUpdateMessage
+
+sub ProcessUpdateMessage {
+
+    #TODO document what else this takes.
+    my %args = (
+        ARGSRef   => undef,
+        Actions   => undef,
+        TicketObj => undef,
+        @_
+    );
+
+    #Make the update content have no 'weird' newlines in it
+    if ( $args{ARGSRef}->{'UpdateContent'} ) {
+
+        if (
+            $args{ARGSRef}->{'UpdateSubject'} eq $args{'TicketObj'}->Subject() )
+        {
+            $args{ARGSRef}->{'UpdateSubject'} = undef;
+        }
+
+        my $Message = MakeMIMEEntity(
+            Subject             => $args{ARGSRef}->{'UpdateSubject'},
+            Body                => $args{ARGSRef}->{'UpdateContent'},
+            AttachmentFieldName => 'UpdateAttachment'
+        );
+
+       ## Check whether this was a refresh or not.  
+
+       # Match Correspondence or Comments.
+        my $trans_flag = -2;
+       my $trans_type = undef;
+       my $orig_trans = $args{ARGSRef}->{'UpdateType'};
+        if ( $orig_trans =~ /^(private|public)$/ ) {
+           $trans_type = "Comment";
+        }elsif ( $orig_trans eq 'response' ) {
+           $trans_type = "Correspond";
+       }
+
+       # Do we have a transaction that we need to update on? session
+       if( defined( $trans_type ) ){
+           $trans_flag = 0;
+
+           # Prepare a checksum.
+           # See perldoc -f unpack for example of this.
+           my $this_checksum = unpack("%32C*", $Message->body_as_string ) % 65535;
+
+           # The above *could* generate duplicate checksums.  Crosscheck with
+           # the length.
+           my $this_length = length( $Message->body_as_string );
+
+           # Don't forget the ticket id.
+           my $this_id = $args{TicketObj}->id;
+
+           # Check whether the previous transaction in the
+           # ticket is the same as the current transaction.
+           if( defined( $session{'prev_trans_type'} ) && defined( $session{'prev_trans_chksum'} ) && defined( $session{'prev_trans_length'} ) && defined( $session{'prev_trans_tickid'} ) ){
+               if( $session{'prev_trans_type'} eq $orig_trans && $session{'prev_trans_chksum'} == $this_checksum && $session{'prev_trans_length'} == $this_length && $session{'prev_trans_tickid'} == $this_id ){
+                   # Its the same as the previous transaction for this user.
+                   $trans_flag = -1;
+               }
+           }
+
+           # Store them for next time.
+           $session{'prev_trans_type'} = $orig_trans;
+           $session{'prev_trans_chksum'} = $this_checksum;
+           $session{'prev_trans_length'} = $this_length;
+           $session{'prev_trans_tickid'} = $this_id;
+
+           if( $trans_flag == -1 ){
+                push ( @{ $args{'Actions'} },
+"This appears to be a duplicate of your previous update (please do not refresh this page)" );
+           }
+
+
+            if ( $trans_type eq 'Comment' && $trans_flag >= 0 ) {
+                my ( $Transaction, $Description ) = $args{TicketObj}->Comment(
+                    CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
+                    BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
+                    MIMEObj      => $Message,
+                    TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
+                );
+                push ( @{ $args{Actions} }, $Description );
+            }
+            elsif ( $trans_type eq 'Correspond' && $trans_flag >= 0 ) {
+                my ( $Transaction, $Description ) = $args{TicketObj}->Correspond(
+                    CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
+                    BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
+                    MIMEObj      => $Message,
+                    TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
+                );
+                push ( @{ $args{Actions} }, $Description );
+            }
+       }
+        else {
+            push ( @{ $args{'Actions'} },
+    "Update type was neither correspondence nor comment. Update not recorded"
+                );
+        }
+    }
+}
+
+# }}}
+
+# {{{ sub MakeMIMEEntity
+
+=head2 MakeMIMEEntity PARAMHASH
+
+Takes a paramhash Subject, Body and AttachmentFieldName.
+
+  Returns a MIME::Entity.
+
+=cut
+
+sub MakeMIMEEntity {
+
+    #TODO document what else this takes.
+    my %args = (
+        Subject             => undef,
+        From                => undef,
+        Cc                  => undef,
+        Body                => undef,
+        AttachmentFieldName => undef,
+        @_
+    );
+
+    #Make the update content have no 'weird' newlines in it
+
+    $args{'Body'} =~ s/\r\n/\n/gs;
+    my $Message = MIME::Entity->build(
+        Subject => $args{'Subject'} || "",
+        From    => $args{'From'},
+        Cc      => $args{'Cc'},
+        Data    => [ $args{'Body'} ]
+    );
+
+    my $cgi_object = CGIObject();
+    if ( $cgi_object->param( $args{'AttachmentFieldName'} ) ) {
+
+        my $cgi_filehandle =
+          $cgi_object->upload( $args{'AttachmentFieldName'} );
+
+        use File::Temp qw(tempfile tempdir);
+
+        #foreach my $filehandle (@filenames) {
+
+        # my ( $fh, $temp_file ) = tempfile();
+
+        #$binmode $fh;    #thank you, windows
+
+        # We're having trouble with tempfiles not getting created. Let's try it with 
+        # a scalar instead
+
+        my ( $buffer, @file );
+
+        while ( my $bytesread = read( $cgi_filehandle, $buffer, 4096 ) ) {
+            push ( @file, $buffer );
+        }
+
+        $RT::Logger->debug($file);
+        my $filename = "$cgi_filehandle";
+        $filename =~ s#^(.*)/##;
+        $filename =~ s#^(.*)\\##;
+        my $uploadinfo = $cgi_object->uploadInfo($cgi_filehandle);
+        $Message->attach(
+            Data => \@file,
+
+            #Path     => $temp_file,
+            Filename => $filename,
+            Type     => $uploadinfo->{'Content-Type'}
+        );
+
+        #close($fh);
+        #unlink($temp_file);
+
+        #      }
+    }
+    $Message->make_singlepart();
+    return ($Message);
+
+}
+
+# }}}
+
+# {{{ sub ProcessSearchQuery
+
+=head2 ProcessSearchQuery
+
+  Takes a form such as the one filled out in webrt/Search/Elements/PickRestriction and turns it into something that RT::Tickets can understand.
+
+TODO Doc exactly what comes in the paramhash
+
+
+=cut
+
+sub ProcessSearchQuery {
+    my %args = @_;
+
+    ## TODO: The only parameter here is %ARGS.  Maybe it would be
+    ## cleaner to load this parameter as $ARGS, and use $ARGS->{...}
+    ## instead of $args{ARGS}->{...} ? :)
+
+    #Searches are sticky.
+    if ( defined $session{'tickets'} ) {
+
+        # Reset the old search
+        $session{'tickets'}->GotoFirstItem;
+    }
+    else {
+
+        # Init a new search
+        $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
+    }
+
+    #Import a bookmarked search if we have one
+    if ( defined $args{ARGS}->{'Bookmark'} ) {
+        $session{'tickets'}->ThawLimits( $args{ARGS}->{'Bookmark'} );
+    }
+
+    # {{{ Goto next/prev page
+    if ( $args{ARGS}->{'GotoPage'} eq 'Next' ) {
+        $session{'tickets'}->NextPage;
+    }
+    elsif ( $args{ARGS}->{'GotoPage'} eq 'Prev' ) {
+        $session{'tickets'}->PrevPage;
+    }
+
+    # }}}
+
+    # {{{ Deal with limiting the search
+
+    if ( $args{ARGS}->{'RefreshSearchInterval'} ) {
+        $session{'tickets_refresh_interval'} =
+          $args{ARGS}->{'RefreshSearchInterval'};
+    }
+
+    if ( $args{ARGS}->{'TicketsSortBy'} ) {
+        $session{'tickets_sort_by'}    = $args{ARGS}->{'TicketsSortBy'};
+        $session{'tickets_sort_order'} = $args{ARGS}->{'TicketsSortOrder'};
+        $session{'tickets'}->OrderBy(
+            FIELD => $args{ARGS}->{'TicketsSortBy'},
+            ORDER => $args{ARGS}->{'TicketsSortOrder'}
+        );
+    }
+
+    # }}}
+
+    # {{{ Set the query limit
+    if ( defined $args{ARGS}->{'RowsPerPage'} ) {
+        $RT::Logger->debug(
+            "limiting to " . $args{ARGS}->{'RowsPerPage'} . " rows" );
+
+        $session{'tickets_rows_per_page'} = $args{ARGS}->{'RowsPerPage'};
+        $session{'tickets'}->RowsPerPage( $args{ARGS}->{'RowsPerPage'} );
+    }
+
+    # }}}
+    # {{{ Limit priority
+    if ( $args{ARGS}->{'ValueOfPriority'} ne '' ) {
+        $session{'tickets'}->LimitPriority(
+            VALUE    => $args{ARGS}->{'ValueOfPriority'},
+            OPERATOR => $args{ARGS}->{'PriorityOp'}
+        );
+    }
+
+    # }}}
+    # {{{ Limit owner
+    if ( $args{ARGS}->{'ValueOfOwner'} ne '' ) {
+        $session{'tickets'}->LimitOwner(
+            VALUE    => $args{ARGS}->{'ValueOfOwner'},
+            OPERATOR => $args{ARGS}->{'OwnerOp'}
+        );
+    }
+
+    # }}}
+    # {{{ Limit requestor email
+
+    if ( $args{ARGS}->{'ValueOfRequestor'} ne '' ) {
+        my $alias = $session{'tickets'}->LimitRequestor(
+            VALUE    => $args{ARGS}->{'ValueOfRequestor'},
+            OPERATOR => $args{ARGS}->{'RequestorOp'},
+        );
+
+    }
+
+    # }}}
+    # {{{ Limit Queue
+    if ( $args{ARGS}->{'ValueOfQueue'} ne '' ) {
+        $session{'tickets'}->LimitQueue(
+            VALUE    => $args{ARGS}->{'ValueOfQueue'},
+            OPERATOR => $args{ARGS}->{'QueueOp'}
+        );
+    }
+
+    # }}}
+    # {{{ Limit Status
+    if ( $args{ARGS}->{'ValueOfStatus'} ne '' ) {
+        if ( ref( $args{ARGS}->{'ValueOfStatus'} ) ) {
+            foreach my $value ( @{ $args{ARGS}->{'ValueOfStatus'} } ) {
+                $session{'tickets'}->LimitStatus(
+                    VALUE    => $value,
+                    OPERATOR => $args{ARGS}->{'StatusOp'},
+                );
+            }
+        }
+        else {
+            $session{'tickets'}->LimitStatus(
+                VALUE    => $args{ARGS}->{'ValueOfStatus'},
+                OPERATOR => $args{ARGS}->{'StatusOp'},
+            );
+        }
+
+    }
+
+    # }}}
+    # {{{ Limit Subject
+    if ( $args{ARGS}->{'ValueOfSubject'} ne '' ) {
+        $session{'tickets'}->LimitSubject(
+            VALUE    => $args{ARGS}->{'ValueOfSubject'},
+            OPERATOR => $args{ARGS}->{'SubjectOp'},
+        );
+    }
+
+    # }}}    
+    # {{{ Limit Dates
+    if ( $args{ARGS}->{'ValueOfDate'} ne '' ) {
+
+        my $date = ParseDateToISO( $args{ARGS}->{'ValueOfDate'} );
+        $args{ARGS}->{'DateType'} =~ s/_Date$//;
+
+        $session{'tickets'}->LimitDate(
+            FIELD    => $args{ARGS}->{'DateType'},
+            VALUE    => $date,
+            OPERATOR => $args{ARGS}->{'DateOp'},
+        );
+    }
+
+    # }}}    
+    # {{{ Limit Content
+    if ( $args{ARGS}->{'ValueOfContent'} ne '' ) {
+        $session{'tickets'}->LimitContent(
+            VALUE    => $args{ARGS}->{'ValueOfContent'},
+            OPERATOR => $args{ARGS}->{'ContentOp'},
+        );
+    }
+
+    # }}}   
+    # {{{ Limit KeywordSelects
+
+    foreach my $KeywordSelectId (
+        map { /^KeywordSelect(\d+)$/; $1 }
+        grep { /^KeywordSelect(\d+)$/; } keys %{ $args{ARGS} }
+      )
+    {
+        my $form = $args{ARGS}->{"KeywordSelect$KeywordSelectId"};
+        my $oper = $args{ARGS}->{"KeywordSelectOp$KeywordSelectId"};
+        foreach my $KeywordId ( ref($form) ? @{$form} : ($form) ) {
+            next unless ($KeywordId);
+            my $quote = 1;
+            if ( $KeywordId =~ /^null$/i ) {
+
+                #Don't quote the string 'null'
+                $quote = 0;
+
+                # Convert the operator to something apropriate for nulls
+                $oper = 'IS'     if ( $oper eq '=' );
+                $oper = 'IS NOT' if ( $oper eq '!=' );
+            }
+            $session{'tickets'}->LimitKeyword(
+                KEYWORDSELECT => $KeywordSelectId,
+                OPERATOR      => $oper,
+                QUOTEVALUE    => $quote,
+                KEYWORD       => $KeywordId
+            );
+        }
+    }
+
+    # }}}
+
+}
+
+# }}}
+
+# {{{ sub ParseDateToISO
+
+=head2 ParseDateToISO
+
+Takes a date in an arbitrary format.
+Returns an ISO date and time in GMT
+
+=cut
+
+sub ParseDateToISO {
+    my $date = shift;
+
+    my $date_obj = new RT::Date($CurrentUser);
+    $date_obj->Set(
+        Format => 'unknown',
+        Value  => $date
+    );
+    return ( $date_obj->ISO );
+}
+
+# }}}
+
+# {{{ sub Config 
+# TODO: This might eventually read the cookies, user configuration
+# information from the DB, queue configuration information from the
+# DB, etc.
+
+sub Config {
+    my $args = shift;
+    my $key  = shift;
+    return $args->{$key} || $RT::WebOptions{$key};
+}
+
+# }}}
+
+# {{{ sub ProcessACLChanges
+
+sub ProcessACLChanges {
+    my $ACLref  = shift;
+    my $ARGSref = shift;
+
+    my @CheckACL = @$ACLref;
+    my %ARGS     = %$ARGSref;
+
+    my ( $ACL, @results );
+
+    # {{{ Add rights
+    foreach $ACL (@CheckACL) {
+        my ($Principal);
+
+        next unless ($ACL);
+
+        # Parse out what we're really talking about. 
+        if ( $ACL =~ /^(.*?)-(\d+)-(.*?)-(\d+)/ ) {
+            my $PrincipalType = $1;
+            my $PrincipalId   = $2;
+            my $Scope         = $3;
+            my $AppliesTo     = $4;
+
+            # {{{ Create an object called Principal
+            # so we can do rights operations
+
+            if ( $PrincipalType eq 'User' ) {
+                $Principal = new RT::User( $session{'CurrentUser'} );
+            }
+            elsif ( $PrincipalType eq 'Group' ) {
+                $Principal = new RT::Group( $session{'CurrentUser'} );
+            }
+            else {
+                Abort("$PrincipalType unknown principal type");
+            }
+
+            $Principal->Load($PrincipalId)
+              || Abort("$PrincipalType $PrincipalId couldn't be loaded");
+
+            # }}}
+
+            # {{{ load up an RT::ACL object with the same current vals of this ACL
+
+            my $CurrentACL = new RT::ACL( $session{'CurrentUser'} );
+            if ( $Scope eq 'Queue' ) {
+                $CurrentACL->LimitToQueue($AppliesTo);
+            }
+            elsif ( $Scope eq 'System' ) {
+                $CurrentACL->LimitToSystem();
+            }
+
+            $CurrentACL->LimitPrincipalToType($PrincipalType);
+            $CurrentACL->LimitPrincipalToId($PrincipalId);
+
+            # }}}
+
+            # {{{ Get the values of the select we're working with 
+            # into an array. it will contain all the new rights that have 
+            # been granted
+            #Hack to turn the ACL returned into an array
+            my @rights =
+              ref( $ARGS{"GrantACE-$ACL"} ) eq 'ARRAY'
+              ? @{ $ARGS{"GrantACE-$ACL"} }
+              : ( $ARGS{"GrantACE-$ACL"} );
+
+            # }}}
+
+            # {{{ Add any rights we need.
+
+            foreach my $right (@rights) {
+                next unless ($right);
+
+                #if the right that's been selected wasn't there before, add it.
+                unless (
+                    $CurrentACL->HasEntry(
+                        RightScope     => "$Scope",
+                        RightName      => "$right",
+                        RightAppliesTo => "$AppliesTo",
+                        PrincipalType  => $PrincipalType,
+                        PrincipalId    => $Principal->Id
+                    )
+                  )
+                {
+
+                    #Add new entry to list of rights.
+                    if ( $Scope eq 'Queue' ) {
+                        my $Queue = new RT::Queue( $session{'CurrentUser'} );
+                        $Queue->Load($AppliesTo);
+                        unless ( $Queue->id ) {
+                            Abort("Couldn't find a queue called $AppliesTo");
+                        }
+
+                        my ( $val, $msg ) = $Principal->GrantQueueRight(
+                            RightAppliesTo => $Queue->id,
+                            RightName      => "$right"
+                        );
+
+                        if ($val) {
+                            push ( @results,
+                                "Granted right $right to "
+                                  . $Principal->Name
+                                  . " for queue "
+                                  . $Queue->Name );
+                        }
+                        else {
+                            push ( @results, $msg );
+                        }
+                    }
+                    elsif ( $Scope eq 'System' ) {
+                        my ( $val, $msg ) = $Principal->GrantSystemRight(
+                            RightAppliesTo => $AppliesTo,
+                            RightName      => "$right"
+                        );
+                        if ($val) {
+                            push ( @results, "Granted system right '$right' to "
+                                  . $Principal->Name );
+                        }
+                        else {
+                            push ( @results, $msg );
+                        }
+                    }
+                }
+            }
+
+            # }}}
+        }
+    }
+
+    # }}} Add rights
+
+    # {{{ remove any rights that have been deleted
+
+    my @RevokeACE =
+      ref( $ARGS{"RevokeACE"} ) eq 'ARRAY' 
+      ? @{ $ARGS{"RevokeACE"} }
+      : ( $ARGS{"RevokeACE"} );
+
+    foreach my $aceid (@RevokeACE) {
+
+        my $right = new RT::ACE( $session{'CurrentUser'} );
+        $right->Load($aceid);
+        next unless ( $right->id );
+
+        my $phrase = "Revoked "
+          . $right->PrincipalType . " "
+          . $right->PrincipalObj->Name
+          . "'s right to "
+          . $right->RightName;
+
+        if ( $right->RightScope eq 'System' ) {
+            $phrase .= ' across all queues.';
+        }
+        else {
+            $phrase .= ' for the queue ' . $right->AppliesToObj->Name . '.';
+        }
+        my ( $val, $msg ) = $right->Delete();
+        if ($val) {
+            push ( @results, $phrase );
+        }
+        else {
+            push ( @results, $msg );
+        }
+    }
+
+    # }}}
+
+    return (@results);
+}
+
+# }}}
+
+# {{{ sub UpdateRecordObj
+
+=head2 UpdateRecordObj ( ARGSRef => \%ARGS, Object => RT::Record, AttributesRef => \@attribs)
+
+@attribs is a list of ticket fields to check and update if they differ from the  B<Object>'s current values. ARGSRef is a ref to HTML::Mason's %ARGS.
+
+Returns an array of success/failure messages
+
+=cut
+
+sub UpdateRecordObject {
+    my %args = (
+        ARGSRef       => undef,
+        AttributesRef => undef,
+        Object        => undef,
+        @_
+    );
+
+    my (@results);
+
+    my $object     = $args{'Object'};
+    my $attributes = $args{'AttributesRef'};
+    my $ARGSRef    = $args{'ARGSRef'};
+
+    foreach $attribute (@$attributes) {
+        if ( ( defined $ARGSRef->{"$attribute"} )
+            and ( $ARGSRef->{"$attribute"} ne $object->$attribute() ) )
+        {
+            $ARGSRef->{"$attribute"} =~ s/\r\n/\n/gs;
+
+            my $method = "Set$attribute";
+            my ( $code, $msg ) = $object->$method( $ARGSRef->{"$attribute"} );
+            push @results, "$attribute: $msg";
+        }
+    }
+    return (@results);
+}
+
+# }}}
+
+# {{{ sub ProcessTicketBasics
+
+=head2 ProcessTicketBasics ( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+Returns an array of results messages.
+
+=cut
+
+sub ProcessTicketBasics {
+
+    my %args = (
+        TicketObj => undef,
+        ARGSRef   => undef,
+        @_
+    );
+
+    my $TicketObj = $args{'TicketObj'};
+    my $ARGSRef   = $args{'ARGSRef'};
+
+    # {{{ Set basic fields 
+    my @attribs = qw(
+      Subject
+      FinalPriority
+      Priority
+      TimeWorked
+      TimeLeft
+      Status
+      Queue
+    );
+
+    if ( $ARGSRef->{'Queue'} and ( $ARGSRef->{'Queue'} !~ /^(\d+)$/ ) ) {
+        my $tempqueue = RT::Queue->new($RT::SystemUser);
+        $tempqueue->Load( $ARGSRef->{'Queue'} );
+        if ( $tempqueue->id ) {
+            $ARGSRef->{'Queue'} = $tempqueue->Id();
+        }
+    }
+
+    my @results = UpdateRecordObject(
+        AttributesRef => \@attribs,
+        Object        => $TicketObj,
+        ARGSRef       => $ARGSRef
+    );
+
+    # We special case owner changing, so we can use ForceOwnerChange
+    if ( $ARGSRef->{'Owner'} && ( $TicketObj->Owner ne $ARGSRef->{'Owner'} ) ) {
+        my ($ChownType);
+        if ( $ARGSRef->{'ForceOwnerChange'} ) {
+            $ChownType = "Force";
+        }
+        else {
+            $ChownType = "Give";
+        }
+
+        my ( $val, $msg ) =
+          $TicketObj->SetOwner( $ARGSRef->{'Owner'}, $ChownType );
+        push ( @results, "$msg" );
+    }
+
+    # }}}
+
+    return (@results);
+}
+
+# }}}
+
+# {{{ sub ProcessTicketWatchers
+
+=head2 ProcessTicketWatchers ( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+Returns an array of results messages.
+
+=cut
+
+sub ProcessTicketWatchers {
+    my %args = (
+        TicketObj => undef,
+        ARGSRef   => undef,
+        @_
+    );
+    my (@results);
+
+    my $Ticket  = $args{'TicketObj'};
+    my $ARGSRef = $args{'ARGSRef'};
+
+    # {{{ Munge watchers
+
+    foreach my $key ( keys %$ARGSRef ) {
+
+        # Delete deletable watchers
+        if ( ( $key =~ /^DelWatcher(\d*)$/ ) and ( $ARGSRef->{$key} ) ) {
+            my ( $code, $msg ) = $Ticket->DeleteWatcher($1);
+            push @results, $msg;
+        }
+
+        # Delete watchers in the simple style demanded by the bulk manipulator
+        elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
+            my ( $code, $msg ) = $Ticket->DeleteWatcher( $ARGSRef->{$key}, $1 );
+            push @results, $msg;
+        }
+
+        # Add new wathchers by email address      
+        elsif ( ( $ARGSRef->{$key} =~ /^(AdminCc|Cc|Requestor)$/ )
+            and ( $key =~ /^WatcherTypeEmail(\d*)$/ ) )
+        {
+
+            #They're in this order because otherwise $1 gets clobbered :/
+            my ( $code, $msg ) = $Ticket->AddWatcher(
+                Type  => $ARGSRef->{$key},
+                Email => $ARGSRef->{ "WatcherAddressEmail" . $1 }
+            );
+            push @results, $msg;
+        }
+
+        #Add requestors in the simple style demanded by the bulk manipulator
+        elsif ( $key =~ /^Add(Requestor|Cc|AdminCc)$/ ) {
+            my ( $code, $msg ) = $Ticket->AddWatcher(
+                Type  => $1,
+                Email => $ARGSRef->{$key}
+            );
+            push @results, $msg;
+        }
+
+        # Add new  watchers by owner
+        elsif ( ( $ARGSRef->{$key} =~ /^(AdminCc|Cc|Requestor)$/ )
+            and ( $key =~ /^WatcherTypeUser(\d*)$/ ) )
+        {
+
+            #They're in this order because otherwise $1 gets clobbered :/
+            my ( $code, $msg ) =
+              $Ticket->AddWatcher( Type => $ARGSRef->{$key}, Owner => $1 );
+            push @results, $msg;
+        }
+    }
+
+    # }}}
+
+    return (@results);
+}
+
+# }}}
+
+# {{{ sub ProcessTicketDates
+
+=head2 ProcessTicketDates ( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+Returns an array of results messages.
+
+=cut
+
+sub ProcessTicketDates {
+    my %args = (
+        TicketObj => undef,
+        ARGSRef   => undef,
+        @_
+    );
+
+    my $Ticket  = $args{'TicketObj'};
+    my $ARGSRef = $args{'ARGSRef'};
+
+    my (@results);
+
+    # {{{ Set date fields
+    my @date_fields = qw(
+      Told
+      Resolved
+      Starts
+      Started
+      Due
+    );
+
+    #Run through each field in this list. update the value if apropriate
+    foreach $field (@date_fields) {
+        my ( $code, $msg );
+
+        my $DateObj = RT::Date->new( $session{'CurrentUser'} );
+
+        #If it's something other than just whitespace
+        if ( $ARGSRef->{ $field . '_Date' } ne '' ) {
+            $DateObj->Set(
+                Format => 'unknown',
+                Value  => $ARGSRef->{ $field . '_Date' }
+            );
+            my $obj = $field . "Obj";
+            if ( ( defined $DateObj->Unix )
+                and ( $DateObj->Unix ne $Ticket->$obj()->Unix() ) )
+            {
+                my $method = "Set$field";
+                my ( $code, $msg ) = $Ticket->$method( $DateObj->ISO );
+                push @results, "$msg";
+            }
+        }
+    }
+
+    # }}}
+    return (@results);
+}
+
+# }}}
+
+# {{{ sub ProcessTicketLinks
+
+=head2 ProcessTicketLinks ( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+Returns an array of results messages.
+
+=cut
+
+sub ProcessTicketLinks {
+    my %args = (
+        TicketObj => undef,
+        ARGSRef   => undef,
+        @_
+    );
+
+    my $Ticket  = $args{'TicketObj'};
+    my $ARGSRef = $args{'ARGSRef'};
+
+    my (@results);
+
+    # Delete links that are gone gone gone.
+    foreach my $arg ( keys %$ARGSRef ) {
+        if ( $arg =~ /DeleteLink-(.*?)-(DependsOn|MemberOf|RefersTo)-(.*)$/ ) {
+            my $base   = $1;
+            my $type   = $2;
+            my $target = $3;
+
+            push @results,
+              "Trying to delete: Base: $base Target: $target  Type $type";
+            my ( $val, $msg ) = $Ticket->DeleteLink(
+                Base   => $base,
+                Type   => $type,
+                Target => $target
+            );
+
+            push @results, $msg;
+
+        }
+
+    }
+
+    my @linktypes = qw( DependsOn MemberOf RefersTo );
+
+    foreach my $linktype (@linktypes) {
+
+        for my $luri ( split ( / /, $ARGSRef->{ $Ticket->Id . "-$linktype" } ) )
+        {
+            $luri =~ s/\s*$//;    # Strip trailing whitespace
+            my ( $val, $msg ) = $Ticket->AddLink(
+                Target => $luri,
+                Type   => $linktype
+            );
+            push @results, $msg;
+        }
+
+        for my $luri ( split ( / /, $ARGSRef->{ "$linktype-" . $Ticket->Id } ) )
+        {
+            my ( $val, $msg ) = $Ticket->AddLink(
+                Base => $luri,
+                Type => $linktype
+            );
+
+            push @results, $msg;
+        }
+    }
+
+    #Merge if we need to
+    if ( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ) {
+        my ( $val, $msg ) =
+          $Ticket->MergeInto( $ARGSRef->{ $Ticket->Id . "-MergeInto" } );
+        push @results, $msg;
+    }
+
+    return (@results);
+}
+
+# }}}
+
+# {{{ sub ProcessTicketObjectKeywords
+
+=head2 ProcessTicketObjectKeywords ( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+Returns an array of results messages.
+
+=cut
+
+sub ProcessTicketObjectKeywords {
+    my %args = (
+        TicketObj => undef,
+        ARGSRef   => undef,
+        @_
+    );
+
+    my $TicketObj = $args{'TicketObj'};
+    my $ARGSRef   = $args{'ARGSRef'};
+
+    my (@results);
+
+    # {{{ set ObjectKeywords.
+
+    my $KeywordSelects = $TicketObj->QueueObj->KeywordSelects;
+
+    # iterate through all the keyword selects for this queue
+    while ( my $KeywordSelect = $KeywordSelects->Next ) {
+
+        # {{{ do some setup
+
+        # if we have KeywordSelectMagic for this keywordselect:
+        next
+          unless
+          defined $ARGSRef->{ 'KeywordSelectMagic' . $KeywordSelect->id };
+
+        # Lets get a hash of the possible values to work with
+        my $value = $ARGSRef->{ 'KeywordSelect' . $KeywordSelect->id } || [];
+
+        #lets get all those values in a hash. regardless of # of entries
+        #we'll use this for adding and deleting keywords from this object.
+        my %values = map { $_ => 1 } ref($value) ? @{$value} : ($value);
+
+        # Load up the ObjectKeywords for this KeywordSelect for this ticket
+        my $ObjectKeys = $TicketObj->KeywordsObj( $KeywordSelect->id );
+
+        # }}}
+        # {{{ add new keywords
+
+        foreach my $key ( keys %values ) {
+
+            #unless the ticket has that keyword for that keyword select,
+            unless ( $ObjectKeys->HasEntry($key) ) {
+
+                #Add the keyword
+                my ( $result, $msg ) = $TicketObj->AddKeyword(
+                    Keyword       => $key,
+                    KeywordSelect => $KeywordSelect->id
+                );
+                push ( @results, $msg );
+            }
+        }
+
+        # }}}
+        # {{{ Delete unused keywords
+
+        #redo this search, so we don't ask it to delete things that are already gone
+        # such as when a single keyword select gets its value changed.
+        $ObjectKeys = $TicketObj->KeywordsObj( $KeywordSelect->id );
+
+        while ( my $TicketKey = $ObjectKeys->Next ) {
+
+            # if the hash defined above doesn\'t contain the keyword mentioned,
+            unless ( $values{ $TicketKey->Keyword } ) {
+
+                #I'd really love to just call $keyword->Delete, but then 
+                # we wouldn't get a transaction recorded
+                my ( $result, $msg ) = $TicketObj->DeleteKeyword(
+                    Keyword       => $TicketKey->Keyword,
+                    KeywordSelect => $KeywordSelect->id
+                );
+                push ( @results, $msg );
+            }
+        }
+
+        # }}}
+    }
+
+    #Iterate through the keyword selects for BulkManipulator style access
+    while ( my $KeywordSelect = $KeywordSelects->Next ) {
+        if ( $ARGSRef->{ "AddToKeywordSelect" . $KeywordSelect->Id } ) {
+
+            #Add the keyword
+            my ( $result, $msg ) = $TicketObj->AddKeyword(
+                Keyword =>
+                $ARGSRef->{ "AddToKeywordSelect" . $KeywordSelect->Id },
+                KeywordSelect => $KeywordSelect->id
+            );
+            push ( @results, $msg );
+        }
+        if ( $ARGSRef->{ "DeleteFromKeywordSelect" . $KeywordSelect->Id } ) {
+
+            #Delete the keyword
+            my ( $result, $msg ) = $TicketObj->DeleteKeyword(
+                Keyword =>
+                $ARGSRef->{ "DeleteFromKeywordSelect" . $KeywordSelect->Id },
+                KeywordSelect => $KeywordSelect->id
+            );
+            push ( @results, $msg );
+        }
+    }
+
+    # }}}
+
+    return (@results);
+}
+
+# }}}
+
+1;
diff --git a/rt/lib/RT/Keyword.pm b/rt/lib/RT/Keyword.pm
new file mode 100644 (file)
index 0000000..a41e0a5
--- /dev/null
@@ -0,0 +1,446 @@
+#$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
new file mode 100644 (file)
index 0000000..6865216
--- /dev/null
@@ -0,0 +1,452 @@
+#$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
new file mode 100644 (file)
index 0000000..c220b39
--- /dev/null
@@ -0,0 +1,143 @@
+#$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
new file mode 100644 (file)
index 0000000..a9ecda2
--- /dev/null
@@ -0,0 +1,106 @@
+#$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/Link.pm b/rt/lib/RT/Link.pm
new file mode 100644 (file)
index 0000000..885ffe3
--- /dev/null
@@ -0,0 +1,373 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Link.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# (c) 1996-1999 Jesse Vincent <jesse@fsck.com>
+# This software is redistributable under the terms of the GNU GPL
+
+=head1 NAME
+
+  RT::Link - an RT Link object
+
+=head1 SYNOPSIS
+
+  use RT::Link;
+
+=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 other similar objects.
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Link);
+
+=end testing
+
+=cut
+
+package RT::Link;
+use RT::Record;
+use Carp;
+@ISA= qw(RT::Record);
+
+# {{{ sub _Init
+sub _Init  {
+  my $self  = shift;
+  $self->{'table'} = "Links";
+  return ($self->SUPER::_Init(@_));
+}
+
+# }}}
+
+# {{{ sub Create 
+
+=head2 Create PARAMHASH
+
+Create a new link object. Takes 'Base', 'Target' and 'Type'.
+Returns undef on failure or a Link Id on success.
+
+=cut
+
+sub Create  {
+    my $self = shift;
+    my %args = ( Base => undef,
+                Target => undef,
+                Type => undef,
+                @_ # get the real argumentlist
+              );
+    
+    my $BaseURI = $self->CanonicalizeURI($args{'Base'});
+    my $TargetURI = $self->CanonicalizeURI($args{'Target'});
+    
+    unless (defined $BaseURI) {
+       $RT::Logger->warning ("$self couldn't resolve base:'".$args{'Base'}.
+                             "' into a URI\n");
+       return (undef);
+    }
+    unless (defined $TargetURI) {
+       $RT::Logger->warning ("$self couldn't resolve target:'".$args{'Target'}.
+                             "' into a URI\n");
+       return(undef);
+    }
+    
+    my $LocalBase = $self->_IsLocal($BaseURI);
+    my $LocalTarget = $self->_IsLocal($TargetURI);
+    my $id = $self->SUPER::Create(Base => "$BaseURI",
+                                 Target => "$TargetURI",
+                                 LocalBase => $LocalBase, 
+                                 LocalTarget => $LocalTarget,
+                                 Type => $args{'Type'});
+    return ($id);
+}
+
+# }}}
+# {{{ sub Load 
+
+=head2 Load
+
+  Load an RT::Link object from the database.  Takes one parameter or three.
+  One parameter is the id of an entry in the links table.  Three parameters are a tuple of (base, linktype, target);
+
+
+=cut
+
+sub Load  {
+  my $self = shift;
+  my $identifier = shift;
+  my $linktype = shift if (@_);
+  my $target = shift if (@_);
+  
+  if ($target) {
+      my $BaseURI = $self->CanonicalizeURI($identifier);
+      my $TargetURI = $self->CanonicalizeURI($target);
+      $self->LoadByCols( Base => $BaseURI,
+                        Type => $linktype,
+                        Target => $TargetURI
+                      ) || return (0, "Couldn't load link");
+  }
+  
+  elsif ($identifier =~ /^\d+$/) {
+      $self->LoadById($identifier) ||
+       return (0, "Couldn't load link");
+  }
+  else {
+       return (0, "That's not a numerical id");
+  }
+}
+
+# }}}
+
+# {{{ sub TargetObj 
+
+=head2 TargetObj
+
+=cut
+
+sub TargetObj {
+  my $self = shift;
+   return $self->_TicketObj('base',$self->Target);
+}
+# }}}
+
+# {{{ sub BaseObj
+
+=head2 BaseObj
+
+=cut
+
+sub BaseObj {
+  my $self = shift;
+  return $self->_TicketObj('target',$self->Base);
+}
+# }}}
+
+# {{{ sub _TicketObj
+sub _TicketObj {
+  my $self = shift;
+  my $name = shift;
+  my $ref = shift;
+  my $tag="$name\_obj";
+  
+  unless (exists $self->{$tag}) {
+
+  $self->{$tag}=RT::Ticket->new($self->CurrentUser);
+
+  #If we can get an actual ticket, load it up.
+  if ($self->_IsLocal($ref)) {
+      $self->{$tag}->Load($ref);
+    }
+  }
+  return $self->{$tag};
+}
+# }}}
+
+# {{{ sub _Accessible 
+sub _Accessible  {
+  my $self = shift;
+  my %Cols = (
+             LocalBase => 'read',
+             LocalTarget => 'read',
+             Base => 'read',
+             Target => 'read',
+             Type => 'read',
+             Creator => 'read/auto',
+             Created => 'read/auto',
+             LastUpdatedBy => 'read/auto',
+             LastUpdated => 'read/auto'
+            );
+  return($self->SUPER::_Accessible(@_, %Cols));
+}
+# }}}
+
+
+# Static methods:
+
+# {{{ sub BaseIsLocal
+
+=head2 BaseIsLocal
+
+Returns true if the base of this link is a local ticket
+
+=cut
+
+sub BaseIsLocal {
+  my $self = shift;
+  return $self->_IsLocal($self->Base);
+}
+
+# }}}
+
+# {{{ sub TargetIsLocal
+
+=head2 TargetIsLocal
+
+Returns true if the target of this link is a local ticket
+
+=cut
+
+sub TargetIsLocal {
+  my $self = shift;
+  return $self->_IsLocal($self->Target);
+}
+
+# }}}
+
+# {{{ sub _IsLocal
+
+=head2 _IsLocal URI 
+
+When handed a URI returns the local ticket id if it\'s local. otherwise returns undef.
+
+=cut
+
+sub _IsLocal {
+    my $self = shift;
+    my $URI=shift;
+    unless ($URI) {
+       $RT::Logger->warning ("$self _IsLocal called without a URI\n");
+       return (undef);
+    }
+    # TODO: More thorough check
+    if ($URI =~ /^$RT::TicketBaseURI(\d+)$/) {
+       return($1);
+    }
+    else {
+       return (undef);
+    }
+}
+# }}}
+
+
+# {{{ sub BaseAsHREF 
+
+=head2 BaseAsHREF
+
+Returns an HTTP url to access the base of this link
+
+=cut
+
+sub BaseAsHREF {
+  my $self = shift;
+  return $self->AsHREF($self->Base);
+}
+# }}}
+
+# {{{ sub TargetAsHREF 
+
+=head2 TargetAsHREF
+
+return an HTTP url to access the target of this link
+
+=cut
+
+sub TargetAsHREF {
+  my $self = shift;
+  return $self->AsHREF($self->Target);
+}
+# }}}
+
+# {{{ sub AsHREF - Converts Link URIs to HTTP URLs
+=head2 URI
+
+Takes a URI and returns an http: url to access that object.
+
+=cut
+sub AsHREF {
+    my $self=shift;
+    my $URI=shift;
+    if ($self->_IsLocal($URI)) {
+       my $url=$RT::WebURL . "Ticket/Display.html?id=$URI";
+       return($url);
+    } 
+    else {
+       my ($protocol) = $URI =~ m|(.*?)://|;
+       unless (exists $RT::URI2HTTP{$protocol}) {
+           $RT::Logger->warning("Linking for protocol $protocol not defined in the config file!");
+           return("");
+       }
+       return $RT::URI2HTTP{$protocol}->($URI);
+    }
+}
+
+# }}}
+
+# {{{ sub GetContent - gets the content from a link
+sub GetContent {
+    my ($self, $URI)= @_;
+    if ($self->_IsLocal($URI)) {
+       die "stub";
+    } else {
+       # Find protocol
+       if ($URI =~ m|^(.*?)://|) {
+           if (exists $RT::ContentFromURI{$1}) {
+               return $RT::ContentFromURI{$1}->($URI);
+           } else {
+               warn "No sub exists for fetching the content from a $1 in $URI";
+           }
+       } else {
+           warn "No protocol specified in $URI";
+       }
+    }
+}
+# }}}
+
+# {{{ sub CanonicalizeURI
+
+=head2 CanonicalizeURI
+
+Takes a single argument: some form of ticket identifier. 
+Returns its canonicalized URI.
+
+Bug: ticket aliases can't have :// in them. URIs must have :// in them.
+
+=cut
+
+sub CanonicalizeURI {
+    my $self = shift;
+    my $id = shift;
+    
+    
+    #If it's a local URI, load the ticket object and return its URI
+    if ($id =~ /^$RT::TicketBaseURI/) {
+       my $ticket = new RT::Ticket($self->CurrentUser);
+       $ticket->Load($id);
+       #If we couldn't find a ticket, return undef.
+       return undef unless (defined $ticket->Id);
+       #$RT::Logger->debug("$self -> CanonicalizeURI was passed $id and returned ".$ticket->URI ." (uri)\n");
+       return ($ticket->URI);
+    }
+    #If it's a remote URI, we're going to punt for now
+    elsif ($id =~ '://' ) {
+       return ($id);
+    }
+  
+    #If the base is an integer, load it as a ticket 
+    elsif ( $id =~ /^\d+$/ ) {
+       
+       #$RT::Logger->debug("$self -> CanonicalizeURI was passed $id. It's a ticket id.\n");
+       my $ticket = new RT::Ticket($self->CurrentUser);
+       $ticket->Load($id);
+       #If we couldn't find a ticket, return undef.
+       return undef unless (defined $ticket->Id);
+       #$RT::Logger->debug("$self returned ".$ticket->URI ." (id #)\n");
+       return ($ticket->URI);
+    }
+
+    #It's not a URI. It's not a numerical ticket ID
+    else { 
+     
+       #If we couldn't find a ticket, return undef.
+       return( undef);
+    
+    }
+
+}
+
+# }}}
+
+1;
diff --git a/rt/lib/RT/Links.pm b/rt/lib/RT/Links.pm
new file mode 100644 (file)
index 0000000..a8180ca
--- /dev/null
@@ -0,0 +1,90 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Links.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Links - A collection of Link objects
+
+=head1 SYNOPSIS
+
+  use RT::Links;
+  my $links = new RT::Links($CurrentUser);
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Links);
+
+=end testing
+
+=cut
+
+package RT::Links;
+use RT::EasySearch;
+use RT::Link;
+
+@ISA= qw(RT::EasySearch);
+
+# {{{ sub _Init  
+sub _Init   {
+  my $self = shift;
+  $self->{'table'} = "Links";
+  $self->{'primary_key'} = "id";
+
+
+  return ( $self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub Limit 
+sub Limit  {
+    my $self = shift;
+    my %args = ( ENTRYAGGREGATOR => 'AND',
+                OPERATOR => '=',
+                @_);
+    
+    #if someone's trying to search for tickets, try to resolve the uris for searching.
+    
+    if (  ( $args{'OPERATOR'} eq '=') and
+         ( $args{'FIELD'}  eq 'Base') or ($args{'FIELD'} eq 'Target')
+       ) {
+       my $dummy = $self->NewItem();
+         $uri = $dummy->CanonicalizeURI($args{'VALUE'});
+    }
+
+
+    # If we're limiting by target, order by base
+    # (Order by the thing that's changing)
+
+    if ( ($args{'FIELD'} eq 'Target') or 
+        ($args{'FIELD'} eq 'LocalTarget') ) {
+       $self->OrderBy (ALIAS => 'main',
+                       FIELD => 'Base',
+                       ORDER => 'ASC');
+    }
+    elsif ( ($args{'FIELD'} eq 'Base') or 
+           ($args{'FIELD'} eq 'LocalBase') ) {
+       $self->OrderBy (ALIAS => 'main',
+                       FIELD => 'Target',
+                       ORDER => 'ASC');
+    }
+    
+
+    $self->SUPER::Limit(%args);
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+    my $self = shift;
+    return(RT::Link->new($self->CurrentUser));
+}
+# }}}
+  1;
+
diff --git a/rt/lib/RT/ObjectKeyword.pm b/rt/lib/RT/ObjectKeyword.pm
new file mode 100644 (file)
index 0000000..287d41f
--- /dev/null
@@ -0,0 +1,192 @@
+#$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
new file mode 100644 (file)
index 0000000..5df996e
--- /dev/null
@@ -0,0 +1,234 @@
+#$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/Queue.pm b/rt/lib/RT/Queue.pm
new file mode 100755 (executable)
index 0000000..1656903
--- /dev/null
@@ -0,0 +1,944 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Queue.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Queue - an RT Queue object
+
+=head1 SYNOPSIS
+
+  use RT::Queue;
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing 
+use RT::TestHarness;
+
+use RT::Queue;
+
+=end testing
+
+=cut
+
+
+
+package RT::Queue;
+use RT::Record;
+
+@ISA= qw(RT::Record);
+
+use vars (@STATUS);
+
+@STATUS = qw(new open stalled resolved dead); 
+
+=head2 StatusArray
+
+Returns an array of all statuses for this queue
+
+=cut
+
+sub StatusArray {
+    my $self = shift;
+    return (@STATUS);
+}
+
+
+=head2 IsValidStatus VALUE
+
+Returns true if VALUE is a valid status.  Otherwise, returns 0
+
+=for testing
+my $q = new RT::Queue($RT::SystemUser);
+ok($q->IsValidStatus('new')== 1, 'New is a valid status');
+ok($q->IsValidStatus('f00')== 0, 'f00 is not a valid status');
+
+=cut
+
+sub IsValidStatus {
+       my $self = shift;
+       my $value = shift;
+
+       my $retval = grep (/^$value$/, $self->StatusArray);
+       return ($retval);       
+
+}
+       
+
+
+
+# {{{  sub _Init 
+sub _Init  {
+    my $self = shift;
+    $self->{'table'} = "Queues";
+    return ($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _Accessible 
+
+sub _Accessible  {
+    my $self = shift;
+    my %Cols = ( Name => 'read/write',
+                CorrespondAddress => 'read/write',
+                Description => 'read/write',
+                CommentAddress =>  'read/write',
+                InitialPriority =>  'read/write',
+                FinalPriority =>  'read/write',
+                DefaultDueIn =>  'read/write',
+                Creator => 'read/auto',
+                Created => 'read/auto',
+                LastUpdatedBy => 'read/auto',
+                LastUpdated => 'read/auto',
+                Disabled => 'read/write',
+                
+              );
+    return($self->SUPER::_Accessible(@_, %Cols));
+}
+
+# }}}
+
+# {{{ sub Create
+
+=head2 Create
+
+Create takes the name of the new queue 
+If you pass the ACL check, it creates the queue and returns its queue id.
+
+=cut
+
+sub Create  {
+    my $self = shift;
+    my %args = ( Name => undef,
+                CorrespondAddress => '',
+                Description => '',
+                CommentAddress => '',
+                InitialPriority => "0",
+                FinalPriority =>  "0",
+                DefaultDueIn =>  "0",
+                @_); 
+    
+    unless ($self->CurrentUser->HasSystemRight('AdminQueue')) {    #Check them ACLs
+       return (0, "No permission to create queues") 
+    }
+
+    unless ($self->ValidateName($args{'Name'})) {
+       return(0, 'Queue already exists');
+    }
+    #TODO better input validation
+    
+    my $id = $self->SUPER::Create(%args);
+    unless ($id) {
+       return (0, 'Queue could not be created');
+    }
+
+    return ($id, "Queue $id created");
+}
+
+# }}}
+
+# {{{ sub Delete 
+
+sub Delete {
+    my $self = shift;
+    return (0, 'Deleting this object would break referential integrity');
+}
+
+# }}}
+
+# {{{ sub SetDisabled
+
+=head2 SetDisabled
+
+Takes a boolean.
+1 will cause this queue to no longer be avaialble for tickets.
+0 will re-enable this queue
+
+=cut
+
+# }}}
+
+# {{{ sub Load 
+
+=head2 Load
+
+Takes either a numerical id or a textual Name and loads the specified queue.
+  
+=cut
+
+sub Load  {
+    my $self = shift;
+    
+    my $identifier = shift;
+    if (!$identifier) {
+       return (undef);
+    }      
+    
+    if ($identifier !~ /\D/) {
+       $self->SUPER::LoadById($identifier);
+    }
+    else {
+       $self->LoadByCol("Name", $identifier);
+    }
+
+    return ($self->Id);
+
+
+}
+# }}}
+
+# {{{ sub ValidateName
+
+=head2 ValidateName NAME
+
+Takes a queue name. Returns true if it's an ok name for
+a new queue. Returns undef if there's already a queue by that name.
+
+=cut
+
+sub ValidateName {
+    my $self = shift;
+    my $name = shift;
+   
+    my $tempqueue = new RT::Queue($RT::SystemUser);
+    $tempqueue->Load($name);
+
+    #If we couldn't load it :)
+    unless ($tempqueue->id()) {
+       return(1);
+    }
+
+    #If this queue exists, return undef
+    #Avoid the ACL check.
+    if ($tempqueue->Name()){
+        return(undef);
+    }
+
+    #If the queue doesn't exist, return 1
+    else {
+        return(1);
+    }
+
+}
+
+
+# }}}
+
+# {{{ sub Templates
+
+=head2 Templates
+
+Returns an RT::Templates object of all of this queue's templates.
+
+=cut
+
+sub Templates {
+    my $self = shift;
+    
+
+    my $templates = RT::Templates->new($self->CurrentUser);
+
+    if ($self->CurrentUserHasRight('ShowTemplate')) {
+       $templates->LimitToQueue($self->id);
+    }
+    
+    return ($templates); 
+}
+
+# }}}
+
+# {{{ Dealing with watchers
+
+# {{{ sub Watchers
+
+=head2 Watchers
+
+Watchers returns a Watchers object preloaded with this queue\'s watchers.
+
+=cut
+
+sub Watchers {
+    my $self = shift;
+    
+    require RT::Watchers;
+    my $watchers =RT::Watchers->new($self->CurrentUser);
+    
+    if ($self->CurrentUserHasRight('SeeQueue')) {
+       $watchers->LimitToQueue($self->id);     
+    }  
+    
+    return($watchers);
+}
+
+# }}}
+
+# {{{ sub WatchersAsString
+=head2 WatchersAsString
+
+Returns a string of all queue watchers email addresses concatenated with ','s.
+
+=cut
+
+sub WatchersAsString {
+    my $self=shift;
+    return($self->Watchers->EmailsAsString());
+}
+
+# }}}
+
+# {{{ sub AdminCcAsString 
+
+=head2 AdminCcAsString
+
+Takes nothing. returns a string: All Ticket/Queue AdminCcs.
+
+=cut
+
+
+sub AdminCcAsString {
+    my $self=shift;
+    
+    return($self->AdminCc->EmailsAsString());
+  }
+
+# }}}
+
+# {{{ sub CcAsString
+
+=head2 CcAsString
+
+B<Returns> String: All Queue Ccs as a comma delimited set of email addresses.
+
+=cut
+
+sub CcAsString {
+    my $self=shift;
+    
+    return ($self->Cc->EmailsAsString());
+}
+
+# }}}
+
+# {{{ sub Cc
+
+=head2 Cc
+
+Takes nothing.
+Returns a watchers object which contains this queue\'s Cc watchers
+
+=cut
+
+sub Cc {
+    my $self = shift;
+    my $cc = $self->Watchers();
+    if ($self->CurrentUserHasRight('SeeQueue')) {
+       $cc->LimitToCc();
+    }
+    return ($cc);
+}
+
+# A helper function for Cc, so that we can call it from the ACL checks 
+# without going through acl checks.
+
+sub _Cc {
+    my $self = shift;
+    my $cc = $self->Watchers();
+    $cc->LimitToCc();
+    return($cc);
+    
+}
+
+# }}}
+
+# {{{ sub AdminCc
+
+=head2 AdminCc
+
+Takes nothing.
+Returns this queue's administrative Ccs as an RT::Watchers object
+
+=cut
+
+sub AdminCc {
+    my $self = shift;
+    my $admin_cc = $self->Watchers();
+    if ($self->CurrentUserHasRight('SeeQueue')) {
+       $admin_cc->LimitToAdminCc();
+    }
+    return($admin_cc);
+}
+
+#helper function for AdminCc so we can call it without ACLs
+sub _AdminCc {
+    my $self = shift;
+    my $admin_cc = $self->Watchers();
+    $admin_cc->LimitToAdminCc();
+    return($admin_cc);
+}
+
+# }}}
+
+# {{{ IsWatcher, IsCc, IsAdminCc
+
+# {{{ sub IsWatcher
+
+# a generic routine to be called by IsRequestor, IsCc and IsAdminCc
+
+=head2 IsWatcher
+
+Takes a param hash with the attributes Type and User. User is either a user object or string containing an email address. Returns true if that user or string
+is a queue watcher. Returns undef otherwise
+
+=cut
+
+sub IsWatcher {
+    my $self = shift;
+    
+    my %args = ( Type => 'Requestor',
+                Id => undef,
+                Email => undef,
+                @_
+              );
+    #ACL check - can't do it. we need this method for ACL checks
+    #    unless ($self->CurrentUserHasRight('SeeQueue')) {
+    #  return(undef);
+    #    }
+
+
+    my %cols = ('Type' => $args{'Type'},
+               'Scope' => 'Queue',
+               'Value' => $self->Id
+              );
+    if (defined ($args{'Id'})) {
+       if (ref($args{'Id'})){ #If it's a ref, assume it's an RT::User object;
+           #Dangerous but ok for now
+           $cols{'Owner'} = $args{'Id'}->Id;
+       }
+       elsif ($args{'Id'} =~ /^\d+$/) { # if it's an integer, it's an RT::User obj
+           $cols{'Owner'} = $args{'Id'};
+       }
+       else {
+           $cols{'Email'} = $args{'Id'};
+       }       
+    }  
+    
+    if (defined $args{'Email'}) {
+       $cols{'Email'} = $args{'Email'};
+    }
+
+    my ($description);
+    $description = join(":",%cols);
+    
+    #If we've cached a positive match...
+    if (defined $self->{'watchers_cache'}->{"$description"}) {
+       if ($self->{'watchers_cache'}->{"$description"} == 1) {
+           return(1);
+       }
+       #If we've cached a negative match...
+       else {
+           return(undef);
+       }
+    }
+
+    require RT::Watcher;
+    my $watcher = new RT::Watcher($self->CurrentUser);
+    $watcher->LoadByCols(%cols);
+    
+    
+    if ($watcher->id) {
+       $self->{'watchers_cache'}->{"$description"} = 1;
+       return(1);
+    }  
+    else {
+       $self->{'watchers_cache'}->{"$description"} = 0;
+       return(undef);
+    }
+    
+}
+
+# }}}
+
+# {{{ sub IsCc
+
+=head2 IsCc
+
+Takes a string. Returns true if the string is a Cc watcher of the current queue
+
+=item Bugs
+
+Should also be able to handle an RT::User object
+
+=cut
+
+
+sub IsCc {
+  my $self = shift;
+  my $cc = shift;
+  
+  return ($self->IsWatcher( Type => 'Cc', Id => $cc ));
+  
+}
+
+# }}}
+
+# {{{ sub IsAdminCc
+
+=head2 IsAdminCc
+
+Takes a string. Returns true if the string is an AdminCc watcher of the current queue
+
+=item Bugs
+
+Should also be able to handle an RT::User object
+
+=cut
+
+sub IsAdminCc {
+  my $self = shift;
+  my $admincc = shift;
+  
+  return ($self->IsWatcher( Type => 'AdminCc', Id => $admincc ));
+  
+}
+
+# }}}
+
+# }}}
+
+# {{{ sub AddWatcher
+
+=head2 AddWatcher
+
+Takes a paramhash of Email, Owner and Type. Type is one of 'Cc' or 'AdminCc',
+We need either an Email Address in Email or a userid in Owner
+
+=cut
+
+sub AddWatcher {
+    my $self = shift;
+    my %args = ( Email => undef,
+                Type => undef,
+                Owner => 0,
+                @_
+              );
+    
+    # {{{ Check ACLS
+    #If the watcher we're trying to add is for the current user
+    if ( ( ( defined $args{'Email'})  && 
+           ( $args{'Email'} eq $self->CurrentUser->EmailAddress) ) or 
+        ($args{'Owner'} eq $self->CurrentUser->Id)) {
+       
+       #  If it's an AdminCc and they don't have 
+       #   'WatchAsAdminCc' or 'ModifyQueueWatchers', bail
+       if ($args{'Type'} eq 'AdminCc') {
+           unless ($self->CurrentUserHasRight('ModifyQueueWatchers') or 
+                   $self->CurrentUserHasRight('WatchAsAdminCc')) {
+               return(0, 'Permission Denied');
+           }
+       }
+
+       #  If it's a Requestor or Cc and they don't have
+       #   'Watch' or 'ModifyQueueWatchers', bail
+       elsif ($args{'Type'} eq 'Cc') {
+           unless ($self->CurrentUserHasRight('ModifyQueueWatchers') or 
+                   $self->CurrentUserHasRight('Watch')) {
+               return(0, 'Permission Denied');
+           }
+       }
+       else {
+           $RT::Logger->warn("$self -> AddWatcher hit code".
+                             " it never should. We got passed ".
+                             " a type of ". $args{'Type'});
+           return (0,'Error in parameters to $self AddWatcher');
+       }
+    }
+    # If the watcher isn't the current user 
+    # and the current user  doesn't have 'ModifyQueueWatchers'
+    # bail
+    else {
+       unless ($self->CurrentUserHasRight('ModifyQueueWatchers')) {
+           return (0, "Permission Denied");
+       }
+    }
+    # }}}
+        
+    require RT::Watcher;
+    my $Watcher = new RT::Watcher ($self->CurrentUser);
+    return ($Watcher->Create(Scope => 'Queue', 
+                            Value => $self->Id,
+                            Email => $args{'Email'},
+                            Type => $args{'Type'},
+                            Owner => $args{'Owner'}
+                           ));
+}
+
+# }}}
+
+# {{{ sub AddCc
+
+=head2 AddCc
+
+Add a Cc to this queue.
+Takes a paramhash of Email and Owner. 
+We need either an Email Address in Email or a userid in Owner
+
+=cut
+
+
+sub AddCc {
+    my $self = shift;
+    return ($self->AddWatcher( Type => 'Cc', @_));
+}
+# }}}
+
+# {{{ sub AddAdminCc
+
+=head2 AddAdminCc
+
+Add an Administrative Cc to this queue.
+Takes a paramhash of Email and Owner. 
+We need either an Email Address in Email or a userid in Owner
+
+=cut
+
+sub AddAdminCc {
+    my $self = shift;
+    return ($self->AddWatcher( Type => 'AdminCc', @_));
+}
+# }}}
+
+# {{{ sub DeleteWatcher
+
+=head2 DeleteWatcher id [type]
+
+DeleteWatcher takes a single argument which is either an email address 
+or a watcher id.  
+If the first argument is an email address, you need to specify the watcher type you're talking
+about as the second argument. Valid values are 'Cc' or 'AdminCc'.
+It removes that watcher from this Queue\'s list of watchers.
+
+
+=cut
+
+
+sub DeleteWatcher {
+    my $self = shift;
+    my $id = shift;
+    
+    my $type;
+    
+    $type = shift if (@_);
+    
+
+    require RT::Watcher;
+    my $Watcher = new RT::Watcher($self->CurrentUser);
+    
+    #If it\'s a numeric watcherid
+    if ($id =~ /^(\d*)$/) {
+       $Watcher->Load($id);
+    }
+    
+    #Otherwise, we'll assume it's an email address
+    elsif ($type) {
+       my ($result, $msg) = 
+         $Watcher->LoadByValue( Email => $id,
+                                Scope => 'Queue',
+                                Value => $self->id,
+                                Type => $type);
+       return (0,$msg) unless ($result);
+    }
+    
+    else {
+       return(0,"Can\'t delete a watcher by email address without specifying a type");
+    }
+    
+    # {{{ Check ACLS 
+
+    #If the watcher we're trying to delete is for the current user
+    if ($Watcher->Email eq $self->CurrentUser->EmailAddress) {
+               
+       #  If it's an AdminCc and they don't have 
+       #   'WatchAsAdminCc' or 'ModifyQueueWatchers', bail
+       if ($Watcher->Type eq 'AdminCc') {
+           unless ($self->CurrentUserHasRight('ModifyQueueWatchers') or 
+                   $self->CurrentUserHasRight('WatchAsAdminCc')) {
+               return(0, 'Permission Denied');
+           }
+       }
+
+       #  If it's a  Cc and they don't have
+       #   'Watch' or 'ModifyQueueWatchers', bail
+       elsif ($Watcher->Type eq 'Cc') {
+           unless ($self->CurrentUserHasRight('ModifyQueueWatchers') or 
+                   $self->CurrentUserHasRight('Watch')) {
+               return(0, 'Permission Denied');
+           }
+       }
+       else {
+           $RT::Logger->warn("$self -> DeleteWatcher hit code".
+                             " it never should. We got passed ".
+                             " a type of ". $args{'Type'});
+           return (0,'Error in parameters to $self DeleteWatcher');
+       }
+    }
+    # If the watcher isn't the current user 
+    # and the current user  doesn't have 'ModifyQueueWatchers'
+    # bail
+    else {
+       unless ($self->CurrentUserHasRight('ModifyQueueWatchers')) {
+           return (0, "Permission Denied");
+       }
+    }
+
+    # }}}
+    
+    unless (($Watcher->Scope eq 'Queue') and
+           ($Watcher->Value == $self->id) ) {
+       return (0, "Not a watcher for this queue");
+    }
+    
+
+    #Clear out the watchers hash.
+    $self->{'watchers'} = undef;
+    
+    my $retval = $Watcher->Delete();
+    
+    unless ($retval) {
+       return(0,"Watcher could not be deleted.");
+    }
+    
+    return(1, "Watcher deleted");
+}
+
+# {{{ sub DeleteCc
+
+=head2 DeleteCc EMAIL
+
+Takes an email address. It calls DeleteWatcher with a preset 
+type of 'Cc'
+
+
+=cut
+
+sub DeleteCc {
+   my $self = shift;
+   my $id = shift;
+   return ($self->DeleteWatcher ($id, 'Cc'))
+}
+
+# }}}
+
+# {{{ sub DeleteAdminCc
+
+=head2 DeleteAdminCc EMAIL
+
+Takes an email address. It calls DeleteWatcher with a preset 
+type of 'AdminCc'
+
+
+=cut
+
+sub DeleteAdminCc {
+   my $self = shift;
+   my $id = shift;
+   return ($self->DeleteWatcher ($id, 'AdminCc'))
+}
+
+# }}}
+
+
+# }}}
+
+# }}}
+
+# {{{ Dealing with keyword selects
+
+# {{{ sub AddKeywordSelect
+
+=head2 AddKeywordSelect
+
+Takes a paramhash of Name, Keyword, Depth and Single.  Adds a new KeywordSelect for 
+this queue with those attributes.
+
+=cut
+
+
+sub AddKeywordSelect {
+    my $self = shift;
+    my %args = ( Keyword => undef,
+                Depth => undef,
+                Single => undef,
+                Name => undef,
+                @_);
+    
+    #ACLS get handled in KeywordSelect
+    my $NewKeywordSelect = new RT::KeywordSelect($self->CurrentUser);
+    
+    return ($NewKeywordSelect->Create (Keyword => $args{'Keyword'},
+                              Depth => $args{'Depth'},
+                              Name => $args{'Name'},
+                              Single => $args{'Single'},
+                              ObjectType => 'Ticket',
+                              ObjectField => 'Queue',
+                              ObjectValue => $self->Id()
+                             ) );
+}
+
+# }}}
+
+# {{{ sub KeywordSelect
+
+=head2 KeywordSelect([NAME])
+
+Takes the name of a keyword select for this queue or that's global.
+Returns the relevant KeywordSelect object.  Prefers a keywordselect that's 
+specific to this queue over a global one.  If it can't find the proper
+Keword select or the user doesn't have permission, returns an empty 
+KeywordSelect object
+
+=cut
+
+sub KeywordSelect {
+    my $self = shift;
+    my $name = shift;
+    
+    require RT::KeywordSelect;
+
+    my $select = RT::KeywordSelect->new($self->CurrentUser);
+    if ($self->CurrentUserHasRight('SeeQueue')) {
+       $select->LoadByName( Name => $name, Queue => $self->Id);
+    }
+    return ($select);
+}
+
+
+# }}}
+
+# {{{ sub KeywordSelects
+
+=head2 KeywordSelects
+
+Returns an B<RT::KeywordSelects> object containing the collection of
+B<RT::KeywordSelect> objects which apply to this queue. (Both queue specific keyword selects
+and global keyword selects.
+
+=cut
+
+sub KeywordSelects {
+  my $self = shift;
+
+
+  use RT::KeywordSelects;
+  my $KeywordSelects = new RT::KeywordSelects($self->CurrentUser);
+
+  if ($self->CurrentUserHasRight('SeeQueue')) {
+      $KeywordSelects->LimitToQueue($self->id);
+      $KeywordSelects->IncludeGlobals();
+  }
+  return ($KeywordSelects);
+}
+# }}}
+
+# }}}
+
+# {{{ ACCESS CONTROL
+
+# {{{ sub ACL 
+
+=head2 ACL
+
+#Returns an RT::ACL object of ACEs everyone who has anything to do with this queue.
+
+=cut
+
+sub ACL  {
+    my $self = shift;
+    
+    use RT::ACL;
+    my $acl = new RT::ACL($self->CurrentUser);
+    
+    if ($self->CurrentUserHasRight('ShowACL')) {
+       $acl->LimitToQueue($self->Id);
+    }
+    
+    return ($acl);
+}
+
+# }}}
+
+# {{{ sub _Set
+sub _Set {
+    my $self = shift;
+
+    unless ($self->CurrentUserHasRight('AdminQueue')) {
+       return(0, 'Permission Denied');
+    }  
+    return ($self->SUPER::_Set(@_));
+}
+# }}}
+
+# {{{ sub _Value
+
+sub _Value {
+    my $self = shift;
+
+    unless ($self->CurrentUserHasRight('SeeQueue')) {
+       return (undef);
+    }
+
+    return ($self->__Value(@_));
+}
+
+# }}}
+
+# {{{ sub CurrentUserHasRight
+
+=head2 CurrentUserHasRight
+
+Takes one argument. A textual string with the name of the right we want to check.
+Returns true if the current user has that right for this queue.
+Returns undef otherwise.
+
+=cut
+
+sub CurrentUserHasRight {
+  my $self = shift;
+  my $right = shift;
+
+  return ($self->HasRight( Principal=> $self->CurrentUser,
+                            Right => "$right"));
+
+}
+
+# }}}
+
+# {{{ sub HasRight
+
+=head2 HasRight
+
+Takes a param hash with the fields 'Right' and 'Principal'.
+Principal defaults to the current user.
+Returns true if the principal has that right for this queue.
+Returns undef otherwise.
+
+=cut
+
+# TAKES: Right and optional "Principal" which defaults to the current user
+sub HasRight {
+    my $self = shift;
+        my %args = ( Right => undef,
+                     Principal => $self->CurrentUser,
+                     @_);
+        unless(defined $args{'Principal'}) {
+                $RT::Logger->debug("Principal undefined in Queue::HasRight");
+
+        }
+        return($args{'Principal'}->HasQueueRight(QueueObj => $self,
+          Right => $args{'Right'}));
+}
+# }}}
+
+# }}}
+
+1;
diff --git a/rt/lib/RT/Queues.pm b/rt/lib/RT/Queues.pm
new file mode 100755 (executable)
index 0000000..ab58d8d
--- /dev/null
@@ -0,0 +1,123 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Queues.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Queues - a collection of RT::Queue objects
+
+=head1 SYNOPSIS
+
+  use RT::Queues;
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Queues);
+
+=end testing
+
+=cut
+
+package RT::Queues;
+use RT::EasySearch;
+@ISA= qw(RT::EasySearch);
+
+
+# {{{ sub _Init
+sub _Init { 
+  my $self = shift;
+  $self->{'table'} = "Queues";
+  $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 Limit 
+sub Limit  {
+  my $self = shift;
+  my %args = ( ENTRYAGGREGATOR => 'AND',
+              @_);
+  $self->SUPER::Limit(%args);
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+  my $item;
+
+  use RT::Queue;
+  $item = new RT::Queue($self->CurrentUser);
+  return($item);
+}
+# }}}
+
+# {{{ sub Next 
+
+=head2 Next
+
+Returns the next queue that this user can see.
+
+=cut
+  
+sub Next {
+    my $self = shift;
+    
+    
+    my $Queue = $self->SUPER::Next();
+    if ((defined($Queue)) and (ref($Queue))) {
+
+       if ($Queue->CurrentUserHasRight('SeeQueue')) {
+           return($Queue);
+       }
+       
+       #If the user doesn't have the right to show this queue
+       else {  
+           return($self->Next());
+       }
+    }
+    #if there never was any queue
+    else {
+       return(undef);
+    }  
+    
+}
+# }}}
+
+1;
+
diff --git a/rt/lib/RT/Record.pm b/rt/lib/RT/Record.pm
new file mode 100755 (executable)
index 0000000..5340f7d
--- /dev/null
@@ -0,0 +1,345 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Record.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Record - Base class for RT record objects
+
+=head1 SYNOPSIS
+
+
+=head1 DESCRIPTION
+
+
+=begin testing
+
+ok (require RT::Record);
+
+=end testing
+
+=head1 METHODS
+
+=cut
+
+
+package RT::Record;
+use DBIx::SearchBuilder::Record::Cachable;
+use RT::Date;
+use RT::User;
+
+@ISA= qw(DBIx::SearchBuilder::Record::Cachable);
+
+# {{{ sub _Init 
+
+sub _Init  {
+  my $self = shift;
+  $self->_MyCurrentUser(@_);
+  
+}
+
+# }}}
+
+# {{{ _PrimaryKeys
+
+=head2 _PrimaryKeys
+
+The primary keys for RT classes is 'id'
+
+=cut
+
+sub _PrimaryKeys {
+    my $self = shift;
+    return(['id']);
+}
+
+# }}}
+
+# {{{ sub _MyCurrentUser 
+
+sub _MyCurrentUser  {
+    my $self = shift;
+  
+    $self->CurrentUser(@_);
+    if(!defined($self->CurrentUser)) {
+       use Carp;
+       Carp::cluck();
+       $RT::Logger->err("$self was created without a CurrentUser\n"); 
+      return(0);
+    }
+}
+
+# }}}
+
+# {{{ sub _Handle 
+sub _Handle  {
+  my $self = shift;
+  return($RT::Handle);
+}
+# }}}
+
+# {{{ sub Create 
+
+sub Create  {
+    my $self = shift;
+    my $now = new RT::Date($self->CurrentUser);
+    $now->Set(Format=> 'unix', Value => time);
+    push @_, 'Created', $now->ISO()
+      if ($self->_Accessible('Created', 'auto'));
+    
+
+    push @_, 'Creator', $self->{'user'}->id
+      if $self->_Accessible('Creator', 'auto');
+    
+    push @_, 'LastUpdated', $now->ISO()
+      if ($self->_Accessible('LastUpdated', 'auto'));
+
+    push @_, 'LastUpdatedBy', $self->{'user'}->id
+      if $self->_Accessible('LastUpdatedBy', 'auto');
+    
+    
+
+   my $id = $self->SUPER::Create(@_);
+    
+    if ($id) {
+       $self->Load($id);
+    }
+    
+    return($id);
+    
+}
+
+# }}}
+
+
+# {{{ sub LoadByCols
+
+=head2 LoadByCols
+
+Override DBIx::SearchBuilder::LoadByCols to do case-insensitive loads if the 
+DB is case sensitive
+
+=cut
+
+sub LoadByCols {
+    my $self = shift;
+    my %hash = (@_);
+
+    # If this database is case sensitive we need to uncase objects for
+    # explicit loading
+    if ($self->_Handle->CaseSensitive) {
+        my %newhash;
+        foreach my $key (keys %hash) {
+        # If we've been passed an empty value, we can't do the lookup. 
+               # We don't need to explicitly downcase integers or an id.
+               if ($key =~ '^id$' || $hash{$key} =~/^\d+$/ || !defined ($hash{$key}) ) {
+                       $newhash{$key} = $hash{$key};
+               }
+               else {
+                       $newhash{"lower(".$key.")"} = lc($hash{$key});  
+               }
+        }
+       $self->SUPER::LoadByCols(%newhash);
+    }
+    else {
+       $self->SUPER::LoadByCols(%hash);
+    }
+}
+
+# }}}
+
+
+# {{{ Datehandling
+
+# There is room for optimizations in most of those subs:
+
+# {{{ LastUpdatedObj
+
+sub LastUpdatedObj {
+    my $self=shift;
+    my $obj = new RT::Date($self->CurrentUser);
+    
+    $obj->Set(Format => 'sql', Value => $self->LastUpdated);
+    return $obj;
+}
+
+# }}}
+
+# {{{ CreatedObj
+
+sub CreatedObj {
+    my $self=shift;
+    my $obj = new RT::Date($self->CurrentUser);
+    
+    $obj->Set(Format => 'sql', Value => $self->Created);
+
+    
+    return $obj;
+}
+
+# }}}
+
+# {{{ AgeAsString
+#
+# TODO: This should be deprecated
+#
+sub AgeAsString {
+    my $self=shift;
+    return($self->CreatedObj->AgeAsString());
+}
+# }}}
+
+# {{{ LastUpdatedAsString
+
+# TODO this should be deprecated
+
+sub LastUpdatedAsString {
+    my $self=shift;
+    if ($self->LastUpdated) {
+       return ($self->LastUpdatedObj->AsString());
+         
+    } else {
+       return "never";
+    }
+}
+
+# }}}
+
+# {{{ CreatedAsString
+#
+# TODO This should be deprecated 
+#
+sub CreatedAsString {
+    my $self = shift;
+    return ($self->CreatedObj->AsString());
+}
+# }}}
+
+# {{{ LongSinceUpdateAsString
+#
+# TODO This should be deprecated
+#
+sub LongSinceUpdateAsString {
+    my $self=shift;
+    if ($self->LastUpdated) {
+      
+        return ($self->LastUpdatedObj->AgeAsString());
+       
+    } else {
+       return "never";
+    }
+}
+# }}}
+
+# }}} Datehandling
+
+
+# {{{ sub _Set 
+sub _Set  {
+  my $self = shift;
+
+  my %args = ( Field => undef,
+              Value => undef,
+              IsSQL => undef,
+              @_ );
+
+
+  #if the user is trying to modify the record
+  if ((!defined ($args{'Field'})) || (!defined ($args{'Value'}))) {
+    $args{'Value'} = 0; 
+   }
+
+  $self->_SetLastUpdated();
+  $self->SUPER::_Set(Field => $args{'Field'},
+                    Value => $args{'Value'},
+                    IsSQL => $args{'IsSQL'});
+  
+  
+}
+# }}}
+
+# {{{ sub _SetLastUpdated
+
+=head2 _SetLastUpdated
+
+This routine updates the LastUpdated and LastUpdatedBy columns of the row in question
+It takes no options. Arguably, this is a bug
+
+=cut
+
+sub _SetLastUpdated {
+    my $self = shift;
+    use RT::Date;
+    my $now = new RT::Date($self->CurrentUser);
+    $now->SetToNow();
+
+    if ($self->_Accessible('LastUpdated','auto')) {
+       my ($msg, $val) = $self->__Set( Field => 'LastUpdated',
+                                        Value => $now->ISO);
+    }
+    if ($self->_Accessible('LastUpdatedBy','auto')) {
+        my ($msg, $val) = $self->__Set( Field => 'LastUpdatedBy', 
+                                       Value => $self->CurrentUser->id);
+    }
+}
+
+# }}}
+
+# {{{ sub CreatorObj 
+
+=head2 CreatorObj
+
+Returns an RT::User object with the RT account of the creator of this row
+
+=cut
+
+sub CreatorObj  {
+  my $self = shift;
+  unless (exists $self->{'CreatorObj'}) {
+    
+    $self->{'CreatorObj'} = RT::User->new($self->CurrentUser);
+    $self->{'CreatorObj'}->Load($self->Creator);
+  }
+  return($self->{'CreatorObj'});
+}
+# }}}
+
+# {{{ sub LastUpdatedByObj
+
+=head2 LastUpdatedByObj
+
+  Returns an RT::User object of the last user to touch this object
+
+=cut
+
+sub LastUpdatedByObj {
+    my $self=shift;
+    unless (exists $self->{LastUpdatedByObj}) {
+       $self->{'LastUpdatedByObj'}=RT::User->new($self->CurrentUser);
+       $self->{'LastUpdatedByObj'}->Load($self->LastUpdatedBy);
+    }
+    return $self->{'LastUpdatedByObj'};
+}
+
+# }}}
+
+# {{{ sub CurrentUser 
+
+=head2 CurrentUser
+
+If called with an argument, sets the current user to that user object.
+This will affect ACL decisions, etc.  
+Returns the current user
+
+=cut
+
+sub CurrentUser  {
+  my $self = shift;
+
+  if (@_) {
+    $self->{'user'} = shift;
+  }
+  return ($self->{'user'});
+}
+# }}}
+
+
+1;
diff --git a/rt/lib/RT/Scrip.pm b/rt/lib/RT/Scrip.pm
new file mode 100755 (executable)
index 0000000..aef011c
--- /dev/null
@@ -0,0 +1,372 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Scrip.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Scrip - an RT Scrip object
+
+=head1 SYNOPSIS
+
+  use RT::Scrip;
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Scrip);
+
+=end testing
+
+=cut
+
+package RT::Scrip;
+use RT::Record;
+@ISA= qw(RT::Record);
+
+# {{{ sub _Init
+sub _Init  {
+    my $self = shift;
+    $self->{'table'} = "Scrips";
+    return ($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _Accessible 
+sub _Accessible  {
+    my $self = shift;
+    my %Cols = ( ScripAction  => 'read/write',
+                ScripCondition => 'read/write',
+                Stage => 'read/write',
+                Queue => 'read/write', 
+                Template => 'read/write',
+              );
+    return($self->SUPER::_Accessible(@_, %Cols));
+}
+# }}}
+
+# {{{ sub Create 
+
+=head2 Create
+
+Creates a new entry in the Scrips table. Takes a paramhash with the attributes:
+
+    Queue           A queue id or 0 for a global scrip
+    Template        A template ID or name.  
+                    Behavior is undefined if you have multiple items with 
+                    the same name
+    ScripAction     A ScripAction id or name
+                    Behavior is undefined if you have multiple items with 
+                    the same name
+    ScripCondition  A ScripCondition id or name
+                    Behavior is undefined if you have multiple items with 
+                    the same name
+
+Returns (retval, msg);
+retval is 0 for failure or scrip id.  msg is a textual description of what happened.
+
+=cut
+
+sub Create  {
+    my $self = shift;
+    my %args = ( Queue => undef,
+                Template => undef,
+                ScripAction => undef,
+                ScripCondition => undef,
+                Stage => 'TransactionCreate',
+                @_
+              );
+    
+      
+    if ($args{'Queue'} == 0 ) { 
+       unless ($self->CurrentUser->HasSystemRight('ModifyScrips')) {
+           return (0, 'Permission Denied');
+       }       
+    }
+    else {
+       my $QueueObj = new RT::Queue($self->CurrentUser);
+       $QueueObj->Load($args{'Queue'});
+       unless ($QueueObj->id()) {
+           return (0,'Invalid queue');
+       }
+       unless ($QueueObj->CurrentUserHasRight('ModifyScrips')) {
+           return (0, 'Permssion Denied');
+       }       
+    }
+
+    #TODO +++ validate input 
+
+    require RT::ScripAction;
+    my $action = new RT::ScripAction($self->CurrentUser);
+    $action->Load($args{'ScripAction'});
+    return (0, "Action ".$args{'ScripAction'}." not found") unless $action->Id;
+
+    require RT::Template;
+    my $template = new RT::Template($self->CurrentUser);
+    $template->Load($args{'Template'});
+    return (0, 'Template not found') unless $template->Id;
+
+    require RT::ScripCondition;
+    my $condition = new RT::ScripCondition($self->CurrentUser);
+    $condition->Load($args{'ScripCondition'});
+
+    unless ($condition->Id) {
+       return (0, 'Condition not found');
+    }  
+    
+    my $id = $self->SUPER::Create(Queue => $args{'Queue'},
+                                 Template => $template->Id,
+                                 ScripCondition => $condition->id,
+                                 Stage => $args{'Stage'},
+                                 ScripAction => $action->Id
+                                );
+    return ($id, 'Scrip Created'); 
+}
+
+# }}}
+
+# {{{ sub Delete
+
+=head2 Delete
+
+Delete this object
+
+=cut
+
+sub Delete {
+    my $self = shift;
+    
+    unless ($self->CurrentUserHasRight('ModifyScrips')) {
+       return (0, 'Permission Denied');
+    }
+    
+    return ($self->SUPER::Delete(@_));
+}
+# }}}
+
+# {{{ sub QueueObj
+
+=head2 QueueObj
+
+Retuns an RT::Queue object with this Scrip\'s queue
+
+=cut
+
+sub QueueObj {
+    my $self = shift;
+    
+    if (!$self->{'QueueObj'})  {
+       require RT::Queue;
+       $self->{'QueueObj'} = RT::Queue->new($self->CurrentUser);
+       $self->{'QueueObj'}->Load($self->Queue);
+    }
+    return ($self->{'QueueObj'});
+}
+
+# }}}
+
+# {{{ sub ActionObj
+
+
+=head2 ActionObj
+
+Retuns an RT::Action object with this Scrip\'s Action
+
+=cut
+
+sub ActionObj {
+    my $self = shift;
+    
+    unless (defined $self->{'ScripActionObj'})  {
+       require RT::ScripAction;
+       
+       $self->{'ScripActionObj'} = RT::ScripAction->new($self->CurrentUser);
+       #TODO: why are we loading Actions with templates like this. 
+       # two seperate methods might make more sense
+       $self->{'ScripActionObj'}->Load($self->ScripAction, $self->Template);
+    }
+    return ($self->{'ScripActionObj'});
+}
+
+# }}}
+
+
+# {{{ sub TemplateObj
+=head2 TemplateObj
+
+Retuns an RT::Template object with this Scrip\'s Template
+
+=cut
+
+sub TemplateObj {
+    my $self = shift;
+    
+    unless (defined $self->{'TemplateObj'})  {
+       require RT::Template;
+       $self->{'TemplateObj'} = RT::Template->new($self->CurrentUser);
+       $self->{'TemplateObj'}->Load($self->Template);
+    }
+    return ($self->{'TemplateObj'});
+}
+
+# }}}
+
+# {{{ sub Prepare
+=head2 Prepare
+
+Calls the action object's prepare method
+
+=cut
+
+sub Prepare {
+    my $self = shift;
+    $self->ActionObj->Prepare(@_);
+}
+
+# }}}
+
+# {{{ sub Commit
+=head2 Commit
+
+Calls the action object's commit method
+
+=cut
+
+sub Commit {
+    my $self = shift;
+    $self->ActionObj->Commit(@_);
+}
+
+# }}}
+
+# {{{ sub ConditionObj
+
+=head2 ConditionObj
+
+Retuns an RT::ScripCondition object with this Scrip's IsApplicable
+
+=cut
+
+sub ConditionObj {
+    my $self = shift;
+    
+    unless (defined $self->{'ScripConditionObj'})  {
+       require RT::ScripCondition;
+       $self->{'ScripConditionObj'} = RT::ScripCondition->new($self->CurrentUser);
+       $self->{'ScripConditionObj'}->Load($self->ScripCondition);
+    }
+    return ($self->{'ScripConditionObj'});
+}
+
+# }}}
+
+# {{{ sub IsApplicable
+
+=head2 IsApplicable
+
+Calls the  Condition object\'s IsApplicable method
+
+=cut
+
+sub IsApplicable {
+    my $self = shift;
+    return ($self->ConditionObj->IsApplicable(@_));
+}
+
+# }}}
+
+# {{{ sub DESTROY
+sub DESTROY {
+    my $self = shift;
+    $self->{'ActionObj'} = undef;
+}
+# }}}
+
+# {{{ ACL related methods
+
+# {{{ sub _Set
+
+# does an acl check and then passes off the call
+sub _Set {
+    my $self = shift;
+    
+    unless ($self->CurrentUserHasRight('ModifyScrips')) {
+        $RT::Logger->debug("CurrentUser can't modify Scrips for ".$self->Queue."\n");
+       return (0, 'Permission Denied');
+    }
+    return $self->__Set(@_);
+}
+
+# }}}
+
+# {{{ sub _Value
+# does an acl check and then passes off the call
+sub _Value {
+    my $self = shift;
+    
+    unless ($self->CurrentUserHasRight('ShowScrips')) {
+        $RT::Logger->debug("CurrentUser can't modify Scrips for ".$self->__Value('Queue')."\n");
+       return (undef);
+    }
+    
+    return $self->__Value(@_);
+}
+# }}}
+
+# {{{ 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 Scrips.
+
+=cut
+
+sub HasRight {
+    my $self = shift;
+    my %args = ( Right => undef,
+                 Principal => undef,
+                 @_ );
+    
+    if ((defined $self->SUPER::_Value('Queue')) and ($self->SUPER::_Value('Queue') != 0)) {
+        return ( $args{'Principal'}->HasQueueRight(
+                                                  Right => $args{'Right'},
+                                                  Queue => $self->SUPER::_Value('Queue'),
+                                                  Principal => $args{'Principal'}
+                                                 ) 
+              );
+       
+    }
+    else {
+        return( $args{'Principal'}->HasSystemRight( $args{'Right'}) );
+    }
+}
+# }}}
+
+# }}}
+
+1;
+
+
diff --git a/rt/lib/RT/ScripAction.pm b/rt/lib/RT/ScripAction.pm
new file mode 100755 (executable)
index 0000000..471ad91
--- /dev/null
@@ -0,0 +1,200 @@
+# Copyright 1999-2000 Jesse Vincent <jesse@fsck.com>
+# Released under the terms of the GNU Public License
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ScripAction.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::ScripAction - RT Action object
+
+=head1 SYNOPSIS
+
+  use RT::ScripAction;
+
+
+=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 other modules.
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::ScripAction);
+
+=end testing
+
+=head1 METHODS
+
+=cut
+
+package RT::ScripAction;
+use RT::Record;
+@ISA= qw(RT::Record);
+
+# {{{  sub _Init 
+sub _Init  {
+    my $self = shift; 
+    $self->{'table'} = "ScripActions";
+    return ($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _Accessible 
+sub _Accessible  {
+    my $self = shift;
+    my %Cols = ( Name  => 'read',
+                Description => 'read',
+                ExecModule  => 'read',
+                Argument  => 'read',
+                Creator => 'read/auto',
+                Created => 'read/auto',
+                LastUpdatedBy => 'read/auto',
+                LastUpdated => 'read/auto'
+       );
+    return($self->SUPER::_Accessible(@_, %Cols));
+}
+# }}}
+
+# {{{ sub Create 
+=head2 Create
+  
+ Takes a hash. Creates a new Action entry.
+ should be better documented.
+=cut
+
+sub Create  {
+    my $self = shift;
+    #TODO check these args and do smart things.
+    return($self->SUPER::Create(@_));
+}
+# }}}
+
+# {{{ sub Delete 
+sub Delete  {
+    my $self = shift;
+    
+    return (0, "ScripAction->Delete not implemented");
+}
+# }}}
+
+# {{{ sub Load 
+sub Load  {
+    my $self = shift;
+    my $identifier = shift;
+    
+    if (!$identifier) {
+       return (0, 'Input error');
+    }      
+    
+    if ($identifier !~ /\D/) {
+       $self->SUPER::LoadById($identifier);
+    }
+    else {
+       $self->LoadByCol('Name', $identifier);
+       
+    }
+
+    if (@_) {
+       # Set the template Id to the passed in template    
+       my $template = shift;
+       
+       $self->{'Template'} = $template;
+    }
+    return ($self->Id, 'ScripAction loaded');
+}
+# }}}
+
+# {{{ sub LoadAction 
+
+=head2 LoadAction HASH
+
+  Takes a hash consisting of TicketObj and TransactionObj.  Loads an RT::Action:: module.
+
+=cut
+
+sub LoadAction  {
+    my $self = shift;
+    my %args = ( TransactionObj => undef,
+                TicketObj => undef,
+                @_ );
+    
+    #TODO: Put this in an eval  
+    $self->ExecModule =~ /^(\w+)$/;
+    my $module = $1;
+    my $type = "RT::Action::". $module;
+    $RT::Logger->debug("now requiring $type\n"); 
+    eval "require $type" || die "Require of $type failed.\n$@\n";
+    
+    $self->{'Action'}  = $type->new ( 'ScripActionObj' => $self, 
+                                     'TicketObj' => $args{'TicketObj'},
+                                     'TransactionObj' => $args{'TransactionObj'},
+                                     'TemplateObj' => $self->TemplateObj,
+                                     'Argument' => $self->Argument,
+                                   );
+}
+# }}}
+
+# {{{ sub TemplateObj
+
+=head2 TemplateObj
+
+Return this action\'s template object
+
+=cut
+
+sub TemplateObj {
+    my $self = shift;
+    return undef unless $self->{Template};
+    if (!$self->{'TemplateObj'})  {
+       require RT::Template;
+       $self->{'TemplateObj'} = RT::Template->new($self->CurrentUser);
+       $self->{'TemplateObj'}->LoadById($self->{'Template'});
+       
+    }
+    
+    return ($self->{'TemplateObj'});
+}
+# }}}
+
+# The following methods call the action object
+
+# {{{ sub Prepare 
+
+sub Prepare  {
+    my $self = shift;
+    return ($self->{'Action'}->Prepare());
+  
+}
+# }}}
+
+# {{{ sub Commit 
+sub Commit  {
+    my $self = shift;
+    return($self->{'Action'}->Commit());
+    
+    
+}
+# }}}
+
+# {{{ sub Describe 
+sub Describe  {
+    my $self = shift;
+    return ($self->{'Action'}->Describe());
+    
+}
+# }}}
+
+# {{{ sub DESTROY
+sub DESTROY {
+    my $self=shift;
+    $self->{'Action'} = undef;
+    $self->{'TemplateObj'} = undef;
+}
+# }}}
+
+
+1;
+
+
diff --git a/rt/lib/RT/ScripActions.pm b/rt/lib/RT/ScripActions.pm
new file mode 100755 (executable)
index 0000000..ec61415
--- /dev/null
@@ -0,0 +1,70 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ScripActions.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::ScripActions - Collection of Action objects
+
+=head1 SYNOPSIS
+
+  use RT::ScripActions;
+
+
+=head1 DESCRIPTION
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::ScripActions);
+
+=end testing
+
+=head1 METHODS
+
+=cut
+
+package RT::ScripActions;
+use RT::EasySearch;
+use RT::ScripAction;
+
+@ISA= qw(RT::EasySearch);
+
+# {{{ sub _Init
+sub _Init { 
+  my $self = shift;
+  $self->{'table'} = "ScripActions";
+  $self->{'primary_key'} = "id";
+  return ( $self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub LimitToType 
+sub LimitToType  {
+  my $self = shift;
+  my $type = shift;
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Type',
+               VALUE => "$type")
+      if defined $type;
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Type',
+               VALUE => "Correspond")
+      if $type eq "Create";
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Type',
+               VALUE => 'any');
+  
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+  return(RT::ScripAction->new($self->CurrentUser));
+
+}
+# }}}
+
+
+1;
+
diff --git a/rt/lib/RT/ScripCondition.pm b/rt/lib/RT/ScripCondition.pm
new file mode 100755 (executable)
index 0000000..253502b
--- /dev/null
@@ -0,0 +1,192 @@
+# Copyright 1999-2000 Jesse Vincent <jesse@fsck.com>
+# Released under the terms of the GNU Public License
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ScripCondition.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::ScripCondition - RT scrip conditional
+
+=head1 SYNOPSIS
+
+  use RT::ScripCondition;
+
+
+=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 other modules.
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::ScripCondition);
+
+=end testing
+
+=head1 METHODS
+
+=cut
+
+package RT::ScripCondition;
+use RT::Record;
+@ISA= qw(RT::Record);
+
+# {{{  sub _Init 
+sub _Init  {
+    my $self = shift; 
+    $self->{'table'} = "ScripConditions";
+    return ($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _Accessible 
+sub _Accessible  {
+    my $self = shift;
+    my %Cols = ( Name  => 'read',
+                Description => 'read',
+                ApplicableTransTypes    => 'read',
+                ExecModule  => 'read',
+                Argument  => 'read',
+                Creator => 'read/auto',
+                Created => 'read/auto',
+                LastUpdatedBy => 'read/auto',
+                LastUpdated => 'read/auto'
+              );
+    return($self->SUPER::_Accessible(@_, %Cols));
+}
+# }}}
+
+# {{{ sub Create 
+
+=head2 Create
+  
+  Takes a hash. Creates a new Condition entry.
+  should be better documented.
+
+=cut
+
+sub Create  {
+    my $self = shift;
+    return($self->SUPER::Create(@_));
+}
+# }}}
+
+# {{{ sub Delete 
+
+=head2 Delete
+
+No API available for deleting things just yet.
+
+=cut
+
+sub Delete  {
+    my $self = shift;
+    return(0,'Unimplemented');
+}
+# }}}
+
+# {{{ sub Load 
+
+=head2 Load IDENTIFIER
+
+Loads a condition takes a name or ScripCondition id.
+
+=cut
+
+sub Load  {
+    my $self = shift;
+    my $identifier = shift;
+    
+    unless (defined $identifier) {
+       return (undef);
+    }      
+    
+    if ($identifier !~ /\D/) {
+       return ($self->SUPER::LoadById($identifier));
+    }
+    else {
+       return ($self->LoadByCol('Name', $identifier));
+    }
+}
+# }}}
+
+# {{{ sub LoadCondition 
+
+=head2 LoadCondition  HASH
+
+takes a hash which has the following elements:  TransactionObj and TicketObj.
+Loads the Condition module in question.
+
+=cut
+
+
+sub LoadCondition  {
+    my $self = shift;
+    my %args = ( TransactionObj => undef,
+                TicketObj => undef,
+                @_ );
+    
+    #TODO: Put this in an eval  
+    $self->ExecModule =~ /^(\w+)$/;
+    my $module = $1;
+    my $type = "RT::Condition::". $module;
+    
+    $RT::Logger->debug("now requiring $type\n"); 
+    eval "require $type" || die "Require of $type failed.\n$@\n";
+    
+    $self->{'Condition'}  = $type->new ( 'ScripConditionObj' => $self, 
+                                        'TicketObj' => $args{'TicketObj'},
+                                        'TransactionObj' => $args{'TransactionObj'},
+                                        'Argument' => $self->Argument,
+                                        'ApplicableTransTypes' => $self->ApplicableTransTypes,
+                                      );
+}
+# }}}
+
+# {{{ The following methods call the Condition object
+
+
+# {{{ sub Describe 
+
+=head2 Describe 
+
+Helper method to call the condition module\'s Describe method.
+
+=cut
+
+sub Describe  {
+    my $self = shift;
+    return ($self->{'Condition'}->Describe());
+    
+}
+# }}}
+
+# {{{ sub IsApplicable 
+
+=head2 IsApplicable
+
+Helper method to call the condition module\'s IsApplicable method.
+
+=cut
+
+sub IsApplicable  {
+    my $self = shift;
+    return ($self->{'Condition'}->IsApplicable());
+    
+}
+# }}}
+
+# }}}
+
+# {{{ sub DESTROY
+sub DESTROY {
+    my $self=shift;
+    $self->{'Condition'} = undef;
+}
+# }}}
+
+
+1;
+
+
diff --git a/rt/lib/RT/ScripConditions.pm b/rt/lib/RT/ScripConditions.pm
new file mode 100755 (executable)
index 0000000..236e671
--- /dev/null
@@ -0,0 +1,69 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ScripConditions.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::ScripConditions - Collection of Action objects
+
+=head1 SYNOPSIS
+
+  use RT::ScripConditions;
+
+
+=head1 DESCRIPTION
+
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::ScripConditions);
+
+=end testing
+
+=head1 METHODS
+
+=cut
+
+package RT::ScripConditions;
+use RT::EasySearch;
+use RT::ScripCondition;
+@ISA= qw(RT::EasySearch);
+
+# {{{ sub _Init
+sub _Init { 
+  my $self = shift;
+  $self->{'table'} = "ScripConditions";
+  $self->{'primary_key'} = "id";
+  return ( $self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub LimitToType 
+sub LimitToType  {
+  my $self = shift;
+  my $type = shift;
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Type',
+               VALUE => "$type")
+      if defined $type;
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Type',
+               VALUE => "Correspond")
+      if $type eq "Create";
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Type',
+               VALUE => 'any');
+  
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+  return(RT::ScripCondition->new($self->CurrentUser));
+}
+# }}}
+
+
+1;
+
diff --git a/rt/lib/RT/Scrips.pm b/rt/lib/RT/Scrips.pm
new file mode 100755 (executable)
index 0000000..90be847
--- /dev/null
@@ -0,0 +1,127 @@
+# Copyright 1999-2001 Jesse Vincent <jesse@fsck.com>
+# Released under the terms of the GNU Public License
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Scrips.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Scrips - a collection of RT Scrip objects
+
+=head1 SYNOPSIS
+
+  use RT::Scrips;
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Scrips);
+
+=end testing
+
+=cut
+
+package RT::Scrips;
+use RT::EasySearch;
+use RT::Scrip;
+@ISA= qw(RT::EasySearch);
+
+
+# {{{ sub _Init
+sub _Init { 
+  my $self = shift;
+  $self->{'table'} = "Scrips";
+  $self->{'primary_key'} = "id";
+  return ( $self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub LimitToQueue 
+
+=head2 LimitToQueue
+
+Takes a queue id (numerical) as its only argument. Makes sure that 
+Scopes it pulls out apply to this queue (or another that you've selected with
+another call to this method
+
+=cut
+
+sub LimitToQueue  {
+   my $self = shift;
+  my $queue = shift;
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Queue',
+               VALUE => "$queue")
+      if defined $queue;
+  
+}
+# }}}
+
+# {{{ sub LimitToGlobal
+
+=head2 LimitToGlobal
+
+Makes sure that 
+Scopes it pulls out apply to all queues (or another that you've selected with
+another call to this method or LimitToQueue
+
+=cut
+
+
+sub LimitToGlobal  {
+   my $self = shift;
+  $self->Limit (ENTRYAGGREGATOR => 'OR',
+               FIELD => 'Queue',
+               VALUE => 0);
+  
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+  
+  return(new RT::Scrip($self->CurrentUser));
+}
+# }}}
+
+# {{{ sub Next 
+
+=head2 Next
+
+Returns the next scrip that this user can see.
+
+=cut
+  
+sub Next {
+    my $self = shift;
+    
+    
+    my $Scrip = $self->SUPER::Next();
+    if ((defined($Scrip)) and (ref($Scrip))) {
+
+       if ($Scrip->CurrentUserHasRight('ShowScrips')) {
+           return($Scrip);
+       }
+       
+       #If the user doesn't have the right to show this scrip
+       else {  
+           return($self->Next());
+       }
+    }
+    #if there never was any scrip
+    else {
+       return(undef);
+    }  
+    
+}
+# }}}
+
+1;
+
diff --git a/rt/lib/RT/Template.pm b/rt/lib/RT/Template.pm
new file mode 100755 (executable)
index 0000000..3ef96c7
--- /dev/null
@@ -0,0 +1,395 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Template.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Copyright 1996-2002 Jesse Vincent <jesse@bestpractical.com>
+# Portions Copyright 2000 Tobias Brox <tobix@cpan.org> 
+# Released under the terms of the GNU General Public License
+
+=head1 NAME
+
+  RT::Template - RT's template object
+
+=head1 SYNOPSIS
+
+  use RT::Template;
+
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::Template);
+
+=end testing
+
+=cut
+
+package RT::Template;
+use RT::Record;
+use MIME::Entity;
+use MIME::Parser;
+
+@ISA = qw(RT::Record);
+
+# {{{ sub _Init
+
+sub _Init {
+    my $self = shift;
+    $self->{'table'} = "Templates";
+    return ( $self->SUPER::_Init(@_) );
+}
+
+# }}}
+
+# {{{ sub _Accessible 
+
+sub _Accessible {
+    my $self = shift;
+    my %Cols = (
+        id            => 'read',
+        Name          => 'read/write',
+        Description   => 'read/write',
+        Type          => 'read/write',    #Type is one of Action or Message
+        Content       => 'read/write',
+        Queue         => 'read/write',
+        Creator       => 'read/auto',
+        Created       => 'read/auto',
+        LastUpdatedBy => 'read/auto',
+        LastUpdated   => 'read/auto'
+    );
+    return $self->SUPER::_Accessible( @_, %Cols );
+}
+
+# }}}
+
+# {{{ sub _Set
+
+sub _Set {
+    my $self = shift;
+
+    # use super::value or we get acl blocked
+    if ( ( defined $self->SUPER::_Value('Queue') )
+        && ( $self->SUPER::_Value('Queue') == 0 ) )
+    {
+        unless ( $self->CurrentUser->HasSystemRight('ModifyTemplate') ) {
+            return ( 0, 'Permission Denied' );
+        }
+    }
+    else {
+
+        unless ( $self->CurrentUserHasQueueRight('ModifyTemplate') ) {
+            return ( 0, 'Permission Denied' );
+        }
+    }
+    return ( $self->SUPER::_Set(@_) );
+
+}
+
+# }}}
+
+# {{{ sub _Value 
+
+=head2 _Value
+
+Takes the name of a table column.
+Returns its value as a string, if the user passes an ACL check
+
+=cut
+
+sub _Value {
+
+    my $self  = shift;
+    my $field = shift;
+
+    #If the current user doesn't have ACLs, don't let em at it.  
+    #use super::value or we get acl blocked
+    if ( ( !defined $self->__Value('Queue') )
+        || ( $self->__Value('Queue') == 0 ) )
+    {
+        unless ( $self->CurrentUser->HasSystemRight('ShowTemplate') ) {
+            return (undef);
+        }
+    }
+    else {
+        unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
+            return (undef);
+        }
+    }
+    return ( $self->__Value($field) );
+
+}
+
+# }}}
+
+# {{{ sub Load
+
+=head2 Load <identifer>
+
+Load a template, either by number or by name
+
+=cut
+
+sub Load {
+    my $self       = shift;
+    my $identifier = shift;
+
+    if ( !$identifier ) {
+        return (undef);
+    }
+
+    if ( $identifier !~ /\D/ ) {
+        $self->SUPER::LoadById($identifier);
+    }
+    else {
+        $self->LoadByCol( 'Name', $identifier );
+
+    }
+}
+
+# }}}
+
+# {{{ sub LoadGlobalTemplate
+
+=head2 LoadGlobalTemplate NAME
+
+Load the global tempalte with the name NAME
+
+=cut
+
+sub LoadGlobalTemplate {
+    my $self = shift;
+    my $id   = shift;
+
+    return ( $self->LoadQueueTemplate( Queue => 0, Name => $id ) );
+}
+
+# }}}
+
+# {{{ sub LoadQueueTemplate
+
+=head2  LoadQueueTemplate (Queue => QUEUEID, Name => NAME)
+
+Loads the Queue template named NAME for Queue QUEUE.
+
+=cut
+
+sub LoadQueueTemplate {
+    my $self = shift;
+    my %args = (
+        Queue => undef,
+        Name  => undef
+    );
+
+    return ( $self->LoadByCols( Name => $args{'Name'}, Queue => {'Queue'} ) );
+
+}
+
+# }}}
+
+# {{{ sub Create
+
+=head2 Create
+
+Takes a paramhash of Content, Queue, Name and Description.
+Name should be a unique string identifying this Template.
+Description and Content should be the template's title and content.
+Queue should be 0 for a global template and the queue # for a queue-specific 
+template.
+
+Returns the Template's id # if the create was successful. Returns undef for
+unknown database failure.
+
+
+=cut
+
+sub Create {
+    my $self = shift;
+    my %args = (
+        Content     => undef,
+        Queue       => 0,
+        Description => '[no description]',
+        Type => 'Action',    #By default, template are 'Action' templates
+        Name => undef,
+        @_
+    );
+
+    if ( $args{'Queue'} == 0 ) {
+        unless ( $self->CurrentUser->HasSystemRight('ModifyTemplate') ) {
+            return (undef);
+        }
+    }
+    else {
+        my $QueueObj = new RT::Queue( $self->CurrentUser );
+        $QueueObj->Load( $args{'Queue'} ) || return ( 0, 'Invalid queue' );
+
+        unless ( $QueueObj->CurrentUserHasRight('ModifyTemplate') ) {
+            return (undef);
+        }
+    }
+
+    my $result = $self->SUPER::Create(
+        Content => $args{'Content'},
+        Queue   => $args{'Queue'},
+        ,
+        Description => $args{'Description'},
+        Name        => $args{'Name'}
+    );
+
+    return ($result);
+
+}
+
+# }}}
+
+# {{{ sub Delete
+
+=head2 Delete
+
+Delete this template.
+
+=cut
+
+sub Delete {
+    my $self = shift;
+
+    unless ( $self->CurrentUserHasRight('ModifyTemplate') ) {
+        return ( 0, 'Permission Denied' );
+    }
+
+    return ( $self->SUPER::Delete(@_) );
+}
+
+# }}}
+
+# {{{ sub MIMEObj
+sub MIMEObj {
+    my $self = shift;
+    return ( $self->{'MIMEObj'} );
+}
+
+# }}}
+
+# {{{ sub Parse 
+
+=item Parse
+
+ This routine performs Text::Template parsing on thte template and then imports the 
+ results into a MIME::Entity so we can really use it
+ It returns a tuple of (val, message)
+ If val is 0, the message contains an error message
+
+=cut
+
+sub Parse {
+    my $self = shift;
+
+    #We're passing in whatever we were passed. it's destined for _ParseContent
+    my $content = $self->_ParseContent(@_);
+
+    #Lets build our mime Entity
+
+    my $parser = MIME::Parser->new();
+    
+    # Do work on the parsed template in memory, rather than on disk
+    $parser->output_to_core(1); 
+
+    ### Should we forgive normally-fatal errors?
+    $parser->ignore_errors(1);
+    $self->{'MIMEObj'} = eval { $parser->parse_data($content) };
+    $error = ( $@ || $parser->last_error );
+
+    if ($error) {
+        $RT::Logger->error("$error");
+        return ( 0, $error );
+    }
+
+    # Unfold all headers
+    $self->{'MIMEObj'}->head->unfold();
+
+    return ( 1, "Template parsed" );
+   
+
+}
+
+# }}}
+
+# {{{ sub _ParseContent
+
+# Perform Template substitutions on the template
+
+sub _ParseContent {
+    my $self = shift;
+    my %args = (
+        Argument       => undef,
+        TicketObj      => undef,
+        TransactionObj => undef,
+        @_
+    );
+
+    # Might be subject to change
+    use Text::Template;
+
+    $T::Ticket      = $args{'TicketObj'};
+    $T::Transaction = $args{'TransactionObj'};
+    $T::Argument    = $args{'Argument'};
+    $T::rtname      = $RT::rtname;
+
+    # We need to untaint the content of the template, since we'll be working
+    # with it
+    my $content = $self->Content();
+    $content =~ s/^(.*)$/$1/;
+    $template = Text::Template->new(
+        TYPE   => STRING,
+        SOURCE => $content
+    );
+
+    my $retval = $template->fill_in( PACKAGE => T );
+    return ($retval);
+}
+
+# }}}
+
+# {{{ sub QueueObj
+
+=head2 QueueObj
+
+Takes nothing. returns this ticket's queue object
+
+=cut
+
+sub QueueObj {
+    my $self = shift;
+    if ( !defined $self->{'queue'} ) {
+        require RT::Queue;
+        $self->{'queue'} = RT::Queue->new( $self->CurrentUser );
+
+        unless ( $self->{'queue'} ) {
+            $RT::Logger->crit(
+                "RT::Queue->new(" . $self->CurrentUser . ") returned false" );
+            return (undef);
+        }
+        my ($result) = $self->{'queue'}->Load( $self->__Value('Queue') );
+
+    }
+    return ( $self->{'queue'} );
+}
+
+# }}}
+
+# {{{ sub CurrentUserHasQueueRight
+
+=head2 CurrentUserHasQueueRight
+
+Helper function to call the template's queue's CurrentUserHasQueueRight with the passed in args.
+
+=cut
+
+sub CurrentUserHasQueueRight {
+    my $self = shift;
+    return ( $self->QueueObj->CurrentUserHasRight(@_) );
+}
+
+# }}}
+1;
diff --git a/rt/lib/RT/Templates.pm b/rt/lib/RT/Templates.pm
new file mode 100755 (executable)
index 0000000..b5b483c
--- /dev/null
@@ -0,0 +1,122 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Templates.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Templates - a collection of RT Template objects
+
+=head1 SYNOPSIS
+
+  use RT::Templates;
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Templates);
+
+=end testing
+
+=cut
+
+package RT::Templates;
+use RT::EasySearch;
+@ISA= qw(RT::EasySearch);
+
+
+# {{{ sub _Init
+
+=head2 _Init
+
+  Returns RT::Templates specific init info like table and primary key names
+
+=cut
+
+sub _Init {
+    
+    my $self = shift;
+    $self->{'table'} = "Templates";
+    $self->{'primary_key'} = "id";
+    return ($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ LimitToNotInQueue
+
+=head2 LimitToNotInQueue
+
+Takes a queue id # and limits the returned set of templates to those which 
+aren't that queue's templates.
+
+=cut
+
+sub LimitToNotInQueue {
+    my $self = shift;
+    my $queue_id = shift;
+    $self->Limit(FIELD => 'Queue',
+                 VALUE => "$queue_id",
+                 OPERATOR => '!='
+                );
+}
+# }}}
+
+# {{{ LimitToGlobal
+
+=head2 LimitToGlobal
+
+Takes no arguments. Limits the returned set to "Global" templates
+which can be used with any queue.
+
+=cut
+
+sub LimitToGlobal {
+    my $self = shift;
+    my $queue_id = shift;
+    $self->Limit(FIELD => 'Queue',
+                 VALUE => "0",
+                 OPERATOR => '='
+                );
+}
+# }}}
+
+# {{{ LimitToQueue
+
+=head2 LimitToQueue
+
+Takes a queue id # and limits the returned set of templates to that queue's
+templates
+
+=cut
+
+sub LimitToQueue {
+    my $self = shift;
+    my $queue_id = shift;
+    $self->Limit(FIELD => 'Queue',
+                 VALUE => "$queue_id",
+                 OPERATOR => '='
+                );
+}
+# }}}
+
+# {{{ sub NewItem 
+
+=head2 NewItem
+
+Returns a new empty Template object
+
+=cut
+
+sub NewItem  {
+  my $self = shift;
+
+  use RT::Template;
+  my $item = new RT::Template($self->CurrentUser);
+  return($item);
+}
+# }}}
+
+1;
+
diff --git a/rt/lib/RT/TestHarness.pm b/rt/lib/RT/TestHarness.pm
new file mode 100644 (file)
index 0000000..160e9e6
--- /dev/null
@@ -0,0 +1,14 @@
+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/Ticket.pm b/rt/lib/RT/Ticket.pm
new file mode 100755 (executable)
index 0000000..f7275e4
--- /dev/null
@@ -0,0 +1,3004 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket.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::Ticket - RT ticket object
+
+=head1 SYNOPSIS
+
+  use RT::Ticket;
+  my $ticket = new RT::Ticket($CurrentUser);
+  $ticket->Load($ticket_id);
+
+=head1 DESCRIPTION
+
+This module lets you manipulate RT\'s ticket object.
+
+
+=head1 METHODS
+
+=cut
+
+
+
+package RT::Ticket;
+use RT::Queue;
+use RT::User;
+use RT::Record;
+use RT::Link;
+use RT::Links;
+use RT::Date;
+use RT::Watcher;
+
+
+@ISA= qw(RT::Record);
+
+
+=begin testing
+
+use RT::TestHarness;
+
+ok(require RT::Ticket, "Loading the RT::Ticket library");
+
+=end testing
+
+=cut
+
+# {{{ sub _Init
+
+sub _Init {
+    my $self = shift;
+    $self->{'table'} = "Tickets";
+    return ($self->SUPER::_Init(@_));
+}
+
+# }}}
+
+# {{{ sub Load
+
+=head2 Load
+
+Takes a single argument. This can be a ticket id, ticket alias or 
+local ticket uri.  If the ticket can't be loaded, returns undef.
+Otherwise, returns the ticket id.
+
+=cut
+
+sub Load {
+   my $self = shift;
+   my $id = shift;
+
+   #TODO modify this routine to look at EffectiveId and do the recursive load
+   # thing. be careful to cache all the interim tickets we try so we don't loop forever.
+   
+   #If it's a local URI, turn it into a ticket id
+   if ($id =~ /^$RT::TicketBaseURI(\d+)$/)  {
+       $id = $1;
+   }
+   #If it's a remote URI, we're going to punt for now
+   elsif ($id =~ '://' ) {
+       return (undef);
+   }
+   
+   #If we have an integer URI, load the ticket
+   if ( $id =~ /^\d+$/ ) {
+       my $ticketid = $self->LoadById($id);
+   
+       unless ($ticketid) {
+          $RT::Logger->debug("$self tried to load a bogus ticket: $id\n");
+          return(undef);
+       }
+   }
+   
+   #It's not a URI. It's not a numerical ticket ID. Punt!
+   else {
+       return(undef);
+   }
+   
+   #If we're merged, resolve the merge.
+   if (($self->EffectiveId) and
+       ($self->EffectiveId != $self->Id)) {
+          return ($self->Load($self->EffectiveId));
+       }
+
+   #Ok. we're loaded. lets get outa here.
+   return ($self->Id);
+   
+}
+
+# }}}
+
+# {{{ sub LoadByURI
+
+=head2 LoadByURI
+
+Given a local ticket URI, loads the specified ticket.
+
+=cut
+
+sub LoadByURI {
+    my $self = shift;
+    my $uri = shift;
+    
+    if ($uri =~ /^$RT::TicketBaseURI(\d+)$/) {
+        my $id = $1;
+        return ($self->Load($id));
+    }
+    else {
+        return(undef);
+    }
+}
+
+# }}}
+
+# {{{ sub Create
+
+=head2 Create (ARGS)
+
+Arguments: ARGS is a hash of named parameters.  Valid parameters are:
+
+  Queue  - Either a Queue object or a Queue Name
+  Requestor -  A reference to a list of RT::User objects, email addresses or RT user Names
+  Cc  - A reference to a list of RT::User objects, email addresses or Names
+  AdminCc  - A reference to a  list of RT::User objects, email addresses or Names
+  Type -- The ticket\'s type. ignore this for now
+  Owner -- This ticket\'s owner. either an RT::User object or this user\'s id
+  Subject -- A string describing the subject of the ticket
+  InitialPriority -- an integer from 0 to 99
+  FinalPriority -- an integer from 0 to 99
+  Status -- any valid status (Defined in RT::Queue)
+  TimeWorked -- an integer
+  TimeLeft -- an integer
+  Starts -- an ISO date describing the ticket\'s start date and time in GMT
+  Due -- an ISO date describing the ticket\'s due date and time in GMT
+  MIMEObj -- a MIME::Entity object with the content of the initial ticket request.
+
+  KeywordSelect-<id> -- an array of keyword ids for that keyword select
+
+
+Returns: TICKETID, Transaction Object, Error Message
+
+
+=begin testing
+
+my $t = RT::Ticket->new($RT::SystemUser);
+
+ok( $t->Create(Queue => 'General', Subject => 'This is a subject'), "Ticket Created");
+
+ok ( my $id = $t->Id, "Got ticket id");
+
+=end testing
+
+=cut
+
+sub Create {
+    my $self = shift;
+    
+    my %args = (
+               Queue => undef,
+               Requestor => undef,
+               Cc => undef,
+               AdminCc => undef,
+               Type => 'ticket',
+               Owner => $RT::Nobody->UserObj,
+               Subject => '[no subject]',
+               InitialPriority => undef,
+               FinalPriority => undef,
+               Status => 'new',
+               TimeWorked => "0",
+               TimeLeft => 0,
+               Due => undef,
+               Starts => undef,
+               MIMEObj => undef,
+               @_);
+
+    my ($ErrStr, $QueueObj, $Owner, $resolved);
+    my (@non_fatal_errors);
+    
+    my $now = RT::Date->new($self->CurrentUser);
+    $now->SetToNow();
+
+    if ( (defined($args{'Queue'})) && (!ref($args{'Queue'})) ) {
+       $QueueObj=RT::Queue->new($RT::SystemUser);
+       $QueueObj->Load($args{'Queue'});
+    }
+    elsif (ref($args{'Queue'}) eq 'RT::Queue') {
+       $QueueObj=RT::Queue->new($RT::SystemUser);
+       $QueueObj->Load($args{'Queue'}->Id);
+    }
+    else {
+       $RT::Logger->debug("$self ". $args{'Queue'} . 
+                        " not a recognised queue object.");
+    }
+  
+    #Can't create a ticket without a queue.
+    unless (defined ($QueueObj)) {
+       $RT::Logger->debug( "$self No queue given for ticket creation.");
+       return (0, 0,'Could not create ticket. Queue not set');
+    }
+    
+    #Now that we have a queue, Check the ACLS
+    unless ($self->CurrentUser->HasQueueRight(Right => 'CreateTicket',
+                                             QueueObj => $QueueObj )) {
+       return (0,0,"No permission to create tickets in the queue '". 
+               $QueueObj->Name."'.");
+    }
+    
+    #Since we have a queue, we can set queue defaults
+    #Initial Priority
+
+    # If there's no queue default initial priority and it's not set, set it to 0
+    $args{'InitialPriority'} = ($QueueObj->InitialPriority || 0)
+      unless (defined $args{'InitialPriority'});
+       
+    #Final priority 
+
+    # If there's no queue default final priority and it's not set, set it to 0
+    $args{'FinalPriority'} = ($QueueObj->FinalPriority  || 0)
+      unless (defined $args{'FinalPriority'});
+    
+    
+    #TODO we should see what sort of due date we're getting, rather +
+    # than assuming it's in ISO format.
+    
+    #Set the due date. if we didn't get fed one, use the queue default due in
+    my $due = new RT::Date($self->CurrentUser);
+    if (defined $args{'Due'}) {
+       $due->Set (Format => 'ISO',
+                  Value => $args{'Due'});
+    }  
+    elsif (defined ($QueueObj->DefaultDueIn)) {
+       $due->SetToNow;
+       $due->AddDays($QueueObj->DefaultDueIn);
+    }  
+    
+    my $starts = new RT::Date($self->CurrentUser);
+    if (defined $args{'Starts'}) {
+       $starts->Set (Format => 'ISO',
+                  Value => $args{'Starts'});
+    }
+
+       
+    # {{{ Deal with setting the owner
+    
+    if (ref($args{'Owner'}) eq 'RT::User') {
+       $Owner = $args{'Owner'};
+    }
+    #If we've been handed something else, try to load the user.
+    elsif ($args{'Owner'}) {
+       $Owner = new RT::User($self->CurrentUser);
+       $Owner->Load($args{'Owner'});
+       
+    }
+    #If we can't handle it, call it nobody
+    else {
+       if (ref($args{'Owner'})) {
+           $RT::Logger->warning("$ticket ->Create called with an Owner of ".
+                "type ".ref($args{'Owner'}) .". Defaulting to nobody.\n");
+
+           push @non_fatal_errors, "Invalid owner. Defaulting to 'nobody'.";
+       }
+       else { 
+           $RT::Logger->warning("$self ->Create called with an ".
+                                "unknown datatype for Owner: ".$args{'Owner'} .
+                                ". Defaulting to Nobody.\n");
+       }
+    }
+    
+    #If we have a proposed owner and they don't have the right 
+    #to own a ticket, scream about it and make them not the owner
+    if ((defined ($Owner)) and
+       ($Owner->Id != $RT::Nobody->Id) and 
+       (!$Owner->HasQueueRight( QueueObj => $QueueObj, 
+                                Right => 'OwnTicket'))) {
+       
+       $RT::Logger->warning("$self user ".$Owner->Name . "(".$Owner->id .
+                            ") was proposed ".
+                            "as a ticket owner but has no rights to own ".
+                            "tickets in this queue\n");
+
+       push @non_fatal_errors, "Invalid owner. Defaulting to 'nobody'.";
+
+       $Owner = undef;
+    }
+    
+    #If we haven't been handed a valid owner, make it nobody.
+    unless (defined ($Owner)) {
+       $Owner = new RT::User($self->CurrentUser);
+       $Owner->Load($RT::Nobody->UserObj->Id);
+    }  
+
+    # }}}
+
+    unless ($self->ValidateStatus($args{'Status'})) {
+       return (0,0,'Invalid value for status');
+    }
+
+    if ($args{'Status'} eq 'resolved') {
+       $resolved = $now->ISO;
+    } else{
+       $resolved = undef;
+    }
+
+    my $id = $self->SUPER::Create(
+                                 Queue => $QueueObj->Id,
+                                 Owner => $Owner->Id,
+                                 Subject => $args{'Subject'},
+                                 InitialPriority => $args{'InitialPriority'},
+                                 FinalPriority => $args{'FinalPriority'},
+                                 Priority => $args{'InitialPriority'},
+                                 Status => $args{'Status'},
+                                 TimeWorked => $args{'TimeWorked'},
+                                 TimeLeft => $args{'TimeLeft'},
+                                 Type => $args{'Type'},        
+                                 Starts => $starts->ISO,
+                                 Resolved => $resolved,
+                                 Due => $due->ISO
+                                );
+    #Set the ticket's effective ID now that we've created it.
+    my ($val, $msg) = $self->__Set(Field => 'EffectiveId', Value => $id);
+    
+    unless ($val) {
+       $RT::Logger->err("$self ->Create couldn't set EffectiveId: $msg\n");
+    }  
+     
+
+    my $watcher;
+    foreach $watcher (@{$args{'Cc'}}) {
+       my ($wval, $wmsg) = 
+         $self->_AddWatcher( Type => 'Cc', Person => $watcher, Silent => 1);
+       push @non_fatal_errors, $wmsg   unless ($wval);
+    }  
+
+    foreach $watcher (@{$args{'Requestor'}}) {
+       my ($wval, $wmsg) = 
+         $self->_AddWatcher( Type => 'Requestor', Person => $watcher, Silent => 1);
+       push @non_fatal_errors, $wmsg   unless ($wval);
+    }
+
+    foreach $watcher (@{$args{'AdminCc'}}) {
+       # Note that we're using AddWatcher, rather than _AddWatcher, as we 
+       # actually _want_ that ACL check. Otherwise, random ticket creators
+       # could make themselves adminccs and maybe get ticket rights. that would
+       # be poor
+       my ($wval, $wmsg) = 
+         $self->AddWatcher( Type => 'AdminCc', Person => $watcher, Silent => 1);
+       push @non_fatal_errors, $wmsg   unless ($wval);
+    }
+
+    # Iterate through all the KeywordSelect-<int> params passed in, calling _AddKeyword
+    # for each of them
+
+
+    foreach my $key (keys %args) {
+
+       next unless ($key =~ /^KeywordSelect-(.*)$/);
+       
+       my $ks = $1;
+
+
+       my @keywords = ref($args{$key}) eq 'ARRAY' ?
+             @{$args{$key}} : ($args{$key});
+       
+       foreach my $keyword (@keywords) {  
+           my ($kval, $kmsg) = $self->_AddKeyword(KeywordSelect => $ks,
+                                                  Keyword => $keyword,
+                                                  Silent => 1);
+       }       
+       push @non_fatal_errors, $kmsg unless ($kval);
+    }
+
+    
+    
+    #Add a transaction for the create
+    my ($Trans, $Msg, $TransObj) = 
+       $self->_NewTransaction( Type => "Create",
+                               TimeTaken => 0, 
+                               MIMEObj=>$args{'MIMEObj'});
+    
+    # Logging
+    if ($self->Id && $Trans) {
+       $ErrStr = "Ticket ".$self->Id . " created in queue '". $QueueObj->Name. 
+         "'.\n" . join("\n", @non_fatal_errors);
+       
+       $RT::Logger->info($ErrStr);
+    }
+    else {
+       # TODO where does this get errstr from?
+       $RT::Logger->warning("Ticket couldn't be created: $ErrStr");
+    }
+    
+    return($self->Id, $TransObj->Id, $ErrStr);
+}
+
+# }}}
+
+# {{{ sub Import
+
+=head2 Import PARAMHASH
+
+Import a ticket. 
+Doesn\'t create a transaction. 
+Doesn\'t supply queue defaults, etc.
+
+Arguments are identical to Create(), with the addition of
+    Id -    Ticket Id
+
+Returns: TICKETID
+
+=cut
+
+
+sub Import {
+    my $self = shift;
+    my ( $ErrStr, $QueueObj, $Owner);
+    
+    my %args = (id => undef,
+               EffectiveId => undef,
+               Queue => undef,
+               Requestor => undef,
+               Type => 'ticket',
+               Owner => $RT::Nobody->Id,
+               Subject => '[no subject]',
+               InitialPriority => undef,
+               FinalPriority => undef,
+               Status => 'new',
+               TimeWorked => "0",
+               Due => undef,
+               Created => undef,
+               Updated => undef,
+       Resolved => undef,
+               Told => undef,
+               @_);
+    
+    if ( (defined($args{'Queue'})) && (!ref($args{'Queue'})) ) {
+       $QueueObj=RT::Queue->new($RT::SystemUser);
+       $QueueObj->Load($args{'Queue'});
+       #TODO error check this and return 0 if it\'s not loading properly +++
+    }
+    elsif (ref($args{'Queue'}) eq 'RT::Queue') {
+       $QueueObj=RT::Queue->new($RT::SystemUser);
+       $QueueObj->Load($args{'Queue'}->Id);
+    }
+    else {
+       $RT::Logger->debug("$self ". $args{'Queue'} . 
+                          " not a recognised queue object.");
+    }
+    
+    #Can't create a ticket without a queue.
+    unless (defined ($QueueObj) and $QueueObj->Id) {
+       $RT::Logger->debug( "$self No queue given for ticket creation.");
+       return (0,'Could not create ticket. Queue not set');
+    }
+    
+    #Now that we have a queue, Check the ACLS
+    unless ($self->CurrentUser->HasQueueRight(Right => 'CreateTicket',
+                                             QueueObj => $QueueObj )) {
+       return (0,"No permission to create tickets in the queue '". 
+               $QueueObj->Name."'.");
+    }
+    
+    
+
+
+    # {{{ Deal with setting the owner
+      
+    # Attempt to take user object, user name or user id.
+    # Assign to nobody if lookup fails.
+    if (defined ($args{'Owner'})) { 
+       if ( ref($args{'Owner'}) ) {
+           $Owner = $args{'Owner'};
+       }
+       else {
+           $Owner = new RT::User($self->CurrentUser);
+           $Owner->Load($args{'Owner'});
+           if ( ! defined($Owner->id) ) {
+               $Owner->Load($RT::Nobody->id);
+           }
+       }
+    }
+    
+
+    #If we have a proposed owner and they don't have the right 
+    #to own a ticket, scream about it and make them not the owner
+    if ((defined ($Owner)) and
+       ($Owner->Id != $RT::Nobody->Id) and 
+       (!$Owner->HasQueueRight( QueueObj => $QueueObj, 
+                                Right => 'OwnTicket'))) {
+       
+       $RT::Logger->warning("$self user ".$Owner->Name . "(".$Owner->id .
+                            ") was proposed ".
+                            "as a ticket owner but has no rights to own ".
+                            "tickets in '".$QueueObj->Name."'\n");
+       
+       $Owner = undef;
+    }
+    
+    #If we haven't been handed a valid owner, make it nobody.
+    unless (defined ($Owner)) {
+       $Owner = new RT::User($self->CurrentUser);
+       $Owner->Load($RT::Nobody->UserObj->Id);
+    }  
+
+    # }}}
+
+    unless ($self->ValidateStatus($args{'Status'})) {
+       return (0,"'$args{'Status'}' is an invalid value for status");
+    }
+    
+    $self->{'_AccessibleCache'}{Created} = { 'read'=>1, 'write'=>1 };
+    $self->{'_AccessibleCache'}{Creator} = { 'read'=>1, 'auto'=>1 };
+    $self->{'_AccessibleCache'}{LastUpdated} = { 'read'=>1, 'write'=>1 };
+    $self->{'_AccessibleCache'}{LastUpdatedBy} = { 'read'=>1, 'auto'=>1 };
+
+
+    # If we're coming in with an id, set that now.
+    my $EffectiveId = undef;
+    if ($args{'id'}) {
+       $EffectiveId = $args{'id'};
+
+    }
+
+
+    my $id = $self->SUPER::Create(
+                                 id => $args{'id'},
+                                 EffectiveId => $EffectiveId,
+                                 Queue => $QueueObj->Id,
+                                 Owner => $Owner->Id,
+                                 Subject => $args{'Subject'},
+                                 InitialPriority => $args{'InitialPriority'},
+                                 FinalPriority => $args{'FinalPriority'},
+                                 Priority => $args{'InitialPriority'},
+                                 Status => $args{'Status'},
+                                 TimeWorked => $args{'TimeWorked'},
+                                 Type => $args{'Type'},        
+                                 Created => $args{'Created'},
+                                 Told => $args{'Told'},
+                                 LastUpdated => $args{'Updated'},
+       Resolved => $args{Resolved},
+                                 Due => $args{'Due'},
+                                );
+
+
+
+    # If the ticket didn't have an id
+    # Set the ticket's effective ID now that we've created it.
+    if ($args{'id'} ) { 
+         $self->Load($args{'id'});
+    }
+    else {
+          my ($val, $msg) = $self->__Set(Field => 'EffectiveId', Value => $id);
+    
+          unless ($val) {
+           $RT::Logger->err($self."->Import couldn't set EffectiveId: $msg\n");
+          }    
+    } 
+
+    my $watcher;
+    foreach $watcher (@{$args{'Cc'}}) {
+       $self->_AddWatcher( Type => 'Cc', Person => $watcher, Silent => 1);
+    }  
+    foreach $watcher (@{$args{'AdminCc'}}) {
+       $self->_AddWatcher( Type => 'AdminCc', Person => $watcher, Silent => 1);
+    }  
+    foreach $watcher (@{$args{'Requestor'}}) {
+       $self->_AddWatcher( Type => 'Requestor', Person => $watcher, Silent => 1);
+    }
+    
+    return($self->Id, $ErrStr);
+}
+
+# }}}
+
+# {{{ sub Delete
+
+sub Delete {
+    my $self = shift;
+    return (0, 'Deleting this object would violate referential integrity.'.
+           ' That\'s bad.');
+}
+# }}}
+
+# {{{ Routines dealing with watchers.
+
+# {{{ Routines dealing with adding new watchers
+
+# {{{ sub AddWatcher
+
+=head2 AddWatcher
+
+AddWatcher takes a parameter hash. The keys are as follows:
+
+Email
+Type
+Owner
+
+If the watcher you\'re trying to set has an RT account, set the Owner paremeter to their User Id. Otherwise, set the Email parameter to their Email address.
+
+=cut
+
+sub AddWatcher {
+    my $self = shift;
+    my %args = ( Email => undef,
+                Type => undef,
+                Owner => undef,
+                @_
+              );
+
+    # {{{ Check ACLS
+    #If the watcher we're trying to add is for the current user
+    if ( ( $self->CurrentUser->EmailAddress &&
+           ($args{'Email'} eq $self->CurrentUser->EmailAddress) ) or
+           ($args{'Owner'} eq $self->CurrentUser->Id) 
+        ) {
+
+       
+       #  If it's an AdminCc and they don't have 
+       #   'WatchAsAdminCc' or 'ModifyTicket', bail
+       if ($args{'Type'} eq 'AdminCc') {
+           unless ($self->CurrentUserHasRight('ModifyTicket') or 
+                   $self->CurrentUserHasRight('WatchAsAdminCc')) {
+               return(0, 'Permission Denied');
+           }
+       }
+
+       #  If it's a Requestor or Cc and they don't have
+       #   'Watch' or 'ModifyTicket', bail
+       elsif (($args{'Type'} eq 'Cc') or 
+              ($args{'Type'} eq 'Requestor')) {
+                  
+           unless ($self->CurrentUserHasRight('ModifyTicket') or 
+                   $self->CurrentUserHasRight('Watch')) {
+               return(0, 'Permission Denied');
+           }
+       }
+       else {
+           $RT::Logger->warn("$self -> AddWatcher hit code".
+                             " it never should. We got passed ".
+                             " a type of ". $args{'Type'});
+           return (0,'Error in parameters to TicketAddWatcher');
+       }
+    }
+    # If the watcher isn't the current user 
+    # and the current user  doesn't have 'ModifyTicket'
+    # bail
+    else {
+       unless ($self->CurrentUserHasRight('ModifyTicket')) {
+           return (0, "Permission Denied");
+       }
+    }
+    # }}}
+
+    return ($self->_AddWatcher(%args));
+}
+
+
+#This contains the meat of AddWatcher. but can be called from a routine like
+# Create, which doesn't need the additional acl check
+sub _AddWatcher {
+    my $self = shift;
+    my %args = (
+               Type => undef,
+               Silent => undef,
+               Email => undef,
+               Owner => 0,
+               Person => undef,
+               @_ );
+    
+    
+    
+    #clear the watchers cache
+    $self->{'watchers_cache'} = undef;
+    
+    if (defined $args{'Person'}) {
+       #if it's an RT::User object, pull out the id and shove it in Owner
+       if (ref ($args{'Person'}) =~ /RT::User/) {
+           $args{'Owner'} = $args{'Person'}->id;
+       }       
+       #if it's an int, shove it in Owner
+       elsif ($args{'Person'} =~ /^\d+$/) {
+           $args{'Owner'} = $args{'Person'};
+       }
+       #if it's an email address, shove it in Email
+       else {
+          $args{'Email'} = $args{'Person'};
+       }       
+    }  
+
+    # Turn an email address int a watcher if we possibly can.
+    if ($args{'Email'}) {
+       my $watcher = new RT::User($self->CurrentUser);
+       $watcher->LoadByEmail($args{'Email'});
+       if ($watcher->Id) {
+               $args{'Owner'} = $watcher->Id;
+               delete $args{'Email'};
+       }
+    }
+
+
+    # see if this user is already a watcher. if we have an owner, check it
+    # otherwise, we've got an email-address watcher. use that.
+
+    if ($self->IsWatcher(Type => $args{'Type'},
+                         Id => ($args{'Owner'} || $args{'Email'}) ) ) {
+
+
+        return(0, 'That user is already that sort of watcher for this ticket');
+    }
+
+    
+    require RT::Watcher;
+    my $Watcher = new RT::Watcher ($self->CurrentUser);
+    my ($retval, $msg) = ($Watcher->Create( Value => $self->Id,
+                                           Scope => 'Ticket',
+                                           Email => $args{'Email'},
+                                           Type => $args{'Type'},
+                                           Owner => $args{'Owner'},
+                                         ));
+    
+    unless ($args{'Silent'}) {
+       $self->_NewTransaction( Type => 'AddWatcher',
+                               NewValue => $Watcher->Email,
+                               Field => $Watcher->Type);
+    }
+    
+    return ($retval, $msg);
+}
+
+# }}}
+
+# {{{ sub AddRequestor
+
+=head2 AddRequestor
+
+AddRequestor takes what AddWatcher does, except it presets
+the "Type" parameter to \'Requestor\'
+
+=cut
+
+sub AddRequestor {
+   my $self = shift;
+   return ($self->AddWatcher ( Type => 'Requestor', @_));
+}
+
+# }}}
+
+# {{{ sub AddCc
+
+=head2 AddCc
+
+AddCc takes what AddWatcher does, except it presets
+the "Type" parameter to \'Cc\'
+
+=cut
+
+sub AddCc {
+   my $self = shift;
+   return ($self->AddWatcher ( Type => 'Cc', @_));
+}
+# }}}
+       
+# {{{ sub AddAdminCc
+
+=head2 AddAdminCc
+
+AddAdminCc takes what AddWatcher does, except it presets
+the "Type" parameter to \'AdminCc\'
+
+=cut
+
+sub AddAdminCc {
+   my $self = shift;
+   return ($self->AddWatcher ( Type => 'AdminCc', @_));
+}
+
+# }}}
+
+# }}}
+
+# {{{ sub DeleteWatcher
+
+=head2 DeleteWatcher id [type]
+
+DeleteWatcher takes a single argument which is either an email address 
+or a watcher id.  
+If the first argument is an email address, you need to specify the watcher type you're talking
+about as the second argument. Valid values are 'Requestor', 'Cc' or 'AdminCc'.
+It removes that watcher from this Ticket\'s list of watchers.
+
+
+=cut
+
+#TODO It is lame that you can't call this the same way you can call AddWatcher
+
+sub DeleteWatcher {
+    my $self = shift;
+    my $id = shift;
+
+    my $type;
+    
+    $type = shift if (@_);
+    
+    my $Watcher = new RT::Watcher($self->CurrentUser);
+    
+    #If it\'s a numeric watcherid
+    if ($id =~ /^(\d*)$/) {
+       $Watcher->Load($id);
+    }
+    
+    #Otherwise, we'll assume it's an email address
+    elsif ($type) {
+       my ($result, $msg) = 
+         $Watcher->LoadByValue( Email => $id,
+                                Scope => 'Ticket',
+                                Value => $self->id,
+                                Type => $type);
+       return (0,$msg) unless ($result);
+    }
+    
+    else {
+       return(0,"Can\'t delete a watcher by email address without specifying a type");
+    }
+    
+    # {{{ Check ACLS 
+
+    #If the watcher we're trying to delete is for the current user
+    if ($Watcher->Email eq $self->CurrentUser->EmailAddress) {
+               
+       #  If it's an AdminCc and they don't have 
+       #   'WatchAsAdminCc' or 'ModifyTicket', bail
+       if ($Watcher->Type eq 'AdminCc') {
+           unless ($self->CurrentUserHasRight('ModifyTicket') or 
+                   $self->CurrentUserHasRight('WatchAsAdminCc')) {
+               return(0, 'Permission Denied');
+           }
+       }
+
+       #  If it's a Requestor or Cc and they don't have
+       #   'Watch' or 'ModifyTicket', bail
+       elsif (($Watcher->Type eq 'Cc') or 
+              ($Watcher->Type eq 'Requestor')) {
+                  
+           unless ($self->CurrentUserHasRight('ModifyTicket') or 
+                   $self->CurrentUserHasRight('Watch')) {
+               return(0, 'Permission Denied');
+           }
+       }
+       else {
+           $RT::Logger->warn("$self -> DeleteWatcher hit code".
+                             " it never should. We got passed ".
+                             " a type of ". $args{'Type'});
+           return (0,'Error in parameters to $self DeleteWatcher');
+       }
+    }
+    # If the watcher isn't the current user 
+    # and the current user  doesn't have 'ModifyTicket'
+    # bail
+    else {
+       unless ($self->CurrentUserHasRight('ModifyTicket')) {
+           return (0, "Permission Denied");
+       }
+    }  
+    
+    # }}}
+    
+    unless (($Watcher->Scope eq 'Ticket') and
+           ($Watcher->Value == $self->id) ) {
+       return (0, "Not a watcher for this ticket");
+    }
+
+
+    #Clear out the watchers hash.
+    $self->{'watchers'} = undef;
+    
+    #If we\'ve validated that it is a watcher for this ticket 
+    $self->_NewTransaction ( Type => 'DelWatcher',        
+                            OldValue => $Watcher->Email,
+                            Field => $Watcher->Type,
+                          );
+    
+    my $retval = $Watcher->Delete();
+    
+    unless ($retval) {
+       return(0,"Watcher could not be deleted. Database inconsistency possible.");
+    }
+    
+    return(1, "Watcher deleted");
+}
+
+# {{{ sub DeleteRequestor
+
+=head2 DeleteRequestor EMAIL
+
+Takes an email address. It calls DeleteWatcher with a preset 
+type of 'Requestor'
+
+
+=cut
+
+sub DeleteRequestor {
+   my $self = shift;
+   my $id = shift;
+   return ($self->DeleteWatcher ($id, 'Requestor'))
+}
+
+# }}}
+
+# {{{ sub DeleteCc
+
+=head2 DeleteCc EMAIL
+
+Takes an email address. It calls DeleteWatcher with a preset 
+type of 'Cc'
+
+
+=cut
+
+sub DeleteCc {
+   my $self = shift;
+   my $id = shift;
+   return ($self->DeleteWatcher ($id, 'Cc'))
+}
+
+# }}}
+
+# {{{ sub DeleteAdminCc
+
+=head2 DeleteAdminCc EMAIL
+
+Takes an email address. It calls DeleteWatcher with a preset 
+type of 'AdminCc'
+
+
+=cut
+
+sub DeleteAdminCc {
+   my $self = shift;
+   my $id = shift;
+   return ($self->DeleteWatcher ($id, 'AdminCc'))
+}
+
+# }}}
+
+
+# }}}
+
+# {{{ sub Watchers
+
+=head2 Watchers
+
+Watchers returns a Watchers object preloaded with this ticket\'s watchers.
+
+# It should return only the ticket watchers. the actual FooAsString
+# methods capture the queue watchers too. I don't feel thrilled about this,
+# but we don't want the Cc Requestors and AdminCc objects to get filled up
+# with all the queue watchers too. we've got seperate objects for that.
+  # should we rename these as s/(.*)AsString/$1Addresses/ or somesuch?
+
+=cut
+
+sub Watchers {
+  my $self = shift;
+  
+  require RT::Watchers;
+  my $watchers=RT::Watchers->new($self->CurrentUser);
+  if ($self->CurrentUserHasRight('ShowTicket')) {
+      $watchers->LimitToTicket($self->id);
+  }
+  
+  return($watchers);
+  
+}
+
+# }}}
+
+# {{{ a set of  [foo]AsString subs that will return the various sorts of watchers for a ticket/queue as a comma delineated string
+
+=head2 RequestorsAsString
+
+ B<Returns> String: All Ticket Requestor email addresses as a string.
+
+=cut
+
+sub RequestorsAsString {
+    my $self=shift;
+
+    unless ($self->CurrentUserHasRight('ShowTicket')) {
+        return undef;
+    }
+    
+    return ($self->Requestors->EmailsAsString() );
+}
+
+=head2 WatchersAsString
+
+B<Returns> String: All Ticket Watchers email addresses as a string
+
+=cut
+
+sub WatchersAsString {
+    my $self=shift;
+
+    unless ($self->CurrentUserHasRight('ShowTicket')) {
+       return (0, "Permission Denied");
+    }
+    
+    return ($self->Watchers->EmailsAsString());
+
+}
+
+=head2 AdminCcAsString
+
+returns String: All Ticket AdminCc email addresses as a string
+
+=cut
+
+
+sub AdminCcAsString {
+    my $self=shift;
+
+    unless ($self->CurrentUserHasRight('ShowTicket')) {
+       return undef;
+    }
+    
+    return ($self->AdminCc->EmailsAsString());
+    
+}
+
+=head2 CcAsString
+
+returns String: All Ticket Ccs as a string of email addresses
+
+=cut
+
+sub CcAsString {
+    my $self=shift;
+
+    unless ($self->CurrentUserHasRight('ShowTicket')) {
+        return undef; 
+    }
+    
+    return ($self->Cc->EmailsAsString());
+
+}
+
+# }}}
+
+# {{{ Routines that return RT::Watchers objects of Requestors, Ccs and AdminCcs
+
+# {{{ sub Requestors
+
+=head2 Requestors
+
+Takes nothing.
+Returns this ticket's Requestors as an RT::Watchers object
+
+=cut
+
+sub Requestors {
+    my $self = shift;
+    
+    my $requestors = $self->Watchers();
+    if ($self->CurrentUserHasRight('ShowTicket')) {
+       $requestors->LimitToRequestors();
+    }  
+    
+    return($requestors);
+    
+}
+
+# }}}
+
+# {{{ sub Cc
+
+=head2 Cc
+
+Takes nothing.
+Returns a watchers object which contains this ticket's Cc watchers
+
+=cut
+
+sub Cc {
+    my $self = shift;
+    
+    my $cc = $self->Watchers();
+    
+    if ($self->CurrentUserHasRight('ShowTicket')) {
+       $cc->LimitToCc();
+    }
+    
+    return($cc);
+    
+}
+
+# }}}
+
+# {{{ sub AdminCc
+
+=head2 AdminCc
+
+Takes nothing.
+Returns this ticket\'s administrative Ccs as an RT::Watchers object
+
+=cut
+
+sub AdminCc {
+    my $self = shift;
+    
+    my $admincc = $self->Watchers();
+    if ($self->CurrentUserHasRight('ShowTicket')) {
+       $admincc->LimitToAdminCc();
+    }
+    return($admincc);
+}
+
+# }}}
+
+# }}}
+
+# {{{ IsWatcher,IsRequestor,IsCc, IsAdminCc
+
+# {{{ sub IsWatcher
+# a generic routine to be called by IsRequestor, IsCc and IsAdminCc
+
+=head2 IsWatcher
+
+Takes a param hash with the attributes Type and User. User is either a user object or string containing an email address. Returns true if that user or string
+is a ticket watcher. Returns undef otherwise
+
+=cut
+
+sub IsWatcher {
+    my $self = shift;
+
+    my %args = ( Type => 'Requestor',
+                Email => undef,
+                Id => undef,
+                @_
+              );
+    
+    my %cols = ('Type' => $args{'Type'},
+               'Scope' => 'Ticket',
+               'Value' => $self->Id,
+               'Owner' => undef,
+               'Email' => undef
+              );
+    
+    if (ref($args{'Id'})){ 
+       #If it's a ref, it's an RT::User object;
+       $cols{'Owner'} = $args{'Id'}->Id;
+    }
+    elsif ($args{'Id'} =~ /^\d+$/) { 
+       # if it's an integer, it's a reference to an RT::User obj
+       $cols{'Owner'} = $args{'Id'};
+    }
+    else {
+       $cols{'Email'} = $args{'Id'};
+    }  
+    
+    if ($args{'Email'}) {
+       $cols{'Email'} = $args{'Email'};
+    }
+
+    my $description = join(":",%cols);
+    
+    #If we've cached a positive match...
+    if (defined $self->{'watchers_cache'}->{"$description"}) {
+       if ($self->{'watchers_cache'}->{"$description"} == 1) {
+           return(1);
+       }
+       else { #If we've cached a negative match...
+           return(undef);
+       }
+    }
+    
+    
+    my $watcher = new RT::Watcher($self->CurrentUser);
+    $watcher->LoadByCols(%cols);
+    
+    
+    if ($watcher->id) {
+       $self->{'watchers_cache'}->{"$description"} = 1;
+       return(1);
+    }  
+    else {
+       $self->{'watchers_cache'}->{"$description"} = 0;
+       return(undef);
+    }
+    
+}
+# }}}
+
+# {{{ sub IsRequestor
+
+=head2 IsRequestor
+  
+  Takes an email address, RT::User object or integer (RT user id)
+  Returns true if the string is a requestor of the current ticket.
+
+
+=cut
+
+sub IsRequestor {
+    my $self = shift;
+    my $person = shift;
+
+    return ($self->IsWatcher(Type => 'Requestor', Id => $person));
+           
+};
+
+# }}}
+
+# {{{ sub IsCc
+
+=head2 IsCc
+
+Takes a string. Returns true if the string is a Cc watcher of the current ticket.
+
+=cut
+
+sub IsCc {
+  my $self = shift;
+  my $cc = shift;
+  
+  return ($self->IsWatcher( Type => 'Cc', Id => $cc ));
+  
+}
+
+# }}}
+
+# {{{ sub IsAdminCc
+
+=head2 IsAdminCc
+
+Takes a string. Returns true if the string is an AdminCc watcher of the current ticket.
+
+=cut
+
+sub IsAdminCc {
+  my $self = shift;
+  my $person = shift;
+  
+  return ($self->IsWatcher( Type => 'AdminCc', Id => $person ));
+  
+}
+
+# }}}
+
+# {{{ sub IsOwner
+
+=head2 IsOwner
+
+  Takes an RT::User object. Returns true if that user is this ticket's owner.
+returns undef otherwise
+
+=cut
+
+sub IsOwner {
+    my $self = shift;
+    my $person = shift;
+  
+
+    # no ACL check since this is used in acl decisions
+    # unless ($self->CurrentUserHasRight('ShowTicket')) {
+    #  return(undef);
+    #   }      
+
+    
+    #Tickets won't yet have owners when they're being created.
+    unless ($self->OwnerObj->id) {
+        return(undef);
+    }
+    
+    if ($person->id == $self->OwnerObj->id) {
+       return(1);
+    }
+    else {
+       return(undef);
+    }
+}
+
+
+# }}}
+
+# }}}
+
+# }}}
+
+# {{{ Routines dealing with queues 
+
+# {{{ sub ValidateQueue
+
+sub ValidateQueue {
+  my $self = shift;
+  my $Value = shift;
+  
+  #TODO I don't think this should be here. We shouldn't allow anything to have an undef queue,
+  if (!$Value) {
+    $RT::Logger->warning( " RT:::Queue::ValidateQueue called with a null value. this isn't ok.");
+    return (1);
+  }
+  
+  my $QueueObj = RT::Queue->new($self->CurrentUser);
+  my $id = $QueueObj->Load($Value);
+  
+  if ($id) {
+    return (1);
+  }
+  else {
+    return (undef);
+  }
+}
+
+# }}}
+
+# {{{ sub SetQueue  
+
+sub SetQueue {
+    my $self = shift;
+    my $NewQueue = shift;
+
+    #Redundant. ACL gets checked in _Set;
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, "Permission Denied");
+    }
+   
+    my $NewQueueObj = RT::Queue->new($self->CurrentUser);
+    $NewQueueObj->Load($NewQueue);
+    
+    unless ($NewQueueObj->Id()) {
+       return (0, "That queue does not exist");
+    }
+    
+    if ($NewQueueObj->Id == $self->QueueObj->Id) {
+       return (0, 'That is the same value');
+    }
+    unless ($self->CurrentUser->HasQueueRight(Right =>'CreateTicket',
+                                             QueueObj => $NewQueueObj )) {
+       return (0, "You may not create requests in that queue.");
+    }
+    
+    unless ($self->OwnerObj->HasQueueRight(Right=> 'OwnTicket',  
+                                          QueueObj => $NewQueueObj)) {
+           $self->Untake();
+    }
+
+    return($self->_Set(Field => 'Queue', Value => $NewQueueObj->Id()));
+    
+}
+
+# }}}
+
+# {{{ sub QueueObj
+
+=head2 QueueObj
+
+Takes nothing. returns this ticket's queue object
+
+=cut
+
+sub QueueObj {
+    my $self = shift;
+    
+    my $queue_obj = RT::Queue->new($self->CurrentUser);
+    #We call __Value so that we can avoid the ACL decision and some deep recursion
+    my ($result) = $queue_obj->Load($self->__Value('Queue'));
+    return ($queue_obj);
+}
+
+
+# }}}
+
+# }}}
+
+# {{{ Date printing routines
+
+# {{{ sub DueObj
+
+=head2 DueObj
+
+  Returns an RT::Date object containing this ticket's due date
+
+=cut
+sub DueObj {
+    my $self = shift;
+    
+    my $time = new RT::Date($self->CurrentUser);
+
+    # -1 is RT::Date slang for never
+    if ($self->Due) {
+       $time->Set(Format => 'sql', Value => $self->Due );
+    }
+    else {
+       $time->Set(Format => 'unix', Value => -1);
+    }
+    
+    return $time;
+}
+# }}}
+
+# {{{ sub DueAsString 
+
+=head2 DueAsString
+
+Returns this ticket's due date as a human readable string
+
+=cut
+
+sub DueAsString {
+  my $self = shift;
+  return $self->DueObj->AsString();
+}
+
+# }}}
+
+# {{{ sub GraceTimeAsString 
+
+=head2 GraceTimeAsString
+
+Return the time until this ticket is due as a string
+
+=cut
+
+# TODO This should be deprecated 
+
+sub GraceTimeAsString {
+    my $self=shift;
+    
+    if ($self->Due) {
+       return ($self->DueObj->AgeAsString());
+    } else {
+       return "";
+    }
+}
+
+# }}}
+
+
+# {{{ sub ResolvedObj
+
+=head2 ResolvedObj
+
+  Returns an RT::Date object of this ticket's 'resolved' time.
+
+=cut
+
+sub ResolvedObj {
+  my $self = shift;
+
+  my $time = new RT::Date($self->CurrentUser);
+  $time->Set(Format => 'sql', Value => $self->Resolved);
+  return $time;
+}
+# }}}
+
+# {{{ sub SetStarted
+
+=head2 SetStarted
+
+Takes a date in ISO format or undef
+Returns a transaction id and a message
+The client calls "Start" to note that the project was started on the date in $date.
+A null date means "now"
+
+=cut
+  
+sub SetStarted {
+    my $self = shift;
+    my $time = shift || 0;
+    
+
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, "Permission Denied");
+    }
+
+    #We create a date object to catch date weirdness
+    my $time_obj = new RT::Date($self->CurrentUser());
+    if ($time != 0)  {
+       $time_obj->Set(Format => 'ISO', Value => $time);
+    }
+    else {
+       $time_obj->SetToNow();
+    }
+    
+    #Now that we're starting, open this ticket
+    #TODO do we really want to force this as policy? it should be a scrip
+    
+    #We need $TicketAsSystem, in case the current user doesn't have
+    #ShowTicket
+    #
+    my $TicketAsSystem = new RT::Ticket($RT::SystemUser);
+    $TicketAsSystem->Load($self->Id);  
+    if ($TicketAsSystem->Status eq 'new') {
+       $TicketAsSystem->Open();
+    }  
+    
+    return ($self->_Set(Field => 'Started', Value =>$time_obj->ISO));
+    
+}
+
+# }}}
+
+# {{{ sub StartedObj
+
+=head2 StartedObj
+
+  Returns an RT::Date object which contains this ticket's 
+'Started' time.
+
+=cut
+
+
+sub StartedObj {
+    my $self = shift;
+    
+    my $time = new RT::Date($self->CurrentUser);
+    $time->Set(Format => 'sql', Value => $self->Started);
+    return $time;
+}
+# }}}
+
+# {{{ sub StartsObj
+
+=head2 StartsObj
+
+  Returns an RT::Date object which contains this ticket's 
+'Starts' time.
+
+=cut
+
+sub StartsObj {
+  my $self = shift;
+  
+  my $time = new RT::Date($self->CurrentUser);
+  $time->Set(Format => 'sql', Value => $self->Starts);
+  return $time;
+}
+# }}}
+
+# {{{ sub ToldObj
+
+=head2 ToldObj
+
+  Returns an RT::Date object which contains this ticket's 
+'Told' time.
+
+=cut
+
+
+sub ToldObj {
+  my $self = shift;
+  
+  my $time = new RT::Date($self->CurrentUser);
+  $time->Set(Format => 'sql', Value => $self->Told);
+  return $time;
+}
+
+# }}}
+
+# {{{ sub LongSinceToldAsString
+
+# TODO this should be deprecated
+
+
+sub LongSinceToldAsString {
+  my $self = shift;
+
+  if ($self->Told) {
+      return $self->ToldObj->AgeAsString();
+  } else {
+      return "Never";
+  }
+}
+# }}}
+
+# {{{ sub ToldAsString
+
+=head2 ToldAsString
+
+A convenience method that returns ToldObj->AsString
+
+TODO: This should be deprecated
+
+=cut
+
+
+sub ToldAsString {
+    my $self = shift;
+    if ($self->Told) {
+       return $self->ToldObj->AsString();
+    }
+    else {
+       return("Never");
+    }
+}
+# }}}
+
+# {{{ sub TimeWorkedAsString
+
+=head2 TimeWorkedAsString
+
+Returns the amount of time worked on this ticket as a Text String
+
+=cut
+
+sub TimeWorkedAsString {
+    my $self=shift;
+    return "0" unless $self->TimeWorked;
+    
+    #This is not really a date object, but if we diff a number of seconds 
+    #vs the epoch, we'll get a nice description of time worked.
+    
+    my $worked = new RT::Date($self->CurrentUser);
+    #return the  #of minutes worked turned into seconds and written as
+    # a simple text string
+
+    return($worked->DurationAsString($self->TimeWorked*60));
+}
+
+# }}}
+
+
+# }}}
+
+# {{{ Routines dealing with correspondence/comments
+
+# {{{ sub Comment
+
+=head2 Comment
+
+Comment on this ticket.
+Takes a hashref with the follwoing attributes:
+
+MIMEObj, TimeTaken, CcMessageTo, BccMessageTo
+
+=cut
+
+sub Comment {
+  my $self = shift;
+  
+  my %args = (
+          CcMessageTo => undef,
+          BccMessageTo => undef,
+             MIMEObj => undef,
+             TimeTaken => 0,
+             @_ );
+
+  unless (($self->CurrentUserHasRight('CommentOnTicket')) or
+         ($self->CurrentUserHasRight('ModifyTicket'))) {
+      return (0, "Permission Denied");
+  }
+   unless ($args{'MIMEObj'}) {
+       return(0,"No correspondence attached");
+   }
+
+  # If we've been passed in CcMessageTo and BccMessageTo fields,
+  # add them to the mime object for passing on to the transaction handler
+  # The "NotifyOtherRecipients" scripAction will look for RT--Send-Cc: and
+  # RT-Send-Bcc: headers
+  $args{'MIMEObj'}->head->add('RT-Send-Cc', $args{'CcMessageTo'});
+  $args{'MIMEObj'}->head->add('RT-Send-Bcc', $args{'BccMessageTo'});
+
+  #Record the correspondence (write the transaction)
+  my ($Trans, $Msg, $TransObj) = $self->_NewTransaction( Type => 'Comment',
+                                     Data =>($args{'MIMEObj'}->head->get('subject') || 'No Subject'),
+                                     TimeTaken => $args{'TimeTaken'},
+                                     MIMEObj => $args{'MIMEObj'}
+                                   );
+  
+  
+  return ($Trans, "The comment has been recorded");
+}
+
+# }}}
+
+# {{{ sub Correspond
+
+=head2 Correspond
+
+Correspond on this ticket.
+Takes a hashref with the following attributes:
+
+
+MIMEObj, TimeTaken, CcMessageTo, BccMessageTo
+
+=cut
+
+sub Correspond {
+    my $self = shift;
+    my %args = (
+          CcMessageTo => undef,
+          BccMessageTo => undef,
+               MIMEObj => undef,
+               TimeTaken => 0,
+               @_ );
+    
+    unless (($self->CurrentUserHasRight('ReplyToTicket')) or
+           ($self->CurrentUserHasRight('ModifyTicket'))) {
+       return (0, "Permission Denied");
+    }
+    
+    unless ($args{'MIMEObj'}) {
+       return(0,"No correspondence attached");
+    }
+    
+  # If we've been passed in CcMessageTo and BccMessageTo fields,
+  # add them to the mime object for passing on to the transaction handler
+  # The "NotifyOtherRecipients" scripAction will look for RT-Send-Cc: and RT-Send-Bcc:
+  # headers
+  $args{'MIMEObj'}->head->add('RT-Send-Cc', $args{'CcMessageTo'});
+  $args{'MIMEObj'}->head->add('RT-Send-Bcc', $args{'BccMessageTo'});
+
+    #Record the correspondence (write the transaction)
+    my ($Trans,$msg, $TransObj) = $self->_NewTransaction
+      (Type => 'Correspond',
+       Data => ($args{'MIMEObj'}->head->get('subject') || 'No Subject'),
+       TimeTaken => $args{'TimeTaken'},
+       MIMEObj=> $args{'MIMEObj'}     
+      );
+    
+    # TODO this bit of logic should really become a scrip for 2.2
+    my $TicketAsSystem = new RT::Ticket($RT::SystemUser);
+    $TicketAsSystem->Load($self->Id);
+       
+    if (
+       ($TicketAsSystem->Status ne 'open') and
+       ($TicketAsSystem->Status ne 'new')
+       ) {
+       
+       my $oldstatus = $TicketAsSystem->Status();
+       $TicketAsSystem->__Set(Field => 'Status', Value => 'open');
+       $TicketAsSystem->_NewTransaction 
+         ( Type => 'Set',
+           Field => 'Status',
+           OldValue => $oldstatus,
+           NewValue => 'open',
+           Data => 'Ticket auto-opened on incoming correspondence'
+         );
+    }
+    
+    unless ($Trans) {
+       $RT::Logger->err("$self couldn't init a transaction ($msg)\n");
+       return ($Trans, "correspondence (probably) not sent", $args{'MIMEObj'});
+    }
+    
+    #Set the last told date to now if this isn't mail from the requestor.
+    #TODO: Note that this will wrongly ack mail from any non-requestor as a "told"
+    
+    unless ($TransObj->IsInbound) {
+       $self->_SetTold;
+    }
+    
+    return ($Trans, "correspondence sent");
+}
+
+# }}}
+
+# }}}
+
+# {{{ Routines dealing with Links and Relations between tickets
+
+# {{{ Link Collections
+
+# {{{ sub Members
+
+=head2 Members
+
+  This returns an RT::Links object which references all the tickets 
+which are 'MembersOf' this ticket
+
+=cut
+
+sub Members {
+   my $self = shift;
+   return ($self->_Links('Target', 'MemberOf'));
+}
+
+# }}}
+
+# {{{ sub MemberOf
+
+=head2 MemberOf
+
+  This returns an RT::Links object which references all the tickets that this
+ticket is a 'MemberOf'
+
+=cut
+
+sub MemberOf {
+   my $self = shift;
+   return ($self->_Links('Base', 'MemberOf'));
+}
+
+# }}}
+
+# {{{ RefersTo
+
+=head2 RefersTo
+
+  This returns an RT::Links object which shows all references for which this ticket is a base
+
+=cut
+
+sub RefersTo {
+    my $self = shift;
+    return ($self->_Links('Base', 'RefersTo'));
+}
+
+# }}}
+
+# {{{ ReferredToBy
+
+=head2 ReferredToBy
+
+  This returns an RT::Links object which shows all references for which this ticket is a target
+
+=cut
+
+sub ReferredToBy {
+    my $self = shift;
+    return ($self->_Links('Target', 'RefersTo'));
+}
+
+# }}}
+
+# {{{ DependedOnBy
+
+=head2 DependedOnBy
+
+  This returns an RT::Links object which references all the tickets that depend on this one
+
+=cut
+sub DependedOnBy {
+    my $self = shift;
+    return ($self->_Links('Target','DependsOn'));
+}
+
+# }}}
+
+# {{{ DependsOn
+
+=head2 DependsOn
+
+  This returns an RT::Links object which references all the tickets that this ticket depends on
+
+=cut
+sub DependsOn {
+   my $self = shift;
+    return ($self->_Links('Base','DependsOn'));
+}
+
+# }}}
+
+# {{{ sub _Links 
+
+sub _Links {
+    my $self = shift;
+    
+    #TODO: Field isn't the right thing here. but I ahave no idea what mnemonic ---
+    #tobias meant by $f
+    my $field = shift;
+    my $type =shift || "";
+
+    unless ($self->{"$field$type"}) {
+       $self->{"$field$type"} = new RT::Links($self->CurrentUser);
+       if ($self->CurrentUserHasRight('ShowTicket')) {
+           
+           $self->{"$field$type"}->Limit(FIELD=>$field, VALUE=>$self->URI);
+           $self->{"$field$type"}->Limit(FIELD=>'Type', 
+                                         VALUE=>$type) if ($type);
+       }
+    }
+    return ($self->{"$field$type"});
+}
+
+# }}}
+
+# }}}
+
+
+# {{{ sub DeleteLink 
+
+=head2 DeleteLink
+
+Delete a link. takes a paramhash of Base, Target and Type.
+Either Base or Target must be null. The null value will 
+be replaced with this ticket\'s id
+
+=cut 
+
+sub DeleteLink {
+    my $self = shift;
+    my %args = ( Base =>  undef,
+                Target => undef,
+                Type => undef,
+                @_ );
+    
+    #check acls
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+        $RT::Logger->debug("No permission to delete links\n"); 
+        return (0, 'Permission Denied');
+
+    
+    }
+    
+    #we want one of base and target. we don't care which
+    #but we only want _one_
+
+    if ($args{'Base'} and $args{'Target'}) {
+       $RT::Logger->debug("$self ->_DeleteLink. got both Base and Target\n");
+       return (0, 'Can\'t specifiy both base and target');
+    }
+    elsif ($args{'Base'}) {
+       $args{'Target'} = $self->Id();
+    }
+    elsif ($args{'Target'}) {
+       $args{'Base'} = $self->Id();
+    }
+    else {  
+        $RT::Logger->debug("$self: Base or Target must be specified\n");
+       return (0, 'Either base or target must be specified');
+    }
+     
+    my $link = new RT::Link($self->CurrentUser);
+    $RT::Logger->debug("Trying to load link: ". $args{'Base'}." ". $args{'Type'}. " ". $args{'Target'}. "\n");
+    
+    $link->Load($args{'Base'}, $args{'Type'}, $args{'Target'});
+    
+    
+    
+    #it's a real link. 
+    if ($link->id) {
+        $RT::Logger->debug("We're going to delete link ".$link->id."\n");
+       $link->Delete();
+
+       my $TransString=
+         "Ticket $args{'Base'} no longer $args{Type} ticket $args{'Target'}.";
+       my ($Trans, $Msg, $TransObj) = $self->_NewTransaction
+         (Type => 'DeleteLink',
+          Field => $args{'Type'},
+          Data => $TransString,
+          TimeTaken => 0
+         );
+       
+       return ($linkid, "Link deleted ($TransString)", $transactionid);
+    }
+    #if it's not a link we can find
+    else {
+        $RT::Logger->debug("Couldn't find that link\n");
+       return (0, "Link not found");
+    }
+}
+
+# }}}
+
+# {{{ sub AddLink
+
+=head2 AddLink
+
+Takes a paramhash of Type and one of Base or Target. Adds that link to this ticket.
+
+
+=cut
+
+sub AddLink {
+    my $self = shift;
+    my %args = ( Target => '',
+                Base => '',
+                Type => '',
+                @_ );
+    
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, "Permission Denied");
+    }
+    
+    if ($args{'Base'} and $args{'Target'}) {
+       $RT::Logger->debug("$self tried to delete a link. both base and target were specified\n");
+       return (0, 'Can\'t specifiy both base and target');
+    }
+    elsif ($args{'Base'}) {
+        $args{'Target'} = $self->Id();
+    }
+    elsif ($args{'Target'}) {
+       $args{'Base'} = $self->Id();
+    }
+    else {  
+       return (0, 'Either base or target must be specified');
+    }
+    
+    # {{{ We don't want references to ourself
+    if ($args{Base} eq $args{Target}) {
+       return (0, "Can\'t link a ticket to itself");
+    }  
+               
+    # }}}
+    
+    # If the base isn't a URI, make it a URI. 
+    # If the target isn't a URI, make it a URI. 
+        
+    # {{{ Check if the link already exists - we don't want duplicates
+    my $old_link= new RT::Link ($self->CurrentUser);
+    $old_link->Load($args{'Base'}, $args{'Type'}, $args{'Target'});
+    if ($old_link->Id) {
+       $RT::Logger->debug("$self Somebody tried to duplicate a link");
+       return ($old_link->id, "Link already exists",0);
+    }
+    # }}}
+    
+    # Storing the link in the DB.
+    my $link = RT::Link->new($self->CurrentUser);
+    my ($linkid) = $link->Create(Target => $args{Target}, 
+                                Base => $args{Base}, 
+                                Type => $args{Type});
+    
+    unless ($linkid) {
+       return (0,"Link could not be created");
+    }
+       #Write the transaction
+    
+    my $TransString="Ticket $args{'Base'} $args{Type} ticket $args{'Target'}.";
+    
+    my ($Trans, $Msg, $TransObj) = $self->_NewTransaction
+      (Type => 'AddLink',
+       Field => $args{'Type'},
+       Data => $TransString,
+       TimeTaken => 0
+      );
+    
+    return ($Trans, "Link created ($TransString)");
+       
+       
+}
+# }}}
+
+# {{{ sub URI 
+
+=head2 URI
+
+Returns this ticket's URI
+
+=cut
+
+sub URI {
+    my $self = shift;
+    return $RT::TicketBaseURI.$self->id;
+}
+
+# }}}
+
+# {{{ sub MergeInto
+
+=head2 MergeInto
+MergeInto take the id of the ticket to merge this ticket into.
+
+=cut
+
+sub MergeInto {
+    my $self = shift;
+    my $MergeInto = shift;
+    
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, "Permission Denied");
+    }
+    
+    # Load up the new ticket.
+    my $NewTicket = RT::Ticket->new($RT::SystemUser);
+    $NewTicket->Load($MergeInto);
+
+    # make sure it exists.
+    unless (defined $NewTicket->Id) {
+       return (0, 'New ticket doesn\'t exist');
+    }
+
+    
+    # Make sure the current user can modify the new ticket.
+    unless ($NewTicket->CurrentUserHasRight('ModifyTicket')) {
+       $RT::Logger->debug("failed...");
+       return (0, "Permission Denied");
+    }
+    
+    $RT::Logger->debug("checking if the new ticket has the same id and effective id...");
+    unless ($NewTicket->id == $NewTicket->EffectiveId) {
+       $RT::Logger->err('$self trying to merge into '.$NewTicket->Id .
+                        ' which is itself merged.\n');
+       return (0, "Can't merge into a merged ticket. ".
+               "You should never get this error");
+    }
+
+    
+    # We use EffectiveId here even though it duplicates information from
+    # the links table becasue of the massive performance hit we'd take
+    # by trying to do a seperate database query for merge info everytime 
+    # loaded a ticket. 
+    
+    
+    #update this ticket's effective id to the new ticket's id.
+    my ($id_val, $id_msg) = $self->__Set(Field => 'EffectiveId', 
+                                        Value => $NewTicket->Id());
+    
+    unless ($id_val) {
+       $RT::Logger->error("Couldn't set effective ID for ".$self->Id.
+                          ": $id_msg");
+       return(0,"Merge failed. Couldn't set EffectiveId");
+    }
+    
+    my ($status_val, $status_msg) = $self->__Set(Field => 'Status',
+                                                Value => 'resolved');
+    
+    unless ($status_val) {
+       $RT::Logger->error("$self couldn't set status to resolved.".
+                          "RT's Database may be inconsistent.");
+    }      
+    
+    #make a new link: this ticket is merged into that other ticket.
+    $self->AddLink( Type =>'MergedInto',
+                   Target => $NewTicket->Id() );
+    
+    #add all of this ticket's watchers to that ticket.
+    my $watchers = $self->Watchers();
+    
+    while (my $watcher = $watchers->Next()) {
+       unless (
+               ($watcher->Owner && 
+               $NewTicket->IsWatcher (Type => $watcher->Type,
+                                      Id => $watcher->Owner)) or 
+               ($watcher->Email && 
+                $NewTicket->IsWatcher (Type => $watcher->Type,
+                                       Id => $watcher->Email)) 
+              ) {
+           
+           
+           
+           $NewTicket->_AddWatcher(Silent => 1, 
+                                   Type => $watcher->Type, 
+                                   Email => $watcher->Email,
+                                   Owner => $watcher->Owner);
+       }
+    }
+    
+    
+    #find all of the tickets that were merged into this ticket. 
+    my $old_mergees = new RT::Tickets($self->CurrentUser);
+    $old_mergees->Limit( FIELD => 'EffectiveId',
+                        OPERATOR => '=',
+                        VALUE => $self->Id );
+    
+    #   update their EffectiveId fields to the new ticket's id
+    while (my $ticket = $old_mergees->Next()) {
+       my ($val, $msg) = $ticket->__Set(Field => 'EffectiveId', 
+                                        Value => $NewTicket->Id());
+    }  
+    $NewTicket->_SetLastUpdated;
+
+    return ($TransactionObj, "Merge Successful");
+}  
+
+# }}}
+
+# }}}
+
+# {{{ Routines dealing with keywords
+
+# {{{ sub KeywordsObj
+
+=head2 KeywordsObj [KEYWORD_SELECT_ID]
+
+  Returns an B<RT::ObjectKeywords> object preloaded with this ticket's ObjectKeywords.
+If the optional KEYWORD_SELECT_ID parameter is set, limit the keywords object to that keyword
+select.
+
+=cut
+
+sub KeywordsObj {
+    my $self = shift;
+    my $keyword_select; 
+    
+    $keyword_select = shift if (@_);
+    
+    use RT::ObjectKeywords;
+    my $Keywords = new RT::ObjectKeywords($self->CurrentUser);
+
+    #ACL check
+    if ($self->CurrentUserHasRight('ShowTicket')) {
+       $Keywords->LimitToTicket($self->id);
+       if ($keyword_select) {
+           $Keywords->LimitToKeywordSelect($keyword_select);
+       }       
+    }
+    return ($Keywords);
+}
+# }}}
+
+# {{{ sub AddKeyword
+
+=head2 AddKeyword
+
+Takes a paramhash of Keyword and KeywordSelect.  If Keyword is a valid choice
+for KeywordSelect, creates a KeywordObject.  If the KeywordSelect says this should
+be a single KeywordObject, automatically removes the old value.
+
+ Issues: probably doesn't enforce the depth restrictions or make sure that keywords
+are coming from the right part of the tree. really should.
+
+=cut
+
+sub AddKeyword {
+    my $self = shift;
+   #ACL check
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, 'Permission Denied');
+    }
+    
+    return($self->_AddKeyword(@_));
+    
+}
+
+
+# Helper version of AddKeyword without that pesky ACL check
+sub _AddKeyword {
+    my $self = shift;
+    my %args = ( KeywordSelect => undef,  # id of a keyword select record
+                Keyword => undef, #id of the keyword to add
+                Silent => 0,
+                @_
+              );
+    
+    my ($OldValue);
+
+    #TODO make sure that $args{'Keyword'} is valid for $args{'KeywordSelect'}
+
+    #TODO: make sure that $args{'KeywordSelect'} applies to this ticket's queue.
+    
+    my $Keyword = new RT::Keyword($self->CurrentUser);
+    unless ($Keyword->Load($args{'Keyword'}) ) {
+       $RT::Logger->err("$self Couldn't load Keyword ".$args{'Keyword'} ."\n");
+       return(0, "Couldn't load keyword");
+    }
+    
+    my $KeywordSelectObj = new RT::KeywordSelect($self->CurrentUser);
+    unless ($KeywordSelectObj->Load($args{'KeywordSelect'})) {
+       $RT::Logger->err("$self Couldn't load KeywordSelect ".$args{'KeywordSelect'});
+       return(0, "Couldn't load keywordselect");
+    }
+    
+    my $Keywords = $self->KeywordsObj($KeywordSelectObj->id);
+
+    #If the ticket already has this keyword, just get out of here.
+    if ($Keywords->HasEntry($Keyword->id)) {
+       return(0, "That is already the current value");
+    }  
+
+    #If the keywordselect wants this to be a singleton:
+
+    if ($KeywordSelectObj->Single) {
+
+       #Whack any old values...keep track of the last value that we get.
+       #we shouldn't need a loop ehre, but we do it anyway, to try to 
+       # help keep the database clean.
+       while (my $OldKey = $Keywords->Next) {
+           $OldValue = $OldKey->KeywordObj->Name;
+           $OldKey->Delete();
+       }       
+       
+       
+    }
+
+    # create the new objectkeyword 
+    my $ObjectKeyword = new RT::ObjectKeyword($self->CurrentUser);
+    my $result = $ObjectKeyword->Create( Keyword => $Keyword->Id,
+                                        ObjectType => 'Ticket',
+                                        ObjectId => $self->Id,
+                                        KeywordSelect => $KeywordSelectObj->Id );
+    
+
+    # record a single transaction, unless we were told not to
+    unless ($args{'Silent'}) {
+       my ($TransactionId, $Msg, $TransactionObj) = 
+         $self->_NewTransaction( Type => 'Keyword',
+                                 Field => $KeywordSelectObj->Id,
+                                 OldValue => $OldValue,
+                                 NewValue => $Keyword->Name );
+    }
+    return ($TransactionId, "Keyword ".$ObjectKeyword->KeywordObj->Name ." added.");    
+
+}      
+
+# }}}
+
+# {{{ sub DeleteKeyword
+
+=head2 DeleteKeyword
+  
+  Takes a paramhash. Deletes the Keyword denoted by the I<Keyword> parameter from this
+  ticket's object keywords.
+
+=cut
+
+sub DeleteKeyword {
+    my $self = shift;
+    my %args = ( Keyword => undef,
+                KeywordSelect => undef,
+                @_ );
+
+   #ACL check
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {    
+       return (0, 'Permission Denied');
+    }
+
+    
+    #Load up the ObjectKeyword we\'re talking about
+    my $ObjectKeyword = new RT::ObjectKeyword($self->CurrentUser);
+    $ObjectKeyword->LoadByCols(Keyword => $args{'Keyword'},
+                              KeywordSelect => $args{'KeywordSelect'},
+                              ObjectType => 'Ticket',
+                              ObjectId => $self->id()
+                             );
+    
+    #if we can\'t find it, bail
+    unless ($ObjectKeyword->id) {
+       $RT::Logger->err("Couldn't find the keyword ".$args{'Keyword'} .
+                        " for keywordselect ". $args{'KeywordSelect'} . 
+                        "for ticket ".$self->id );
+       return (undef, "Couldn't load keyword while trying to delete it.");
+    };
+    
+    #record transaction here.
+    my ($TransactionId, $Msg, $TransObj) = 
+      $self->_NewTransaction( Type => 'Keyword', 
+                             OldValue => $ObjectKeyword->KeywordObj->Name);
+    
+    $ObjectKeyword->Delete();
+    
+    return ($TransactionId, "Keyword ".$ObjectKeyword->KeywordObj->Name ." deleted.");
+    
+}
+
+# }}}
+
+# }}}
+
+# {{{ Routines dealing with ownership
+
+# {{{ sub OwnerObj
+
+=head2 OwnerObj
+
+Takes nothing and returns an RT::User object of 
+this ticket's owner
+
+=cut
+
+sub OwnerObj {
+    my $self = shift;
+    
+    #If this gets ACLed, we lose on a rights check in User.pm and
+    #get deep recursion. if we need ACLs here, we need
+    #an equiv without ACLs
+    
+    $owner = new RT::User ($self->CurrentUser);
+    $owner->Load($self->__Value('Owner'));
+    
+    #Return the owner object
+    return ($owner);
+}
+
+# }}}
+
+# {{{ sub OwnerAsString 
+
+=head2 OwnerAsString
+
+Returns the owner's email address
+
+=cut
+
+sub OwnerAsString {
+  my $self = shift;
+  return($self->OwnerObj->EmailAddress);
+
+}
+
+# }}}
+
+# {{{ sub SetOwner
+
+=head2 SetOwner
+
+Takes two arguments:
+     the Id or Name of the owner 
+and  (optionally) the type of the SetOwner Transaction. It defaults
+to 'Give'.  'Steal' is also a valid option.
+
+=cut
+
+sub SetOwner {
+    my $self = shift;
+    my $NewOwner = shift;
+    my $Type = shift || "Give";
+    
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, "Permission Denied");
+    }  
+    
+    my $NewOwnerObj = RT::User->new($self->CurrentUser);
+    my $OldOwnerObj = $self->OwnerObj;
+  
+    $NewOwnerObj->Load($NewOwner);
+    if (!$NewOwnerObj->Id) {
+           return (0, "That user does not exist");
+    }
+    
+    #If thie ticket has an owner and it's not the current user
+    
+    if (($Type ne 'Steal' ) and ($Type ne 'Force') and #If we're not stealing
+       ($self->OwnerObj->Id != $RT::Nobody->Id ) and #and the owner is set
+       ($self->CurrentUser->Id ne $self->OwnerObj->Id())) { #and it's not us
+       return(0, "You can only reassign tickets that you own or that are unowned");
+    }
+    
+    #If we've specified a new owner and that user can't modify the ticket
+    elsif (($NewOwnerObj->Id) and 
+          (!$NewOwnerObj->HasQueueRight(Right => 'OwnTicket',
+                                        QueueObj => $self->QueueObj,
+                                        TicketObj => $self))
+         ) {
+       return (0, "That user may not own requests in that queue");
+    }
+  
+  
+    #If the ticket has an owner and it's the new owner, we don't need
+    #To do anything
+    elsif (($self->OwnerObj) and ($NewOwnerObj->Id eq $self->OwnerObj->Id)) {
+       return(0, "That user already owns that request");
+    }
+  
+  
+    my ($trans,$msg)=$self->_Set(Field => 'Owner',
+                                Value => $NewOwnerObj->Id, 
+                                TimeTaken => 0,
+                                TransactionType => $Type);
+  
+    if ($trans) {
+       $msg = "Owner changed from ".$OldOwnerObj->Name." to ".$NewOwnerObj->Name;
+    }
+    return ($trans, $msg);
+         
+}
+
+# }}}
+
+# {{{ sub Take
+
+=head2 Take
+
+A convenince method to set the ticket's owner to the current user
+
+=cut
+
+sub Take {
+    my $self = shift;
+    return ($self->SetOwner($self->CurrentUser->Id, 'Take'));
+}
+
+# }}}
+
+# {{{ sub Untake
+
+=head2 Untake
+
+Convenience method to set the owner to 'nobody' if the current user is the owner.
+
+=cut
+
+sub Untake {
+    my $self = shift;
+    return($self->SetOwner($RT::Nobody->UserObj->Id, 'Untake'));
+}
+# }}}
+
+# {{{ sub Steal 
+
+=head2 Steal
+
+A convenience method to change the owner of the current ticket to the
+current user. Even if it's owned by another user.
+
+=cut
+
+sub Steal {
+    my $self = shift;
+  
+    if ($self->IsOwner($self->CurrentUser)) {
+       return (0,"You already own this ticket"); 
+    } else {
+       return($self->SetOwner($self->CurrentUser->Id, 'Steal'));
+      
+    }
+  
+}
+
+# }}}
+
+# }}}
+
+# {{{ Routines dealing with status
+
+# {{{ sub ValidateStatus 
+
+=head2 ValidateStatus STATUS
+
+Takes a string. Returns true if that status is a valid status for this ticket.
+Returns false otherwise.
+
+=cut
+
+sub ValidateStatus {
+    my $self = shift;
+    my $status = shift;
+
+    #Make sure the status passed in is valid
+    unless ($self->QueueObj->IsValidStatus($status)) {
+       return (undef);
+    }
+    
+    return (1);
+
+}
+
+
+# }}}
+
+# {{{ sub SetStatus
+
+=head2 SetStatus STATUS
+
+Set this ticket\'s status. STATUS can be one of: new, open, stalled, resolved or dead.
+
+=cut
+
+sub SetStatus { 
+    my $self = shift;
+    my $status = shift;
+
+    #Check ACL
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, 'Permission Denied');
+    }
+
+    my $now = new RT::Date($self->CurrentUser);
+    $now->SetToNow();
+    
+    #If we're changing the status from new, record that we've started
+    if (($self->Status =~ /new/) && ($status ne 'new')) {
+       #Set the Started time to "now"
+       $self->_Set(Field => 'Started',
+                   Value => $now->ISO,
+                   RecordTransaction => 0);
+    }
+    
+
+    if ($status eq 'resolved') {
+       #When we resolve a ticket, set the 'Resolved' attribute to now.
+       $self->_Set(Field => 'Resolved',
+                   Value => $now->ISO, 
+                   RecordTransaction => 0);
+    }
+    
+    
+    #Actually update the status
+    return($self->_Set(Field => 'Status', 
+                      Value => $status,
+                      TimeTaken => 0,
+                      TransactionType => 'Status'));
+}
+
+# }}}
+
+# {{{ sub Kill
+
+=head2 Kill
+
+Takes no arguments. Marks this ticket for garbage collection
+
+=cut
+
+sub Kill {
+  my $self = shift;
+  return ($self->SetStatus('dead'));
+  # TODO: garbage collection
+}
+
+# }}}
+
+# {{{ sub Stall
+
+=head2 Stall
+
+Sets this ticket's status to stalled
+
+=cut
+
+sub Stall {
+  my $self = shift;
+  return ($self->SetStatus('stalled'));
+}
+
+# }}}
+
+# {{{ sub Open
+
+=head2 Open
+
+Sets this ticket\'s status to Open
+
+=cut
+
+sub Open {
+    my $self = shift;
+    return ($self->SetStatus('open'));
+}
+
+# }}}
+
+# {{{ sub Resolve
+
+=head2 Resolve
+
+Sets this ticket\'s status to Resolved
+
+=cut
+
+sub Resolve {
+    my $self = shift;
+    return ($self->SetStatus('resolved'));
+}
+
+# }}}
+
+# }}}
+
+# {{{ Actions + Routines dealing with transactions
+
+# {{{ sub SetTold and _SetTold
+
+=head2 SetTold ISO  [TIMETAKEN]
+
+Updates the told and records a transaction
+
+=cut
+
+sub SetTold {
+    my $self=shift;
+    my $told;
+    $told = shift if (@_);
+    my $timetaken=shift || 0;
+   
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, "Permission Denied");
+    }
+
+    my $datetold = new RT::Date($self->CurrentUser);
+    if ($told) {
+       $datetold->Set( Format => 'iso',
+                       Value => $told);
+    }
+    else {
+        $datetold->SetToNow(); 
+    }
+    
+    return($self->_Set(Field => 'Told', 
+                      Value => $datetold->ISO,
+                      TimeTaken => $timetaken,
+                      TransactionType => 'Told'));
+}
+
+=head2 _SetTold
+
+Updates the told without a transaction or acl check. Useful when we're sending replies.
+
+=cut
+
+sub _SetTold {
+    my $self=shift;
+    
+    my $now = new RT::Date($self->CurrentUser);
+    $now->SetToNow();
+    #use __Set to get no ACLs ;)
+    return($self->__Set(Field => 'Told',
+                       Value => $now->ISO));
+}
+
+# }}}
+
+# {{{ sub Transactions 
+
+=head2 Transactions
+
+  Returns an RT::Transactions object of all transactions on this ticket
+
+=cut
+  
+sub Transactions {
+    my $self = shift;
+    
+    use RT::Transactions;
+    my $transactions = RT::Transactions->new($self->CurrentUser);
+
+    #If the user has no rights, return an empty object
+    if ($self->CurrentUserHasRight('ShowTicket')) {
+       my $tickets = $transactions->NewAlias('Tickets');
+       $transactions->Join( ALIAS1 => 'main',
+                             FIELD1 => 'Ticket',
+                             ALIAS2 => $tickets,
+                             FIELD2 => 'id');
+       $transactions->Limit( ALIAS => $tickets,
+                             FIELD => 'EffectiveId',
+                             VALUE => $self->id());
+        # if the user may not see comments do not return them
+        unless ($self->CurrentUserHasRight('ShowTicketComments')) {
+            $transactions->Limit( FIELD => 'Type',
+                                  OPERATOR => '!=',
+                                  VALUE => "Comment");
+        }
+    }
+    
+    return($transactions);
+}
+
+# }}}
+
+# {{{ sub _NewTransaction
+
+sub _NewTransaction {
+    my $self = shift;
+    my %args = ( TimeTaken => 0,
+                Type => undef,
+                OldValue => undef,
+                NewValue => undef,
+                Data => undef,
+                Field => undef,
+                MIMEObj => undef,
+                @_ );
+    
+    
+    require RT::Transaction;
+    my $trans = new RT::Transaction($self->CurrentUser);
+    my ($transaction, $msg) = 
+      $trans->Create( Ticket => $self->Id,
+                     TimeTaken => $args{'TimeTaken'},
+                     Type => $args{'Type'},
+                     Data => $args{'Data'},
+                     Field => $args{'Field'},
+                     NewValue => $args{'NewValue'},
+                     OldValue => $args{'OldValue'},
+                     MIMEObj => $args{'MIMEObj'}
+                   );
+    
+    $RT::Logger->warning($msg) unless $transaction;
+    
+    $self->_SetLastUpdated;
+    
+    if (defined $args{'TimeTaken'} ) {
+       $self->_UpdateTimeTaken($args{'TimeTaken'}); 
+    }
+    return($transaction, $msg, $trans);
+}
+
+# }}}
+
+# }}}
+
+# {{{ PRIVATE UTILITY METHODS. Mostly needed so Ticket can be a DBIx::Record
+
+# {{{ sub _ClassAccessible
+
+sub _ClassAccessible {
+    {
+       EffectiveId => { 'read' => 1, 'write' => 1, 'public' => 1 },
+       Queue => { 'read' => 1, 'write' => 1 },
+       Requestors => { 'read' => 1, 'write' => 1 },
+       Owner => { 'read' => 1, 'write' => 1 },
+       Subject => { 'read' => 1, 'write' => 1 },
+       InitialPriority => { 'read' => 1, 'write' => 1 },
+       FinalPriority => { 'read' => 1, 'write' => 1 },
+       Priority => { 'read' => 1, 'write' => 1 },
+       Status => { 'read' => 1, 'write' => 1 },
+       TimeWorked => { 'read' => 1, 'write' => 1 },
+       TimeLeft => { 'read' => 1, 'write' => 1 },
+       Created => { 'read' => 1, 'auto' => 1 },
+       Creator => { 'read' => 1,  'auto' => 1 },
+       Told => { 'read' => 1, 'write' => 1 },
+       Resolved => {'read' => 1},
+       Starts => { 'read' => 1, 'write' => 1 },
+       Started => { 'read' => 1, 'write' => 1 },
+       Due => { 'read' => 1, 'write' => 1 },
+       Creator => { 'read' => 1, 'auto' => 1 },
+       Created => { 'read' => 1, 'auto' => 1 },
+       LastUpdatedBy => { 'read' => 1, 'auto' => 1 },
+       LastUpdated => { 'read' => 1, 'auto' => 1 }
+    };
+
+}    
+
+# }}}
+
+# {{{ sub _Set
+
+sub _Set {
+    my $self = shift;
+    
+    unless ($self->CurrentUserHasRight('ModifyTicket')) {
+       return (0, "Permission Denied");
+    }
+    
+    my %args = (Field => undef,
+               Value => undef,
+               TimeTaken => 0,
+               RecordTransaction => 1,
+               TransactionType => 'Set',
+               @_
+              );
+    #if the user is trying to modify the record
+    
+    #Take care of the old value we really don't want to get in an ACL loop.
+    # so ask the super::_Value
+    my $Old=$self->SUPER::_Value("$args{'Field'}");
+    
+    #Set the new value
+    my ($ret, $msg)=$self->SUPER::_Set(Field => $args{'Field'}, 
+                                      Value=> $args{'Value'});
+    
+    #If we can't actually set the field to the value, don't record
+    # a transaction. instead, get out of here.
+    if ($ret==0) {return (0,$msg);}
+    
+    if ($args{'RecordTransaction'} == 1) {
+       
+       my ($Trans, $Msg, $TransObj) =  
+         $self->_NewTransaction(Type => $args{'TransactionType'},
+                                Field => $args{'Field'},
+                                NewValue => $args{'Value'},
+                                OldValue =>  $Old,
+                                TimeTaken => $args{'TimeTaken'},
+                               );
+      return ($Trans,$TransObj->Description);
+    }
+    else {
+       return ($ret, $msg);
+  }
+}
+
+# }}}
+
+# {{{ sub _Value 
+
+=head2 _Value
+
+Takes the name of a table column.
+Returns its value as a string, if the user passes an ACL check
+
+=cut
+
+sub _Value  {
+
+  my $self = shift;
+  my $field = shift;
+
+  
+  #if the field is public, return it.
+  if ($self->_Accessible($field, 'public')) {
+      #$RT::Logger->debug("Skipping ACL check for $field\n");
+      return($self->SUPER::_Value($field));
+      
+  }
+  
+  #If the current user doesn't have ACLs, don't let em at it.  
+  
+  unless ($self->CurrentUserHasRight('ShowTicket')) {
+      return (undef);
+  }
+  return($self->SUPER::_Value($field));
+  
+}
+
+# }}}
+
+# {{{ sub _UpdateTimeTaken
+
+=head2 _UpdateTimeTaken
+
+This routine will increment the timeworked counter. it should
+only be called from _NewTransaction 
+
+=cut
+
+sub _UpdateTimeTaken {
+  my $self = shift;
+  my $Minutes = shift;
+  my ($Total);
+   
+  $Total = $self->SUPER::_Value("TimeWorked");
+  $Total = ($Total || 0) + ($Minutes || 0);
+  $self->SUPER::_Set(Field => "TimeWorked", 
+                    Value => $Total);
+
+  return ($Total);
+}
+
+# }}}
+
+# }}}
+
+# {{{ Routines dealing with ACCESS CONTROL
+
+# {{{ sub CurrentUserHasRight 
+
+=head2 CurrentUserHasRight
+
+  Takes the textual name of a Ticket scoped right (from RT::ACE) and returns
+1 if the user has that right. It returns 0 if the user doesn't have that right.
+
+=cut
+
+sub CurrentUserHasRight {
+  my $self = shift;
+  my $right = shift;
+  
+  return ($self->HasRight( Principal=> $self->CurrentUser->UserObj(),
+                           Right => "$right"));
+
+}
+
+# }}}
+
+# {{{ sub HasRight 
+
+=head2 HasRight
+
+ Takes a paramhash with the attributes 'Right' and 'Principal'
+  'Right' is a ticket-scoped textual right from RT::ACE 
+  'Principal' is an RT::User object
+
+  Returns 1 if the principal has the right. Returns undef if not.
+
+=cut
+
+sub HasRight {
+    my $self = shift;
+    my %args = ( Right => undef,
+                Principal => undef,
+                @_);
+    
+    unless ((defined $args{'Principal'}) and (ref($args{'Principal'}))) {
+       $RT::Logger->warning("Principal attrib undefined for Ticket::HasRight");
+    }
+    
+    return($args{'Principal'}->HasQueueRight(TicketObj => $self,
+                                            Right => $args{'Right'}));
+}
+
+# }}}
+
+# }}}
+
+
+1;
+
+=head1 AUTHOR
+
+Jesse Vincent, jesse@fsck.com
+
+=head1 SEE ALSO
+
+RT
+
+=cut
+
+
diff --git a/rt/lib/RT/Tickets.pm b/rt/lib/RT/Tickets.pm
new file mode 100755 (executable)
index 0000000..dd91126
--- /dev/null
@@ -0,0 +1,1789 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Tickets.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Tickets - A collection of Ticket objects
+
+
+=head1 SYNOPSIS
+
+  use RT::Tickets;
+  my $tickets = new RT::Tickets($CurrentUser);
+
+=head1 DESCRIPTION
+
+   A collection of RT::Tickets.
+
+=head1 METHODS
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Tickets);
+
+=end testing
+
+=cut
+
+package RT::Tickets;
+use RT::EasySearch;
+use RT::Ticket;
+@ISA= qw(RT::EasySearch);
+
+use vars qw(%TYPES @SORTFIELDS);
+
+# {{{ TYPES
+
+%TYPES =    ( Status => 'ENUM',
+             Queue  => 'ENUM',
+             Type => 'ENUM',
+             Creator => 'ENUM',
+             LastUpdatedBy => 'ENUM',
+             Owner => 'ENUM',
+             EffectiveId => 'INT',
+             id => 'INT',
+             InitialPriority => 'INT',
+             FinalPriority => 'INT',
+             Priority => 'INT',
+             TimeLeft => 'INT',
+             TimeWorked => 'INT',
+             MemberOf => 'LINK',
+             DependsOn => 'LINK',
+             HasMember => 'LINK',
+             HasDepender => 'LINK',
+             RelatedTo => 'LINK',
+              Told => 'DATE',
+              StartsBy => 'DATE',
+              Started => 'DATE',
+              Due  => 'DATE',
+              Resolved => 'DATE',
+              LastUpdated => 'DATE',
+              Created => 'DATE',
+              Subject => 'STRING',
+             Type => 'STRING',
+              Content => 'TRANSFIELD',
+             ContentType => 'TRANSFIELD',
+             TransactionDate => 'TRANSDATE',
+             Watcher => 'WATCHERFIELD',
+             LinkedTo => 'LINKFIELD',
+              Keyword => 'KEYWORDFIELD'
+
+           );
+
+
+# }}}
+
+# {{{ sub SortFields
+
+@SORTFIELDS = qw(id Status Owner Created Due Starts Started
+                Queue Subject Told Started 
+                   Resolved LastUpdated Priority TimeWorked TimeLeft);
+
+=head2 SortFields
+
+Returns the list of fields that lists of tickets can easily be sorted by
+
+=cut
+
+
+sub SortFields {
+       my $self = shift;
+       return(@SORTFIELDS);
+}
+
+
+# }}}
+
+# {{{ Limit the result set based on content
+
+# {{{ sub Limit 
+
+=head2 Limit
+
+Takes a paramhash with the fields FIELD, OPERATOR, VALUE and DESCRIPTION
+Generally best called from LimitFoo methods
+
+=cut
+sub Limit {
+    my $self = shift;
+    my %args = ( FIELD => undef,
+                OPERATOR => '=',
+                VALUE => undef,
+                DESCRIPTION => undef,
+                @_
+              );
+   $args{'DESCRIPTION'} = "Autodescribed: ".$args{'FIELD'} . $args{'OPERATOR'} . $args{'VALUE'},
+    if (!defined $args{'DESCRIPTION'}) ;
+
+    my $index = $self->_NextIndex;
+    
+    #make the TicketRestrictions hash the equivalent of whatever we just passed in;
+    
+    %{$self->{'TicketRestrictions'}{$index}} = %args;
+
+    $self->{'RecalcTicketLimits'} = 1;
+
+    # If we're looking at the effective id, we don't want to append the other clause
+    # which limits us to tickets where id = effective id 
+    if ($args{'FIELD'} eq 'EffectiveId') {
+        $self->{'looking_at_effective_id'} = 1;
+    }
+
+    return ($index);
+}
+
+# }}}
+
+
+
+
+=head2 FreezeLimits
+
+Returns a frozen string suitable for handing back to ThawLimits.
+
+=cut
+# {{{ sub FreezeLimits
+
+sub FreezeLimits {
+       my $self = shift;
+       require FreezeThaw;
+       return (FreezeThaw::freeze($self->{'TicketRestrictions'},
+                                  $self->{'restriction_index'}
+                                 ));
+}
+
+# }}}
+
+=head2 ThawLimits
+
+Take a frozen Limits string generated by FreezeLimits and make this tickets
+object have that set of limits.
+
+=cut
+# {{{ sub ThawLimits
+
+sub ThawLimits {
+       my $self = shift;
+       my $in = shift;
+       
+       #if we don't have $in, get outta here.
+       return undef unless ($in);
+
+       $self->{'RecalcTicketLimits'} = 1;
+
+       require FreezeThaw;
+       
+       #We don't need to die if the thaw fails.
+       
+       eval {
+               ($self->{'TicketRestrictions'},
+               $self->{'restriction_index'}
+               ) = FreezeThaw::thaw($in);
+       }
+
+}
+
+# }}}
+
+# {{{ Limit by enum or foreign key
+
+# {{{ sub LimitQueue
+
+=head2 LimitQueue
+
+LimitQueue takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of = or !=. (It defaults to =).
+VALUE is a queue id. 
+
+=cut
+
+sub LimitQueue {
+    my $self = shift;
+    my %args = (VALUE => undef,
+               OPERATOR => '=',
+               @_);
+
+    #TODO  VALUE should also take queue names and queue objects
+    my $queue = new RT::Queue($self->CurrentUser);
+    $queue->Load($args{'VALUE'});
+    
+    #TODO check for a valid queue here
+
+    $self->Limit (FIELD => 'Queue',
+                 VALUE => $queue->id(),
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Queue ' .  $args{'OPERATOR'}. " ". $queue->Name
+                );
+    
+}
+# }}}
+
+# {{{ sub LimitStatus
+
+=head2 LimitStatus
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of = or !=.
+VALUE is a status.
+
+=cut
+
+sub LimitStatus {
+    my $self = shift;
+    my %args = ( OPERATOR => '=',
+                  @_);
+    $self->Limit (FIELD => 'Status',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Status ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+
+# {{{ sub LimitType
+
+=head2 LimitType
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of = or !=, it defaults to "=".
+VALUE is a string to search for in the type of the ticket.
+
+=cut
+
+sub LimitType {
+    my $self = shift;
+    my %args = (OPERATOR => '=',
+               VALUE => undef,
+               @_);
+    $self->Limit (FIELD => 'Type',
+                  VALUE => $args{'VALUE'},
+                  OPERATOR => $args{'OPERATOR'},
+                  DESCRIPTION => 'Type ' .  $args{'OPERATOR'}. " ". $args{'Limit'},
+                 );
+}
+
+# }}}
+
+# }}}
+
+# {{{ Limit by string field
+
+# {{{ sub LimitSubject
+
+=head2 LimitSubject
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of = or !=.
+VALUE is a string to search for in the subject of the ticket.
+
+=cut
+
+sub LimitSubject {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'Subject',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Subject ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+
+# }}}
+
+# {{{ Limit based on ticket numerical attributes
+# Things that can be > < = !=
+
+# {{{ sub LimitId
+
+=head2 LimitId
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, >, < or !=.
+VALUE is a ticket Id to search for
+
+=cut
+
+sub LimitId {
+    my $self = shift;
+    my %args = (OPERATOR => '=',
+                @_);
+    
+    $self->Limit (FIELD => 'id',
+                  VALUE => $args{'VALUE'},
+                  OPERATOR => $args{'OPERATOR'},
+                  DESCRIPTION => 'Id ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                 );
+}
+
+# }}}
+
+# {{{ sub LimitPriority
+
+=head2 LimitPriority
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, >, < or !=.
+VALUE is a value to match the ticket\'s priority against
+
+=cut
+
+sub LimitPriority {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'Priority',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Priority ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+
+# {{{ sub LimitInitialPriority
+
+=head2 LimitInitialPriority
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, >, < or !=.
+VALUE is a value to match the ticket\'s initial priority against
+
+
+=cut
+
+sub LimitInitialPriority {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'InitialPriority',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Initial Priority ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+
+# {{{ sub LimitFinalPriority
+
+=head2 LimitFinalPriority
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, >, < or !=.
+VALUE is a value to match the ticket\'s final priority against
+
+=cut
+
+sub LimitFinalPriority {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'FinalPriority',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Final Priority ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+
+# {{{ sub LimitTimeWorked
+
+=head2 LimitTimeWorked
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, >, < or !=.
+VALUE is a value to match the ticket's TimeWorked attribute
+
+=cut
+
+sub LimitTimeWorked {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'TimeWorked',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Time worked ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+
+# {{{ sub LimitTimeLeft
+
+=head2 LimitTimeLeft
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, >, < or !=.
+VALUE is a value to match the ticket's TimeLeft attribute
+
+=cut
+
+sub LimitTimeLeft {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'TimeLeft',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Time left ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+
+# }}}
+
+# {{{ Limiting based on attachment attributes
+
+# {{{ sub LimitContent
+
+=head2 LimitContent
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, LIKE, NOT LIKE or !=.
+VALUE is a string to search for in the body of the ticket
+
+=cut
+sub LimitContent {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'Content',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Ticket content ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+
+# }}}
+# {{{ sub LimitContentType
+
+=head2 LimitContentType
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of =, LIKE, NOT LIKE or !=.
+VALUE is a content type to search ticket attachments for
+
+=cut
+  
+sub LimitContentType {
+    my $self = shift;
+    my %args = (@_);
+    $self->Limit (FIELD => 'ContentType',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Ticket content type ' .  $args{'OPERATOR'}. " ". $args{'VALUE'},
+                );
+}
+# }}}
+
+# }}}
+
+# {{{ Limiting based on people
+
+# {{{ sub LimitOwner
+
+=head2 LimitOwner
+
+Takes a paramhash with the fields OPERATOR and VALUE.
+OPERATOR is one of = or !=.
+VALUE is a user id.
+
+=cut
+
+sub LimitOwner {
+    my $self = shift;
+    my %args = ( OPERATOR => '=',
+                 @_);
+    
+    my $owner = new RT::User($self->CurrentUser);
+    $owner->Load($args{'VALUE'});
+    $self->Limit (FIELD => 'Owner',
+                 VALUE => $owner->Id,
+                 OPERATOR => $args{'OPERATOR'},
+                 DESCRIPTION => 'Owner ' .  $args{'OPERATOR'}. " ". $owner->Name()
+                );
+    
+}
+
+# }}}
+
+# {{{ Limiting watchers
+
+# {{{ sub LimitWatcher
+
+
+=head2 LimitWatcher
+  
+  Takes a paramhash with the fields OPERATOR, TYPE and VALUE.
+  OPERATOR is one of =, LIKE, NOT LIKE or !=.
+  VALUE is a value to match the ticket\'s watcher email addresses against
+  TYPE is the sort of watchers you want to match against. Leave it undef if you want to search all of them
+
+=cut
+   
+sub LimitWatcher {
+    my $self = shift;
+    my %args = ( OPERATOR => '=',
+                VALUE => undef,
+                TYPE => undef,
+               @_);
+
+
+    #build us up a description
+    my ($watcher_type, $desc);
+    if ($args{'TYPE'}) {
+       $watcher_type = $args{'TYPE'};
+    }
+    else {
+       $watcher_type = "Watcher";
+    }
+    $desc = "$watcher_type ".$args{'OPERATOR'}." ".$args{'VALUE'};
+
+
+    $self->Limit (FIELD => 'Watcher',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+                 TYPE => $args{'TYPE'},
+                 DESCRIPTION => "$desc"
+                );
+}
+
+# }}}
+
+# {{{ sub LimitRequestor
+
+=head2 LimitRequestor
+
+It\'s like LimitWatcher, but it presets TYPE to Requestor
+
+=cut
+
+
+sub LimitRequestor {
+    my $self = shift;
+    $self->LimitWatcher(TYPE=> 'Requestor', @_);
+}
+
+# }}}
+
+# {{{ sub LimitCc
+
+=head2 LimitCC
+
+It\'s like LimitWatcher, but it presets TYPE to Cc
+
+=cut
+
+sub LimitCc {
+    my $self = shift;
+    $self->LimitWatcher(TYPE=> 'Cc', @_);
+}
+
+# }}}
+
+# {{{ sub LimitAdminCc
+
+=head2 LimitAdminCc
+
+It\'s like LimitWatcher, but it presets TYPE to AdminCc
+
+=cut
+  
+sub LimitAdminCc {
+    my $self = shift;
+    $self->LimitWatcher(TYPE=> 'AdminCc', @_);
+}
+
+# }}}
+
+# }}}
+
+# }}}
+
+# {{{ Limiting based on links
+
+# {{{ LimitLinkedTo
+
+=head2 LimitLinkedTo
+
+LimitLinkedTo takes a paramhash with two fields: TYPE and TARGET
+TYPE limits the sort of relationship we want to search on
+
+TARGET is the id or URI of the TARGET of the link
+(TARGET used to be 'TICKET'.  'TICKET' is deprecated, but will be treated as TARGET
+
+=cut
+
+sub LimitLinkedTo {
+    my $self = shift;
+    my %args = ( 
+               TICKET => undef,
+               TARGET => undef,
+               TYPE => undef,
+                @_);
+
+
+    $self->Limit( FIELD => 'LinkedTo',
+                 BASE => undef,
+                 TARGET => ($args{'TARGET'} || $args{'TICKET'}),
+                 TYPE => $args{'TYPE'},
+                 DESCRIPTION => "Tickets ".$args{'TYPE'}." by ".($args{'TARGET'} || $args{'TICKET'})
+               );
+}
+
+
+# }}}
+
+# {{{ LimitLinkedFrom
+
+=head2 LimitLinkedFrom
+
+LimitLinkedFrom takes a paramhash with two fields: TYPE and BASE
+TYPE limits the sort of relationship we want to search on
+
+
+BASE is the id or URI of the BASE of the link
+(BASE used to be 'TICKET'.  'TICKET' is deprecated, but will be treated as BASE
+
+
+=cut
+
+sub LimitLinkedFrom {
+    my $self = shift;
+    my %args = ( BASE => undef,
+                TICKET => undef,
+                TYPE => undef,
+                @_);
+
+    
+    $self->Limit( FIELD => 'LinkedTo',
+                 TARGET => undef,
+                 BASE => ($args{'BASE'} || $args{'TICKET'}),
+                 TYPE => $args{'TYPE'},
+                 DESCRIPTION => "Tickets " .($args{'BASE'} || $args{'TICKET'}) ." ".$args{'TYPE'}
+               );
+}
+
+
+# }}}
+
+# {{{ LimitMemberOf 
+sub LimitMemberOf {
+    my $self = shift;
+    my $ticket_id = shift;
+    $self->LimitLinkedTo ( TARGET=> "$ticket_id",
+                          TYPE => 'MemberOf',
+                         );
+    
+}
+# }}}
+
+# {{{ LimitHasMember
+sub LimitHasMember {
+    my $self = shift;
+    my $ticket_id =shift;
+    $self->LimitLinkedFrom ( BASE => "$ticket_id",
+                            TYPE => 'MemberOf',
+                            );
+    
+}
+# }}}
+
+# {{{ LimitDependsOn
+
+sub LimitDependsOn {
+    my $self = shift;
+    my $ticket_id = shift;
+    $self->LimitLinkedTo ( TARGET => "$ticket_id",
+                           TYPE => 'DependsOn',
+                          );
+    
+}
+
+# }}}
+
+# {{{ LimitDependedOnBy
+
+sub LimitDependedOnBy {
+    my $self = shift;
+    my $ticket_id = shift;
+    $self->LimitLinkedFrom (  BASE => "$ticket_id",
+                               TYPE => 'DependsOn',
+                            );
+    
+}
+
+# }}}
+
+
+# {{{ LimitRefersTo
+
+sub LimitRefersTo {
+    my $self = shift;
+    my $ticket_id = shift;
+    $self->LimitLinkedTo ( TARGET => "$ticket_id",
+                           TYPE => 'RefersTo',
+                          );
+    
+}
+
+# }}}
+
+# {{{ LimitReferredToBy
+
+sub LimitReferredToBy {
+    my $self = shift;
+    my $ticket_id = shift;
+    $self->LimitLinkedFrom (  BASE=> "$ticket_id",
+                               TYPE => 'RefersTo',
+                            );
+    
+}
+
+# }}}
+
+# }}}
+
+# {{{ limit based on ticket date attribtes
+
+# {{{ sub LimitDate
+
+=head2 LimitDate (FIELD => 'DateField', OPERATOR => $oper, VALUE => $ISODate)
+
+Takes a paramhash with the fields FIELD OPERATOR and VALUE.
+
+OPERATOR is one of > or < 
+VALUE is a date and time in ISO format in GMT
+FIELD is one of Starts, Started, Told, Created, Resolved, LastUpdated
+
+There are also helper functions of the form LimitFIELD that eliminate
+the need to pass in a FIELD argument.
+
+=cut
+
+sub LimitDate {
+    my $self = shift;
+    my %args = (
+                  FIELD => undef,
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+
+                  @_);
+
+    #Set the description if we didn't get handed it above
+    unless ($args{'DESCRIPTION'} ) {
+       $args{'DESCRIPTION'} = $args{'FIELD'} . " " .$args{'OPERATOR'}. " ". $args{'VALUE'} . " GMT"
+    }
+
+    $self->Limit (%args);
+
+}
+
+# }}}
+
+
+
+
+sub LimitCreated {
+    my $self = shift;
+    $self->LimitDate( FIELD => 'Created', @_);
+}
+sub LimitDue {
+    my $self = shift;
+    $self->LimitDate( FIELD => 'Due', @_);
+
+}
+sub LimitStarts {
+    my $self = shift;
+    $self->LimitDate( FIELD => 'Starts', @_);
+
+}
+sub LimitStarted {
+    my $self = shift;
+    $self->LimitDate( FIELD => 'Started', @_);
+}
+sub LimitResolved { 
+    my $self = shift;
+    $self->LimitDate( FIELD => 'Resolved', @_);
+}
+sub LimitTold {
+    my $self = shift;
+    $self->LimitDate( FIELD => 'Told', @_);
+}
+sub LimitLastUpdated {
+    my $self = shift;
+    $self->LimitDate( FIELD => 'LastUpdated', @_);
+}
+#
+# {{{ sub LimitTransactionDate
+
+=head2 LimitTransactionDate (OPERATOR => $oper, VALUE => $ISODate)
+
+Takes a paramhash with the fields FIELD OPERATOR and VALUE.
+
+OPERATOR is one of > or < 
+VALUE is a date and time in ISO format in GMT
+
+
+=cut
+
+sub LimitTransactionDate {
+    my $self = shift;
+    my %args = (
+                  FIELD => 'TransactionDate',
+                 VALUE => $args{'VALUE'},
+                 OPERATOR => $args{'OPERATOR'},
+
+                  @_);
+
+    #Set the description if we didn't get handed it above
+    unless ($args{'DESCRIPTION'} ) {
+       $args{'DESCRIPTION'} = $args{'FIELD'} . " " .$args{'OPERATOR'}. " ". $args{'VALUE'} . " GMT"
+    }
+
+    $self->Limit (%args);
+
+}
+
+# }}}
+
+# }}}
+
+# {{{ sub LimitKeyword
+
+=head2 LimitKeyword 
+
+Takes a paramhash of key/value pairs with the following keys:
+
+=over 4
+
+=item KEYWORDSELECT - KeywordSelect id
+
+=item OPERATOR - (for KEYWORD only - KEYWORDSELECT operator is always `=')
+
+=item KEYWORD - Keyword id
+
+=back
+
+=cut
+
+sub LimitKeyword {
+    my $self = shift;
+    my %args = ( KEYWORD => undef,
+                 KEYWORDSELECT => undef,
+                OPERATOR => '=',
+                DESCRIPTION => undef,
+                FIELD => 'Keyword',
+                QUOTEVALUE => 1,
+                @_
+              );
+
+    use RT::KeywordSelect;
+    my $KeywordSelect = RT::KeywordSelect->new($self->CurrentUser);
+    $KeywordSelect->Load($args{KEYWORDSELECT});
+    
+
+    # Below, We're checking to see whether the keyword we're searching for
+    # is null or not.
+    # This could probably be rewritten to be easier to read and  understand
+
+    
+    #If we are looking to compare with a null value.
+    if ($args{'OPERATOR'} =~ /is/i)  {
+       if ($args{'OPERATOR'} =~ /^is$/i) {
+           $args{'DESCRIPTION'} ||= "Keyword Selection ". $KeywordSelect->Name . " has no value";
+       }
+       elsif ($args{'OPERATOR'} =~ /^is not$/i) {
+           $args{'DESCRIPTION'} ||= "Keyword Selection ". $KeywordSelect->Name . " has a value";
+       }
+    }
+       # if we're not looking to compare with a null value
+    else {     
+        use RT::Keyword;
+       my $Keyword = RT::Keyword->new($self->CurrentUser);
+       $Keyword->Load($args{KEYWORD});
+       $args{'DESCRIPTION'} ||= "Keyword Selection " . $KeywordSelect->Name.  " $args{OPERATOR} ". $Keyword->Name;
+    }
+    
+    $args{SingleValued} = $KeywordSelect->Single();
+    
+    my $index = $self->_NextIndex;
+    %{$self->{'TicketRestrictions'}{$index}} = %args;
+    
+    $self->{'RecalcTicketLimits'} = 1;
+    return ($index);
+}
+
+# }}}
+
+# {{{ sub _NextIndex
+
+=head2 _NextIndex
+
+Keep track of the counter for the array of restrictions
+
+=cut
+
+sub _NextIndex {
+    my $self = shift;
+    return ($self->{'restriction_index'}++);
+}
+# }}}
+
+# }}} 
+
+# {{{ Core bits to make this a DBIx::SearchBuilder object
+
+# {{{ sub _Init 
+sub _Init  {
+    my $self = shift;
+    $self->{'table'} = "Tickets";
+    $self->{'RecalcTicketLimits'} = 1;
+    $self->{'looking_at_effective_id'} = 0;
+    $self->{'restriction_index'} =1;
+    $self->{'primary_key'} = "id";
+    $self->SUPER::_Init(@_);
+
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+  my $self = shift;
+  return(RT::Ticket->new($self->CurrentUser));
+
+}
+# }}}
+
+# {{{ sub Count
+sub Count {
+  my $self = shift;
+  $self->_ProcessRestrictions if ($self->{'RecalcTicketLimits'} == 1 );
+  return($self->SUPER::Count());
+}
+# }}}
+
+# {{{ sub ItemsArrayRef
+
+=head2 ItemsArrayRef
+
+Returns a reference to the set of all items found in this search
+
+=cut
+
+sub ItemsArrayRef {
+    my $self = shift;
+    my @items;
+    
+    my $placeholder = $self->_ItemsCounter;
+    $self->GotoFirstItem();
+    while (my $item = $self->Next) { 
+       push (@items, $item);
+    }
+    
+    $self->GotoItem($placeholder);
+    return(\@items);
+}
+# }}}
+
+# {{{ sub Next 
+sub Next {
+       my $self = shift;
+       
+       $self->_ProcessRestrictions if ($self->{'RecalcTicketLimits'} == 1 );
+
+       my $Ticket = $self->SUPER::Next();
+       if ((defined($Ticket)) and (ref($Ticket))) {
+
+           #Make sure we _never_ show dead tickets
+           #TODO we should be doing this in the where clause.
+           #but you can't do multiple clauses on the same field just yet :/
+
+           if ($Ticket->Status eq 'dead') {
+               return($self->Next());
+           }
+           elsif ($Ticket->CurrentUserHasRight('ShowTicket')) {
+               return($Ticket);
+           }
+
+           #If the user doesn't have the right to show this ticket
+           else {      
+               return($self->Next());
+           }
+       }
+       #if there never was any ticket
+       else {
+               return(undef);
+       }       
+
+}
+# }}}
+
+# }}}
+
+# {{{ Deal with storing and restoring restrictions
+
+# {{{ sub LoadRestrictions
+
+=head2 LoadRestrictions
+
+LoadRestrictions takes a string which can fully populate the TicketRestrictons hash.
+TODO It is not yet implemented
+
+=cut
+
+# }}}
+
+# {{{ sub DescribeRestrictions
+
+=head2 DescribeRestrictions
+
+takes nothing.
+Returns a hash keyed by restriction id. 
+Each element of the hash is currently a one element hash that contains DESCRIPTION which
+is a description of the purpose of that TicketRestriction
+
+=cut
+
+sub DescribeRestrictions  {
+    my $self = shift;
+    
+    my ($row, %listing);
+    
+    foreach $row (keys %{$self->{'TicketRestrictions'}}) {
+       $listing{$row} = $self->{'TicketRestrictions'}{$row}{'DESCRIPTION'};
+    }
+    return (%listing);
+}
+# }}}
+
+# {{{ sub RestrictionValues
+
+=head2 RestrictionValues FIELD
+
+Takes a restriction field and returns a list of values this field is restricted
+to.
+
+=cut
+
+sub RestrictionValues {
+    my $self = shift;
+    my $field = shift;
+    map $self->{'TicketRestrictions'}{$_}{'VALUE'},
+      grep {
+             $self->{'TicketRestrictions'}{$_}{'FIELD'} eq $field
+             && $self->{'TicketRestrictions'}{$_}{'OPERATOR'} eq "="
+           }
+        keys %{$self->{'TicketRestrictions'}};
+}
+
+# }}}
+
+# {{{ sub ClearRestrictions
+
+=head2 ClearRestrictions
+
+Removes all restrictions irretrievably
+
+=cut
+  
+sub ClearRestrictions {
+    my $self = shift;
+    delete $self->{'TicketRestrictions'};
+    $self->{'looking_at_effective_id'} = 0;
+    $self->{'RecalcTicketLimits'} =1;
+}
+
+# }}}
+
+# {{{ sub DeleteRestriction
+
+=head2 DeleteRestriction
+
+Takes the row Id of a restriction (From DescribeRestrictions' output, for example.
+Removes that restriction from the session's limits.
+
+=cut
+
+
+sub DeleteRestriction {
+    my $self = shift;
+    my $row = shift;
+    delete $self->{'TicketRestrictions'}{$row};
+    
+    $self->{'RecalcTicketLimits'} = 1;
+    #make the underlying easysearch object forget all its preconceptions
+}
+
+# }}}
+
+# {{{ sub _ProcessRestrictions 
+
+sub _ProcessRestrictions {
+    my $self = shift;
+
+    #Need to clean the EasySearch slate because it makes things too sticky
+    $self->CleanSlate();
+
+    #Blow away ticket aliases since we'll need to regenerate them for a new search
+    delete $self->{'TicketAliases'};
+    delete $self->{KeywordsAliases};
+
+    my $row;
+    
+    foreach $row (keys %{$self->{'TicketRestrictions'}}) {
+        my $restriction = $self->{'TicketRestrictions'}{$row};
+       # {{{ if it's an int
+       
+       if ($TYPES{$restriction->{'FIELD'}} eq 'INT' ) {
+           if ($restriction->{'OPERATOR'} =~ /^(=|!=|>|<|>=|<=)$/) {
+               $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                             ENTRYAGGREGATOR => 'AND',
+                             OPERATOR => $restriction->{'OPERATOR'},
+                             VALUE => $restriction->{'VALUE'},
+                             );
+           }
+       }
+       # }}}
+       # {{{ if it's an enum
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'ENUM') {
+           
+           if ($restriction->{'OPERATOR'} eq '=') {
+               $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                             ENTRYAGGREGATOR => 'OR',
+                             OPERATOR => '=',
+                             VALUE => $restriction->{'VALUE'},
+                           );
+           }
+           elsif ($restriction->{'OPERATOR'} eq '!=') {
+               $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                             ENTRYAGGREGATOR => 'AND',
+                             OPERATOR => '!=',
+                             VALUE => $restriction->{'VALUE'},
+                           );
+           }
+           
+       }
+       # }}}
+       # {{{ if it's a date
+
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'DATE') {
+           $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                                ENTRYAGGREGATOR => 'AND',
+                                OPERATOR => $restriction->{'OPERATOR'},
+                                VALUE => $restriction->{'VALUE'},
+                              );
+       }
+       # }}}
+       # {{{ if it's a string
+
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'STRING') {
+           
+           if ($restriction->{'OPERATOR'} eq '=') {
+               $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                             ENTRYAGGREGATOR => 'OR',
+                             OPERATOR => '=',
+                             VALUE => $restriction->{'VALUE'},
+                             CASESENSITIVE => 0
+                           );
+           }
+           elsif ($restriction->{'OPERATOR'} eq '!=') {
+               $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                             ENTRYAGGREGATOR => 'AND',
+                             OPERATOR => '!=',
+                             VALUE => $restriction->{'VALUE'},
+                             CASESENSITIVE => 0
+                           );
+           }
+           elsif ($restriction->{'OPERATOR'} eq 'LIKE') {
+               $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                             ENTRYAGGREGATOR => 'AND',
+                             OPERATOR => 'LIKE',
+                             VALUE => $restriction->{'VALUE'},
+                             CASESENSITIVE => 0
+                           );
+           }
+           elsif ($restriction->{'OPERATOR'} eq 'NOT LIKE') {
+               $self->SUPER::Limit( FIELD => $restriction->{'FIELD'},
+                             ENTRYAGGREGATOR => 'AND',
+                             OPERATOR => 'NOT LIKE',
+                             VALUE => $restriction->{'VALUE'},
+                             CASESENSITIVE => 0
+                           );
+           }
+       }
+
+       # }}}
+       # {{{ if it's Transaction content that we're hunting for
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'TRANSFIELD') {
+
+           #Basically, we want to make sure that the limits apply to the same attachment,
+           #rather than just another attachment for the same ticket, no matter how many 
+           #clauses we lump on. 
+           #We put them in TicketAliases so that they get nuked when we redo the join.
+           
+           unless (defined $self->{'TicketAliases'}{'TransFieldAlias'}) {
+               $self->{'TicketAliases'}{'TransFieldAlias'} = $self->NewAlias ('Transactions');
+           }
+           unless (defined $self->{'TicketAliases'}{'TransFieldAttachAlias'}){
+               $self->{'TicketAliases'}{'TransFieldAttachAlias'} = $self->NewAlias('Attachments');
+               
+           }
+           #Join transactions to attachments
+           $self->Join( ALIAS1 => $self->{'TicketAliases'}{'TransFieldAttachAlias'},  
+                        FIELD1 => 'TransactionId',
+                        ALIAS2 => $self->{'TicketAliases'}{'TransFieldAlias'}, FIELD2=> 'id');
+           
+           #Join transactions to tickets
+           $self->Join( ALIAS1 => 'main', FIELD1 => $self->{'primary_key'},
+                        ALIAS2 =>$self->{'TicketAliases'}{'TransFieldAlias'}, FIELD2 => 'Ticket');
+           
+           #Search for the right field
+           $self->SUPER::Limit(ALIAS => $self->{'TicketAliases'}{'TransFieldAttachAlias'},
+                                 ENTRYAGGREGATOR => 'AND',
+                                 FIELD =>    $restriction->{'FIELD'},
+                                 OPERATOR => $restriction->{'OPERATOR'} ,
+                                 VALUE =>    $restriction->{'VALUE'},
+                                 CASESENSITIVE => 0
+                               );
+           
+
+       }
+
+       # }}}
+       # {{{ if it's a Transaction date that we're hunting for
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'TRANSDATE') {
+
+           #Basically, we want to make sure that the limits apply to the same attachment,
+           #rather than just another attachment for the same ticket, no matter how many 
+           #clauses we lump on. 
+           #We put them in TicketAliases so that they get nuked when we redo the join.
+           
+           unless (defined $self->{'TicketAliases'}{'TransFieldAlias'}) {
+               $self->{'TicketAliases'}{'TransFieldAlias'} = $self->NewAlias ('Transactions');
+           }
+
+           #Join transactions to tickets
+           $self->Join( ALIAS1 => 'main', FIELD1 => $self->{'primary_key'},
+                        ALIAS2 =>$self->{'TicketAliases'}{'TransFieldAlias'}, FIELD2 => 'Ticket');
+           
+           #Search for the right field
+           $self->SUPER::Limit(ALIAS => $self->{'TicketAliases'}{'TransFieldAlias'},
+                               ENTRYAGGREGATOR => 'AND',
+                               FIELD =>    'Created',
+                               OPERATOR => $restriction->{'OPERATOR'} ,
+                               VALUE =>    $restriction->{'VALUE'} );
+       }
+
+       # }}}
+       # {{{ if it's a relationship that we're hunting for
+       
+       # Takes FIELD: which is something like "LinkedTo"
+       # takes TARGET or BASE which is the TARGET or BASE id that we're searching for
+       # takes TYPE which is the type of link we're looking for.
+
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'LINKFIELD') {
+
+           
+           my $LinkAlias = $self->NewAlias ('Links');
+
+           
+           #Make sure we get the right type of link, if we're restricting it
+           if ($restriction->{'TYPE'}) {
+               $self->SUPER::Limit(ALIAS => $LinkAlias,
+                                   ENTRYAGGREGATOR => 'AND',
+                                   FIELD =>   'Type',
+                                   OPERATOR => '=',
+                                   VALUE =>    $restriction->{'TYPE'} );
+           }
+           
+           #If we're trying to limit it to things that are target of
+           if ($restriction->{'TARGET'}) {
+               
+
+               # If the TARGET is an integer that means that we want to look at the LocalTarget
+               # field. otherwise, we want to look at the "Target" field
+
+               my ($matchfield);
+               if ($restriction->{'TARGET'} =~/^(\d+)$/) {
+                   $matchfield = "LocalTarget";
+               }       
+               else {
+                   $matchfield = "Target";
+               }       
+
+               $self->SUPER::Limit(ALIAS => $LinkAlias,
+                                   ENTRYAGGREGATOR => 'AND',
+                                   FIELD =>   $matchfield,
+                                   OPERATOR => '=',
+                                   VALUE =>    $restriction->{'TARGET'} );
+
+               
+               #If we're searching on target, join the base to ticket.id
+               $self->Join( ALIAS1 => 'main', FIELD1 => $self->{'primary_key'},
+                            ALIAS2 => $LinkAlias,
+                            FIELD2 => 'LocalBase');
+
+           
+
+
+           }
+           #If we're trying to limit it to things that are base of
+           elsif ($restriction->{'BASE'}) {
+
+
+               # If we're trying to match a numeric link, we want to look at LocalBase,
+               # otherwise we want to look at "Base"
+
+               my ($matchfield);
+               if ($restriction->{'BASE'} =~/^(\d+)$/) {
+                   $matchfield = "LocalBase";
+               }       
+               else {
+                   $matchfield = "Base";
+               }       
+
+
+               $self->SUPER::Limit(ALIAS => $LinkAlias,
+                                   ENTRYAGGREGATOR => 'AND',
+                                   FIELD => $matchfield,
+                                   OPERATOR => '=',
+                                   VALUE =>    $restriction->{'BASE'} );
+               
+               #If we're searching on base, join the target to ticket.id
+               $self->Join( ALIAS1 => 'main', FIELD1 => $self->{'primary_key'},
+                            ALIAS2 => $LinkAlias,
+                            FIELD2 => 'LocalTarget');
+               
+           }
+
+       }
+               
+       # }}}
+       # {{{ if it's a watcher that we're hunting for
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'WATCHERFIELD') {
+
+           my $Watch = $self->NewAlias('Watchers');
+
+           #Join watchers to users
+           my $User = $self->Join( TYPE => 'left',
+                                    ALIAS1 => $Watch, 
+                                    FIELD1 => 'Owner',
+                                    TABLE2 => 'Users', 
+                                    FIELD2 => 'id',
+                                  );
+
+           #Join Ticket to watchers
+           $self->Join( ALIAS1 => 'main', FIELD1 => 'id',
+                        ALIAS2 => $Watch, FIELD2 => 'Value');
+
+
+           #Make sure we're only talking about ticket watchers
+           $self->SUPER::Limit( ALIAS => $Watch,
+                                FIELD => 'Scope',
+                                VALUE => 'Ticket',
+                                OPERATOR => '=');
+
+
+           # Find email address watchers
+           $self->SUPER::Limit( SUBCLAUSE => 'WatcherEmailAddress',
+                                ALIAS => $Watch,
+                                FIELD => 'Email',
+                                ENTRYAGGREGATOR => 'OR',
+                                VALUE => $restriction->{'VALUE'},
+                                OPERATOR => $restriction->{'OPERATOR'},
+                                CASESENSITIVE => 0
+                       );
+
+
+
+           #Find user watchers
+           $self->SUPER::Limit(
+                               SUBCLAUSE => 'WatcherEmailAddress',
+                               ALIAS => $User,
+                               FIELD => 'EmailAddress',
+                               ENTRYAGGREGATOR => 'OR',
+                               VALUE => $restriction->{'VALUE'},
+                               OPERATOR => $restriction->{'OPERATOR'},
+                               CASESENSITIVE => 0
+                              );
+
+           
+           #If we only want a specific type of watchers, then limit it to that
+           if ($restriction->{'TYPE'}) {
+               $self->SUPER::Limit( ALIAS => $Watch,
+                                    FIELD => 'Type',
+                                    ENTRYAGGREGATOR => 'OR',
+                                    VALUE => $restriction->{'TYPE'},
+                                    OPERATOR => '=');
+           }
+       }
+
+       # }}}
+       # {{{ if it's a keyword
+       elsif ($TYPES{$restriction->{'FIELD'}} eq 'KEYWORDFIELD') {
+           my $null_columns_ok;
+
+            my $ObjKeywordsAlias;
+           $ObjKeywordsAlias = $self->{KeywordsAliases}{$restriction->{'KEYWORDSELECT'}}
+             if $restriction->{SingleValued};
+           unless (defined $ObjKeywordsAlias) {
+             $ObjKeywordsAlias = $self->Join(
+                                              TYPE => 'left',
+                                              ALIAS1 => 'main',
+                                              FIELD1 => 'id',
+                                              TABLE2 => 'ObjectKeywords',
+                                              FIELD2 => 'ObjectId'
+                                             );
+             if ($restriction->{'SingleValued'}) {
+               $self->{KeywordsAliases}{$restriction->{'KEYWORDSELECT'}} 
+                 = $ObjKeywordsAlias;
+             }
+           }
+
+         
+            $self->SUPER::Limit(
+                               ALIAS => $ObjKeywordsAlias,
+                               FIELD => 'Keyword',
+                               OPERATOR => $restriction->{'OPERATOR'},
+                               VALUE => $restriction->{'KEYWORD'},
+                               QUOTEVALUE => $restriction->{'QUOTEVALUE'},
+                               ENTRYAGGREGATOR => 'OR',
+                               );
+           
+            if  ( ($restriction->{'OPERATOR'} =~ /^IS$/i) or 
+                 ($restriction->{'OPERATOR'} eq '!=') ) {
+               
+               $null_columns_ok=1;
+
+           } 
+
+           #If we're trying to find tickets where the keyword isn't somethng, also check ones where it _IS_ null
+           if ( $restriction->{'OPERATOR'} eq '!=') {
+               $self->SUPER::Limit(
+                                   ALIAS => $ObjKeywordsAlias,
+                                   FIELD => 'Keyword',
+                                   OPERATOR => 'IS',
+                                   VALUE => 'NULL',
+                                   QUOTEVALUE => 0,
+                                   ENTRYAGGREGATOR => 'OR',
+                                  );
+             }
+
+
+            $self->SUPER::Limit(LEFTJOIN => $ObjKeywordsAlias,
+                               FIELD => 'KeywordSelect',
+                               VALUE => $restriction->{'KEYWORDSELECT'},
+                               ENTRYAGGREGATOR => 'OR');
+
+
+            $self->SUPER::Limit( ALIAS => $ObjKeywordsAlias,
+                                 FIELD => 'ObjectType',
+                                 VALUE => 'Ticket',
+                                 ENTRYAGGREGATOR => 'AND');
+           
+           if ($null_columns_ok) {
+                $self->SUPER::Limit(ALIAS => $ObjKeywordsAlias,
+                                    FIELD => 'ObjectType',
+                                   OPERATOR => 'IS',
+                                    VALUE => 'NULL',
+                                   QUOTEVALUE => 0,
+                                    ENTRYAGGREGATOR => 'OR');
+           }
+          
+        }
+        # }}}
+
+    
+     }
+
+     
+     # here, we make sure we don't get any tickets that have been merged  into other tickets
+     # (Ticket Id == Ticket EffectiveId
+     # note that we _really_ don't want to do this if we're already looking at the effectiveid
+     if ($self->_isLimited && (! $self->{'looking_at_effective_id'})) {
+        $self->SUPER::Limit( FIELD => 'EffectiveId', 
+              OPERATOR => '=',
+              QUOTEVALUE => 0,
+              VALUE => 'main.id');   #TODO, we shouldn't be hard coding the tablename to main.
+      } 
+    $self->{'RecalcTicketLimits'} = 0;
+}
+
+# }}}
+
+# }}}
+
+# {{{ Deal with displaying rows of the listing 
+
+#
+#  Everything in this section is stub code for 2.2
+# It's not part of the API. It's not for your use
+# It's not for our use.
+#
+
+
+# {{{ sub SetListingFormat
+
+=head2 SetListingFormat
+
+Takes a single Format string as specified below. parses that format string and makes the various listing output
+things DTRT.
+
+=item Format strings
+
+Format strings are made up of a chain of Elements delimited with vertical pipes (|).
+Elements of a Format string 
+
+
+FormatString:    Element[::FormatString]
+
+Element:         AttributeName[;HREF=<URL>][;TITLE=<TITLE>]
+
+AttributeName    Id | Subject | Status | Owner | Priority | InitialPriority | TimeWorked | TimeLeft |
+  
+                 Keywords[;SELECT=<KeywordSelect>] | 
+       
+                <Created|Starts|Started|Contacted|Due|Resolved>Date<AsString|AsISO|AsAge>
+
+
+=cut
+
+
+
+
+#accept a format string
+
+
+
+sub SetListingFormat {
+    my $self = shift;
+    my $listing_format = shift;
+    
+    my ($element, $attribs);
+    my $i = 0;
+    foreach $element (split (/::/,$listing_format)) {
+       if ($element =~ /^(.*?);(.*)$/) {
+           $element = $1;
+           $attribs = $2;
+       }       
+       $self->{'format_string'}->[$i]->{'Element'} = $element;
+       foreach $attrib (split (/;/, $attribs)) {
+           my $value = "";
+           if ($attrib =~ /^(.*?)=(.*)$/) {
+               $attrib = $1;
+               $value = $2;
+           }   
+           $self->{'format_string'}->[$i]->{"$attrib"} = $val;
+           
+       }
+    
+    }
+    return(1);
+}
+
+# }}}
+
+# {{{ sub HeaderAsHTML
+sub HeaderAsHTML {
+    my $self = shift;
+    my $header = "";
+    my $col;
+    foreach $col ( @{[ $self->{'format_string'} ]}) {
+       $header .= "<TH>" . $self->_ColumnTitle($self->{'format_string'}->[$col]) . "</TH>";
+       
+    }
+    return ($header);
+}
+# }}}
+
+# {{{ sub HeaderAsText
+#Print text header
+sub HeaderAsText {
+    my $self = shift;
+    my ($header);
+    
+    return ($header);
+}
+# }}}
+
+# {{{ sub TicketAsHTMLRow
+#Print HTML row
+sub TicketAsHTMLRow {
+    my $self = shift;
+    my $Ticket = shift;
+    my ($row, $col);
+    foreach $col (@{[$self->{'format_string'}]}) {
+       $row .= "<TD>" . $self->_TicketColumnValue($ticket,$self->{'format_string'}->[$col]) . "</TD>";
+       
+    }
+    return ($row);
+}
+# }}}
+
+# {{{ sub TicketAsTextRow
+#Print text row
+sub TicketAsTextRow {
+    my $self = shift;
+    my ($row);
+
+    #TODO implement
+    
+    return ($row);
+}
+# }}}
+
+# {{{ _ColumnTitle {
+
+sub _ColumnTitle {
+    my $self = shift;
+    
+    # Attrib is a hash 
+    my $attrib = shift;
+    
+    # return either attrib->{'TITLE'} or..
+    if ($attrib->{'TITLE'}) {
+       return($attrib->{'TITLE'});
+    }  
+    # failing that, Look up the title in a hash
+    else {
+       #TODO create $self->{'ColumnTitles'};
+       return ($self->{'ColumnTitles'}->{$attrib->{'Element'}});
+    }  
+    
+}
+
+# }}}
+
+# {{{ _TicketColumnValue
+sub _TicketColumnValue {
+    my $self = shift;
+    my $Ticket = shift;
+    my $attrib = shift;
+
+    
+    my $out;
+
+  SWITCH: {
+       /^id/i && do {
+           $out = $Ticket->id;
+           last SWITCH; 
+       };
+       /^subj/i && do {
+           last SWITCH; 
+           $Ticket->Subject;
+                  };   
+       /^status/i && do {
+           last SWITCH; 
+           $Ticket->Status;
+       };
+       /^prio/i && do {
+           last SWITCH; 
+           $Ticket->Priority;
+       };
+       /^finalprio/i && do {
+           
+           last SWITCH; 
+           $Ticket->FinalPriority
+       };
+       /^initialprio/i && do {
+           
+           last SWITCH; 
+           $Ticket->InitialPriority;
+       };      
+       /^timel/i && do {
+           
+           last SWITCH; 
+           $Ticket->TimeWorked;
+       };
+       /^timew/i && do {
+           
+           last SWITCH; 
+           $Ticket->TimeLeft;
+       };
+       
+       /^(.*?)date(.*)$/i && do {
+           my $o = $1;
+           my $m = $2;
+           my ($obj);
+           #TODO: optimize
+           $obj = $Ticket->DueObj         if $o =~ /due/i;
+           $obj = $Ticket->CreatedObj     if $o =~ /created/i;
+           $obj = $Ticket->StartsObj      if $o =~ /starts/i;
+           $obj = $Ticket->StartedObj     if $o =~ /started/i;
+           $obj = $Ticket->ToldObj        if $o =~ /told/i;
+           $obj = $Ticket->LastUpdatedObj if $o =~ /lastu/i;
+           
+           $method = 'ISO' if $m =~ /iso/i;
+           
+           $method = 'AsString' if $m =~ /asstring/i;
+           $method = 'AgeAsString' if $m =~ /age/i;
+           last SWITCH;
+           $obj->$method();
+             
+       };
+         
+         /^watcher/i && do {
+             last SWITCH; 
+             $Ticket->WatchersAsString();
+         };    
+       
+       /^requestor/i && do {
+           last SWITCH; 
+           $Ticket->RequestorsAsString();
+       };      
+       /^cc/i && do {
+           last SWITCH; 
+           $Ticket->CCAsString();
+       };      
+       
+       
+       /^admincc/i && do {
+           last SWITCH; 
+           $Ticket->AdminCcAsString();
+       };
+       
+       /^keywords/i && do {
+           last SWITCH; 
+           #Limit it to the keyword select we're talking about, if we've got one.
+           my $objkeys =$Ticket->KeywordsObj($attrib->{'SELECT'});
+           $objkeys->KeywordRelativePathsAsString();
+       };
+       
+    }
+      
+}
+
+# }}}
+
+# }}}
+
+# {{{ POD
+=head2 notes
+"Enum" Things that get Is, IsNot
+
+
+"Int" Things that get Is LessThan and GreaterThan
+id
+InitialPriority
+FinalPriority
+Priority
+TimeLeft
+TimeWorked
+
+"Text" Things that get Is, Like
+Subject
+TransactionContent
+
+
+"Link" OPERATORs
+
+
+"Date" OPERATORs Is, Before, After
+
+  =cut
+# }}}
+1;
diff --git a/rt/lib/RT/Transaction.pm b/rt/lib/RT/Transaction.pm
new file mode 100755 (executable)
index 0000000..ee1f069
--- /dev/null
@@ -0,0 +1,783 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Transaction.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# Copyright 1999-2001 Jesse Vincent <jesse@fsck.com>
+# Released under the terms of the GNU Public License
+
+=head1 NAME
+
+  RT::Transaction - RT\'s transaction object
+
+=head1 SYNOPSIS
+
+  use RT::Transaction;
+
+
+=head1 DESCRIPTION
+
+
+Each RT::Transaction describes an atomic change to a ticket object 
+or an update to an RT::Ticket object.
+It can have arbitrary MIME attachments.
+
+
+=head1 METHODS
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::Transaction);
+
+=end testing
+
+=cut
+
+package RT::Transaction;
+
+use RT::Record;
+@ISA= qw(RT::Record);
+    
+use RT::Attachments;
+
+# {{{ sub _Init 
+sub _Init  {
+    my $self = shift;
+  $self->{'table'} = "Transactions";
+  return ($self->SUPER::_Init(@_));
+
+}
+# }}}
+
+# {{{ sub Create 
+
+=head2 Create
+
+Create a new transaction.
+
+This routine should _never_ be called anything other Than RT::Ticket. It should not be called 
+from client code. Ever. Not ever.  If you do this, we will hunt you down. and break your kneecaps.
+Then the unpleasant stuff will start.
+
+TODO: Document what gets passed to this
+
+=cut
+
+sub Create  {
+    my $self = shift;
+    my %args = ( id => undef,
+                TimeTaken => 0,
+                Ticket => 0 ,
+                Type => 'undefined',
+                Data => '',
+                Field => undef,
+                OldValue => undef,
+                NewValue => undef,
+                MIMEObj => undef,
+                ActivateScrips => 1,
+                @_
+              );
+    
+    #if we didn't specify a ticket, we need to bail
+    unless ( $args{'Ticket'} ) {
+       return(0, "RT::Transaction->Create couldn't, as you didn't specify a ticket id");
+    }
+        
+    #lets create our transaction
+    my $id = $self->SUPER::Create(Ticket => $args{'Ticket'},
+                                 TimeTaken => $args{'TimeTaken'},
+                                 Type => $args{'Type'},
+                                 Data => $args{'Data'},
+                                 Field => $args{'Field'},
+                                 OldValue => $args{'OldValue'},
+                                 NewValue => $args{'NewValue'},
+                                 Created => $args{'Created'}
+                                );
+    $self->Load($id);
+    $self->_Attach($args{'MIMEObj'})
+      if defined $args{'MIMEObj'};
+    
+    #Provide a way to turn off scrips if we need to
+    if ($args{'ActivateScrips'}) {
+
+       #We're really going to need a non-acled ticket for the scrips to work
+       my $TicketAsSystem = RT::Ticket->new($RT::SystemUser);
+       $TicketAsSystem->Load($args{'Ticket'}) || 
+         $RT::Logger->err("$self couldn't load ticket $args{'Ticket'}\n");
+       
+       my $TransAsSystem = RT::Transaction->new($RT::SystemUser);
+       $TransAsSystem->Load($self->id) ||
+         $RT::Logger->err("$self couldn't load a copy of itself as superuser\n");
+       
+       # {{{ Deal with Scrips
+    
+    #Load a scripscopes object
+    use RT::Scrips;
+    my $PossibleScrips = RT::Scrips->new($RT::SystemUser);
+    
+    $PossibleScrips->LimitToQueue($TicketAsSystem->QueueObj->Id); #Limit it to  $Ticket->QueueObj->Id
+    $PossibleScrips->LimitToGlobal(); # or to "global"
+    my $ConditionsAlias = $PossibleScrips->NewAlias('ScripConditions');
+    
+    $PossibleScrips->Join(ALIAS1 => 'main',  FIELD1 => 'ScripCondition',
+                         ALIAS2 => $ConditionsAlias, FIELD2=> 'id');
+    
+    
+    #We only want things where the scrip applies to this sort of transaction
+    $PossibleScrips->Limit(ALIAS=> $ConditionsAlias,
+                          FIELD=>'ApplicableTransTypes',
+                          OPERATOR => 'LIKE',
+                          VALUE => $args{'Type'},
+                          ENTRYAGGREGATOR => 'OR',
+                         );
+    
+    # Or where the scrip applies to any transaction
+    $PossibleScrips->Limit(ALIAS=> $ConditionsAlias,
+                          FIELD=>'ApplicableTransTypes',
+                          OPERATOR => 'LIKE',
+                          VALUE => "Any",
+                          ENTRYAGGREGATOR => 'OR',
+                         );                        
+    
+    #Iterate through each script and check it's applicability.
+    
+    while (my $Scrip = $PossibleScrips->Next()) {
+      
+      #TODO: properly deal with errors raised in this scrip loop
+       
+      #$RT::Logger->debug("$self now dealing with ".$Scrip->Id. "\n");      
+       eval {
+         local $SIG{__DIE__} = sub { $RT::Logger->error($_[0])};
+         
+         
+         #Load the scrip's Condition object
+         $Scrip->ConditionObj->LoadCondition(TicketObj => $TicketAsSystem, 
+                                             TransactionObj => $TransAsSystem);          
+         
+         
+         #If it's applicable, prepare and commit it
+         
+       $RT::Logger->debug ("$self: Checking condition ".$Scrip->ConditionObj->Name. "...\n");
+         
+         if ( $Scrip->IsApplicable() ) {
+             
+               $RT::Logger->debug ("$self: Matches condition ".$Scrip->ConditionObj->Name. "...\n");
+             #TODO: handle some errors here
+             
+             $Scrip->ActionObj->LoadAction(TicketObj => $TicketAsSystem, 
+                                          TransactionObj => $TransAsSystem);
+         
+             
+             if ($Scrip->Prepare()) {
+                 $RT::Logger->debug("$self: Prepared " .
+                                  $Scrip->ActionObj->Name . "\n");
+                 if ($Scrip->Commit()) {
+                       $RT::Logger->debug("$self: Committed " .
+                                          $Scrip->ActionObj->Name . "\n");
+                 }
+                 else {
+                       $RT::Logger->info("$self: Failed to commit ".
+                                          $Scrip->ActionObj->Name . "\n");
+                 } 
+             }
+             else {
+                 $RT::Logger->info("$self: Failed to prepare " .
+                                    $Scrip->ActionObj->Name . "\n");
+             }
+
+             #We're done with it. lets clean up.
+             #TODO: something else isn't letting these get garbage collected. check em out.
+             $Scrip->ActionObj->DESTROY();
+             $Scrip->ConditionObj->DESTROY;
+         }
+         
+         
+       else {
+           $RT::Logger->debug ("$self: Doesn't match condition ".$Scrip->ConditionObj->Name. "...\n");
+
+           # TODO: why doesn't this catch all the ScripObjs we create. 
+           # and why do we explictly need to destroy them?
+           $Scrip->ConditionObj->DESTROY;
+       }
+      }        
+    }
+
+    # }}}
+       
+    }
+
+    return ($id, "Transaction Created");
+}
+
+# }}}
+
+# {{{ sub Delete
+
+sub Delete {
+    my $self = shift;
+    return (0, 'Deleting this object could break referential integrity');
+}
+
+# }}}
+
+# {{{ Routines dealing with Attachments
+
+# {{{ sub Message 
+
+=head2 Message
+
+  Returns the RT::Attachments Object which contains the "top-level" object
+  attachment for this transaction
+
+=cut
+
+sub Message  {
+
+    my $self = shift;
+    
+    if (!defined ($self->{'message'}) ){
+       
+       $self->{'message'} = new RT::Attachments($self->CurrentUser);
+       $self->{'message'}->Limit(FIELD => 'TransactionId',
+                                 VALUE => $self->Id);
+       
+       $self->{'message'}->ChildrenOf(0);
+    } 
+    return($self->{'message'});
+}
+# }}}
+
+# {{{ sub Content
+
+=head2 Content PARAMHASH
+
+If this transaction has attached mime objects, returns the first text/ part.
+Otherwise, returns undef.
+
+Takes a paramhash.  If the $args{'Quote'} parameter is set, wraps this message 
+at $args{'Wrap'}.  $args{'Wrap'} defaults to 70.
+
+
+=cut
+
+sub Content {
+    my $self = shift;
+    my %args = ( Quote => 0,
+                Wrap => 70,
+                @_ );
+
+    my $content = undef;
+
+    # If we don\'t have any content, return undef now.
+    unless ($self->Message->First) {
+       return (undef);
+    }  
+    
+    # Get the set of toplevel attachments to this transaction.
+    my $MIMEObj = $self->Message->First();
+    
+    # If it's a message or a plain part, just return the
+    # body. 
+    if ($MIMEObj->ContentType() =~ '^(text|message)(/|$)') {
+       $content = $MIMEObj->Content();
+    }
+    
+    # If it's a multipart object, first try returning the first 
+    # text/plain part. 
+    
+    elsif ($MIMEObj->ContentType() =~ '^multipart/') {
+       my $plain_parts = $MIMEObj->Children();
+       $plain_parts->ContentType(VALUE => 'text/plain');
+       
+       # If we actully found a part, return its content
+       if ($plain_parts->First && 
+        $plain_parts->First->Content ne '') {
+           $content = $plain_parts->First->Content;            
+       }       
+       
+       # If that fails, return the  first text/ or message/ part 
+       # which has some content.
+    
+       else {
+           my $all_parts = $MIMEObj->Children();
+           while (($content == undef) && 
+                  (my $part = $all_parts->Next)) {
+               if (($part->ContentType() =~ '^(text|message)(/|$)') and
+                   ($part->Content())) {
+                   $content = $part->Content;
+               }       
+           }
+       }       
+
+    }
+    # If all else fails, return a message that we couldn't find
+    # any content
+    else { 
+        $content = 'This transaction appears to have no content';
+    }  
+
+    if ($args{'Quote'}) {
+       # Remove quoted signature.
+       $content =~ s/\n-- \n(.*)$//s;
+
+       # What's the longest line like?
+       foreach (split (/\n/,$content)) {
+           $max=length if ( length > $max);
+       }
+
+       if ($max>76) {
+           require Text::Wrapper;
+           my $wrapper=new Text::Wrapper
+               (
+                columns => $args{'Wrap'}, 
+                body_start => ($max > 70*3 ? '   ' : ''),
+                par_start => ''
+                );
+           $content=$wrapper->wrap($content);
+       }
+
+       $content =~ s/^/> /gm;
+       $content = '[' . $self->CreatorObj->Name() . ' - ' . $self->CreatedAsString()
+                   . "]:\n\n"
+               . $content . "\n\n";
+
+    }
+
+    return ($content); 
+}
+# }}}
+
+# {{{ sub Subject
+
+=head2 Subject
+
+If this transaction has attached mime objects, returns the first one's subject
+Otherwise, returns null
+  
+=cut
+
+sub Subject {
+    my $self = shift;
+    if ($self->Message->First) {
+       return ($self->Message->First->Subject);
+    }
+    else {
+       return (undef);
+    }
+}
+# }}}
+
+# {{{ sub Attachments 
+
+=head2 Attachments
+
+  Returns all the RT::Attachment objects which are attached
+to this transaction. Takes an optional parameter, which is
+a ContentType that Attachments should be restricted to.
+
+=cut
+
+
+sub Attachments  {
+    my $self = shift;
+    my $Types = '';
+    $Types = shift if (@_);
+
+    my $Attachments = new RT::Attachments($self->CurrentUser);
+    
+    #If it's a comment, return an empty object if they don't have the right to see it
+    if ($self->Type eq 'Comment') {
+       unless ($self->CurrentUserHasRight('ShowTicketComments')) {
+           return ($Attachments);
+       }
+    }  
+    #if they ain't got rights to see, return an empty object
+    else {
+       unless ($self->CurrentUserHasRight('ShowTicket')) {
+           return ($Attachments);
+       }
+    }
+    
+    $Attachments->Limit(FIELD => 'TransactionId',
+                       VALUE => $self->Id);
+
+    # Get the attachments in the order they're put into
+    # the database.  Arguably, we should be returning a tree
+    # of attachments, not a set...but no current app seems to need
+    # it. 
+
+    $Attachments->OrderBy(ALIAS => 'main', 
+                         FIELD => 'Id',
+                         ORDER => 'asc');
+
+    if ($Types) {
+       $Attachments->ContentType( VALUE => "$Types",
+                                  OPERATOR => "LIKE");
+    }
+    
+    
+    return($Attachments);
+    
+}
+
+# }}}
+
+# {{{ sub _Attach 
+
+=head2 _Attach
+
+A private method used to attach a mime object to this transaction.
+
+=cut
+
+sub _Attach  {
+    my $self = shift;
+    my $MIMEObject = shift;
+    
+    if (!defined($MIMEObject)) {
+       $RT::Logger->error("$self _Attach: We can't attach a mime object if you don't give us one.\n");
+       return(0, "$self: no attachment specified");
+    }
+    
+  
+    use RT::Attachment;
+    my $Attachment = new RT::Attachment ($self->CurrentUser);
+    $Attachment->Create(TransactionId => $self->Id,
+                       Attachment => $MIMEObject);
+    return ($Attachment, "Attachment created");
+    
+}
+
+# }}}
+
+# }}}
+
+# {{{ Routines dealing with Transaction Attributes
+
+# {{{ sub TicketObj
+
+=head2 TicketObj
+
+Returns this transaction's ticket object.
+
+=cut
+
+sub TicketObj {
+    my $self = shift;
+    if (! exists $self->{'TicketObj'}) {
+       $self->{'TicketObj'} = new RT::Ticket($self->CurrentUser);
+       $self->{'TicketObj'}->Load($self->Ticket);
+    }
+    
+    return $self->{'TicketObj'};
+}
+# }}}
+
+# {{{ sub Description 
+
+=head2 Description
+
+Returns a text string which describes this transaction
+
+=cut
+
+
+sub Description  {
+    my $self = shift;
+
+    #Check those ACLs
+    #If it's a comment, we need to be extra special careful
+    if ($self->__Value('Type') eq 'Comment') {
+       unless ($self->CurrentUserHasRight('ShowTicketComments')) {
+           return (0, "Permission Denied");
+       }
+    }  
+
+    #if they ain't got rights to see, don't let em
+    else {
+       unless ($self->CurrentUserHasRight('ShowTicket')) {
+           return (0, "Permission Denied");
+       }
+    }
+
+    if (!defined($self->Type)) {
+       return("No transaction type specified");
+    }
+    
+    return ($self->BriefDescription . " by " . $self->CreatorObj->Name);
+}
+
+# }}}
+
+# {{{ sub BriefDescription 
+
+=head2 BriefDescription
+
+Returns a text string which briefly describes this transaction
+
+=cut
+
+
+sub BriefDescription  {
+    my $self = shift;
+
+    #Check those ACLs
+    #If it's a comment, we need to be extra special careful
+    if ($self->__Value('Type') eq 'Comment') {
+       unless ($self->CurrentUserHasRight('ShowTicketComments')) {
+           return (0, "Permission Denied");
+       }
+    }  
+
+    #if they ain't got rights to see, don't let em
+    else {
+       unless ($self->CurrentUserHasRight('ShowTicket')) {
+           return (0, "Permission Denied");
+       }
+    }
+
+    if (!defined($self->Type)) {
+       return("No transaction type specified");
+    }
+    
+    if ($self->Type eq 'Create'){
+       return("Ticket created");
+    }
+    elsif ($self->Type =~ /Status/) {
+       if ($self->Field eq 'Status') {
+           if ($self->NewValue eq 'dead') {
+               return ("Ticket killed");
+      }
+           else {
+               return( "Status changed from ".  $self->OldValue . 
+                       " to ". $self->NewValue);
+
+           }
+       }
+       # Generic:
+       return ($self->Field." changed from ".($self->OldValue||"(empty value)").
+         " to ".$self->NewValue );
+      }
+    
+    if ($self->Type eq 'Correspond')    {
+       return("Correspondence added");
+    }
+    
+    elsif ($self->Type eq 'Comment')  {
+       return( "Comments added");
+    }
+    
+    elsif ($self->Type eq 'Keyword') {
+
+       my $field = 'Keyword';
+
+       if ($self->Field) {
+           my $keywordsel = new RT::KeywordSelect ($self->CurrentUser);
+           $keywordsel->Load($self->Field);
+           $field = $keywordsel->Name();
+       }
+
+       if ($self->OldValue eq '') {
+           return ($field." ".$self->NewValue." added");
+       }
+       elsif ($self->NewValue eq '') {
+           return ($field." ".$self->OldValue." deleted"); 
+           
+       }
+       else {
+           return ($field." ".$self->OldValue . " changed to ". 
+                    $self->NewValue);
+       }       
+    }
+    
+    elsif ($self->Type eq 'Untake'){
+           return( "Untaken");
+       }
+    
+    elsif ($self->Type eq "Take") {
+       return( "Taken");
+    }
+    
+    elsif ($self->Type eq "Force") {
+        my $Old = RT::User->new($self->CurrentUser);
+        $Old->Load($self->OldValue);
+        my $New = RT::User->new($self->CurrentUser);
+        $New->Load($self->NewValue);
+       return "Owner forcibly changed from ".$Old->Name . " to ". $New->Name;
+    }
+    elsif ($self->Type eq "Steal") {
+       my $Old = RT::User->new($self->CurrentUser);
+       $Old->Load($self->OldValue);
+       return "Stolen from ".$Old->Name;
+    }
+    
+    elsif ($self->Type eq "Give") {
+       my $New = RT::User->new($self->CurrentUser);
+       $New->Load($self->NewValue);
+       return( "Given to ".$New->Name);
+    }
+    
+    elsif ($self->Type eq 'AddWatcher'){
+       return( $self->Field." ". $self->NewValue ." added");
+    }
+    
+    elsif ($self->Type eq 'DelWatcher'){
+       return( $self->Field." ".$self->OldValue ." deleted");
+    }
+    
+    elsif ($self->Type eq 'Subject') {
+       return( "Subject changed to ".$self->Data);
+    }
+    elsif ($self->Type eq 'Told') {
+       return( "User notified");
+    }
+    
+    elsif ($self->Type eq 'AddLink') {
+       return ($self->Data);
+    }
+    elsif ($self->Type eq 'DeleteLink') {
+       return ($self->Data);
+    }
+    elsif ($self->Type eq 'Set') {
+       if ($self->Field eq 'Queue') {
+           my $q1 = new RT::Queue($self->CurrentUser);
+           $q1->Load($self->OldValue);
+           my $q2 = new RT::Queue($self->CurrentUser);
+           $q2->Load($self->NewValue);
+           return ($self->Field . " changed from " . $q1->Name . " to ".
+                   $q2->Name);
+       }
+
+        # Write the date/time change at local time:                    
+    elsif ($self->Field =~  /Due|Starts|Started|Told/) {           
+        my $t1 = new RT::Date($self->CurrentUser);                 
+        $t1->Set(Format => 'ISO', Value => $self->NewValue);       
+        my $t2 = new RT::Date($self->CurrentUser);                 
+        $t2->Set(Format => 'ISO', Value => $self->OldValue);       
+        return ($self->Field . " changed from " . $t2->AsString .  
+                    " to ".$t1->AsString);      
+    }                
+       else {
+           return ($self->Field . " changed from " . $self->OldValue . 
+                   " to ".$self->NewValue);
+       }       
+    }
+    elsif ($self->Type eq 'PurgeTransaction') {
+       return ("Transaction ".$self->Data. " purged");
+    }
+    else {
+       return ("Default: ". $self->Type ."/". $self->Field . 
+               " changed from " . $self->OldValue . 
+               " to ".$self->NewValue);
+       
+    }
+}
+
+# }}}
+
+# {{{ Utility methods
+
+# {{{ sub IsInbound
+
+=head2 IsInbound
+
+Returns true if the creator of the transaction is a requestor of the ticket.
+Returns false otherwise
+
+=cut
+
+sub IsInbound {
+    my $self=shift;
+    return ($self->TicketObj->IsRequestor($self->CreatorObj));
+}
+
+# }}}
+
+# }}}
+
+# {{{ sub _Accessible 
+
+sub _Accessible  {
+  my $self = shift;
+  my %Cols = (
+             TimeTaken => 'read',
+             Ticket => 'read/public',
+             Type=> 'read',
+             Field => 'read',
+             Data => 'read',
+             NewValue => 'read',
+             OldValue => 'read',
+             Creator => 'read/auto',
+             Created => 'read/auto',
+            );
+  return $self->SUPER::_Accessible(@_, %Cols);
+}
+
+# }}}
+
+# }}}
+
+# {{{ sub _Set
+
+sub _Set {
+    my $self = shift;
+    return(0, 'Transactions are immutable');
+}
+
+# }}}
+
+# {{{ sub _Value 
+
+=head2 _Value
+
+Takes the name of a table column.
+Returns its value as a string, if the user passes an ACL check
+
+=cut
+
+sub _Value  {
+
+    my $self = shift;
+    my $field = shift;
+    
+    
+    #if the field is public, return it.
+    if ($self->_Accessible($field, 'public')) {
+       return($self->__Value($field));
+       
+    }
+    #If it's a comment, we need to be extra special careful
+    if ($self->__Value('Type') eq 'Comment') {
+       unless ($self->CurrentUserHasRight('ShowTicketComments')) {
+           return (undef);
+       }
+    }  
+    #if they ain't got rights to see, don't let em
+    else {
+       unless ($self->CurrentUserHasRight('ShowTicket')) {
+           return (undef);
+       }
+    }  
+    
+    return($self->__Value($field));
+    
+}
+
+# }}}
+
+# {{{ sub CurrentUserHasRight
+
+=head2 CurrentUserHasRight RIGHT
+
+Calls $self->CurrentUser->HasQueueRight for the right passed in here.
+passed in here.
+
+=cut
+
+sub CurrentUserHasRight {
+    my $self = shift;
+    my $right = shift;
+    return ($self->CurrentUser->HasQueueRight(Right => "$right", 
+                                              TicketObj => $self->TicketObj));            
+}
+
+# }}}
+
+1;
diff --git a/rt/lib/RT/Transactions.pm b/rt/lib/RT/Transactions.pm
new file mode 100755 (executable)
index 0000000..2ae98f2
--- /dev/null
@@ -0,0 +1,78 @@
+#$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Transactions.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+
+=head1 NAME
+
+  RT::Transactions - a collection of RT Transaction objects
+
+=head1 SYNOPSIS
+
+  use RT::Transactions;
+
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok (require RT::TestHarness);
+ok (require RT::Transactions);
+
+=end testing
+
+=cut
+
+package RT::Transactions;
+use RT::EasySearch;
+
+@ISA= qw(RT::EasySearch);
+use RT::Transaction;
+
+# {{{ sub _Init  
+sub _Init   {
+  my $self = shift;
+  
+  $self->{'table'} = "Transactions";
+  $self->{'primary_key'} = "id";
+  
+  # By default, order by the date of the transaction, rather than ID.
+  $self->OrderBy( ALIAS => 'main',
+                 FIELD => 'Created',
+                 ORDER => 'ASC');
+
+  return ( $self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub NewItem 
+sub NewItem  {
+    my $self = shift;
+    
+    return(RT::Transaction->new($self->CurrentUser));
+}
+# }}}
+
+
+=head2 example methods
+
+  Queue RT::Queue or Queue Id
+  Ticket RT::Ticket or Ticket Id
+
+
+LimitDate 
+  
+Type TRANSTYPE
+Field STRING
+OldValue OLDVAL
+NewValue NEWVAL
+Data DATA
+TimeTaken
+Actor USEROBJ/USERID
+ContentMatches STRING
+
+=cut
+
+
+1;
+
diff --git a/rt/lib/RT/User.pm b/rt/lib/RT/User.pm
new file mode 100755 (executable)
index 0000000..4e85540
--- /dev/null
@@ -0,0 +1,1222 @@
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/User.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::User - RT User object
+
+=head1 SYNOPSIS
+
+  use RT::User;
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::User);
+
+=end testing
+
+
+=cut
+
+
+package RT::User;
+use RT::Record;
+@ISA= qw(RT::Record);
+
+# {{{ sub _Init
+sub _Init  {
+    my $self = shift;
+    $self->{'table'} = "Users";
+    return($self->SUPER::_Init(@_));
+}
+# }}}
+
+# {{{ sub _Accessible 
+
+sub _Accessible  {
+  my $self = shift;
+  my %Cols = (
+             # {{{ Core RT info
+             Name => 'public/read/write/admin',
+             Password => 'write',
+             Comments => 'read/write/admin',
+             Signature => 'read/write',
+             EmailAddress => 'public/read/write',
+             PagerEmailAddress => 'read/write',
+             FreeformContactInfo => 'read/write',
+             Organization => 'public/read/write/admin',
+             Disabled => 'public/read/write/admin', #To modify this attribute, we have helper
+             #methods
+             Privileged => 'read/write/admin', # 0=no 1=user 2=system
+
+             # }}}
+             
+             # {{{ Names
+             
+             RealName => 'public/read/write',
+             NickName => 'public/read/write',
+             # }}}
+                     
+             # {{{ Localization and Internationalization
+             Lang => 'public/read/write',
+             EmailEncoding => 'public/read/write',
+             WebEncoding => 'public/read/write',
+             # }}}
+             
+             # {{{ External ContactInfo Linkage
+             ExternalContactInfoId => 'public/read/write/admin',
+             ContactInfoSystem => 'public/read/write/admin',
+             # }}}
+             
+             # {{{ User Authentication identifier
+             ExternalAuthId => 'public/read/write/admin',
+             #Authentication system used for user 
+             AuthSystem => 'public/read/write/admin',
+             Gecos => 'public/read/write/admin', #Gecos is the name of the fields in a 
+             # unix passwd file. In this case, it refers to "Unix Username"
+             # }}}
+             
+             # {{{ Telephone numbers
+             HomePhone =>  'read/write',
+             WorkPhone => 'read/write',
+             MobilePhone => 'read/write',
+             PagerPhone => 'read/write',
+
+             # }}}
+             
+             # {{{ Paper Address
+             Address1 => 'read/write',
+             Address2 => 'read/write',
+             City => 'read/write',
+             State => 'read/write',
+             Zip => 'read/write',
+             Country => 'read/write',
+             # }}}
+             
+             # {{{ Core DBIx::Record Attributes
+             Creator => 'read/auto',
+             Created => 'read/auto',
+             LastUpdatedBy => 'read/auto',
+             LastUpdated => 'read/auto'
+
+             # }}}
+            );
+  return($self->SUPER::_Accessible(@_, %Cols));
+}
+
+# }}}
+
+# {{{ sub Create 
+
+sub Create  {
+    my $self = shift;
+    my %args = (Privileged => 0,
+               @_ # get the real argumentlist
+              );
+    
+    #Check the ACL
+    unless ($self->CurrentUserHasRight('AdminUsers')) {
+       return (0, 'No permission to create users');
+    }
+    
+    if (! $args{'Password'})  {
+       $args{'Password'} = '*NO-PASSWORD*';
+    }
+    elsif (length($args{'Password'}) < $RT::MinimumPasswordLength) {
+        return(0,"Password too short");
+    }
+    else {
+        my $salt = join '', ('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64];
+        $args{'Password'} = crypt($args{'Password'}, $salt);     
+    }   
+        
+    
+    #TODO Specify some sensible defaults.
+    
+    unless (defined ($args{'Name'})) {
+       return(0, "Must specify 'Name' attribute");
+    }  
+    
+    
+    #SANITY CHECK THE NAME AND ABORT IF IT'S TAKEN
+    if ($RT::SystemUser) { #This only works if RT::SystemUser has been defined
+               my $TempUser = RT::User->new($RT::SystemUser);
+               $TempUser->Load($args{'Name'});
+               return (0, 'Name in use') if ($TempUser->Id);
+       
+               return(0, 'Email address in use') 
+                       unless ($self->ValidateEmailAddress($args{'EmailAddress'}));
+    }
+    else {
+               $RT::Logger->warning("$self couldn't check for pre-existing ".
+                            " users on create. This will happen".
+                            " on installation\n");
+    }
+    
+    my $id = $self->SUPER::Create(%args);
+    
+    #If the create failed.
+    unless ($id) {
+               return (0, 'Could not create user');
+    }
+      
+    
+    #TODO post 2.0
+    #if ($args{'SendWelcomeMessage'}) {
+    #  #TODO: Check if the email exists and looks valid
+    #  #TODO: Send the user a "welcome message" 
+    #}
+    
+    return ($id, 'User created');
+}
+
+# }}}
+
+# {{{ sub _BootstrapCreate 
+
+#create a user without validating _any_ data.
+
+#To be used only on database init.
+
+sub _BootstrapCreate {
+    my $self = shift;
+    my %args = (@_);
+
+    $args{'Password'} = "*NO-PASSWORD*";
+    my $id = $self->SUPER::Create(%args);
+    
+    #If the create failed.
+    return (0, 'Could not create user') 
+      unless ($id);
+
+    return ($id, 'User created');
+}
+
+# }}}
+
+# {{{ sub Delete 
+
+sub Delete  {
+    my $self = shift;
+    
+    return(0, 'Deleting this object would violate referential integrity');
+    
+}
+
+# }}}
+
+# {{{ sub Load 
+
+=head2 Load
+
+Load a user object from the database. Takes a single argument.
+If the argument is numerical, load by the column 'id'. Otherwise, load by
+the "Name" column which is the user's textual username.
+
+=cut
+
+sub Load  {
+    my $self = shift;
+    my $identifier = shift || return undef;
+    
+    #if it's an int, load by id. otherwise, load by name.
+    if ($identifier !~ /\D/) {
+       $self->SUPER::LoadById($identifier);
+    }
+    else {
+       $self->LoadByCol("Name",$identifier);
+    }
+}
+
+# }}}
+
+
+# {{{ sub LoadByEmail
+
+=head2 LoadByEmail
+
+Tries to load this user object from the database by the user's email address.
+
+
+=cut
+
+sub LoadByEmail {
+    my $self=shift;
+    my $address = shift;
+
+    # Never load an empty address as an email address.
+    unless ($address) {
+       return(undef);
+    }
+
+    $address = RT::CanonicalizeAddress($address);
+    #$RT::Logger->debug("Trying to load an email address: $address\n");
+    return $self->LoadByCol("EmailAddress", $address);
+}
+# }}}
+
+
+# {{{ sub ValidateEmailAddress
+
+=head2 ValidateEmailAddress ADDRESS
+
+Returns true if the email address entered is not in use by another user or is 
+undef or ''. Returns false if it's in use. 
+
+=cut
+
+sub ValidateEmailAddress {
+       my $self = shift;
+       my $Value = shift;
+
+       # if the email address is null, it's always valid
+       return (1) if(!$Value || $Value eq "");
+
+       my $TempUser = RT::User->new($RT::SystemUser);
+       $TempUser->LoadByEmail($Value);
+
+       if( $TempUser->id && 
+          ($TempUser->id != $self->id)) { # if we found a user with that address 
+                                       # it's invalid to set this user's address to it
+               return(undef);
+       }
+       else { #it's a valid email address
+               return(1);
+       }
+}
+
+# }}}
+
+
+
+
+# {{{ sub SetRandomPassword
+
+=head2 SetRandomPassword
+
+Takes no arguments. Returns a status code and a new password or an error message.
+If the status is 1, the second value returned is the new password.
+If the status is anything else, the new value returned is the error code.
+
+=cut
+
+sub SetRandomPassword  {
+    my $self = shift;
+
+
+    unless ($self->CurrentUserCanModify('Password')) {
+       return (0, "Permission Denied");
+    }
+    
+    my $pass = $self->GenerateRandomPassword(6,8);
+
+    # If we have "notify user on 
+
+    my ($val, $msg) = $self->SetPassword($pass);
+    
+    #If we got an error return the error.
+    return (0, $msg) unless ($val);
+    
+    #Otherwise, we changed the password, lets return it.
+    return (1, $pass);
+    
+}
+
+# }}}
+
+
+# {{{ sub ResetPassword
+
+=head2 ResetPassword
+
+Returns status, [ERROR or new password].  Resets this user\'s password to
+a randomly generated pronouncable password and emails them, using a 
+global template called "RT_PasswordChange", which can be overridden
+with global templates "RT_PasswordChange_Privileged" or "RT_PasswordChange_NonPrivileged" 
+for privileged and Non-privileged users respectively.
+
+=cut
+
+sub ResetPassword {
+    my $self = shift;
+    
+    unless ($self->CurrentUserCanModify('Password')) {
+       return (0, "Permission Denied");
+    }
+    my ($status, $pass) = $self->SetRandomPassword();
+
+    unless ($status) {
+       return (0, "$pass");
+    }
+    
+    my $template = RT::Template->new($self->CurrentUser);
+
+
+    if ($self->IsPrivileged) {
+       $template->LoadGlobalTemplate('RT_PasswordChange_Privileged');
+    } 
+    else {
+       $template->LoadGlobalTemplate('RT_PasswordChange_Privileged');
+    }  
+    
+    unless ($template->Id) {
+       $template->LoadGlobalTemplate('RT_PasswordChange');
+    }  
+    
+    unless ($template->Id) {
+       $RT::Logger->crit("$self tried to send ".$self->Name." a password reminder ".
+                         "but couldn't find a password change template");
+    }  
+
+    my $notification =  RT::Action::SendPasswordEmail->new(TemplateObj => $template,
+                                                          Argument => $pass);
+    
+    $notification->SetTo($self->EmailAddress);
+
+    my ($ret);
+    $ret = $notification->Prepare();
+    if ($ret) {
+       $ret = $notification->Commit();
+    }
+    
+    if ($ret) {
+       return(1, 'New password notification sent');
+    }  else {
+       return (0, 'Notification could not be sent');
+    }  
+    
+}
+
+
+# }}}
+
+# {{{ sub GenerateRandomPassword
+
+=head2 GenerateRandomPassword MIN_LEN and MAX_LEN
+
+Returns a random password between MIN_LEN and MAX_LEN characters long.
+
+=cut
+
+sub GenerateRandomPassword {
+    my $self = shift;
+    my $min_length = shift;
+    my $max_length = shift;
+    
+    #This code derived from mpw.pl, a bit of code with a sordid history
+    # Its notes: 
+    
+    # Perl cleaned up a bit by Jesse Vincent 1/14/2001.
+    # Converted to perl from C by Marc Horowitz, 1/20/2000.
+    # Converted to C from Multics PL/I by Bill Sommerfeld, 4/21/86.
+    # Original PL/I version provided by Jerry Saltzer.
+
+    
+    my ($frequency, $start_freq, $total_sum, $row_sums);
+
+    #When munging characters, we need to know where to start counting letters from
+    my $a = ord('a');
+
+    # frequency of English digraphs (from D Edwards 1/27/66) 
+    $frequency =
+      [ [ 4, 20, 28, 52, 2, 11, 28, 4, 32, 4, 6, 62, 23,
+         167, 2, 14, 0, 83, 76, 127, 7, 25, 8, 1, 9, 1 ], # aa - az
+       [ 13, 0, 0, 0, 55, 0, 0, 0, 8, 2, 0, 22, 0,
+         0, 11, 0, 0, 15, 4, 2, 13, 0, 0, 0, 15, 0 ], # ba - bz
+       [ 32, 0, 7, 1, 69, 0, 0, 33, 17, 0, 10, 9, 1,
+         0, 50, 3, 0, 10, 0, 28, 11, 0, 0, 0, 3, 0 ], # ca - cz
+       [ 40, 16, 9, 5, 65, 18, 3, 9, 56, 0, 1, 4, 15,
+         6, 16, 4, 0, 21, 18, 53, 19, 5, 15, 0, 3, 0 ], # da - dz
+       [ 84, 20, 55, 125, 51, 40, 19, 16, 50, 1, 4, 55, 54,
+         146, 35, 37, 6, 191, 149, 65, 9, 26, 21, 12, 5, 0 ], # ea - ez
+       [ 19, 3, 5, 1, 19, 21, 1, 3, 30, 2, 0, 11, 1,
+         0, 51, 0, 0, 26, 8, 47, 6, 3, 3, 0, 2, 0 ], # fa - fz
+       [ 20, 4, 3, 2, 35, 1, 3, 15, 18, 0, 0, 5, 1,
+         4, 21, 1, 1, 20, 9, 21, 9, 0, 5, 0, 1, 0 ], # ga - gz
+       [ 101, 1, 3, 0, 270, 5, 1, 6, 57, 0, 0, 0, 3,
+         2, 44, 1, 0, 3, 10, 18, 6, 0, 5, 0, 3, 0 ], # ha - hz
+       [ 40, 7, 51, 23, 25, 9, 11, 3, 0, 0, 2, 38, 25,
+         202, 56, 12, 1, 46, 79, 117, 1, 22, 0, 4, 0, 3 ], # ia - iz
+       [ 3, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 0,
+         0, 4, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 ], # ja - jz
+       [ 1, 0, 0, 0, 11, 0, 0, 0, 13, 0, 0, 0, 0,
+         2, 0, 0, 0, 0, 6, 2, 1, 0, 2, 0, 1, 0 ], # ka - kz
+       [ 44, 2, 5, 12, 62, 7, 5, 2, 42, 1, 1, 53, 2,
+         2, 25, 1, 1, 2, 16, 23, 9, 0, 1, 0, 33, 0 ], # la - lz
+       [ 52, 14, 1, 0, 64, 0, 0, 3, 37, 0, 0, 0, 7,
+         1, 17, 18, 1, 2, 12, 3, 8, 0, 1, 0, 2, 0 ], # ma - mz
+       [ 42, 10, 47, 122, 63, 19, 106, 12, 30, 1, 6, 6, 9,
+         7, 54, 7, 1, 7, 44, 124, 6, 1, 15, 0, 12, 0 ], # na - nz
+       [ 7, 12, 14, 17, 5, 95, 3, 5, 14, 0, 0, 19, 41,
+         134, 13, 23, 0, 91, 23, 42, 55, 16, 28, 0, 4, 1 ], # oa - oz
+       [ 19, 1, 0, 0, 37, 0, 0, 4, 8, 0, 0, 15, 1,
+         0, 27, 9, 0, 33, 14, 7, 6, 0, 0, 0, 0, 0 ], # pa - pz
+       [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 ], # qa - qz
+       [ 83, 8, 16, 23, 169, 4, 8, 8, 77, 1, 10, 5, 26,
+         16, 60, 4, 0, 24, 37, 55, 6, 11, 4, 0, 28, 0 ], # ra - rz
+       [ 65, 9, 17, 9, 73, 13, 1, 47, 75, 3, 0, 7, 11,
+         12, 56, 17, 6, 9, 48, 116, 35, 1, 28, 0, 4, 0 ], # sa - sz
+       [ 57, 22, 3, 1, 76, 5, 2, 330, 126, 1, 0, 14, 10,
+         6, 79, 7, 0, 49, 50, 56, 21, 2, 27, 0, 24, 0 ], # ta - tz
+       [ 11, 5, 9, 6, 9, 1, 6, 0, 9, 0, 1, 19, 5,
+         31, 1, 15, 0, 47, 39, 31, 0, 3, 0, 0, 0, 0 ], # ua - uz
+       [ 7, 0, 0, 0, 72, 0, 0, 0, 28, 0, 0, 0, 0,
+         0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0 ], # va - vz
+       [ 36, 1, 1, 0, 38, 0, 0, 33, 36, 0, 0, 4, 1,
+         8, 15, 0, 0, 0, 4, 2, 0, 0, 1, 0, 0, 0 ], # wa - wz
+       [ 1, 0, 2, 0, 0, 1, 0, 0, 3, 0, 0, 0, 0,
+         0, 1, 5, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0 ], # xa - xz
+       [ 14, 5, 4, 2, 7, 12, 12, 6, 10, 0, 0, 3, 7,
+         5, 17, 3, 0, 4, 16, 30, 0, 0, 5, 0, 0, 0 ], # ya - yz
+       [ 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]; # za - zz
+
+    #We need to know the totals for each row 
+    $row_sums =
+      [ map { my $sum = 0; map { $sum += $_ } @$_; $sum } @$frequency ];
+    
+
+    #Frequency with which a given letter starts a word.
+    $start_freq =
+      [ 1299, 425, 725, 271, 375, 470, 93, 223, 1009, 24, 20, 355, 379,
+       319, 823, 618, 21, 317, 962, 1991, 271, 104, 516, 6, 16, 14 ];
+    
+    $total_sum = 0; map { $total_sum += $_ } @$start_freq;
+    
+    
+    my $length = $min_length + int(rand($max_length-$min_length));
+    
+    my $char = $self->GenerateRandomNextChar($total_sum, $start_freq);
+    my @word = ($char+$a);
+    for (2..$length) {
+       $char = $self->_GenerateRandomNextChar($row_sums->[$char], $frequency->[$char]);
+       push(@word, $char+$a);
+    }
+    
+    #Return the password
+    return pack("C*",@word);
+    
+}
+
+
+#A private helper function for RandomPassword
+# Takes a row summary and a frequency chart for the next character to be searched
+sub _GenerateRandomNextChar {
+    my $self = shift;
+    my($all, $freq) = @_;
+    my($pos, $i);
+    
+    for ($pos = int(rand($all)), $i=0;
+        $pos >= $freq->[$i];
+        $pos -= $freq->[$i], $i++) {};
+    
+    return($i);
+}
+
+# }}}
+
+# {{{ sub SetPassword
+
+=head2 SetPassword
+
+Takes a string. Checks the string's length and sets this user's password 
+to that string.
+
+=cut
+
+sub SetPassword {
+    my $self = shift;
+    my $password = shift;
+    
+    unless ($self->CurrentUserCanModify('Password')) {
+       return(0, 'Permission Denied');
+    }
+    
+    if (! $password)  {
+        return(0, "No password set");
+    }
+    elsif (length($password) < $RT::MinimumPasswordLength) {
+        return(0,"Password too short");
+    }
+    else {
+        my $salt = join '', ('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64];
+        return ( $self->SUPER::SetPassword(crypt($password, $salt)) );
+    }   
+    
+}
+
+# }}}
+
+# {{{ sub IsPassword 
+
+=head2 IsPassword
+
+Returns true if the passed in value is this user's password.
+Returns undef otherwise.
+
+=cut
+
+sub IsPassword { 
+    my $self = shift;
+    my $value = shift;
+
+    #TODO there isn't any apparent way to legitimately ACL this
+
+    # RT does not allow null passwords 
+    if ((!defined ($value)) or ($value eq '')) {
+       return(undef);
+    } 
+    if ($self->Disabled) {
+       $RT::Logger->info("Disabled user ".$self->Name." tried to log in");
+       return(undef);
+    }
+
+    if ( ($self->__Value('Password') eq '') || 
+         ($self->__Value('Password') eq undef) )  {
+        return(undef);
+     }
+    if ($self->__Value('Password') eq crypt($value, $self->__Value('Password'))) {
+       return (1);
+    }
+    else {
+       return (undef);
+    }
+}
+
+# }}}
+
+# {{{ sub SetDisabled
+
+=head2 Sub SetDisabled
+
+Toggles the user's disabled flag.
+If this flag is
+set, all password checks for this user will fail. All ACL checks for this
+user will fail. The user will appear in no user listings.
+
+=cut 
+
+# }}}
+
+# {{{ ACL Related routines
+
+# {{{ GrantQueueRight
+
+=head2 GrantQueueRight
+
+Grant a queue right to this user.  Takes a paramhash of which the elements
+RightAppliesTo and RightName are important.
+
+=cut
+
+sub GrantQueueRight {
+    
+    my $self = shift;
+    my %args = ( RightScope => 'Queue',
+                RightName => undef,
+                RightAppliesTo => undef,
+                PrincipalType => 'User',
+                PrincipalId => $self->Id,
+                @_);
+   
+    #ACL check handled in ACE.pm
+
+    require RT::ACE;
+
+#    $RT::Logger->debug("$self ->GrantQueueRight right:". $args{'RightName'} .
+#                     " applies to queue ".$args{'RightAppliesTo'}."\n");
+    
+    my $ace = new RT::ACE($self->CurrentUser);
+    
+    return ($ace->Create(%args));
+}
+
+# }}}
+
+# {{{ GrantSystemRight
+
+=head2 GrantSystemRight
+
+Grant a system right to this user. 
+The only element that's important to set is RightName.
+
+=cut
+sub GrantSystemRight {
+    
+    my $self = shift;
+    my %args = ( RightScope => 'System',
+                RightName => undef,
+                RightAppliesTo => 0,
+                PrincipalType => 'User',
+                PrincipalId => $self->Id,
+                @_);
+   
+
+    #ACL check handled in ACE.pm
+
+    require RT::ACE;    
+    my $ace = new RT::ACE($self->CurrentUser);
+    
+    return ($ace->Create(%args));
+}
+
+
+# }}}
+
+# {{{ sub HasQueueRight
+
+=head2 HasQueueRight
+
+Takes a paramhash which can contain
+these items:
+    TicketObj => RT::Ticket or QueueObj => RT::Queue or Queue => integer
+    IsRequestor => undef, (for bootstrapping create)
+    Right => 'Right' 
+
+
+Returns 1 if this user has the right specified in the paramhash. for the queue
+passed in.
+
+Returns undef if they don't
+
+=cut
+
+sub HasQueueRight {
+    my $self = shift;
+    my %args = ( TicketObj => undef,
+                 QueueObj => undef,
+                Queue => undef,
+                IsRequestor => undef,
+                Right => undef,
+                @_);
+    
+    my ($IsRequestor, $IsCc, $IsAdminCc, $IsOwner);
+    
+    if (defined $args{'Queue'}) {
+       $args{'QueueObj'} = new RT::Queue($self->CurrentUser);
+       $args{'QueueObj'}->Load($args{'Queue'});
+    }
+    
+    if (defined $args{'TicketObj'}) {
+       $args{'QueueObj'} = $args{'TicketObj'}->QueueObj();
+    }
+
+    # {{{ Validate and load up the QueueId
+    unless ((defined $args{'QueueObj'}) and ($args{'QueueObj'}->Id)) {
+       require Carp;
+       $RT::Logger->debug(Carp::cluck ("$self->HasQueueRight Couldn't find a queue id"));
+       return undef;
+    }
+
+    # }}}
+
+        
+    # Figure out whether a user has the right we're asking about.
+    # first see if they have the right personally for the queue in question. 
+    my $retval = $self->_HasRight(Scope => 'Queue',
+                                 AppliesTo => $args{'QueueObj'}->Id,
+                                 Right => $args{'Right'},
+                                 IsOwner => $IsOwner);
+
+    return ($retval) if (defined $retval);
+    
+    # then we see whether they have the right personally globally. 
+    $retval = $self->HasSystemRight( $args{'Right'});
+
+    return ($retval) if (defined $retval);
+    
+    # now that we know they don't have the right personally,
+    
+    # {{{ Find out about whether the current user is a Requestor, Cc, AdminCc or Owner
+
+    if (defined $args{'TicketObj'}) {
+       if ($args{'TicketObj'}->IsRequestor($self)) {#user is requestor
+           $IsRequestor = 1;
+       }       
+
+       if ($args{'TicketObj'}->IsCc($self)) { #If user is a cc
+           $IsCc = 1;
+       }
+
+       if ($args{'TicketObj'}->IsAdminCc($self)) { #If user is an admin cc
+           $IsAdminCc = 1;
+       }       
+       
+       if ($args{'TicketObj'}->IsOwner($self)) { #If user is an owner
+           $IsOwner = 1;
+       }
+    }
+    
+    if (defined $args{'QueueObj'}) {
+       if ($args{'QueueObj'}->IsCc($self)) { #If user is a cc
+           $IsCc = 1;
+       }
+       if ($args{'QueueObj'}->IsAdminCc($self)) { #If user is an admin cc
+           $IsAdminCc = 1;
+       }
+       
+    } 
+    # }}}
+    
+    # then see whether they have the right for the queue as a member of a metagroup 
+
+    $retval = $self->_HasRight(Scope => 'Queue',
+                                 AppliesTo => $args{'QueueObj'}->Id,
+                                 Right => $args{'Right'},
+                                 IsOwner => $IsOwner,
+                                 IsCc => $IsCc,
+                                 IsAdminCc => $IsAdminCc,
+                                 IsRequestor => $IsRequestor
+                                );
+
+    return ($retval) if (defined $retval);
+
+    #   then we see whether they have the right globally as a member of a metagroup
+    $retval = $self->HasSystemRight( $args{'Right'},
+                                    (IsOwner => $IsOwner,
+                                     IsCc => $IsCc,
+                                     IsAdminCc => $IsAdminCc,
+                                     IsRequestor => $IsRequestor
+                                    ) );
+
+    #If they haven't gotten it by now, they just lose.
+    return ($retval);
+    
+}
+
+# }}}
+  
+# {{{ sub HasSystemRight
+
+=head2 HasSystemRight
+
+takes an array of a single value and a paramhash.
+The single argument is the right being passed in.
+the param hash is some additional data. (IsCc, IsOwner, IsAdminCc and IsRequestor)
+
+Returns 1 if this user has the listed 'right'. Returns undef if this user doesn't.
+
+=cut
+
+sub HasSystemRight {
+    my $self = shift;
+    my $right = shift;
+
+    my %args = ( IsOwner => undef,
+                IsCc => undef,
+                IsAdminCc => undef,
+                IsRequestor => undef,
+                @_);
+    
+    unless (defined $right) {
+
+       $RT::Logger->debug("$self RT::User::HasSystemRight was passed in no right.");
+       return(undef);
+    }  
+    return ( $self->_HasRight ( Scope => 'System',
+                               AppliesTo => '0',
+                               Right => $right,
+                               IsOwner => $args{'IsOwner'},
+                               IsCc => $args{'IsCc'},
+                               IsAdminCc => $args{'IsAdminCc'},
+                               IsRequestor => $args{'IsRequestor'},
+                               
+                             )
+          );
+    
+}
+
+# }}}
+
+# {{{ sub _HasRight
+
+=head2 sub _HasRight (Right => 'right', Scope => 'scope',  AppliesTo => int, ExtendedPrincipals => SQL)
+
+_HasRight is a private helper method for checking a user's rights. It takes
+several options:
+
+=item Right is a textual right name
+
+=item Scope is a textual scope name. (As of July these were Queue, Ticket and System
+
+=item AppliesTo is the numerical Id of the object identified in the scope. For tickets, this is the queue #. for queues, this is the queue #
+
+=item ExtendedPrincipals is an  SQL select clause which assumes that the only
+table in play is ACL.  It's used by HasQueueRight to pass in which 
+metaprincipals apply. Actually, it's probably obsolete. TODO: remove it.
+
+Returns 1 if a matching ACE was found.
+
+Returns undef if no ACE was found.
+
+=cut
+
+
+sub _HasRight {
+    
+    my $self = shift;
+    my %args = ( Right => undef,
+                Scope => undef,
+                AppliesTo => undef,
+                IsRequestor => undef,
+                IsCc => undef,
+                IsAdminCc => undef,
+                IsOwner => undef,
+                ExtendedPrincipals => undef,
+                @_);
+    
+    if ($self->Disabled) {
+       $RT::Logger->debug ("Disabled User:  ".$self->Name.
+                           " failed access check for ".$args{'Right'}.
+                           " to object ".$args{'Scope'}."/".
+                           $args{'AppliesTo'}."\n");
+       return (undef);
+    }
+    
+    if (!defined $args{'Right'}) {
+       $RT::Logger->debug("_HasRight called without a right\n");
+       return(undef);
+    }
+    elsif (!defined $args{'Scope'}) {
+       $RT::Logger->debug("_HasRight called without a scope\n");
+       return(undef);
+    }
+    elsif (!defined $args{'AppliesTo'}) {
+       $RT::Logger->debug("_HasRight called without an AppliesTo object\n");
+       return(undef);
+    }
+    
+    #If we've cached a win or loss for this lookup say so
+    
+    #TODO Security +++ check to make sure this is complete and right
+    
+    #Construct a hashkey to cache decisions in
+    my ($hashkey);
+    { #it's ugly, but we need to turn off warning, cuz we're joining nulls.
+       local $^W=0;
+       $hashkey =$self->Id .":". join(':',%args);
+    }  
+    
+  # $RT::Logger->debug($hashkey."\n");
+    
+    #Anything older than 10 seconds needs to be rechecked
+    my $cache_timeout = (time - 10);
+    
+    
+    if ((defined $self->{'rights'}{"$hashkey"}) &&
+           ($self->{'rights'}{"$hashkey"} == 1 ) &&
+        (defined $self->{'rights'}{"$hashkey"}{'set'} ) &&
+           ($self->{'rights'}{"$hashkey"}{'set'} > $cache_timeout)) {
+#        $RT::Logger->debug("Cached ACL win for ". 
+#                           $args{'Right'}.$args{'Scope'}.
+#                           $args{'AppliesTo'}."\n");      
+       return ($self->{'rights'}{"$hashkey"});
+    }
+    elsif ((defined $self->{'rights'}{"$hashkey"}) &&
+              ($self->{'rights'}{"$hashkey"} == -1)  &&
+           (defined $self->{'rights'}{"$hashkey"}{'set'}) &&
+              ($self->{'rights'}{"$hashkey"}{'set'} > $cache_timeout)) {
+       
+#      $RT::Logger->debug("Cached ACL loss decision for ". 
+#                         $args{'Right'}.$args{'Scope'}.
+#                         $args{'AppliesTo'}."\n");        
+       
+       return(undef);
+    }
+    
+    
+    my $RightClause = "(RightName = '$args{'Right'}')";
+    my $ScopeClause = "(RightScope = '$args{'Scope'}')";
+    
+    #If an AppliesTo was passed in, we should pay attention to it.
+    #otherwise, none is needed
+    
+    $ScopeClause = "($ScopeClause AND (RightAppliesTo = $args{'AppliesTo'}))"
+      if ($args{'AppliesTo'});
+    
+    
+    # The generic principals clause looks for users with my id
+    # and Rights that apply to _everyone_
+    my $PrincipalsClause = "((PrincipalType = 'User') AND (PrincipalId = ".$self->Id."))";
+    
+    
+    # If the user is the superuser, grant them the damn right ;)
+    my $SuperUserClause = 
+      "(RightName = 'SuperUser') AND (RightScope = 'System') AND (RightAppliesTo = 0)";
+    
+    # If we've been passed in an extended principals clause, we should lump it
+    # on to the existing principals clause. it'll make life easier
+    if ($args{'ExtendedPrincipals'}) {
+       $PrincipalsClause = "(($PrincipalsClause) OR ".
+         "($args{'ExtendedPrincipalsClause'}))";
+    }
+    
+    my $GroupPrincipalsClause = "((ACL.PrincipalType = 'Group') ".
+      "AND (ACL.PrincipalId = Groups.Id) AND (GroupMembers.GroupId = Groups.Id) ".
+     " AND (GroupMembers.UserId = ".$self->Id."))";
+    
+    
+
+
+    # {{{ A bunch of magic statements that make the metagroups listed
+    # work. basically, we if the user falls into the right group,
+    # we add the type of ACL check needed
+    my (@MetaPrincipalsSubClauses, $MetaPrincipalsClause);
+    
+    #The user is always part of the 'Everyone' Group
+    push (@MetaPrincipalsSubClauses,  "((Groups.Name = 'Everyone') AND 
+                                       (PrincipalType = 'Group') AND 
+                                       (Groups.Id = PrincipalId))");
+
+    if ($args{'IsAdminCc'}) {
+       push (@MetaPrincipalsSubClauses,  "((Groups.Name = 'AdminCc') AND 
+                                       (PrincipalType = 'Group') AND 
+                                       (Groups.Id = PrincipalId))");
+    }
+    if ($args{'IsCc'}) {
+       push (@MetaPrincipalsSubClauses, " ((Groups.Name = 'Cc') AND 
+                                       (PrincipalType = 'Group') AND 
+                                       (Groups.Id = PrincipalId))");
+    }
+    if ($args{'IsRequestor'}) {
+       push (@MetaPrincipalsSubClauses,  " ((Groups.Name = 'Requestor') AND 
+                                       (PrincipalType = 'Group') AND 
+                                       (Groups.Id = PrincipalId))");
+    }
+    if ($args{'IsOwner'}) {
+       
+       push (@MetaPrincipalsSubClauses, " ((Groups.Name = 'Owner') AND 
+                                       (PrincipalType = 'Group') AND 
+                                       (Groups.Id = PrincipalId))");
+    }
+
+    # }}}
+    
+    my ($GroupRightsQuery, $MetaGroupRightsQuery, $IndividualRightsQuery, $hitcount);
+    
+    # {{{ If there are any metaprincipals to be checked
+    if (@MetaPrincipalsSubClauses) {
+       #chop off the leading or
+       #TODO redo this with an array and a join
+       $MetaPrincipalsClause = join (" OR ", @MetaPrincipalsSubClauses);
+       
+       $MetaGroupRightsQuery =  "SELECT COUNT(ACL.id) FROM ACL, Groups".
+         " WHERE " .
+           " ($ScopeClause) AND ($RightClause) AND ($MetaPrincipalsClause)";
+       
+       # {{{ deal with checking if the user has a right as a member of a metagroup
+
+#      $RT::Logger->debug("Now Trying $MetaGroupRightsQuery\n");       
+       $hitcount = $self->_Handle->FetchResult($MetaGroupRightsQuery);
+       
+       #if there's a match, the right is granted
+       if ($hitcount) {
+           $self->{'rights'}{"$hashkey"}{'set'} = time;
+           $self->{'rights'}{"$hashkey"} = 1;
+           return (1);
+       }
+       
+#      $RT::Logger->debug("No ACL matched MetaGroups query: $MetaGroupRightsQuery\n"); 
+
+       # }}}    
+       
+    }
+    # }}}
+
+    # {{{ deal with checking if the user has a right as a member of a group
+    # This query checks to se whether the user has the right as a member of a
+    # group
+    $GroupRightsQuery = "SELECT COUNT(ACL.id) FROM ACL, GroupMembers, Groups".
+      " WHERE " .
+       " (((($ScopeClause) AND ($RightClause)) OR ($SuperUserClause)) ".
+         " AND ($GroupPrincipalsClause))";    
+    
+    #  $RT::Logger->debug("Now Trying $GroupRightsQuery\n");   
+    $hitcount = $self->_Handle->FetchResult($GroupRightsQuery);
+    
+    #if there's a match, the right is granted
+    if ($hitcount) {
+       $self->{'rights'}{"$hashkey"}{'set'} = time;
+       $self->{'rights'}{"$hashkey"} = 1;
+       return (1);
+    }
+    
+#    $RT::Logger->debug("No ACL matched $GroupRightsQuery\n"); 
+    
+    # }}}
+
+    # {{{ Check to see whether the user has a right as an individual
+    
+    # This query checks to see whether the current user has the right directly
+    $IndividualRightsQuery = "SELECT COUNT(ACL.id) FROM ACL WHERE ".
+      " ((($ScopeClause) AND ($RightClause)) OR ($SuperUserClause)) " .
+       " AND ($PrincipalsClause)";
+
+    
+    $hitcount = $self->_Handle->FetchResult($IndividualRightsQuery);
+    
+    if ($hitcount) {
+       $self->{'rights'}{"$hashkey"}{'set'} = time;
+       $self->{'rights'}{"$hashkey"} = 1;
+       return (1);
+    }
+    # }}}
+
+    else { #If the user just doesn't have the right
+       
+#      $RT::Logger->debug("No ACL matched $IndividualRightsQuery\n");
+       
+       #If nothing matched, return 0.
+       $self->{'rights'}{"$hashkey"}{'set'} = time;
+       $self->{'rights'}{"$hashkey"} = -1;
+
+       
+       return (undef);
+    }
+}
+
+# }}}
+
+# {{{ sub CurrentUserCanModify
+
+=head2 CurrentUserCanModify RIGHT
+
+If the user has rights for this object, either because
+he has 'AdminUsers' or (if he\'s trying to edit himself and the right isn\'t an 
+admin right) 'ModifySelf', return 1. otherwise, return undef.
+
+=cut
+
+sub CurrentUserCanModify {
+    my $self = shift;
+    my $right = shift;
+
+    if ($self->CurrentUserHasRight('AdminUsers')) {
+       return (1);
+    }
+    #If the field is marked as an "administrators only" field, 
+    # don\'t let the user touch it.
+    elsif ($self->_Accessible($right, 'admin')) {
+       return(undef);
+    }
+    
+    #If the current user is trying to modify themselves
+    elsif ( ($self->id == $self->CurrentUser->id)  and
+           ($self->CurrentUserHasRight('ModifySelf'))) {
+       return(1);
+    }
+    #If we don\'t have a good reason to grant them rights to modify
+    # by now, they lose
+    else {
+       return(undef);
+    }
+    
+}
+
+# }}}
+
+# {{{ sub CurrentUserHasRight
+
+=head2 CurrentUserHasRight
+  
+  Takes a single argument. returns 1 if $Self->CurrentUser
+  has the requested right. returns undef otherwise
+
+=cut
+
+sub CurrentUserHasRight {
+    my $self = shift;
+    my $right = shift;
+    
+    return ($self->CurrentUser->HasSystemRight($right));
+}
+
+# }}}
+
+
+# {{{ sub _Set
+
+sub _Set {
+  my $self = shift;
+  
+  my %args = (Field => undef,
+             Value => undef,
+             @_
+            );
+
+  # Nobody is allowed to futz with RT_System or Nobody unless they
+  # want to change an email address. For 2.2, neither should have an email address
+
+  if ($self->Privileged == 2) {
+    return (0, "Can not modify system users"); 
+  }
+  unless ($self->CurrentUserCanModify($args{'Field'})) {
+      return (0, "Permission Denied");
+  }
+
+
+  
+  #Set the new value
+  my ($ret, $msg)=$self->SUPER::_Set(Field => $args{'Field'}, 
+                                    Value=> $args{'Value'});
+  
+    return ($ret, $msg);
+}
+
+# }}}
+
+# {{{ sub _Value 
+
+=head2 _Value
+
+Takes the name of a table column.
+Returns its value as a string, if the user passes an ACL check
+
+=cut
+
+sub _Value  {
+
+  my $self = shift;
+  my $field = shift;
+  
+  #If the current user doesn't have ACLs, don't let em at it.  
+  
+  my @PublicFields = qw( Name EmailAddress Organization Disabled
+                        RealName NickName Gecos ExternalAuthId 
+                        AuthSystem ExternalContactInfoId 
+                        ContactInfoSystem );
+
+  #if the field is public, return it.
+  if ($self->_Accessible($field, 'public')) {
+      return($self->SUPER::_Value($field));
+      
+  }
+  #If the user wants to see their own values, let them
+  elsif ($self->CurrentUser->Id == $self->Id) {        
+      return($self->SUPER::_Value($field));
+  } 
+  #If the user has the admin users right, return the field
+  elsif ($self->CurrentUserHasRight('AdminUsers')) {
+      return($self->SUPER::_Value($field));
+  }
+  else {
+      return(undef);
+  }    
+
+}
+
+# }}}
+
+# }}}
+1;
diff --git a/rt/lib/RT/Users.pm b/rt/lib/RT/Users.pm
new file mode 100755 (executable)
index 0000000..f4a9726
--- /dev/null
@@ -0,0 +1,281 @@
+
+# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Users.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
+# (c) 1996-1999 Jesse Vincent <jesse@fsck.com>
+# This software is redistributable under the terms of the GNU GPL
+
+=head1 NAME
+
+  RT::Users - Collection of RT::User objects
+
+=head1 SYNOPSIS
+
+  use RT::Users;
+
+
+=head1 DESCRIPTION
+
+
+=head1 METHODS
+
+=begin testing
+
+ok(require RT::TestHarness);
+ok(require RT::Users);
+
+=end testing
+
+=cut
+
+package RT::Users;
+use RT::EasySearch;
+@ISA = qw(RT::EasySearch);
+
+# {{{ sub _Init 
+sub _Init  {
+  my $self = shift;
+  $self->{'table'} = "Users";
+  $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;
+
+  use RT::User;
+  my $item = new RT::User($self->CurrentUser);
+  return($item);
+}
+# }}}
+
+# {{{ LimitToEmail
+=head2 LimitToEmail
+
+Takes one argument. an email address. limits the returned set to
+that email address
+
+=cut
+
+sub LimitToEmail {
+    my $self = shift;
+    my $addr = shift;
+    $self->Limit(FIELD => 'EmailAddress', VALUE => "$addr");
+}
+
+# }}}
+
+# {{{ MemberOfGroup
+
+=head2 MemberOfGroup
+
+takes one argument, a group id number. Limits the returned set
+to members of a given group
+
+=cut
+
+sub MemberOfGroup {
+    my $self = shift;
+    my $group = shift;
+    
+    return ("No group specified") if (!defined $group);
+
+    my $groupalias = $self->NewAlias('GroupMembers');
+
+    $self->Join( ALIAS1 => 'main', FIELD1 => 'id', 
+                ALIAS2 => "$groupalias", FIELD2 => 'Name');
+    
+    $self->Limit (ALIAS => "$groupalias",
+                 FIELD => 'GroupId',
+                 VALUE => "$group",
+                 OPERATOR => "="
+                );
+}
+
+# }}}
+
+# {{{ LimitToPrivileged
+
+=head2 LimitToPrivileged
+
+Limits to users who can be made members of ACLs and groups
+
+=cut
+
+sub LimitToPrivileged {
+    my $self = shift;
+    $self->Limit( FIELD => 'Privileged',
+                  OPERATOR => '=',
+                  VALUE => '1');
+}
+
+# }}}
+
+
+
+# {{{ LimitToSystem
+
+=head2 LimitToSystem
+
+Limits to users who can be granted rights, but who should
+never have their rights modified by a user or be made members of groups.
+
+=cut
+
+sub LimitToSystem {
+    my $self = shift;
+    $self->Limit( FIELD => 'Privileged',
+                  OPERATOR => '=',
+                  VALUE => '2');
+}
+
+# }}}
+
+# {{{ HasQueueRight
+
+=head2 HasQueueRight
+
+Takes a queue id as its first argument.  Queue Id "0" is treated by RT as "applies to all queues"
+Takes a specific right as an optional second argument
+
+Limits the returned set to users who have rights in the queue specified, personally.  If the optional second argument is supplied, limits to users who have been explicitly granted that right.
+
+
+
+This should not be used as an ACL check, but only for obtaining lists of
+users with explicit rights in a given queue.
+
+=cut
+
+sub HasQueueRight {
+    my $self = shift;
+    my $queue = shift;
+    my $right;
+    
+    $right = shift if (@_);
+
+
+    my $acl_alias  = $self->NewAlias('ACL');
+    $self->Join( ALIAS1 => 'main',  FIELD1 => 'id',
+                ALIAS2 => $acl_alias, FIELD2 => 'PrincipalId');
+    $self->Limit (ALIAS => $acl_alias,
+                FIELD => 'PrincipalType',
+                OPERATOR => '=',
+                VALUE => 'User');
+
+
+    $self->Limit(ALIAS => $acl_alias,
+                FIELD => 'RightAppliesTo',
+                OPERATOR => '=',
+                VALUE => "$queue");
+
+
+    $self->Limit(ALIAS => $acl_alias,
+                FIELD => 'RightScope',
+                OPERATOR => '=',
+                ENTRYAGGREGATOR => 'OR',
+                VALUE => 'Queue');
+
+
+    $self->Limit(ALIAS => $acl_alias,
+                FIELD => 'RightScope',
+                OPERATOR => '=',
+                ENTRYAGGREGATOR => 'OR',
+                VALUE => 'Ticket');
+
+
+    #TODO: is this being initialized properly if the right isn't there?
+    if (defined ($right)) {
+       
+       $self->Limit(ALIAS => $acl_alias,
+                    FIELD => 'RightName',
+                    OPERATOR => '=',
+                    VALUE => "$right");
+       
+       
+       };
+
+
+}
+
+
+
+# }}}
+
+# {{{ HasSystemRight
+
+=head2 HasSystemRight
+
+Takes one optional argument:
+   The name of a System level right.
+
+Limits the returned set to users who have been granted system rights, personally.  If the optional argument is passed in, limits to users who have been granted the explicit right listed.   Please see the note attached to LimitToQueueRights
+
+=cut
+
+sub HasSystemRight {
+    my $self = shift;
+    my $right = shift if (@_);
+       my $acl_alias  = $self->NewAlias('ACL');
+
+
+    $self->Join( ALIAS1 => 'main',  FIELD1 => 'id',
+                ALIAS2 => $acl_alias, FIELD2 => 'PrincipalId');
+    $self->Limit (ALIAS => $acl_alias,
+                FIELD => 'PrincipalType',
+                OPERATOR => '=',
+                VALUE => 'User');
+
+    $self->Limit(ALIAS => $acl_alias,
+                FIELD => 'RightScope',
+                OPERATOR => '=',
+                VALUE => 'System');
+
+
+    #TODO: is this being initialized properly if the right isn't there?
+    if (defined ($right)) {
+       $self->Limit(ALIAS => $acl_alias,
+                    FIELD => 'RightName',
+                    OPERATOR => '=',
+                    VALUE => "$right");
+       
+       }
+
+    
+}
+
+# }}}
+
+1;
+
diff --git a/rt/lib/RT/Watcher.pm b/rt/lib/RT/Watcher.pm
new file mode 100755 (executable)
index 0000000..c7c6100
--- /dev/null
@@ -0,0 +1,313 @@
+# $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
new file mode 100755 (executable)
index 0000000..c55adda
--- /dev/null
@@ -0,0 +1,226 @@
+# $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
new file mode 100644 (file)
index 0000000..f0da5df
--- /dev/null
@@ -0,0 +1,52 @@
+# 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;
+
diff --git a/rt/tools/cpan2rpm b/rt/tools/cpan2rpm
new file mode 100644 (file)
index 0000000..9b54cb9
--- /dev/null
@@ -0,0 +1,299 @@
+#!/usr/bin/perl -w
+
+
+# Take a perl tarball and make a specfile for it. Now with bundles.
+#
+# Copyright 2000,2001 Simon Wilkinson. All rights reserved.
+#
+# 10/18/2001 - <jesse@bestpractical.com>
+#              Added resolution of prereq_pm modules
+#
+# This program is free software; you can redistribute it 
+# and/or modify it under the same terms as Perl itself.
+#
+
+use strict;
+
+use CPAN;
+use POSIX;
+use Sys::Hostname;
+use File::Basename;
+use Getopt::Long;
+
+use vars qw ($DEBUG $ARCH $builddir $seen @report);
+
+$ARCH = 'i386';
+
+$DEBUG = 0;
+# Icky globals
+
+my $release;
+my $package;
+
+$seen = {};
+
+
+sub usage 
+{
+  print STDERR <<EOM;
+
+Usage: cpan2rpm [--release <release>] [--builddir <rpm build dir>]  <Perl::Module>
+
+Where:
+<release> is the release number of the RPM you wish to produce
+<Perl::Module> is the name of the module to build
+EOM
+  exit(1);
+}
+
+
+my $ret=GetOptions("release" => \$release,
+                  "builddir=s" => \$builddir);
+
+$package=$ARGV[0];
+usage() if !$package;
+$release=1 if !$release;
+
+
+$builddir=ExtractRpmMacro($ENV{HOME}."/.rpmmacros","_topdir") if !$builddir;
+$builddir=ExtractRpmMacro("/etc/rpm/macros","_topdir") if !$builddir;
+$builddir=getcwd() if !$builddir;
+  
+die "Build directory $builddir doesn't look like an RPM build root\n"
+    if ((! -d "$builddir/SPECS") || (! -d "$builddir/SOURCES"));
+
+process($package,$release);
+
+print join("\n",@report)."\n";
+
+sub process {
+  my ($infile,$release)=@_;
+
+  
+
+# Convert our installation list into an unbundled one
+  unbundle($infile);
+
+  print "Building $infile\n";
+
+    cpan2rpm($infile,$builddir,$release);
+
+}
+
+# Given a Module, try to split it into its required components - this
+# currently only handles Bundles, but could also be extended to deal with
+# prereqs as well.
+
+sub unbundle {
+  my ($item) = @_;
+
+  if ($item=~/Bundle::/) {
+    my $obj=CPAN::Shell->expand('Bundle',$item);
+
+    foreach my $kid ($obj->contains) {
+       process($kid,$release);
+    }
+  }
+}
+
+
+sub cpan2rpm($$$) {
+  my ($infile,$builddir,$release) = @_;
+
+  my $ret;
+
+  my $obj=CPAN::Shell->expand('Module',$infile);
+
+  print "CPAN tells us the following about $infile:\n",$obj->as_string if ($DEBUG);
+
+  $ret=fetch_source($obj,$builddir);
+  $ret=build_specfile($obj,$builddir,$release) if !$ret;
+  
+  return $ret;
+}
+
+# FIXME: Some error handling in the function below wouldn't go amiss ...
+sub fetch_source {
+  my ($obj,$builddir)=@_;
+
+  # Minor Sanity checks
+  my $id=$obj->{ID};
+
+  return "Error: No file for $id\n" 
+     if $obj->cpan_file eq "N/A";
+  return "Error: $id says 'Contact Author'\n" 
+     if $obj->cpan_file =~ /^Contact Author/;
+  return "Error: $id is contained within Perl itself!\n"
+     if ($obj->cpan_file =~/perl-5\.\d?\.\d?\.tar\.gz/xo);
+
+  # We do this so we can take advantage of CPAN's object caching. This is
+  # pinched from the CPAN::Distribution::get method, which we can't use
+  # directly, as it untars the package as well - which we let RPM do.
+  my $dist = $CPAN::META->instance('CPAN::Distribution',$obj->cpan_file);
+
+
+  my($local_wanted) =
+       MM->catfile($CPAN::Config->{keep_source_where},
+                   "authors",
+                   "id",
+                   split("/",$dist->{ID})
+                   );
+
+  my $local_file = CPAN::FTP->localize("authors/id/$dist->{ID}", $local_wanted);
+  
+  $dist->{localfile} = $local_file;
+
+  $dist->verifyMD5 if ($CPAN::META->has_inst('MD5'));
+
+
+  # Find all the prereqs for this distribution, then build em.
+  # TODO this should be somewhere else
+
+  $dist->make;
+  build_prereqs( $dist->prereq_pm());
+
+
+
+  my $infile=basename($obj->cpan_file);
+
+  File::Copy::copy($local_file,"$builddir/SOURCES/$infile");
+
+  return undef;
+}
+
+
+sub build_prereqs($) {
+  my ($prereqs) = @_;
+  
+  foreach my $prereq (keys %{$prereqs}) {
+       process ($prereq, $release);
+  }
+}
+sub build_specfile($$$) {
+  my ($obj,$builddir,$release) = @_;
+
+  my $source=basename($obj->cpan_file);
+
+  # don't go through dependencies on something we've already dealt with
+  return() if ($seen->{$source});
+  $seen->{$source} = 1; 
+
+my ($name,$version)=($source=~/(.*)-(.*)\.tar\.gz/);
+  return "Couldn't get a name for $source\n" if !$name;
+  return "Couldn't get a version for $source\n" if !$version; 
+  
+  my $summary="$name module for perl";
+  my $description=$obj->{description};
+  $description= $summary if !$description;
+
+  open(SPEC, ">$builddir/SPECS/perl-$name.spec")
+    or die "Couldn't open perl-$name.spec for writing.";
+  print SPEC <<EOF;
+
+Summary: $summary
+Name: perl-$name
+Version: $version
+Release: $release
+Copyright: distributable
+Group: Applications/CPAN
+Source0: $source
+Url: http://www.cpan.org
+BuildRoot: /var/tmp/perl-${name}-buildroot/
+Requires: perl 
+
+%description
+This is a perl module, autogenerated by cpan2rpm. The original package's
+description was:
+
+$description
+
+%prep
+%setup -q -n $name-%{version}
+
+%build
+CFLAGS="\$RPM_OPT_FLAGS" perl Makefile.PL
+make
+
+%clean
+rm -rf \$RPM_BUILD_ROOT
+
+%install
+rm -rf \$RPM_BUILD_ROOT
+eval `perl '-V:installarchlib'`
+mkdir -p \$RPM_BUILD_ROOT/\$installarchlib
+make PREFIX=\$RPM_BUILD_ROOT/usr install
+/usr/lib/rpm/brp-compress
+find \$RPM_BUILD_ROOT/usr -type f -print | sed "s\@^\$RPM_BUILD_ROOT\@\@g" | grep -v perllocal.pod > $name-$version-filelist
+
+%files -f ${name}-${version}-filelist
+%defattr(-,root,root)
+
+%changelog
+EOF
+  print SPEC "* ",POSIX::strftime("%a %b %d %Y",localtime()), " ",$ENV{USER}," <",$ENV{USER},"\@",hostname(),">\n";
+  print SPEC "- Spec file automatically generated by cpan2rpm\n";
+
+  close(SPEC);
+
+  system("rpm -ba $builddir/SPECS/perl-$name.spec >/dev/null") == 0
+    or push (@report,  "RPM of $source failed with : $!\n"); 
+  system("rpm -Uvh $builddir/RPMS/$ARCH/perl-$name-$version-$release.$ARCH.rpm") == 0
+    or warn "RPM of $source could not be installed: $!\n";
+
+  push (@report,  "Built perl-$name-$version-$release.$ARCH.rpm");
+}
+
+sub ExtractRpmMacro {
+  my ($file,$macro) = @_;
+
+  my $handle=new IO::File;
+
+  if (!$handle->open($file)) {
+    return undef;
+  }
+
+  while(<$handle>) {
+    if (/\%$macro (.*)/) {
+       return $1;
+    }
+  }
+
+  return undef;
+}
+
+=head1 NAME
+
+cpan2rpm - fetch and convert CPAN packages to RPMs
+
+=head1 SYNOPSIS
+
+cpan2rpm --release <release> <package>
+
+=head1 DESCRIPTION
+
+cpan2rpm provides a quick way of creating RPM packages from perl modules
+published on CPAN. It interfaces with the perl CPAN module to fetch the
+file from the selected mirror, and then creates a spec file from the 
+information in CPAN, and invokes RPM on that spec file.
+
+Files are created in the users RPM build root.
+
+=head1 OPTIONS
+
+=over 4
+
+=item release
+
+Sets the release number of the created RPMs.
+
+=back
+
+=head1 SEE ALSO
+
+rpm(1)
+
+=head1 AUTHOR
+
+Simon Wilkinson <sxw@sxw.org.uk>
diff --git a/rt/tools/initdb b/rt/tools/initdb
new file mode 100644 (file)
index 0000000..ffb1ae3
--- /dev/null
@@ -0,0 +1,216 @@
+#!/usr/bin/perl -w
+# $Header: /home/cvs/cvsroot/freeside/rt/tools/Attic/initdb,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+use strict;
+use vars qw($PROMPT $SCHEMA_FILE $SCHEMA_DIR
+           $ACTION $DEBUG $DB_TYPE $DB_HOME 
+           $DB_HOST $DB_PORT $DB_DBA $DB_DATABASE $DB_DBA_PASSWORD);
+
+use DBI;
+use DBIx::DataSource qw( create_database drop_database );
+
+
+$|=1; #unbuffer that output.
+
+$DEBUG=0;
+$PROMPT = 1; #by default, should at least *ask* before nuking databases
+$SCHEMA_DIR ="etc";
+$SCHEMA_FILE = "$SCHEMA_DIR/schema.pm"; #hmm
+
+($DB_TYPE, $DB_HOME, $DB_HOST, $DB_PORT, $DB_DBA, $DB_DATABASE, $ACTION) = @ARGV;
+
+
+if ($DEBUG) {
+  print_config_params();
+}
+my $dsn = "dbi:$DB_TYPE:";
+
+if (($DB_TYPE eq 'Pg') or ($DB_TYPE eq 'mysql')) {
+   $dsn .= "dbname=$DB_DATABASE";
+   if ($DB_HOST) {
+       $dsn .= ";host=$DB_HOST";
+    }
+   if ($DB_PORT) {
+       $dsn .= ";port=$DB_PORT";
+   }
+}
+elsif ($DB_TYPE eq 'Oracle') {
+   $dsn .= "$DB_DATABASE";
+}
+
+
+if ($ACTION eq 'create') {
+    unless ($DB_TYPE eq 'Oracle') {
+        print "Now creating a database for RT.\n";
+       prompt_for_dba_password();
+       create_db();
+    }
+}
+elsif ($ACTION eq 'drop' ) {
+    unless ($DB_TYPE eq 'Oracle') {
+       print "Now dropping the RT2 database.\n";
+        prompt_for_dba_password();
+        drop_db();
+    }
+}
+elsif ($ACTION eq 'insert' ) {
+    print "Now populating database schema.\n";
+    prompt_for_dba_password();
+    insert_schema();
+}
+elsif ($ACTION eq 'generate') {
+    prompt_for_dba_password();
+    generate_schema();
+}
+else {
+    print STDERR '$ACTION unspecified. Makefile error. It was '.$ACTION ;
+    exit(-1);
+}
+
+
+# {{{ sub prompt_for_dba_password
+
+sub prompt_for_dba_password {
+    print "Enter the $DB_TYPE password for $DB_DBA: ";
+
+    system "stty -echo";
+    $DB_DBA_PASSWORD = scalar(<STDIN>); #keep off commandline
+    system "stty echo";
+    chomp $DB_DBA_PASSWORD;
+
+}
+# }}}
+
+# {{{ sub print_config_params
+sub print_config_params {
+    print <<END;
+Database creation parameters:
+
+DB_TYPE         = $DB_TYPE
+DB_HOME         = $DB_HOME
+DB_HOST         = $DB_HOST
+DB_DBA          = $DB_DBA
+DB_DBA_PASSWORD = <hidden>
+DB_DATABASE     = $DB_DATABASE
+END
+}
+# }}}
+
+# {{{ sub drop_db
+sub drop_db {
+    
+    if ( $PROMPT ) {
+       print <<END;
+
+About to drop $DB_TYPE database $DB_DATABASE.
+WARNING: This will erase all data in $DB_DATABASE.
+If you have an existing RT 2.x installation, this will destroy all your data.
+i
+END
+       exit unless _yesno();
+       
+    }
+    
+
+  print "\nDropping $DB_TYPE database $DB_DATABASE.\n";
+  drop_database( $dsn, $DB_DBA, $DB_DBA_PASSWORD )
+    or warn $DBIx::DataSource::errstr;
+
+
+}
+# }}}
+
+# {{{ sub generate_schema
+sub generate_schema {
+    my @schema = generate_schema_from_hash();
+    print "Generating schema for $DB_TYPE...";
+    
+    system('mv', "$SCHEMA_DIR/schema.$DB_TYPE", "$SCHEMA_DIR/schema.$DB_TYPE.bak")
+      if (-f "$SCHEMA_DIR/schema.$DB_TYPE");
+    open(SCHEMA, ">$SCHEMA_DIR/schema.$DB_TYPE");
+    foreach my $line (@schema) {
+       print SCHEMA "$line;\n";
+    }
+    close(SCHEMA);
+    print "done.\n";
+}
+# }}}
+
+# {{{ sub insert_schema
+sub insert_schema {
+    my (@schema);
+    print "\nCreating database schema.\n";
+   
+    my $dbh = DBI->connect( $dsn, $DB_DBA, $DB_DBA_PASSWORD ) or die $DBI::errstr;    
+    
+    if ( -f "$SCHEMA_DIR/schema.$DB_TYPE") {
+       open (SCHEMA, "<$SCHEMA_DIR/schema.$DB_TYPE");
+       my $statement = "";
+       foreach my $line (<SCHEMA>) {
+           $statement .= $line;
+           if ($line =~ /;$/) {
+               $statement =~ s/;$//g;
+               push @schema, $statement;
+               $statement = "";
+           }
+       }       
+    }  
+    
+    else {
+        @schema = generate_schema_from_hash();
+     }
+    
+    foreach my $statement (@schema) {
+       print STDERR $statement if $DEBUG;
+       my $sth = $dbh->prepare($statement) or die $dbh->errstr;
+       unless ($sth->execute) {
+           print STDERR "Problem with statement:\n $statement\n";
+           die $sth->errstr;
+       }
+    }
+    
+    
+    $dbh->disconnect;
+    print "schema sucessfully inserted\n";
+    
+}
+# }}}
+
+# {{{ sub generate_schema_from_hash
+sub generate_schema_from_hash {
+    my (@schema);
+    
+    require DBIx::DBSchema;    
+    my $schema_href = do "$SCHEMA_FILE" or die $@ || $!;
+    my $schema = DBIx::DBSchema->pretty_read($schema_href);
+    
+    
+    foreach my $statement ( $schema->sql($dsn, $DB_DBA, $DB_DBA_PASSWORD ) ) {
+       print STDERR $statement if $DEBUG;
+       chomp $statement;
+       push @schema, $statement;
+       
+    }
+    return (@schema);
+    
+}
+# }}}
+
+# {{{ sub create_db
+sub create_db {
+    
+    print "\nCreating $DB_TYPE database $DB_DATABASE.\n";
+    create_database( $dsn, $DB_DBA, $DB_DBA_PASSWORD )
+      or die $DBIx::DataSource::errstr;
+
+}
+# }}}
+
+# {{{ sub _yesno
+sub _yesno {
+    print "Proceed [y/N]:";
+    my $x = scalar(<STDIN>);
+    $x =~ /^y/i;
+}
+
+# }}}
diff --git a/rt/tools/insertdata b/rt/tools/insertdata
new file mode 100755 (executable)
index 0000000..b3e76e6
--- /dev/null
@@ -0,0 +1,618 @@
+#!/usr/bin/perl -w
+#
+# $Header: /home/cvs/cvsroot/freeside/rt/tools/Attic/insertdata,v 1.1 2002-08-12 06:17:08 ivan Exp $
+# RT is (c) 1996-2002 Jesse Vincent (jesse@bestpractical.com);
+
+package RT;
+use strict;
+use vars qw($VERSION $Handle $Nobody $SystemUser $item);
+
+use lib "!!RT_LIB_PATH!!";
+use lib "!!RT_ETC_PATH!!";
+
+#This drags in  RT's config.pm
+use config;
+use Carp;
+
+use RT::Handle;
+use RT::User;
+use RT::CurrentUser;
+
+# 
+my $LastVersion = shift || undef;
+my $LastMinorVersion = undef;
+
+#connect to the db
+$RT::Handle = new RT::Handle($RT::DatabaseType);
+$RT::Handle->Connect();
+
+#Put together a current user object so we can create a User object
+my $CurrentUser = new RT::CurrentUser();
+
+if ($LastVersion) {
+    if ( $LastVersion =~ /^2.0.(\d+)$/ ) {
+        $LastMinorVersion = $1;
+        print "Looking for new objects to add to the database"
+          . " since $LastVersion\n\n";
+    }
+    else {
+        print "This tool does not support upgrades from development releases "
+          . "or non 2.0.x versions";
+    }
+}
+else {    # this is a virgin install
+    print "Checking for existing system user...";
+    my $test_user = RT::User->new($CurrentUser);
+    $test_user->Load('RT_System');
+    if ( $test_user->id ) {
+        print "Found!\n\nYou appear to have already run insertdata.\n"
+          . "Exiting, so as not to clobber your existing data. To ERASE your\n"
+          . "RT database and start over, type 'make dropdb; make install' in\n"
+          . "the RT installation directory. If you just meant to upgrade the\n"
+          . "content of your database, rerun this program as: \n",
+          "       $0 <version>\n"
+          . "where <version> is the last RELEASED version of RT you installed\n"
+          . "for example, if you're upgrading from 2.0.4, you'd type:\n"
+          . "       $0 2.0.4\n";
+        exit(-1);
+
+    }
+    else {
+        print "not found.  This appears to be a new installation";
+    }
+
+    print "Creating system user...";
+    my $RT_System = new RT::User($CurrentUser);
+
+    my ( $val, $msg ) = $RT_System->_BootstrapCreate(
+        Name     => 'RT_System',
+        RealName => 'The RT System itself',
+        Comments =>
+'Do not delete or modify this user. It is integral to RT\'s internal database structures',
+        Privileged => '2',
+        Creator    => '1'
+    );
+
+    if ($val) {
+        print "done.\n";
+    }
+    else {
+        print "$msg\n";
+        exit(1);
+    }
+
+}
+
+#now that we bootstrapped that little bit, we can use the standard RT cli
+# helpers  to do what we need
+
+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();
+
+#Connect to the database and get RT::SystemUser and RT::Nobody loaded
+DBConnect();
+
+$CurrentUser->LoadByName('RT_System');
+
+# {{{ Users
+
+my @users;
+
+unless ($LastVersion) {
+    @users = (
+        {
+            Name     => 'Nobody',
+            RealName => 'Nobody in particular',
+            Comments => 'Do not delete or modify this user. It is integral '
+              . 'to RT\'s internal data structures',
+            Privileged => '2',
+        },
+
+        {
+            Name         => 'root',
+            Gecos        => 'root',
+            RealName     => 'Enoch Root',
+            Password     => 'password',
+            EmailAddress => "root\@localhost",
+            Comments     => 'SuperUser',
+            Privileged   => '1',
+        }
+    );
+}
+
+# }}}
+
+# {{{ Groups 
+
+my @groups;
+unless ($LastVersion) {
+    @groups = (
+        {
+            Name        => 'Everyone',
+            Description => 'Pseudogroup for internal use',
+            Pseudo      => '1',
+        },
+        {
+            Name        => 'Owner',
+            Description => 'Pseudogroup for internal use',
+            Pseudo      => '1',
+        },
+        {
+            Name        => 'Requestor',
+            Description => 'Pseudogroup for internal use',
+            Pseudo      => '1',
+        },
+        {
+            Name        => 'Cc',
+            Description => 'Pseudogroup for internal use',
+            Pseudo      => '1',
+        },
+        {
+            Name        => 'AdminCc',
+            Description => 'Pseudogroup for internal use',
+            Pseudo      => '1',
+        },
+    );
+}
+
+# }}}
+
+# {{{ ACL
+my @acl;
+
+unless ($LastVersion) {
+    @acl = (    #TODO: make this actually take the serial # granted to root.
+        {
+            PrincipalId    => '1',
+            PrincipalType  => 'User',
+            RightName      => 'SuperUser',
+            RightScope     => 'System',
+            RightAppliesTo => '0'
+        },
+        {
+            PrincipalId    => '2',
+            PrincipalType  => 'User',
+            RightName      => 'SuperUser',
+            RightScope     => 'System',
+            RightAppliesTo => '0'
+        },
+
+        {
+            PrincipalId    => '3',
+            PrincipalType  => 'User',
+            RightName      => 'SuperUser',
+            RightScope     => 'System',
+            RightAppliesTo => '0'
+        }
+
+    );
+}
+
+# }}}
+
+# {{{ Queues
+
+my @queues;
+unless ($LastVersion) {
+    @queues = (
+        {
+            Name              => 'general',
+            Description       => 'The default queue',
+            CorrespondAddress => "rt\@localhost",
+            CommentAddress    => "rt-comment\@localhost"
+        }
+    );
+}
+
+# }}}
+
+# {{{ ScripActions
+
+my @ScripActions;
+
+unless ($LastVersion) {
+    @ScripActions = (
+
+        {
+            Name        => 'AutoreplyToRequestors',
+            Description =>
+'Always sends a message to the requestors independent of message sender',
+            ExecModule => 'Autoreply',
+            Argument   => 'Requestor'
+        },
+        {
+            Name        => 'NotifyRequestors',
+            Description => 'Sends a message to the requestors',
+            ExecModule  => 'Notify',
+            Argument    => 'Requestor'
+        },
+        {
+            Name        => 'NotifyOwnerAsComment',
+            Description => 'Sends mail to the owner',
+            ExecModule  => 'NotifyAsComment',
+            Argument    => 'Owner'
+        },
+        {
+            Name        => 'NotifyOwner',
+            Description => 'Sends mail to the owner',
+            ExecModule  => 'Notify',
+            Argument    => 'Owner'
+        },
+        {
+            Name        => 'NotifyAdminCcsAsComment',
+            Description => 'Sends mail to the administrative Ccs as a comment',
+            ExecModule  => 'NotifyAsComment',
+            Argument    => 'AdminCc'
+        },
+        {
+            Name        => 'NotifyAdminCcs',
+            Description => 'Sends mail to the administrative Ccs',
+            ExecModule  => 'Notify',
+            Argument    => 'AdminCc'
+        },
+
+        {
+            Name        => 'NotifyRequestorsAndCcsAsComment',
+            Description => 'Send mail to requestors and Ccs as a comment',
+            ExecModule  => 'NotifyAsComment',
+            Argument    => 'Requestor,Cc'
+        },
+
+        {
+            Name        => 'NotifyRequestorsAndCcs',
+            Description => 'Send mail to requestors and Ccs',
+            ExecModule  => 'Notify',
+            Argument    => 'Requestor,Cc'
+        },
+
+        {
+            Name        => 'NotifyAllWatchersAsComment',
+            Description => 'Send mail to all watchers',
+            ExecModule  => 'NotifyAsComment',
+            Argument    => 'All'
+        },
+        {
+            Name        => 'NotifyAllWatchers',
+            Description => 'Send mail to all watchers',
+            ExecModule  => 'Notify',
+            Argument    => 'All'
+        },
+    );
+}
+
+if ( $LastMinorVersion < 12 ) {
+    push (
+        @ScripActions,
+        {
+            Name        => 'NotifyOtherRecipientsAsComment',
+            Description => 'Sends mail to explicitly listed Ccs and Bccs',
+            ExecModule  => 'NotifyAsComment',
+            Argument    => 'OtherRecipients'
+        },
+        {
+            Name        => 'NotifyOtherRecipients',
+            Description => 'Sends mail to explicitly listed Ccs and Bccs',
+            ExecModule  => 'Notify',
+            Argument    => 'OtherRecipients'
+        },
+    );
+}
+
+# }}}
+
+# {{{ ScripConditions
+
+my @ScripConditions;
+unless ($LastVersion) {
+    @ScripConditions = (
+        {
+            Name                 => 'OnCreate',
+            Description          => 'When a ticket is created',
+            ApplicableTransTypes => 'Create',
+            ExecModule           => 'AnyTransaction',
+        },
+
+        {
+            Name                 => 'OnTransaction',
+            Description          => 'When anything happens',
+            ApplicableTransTypes => 'Any',
+            ExecModule           => 'AnyTransaction',
+        },
+        {
+
+            Name                 => 'OnCorrespond',
+            Description          => 'Whenever correspondence comes in',
+            ApplicableTransTypes => 'Correspond',
+            ExecModule           => 'AnyTransaction',
+        },
+
+        {
+
+            Name                 => 'OnComment',
+            Description          => 'Whenever comments come in',
+            ApplicableTransTypes => 'Comment',
+            ExecModule           => 'AnyTransaction'
+        },
+        {
+
+            Name                 => 'OnStatus',
+            Description          => 'Whenever a ticket\'s status changes',
+            ApplicableTransTypes => 'Status',
+            ExecModule           => 'AnyTransaction',
+
+        },
+        {
+            Name                 => 'OnResolve',
+            Description          => 'Whenever a ticket is resolved.',
+            ApplicableTransTypes => 'Status',
+            ExecModule           => 'StatusChange',
+            Argument             => 'resolved'
+
+        },
+
+    );
+}
+
+# }}}
+
+# {{{ Templates
+my @templates;
+
+unless ($LastVersion) {
+    @templates = (
+        {
+            Queue       => '0',
+            Name        => 'Autoreply',
+            Description => 'Default Autoresponse Template',
+            Content     => 'Subject: AutoReply: {$Ticket->Subject}
+
+
+Greetings,
+
+This message has been automatically generated in response to the
+creation of a trouble ticket regarding:
+       "{$Ticket->Subject()}", 
+a summary of which appears below.
+
+There is no need to reply to this message right now.  Your ticket has been
+assigned an ID of [{$rtname} #{$Ticket->id()}].
+
+Please include the string:
+
+         [{$rtname} #{$Ticket->id}]
+
+in the subject line of all future correspondence about this issue. To do so, 
+you may reply to this message.
+
+                        Thank you,
+                        {$Ticket->QueueObj->CorrespondAddress()}
+
+-------------------------------------------------------------------------
+{$Transaction->Content()}
+'
+        },
+
+        {
+
+            #                  id => 2,
+            Queue       => '0',
+            Name        => 'Transaction',
+            Description => 'Default transaction template',
+            Content     => '
+
+
+{$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
+Transaction: {$Transaction->Description}
+       Queue: {$Ticket->QueueObj->Name}
+     Subject: {$Transaction->Subject || $Ticket->Subject || "(No subject given)"}
+       Owner: {$Ticket->OwnerObj->Name}
+  Requestors: {$Ticket->Requestors->EmailsAsString()}
+      Status: {$Ticket->Status}
+ Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
+-------------------------------------------------------------------------
+{$Transaction->Content()}'
+        },
+
+        {
+
+            Queue       => '0',
+            Name        => 'AdminCorrespondence',
+            Description => 'Default admin correspondence template',
+            Content     => '
+
+
+<URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
+
+{$Transaction->Content()}'
+        },
+
+        {
+            Queue       => '0',
+            Name        => 'Correspondence',
+            Description => 'Default correspondence template',
+            Content     => '
+
+{$Transaction->Content()}'
+        },
+
+        {
+            Queue       => '0',
+            Name        => 'AdminComment',
+            Description => 'Default admin comment template',
+            Content     =>
+'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]//g; $comment =~ s/^Re//i; $s;}
+
+
+{$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
+This is a comment.  It is not sent to the Requestor(s):
+
+{$Transaction->Content()}
+'
+        },
+
+        {
+            Queue       => '0',
+            Name        => 'StatusChange',
+            Description => 'Ticket status changed',
+            Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
+
+
+{$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
+
+{$Transaction->Content()}
+'
+        },
+
+        {
+
+            Queue       => '0',
+            Name        => 'Resolved',
+            Description => 'Ticket Resolved',
+            Content     => 'Subject: Ticket Resolved
+
+According to our records, your request has been resolved. If you have any
+further questions or concerns, please respond to this message.
+'
+        }
+    );
+}
+
+# }}}
+
+# {{{ Scrips;
+
+my @scrips;
+unless ($LastVersion) {
+     @scrips = (
+                { Queue => 0,
+                  ScripCondition => 'OnCreate',
+                  ScripAction => 'AutoreplyToRequestors',
+                  Template => 'Autoreply'
+                },
+                { Queue => 0,
+                  ScripCondition => 'OnCreate',
+                  ScripAction => 'NotifyAdminCcs',
+                  Template => 'Transaction',
+                },
+                { Queue => 0,
+                  ScripCondition => 'OnCorrespond',
+                  ScripAction => 'NotifyAllWatchers',
+                  Template => 'Correspondence',
+                },
+                { Queue => 0,
+                  ScripCondition => 'OnComment',
+                  ScripAction => 'NotifyAdminCcsAsComment',
+                  Template => 'AdminComment',
+                },
+     ) 
+}
+if ( $LastMinorVersion < 12 ) {
+    push (
+        @scrips,
+                { Queue => 0,
+                  ScripCondition => 'OnComment',
+                  ScripAction => 'NotifyOtherRecipientsAsComment',
+                  Template => 'Correspondence',
+                },
+                { Queue => 0,
+                  ScripCondition => 'OnCorrespond',
+                  ScripAction => 'NotifyOtherRecipients',
+                  Template => 'Correspondence',
+                },
+        );
+}
+# }}}
+
+print "Creating ACL...";
+use RT::ACE;
+for $item (@acl) {
+    my $new_entry = new RT::ACE($CurrentUser);
+
+    #Using an internal function. this should never be used outside of the bootstrap script
+    my $return = $new_entry->_BootstrapRight(%$item);
+    print $return. ".";
+}
+print "done.\n";
+
+print "Creating users...";
+use RT::User;
+foreach $item (@users) {
+    my $new_entry = new RT::User($CurrentUser);
+    my ( $return, $msg ) = $new_entry->Create(%$item);
+    print "(Error: $msg)" unless ($return);
+    print $return. ".";
+}
+print "done.\n";
+
+print "Creating groups...";
+use RT::Group;
+foreach $item (@groups) {
+    my $new_entry = new RT::Group($CurrentUser);
+    my $return    = $new_entry->Create(%$item);
+    print $return. ".";
+}
+print "done.\n";
+
+print "Creating queues...";
+use RT::Queue;
+for $item (@queues) {
+    my $new_entry = new RT::Queue($CurrentUser);
+    my ( $return, $msg ) = $new_entry->Create(%$item);
+    print "(Error: $msg)" unless ($return);
+    print $return. ".";
+}
+
+print "done.\n";
+print "Creating ScripActions...";
+
+use RT::ScripAction;
+for $item (@ScripActions) {
+    my $new_entry = new RT::ScripAction($CurrentUser);
+    my $return    = $new_entry->Create(%$item);
+    print $return. ".";
+}
+
+print "done.\n";
+print "Creating ScripConditions...";
+
+use RT::ScripCondition;
+for $item (@ScripConditions) {
+    my $new_entry = new RT::ScripCondition($CurrentUser);
+    my $return    = $new_entry->Create(%$item);
+    print $return. ".";
+}
+
+print "done.\n";
+
+print "Creating templates...";
+
+use RT::Template;
+for $item (@templates) {
+    my $new_entry = new RT::Template($CurrentUser);
+    my $return    = $new_entry->Create(%$item);
+    print $return. ".";
+}
+print "done.\n";
+
+print "Creating Scrips...";
+
+use RT::Scrip;
+for $item (@scrips) {
+        my $new_entry = RT::Scrip->new($CurrentUser);
+        my ($return,$msg) = $new_entry->Create(%$item);
+        print "(Error: $msg)" unless ($return);
+        print $return.".";
+
+}
+print "done.\n";
+
+$RT::Handle->Disconnect();
+
+1;
+
diff --git a/rt/tools/testdeps b/rt/tools/testdeps
new file mode 100644 (file)
index 0000000..ddc3381
--- /dev/null
@@ -0,0 +1,115 @@
+#!/usr/bin/perl -w
+
+# $Header: /home/cvs/cvsroot/freeside/rt/tools/Attic/testdeps,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+# Copyright 2000 Jesse Vincent <jesse@fsck.com>
+# Distributed under the GNU General Public License
+# 
+
+#
+# This is just a basic script that checks to make sure that all
+# the modules needed by RT before you can install it.
+#
+
+use strict;
+
+use vars qw($mode $dbd $module @modules);
+
+$mode = shift || print_help();
+$dbd = shift || print_help();
+
+@modules = qw(
+Digest::MD5
+Storable
+DBI 1.18
+DBIx::DataSource 0.02
+DBIx::SearchBuilder 0.48
+HTML::Entities 
+MLDBM
+Net::Domain
+Net::SMTP
+Params::Validate 0.02
+HTML::Mason 1.02
+CGI::Cookie 1.20
+Apache::Cookie
+Apache::Session 1.53
+Date::Parse
+Date::Format 
+MIME::Entity 5.108
+Mail::Mailer 1.20
+Getopt::Long 2.24
+Tie::IxHash 
+Text::Wrapper 
+Text::Template
+File::Spec 0.8
+Errno
+FreezeThaw
+File::Temp 
+Log::Dispatch 1.6
+);
+
+
+if ($dbd =~ /mysql/i) {
+       push @modules, ('DBD::mysql','2.0416'); 
+}
+elsif ($dbd =~ /oracle/i) {
+       push @modules, ('DBD::Oracle','');
+}
+elsif ($dbd =~ /pg/i) {
+       push @modules, ('DBD::Pg','');
+}
+use CPAN;
+
+while ($module= shift @modules) {
+       my $version = "";
+       $version = " ". shift (@modules) . " " if ($modules[0] =~ /^([\d\.]*)$/);
+       print "Checking for $module$version";
+       eval "use $module$version" ;
+       if ($@) {
+       &resolve_dependency($module, $version) 
+       }
+       else {
+       print "...found\n";
+       }
+}
+
+sub print_help {
+print <<EOF;
+
+$0 FLAG DBTYPE
+
+
+$0 is a tool for RT that will tell you if you've got all
+the modules RT depends on properly installed.
+
+Flags: (only one flag is valid for a given run)
+
+-quiet will check to see if we've got everything we need
+       and will exit with a return code of (1) if we don't.
+
+-warn will tell you what isn't properly installed
+
+-fix will use CPAN to magically make everything better
+
+DBTYPE is one of:
+       oracle, pg, mysql
+
+EOF
+
+exit(0);
+}
+
+sub resolve_dependency {
+       my $module = shift;
+       my $version = shift;
+        print "....$module$version not installed.";
+    if ($mode =~ /-f/) {
+       $module = "DBD::mysql::Install" if ($module =~ /DBD::mysql/);
+       
+        print "Installing with CPAN...";
+        CPAN::install($module);
+     }
+     print "\n";
+       exit(1) if ($mode =~ /-q/);
+}      
+       
diff --git a/rt/webrt/Admin/Elements/CreateQueueCalled b/rt/webrt/Admin/Elements/CreateQueueCalled
new file mode 100755 (executable)
index 0000000..aeed6e7
--- /dev/null
@@ -0,0 +1,3 @@
+<FORM METHOD=get ACTION="<% $RT::WebPath %>/Admin/Queues/Create.html">
+Create a queue called <INPUT NAME="Name" size=10><input type=submit>
+</form>
diff --git a/rt/webrt/Admin/Elements/CreateUserCalled b/rt/webrt/Admin/Elements/CreateUserCalled
new file mode 100755 (executable)
index 0000000..7e4bb75
--- /dev/null
@@ -0,0 +1,3 @@
+<FORM METHOD=get ACTION="<%$RT::WebPath%>/Admin/Users/Create.html">
+New user called <INPUT NAME="Name" size=10><input type=submit value="Create">
+</form>
diff --git a/rt/webrt/Admin/Elements/EditUserComments b/rt/webrt/Admin/Elements/EditUserComments
new file mode 100755 (executable)
index 0000000..1ac7e18
--- /dev/null
@@ -0,0 +1,9 @@
+<& /Elements/Header, Title => "Comments about $name" &>
+These comments aren't generally visible to the user:<br>
+<input type="hidden" name="id" value="<%$id%>">
+<TEXTAREA COLS=60 ROWS=15 WRAP=SOFT NAME="Comments"><% $UserObj->Comments %></TEXTAREA>
+</FORM>
+
+<%ARGS>
+$UserObj => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/GrantQueueRightsTo b/rt/webrt/Admin/Elements/GrantQueueRightsTo
new file mode 100755 (executable)
index 0000000..3850a18
--- /dev/null
@@ -0,0 +1,30 @@
+<BR>
+
+% if ($msg) {
+<%$msg%>
+% } elsif ($Users) {
+<ul>
+% while (my $u = $Users->Next ) {
+<li> <%$u->Name%> (<%$u->RealName%>) <& SelectQueueRights, Name => "GrantTo".$u->id &>
+% }
+</ul>
+% }
+
+<%INIT>
+my ($msg, $Users);
+if (!$ARGS{'UserString'}) {
+$msg = "No users selected.";
+ }
+else {
+    $Users = new RT::Users($session{'CurrentUser'});
+    $Users->Limit(FIELD => $ARGS{'UserField'},
+                 VALUE => $ARGS{'UserString'},
+                 OPERATOR => $ARGS{'UserOp'});
+     }
+</%INIT>
+
+<%ARGS>
+$UserField => 'Name'
+$UserOp => '='
+$UserString => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/GroupTabs b/rt/webrt/Admin/Elements/GroupTabs
new file mode 100755 (executable)
index 0000000..261bef1
--- /dev/null
@@ -0,0 +1,18 @@
+<& /Admin/Elements/Tabs, subtabs => $subtabs, current_tab => 'Admin/Groups/' &>
+<hr>
+<%INIT>
+my $subtabs = { 
+             Basics => { title => 'Basics',
+                         path => "Admin/Groups/Modify.html?id=". $GroupObj->id
+                       }
+       };
+
+unless ($GroupObj->Pseudo) {
+$subtabs->{'Members'} = { title => 'Members',
+                         path => "Admin/Groups/Members.html?id=".$GroupObj->id };
+}
+</%INIT>
+
+<%ARGS>
+$GroupObj => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/Header b/rt/webrt/Admin/Elements/Header
new file mode 100755 (executable)
index 0000000..95acdac
--- /dev/null
@@ -0,0 +1,5 @@
+<& /Elements/Header, Title => $Title &>
+
+<%ARGS>
+$Title => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/ListGlobalKeywordSelects b/rt/webrt/Admin/Elements/ListGlobalKeywordSelects
new file mode 100644 (file)
index 0000000..b24d689
--- /dev/null
@@ -0,0 +1,15 @@
+% while (my $KeywordSelect = $KeywordSelects->Next()) {
+
+<%$KeywordSelect->Name %>:
+<% $KeywordSelect->Single ? 'Single' : 'Multiple' %>
+children of
+<% $KeywordSelect->KeywordObj->Path %>
+% if ($KeywordSelect->Depth) {
+         up to <%$KeywordSelect->Depth%> levels deep
+% }
+<BR>
+%} 
+<%INIT>
+my $KeywordSelects = RT::KeywordSelects->new($session{'CurrentUser'});
+$KeywordSelects->LimitToGlobals();
+</%INIT>
diff --git a/rt/webrt/Admin/Elements/ListGlobalScrips b/rt/webrt/Admin/Elements/ListGlobalScrips
new file mode 100755 (executable)
index 0000000..2f044bf
--- /dev/null
@@ -0,0 +1,10 @@
+%  while (my $scrip = $Scrips->Next ) {
+<% $scrip->ConditionObj->Name %> 
+<% $scrip->ActionObj->Name %> 
+with template <% $scrip->TemplateObj->Name %>
+<BR>
+%   }
+<%init>
+my $Scrips = new RT::Scrips ($session{'CurrentUser'});
+$Scrips->LimitToGlobal();
+</%INIT>
diff --git a/rt/webrt/Admin/Elements/ModifyKeyword b/rt/webrt/Admin/Elements/ModifyKeyword
new file mode 100644 (file)
index 0000000..4b01c36
--- /dev/null
@@ -0,0 +1,95 @@
+<FORM METHOD="get" ACTION="<%$RT::WebPath%>/Admin/Keywords/Modify.html">
+[<%$title |n %>]<BR>
+
+<INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>">
+Keyword <INPUT NAME="Name" VALUE="<% $Keyword->Name %>"><BR>
+
+Parent <SELECT NAME="Parent">
+             <OPTION VALUE=""<% defined($Keyword->Parent) ? '' : ' SELECTED' %>>-</OPTION>
+%while ( $parent = $parents->Next ) {
+             <OPTION VALUE="<% $parent->id %>"<% defined($Keyword->Parent) && $parent->id == $Keyword->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION>
+%}
+</SELECT>
+
+
+Kids <FONT SIZE="-2">(separate by
+<INPUT TYPE="radio" NAME="delim" VALUE="n"<% $delim eq 'n' ? ' CHECKED' : '' %>>
+line or
+<INPUT TYPE="radio" NAME="delim" VALUE="s"<% $delim eq 's' ? ' CHECKED' : '' %>>
+whitespace)</FONT><BR>
+
+<TEXTAREA NAME="Kids" ROWS=4><% $kidstring %></TEXTAREA>
+<BR>
+
+<& /Elements/Submit, Label => $submit &>
+</FORM>
+
+<%INIT>
+
+my $Keyword = new RT::Keyword($session{CurrentUser});
+my ($title, $submit, %kids, $kid);
+
+if ( $Create ) {
+    $title = "Create a new Keyword";
+    $submit = "Create";
+    $id = "new";
+    %kids = ();
+    $Parent = ''; #silence 
+} elsif ( $id eq 'new' ) {
+    $id = $Keyword->Create( Name => $Name, Parent => $Parent )
+      or Abort("can't create keyword Name=>$Name, Parent=>$Parent");
+} else {
+    $Keyword->Load($id) || Abort("Can't load keyword id $id");
+    #foreach my $field ( grep eval "defined(\$$_)", qw( Name Parent )) {
+    #  eval "\$Keyword->Set(\$field=>\$$field); #sigh
+    #}
+    $Keyword->SetName($Name) if defined($Name);
+    $Keyword->SetParent($Parent) if defined($Parent);
+}
+
+$title = "Modify the Keyword <B>". $Keyword->Name. "</B>";
+$submit = "Modify";
+
+my $kids = new RT::Keywords($session{CurrentUser});
+$kids->Limit( FIELD => 'Parent', VALUE => $id, OPERATOR => '=' );
+$kids{$kid->Name} = $kid while $kid = $kids->Next;
+
+if ( defined($Kids) ) {
+    my %newkids;
+    if ( $delim eq 'n' ) {
+       %newkids = map { $_=>1 } split(/\n/, $Kids);
+    } elsif ( $delim eq 's' ) {
+       %newkids = map { $_=>1 } split(' ', $Kids);
+    } else {
+       Abort("'$delim' isn't a valid keyword delimiter.");
+    }
+    foreach ( grep { ! defined($newkids{$_}) } keys %kids ) {
+       $kids{$_}->Delete;
+       delete $kids{$_};
+    }
+    foreach ( grep { ! defined($kids{$_}) } keys %newkids ) {
+       $kids{$_} = new RT::Keyword($session{CurrentUser});
+       $kids{$_}->Create( Name => $_, Parent => $id )
+         or Abort("can't create keyword Name=>$_, Parent=>$id");
+    }
+
+}
+
+
+my $parent;
+my $parents = new RT::Keywords($session{CurrentUser});
+$parents->UnLimit;
+
+$delim = ( grep /\s/, keys %kids ) ? 'n' : 's';
+my $kidstring = join("\n", keys %kids);
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Create => undef
+$Name => undef
+$Parent => undef
+$Kids => undef
+$delim => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/ModifyKeywordSelect b/rt/webrt/Admin/Elements/ModifyKeywordSelect
new file mode 100644 (file)
index 0000000..470e629
--- /dev/null
@@ -0,0 +1,120 @@
+  <FORM NAME="ModifyKeywordSelect" METHOD=POST ACTION="<%$RT::WebPath%>/Admin/KeywordSelects/Modify.html">
+
+    [<%$title |n %>]
+    <BR>
+      
+      <INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>">
+       Keyword 
+       <SELECT NAME="Parent">
+         
+%while ( $parent = $parents->Next ) {
+         
+         <OPTION VALUE="<% $parent->id %>" <% defined($KeywordSelect->Parent) && $parent->id == $KeywordSelect->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION>
+         
+% }
+         
+       </SELECT>
+       <BR>
+         Object 
+         <SELECT NAME="ObjectType">
+           <OPTION SELECTED>Ticket</OPTION>
+         </SELECT>
+         <BR>
+           
+<SCRIPT>
+function addOption(text, value, defaultselected, selected) {
+  var option = new Option(text, value, defaultselected, selected )
+  var length = document.ModifyKeywordSelect.ObjectValue.length;
+  document.ModifyKeywordSelect.ObjectValue.options[length] = option
+}
+function ChangeObjectValue(what) {
+  Value = what.options[what.selectedIndex].value
+  if ( Value == "(none)" ) {
+    document.ModifyKeywordSelect.ObjectValue.options.length = 0
+    addOption("(n/a)", "", false, false)
+  }
+  if ( Value == "Queue" ) {
+    document.ModifyKeywordSelect.ObjectValue.options.length = 0
+%foreach $queue ( keys %queues ) {
+    addOption("<% $queues{$queue} %>", "<% $queue %>", false, <% $queue == $KeywordSelect->ObjectValue ? 'true' : 'false' %> )
+%}
+  }
+}
+</SCRIPT>
+           
+           Limit to <SELECT NAME="ObjectField" onChange="ChangeObjectValue(this)">
+             <OPTION VALUE="" <% $KeywordSelect->ObjectField ? '' : ' SELECTED' %>>(none)</OPTION>
+             <OPTION VALUE="Queue" <% $KeywordSelect->ObjectField eq 'Queue' ? ' SELECTED' : '' %>>Queue</OPTION>
+           </SELECT> 
+           <SELECT NAME="ObjectValue">
+             <OPTION VALUE="<% $KeywordSelect->ObjectValue %>">
+               <% $KeywordSelect->ObjectField ? $queues{$KeywordSelect->ObjectValue} : "(n/a)" %></OPTION>
+           </SELECT><BR>
+             <INPUT TYPE="hidden" NAME="SingleMagic" VALUE="1">
+               <INPUT TYPE="checkbox" NAME="Single" VALUE="1" <% $KeywordSelect->Single ? ' CHECKED' : '' %>>Allow single selection only<BR>
+                   Limit to <INPUT TYPE="text" NAME="Generations" SIZE="2" VALUE="<% $KeywordSelect->Generations %>"> generations (0 = no limit)<BR>
+                       <& /Elements/Submit, Label => $submit &>
+
+</FORM>
+
+<%INIT>
+
+
+my $KeywordSelect = new RT::KeywordSelect($session{CurrentUser});
+  
+my($title, $submit);
+  
+if ( $Create ) {
+      $title = "Create a new KeywordSelect";
+      $submit = "Create";
+      $id = "new";
+} else {
+    if  ( $id eq 'new' ) {
+       $id = $KeywordSelect->Create (
+                                     Parent      => $Parent,
+                                     ObjectType  => $ObjectType,
+                                     ObjectField => $ObjectField,
+                                     ObjectValue => $ObjectValue,
+                                     Single      => $Single,
+                                     Generations => $Generations,
+                                    ) or Abort "can't create KeywordSelect";
+    } else {
+       $KeywordSelect->Load($id) || Abort("Can't load keyword id $id");
+       #false laziness
+       $KeywordSelect->SetParent($Parent) if defined($Parent);
+       $KeywordSelect->SetObjectType($ObjectType) if defined($ObjectType);
+       $KeywordSelect->SetObjectField($ObjectField) if defined($ObjectField);
+       $KeywordSelect->SetObjectValue($ObjectValue) if defined($ObjectValue);
+       $KeywordSelect->SetSingle($Single) if defined($SingleMagic);
+       $KeywordSelect->SetGenerations($Generations) if defined($Generations);
+    }
+    $title = "Modify the KeywordSelect <B>". $KeywordSelect->KeywordObj->Name. "</B>";
+    $submit = "Modify";
+    
+}
+  
+  my $parents = new RT::Keywords($session{CurrentUser});
+  $parents->UnLimit;
+  my $parent;
+
+my $queues = new RT::Queues($session{CurrentUser});
+$queues->UnLimit;
+
+my %queues;
+my $queue;
+$queues{$queue->id} = $queue->Name while $queue = $queues->Next;
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Create => undef
+$Parent => undef
+$ObjectType => undef
+$ObjectField => undef
+$ObjectValue => undef
+$Single => undef
+$SingleMagic => undef
+$Generations => undef
+</%ARGS>
+
diff --git a/rt/webrt/Admin/Elements/ModifyQueue b/rt/webrt/Admin/Elements/ModifyQueue
new file mode 100755 (executable)
index 0000000..a641c81
--- /dev/null
@@ -0,0 +1,56 @@
+
+<& /Elements/TitleBoxStart, title => 'Editing Configuration for queue '.$QueueObj->Id &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Queues/Modify.html" METHOD=POST>
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
+<TABLE>
+<TR><TD ALIGN=RIGHT>
+Queue Name: 
+</TD>
+<TD><INPUT name="Name" value="<%$QueueObj->Name%>"></TD>
+</TR><TR>
+<TD ALIGN=RIGHT>
+Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$QueueObj->Description%>" size=60></TD></TR>
+<TR>
+<TD ALIGN=RIGHT>
+Correspondence Address:
+</TD><TD>
+<INPUT name="CorrespondAddress" value="<%$QueueObj->CorrespondAddress%>">
+</TD>
+<TD ALIGN=RIGHT>
+
+Comment Address: </TD><TD>
+<INPUT NAME="CommentAddress" value="<%$QueueObj->CommentAddress%>">
+</TD>
+</TR><TR>
+
+<TD ALIGN=RIGHT>
+Priority starts at: 
+</TD><TD><INPUT NAME="InitialPriority" value="<%$QueueObj->InitialPriority %>">
+</TD>
+<TD ALIGN=RIGHT>
+Over time, priority moves toward:
+</TD><TD><INPUT NAME="FinalPriority" value="<%$QueueObj->FinalPriority %>">
+</TD>
+</TR>
+<TR>
+<TD ALIGN=RIGHT>
+Requests should be due in:
+</TD><TD>
+<INPUT NAME="DefaultDueIn" VALUE="<%$QueueObj->DefaultDueIn%>"> days.
+</TD>
+</TR>
+</TABLE>
+<& /Elements/Submit &>
+</form>
+<& /Elements/TitleBoxEnd &>
+
+<%INIT>
+
+</%INIT>
+
+<%ARGS>
+
+
+$QueueObj => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/ModifyTemplate b/rt/webrt/Admin/Elements/ModifyTemplate
new file mode 100755 (executable)
index 0000000..6e4f8a3
--- /dev/null
@@ -0,0 +1,78 @@
+
+<& /Elements/TitleBoxStart, title => 'Editing Configuration for user '.$UserObj->Name &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/ModifyUser.html" METHOD=POST>
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>">
+
+Name: <input name="Name" value="<%$UserObj->Name%>">
+<BR>
+New Password: <input type=password name="Pass1"><BR>
+Retype Password: <input type=password name="Pass2"><BR>
+
+Comments: <TEXTAREA name="Comments" COLS=20 ROWS=5>
+<%$UserObj->Comments%></TEXTAREA>
+
+<BR>
+Signature: <TEXTAREA COLS=80 ROWS=5 name="Signature">
+<%$UserObj->Signature%>"></TEXTAREA>
+<BR>
+EmailAddress: <input name="EmailAddress" value="<%$UserObj->EmailAddress%>">
+<BR>
+FreeformContactInfo: <input name="FreeformContactInfo" value="<%$UserObj->FreeformContactInfo%>">
+<BR>
+Organization: <input name="Organization" value="<%$UserObj->Organization%>">
+<BR>
+RealName: <input name="RealName" value="<%$UserObj->RealName%>">
+<BR>
+NickName: <input name="NickName" value="<%$UserObj->NickName%>">
+<BR>
+Lang: <input name="Lang" value="<%$UserObj->Lang%>">
+<BR>
+EmailEncoding: <input name="EmailEncoding" value="<%$UserObj->EmailEncoding%>">
+<BR>
+WebEncoding: <input name="WebEncoding" value="<%$UserObj->WebEncoding%>">
+<BR>
+ExternalContactInfoId: <input name="ExternalContactInfoId" value="<%$UserObj->ExternalContactInfoId%>">
+<BR>
+ContactInfoSystem: <input name="ContactInfoSystem" value="<%$UserObj->ContactInfoSystem%>">
+<BR>
+Gecos: <input name="Gecos" value="<%$UserObj->Gecos%>">
+<BR>
+ExternalAuthId: <input name="ExternalAuthId" value="<%$UserObj->ExternalAuthId%>">
+<BR>
+AuthSystem: <input name="AuthSystem" value="<%$UserObj->AuthSystem%>">
+<BR>
+HomePhone: <input name="HomePhone" value="<%$UserObj->HomePhone%>">
+<BR>
+WorkPhone: <input name="WorkPhone" value="<%$UserObj->WorkPhone%>">
+<BR>
+MobilePhone: <input name="MobilePhone" value="<%$UserObj->MobilePhone%>">
+<BR>
+PagerPhone: <input name="PagerPhone" value="<%$UserObj->PagerPhone%>">
+<BR>
+Address1: <input name="Address1" value="<%$UserObj->Address1%>">
+<BR>
+Address2: <input name="Address2" value="<%$UserObj->Address2%>">
+<BR>
+City: <input name="City" value="<%$UserObj->City%>">
+<BR>
+State: <input name="State" value="<%$UserObj->State%>">
+<BR>
+Zip: <input name="Zip" value="<%$UserObj->Zip%>">
+<BR>
+Country: <input name="Country" value="<%$UserObj->Country%>">
+<BR>
+
+<input type=submit>
+</form>
+<& /Elements/TitleBoxEnd &>
+
+<%INIT>
+
+</%INIT>
+
+<%ARGS>
+
+
+$UserObj => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/ModifyUser b/rt/webrt/Admin/Elements/ModifyUser
new file mode 100755 (executable)
index 0000000..53aa027
--- /dev/null
@@ -0,0 +1,77 @@
+
+<& /Elements/TitleBoxStart, title => 'Editing Configuration for user '.$UserObj->Name &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Users/Modify.html" METHOD=POST>
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>">
+
+Name: <input name="Name" value="<%$UserObj->Name%>">
+<BR>
+New Password: <input type=password name="Pass1"><BR>
+Retype Password: <input type=password name="Pass2"><BR>
+
+Comments: <TEXTAREA name="Comments" COLS=80 ROWS=5 WRAP=VIRTUAL>
+<%$UserObj->Comments%></TEXTAREA>
+
+<BR>
+Signature: <TEXTAREA COLS=80 ROWS=5 name="Signature" WRAP=HARD>
+<%$UserObj->Signature%></TEXTAREA>
+<BR>
+EmailAddress: <input name="EmailAddress" value="<%$UserObj->EmailAddress%>">
+<BR>
+FreeformContactInfo: <input name="FreeformContactInfo" value="<%$UserObj->FreeformContactInfo%>">
+<BR>
+Organization: <input name="Organization" value="<%$UserObj->Organization%>">
+<BR>
+RealName: <input name="RealName" value="<%$UserObj->RealName%>">
+<BR>
+NickName: <input name="NickName" value="<%$UserObj->NickName%>">
+<BR>
+Lang: <input name="Lang" value="<%$UserObj->Lang%>">
+<BR>
+EmailEncoding: <input name="EmailEncoding" value="<%$UserObj->EmailEncoding%>">
+<BR>
+WebEncoding: <input name="WebEncoding" value="<%$UserObj->WebEncoding%>">
+<BR>
+ExternalContactInfoId: <input name="ExternalContactInfoId" value="<%$UserObj->ExternalContactInfoId%>">
+<BR>
+ContactInfoSystem: <input name="ContactInfoSystem" value="<%$UserObj->ContactInfoSystem%>">
+<BR>
+Gecos: <input name="Gecos" value="<%$UserObj->Gecos%>">
+<BR>
+ExternalAuthId: <input name="ExternalAuthId" value="<%$UserObj->ExternalAuthId%>">
+<BR>
+AuthSystem: <input name="AuthSystem" value="<%$UserObj->AuthSystem%>">
+<BR>
+HomePhone: <input name="HomePhone" value="<%$UserObj->HomePhone%>">
+<BR>
+WorkPhone: <input name="WorkPhone" value="<%$UserObj->WorkPhone%>">
+<BR>
+MobilePhone: <input name="MobilePhone" value="<%$UserObj->MobilePhone%>">
+<BR>
+PagerPhone: <input name="PagerPhone" value="<%$UserObj->PagerPhone%>">
+<BR>
+Address1: <input name="Address1" value="<%$UserObj->Address1%>">
+<BR>
+Address2: <input name="Address2" value="<%$UserObj->Address2%>">
+<BR>
+City: <input name="City" value="<%$UserObj->City%>">
+<BR>
+State: <input name="State" value="<%$UserObj->State%>">
+<BR>
+Zip: <input name="Zip" value="<%$UserObj->Zip%>">
+<BR>
+Country: <input name="Country" value="<%$UserObj->Country%>">
+<BR>
+<& /Elements/Submit &>
+</form>
+<& /Elements/TitleBoxEnd &>
+
+<%INIT>
+
+</%INIT>
+
+<%ARGS>
+
+
+$UserObj => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/QueueRightsForUser b/rt/webrt/Admin/Elements/QueueRightsForUser
new file mode 100644 (file)
index 0000000..e62a124
--- /dev/null
@@ -0,0 +1,17 @@
+<UL>
+%while(my $ACE = $ACL->Next) {
+
+<LI><checkbox name="delete_ace_<%$ACE->id%>"> <%$ACE->RightName%> (<%$ACE->UserObj->RealName%>)
+
+%}
+</UL>
+
+<%INIT>
+my $ACL = new RT::ACL($session{'CurrentUser'});
+$ACL->LimitToQueue($QueueObj->id);
+$ACL->LimitPrincipalToUser($PrincipalId);
+</%INIT>
+<%ARGS>
+$PrincipalId => undef
+$QueueObj => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/QueueTabs b/rt/webrt/Admin/Elements/QueueTabs
new file mode 100755 (executable)
index 0000000..b7da7e0
--- /dev/null
@@ -0,0 +1,36 @@
+<& /Admin/Elements/Tabs, subtabs => $subtabs, current_tab => 'Admin/Queues/' &>
+<hr>
+<%INIT>
+  my $subtabs = {
+                A => { title => 'Basics',
+                       path => "Admin/Queues/Modify.html?id=".$id,
+                          },
+                B => { title => 'Watchers',
+                       path => "Admin/Queues/People.html?id=".$id,
+                     },
+
+                C => { title => 'Scrips',
+                            path => "Admin/Queues/Scrips.html?id=".$id,
+                          },
+                D => { title => 'Templates',
+                               path => "Admin/Queues/Templates.html?id=".$id,
+                             },
+                E => { title => 'Keyword Selections',
+                               path => "Admin/Queues/Keywords.html?id=".$id,
+                       },
+                F => { title => 'Group Rights',
+                         path => "Admin/Queues/GroupRights.html?id=".$id,
+                       },      
+                G => { title => 'User Rights',
+                         path => "Admin/Queues/UserRights.html?id=".$id,
+                       },
+
+
+                
+};
+</%INIT>
+
+  
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectKeywordSelect b/rt/webrt/Admin/Elements/SelectKeywordSelect
new file mode 100644 (file)
index 0000000..f5a8d77
--- /dev/null
@@ -0,0 +1,22 @@
+<input size=10 name="<%$NamePrefix%>-Name" value="<% $KeywordSelect->Name %>">:
+<& /Admin/Elements/SelectSingleOrMultiple, 
+         Name => $NamePrefix.'-Single',
+         Default => $KeywordSelect->Single &>
+         
+children of
+<& /Elements/SelectKeyword, Root => '0', 
+                           Name => $NamePrefix.'-Keyword',
+                            Default => $KeywordSelect->KeywordObj->Id &>
+         up to <input name="<%$NamePrefix%>-Depth" size=2 value="<%$KeywordSelect->Depth%>"> levels deep.
+<%INIT>
+unless ($NamePrefix) {
+       $NamePrefix = $KeywordSelect->Id;
+}
+$NamePrefix = "KeywordSelect-$NamePrefix";
+
+</%INIT>
+
+<%ARGS>
+$KeywordSelect => undef
+$NamePrefix => undef
+</%ARGS>
\ No newline at end of file
diff --git a/rt/webrt/Admin/Elements/SelectModifyGroup b/rt/webrt/Admin/Elements/SelectModifyGroup
new file mode 100644 (file)
index 0000000..45d437f
--- /dev/null
@@ -0,0 +1,10 @@
+%while ( $Group = $Groups->Next) {
+<A HREF="Modify.html?id=<%$Group->id%>"><%$Group->id%>: <%$Group->Name%></a><BR>
+%}
+<%INIT>
+my ($Group);
+my $Groups = new RT::Groups($session{'CurrentUser'});
+$Groups->UnLimit;
+</%INIT>
+<%ARGS>
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectModifyKeyword b/rt/webrt/Admin/Elements/SelectModifyKeyword
new file mode 100644 (file)
index 0000000..6af2232
--- /dev/null
@@ -0,0 +1,13 @@
+%while ( $keyword = $keywords->Next ) {
+<A HREF="/Admin/Keywords/Modify.html?id=<%$keyword->id%>"><%$keyword->id%>: <%$keyword->Name%></a><BR>
+%}
+
+<%INIT>
+
+use RT::Keywords;
+
+my $keyword;
+my $keywords = new RT::Keywords $session{CurrentUser};
+$keywords->UnLimit;
+</%INIT>
+
diff --git a/rt/webrt/Admin/Elements/SelectModifyKeywordSelect b/rt/webrt/Admin/Elements/SelectModifyKeywordSelect
new file mode 100644 (file)
index 0000000..c91eb6c
--- /dev/null
@@ -0,0 +1,13 @@
+%while ( $keywordselect = $keywordselects->Next ) {
+<A HREF="/Admin/KeywordSelects/Modify.html?id=<%$keywordselect->id%>"><%$keywordselect->id%>: ( <%$keywordselect->Parent%>: <%$keywordselect->KeywordObj->Name%> )</a><BR>
+%}
+
+<%INIT>
+
+use RT::KeywordSelects;
+
+my $keywordselect;
+my $keywordselects = new RT::KeywordSelects $session{CurrentUser};
+$keywordselects->UnLimit;
+</%INIT>
+
diff --git a/rt/webrt/Admin/Elements/SelectModifyQueue b/rt/webrt/Admin/Elements/SelectModifyQueue
new file mode 100755 (executable)
index 0000000..1c6cd7d
--- /dev/null
@@ -0,0 +1,10 @@
+%while ( $queue = $queues->Next) {
+<A HREF="Modify.html?id=<%$queue->id%>"><%$queue->id%>: <%$queue->Name%></a><BR>
+%}
+<%INIT>
+my ($queue);
+my $queues = new RT::Queues($session{'CurrentUser'});
+$queues->UnLimit;
+</%INIT>
+<%ARGS>
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectModifyUser b/rt/webrt/Admin/Elements/SelectModifyUser
new file mode 100755 (executable)
index 0000000..da49212
--- /dev/null
@@ -0,0 +1,26 @@
+%while ( $user = $users->Next) {
+<A HREF="Modify.html?id=<%$user->id%>"><%$user->id%>: <%$user->Name%></a><BR>
+%}
+<%INIT>
+my ($user);
+my $users = new RT::Users($session{'CurrentUser'});
+$users->Limit(FIELD => 'id',
+              VALUE => $RT::SystemUser->id,
+              OPERATOR => '!=' );
+
+if (defined $IdLike) {
+$users->Limit(FIELD => 'Name',
+              VALUE => $IdLike,
+              OPERATOR => 'LIKE' );
+}
+if (defined $EmailLike) {
+$users->Limit(FIELD => 'EmailAddress',
+              VALUE => $EmailLike,
+              OPERATOR => 'LIKE');
+
+}
+</%INIT>
+<%ARGS>
+$IdLike => undef
+$EmailLike => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectQueueRights b/rt/webrt/Admin/Elements/SelectQueueRights
new file mode 100755 (executable)
index 0000000..6861d40
--- /dev/null
@@ -0,0 +1,29 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Admin/Elements/Attic/SelectQueueRights,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+<SELECT NAME ="<%$Name%>">
+<OPTION VALUE="">-</OPTION>
+%foreach $right (@rights) {
+<OPTION VALUE="<%$right%>" <%($Default eq $right) && 'SELECTED'%>><%$right%></OPTION>
+% }
+</SELECT>
+<%ONCE>
+
+use RT::ACE;
+my $ACE = new RT::ACE($session{'CurrentUser'});
+my %QueueRights = $ACE->QueueRights;
+my %TicketRights = $ACE->TicketRights;
+
+my ($key, $right, @rights);
+
+foreach $key (sort keys %QueueRights) {
+push (@rights, $QueueRights{$key} . " ($key)");
+}
+foreach $key (sort keys %TicketRights) {
+push (@rights, $TicketRights{$key} . " ($key)");
+}
+</%ONCE>
+<%ARGS>
+$Name => undef
+$Default => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectRights b/rt/webrt/Admin/Elements/SelectRights
new file mode 100644 (file)
index 0000000..0ac7749
--- /dev/null
@@ -0,0 +1,58 @@
+<INPUT TYPE=HIDDEN NAME="CheckACL"  VALUE="<%$ACLDesc%>">
+     <TABLE BORDER=0>
+<TR>
+<TD valign=top>
+<h3>New rights</h3> 
+<SELECT SIZE=5  MULTIPLE  NAME="GrantACE-<%$ACLDesc%>">
+% foreach $right (sort keys %Rights) {
+      <OPTION VALUE="<%$right%>"  
+       ><%$right%></OPTION>
+% }
+<OPTION VALUE="" SELECTED>(no value)</OPTION>
+</SELECT>
+</TD>
+<TD valign=top> 
+<h3>Current rights</h3>
+<i>(Check box to revoke right)</i> <BR>
+% while (my $right = $ACLObj->Next()) {
+% if ($right->RightName) {
+<input type=checkbox value="<%$right->Id%>" name="RevokeACE"> <%$right->RightName%><br>
+% }
+%  }
+</TD>
+</TR>
+</TABLE>
+<%INIT>
+    my ($right, $ACLDesc, $AppliesTo, %Rights);
+   
+       
+    my $ACLObj = new RT::ACL($session{'CurrentUser'});
+    my $ACE = new RT::ACE($session{'CurrentUser'});
+
+    if ($Scope eq 'Queue') { 
+        $AppliesTo = $QueueObj->Id;
+        $ACLObj->LimitToQueue($AppliesTo);
+        %Rights = $ACE->QueueRights();
+    } 
+    elsif ($Scope eq 'System') {
+        $AppliesTo = 0;
+        $ACLObj->LimitToSystem();
+        %Rights =  ( $ACE->SystemRights , $ACE->QueueRights());
+    }
+
+    if ($PrincipalType eq 'Group') {
+        $ACLObj->LimitPrincipalToGroup($PrincipalObj->Id);
+    } 
+    elsif ($PrincipalType eq 'User') {
+        $ACLObj->LimitPrincipalToUser($PrincipalObj->Id);
+    } 
+    
+    $ACLDesc = "$PrincipalType-".$PrincipalObj->Id."-$Scope-$AppliesTo";
+</%INIT>
+    
+<%ARGS>
+$PrincipalType => undef
+$PrincipalObj => undef
+$Scope => undef
+$QueueObj => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectScrip b/rt/webrt/Admin/Elements/SelectScrip
new file mode 100755 (executable)
index 0000000..4ae15d8
--- /dev/null
@@ -0,0 +1,25 @@
+<SELECT NAME=<%$Name%>>
+<OPTION VALUE="" 
+<% $Default eq undef && 'SELECTED' %>
+>-</OPTION>
+%while  (my $Scrip = $Scrips->Next) {
+<OPTION VALUE=<%$Scrip->Id%>
+<% $Scrip->Id == $Default && 'SELECTED' %>
+><%$Scrip->Name%>
+</OPTION>
+%}
+</SELECT>
+
+<%INIT>
+my $Scrips = RT::Scrips->new($session{'CurrentUser'});
+$Scrips->UnLimit;
+
+
+
+</%INIT>
+<%ARGS>
+
+$Default => undef
+$Name => 'Scrip'
+
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectScripAction b/rt/webrt/Admin/Elements/SelectScripAction
new file mode 100644 (file)
index 0000000..08a1734
--- /dev/null
@@ -0,0 +1,25 @@
+<SELECT NAME=<%$Name%>>
+<OPTION VALUE="" 
+<% $Default eq undef && 'SELECTED' %>
+>-</OPTION>
+%while  (my $ScripAction = $ScripActions->Next) {
+<OPTION VALUE=<%$ScripAction->Id%>
+<% $ScripAction->Id == $Default && 'SELECTED' %>
+><%$ScripAction->Name%>
+</OPTION>
+%}
+</SELECT>
+
+<%INIT>
+my $ScripActions = RT::ScripActions->new($session{'CurrentUser'});
+$ScripActions->UnLimit;
+
+
+
+</%INIT>
+<%ARGS>
+
+$Default => undef
+$Name => 'ScripAction'
+
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectScripCondition b/rt/webrt/Admin/Elements/SelectScripCondition
new file mode 100644 (file)
index 0000000..434f0c4
--- /dev/null
@@ -0,0 +1,25 @@
+<SELECT NAME=<%$Name%>>
+<OPTION VALUE="" 
+<% $Default eq undef && 'SELECTED' %>
+>-</OPTION>
+%while  (my $ScripCondition = $ScripConditions->Next) {
+<OPTION VALUE=<%$ScripCondition->Id%>
+<% $ScripCondition->Id == $Default && 'SELECTED' %>
+><%$ScripCondition->Name%>
+</OPTION>
+%}
+</SELECT>
+
+<%INIT>
+my $ScripConditions = RT::ScripConditions->new($session{'CurrentUser'});
+$ScripConditions->UnLimit;
+
+
+
+</%INIT>
+<%ARGS>
+
+$Default => undef
+$Name => 'ScripCondition'
+
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectSingleOrMultiple b/rt/webrt/Admin/Elements/SelectSingleOrMultiple
new file mode 100644 (file)
index 0000000..307b021
--- /dev/null
@@ -0,0 +1,20 @@
+  <select name="<%$Name%>">
+    <option value="1" <%$SingleDefault%>>Single</option>
+    <option value="0" <%$MultipleDefault%>>Multiple</option>
+  </select>    
+
+
+<%INIT>
+my ($SingleDefault, $MultipleDefault);
+if ($Default == 1) {
+    $SingleDefault = "SELECTED";
+}
+elsif ($Default == 0 ) {
+    $MultipleDefault = "SELECTED";
+}
+
+</%INIT>
+<%ARGS>
+$Name => 'Single'
+$Default => 1
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectTemplate b/rt/webrt/Admin/Elements/SelectTemplate
new file mode 100755 (executable)
index 0000000..76550dc
--- /dev/null
@@ -0,0 +1,37 @@
+<SELECT NAME=<%$Name%>>
+<OPTION VALUE="" 
+<% $Default eq 'none' && 'SELECTED' %>
+>-</OPTION>
+%while  (my $Template = $PrimaryTemplates->Next) {
+<OPTION VALUE=<%$Template->Id%>
+<% ($Template->Id == $Default) && 'SELECTED' %>
+><%$Template->Name%>
+</OPTION>
+%}
+%while  (my $Template = $OtherTemplates->Next) {
+<OPTION VALUE=<%$Template->Id%>
+<% ($Template->Id == $Default)  && 'SELECTED'%>
+>Global template: <%$Template->Name%>
+</OPTION>
+%}
+</SELECT>
+
+<%INIT>
+
+
+my $PrimaryTemplates = RT::Templates->new($session{'CurrentUser'});
+if ($DefaultQueue != 0) {
+$PrimaryTemplates->LimitToQueue($DefaultQueue);
+}
+
+my $OtherTemplates = RT::Templates->new($session{'CurrentUser'});
+$OtherTemplates->LimitToGlobal($DefaultQueue);
+
+</%INIT>
+<%ARGS>
+
+$Default => 'none'
+$DefaultQueue => undef
+$Name => 'Template'
+
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SelectUsers b/rt/webrt/Admin/Elements/SelectUsers
new file mode 100644 (file)
index 0000000..af51c60
--- /dev/null
@@ -0,0 +1,17 @@
+<SELECT MULTIPLE NAME="<%$Name%>"  SIZE=10>
+%while (my $user = $users->Next) {
+<OPTION VALUE="<%$user->id%>"><%$user->Name%>
+%}
+</SELECT>
+
+<%INIT>
+my $users = new RT::Users($session{'CurrentUser'});
+
+$users->Limit(FIELD => 'id', VALUE => $RT::SystemUser->id, OPERATOR => '!=' );
+$users->Limit(FIELD => 'id', VALUE => $RT::Nobody->id, OPERATOR => '!=' );
+$users->LimitToPrivileged();
+
+</%INIT>
+<%ARGS>
+$Name => 'Users'
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/SystemTabs b/rt/webrt/Admin/Elements/SystemTabs
new file mode 100755 (executable)
index 0000000..f8b2312
--- /dev/null
@@ -0,0 +1,31 @@
+<& /Admin/Elements/Tabs, subtabs => $subtabs, current_tab => 'Admin/Global/', current_subtab => $current_subtab &>
+<hr>
+<%INIT>
+  my $subtabs = {
+               
+              A => { title => 'Scrips',
+                          path => 'Admin/Global/Scrips.html',
+                        },
+              Ba => { title => 'Keyword Selections',           
+                               path => 'Admin/Global/Keywords.html',
+                     },
+
+              B => { title => 'Templates',
+                       path => 'Admin/Global/Templates.html',
+                     },
+               C => { title => 'Group Rights',
+                               path => 'Admin/Global/GroupRights.html',
+                     },
+               D => { title => 'User Rights',
+                               path => 'Admin/Global/UserRights.html',
+                     }
+
+
+};
+</%INIT>
+
+  
+<%ARGS>
+$id => undef
+$current_subtab => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/Tabs b/rt/webrt/Admin/Elements/Tabs
new file mode 100755 (executable)
index 0000000..ee6d82b
--- /dev/null
@@ -0,0 +1,31 @@
+<& /Elements/Tabs, tabs => $tabs, subtabs => $subtabs, current_toptab => 'Admin/', current_tab => $current_tab, current_subtab => $current_subtab&>
+
+<hr>
+  
+<%INIT>
+  my $tabs = { Users => { title => 'Users',
+                         path => 'Admin/Users/',
+                       },
+              Groups => { title => 'Groups',
+                          path => 'Admin/Groups/',
+                        },
+              Queues => { title => 'Queues',
+                          path => 'Admin/Queues/',
+                        },
+              System => { 'title' => 'Global',
+                          path => 'Admin/Global/',
+                        },
+               Keywords => { title => 'Keywords',
+                                   path => 'Admin/Keywords/',
+                                 },
+
+              
+            };
+</%INIT>
+
+
+<%ARGS>
+$subtabs => undef
+$current_tab => undef
+$current_subtab => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Elements/UserTabs b/rt/webrt/Admin/Elements/UserTabs
new file mode 100755 (executable)
index 0000000..bbf1731
--- /dev/null
@@ -0,0 +1,21 @@
+<& /Admin/Elements/Tabs, subtabs => $subtabs,
+                        current_tab => 'Admin/Users/', 
+                         current_subtab => $current_subtab &>
+<hr>
+<%INIT>
+my $subtabs = {
+              Queues => { title => 'Basics',
+                          path => "Admin/Users/Modify.html?id=".$id
+                        },
+#             Scrips => { title => 'Rights',
+#                         path => "Admin/Users/Rights.html?id=".$id
+#                       }
+              
+             };
+</%INIT>
+  
+  
+<%ARGS>
+$id => undef
+$current_subtab => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Global/GroupRights.html b/rt/webrt/Admin/Global/GroupRights.html
new file mode 100755 (executable)
index 0000000..26b7e1f
--- /dev/null
@@ -0,0 +1,78 @@
+<& /Admin/Elements/Header, Title => 'Modify System ACLS' &>
+<& /Admin/Elements/SystemTabs &>
+  
+<& /Elements/ListActions, actions => \@results &>
+  <FORM METHOD=POST action="GroupRights.html">
+      
+
+
+<h2>Modify global rights for groups</h2>
+
+<TABLE>
+<TR><TD>Pseudogroups</TD></TR>
+% while (my $GroupObj = $PseudoGroups->Next()) {
+             
+             <TR ALIGN=RIGHT> 
+               <TD VALIGN=TOP>
+                 <% $GroupObj->Name %>
+               </TD>
+               <TD>
+           <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, 
+                                   PrincipalType => 'Group',
+                                   Scope => 'System' &>
+               </TD>
+             </TR>
+       
+% }
+
+<TR><TD>Groups</TD></TR>
+
+% while (my $GroupObj = $Groups->Next()) {
+             
+             <TR ALIGN=RIGHT> 
+               <TD VALIGN=TOP>
+                 <% $GroupObj->Name %>
+               </TD>
+               <TD>
+           <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, 
+                                   PrincipalType => 'Group',
+                                   Scope => 'System' &>
+               </TD>
+             </TR>
+       
+% }
+       
+      </TABLE>
+    <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &>
+  </FORM>
+  
+  <%INIT>
+   #Update the acls.
+ my @results =  ProcessACLChanges(\@CheckACL, \%ARGS);
+
+        
+    # {{{ do basic initialization.
+    
+  
+  
+  # Find out which groups we want to display ACL selects for.
+  my $Groups = new RT::Groups($session{'CurrentUser'});
+  #TODO: limit this to non-pseudogroups
+  $Groups->LimitToReal();
+
+
+  my $PseudoGroups = new RT::Groups($session{'CurrentUser'});
+  #TODO: limit this to non-pseudogroups
+  $PseudoGroups->LimitToPseudo;
+
+  # }}}
+    
+  
+
+  
+  </%INIT>
+
+<%ARGS>
+@CheckACL => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Global/Keywords.html b/rt/webrt/Admin/Global/Keywords.html
new file mode 100644 (file)
index 0000000..bf7bbd2
--- /dev/null
@@ -0,0 +1,97 @@
+<& /Admin/Elements/Header, Title => 'Edit keywords' &>
+<& /Admin/Elements/SystemTabs &>
+<& /Elements/ListActions, actions => \@actions &>
+
+<& /Elements/TitleBoxStart, title => $description &>
+  
+  <FORM METHOD=POST ACTION="Keywords.html">
+
+% if ($KeywordSelects->Count > 0 ) {
+<TABLE>
+<TR><TD>Delete</TD></TR>
+%  while (my $keywordselect = $KeywordSelects->Next ) {
+<TR>
+  <TD><INPUT TYPE="CHECKBOX" NAME="KeywordSelect-<%$keywordselect->Id%>-Delete"></TD>
+  <TD><& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $keywordselect &></TD>
+</TR>
+%  }
+</TABLE>
+% }
+
+Add a global keyword selection:
+%my $ks = new RT::KeywordSelect($session{'CurrentUser'});
+<ul>
+<li><& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $ks, NamePrefix => 'new' &></li>
+</ul>
+
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+</FORM>
+
+
+
+<%init>
+my (@actions);
+
+my $description = "Modify global Keyword selections";
+
+my $KeywordSelects = new RT::KeywordSelects ($session{'CurrentUser'});
+
+unless ($KeywordSelects->LimitToGlobals()) {
+    Abort("Couldn't load KeywordSelects.");
+}
+
+
+# {{{ if we're trying to create a new keyword select
+
+if ($ARGS{'KeywordSelect-new-Name'}) {
+    my $NewKeywordSelect = new RT::KeywordSelect($session{'CurrentUser'});
+    
+    my ($retval, $msg) = $NewKeywordSelect->Create ( Keyword => $ARGS{'KeywordSelect-new-Keyword'},
+                                            ObjectField => 'Queue',
+                                            ObjectType => 'Ticket',
+                                            ObjectValue => 0,
+                                            Name => $ARGS{'KeywordSelect-new-Name'},
+                                            Single => $ARGS{'KeywordSelect-new-Single'},
+                                            Depth => $ARGS{'KeywordSelect-new-Depth'}
+                                          );
+       push (@actions, $msg);
+}
+# }}}
+
+# {{{ if we're trying to delete the keywordselect
+foreach my $key (keys %ARGS) {
+    if ($key =~ /^KeywordSelect-(\d+)-Delete$/) {
+       my $id = $1;
+       my $keywordselect = new RT::KeywordSelect($session{'CurrentUser'});
+       $keywordselect->Load($id) || push @actions, "Couldn't load keywordSelect";
+       my ($val, $msg) = $keywordselect->SetDisabled(1);
+       if ($val) {
+           push @actions, 'KeywordSelect disabled.';
+       }       
+       else {
+           push @actions, $msg;
+       }       
+    }
+}
+# }}}
+# {{{ if we're modifying keyword selects
+my @fields = qw(Name Keyword Single Depth);
+
+while (my $ks = $KeywordSelects->Next) {
+    foreach my $field (@fields) {
+       if (defined ($ARGS{"KeywordSelect-".$ks->Id."-".$field}) &&
+           ($ARGS{"KeywordSelect-".$ks->Id."-".$field} ne $ks->$field())) {
+           
+           my $method = "Set$field";
+           my ($val, $msg) = $ks->$method($ARGS{"KeywordSelect-".$ks->Id."-".$field});
+           push @actions, "Keyword Select ". $ks->Name."/$field:".$msg;
+       }       
+    }
+}
+# }}}
+
+</%init>
+
+<%ARGS>
+</%ARGS>
diff --git a/rt/webrt/Admin/Global/Scrips.html b/rt/webrt/Admin/Global/Scrips.html
new file mode 100755 (executable)
index 0000000..e55f8b3
--- /dev/null
@@ -0,0 +1,95 @@
+<& /Admin/Elements/Header, Title => 'Edit scrips' &>
+<& /Admin/Elements/SystemTabs &>
+
+<& /Elements/ListActions, actions => \@actions &>
+
+<& /Elements/TitleBoxStart, title => "Modify global scrips" &>
+  
+  <FORM METHOD=POST ACTION="Scrips.html">
+
+% if ($Scrips->Count > 0 ) {
+<TABLE>
+<TR>
+<TD>Delete
+</TD>
+<TD>
+</TR>
+
+%   while (my $scrip = $Scrips->Next ) {
+<TR>
+<TD>
+<INPUT TYPE="CHECKBOX" NAME="DeleteScrip-<%$scrip->Id%>">
+</TD>
+<TD>
+<% $scrip->ConditionObj->Name %> 
+<% $scrip->ActionObj->Name %> 
+with template <% $scrip->TemplateObj->Name %>
+</TD>
+</TR>
+%   }
+
+</TABLE>
+
+% }
+Add a scrip which will apply to all queues:
+<ul>
+<li>Condition: <& /Admin/Elements/SelectScripCondition, Name => 'NewScripCondition' &>
+         Action: <& /Admin/Elements/SelectScripAction, Name => 'NewScripAction' &>
+         Template: <& /Admin/Elements/SelectTemplate, Name => 'NewScripTemplate' &>
+
+</ul>
+
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+</FORM>
+<%init>
+my (@actions, $description);
+
+my $Scrips = new RT::Scrips ($session{'CurrentUser'});
+$Scrips->LimitToGlobal();
+
+
+
+
+if ($NewScripAction and $NewScripCondition) {
+    my $NewScrip = new RT::Scrip($session{'CurrentUser'});
+    
+    my ($retval, $msg) = $NewScrip->Create ( ScripAction => $NewScripAction,
+                                    ScripCondition => $NewScripCondition,
+                                    Stage => 'TransactionCreate',
+                                    Queue => 0,
+                                    Template => $NewScripTemplate);
+    if (defined $retval) {
+        push @actions, $msg;
+    }
+    else {
+        push @actions, $msg;
+    }
+}
+
+# {{{ deal with modifying and deleting existing scrips
+my ($key );
+foreach $key (keys %ARGS) {
+  # {{{ if we're trying to delete the scrip
+  if ($key =~ /^DeleteScrip-(\d+)/) {
+    my $id = $1;
+    my $scrip = new RT::Scrip($session{'CurrentUser'});
+    $scrip->Load($id);
+    my ($retval, $msg) = $scrip->Delete;
+    if ($retval) {
+      push @actions, "Scrip deleted";
+    }
+    else {
+      push @actions, $msg;
+    }
+  }
+  # }}}
+}
+# }}}
+</%init>
+
+<%ARGS>
+$NewScripCondition => undef
+$NewScripAction => undef
+$NewScripTemplate => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Global/Template.html b/rt/webrt/Admin/Global/Template.html
new file mode 100755 (executable)
index 0000000..856d2ee
--- /dev/null
@@ -0,0 +1,66 @@
+<& /Admin/Elements/Header, title => "Modify template ".$TemplateObj->id&>
+<& /Admin/Elements/SystemTabs &>
+<& /Elements/ListActions, actions => \@results &>
+
+<& /Elements/TitleBoxStart, title => $title &>
+
+<FORM METHOD=POST ACTION="Template.html">
+%if ($create ) {
+<INPUT TYPE=HIDDEN NAME=template VALUE="new">
+% } else {
+<INPUT TYPE=HIDDEN NAME=template VALUE="<%$TemplateObj->Id%>">
+% }
+
+%# hang onto the queue id
+<INPUT TYPE=HIDDEN name="Queue" value="<%$Queue%>">
+
+
+Name: <input name="Name" VALUE="<%$TemplateObj->Name%>" SIZE=20><BR>
+Description: <input name="Description" VALUE="<%$TemplateObj->Description%>" SIZE=80><BR>
+
+<TEXTAREA NAME=Content ROWS=25 COLS=80 WRAP=SOFT>
+<%$TemplateObj->Content%></TEXTAREA>
+
+<& /Elements/TitleBoxEnd&>
+<&/Elements/Submit&>
+</FORM>
+
+
+
+<%INIT>
+
+my $TemplateObj = new RT::Template($session{'CurrentUser'});
+my  ($title, @results);
+
+if ($create) {
+  $title = "Create a template";
+}
+
+else {
+  if ($template eq 'new') {
+      my ($val, $msg) =  $TemplateObj->Create(Queue => $Queue, Name => $Name);
+      Abort("Could not create template: $msg") unless ($val);
+     push @results, $msg;
+     $title = 'Created template ' . $TemplateObj->Name(); 
+    }
+    else {
+       $TemplateObj->Load($template) || Abort('No Template');
+      $title = 'Editing template ' . $TemplateObj->Name(); 
+    }
+  
+    
+}
+if ($TemplateObj->Id()) {
+  my @attribs = qw( Description Content Queue Name);
+  my @aresults = UpdateRecordObject( AttributesRef => \@attribs, 
+                                    Object => $TemplateObj, 
+                                    ARGSRef => \%ARGS);
+  push @results, @aresults;
+}
+</%INIT>
+<%ARGS>
+$Queue => undef
+$template => undef
+$create => undef
+$Name => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Global/Templates.html b/rt/webrt/Admin/Global/Templates.html
new file mode 100755 (executable)
index 0000000..cf388e5
--- /dev/null
@@ -0,0 +1,24 @@
+<& /Admin/Elements/Header, Title => 'Edit system templates' &>
+<& /Admin/Elements/SystemTabs &>
+
+<& /Elements/TitleBoxStart, title => 'Edit system templates' &>
+<UL>
+<LI><A href="Template.html?create=1&Queue=0">Create a new template</A><BR><BR>
+
+
+%while  (my $TemplateObj = $Templates->Next) { 
+
+<LI><A HREF="Template.html?template=<%$TemplateObj->id()%>"><%$TemplateObj->id()%>/<%$TemplateObj->Name%>: <%$TemplateObj->Description%></a><BR>
+
+%}
+
+<& /Elements/TitleBoxEnd &>
+<%INIT>
+
+my $Templates = RT::Templates->new($session{'CurrentUser'});
+$Templates->LimitToGlobal();
+
+</%INIT>
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Global/UserRights.html b/rt/webrt/Admin/Global/UserRights.html
new file mode 100755 (executable)
index 0000000..351f4b8
--- /dev/null
@@ -0,0 +1,42 @@
+<& /Admin/Elements/Header, Title => 'Modify System ACLS' &>
+<& /Admin/Elements/SystemTabs &>
+  
+<& /Elements/ListActions, actions => \@results &>
+  <FORM METHOD=POST action="UserRights.html">
+      
+
+<h2>Modify global rights for users</h2>
+<TABLE>
+%      while (my $UserObj = $Users->Next()) {
+  <TR ALIGN=RIGHT> 
+       <TD VALIGN=TOP>
+         <A HREF="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$UserObj->id%>"><% $UserObj->Name %></A>
+       </TD>
+       <TD>
+         <& /Admin/Elements/SelectRights, PrincipalObj => $UserObj, 
+             PrincipalType => 'User',
+             Scope => 'System' &>
+         
+       </TD>
+      </TR>
+       
+% }
+    </TABLE>
+    
+    <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &>
+  </FORM>
+  
+<%INIT>
+ my @results =  ProcessACLChanges(\@CheckACL, \%ARGS);
+
+ # Find out which users we want to display ACL selects for
+ my $Users = new RT::Users($session{'CurrentUser'});
+
+ $Users->LimitToPrivileged();
+  
+</%INIT>
+
+<%ARGS>
+@CheckACL => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Global/index.html b/rt/webrt/Admin/Global/index.html
new file mode 100755 (executable)
index 0000000..5907ed1
--- /dev/null
@@ -0,0 +1,2 @@
+<& /Admin/Elements/Header, Title => 'Admin/Global configuration' &>
+<& /Admin/Elements/SystemTabs &>
diff --git a/rt/webrt/Admin/Groups/Members.html b/rt/webrt/Admin/Groups/Members.html
new file mode 100644 (file)
index 0000000..4b0e0d0
--- /dev/null
@@ -0,0 +1,76 @@
+<& /Admin/Elements/Header, Title => "RT/Admin/Edit the group ". $Group->Name &>
+<& /Admin/Elements/GroupTabs, GroupObj => $Group &>
+<& /Elements/ListActions, actions => \@results &>
+
+
+<& /Elements/TitleBoxStart, title => 'Editing membership for group '.$Group->Name &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Groups/Members.html" METHOD=POST>
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Group->Id%>">
+<TABLE WIDTH="100%">
+<TR>
+<TD>
+Add members
+</TD>
+<TD>
+Current members
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=TOP>
+<& /Admin/Elements/SelectUsers, Name => "AddMembers" &>
+</TD>
+<TD VALIGN=TOP>
+% if ($Group->MembersObj->Count == 0 ) {
+<i>(No members)</i>
+% } else {
+(Check box to delete group member)
+<UL>
+% while (my $member = $Group->MembersObj->Next()) {
+<LI><INPUT TYPE=CHECKBOX Name="DeleteMember-<%$member->UserObj->id%>">
+<%$member->UserObj->Name%> (<%$member->UserObj->RealName%>)
+% }
+% }
+</UL>
+</TD>
+</TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+</form>
+
+
+<%INIT>
+
+my $Group = new RT::Group($session{'CurrentUser'});
+$Group->Load($id) || Abort('Could not load group');
+
+my (@results);
+
+my $key;
+foreach $key (keys %ARGS) {
+
+if ($key =~ /^DeleteMember-(\d+)$/) {
+    my $id = $1; 
+    my ($val,$msg) = $Group->DeleteMember($id);
+    push (@results, $msg);
+}
+}
+
+# Make sure AddMembers is always an array
+my @AddMembers = (ref $AddMembers eq 'ARRAY') ? @{$AddMembers} : ($AddMembers);
+
+foreach my $member (@AddMembers) {
+    next unless ($member);
+    my ($val, $msg) = $Group->AddMember($member);
+    push (@results, $msg);
+}
+
+
+</%INIT>
+
+<%ARGS>
+$AddMembers => undef
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Groups/Modify.html b/rt/webrt/Admin/Groups/Modify.html
new file mode 100644 (file)
index 0000000..7104a69
--- /dev/null
@@ -0,0 +1,83 @@
+<& /Admin/Elements/Header, Title => $title &>
+
+<& /Admin/Elements/GroupTabs, GroupObj => $Group &>
+<& /Elements/ListActions, actions => \@results &>
+
+
+<& /Elements/TitleBoxStart, title => $title &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Groups/Modify.html" METHOD=POST>
+
+%unless ($Group->Id) {
+<INPUT TYPE=HIDDEN NAME=id VALUE="new">
+% } else {
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Group->Id%>">
+% }
+<TABLE>
+<TR><TD ALIGN=RIGHT>
+Name: 
+</TD>
+<TD><INPUT name="Name" value="<%$Group->Name%>"></TD>
+</TR><TR>
+<TD ALIGN=RIGHT>
+Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$Group->Description%>" size=60></TD></TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+<& /Elements/Submit &>
+</form>
+<%INIT>
+
+my ($title);
+my (@results);
+
+my $Group = new RT::Group($session{'CurrentUser'});
+
+if ($Create) {
+    $title = "Create a new group";
+} 
+
+else {
+    
+    if ($id eq 'new' ) {
+       
+       $Group->Create(Name => "$Name") || Abort ("Group could not be created.");
+       $id = $Group->Id;
+    }
+    else {
+       $Group->Load($id) || Abort('Could not load group');
+    }
+
+
+    if ($id) {
+       $title = "Modify the group ". $Group->Name;
+
+    }  
+
+    # If the create failed
+    else {
+       $title = "Create a new group";
+       $Create = 1;
+    }    
+    
+}
+
+if ($id) {
+    
+    my @fields = qw(Description Name );
+    my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
+                                           Object => $Group,
+                                           ARGSRef => \%ARGS );
+    push (@results,@fieldresults);
+}
+
+
+</%INIT>
+
+
+<%ARGS>
+$Create => undef
+$Name => undef
+$Description => undef
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Groups/Rights.html b/rt/webrt/Admin/Groups/Rights.html
new file mode 100644 (file)
index 0000000..5c842a3
--- /dev/null
@@ -0,0 +1 @@
+Not yet implemented....
diff --git a/rt/webrt/Admin/Groups/index.html b/rt/webrt/Admin/Groups/index.html
new file mode 100644 (file)
index 0000000..d419e7f
--- /dev/null
@@ -0,0 +1,33 @@
+
+<& /Admin/Elements/Header, Title => 'Admin/Groups' &>
+<& /Admin/Elements/Tabs, current_tab => 'Admin/Groups/' &>
+
+<& /Elements/TitleBoxStart, title => 'Select a group' &>
+
+Pseudogroups:<BR>
+<UL>
+%while ( $Group = $PseudoGroups->Next) {
+<LI><A HREF="Modify.html?id=<%$Group->id%>"><%$Group->Name%></a><BR>
+%}
+
+</UL>
+
+Groups:<BR>
+<UL>
+<LI><A HREF="Modify.html?Create=1">Create a new group</A><BR><BR></LI>
+%while ( $Group = $Groups->Next) {
+<LI><A HREF="Modify.html?id=<%$Group->id%>"><%$Group->Name%></a><BR>
+%}
+</UL>
+
+<& /Elements/TitleBoxEnd &>
+<%INIT>
+my ($Group);
+my $PseudoGroups = new RT::Groups($session{'CurrentUser'});
+$PseudoGroups->LimitToPseudo;
+my $Groups = new RT::Groups($session{'CurrentUser'});
+$Groups->LimitToReal;
+
+</%INIT>
+<%ARGS>
+</%ARGS>
diff --git a/rt/webrt/Admin/KeywordSelects/Modify.html b/rt/webrt/Admin/KeywordSelects/Modify.html
new file mode 100644 (file)
index 0000000..e753c66
--- /dev/null
@@ -0,0 +1,17 @@
+<& /Admin/Elements/Header, Title => 'Admin KeywordSelects' &>
+<& /Admin/Elements/Tabs &>
+
+<& /Admin/Elements/ModifyKeywordSelect, Create=>$Create, id=>$id, Parent=>$Parent, ObjectType=>$ObjectType, ObjectField=>$ObjectField, ObjectValue=>$ObjectValue, Single=>$Single, SingleMagic=>$SingleMagic, Generations=>$Generations &>
+
+<%ARGS>
+$Create => undef
+$id => undef
+$Parent => undef
+$ObjectType => undef
+$ObjectField => undef
+$ObjectValue => undef
+$Single => undef
+$SingleMagic => undef
+$Generations => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/KeywordSelects/index.html b/rt/webrt/Admin/KeywordSelects/index.html
new file mode 100644 (file)
index 0000000..ba3da9f
--- /dev/null
@@ -0,0 +1,137 @@
+<& /Admin/Elements/Header, Title => 'Admin KeywordSelects' &>
+<& /Admin/Elements/Tabs, current_tab => 'Admin/KeywordSelects/' &>
+
+A <B>KeywordSelect</B> is a link between a <B>Keyword</B> and a object
+(currently just <B>Tickets</B>), titled by the <I>Name</I> field of the Keyword such that:
+<ul>
+<li>Object display will contain a field, titled with the <I>Name</I> field of
+the <B>Keyword</B> and showing any descendent keywords.
+<li>Object creation for this field will contain a field, titled with the
+<I>Name</I> field of the <B>Keyword</B> and containing the descendents of
+the <B>Keyword</B> as choices.
+<li>Searches for this object type will contain a selection field titled with
+the <I>Name</I> field of the <B>Keyword</B> and containing the descendents
+of the <B>Keyword</B> as choices.
+<TABLE WIDTH=100%>
+
+
+
+  <TD VALIGN=TOP>
+    <h2>Create KeywordSelect</h2>
+  <FORM NAME="ModifyKeywordSelect" METHOD="POST" ACTION="<%$RT::WebPath%>/Admin/KeywordSelects/Modify.html">
+    [<%$title |n %>]
+    <BR>
+      
+      <INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>">
+       Keyword 
+       <SELECT NAME="Parent">
+         
+%while ( $parent = $parents->Next ) {
+         
+         <OPTION VALUE="<% $parent->id %>" <% defined($KeywordSelect->Parent) && $parent->id == $KeywordSelect->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION>
+         
+% }
+         
+       </SELECT>
+       <BR>
+         Object 
+         <SELECT NAME="ObjectType">
+           <OPTION SELECTED>Ticket</OPTION>
+         </SELECT>
+         <BR>
+           
+%foreach $queue ( keys %queues ) {
+    addOption("<% $queues{$queue} %>", "<% $queue %>", false, <% $queue == $KeywordSelect->ObjectValue ? 'true' : 'false' %> )
+%}
+  }
+}
+</SCRIPT>
+           
+           Limit to <SELECT NAME="ObjectField" onChange="ChangeObjectValue(this)">
+             <OPTION VALUE="" <% $KeywordSelect->ObjectField ? '' : ' SELECTED' %>>(none)</OPTION>
+             <OPTION VALUE="Queue" <% $KeywordSelect->ObjectField eq 'Queue' ? ' SELECTED' : '' %>>Queue</OPTION>
+           </SELECT> 
+           <SELECT NAME="ObjectValue">
+             <OPTION VALUE="<% $KeywordSelect->ObjectValue %>">
+               <% $KeywordSelect->ObjectField ? $queues{$KeywordSelect->ObjectValue} : "(n/a)" %></OPTION>
+           </SELECT><BR>
+             <INPUT TYPE="hidden" NAME="SingleMagic" VALUE="1">
+               <INPUT TYPE="checkbox" NAME="Single" VALUE="1" <% $KeywordSelect->Single ? ' CHECKED' : '' %>>Allow single selection only<BR>
+                   Limit to <INPUT TYPE="text" NAME="Generations" SIZE="2" VALUE="<% $KeywordSelect->Generations %>"> generations (0 = no limit)<BR>
+                       <& /Elements/Submit, Label => $submit &>
+
+</FORM>
+
+<%INIT>
+
+
+my $KeywordSelect = new RT::KeywordSelect($session{CurrentUser});
+  
+my($title, $submit);
+  
+if ( $Create ) {
+      $title = "Create a new KeywordSelect";
+      $submit = "Create";
+      $id = "new";
+} else {
+    if  ( $id eq 'new' ) {
+       $id = $KeywordSelect->Create (
+                                     Parent      => $Parent,
+                                     ObjectType  => $ObjectType,
+                                     ObjectField => $ObjectField,
+                                     ObjectValue => $ObjectValue,
+                                     Single      => $Single,
+                                     Generations => $Generations,
+                                    ) or Abort "can't create KeywordSelect";
+    } else {
+       $KeywordSelect->Load($id) || Abort("Can't load keyword id $id");
+       #false laziness
+       $KeywordSelect->SetParent($Parent) if defined($Parent);
+       $KeywordSelect->SetObjectType($ObjectType) if defined($ObjectType);
+       $KeywordSelect->SetObjectField($ObjectField) if defined($ObjectField);
+       $KeywordSelect->SetObjectValue($ObjectValue) if defined($ObjectValue);
+       $KeywordSelect->SetSingle($Single) if defined($SingleMagic);
+       $KeywordSelect->SetGenerations($Generations) if defined($Generations);
+    }
+    $title = "Modify the KeywordSelect <B>". $KeywordSelect->KeywordObj->Name. "</B>";
+    $submit = "Modify";
+    
+}
+  
+  my $parents = new RT::Keywords($session{CurrentUser});
+  $parents->UnLimit;
+  my $parent;
+
+my $queues = new RT::Queues($session{CurrentUser});
+$queues->UnLimit;
+
+my %queues;
+my $queue;
+$queues{$queue->id} = $queue->Name while $queue = $queues->Next;
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Create => undef
+$Parent => undef
+$ObjectType => undef
+$ObjectField => undef
+$ObjectValue => undef
+$Single => undef
+$SingleMagic => undef
+$Generations => undef
+</%ARGS>
+
+
+    <& /Admin/Elements/ModifyKeywordSelect, 'Create'=>'1' &>
+  </TD>
+
+  <TD VALIGN=TOP>
+    <H2>Modify KeywordSelect</H2>
+
+    <& /Admin/Elements/SelectModifyKeywordSelect &>
+  </TD>
+</TR>
+
+</TABLE>
diff --git a/rt/webrt/Admin/Keywords/Modify.html b/rt/webrt/Admin/Keywords/Modify.html
new file mode 100644 (file)
index 0000000..bb7e2db
--- /dev/null
@@ -0,0 +1,96 @@
+<& /Admin/Elements/Header, Title => $title &>
+<& /Admin/Elements/Tabs &>
+
+
+<& /Elements/TitleBoxStart, title => %$title  &>
+<FORM METHOD="POST" ACTION="<%$RT::WebPath%>/Admin/Keywords/Modify.html">
+<INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>">
+Keyword <INPUT NAME="Name" VALUE="<% $Keyword->Name %>"><BR>
+
+Parent <SELECT NAME="Parent">
+             <OPTION VALUE=""<% defined($Keyword->Parent) ? '' : ' SELECTED' %>>-</OPTION>
+%while ( $parent = $parents->Next ) {
+             <OPTION VALUE="<% $parent->id %>"<% defined($Keyword->Parent) && $parent->id == $Keyword->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION>
+%}
+</SELECT>
+
+
+New children of this keyword. one per line.
+<TEXTAREA NAME="Kids" ROWS=4><% $kidstring %></TEXTAREA>
+<BR>
+
+<& /Elements/Submit, Label => $submit &>
+</FORM>
+<& /Elements/TitleBoxEnd &>
+
+<%INIT>
+
+my $Keyword = new RT::Keyword($session{CurrentUser});
+my ($title, $submit, %kids, $kid);
+
+if ( $Create ) {
+    $title = "Create a new Keyword";
+    $submit = "Create";
+    $id = "new";
+    %kids = ();
+    $Parent = ''; #silence 
+} 
+else {
+    if ( $id eq 'new' ) {
+       $id = $Keyword->Create( Name => $Name, Parent => $Parent )
+         or Abort("can't create keyword Name=>$Name, Parent=>$Parent");
+    } else {
+       $Keyword->Load($id) || Abort("Can't load keyword id $id");
+       
+       #foreach my $field ( grep eval "defined(\$$_)", qw( Name Parent )) {
+       #  eval "\$Keyword->Set(\$field=>\$$field); #sigh
+       #}
+       
+       $Keyword->SetName($Name) if defined($Name);
+       $Keyword->SetParent($Parent) if defined($Parent);
+    }
+
+    $title = "Modify the Keyword <B>". $Keyword->Name. "</B>";
+    $submit = "Modify";
+}
+
+
+my $kids = $Keyword->Children(new RT::Keywords($session{CurrentUser}));
+
+$kids{$kid->Name} = $kid while $kid = $kids->Next;
+
+if ( defined($Kids) ) {
+    my %newkids;
+
+       %newkids = map { $_=>1 } split(/\r/, $Kids);
+
+    }
+    foreach ( grep { ! defined($newkids{$_}) } keys %kids ) {
+       $kids{$_}->Delete;
+       delete $kids{$_};
+    }
+    foreach ( grep { ! defined($kids{$_}) } keys %newkids ) {
+       $kids{$_} = new RT::Keyword($session{CurrentUser});
+       $kids{$_}->Create( Name => $_, Parent => $id )
+         or Abort("can't create keyword Name=>$_, Parent=>$id");
+    }
+
+}
+
+
+my $parent;
+my $parents = new RT::Keywords($session{CurrentUser});
+$parents->UnLimit;
+
+my $kidstring = join("\r", keys %kids);
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Create => undef
+$Name => undef
+$Parent => undef
+$Kids => undef
+
+</%ARGS>
diff --git a/rt/webrt/Admin/Keywords/index.html b/rt/webrt/Admin/Keywords/index.html
new file mode 100644 (file)
index 0000000..12814ec
--- /dev/null
@@ -0,0 +1,110 @@
+<& /Elements/Header, Title => 'Admin/Keywords' &>
+<& /Admin/Elements/Tabs, current_tab => 'Admin/Keywords/' &>
+
+<& /Elements/ListActions, actions => \@Actions &>
+
+<& /Elements/TitleBoxStart, title => 'Keywords' &>
+<a href="<%$RT::WebPath%>/Admin/Keywords/?RootId=<%$Root->Parent%>"><%$Root->Path%></a>
+<UL>
+<FORM METHOD=POST ACTION="index.html">
+<input type=hidden name=RootId value="<%$RootId%>">
+
+
+% while (my $key = $Keywords->Next) {
+    <LI>
+% if ($Edit == $key->id) {
+      <input name="KeyName-<%$key->id%>" value="<%$key->Name%>">
+         <input type=submit value="Update">
+           <input type=submit name="Disable-<%$key->id%>" value="Disable">
+% } else {
+             <A HREF="?RootId=<%$key->id%>"><%$key->Name%></A>
+% if ($key->Disabled) {
+       <input type=submit name="Enable-<%$key->id%>" value="Enable">
+% } else {
+      [<a href="?Edit=<%$key->id%>&RootId=<%$Root->Id%>">edit</a>]
+% }
+% }
+
+
+         </LI>
+% }
+         <LI>
+           <input name="KeyName-New"> <input type=submit value="Add">
+</UL>
+<BR>
+         <input type="checkbox" name="ShowDisabled"> Include disabled items in listing.
+       <input type=submit value="Go!">
+
+</FORM>
+
+<& /Elements/TitleBoxEnd &>
+<%INIT>
+my (@Actions);
+  
+if ($ARGS{'KeyName-New'}) {
+    my $NewKey = new RT::Keyword($session{'CurrentUser'});
+    my ($val, $msg) = $NewKey->Create( Parent => $RootId, Name => $ARGS{'KeyName-New'});
+    push (@Actions, $msg);
+}
+
+my $arg;
+foreach $arg (keys %ARGS) {
+    if ($arg =~ /^Disable-(\d*)$/) {
+       my $id = $1;
+       my $keyword = new RT::Keyword($session{'CurrentUser'});
+       $keyword->Load($id);
+       my ($val, $msg) = $keyword->SetDisabled(1);
+       push (@Actions, $msg);
+
+
+    }  
+    elsif ($arg =~ /^Enable-(\d*)$/) {
+       my $id = $1;
+       my $keyword = new RT::Keyword($session{'CurrentUser'});
+       $keyword->Load($id);
+       my ($val, $msg) = $keyword->SetDisabled(0);
+       push (@Actions, $msg);
+    }
+    elsif ($arg =~ /^KeyName-(\d*)$/) {
+       my $id = $1;
+       my $keyword = new RT::Keyword ($session{'CurrentUser'});
+       $keyword->Load($id);
+       if ($keyword->Name() ne $ARGS{"$arg"}) {
+           my ($val, $msg) = $keyword->SetName($ARGS{"$arg"});
+           push (@Actions, $msg);
+       }       
+       if (($ARGS{"KeyParent-$id"}) && 
+           ($keyword->Parent ne $ARGS{"KeyParent-$id"})) {
+           my ($val, $msg) = $keyword->SetParent($ARGS{"KeyParent-$id"});
+           push (@Actions, $msg);
+       }       
+    }  
+}
+
+
+my $Root = new RT::Keyword($session{'CurrentUser'});
+my $Keywords;
+#If we have a root load it.
+if ($RootId != 0) {
+    $Root->Load($RootId);
+    $Keywords = $Root->Children();
+    
+}
+else {
+    $Keywords = new RT::Keywords($session{'CurrentUser'});
+    $Keywords->LimitToParent(0);
+}
+
+if ($ShowDisabled) {
+    $Keywords->{'find_disabled_rows'} = 1;
+}
+
+
+
+
+</%INIT>
+<%ARGS>
+$RootId => 0
+$Edit => undef
+$ShowDisabled => 0
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/Create.html b/rt/webrt/Admin/Queues/Create.html
new file mode 100755 (executable)
index 0000000..b39d659
--- /dev/null
@@ -0,0 +1,13 @@
+<& /Admin/Elements/Header, Title => 'Create a queue' &>
+    <h1>Create a queue</h1>
+
+<& /Admin/Elements/ModifyQueue, QueueObj => $QueueObj &>
+
+<%INIT>
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+$QueueObj->Create(Name => "$Name");
+</%INIT>
+
+<%ARGS>
+$Name => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/GroupRights.html b/rt/webrt/Admin/Queues/GroupRights.html
new file mode 100755 (executable)
index 0000000..a2c6690
--- /dev/null
@@ -0,0 +1,103 @@
+<& /Admin/Elements/Header, Title => 'Modify group rights for queue '. $QueueObj->Name &>
+<& /Admin/Elements/QueueTabs, id => $id &>  
+<& /Elements/ListActions, actions => \@results &>
+
+  <FORM METHOD=POST ACTION="GroupRights.html">
+    <INPUT TYPE=HIDDEN NAME=id VALUE="<% $QueueObj->id %>">
+      
+
+
+<& /Elements/TitleBoxStart, title => 'Modify group rights for queue '.$QueueObj->Name &>
+
+<TABLE>
+<TR><TD>Pseudogroups</TD></TR>
+% while (my $GroupObj = $PseudoGroups->Next()) {
+             
+             <TR ALIGN=RIGHT> 
+               <TD VALIGN=TOP>
+                 <% $GroupObj->Name %>
+               </TD>
+               <TD>
+           <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, 
+                                   PrincipalType => 'Group',
+                                  QueueObj => $QueueObj,
+                                   Scope => 'Queue' &>
+
+               </TD>
+             </TR>
+       
+% }
+
+<TR><TD>Groups</TD></TR>
+
+% while (my $GroupObj = $Groups->Next()) {
+             
+             <TR ALIGN=RIGHT> 
+               <TD VALIGN=TOP>
+                 <% $GroupObj->Name %>
+               </TD>
+               <TD>
+           <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, 
+                                   PrincipalType => 'Group',
+                                  QueueObj => $QueueObj,
+                                   Scope => 'Queue' &>
+
+               </TD>
+             </TR>
+       
+% }
+       
+      </TABLE>
+
+      <& /Elements/TitleBoxEnd &>
+      <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &>
+  </FORM>
+  
+<%INIT>
+#Update the acls.
+my @results =  ProcessACLChanges(\@CheckACL, \%ARGS);
+
+# {{{ Deal with setting up the display of current rights.
+
+# {{{ do basic initialization.
+
+#Define vars used in html above
+my ($GroupObj);
+
+my ($right);
+
+
+if (!defined $id) {
+    Abort("No Queue defined");
+}
+
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+$QueueObj->Load($id) ||
+  Abort("Couldn't load queue $id");
+  
+  # Find out which groups we want to display ACL selects for.
+  my $Groups = new RT::Groups($session{'CurrentUser'});
+  #TODO: limit this to non-pseudogroups
+  $Groups->LimitToReal();
+
+
+  my $PseudoGroups = new RT::Groups($session{'CurrentUser'});
+  #TODO: limit this to non-pseudogroups
+  $PseudoGroups->LimitToPseudo;
+
+
+# }}}
+    
+  
+  # }}}
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$UserString => undef
+$UserOp => undef
+$UserField => undef
+@CheckACL => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/Keywords.html b/rt/webrt/Admin/Queues/Keywords.html
new file mode 100644 (file)
index 0000000..7809805
--- /dev/null
@@ -0,0 +1,114 @@
+<& /Admin/Elements/Header, Title => 'Edit keywords' &>
+<& /Admin/Elements/QueueTabs, id => $QueueObj->Id &>
+
+<& /Elements/ListActions, actions => \@actions &>
+
+<& /Elements/TitleBoxStart, title => $description &>
+
+<h2>Global Keyword Selections</h2>
+<& /Admin/Elements/ListGlobalKeywordSelects &>
+<BR>
+  
+  <FORM METHOD=POST ACTION="Keywords.html">
+    <INPUT TYPE=HIDDEN NAME=id VALUE="<%$id%>">
+
+% if ($KeywordSelects->Count > 0 ) {
+
+
+<h2>Queue Keyword Selections</h2>
+<TABLE>
+<TR><TD>Delete</TD></TR>
+%  while (my $keywordselect = $KeywordSelects->Next ) {
+<TR>
+  <TD><INPUT TYPE="CHECKBOX" NAME="KeywordSelect-<%$keywordselect->Id%>-Delete"></TD>
+  <TD><& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $keywordselect &></TD>
+</TR>
+%  }
+</TABLE>
+% }
+
+Add a keyword selection to this queue:
+%my $ks = new RT::KeywordSelect($session{'CurrentUser'});
+<ul>
+<li><& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $ks, NamePrefix => 'new' &></li>
+</ul>
+
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+
+</FORM>
+<%init>
+my (@actions);
+
+
+
+my $KeywordSelects = new RT::KeywordSelects ($session{'CurrentUser'});
+unless ($id =~ /^\d+$/) {
+    Abort("$id isn't a valid Queue id.");
+}
+
+unless ($KeywordSelects->LimitToQueue($id)) {
+    Abort("Couldn't load KeywordSelects.");
+}
+
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+$QueueObj->Load($id);
+
+my $description = "Modify Keyword selections for queue '". $QueueObj->Name ."'";
+
+
+
+# {{{ if we're trying to create a new keyword select
+
+if ($ARGS{'KeywordSelect-new-Name'}) {
+    my $NewKeywordSelect = new RT::KeywordSelect($session{'CurrentUser'});
+    
+    my ($retval, $msg) = $NewKeywordSelect->Create ( Keyword => $ARGS{'KeywordSelect-new-Keyword'},
+                                            ObjectField => 'Queue',
+                                            ObjectType => 'Ticket',
+                                            ObjectValue => $QueueObj->Id,
+                                            Name => $ARGS{'KeywordSelect-new-Name'},
+                                            Single => $ARGS{'KeywordSelect-new-Single'},
+                                            Depth => $ARGS{'KeywordSelect-new-Depth'}
+                                          );
+       push (@actions, $msg);
+}
+# }}}
+# {{{ if we're trying to delete the keywordselect
+foreach my $key (keys %ARGS) {
+    if ($key =~ /^KeywordSelect-(\d+)-Delete$/) {
+       my $id = $1;
+       my $keywordselect = new RT::KeywordSelect($session{'CurrentUser'});
+       $keywordselect->Load($id) || push @actions, "Couldn't load keywordSelect";
+       my ($val, $msg) = $keywordselect->SetDisabled(1);
+       if ($val) {
+           push @actions, 'KeywordSelect disabled.';
+       }       
+       else {
+           push @actions, $msg;
+       }       
+    }
+}
+# }}}
+# {{{ if we're modifying keyword selects
+my @fields = qw(Name Keyword Single Depth);
+
+while (my $ks = $KeywordSelects->Next) {
+    foreach my $field (@fields) {
+       if (defined ($ARGS{"KeywordSelect-".$ks->Id."-".$field}) &&
+           ($ARGS{"KeywordSelect-".$ks->Id."-".$field} ne $ks->$field())) {
+           
+           my $method = "Set$field";
+           my ($val, $msg) = $ks->$method($ARGS{"KeywordSelect-".$ks->Id."-".$field});
+           push @actions, "Keyword Select ". $ks->Name."/$field:".$msg;
+       }       
+    }
+}
+# }}}
+
+</%init>
+
+<%ARGS>
+$id => undef         #some identifier that a Queue could 
+
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/Modify.html b/rt/webrt/Admin/Queues/Modify.html
new file mode 100755 (executable)
index 0000000..7a200df
--- /dev/null
@@ -0,0 +1,137 @@
+<& /Admin/Elements/Header, Title => 'Admin/Queue/Basics' &>
+<& /Admin/Elements/QueueTabs, id => $QueueObj->id &>
+<& /Elements/ListActions, actions => \@results &>
+
+
+
+<& /Elements/TitleBoxStart, title => $title &>
+
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Queues/Modify.html" METHOD=POST>
+%if ($Create ) {
+<INPUT TYPE=HIDDEN NAME=id VALUE="new">
+% } else {
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
+% }
+
+<TABLE>
+<TR><TD ALIGN=RIGHT>
+Queue Name: 
+</TD>
+<TD><INPUT name="Name" value="<%$QueueObj->Name%>"></TD>
+</TR><TR>
+<TD ALIGN=RIGHT>
+Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$QueueObj->Description%>" size=60></TD></TR>
+<TR>
+<TD ALIGN=RIGHT>
+Correspondence Address:
+</TD><TD>
+<INPUT name="CorrespondAddress" value="<%$QueueObj->CorrespondAddress%>">
+<BR><font size="-1"><i>(If left blank, will default to <%$RT::CorrespondAddress%></i></font>
+</TD>
+<TD ALIGN=RIGHT>
+
+Comment Address: </TD><TD>
+<INPUT NAME="CommentAddress" value="<%$QueueObj->CommentAddress%>">
+<BR><font size="-1"><i>(If left blank, will default to <%$RT::CommentAddress%></i></font>
+</TD>
+</TR><TR>
+
+<TD ALIGN=RIGHT>
+Priority starts at: 
+</TD><TD><INPUT NAME="InitialPriority" value="<%$QueueObj->InitialPriority %>">
+</TD>
+<TD ALIGN=RIGHT>
+Over time, priority moves toward:
+</TD><TD><INPUT NAME="FinalPriority" value="<%$QueueObj->FinalPriority %>">
+</TD>
+</TR>
+<TR>
+<TD ALIGN=RIGHT>
+Requests should be due in:
+</TD><TD>
+<INPUT NAME="DefaultDueIn" VALUE="<%$QueueObj->DefaultDueIn%>"> days.
+</TD>
+</TR>
+<TR>
+<TD>
+</TD>
+<TD COLSPAN=4><INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
+<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> Enabled (Unchecking this box disables this queue)<BR>
+</TD>
+</TR>
+
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+</form>
+
+
+
+<%INIT>
+
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+my  ($title, @results, $Disabled, $EnabledChecked);
+
+if ($Create) {
+    $title = "Create a queue";
+}
+
+else {
+    if ($id eq 'new') {
+       my ($val, $msg) =  $QueueObj->Create(Name => $Name);
+       if ($val == 0 ) {
+           Abort("Could not create queue: $msg");
+       }
+       else {
+               push @results, $msg;
+       }    
+     }
+     else {
+        $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort("Couldn't load queue '$Name'");
+    }
+        $title = 'Editing Configuration for queue '.$QueueObj->Name;
+    
+}
+if ($QueueObj->Id()) {
+my @attribs= qw(Description CorrespondAddress CommentAddress Name 
+                InitialPriority FinalPriority DefaultDueIn);
+
+  @results = UpdateRecordObject( AttributesRef => \@attribs, 
+                                   Object => $QueueObj, 
+                                   ARGSRef => \%ARGS);
+
+}
+
+#we're asking about enabled on the web page but really care about disabled.
+if ($Enabled == 1) {
+    $Disabled = 0;
+}      
+else {
+    $Disabled = 1;
+}
+if  ( ($SetEnabled) and ( $Disabled != $QueueObj->Disabled) ) { 
+    my  ($code, $msg) = $QueueObj->SetDisabled($Disabled);
+    push @results, 'Enabled status '. $msg;
+}
+
+unless ($QueueObj->Disabled()) {
+    $EnabledChecked ="CHECKED";
+}
+</%INIT>
+
+
+<%ARGS>
+$id => undef
+$result => undef
+$Name => undef
+$Create => undef
+$Description => undef
+$CorrespondAddress => undef
+$CommentAddress => undef
+$InitialPriority => undef
+$FinalPriority => undef
+$DefaultDueIn => undef
+$SetEnabled => undef
+$Enabled => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/People.html b/rt/webrt/Admin/Queues/People.html
new file mode 100755 (executable)
index 0000000..b495400
--- /dev/null
@@ -0,0 +1,161 @@
+<& /Elements/Header, Title => 'Modify people related to queue ' . $QueueObj->Name &>
+<& /Admin/Elements/QueueTabs, id => $id  &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<FORM METHOD=POST ACTION="People.html">
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
+<& /Elements/TitleBoxStart, title => 'Modify watchers for queue \''.$QueueObj->Name ."'",   width => "100%" &>
+
+<TABLE WIDTH=100%>
+<TR>
+<TD VALIGN=TOP >
+
+<h3>Current watchers</h3>
+<i>(Check box to delete)</i><br><BR>
+
+
+Cc:
+
+<ul>
+
+%# Print out a placeholder if there are none.
+%if ($cc->Count == 0 ) {
+<li><i>none</i>
+% }
+
+%while (my $watcher=$cc->Next) {
+<li>
+<INPUT TYPE=CHECKBOX NAME="DelWatcher<%$watcher->id%>" UNCHECKED>
+%# account
+%if ($watcher->IsUser) { 
+<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->OwnerObj->id%>">
+<%$watcher->OwnerObj->RealName%></a>:
+%} else {
+Email address:
+%}
+<i><%$watcher->Email%></i>
+%}
+</ul>
+
+
+Administrative Cc:
+<UL>
+%# Print out a placeholder if there are none.
+%if ($admincc->Count == 0 ) {
+<li><i>none</i>
+% }
+
+%while (my $watcher=$admincc->Next) {
+<li><INPUT TYPE=CHECKBOX NAME="DelWatcher<%$watcher->id%>" UNCHECKED>
+%# account
+%if ($watcher->IsUser) { 
+<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->OwnerObj->id%>">
+<%$watcher->OwnerObj->RealName%></a>:
+%} else {
+Email address:
+%}
+<i><%$watcher->Email%></i>
+%}
+</UL>
+</TD>
+
+<TD VALIGN=TOP>
+<h3>New watchers</h3>
+Find people whose<BR>
+<& /Elements/SelectUsers &>
+
+<BR>
+Add new watchers:<br>
+
+% if ($msg) {
+<i><%$msg%></i>
+% } elsif ($Users) {
+<ul>
+% while (my $u = $Users->Next ) {
+<li><&/Elements/SelectWatcherType, Scope=>'queue', Name => "WatcherTypeUser".$u->Id &> <%$u->Name%>
+(<%$u->RealName%>)
+% }
+</ul>
+% }
+
+</TD>
+</TR>
+</TABLE>
+
+
+
+
+
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit, Label => 'Save Changes', Caption => "If you've updated anything above, be sure to" &>
+</form>
+
+<%INIT>
+
+my ($field, @results, $User, $Users, $watcher, $key, $msg);
+# {{{ Load the queue
+#If we get handed two ids, mason will make them an array. bleck.
+# We want teh first one. Just because there's no other sensible way
+# to deal
+
+
+
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+$QueueObj->Load($id) || Abort("Couldn't load queue '$id'");
+# }}}
+
+# {{{ Delete deletable watchers
+
+foreach $key (keys %ARGS) {
+    if (($key =~ /^DelWatcher(\d*)$/) and
+       ($ARGS{$key})) {
+       $RT::Logger->debug("Deleting watcher $1\n");
+       my ($code, $msg) = $QueueObj->DeleteWatcher($1);
+       
+       push @results, $msg;
+    }
+}
+# }}}
+
+# {{{ Add new watchers
+foreach $key (keys %ARGS) {
+    #They're in this order because otherwise $1 gets clobbered :/
+    if ( ($ARGS{$key} =~ /^(AdminCc|Cc)$/) and
+        ($key =~ /^WatcherTypeUser(\d*)$/) ) {
+       $RT::Logger->debug("Adding a watcher $1 to ".$ARGS{$key}."\n");
+       my ($code, $msg) = 
+         $QueueObj->AddWatcher(Type => $ARGS{$key},
+                                Owner => $1);
+       push @results, $msg;
+    }
+}
+
+# }}}
+
+
+
+my $admincc = $QueueObj->AdminCc;
+my $cc = $QueueObj->Cc;
+
+if (!$ARGS{'UserString'}) {
+$msg = "No users selected.";
+ }
+else {
+    $Users = new RT::Users($session{'CurrentUser'});
+    $Users->Limit(FIELD => $ARGS{'UserField'},
+                 VALUE => $ARGS{'UserString'},
+                 OPERATOR => $ARGS{'UserOp'});
+     }
+</%INIT>
+
+<%ARGS>
+$UserField => 'Name'
+$UserOp => '='
+$UserString => undef
+$Type => undef
+$id => undef
+</%ARGS>
+
diff --git a/rt/webrt/Admin/Queues/Scrips.html b/rt/webrt/Admin/Queues/Scrips.html
new file mode 100755 (executable)
index 0000000..95b8c43
--- /dev/null
@@ -0,0 +1,111 @@
+<& /Admin/Elements/Header, Title => 'Edit scrips' &>
+<& /Admin/Elements/QueueTabs, id => $QueueObj->Id &>
+
+<& /Elements/ListActions, actions => \@actions &>
+
+<& /Elements/TitleBoxStart, title => $description &>
+<h2>Global Scrips</h2>
+<& /Admin/Elements/ListGlobalScrips &>
+<BR> 
+  <FORM METHOD=POST ACTION="Scrips.html">
+    <INPUT TYPE=HIDDEN NAME=id VALUE=<%$id%>>
+<h2>Queue Scrips</h2>
+% if ($Scrips->Count > 0 ) {
+<TABLE>
+<TR>
+<TD>Delete
+</TD>
+<TD>
+</TR>
+% while (my $scrip = $Scrips->Next ) {
+<TR>
+<TD>
+<INPUT TYPE="CHECKBOX" NAME="DeleteScrip-<%$scrip->Id%>">
+</TD>
+<TD>
+<% $scrip->ConditionObj->Name %> 
+<% $scrip->ActionObj->Name %> with template
+<% $scrip->TemplateObj->Name %>
+</TD>
+</TR>
+% }
+</TABLE>
+% }
+<BR>
+<h2>Add a scrip to this queue</h2>
+Condition: <& /Admin/Elements/SelectScripCondition, Name => 'NewScripCondition' &>
+         Action: <& /Admin/Elements/SelectScripAction, Name => 'NewScripAction' &>
+         Template: <& /Admin/Elements/SelectTemplate, Name => 'NewScripTemplate', DefaultQueue => $id &>
+
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+</FORM>
+<%init>
+my (@actions, $description);
+
+my $Scrips = new RT::Scrips ($session{'CurrentUser'});
+unless ($id =~ /^\d+$/) {
+    Abort("$id isn't a valid Queue id.");
+}
+
+unless ($Scrips->LimitToQueue($id)) {
+    Abort("Couldn't load Scrips.");
+        }
+
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+$QueueObj->Load($id);
+
+if ($QueueObj->id) {
+    $description = "Modify scrips for queue '". $QueueObj->Name ."'";
+}
+else {
+    $description = "Modify global scrips";
+}
+
+
+if ($NewScripAction and $NewScripCondition) {
+    my $NewScrip = new RT::Scrip($session{'CurrentUser'});
+    
+    my ($retval, $msg) = $NewScrip->Create ( ScripAction => $NewScripAction,
+                                    ScripCondition => $NewScripCondition,
+                                    Stage => 'TransactionCreate',
+                                    Queue => $id,
+                                    Template => $NewScripTemplate);
+    if (defined $retval) {
+        push @actions, $msg;
+    }
+    else {
+        push @actions, $msg;
+    }
+}
+
+# {{{ deal with modifying and deleting existing scrips
+my ($key );
+foreach $key (keys %ARGS) {
+       # {{{ if we're trying to delete the scrip
+    if ($key =~ /^DeleteScrip-(\d+)/) {
+            my $id = $1;
+               my $scrip = new RT::Scrip($session{'CurrentUser'});
+               $scrip->Load($id);
+           my ($retval, $msg) = $scrip->Delete;
+           if ($retval) {
+               push @actions, 'Scrip deleted';
+           }
+           else {
+               push @actions, $msg;
+           }
+       }
+       # }}}
+
+    
+}
+# }}}
+</%init>
+
+<%ARGS>
+$NewScripCondition => undef
+$NewScripAction => undef
+$NewScripTemplate => undef
+$id => undef         #some identifier that a Queue could 
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/Template.html b/rt/webrt/Admin/Queues/Template.html
new file mode 100755 (executable)
index 0000000..61ee418
--- /dev/null
@@ -0,0 +1,68 @@
+<& /Admin/Elements/Header, title => "Modify template ".$TemplateObj->id&>
+<& /Admin/Elements/QueueTabs, id => $Queue &>
+<& /Elements/ListActions, actions => \@results &>
+
+<& /Elements/TitleBoxStart, title => $title &>
+
+<FORM METHOD=POST ACTION="Template.html">
+%if ($create ) {
+<INPUT TYPE=HIDDEN NAME=template VALUE="new">
+% } else {
+<INPUT TYPE=HIDDEN NAME=template VALUE="<%$TemplateObj->Id%>">
+% }
+
+%# hang onto the queue id
+<INPUT TYPE=HIDDEN name="Queue" value="<%$Queue%>">
+
+
+Name: <input name="Name" VALUE="<%$TemplateObj->Name%>" SIZE=20><BR>
+Description: <input name="Description" VALUE="<%$TemplateObj->Description%>" SIZE=80><BR>
+
+<TEXTAREA NAME=Content ROWS=25 COLS=80 WRAP=SOFT>
+<%$TemplateObj->Content%></TEXTAREA>
+
+<& /Elements/TitleBoxEnd&>
+<&/Elements/Submit&>
+</FORM>
+
+
+
+<%INIT>
+
+my $TemplateObj = new RT::Template($session{'CurrentUser'});
+my  ($title, @results);
+
+if ($create) {
+  $title = "Create a template";
+}
+
+else {
+  if ($template eq 'new') {
+      my ($val, $msg) =  $TemplateObj->Create(Queue => $Queue, Name => $Name);
+      Abort("Could not create template: $msg") unless ($val);
+     push @results, $msg;
+     $title = 'Created template ' . $TemplateObj->Name(); 
+    }
+    else {
+       $TemplateObj->Load($template) || Abort('No Template');
+      $title = 'Editing template ' . $TemplateObj->Name(); 
+    }
+  
+    
+}
+if ($TemplateObj->Id()) {
+  $Queue = $TemplateObj->Queue;
+
+  my @attribs = qw( Description Content Queue Name);
+  my @aresults = UpdateRecordObject( AttributesRef => \@attribs, 
+                                    Object => $TemplateObj, 
+                                    ARGSRef => \%ARGS);
+  push @results, @aresults;
+}
+</%INIT>
+<%ARGS>
+$Queue => undef
+$template => undef
+$create => undef
+$Name => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/Templates.html b/rt/webrt/Admin/Queues/Templates.html
new file mode 100755 (executable)
index 0000000..218d41d
--- /dev/null
@@ -0,0 +1,24 @@
+<& /Admin/Elements/Header, Title => 'Edit templates for '.$Queue->Name &>
+<& /Admin/Elements/QueueTabs, id => $Queue->id &>
+
+<& /Elements/TitleBoxStart, title => 'Edit templates for '.$Queue->Name &>
+<UL>
+<LI><A href="Template.html?create=1&Queue=<%$Queue->id%>">Create a new template</A><BR><BR>
+
+%while  (my $TemplateObj = $Templates->Next) { 
+
+<LI><A HREF="Template.html?Queue=<%$id%>&template=<%$TemplateObj->id()%>"><%$TemplateObj->id()%>/<%$TemplateObj->Name%>: <%$TemplateObj->Description%></a><BR>
+
+%}
+
+<& /Elements/TitleBoxEnd &>
+<%INIT>
+
+my $Queue = new RT::Queue($session{'CurrentUser'});
+$Queue->Load($id);
+my $Templates = $Queue->Templates;
+
+</%INIT>
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/UserRights.html b/rt/webrt/Admin/Queues/UserRights.html
new file mode 100755 (executable)
index 0000000..75d9cb2
--- /dev/null
@@ -0,0 +1,72 @@
+<& /Admin/Elements/Header, Title => 'Modify user rights for queue '. $QueueObj->Name &>
+<& /Admin/Elements/QueueTabs, id => $id &>  
+<& /Elements/ListActions, actions => \@results &>
+
+  <FORM METHOD=POST ACTION="UserRights.html">
+    <INPUT TYPE=HIDDEN NAME=id VALUE="<% $QueueObj->id %>">
+      
+<& /Elements/TitleBoxStart, title => 'Modify user rights for queue '.$QueueObj->Name &>
+      
+<TABLE>
+        
+%      while (my $UserObj = $Users->Next()) {
+  <TR ALIGN=RIGHT> 
+       <TD VALIGN=TOP>
+           <% $UserObj->Name %>
+                 </TD>
+         <TD>
+           <& /Admin/Elements/SelectRights, PrincipalObj => $UserObj,
+                   PrincipalType => 'User',
+                     Scope => 'Queue',
+                       QueueObj => $QueueObj &>
+         </TD>
+       </TR>
+% }
+      </TABLE>
+            
+      <& /Elements/TitleBoxEnd &>
+      <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &>
+      
+  </FORM>
+  
+<%INIT>
+  #Update the acls.
+  my @results =  ProcessACLChanges(\@CheckACL, \%ARGS);
+
+# {{{ Deal with setting up the display of current rights.
+
+# {{{ do basic initialization.
+
+#Define vars used in html above
+my ($GroupObj);
+
+my ($right);
+
+
+if (!defined $id) {
+    Abort("No Queue defined");
+}
+
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+$QueueObj->Load($id) ||
+  Abort("Couldn't load queue $id");
+
+# Find out which users we want to display ACL selects for
+my $Users = new RT::Users($session{'CurrentUser'});
+$Users->LimitToPrivileged();
+
+# }}}
+    
+  
+# }}}
+    
+</%INIT>
+
+<%ARGS>
+$id => undef
+$UserString => undef
+$UserOp => undef
+$UserField => undef
+@CheckACL => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Queues/index.html b/rt/webrt/Admin/Queues/index.html
new file mode 100755 (executable)
index 0000000..52dfb73
--- /dev/null
@@ -0,0 +1,52 @@
+<& /Admin/Elements/Header, Title => 'Admin queues' &>
+<& /Admin/Elements/Tabs, current_tab => 'Admin/Queues/' &>
+
+
+<& /Elements/TitleBoxStart, title => 'Select a queue' &>
+
+<TABLE>
+<TR>
+<TD VALIGN=TOP>
+
+<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Queues/">
+
+<input type="checkbox" name="FindDisabledQueues"> Include disabled queues in listing.
+<BR>
+<div align=right><input type=submit value="Go!"></div> 
+</FORM>
+</TD>
+<TD VALIGN=TOP>
+<UL>
+% if ($session{'CurrentUser'}->HasSystemRight('AdminQueue')) {
+<LI><A HREF="<%$RT::WebPath%>/Admin/Queues/Modify.html?Create=1">Create a new queue</A><BR><BR></LI>
+</UL>
+% }
+
+<%$caption%><BR>
+<UL>
+%if ($queues->Count == 0) {
+<LI> <i>No queues matching search criteria found.</i>
+% }
+%while ( $queue = $queues->Next) {
+<LI><A HREF="Modify.html?id=<%$queue->id%>"><%$queue->Name%></a></LI>
+%}
+
+</UL>
+</TD>
+</TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+<%INIT>
+my ($queue, $caption);
+my $queues = new RT::Queues($session{'CurrentUser'});
+$queues->UnLimit();
+
+if ($FindDisabledQueues) {
+       $queues->{'find_disabled_rows'} = 1;
+}
+
+</%INIT>
+<%ARGS>
+$FindDisabledQueues => 0
+</%ARGS>
diff --git a/rt/webrt/Admin/Users/Modify.html b/rt/webrt/Admin/Users/Modify.html
new file mode 100755 (executable)
index 0000000..b6daed4
--- /dev/null
@@ -0,0 +1,259 @@
+<& /Admin/Elements/Header, Title => $title &>
+<& /Admin/Elements/UserTabs, id => $id, current_subtab => '/Admin/Elements/Modify.html?id='.$id &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Users/Modify.html" METHOD=POST>
+%if ($Create) {
+<INPUT TYPE=HIDDEN NAME=id VALUE="new">
+% } else {
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>">
+% }
+
+<TABLE WIDTH=100% BORDER=0>
+<TR>
+
+<TD VALIGN=TOP ROWSPAN=2>
+<& /Elements/TitleBoxStart, title => 'Identity' &>
+
+Username: <input name="Name" value="<%$UserObj->Name%>"> <b>(required)</b> <BR>
+Email: <input name="EmailAddress" value="<%$UserObj->EmailAddress%>"><BR>
+Real Name: <input name="RealName" value="<%$UserObj->RealName%>"> <BR>
+Nickname: <input name="NickName" value="<%$UserObj->NickName%>">
+<BR>
+Unix login: <input name="Gecos" value="<%$UserObj->Gecos%>">
+<BR>
+Extra info: <textarea name="FreeformContactInfo" cols=20 rows=5><%$UserObj->FreeformContactInfo%></TEXTAREA>
+<& /Elements/TitleBoxEnd &>
+</TD>
+<TD VALIGN=TOP>
+<& /Elements/TitleBoxStart, title => 'Access control' &>
+<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
+<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>>
+Let this user access RT<BR>
+
+
+<INPUT TYPE=HIDDEN NAME="SetPrivileged" VALUE="1">
+<INPUT TYPE=CHECKBOX NAME="Privileged" VALUE="1" <%$PrivilegedChecked%>> Let this user be granted rights<BR>
+                   
+% unless ($RT::WebExternalAuth) {
+<TABLE>
+<TR>
+<TD ALIGN=RIGHT>
+New Password:
+</TD>
+<TD ALIGN=LEFT>
+<input type=password name="Pass1">
+</TD>
+</TR>
+<TR><TD ALIGN=RIGHT>
+Retype Password:
+</TD>
+<TD>
+<input type=password name="Pass2">
+</TD>
+</TR>
+</TABLE>
+% }
+<& /Elements/TitleBoxEnd &>
+</TD>
+<TR>
+
+<TD VALIGN=TOP>
+<& /Elements/TitleBoxStart, title => 'Location' &>
+Organization: <input name="Organization" value="<%$UserObj->Organization%>">
+<BR>
+Address1: <input name="Address1" value="<%$UserObj->Address1%>">
+<BR>
+Address2: <input name="Address2" value="<%$UserObj->Address2%>">
+<BR>
+City: <input name="City" value="<%$UserObj->City%>" size=14>
+
+State: <input name="State" value="<%$UserObj->State%>" size=3>
+
+Zip: <input name="Zip" value="<%$UserObj->Zip%>" size=9>
+<BR>
+Country: <input name="Country" value="<%$UserObj->Country%>">
+<BR>
+
+
+<& /Elements/TitleBoxEnd &>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2 VALIGN=TOP>
+
+
+<& /Elements/TitleBoxStart, title => 'Phone numbers' &>
+Home: <input name="HomePhone" value="<%$UserObj->HomePhone%>" size=13>
+
+Work: <input name="WorkPhone" value="<%$UserObj->WorkPhone%>" size=13>
+
+Mobile: <input name="MobilePhone" value="<%$UserObj->MobilePhone%>" size=13>
+
+Pager: <input name="PagerPhone" value="<%$UserObj->PagerPhone%>" size=13>
+<& /Elements/TitleBoxEnd &>
+<BR>
+<& /Elements/TitleBoxStart, title => 'Comments about this user' &>
+<TEXTAREA name="Comments" COLS=80 ROWS=5 WRAP=VIRTUAL><%$UserObj->Comments%></TEXTAREA>
+<& /Elements/TitleBoxEnd &>
+
+
+%if ($UserObj->Privileged) {
+<BR>
+<& /Elements/TitleBoxStart, title => 'Signature' &>
+<TEXTAREA COLS=80 ROWS=5 name="Signature" WRAP=HARD>
+<%$UserObj->Signature%></TEXTAREA>
+<& /Elements/TitleBoxEnd &>
+% }
+
+</TD>
+
+</TR>
+</TABLE>
+
+
+<& /Elements/Submit &>
+</form>
+
+
+<%INIT>
+
+my $UserObj = new RT::User($session{'CurrentUser'});
+my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results);
+
+my ($val, $msg);
+
+if ($Create) {
+    $title = "Create a new user";
+} 
+else {
+
+    if ($id eq 'new') {
+       ($val, $msg) = $UserObj->Create( Name => $Name,
+                                        EmailAddress => $ARGS{'EmailAddress'}
+                                      );
+       if ($val) {
+               push @results, $msg;
+       } else {
+               push @results, 'User could not be created: '. $msg;
+       }       
+       
+    }
+    else {
+       $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'");
+       $val = $UserObj->Id();
+    }
+
+    if ($val) {
+       $title = "Modify the user ". $UserObj->Name;
+    }  
+
+    # If the create failed
+    else {
+       $title = "Create a new user";
+       $Create = 1;
+    }    
+
+    
+
+}
+
+
+
+
+# If we have a user to modify, lets try. 
+if ($UserObj->Id) {
+    
+    my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo 
+                   Organization RealName NickName Lang EmailEncoding WebEncoding 
+                   ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId 
+                   AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
+               Address2 City State Zip Country 
+                  );
+    
+    my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
+                                           Object => $UserObj,
+                                           ARGSRef => \%ARGS );
+    push (@results,@fieldresults);
+
+
+# {{{ Deal with special fields: Privileged, Enabled and Password
+if  ( ($SetPrivileged) and ( $Privileged != $UserObj->Privileged) ) {
+my  ($code, $msg) = $UserObj->SetPrivileged($Privileged);
+     push @results, 'Privileged status: '. $msg;
+}
+
+#we're asking about enabled on the web page but really care about disabled.
+if ($Enabled == 1) {
+    $Disabled = 0;
+}      
+else {
+    $Disabled = 1;
+}
+if  ( ($SetEnabled) and ( $Disabled != $UserObj->Disabled) ) { 
+    my  ($code, $msg) = $UserObj->SetDisabled($Disabled);
+    push @results, 'Enabled status '. $msg;
+}
+
+
+#TODO: make this report errors properly
+if ((defined $Pass1) and ($Pass1 ne '') and ($Pass1 eq $Pass2) and (!$UserObj->IsPassword($Pass1))) {
+    my ($code, $msg);
+    ($code, $msg) = $UserObj->SetPassword($Pass1);
+    push @results, 'Password: '. $msg;
+}
+
+# }}}
+}
+
+
+# {{{ Do some setup for the ui
+unless ($UserObj->Disabled()) {
+    $EnabledChecked ="CHECKED";
+}
+
+if ($UserObj->Privileged()) {  
+    $PrivilegedChecked = "CHECKED";
+}
+
+# }}}
+</%INIT>
+
+
+<%ARGS>
+$id => undef
+$Name  => undef
+$Comments  => undef
+$Signature  => undef
+$EmailAddress  => undef
+$FreeformContactInfo => undef
+$Organization  => undef
+$RealName  => undef
+$NickName  => undef
+$Privileged => undef
+$SetPrivileged => undef
+$Enabled => undef
+$SetEnabled => undef
+$Lang  => undef
+$EmailEncoding  => undef
+$WebEncoding => undef
+$ExternalContactInfoId  => undef
+$ContactInfoSystem  => undef
+$Gecos => undef
+$ExternalAuthId  => undef
+$AuthSystem  => undef
+$HomePhone => undef
+$WorkPhone  => undef
+$MobilePhone  => undef
+$PagerPhone  => undef
+$Address1 => undef
+$Address2  => undef
+$City  => undef
+$State  => undef
+$Zip  => undef
+$Country => undef
+$Pass1 => undef
+$Pass2=> undef
+$Create=> undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Users/Prefs.html b/rt/webrt/Admin/Users/Prefs.html
new file mode 100755 (executable)
index 0000000..4a9fc5c
--- /dev/null
@@ -0,0 +1,97 @@
+<& /Elements/Header, Title=>"User view" &>
+
+<& /Elements/ViewUser, User=>$u &>
+
+%if ($session{CurrentUser} && ($session{CurrentUser}->Id == $id)) {
+       <& /Elements/TitleBoxStart, title => 'Signature'  &>
+<form method=post>
+<input type="hidden" name="id" value=<%$id%>>
+<TEXTAREA COLS=72 ROWS=4 WRAP=HARD NAME="Signature"><% $u->Signature %></TEXTAREA><br><br>
+<input type="submit" value="Update signature">
+</form>
+         <& /Elements/TitleBoxEnd &>
+         <form method=post>
+         Open tickets (from listing) in another window: <input type="checkbox" name="NewWindowOption" <%exists $session{NewWindowOption} && "CHECKED"%>><br>
+         Open tickets (from listing) in a new window: <input type="checkbox" name="AlwaysNewWindowOption" <%exists $session{AlwaysNewWindowOption} && "CHECKED"%>><br>
+         <input type="submit" name="NewWindowSetting" value="New window setting">
+         </form>
+%}
+
+       <& /Elements/TitleBoxStart, title => 'Email'  &>
+<form method=post>
+<input type="hidden" name="id" value="<%$id%>">
+<input name="Email" value="<% $u->EmailAddress %>"><input type="submit" value="Update email">
+</form>
+         <& /Elements/TitleBoxEnd &>
+       <& /Elements/TitleBoxStart, title => 'Real Name'  &>
+<form method=post>
+<input type="hidden" name="id" value="<%$id%>">
+<input name="RealName" value="<% $u->RealName %>"><input type="submit" value="Update name">
+</form>
+         <& /Elements/TitleBoxEnd &>
+
+       <& /Elements/TitleBoxStart, title => 'User ID'  &>
+<form method=post>
+<input type="hidden" name="id" value="<%$id%>">
+<input name="Name" value="<% $u->Name %>"><input type="submit" value="Update ID">
+</form>
+         <& /Elements/TitleBoxEnd &>
+
+%# TODO: alternative email addresses + merging users
+
+<%ARGS>
+$id => $session{CurrentUser} ? $session{CurrentUser}->Id : 0
+$Signature => undef
+$Email => undef
+$RealName => undef
+$Name => undef
+</%ARGS>
+
+<%INIT>
+require RT::User;
+my $u=RT::User->new($session{CurrentUser});
+$u->Load($id) || die "Couldn't load that user ($id)";
+if ($Signature) {
+my ($val, $msg)=$u->SetSignature($Signature);
+$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
+}
+
+if ($Email) {
+my ($val, $msg)=$u->SetEmailAddress($Email);
+$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
+}
+
+if ($RealName) {
+my ($val, $msg)=$u->SetRealName($RealName);
+$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
+}
+
+if ($Name) {
+my ($val, $msg)=$u->SetName($Name);
+$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg);
+}
+
+if ($ARGS{NewWindowSetting}) {
+if ($ARGS{NewWindowOption}) {
+$session{NewWindowOption}=1;
+} else {
+delete $session{NewWindowOption};
+}
+if ($ARGS{AlwaysNewWindowOption}) {
+$session{NewWindowOption}=1;
+$session{AlwaysNewWindowOption}=1;
+} else {
+delete $session{AlwaysNewWindowOption};
+}
+}
+
+</%INIT>
+
+
+
+
+
+
+
+
+
diff --git a/rt/webrt/Admin/Users/Rights.html b/rt/webrt/Admin/Users/Rights.html
new file mode 100644 (file)
index 0000000..3b94f91
--- /dev/null
@@ -0,0 +1 @@
+Placeholder
diff --git a/rt/webrt/Admin/Users/index.html b/rt/webrt/Admin/Users/index.html
new file mode 100755 (executable)
index 0000000..3835137
--- /dev/null
@@ -0,0 +1,71 @@
+<& /Admin/Elements/Header, Title => 'Admin users' &>
+<& /Admin/Elements/Tabs, current_tab => 'Admin/Users/' &>
+
+
+<& /Elements/TitleBoxStart, title => 'Select a user' &>
+
+<TABLE>
+<TR>
+<TD VALIGN=TOP>
+
+<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Users/">
+
+Find people whose <& /Elements/SelectUsers &><BR>
+<input type="checkbox" name="FindDisabledUsers"> Include disabled users in search.
+<BR>
+<div align=right><input type=submit value="Go!"></div> 
+</FORM>
+</TD>
+<TD VALIGN=TOP>
+<UL>
+% if ($session{'CurrentUser'}->HasSystemRight('AdminUsers')) {
+<LI><A HREF="<%$RT::WebPath%>/Admin/Users/Modify.html?Create=1">Create a new user</A><BR><BR></LI>
+</UL>
+% }
+
+<%$caption%><BR>
+<UL>
+%if ($users->Count == 0) {
+<LI> <i>No users matching search criteria found.</i>
+% }
+%while ( $user = $users->Next) {
+<LI><A HREF="Modify.html?id=<%$user->id%>"><%$user->Name || '(no name listed)'%></a></LI>
+%}
+
+</UL>
+</TD>
+</TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+<%INIT>
+my ($user, $caption);
+my $users = new RT::Users($session{'CurrentUser'});
+
+if ($FindDisabledUsers) {
+       $users->{'find_disabled_rows'} = 1;
+}
+
+unless (defined $UserString) {
+    $users->LimitToPrivileged();
+    $caption = "Privileged users";
+}
+else {
+    $caption = "Users matching search criteria";
+
+  if ($UserString) {
+       $users->Limit( FIELD => $UserField,
+                       OPERATOR => $UserOp,
+                      VALUE => $UserString); 
+
+}
+}
+</%INIT>
+<%ARGS>
+$UserString => undef
+$UserOp => '='
+$UserField => 'Name'
+$IdLike => undef
+$EmailLike => undef
+$FindDisabledUsers => 0
+</%ARGS>
diff --git a/rt/webrt/Admin/index.html b/rt/webrt/Admin/index.html
new file mode 100755 (executable)
index 0000000..1ed973f
--- /dev/null
@@ -0,0 +1,4 @@
+  <& /Admin/Elements/Header, Title => 'RT Administration' &>
+<& /Admin/Elements/Tabs &>
+
+
diff --git a/rt/webrt/Elements/Checkbox b/rt/webrt/Elements/Checkbox
new file mode 100755 (executable)
index 0000000..964c482
--- /dev/null
@@ -0,0 +1,17 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/Checkbox,v 1.1 2002-08-12 06:17:08 ivan Exp $
+<INPUT TYPE="Checkbox" NAME ="<%$Name%>" <%$IsChecked%>>
+
+<%ARGS>
+$Name => undef
+$Default => undef
+$True => undef
+$False => undef
+$IsChecked => undef
+</%ARGS>
+
+<%INIT>
+$IsChecked = 
+  ($Default && $Default =~ /checked/i)
+    ? " CHECKED " : "";
+1;
+</%INIT>
diff --git a/rt/webrt/Elements/CreateTicket b/rt/webrt/Elements/CreateTicket
new file mode 100644 (file)
index 0000000..1270f6e
--- /dev/null
@@ -0,0 +1 @@
+<FORM ACTION="<% $RT::WebPath%>/Ticket/Create.html"><input type=submit value="New ticket in">&nbsp;<& /Elements/SelectNewTicketQueue &></FORM>
diff --git a/rt/webrt/Elements/CustomHomepageHeader b/rt/webrt/Elements/CustomHomepageHeader
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/rt/webrt/Elements/Error b/rt/webrt/Elements/Error
new file mode 100755 (executable)
index 0000000..ec2cf51
--- /dev/null
@@ -0,0 +1,23 @@
+<& /Elements/Header, Code => $Code, Why => $Why &>
+<& /Elements/Tabs &>
+<& /Elements/TitleBoxStart, title => $Title &>
+<%$Why%>
+<br>
+<font size=-1>
+<%$Details%>
+</font>
+<& /Elements/TitleBoxEnd &>
+</body>
+</HTML>
+
+
+<%args>
+$Code => undef
+$Details => undef
+$Title => "RT Error"
+$Why => "the calling component did not specify why"
+</%args>
+
+<%INIT>
+$RT::Logger->error("WebRT: $Why ($Details)");
+</%INIT>
diff --git a/rt/webrt/Elements/Footer b/rt/webrt/Elements/Footer
new file mode 100755 (executable)
index 0000000..776c219
--- /dev/null
@@ -0,0 +1,10 @@
+% if ($Debug) {
+<HR>
+<b>Time to display: <%time - $m->{'rt_base_time'} %></b>
+% }
+</BODY>
+</HTML>
+
+<%ARGS>
+$Debug => 0
+</%ARGS>
diff --git a/rt/webrt/Elements/GotoTicket b/rt/webrt/Elements/GotoTicket
new file mode 100644 (file)
index 0000000..21d2bcd
--- /dev/null
@@ -0,0 +1 @@
+<FORM ACTION="<%$RT::WebPath%>/Ticket/Display.html"><input type=submit value="Goto ticket">&nbsp;<input size=5 name=id></FORM>
diff --git a/rt/webrt/Elements/Header b/rt/webrt/Elements/Header
new file mode 100755 (executable)
index 0000000..471331b
--- /dev/null
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+<HEAD>
+<TITLE><%$Title%></TITLE>
+<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
+
+%# TODO this gets called from error. but I have no idea what it might
+%# be used for. can we whack it?  -jesse
+% if ($Code) {
+<META HTTP-EQUIV VALUE="<%$Code%> <%$Why%>">
+% }
+% if ($Refresh > 0) {
+<META HTTP-EQUIV="REFRESH" CONTENT="<%$Refresh%>">
+% }
+
+<link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/webrt.css" type="text/css">
+</HEAD>
+<BODY BGCOLOR="<%$BgColor%>">
+% if ($ShowBar) {
+<TABLE BORDER=0 WIDTH=100% CELLSPACING=0 BGCOLOR="#993333">
+<TR VALIGN=TOP>
+<TD><IMG SRC="<%$RT::LogoURL%>" alt="RT"></TD>
+<TD VALIGN=CENTER ALIGN=LEFT>
+<font size=+2 color="#ffffff">
+<B>
+<%$Title%>
+</B>
+</font>
+</TD>
+<TD ALIGN=RIGHT>
+<font color="#ffffff">
+% if ($session{'CurrentUser'}) {
+Signed in as <b><%$session{'CurrentUser'}->Name%></b>.<BR>
+% if ($session{'CurrentUser'}->HasSystemRight('ModifySelf')) {
+[<A class='inverse' HREF="<%$RT::WebPath%>/User/Prefs.html" >Preferences</A>] 
+% }
+% unless ($RT::WebExternalAuth) { 
+[<A class='inverse' HREF="<%$RT::WebPath%>/NoAuth/Logout.html">Logout</a>]
+% }
+% } else {
+Not logged in.
+% }
+</font>
+</TD>
+</TR>
+</TABLE>
+
+<BR>
+% }
+<%ARGS>
+$Title => 'WebRT'
+$Code => undef
+$Refresh => undef
+$Why => undef
+$BgColor => '#ffffff'
+$ShowBar => 1
+</%ARGS>
+<%INIT>
+$Title = "RT/$RT::rtname: ".$Title;
+</%INIT>
+
diff --git a/rt/webrt/Elements/ListActions b/rt/webrt/Elements/ListActions
new file mode 100755 (executable)
index 0000000..3fc9b0b
--- /dev/null
@@ -0,0 +1,14 @@
+% if (@actions ) {
+<& /Elements/TitleBoxStart, title => 'Results' &>
+<UL>
+% foreach my $action (@actions) {
+% next unless ($action);
+<LI><%$action%></LI>
+% }
+</UL>
+<& /Elements/TitleBoxEnd &>
+<BR>
+% }
+<%ARGS>
+@actions => undef
+</%ARGS>
diff --git a/rt/webrt/Elements/Login b/rt/webrt/Elements/Login
new file mode 100755 (executable)
index 0000000..27ec982
--- /dev/null
@@ -0,0 +1,69 @@
+<& /Elements/Header, Title=>"Login" , &>
+
+<DIV ALIGN=CENTER>
+% if ($Error) {
+<& /Elements/TitleBoxStart, title => 'Error' &>
+<% $Error %>
+<& /Elements/TitleBoxEnd &>
+% }
+<BR>
+<& /Elements/TitleBoxStart, width=> "40%", titleright => "RT $RT::VERSION for $RT::rtname", title => 'Login' ,
+contentbg=>"#cccccc" &>
+
+
+% unless ($RT::WebExternalAuth) {
+<FORM METHOD=POST >
+<TABLE BORDER=0 WIDTH=100%>
+<TR ALIGN=RIGHT>
+<TD ALIGN=RIGHT>Username:</TD><TD ALIGN=LEFT><input name=user value="<%$user%>"></TD></TR>
+<TR><TD ALIGN=RIGHT>Password:</TD><TD ALIGN=LEFT><input type=password name=pass></TD></TR>
+<TR><TD colspan=2 align=right>
+<input type=submit Value="Login">
+</TD></TR>
+</TABLE>
+<&/Elements/TitleBoxEnd&>
+% # From mason 1.0.1 forward, this doesn't work. in fact, it breaks things.
+% if (0) {
+% # The code below iterates through everything in the passed in arguments
+% # Preserving all the old parameters
+% # This would be easier, except mason is 'smart' and calls multiple values
+% # arrays rather than multiple hash keys
+% my $key; my $val;
+% foreach $key (keys %ARGS) {
+%  if (($key ne 'user') and ($key ne 'pass')) {
+%      if (ref($ARGS{$key}) =~ /ARRAY/) {
+%              foreach $val (@{$ARGS{$key}}) {
+<input type=hidden name="<%$key %>" value="<% $val %>">
+%              }
+%      }
+%      else {
+<input type="hidden" name="<% $key %>" value="<% $ARGS{$key} %>">
+%      }
+% }
+%}
+% }
+</FORM>
+% }
+</DIV>
+
+<BR>
+<!-- TODO: not yet implemented
+If you've forgotten your username or password, RT can <A
+href="/NoAuth/Reminder.html">send you a reminder</a>.
+-->
+<BR>
+<HR>
+RT is &copy; Copyright 1996-2002 Jesse Vincent &lt;jesse@bestpractical.com&gt;.  It is
+distributed under <a href="http://www.gnu.org/copyleft/gpl.html">Version 2 of the GNU General Public License.</a>
+
+
+<%ARGS>
+$user => ""
+$pass => undef
+$goto => undef
+$Error => undef
+</%ARGS>
+
+<%INIT>
+SetContentType('text/html');
+</%INIT>
diff --git a/rt/webrt/Elements/MessageBox b/rt/webrt/Elements/MessageBox
new file mode 100644 (file)
index 0000000..aa081a3
--- /dev/null
@@ -0,0 +1,30 @@
+<TEXTAREA COLS=<%$Width%> ROWS=15 WRAP=HARD NAME="<%$Name%>"><% $Default %><%$message%><%$signature%></TEXTAREA>
+<%INIT>
+
+my ($message);
+
+if ($MessageURI) {
+       my $code;
+       ($code, $Default)=RT::Link->GetContent($MessageURI);
+}
+if ($QuoteTransaction) {
+    my $transaction=RT::Transaction->new($session{'CurrentUser'});
+    $transaction->Load($QuoteTransaction);
+    $message=$transaction->Content(Quote => 1);
+}
+
+my $signature = '';
+if ($session{'CurrentUser'}->UserObj->Signature) {
+       $signature = "-- \n".$session{'CurrentUser'}->UserObj->Signature;
+}
+
+</%INIT>
+<%ARGS>
+$QuoteTransaction => undef
+$Name => 'Content'
+$Default => ''
+$DefaultURI => undef
+$Width => 72
+$MessageURI => undef
+</%ARGS>
+
diff --git a/rt/webrt/Elements/MyRequests b/rt/webrt/Elements/MyRequests
new file mode 100644 (file)
index 0000000..6781729
--- /dev/null
@@ -0,0 +1,45 @@
+<& /Elements/TitleBoxStart, title => "25 highest priority tickets I requested..." &>
+<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>Owner</TH>
+<TH>&nbsp;</TH>
+</TR>
+% while (my $Ticket = $MyTickets->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>
+<%$Ticket->OwnerObj->Name%>
+</TD><TD ALIGN=RIGHT>
+[<A HREF="<% $RT::WebPath %>/Ticket/Display.html?id=<%$Ticket->Id%>">Display</A>]
+</TD>
+</TR>
+% }
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+
+<%INIT>
+my $MyTickets;
+$MyTickets = new RT::Tickets ($session{'CurrentUser'});
+$MyTickets->LimitRequestor(VALUE => $session{'CurrentUser'}->EmailAddress);
+$MyTickets->LimitStatus(VALUE => "open");
+$MyTickets->LimitStatus(VALUE => "new");
+$MyTickets->OrderBy(FIELD => 'Priority', ORDER => 'DESC');
+$MyTickets->RowsPerPage(25);
+
+</%INIT>
diff --git a/rt/webrt/Elements/MyTickets b/rt/webrt/Elements/MyTickets
new file mode 100644 (file)
index 0000000..64a2ba7
--- /dev/null
@@ -0,0 +1,43 @@
+<& /Elements/TitleBoxStart, title => "25 highest priority tickets I own..." &>
+<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>&nbsp;</TH>
+</TR>
+% while (my $Ticket = $MyTickets->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/Update.html?id=<%$Ticket->Id%>">Update</A>]
+</TD>
+</TR>
+% }
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+
+<%INIT>
+my $MyTickets;
+$MyTickets = new RT::Tickets ($session{'CurrentUser'});
+$MyTickets->LimitOwner(VALUE => $session{'CurrentUser'}->Id);
+$MyTickets->LimitStatus(VALUE => "open");
+$MyTickets->LimitStatus(VALUE => "new");
+$MyTickets->OrderBy(FIELD => 'Priority', ORDER => 'DESC');
+$MyTickets->RowsPerPage(25);
+
+</%INIT>
diff --git a/rt/webrt/Elements/Quicksearch b/rt/webrt/Elements/Quicksearch
new file mode 100644 (file)
index 0000000..d44c996
--- /dev/null
@@ -0,0 +1,41 @@
+<& /Elements/TitleBoxStart, title => "Find new/open tickets", titleright => "<A class='inverse' href=\"$RT::WebPath/Search/Listing.html?NewSearch=1\">Advanced Search</A>" &>
+
+<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>                       
+<tr>                                                                          
+       <th align=left>Queue</th>                                         
+       <th align=left><font size=-1>New</font></th>
+       <th align=left><font size=-1>Open</font></th>          
+       <th align=left><font size=-1>Stalled</font></th>          
+</tr>
+
+<%PERL>
+while (my $queue = $Queues->Next) {
+     $Tickets->ClearRestrictions;                                           
+     $Tickets->LimitStatus(VALUE => "open");                                
+     $Tickets->LimitQueue(VALUE => $queue->id, OPERATOR => '=');            
+     my $open = $Tickets->Count();
+
+     $Tickets->ClearRestrictions;                                           
+     $Tickets->LimitStatus(VALUE => "new");
+     $Tickets->LimitQueue(VALUE => $queue->id, OPERATOR => '=');            
+     my $new = $Tickets->Count();
+
+     $Tickets->ClearRestrictions; 
+     $Tickets->LimitStatus(VALUE => "stalled");
+     $Tickets->LimitQueue(VALUE => $queue->id, OPERATOR => '=');            
+     my $stalled = $Tickets->Count();
+</%PERL>
+<TR><TD><A HREF="<% $RT::WebPath%>/Search/Listing.html?ValueOfStatus=open&ValueOfStatus=new&StatusOp=%3D&QueueOp=%3D&ValueOfQueue=<%$queue->Id%>&RowsPerPage=50&NewSearch=1"><%$queue->Name%></a></TD>
+<TD><%$new%></TD>
+<TD><%$open%></TD>
+<TD><%$stalled%></TD>
+</TR>
+% }
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+<%INIT>
+my $Queues = new RT::Queues($session{'CurrentUser'}); 
+$Queues->UnLimit();
+my $Tickets = new RT::Tickets ($session{'CurrentUser'});
+</%INIT>
diff --git a/rt/webrt/Elements/Refresh b/rt/webrt/Elements/Refresh
new file mode 100644 (file)
index 0000000..6949d8c
--- /dev/null
@@ -0,0 +1,22 @@
+<SELECT NAME="<%$Name%>">
+<OPTION VALUE="-1"
+%unless ($Default) {
+ SELECTED
+%}
+>Don't refresh this page.</OPTION>
+%foreach my $value (@refreshevery) {
+<OPTION VALUE="<%$value%>"
+% if ($value == $Default) {
+SELECTED 
+% }
+>Refresh this page every <%$value/60%> minutes.
+%}
+</SELECT>
+
+<%INIT>
+my @refreshevery = qw(120 300 600 1200 3600 7200);
+</%INIT>
+<%ARGS>
+$Name => undef
+$Default => undef
+</%ARGS>
diff --git a/rt/webrt/Elements/Section b/rt/webrt/Elements/Section
new file mode 100755 (executable)
index 0000000..067311d
--- /dev/null
@@ -0,0 +1,11 @@
+<TABLE WIDTH=100%>
+<TR>
+<TD>
+<font size=+4><%$title%></font>
+</TD>
+</TR>
+</TABLE>
+
+<%ARGS>
+$title => undef
+</%ARGS>
\ No newline at end of file
diff --git a/rt/webrt/Elements/SelectBoolean b/rt/webrt/Elements/SelectBoolean
new file mode 100755 (executable)
index 0000000..93b78ce
--- /dev/null
@@ -0,0 +1,24 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectBoolean,v 1.1 2002-08-12 06:17:08 ivan Exp $
+<SELECT NAME ="<%$Name%>">
+<OPTION VALUE="<%$TrueVal%>" <%$TrueDefault%>><%$True%></OPTION>
+<OPTION VALUE="<%$FalseVal%>" <%$FalseDefault%>><%$False%></OPTION>
+</SELECT>
+
+<%ARGS>
+$Name => undef
+$True => "is"
+$Default => 'true'
+$TrueVal => 1
+$FalseVal => 0
+$False => "isn't"
+</%ARGS>
+
+<%INIT>
+my ($TrueDefault, $FalseDefault);
+if ($Default && $Default !~ /true/i) {
+       $FalseDefault = "SELECTED";
+}
+else {
+       $TrueDefault = "SELECTED";
+}
+</%INIT>
diff --git a/rt/webrt/Elements/SelectDate b/rt/webrt/Elements/SelectDate
new file mode 100755 (executable)
index 0000000..6fafbf1
--- /dev/null
@@ -0,0 +1,25 @@
+<INPUT NAME="<%$Name%>" VALUE="<%$Default%>" size=16> 
+
+<%init>
+unless ((defined $Default) or 
+       ($current <= 0)) {
+       my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
+                                            localtime($current);
+        $Default = sprintf("%04d-%02d-%02d %02d:%02d",                         
+                           $year+1900,$mon+1,$mday,                            
+                           $hour,$min);   
+}
+
+unless ($Name) {
+       $Name = $menu_prefix. "_Date";
+}
+</%init>
+
+<%args>
+
+$ShowTime => undef
+$menu_prefix=>''
+$current=>time
+$Default => undef
+$Name => undef
+</%args>
diff --git a/rt/webrt/Elements/SelectDateRelation b/rt/webrt/Elements/SelectDateRelation
new file mode 100755 (executable)
index 0000000..c5849c8
--- /dev/null
@@ -0,0 +1,14 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectDateRelation,v 1.1 2002-08-12 06:17:08 ivan Exp $
+<SELECT NAME ="<%$Name%>">
+<OPTION VALUE="&lt;"><%$Before%></OPTION>
+<OPTION VALUE="="><%$On%></OPTION>
+<OPTION VALUE="&gt;"><%$After%></OPTION>
+</SELECT>
+
+<%ARGS>
+$Name => undef
+$Default => undef
+$Before => 'Before'
+$On =>         'On'
+$After => 'After'
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectDateType b/rt/webrt/Elements/SelectDateType
new file mode 100755 (executable)
index 0000000..65c0e9b
--- /dev/null
@@ -0,0 +1,12 @@
+<SELECT NAME="<%$Name%>">
+<OPTION VALUE="Created">Created</OPTION>
+<OPTION VALUE="Started">Started</OPTION>
+<OPTION VALUE="Resolved">Resolved</OPTION>
+<OPTION VALUE="Told">Last Contacted</OPTION>
+<OPTION VALUE="LastUpdated">Last Updated</OPTION>
+<OPTION VALUE="StartsBy">Starts By</OPTION>
+<OPTION VALUE="Due">Due</OPTION>
+</SELECT>
+<%ARGS>
+$Name => 'DateType'
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectEqualityOperator b/rt/webrt/Elements/SelectEqualityOperator
new file mode 100755 (executable)
index 0000000..f93dc1a
--- /dev/null
@@ -0,0 +1,18 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectEqualityOperator,v 1.1 2002-08-12 06:17:08 ivan Exp $
+<SELECT NAME ="<%$Name%>">
+% while (my $option = shift @Options) {
+% my $value = shift @Values;
+<OPTION VALUE="<%$value%>"
+% if ($Default eq '$value') {
+SELECTED
+% }
+><%$option%></OPTION>
+% }
+</SELECT>
+
+<%ARGS>
+$Name => undef
+@Options => ('less than', 'equal to', 'greater than', 'not equal to')
+@Values => qw(< = > !=)
+$Default => undef
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectKeyword b/rt/webrt/Elements/SelectKeyword
new file mode 100644 (file)
index 0000000..c4bd9e1
--- /dev/null
@@ -0,0 +1,38 @@
+<SELECT NAME=<%$Name%> <%$Size%> <%$Multiple%>>
+<OPTION VALUE="">-</OPTION>
+<OPTION VALUE="NULL">(empty)</OPTION>
+%   foreach my $kid ( keys %{$Descendents} ) {
+<OPTION VALUE="<% $kid %>" 
+%if ($kid == $Default) {
+SELECTED
+%}
+><% $Descendents->{$kid} %></OPTION>
+% }
+</SELECT>
+
+
+<%INIT>
+
+unless (defined $KeywordObj) {
+    $KeywordObj = new RT::Keyword($session{'CurrentUser'});
+    $KeywordObj->Load($Root);
+}
+my $Descendents = $KeywordObj->Descendents();
+
+if ($Multiple) {
+       $Multiple = "MULTIPLE";
+}
+if ($Size) {
+       $Size="SIZE=$Size";
+}      
+
+
+</%INIT>
+<%ARGS>
+$Multiple => undef
+$Size => undef
+$Name => 'Keyword'
+$KeywordObj => undef
+$Root => 0
+$Default => undef
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectKeywordOptions b/rt/webrt/Elements/SelectKeywordOptions
new file mode 100644 (file)
index 0000000..f56dfe5
--- /dev/null
@@ -0,0 +1,18 @@
+<PERL>
+while (my $keyword = $keywords->Next()) {
+    my ($selected);
+    if $keyword->Id == $default
+</PERL>
+<OPTION VALUE="<%$keyword->id%>"><% '-' x $depth %><%$keyword->Name%></OPTION>
+<& SelectKeywordOptions, depth => ($depth+1), root => $keyword->id &>
+%}
+<%INIT>
+
+my $keywords = new RT::Keywords($session{'CurrentUser'});
+$keywords->LimitToParent($root);
+
+</%INIT>
+<%ARGS>
+$root => undef
+$depth => 0
+</%ARGS>
\ No newline at end of file
diff --git a/rt/webrt/Elements/SelectLinkType b/rt/webrt/Elements/SelectLinkType
new file mode 100644 (file)
index 0000000..22cde3d
--- /dev/null
@@ -0,0 +1,16 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectLinkType,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+<SELECT NAME ="<%$Name%>">
+% foreach ('MemberOf', 'DependsOn', 'RefersTo') { # TODO: Merging!
+<OPTION VALUE="<%$_%>"><%$_%></OPTION>
+% }
+</SELECT>
+
+<%ARGS>
+$Name => "LinkType"
+$Default => undef
+</%ARGS>
+
+<%INIT>
+# TODO handle Default
+</%INIT>
diff --git a/rt/webrt/Elements/SelectMatch b/rt/webrt/Elements/SelectMatch
new file mode 100644 (file)
index 0000000..7f3a94f
--- /dev/null
@@ -0,0 +1,31 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectMatch,v 1.1 2002-08-12 06:17:08 ivan Exp $
+<SELECT NAME ="<%$Name%>">
+<OPTION VALUE="LIKE" <%$LikeDefault%>><%$Like%></OPTION>
+<OPTION VALUE="NOT LIKE" <%$NotLikeDefault%>><%$NotLike%></OPTION>
+<OPTION VALUE="=" <%$TrueDefault%>><%$True%></OPTION>
+<OPTION VALUE="!=" <%$FalseDefault%>><%$False%></OPTION>
+</SELECT>
+
+<%ARGS>
+$Name => undef
+$Like => 'contains'
+$NotLike => "doesn't contain"
+$True => 'is'
+$False => "isn't"
+$Default => undef
+</%ARGS>
+<%INIT>
+my ($TrueDefault, $FalseDefault, $LikeDefault, $NotLikeDefault);
+if ($Default && $Default !~ /true/i) {
+       $FalseDefault = "SELECTED";
+}
+elsif ($Default && $Default !~ /false/i) {
+       $TrueDefault = "SELECTED";
+} 
+elsif ($Default && $Default !~ /notlike/i) {
+       $NotLikeDefault = "SELECTED";
+}
+else {
+       $LikeDefault = "SELECTED";
+}
+</%INIT>
diff --git a/rt/webrt/Elements/SelectNewTicketQueue b/rt/webrt/Elements/SelectNewTicketQueue
new file mode 100755 (executable)
index 0000000..9f5cd28
--- /dev/null
@@ -0,0 +1,9 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectNewTicketQueue,v 1.1 2002-08-12 06:17:08 ivan Exp $
+<& SelectQueue, Name => $Name, Verbose => $Verbose, Default => $Default,
+       ShowAllQueues => 0, ShowNullOption => 0 &>
+
+<%ARGS>
+$Name => 'Queue'
+$Verbose => undef
+$Default => undef
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectOwner b/rt/webrt/Elements/SelectOwner
new file mode 100755 (executable)
index 0000000..59ebf36
--- /dev/null
@@ -0,0 +1,22 @@
+<SELECT NAME="<%$Name%>">
+<OPTION VALUE="">-</OPTION>
+<OPTION <% ($RT::Nobody->Id() == $Default) && "SELECTED" %> VALUE="<%$RT::Nobody->Id%>"><%$RT::Nobody->Name%></OPTION>
+%while ( my $User = $Users->Next())  {
+% if ((!defined $QueueObj) || ($User->HasQueueRight(Right => 'OwnTicket', QueueObj => $QueueObj, TicketObj => $TicketObj))){
+<OPTION VALUE="<%$User->Id()%>" <% ($User->Id() == $Default) && "SELECTED" %>><%$User->Name()%></OPTION>
+% }
+%}
+</SELECT>
+
+<%INIT>
+my $Users = RT::Users->new($session{CurrentUser});
+$Users->LimitToPrivileged;
+</%INIT>
+
+<%ARGS>
+$QueueObj => undef
+$Name => undef
+$Default => undef
+$User => undef
+$TicketObj => undef
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectQueue b/rt/webrt/Elements/SelectQueue
new file mode 100755 (executable)
index 0000000..d63b17b
--- /dev/null
@@ -0,0 +1,38 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectQueue,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+% if ($Lite) {
+<INPUT NAME="<%$Name%>" size=25 DEFAULT="<%$d->Name%>">
+% } else {
+<SELECT NAME ="<%$Name%>">
+% if ($ShowNullOption) {
+<OPTION VALUE="">-</OPTION>
+% }
+% while (my $queue=$q->Next) {
+% if ($ShowAllQueues || $queue->CurrentUserHasRight('CreateTicket')) {
+<OPTION VALUE="<%$queue->Id%>" <%($queue->Id == $Default) && 'SELECTED'%>><%$queue->Name%>
+%   if (($Verbose) and ($queue->Description) ){
+(<%$queue->Description%>)
+%  }
+</OPTION>
+% }
+% }
+</SELECT>
+% }
+<%ARGS>
+$ShowNullOption => 1
+$ShowAllQueues => 1
+$Name => undef
+$Verbose => undef
+$Default => undef
+$Lite => 0
+</%ARGS>
+
+<%INIT>
+
+my $q=new RT::Queues($session{'CurrentUser'});
+$q->UnLimit;
+
+my $d = new RT::Queue($session{'CurrentUser'});
+$d->Load($Default);
+
+</%INIT>
diff --git a/rt/webrt/Elements/SelectResultsPerPage b/rt/webrt/Elements/SelectResultsPerPage
new file mode 100644 (file)
index 0000000..0699c68
--- /dev/null
@@ -0,0 +1,22 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectResultsPerPage,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+%# TODO: Better default handling
+
+<SELECT NAME ="<%$Name%>">
+% foreach my $value (@values) {
+<OPTION VALUE="<%$value%>" <% $value == $Default && 'SELECTED' %>>
+<% shift @labels %>
+</OPTION>
+% }
+</SELECT>
+
+<%INIT>
+my @values = qw(0 10 25 50 100);
+my @labels = qw(Unlimited 10 25 50 100);
+</%INIT>
+<%ARGS>
+
+$Name => undef
+$Default => 50
+
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectSortOrder b/rt/webrt/Elements/SelectSortOrder
new file mode 100644 (file)
index 0000000..6dc9006
--- /dev/null
@@ -0,0 +1,18 @@
+<SELECT NAME="<%$Name%>">
+%foreach my $order (@orders) {
+<OPTION VALUE="<%$order%>" <%$order eq $Default && 'SELECTED' %>>
+<% shift @order_names %>
+</OPTION>
+% }
+</SELECT>
+
+<%INIT>
+my @orders = qw (ASC DESC);
+my @order_names = qw (Ascending Descending);
+
+</%INIT>
+
+<%ARGS>
+$Name => 'SortOrder'
+$Default => 'ASC'
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectStatus b/rt/webrt/Elements/SelectStatus
new file mode 100755 (executable)
index 0000000..92df7c6
--- /dev/null
@@ -0,0 +1,17 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectStatus,v 1.1 2002-08-12 06:17:08 ivan Exp $
+
+<SELECT NAME ="<%$Name%>">
+<OPTION VALUE="">-</OPTION>
+%foreach my $status (@status) {
+<OPTION VALUE="<%$status%>" <%($Default eq $status) && 'SELECTED'%>><%$status%></OPTION>
+% }
+</SELECT>
+<%ONCE>
+my $queue = new RT::Queue($session{'CurrentUser'});
+my @status = $queue->StatusArray();
+</%ONCE>
+<%ARGS>
+$Name => undef
+$Default => undef
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectTicketSortBy b/rt/webrt/Elements/SelectTicketSortBy
new file mode 100644 (file)
index 0000000..02021de
--- /dev/null
@@ -0,0 +1,15 @@
+<SELECT NAME="<%$Name%>">
+% foreach my $field (@sortfields) {
+<OPTION VALUE="<%$field%>" <%$field eq $Default && 'SELECTED'%>><%$field%></OPTION>
+% }
+</SELECT>
+
+<%INIT>
+my $tickets = new RT::Tickets($session{'CurrentUser'});
+my @sortfields = $tickets->SortFields();
+
+</%INIT>
+<%ARGS>
+$Name => 'SortTicketsBy'
+$Default => 'id'
+</%ARGS>
diff --git a/rt/webrt/Elements/SelectUsers b/rt/webrt/Elements/SelectUsers
new file mode 100755 (executable)
index 0000000..f517d35
--- /dev/null
@@ -0,0 +1,8 @@
+<select name="UserField">
+<option value="Name">User Id
+<option value="EmailAddress">Email
+<option value="RealName">Name
+<option value="Organization">Organization
+</select>
+<& /Elements/SelectMatch, Name=> 'UserOp' &>
+<input size=8 name="UserString">
diff --git a/rt/webrt/Elements/SelectWatcherType b/rt/webrt/Elements/SelectWatcherType
new file mode 100644 (file)
index 0000000..5a85519
--- /dev/null
@@ -0,0 +1,26 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Elements/Attic/SelectWatcherType,v 1.1 2002-08-12 06:17:08 ivan Exp $
+%# portions Copyright 2000 Tobias Brox <tobix@fsck.com>
+%# Request Tracker is Copyright 1996-2000 Jesse Vincent <jesse@fsck.com>
+
+<SELECT NAME ="<%$Name%>">
+<OPTION VALUE="none">-</OPTION>
+%# Make nice options:
+%for my $option (@types) {
+<OPTION VALUE="<%$option%>" <%$option eq $Default && "SELECTED"%>><%$option%></OPTION>
+%}
+</SELECT>
+
+<%INIT>
+my @types;
+if ($Scope =~ 'queue') {
+   @types = qw(Cc AdminCc);
+}
+else { 
+   @types = qw(Requestor Cc AdminCc);
+}
+</%INIT>
+<%ARGS>
+$Default=>undef
+$Scope => 'ticket'
+$Name => 'WatcherType'
+</%ARGS>
diff --git a/rt/webrt/Elements/ShadedBox b/rt/webrt/Elements/ShadedBox
new file mode 100755 (executable)
index 0000000..334b579
--- /dev/null
@@ -0,0 +1,5 @@
+<div align="left"><span class=label><%$title |n %></span><br><b><%$content |n %></b></div>
+<%ARGS>
+$title => undef
+$content => "&nbsp;"
+</%ARGS>
diff --git a/rt/webrt/Elements/Submit b/rt/webrt/Elements/Submit
new file mode 100755 (executable)
index 0000000..7b75e9e
--- /dev/null
@@ -0,0 +1,44 @@
+<TABLE WIDTH=100% BGCOLOR="<%$color%>" CELLSPACING=0 BORDER=0 CELLPADDING=0 >
+<TR>
+% if ($Reset) {
+<TD>
+<FONT COLOR=#ffd800 >
+<INPUT TYPE=RESET VALUE="<%$ResetLabel%>">
+</FONT>
+</TD>
+%}
+<TD>
+&nbsp;
+</TD>
+<TD ALIGN=RIGHT VALIGN=CENTER>
+
+<FONT COLOR=#ffd800>
+
+% if ($AlternateLabel) {
+<B><%$AlternateCaption%>
+<INPUT TYPE=SUBMIT
+%if ($Name) {
+NAME="<%$Name%>"
+%}
+VALUE='<%$AlternateLabel%>'></B>
+% }
+
+<B><%$Caption%>
+<INPUT TYPE=SUBMIT
+%if ($Name) {
+NAME="<%$Name%>"
+% }
+ VALUE='<%$Label%>'></B></FONT>
+</TD>
+</TR>
+</TABLE>
+<%ARGS>
+$color => "#336699"
+$Caption => undef
+$AlternateCaption => undef
+$AlternateLabel => undef
+$Label => 'Submit'
+$Name => undef
+$Reset => undef
+$ResetLabel => 'Reset'
+</%ARGS>
diff --git a/rt/webrt/Elements/Tabs b/rt/webrt/Elements/Tabs
new file mode 100755 (executable)
index 0000000..6eacf39
--- /dev/null
@@ -0,0 +1,133 @@
+<TABLE WIDTH=100%>
+    <TR>
+      <TD VALIGN=TOP>
+       <TABLE cellspacing=1>
+         <TR>
+% foreach $tab (sort keys %{$toptabs}) {
+           <TD ALIGN=CENTER>
+             <font size=+1>
+               [<A 
+% if ($current_toptab eq $toptabs->{$tab}->{'path'}) {
+class='currenttab'
+% } 
+       HREF="<%$RT::WebPath%>/<% $toptabs->{$tab}->{'path'}%>"><% $toptabs->{$tab}->{'title'}%></A>]
+
+
+             </font>
+           </TD>
+% }
+         </TR>
+       </TABLE>
+<BR>
+% if ($tabs_scalar) {
+<% $tabs_scalar |n%>
+% }
+% if ($tabs) {
+       
+       <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>    
+         <TR>
+% foreach $tab (sort keys %{$tabs}) {
+           <TD ALIGN=CENTER VALIGN=TOP>
+[<A 
+% if ($current_tab eq $tabs->{$tab}->{'path'}) {
+class='currenttab' 
+% } 
+HREF="<%$RT::WebPath%>/<% $tabs->{$tab}->{'path'}%>"><% $tabs->{$tab}->{'title'}%></A>]</TD>
+%}
+         </TR>
+       </TABLE>
+%}
+
+<BR>
+% if ($subtabs_scalar) {
+<% $subtabs_scalar |n%>
+% }
+% if ($subtabs) {
+       <TABLE> 
+         <TR>
+% foreach $tab (sort keys %{$subtabs}) {
+           <TD ALIGN=CENTER>
+             [<A HREF="<%$RT::WebPath%>/<% $subtabs->{$tab}->{'path'}%>"><% $subtabs->{$tab}->{'title'}%></A>]
+           </TD>
+%}
+         </TR>
+       </TABLE>
+%}
+      </TD>
+      <TD VALIGN=TOP ALIGN=RIGHT>
+<TABLE>
+<TR>
+
+% foreach $action (sort keys %{$topactions}) {
+<TD><font size=-1><%$topactions->{"$action"}->{'html'} |n %></font></TD>
+% }
+</TR>
+</TABLE>
+       
+
+       
+% if ($actions) {
+<TABLE><TR>
+%  foreach $action (sort keys %{$actions}) {
+<TD>
+<FONT SIZE=-1>
+% if ($actions->{"$action"}->{'html'}) {
+<%$actions->{"$action"}->{'html'} |n%>
+% } else {
+<A HREF="<%$RT::WebPath%>/<% $actions->{$action}->{'path'}%>"><% $actions->{$action}->{'title'}%></A>
+% }
+</FONT>
+</TD>
+%  }
+</TR></TABLE>
+% }
+       
+% if ($subactions_scalar) {
+<% $subactions_scalar |n%>
+% }
+% if ($subactions) {
+<BR>|&nbsp;
+%  foreach $action (sort keys %{$subactions}) {
+<%$subactions->{"$action"}->{'html'} |n%>&nbsp;|
+%  }
+% }
+      </TD>
+    </TR>
+  </TABLE>
+
+
+<%INIT>
+my ($tab, $action);
+my $toptabs = {    A => { title => 'Home',
+                           path => '',
+                         },
+                    B => { title => 'Search',
+                        path => 'Search/Listing.html'
+                      },
+
+                    D => { title => 'Configuration',
+                           path => 'Admin/'
+                         }
+                 };
+                    
+
+my $topactions = {
+       A => { html => $m->scomp('/Elements/CreateTicket')      
+               },
+       B => { html => $m->scomp('/Elements/GotoTicket') 
+               }
+       };
+</%INIT>
+<%ARGS>
+$current_toptab =>  "none"
+$current_tab => "none"
+$current_subtab => "none"
+$tabs => undef
+$tabs_scalar => undef
+$subtabs => undef
+$actions => undef
+$subactions => undef
+$subtabs_scalar => undef
+$subactions_scalar => undef
+</%ARGS>
+
diff --git a/rt/webrt/Elements/TitleBoxEnd b/rt/webrt/Elements/TitleBoxEnd
new file mode 100755 (executable)
index 0000000..bdd4106
--- /dev/null
@@ -0,0 +1,10 @@
+</TD></TR></TABLE>
+</TD>
+</TR>
+<TR><TD COLSPAN=4><IMG SRC="<%$RT::WebImagesURL%>spacer.gif" height=1 ALT="&nbsp;"width=1></TD>
+</TABLE>
+<%ARGS>
+$title => undef
+$content => undef
+</%ARGS>
+
diff --git a/rt/webrt/Elements/TitleBoxStart b/rt/webrt/Elements/TitleBoxStart
new file mode 100755 (executable)
index 0000000..6d0f1f9
--- /dev/null
@@ -0,0 +1,20 @@
+<TABLE CLASS="<%$class%>" BGCOLOR="<%$color%>" CELLSPACING=0 BORDER=0 CELLPADDING=0 WIDTH="<%$width%>">
+<TR><TD ROWSPAN=2><IMG SRC="<%$RT::WebImagesURL%>spacer.gif" width=1 height=1 ALT=""></TD>
+<TD valign=middle align=left bgcolor="<%$color%>">&nbsp;<font size=-1 color="#ffffff"><b><% $title_href && "<A CLASS=\"$title_class\" HREF=\"$title_href\">"|n%><%$title |n %><%  $title_href && "</A>" |n%></b></font></TD>
+<TD  ALIGN="right" valign=middle bgcolor="<%$color%>"><FONT color="#ffffff" SIZE=-1><%$titleright |n %></FONT>&nbsp;</TD>
+<TD ROWSPAN=2><IMG SRC="<%$RT::WebImagesURL%>spacer.gif" width=1 height=1 ALT=""></TD></TR>
+<TR><TD COLSPAN=2 bgcolor="<%$contentbg%>" valign=top align=left WIDTH=100%>
+<TABLE CELLPADDING=2 WIDTH=100%><TR><TD>
+<%ARGS>
+$width => "100%"
+$class => undef
+
+$title_href => undef
+$title => undef
+$title_class => undef
+
+$titleright_href => undef
+$titleright => undef
+$contentbg => "#dddddd"
+$color => "#336699"
+</%ARGS>
diff --git a/rt/webrt/Elements/ViewUser b/rt/webrt/Elements/ViewUser
new file mode 100644 (file)
index 0000000..92446e6
--- /dev/null
@@ -0,0 +1,29 @@
+
+<& /Elements/TitleBoxStart, 
+       title => "<a class='inverse' href=\"$RT::WebPath/Search/Listing.html?LimitRequestorById=1&IdOfRequestor=".$User->id."\">Tickets from $name</a>",
+       titleright=> "<a class='inverse' href=\"$RT::WebPath/EditUserComments.html?id=".$User->id."\">Comments about $name</a>" &>
+<TABLE WIDTH="100%">
+<tr>
+<td halign=left valign=top>
+%while (my $w=$tickets->Next) {
+<%$w->Id%>: <a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$w->id%>"><%$w->Subject%></a> (<%$w->Status%>)<BR>
+%}
+</td>
+<td align=right valign=top>
+       <% ($User->Comments || "No comment entered about this user") %>
+</tr>
+</table>
+<& /Elements/TitleBoxEnd &>
+
+<%ARGS>
+$User=>undef
+</%ARGS>
+
+<%INIT>
+my $name=$User->RealName || $User->EmailAddress;       
+
+my $tickets = new RT::Tickets($session{'CurrentUser'});
+$tickets->LimitRequestor(VALUE => $User->EmailAddress);
+
+
+</%INIT>
diff --git a/rt/webrt/Elements/dayMenu b/rt/webrt/Elements/dayMenu
new file mode 100755 (executable)
index 0000000..6591b05
--- /dev/null
@@ -0,0 +1,19 @@
+<%doc>-------------------------------------------------------------------
+dayMenu: Display a pulldown menu of days of the month (1 to 31)
+
+Optional arguments:
+$menu_name - Name of menu, defaults to 'day'
+$current - Selected day value (1 to 31)
+-------------------------------------------------------------------</%doc>
+
+<select name="<% $menu_name %>">
+<option value="-1">-
+% foreach my $day (1..31) {
+<option value="<% $day %>" <% $day==$current ? "selected" : "" %>><% sprintf("%02d",$day) %>
+% }
+</select>
+
+<%args>
+$menu_name=>'day'
+$current=>undef
+</%args>
diff --git a/rt/webrt/Elements/monthMenu b/rt/webrt/Elements/monthMenu
new file mode 100755 (executable)
index 0000000..b9a71d3
--- /dev/null
@@ -0,0 +1,37 @@
+<%doc>-------------------------------------------------------------------
+monthMenu: Display a pulldown menu of months
+
+Optional arguments:
+$menu_name - Name of menu, defaults to 'month'
+$current - Selected month value (1 to 12)
+$format - Choice of month labels:
+   'full'    (January, February, ...)
+   'short'   (Jan, Feb, ...)
+   'numeric' (1, 2, ...)
+  Defaults to 'full'. The format only affects appearance; the menu
+  values are always numeric.
+-------------------------------------------------------------------</%doc>
+
+<select name="<% $menu_name %>">
+<option value="-1">-
+% foreach my $month (1..12) {
+<option value="<% $month %>" <% $month==$current ? "selected" : "" %>>
+%   if ($format eq 'full') {
+<% $month_names[$month-1] %>
+%   } elsif ($format eq 'short') {
+<% substr($month_names[$month-1],0,3) %>
+%   } elsif ($format eq 'numeric') {
+<% sprintf("%02d",$month) %>
+%   }
+% }
+</select>
+
+<%init>
+my @month_names = qw(January February March April May June July August September October November December);
+</%init>
+
+<%args>
+$menu_name=>'month'
+$current=>undef
+$format=>'full'
+</%args>
diff --git a/rt/webrt/Elements/yearMenu b/rt/webrt/Elements/yearMenu
new file mode 100755 (executable)
index 0000000..4a0e7a7
--- /dev/null
@@ -0,0 +1,24 @@
+<%doc>-------------------------------------------------------------------
+yearMenu: Display a pulldown menu of years.
+
+Optional arguments:
+$menu_name - Name of menu, defaults to 'year'
+$current - Selected year value
+$min - Minimum year appearing in menu; defaults to current year
+$max - Maximum year appearing in menus; defaults to $min plus 10.
+-------------------------------------------------------------------</%doc>
+
+<select name="<% $menu_name %>">
+<option value="-1">-
+% foreach my $year ($min..$max) {
+<option value="<% $year %>" <% $year==$current ? "selected" : "" %>>
+<% $year %>
+% }
+</select>
+
+<%args>
+$menu_name=>'year'
+$current=>(localtime)[5]+1900
+$min=>(localtime)[5]+1900-1
+$max=>$min+10
+</%args>
diff --git a/rt/webrt/NoAuth/Logout.html b/rt/webrt/NoAuth/Logout.html
new file mode 100755 (executable)
index 0000000..a00ae96
--- /dev/null
@@ -0,0 +1,22 @@
+<HTML>
+<HEAD>
+<TITLE>RT: Logout</TITLE>
+ <META HTTP-EQUIV="Refresh" CONTENT="0;URL=<%$RT::WebPath%>/">
+</HEAD>
+<BODY>
+<p>You have been logged out of RT.
+
+
+<br>
+<br>
+<A HREF="<%$RT::WebPath%>/">You're welcome to login again</a>
+
+
+<%PERL>
+if (defined %session) {
+       %session = undef;
+}
+$m->abort();
+</%PERL>
+
+
diff --git a/rt/webrt/NoAuth/Reminder.html b/rt/webrt/NoAuth/Reminder.html
new file mode 100755 (executable)
index 0000000..a814a91
--- /dev/null
@@ -0,0 +1,3 @@
+<& /Elements/Header, title => 'Password Reminder' &>
+
+Not yet implemented.
diff --git a/rt/webrt/NoAuth/images/rt.jpg b/rt/webrt/NoAuth/images/rt.jpg
new file mode 100644 (file)
index 0000000..a137a93
Binary files /dev/null and b/rt/webrt/NoAuth/images/rt.jpg differ
diff --git a/rt/webrt/NoAuth/images/spacer.gif b/rt/webrt/NoAuth/images/spacer.gif
new file mode 100644 (file)
index 0000000..5bfd67a
Binary files /dev/null and b/rt/webrt/NoAuth/images/spacer.gif differ
diff --git a/rt/webrt/NoAuth/webrt.css b/rt/webrt/NoAuth/webrt.css
new file mode 100755 (executable)
index 0000000..a71d057
--- /dev/null
@@ -0,0 +1,102 @@
+BODY, TD {font-family: Helvetica, Arial, sans-serif}
+TD {border-color: #cccccc }
+
+BLOCKQUOTE.message {
+       font-size: 80%;
+       font-family: "Helvetica", sans-serif;
+}
+
+
+BODY {
+  color: #000;
+  background: #FFFFFF;
+  font-family: "Helvetica", sans-serif;
+
+
+}
+
+TD, TH { /* ns workaround */
+  font-family: "Helvetica", sans-serif;
+}
+
+TR.oddline { 
+    background-color : #eeeeee;
+}
+
+H1, H2, H3 { 
+  margin-top: 0.2em;
+  color: #336699;
+  font-family: "Helvetica", sans-serif;
+
+  clear: both;
+}
+
+
+DIV.endmatter { margin-left: -7% }
+
+
+
+A { font-weight: bold; 
+               color: #000000;
+           /* border: none -- breaks NS 4.x */ }
+
+.currenttab { background-color: #cccccc; }
+
+.inverse { color: #ffffff; }
+
+
+
+A:link IMG, A:visited IMG { border-style: none }
+
+A IMG { color: white } /* The only way to hide the border in NS 4.x */
+
+.hide {
+  display: none;
+  color: white;
+}
+
+SPAN.date { font-size: 0.8em }
+
+SPAN.attribution {
+  font-weight: bold
+}
+
+SPAN.label { font-size: 0.8em; 
+}
+
+BLOCKQUOTE {
+  font-style: italic;
+  /* color: #990; */
+}
+
+ADDRESS { 
+  text-align: right;
+  font-weight: bold;
+  font-style: italic 
+}
+
+BLOCKQUOTE P {                 /* Try to avoid space above the attribution */
+  margin-bottom: 0;
+}
+BLOCKQUOTE ADDRESS {
+  margin: 0;
+}
+
+.motto, .motto A {font: italic 120%/1.3 Georgia, serif; color: #990}
+
+.emphasized {
+  font-weight: bold
+}
+
+/* Why o why does this break Netscape 4.x?
+IMG { 
+  border: none
+}
+*/
+
+P.map-also { font-style: italic; margin-left: 15%; text-align: right }
+
+.oddline { 
+background-color : #eeeeee;
+
+}
diff --git a/rt/webrt/Search/Bulk.html b/rt/webrt/Search/Bulk.html
new file mode 100755 (executable)
index 0000000..ac688d7
--- /dev/null
@@ -0,0 +1,186 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Search/Attic/Bulk.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com>
+<& /Elements/Header, Title => "Bulk ticket update" &>
+<& /Elements/Tabs &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<FORM METHOD=POST>
+<TABLE WIDTH=100% border=0 cellpadding=3 CELLSPACING=0>
+<TR>
+<TH>Update</TH>
+%foreach my $col (@cols) {
+% my $colalias = $col;
+% $colalias =~ s/(Obj\-\>|)(Name|AsString)//;
+
+<TH ><% $colalias %>&nbsp;</TH>
+%}
+</TR>
+
+<%PERL>
+
+my $i;
+
+
+      
+$session{'tickets'}->RedoSearch();
+while (my $Ticket = $session{'tickets'}->Next) {
+ $i++;
+ if ($i % 2) {
+     $bgcolor = "#dddddd";
+ }
+ else {
+     $bgcolor = "#ffffff";
+ }
+      </%PERL>
+<TR bgcolor="<%$bgcolor%>">
+<TD><input type=checkbox name="UpdateTicket<%$Ticket->Id%>" CHECKED></TD>
+%# The ticket view is controlled by config.pm, WebOptions
+%foreach my $col (@cols) {
+<TD>
+% if ($col eq 'id') {
+<A HREF="<% $RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id()%></A>
+% }
+%else {
+<% eval "\$Ticket->$col()" %>&nbsp;
+%}
+</TD>
+%}
+</TR>
+%}
+
+
+
+</TABLE>
+
+<HR>
+
+
+<& /Elements/TitleBoxStart, title => 'Update selected tickets' &>
+<TABLE>
+<TR>
+<TD VALIGN=TOP>
+<UL>
+<li> Make Owner <& /Elements/SelectOwner, Name => "Owner" &>
+(<input type=checkbox name="ForceOwnerChange"> Force change)
+<li> Add Requestor <INPUT Name="AddRequestor" SIZE=20>
+<li> Remove Requestor <INPUT Name="DeleteRequestor" SIZE=20>
+<li> Add Cc <INPUT Name="AddCc" SIZE=20>
+<li> Remove Cc <INPUT Name="DeleteCc" SIZE=20>
+<li> Add AdminCc <INPUT Name="AddAdminCc" SIZE=20>
+<li> Remove AdminCc <INPUT Name="DeleteAdminCc" SIZE=20>
+</UL>
+</TD>
+<TD VALIGN=TOP>
+<UL>
+<li> Make subject <INPUT Name="Subject" SIZE=20>
+<li> Make priority <INPUT Name="Priority" SIZE=4>
+<li> Make queue <& /Elements/SelectQueue, Name => "Queue" &>
+
+<li>Make Status <& /Elements/SelectStatus, Name => "Status" &>
+
+
+
+<li> Make date Starts <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &>
+<li> Make date Started <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &>
+<li> Make date Told <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &>
+<li> Make date Due <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &>
+<li> Make date Resolved <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &>
+
+
+% while ( my $KeywordSelect = $KeywordSelects->Next ) {
+
+<li> Add <% $KeywordSelect->Name %> <& /Elements/SelectKeyword, Name => "AddToKeywordSelect".$KeywordSelect->id, KeywordObj => $KeywordSelect->KeywordObj &>
+<li> Remove <% $KeywordSelect->Name %> <& /Elements/SelectKeyword, Name => "DeleteFromKeywordSelect".$KeywordSelect->id, KeywordObj => $KeywordSelect->KeywordObj &>
+% }
+
+</UL>
+
+
+</TD>
+</TR>
+</table>
+<& /Elements/TitleBoxEnd&>
+<& /Elements/TitleBoxStart, title => 'Add comments or replies to selected tickets' &>
+<table>
+<tr><td align=right>Update Type:</td>
+<td><select name="UpdateType">
+  <option value="private" >Comments (not sent to requestors)</option>
+<option value="response" >Response to requestors</option>
+</select> 
+</td></tr>
+<tr><td align=right>Subject:</td><td> <input name="UpdateSubject" size=60 value=""></td></tr>
+ <tr><td align=right>Attach:</td><td><input name="UpdateAttachment" type="file"></td></tr>
+ <tr><td colspan="2">
+ <& /Elements/MessageBox, Name=>"UpdateContent"&>
+ </td></tr>
+ </table>
+<& /Elements/TitleBoxEnd &>
+
+
+
+
+<& /Elements/Submit &>
+
+
+</FORM>
+<%INIT>
+
+# Iterate through the ARGS hash and remove anything with a null value.
+map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS);
+
+my ($bgcolor, @results);
+my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorsAsString DueAsString );
+
+Abort("No search to operate on.") unless ($session{'tickets'});
+
+
+my $do_comment_reply=0;
+# Prepare for ticket updates
+$ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
+chomp ($ARGS{'UpdateContent'}) ;
+
+if ($ARGS{'UpdateContent'} &&
+    $ARGS{'UpdateContent'} ne '' &&
+    $ARGS{'UpdateContent'} ne  "-- \n" .
+    $session{'CurrentUser'}->UserObj->Signature) {
+            $do_comment_reply=1;
+}
+
+my $KeywordSelects = new RT::KeywordSelects $session{'CurrentUser'};
+foreach ( $session{'tickets'}->RestrictionValues('Queue') ) {
+    $KeywordSelects->LimitToQueue($_);
+}
+
+$KeywordSelects->IncludeGlobals;
+
+
+#Iterate through each ticket we've been handed
+
+while (my $Ticket = $session{'tickets'}->Next) {
+    $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n");
+    next unless ($ARGS{"UpdateTicket".$Ticket->Id});
+    $RT::Logger->debug ("Matched\n");
+    #Update the basics.
+    my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS);
+    my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS);
+    my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS);    
+    my @selectresults = ProcessTicketObjectKeywords(TicketObj => $Ticket, ARGSRef => \%ARGS);
+    
+   
+     my @updateresults; 
+     if ($do_comment_reply) {
+     ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \
+@updateresults); 
+    } 
+    my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults);
+    @tempresults = map { "Ticket ".$Ticket->Id. ": ".$_ } @tempresults;
+
+    
+    #Update the keyword selects
+    #Update the watchers
+    $RT::Logger->debug(join("\n",@tempresults));
+    @results = (@results, @tempresults);
+}
+
+</%INIT>
diff --git a/rt/webrt/Search/Listing.html b/rt/webrt/Search/Listing.html
new file mode 100755 (executable)
index 0000000..da927fe
--- /dev/null
@@ -0,0 +1,134 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Search/Attic/Listing.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com>
+<& /Elements/Header, Title => "Search", Refresh => $session{'tickets_refresh_interval'} &>
+<& /Elements/Tabs, current_toptab => 'Search/Listing.html' &>
+
+
+% unless ($ARGS{'Action'} eq 'Refine') {
+<TABLE WIDTH=100% border=0 cellpadding=3 CELLSPACING=1>
+<TR>
+%foreach my $col (@{Config(\%ARGS, 'QueueListingCols')}) {
+<TH>
+
+<%PERL>        
+my ($order);
+ my $attr = $col->{'TicketAttribute'};
+ $attr =~ s/Obj->(Name|AsString|AgeAsString)//g;
+  if ($session{'tickets_sort_order'} =~ /^asc$/i) {
+   $order = 'DESC';
+ } else {
+   $order = 'ASC';
+ }
+</%PERL>
+
+% if (grep (/^$attr$/i, $session{'tickets'}->SortFields)) {
+<A 
+% if ($attr eq $session{'tickets_sort_by'}) {
+class="currenttab"
+% }
+HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|u%>&TicketsSortBy=<%$attr%>&TicketsSortOrder=<%$order%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>">
+<%$col->{Header}%>
+</A>
+% } else {
+<% $col->{Header} %>
+% }
+</TH>
+%}
+</TR>
+
+<%PERL>
+
+my $i;
+      
+$session{'tickets'}->RedoSearch();
+while (my $Ticket = $session{'tickets'}->Next) {
+ $i++;
+ if ($i % 2) {
+     $bgcolor = "#dddddd";
+ }
+ else {
+     $bgcolor = "#ffffff";
+ }
+      </%PERL>
+<TR bgcolor="<%$bgcolor%>" >
+%# The ticket view is controlled by config.pm, WebOptions
+%foreach my $col (@{Config(\%ARGS,'QueueListingCols')}) {
+<TD><& TicketCell , Ticket=>$Ticket,  Column=>$col &></TD>
+%}
+</TR>
+%}
+
+
+
+</TABLE>
+
+<div align=center>
+<font size=2>
+<a href="Listing.html?GotoPage=1">First page</a>
+&nbsp;&nbsp;
+<a href="Listing.html?GotoPage=Prev">&lt;Previous page</a>
+&nbsp;&nbsp;
+<a href="Listing.html?GotoPage=Next">Next page&gt;</a>
+%#&nbsp;&nbsp;<form method=get action="Listing.html">Goto page <input name=GotoPage size=2></form>
+</font>
+</div>
+% if ($session{'tickets'}->Count()) { 
+<div align=right>
+<a href="Bulk.html">Update all these tickets at once</a>
+</div>
+% }
+<HR>
+
+% } #endif {$ARGS{'Action'} eq 'Refine')
+<TABLE WIDTH="100%">
+<TR>
+<TD VALIGN="TOP">
+<& /Elements/TitleBoxStart, title => 'Search Criteria'&>
+
+<A HREF="<% $RT::WebPath%>/Search/Listing.html?ClearRestrictions=1">New search</a><br>
+<A HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|u%>&TicketsSortBy=<%$session{'tickets_sort_by'}%>&TicketsSortOrder=<%$session{'tickets_sort_order'}%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>">Bookmarkable URL for this search</a>
+<BR>
+<BR>
+% my %restrictions=$session{'tickets'}->DescribeRestrictions();
+% my %seen_restrictions=();
+% foreach $row (keys %restrictions){
+%  my $tmp=$restrictions{"$row"};
+%  if( ! defined( $seen_restrictions{"$tmp"} ) ){
+<%$restrictions{"$row"}%> <A HREF="<% $RT::WebPath%>/Search/Listing.html?DeleteRestriction=<%$row%>">[delete]</a><br>
+%   } else {
+%     $session{'tickets'}->DeleteRestriction($row);
+<b>Deleted Duplicate Restriction <i><%$tmp%></i></b><br>
+% }
+% $seen_restrictions{"$tmp"}++;
+%}
+<& /Elements/TitleBoxEnd&>
+</TD>
+<TD>
+
+<& PickRestriction &>
+
+</TD>
+</TR>
+</TABLE>
+
+<%INIT>
+
+my $bgcolor;
+require RT::Interface::Web;
+
+$session{'i'}++;
+if ($session{'tickets'}) {
+    if ( ($ARGS{'ClearRestrictions'}) ||
+        ($ARGS{'NewSearch'}) ) {
+       $session{'tickets'}->ClearRestrictions;
+    }
+    
+    if ($ARGS{'DeleteRestriction'}) {
+       $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'});
+    }
+}
+&ProcessSearchQuery(ARGS=>\%ARGS);
+
+my $row;
+
+</%INIT>
diff --git a/rt/webrt/Search/PickRestriction b/rt/webrt/Search/PickRestriction
new file mode 100755 (executable)
index 0000000..82f576c
--- /dev/null
@@ -0,0 +1,112 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Search/Attic/PickRestriction,v 1.1 2002-08-12 06:17:09 ivan Exp $
+<FORM ACTION="Listing.html" METHOD="GET">
+<INPUT TYPE=HIDDEN NAME="Bookmark" VALUE="<% $session{'tickets'}->FreezeLimits()|u %>">
+<& /Elements/TitleBoxStart, title => 'Refine Search'&>
+<INPUT TYPE=HIDDEN NAME="CompileRestriction" VALUE=1>
+
+<ul>
+<li>Owner is  <& /Elements/SelectBoolean, Name => "OwnerOp", 
+                                         TrueVal=> '=', 
+                                         FalseVal => '!=' 
+&> 
+<& /Elements/SelectOwner, Name => "ValueOfOwner" &>
+
+<li>
+Requestor email address 
+<& /Elements/SelectMatch, Name => "RequestorOp" &>
+<INPUT Name="ValueOfRequestor" SIZE=20>
+
+<li>
+Subject <& /Elements/SelectMatch, Name => "SubjectOp" &> 
+<INPUT Name="ValueOfSubject" SIZE=20>
+
+<li>Queue  <& /Elements/SelectBoolean,  Name => "QueueOp" , 
+                                       True => "is", 
+                                       False => "isn't", 
+                                       TrueVal=> '=', 
+                                       FalseVal => '!=' &>
+<& /Elements/SelectQueue, Name => "ValueOfQueue" &>
+
+
+<li>Priority  <& /Elements/SelectEqualityOperator,  Name => "PriorityOp" &>
+
+<INPUT Name="ValueOfPriority" SIZE=5>
+
+
+<li>
+<& /Elements/SelectDateType, Name => 'DateType' &>
+<& /Elements/SelectDateRelation, Name=>"DateOp" &>
+<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &>
+
+<li>Ticket content 
+<& /Elements/SelectBoolean, Name => "ContentOp", 
+                           True => "matches", 
+                           False => "does not match", 
+                           TrueVal => 'LIKE', 
+                           FalseVal => 'NOT LIKE' 
+&> 
+<Input Name="ValueOfContent" Size=20>
+
+<li>Status 
+<& /Elements/SelectBoolean, Name => "StatusOp", 
+                           True => "is", 
+                           False => "isn't", 
+                           TrueVal=> '=', 
+                           FalseVal => '!=' 
+&>  
+<& /Elements/SelectStatus, Name => "ValueOfStatus" &>
+
+% while ( my $KeywordSelect = $KeywordSelects->Next ) {
+
+<li><% $KeywordSelect->Name %> 
+       <& /Elements/SelectBoolean, Name => "KeywordSelectOp". $KeywordSelect->id, 
+                                   True => "is", False => "isn't", 
+                                   TrueVal=> '=', FalseVal => '!=' &>
+
+<& /Elements/SelectKeyword, Name => "KeywordSelect".$KeywordSelect->id,
+                           KeywordObj => $KeywordSelect->KeywordObj
+                           &>
+% }
+
+</UL>
+
+<& /Elements/TitleBoxEnd &>
+
+<& /Elements/TitleBoxStart, title => 'Ordering and sorting'&>
+
+<UL>
+
+<li>Results per page <& /Elements/SelectResultsPerPage, Name => "RowsPerPage", 
+                                                       Default => $session{'tickets_rows_per_page'} || '50'
+&>
+
+<li>Sort results by <& /Elements/SelectTicketSortBy, Name => "TicketsSortBy", 
+                                                    Default => $session{'tickets_sort_by'} 
+&> 
+<& /Elements/SelectSortOrder, Name => 'TicketsSortOrder', Default => $session{'tickets_sort_order'} &>
+
+<li> <& /Elements/Refresh, Name => 'RefreshSearchInterval' , Default => $session{'tickets_refresh_interval'} &>
+
+
+</UL>
+
+
+</DIV>
+
+
+
+<& /Elements/TitleBoxEnd &>
+
+<& /Elements/Submit, Label => 'Show Results', AlternateLabel => 'Refine', Name => 'Action'&>
+
+</FORM>
+
+
+ <%INIT>
+ my $KeywordSelects = new RT::KeywordSelects $session{'CurrentUser'};
+ foreach ( $session{'tickets'}->RestrictionValues('Queue') ) {
+        $KeywordSelects->LimitToQueue($_);
+ }
+
+ $KeywordSelects->IncludeGlobals;
+</%INIT>
diff --git a/rt/webrt/Search/RestrictSearch.html b/rt/webrt/Search/RestrictSearch.html
new file mode 100755 (executable)
index 0000000..977308e
--- /dev/null
@@ -0,0 +1,3 @@
+<& /Elements/Header, Title=>"Compile Restrictions" &>
+<& /Elements/Tabs &>
+<& PickRestriction &>
diff --git a/rt/webrt/Search/TicketCell b/rt/webrt/Search/TicketCell
new file mode 100644 (file)
index 0000000..aaded88
--- /dev/null
@@ -0,0 +1,28 @@
+%#$Header: /home/cvs/cvsroot/freeside/rt/webrt/Search/Attic/TicketCell,v 1.1 2002-08-12 06:17:09 ivan Exp $
+<% $link |n%><%$Column->{Constant} || eval("\$Ticket->$Column->{TicketAttribute}") || "-" %><% $endlink|n %>
+<%INIT>
+
+my $link = "";
+my $endlink = "";
+if ($Column->{TicketLink}) {
+       $link = "<A HREF=\"";
+       if ($Column->{TicketLink} == 1 ) {
+               $link .= "../Ticket/Display.html?";
+       }
+       else {
+               $link .= $Column->{TicketLink};
+       }
+
+       $link .= "id=".$Ticket->Id . $Column->{ExtraLinks};
+
+       if ($session{NewWindowOption}) {
+               $link .= "TARGET=\"TicketDisplay".$session{AlwaysNewWindowOption} && (time() . rand(1024))."\" ";
+       }
+       $link .= "\">";
+       $endlink = "</a>";
+}
+</%INIT>
+<%ARGS>
+$Ticket => undef
+$Column => undef
+</%ARGS>
diff --git a/rt/webrt/SelfService/Attachment/dhandler b/rt/webrt/SelfService/Attachment/dhandler
new file mode 100644 (file)
index 0000000..0d646cc
--- /dev/null
@@ -0,0 +1,27 @@
+<%perl>
+     my ($ticket, $trans,$attach, $filename);
+     my $arg = $m->dhandler_arg;                # get rest of path
+     if ($arg =~ '^(\d+)/(\d+)') {
+        $trans = $1;
+        $attach = $2;
+     }
+    else {
+        Abort("Corrupted attachment URL.");
+        }
+     my $AttachmentObj = new RT::Attachment($session{'CurrentUser'});
+     $AttachmentObj->Load($attach) || Abort("Attachment '$attach' could not be loaded");
+
+
+     unless ($AttachmentObj->id) {
+        Abort("Bad attachment id. Couldn't find attachment '$attach'\n");
+    }
+     unless ($AttachmentObj->TransactionId() == $trans ) {
+        Abort("Bad transaction number for attachment. $trans should be".$AttachmentObj->TransactionId() ."\n");
+
+     }
+     my $content_type = $AttachmentObj->ContentType || 'text/plain';
+     SetContentType($content_type);
+     $m->out($AttachmentObj->Content); 
+     $m->abort; 
+</%perl>
+
diff --git a/rt/webrt/SelfService/Closed.html b/rt/webrt/SelfService/Closed.html
new file mode 100644 (file)
index 0000000..a359360
--- /dev/null
@@ -0,0 +1,4 @@
+<& /SelfService/Elements/Header, title => 'RT Self Service / Closed Tickets' &>
+
+<& /SelfService/Elements/MyRequests, status => ['resolved'], friendly_status =>
+'closed' &>
diff --git a/rt/webrt/SelfService/Create.html b/rt/webrt/SelfService/Create.html
new file mode 100755 (executable)
index 0000000..60110cb
--- /dev/null
@@ -0,0 +1,63 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/SelfService/Attic/Create.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com>
+
+<& Elements/Header, Title => "Create a request" &>
+
+
+<FORM ACTION="Display.html" METHOD="POST" ENCTYPE="multipart/form-data">
+<INPUT TYPE=HIDDEN Name="id" VALUE="new">
+<& /Elements/TitleBoxStart, contentbg => "#cccccc", title => "Create a new ticket" &>
+
+<TABLE>
+<TR>
+<TD>
+Queue:
+</TD>
+<TD>
+<& /Elements/SelectNewTicketQueue, Verbose => 'True' &>
+</TD>
+</TR>
+<TR>
+<TD>
+Requestors: 
+</TD>
+<TD>
+<INPUT Name="Requestors" Value="<%$session{CurrentUser}->EmailAddress%>" SIZE=20>
+</TD>
+</TR>
+<TR>
+<TD>
+Cc:
+</TD>
+<TD>
+ <INPUT NAME="Cc" SIZE=20>
+</TD>
+</TR>
+<TR>
+<TD>
+Subject:
+</TD>
+<TD>
+<INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="">
+</TD>
+</TR>
+<TR>
+<TD>
+Attach file:
+</TD>
+<TD>
+<INPUT Name="Attach" type=file>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2>
+Describe the issue below:<br>
+<& /Elements/MessageBox &>
+</TD>
+</TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit, Label => "Create ticket"&>
+
+
+</FORM>
diff --git a/rt/webrt/SelfService/Display.html b/rt/webrt/SelfService/Display.html
new file mode 100755 (executable)
index 0000000..2d44f14
--- /dev/null
@@ -0,0 +1,190 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/SelfService/Attic/Display.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com>
+
+<& /SelfService/Elements/Header, Title => 'Display ticket #'.$Ticket->id &>
+
+
+<& /Elements/ListActions, actions => \@results &>
+
+<TABLE>
+    <TR>
+       <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       Ticket Id
+       </TD>
+      <TD>
+       <%$Ticket->Id%>
+       </TD>
+      </TR>
+    <TR>       
+      <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       Requestors
+       </TD>
+      <TD>
+       <%$Ticket->RequestorsAsString%>
+      </TD>
+      </TR>
+    <TR>       
+      <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       Cc
+       </TD>
+      <TD>
+       <%$Ticket->CcAsString%>
+      </TD>
+    </TR>
+
+  <TR> 
+      <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       Status
+       </TD>
+      <TD>
+       <%$Ticket->Status%>
+      </TD>
+    </TR>
+
+    <TR>       
+      <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       Queue
+       </TD>
+      <TD>
+       <%$Ticket->QueueObj->Name%> (<%$Ticket->QueueObj->Description%>)
+      </TD>
+    </TR>
+    <TR>       
+      <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       Priority
+      </TD>
+      <TD>
+       <%$Ticket->Priority %>
+      </TD>
+    </TR>
+%  if ($Ticket->TimeWorked) {
+   <TR>        
+      <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       Worked
+      </TD>
+      <TD>
+       <%$Ticket->TimeWorked %> minutes
+      </TD>
+    </TR>
+% }
+    
+% my $selects = $Ticket->QueueObj->KeywordSelects;
+% while (my $select = $selects->Next) {
+    <TR>
+      <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT>
+       <%$select->Name%>
+      </TD>
+      <TD>
+% my $object_keywords = $Ticket->KeywordsObj($select->id);     
+% while (my $keyword = $object_keywords->Next) {
+       <%$keyword->KeywordObj->RelativePath($select->KeywordObj)%>
+% }
+%}
+       </TD>
+      </TR>
+
+
+
+
+       </TABLE>
+<TABLE BORDER=0 CELLSPACING=0>
+% my ($i);
+%while (my $Transaction = $Transactions->Next) {
+% $i++;
+%      if ($Transactions->IsLast) {
+       <a name="lasttrans"></a>
+%      }
+       <& /Ticket/Elements/ShowTransaction, Transaction => $Transaction, 
+                                            RowNum => $i,
+                                            Ticket => $Ticket &>
+
+%}
+</TABLE>
+
+
+<%INIT>
+
+my ($field, @results);
+
+# {{{ Load the ticket
+#If we get handed two ids, mason will make them an array. bleck.
+# We want teh first one. Just because there's no other sensible way
+# to deal
+my @id = (ref $id eq 'ARRAY') ? @{$id} : ($id);                
+
+
+my $Ticket = new RT::Ticket($session{'CurrentUser'});
+if ($id[0] eq 'new') {
+    # {{{ Create a new ticket
+    
+    my $Queue = new RT::Queue($session{'CurrentUser'});        
+    unless ($Queue->Load($ARGS{'Queue'})) {
+       $m->comp('Error.html', Why => 'Queue not found');
+       $m->abort;
+    }
+    
+    unless ($Queue->CurrentUserHasRight('CreateTicket')) {
+       $m->comp('Error.html', Why => 'You have no permission to create tickets in that queue.');
+       $m->abort; 
+    }
+    
+    my @Requestors = split(/,/,$ARGS{'Requestors'});
+    my @Cc = split(/,/,$ARGS{'Cc'});
+    
+
+    my $MIMEObj = MakeMIMEEntity ( Subject => $ARGS{'Subject'},
+                                  From => $ARGS{'From'},
+                                  Cc => $ARGS{'Cc'},
+                                  Body => $ARGS{'Content'},
+                                  AttachmentFieldName => 'Attach');
+
+    #TODO in Create_Details.html: priorities and due-date      
+    my ($id, $Trans, $ErrMsg)= $Ticket->Create(Queue=>$ARGS{Queue},
+                                              Requestor=> \@Requestors,
+                                              Cc => \@Cc,
+                                              Subject=>$ARGS{Subject},
+                                              MIMEObj => $MIMEObj        
+                                             );         
+    unless ($id && $Trans) {
+       $m->comp('Error.html', Why => $ErrMsg);
+       $m->abort(); 
+    }
+
+    push(@results, $ErrMsg);
+
+    # }}}
+}
+else {
+    unless ($Ticket->Load($id[0])) {
+       $m->comp('Error.html', Why =>"Couldn't load ticket '$id'");
+       $m->abort();
+    }
+}
+# }}}
+
+unless ($session{'CurrentUser'}->HasQueueRight ( TicketObj => $Ticket,
+                                                Right => 'ShowTicket')) {
+    $m->comp('Error.html', Why => "No permission to display that ticket");
+    $m->abort();
+}
+
+my ($code, $msg);
+
+#Update the status
+if ((defined $ARGS{'Status'}) and 
+    ($ARGS{'Status'} ne $Ticket->Status)) {
+    ($code, $msg) = $Ticket->SetStatus($ARGS{'Status'});
+    push @results, "$msg";
+}
+
+ProcessUpdateMessage(ARGSRef=>\%ARGS, Actions=>\@results, TicketObj=>$Ticket);
+
+my $Transactions = $Ticket->Transactions;
+
+</%INIT>
+
+
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/SelfService/Elements/GotoTicket b/rt/webrt/SelfService/Elements/GotoTicket
new file mode 100755 (executable)
index 0000000..0c0c8b6
--- /dev/null
@@ -0,0 +1 @@
+<FORM ACTION="<%$RT::WebPath%>/SelfService/Display.html"><input type=submit value="Goto ticket">&nbsp;<input size=4 name=id></FORM>
diff --git a/rt/webrt/SelfService/Elements/Header b/rt/webrt/SelfService/Elements/Header
new file mode 100755 (executable)
index 0000000..ecf58f4
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+     "http://www.w3.org/TR/REC-html40/loose.dtd"> 
+<HTML>
+<HEAD>
+<TITLE><%$Title%></TITLE>
+% if ($Code) {
+<META NAME="HTTP-EQUIV" VALUE="<%$Code%> <%$Why%>">
+% }
+
+<link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/webrt.css" type="text/css">
+</HEAD>
+<BODY BGCOLOR="<%$BgColor%>">
+<TABLE BORDER=0 WIDTH=100% CELLSPACING=0 BGCOLOR="#993333">
+<TR VALIGN=TOP>
+<TD WIDTH=32>
+        <IMG SRC="<%$RT::LogoURL%>" alt="RT">
+</TD>
+<TD VALIGN=CENTER ALIGN=LEFT>
+<font size=+2 color=#ffffff>
+<B>
+<%$Title%>
+</B>
+</font>
+</TD>
+<TD ALIGN=RIGHT>
+<font color="#ffffff">
+% if ($session{'CurrentUser'} ) {
+Signed in as <b><%$session{'CurrentUser'}->Name%></b>.<BR>
+% if ($session{'CurrentUser'}->HasSystemRight('ModifySelf')) {
+[<A class='inverse' HREF="<%$RT::WebPath%>/SelfService/Prefs.html" >Preferences</A>]
+% }
+% unless ($RT::WebExternalAuth) { 
+ [<A class='inverse' HREF="<%$RT::WebPath%>/NoAuth/Logout.html">Logout</a>]
+% }
+% } else {
+Not logged in.
+% }
+</font>
+</TD>
+</TR>
+</TABLE>
+
+<BR>
+<& /SelfService/Elements/Tabs &>
+
+<%ARGS>
+$Title => ''
+$Code => undef
+$Why => undef
+$BgColor => '#ffffff'
+</%ARGS>
+<%INIT>
+$Title = "RT/$RT::rtname: ".$Title;
+</%INIT>
+
diff --git a/rt/webrt/SelfService/Elements/MyRequests b/rt/webrt/SelfService/Elements/MyRequests
new file mode 100644 (file)
index 0000000..ce268d5
--- /dev/null
@@ -0,0 +1,41 @@
+<& /Elements/TitleBoxStart, title => "Your $friendly_status requests" &>
+<TABLE BORDER=0 cellspacing=1 cellpadding=1 BGCOLOR="#eeeeee" WIDTH=100%>
+<TR>
+<TH>Subject</TH>
+<TH>Status</TH>
+<TH>Owner</TH>
+<TH>&nbsp;</TH>
+</TR>
+<TR>
+% while (my $Ticket = $MyTickets->Next) {
+<TR>
+<TD>
+<%$Ticket->Id%>: <%$Ticket->Subject%>
+</TD>
+<TD>
+<%$Ticket->Status%>
+</TD><TD>
+<%$Ticket->OwnerObj->Name%>
+</TD><TD ALIGN=RIGHT>
+[<A HREF="<% $RT::WebPath %>/SelfService/Display.html?id=<%$Ticket->Id%>">Details</A>]
+</TD>
+</TR>
+% }
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+
+<%INIT>
+my $MyTickets;
+$MyTickets = new RT::Tickets ($session{'CurrentUser'});
+$MyTickets->LimitRequestor(VALUE => $session{'CurrentUser'}->EmailAddress);
+
+foreach my $status (@status) {
+
+        $MyTickets->LimitStatus(VALUE => $status);
+}
+</%INIT>
+<%ARGS>
+$friendly_status => 'open'
+@status => ('open', 'new', 'stalled')
+</%ARGS>
diff --git a/rt/webrt/SelfService/Elements/Tabs b/rt/webrt/SelfService/Elements/Tabs
new file mode 100644 (file)
index 0000000..d689d8a
--- /dev/null
@@ -0,0 +1,49 @@
+<TABLE WIDTH=100%>
+<TR>
+% foreach $tab (sort keys %{$tabs}) {
+<TD ALIGN=CENTER>
+[<A HREF="<%$RT::WebPath%>/<% $tabs->{"$tab"}->{'path'}%>"><% $tabs->{"$tab"}->{'title'}%></A>]
+</TD>
+%}
+
+% if ($actions) {
+
+<TD ALIGN=RIGHT>
+<TABLE><TR>
+%  foreach my $action (sort keys %{$actions}) {
+<TD>
+<FONT SIZE=-1>
+% if ($actions->{"$action"}->{'html'}) {
+<%$actions->{"$action"}->{'html'} |n%>
+% } else {
+<A HREF="<%$RT::WebPath%>/<% $actions->{$action}->{'path'}%>"><% $actions->{$action}->{'title'}%></A>
+% }
+</FONT>
+</TD>
+%  }
+</TR>
+</TABLE>
+</TD>
+%}
+</TR>
+</TABLE>
+<hr>
+<%INIT>
+my ($tab);
+my $tabs = { A  => { title => 'Open requests',
+                        path => 'SelfService/',
+                      },
+             B => { title => 'Closed requests',
+                         path => 'SelfService/Closed.html',
+                       },
+             C => { title => 'New request',
+                    path => 'SelfService/Create.html'
+                    }
+           };
+my $actions = {
+       B => { html => $m->scomp('GotoTicket') 
+               }
+       };
+</%INIT>
+
+
diff --git a/rt/webrt/SelfService/Error.html b/rt/webrt/SelfService/Error.html
new file mode 100755 (executable)
index 0000000..19b79e6
--- /dev/null
@@ -0,0 +1,22 @@
+<& /SelfService/Elements/Header, Title => 'Error' &>
+<& /Elements/TitleBoxStart, title => $Title &>
+<%$Why%>
+<br>
+<font size=-1>
+<%$Details%>
+</font>
+<& /Elements/TitleBoxEnd &>
+</body>
+</HTML>
+
+
+<%args>
+$Code => undef
+$Details => undef
+$Title => "RT Error"
+$Why => "the calling component did not specify why"
+</%args>
+
+<%INIT>
+$RT::Logger->error("WebRT: $Why ($Details)");
+</%INIT>
diff --git a/rt/webrt/SelfService/Prefs.html b/rt/webrt/SelfService/Prefs.html
new file mode 100755 (executable)
index 0000000..9c614e9
--- /dev/null
@@ -0,0 +1,51 @@
+<& /SelfService/Elements/Header, title => 'Preferences' &>
+
+<& /Elements/ListActions, actions => \@results &>
+<form method=post>
+
+% unless ($RT::WebExternalAuth) {
+<& /Elements/TitleBoxStart, title => 'Change password'  &>
+New password: <input type=password name="NewPass1" size=16>
+Confirm: <input type=password name="NewPass2" size=16>
+<& /Elements/TitleBoxEnd &>
+<BR>
+% }
+<& /Elements/TitleBoxStart, title => 'Signature'  &>
+
+<TEXTAREA COLS=72 ROWS=4 WRAP=HARD NAME="Signature"><% $session{'CurrentUser'}->UserObj->Signature %></TEXTAREA>
+<br>
+<BR>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+         </form>
+
+
+<%INIT>
+my @results;
+
+if ($NewPass1) {
+    if ($NewPass1 ne $NewPass2) {
+       push (@results, "Passwords did not match.");
+    }  
+    else {
+       my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetPassword($NewPass1);
+       push (@results, "Password: ".$msg);
+    }  
+}
+if ($Signature) {
+    $Signature =~ s/(\r\n|\r)/\n/g;
+    if ($Signature ne $session{'CurrentUser'}->UserObj->Signature) {
+       my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetSignature($Signature);
+       push (@results, "Signature: ".$msg);
+    }
+}
+#A hack to make sure that session gets rewritten.
+
+$session{'i'}++;
+</%INIT>
+
+<%ARGS>
+$Signature => undef
+$NewPass1 => undef
+$NewPass2 => undef
+</%ARGS>
diff --git a/rt/webrt/SelfService/Update.html b/rt/webrt/SelfService/Update.html
new file mode 100755 (executable)
index 0000000..17f1618
--- /dev/null
@@ -0,0 +1,40 @@
+<& /SelfService/Elements/Header, Title => 'Update ticket #'.$Ticket->id &>
+
+
+<FORM ACTION="Display.html" METHOD=POST ENCTYPE="multipart/form-data">
+
+Status:
+<& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &> 
+<input type=hidden name="UpdateType" value="response">
+
+Subject: <input name="UpdateSubject" size=60 value="Re: <% $Ticket->Subject %>"> <br>
+Attach: <input name="UpdateAttachment" type=file><br>
+<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &>
+               <INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>"><br>
+
+
+<& /Elements/Submit &>
+  </FORM>
+
+
+
+<%INIT>
+
+my $Ticket = LoadTicket($id);
+
+my $title = "Update ticket #" . $Ticket->id;
+
+$DefaultStatus = $Ticket->Status() unless ($DefaultStatus);
+
+
+Abort("No permission to view update ticket") 
+       unless ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
+                     $Ticket->CurrentUserHasRight('ModifyTicket') ); 
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Action => undef
+$DefaultStatus => undef
+</%ARGS>
diff --git a/rt/webrt/SelfService/index.html b/rt/webrt/SelfService/index.html
new file mode 100644 (file)
index 0000000..a377d8c
--- /dev/null
@@ -0,0 +1,3 @@
+<& /SelfService/Elements/Header, title => 'Self Service' &>
+
+<& /SelfService/Elements/MyRequests &>
diff --git a/rt/webrt/Ticket/Attachment/dhandler b/rt/webrt/Ticket/Attachment/dhandler
new file mode 100644 (file)
index 0000000..0d646cc
--- /dev/null
@@ -0,0 +1,27 @@
+<%perl>
+     my ($ticket, $trans,$attach, $filename);
+     my $arg = $m->dhandler_arg;                # get rest of path
+     if ($arg =~ '^(\d+)/(\d+)') {
+        $trans = $1;
+        $attach = $2;
+     }
+    else {
+        Abort("Corrupted attachment URL.");
+        }
+     my $AttachmentObj = new RT::Attachment($session{'CurrentUser'});
+     $AttachmentObj->Load($attach) || Abort("Attachment '$attach' could not be loaded");
+
+
+     unless ($AttachmentObj->id) {
+        Abort("Bad attachment id. Couldn't find attachment '$attach'\n");
+    }
+     unless ($AttachmentObj->TransactionId() == $trans ) {
+        Abort("Bad transaction number for attachment. $trans should be".$AttachmentObj->TransactionId() ."\n");
+
+     }
+     my $content_type = $AttachmentObj->ContentType || 'text/plain';
+     SetContentType($content_type);
+     $m->out($AttachmentObj->Content); 
+     $m->abort; 
+</%perl>
+
diff --git a/rt/webrt/Ticket/Create.html b/rt/webrt/Ticket/Create.html
new file mode 100755 (executable)
index 0000000..2c61de0
--- /dev/null
@@ -0,0 +1,199 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Ticket/Attic/Create.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2000 Jesse Vincent <jesse@fsck.com> 
+
+<& /Elements/Header, Title => "Create a new ticket" &>
+<& /Elements/Tabs, current_toptab => "Ticket/Create.html" &>
+<FORM ACTION="Display.html" METHOD="POST" ENCTYPE="multipart/form-data">
+<INPUT TYPE=HIDDEN Name="id" VALUE="new">
+<A NAME="top">
+       
+       
+[<a class="currenttab">Show basics</a>] [<A HREF="#detail">Show details</a>]
+<BR>
+<& /Elements/TitleBoxStart, contentbg => "#cccccc", title => "Create a new ticket"&>
+<div align=right><input type=submit value="Create"></div>
+<TABLE border=0 cellpadding=0 cellspacing=0>
+<TR><TD>Queue</TD>
+<TD><% $QueueObj->Name %>
+<INPUT TYPE=HIDDEN NAME=Queue Value="<%$QueueObj->Name%>">
+</TD>
+<TD>Status:
+</TD>
+<TD>
+<& /Elements/SelectStatus, Name => "Status", Default=> 'new' &>
+</TD>
+<TD>
+Owner: 
+</TD>
+<TD>
+<& /Elements/SelectOwner, Name => "ValueOfOwner", QueueObj => $QueueObj &>
+</TD>
+</TR>
+<TR>
+<TD>
+Requestors: 
+</TD>
+<TD COLSPAN=5>
+<INPUT Name="Requestors" Value="<%$session{CurrentUser}->EmailAddress%>" SIZE=40>
+</TD>
+</TR>
+<TR>
+<TD>
+Cc:
+</TD>
+<TD COLSPAN=5>
+ <INPUT NAME="Cc" SIZE=40>
+</TD>
+</TR>
+<TR>
+<TD>
+Admin Cc:
+</TD>
+<TD COLSPAN=5>
+ <INPUT NAME="AdminCc" SIZE=40>
+</TD>
+</TR>
+<TR>
+<TD>
+Subject:
+</TD>
+<TD COLSPAN=5>
+<INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="">
+</TD>
+</TR>
+<TR>
+<TD>
+Attach file:
+</TD>
+<TD COLSPAN=5>
+<INPUT TYPE=FILE NAME="Attach">
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=6>
+Describe the issue below:<br>
+<& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &>
+
+<BR>
+</TD>
+</TR>
+<TR>
+<TD ALIGN=RIGHT COLSPAN=2>
+</TD>
+</TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit, Label => "Create"&>
+
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+
+<A NAME="detail">
+       [<A HREF="#top">Show basics</a>] [<a class="currenttab">Show details</a>]
+<BR>
+<TABLE WIDTH="100%" BORDER=0>
+<TR>
+<TD WIDTH="50%" VALIGN=TOP>
+
+         <& /Elements/TitleBoxStart, title => 'The Basics', 
+               title_class=> 'inverse',  
+               color => "#993333" &>
+<TABLE BORDER=0>
+<TR><TD ALIGN=RIGHT>Priority:</TD><TD><input size=3 name="InitialPriority" value="<%$QueueObj->InitialPriority%>"></TD></TR>
+<TR><TD ALIGN=RIGHT>Final Priority:</TD><TD><input size=3 name="FinalPriority" value="<%$QueueObj->FinalPriority%>"></TD></TR>
+<TR><TD ALIGN=RIGHT>Time Worked:</TD><TD><input size=3 name="TimeWorked"></TD></TR>
+<TR><TD ALIGN=RIGHT>Time Left:</TD><TD><input size=3 name="TimeLeft"></TD></TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<BR>
+<BR>
+
+
+ <& /Elements/TitleBoxStart, 
+               title_class=> 'inverse',  
+               title => "Keyword Selections", color => "#993300"
+  &>
+<TABLE BORDER=0>
+% while ( my $KeywordSelect = $KeywordSelects->Next ) {
+%   my $Descendents = $KeywordSelect->KeywordObj->Descendents;
+     <TR><TD ALIGN=RIGHT>
+       <% $KeywordSelect->Name %></TD><TD>
+         <INPUT TYPE="hidden" NAME="KeywordSelectMagic<% $KeywordSelect->id %>" VALUE="1">
+           <SELECT NAME="KeywordSelect-<% $KeywordSelect->id %>"
+             <% $KeywordSelect->Single ? "" : " MULTIPLE " %> SIZE=5>
+%#
+%#  All of this cruft is so we have a 'no keyword' selector for single
+%#  keywords that's only selected when there's no value.
+%
+% foreach my $kid ( keys %{$Descendents} ) {
+             <OPTION VALUE="<% $kid %>"><% $Descendents->{$kid} %></OPTION>
+%   }
+%   if ( $KeywordSelect->Single) {
+<OPTION VALUE="" SELECTED>(empty)</OPTION>
+% }
+           </SELECT>
+      </TD></TR>
+% }
+  
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+</TD>
+
+<TD VALIGN="TOP">
+<& /Elements/TitleBoxStart, title => "Dates",
+               title_class=> 'inverse',  
+                color => "#663366" &>
+
+<TABLE BORDER=0>
+<TR><TD ALIGN=RIGHT>Starts:</TD><TD><input size=10 name="Starts"></TD></TR>
+<TR><TD ALIGN=RIGHT>Due:</TD><TD><input size=10 name="Due"></TD></TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<BR>
+<& /Elements/TitleBoxStart, title => 'Relationships', 
+       title_class=> 'inverse',  
+       titleright => '', color=> "#336633" &>
+
+<i>(Enter ticket ids or URLs, seperated with spaces)</i>
+<TABLE BORDER=0>
+<TR><TD ALIGN=RIGHT>Depends on</TD><TD><input size=10 name="new-DependsOn"></TD></TR>
+<TR><TD ALIGN=RIGHT>Depended on by</TD><TD><input size=10 name="DependsOn-new"></TD></TR>
+<TR><TD ALIGN=RIGHT>Parents</TD><TD><input size=10 name="new-MemberOf"></TD></TR>
+<TR><TD ALIGN=RIGHT>Children</TD><TD><input size=10 name="MemberOf-new"></TD></TR>
+<TR><TD ALIGN=RIGHT>Refers to</TD><TD><input size=10 name="new-RefersTo"></TD></TR>
+<TR><TD ALIGN=RIGHT>Referred to by</TD><TD><input size=10 name="RefersTo-new"></TD></TR>
+
+
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<BR>
+
+</TD>
+</TR>
+</TABLE>
+<& /Elements/Submit, Label => "Create"&>
+</FORM>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
+
+<%INIT>
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+$QueueObj->Load($Queue) || Abort("Queue could not be loaded.");
+my $KeywordSelects = $QueueObj->KeywordSelects;
+
+</%INIT>
+
+<%ARGS>
+$DependsOn => undef
+$DependedOnBy => undef
+$MemberOf => undef
+$QuoteTransaction => undef
+$Queue => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Display.html b/rt/webrt/Ticket/Display.html
new file mode 100755 (executable)
index 0000000..cb0dc25
--- /dev/null
@@ -0,0 +1,152 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Ticket/Attic/Display.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2000 Jesse Vincent <jesse@fsck.com>
+
+<& /Elements/Header, Title => "Ticket #".$Ticket->Id ." ".$Ticket->Subject &>
+<& /Ticket/Elements/Tabs, Ticket => $Ticket, current_tab => 'Ticket/Display.html?id='.$Ticket->id &>
+
+<& /Elements/ListActions, actions => \@Actions &>
+
+<& /Ticket/Elements/ShowSummary,  Ticket => $Ticket &>
+
+
+<BR>
+<& /Ticket/Elements/ShowHistory , 
+      Ticket => $Ticket, 
+      Collapsed => $ARGS{'Collapsed'}, 
+      ShowHeaders => $ARGS{'ShowHeaders'} &> 
+
+  
+<%ARGS>
+$id => undef
+$Create => undef
+$ShowHeaders => undef
+$Collapsed => undef
+</%ARGS>
+
+<%INIT>
+
+  
+  my ($linkid, $message, $tid, $Ticket, @Actions);  
+
+$Ticket = new RT::Ticket($session{'CurrentUser'});
+
+unless ($id) {
+    Abort('No ticket specified');
+}
+
+if ($ARGS{'id'} eq 'new') {
+    # {{{ Create a new ticket
+    
+    my $Queue = new RT::Queue($session{'CurrentUser'});        
+    unless ($Queue->Load($ARGS{'Queue'})) {
+       Abort('Queue not found');
+    }
+    
+    unless ($Queue->CurrentUserHasRight('CreateTicket')) {
+       Abort('You have no permission to create tickets in that queue.');
+    }
+   
+    my $due = new RT::Date($session{'CurrentUser'});
+    $due->Set(Format => 'unknown', Value => $ARGS{'Due'});
+    my $starts = new RT::Date($session{'CurrentUser'});
+    $starts->Set(Format => 'unknown', Value => $ARGS{'Starts'});
+    
+    my @Requestors = split(/,/,$ARGS{'Requestors'});
+    my @Cc = split(/,/,$ARGS{'Cc'});
+    my @AdminCc = split(/,/,$ARGS{'AdminCc'});
+    
+    my $MIMEObj = MakeMIMEEntity( Subject => $ARGS{'Subject'},
+                                 From => $ARGS{'From'},
+                                 Cc => $ARGS{'Cc'},
+                                 Body => $ARGS{'Content'},
+                                 AttachmentFieldName => 'Attach');
+                                 
+    my %create_args = ( 
+                      Queue=>$ARGS{Queue},
+                      Owner=>$ARGS{ValueOfOwner},
+                      InitialPriority=> $ARGS{InitialPriority},
+                      FinalPriority=> $ARGS{FinalPriority},
+                      TimeLeft => $ARGS{TimeLeft},
+                      TimeWorked => $ARGS{TimeWorked},
+                      Requestor=> \@Requestors,
+                      Cc => \@Cc,
+                      AdminCc => \@AdminCc,
+                      Subject=>$ARGS{Subject},
+                      Status=>$ARGS{Status},
+                      Due => $due->ISO,
+                      Starts => $starts->ISO,
+                      MIMEObj => $MIMEObj        
+                     );         
+
+    
+    # we need to get any KeywordSelect-<integer> fields into %create_args..
+    grep { $_ =~ /^KeywordSelect-/ && {$create_args{$_} = $ARGS{$_}}} %ARGS;
+
+    my ($id, $Trans, $ErrMsg)= $Ticket->Create(%create_args);
+    unless ($id && $Trans) {
+       Abort($ErrMsg);
+    }
+    my @linktypes = qw( DependsOn MemberOf RefersTo );
+    
+    foreach my $linktype (@linktypes) {
+      foreach my $luri (split (/ /,$ARGS{"new-$linktype"})) {
+       $luri =~ s/\s*$//; # Strip trailing whitespace
+       my ($val, $msg) = $Ticket->AddLink( Target => $luri,
+                                           Type => $linktype);
+       push @Actions, $msg;
+      }
+      
+      foreach my $luri (split (/ /,$ARGS{"$linktype-new"})) {
+       my ($val, $msg) = $Ticket->AddLink( Base => $luri,
+                                           Type => $linktype);
+       
+       push @Actions, $msg;
+      }
+    }
+    # don't try to change queue to the current queue
+    delete $ARGS{'Queue'};
+
+    push(@Actions, $ErrMsg);
+    unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
+      Abort("No permission to view newly created ticket #".$Ticket->id.".");
+    }
+    # }}}
+}
+
+else { 
+    $Ticket = LoadTicket($ARGS{'id'});
+    unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
+       Abort("No permission to view ticket");
+    }
+
+
+if (defined $ARGS{'Action'}) {
+  if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
+    my $action = $1;
+    my ($res, $msg)=$Ticket->$action();
+    push(@Actions, $msg);
+  }
+}
+    $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
+
+    if ($ARGS{'UpdateContent'} &&
+        $ARGS{'UpdateContent'} ne '' &&
+        $ARGS{'UpdateContent'} ne  "-- \n" .
+                                $session{'CurrentUser'}->UserObj->Signature
+       ) {
+           ProcessUpdateMessage(ARGSRef=>\%ARGS, 
+                                Actions=>\@Actions, 
+                                TicketObj=>$Ticket);
+       }
+#Process status updates
+my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket);
+
+push (@Actions, @BasicActions);
+}
+</%INIT>
+
+
+
+
diff --git a/rt/webrt/Ticket/Elements/AddWatchers b/rt/webrt/Ticket/Elements/AddWatchers
new file mode 100755 (executable)
index 0000000..053cff1
--- /dev/null
@@ -0,0 +1,54 @@
+<BR>
+<%$msg%><br>
+
+Add new watchers:<br>
+
+<table>
+% if ($Users) {
+<tr><td>
+Type
+</td><td>
+Username
+</td></tr>
+% while (my $u = $Users->Next ) {
+<tr><td><&/Elements/SelectWatcherType, Name => "WatcherTypeUser".$u->Id &></td><td><%$u->Name%> (<%$u->RealName%>)</td></tr>
+% }
+% }
+
+<tr><td>
+Type
+</td><td>
+Email
+</td></tr>
+<tr><td>
+<&/Elements/SelectWatcherType, Name => "WatcherTypeEmail1" &>
+</td><td>
+<input name="WatcherAddressEmail1" size=15>
+</td></tr>
+<tr><td>
+<&/Elements/SelectWatcherType, Name => "WatcherTypeEmail2" &> 
+</td><td>
+<input name="WatcherAddressEmail2" size=15>
+</td></tr>
+<tr><td>
+<&/Elements/SelectWatcherType, Name => "WatcherTypeEmail3" &>
+</td><td>
+<input name="WatcherAddressEmail3" size=15>
+</td></tr>
+</table>
+
+<%INIT>
+my ($msg, $Users);
+if ($UserString) {
+    $Users = new RT::Users($session{'CurrentUser'});
+    $Users->Limit(FIELD => $UserField,
+                 VALUE => $UserString,
+                 OPERATOR => $UserOp);
+     }
+</%INIT>
+
+<%ARGS>
+$UserField => 'Name'
+$UserOp => '='
+$UserString => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/EditBasics b/rt/webrt/Ticket/Elements/EditBasics
new file mode 100755 (executable)
index 0000000..1214287
--- /dev/null
@@ -0,0 +1,62 @@
+<TABLE>
+<TR>
+<TD COLSPAN=6>
+        Subject<BR>
+        <input name=Subject value="<%$TicketObj->Subject|h%>"  SIZE=50>
+</TD>
+</TR>
+<TR>
+<TD>
+<& /Elements/ShadedBox, 
+        title => 'Status',
+        content => $SelectStatus
+&>
+</TD>
+<TD>
+
+<& /Elements/ShadedBox,
+       title => 'Time Worked',
+       content => "<input name=TimeWorked value=\"".$TicketObj->TimeWorked."\" SIZE=5>" 
+&>
+
+</TD>
+<TD>
+<& /Elements/ShadedBox,
+       title => 'Time Left',
+       content => "<input name=TimeLeft value=\"".$TicketObj->TimeLeft."\" SIZE=5>" 
+&>
+</TD>
+<TD>
+<& /Elements/ShadedBox,
+       title => 'Priority',
+       content => "<input name=Priority value=\"".$TicketObj->Priority."\" SIZE=3>"
+&>
+
+</TD>
+<TD>
+<& /Elements/ShadedBox,
+       title => 'Final Priority',
+       content => "<input name=FinalPriority value=\"".$TicketObj->FinalPriority."\" SIZE=3>"
+&>
+
+
+</TD>
+<TD>
+<& /Elements/ShadedBox,
+        title => 'Queue',
+        content => "$SelectQueue"
+ &>
+</TD>
+</TR>
+</TABLE>
+
+<%INIT>
+#It's hard to do this inline, so we'll preload the html of the selectstatus in here.
+my $SelectStatus = $m->scomp("/Elements/SelectStatus", Name => 'Status', Default=> $TicketObj->Status);
+my $SelectQueue = $m->scomp("/Elements/SelectQueue", Name => 'Queue', Default =>$TicketObj->QueueObj->Id);
+
+</%INIT>
+<%ARGS>
+
+$TicketObj => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/EditDates b/rt/webrt/Ticket/Elements/EditDates
new file mode 100755 (executable)
index 0000000..f04130b
--- /dev/null
@@ -0,0 +1,46 @@
+<TABLE>
+<TR>
+<TD>
+Starts: 
+</TD>
+<TD>
+<& /Elements/SelectDate, menu_prefix => 'Starts', current => 0 &> 
+        (<% $TicketObj->StartsObj->AsString %>)
+</TD>
+</TR>
+<TR>
+<TD>
+Started:
+</TD>
+<TD>
+<& /Elements/SelectDate, menu_prefix => 'Started', current => 0 &> (<%$TicketObj->StartedObj->AsString %>)
+
+
+
+</TD>
+</TR>
+
+<TR>
+<TD>
+Last Contact:
+</TD>
+<TD>
+<& /Elements/SelectDate, menu_prefix => 'Told', current => 0 &> (<% $TicketObj->ToldObj->AsString %>)
+
+</TD>
+</TR>
+<TR>
+<TD>
+Due:
+</TD>
+<TD>
+
+<& /Elements/SelectDate, menu_prefix => 'Due', current => 0 &> (<% $TicketObj->DueObj->AsString %>)
+</TD>
+</TR>
+
+</TABLE>
+<%ARGS>
+$TicketObj => undef
+</%ARGS>
+
diff --git a/rt/webrt/Ticket/Elements/EditKeywordSelects b/rt/webrt/Ticket/Elements/EditKeywordSelects
new file mode 100644 (file)
index 0000000..34ade9f
--- /dev/null
@@ -0,0 +1,45 @@
+
+<TABLE>
+    <TR>
+% while ( my $KeywordSelect = $KeywordSelects->Next ) {
+% my $CurrentKeywords = $TicketObj->KeywordsObj($KeywordSelect->id);   
+%   my $Descendents = $KeywordSelect->KeywordObj->Descendents;
+      <TD VALIGN=TOP>
+       <% $KeywordSelect->Name %>
+       <BR>
+         <INPUT TYPE="hidden" NAME="KeywordSelectMagic<% $KeywordSelect->id %>" VALUE="1">
+           <SELECT NAME="KeywordSelect<% $KeywordSelect->id %>"
+             <% $KeywordSelect->Single ? "" : " MULTIPLE " %> SIZE=5>
+%#
+%#
+%#  All of this cruft is so we have a 'no keyword' selector for single
+%#  keywords that's only selected when there's no value.
+%
+% my $selected_keywords = 0;
+% foreach my $kid ( keys %{$Descendents} ) {
+% my $selected = 0;
+% if ($CurrentKeywords->HasEntry($kid)) { $selected_keywords++; $selected=1;}
+             <OPTION VALUE="<% $kid %>" 
+               <% $selected && 'SELECTED'%>>
+               <% $Descendents->{$kid} %>
+             </OPTION>
+%   }
+%   if ( $KeywordSelect->Single) {
+<OPTION VALUE="" <% ($selected_keywords == 0) && 'SELECTED' %> >(empty)</OPTION>
+% }
+           </SELECT>
+      </TD>
+% }
+    </TR>
+  
+</TABLE>
+
+
+<%INIT>
+my $KeywordSelects = $TicketObj->QueueObj->KeywordSelects;
+</%INIT>
+
+<%ARGS>
+$TicketObj => undef
+</%ARGS>
+
diff --git a/rt/webrt/Ticket/Elements/EditLinks b/rt/webrt/Ticket/Elements/EditLinks
new file mode 100755 (executable)
index 0000000..b0296fc
--- /dev/null
@@ -0,0 +1,109 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Ticket/Elements/Attic/EditLinks,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2000 Jesse Vincent <jesse@fsck.com>
+
+
+<TABLE>
+<TR>
+<TD VALIGN=TOP>
+<h3>New Relationships</h3>
+<i>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.</i><br>
+<TABLE>
+<TR><TD>Merge into:</TD><TD><input name="<%$Ticket->Id%>-MergeInto"> <i>(only one ticket)</i></TD></TR>
+<TR><TD>Depends on:</TD><TD><input name="<%$Ticket->Id%>-DependsOn"></TD></TR>
+<TR><TD>Depended on by:</TD><TD><input name="DependsOn-<%$Ticket->Id%>"></TD></TR>
+<TR><TD>Parents:</TD><TD><input name="<%$Ticket->Id%>-MemberOf"></TD></TR>
+<TR><TD>Children:</TD><TD> <input name="MemberOf-<%$Ticket->Id%>"></TD></TR>
+<TR><TD>Refers to:</TD><TD><input name="<%$Ticket->Id%>-RefersTo"></TD></TR>
+<TR><TD>Referred to by:</TD><TD> <input name="RefersTo-<%$Ticket->Id%>"></TD></TR>
+</TABLE>
+</TD>
+<TD VALIGN=TOP WIDTH=50%>
+<h3>Current Relationships</h3>
+<i>(Check boxes to delete)</i><br>
+
+Depends on:<BR>
+<UL>
+% while (my $link = $Ticket->DependsOn->Next) {
+% my $member = $link->TargetObj;
+<LI>
+<INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>">
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%>
+[<%$member->Status%>]
+
+% }
+</UL>
+
+Depended on by:<BR>
+<UL>
+% while (my $link = $Ticket->DependedOnBy->Next) {
+% my $member = $link->BaseObj;
+<LI>
+<INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-">
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> 
+[<%$member->Status%>]
+% }
+</UL>
+
+Parents:<BR>
+<UL>
+% while (my $link = $Ticket->MemberOf->Next) {
+% my $member = $link->TargetObj;
+<LI>
+<INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>">
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%>
+[<%$member->Status%>]
+
+% }
+</UL>
+
+Children:<BR>
+<UL>
+% while (my $link = $Ticket->Members->Next) {
+<LI>
+<INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-">
+% my $member = $link->BaseObj;
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> 
+[<%$member->Status%>]
+% }
+</UL>
+
+
+Refers to:<BR>
+<UL>
+% while (my $link = $Ticket->RefersTo->Next) {
+<LI>
+<INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>">
+% if ($link->TargetIsLocal) {
+% my $member = $link->TargetObj;
+
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br>
+% } else {
+<A HREF="<%$link->TargetAsHREF%>"><%$link->Target%></A>
+% }
+%}
+</UL>
+
+Referred to by:<BR>
+<UL>
+% while (my $link = $Ticket->ReferredToBy->Next) {
+<LI>
+<INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-">
+% if ($link->BaseIsLocal) {
+% my $member = $link->BaseObj;
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br>
+% } else {
+<A HREF="<%$link->BaseAsHREF%>"><%$link->Base%></A>
+%}
+% }
+</UL>
+
+                           
+</TD>
+</TR>
+</TABLE>
+
+
+      
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/EditPeople b/rt/webrt/Ticket/Elements/EditPeople
new file mode 100755 (executable)
index 0000000..4f69af9
--- /dev/null
@@ -0,0 +1,37 @@
+
+<TABLE>
+<TR>
+<TD VALIGN=TOP>
+
+<h3>New watchers</h3>
+Find people whose<BR>
+<& /Elements/SelectUsers &>
+<input type=submit name="OnlySearchForPeople" value="Go!">
+
+<& AddWatchers, Ticket => $Ticket, UserString => $UserString,
+        UserOp => $UserOp, UserField => $UserField &> 
+</TD><TD VALIGN=TOP>
+<h3>Owner</h3>
+Owner: <& /Elements/SelectOwner, Name => 'Owner', QueueObj => $Ticket->QueueObj, TicketObj => $Ticket, Default => $Ticket->OwnerObj->Id &>
+<h3>Current watchers</h3>
+(Check box to delete)<br>
+
+Requestors:
+<& EditWatchers, TicketObj => $Ticket, Type => 'requestors' &>
+
+Cc:
+<& EditWatchers, TicketObj => $Ticket, Type => 'cc' &>
+
+Administrative Cc:
+<& EditWatchers, TicketObj => $Ticket, Type => 'admincc' &>
+
+</TD>
+</TR>
+</TABLE>
+
+<%ARGS>
+$UserField => undef
+$UserOp => undef
+$UserString => undef
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/EditWatchers b/rt/webrt/Ticket/Elements/EditWatchers
new file mode 100755 (executable)
index 0000000..00185e8
--- /dev/null
@@ -0,0 +1,46 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Ticket/Elements/Attic/EditWatchers,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2000 Jesse Vincent <jesse@fsck.com>
+
+<ul>
+
+%# Print out a placeholder if there are none.
+%if ($watchers->Count == 0 ) {
+<li><i>none</i>
+% }
+
+
+%while (my $watcher=$watchers->Next) {
+<li>
+<INPUT TYPE=CHECKBOX NAME="DelWatcher<%$watcher->id%>" UNCHECKED>
+%#If there's a principal backing this user, lets give a link to their
+%# account
+%if ($watcher->IsUser) { 
+<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->OwnerObj->id%>">
+<%$watcher->OwnerObj->RealName%></a>:
+%} else {
+Email address:
+%}
+<i><%$watcher->Email%></i>
+%}
+</ul>
+<%INIT>
+my ($watchers, $watcher, $set);
+if ($Type  =~ /^request/i) {
+       $watchers = $TicketObj->Requestors;
+       }
+elsif ($Type =~ /^admin/i) {
+        $watchers = $TicketObj->AdminCc;
+        }
+elsif ($Type =~ /^cc/i) {
+        $watchers = $TicketObj->Cc;
+      }
+else { $watchers = $TicketObj->Watchers;
+       }
+</%INIT>
+<%ARGS>
+$TicketObj => undef
+$Type => undef
+</%ARGS>
+
+
+
diff --git a/rt/webrt/Ticket/Elements/ShowBasics b/rt/webrt/Ticket/Elements/ShowBasics
new file mode 100755 (executable)
index 0000000..97c84c9
--- /dev/null
@@ -0,0 +1,29 @@
+ <TABLE WIDTH="100%">
+      <TR>
+       <TD VALIGN=TOP WIDTH="20%">
+         <& /Elements/ShadedBox, title => 'Id' , content => $Ticket->Id &>
+       </TD>
+       <TD VALIGN=TOP WIDTH="20%"> <& /Elements/ShadedBox, title => 'Status' , content => $Ticket->Status &>
+       </TD>
+       <TD VALIGN=TOP WIDTH="20%">
+        <& /Elements/ShadedBox, title => 'Worked' , content => $TimeWorked ." min" &>
+       </TD>
+       <TD VALIGN=TOP WIDTH="20%">
+         <& /Elements/ShadedBox, title => 'Priority', content=> $Ticket->Priority."/".$Ticket->FinalPriority &>
+       </TD>
+       <TD VALIGN=TOP WIDTH="20%">
+         <& /Elements/ShadedBox, title => 'Queue', content=> $Ticket->QueueObj->Name &>
+       </TD>   
+
+
+      </TR>
+    </TABLE>
+<%INIT>
+my $TimeWorked = $Ticket->TimeWorked;
+if ($Ticket->TimeLeft > 0 ) {
+        $TimeWorked = $Ticket->TimeWorked."/".$Ticket->TimeLeft;
+}
+</%INIT>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowDates b/rt/webrt/Ticket/Elements/ShowDates
new file mode 100755 (executable)
index 0000000..e17e313
--- /dev/null
@@ -0,0 +1,54 @@
+<TABLE>
+<TR>
+<TD>
+Created:
+</TD>
+<TD>
+<% $Ticket->CreatedObj->AsString %>
+</TD>
+</TR>
+<TR>
+<TD>
+Starts: 
+</TD>
+<TD>
+<% $Ticket->StartsObj->AsString %> <BR>
+</TD>
+</TR>
+<TR>
+<TD>
+Started:
+</TD>
+<TD>
+<% $Ticket->StartedObj->AsString %>
+</TD>
+</TR>
+
+<TR>
+<TD>
+<a href="Display.html?id=<%$Ticket->id%>&Action=SetTold">Last Contact</a>:
+</TD>
+<TD>
+<% $Ticket->ToldObj->AsString %>
+</TD>
+</TR>
+<TR>
+<TD>
+Due:
+</TD>
+<TD><% $Ticket->DueObj->AsString  %>
+</TD>
+</TR>
+<TR>
+<TD>
+Updated:
+</TD>
+<TD>
+<A HREF="#lasttrans">
+<% $Ticket->LastUpdated ? ($Ticket->LastUpdatedAsString ." by ".$Ticket->LastUpdatedByObj->Name) : "Never" | h %></a>
+</TD>
+</TR>
+</TABLE>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowDependencies b/rt/webrt/Ticket/Elements/ShowDependencies
new file mode 100755 (executable)
index 0000000..488652f
--- /dev/null
@@ -0,0 +1,18 @@
+Depends on:<BR>
+% while (my $Link = $Ticket->DependsOn->Next) {
+% my $member = $Link->TargetObj;
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%>
+[<%$member->Status%>]
+ <br>
+% }
+Depended on by:<BR>
+% while (my $Link = $Ticket->DependedOnBy->Next) {
+% my $member = $Link->TargetObj;
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> 
+[<%$member->Status%>]
+ <br>
+% }
+
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowHistory b/rt/webrt/Ticket/Elements/ShowHistory
new file mode 100755 (executable)
index 0000000..155eaaa
--- /dev/null
@@ -0,0 +1,43 @@
+<TABLE BORDER=0 width="100%">
+<TR>
+<TD ALIGN=LEFT>
+% if ($ShowTitle) {
+<font size=+3>History</font>
+% }
+&nbsp;</TD>
+<TD align=right><font size=-1>Display mode: 
+%  if ($ShowHeaders == $Ticket->Id) {
+[<A HREF="<%$URIFile%>?id=<%$Ticket->id%>">Brief headers</a>]
+<b>[Full headers]</b>
+% } else {
+<b>[Brief headers]</b>
+[<A HREF="<%$URIFile%>?ShowHeaders=<%$Ticket->Id%>&id=<%$Ticket->id%>">Full headers</a>]
+%  }
+</font>
+</TD>
+</TR>
+</TABLE>
+
+<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0>
+% while (my $Transaction = $Transactions->Next) {
+% $i++;
+%      if ($Transactions->IsLast) {
+       <a name="lasttrans"></a>
+%      }
+           <& ShowTransaction, Ticket => $Ticket, Transaction => $Transaction, ShowHeaders => $ShowHeaders, Collapsed => $Collapsed, RowNum => $i  &>
+% }
+</TABLE>
+<%INIT>
+
+my $Transactions = $Ticket->Transactions;
+my $i;
+
+
+</%INIT>
+<%ARGS>
+$URIFile => 'Display.html'
+$Ticket => undef
+$ShowHeaders => undef
+$Collapsed => undef
+$ShowTitle => 1
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowKeywordSelects b/rt/webrt/Ticket/Elements/ShowKeywordSelects
new file mode 100644 (file)
index 0000000..4f8a178
--- /dev/null
@@ -0,0 +1,26 @@
+<TABLE>
+% while ( my $KeywordSelect = $KeywordSelects->Next ) {
+    <TR>
+      <TD VALIGN=TOP>
+       <% $KeywordSelect->Name %><BR>
+      </TD>
+      <TD VALIGN=TOP>
+       <UL>
+% my $Keywords = $Ticket->KeywordsObj($KeywordSelect->Id);
+% while (my $Keyword = $Keywords->Next) { 
+       <li><% $Keyword->KeywordObj->RelativePath($KeywordSelect->KeywordObj) |n %></li>
+
+%   }
+       </ul>
+      </TD>
+    </TR>
+% }
+</TABLE>
+
+<%INIT>
+my $KeywordSelects = $Ticket->QueueObj->KeywordSelects;
+</%INIT>
+
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowLinks b/rt/webrt/Ticket/Elements/ShowLinks
new file mode 100755 (executable)
index 0000000..4979595
--- /dev/null
@@ -0,0 +1,61 @@
+Depends on:<BR>
+<UL>
+% while (my $Link = $Ticket->DependsOn->Next) {
+% my $member = $Link->TargetObj;
+<LI><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%>
+[<%$member->Status%>]
+
+% }
+</UL>
+
+Depended on by:<BR>
+<UL>
+% while (my $Link = $Ticket->DependedOnBy->Next) {
+% my $member = $Link->BaseObj;
+<LI><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> 
+[<%$member->Status%>]
+% }
+</UL>
+Parents:<BR>   
+<UL>
+% while (my $Link = $Ticket->MemberOf->Next) {
+% my $member = $Link->TargetObj;
+<LI><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%>
+[<%$member->Status%>]
+
+% }
+</UL>
+
+Children:<BR>
+<& /Ticket/Elements/ShowMembers, Ticket => $Ticket &>
+<BR>
+Refers to:<BR>
+<UL>
+% while (my $Link = $Ticket->RefersTo->Next) {
+<LI>
+% if ($Link->TargetIsLocal) {
+% my $member = $Link->TargetObj;
+
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br>
+% } else {
+<A HREF="<%$Link->TargetAsHREF%>"><%$Link->Target%></A>
+% }
+%}
+</UL>
+
+Referred to by:<BR>
+<UL>
+% while (my $Link = $Ticket->ReferredToBy->Next) {
+<LI>
+% if ($Link->BaseIsLocal) {
+% my $member = $Link->BaseObj;
+<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br>
+% } else {
+<A HREF="<%$Link->BaseAsHREF%>"><%$Link->Base%></A>
+%}
+% }
+</UL>
+
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowMemberOf b/rt/webrt/Ticket/Elements/ShowMemberOf
new file mode 100755 (executable)
index 0000000..df5dc92
--- /dev/null
@@ -0,0 +1,12 @@
+<UL>
+% my $memberof = $Ticket->MemberOf;
+% while (my $member_of = $memberof->Next) {
+<LI><a href="/Ticket/Display.html?id=<%$member_of->Id%>"><%$member_of->Id%></a>: <%$member_of->Subject%> [<%$member_of->Status%>]
+% }
+</UL>
+
+<%INIT>
+</%INIT>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowMembers b/rt/webrt/Ticket/Elements/ShowMembers
new file mode 100755 (executable)
index 0000000..0a6f123
--- /dev/null
@@ -0,0 +1,22 @@
+% if ($members->Count) {
+<UL>
+% while (my $link = $members->Next) {
+% my $member= $link->BaseObj;
+<LI><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: <%$member->Subject%> [<%$member->Status%>]<br>
+% if ($depth < 8) {
+<&/Ticket/Elements/ShowMembers, Ticket => $member, depth => ($depth+1) &> 
+% }
+% }
+</UL>
+% }
+
+<%INIT>
+
+my $members = $Ticket->Members;
+
+</%INIT>
+
+<%ARGS>
+$Ticket => undef
+$depth => 1
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowPeople b/rt/webrt/Ticket/Elements/ShowPeople
new file mode 100755 (executable)
index 0000000..ff35f48
--- /dev/null
@@ -0,0 +1,12 @@
+Owner<BR>
+&nbsp;<B><%$Ticket->OwnerObj->Name%></B><BR>
+Requestors<BR>
+&nbsp;<B><%$Ticket->RequestorsAsString%></B><BR>
+Cc<BR>
+&nbsp;<B><%$Ticket->CcAsString%></B><BR>
+AdminCc<BR>
+&nbsp;<B><%$Ticket->AdminCcAsString%></B>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
+
diff --git a/rt/webrt/Ticket/Elements/ShowReferences b/rt/webrt/Ticket/Elements/ShowReferences
new file mode 100755 (executable)
index 0000000..37e2fde
--- /dev/null
@@ -0,0 +1,27 @@
+<UL>
+% while (my $Link = $Ticket->RefersTo->Next) {
+<LI>
+% if ($Link->TargetIsLocal) {
+% my $member = $Link->TargetObj;
+
+<a href="/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br>
+% } else {
+<A HREF="<%$Link->TargetAsHREF%>"><%$Link->Target%></A>
+% }
+%}
+
+
+
+% while (my $Link = $Ticket->ReferredToBy->Next) {
+<LI>
+% if ($Link->BaseIsLocal) {
+% my $member = $Link->BaseObj;
+<a href="/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br>
+% } else {
+<A HREF="<%$Link->BaseAsHREF%>"><%$Link->Base%></A>
+%}
+% }
+</UL>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowRequestor b/rt/webrt/Ticket/Elements/ShowRequestor
new file mode 100644 (file)
index 0000000..fcbe71d
--- /dev/null
@@ -0,0 +1,35 @@
+<%PERL>
+my $people = $Ticket->Requestors;
+while (my $requestor=$people->Next) {
+if (($requestor->Owner ) && (my $user=$requestor->OwnerObj)) {
+my $name=$user->RealName || $user->EmailAddress;       
+my $tickets = new RT::Tickets($session{'CurrentUser'});
+$tickets->LimitRequestor(VALUE => $user->EmailAddress);
+$tickets->LimitStatus( VALUE => 'open');
+$tickets->LimitStatus( VALUE => 'new');
+$tickets->RowsPerPage(25);
+$tickets->OrderBy(FIELD => 'Priority',
+                 ORDER => 'DESC');
+</%PERL>
+
+% unless ($user->Privileged) {
+<& /Elements/TitleBoxStart, 
+       title => "<a class='inverse' href=\"$RT::WebPath/Admin/Users/Modify.html?id=".$user->id."\">More about $name</a>" &>
+
+Comments about this user:<BR>
+<B><% ($user->Comments || "No comment entered about this user") %></B><BR>
+
+This user's 25 highest priority tickets:<BR>
+<UL>
+%while (my $w=$tickets->Next) {
+<LI><%$w->Id%>: <a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$w->id%>"><%$w->Subject%></a> (<%$w->Status%>)
+%}
+</UL>
+<& /Elements/TitleBoxEnd &>
+
+% }
+% }
+%}
+<%ARGS>
+$Ticket=>undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ShowSummary b/rt/webrt/Ticket/Elements/ShowSummary
new file mode 100755 (executable)
index 0000000..b80ceb4
--- /dev/null
@@ -0,0 +1,61 @@
+      <TABLE WIDTH="100%" >
+      <TR>
+       <TD VALIGN=TOP >
+         <& /Elements/TitleBoxStart, title => 'The Basics', 
+               title_href =>"$RT::WebPath/Ticket/Modify.html?id=".$Ticket->Id, 
+               title_class=> 'inverse',  
+               color => "#993333" &>
+         <& /Ticket/Elements/ShowBasics, Ticket => $Ticket &>
+         <& /Elements/TitleBoxEnd &>
+
+       <BR>
+
+         <& /Elements/TitleBoxStart, 
+               title_href =>"$RT::WebPath/Ticket/Modify.html?id=".$Ticket->Id, 
+               title_class=> 'inverse',  
+               title => "Keyword Selections", color => "#993300"
+         &>
+         <& /Ticket/Elements/ShowKeywordSelects, Ticket => $Ticket &>
+         <& /Elements/TitleBoxEnd &>
+
+       
+
+       <BR>
+         <& /Elements/TitleBoxStart, title => 'Relationships', 
+               title_href => "$RT::WebPath/Ticket/ModifyLinks.html?id=".$Ticket->Id, 
+               title_class=> 'inverse',  
+               titleright => '', color=> "#336633" &>
+         <& /Ticket/Elements/ShowLinks, Ticket => $Ticket &>
+       <& /Elements/TitleBoxEnd &>
+       </TD>
+       <BR>
+       <TD VALIGN=TOP >
+
+         <& /Elements/TitleBoxStart, title => "Dates",
+               title_href =>"$RT::WebPath/Ticket/ModifyDates.html?id=".$Ticket->Id, 
+               title_class=> 'inverse',  
+                color => "#663366" &>
+         <& /Ticket/Elements/ShowDates, Ticket => $Ticket &>
+         <& /Elements/TitleBoxEnd &>
+       <BR>  
+         <& /Elements/TitleBoxStart, title => 'People', 
+               title_href =>"$RT::WebPath/Ticket/ModifyPeople.html?id=".$Ticket->Id, 
+               title_class=> 'inverse',  
+               color => "#333399" &>
+         <& /Ticket/Elements/ShowPeople, Ticket => $Ticket &>
+         <& /Elements/TitleBoxEnd &>
+       <BR>
+
+         <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
+
+
+       </TD>
+      </TR>
+    </TABLE>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
+
+
+
+
diff --git a/rt/webrt/Ticket/Elements/ShowTransaction b/rt/webrt/Ticket/Elements/ShowTransaction
new file mode 100755 (executable)
index 0000000..a0da008
--- /dev/null
@@ -0,0 +1,162 @@
+<TR bgcolor="<%$rowbgcolor%>">
+<TD bgcolor="<%$bgcolor%>"><A NAME="#<%$Transaction->Id%>"></A>&nbsp&nbsp;</TD>
+<TD>&nbsp&nbsp;</TD>
+<TD><font size=-2><% $transdate|n %></font>&nbsp;</TD>
+<TD ALIGN="LEFT"><b><%$Transaction->CreatorObj->Name%> - <%$TicketString%> <%$Transaction->BriefDescription%>
+
+</b></TD>
+<TD><%$TimeTaken%>&nbsp;</TD>
+<TD ALIGN="RIGHT"><font size=-1><%$titlebar_commands|n%></font></TD>
+</TR>
+<%PERL>
+
+unless ($Collapsed) {
+ $attachments->GotoFirstItem;
+ while (my $message=$attachments->Next) {
+     #we don't want to show any empty transactions, unless they have kids
+     next unless (length $message->Content || $message->Children->Count);
+     my ($headers, $content);
+     
+    </%PERL>
+
+
+<%PERL>
+  if ($message->Parent == 0) {
+      if ($ShowHeaders == $Ticket->Id) {
+         $headers = $message->Headers;
+      } else {
+         $headers = $message->NiceHeaders;
+      }
+      chomp $headers;
+      $headers .= "\n\n" if ($headers);
+  }
+     # 13456 is a random # of about the biggest size we want to see inline text
+     my $MAX_INLINE_BODY = 13456;
+     if ($message->ContentType =~ m{^(text/plain|message|text$)}i && 
+                                   length($message->Content)< $MAX_INLINE_BODY ) {
+
+        $content = $message->Content;
+
+        my $wrapper = new Text::Wrapper (columns=>85);
+        $content = $wrapper->wrap($content);
+         $content =~ s/&/&amp;/g;
+        $content =~ s/</&lt;/g;
+        $content =~ s/>/&gt;/g;
+         $content =~ s!((?:http|https|ftp|mailto):\S*?)([\s"']|&gt;|\.[\n])!<A HREF=\"$1\" TARGET=new>$1</A>$2!g;
+
+
+     }
+     else {
+        $content = "&nbsp;";
+     }
+        
+</%PERL>
+<TR BGCOLOR="<%$rowbgcolor%>">
+      <TD BGCOLOR="<%$bgcolor%>">&nbsp;&nbsp;</TD>
+      <TD>&nbsp&nbsp;</TD>
+      <TD COLSPAN=3 VALIGN=TOP>
+       <PRE>
+<%$headers%><%$content|n%>
+</PRE>
+      </TD>
+      <TD VALIGN=TOP ALIGN=RIGHT>
+       
+% if ($message->Parent == 0  ) {
+<BR>
+% }
+<%PERL>
+my $size = length($message->Content());
+
+if ($size) {
+    if ($size > 1024) {
+       $size = int($size/102.4)/10 . "k";
+    }
+    else {
+       $size = $size ."b";
+    }
+</%PERL>
+<font size=-1><A HREF="Attachment/<%$Transaction->Id%>/<%$message->Id%>/<%$message->Filename%>">Download <%$message->Filename|| '(untitled)'%></a> <% $size %></font>
+% }
+</TD>
+</TR>
+% }
+% }
+
+
+
+<%ARGS>
+$Ticket => undef
+$Transaction => undef
+$ShowHeaders => undef
+$Collapsed => undef
+$ShowTitleBarCommands => 1
+$RowNum => 1
+</%ARGS>
+
+<%INIT>
+
+
+my ($TimeTaken, $TicketString, $bgcolor, $rowbgcolor);
+
+my $transdate = $Transaction->CreatedAsString();
+$transdate =~ s/\s/&nbsp;/g;
+
+if ($RowNum % 2) {
+       $rowbgcolor="#cccccc";
+} else {
+       $rowbgcolor="#ffffff";
+}
+
+if ($Transaction->Type =~ /^(Create|Correspond|Comment$)/) {
+       if ($Transaction->IsInbound) {
+               $bgcolor="#336699";
+       }
+       else {
+               $bgcolor="#339999";
+       }
+} elsif (($Transaction->Field =~ /^Owner$/) or 
+        ($Transaction->Type =~ /^(AddWatcher|DelWatcher)$/)) {
+       $bgcolor="#333399";
+
+} elsif ($Transaction->Type =~ /^(AddLink|DeleteLink)$/) {
+       $bgcolor="#336633";
+} elsif ($Transaction->Type =~ /^(Status|Set|Keyword|Told)$/) {
+       if ($Transaction->Field =~ /^(Told|Starts|Started|Due)$/) {
+               $bgcolor="#663366";     
+       }
+       else {
+               $bgcolor="#993333";
+       }
+}
+else {
+       $bgcolor="#cccccc";
+}
+
+if ($Ticket->Id != $Transaction->Ticket) {
+       $TicketString = "Ticket ".$Transaction->Ticket .": ";
+}
+
+if ($Transaction->TimeTaken > 0) {
+       $TimeTaken = $Transaction->TimeTaken." min"
+}
+my $attachments = $Transaction->Attachments;
+
+my $titlebar_commands='&nbsp;';
+
+# If the transaction has anything attached to it at all
+if ($Transaction->Message->First && $ShowTitleBarCommands) {
+       if ($Transaction->TicketObj->CurrentUserHasRight('ReplyToTicket')) {
+               $titlebar_commands .= 
+                 "[<a href=\"Update.html?id=".
+                 $Transaction->Ticket . "&QuoteTransaction=".$Transaction->Id.
+                 "&Action=Respond\">Reply</a>]&nbsp;";
+       }
+       if ($Transaction->TicketObj->CurrentUserHasRight('CommentOnTicket')) {
+            $titlebar_commands .= 
+            "[<a href=\"Update.html?id=".$Transaction->Ticket. 
+            "&QuoteTransaction=".$Transaction->Id.
+            "&Action=Comment\">Comment</a>]";
+       }
+}
+
+</%INIT>
diff --git a/rt/webrt/Ticket/Elements/Tabs b/rt/webrt/Ticket/Elements/Tabs
new file mode 100755 (executable)
index 0000000..8cce197
--- /dev/null
@@ -0,0 +1,126 @@
+<& /Elements/Tabs, tabs => $tabs, actions => $actions, current_tab => $current_tab, tabs_scalar => $tabs_scalar &>
+<%INIT>
+       
+  my $id = $Ticket->id();
+  my $tabs_scalar = '';
+  my $tabs = {
+                A => { title => 'Display',
+                       path => "Ticket/Display.html?id=".$id,
+                     },
+             
+             Ab => { title => 'History',
+                     path => "Ticket/History.html?id=".$id,
+                      },
+             B => { title => 'Basics',
+                    path => "Ticket/Modify.html?id=".$id,
+                  },
+             
+             C => { title => 'Dates',
+                    path => "Ticket/ModifyDates.html?id=".$id,
+                  },
+             
+             D => { title => 'People',
+                    path => "Ticket/ModifyPeople.html?id=".$id,
+                  },
+             E => { title => 'Links',
+                    path => "Ticket/ModifyLinks.html?id=".$id,
+                  },
+             F => { title => 'Jumbo',
+                    path => "Ticket/ModifyAll.html?id=".$id,
+                  },
+             
+            };
+
+my $actions;
+if ($Ticket->CurrentUserHasRight('ModifyTicket') or 
+    $Ticket->CurrentUserHasRight('CommentOnTicket')) {
+    $actions->{'Comment'} = 
+      { 
+       title => 'Comment',
+       path => "Ticket/Update.html?Action=Comment&id=".$id,
+      }
+  };
+
+if ($Ticket->CurrentUserHasRight('ModifyTicket') or 
+    $Ticket->CurrentUserHasRight('ReplyToTicket')) {
+    $actions->{'Reply'} = 
+      { 
+       title => 'Reply',
+       path => "Ticket/Update.html?Action=Respond&id=".$id,
+      }
+  };
+
+if ($Ticket->CurrentUserHasRight('OwnTicket')) {
+    if ($Ticket->OwnerObj->id == $RT::Nobody->id)  {
+       $actions->{'Take'} =    
+         { 
+          path => "Ticket/Display.html?Action=Take&id=".$id,
+          title => 'Take'
+         };
+    }
+    elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id) {
+       $actions->{'Steal'} =   
+         { 
+          path => "Ticket/Display.html?Action=Steal&id=".$id,
+          title => 'Steal' 
+         };
+    }
+}
+
+if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
+    if ($Ticket->Status ne 'resolved') {
+       $actions->{'Resolve'} = 
+         { 
+
+           path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=".$id,
+          title => 'Resolve'
+         };
+    }  
+    if ($Ticket->Status ne 'open') {   
+       $actions->{'Open'} = 
+         { 
+          path => "Ticket/Display.html?Status=open&id=". $id,
+          title => 'Open'
+         };
+    }
+}
+
+
+
+
+if (defined $session{'tickets'}) {
+    my $items = $session{'tickets'}->ItemsArrayRef();
+    my @indexs = grep(($items->[$_]->id == $Ticket->Id), 0 .. $#{$items});
+
+    if ($items->[0]) {
+
+    if ($items->[$indexs[0]]->id == $Ticket->Id) {
+       # Don't display prev links if we're on the first ticket
+       if ( $items->[0]->id != $Ticket->id ) {
+           $tabs_scalar .= '[<A HREF="Display.html?id='.
+             $items->[0]->id.
+               '">&lt;&lt; First</a>] ';
+           $tabs_scalar .= '[<A HREF="Display.html?id='.
+             $items->[$indexs[0]-1]->id.
+               '">&lt; Prev</a>] ';
+       }
+       # Don't display next links if we're on the last ticket
+       if ( $Ticket->id != $items->[-1]->id ) {
+           $tabs_scalar .= '[<A HREF="Display.html?id='.
+             $items->[$indexs[0]+1]->id.
+               '">Next &gt;</a>] ';
+           $tabs_scalar .= '[<A HREF="Display.html?id='.
+             $items->[-1]->id.
+               '">Last &gt;&gt</a>]';
+       }
+       $tabs_scalar .= "<BR><BR>";
+    }
+    }
+}
+</%INIT>
+
+  
+<%ARGS>
+$Ticket => undef
+$current_tab => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/Elements/ToolBar b/rt/webrt/Ticket/Elements/ToolBar
new file mode 100755 (executable)
index 0000000..108e2f7
--- /dev/null
@@ -0,0 +1,3 @@
+<%ARGS>
+$Ticket => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/History.html b/rt/webrt/Ticket/History.html
new file mode 100755 (executable)
index 0000000..e0a5fe1
--- /dev/null
@@ -0,0 +1,30 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Ticket/Attic/History.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2000 Jesse Vincent <jesse@fsck.com>
+
+<& /Elements/Header, Title => "Ticket History #".$Ticket->Id ." ".$Ticket->Subject &>
+<& /Ticket/Elements/Tabs, Ticket => $Ticket, current_tab => 'Ticket/History.html?id='.$Ticket->id  &>
+
+<BR>
+      
+<& /Ticket/Elements/ShowHistory , Ticket => $Ticket, ShowHeaders => $ARGS{'ShowHeaders'}, URIFile => 'History.html' &> 
+
+
+<%ARGS>
+$id => undef
+</%ARGS>
+
+<%INIT>
+
+  
+
+my $Ticket = LoadTicket ($id);
+
+unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
+       Abort("No permission to view ticket");
+}
+
+</%INIT>
+
+
+
+
diff --git a/rt/webrt/Ticket/Modify.html b/rt/webrt/Ticket/Modify.html
new file mode 100755 (executable)
index 0000000..7a8a792
--- /dev/null
@@ -0,0 +1,39 @@
+<& /Elements/Header, Title => 'Modify ticket #'.$TicketObj->Id &>
+<& /Ticket/Elements/Tabs, Ticket => $TicketObj, current_tab => "Ticket/Modify.html?id=".$TicketObj->Id  &>
+
+<& /Elements/ListActions, actions => \@results &>
+<FORM METHOD=POST ACTION="Modify.html">
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>">
+
+<& /Elements/TitleBoxStart, title => 'Modify ticket #'.$TicketObj->Id, 
+  color=> "#993333", width => "100%" &>
+<& Elements/EditBasics, TicketObj => $TicketObj &>
+<& /Elements/TitleBoxEnd &>
+
+<& /Elements/TitleBoxStart, title => 'Keywords', color =>"#993333"&>
+<& Elements/EditKeywordSelects, TicketObj=>$TicketObj &>
+<& /Elements/TitleBoxEnd &>
+
+<& /Elements/Submit, Label => 'Save Changes', Caption => "If you've updated anything above, be sure to", color => "#993333" &>
+</form>
+<%INIT>
+  
+my $TicketObj = LoadTicket($id);
+
+my @results = ProcessTicketBasics(TicketObj => $TicketObj, ARGSRef => \%ARGS);
+my @okresults = ProcessTicketObjectKeywords(TicketObj => $TicketObj, ARGSRef => \%ARGS);
+
+push (@results, @okresults);
+
+# TODO: display the results, even if we can't display the ticket
+
+unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
+     Abort("No permission to view ticket");
+} 
+
+</%INIT>
+
+
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/ModifyAll.html b/rt/webrt/Ticket/ModifyAll.html
new file mode 100755 (executable)
index 0000000..ad91373
--- /dev/null
@@ -0,0 +1,124 @@
+<& /Elements/Header, Title => "Ticket #".$Ticket->Id ." Jumbo update: ".$Ticket->Subject &>
+<& /Ticket/Elements/Tabs, Ticket => $Ticket , current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<FORM METHOD=POST ACTION="ModifyAll.html" ENCTYPE="multipart/form-data">
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>">
+
+
+<& /Elements/TitleBoxStart, title => 'Modify ticket #'.$Ticket->Id,   color=> "#993333", width => "100%" &>
+<& Elements/EditBasics, TicketObj => $Ticket &>
+<& /Elements/TitleBoxEnd &>
+
+<BR>
+
+<& /Elements/TitleBoxStart, title => 'Dates',  width => "100%", color => "#663366"  &>
+<& Elements/EditDates, TicketObj => $Ticket &>
+<& /Elements/TitleBoxEnd &>
+
+<BR>
+
+<& /Elements/TitleBoxStart, title => 'Keywords', color =>"#993333"&>
+<& Elements/EditKeywordSelects, TicketObj=>$Ticket &>
+<& /Elements/TitleBoxEnd &>
+
+<BR>
+
+<& /Elements/TitleBoxStart, title => 'People',width => "100%", color=> "#333399" &>
+<& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp &>
+<& /Elements/TitleBoxEnd &>
+
+<BR>
+
+<& /Elements/TitleBoxStart, title => 'Relationships', color => "#336633"&>
+<& Elements/EditLinks, Ticket => $Ticket &>
+<& /Elements/TitleBoxEnd &>
+
+<BR>
+
+<& /Elements/TitleBoxStart, title => 'Update ticket' &>
+<hr>
+Update Type: <select name="UpdateType">
+% if ($CanComment) {
+  <option value="private" >Comments (Not sent to requestors)</option>
+% }
+% if ($CanRespond) {
+   <option value="response">Response to requestors</option>
+% }
+</select> 
+<br>
+
+Subject: <input name="UpdateSubject" size=60 value=""> <br>
+Attach: <input name="UpdateAttachment" type=file> <br>
+<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &>
+<& /Elements/TitleBoxEnd &>
+
+
+<& /Elements/Submit, Label => 'Save Changes', Caption => "If you've updated anything above, be sure to", color => "#333399" &>
+</form>
+
+<%INIT>
+
+
+
+my $Ticket = LoadTicket($id);
+
+my $CanRespond = 0;
+my $CanComment = 0;
+
+
+$CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
+                     $Ticket->CurrentUserHasRight('ModifyTicket') ); 
+
+$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
+                     $Ticket->CurrentUserHasRight('ModifyTicket') );
+
+
+my (@wresults, @results, @okresults, @dresults, @lresults);
+
+unless ($OnlySearchForPeople) {
+    @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    @okresults = ProcessTicketObjectKeywords(TicketObj => $Ticket, ARGSRef => \%ARGS);
+
+    @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+
+    $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
+
+    if ($ARGS{'UpdateContent'} && 
+       $ARGS{'UpdateContent'} ne '' && 
+       $ARGS{'UpdateContent'} ne  "-- \n" . 
+                               $session{'CurrentUser'}->UserObj->Signature
+       ) {
+        ProcessUpdateMessage(TicketObj => $Ticket, 
+                             ARGSRef=>\%ARGS, 
+                              Actions=>\@results);
+       }
+}
+push @results, @wresults;
+push @results, @dresults;
+push @results, @lresults;
+push @results, @okresults;
+
+# If they've gone and moved the ticket to somewhere they can't see, etc...
+# TODO: display the results, even if we can't display the ticket.
+
+unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
+   Abort("No permission to view ticket");
+}
+
+
+</%INIT>
+
+
+
+<%ARGS>
+$OnlySearchForPeople => undef
+$UserField => undef
+$UserOp => undef
+$UserString => undef
+$id => undef
+</%ARGS>
+
diff --git a/rt/webrt/Ticket/ModifyDates.html b/rt/webrt/Ticket/ModifyDates.html
new file mode 100755 (executable)
index 0000000..b2ecb68
--- /dev/null
@@ -0,0 +1,26 @@
+<& /Elements/Header, Title => 'Modify dates for #'. $TicketObj->Id &>
+<& /Ticket/Elements/Tabs, Ticket => $TicketObj, current_tab => "Ticket/ModifyDates.html?id=".$TicketObj->Id  &> 
+
+<& /Elements/ListActions, actions => \@results &>
+
+<FORM METHOD=POST ACTION="ModifyDates.html">
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>">
+<& /Elements/TitleBoxStart, title => 'Modify dates for ticket #'.$TicketObj->Id,  width => "100%", color => "#663366"  &>
+
+<& Elements/EditDates, TicketObj => $TicketObj &>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit, color => "#663366" &>
+</form>
+
+
+<%INIT>
+
+my $TicketObj = LoadTicket($id);
+my @results = ProcessTicketDates( TicketObj => $TicketObj, ARGSRef => \%ARGS);
+
+</%INIT>
+
+
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/ModifyLinks.html b/rt/webrt/Ticket/ModifyLinks.html
new file mode 100755 (executable)
index 0000000..14c939d
--- /dev/null
@@ -0,0 +1,31 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Ticket/Attic/ModifyLinks.html,v 1.1 2002-08-12 06:17:09 ivan Exp $
+%# Copyright 1996-2000 Jesse Vincent <jesse@fsck.com>
+
+<& /Elements/Header, Title => "Link ticket ".$Ticket->Id &>
+<& /Ticket/Elements/Tabs, Ticket => $Ticket, current_tab => "Ticket/ModifyLinks.html?id=".$Ticket->Id &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<form action="ModifyLinks.html" method="post">
+<input type="hidden" name="id" value="<%$Ticket->id%>">
+
+<& /Elements/TitleBoxStart, title => 'Edit Relationships', color => "#336633"&>
+<& Elements/EditLinks, Ticket => $Ticket &>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit, color => "#336633", Caption=> 'Save changes' &>
+</form>
+
+
+
+
+<%INIT>
+  
+my $Ticket = LoadTicket($id);
+my @results = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    
+</%INIT>
+      
+      
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Ticket/ModifyPeople.html b/rt/webrt/Ticket/ModifyPeople.html
new file mode 100755 (executable)
index 0000000..fecf091
--- /dev/null
@@ -0,0 +1,38 @@
+<& /Elements/Header, Title => 'Modify people related to ticket # ' . $Ticket->id &>
+<& /Ticket/Elements/Tabs, Ticket => $Ticket , current_tab => "Ticket/ModifyPeople.html?id=".$Ticket->Id &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<FORM METHOD=POST ACTION="ModifyPeople.html">
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>">
+<& /Elements/TitleBoxStart, title => 'Modify people related to ticket #'.$Ticket->Id,   width => "100%", color=> "#333399" &>
+<& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp &>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit, Label => 'Save Changes', Caption => "If you've updated anything above, be sure to", color => "#333399" &>
+</form>
+
+<%INIT>
+
+my (@results, @wresults);
+
+my $Ticket = LoadTicket($id);
+
+# if we're trying to search for watchers and nothing else
+unless ($OnlySearchForPeople) {
+    @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
+}
+
+push @results, @wresults;
+</%INIT>
+
+
+
+<%ARGS>
+$OnlySearchForPeople => undef
+$UserField => undef
+$UserOp => undef
+$UserString => undef
+$id => undef
+</%ARGS>
+
diff --git a/rt/webrt/Ticket/Update.html b/rt/webrt/Ticket/Update.html
new file mode 100755 (executable)
index 0000000..be22666
--- /dev/null
@@ -0,0 +1,110 @@
+<& /Elements/Header, Title=> $title  &>
+<& /Ticket/Elements/Tabs, Ticket => $Ticket &>
+<& /Elements/TitleBoxStart, title => "Update ticket" &>
+
+<FORM ACTION="Display.html" NAME="TicketUpdate" 
+       METHOD=POST enctype="multipart/form-data">
+
+<TABLE>
+<TR><TD>
+<a href="ModifyPeople.html?id=<%$Ticket->Id%>">Ticket watchers</A></TD><TD align=right>
+Requestor:
+</TD><TD>
+<b><% $Ticket->RequestorsAsString %></b>
+</TD></TR>
+<TR><TD>&nbsp;</TD><TD align=right>
+Cc:
+</TD><TD>
+<b><% $Ticket->CcAsString %></b>
+</TD></TR>
+<TR><TD>&nbsp;</TD><TD align=right>
+AdminCc:
+</TD><TD>
+<b><% $Ticket->AdminCcAsString %></b>
+</TD></TR>
+</TR>
+</TABLE>
+<hr>
+
+<TABLE BORDER=0>
+
+<tr><td align=right>Status:</td>
+<td>
+<& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &>
+Owner:  
+<& /Elements/SelectOwner, Name=>"Owner", Default => $Ticket->OwnerObj->Id(), QueueObj => $Ticket->QueueObj, TicketObj => $Ticket &>
+Worked: <input size=4 name="UpdateTimeWorked"> minutes</td></tr>
+<tr><td align=right>Update Type:</td>
+<td><select name="UpdateType">
+% if ($CanComment) {
+  <option value="private" <%$CommentDefault%>>Comments (Not sent to requestors)</option>
+% }
+% if ($CanRespond) {
+   <option value="response" <%$ResponseDefault%>>Response to requestors</option>
+% }
+</select> 
+</td></tr>
+<tr><td align=right>Subject:</td><td> <input name="UpdateSubject" size=60 value="<%$Ticket->Subject()%>"></td></tr>
+<tr><td align=right>Cc:</td><td> <input name="UpdateCc" size=60><BR>
+<i><font size=-2>(Sends a carbon-copy of this update to a comma-delimited list
+of email addresses. Does <b>not</b> change who will receive future updates.)</font></i>
+</td></tr>
+<tr><td align=right>Bcc:</td><td> <input name="UpdateBcc" size=60><BR>
+<i><font size=-2>(Sends a blind carbon-copy of this update to a comma-delimited list
+of email addresses. Does <b>not</b> change who will receive future updates.)</font></i>
+</td></tr>
+<tr><td align=right>Attach:</td><td><input name="UpdateAttachment" type="file"></td></tr>
+</table>
+<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &>
+               <INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>"><br>
+
+
+
+
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+  </FORM>
+
+
+
+<%INIT>
+
+my $CanRespond = 0;
+my $CanComment = 0;
+my $title;
+
+my $Ticket = LoadTicket($id);
+
+
+if ($DefaultStatus eq 'resolved') {
+       $title = "Resolve";
+} else {
+       $title = "Update";
+}
+
+$title .= " ticket #" . $Ticket->id . " (" .$Ticket->Subject.")";
+
+# Things needed in the template - we'll do the processing here, just
+# for the convinience:
+my $CommentDefault=$Action eq "Comment" ? "SELECTED" : "";
+my $ResponseDefault=$Action eq "Respond" ? "SELECTED" : "";
+
+$DefaultStatus = $Ticket->Status() unless ($DefaultStatus);
+
+$CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
+                     $Ticket->CurrentUserHasRight('ModifyTicket') ); 
+
+$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
+                     $Ticket->CurrentUserHasRight('ModifyTicket') ); 
+       
+
+     
+     
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Action => undef
+$DefaultStatus => undef
+</%ARGS>
diff --git a/rt/webrt/User/Prefs.html b/rt/webrt/User/Prefs.html
new file mode 100755 (executable)
index 0000000..d769977
--- /dev/null
@@ -0,0 +1,53 @@
+<& /Elements/Header, Title=>"Preferences" &>
+<& /Elements/Tabs &>
+
+<& /Elements/ListActions, actions => \@results &>
+<form method=post>
+
+% unless ($RT::WebExternalAuth) {
+<& /Elements/TitleBoxStart, title => 'Change password'  &>
+New password: <input type=password name="NewPass1" size=16>
+Confirm: <input type=password name="NewPass2" size=16>
+<& /Elements/TitleBoxEnd &>
+<BR>
+% }
+<& /Elements/TitleBoxStart, title => 'Signature'  &>
+<INPUT TYPE=HIDDEN NAME="SignatureMagic" VALUE=1>
+<TEXTAREA COLS=72 ROWS=4 WRAP=HARD NAME="Signature"><% $session{'CurrentUser'}->UserObj->Signature %></TEXTAREA>
+<br>
+<BR>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+         </form>
+
+
+<%INIT>
+my @results;
+
+if ($NewPass1) {
+    if ($NewPass1 ne $NewPass2) {
+       push (@results, "Passwords did not match.");
+    }  
+    else {
+       my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetPassword($NewPass1);
+       push (@results, "Password: ".$msg);
+    }  
+}
+if ($Signature || $SignatureMagic) {
+    $Signature =~ s/(\r\n|\r)/\n/g;
+    if ($Signature ne $session{'CurrentUser'}->UserObj->Signature) {
+       my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetSignature($Signature);
+       push (@results, "Signature: ".$msg);
+    }
+}
+#A hack to make sure that session gets rewritten.
+
+$session{'i'}++;
+</%INIT>
+
+<%ARGS>
+$Signature => undef
+$SignatureMagic => undef
+$NewPass1 => undef
+$NewPass2 => undef
+</%ARGS>
diff --git a/rt/webrt/autohandler b/rt/webrt/autohandler
new file mode 100755 (executable)
index 0000000..16cdbc7
--- /dev/null
@@ -0,0 +1,73 @@
+%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Attic/autohandler,v 1.1 2002-08-12 06:17:08 ivan Exp $
+<& /Elements/Footer, %ARGS &>
+
+<%INIT>
+
+$m->{'rt_base_time'} = time;
+
+#if it's a noauth file, don't ask for auth.
+if ($m->base_comp->path =~ '^/+NoAuth/') {
+        $m->call_next();
+       $m->abort();
+}
+
+# If RT is configured for external auth, let's get REMOTE_USER
+# We intentionally don't test for REMOTE_USER to meet our policy
+elsif ($RT::WebExternalAuth){
+
+    $user = $ENV{'REMOTE_USER'};
+    $session{'CurrentUser'} = RT::CurrentUser->new();
+    $session{'CurrentUser'}->Load($user);
+    unless ($session{'CurrentUser'}->id() ) {
+        delete $session{'CurrentUser'};
+        $m->comp('/Elements/Login', %ARGS, Error=> 'You are not an authorized user');
+        $m->abort();
+    }
+}
+# If the user is loging in, let's authenticate
+elsif (defined ($user) && defined ($pass)){
+    
+    $session{'CurrentUser'} = RT::CurrentUser->new();
+    $session{'CurrentUser'}->Load($user);
+    unless ($session{'CurrentUser'}->id() ) {
+       delete $session{'CurrentUser'};
+       $m->comp('/Elements/Login', %ARGS, Error=> 'Your username or password is incorrect');
+        $m->abort();
+    };
+    unless ($session{'CurrentUser'}->IsPassword($pass)) {
+       delete $session{'CurrentUser'};
+       
+       $m->comp('/Elements/Login', Error => 'Your username or password is incorrect', %ARGS);
+       $m->abort();
+    }
+}
+  
+
+#If we've got credentials, lets serve the file up.
+if ( (defined $session{'CurrentUser'}) and 
+     ( $session{'CurrentUser'}->Id) ) {
+    
+    # If the user isn\'t privileged, they can only see SelfService
+    if ((! $session{'CurrentUser'}->Privileged) and
+       ($m->base_comp->path !~ '^/+SelfService/') ) {
+       $m->comp('/SelfService/index.html');
+       $m->abort();
+    }
+    else {
+       $m->call_next;
+    }
+}
+
+#If we have no credentials
+else {
+    $m->comp('/Elements/Login', %ARGS);
+    $m->abort();
+}
+
+</%INIT>
+
+<%ARGS>
+$user => undef
+$pass => undef
+</%ARGS>
diff --git a/rt/webrt/index.html b/rt/webrt/index.html
new file mode 100644 (file)
index 0000000..0c1091a
--- /dev/null
@@ -0,0 +1,25 @@
+<& /Elements/Header, Title=>"Start page", Refresh => $session{'home_refresh_interval'} &>
+<& /Elements/Tabs, current_toptab => '' &>
+<TABLE BORDER=0 WIDTH=100%>
+<TR VALIGN=TOP>
+<TD WIDTH=70%>
+<& /Elements/CustomHomepageHeader, %ARGS &>
+<& /Elements/MyTickets &>
+<BR>
+<& /Elements/MyRequests &>
+</TD>
+<TD>
+<& /Elements/Quicksearch &>
+<BR>
+<form method=get action="index.html">
+<& /Elements/Refresh, Name => 'HomeRefreshInterval', Default => $session {'home_refresh_interval'} &>
+<div align=right><input type=submit value="Go!"></div>
+</form>
+</TD>
+</TR>
+</TABLE>
+<%init>
+if ($ARGS{'HomeRefreshInterval'}) {
+       $session{'home_refresh_interval'} = $ARGS{'HomeRefreshInterval'};
+}
+</%init>