[Rt-commit] r6411 - in rt/branches/3.7-EXPERIMENTAL: . etc html/Approvals/Elements html/Elements html/Prefs html/SelfService/Elements html/Ticket/Elements lib lib/RT lib/RT/Interface

ruz at bestpractical.com ruz at bestpractical.com
Sat Nov 11 21:14:08 EST 2006


Author: ruz
Date: Sat Nov 11 21:14:07 2006
New Revision: 6411

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/README
   rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in
   rt/branches/3.7-EXPERIMENTAL/html/Approvals/Elements/Approve
   rt/branches/3.7-EXPERIMENTAL/html/Elements/MyRT
   rt/branches/3.7-EXPERIMENTAL/html/Elements/ShowSearch
   rt/branches/3.7-EXPERIMENTAL/html/Prefs/MyRT.html
   rt/branches/3.7-EXPERIMENTAL/html/SelfService/Closed.html
   rt/branches/3.7-EXPERIMENTAL/html/SelfService/Elements/MyRequests
   rt/branches/3.7-EXPERIMENTAL/html/SelfService/index.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs
   rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/releng.cnf

Log:
merge 3.6 -> 3.7

 r3898 at cubic-pc (orig r6063):  jesse | 2006-09-28 02:43:54 +0400
  r27846 at 253:  jesse | 2006-09-27 18:43:53 -0400
  * removed a stray font tag
 
 r3945 at cubic-pc (orig r6167):  jesse | 2006-10-05 20:06:49 +0400
  r28050 at pinglin:  jesse | 2006-10-05 12:06:47 -0400
  * 3.6.2rc1
 
 r3946 at cubic-pc (orig r6172):  jesse | 2006-10-06 20:42:45 +0400
  r28065 at 101:  jesse | 2006-10-06 12:42:52 -0400
  * After RT 3.6.1, we broke the ""send an error message" email routines to require that they have an incoming message. Fixed now
      - Spotted by Jason A. Diegmueller
  
 
 r3947 at cubic-pc (orig r6198):  ruz | 2006-10-13 01:54:23 +0400
 * skip -Category part as -Magic [rt3.fsck.com #7903]
 * drop $cfid as it's not used
 
 r3952 at cubic-pc (orig r6199):  ruz | 2006-10-13 06:33:05 +0400
  r3949 at cubic-pc:  cubic | 2006-10-13 06:02:30 +0400
  * cache results of rights checks locally
 
 r3953 at cubic-pc (orig r6200):  ruz | 2006-10-13 06:33:13 +0400
  r3950 at cubic-pc:  cubic | 2006-10-13 06:07:28 +0400
  * fine tune [Take] and [Steal] actions according to ACL
 
 r3954 at cubic-pc (orig r6201):  ruz | 2006-10-13 06:33:22 +0400
  r3951 at cubic-pc:  cubic | 2006-10-13 06:43:19 +0400
  * we have $OldOwnerObj, so use it
 
 r3963 at cubic-pc (orig r6211):  jesse | 2006-10-16 19:49:02 +0400
  r28886 at pinglin:  jesse | 2006-10-16 11:48:54 -0400
  * Added a workaround for parsing headers from broken  MUAs that send headers like:
  
      From: ""Vincent, Jesse"" <jesse at fsck.com>
  
  
 
 r4039 at cubic-pc (orig r6240):  kevinr | 2006-10-20 08:05:03 +0400
 
 r4040 at cubic-pc (orig r6241):  kevinr | 2006-10-20 08:05:59 +0400
  r28703 at sad-girl-in-snow:  kevinr | 2006-10-20 00:02:48 -0400
  * Pulled User::WatchedQueues in from RT::Extension::rt_cpan_org
 
 r4041 at cubic-pc (orig r6242):  kevinr | 2006-10-20 09:13:43 +0400
  r28708 at SAD-GIRL-IN-SNOW:  kevinr | 2006-10-20 01:13:16 -0400
  * Reverted
 
 r4042 at cubic-pc (orig r6243):  jesse | 2006-10-20 20:37:05 +0400
  r28972 at 119:  jesse | 2006-10-20 12:36:50 -0400
  * Backed out the rest of kevin's accidental commit
 
 r4043 at cubic-pc (orig r6302):  ruz | 2006-10-26 07:18:11 +0400
  r4038 at cubic-pc:  cubic | 2006-10-26 07:29:27 +0400
  * add doc
 
 r4113 at cubic-pc (orig r6362):  falcone | 2006-11-06 22:09:21 +0300
  r14255 at ketch:  falcone | 2006-11-06 14:07:58 -0500
  You can't have FastCgiIpcDir and FastCgiServer in the VirtualHost block
 
 r4114 at cubic-pc (orig r6363):  falcone | 2006-11-06 22:09:32 +0300
  r14256 at ketch:  falcone | 2006-11-06 14:08:54 -0500
  Make LoadConfig a lot more vocal about why it can't read your config files
  and offer some hints and warnings about fixing it
 
 r4115 at cubic-pc (orig r6379):  jesse | 2006-11-07 22:16:57 +0300
  r29654 at pinglin:  jesse | 2006-10-31 17:10:10 -0500
  3.6.2rc2
 
 r4116 at cubic-pc (orig r6380):  jesse | 2006-11-07 22:22:15 +0300
  r40520 at pinglin:  jesse | 2006-11-07 14:15:50 -0500
  * SelfService cleanup and regularization patches from 
          David Chandek-Stark <david.chandek.stark at duke.edu>
 
 r4117 at cubic-pc (orig r6399):  jesse | 2006-11-10 07:41:15 +0300
  r44732 at pinglin:  jesse | 2006-11-09 23:41:00 -0500
  * The RT homepage no longer explodes if you upgrade from 3.4. (Error proof the "Portlets" attribute handling)
  
 
 r4118 at cubic-pc (orig r6400):  jesse | 2006-11-10 07:46:17 +0300
  r44740 at pinglin:  jesse | 2006-11-09 23:46:01 -0500
  * Added a callback to let extensions massage custom homepage portlet searches
  
 


Modified: rt/branches/3.7-EXPERIMENTAL/README
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/README	(original)
+++ rt/branches/3.7-EXPERIMENTAL/README	Sat Nov 11 21:14:07 2006
@@ -272,17 +272,18 @@
 To install RT with FastCGI, you'll need to add a few lines to your 
 Apache configuration file telling it about RT:
 
+
+# Tell FastCGI to put its temporary files somewhere sane.
+FastCgiIpcDir /tmp
+
+FastCgiServer /opt/rt3/bin/mason_handler.fcgi -idle-timeout 120
+
 <VirtualHost your.ip.address>
    ServerName your.rt.server.hostname
 
    # Pass through requests to display images
    Alias /NoAuth/images/ /opt/rt3/share/html/NoAuth/images/
 
-   # Tell FastCGI to put its temporary files somewhere sane.
-   FastCgiIpcDir /tmp
-
-   FastCgiServer /opt/rt3/bin/mason_handler.fcgi -idle-timeout 120
-
    AddHandler fastcgi-script fcgi
    ScriptAlias / /opt/rt3/bin/mason_handler.fcgi/
 </VirtualHost>

Modified: rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in	Sat Nov 11 21:14:07 2006
@@ -609,7 +609,8 @@
 
 # You can define new statuses and even reorder existing statuses here.
 # WARNING. DO NOT DELETE ANY OF THE DEFAULT STATUSES. If you do, RT
-# will break horribly.
+# will break horribly. The statuses you add must be no longer than
+# 10 characters.
 
 Set(@ActiveStatus, qw(new open stalled));
 Set(@InactiveStatus, qw(resolved rejected deleted));

Modified: rt/branches/3.7-EXPERIMENTAL/html/Approvals/Elements/Approve
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Approvals/Elements/Approve	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Approvals/Elements/Approve	Sat Nov 11 21:14:07 2006
@@ -2,7 +2,7 @@
 %# 
 %# COPYRIGHT:
 %#  
-%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
+%# This software is Copyright (c) 1996-2006 Best Practical Solutions, LLC 
 %#                                          <jesse at bestpractical.com>
 %# 
 %# (Except where explicitly superseded by other copyright notices)
@@ -45,7 +45,7 @@
 %# END BPS TAGGED BLOCK }}}
 <div class="approval">
   <div class="name">
-    <a href="<%RT->Config->Get('WebPath')%>/Approvals/Display.html?id=<%$ticket->Id%>"><% loc("#[_1]: [_2]", $ticket->Id, $ticket->Subject) %></a> (<%loc($ticket->Status)%>)</font>
+    <a href="<%RT->Config->Get('WebPath')%>/Approvals/Display.html?id=<%$ticket->Id%>"><% loc("#[_1]: [_2]", $ticket->Id, $ticket->Subject) %></a> (<%loc($ticket->Status)%>)
   </div>
 % if ($ShowApproving) {
 %     foreach my $approving ( $ticket->AllDependedOnBy( Type => 'ticket' ) ) {

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/MyRT
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/MyRT	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/MyRT	Sat Nov 11 21:14:07 2006
@@ -64,12 +64,13 @@
 
 $Portlets ||= $session{'my_rt_portlets'};
 unless ( $Portlets ) {
-    my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
+    my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
     $Portlets = $session{'my_rt_portlets'} =
                 $session{'CurrentUser'}->UserObj->Preferences( 
                     'HomepageSettings',
-                    $d_portlets->Content,
+                    $default_portlets? $default_portlets->Content: {},
                 );
+    }
 }
 
 my $two_columns = $Portlets->{summary} && @{$Portlets->{summary}};

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/ShowSearch
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/ShowSearch	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/ShowSearch	Sat Nov 11 21:14:07 2006
@@ -44,14 +44,11 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <&|/Widgets/TitleBox,
-    title => loc($search->Description, $rows),
+    title => loc($search->Description, $SearchArg->{'Rows'}),
     title_href => "Search/Results.html".$QueryString,
     titleright => loc('Edit'),
     titleright_href => $customize &>
-<& /Elements/TicketList, %$SearchArg,
-        Rows => $rows,
-        ShowNavigation => 0
-        &>
+<& /Elements/TicketList, %$SearchArg, ShowNavigation => 0 &>
 </&>
 <%init>
 my $search;
@@ -77,13 +74,23 @@
 	return;
     }
     $SearchArg = $user->Preferences($search, $search->Content);
+    $SearchArg->{'Rows'} = $user->Preferences('SummaryRows', RT->Config->Get('DefaultSummaryRows'));
     $customize = RT->Config->Get('WebPath').'/Prefs/Search.html?'.$m->comp('/Elements/QueryString', name => ref($search).'-'.$search->Id)
 }
 
