コード例 #1
0
from Products.Collage.content.common import LayoutContainer
from Products.Collage.interfaces import ICollageColumn
from Products.Collage.utilities import CollageMessageFactory as _
from zope.interface import implementer

try:
    from Products.LinguaPlone import public as atapi
except ImportError:
    from Products.Archetypes import atapi

CollageColumnSchema = atapi.BaseContent.schema.copy() + atapi.Schema(
    (atapi.StringField(
        name='title',
        accessor='Title',
        required=False,
        searchable=True,
        widget=atapi.StringWidget(
            label=_(u'label_optional_column_title', default=u"Title"),
            description=_(
                u'help_optional_column_title',
                default=u"You may optionally supply a title for this column."),
        )), ))

CollageColumnSchema = CollageColumnSchema + CommonCollageSchema.copy()

# move description to main edit page
CollageColumnSchema['description'].schemata = 'default'

# never show row in navigation, also when its selected
CollageColumnSchema['excludeFromNav'].default = True

# support show in navigation feature and at marshalling
コード例 #2
0
ファイル: book.py プロジェクト: wilken311/ftw.book
 atapi.Schema((
     atapi.IntegerField(name='web_toc_depth',
                        default=0,
                        searchable=False,
                        widget=atapi.IntegerWidget(
                            label=_(u'label_web_toc_depth',
                                    default=u'Table of contents depth'),
                            description=_(u'help_web_toc_depth',
                                          default=u''))),
     atapi.StringField(
         name='latex_layout',
         required=True,
         vocabulary_factory='ftw.book.layoutsVocabulary',
         default_method='getDefaultLaTeXLayout',
         widget=atapi.SelectionWidget(
             label=_(u'book_label_layout', default=u'Layout'))),
     atapi.BooleanField(name='use_titlepage',
                        default=True,
                        widget=atapi.BooleanWidget(
                            label=_(u'book_label_use_titlepage',
                                    default=u'Embedd a title page'),
                            description=_(u'book_help_use_titlepage',
                                          default=u''))),
     atapi.BooleanField(name='use_toc',
                        default=True,
                        widget=atapi.BooleanWidget(
                            label=_(u'book_label_use_toc',
                                    default=u'Embedd table of contents'),
                            description=_(u'book_help_use_toc',
                                          default=u''))),
     atapi.BooleanField(name='use_lot',
                        default=True,
                        widget=atapi.BooleanWidget(
                            label=_(u'book_label_use_lot',
                                    default=u'Embedd list of tables.'),
                            description=_(u'book_help_use_lot',
                                          default=u''))),
     atapi.BooleanField(
         name='use_loi',
         default=True,
         widget=atapi.BooleanWidget(
             label=_(u'book_label_use_loi',
                     default=u'Embedd list of illustrations'),
             description=_(u'book_help_use_loi', default=u''))),
     atapi.BooleanField(
         name='use_index',
         default=False,
         widget=atapi.BooleanWidget(label=_(
             u'book_label_use_index', default=u'Embedd subject index')),
         description=_(u'book_help_use_index',
                       default=u'When enabled, a keyword index '
                       'will be included in the PDF.')),
 )))
