/usr/lib/python2.7/dist-packages/zope/html/widget.py is in python-zope.html 2.2.0-0ubuntu11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | ##############################################################################
#
# Copyright (c) 2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Widget implementations for rich-text fields.
"""
__docformat__ = "reStructuredText"
import zope.app.form.browser
import zc.resourcelibrary
class FckeditorWidget(zope.app.form.browser.TextAreaWidget):
editorWidth = 600
editorHeight = 400
fckVersion = '2.6.6'
configurationPath = "/@@/zope_fckconfig.js"
toolbarConfiguration = "zope"
def __call__(self):
zc.resourcelibrary.need("fckeditor")
#
# XXX The 'shortname' here needs some salt to ensure that
# multiple widgets with the same trailing name are
# distinguishable; some encoding of the full name seems
# appropriate, or a per-request counter would also do nicely.
#
d = {
"config": self.configurationPath,
"name": self.name,
"shortname": self.name.split('.', 1)[-1],
"toolbars": self.toolbarConfiguration,
"width": self.editorWidth,
"height": self.editorHeight,
"fckversion": self.fckVersion,
}
textarea = super(FckeditorWidget, self).__call__()
return textarea + (self.javascriptTemplate % d)
javascriptTemplate = '''
<script type="text/javascript" language="JavaScript">
var oFCKeditor_%(shortname)s = new FCKeditor(
"%(name)s", %(width)s, %(height)s, "%(toolbars)s");
oFCKeditor_%(shortname)s.BasePath = "/@@/fckeditor/%(fckversion)s/fckeditor/";
oFCKeditor_%(shortname)s.Config["CustomConfigurationsPath"] = "%(config)s";
oFCKeditor_%(shortname)s.ReplaceTextarea();
</script>
'''
class CkeditorWidget(zope.app.form.browser.TextAreaWidget):
editorHeight = 400
fckVersion = '3.6.1'
configurationPath = "/@@/zope_ckconfig.js"
def __call__(self):
zc.resourcelibrary.need("ckeditor")
#
# XXX The 'shortname' here needs some salt to ensure that
# multiple widgets with the same trailing name are
# distinguishable; some encoding of the full name seems
# appropriate, or a per-request counter would also do nicely.
#
d = {
"config": self.configurationPath,
"name": self.name,
"shortname": self.name.split('.', 1)[-1],
"height": self.editorHeight,
"fckversion": self.fckVersion,
}
textarea = super(CkeditorWidget, self).__call__()
return textarea + (self.javascriptTemplate % d)
javascriptTemplate = '''
<script type="text/javascript" language="JavaScript">
var CKeditor_%(shortname)s = new CKEDITOR.replace("%(name)s",
{
height: %(height)s,
customConfig : "%(config)s",
}
);
</script>
'''
|