Back to index

plone3  3.1.7
wickeddoc.py
Go to the documentation of this file.
00001 ##########################################################
00002 #
00003 # Licensed under the terms of the GNU Public License
00004 # (see docs/LICENSE.GPL)
00005 #
00006 # Copyright (c) 2005:
00007 #   - The Open Planning Project (http://www.openplans.org/)
00008 #   - Rob Miller <rob@kalistra.com> (RaFromBRC)
00009 #   - and contributors
00010 #
00011 ##########################################################
00012 """
00013 WickedDoc
00014 ~~~~~~~~~~
00015 
00016 A simple subclass of the ATDocument type that supports wicked
00017 linking in the primary text field.
00018 
00019 """
00020 from AccessControl import ClassSecurityInfo
00021 from Products.Archetypes import public as atapi
00022 from Products.CMFCore import permissions as CMFCorePermissions
00023 from Products.CMFCore.utils import getToolByName
00024 from wicked.at.field import WikiField
00025 from wicked.atcontent import zope2
00026 from wicked.interfaces import IAmWicked
00027 from zope.annotation.interfaces import IAttributeAnnotatable 
00028 from zope.interface import implements
00029 
00030 try:
00031     from Products.ATContentTypes.atct import ATDocument
00032 except ImportError: # ATCT 0.2
00033     from Products.ATContentTypes.types.ATDocument import ATDocument
00034 try:
00035     from Products.ATContentTypes.config import zconf
00036     ATDOCUMENT_CONTENT_TYPE = zconf.ATDocument.default_content_type
00037 except ImportError: # ATCT 0.2
00038     from Products.ATContentTypes.config import ATDOCUMENT_CONTENT_TYPE
00039 
00040      
00041 class WickedDoc(ATDocument):
00042     """ A page in the portal; supports wiki linking. """
00043     implements(IAmWicked, IAttributeAnnotatable)
00044     archetype_name='Wicked Doc'
00045     portal_type= meta_type ='WickedDoc'
00046     global_allow=True
00047     schema = ATDocument.schema.copy() + atapi.Schema((
00048         WikiField('text',
00049                   required=True,
00050                   searchable=True,
00051                   primary=True,
00052                   filters=('Wicked Filter',),
00053                   validators = ('isTidyHtmlWithCleanup',),
00054                   default_content_type = ATDOCUMENT_CONTENT_TYPE,
00055                   default_output_type = 'text/html',
00056                   allowable_content_types = ('text/structured',
00057                                              'text/x-rst',
00058                                              'text/html',
00059                                              'text/plain',
00060                                              'text/plain-pre',
00061                                              'text/python-source',),
00062                   widget = atapi.RichWidget(description = "The body text "\
00063                                             "of the document.",
00064                                             description_msgid = "help_body_text",
00065                                             label = "Body text",
00066                                             label_msgid = "label_body_text",
00067                                             rows = 25,
00068                                             i18n_domain = "plone")),
00069         ))
00070 
00071 atapi.registerType(WickedDoc, zope2.PROJECTNAME)