progressbar fix for elements/ exclusion, RT#38752
[freeside.git] / FS / FS / CGI.pm
index f33a718..fc0f652 100644 (file)
@@ -6,7 +6,7 @@ use Exporter;
 use CGI;
 use URI::URL;
 #use CGI::Carp qw(fatalsToBrowser);
-use FS::UID;
+use FS::UID qw( cgi );
 
 @ISA = qw(Exporter);
 @EXPORT_OK = qw( header menubar idiot eidiot popurl rooturl table itable ntable
@@ -227,9 +227,15 @@ sub popurl {
 =cut
 
 sub rooturl {
-  # better to start with the client-provided URL
-  my $cgi = &FS::UID::cgi;
-  my $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url;
+  my $url_string;
+  if ( scalar(@_) ) {
+    $url_string = shift;
+  } else {
+    # better to start with the client-provided URL
+    my $cgi = cgi;
+    $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url;
+  }
+
   $url_string =~ s/\?.*//;
 
   #even though this is kludgy
@@ -238,18 +244,13 @@ sub rooturl {
   $url_string =~
     s{
        /
-       (browse|config|docs|edit|graph|misc|search|view|pref|rt|elements)
-       /
-       (process/)?
+       (browse|config|docs|edit|graph|misc|search|view|loginout|pref|rt|torrus)
+       (/process)?
        ([\w\-\.\/]*)
        $
      }
      {}x;
 
-  #elements because of progress-popup.html... 
-  #XXX remove anything from elements that is called directly & prevent
-  #those pages from being served up
-
   $url_string .= '/' unless $url_string =~ /\/$/;
 
   $url_string;