-my $rows = $user->Preferences('SummaryRows', RT->Config->Get('DefaultSummaryRows'));
 $SearchArg->{'Query'} =~ s/__CurrentUser__/$session{'CurrentUser'}->Id/ge;
 $SearchArg->{'Format'} =~ s/__(Web(?:Path|Base|BaseURL))__/RT->Config->Get($1)/ge;
 $SearchArg->{'Format'} =~ s/__loc\(["']?(\w+)["']?\)__/loc("$1")/ge;
+
+$m->comp(
+    '/Elements/Callback',
+    _CallbackName => 'ModifySearch',
+    Search        => $SearchArg,
+    %ARGS
+);
+
+
+
 my $QueryString = '?' . $m->comp('/Elements/QueryString',
                                   %$SearchArg);
 	    #map { $_ => $SearchArg->{$_} } qw(Query Order OrderBy));

Modified: rt/branches/3.7-EXPERIMENTAL/html/Prefs/MyRT.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Prefs/MyRT.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Prefs/MyRT.html	Sat Nov 11 21:14:07 2006
@@ -87,8 +87,11 @@
 $ARGS{'SummaryRows'} ||= $user->Preferences('SummaryRows', RT->Config->Get('DefaultSummaryRows'));
 
 unless (exists $session{'my_rt_portlets'}) {
-    my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
-    $session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $d_portlets->Content);
+    my $portlets; 
+
+    my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
+    $portlets  = $default_portlets ? $default_portlets->Content  : {};
+    $session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $portlets);
 }
 my $portlets = $session{'my_rt_portlets'};
 

