[Rt-commit] [svn] r1233 - in rt/branches/3.3-TESTING: . bin etc html/Admin/Elements html/Elements html/Search lib/RT lib/RT/Action lib/RT/Condition lib/RT/I18N lib/RT/Interface lib/RT/Interface/Web

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Wed Jul 14 00:37:57 EDT 2004


Author: jesse
Date: Wed Jul 14 00:37:55 2004
New Revision: 1233

Added:
   rt/branches/3.3-TESTING/lib/RT/Interface/Web/
   rt/branches/3.3-TESTING/lib/RT/Interface/Web/Handler.pm
Modified:
   rt/branches/3.3-TESTING/   (props changed)
   rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in
   rt/branches/3.3-TESTING/bin/mason_handler.scgi.in
   rt/branches/3.3-TESTING/bin/mason_handler.svc.in
   rt/branches/3.3-TESTING/bin/webmux.pl.in
   rt/branches/3.3-TESTING/etc/schema.Sybase
   rt/branches/3.3-TESTING/html/Admin/Elements/EditScrip
   rt/branches/3.3-TESTING/html/Elements/Header
   rt/branches/3.3-TESTING/html/Elements/TicketList
   rt/branches/3.3-TESTING/html/Search/Build.html
   rt/branches/3.3-TESTING/html/Search/Bulk.html
   rt/branches/3.3-TESTING/lib/RT/Action/CreateTickets.pm
   rt/branches/3.3-TESTING/lib/RT/Action/Generic.pm
   rt/branches/3.3-TESTING/lib/RT/Condition/Generic.pm
   rt/branches/3.3-TESTING/lib/RT/I18N/it.po
   rt/branches/3.3-TESTING/lib/RT/Interface/Web.pm
   rt/branches/3.3-TESTING/lib/RT/ScripAction_Overlay.pm
   rt/branches/3.3-TESTING/lib/RT/ScripCondition_Overlay.pm
   rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm
   rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm
Log:
 ----------------------------------------------------------------------
 r3374 at tinbook:  jesse | 2004-07-13T23:31:39.996661Z
 
 Merge forward from RT 3.2
 ----------------------------------------------------------------------
 r3375 at tinbook:  jesse | 2004-07-14T04:33:29.296451Z
 
 Minor fixes for a merge problem from 3.2
 ----------------------------------------------------------------------


Modified: rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in	(original)
+++ rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in	Wed Jul 14 00:37:55 2004
@@ -23,12 +23,13 @@
 # 
 # END LICENSE BLOCK
 
+package RT::Mason;
+
 use strict;
+use vars '$Handler';
 use File::Basename;
 require ('@RT_BIN_PATH@/webmux.pl');
 
-my $h = &RT::Interface::Web::NewCGIHandler(@RT::MasonParameters);
-
 # Enter CGI::Fast mode, which should also work as a vanilla CGI script.
 require CGI::Fast;
 
@@ -45,12 +46,12 @@
 
     RT::ConnectToDatabase();
 