コード例 #3
0
schema = public.Schema((

    ImageBlobField('image',
                   required=False,
                   storage=public.AnnotationStorage(migrate=True),
                   languageIndependent=True,
                   allowable_content_types=('image/gif', 'image/jpeg',
                                            'image/jpg', 'image/png',
                                            'image/tiff'),
                   swallowResizeExceptions=enable_exception,
                   pil_quality=zconf.pil_config.quality,
                   pil_resize_algo=zconf.pil_config.resize_algo,
                   max_size=(1280, 1024),
                   sizes={'xlarge': (633, 356),
                          'wide': (325, 183),
                          'large': (768, 768),
                          'preview': (400, 400),
                          'mini': (180, 135),
                          'thumb': (128, 128),
                          'tile': (64, 64),
                          'icon': (32, 32),
                          'listing': (16, 16),
                          },
                   validators=(
                       ('isNonEmptyFile', V_REQUIRED),
                       ('imageMinSize', V_REQUIRED),
                       ('checkFileMaxSize', V_REQUIRED),
                   ),
                   widget=public.ImageWidget(
                       description=(
                           "Will be shown in the news listing, and in the news "
                           "item itself. Image will be scaled to a sensible"
                           " size and image width should be of minimum 1024px"),
                       description_msgid="help_news_image",
                       label="Image",
                       label_msgid="label_news_image",
                       i18n_domain="plone",
                       show_content_type=False)
                   ),

    public.StringField(
        name='imageLink',
        widget=public.StringWidget(
            label="Image Link",
            label_msgid="label_news_image_link",
            description="Enter a URL that the image should be linked to",
            description_msgid="help_image_link",
            i18n_domain='EEAContentTypes',
            size="40",
        ),
        validators=('isURL',),
    ),

    public.StringField(
        name='imageCaption',
        widget=public.StringWidget(
            label="Image Caption",
            description="Enter a caption for the image (max 5 words)",
            description_msgid="help_image_caption",
            label_msgid="label_image_caption",
            size="40",
            i18n_domain='EEAContentTypes',
            maxValues=5,
        ),
        i18n_domain="plone",
        searchable=True,
        validators=('maxWords',)
    ),

    public.TextField(
        name='imageNote',
        index="ZCTextIndex|TextIndex:brains",
        widget=public.TextAreaWidget(
            label="Image Note",
            description="Enter a note about this image.",
            label_msgid='EEAContentTypes_label_imageNote',
            description_msgid='EEAContentTypes_help_imageNote',
            i18n_domain='EEAContentTypes',
        )
    ),

    public.StringField(
        name='imageSource',
        index="FieldIndex:brains",
        widget=public.StringWidget(
            label="Image Source",
            description="Enter the source of this image.",
            label_msgid='EEAContentTypes_label_imageSource',
            description_msgid='EEAContentTypes_help_imageSource',
            i18n_domain='EEAContentTypes',
        )
    ),

    public.StringField(
        name='imageCopyright',
        index="FieldIndex:brains",
        widget=public.StringWidget(
            label="Image Copyright",
            description="Enter the copyright information for this image.",
            label_msgid='EEAContentTypes_label_imageCopyright',
            description_msgid='EEAContentTypes_help_imageCopyright',
            i18n_domain='EEAContentTypes',
        )
    ),

    public.ReferenceField(
        name='media',
        widget=public.ReferenceWidget(
            label='Media',
            label_msgid='EEAContentTypes_label_media',
            i18n_domain='EEAContentTypes',
        ),
        allowed_types="('ATImage','FlashFile')",
        multiValued=0,
        relationship="frontpageMedia",
        accessor="_getMedia"
    ),

    public.StringField(
        name='newsTitle',
        index_method="getNewsTitle",
        index="FieldIndex:brains",
        widget=public.StringWidget(
            label="News title",
            description=("Enter title that will be visible on the frontpage "
                         "when this highlight is listed."),
            label_msgid='EEAContentTypes_label_newsTitle',
            description_msgid='EEAContentTypes_help_newsTitle',
            i18n_domain='EEAContentTypes',
        ),
        accessor="_getNewsTitle"
    ),

    public.TextField(
        name='teaser',
        index_method="getTeaser",
        index="ZCTextIndex|TextIndex:brains",
        widget=public.TextAreaWidget(
            label="Teaser",
            description="Short informative teaser for the frontpage.",
            maxlength="600",
            label_msgid='EEAContentTypes_label_teaser',
            description_msgid='EEAContentTypes_help_teaser',
            i18n_domain='EEAContentTypes',
        ),
        accessor="_getTeaser"
    ),

    public.StringField(
        name='url',
        index="FieldIndex:brains",
        widget=public.StringWidget(
            label="External URL",
            description="Enter URL to external content.",
            label_msgid='EEAContentTypes_label_url',
            description_msgid='EEAContentTypes_help_url',
            i18n_domain='EEAContentTypes',
            visible={'edit': 'invisible', 'view': 'visible'},
        ),
        languageIndependent=True
    ),

    public.StringField(
        name='visibilityLevel',
        index="FieldIndex:brains",
        widget=public.SelectionWidget(
            label="Visibility Level",
            label_msgid='EEAContentTypes_label_visibilityLevel',
            i18n_domain='EEAContentTypes',
            visible=False,  # disabled/deprecated by default for most content
        ),
        enforceVocabulary=1,
        vocabulary="getVisibilityLevels",
        languageIndependent=True
    ),

    ManagementPlanField(
        name='management_plan',
        languageIndependent=True,
        required_for_published=True,
        required=True,
        default=(datetime.now().year, ''),
        validators=('management_plan_code_validator',),
        vocabulary_factory=u"Temporal coverage",
        widget=ManagementPlanWidget(
            format="select",
            label="EEA Management Plan",
            description=("EEA Management plan code. Internal EEA project "
                         "line code, used to assign an EEA product output to "
                         "a specific EEA project number in the "
                         "management plan."),
            label_msgid='dataservice_label_eea_mp',
            description_msgid='dataservice_help_eea_mp',
            i18n_domain='eea.dataservice',
        )
    ),

),
)
コード例 #4
0
MiPagoAdapterSchema = formMailerAdapterSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.StringField('mipago_cpr_code',
                      languageIndependent=True,
                      vocabulary=atapi.DisplayList([
                          ('9050299', _(u'9050299: Notebook 60, modality 1')),
                          ('9052180', _(u'9052180: Notebook 60, modality 2')),
                          ('9050794', _(u'9050794: Notebook 57')),
                      ]),
                      required=True,
                      storage=atapi.AnnotationStorage(),
                      searchable=False,
                      widget=atapi.SelectionWidget(
                          description='',
                          label=_('Enter the CPR code of this payment'),
                          size=7)),
    atapi.StringField(
        'mipago_format',
        languageIndependent=True,
        vocabulary=atapi.DisplayList([
            ('502', _(u'502: Notebook 60, modality 1, short format')),
            ('521', _(u'521: Notebook 60, modality 2, short format')),
            ('522', _(u'522: Notebook 60, modality 2, long format')),
            ('507', _(u'507: Notebook 57, short format')),
        ]),
        required=True,
        storage=atapi.AnnotationStorage(),
        searchable=False,
        widget=atapi.SelectionWidget(
            description='',
            label=_('Enter the format code of this payment'),
            size=3)),
    atapi.StringField(
        'mipago_sender',
        languageIndependent=True,
        required=True,
        storage=atapi.AnnotationStorage(),
        searchable=False,
        widget=atapi.StringWidget(
            description='', label=_('Enter the sender code'), size=6)),
    atapi.StringField('mipago_suffix',
                      languageIndependent=True,
                      required=True,
                      storage=atapi.AnnotationStorage(),
                      searchable=False,
                      widget=atapi.StringWidget(
                          description='',
                          label=_('Enter the suffix of this payment'),
                          size=3)),
    atapi.DateTimeField('mipago_payment_limit_date',
                        languageIndependent=True,
                        required=True,
                        storage=atapi.AnnotationStorage(),
                        searchable=False,
                        widget=atapi.CalendarWidget(
                            description='',
                            show_hm=False,
                            label=_('Enter the limit date to do the payment'),
                        )),
    atapi.StringField('mipago_screen_language',
                      required=True,
                      storage=atapi.AnnotationStorage(),
                      searchable=False,
                      vocabulary=atapi.DisplayList([
                          ('eu', 'Euskara'),
                          ('es', 'Español'),
                          ('en', 'English'),
                      ]),
                      widget=atapi.SelectionWidget(
                          description='',
                          label=_('Select the language of the screens'),
                          format='radio',
                          size=40)),
    atapi.LinesField('mipago_payment_modes',
                     languageIndependent=True,
                     required=True,
                     storage=atapi.AnnotationStorage(),
                     searchable=False,
                     vocabulary=atapi.DisplayList([
                         ('01', _('Offline payment')),
                         ('02', _('Online payment')),
                     ]),
                     widget=atapi.MultiSelectionWidget(
                         description='',
                         label=_('Select the available payment modes'),
                         format='checkbox',
                         size=40)),
    atapi.StringField('mipago_payment_description_es',
                      languageIndependent=True,
                      required=True,
                      storage=atapi.AnnotationStorage(),
                      searchable=False,
                      widget=atapi.StringWidget(
                          description='',
                          label=_('Concept description in spanish '),
                      )),
    atapi.StringField('mipago_payment_description_eu',
                      languageIndependent=True,
                      required=True,
                      storage=atapi.AnnotationStorage(),
                      searchable=False,
                      widget=atapi.StringWidget(
                          description='',
                          label=_('Concept description in basque '),
                      )),
    atapi.FloatField('mipago_payment_amount',
                     languageIndependent=True,
                     required=True,
                     storage=atapi.AnnotationStorage(),
                     searchable=False,
                     widget=atapi.DecimalWidget(
                         description='',
                         label=_('Enter the amount to be paid'),
                     )),
    atapi.IntegerField(
        'mipago_reference_number_start',
        languageIndependent=True,
        required=True,
        storage=atapi.AnnotationStorage(),
        searchable=False,
        default=0,
        widget=atapi.IntegerWidget(
            description='',
            label=_('Enter the number of the first reference number'),
            default=
            _('All payments will have consecutive numbers, enter here the value of the first.'
              ),  # no-qa
            size=10)),
    atapi.BooleanField(
        'mipago_use_debug_environment',
        required=False,
        default=True,
        widget=atapi.BooleanWidget(
            description='',
            label=_(
                'Check if the payments should be made on the TEST platform'),
        )),
    atapi.StringField(
        'citizen_surname1',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen surname1 field'),
            description=_(
                u"Select which field of the form has the citizen's 1st surname"
            ),
        ),
    ),
    atapi.StringField(
        'citizen_surname2',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen surname2 field'),
            description=_(
                u"Select which field of the form has the citizen's 2nd surname"
            ),
        ),
    ),
    atapi.StringField(
        'citizen_name',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen name field'),
            description=_(
                u"Select which field of the form has the citizen's name"),
        ),
    ),
    atapi.StringField(
        'citizen_nif',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen nif field'),
            description=_(
                u"Select which field of the form has the citizen's nif"),
        ),
    ),
    atapi.StringField(
        'citizen_address',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen address field'),
            description=_(
                u"Select which field of the form has the citizen's address"),
        ),
    ),
    atapi.StringField(
        'citizen_city',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen city field'),
            description=_(
                u"Select which field of the form has the citizen's city"),
        ),
    ),
    atapi.StringField(
        'citizen_postal_code',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen postal code field'),
            description=_(
                u"Select which field of the form has the citizen's postal code"
            ),
        ),
    ),
    atapi.StringField(
        'citizen_territory',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen territory field'),
            description=_(
                u"Select which field of the form has the citizen's territory"),
        ),
    ),
    atapi.StringField(
        'citizen_country',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen country field'),
            description=_(
                u"Select which field of the form has the citizen's country"),
        ),
    ),
    atapi.StringField(
        'citizen_phone',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen phone field'),
            description=_(
                u"Select which field of the form has the citizen's phone"),
        ),
    ),
    atapi.StringField(
        'citizen_email',
        schemata='citizendata',
        searchable=0,
        required=0,
        vocabulary='fieldsDisplayList',
        widget=atapi.SelectionWidget(
            label=_(u'Citizen email field'),
            description=_(
                u"Select which field of the form has the citizen's email"),
        ),
    ),
    atapi.TextField(
        'message_top_description_spanish',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of the payment title in spanish'),
            description=
            _(u"Write here the spanish text that will override the default name of the payment coming from the payment service configuration"
              ),
        ),
    ),
    atapi.TextField(
        'message_top_description_basque',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of the payment title in basque'),
            description=
            _(u"Write here the basque text that will override the default name of the payment coming from the payment service configuration"
              ),
        ),
    ),
    atapi.TextField(
        'message_4_spanish',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of message 4 in spanish'),
            description=
            _(u"Write here the spanish text that will override the value shown on the header of the PDF file"
              ),
        ),
    ),
    atapi.TextField(
        'message_4_basque',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of message 4 in basque'),
            description=
            _(u"Write here the basque text that will override the value shown on the header of the PDF file"
              ),
        ),
    ),
    atapi.TextField(
        'message_2_spanish',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        default=
        '''La tasa objeto de esta liquidación está sujeta a la Ley 13/1998, de 29 de mayo, de tasas y precios públicos de la Adminsitración de la Comunidad Autónoma del Páis Vasco.''',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of message 2 in spanish'),
            description=
            _(u"Write here the spanish text that will override the value shown in the PDF file"
              ),
        ),
    ),
    atapi.TextField(
        'message_2_basque',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        default=
        '''13/1998 Legeak, maiatzaren 29koa, Euskal Autonomia Erkidegoko Administrazioaren tasa eta prezio publikoei buruzkoa, kitapen honen gaia den tasa arautzen du.''',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of message 2 in basque'),
            description=
            _(u"Write here the basque text that will override the value shown in the PDF file"
              ),
        ),
    ),
    atapi.TextField(
        'message_3_spanish',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        default=
        '''Contra esta liquidación podrá interponerse, en el plazo de 15 días desde su notificación, un recurso de reposición ante el órgano que dictó la resolución, o, en su defecto o contra su resolución, reclamación económico-administrativa ante el "Tribunal Económico-Administrativo de Esukadi", en el mismo plazo.''',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of message 3 in spanish'),
            description=
            _(u"Write here the spanish text that will override the value shown in the PDF file"
              ),
        ),
    ),
    atapi.TextField(
        'message_3_basque',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        allowable_content_types='text/plain',
        default_output_type='text/plain',
        default_content_type='text/plain',
        default=
        '''Kitapenaren kontra berraztertzeko errekurtsoa aurkeztu ahal izango zaio kitapena egin duen organoari, edo, bestela, ebazpenaren kontra Administrazioarekiko diru erreklamazioa jarri ahal izango da Euskadiko Ekonomia Ardularitzako Epaitegian, jakinarazpena jaso eta 15 eguneko epean.''',
        widget=atapi.TextAreaWidget(
            label=_(u'Override the value of message 3 in basque'),
            description=
            _(u"Write here the basque text that will override the value shown in the PDF file"
              ),
        ),
    ),
    atapi.StringField(
        'image_1_link',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        widget=atapi.StringWidget(
            label=_(u'1st image shown in the payment documents'),
            description=
            _(u"Add the URL of the 1st image shown in the payment documents. You will need to send it to the Payment Service Administrators and get the URL from them."
              ),
            size=50,
        ),
    ),
    atapi.StringField(
        'image_2_link',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        widget=atapi.StringWidget(
            label=_(u'2nd image shown in the payment documents'),
            description=
            _(u"Add the URL of the 2nd image shown in the payment documents. You will need to send it to the Payment Service Administrators and get the URL from them."
              ),
            size=50,
        ),
    ),
    atapi.StringField(
        'pdf_generator_template',
        languageIndependent=True,
        schemata='messages',
        searchable=0,
        required=0,
        widget=atapi.StringWidget(
            label=_(u'PDF generator template'),
            description=
            _(u"Add the URL of the XSLT template that renders the PDF file. You will hardly need to change this. Contact the Payment Service Administrators for more information."
              ),
            size=50,
        ),
    ),
    atapi.BooleanField(
        'mipago_use_amountOverride',
        schemata='overrides',
        required=False,
        default=False,
        widget=atapi.BooleanWidget(label=_(
            'Check if you need to calculate the amount using a python script'),
                                   )),
    PythonField(
        'mipago_payment_amountOverride',
        schemata='overrides',
        searchable=0,
        required=0,
        default=default_script,
        write_permission=EDIT_PYTHON_PERMISSION,
        read_permission=ModifyPortalContent,
        isMetadata=True,  # just to hide from base view
        widget=atapi.TextAreaWidget(
            label=_(u'Amount calculation script'),
            rows=20,
            visible={
                'view': 'invisible',
                'edit': 'visible'
            },
            description=_(u'Write here the script that calculates the amount'),
        ),
    ),
))
コード例 #5
0
ArticleSchema = folder.ATFolderSchema.copy() + atapi.Schema((
    atapi.TextField(
        'text',
        primary=True,
        required=False,
        searchable=True,
        storage=atapi.AnnotationStorage(),
        validators=('isTidyHtmlWithCleanup', ),
        default_output_type='text/x-html-safe',
        widget=atapi.RichWidget(
            description='',
            label=_at(u'label_body_text', default=u'Body Text'),
            rows=25,
            allow_file_upload=zconf.ATDocument.allow_document_upload),
    ),
    atapi.BooleanField(
        'hideTitle',
        required=False,
        languageIndependent=True,
        default=False,
        storage=atapi.AnnotationStorage(),
        schemata='settings',
        accessor='HideTitle',
        widget=atapi.BooleanWidget(
            description='',
            label=_(u'label_hide_title', default=u'Hide title'),
            visible={
                'view': 'hidden',
                'edit': 'visible'
            },
        ),
    ),
    atapi.BooleanField(
        'hideDescription',
        required=False,
        languageIndependent=True,
        default=False,
        storage=atapi.AnnotationStorage(),
        schemata='settings',
        accessor='HideDescription',
        widget=atapi.BooleanWidget(
            description='',
            label=_(u'label_hide_description', default=u'Hide description'),
            visible={
                'view': 'hidden',
                'edit': 'visible'
            },
        ),
    ),
))
コード例 #6
0
    def delHook(self, tool, sourceObject=None, targetObject=None):
        """Override standard delHook
        """
        manager = IDynamicViewManager(sourceObject)
        manager.setLayout(None)
        return


