address root cause of rt/rt links and remove the workarounds, RT#9280
authorivan <ivan>
Sun, 15 Aug 2010 00:44:55 +0000 (00:44 +0000)
committerivan <ivan>
Sun, 15 Aug 2010 00:44:55 +0000 (00:44 +0000)
FS/FS/Mason.pm
FS/FS/Mason/Request.pm
htetc/freeside-rt.conf
htetc/handler.pl
rt/FREESIDE_MODIFIED
rt/share/html/Admin/Elements/EditCustomFields
rt/share/html/Elements/ColumnMap
rt/share/html/Elements/RT__CustomField/ColumnMap
rt/share/html/Elements/RefreshHomepage
rt/share/html/Ticket/Graphs/index.html

index f5d7c85..7be78aa 100644 (file)
@@ -453,7 +453,7 @@ sub mason_interps {
     RT::LoadConfig();
   }
 
     RT::LoadConfig();
   }
 
-  # A hook supporting strange legacy ways people have added stuff on
+  # A hook supporting strange legacy ways people (well, SG) have added stuff on
 
   my @addl_comp_root = ();
   my $addl_comp_root_file = '%%%FREESIDE_CONF%%%/addl_comp_root.pl';
 
   my @addl_comp_root = ();
   my $addl_comp_root_file = '%%%FREESIDE_CONF%%%/addl_comp_root.pl';
@@ -468,17 +468,20 @@ sub mason_interps {
     }
   }
 
     }
   }
 
+  my $fs_comp_root =
+    scalar(@addl_comp_root)
+      ? [
+          [ 'freeside'=>'%%%FREESIDE_DOCUMENT_ROOT%%%' ],
+          @addl_comp_root,
+        ]
+      : '%%%FREESIDE_DOCUMENT_ROOT%%%';
+
   my %interp = (
     request_class        => $request_class,
     data_dir             => '%%%MASONDATA%%%',
     error_mode           => 'output',
     error_format         => 'html',
     ignore_warnings_expr => '.',
   my %interp = (
     request_class        => $request_class,
     data_dir             => '%%%MASONDATA%%%',
     error_mode           => 'output',
     error_format         => 'html',
     ignore_warnings_expr => '.',
-    comp_root            => [
-                              [ 'freeside'=>'%%%FREESIDE_DOCUMENT_ROOT%%%'    ],
-                              [ 'rt'      =>'%%%FREESIDE_DOCUMENT_ROOT%%%/rt' ],
-                              @addl_comp_root,
-                            ],
   );
 
   $interp{out_method} = $opt{outbuf} if $mode eq 'standalone' && $opt{outbuf};
   );
 
   $interp{out_method} = $opt{outbuf} if $mode eq 'standalone' && $opt{outbuf};
