"""A content type suitable for a homepage""" __author__ = '"Nathaniel W. Turner" ' __docformat__ = 'plaintext' from AccessControl import ClassSecurityInfo, ModuleSecurityInfo try: from Products.LinguaPlone.public import * except ImportError: # No multilingual support from Products.Archetypes.public import * from Products.HomePage.interfaces import IHomePage from Products.ATContentTypes.content.base import updateActions from Products.ATContentTypes.content.base import updateAliases from Products.ATContentTypes.content.document import ATDocument from Products.ATContentTypes.content.document import finalizeATCTSchema from Products.ATContentTypes.configuration import zconf from Products.CMFCore.permissions import View from Products.CMFCore.permissions import ModifyPortalContent from Products.CMFCore.permissions import ManageProperties security = ModuleSecurityInfo('Products.HomePage.content') # set up the schema HomePageSchema = ATDocument.schema.copy() + Schema(( TextField('announcements', required=False, searchable=True, storage = AnnotationStorage(migrate=True), validators = ('isTidyHtmlWithCleanup',), #validators = ('isTidyHtml',), default_content_type = zconf.ATDocument.default_content_type, default_output_type = 'text/x-html-safe', allowable_content_types = zconf.ATDocument.allowed_content_types, widget = RichWidget( description = """ If there is anything here, it will be published above the events and news. """, label = "Announcement Section Text", rows = 20, allow_file_upload = zconf.ATDocument.allow_document_upload)), StringField('eventSrc', required=False, default="events", languageIndependent=1, widget=StringWidget( label="Event Source ID", description=""" The ID of a smart folder that will be used as the source for event announcements. For example, "events". """), ), StringField('newsSrc', required=False, default="news", languageIndependent=1, widget=StringWidget( label="News Source ID", description=""" The ID of a smart folder that will be used as the source for news articles. For example, "news". """), ), StringField('pictureSrc', required=False, default="", languageIndependent=1, widget=StringWidget( label="Picture Source ID", description=""" The ID of a smart folder that will be used as the source for featured picures. For example, "pictures". """), ), StringField('pictureMax', required=True, default="2", languageIndependent=1, widget=StringWidget( label="Maximum number of pictures to show", description=""" If a Picture Source ID is set, this many pictures from that resource will be displayed. """), ), TextField('pictureNotes', required=False, searchable=True, storage = AnnotationStorage(migrate=True), validators = ('isTidyHtmlWithCleanup',), #validators = ('isTidyHtml',), default_content_type = zconf.ATDocument.default_content_type, default_output_type = 'text/x-html-safe', allowable_content_types = zconf.ATDocument.allowed_content_types, widget = RichWidget( description = """ If there is anything here, it will be published just after the featured pictures. This is intended to be something like links to more pictures. (This section is only shown if a Picture Source ID is set.) """, label = "Picture Notes", rows = 8, allow_file_upload = zconf.ATDocument.allow_document_upload)), ),) # Finalise the schema according to ATContentTypes standards. This basically # moves the Related items and Allow discussion fields to the bottom of the # form. See ATContentTypes.content.schemata for details. finalizeATCTSchema(HomePageSchema) class HomePage(ATDocument): """ A content type suitable for a homepage """ # portal_type = meta_type = 'HomePage' archetype_name = 'Home Page' content_icon = 'homepage.png' schema = HomePageSchema typeDescription= 'A content type suitable for a homepage' typeDescMsgId = 'HomePage_description_edit' # Set up our views - these are available from the 'display' menu default_view = 'homepage_view' immediate_view = 'homepage_view' suppl_views = ('homepage_view2',) # Make sure we get title-to-id generation when an object is created _at_rename_after_creation = True # Make sure we get all the interface declarations from ATDocument, # which includes support for ISelectableBrowserDefault to get the # 'display' menu to work, IHistoryAware and other standard interfaces. __implements__ = ATDocument.__implements__ + (IHomePage,) # no columns of "portlets" when using this app left_slots = "" right_slots = "" registerType(HomePage)