# -*- coding: utf-8 # Copyright 2006 by Meelis Mets from Products.Archetypes.public import BaseSchema, Schema from Products.Archetypes.public import BooleanField, ImageField, StringField, TextField from Products.Archetypes.public import BooleanWidget, ImageWidget, StringWidget, SelectionWidget, RichWidget from Products.Archetypes.public import BaseContent, registerType from Globals import InitializeClass from Products.CMFCore.utils import getToolByName from AccessControl import ClassSecurityInfo, Unauthorized from config import PROJECT_NAME from BaseTest import BaseStimulus schema = BaseStimulus.schema + Schema(( TextField('bodytext', accessor='getBodyText', validators = ('isTidyHtmlWithCleanup',), default_output_type = 'text/x-html-safe', allowable_content_types = ('text/html',), widget = RichWidget( label="Body text", description="", label_msgid='label_body_text', description_msgid='description_body_text', visible={'view':'visible','edit':'visible'}, i18n_domain="psyhvel", rows = 10 ), ), )) class TextStimulus(BaseStimulus): """ Text Stimulus""" meta_type = "TextStimulus" archetype_name = "Text Stimulus" global_allow = 0 exclude_from_nav = True filter_content_types = True allowed_content_types = () security = ClassSecurityInfo() schema = schema actions = ( { 'id':'view', 'name':'View', 'action':'string:${object_url}/text_stimulus', 'permissions': ('View',), }, { 'id':'edit', 'name':'Configuration', 'action':'string:${object_url}/base_edit', 'permissions': ('Modify portal content',), }, { 'id':'metadata', 'name':'Info', 'action':'string:${object_url}/base_metadata', 'permissions': ('Modify portal content',), }, ) def getObjectsXML(self, files): """special xml""" xml = self.getBaseXML() xml += '\n' xml += '' return [xml, files] registerType(TextStimulus, PROJECT_NAME)