1#!/usr/bin/env python
2
3"""
4FCKeditor - The text editor for Internet - http://www.fckeditor.net
5Copyright (C) 2003-2007 Frederico Caldeira Knabben
6
7== BEGIN LICENSE ==
8
9Licensed under the terms of any of the following licenses at your
10choice:
11
12 - GNU General Public License Version 2 or later (the "GPL")
13   http://www.gnu.org/licenses/gpl.html
14
15 - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16   http://www.gnu.org/licenses/lgpl.html
17
18 - Mozilla Public License Version 1.1 or later (the "MPL")
19   http://www.mozilla.org/MPL/MPL-1.1.html
20
21== END LICENSE ==
22
23This page lists the data posted by a form.
24"""
25
26import cgi
27import os
28
29# Tell the browser to render html
30print "Content-Type: text/html"
31print ""
32
33try:
34	# Create a cgi object
35	form = cgi.FieldStorage()
36except Exception, e:
37	print e
38
39# Document header
40print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
41<html>
42	<head>
43		<title>FCKeditor - Samples - Posted Data</title>
44		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
45		<meta name="robots" content="noindex, nofollow">
46		<link href="../sample.css" rel="stylesheet" type="text/css" />
47	</head>
48	<body>
49"""
50
51# This is the real work
52print """
53		<h1>FCKeditor - Samples - Posted Data</h1>
54		This page lists all data posted by the form.
55		<hr>
56		<table width="100%" border="1" cellspacing="0" bordercolor="#999999">
57			<tr style="FONT-WEIGHT: bold; COLOR: #dddddd; BACKGROUND-COLOR: #999999">
58				<td nowrap>Field Name&nbsp;&nbsp;</td>
59				<td>Value</td>
60			</tr>
61"""
62for key in form.keys():
63	try:
64		value = form[key].value
65		print """
66				<tr>
67					<td valign="top" nowrap><b>%s</b></td>
68					<td width="100%%" style="white-space:pre">%s</td>
69				</tr>
70			""" % (key, value)
71	except Exception, e:
72		print e
73print "</table>"
74
75# For testing your environments
76print "<hr>"
77for key in os.environ.keys():
78	print "%s: %s<br>" % (key, os.environ.get(key, ""))
79print "<hr>"
80
81# Document footer
82print """
83	</body>
84</html>
85"""
86