Modified: rt/branches/3.7-EXPERIMENTAL/html/SelfService/Closed.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/SelfService/Closed.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/SelfService/Closed.html	Sat Nov 11 21:14:07 2006
@@ -45,5 +45,10 @@
 %# END BPS TAGGED BLOCK }}}
 <& /SelfService/Elements/Header, Title => loc('Closed tickets') &>
 
-<& /SelfService/Elements/MyRequests, status => ['rejected', 'resolved'], friendly_status =>
-loc('closed') &>
+<& /SelfService/Elements/MyRequests, status          => ['rejected', 'resolved'], 
+                                     friendly_status => loc('closed'), 
+				     BaseURL         => $RT::WebPath . "/SelfService/Closed.html?", 
+				     Page            => $Page &>
+<%ARGS>
+$Page => 1
+</%ARGS>

Modified: rt/branches/3.7-EXPERIMENTAL/html/SelfService/Elements/MyRequests
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/SelfService/Elements/MyRequests	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/SelfService/Elements/MyRequests	Sat Nov 11 21:14:07 2006
@@ -44,41 +44,44 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <&| /Widgets/TitleBox, title =>  $title &>
-<table border="0" cellspacing="1" cellpadding="1" bgcolor="#eeeeee" width="100%">
-<tr>
-<th><&|/l&>Subject</&></th>
-<th><&|/l&>Status</&></th>
-<th><&|/l&>Owner</&></th>
-</tr>
-<tr>
-% while (my $Ticket = $MyTickets->Next) {
-<tr>
-<td>
-<a href="<%RT->Config->Get('WebPath')%>/SelfService/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id%>: <%$Ticket->Subject%></a>
-</td>
-<td>
-<%loc($Ticket->Status)%>
-</td><td>
-<%$Ticket->OwnerObj->Name%>
-</tr>
-% }
-</table>
+<& /Elements/TicketList, Title   => $title,
+			 Format  => @Format, 
+			 Query   => $Query, 
+			 Order   => $Order, 
+			 OrderBy => $OrderBy,
+			 BaseURL => $BaseURL,
+			 Page    => $Page &>
 </&>
 
 <%INIT>
 $title ||= loc("My [_1] tickets", $friendly_status);
