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