예제 #1
0
파일: remark.py 프로젝트: seantis/ftw.book
from ftw.book.interfaces import IRemark
from simplelayout.base.interfaces import ISimpleLayoutBlock
from simplelayout.types.common.content import simplelayout_schemas
from zope.i18nmessageid import MessageFactory
from zope.interface import implements


_sl = MessageFactory('simplelayout')

remark_schema = ATContentTypeSchema.copy()

remark_schema += simplelayout_schemas.textSchema.copy()

remark_schema['title'].required = False
remark_schema['title'].searchable = 0
remark_schema['excludeFromNav'].default = True
remark_schema['description'].widget.visible = {'edit': 0, 'view': 0}
simplelayout_schemas.finalize_simplelayout_schema(remark_schema)


class Remark(ATDocumentBase):
    """A simplelayout block used for comments
    """

    security = ClassSecurityInfo()
    implements(IRemark, ISimpleLayoutBlock)
    schema = remark_schema


atapi.registerType(Remark, PROJECTNAME)
예제 #2
0
from simplelayout.base.interfaces import ISimpleLayoutCapable

from Products.ATContentTypes.config import HAS_LINGUA_PLONE
if HAS_LINGUA_PLONE:
    from Products.LinguaPlone.public import registerType
else:
    from Products.Archetypes.atapi import registerType


news_schema = page.page_schema.copy() + imageSchema.copy()

news_schema['effectiveDate'].required = True
news_schema['effectiveDate'].default_method = 'getDefaultEffectiveDate'
news_schema.changeSchemataForField('effectiveDate', 'default')
news_schema.changeSchemataForField('expirationDate', 'default')
finalize_simplelayout_schema(news_schema, folderish=True)


class News(Page):

    implements(INews, ISimpleLayoutCapable)
    security = ClassSecurityInfo()

    schema = news_schema

    def getDefaultEffectiveDate(self):
        return DateTime().Date()

    security.declarePublic('show_description')
    def show_description(self):
        return False
예제 #3
0
                description=_sl(u'simplelayout_help_showtitle',
                                default=u'Show title'))),

        ))

htmlblock_schema += simplelayout_schemas.textSchema.copy()

htmlblock_schema['text'].widget = atapi.TextAreaWidget(
    label=_at(u'label_body_text', default=u'Body Text'),
    description='',
    rows=32,
    cols=70)

htmlblock_schema['title'].required = False
htmlblock_schema['title'].searchable = 0
htmlblock_schema['excludeFromNav'].default = True
htmlblock_schema['description'].widget.visible = {'edit': 0, 'view': 0}
simplelayout_schemas.finalize_simplelayout_schema(htmlblock_schema)


class HTMLBlock(ATDocumentBase):
    """A simplelayout block providing an HTML text field.
    """

    security = ClassSecurityInfo()
    implements(IHTMLBlock, ISimpleLayoutBlock)
    schema = htmlblock_schema


atapi.registerType(HTMLBlock, PROJECTNAME)
예제 #4
0
파일: table.py 프로젝트: seantis/ftw.book
                    description=_(
                        u'description_no_lifting',
                        default=u'When exporting the book as PDF the table '
                        u'will be pulled up if there is no content in the '
                        u'first cell. The aim is to place a preceding title '
                        u'at the same height as the first row of the table. '
                        u'For suppressing this behaviour enable this '
                        u'option.'))),

            )))

# We need a text-field if we inherit from ATDocumentBase
table_schema += simplelayout_schemas.textSchema.copy()
table_schema['text'].widget.visible = {'edit': 0, 'view': 0}

simplelayout_schemas.finalize_simplelayout_schema(table_schema)


class Table(ATDocumentBase):
    """A Table for ftw.book"""
    implements(ITable, ISimpleLayoutBlock)

    portal_type = "Table"
    schema = table_schema

    def getTable(self):
        return generator.TableGenerator(self).render()

    def convert_to_int(self, value):
        """ Converts a value to integer. If its not possible we return the
        unconverted value