[Rt-commit] r15941 - in rt/branches/3.999-DANGEROUS: lib/RT share/html

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Sep 12 07:31:01 EDT 2008


Author: sunnavy
Date: Fri Sep 12 07:30:59 2008
New Revision: 15941

Modified:
   rt/branches/3.999-DANGEROUS/   (props changed)
   rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm
   rt/branches/3.999-DANGEROUS/share/html/autohandler

Log:
 r16664 at sunnavys-mb:  sunnavy | 2008-09-12 18:48:08 +0800
 moved more stuff rom top autohandler to Dispatcher


Modified: rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm	Fri Sep 12 07:30:59 2008
@@ -64,6 +64,18 @@
 };
 
 before qr/.*/ => run {
+    if ( RT->install_mode ) {
+        my $path = Jifty->web->request->path;
+        if (   $path !~ RT->config->get('WebNoAuthRegex')
+            && $path !~ m{^(/+)Install/} && $path !~ m{^/+log(in|out)} )
+        {
+            RT::Interface::Web::redirect(
+                RT->config->get('WebURL') . "Install/index.html" );
+        }
+    }
+}
+
+before qr/.*/ => run {
     if ( int RT->config->get('AutoLogoff') ) {
         my $now = int( time / 60 );
 
@@ -132,6 +144,24 @@
 
 }
 
+before qr/.*/ => run {
+
+    my $args = Jifty->web->request->arguments;
+
+    # This code canonicalize_s time inputs in hours into minutes
+    foreach my $field ( keys %$args ) {
+        next unless $field =~ /^(.*)-TimeUnits$/i && $args->{$1};
+        my $local = $1;
+        $args->{$local} =~ s{\b (?: (\d+) \s+ )? (\d+)/(\d+) \b}
+                      {($1 || 0) + $3 ? $2 / $3 : 0}xe;
+        if ( $args->{$field} && $args->{$field} =~ /hours/i ) {
+            $args->{$local} *= 60;
+        }
+        delete $args->{$field};
+    }
+
+}
+
 after qr/.*/ => run {
     RT::Interface::Web::Handler::cleanup_request();
 };

Modified: rt/branches/3.999-DANGEROUS/share/html/autohandler
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/autohandler	(original)
+++ rt/branches/3.999-DANGEROUS/share/html/autohandler	Fri Sep 12 07:30:59 2008
@@ -46,32 +46,6 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
-use RT::Util;
-
-if (RT->install_mode) {
-  if  ( $m->base_comp->path =~ RT->config->get('WebNoAuthRegex') ) {
-    $m->call_next();
-  }
-  elsif ( $m->request_comp->path !~ '^(/+)Install/' ) {
-    RT::Interface::Web::redirect(RT->config->get('WebURL')."Install/index.html");
-    } else {
-        $m->call_next();
-    }
-    return;
-}
-  
-
-# This code canonicalize_s time inputs in hours into minutes
-foreach my $field ( keys %ARGS ) {
-    next unless $field =~ /^(.*)-TimeUnits$/i && $ARGS{ $1 };
-    my $local = $1;
-    $ARGS{$local} =~ s{\b (?: (\d+) \s+ )? (\d+)/(\d+) \b}
-                      {($1 || 0) + $3 ? $2 / $3 : 0}xe;
-    if ( $ARGS{$field} && $ARGS{$field} =~ /hours/i ) {
-        $ARGS{$local} *= 60;
-    }
-    delete $ARGS{$field};
-}
 
 $m->call_next();
 


More information about the Rt-commit mailing list