4 CXGN::Page::Simple - a simple page object with fewer dependencies, useful for "standalone" projects
8 This module is similar to CXGN::Page, but does not inherit from CXGN::Scrap, and has fewer dependencies. It is intended for use in "standalone" applications that use the SGN codebase but do not implement all the bells and whistles of the SGN system.
12 Lukas Mueller <lam87@cornell.edu>
16 This module implements the following functions (a subset of the CXGN::Page functions that are essential for simple web programming):
23 package CXGN
::Page
::Simple
;
27 use base qw
/CXGN::Scrap/;
29 =head2 constructor new()
32 Ret: a CXGN::Page::Simple object
38 my $self = bless {}, $class;
39 $self->{request
} ||= Apache2
::RequestUtil
->request;
40 $self->{apache_request
} ||= Apache2
::Request
->instance($self->{request
});
44 =head2 function get_encoded_arguments()
46 Args: a list of parameter names
47 Ret: a list of corresponding values from Apache Request object,
48 encoded in HTML encoding
52 sub get_encoded_arguments
{
54 return map {HTML
::Entities
::encode_entities
($_,"<>&'\"")} $self->get_arguments(@items);
55 #encoding does not appear to work for foreign characters with umlauts, etc. so we're using this restricted version of the command
60 Gets arguments which are being sent in via GET or POST (doesn\'t matter which). DOES NOT encode the HTML entities in those arguments, so be careful because it IS possible for clients to submit evil HTML, javascript, etc.
63 my($fasta_file)=$scrap->get_arguments("fasta_file");
67 # only use this method if you need unfiltered arguments with weird characters
68 # in them, like passwords and fasta file data. be aware that the user\'s agent
69 # (browser) could be capable of sending ALMOST ANYTHING to you as parameters.
73 my $apr = $self->{apache_request
};
75 my @p = $apr->param($_);
77 carp
"WARNING: multiple parameters returned for argument '$_'";
88 =head2 function header()
90 Args: An optional header string
92 Side Effects: prints a header to STDOUT
98 my $header_string = shift;
102 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
108 <link rel="stylesheet" href="/documents/inc/sgn.css" type="text/css" />
114 <table summary="" width="800" cellpadding="0" cellspacing="0" border="0">
116 <td width="35"><a href="/"><img src="/documents/img/sgn_logo_icon.png" border="0" width="30" height="30" /></a></td>
117 <td style="color: gray; font-size:12px; font-weight: bold; vertical-align: middle">$header_string</td></tr>
119 <table summary="" width="800" cellpadding="0" cellspacing="0" border="0">
127 =head2 function footer()
131 Side Effects: prints a footer to STDOUT
138 <tr
><td
><hr
></td></tr
>
139 <tr
><td
><font color
="gray" size
="1">Copyright
©
; 2003-2007 <a href
="http://sgn.cornell.edu/" class="footer" >Sol Genomics Network
</a
> and <a
class="footer" href
="http://www.cornell.edu/">Cornell University
</a
>.<br
/>Development of this software was supported by the <a class="footer" href="http://www.nsf.gov/">U.S. National Science Foundation</a>.</td></tr>