CollageAliasSchema = ATCTContent.schema.copy() + atapi.Schema((
    atapi.ReferenceField(
        name='target',
        mutator='set_target',
        accessor='get_target',
        referenceClass=CollageAliasReference,
        relationship='Collage_aliasedItem',
        multiValued=0,
        allowed_types=(),
        widget=ReferenceBrowserWidget(
            label=_(u'label_alias_target', default="Selected target object"),
            startup_directory='/',
        ),
        keepReferencesOnCopy=True,
    ),
))

# we don't require any fields to be filled out
CollageAliasSchema['title'].required = False

# never show in navigation, also when its selected
CollageAliasSchema['excludeFromNav'].default = True

CollageAliasSchema['relatedItems'].widget.visible = {
コード例 #7
0
ファイル: PoiTracker.py プロジェクト: RedTurtle/Products.Poi
schema = atapi.Schema((
    atapi.StringField(
        name='title',
        widget=atapi.StringWidget(
            label=_(u'Poi_label_tracker_title', default=u"Tracker name"),
            description=_(
                u'Poi_help_tracker_title',
                default=u"Enter a descriptive name for this tracker"),
        ),
        required=True,
        accessor="Title",
        searchable=True),
    atapi.TextField(
        name='description',
        widget=atapi.TextAreaWidget(
            label=_(u'Poi_label_tracker_description',
                    default=u"Tracker description"),
            description=_(u'Poi_help_tracker_description',
                          default=u"Describe the purpose of this tracker"),
        ),
        use_portal_factory="1",
        accessor="Description",
        searchable=True,
        allowable_content_types=('text/plain'),
    ),
    atapi.TextField(
        name='helpText',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword'),
        widget=atapi.RichWidget(
            label=_(u'Poi_label_helpText', default=u"Help text"),
            description=_(
                u'Poi_help_helpText',
                default=(u"Enter any introductory help text you'd like to "
                         u"display on the tracker front page.")),
        ),
        default_output_type='text/html',
        searchable=True),
    DataGridField(
        name='availableAreas',
        default=({
            'id': 'ui',
            'title': 'User interface',
            'description': 'User interface issues'
        }, {
            'id': 'functionality',
            'title': 'Functionality',
            'description': 'Issues with the basic functionality'
        }, {
            'id':
            'process',
            'title':
            'Process',
            'description':
            'Issues relating to the development process itself'
        }),
        widget=DataGridWidget(
            label=_(u'Poi_label_availableAreas', default=u"Areas"),
            description=_(
                u'Poi_help_availableAreas',
                default="Enter the issue topics/areas for this tracker."),
            column_names=('Short name', 'Title', 'Description'),
        ),
        allow_empty_rows=False,
        required=True,
        validators=('isDataGridFilled', ),
        columns=(
            'id',
            'title',
            'description',
        )),
    DataGridField(name='availableIssueTypes',
                  default=({
                      'id': 'bug',
                      'title': 'Bug',
                      'description': 'Functionality bugs in the software'
                  }, {
                      'id': 'feature',
                      'title': 'Feature',
                      'description': 'Suggested features'
                  }, {
                      'id': 'patch',
                      'title': 'Patch',
                      'description': 'Patches to the software'
                  }),
                  widget=DataGridWidget(
                      label=_(u'Poi_label_availableIssueTypes',
                              default=u"Issue types"),
                      description=_(
                          u'Poi_help_availableIssueTypes',
                          default=u"Enter the issue types for this tracker."),
                      column_names=(
                          'Short name',
                          'Title',
                          'Description',
                      ),
                  ),
                  allow_empty_rows=False,
                  required=True,
                  validators=('isDataGridFilled', ),
                  columns=('id', 'title', 'description')),
    atapi.LinesField(
        name='availableSeverities',
        default=['Critical', 'Important', 'Medium', 'Low'],
        widget=atapi.LinesWidget(
            label=_(u'Poi_label_availableSeverities',
                    default=u"Available severities"),
            description=_(
                u'Poi_help_availableSeverities',
                default=(u"Enter the different type of issue severities "
                         u"that should be available, one per line.")),
        ),
        required=True),
    atapi.StringField(
        name='defaultSeverity',
        default='Medium',
        widget=atapi.SelectionWidget(
            label=_(u'Poi_label_defaultSeverity', default=u"Default severity"),
            description=_(
                u'Poi_help_defaultSeverity',
                default=u"Select the default severity for new issues."),
        ),
        enforceVocabulary=True,
        vocabulary='getAvailableSeverities',
        required=True),
    atapi.LinesField(
        name='availableReleases',
        widget=atapi.LinesWidget(
            label=_(u'Poi_label_availableReleases',
                    default=u"Available releases"),
            description=_(
                u'Poi_help_availableReleases',
                default=(
                    u"Enter the releases which issues can be assigned to, "
                    u"one per line. If no releases are entered, issues "
                    u"will not be organised by release.")),
        ),
        required=False),
    atapi.LinesField(
        name='managers',
        widget=atapi.LinesWidget(
            label=_(u'Poi_label_managers', default=u"Tracker managers"),
            description=_(
                u'Poi_help_managers',
                default=(
                    u"Enter the user ids of the users who will be allowed "
                    u"to manage this tracker, one per line.")),
        ),
        default_method="getDefaultManagers"),
    atapi.LinesField(
        name='technicians',
        widget=atapi.LinesWidget(
            label=_(u'Poi_label_technicians', default=u"Technicians"),
            description=_(
                u'Poi_help_technicians',
                default=(u"Enter the user ids of the users who will be "
                         u"responsible for solving the issues, one per line. "
                         u"Note that having only managers and no technicians "
                         u"is fine: managers can solve issues too.")),
        ),
    ),
    atapi.LinesField(
        name='watchers',
        widget=atapi.LinesWidget(
            label=_(u'Poi_label_tracker_watchers',
                    default=u"Tracker watchers"),
            description=_(
                u'Poi_help_tracker_watchers',
                default=(u"Enter the user ids of members who are watching "
                         u"this tracker, one per line. E-mail addresses are "
                         u"allowed too. These persons will receive "
                         u"an email when an issue or response is added to the "
                         u"tracker. Members can also add themselves as "
                         u"watchers.")),
        ),
        write_permission=permissions.ModifyIssueWatchers),
    atapi.BooleanField(
        name='sendNotificationEmails',
        default=True,
        widget=atapi.BooleanWidget(
            label=_(u'Poi_label_sendNotificationEmails',
                    default=u"Send notification emails"),
            description=_(
                u'Poi_help_sendNotificationEmails',
                default=(
                    u"If selected, tracker managers will receive an email "
                    u"each time a new issue or response is posted, and "
                    u"issue submitters will receive an email when there "
                    u"is a new response and when an issue has been "
                    u"resolved, awaiting confirmation. Technicians will "
                    u"get an email when an issue is assigned to them.")),
        ),
    ),
    atapi.StringField(
        name='mailingList',
        widget=atapi.StringWidget(
            label=_(u'Poi_label_mailingList', default=u"Mailing list"),
            description=_(
                u'Poi_help_mailingList',
                default=(u"If given, and if 'Send notification emails' is "
                         u"selected, an email will be sent to this address "
                         u"each time a new issue or response is posted. "
                         u"Managers will receive individual emails as well. "
                         u"If this is not wanted, you may want to make them "
                         u"technician instead.")),
        ),
        required=False,
        validators=('isEmail', )),
    atapi.StringField(
        name='svnUrl',
        widget=atapi.StringWidget(
            label=_(u'Poi_label_svnurl', default=u"URL to SVN"),
            description=_(
                u'Poi_help_svnurl',
                default=(
                    u"Please enter the Url to the related SVN repository, "
                    u"e.g.: "
                    u"http://dev.plone.org/changeset/%(rev)s/collective "
                    u"for products in the Plone collective.")),
            size='90',
        ),
        required=False,
    ),
))
コード例 #8
0
CollageSchema = atapi.BaseContent.schema.copy() + atapi.Schema((
    atapi.StringField(
        name='title',
        searchable=True,
        widget=atapi.StringWidget(
            label='Title',
            label_msgid='label_title',
            i18n_domain='plone',
        )
    ),

    atapi.TextField(
        name='description',
        searchable=True,
        widget=atapi.TextAreaWidget(
            label='Description',
            label_msgid='label_description',
            i18n_domain='plone',
        )
    ),
    atapi.BooleanField(
        'show_title',
        accessor='getShowTitle',
        widget=atapi.BooleanWidget(
            label=_(u'label_show_title', default=u"Show title"),
            description=_(
                u'help_show_title',
                default=u"Show title in page composition."
            )
        ),
        default=1,
        languageIndependent=True,
        schemata="settings"),

    atapi.BooleanField(
        'show_description',
        accessor='getShowDescription',
        widget=atapi.BooleanWidget(
            label=_(u'label_show_description',
                    default='Show description'),
            description=_(
                u'help_show_description',
                default=u"Show description in page composition."
            )
        ),
        default=1,
        languageIndependent=True,
        schemata="settings"),

    atapi.BooleanField(
        'index_subobjects',
        accessor='mustIndexSubobjects',
        default=False,
        languageIndependent=True,
        schemata="settings",
        widget=atapi.BooleanWidget(
            label=_(u'label_index_subobjects',
                    default=u"Add collage contents in searchable text?"),
            description=_(
                u'help_index_subobjects',
                default=u"Show this collage in results when searching for "
                        u"terms appearing in a contained item. "
                        u"Note: Checking this option may slow down the system "
                        u"while editing the collage."
            )
        )
    )


))
コード例 #9
0
CarouselBannerSchema = link.ATLinkSchema.copy() + atapi.Schema((
    atapi.ImageField(
        'image',
        required=False,
        storage=atapi.AnnotationStorage(),
        languageIndependent=True,
        max_size=zconf.ATNewsItem.max_image_dimension,
        sizes={},
        validators=(('isNonEmptyFile', V_REQUIRED),
                    ('checkNewsImageMaxSize', V_REQUIRED)),
        widget=atapi.ImageWidget(description=_(
            'This image will be shown when this banner is active.'),
                                 label=_('Image'),
                                 show_content_type=False)),
    atapi.StringField('imageUrl',
                      required=False,
                      searchable=False,
                      default="http://",
                      widget=atapi.StringWidget(description=_(
                          'Instead of uploading an image, you may enter'
                          ' the URL of an image hosted on another server.'),
                                                label=_('Image URL'),
                                                maxlength='511')),
    atapi.TextField(
        'text',
        required=False,
        validators=('isTidyHtmlWithCleanup', ),
        default_output_type='text/x-html-safe',
        widget=atapi.RichWidget(label=_('Body'), ),
    ),
))
コード例 #10
0
type_schema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
    atapi.ImageField(
        'image',
        required=False,
        languageIndependent=True,
        sizes=allowed_sizes,
        widget=atapi.ImageWidget(
            label=_(u"label_image", default=u"Image"),
            description=_(u"help_image",
                          default=u"Image to display as teaser."),
        ),
    ),
    atapi.ReferenceField(
        'link_internal',
        required=False,
        searchable=False,
        languageIndependent=True,
        multiValued=False,
        relationship='ref_link_internal',
        widget=ReferenceBrowserWidget(
            label=_(u"label_link_internal", default=u"Internal Link"),
            description=_(u"help_link_internal",
                          default=u"Link to internal content. For external "
                          u"content, use the External Link field."),
            allow_search=True,
            allow_browse=True,
            force_close_on_insert=True,
            startup_directory='/',
        ),
    ),
    atapi.StringField(
        'link_external',
        required=False,
        searchable=False,
        languageIndependent=True,
        validators=("isURL"),
        widget=atapi.StringWidget(
            label=_(u"label_link_external", default=u"External Link"),
            description=_(
                u"help_link_external",
                default=u"Url to external content. For internal content, "
                u"use the field above. Use form http://WEBSITE.TLD/"),
        ),
    ),
    atapi.StringField(
        'importance',
        required=True,
        searchable=True,
        languageIndependent=True,
        vocabulary_factory="collective.teaser.ImportanceVocabulary",
        enforceVocabulary=True,
        default=DEFAULT_IMPORTANCE,
        widget=atapi.SelectionWidget(
            label=_(u"label_importance", default=u"Importance"),
            description=_(u"help_importance",
                          default=u"Select the importance of the teaser. "
                          u"The frequency of the teaser will be "
                          u"set accordingly."),
        ),
    ),
))