-my $MyTickets;
-$MyTickets = new RT::Tickets ($session{'CurrentUser'});
-$MyTickets->LimitWatcher(TYPE => 'Requestor', VALUE => $session{'CurrentUser'}->EmailAddress);
-$MyTickets->OrderBy(FIELD => 'id', ORDER => 'ASC');
-
-foreach my $status (@status) {
-
-        $MyTickets->LimitStatus(VALUE => $status);
+my $EmailAddress = $session{'CurrentUser'}->EmailAddress;
+my $Role = shift @roles;
+my $Query = "( ";
+$Query .= $Role . " = '" . $EmailAddress . "'";
+foreach $Role (@roles) {
+   $Query .= " OR " . $Role . " = '" . $EmailAddress . "'";
+}
+$Query .= " )";
+if (@status) {
+   $Query .= " AND ( Status = '";
+   $Query .= join "' OR Status = '", @status; 
+   $Query .= "' )";
 }
+my $Order = "ASC";
+my $OrderBy = "Created";
+my @Format = qq{
+   '<B><A HREF="}. RT->Config->Get('WebPath') .qq{/SelfService/Display.html?id=__id__">__id__</a></B>/TITLE:#',
+   '<B><A HREF="}. RT->Config->Get('WebPath') .qq{/SelfService/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
+   Status,
+   '__Requestors__',
+   OwnerName};
 </%INIT>
 <%ARGS>
 $title => undef
 $friendly_status => loc('open')
+ at roles => ('Requestor', 'Cc', 'AdminCc')
 @status => ('open', 'new', 'stalled')
+$BaseURL => undef
+$Page => 1
 </%ARGS>

Modified: rt/branches/3.7-EXPERIMENTAL/html/SelfService/index.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/SelfService/index.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/SelfService/index.html	Sat Nov 11 21:14:07 2006
@@ -43,6 +43,10 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-<& /SelfService/Elements/Header, Title => undef &>
+<& /SelfService/Elements/Header, Title => loc('Open Tickets') &>
 
-<& /SelfService/Elements/MyRequests &>
+<& /SelfService/Elements/MyRequests, BaseURL => $RT::WebPath . "/SelfService/?", 
+				     Page    => $Page &>
+<%ARGS>
+$Page => 1
+</%ARGS>

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs	Sat Nov 11 21:14:07 2006
@@ -138,21 +138,20 @@
 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
 $current_tab = "Ticket/Display.html?id=" . $id;
 
-
-
-
-
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
-    $actions->{'F'} = { title => loc('Reply'),
-                        path  => "Ticket/Update.html?Action=Respond&id=" . $id,
+my %can = (
+    ModifyTicket => $Ticket->CurrentUserHasRight('ModifyTicket'),
+);
+
+if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
+    $actions->{'F'} = {
+        title => loc('Reply'),
+        path  => "Ticket/Update.html?Action=Respond&id=" . $id,
     };
 }
 
-if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
+if ( $can{'ModifyTicket'} ) {
     if ( $Ticket->Status ne 'resolved' ) {
         $actions->{'G'} = {
-
             path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
             title => loc('Resolve') };
     }
@@ -163,20 +162,28 @@
 }
 
 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
-    if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
-        $actions->{'B'} = { path => "Ticket/Display.html?Action=Take&id=" . $id,
-                            title => loc('Take') };
+    if ( $Ticket->OwnerObj->Id == $RT::Nobody->id
+         and ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('TakeTicket') ) )
+    {
+        $actions->{'B'} = {
+            path => "Ticket/Display.html?Action=Take&id=" . $id,
+            title => loc('Take'),
+        };
     }
