4 use vars qw(@EXPORT_OK @ISA);
8 use CGI::Carp qw(fatalsToBrowser);
12 @EXPORT_OK = qw(header menubar idiot eidiot popurl table itable);
16 FS::CGI - Subroutines for the web interface
20 use FS::CGI qw(header menubar idiot eidiot popurl);
22 print header( 'Title', '' );
23 print header( 'Title', menubar('item', 'URL', ... ) );
25 idiot "error message";
26 eidiot "error message";
28 $url = popurl; #returns current url
29 $url = popurl(3); #three levels up
33 Provides a few common subroutines for the web interface.
39 =item header TITLE, MENUBAR
41 Returns an HTML header.
46 my($title,$menubar)=@_;
55 <BODY BGCOLOR="#e8e8e8">
56 <FONT COLOR="#FF0000" SIZE=7>
61 $x .= $menubar. "<BR><BR>" if $menubar;
65 =item menubar ITEM, URL, ...
67 Returns an HTML menubar.
71 sub menubar { #$menubar=menubar('Main Menu', '../', 'Item', 'url', ... );
74 ($item,$url)=splice(@_,0,2);
75 push @html, qq!<A HREF="$url">$item</A>!;
82 Sends headers and an HTML error message.
88 my($cgi)=FS::UID::cgi;
89 if ( $cgi->isa('CGI::Base') ) {
91 &CGI::Base::SendHeaders;
93 print $cgi->header( '-expires' => 'now' );
98 <TITLE>Error processing your request</TITLE>
102 <H4>Error processing your request</H4>
104 Your request could not be processed because of the following error:
106 <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and try again.
115 Sends headers and an HTML error message, then exits.
126 Returns current URL with LEVEL levels of path removed from the end (default 0).
132 my($cgi)=&FS::UID::cgi;
133 my($url)=new URI::URL $cgi->url;
134 my(@path)=$url->path_components;
136 $url->path_components(@path);
137 my $x = $url->as_string;
138 $x .= '/' unless $x =~ /\/$/;
144 Returns HTML tag for beginning a table.
151 "<TABLE BGCOLOR=$col BORDER=1 WIDTH=\"100%\">";
159 Returns HTML tag for beginning an (invisible) table.
166 qq!<TABLE BGCOLOR=$col BORDER=0 CELLSPACING=0 WIDTH=\"100%\">!;
186 subroutines for the HTML/CGI GUI, not properly OO. :(
188 ivan@sisd.com 98-apr-16
189 ivan@sisd.com 98-jun-22
191 lose the background, eidiot ivan@sisd.com 98-sep-2
193 pod ivan@sisd.com 98-sep-12
196 Revision 1.15 1999-01-18 09:41:48 ivan
197 all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
200 Revision 1.14 1999/01/18 09:22:37 ivan
201 changes to track email addresses for email invoicing
203 Revision 1.12 1998/12/23 02:23:16 ivan
204 popurl always has trailing slash
206 Revision 1.11 1998/11/12 07:43:54 ivan
207 *** empty log message ***
209 Revision 1.10 1998/11/12 01:53:47 ivan
212 Revision 1.9 1998/11/09 08:51:49 ivan
215 Revision 1.7 1998/11/09 06:10:59 ivan
218 Revision 1.6 1998/11/09 05:44:20 ivan
219 *** empty log message ***
221 Revision 1.4 1998/11/09 04:55:42 ivan
222 support depriciated CGI::Base as well as CGI.pm (for now)
224 Revision 1.3 1998/11/08 10:50:19 ivan
225 s/CGI::Base/CGI/; etc.