@@ -495,6 +498,7 @@ sub mason_interps {
 
   my $fs_interp = new HTML::Mason::Interp (
     %interp,
 
   my $fs_interp = new HTML::Mason::Interp (
     %interp,
+    comp_root    => $fs_comp_root,
     escape_flags => { 'js_string' => $js_string_sub,
                       'defang'    => sub {
                         ${$_[0]} = $html_defang->defang(${$_[0]});
     escape_flags => { 'js_string' => $js_string_sub,
                       'defang'    => sub {
                         ${$_[0]} = $html_defang->defang(${$_[0]});
@@ -507,6 +511,10 @@ sub mason_interps {
 
   my $rt_interp = new HTML::Mason::Interp (
     %interp,
 
   my $rt_interp = new HTML::Mason::Interp (
     %interp,
+    comp_root    => [
+                      [ 'rt'       => '%%%FREESIDE_DOCUMENT_ROOT%%%/rt' ],
+                      [ 'freeside' => '%%%FREESIDE_DOCUMENT_ROOT%%%'    ],
+                    ],
     escape_flags => { 'h'         => \&RT::Interface::Web::EscapeUTF8,
                       'js_string' => $js_string_sub,
                     },
     escape_flags => { 'h'         => \&RT::Interface::Web::EscapeUTF8,
                       'js_string' => $js_string_sub,
                     },
index 8d66f4f..95c8027 100644 (file)
@@ -37,9 +37,19 @@ sub freeside_setup {
 
     my( $filename, $mode ) = @_;
 
 
     my( $filename, $mode ) = @_;
 
-    #warn "initializing for $filename\n";
+    if ( $filename =~ qr(/REST/\d+\.\d+/NoAuth/) ) {
 
 
-    if ( $filename !~ /\/rt\/.*NoAuth/ ) { #not RT images/JS
+      package HTML::Mason::Commands; #?
+      use FS::UID qw( adminsuidsetup );
+
+      #need to log somebody in for the mail gw
+
+      ##old installs w/fs_selfs or selfserv??
+      #&adminsuidsetup('fs_selfservice');
+
+      &adminsuidsetup('fs_queue');
+
+    } else {
 
       package HTML::Mason::Commands;
       use vars qw( $cgi $p $fsurl );
 
       package HTML::Mason::Commands;
       use vars qw( $cgi $p $fsurl );
@@ -62,19 +72,7 @@ sub freeside_setup {
         die "unknown mode $mode";
       }
 
         die "unknown mode $mode";
       }
 
-    } elsif ( $filename =~ /\/rt\/REST\/.*NoAuth/ ) {
-
-      package HTML::Mason::Commands; #?
-      use FS::UID qw( adminsuidsetup );
-
-      #need to log somebody in for the mail gw
-
-      ##old installs w/fs_selfs or selfserv??
-      #&adminsuidsetup('fs_selfservice');
-
-      &adminsuidsetup('fs_queue');
-
-    }
+  }
 
 }
 
 
 }
 
index 2753bc6..8a62706 100644 (file)
@@ -1,10 +1,6 @@
 <Directory %%%FREESIDE_DOCUMENT_ROOT%%%/rt/NoAuth>
 <Directory %%%FREESIDE_DOCUMENT_ROOT%%%/rt/NoAuth>
-<Limit GET POST>
-allow from all
-Satisfy any   
 SetHandler perl-script
 PerlHandler HTML::Mason
 SetHandler perl-script
 PerlHandler HTML::Mason
-</Limit>
 </Directory>
 
 <Directory %%%FREESIDE_DOCUMENT_ROOT%%%/rt/REST/1.0/NoAuth>
 </Directory>
 
 <Directory %%%FREESIDE_DOCUMENT_ROOT%%%/rt/REST/1.0/NoAuth>
index 94377cf..eb9e67e 100644 (file)
@@ -57,16 +57,17 @@ sub handler
 
     if ( $r->filename =~ /\/rt\// ) { #RT
 
 
     if ( $r->filename =~ /\/rt\// ) { #RT
 
-      $ah->interp($rt_interp);
+      # We don't need to handle non-text, non-xml items
+      return -1 if defined( $r->content_type )
+                && $r->content_type !~ m!(^text/|\bxml\b)!io;
+
 
       local $SIG{__WARN__};
       local $SIG{__DIE__};
 
       RT::Init();
 
 
       local $SIG{__WARN__};
       local $SIG{__DIE__};
 
       RT::Init();
 
-      # We don't need to handle non-text, non-xml items
-      return -1 if defined( $r->content_type )
-                && $r->content_type !~ m!(^text/|\bxml\b)!io;
+      $ah->interp($rt_interp);
 
     } else {
 
 
     } else {
 
index ec551c8..50b44ec 100644 (file)
@@ -18,16 +18,12 @@ lib/RT/Tickets_Overlay.pm #customfield date patch
 lib/RT/URI/freeside.pm
 lib/RT/URI/freeside/Internal.pm
 lib/RT/URI/freeside/XMLRPC.pm
 lib/RT/URI/freeside.pm
 lib/RT/URI/freeside/Internal.pm
 lib/RT/URI/freeside/XMLRPC.pm
- share/html/Admin/Elements/EditCustomFields
  share/html/Admin/Users/Modify.html
  share/html/Admin/Users/Modify.html
- share/html/Elements/ColumnMap
  share/html/Elements/CollectionList
 share/html/Elements/EditCustomFieldDate #customfield date patch (NEW)
  share/html/Elements/Header
  share/html/Elements/PageLayout
  #html/Elements/QuickCreate
  share/html/Elements/CollectionList
 share/html/Elements/EditCustomFieldDate #customfield date patch (NEW)
  share/html/Elements/Header
  share/html/Elements/PageLayout
  #html/Elements/QuickCreate
- share/html/Elements/RefreshHomepage
- share/html/Elements/RT__CustomField/ColumnMap
  share/html/Elements/RT__Ticket/ColumnMap
  share/html/Elements/ShowCustomFieldDate #customfield date patch (NEW)
  share/html/Elements/SelectDate
  share/html/Elements/RT__Ticket/ColumnMap
  share/html/Elements/ShowCustomFieldDate #customfield date patch (NEW)
  share/html/Elements/SelectDate
@@ -48,7 +44,6 @@ share/html/Ticket/Elements/ShowMembers_Checklist
  share/html/Ticket/Elements/ShowSummary
  share/html/Ticket/Elements/ShowTransactionAttachments
  share/html/Ticket/Elements/Tabs
  share/html/Ticket/Elements/ShowSummary
  share/html/Ticket/Elements/ShowTransactionAttachments
  share/html/Ticket/Elements/Tabs
- share/html/Ticket/Graph/index.html
 share/html/Ticket/ModifyCustomers.html
  html/NoAuth/css/3.5-default/main.css
  html/NoAuth/css/3.5-default/misc.css
 share/html/Ticket/ModifyCustomers.html
  html/NoAuth/css/3.5-default/main.css
  html/NoAuth/css/3.5-default/misc.css
index 10f2540..0767e4a 100755 (executable)
@@ -47,9 +47,7 @@
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/ListActions, actions => \@results &>
 
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/ListActions, actions => \@results &>
 
-% my $path = $m->request_comp->path;
-% $path =~ s(^/rt)(); #hacky, dunno why this happens
-<form action="<%RT->Config->Get('WebPath')%><% $path |n %>" method="post" name="EditCustomFields">
+<form action="<%RT->Config->Get('WebPath')%><% $m->request_comp->path |n %>" method="post" name="EditCustomFields">
 <input type="hidden" class="hidden" name="id" value="<% $Object->Id || ''%>" />
 <input type="hidden" class="hidden" name="ObjectType" value="<% $ObjectType %>" />
 <input type="hidden" class="hidden" name="SubType" value="<% $SubType %>" />
 <input type="hidden" class="hidden" name="id" value="<% $Object->Id || ''%>" />
 <input type="hidden" class="hidden" name="ObjectType" value="<% $ObjectType %>" />
 <input type="hidden" class="hidden" name="SubType" value="<% $SubType %>" />
index 6a1c237..a1475a9 100644 (file)
@@ -157,12 +157,7 @@ my $COLUMN_MAP = {
     
     } qw(WebPath WebBaseURL WebURL)),
     WebRequestPath    => { value => sub { substr( $m->request_path, 1 ) } },
     
     } qw(WebPath WebBaseURL WebURL)),
     WebRequestPath    => { value => sub { substr( $m->request_path, 1 ) } },
-    #WebRequestPathDir => { value => sub { substr( $m->request_comp->dir_path, 1 ) } },
-    WebRequestPathDir => { value => sub {
-      my $wrpd = substr( $m->request_comp->dir_path, 1 );
-      $wrpd =~ s(^rt/)(); #hacky, dunno why this happens
-      $wrpd;
-    } },
+    WebRequestPathDir => { value => sub { substr( $m->request_comp->dir_path, 1 ) } },
 };
 
 $COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'};
 };
 
 $COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'};
index 0a867eb..6d8d76a 100644 (file)
@@ -155,9 +155,7 @@ my $COLUMN_MAP = {
                 : ($args->{'PassArguments'});
             my %pass = map { $_ => $args->{$_} } grep exists $args->{$_}, @pass;
 
                 : ($args->{'PassArguments'});
             my %pass = map { $_ => $args->{$_} } grep exists $args->{$_}, @pass;
 
-            my $path = $m->request_path;
-            $path =~ s(^/rt)(); #hacky, dunno why this happens
-            my $uri = RT->Config->Get('WebPath') . $path;
+            my $uri = RT->Config->Get('WebPath') . $m->request_path;
 
             my @res = (
                 \'<a href="',
 
             my @res = (
                 \'<a href="',
index 7840f59..bf91a95 100644 (file)
 %# 
 %# END BPS TAGGED BLOCK }}}
 <&|/Widgets/TitleBox, title => loc('Refresh')&>
 %# 
 %# END BPS TAGGED BLOCK }}}
 <&|/Widgets/TitleBox, title => loc('Refresh')&>
-<form method="get" action="<% RT->Config->Get('WebPath') . $path %>">
+<form method="get" action="<% RT->Config->Get('WebPath') . $m->request_path %>">
 <& /Elements/Refresh, Name => 'HomeRefreshInterval', 
     Default => $session{'home_refresh_interval'}||RT->Config->Get('HomePageRefreshInterval', $session{'CurrentUser'}) &>
 <& /Elements/Submit,  Label => loc('Go!') &>
 </&>
 </form>
 <& /Elements/Refresh, Name => 'HomeRefreshInterval', 
     Default => $session{'home_refresh_interval'}||RT->Config->Get('HomePageRefreshInterval', $session{'CurrentUser'}) &>
 <& /Elements/Submit,  Label => loc('Go!') &>
 </&>
 </form>
-<%init>
-my $path = $m->request_path;
-$path =~ s(^/rt)(); #hacky, dunno why this happens
-</%init>
index 211d3a0..e23737c 100644 (file)
@@ -56,9 +56,7 @@
 
 <& Elements/ShowGraph, %ARGS, Ticket => $ticket &>
 
 
 <& Elements/ShowGraph, %ARGS, Ticket => $ticket &>
 
-% my $path = $m->request_comp->path;
-% $path =~ s(^/rt)(); #hacky, dunno why this happens
-<form action="<% RT->Config->Get('WebPath') . $path %>">
+<form action="<% RT->Config->Get('WebPath') . $m->request_comp->path %>">
 <input type="hidden" class="hidden" name="id" value="<% $id %>" />
 
 <& Elements/EditGraphProperties, %ARGS, Ticket => $ticket &>
 <input type="hidden" class="hidden" name="id" value="<% $id %>" />
 
 <& Elements/EditGraphProperties, %ARGS, Ticket => $ticket &>