-    elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
-        $actions->{'C'} = {path => "Ticket/Display.html?Action=Steal&id=" . $id,
-                           title => loc('Steal') };
+    elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id 
+            and ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('StealTicket') ) )
+    {
+        $actions->{'C'} = {
+            path => "Ticket/Display.html?Action=Steal&id=" . $id,
+            title => loc('Steal'),
+        };
     }
 }
 
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
-    $actions->{'E'} = { title => loc('Comment'),
-                        path  => "Ticket/Update.html?Action=Comment&id=" . $id,
+if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
+    $actions->{'E'} = {
+        title => loc('Comment'),
+        path  => "Ticket/Update.html?Action=Comment&id=" . $id,
     };
 }
 }

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in	Sat Nov 11 21:14:07 2006
@@ -114,7 +114,6 @@
     $Config->LoadConfigs;
     require RT::I18N;
 
-
     # RT::Essentials mistakenly recommends that WebPath be set to '/'.
     # If the user does that, do what they mean.
     $RT::WebPath = '' if ($RT::WebPath eq '/');

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	Sat Nov 11 21:14:07 2006
@@ -244,6 +244,7 @@
         Subject                => $args{'Subject'},
         Precedence             => 'bulk',
         'X-RT-Loop-Prevention' => RT->Config->Get('rtname'),
+        'In-Reply-To:'         => $args{'MIMEObj'} ? $args{'MIMEObj'}->head->get('Message-Id') : undef,
     );
 
     $entity->attach( Data => $args{'Explanation'} . "\n" );
