from zope.interface import implements from zope.component import getMultiAdapter from AccessControl import ClassSecurityInfo try: from Products.LinguaPlone.public import * except ImportError: # No multilingual support from Products.Archetypes.public import * from Products.Memories.config import * from Products.ATContentTypes.atct import * from Products.ATContentTypes.content.schemata import finalizeATCTSchema from Products.ATContentTypes.configuration import zconf from Products.CMFPlone import PloneMessageFactory as _ from zope.component import getUtility from zope.component import getMultiAdapter from plone.app.portlets import portlets from plone.portlets.constants import CONTEXT_CATEGORY as CONTEXT_PORTLETS from Products.CMFCore.utils import getToolByName from Products.Archetypes.Schema import getSchemata AnnouncementSchema = ATContentTypeSchema.copy() + Schema(( TextField('announcement_text', required=True, searchable=True, # XXX text/plain might be sufficient default_output_type = 'text/html', widget = TextAreaWidget( label = 'Announcement text', label_msgid = 'label_announcement_text', description = 'Maximum length of announcement text is 250 characters.', description_msgid = 'description_announcement_text', rows=5, maxlength=250, i18n_domain='memories'), ), )) AnnouncementSchema = AnnouncementSchema.copy() AnnouncementSchema['description'].widget.visible = {'edit':'invisible', 'view':'invisible'} finalizeATCTSchema(AnnouncementSchema) class Announcement(ATCTContent): """Announcement created by user. """ schema = AnnouncementSchema meta_type = portal_type = archetype_name = 'Announcement' meta_type = 'Announcement' portal_type = 'Announcement' archetype_name = 'Announcement' #default_view = 'maps_map' #immediate_view = 'maps_map' #suppl_views = () security = ClassSecurityInfo() security.declareProtected(permissions.View, 'Schemata') def Schemata(self): """returns the Schemata for Announcement. """ schemata = getSchemata(self) new_schemata = {} new_schemata['default'] = schemata['default'] return new_schemata registerType(Announcement, PROJECTNAME)