-    if ( ( !$h->interp->comp_exists( $cgi->path_info ) )
-        && ( $h->interp->comp_exists( $cgi->path_info . "/index.html" ) ) ) {
+    if ( ( !$Handler->interp->comp_exists( $cgi->path_info ) )
+        && ( $Handler->interp->comp_exists( $cgi->path_info . "/index.html" ) ) ) {
         $cgi->path_info( $cgi->path_info . "/index.html" );
     }
 
-    eval { $h->handle_cgi_object($cgi); };
+    eval { $Handler->handle_cgi_object($cgi); };
     if ($@) {
         $RT::Logger->crit($@);
     }

Modified: rt/branches/3.3-TESTING/bin/mason_handler.scgi.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/mason_handler.scgi.in	(original)
+++ rt/branches/3.3-TESTING/bin/mason_handler.scgi.in	Wed Jul 14 00:37:55 2004
@@ -23,21 +23,22 @@
 # 
 # END LICENSE BLOCK
 
+package RT::Mason;
+
 use strict;
+use vars '$Handler';
 require ('@RT_BIN_PATH@/webmux.pl');
 
-my $h = &RT::Interface::Web::NewCGIHandler(@RT::MasonParameters);
-
 require CGI;
 
 RT::Init();
 
 my $cgi = CGI->new;
-if ( ( !$h->interp->comp_exists( $cgi->path_info ) )
-    && ( $h->interp->comp_exists( $cgi->path_info . "/index.html" ) ) ) {
+if ( ( !$Handler->interp->comp_exists( $cgi->path_info ) )
+    && ( $Handler->interp->comp_exists( $cgi->path_info . "/index.html" ) ) ) {
     $cgi->path_info( $cgi->path_info . "/index.html" );
 }
 
-$h->handle_cgi_object($cgi);
+$Handler->handle_cgi_object($cgi);
 
 1;

Modified: rt/branches/3.3-TESTING/bin/mason_handler.svc.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/mason_handler.svc.in	(original)
+++ rt/branches/3.3-TESTING/bin/mason_handler.svc.in	Wed Jul 14 00:37:55 2004
@@ -55,8 +55,11 @@
 
 =cut
 
+package RT::Mason;
+
 use strict;
 use File::Basename;
+use vars '$Handler';
 require (dirname(__FILE__) . '/webmux.pl');
 
 use Cwd;
@@ -197,7 +200,6 @@
 warn "Begin listening on $ENV{'FCGI_SOCKET_PATH'}\n";
 
 require CGI::Fast;
-my $h = &RT::Interface::Web::NewCGIHandler(@RT::MasonParameters);
 
 RT::Init();
 
@@ -212,7 +214,7 @@
     
     warn "Serving $comp\n";
 
-    $h->handle_cgi($comp);
+    $Handler->handle_cgi($comp);
     # _should_ always be tied
 }
 

Modified: rt/branches/3.3-TESTING/bin/webmux.pl.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/webmux.pl.in	(original)
+++ rt/branches/3.3-TESTING/bin/webmux.pl.in	Wed Jul 14 00:37:55 2004
@@ -34,7 +34,9 @@
 
     eval { require Apache2; require APR::Table; require MasonX::Apache2Handler; 1 } or
     eval { require Apache2; require Apache::compat; 1 } or die $@
-        if $ENV{'MOD_PERL'} and $ENV{'MOD_PERL'} =~ m{mod_perl/(?:2|1\.9)};
+      if $ENV{'MOD_PERL'}
+      and $ENV{'MOD_PERL'} =~ m{mod_perl/(?:2|1\.9)};
+
 }
 
 use lib ( "@LOCAL_LIB_PATH@", "@RT_LIB_PATH@" );
@@ -45,36 +47,9 @@
 use CGI qw(-private_tempfiles);    #bring this in before mason, to make sure we
                                    #set private_tempfiles
 
-BEGIN {
-    if ($MasonX::Apache2Handler::VERSION) {
-        $RT::MasonHandlerClass = 'MasonX::Apache2Handler';
-    }
-    elsif ($mod_perl::VERSION && ($mod_perl::VERSION >= 1.9908)) {
-	require Apache::RequestUtil;
-	no warnings 'redefine';
-	my $sub = *Apache::request{CODE};
-	*Apache::request = sub {
-	    my $r;
-	    eval { $r = $sub->('Apache'); };
-	    # warn $@ if $@;
-	    return $r;
-	};
-	require HTML::Mason::ApacheHandler;
-        $RT::MasonHandlerClass = 'HTML::Mason::ApacheHandler';
-    }
-    elsif ($CGI::MOD_PERL) {
-	require HTML::Mason::ApacheHandler;
-        $RT::MasonHandlerClass = 'HTML::Mason::ApacheHandler';
-    }
-    else {
-	require HTML::Mason::CGIHandler;
-        $RT::MasonHandlerClass = 'HTML::Mason::CGIHandler';
-    }
-}
-
 use HTML::Mason;    # brings in subpackages: Parser, Interp, etc.
 
-use vars qw($Nobody $SystemUser $r);
+use vars qw($Nobody $SystemUser $Handler $r);
 
 #This drags in RT's config.pm
 RT::LoadConfig();
@@ -96,28 +71,8 @@
     use Text::Quoted;
 }
 
