~ubuntu-branches/ubuntu/precise/moin/precise-updates

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/_samples/py/sampleposteddata.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-11-13 16:45:52 UTC
  • mfrom: (0.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20081113164552-49t6zf2t2o5bqigh
Tags: 1.8.0-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop recommendation of python-xml, the packages isn't anymore in
    sys.path.

Show diffs side-by-side

added added

removed removed

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