[freeside-commits] freeside/FS/FS CGI.pm,1.29,1.30

Ivan,,, ivan at wavetail.420.am
Tue Feb 21 23:12:30 PST 2006


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv23030

Modified Files:
	CGI.pm 
Log Message:
a better CGI::rooturl(), will have to do for now

Index: CGI.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/CGI.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- CGI.pm	10 Dec 2004 22:28:25 -0000	1.29
+++ CGI.pm	22 Feb 2006 07:12:28 -0000	1.30
@@ -9,7 +9,7 @@
 use FS::UID;
 
 @ISA = qw(Exporter);
- at EXPORT_OK = qw(header menubar idiot eidiot popurl table itable ntable
+ at EXPORT_OK = qw(header menubar idiot eidiot popurl rooturl table itable ntable
                 small_custview myexit http_header);
 
 =head1 NAME
@@ -225,6 +225,34 @@
   $x;
 }
 
+=item rooturl 
+
+=cut
+
+sub rooturl {
+  #this doesn't work so well...
+  #'%%%FREESIDE_URL%%%';
+
+  # better to start with the client-provided URL
+  my $cgi = &FS::UID::cgi;
+  my $url_string = $cgi->isa('Apache') ? $cgi->uri : $cgi->url;
+  $url_string =~ s/\?.*//;
+
+  #even though this is kludgy
+  $url_string =~
+    s{
+       (browse|config|docs|edit|graph|misc|search|view)
+       /
+       (process/)?
+       ([\w\-\.]+)
+       $
+     }
+     {}x;
+
+  $url_string;
+
+}
+
 =item table
 
 Returns HTML tag for beginning a table.



More information about the freeside-commits mailing list