1 | #!/usr/bin/env python
|
---|
2 |
|
---|
3 | """
|
---|
4 | FCKeditor - The text editor for internet
|
---|
5 | Copyright (C) 2003-2006 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: sample01.py
|
---|
16 | Sample page.
|
---|
17 |
|
---|
18 | File Authors:
|
---|
19 | Andrew Liu (andrew@liuholdings.com)
|
---|
20 | """
|
---|
21 |
|
---|
22 | import cgi
|
---|
23 | import os
|
---|
24 |
|
---|
25 | # Ensure that the fckeditor.py is included in your classpath
|
---|
26 | import fckeditor
|
---|
27 |
|
---|
28 | # Tell the browser to render html
|
---|
29 | print "Content-Type: text/html"
|
---|
30 | print ""
|
---|
31 |
|
---|
32 | # Document header
|
---|
33 | print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
34 | <html>
|
---|
35 | <head>
|
---|
36 | <title>FCKeditor - Sample</title>
|
---|
37 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
---|
38 | <meta name="robots" content="noindex, nofollow">
|
---|
39 | <link href="../sample.css" rel="stylesheet" type="text/css" />
|
---|
40 | </head>
|
---|
41 | <body>
|
---|
42 | <h1>FCKeditor - Python - Sample 1</h1>
|
---|
43 | This sample displays a normal HTML form with an FCKeditor with full features
|
---|
44 | enabled.
|
---|
45 | <hr>
|
---|
46 | <form action="sampleposteddata.py" method="post" target="_blank">
|
---|
47 | """
|
---|
48 |
|
---|
49 | # This is the real work
|
---|
50 | try:
|
---|
51 | sBasePath = os.environ.get("SCRIPT_NAME")
|
---|
52 | sBasePath = sBasePath[0:sBasePath.find("_samples")]
|
---|
53 |
|
---|
54 | oFCKeditor = fckeditor.FCKeditor('FCKeditor1')
|
---|
55 | oFCKeditor.BasePath = sBasePath
|
---|
56 | oFCKeditor.Value = """This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>."""
|
---|
57 | print oFCKeditor.Create()
|
---|
58 | except Exception, e:
|
---|
59 | print e
|
---|
60 | print """
|
---|
61 | <br>
|
---|
62 | <input type="submit" value="Submit">
|
---|
63 | </form>
|
---|
64 | """
|
---|
65 |
|
---|
66 | # For testing your environments
|
---|
67 | print "<hr>"
|
---|
68 | for key in os.environ.keys():
|
---|
69 | print "%s: %s<br>" % (key, os.environ.get(key, ""))
|
---|
70 | print "<hr>"
|
---|
71 |
|
---|
72 | # Document footer
|
---|
73 | print """
|
---|
74 | </body>
|
---|
75 | </html>
|
---|
76 | """
|
---|
77 |
|
---|
78 |
|
---|