-# Activate the following if running httpd as root (the normal case).
-# Resets ownership of all files created by Mason at startup.
-# Note that mysql uses DB for sessions, so there's no need to do this.
-unless ( $RT::DatabaseType =~ /(mysql|Pg)/ ) {
-
-    # Clean up our umask to protect session files
-    umask(0077);
-
-    if ($CGI::MOD_PERL) {
-        chown( Apache->server->uid, Apache->server->gid,
-            [$RT::MasonSessionDir] )
-          if Apache->server->can('uid');
-    }
-
-    # 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 _ ) );
-}
-
-my $ah = &RT::Interface::Web::NewApacheHandler(@RT::MasonParameters)
-  if $CGI::MOD_PERL;
+use RT::Interface::Web::Handler;
+$Handler = RT::Interface::Web::Handler->new(@RT::MasonParameters);
 
 sub handler {
     ($r) = @_;
@@ -132,7 +87,7 @@
 
     my %session;
     my $status;
-    eval { $status = $ah->handle_request($r) };
+    eval { $status = $Handler->handle_request($r) };
     if ($@) {
         $RT::Logger->crit($@);
     }

Modified: rt/branches/3.3-TESTING/etc/schema.Sybase
==============================================================================
--- rt/branches/3.3-TESTING/etc/schema.Sybase	(original)
+++ rt/branches/3.3-TESTING/etc/schema.Sybase	Wed Jul 14 00:37:55 2004
@@ -1,5 +1,3 @@
-NEEDS UPDATE FOR 3.3
-
 # {{{ Attachments
 
 CREATE TABLE rt3.Attachments (

Modified: rt/branches/3.3-TESTING/html/Admin/Elements/EditScrip
==============================================================================
--- rt/branches/3.3-TESTING/html/Admin/Elements/EditScrip	(original)
+++ rt/branches/3.3-TESTING/html/Admin/Elements/EditScrip	Wed Jul 14 00:37:55 2004
@@ -109,7 +109,6 @@
 
 <& /Elements/Submit, Label => loc('Create'), Reset => 1 &>
 
-
 </FORM>
 <%init>
 my (@actions);

Modified: rt/branches/3.3-TESTING/html/Elements/Header
==============================================================================
--- rt/branches/3.3-TESTING/html/Elements/Header	(original)
+++ rt/branches/3.3-TESTING/html/Elements/Header	Wed Jul 14 00:37:55 2004
@@ -31,11 +31,6 @@
 
 <link rel="shortcut icon" href="<%$RT::WebImagesURL%>/favicon.png" type="image/png">
 <link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/webrt.css" type="text/css">
-<link rel="" href="<%$RT::WebImagesURL%>/favicon.png" type="image/png">
-% foreach my $service (qw( Feed Post Edit )) {
-%     my $uri = $ARGS{$service."URI"} or next;
-<link rel="service.<% lc($service) %>" type="application/x.atom+xml" href="<% $RT::WebPath %>/REST/2.0/<% $uri %>" title="Atom <% $service %>" />
-% }
 <script>
 function hideshow(num) {
     idstring = "element-" + num;

Modified: rt/branches/3.3-TESTING/html/Elements/TicketList
==============================================================================
--- rt/branches/3.3-TESTING/html/Elements/TicketList	(original)
+++ rt/branches/3.3-TESTING/html/Elements/TicketList	Wed Jul 14 00:37:55 2004
@@ -152,7 +152,7 @@
     },
     Subject => {
         attribute => 'Subject',
-        value => sub { return $_[0]->Subject || "(".loc('No subject').")" }
+        value => sub { length( $_[0]->Subject) ? $_[0]->Subject : "(".loc('No subject').")" }
     },
     ExtendedStatus => {
         title => 'Status',

Modified: rt/branches/3.3-TESTING/html/Search/Build.html
==============================================================================
--- rt/branches/3.3-TESTING/html/Search/Build.html	(original)
+++ rt/branches/3.3-TESTING/html/Search/Build.html	Wed Jul 14 00:37:55 2004
@@ -244,7 +244,6 @@
 	if ($currentkey) {
 	    my $newindex = $currentkey->getIndex() + 1;
 	    if (!$currentkey->getParent->getParent()->isRoot()) {
-		$currentkey->getParent()->setNodeValue($ARGS{'AndOr'});
 	    }
 	    $currentkey->insertSibling($newindex, $newnode);
 	    $currentkey = $newnode;
@@ -253,6 +252,7 @@
 	    $tree->getChild(0)->addChild($newnode);
 	    $currentkey = $newnode;
 	}
+	$newnode->getParent()->setNodeValue($ARGS{'AndOr'});
     }
 }
 # }}}

Modified: rt/branches/3.3-TESTING/html/Search/Bulk.html
==============================================================================
--- rt/branches/3.3-TESTING/html/Search/Bulk.html	(original)
+++ rt/branches/3.3-TESTING/html/Search/Bulk.html	Wed Jul 14 00:37:55 2004
@@ -182,12 +182,11 @@
 
 #Iterate through each ticket we've been handed
 my @linkresults;
+my %queues;
 
 $Tickets->RedoSearch();
-
-my %queues;
 while (my $Ticket = $Tickets->Next) {
-    $queues{$Ticket->Queue}++;
+    $queues{$Ticket->QueueObj->Id}++;
     $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n");
     next unless ($ARGS{"UpdateTicket".$Ticket->Id});
     $RT::Logger->debug ("Matched\n");

Modified: rt/branches/3.3-TESTING/lib/RT/Action/CreateTickets.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Action/CreateTickets.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Action/CreateTickets.pm	Wed Jul 14 00:37:55 2004
@@ -280,7 +280,7 @@
 is ($t->ReferredToBy->Count,1, "It's only referred to by one other ticket");
 is ($t->ReferredToBy->First->BaseObj->Id,$t->DependsOn->First->TargetObj->Id, "The same ticket that depends on it refers to it.");
 use RT::Action::CreateTickets;
-my $action = new RT::Action::CreateTickets;
+my $action =  RT::Action::CreateTickets->new( CurrentUser => $RT::SystemUser);;
 
 # comma-delimited templates
 my $commas = <<"EOF";
@@ -291,6 +291,19 @@
 ticket4,General,foo' bar,,blah'boo
 EOF
 
+
+# Comma delimited templates with missing data
+my $sparse_commas = <<"EOF";
+id,Queue,Subject,Owner,Requestor
+ticket14,General,,,bobby
+ticket15,General,,,tommy
+ticket16,General,,suzie,tommy
+ticket17,General,Foo "bar" baz,suzie,tommy
+ticket18,General,'Foo "bar" baz',suzie,tommy
+ticket19,General,'Foo bar' baz,suzie,tommy
+EOF
+
+
 # tab-delimited templates
 my $tabs = <<"EOF";
 id\tQueue\tSubject\tOwner\tContent
@@ -366,7 +379,49 @@
 ENDOFCONTENT
 EOF
 
+
+$expected{'ticket14'} = <<EOF;
+Queue: General
+Subject: 
+Owner: 
+Requestor: bobby
+EOF
+$expected{'ticket15'} = <<EOF;
+Queue: General
+Subject: 
+Owner: 
+Requestor: tommy
+EOF
+$expected{'ticket16'} = <<EOF;
+Queue: General
+Subject: 
+Owner: suzie
+Requestor: tommy
+EOF
+$expected{'ticket17'} = <<EOF;
+Queue: General
+Subject: Foo "bar" baz
+Owner: suzie
+Requestor: tommy
+EOF
+$expected{'ticket18'} = <<EOF;
+Queue: General
+Subject: Foo "bar" baz
+Owner: suzie
+Requestor: tommy
+EOF
+$expected{'ticket19'} = <<EOF;
+Queue: General
+Subject: 'Foo bar' baz
+Owner: suzie
+Requestor: tommy
+EOF
+
+
+
+
 $action->Parse(Content =>$commas);
+$action->Parse(Content =>$sparse_commas);
 $action->Parse(Content => $tabs);
 
 my %got;
@@ -374,7 +429,7 @@
   $got{$_} = $action->{'templates'}->{$_};
 }
 
-foreach my $id ( keys %expected ) {
+foreach my $id ( sort keys %expected ) {
     ok(exists($got{"create-$id"}), "template exists for $id");
     is($got{"create-$id"}, $expected{$id}, "template is correct for $id");
 }
@@ -600,18 +655,20 @@
         $template_id =~ m/^update-(.*)/;
         my $base_id = "base-$1";
         my $base    = $self->{'templates'}->{$base_id};
+        if ($base) {
         $base    =~ s/\r//g;
         $base    =~ s/\n+$//;
         $current =~ s/\n+$//;
 
-        if ( $base ne $current ) {
+        # If we have no base template, set what we can.
+        if ($base ne $current)  {
             push @results,
               "Could not update ticket "
               . $T::Tickets{$template_id}->Id
               . ": Ticket has changed";
             next;
         }
-
+        }
         push @results, $T::Tickets{$template_id}->Update(
             AttributesRef => \@attribs,
             ARGSRef       => $ticketargs
@@ -728,7 +785,7 @@
                     my $value = $1;
                     $value =~ s/^\s//;
                     $value =~ s/\s$//;
-                    if ( !$value ) {
+                    if ( !$value && $args{'Queue'}) {
                         $value = $args{'Queue'};
                         $line  = "Queue: $value";
                     }
@@ -738,7 +795,7 @@
                     my $value = $1;
                     $value =~ s/^\s//;
                     $value =~ s/\s$//;
-                    if ( !$value ) {
+                    if ( !$value && $args{'Requestor'}) {
                         $value = $args{'Requestor'};
                         $line  = "Requestor: $value";
                     }
@@ -760,10 +817,13 @@
         else {
             $delimiter = ',';
         }
-        my $delimited = qr[[^$delimiter]+];
         my @fields    = split( /$delimiter/, $first );
-        my $empty     = qr[[$delimiter][$delimiter]];
+        
 
+        my $delimiter_re = qr[$delimiter];
+
+        my $delimited = qr[[^$delimiter]+];
+        my $empty     = qr[^[$delimiter](?=[$delimiter])];
         my $justquoted = qr[$RE{quoted}];
 
         $args{'Content'} = substr( $args{'Content'}, index( $args{'Content'}, "\n" ) + 1 );
@@ -777,7 +837,7 @@
             # first item is $template_id
             my $i = 0;
             my $template_id;
-            while ( $line =~ /($justquoted|$delimited|$empty)/igx ) {
+            while ($line && $line =~ s/^($justquoted|.*?)(?:$delimiter_re|$)//ix) {
                 if ( $i == 0 ) {
                     $queue     = 0;
                     $requestor = 0;
@@ -785,16 +845,29 @@
                     $tid =~ s/^\s//;
                     $tid =~ s/\s$//;
                     next unless $tid;
-                    $template_id = 'create-' . $tid;
+                   
+                     
+                    if ($tid =~ /^\d+$/) {
+                        $template_id = 'update-' . $tid;
+                        push @{ $self->{'update_tickets'} }, $template_id;
+
+                    } elsif ($tid =~ /^#base-(\d+)$/) {
+
+                        $template_id = 'base-' . $1;
+                        push @{ $self->{'base_tickets'} }, $template_id;
+
+                    } else {
+                        $template_id = 'create-' . $tid;
+                        push @{ $self->{'create_tickets'} }, $template_id;
+                    }
                     $RT::Logger->debug("template_id: $tid");
-                    push @{ $self->{'create_tickets'} }, $template_id;
                 }
                 else {
                     my $value = $1;
-                    $value = '' if ( $value =~ /^$empty$/ );
-                    if ( $value =~ /$justquoted/ ) {
-                        $value =~ s/^\"|\'//;
-                        $value =~ s/\"|\'$//;
+                    $value = '' if ( $value =~ /^$delimiter$/ );
+                    if ($value =~ /^$RE{delimited}{-delim=>qq{\'\"}}$/) {
+                        substr($value,0,1) = "";
+                    substr($value,-1,1) = "";
                     }
                     my $field = $fields[$i];
                     next unless $field;
@@ -811,13 +884,13 @@
                     }
                     if ( $field =~ /Queue/i ) {
                         $queue = 1;
-                        if ( !$value ) {
+                        if ( !$value && $args{'Queue'} ) {
                             $value = $args{'Queue'};
                         }
                     }
                     if ( $field =~ /Requestor/i ) {
                         $requestor = 1;
-                        if ( !$value ) {
+                        if ( !$value && $args{'Requestor'} ) {
                             $value = $args{'Requestor'};
                         }
                     }
@@ -826,7 +899,6 @@
                     $self->{'templates'}->{$template_id} .= "\n";
                     $self->{'templates'}->{$template_id} .= "ENDOFCONTENT\n"
                       if $field =~ /content/i;
-                    $RT::Logger->debug( $field . ": $1" );
                 }
                 $i++;
             }
@@ -881,12 +953,12 @@
         }
     }
     
-    my $TicketObj ||= RT::Ticket->new($RT::SystemUser);
+    my $TicketObj ||= RT::Ticket->new($self->CurrentUser);
 
     my %args;
     my @lines = ( split( /\n/, $content ) );
     while ( defined( my $line = shift @lines ) ) {
-        if ( $line =~ /^(.*?):(?:\s+(.*))?$/ ) {
+        if ( $line =~ /^(.*?):(?:\s+)(.*?)(?:\s*)$/ ) {
             my $value = $2;
             my $tag   = lc($1);
             $tag =~ s/-//g;
@@ -923,7 +995,7 @@
     }
 
     foreach my $date qw(due starts started resolved) {
-        my $dateobj = RT::Date->new($RT::SystemUser);
+        my $dateobj = RT::Date->new($self->CurrentUser);
         next unless $args{$date};
         if ( $args{$date} =~ /^\d+$/ ) {
             $dateobj->Set( Format => 'unix', Value => $args{$date} );
@@ -1134,6 +1206,10 @@
     foreach my $type qw(Requestor Cc AdminCc) {
         my $method  = $type . 'Addresses';
         my $oldaddr = $ticket->$method;
+    
+    
+        # Skip unless we have a defined field
+        next unless defined $args->{$type};
         my $newaddr = $args->{$type};
 
         my @old = split( ', ', $oldaddr );

Modified: rt/branches/3.3-TESTING/lib/RT/Action/Generic.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Action/Generic.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Action/Generic.pm	Wed Jul 14 00:37:55 2004
@@ -46,6 +46,8 @@
 use strict;
 use Scalar::Util;
 
+use base qw/RT::Base/;
+
 # {{{ sub new 
 sub new  {
   my $proto = shift;
@@ -57,13 +59,6 @@
 }
 # }}}
 
-# {{{ sub new 
-sub loc {
-    my $self = shift;
-    return $self->{'ScripObj'}->loc(@_);
-}
-# }}}
-
 # {{{ sub _Init 
 sub _Init  {
   my $self = shift;
@@ -73,6 +68,7 @@
 	       TemplateObj => undef,
 	       Argument => undef,
 	       Type => undef,
+            CurrentUser => undef,
 	       @_ );
   
   
@@ -82,6 +78,7 @@
   $self->{'TransactionObj'} = $args{'TransactionObj'};
   $self->{'TemplateObj'} = $args{'TemplateObj'};
   $self->{'Type'} = $args{'Type'};
+  $self->CurrentUser( $args{'CurrentUser'});
     Scalar::Util::weaken($self->{'ScripObj'});
     Scalar::Util::weaken($self->{'TicketObj'});
     Scalar::Util::weaken($self->{'TemplateObj'});

Modified: rt/branches/3.3-TESTING/lib/RT/Condition/Generic.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Condition/Generic.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Condition/Generic.pm	Wed Jul 14 00:37:55 2004
@@ -21,6 +21,7 @@
 # 
 # 
 # END LICENSE BLOCK
+
 =head1 NAME
 
   RT::Condition::Generic - ;
@@ -57,10 +58,8 @@
 
 package RT::Condition::Generic;
 
-use RT::Base;
 use strict;
-use vars qw/@ISA/;
- at ISA = qw(RT::Base);
+use base qw/RT::Base/;
 
 # {{{ sub new 
 sub new  {
@@ -82,6 +81,7 @@
 	       TemplateObj => undef,
 	       Argument => undef,
 	       ApplicableTransTypes => undef,
+           CurrentUser => undef,
 	       @_ );
   
   $self->{'Argument'} = $args{'Argument'};
@@ -89,6 +89,7 @@
   $self->{'TicketObj'} = $args{'TicketObj'};
   $self->{'TransactionObj'} = $args{'TransactionObj'};
   $self->{'ApplicableTransTypes'} = $args{'ApplicableTransTypes'};
+  $self->CurrentUser($args{'CurrentUser'});
 }
 # }}}
 

Modified: rt/branches/3.3-TESTING/lib/RT/I18N/it.po
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/I18N/it.po	(original)
+++ rt/branches/3.3-TESTING/lib/RT/I18N/it.po	Wed Jul 14 00:37:55 2004
@@ -440,7 +440,7 @@
 msgstr ""
 
 #: html/Ticket/Create.html:178
-msgid "(Enter ticket ids or URLs, seperated with spaces)"
+msgid "(Enter ticket ids or URLs, separated with spaces)"
 msgstr "(Inserire il numero di tickets o gli URL, separati da spazi)"
 
 #: NOT FOUND IN SOURCE

Modified: rt/branches/3.3-TESTING/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Interface/Web.pm	Wed Jul 14 00:37:55 2004
@@ -45,63 +45,6 @@
 
 
 
-my @DefaultHandlerArgs = (
-
-    comp_root => [
-        [ local    => $RT::MasonLocalComponentRoot ],
-        [ standard => $RT::MasonComponentRoot ]
-    ],
-    default_escape_flags => 'h',
-    data_dir             => "$RT::MasonDataDir",
-    allow_globals        => [qw(%session)],
-    autoflush            => 1
-
-);
-
-# {{{ sub NewApacheHandler 
-
-=head2 NewApacheHandler
-
-  Takes extra options to pass to HTML::Mason::ApacheHandler->new
-  Returns a new Mason::ApacheHandler object
-
-=cut
-
-sub NewApacheHandler {
-    require HTML::Mason::ApacheHandler;
-    return RT::Interface::Web::NewHandler('HTML::Mason::ApacheHandler',
-                                            args_method => "CGI",
-                                            @_);
-}
-
-# }}}
-
-# {{{ sub NewCGIHandler 
-
-=head2 NewCGIHandler
-
-  Returns a new Mason::CGIHandler object
-
-=cut
-
-sub NewCGIHandler {
-    return RT::Interface::Web::NewHandler('HTML::Mason::CGIHandler', at _);
-}
-
-sub NewHandler {
-    my $class = shift;
-    my $handler = $class->new(
-        @DefaultHandlerArgs,
-        @_
-    );
-  
-    $handler->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 );
-    return($handler);
-}
-
-# }}}
-
-
 # {{{ EscapeUTF8
 
 =head2 EscapeUTF8 SCALARREF
@@ -1275,8 +1218,8 @@
         }
 
         # Delete watchers in the simple style demanded by the bulk manipulator
-        elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
-            my ( $code, $msg ) = $Ticket->DeleteWatcher( Type => $ARGSRef->{$key}, PrincipalId => $1 );
+        elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {	    
+            my ( $code, $msg ) = $Ticket->DeleteWatcher( Email => $ARGSRef->{$key}, Type => $1 );
             push @results, $msg;
         }
 

Added: rt/branches/3.3-TESTING/lib/RT/Interface/Web/Handler.pm
==============================================================================
--- (empty file)
+++ rt/branches/3.3-TESTING/lib/RT/Interface/Web/Handler.pm	Wed Jul 14 00:37:55 2004
@@ -0,0 +1,133 @@
+package RT::Interface::Web::Handler;
+
+sub DefaultHandlerArgs  { (
+    comp_root => [
+        [ local    => $RT::MasonLocalComponentRoot ],
+        [ standard => $RT::MasonComponentRoot ]
+    ],
+    default_escape_flags => 'h',
+    data_dir             => "$RT::MasonDataDir",
+    allow_globals        => [qw(%session)],
+    autoflush            => 1
+) };
+
+# {{{ sub new 
+
+=head2 new
+
+  Constructs a web handler of the appropriate class.
+  Takes options to pass to the constructor.
+
+=cut
+
+sub new {
+    my $class = shift;
+    $class->InitSessionDir;
+
+    if ($MasonX::Apache2Handler::VERSION) {
+        goto &NewApache2Handler;
+    }
+    elsif ($mod_perl::VERSION >= 1.9908) {
+	require Apache::RequestUtil;
+	no warnings 'redefine';
+	my $sub = *Apache::request{CODE};
+	*Apache::request = sub {
+	    my $r;
+	    eval { $r = $sub->('Apache'); };
+	    # warn $@ if $@;
+	    return $r;
+	};
+        goto &NewApacheHandler;
+    }
+    elsif ($CGI::MOD_PERL) {
+        goto &NewApacheHandler;
+    }
+    else {
+        goto &NewCGIHandler;
+    }
+}
+
+sub InitSessionDir {
+    # Activate the following if running httpd as root (the normal case).
+    # Resets ownership of all files created by Mason at startup.
+    # Note that mysql uses DB for sessions, so there's no need to do this.
+    unless ( $RT::DatabaseType =~ /(mysql|Pg)/ ) {
+
+        # Clean up our umask to protect session files
+        umask(0077);
+
+        if ($CGI::MOD_PERL) {
+            chown( Apache->server->uid, Apache->server->gid,
+                [$RT::MasonSessionDir] )
+            if Apache->server->can('uid');
+        }
+
+        # 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 NewApacheHandler 
+
+=head2 NewApacheHandler
+
+  Takes extra options to pass to HTML::Mason::ApacheHandler->new
+  Returns a new Mason::ApacheHandler object
+
+=cut
+
+sub NewApacheHandler {
+    require HTML::Mason::ApacheHandler;
+    return NewHandler('HTML::Mason::ApacheHandler', args_method => "CGI", @_);
+}
+
+# }}}
+
+# {{{ sub NewApache2Handler 
+
+=head2 NewApache2Handler
+
+  Takes extra options to pass to MasonX::Apache2Handler->new
+  Returns a new MasonX::Apache2Handler object
+
+=cut
+
+sub NewApache2Handler {
+    require MasonX::Apache2Handler;
+    return NewHandler('MasonX::Apache2Handler', args_method => "CGI", @_);
+}
+
+# }}}
+
+# {{{ sub NewCGIHandler 
+
+=head2 NewCGIHandler
+
+  Returns a new Mason::CGIHandler object
+
+=cut
+
+sub NewCGIHandler {
+    require HTML::Mason::CGIHandler;
+    return NewHandler('HTML::Mason::CGIHandler', @_);
+}
+
+sub NewHandler {
+    my $class = shift;
+    my $handler = $class->new(
+        DefaultHandlerArgs(),
+        @_
+    );
+  
+    $handler->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 );
+    return($handler);
+}
+
+# }}}
+
+1;

Modified: rt/branches/3.3-TESTING/lib/RT/ScripAction_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/ScripAction_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/ScripAction_Overlay.pm	Wed Jul 14 00:37:55 2004
@@ -144,6 +144,7 @@
 				      TransactionObj => $args{'TransactionObj'},
 				      TemplateObj => $self->TemplateObj,
 				      Argument => $self->Argument,
+                      CurrentUser => $self->CurrentUser
 				    );
 }
 # }}}

Modified: rt/branches/3.3-TESTING/lib/RT/ScripCondition_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/ScripCondition_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/ScripCondition_Overlay.pm	Wed Jul 14 00:37:55 2004
@@ -157,7 +157,8 @@
 					 'ScripObj' => $args{'ScripObj'},
 					 'TransactionObj' => $args{'TransactionObj'},
 					 'Argument' => $self->Argument,
-					 'ApplicableTransTypes' => $self->ApplicableTransTypes,
+				     'ApplicableTransTypes' => $self->ApplicableTransTypes,
+                     CurrentUser => $self->CurrentUser 
 				       );
 }
 # }}}

Modified: rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm	Wed Jul 14 00:37:55 2004
@@ -458,7 +458,7 @@
     }
 
     #If we've been handed something else, try to load the user.
-    elsif ( defined $args{'Owner'} ) {
+    elsif ( $args{'Owner'} ) {
         $Owner = RT::User->new( $self->CurrentUser );
         $Owner->Load( $args{'Owner'} );
 

Modified: rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm	Wed Jul 14 00:37:55 2004
@@ -126,7 +126,7 @@
     WATCHERFIELD    => \&_WatcherLimit,
     MEMBERSHIPFIELD => \&_WatcherMembershipLimit,
     LINKFIELD	    => \&_LinkFieldLimit,
-    CUSTOMFIELD     => \&_CustomFieldLimit,
+    CUSTOMFIELD    => \&_CustomFieldLimit,
   );
 my %can_bundle =
   ( WATCHERFIELD => "yeps",
@@ -823,17 +823,17 @@
 sub _CustomFieldLimit {
     my ( $self, $_field, $op, $value, @rest ) = @_;
 
-    my %rest  = @rest;
-    my $field = $rest{SUBKEY} || die "No field specified";
+  my %rest = @rest;
+  my $field = $rest{SUBKEY} || die "No field specified";
 
-    # For our sanity, we can only limit on one queue at a time
-    my $queue = 0;
+  # For our sanity, we can only limit on one queue at a time
+  my $queue = 0;
 
     if ( $field =~ /^(.+?)\.{(.+)}$/ ) {
         $queue = $1;
-        $field = $2;
-    }
-    $field = $1 if $field =~ /^{(.+)}$/;    # trim { }
+    $field = $2;
+   }
+    $field = $1 if $field =~ /^{(.+)}$/; # trim { }
 
 
 
@@ -866,10 +866,10 @@
 
     my $TicketCFs;
 
-    # Perform one Join per CustomField
+  # Perform one Join per CustomField
     if ( $self->{_sql_keywordalias}{$cfid} ) {
-        $TicketCFs = $self->{_sql_keywordalias}{$cfid};
-    }
+    $TicketCFs = $self->{_sql_keywordalias}{$cfid};
+  }
     else {
         $TicketCFs = $self->{_sql_keywordalias}{$cfid} = $self->_SQLJoin(
             TYPE   => 'left',
@@ -914,9 +914,9 @@
             QUOTEVALUE      => 0,
             ENTRYAGGREGATOR => 'OR',
         );
-    }
+  }
 
-    $self->_CloseParen;
+  $self->_CloseParen;
 
 }
 


More information about the Rt-commit mailing list