@@ -511,6 +512,8 @@
 sub ParseAddressFromHeader {
     my $Addr = shift;
 
+    # Some broken mailers send:  ""Vincent, Jesse"" <jesse at fsck.com>. Hate
+    $Addr =~ s/\"\"(.*?)\"\"/\"$1\"/g;                                                                                                                                                  
     my @Addresses = Mail::Address->parse($Addr);
 
     my $AddrObj = $Addresses[0];

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm	Sat Nov 11 21:14:07 2006
@@ -325,13 +325,12 @@
         MIMEObj         => $MIMEObj
     );
     foreach my $arg (keys %ARGS) {
-            my $cfid = $1;
+        next if $arg =~ /-(?:Magic|Category)$/;
 
-            next if ($arg =~ /-Magic$/);
-       #Object-RT::Ticket--CustomField-3-Values
         if ($arg =~ /^Object-RT::Transaction--CustomField-/) {
             $create_args{$arg} = $ARGS{$arg};
         }
+        # Object-RT::Ticket--CustomField-3-Values
         elsif ($arg =~ /^Object-RT::Ticket--CustomField-(\d+)(.*?)$/) {
             my $cfid = $1;
             my $cf = RT::CustomField->new( $session{'CurrentUser'});

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	Sat Nov 11 21:14:07 2006
@@ -2999,10 +2999,12 @@
     my $NewOwner = shift;
     my $Type     = shift || "Give";
 
+    my $OldOwnerObj = $self->OwnerObj;
+
     # must have ModifyTicket rights
     # or TakeTicket/StealTicket and $NewOwner is self
     # see if it's a take
-    if ( $self->OwnerObj->Id == $RT::Nobody->Id ) {
+    if ( $OldOwnerObj->Id == $RT::Nobody->Id ) {
         unless (    $self->CurrentUserHasRight('ModifyTicket')
                  || $self->CurrentUserHasRight('TakeTicket') ) {
             return ( 0, $self->loc("Permission Denied") );
@@ -3010,8 +3012,8 @@
     }
 
     # see if it's a steal
-    elsif (    $self->OwnerObj->Id != $RT::Nobody->Id
-            && $self->OwnerObj->Id != $self->CurrentUser->id ) {
+    elsif (    $OldOwnerObj->Id != $RT::Nobody->Id
+            && $OldOwnerObj->Id != $self->CurrentUser->id ) {
 
         unless (    $self->CurrentUserHasRight('ModifyTicket')
                  || $self->CurrentUserHasRight('StealTicket') ) {
@@ -3023,22 +3025,19 @@
             return ( 0, $self->loc("Permission Denied") );
         }
     }
-    my $NewOwnerObj = RT::User->new( $self->CurrentUser );
-    my $OldOwnerObj = $self->OwnerObj;
 
-    $NewOwnerObj->Load($NewOwner);
-    if ( !$NewOwnerObj->Id ) {
+    my $NewOwnerObj = RT::User->new( $self->CurrentUser );
+    $NewOwnerObj->Load( $NewOwner );
+    unless ( $NewOwnerObj->Id ) {
         return ( 0, $self->loc("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
+    # If we're not stealing and the ticket has an owner and it's not 
+    # the current user
+    if ( $Type ne 'Steal' and $Type ne 'Force'
+         and $OldOwnerObj->Id != $RT::Nobody->Id
+         and $OldOwnerObj->Id != $self->CurrentUser->Id )
+    {
         return ( 0, $self->loc("You can only take tickets that are unowned") )
             if $NewOwnerObj->id == $self->CurrentUser->id;
         return (
@@ -3048,17 +3047,13 @@
     }
 
     #If we've specified a new owner and that user can't modify the ticket
-    elsif ( ( $NewOwnerObj->Id )
-            and ( !$NewOwnerObj->HasRight( Right  => 'OwnTicket',
-                                           Object => $self ) )
-      ) {
+    elsif ( !$NewOwnerObj->HasRight( Right => 'OwnTicket', Object => $self ) ) {
         return ( 0, $self->loc("That user may not own tickets 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 ) ) {
+    # If the ticket has an owner and it's the new owner, we don't need
+    # To do anything
+    elsif ( $NewOwnerObj->Id == $OldOwnerObj->Id ) {
         return ( 0, $self->loc("That user already owns that ticket") );
     }
 

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm	Sat Nov 11 21:14:07 2006
@@ -1694,6 +1694,77 @@
 
 # }}}
 
+
+=head2 WatchedQueues ROLE_LIST
+
+Returns a RT::Queues object containing every queue watched by the user.
+
+Takes a list of roles which is some subset of ('Cc', 'AdminCc').  Defaults to:
+
+$user->WatchedQueues('Cc', 'AdminCc');
+
+=cut
+
+sub WatchedQueues {
+
+    my $self = shift;
+    my @roles = @_ || ('Cc', 'AdminCc');
+
+    $RT::Logger->debug('WatcheQueues got user ' . $self->Name);
+
+    my $watched_queues = RT::Queues->new($self->CurrentUser);
+
+    my $group_alias = $watched_queues->Join(
+                                             ALIAS1 => 'main',
+                                             FIELD1 => 'id',
+                                             TABLE2 => 'Groups',
+                                             FIELD2 => 'Instance',
+                                           );
+
+    $watched_queues->Limit( 
+                            ALIAS => $group_alias,
+                            FIELD => 'Domain',
+                            VALUE => 'RT::Queue-Role',
+                            ENTRYAGGREGATOR => 'AND',
+                          );
+    if (grep { $_ eq 'Cc' } @roles) {
+        $watched_queues->Limit(
+                                SUBCLAUSE => 'LimitToWatchers',
+                                ALIAS => $group_alias,
+                                FIELD => 'Type',
+                                VALUE => 'Cc',
+                                ENTRYAGGREGATOR => 'OR',
+                              );
+    }
+    if (grep { $_ eq 'AdminCc' } @roles) {
+        $watched_queues->Limit(
+                                SUBCLAUSE => 'LimitToWatchers',
+                                ALIAS => $group_alias,
+                                FIELD => 'Type',
+                                VALUE => 'AdminCc',
+                                ENTRYAGGREGATOR => 'OR',
+                              );
+    }
+
+    my $queues_alias = $watched_queues->Join(
+                                              ALIAS1 => $group_alias,
+                                              FIELD1 => 'id',
+                                              TABLE2 => 'CachedGroupMembers',
+                                              FIELD2 => 'GroupId',
+                                            );
+    $watched_queues->Limit(
+                            ALIAS => $queues_alias,
+                            FIELD => 'MemberId',
+                            VALUE => $self->PrincipalId,
+                          );
+
+    $RT::Logger->debug("WatchedQueues got " . $watched_queues->Count . " queues");
+    
+    return $watched_queues;
+
+}
+
+
 # {{{ sub _CleanupInvalidDelegations
 
 =head2 _CleanupInvalidDelegations { InsideTransaction => undef }

Modified: rt/branches/3.7-EXPERIMENTAL/releng.cnf
==============================================================================


More information about the Rt-commit mailing list