|
"""Definition of the banner content type |
|
""" |
|
|
|
from zope.interface import implements |
|
|
|
from Products.Archetypes import atapi |
|
from Products.ATContentTypes.content import base |
|
from Products.ATContentTypes.content import schemata |
|
|
|
# -*- Message Factory Imported Here -*- |
|
from Products.Archetypes.public import BaseContent |
|
from Products.ATContentTypes.content import base |
|
from Products.ATContentTypes.content import schemata |
|
|
|
from Products.ATContentTypes.content.schemata import ATContentTypeSchema |
|
from Products.ATContentTypes.content.schemata import finalizeATCTSchema |
|
from Products.ATContentTypes.content import image |
|
from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget |
|
|
|
|
|
bannerSchema = image.ATImageSchema.copy() + atapi.Schema(( |
|
|
|
# -*- Your Archetypes field definitions here ... -*- |
|
atapi.StringField( |
|
'LinkUrl', |
|
storage=atapi.AnnotationStorage(), |
|
widget=atapi.StringWidget( |
|
label=_(u"Link (URL)") |
|
), |
|
), |
|
|
|
atapi.ReferenceField( |
|
'ContentLink', |
|
widget=ReferenceBrowserWidget( |
|
label=_(u"Link to content") |
|
), |
|
index_method="_at_edit_accessor", |
|
relationship='IsReferencedTo', |
|
multiValued=0, |
|
), |
|
|
|
)) |
|
|
|
# Set storage on fields copied from ATContentTypeSchema, making sure |
|
# they work well with the python bridge properties. |
|
|
|
bannerSchema['title'].storage = atapi.AnnotationStorage() |
|
bannerSchema['description'].storage = atapi.AnnotationStorage() |
|
|
|
schemata.finalizeATCTSchema(bannerSchema, moveDiscussion=False) |
|
|
|
|
|
class banner(base.ATCTContent): |
|
"""Banner""" |
|
implements(Ibanner) |
|
|
|
meta_type = "banner" |
|
schema = bannerSchema |
|
|
|
title = atapi.ATFieldProperty('title') |
|
description = atapi.ATFieldProperty('description') |
|
|
|
# -*- Your ATSchema to Python Property Bridges Here ... -*- |
|
LinkUrl = atapi.ATFieldProperty('LinkUrl') |
|
ContentLink = atapi.ATFieldProperty('ContentLink') |
|
|
|
atapi.registerType(banner, PROJECTNAME) |