# Archetypes imports
try:
    from Products.LinguaPlone.public import registerType, Schema, StringField
except ImportError:
    # No multilingual support
    from Products.Archetypes.public import registerType, Schema, StringField

from Products.PloneArticle.content.article import PloneArticle, PloneArticleSchema

from Products.PloneArticle import config

# Inherits schema from PloneArticle
# Copy it to make sure PloneArticle schema is totally independant
ArticleWithLocationSchema = PloneArticleSchema.copy() + Schema((StringField(
    'location',
    schemata='misc',
), ), )

# Inherits actions from PloneArticle
# Copy them to make sure ArticleWithLocation actions are totally independant
ArticleWithLocationActions = deepcopy(PloneArticle.actions)


class ArticleWithLocation(PloneArticle):
    """
        An article with a location field
    """

    # Standard content type setup
    portal_type = meta_type = 'ArticleWithLocation'
    archetype_name = 'Article with location'
Beispiel #2
0
from Products.ATContentTypes.content.newsitem import ATNewsItem
from Products.Archetypes.Schema import getNames
from Products.CMFCore.permissions import ModifyPortalContent
from Products.CMFCore.permissions import View
from Products.LinguaPlone.public import Schema, registerType
from Products.EEAContentTypes.config import PROJECTNAME
from Products.EEAContentTypes.content.ExternalHighlight import ExternalHighlight
from Products.EEAContentTypes.content.ExternalHighlight import schema as \
    ExtHighlightSchema
from Products.EEAContentTypes.content.interfaces import IExternalHighlight
from Products.EEAContentTypes.content.quotation import quotation_schema
from Products.EEAContentTypes.content.validators import ExistsKeyFactsValidator
from zope.interface import implements
from eea.themecentre.interfaces import IThemeTagging

schema = Schema((), )

Highlight_schema = getattr(ATNewsItem, 'schema', Schema(())).copy() + \
                   getattr(ExternalHighlight, 'schema', Schema(())).copy() + \
                   quotation_schema.copy() + \
                   schema.copy()

# put all the external highlights fields into their own schema
ExternalHighlightSchema = ExtHighlightSchema.copy()

fields2Move2DefaultSchemata = ['management_plan']
for fieldname in getNames(ExternalHighlightSchema):
    field = Highlight_schema[fieldname]
    if fieldname in fields2Move2DefaultSchemata:
        field.schemata = 'default'
    elif field.schemata != 'metadata':
PdfBaseSchema['id'].widget.condition = 'python: not object.getBibFolder().getSynchronizePdfFileAttributes()'
PdfBaseSchema['title'].required = False
PdfBaseSchema['title'].widget.visible['edit'] = 'invisible'
PdfBaseSchema['description'].widget.visible['edit'] = 'invisible'
PdfBaseSchema['relatedItems'].widget.visible['edit'] = 'invisible'
PdfBaseSchema['allowDiscussion'].widget.visible['edit'] = 'invisible'

PdfFileSchema = PdfBaseSchema + Schema((
    FileField('file',
              #required=True,
              primary=True,
              languageIndependent=True,
              default_content_type = "application/pdf",
              storage = Storage(),
              # validators = (('isNonEmptyFile', V_REQUIRED),),
              widget = FileWidget(
                        label= "Printable File",
                        label_msgid = "label_upload_pdffile_from_bibrefitem",
                        description = "If not in conflict with any copyright issues, use this field to upload a printable version (PDF file) of the referenced resource.",
                        description_msgid = "help_upload_pdffile_from_bibrefitem",
                        i18n_domain = "cmfbibliographyat",
                        show_content_type = False,)),
    ) , marshall=PrimaryFieldMarshaller()
    )

finalizeATCTSchema(PdfFileSchema)

class PdfFolder(ATBTreeFolder):
    """CMFBib's specialized folder for holding printable (pdf) files"""

    implements(IPdfFolder)
else:
    from Products.Archetypes.public import Schema

from Products.ATContentTypes.content.base import registerATCT as registerType
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import schoolField, addressField, typeField, isbnField

SourceSchema = Schema((
    typeField,
    schoolField,
    addressField,
    isbnField,
))

PhdthesisSchema = HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() +  \
                  SourceSchema.copy() + TrailingSchema.copy()
PhdthesisSchema.get('authors').required = 1
PhdthesisSchema.get('school').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
PhdthesisSchema.get('description').widget.visible = {
    'view': 'invisible',
    'edit': 'invisible',
}

finalizeATCTSchema(PhdthesisSchema)
    from Products.LinguaPlone.public import Schema
else:
    from Products.Archetypes.public import Schema

from Products.ATContentTypes.content.base import registerATCT as registerType
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields import howpublishedField

howpublishedspecificField = howpublishedField.copy()
howpublishedspecificField.default = ''
SourceSchema = Schema((howpublishedspecificField, ))

MiscSchema = HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() +  \
             SourceSchema.copy() + TrailingSchema.copy()
MiscSchema.get('authors').required = 0
# normally the publication_year for MiscReferences is optional, but
# in CMFBAT we better force the user to enter something here (better not
# irritate portal_catalog...).
MiscSchema.get('publication_year').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
MiscSchema.get('description').widget.visible = {
    'view': 'invisible',
    'edit': 'invisible',
}
schema = Schema(
    (
        TextField(
            name="text",
            allowable_content_types=("text/plain", "text/structured", "text/html", "application/msword"),
            widget=RichWidget(
                description="""Texte
            Descriptif de la promotion - dernieres minutes""",
                searchable=1,
                label="Text",
                label_msgid="GitesContent_label_text",
                description_msgid="GitesContent_help_text",
                i18n_domain="gites",
            ),
            default_output_type="text/html",
            required=0,
        ),
        StringField(
            name="category",
            widget=SelectionWidget(
                description="""Type
            Type de derniere minute""",
                label="Category",
                label_msgid="GitesContent_label_category",
                description_msgid="GitesContent_help_category",
                i18n_domain="gites",
            ),
            required=1,
            multiValued=0,
            vocabulary="getAvailableCategories",
        ),
        LinesField(
            name="hebergementsConcernes",
            widget=DBReferenceWidget(
                description="""Hebergement concerne
            Hebergement concerne par la promotion ou la derniere minute""",
                label="Hebergementsconcernes",
                label_msgid="GitesContent_label_hebergementsConcernes",
                description_msgid="GitesContent_help_hebergementsConcernes",
                i18n_domain="gites",
            ),
            multiValued=0,
        ),
        DateTimeField(
            name="startDate",
            mutator="setStart",
            widget=CalendarWidget(
                label="Date de debut de publication",
                description="Date a laquelle la derniere minute - promotion est publie",
                label_msgid="GitesContent_label_startDate",
                description_msgid="GitesContent_help_startDate",
                i18n_domain="gites",
            ),
            required=1,
            show_hm=False,
            languageIndependent=1,
        ),
        DateTimeField(
            name="endDate",
            mutator="setEnd",
            widget=CalendarWidget(
                description="""Date de fin de publication
            Date de fin de la publication de la derniere minute""",
                label="Enddate",
                label_msgid="GitesContent_label_endDate",
                description_msgid="GitesContent_help_endDate",
                i18n_domain="gites",
            ),
            required=1,
            show_hm=False,
            languageIndependent=1,
        ),
        DateTimeField(
            name="eventStartDate",
            widget=CalendarWidget(
                show_hm=False,
                description="""Debut de l evenement
            Date a laquelle l evenement commence""",
                label="Eventstartdate",
                label_msgid="GitesContent_label_eventStartDate",
                description_msgid="GitesContent_help_eventStartDate",
                i18n_domain="gites",
            ),
            languageIndependent=1,
            required=1,
        ),
        DateTimeField(
            name="eventEndDate",
            widget=CalendarWidget(
                show_hm=False,
                description="Date a laquelle l evenement se fini",
                label="Fin de l evenement",
                label_msgid="GitesContent_label_eventEndDate",
                description_msgid="GitesContent_help_eventEndDate",
                i18n_domain="gites",
            ),
            languageIndependent=1,
            required=1,
        ),
    )
)
Beispiel #7
0
                                         registerType)
from Products.EEAContentTypes.config import PROJECTNAME
from Products.EEAContentTypes.content.ExternalHighlight import ExternalHighlight
from Products.EEAContentTypes.content.ExternalHighlight import schema as \
    ExtHighlightSchema
from Products.EEAContentTypes.content.Highlight import Highlight
from Products.EEAContentTypes.content.interfaces import IArticle
from zope.interface import implements
from eea.themecentre.interfaces import IThemeTagging

schema = Schema((LinesField(
    'publication_groups',
    schemata='categorization',
    vocabulary=NamedVocabulary("publications_groups"),
    languageIndependent=True,
    index="KeywordIndex:brains",
    widget=InAndOutWidget(
        label=_(u'Publication groups'),
        description=_(u'Fill in publication groups'),
        i18n_domain='eea',
    ),
), ), )

Article_schema = getattr(Highlight, 'schema', Schema(())).copy() + \
                 schema.copy()

fields2Move2DefaultSchemata = [
    'management_plan', 'image', 'imageLink', 'imageCaption', 'imageNote'
]
for fieldname in getNames(ExtHighlightSchema):
    field = Article_schema[fieldname]
    if fieldname in fields2Move2DefaultSchemata:
Beispiel #8
0
else:
    from Products.Archetypes.public import Schema

from Products.ATContentTypes.content.base import registerATCT as registerType
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import institutionField, typeField, numberField, addressField

SourceSchema = Schema((
    institutionField,
    typeField,
    numberField,
    addressField,
))

TechreportSchema = HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() +  \
                   SourceSchema.copy() + TrailingSchema.copy()
TechreportSchema.get('authors').required = 1
TechreportSchema.get('publication_year').required = 1
TechreportSchema.get('institution').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
TechreportSchema.get('description').widget.visible = {
    'view': 'invisible',
    'edit': 'invisible',
}
SourceSchema = Schema((
    journalField,
    volumeField,
    numberField,
    pagesField,
    StringField(
        'pmid',
        is_duplicates_criterion=True,
        widget=StringWidget(
            label="PubMed ID",
            label_msgid="label_pmid",
            description="The reference's number in the PubMed database.",
            description_msgid="help_pmid",
            i18n_domain="cmfbibliographyat",
            visible={
                'view': 'invisible',
                'edit': 'invisible',
            }),
    ),
    StringField(
        'DOI',
        is_duplicates_criterion=True,
        widget=StringWidget(
            label="DOI",
            label_msgid="label_doi",
            description="The reference's digital object identifier.",
            description_msgid="help_doi",
            i18n_domain="cmfbibliographyat",
            visible={
                'view': 'invisible',
                'edit': 'invisible',
            }),
    ),
))
    from Products.Archetypes.public import StringWidget

from Products.ATContentTypes.content.base import registerATCT as registerType
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import publisherField, addressField, editionField, volumeField, \
           numberField, seriesField, editor_flagField, isbnField


AuthorTrailingSchema = Schema((
    editor_flagField,
    ))

SourceSchema = Schema((
    publisherField,
    addressField,
    editionField,
    volumeField,
    numberField,
    seriesField,
    isbnField,
))
BookSchema = HeaderSchema.copy() + AuthorSchema.copy() + AuthorTrailingSchema.copy() + \
             CoreSchema.copy() + SourceSchema.copy() + TrailingSchema.copy()
BookSchema.get('authors').required = 1
BookSchema.get('publication_year').required = 1
Beispiel #11
0
from plone.app.blob.field import BlobField
from Products.Archetypes.atapi import StringField
from Products.CMFPlone import PloneMessageFactory as _
from Products.LinguaPlone.public import BaseContent
from Products.LinguaPlone.public import BaseSchema
from Products.LinguaPlone.public import FileWidget
from Products.LinguaPlone.public import registerType
from Products.LinguaPlone.public import Schema

BlobelFishSchema = BaseSchema.copy() + Schema((
    BlobField(name='guide',
              primary=True,
              languageIndependent=True,
              widget=FileWidget(
                  label=_(u'label_file', default=u'File'),
                  description=_(u''),
              )),
    StringField(
        name='teststr',
        languageIndependent=True,
    ),
))


class BlobelFish(BaseContent):
    """ a multilingual fish """

    schema = BlobelFishSchema
    _at_rename_after_creation = True

Beispiel #12
0
else:
    from Products.Archetypes.public import Schema

from Products.ATContentTypes.content.base import registerATCT as registerType
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import organizationField, addressField, editionField, isbnField

SourceSchema = Schema((
    organizationField,
    addressField,
    editionField,
    isbnField,
))

ManualSchema = HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() +  \
               SourceSchema.copy() + TrailingSchema.copy()
ManualSchema.get('authors').required = 0
# normally the publication_year for ManualReferences is optional, but
# in CMFBAT we better force the user to enter something here (better not
# irritate portal_catalog...).
ManualSchema.get('publication_year').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
ManualSchema.get('description').widget.visible = {
    'view': 'invisible',
    'edit': 'invisible',
Beispiel #13
0
SimpleSchema = BaseSchema + Schema((
    TextField(
        name='body',
        required=True,
        searchable=True,
        default_output_type='text/html',
        allowable_content_types=(
            'text/plain',
            'text/restructured',
            'text/html',
            'application/msword',
        ),
        widget=RichWidget(
            description='Enter or upload text for the body of the document.',
        ),
    ),
    StringField(
        name='contactName',
        languageIndependent=True,
        widget=StringWidget(description='Enter a contact person.', ),
    ),
    StringField(
        name='contactName2',
        languageIndependent=True,
        widget=StringWidget(description='Enter a contact person.', ),
    ),
    StringField(
        name='contactName3',
        languageIndependent=True,
        widget=StringWidget(description='Enter a contact person.', ),
    ),
    StringField(
        name='contactName4',
        languageIndependent=False,
        accessor='getFourthContactName',
        mutator='setFourthContactName',
        widget=StringWidget(
            description='This field has custom accessor and mutator.', ),
    ),
    StringField(
        name='contactName5',
        languageIndependent=True,
        accessor='getFifthContactName',
        mutator='setFifthContactName',
        widget=StringWidget(
            description='This field has custom accessor and mutator.', ),
    ),
    StringField(
        name='langIndependentInBase',
        languageIndependent=True,
        widget=StringWidget(
            description='This field is language independent in SimpleType.', ),
    ),
    StringField(
        name='langIndependentInDerived',
        languageIndependent=False,
        widget=StringWidget(
            description='This field is language dependent in DerivedType.', ),
    ),
    StringField(
        name='langIndependentInBoth',
        languageIndependent=True,
        widget=StringWidget(
            description='This field is language independent everywhere.', ),
    ),
    ImageField(
        name='image',
        languageIndependent=True,
    ),
    ImageField(
        name='imageDependent',
        languageIndependent=False,
    ),
    ReferenceField(
        name='reference',
        allowed_types=('SimpleType', ),
        languageIndependent=True,
        relationship='referenceType',
    ),
    ReferenceField(
        name='referenceDependent',
        allowed_types=('SimpleType', ),
        languageIndependent=False,
        relationship='referenceDependentType',
    ),
    ReferenceField(
        name='referenceMulti',
        allowed_types=('SimpleType', ),
        languageIndependent=True,
        multiValued=True,
        relationship='referenceType',
    ),
    LinesField(
        name='lines',
        languageIndependent=True,
        widget=LinesWidget(label="Lines"),
    ),
    TextField(
        name='neutralText',
        languageIndependent=True,
        default_output_type='text/html',
        widget=RichWidget(description='Enter some text', ),
    ),
))
Beispiel #14
0
validation.register(MaxValuesValidator('maxValues'))

schema = Schema((

    ThemesField(
        name='themes',
        schemata='categorization',
        validators=('maxValues',),
        widget=InAndOutWidget
        (
            maxValues=3,
            label="Themes",
            description="Choose max 3 themes",
            label_msgid='EEAContentTypes_label_themes',
            description_msgid='EEAContentTypes_help_themes',
            i18n_domain='EEAContentTypes',
        ),
        languageIndependent=True,
        vocabulary='_getMergedThemes',
        index="KeywordIndex:brains",
        enforceVocabulary=1,
        default=[],
        accessor='getThemes',
        mutator='setThemes',
    ),

),
)


ThemeTaggable_schema = schema.copy()

from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.content.schemata import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema


SourceSchema = Schema(
    (
        StringField(
            "preprint_server",
            searchable=1,
            required=0,
            vocabulary="PreprintServers",
            widget=SelectionWidget(
                label="Preprint server",
                label_msgid="label_preprint_server",
                description="If the preprint is available from one of the following preprint servers, you can indicate that here. Contact the site's admin if you want a server to be added to the list.",
                description_msgid="help_preprint_server",
                i18n_domain="cmfbibliographyat",
            ),
        ),
    )
)

PreprintSchema = (
    HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() + SourceSchema.copy() + TrailingSchema.copy()
)

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
PreprintSchema.get("description").widget.visible = {"view": "invisible", "edit": "invisible"}
Beispiel #16
0
schema = Schema((

    TextField(
        name='description',
        widget=TextAreaWidget(
            description="Description succinte du produit",
            label='Description',
            label_msgid='GitesContent_label_description',
            description_msgid='GitesContent_help_description',
            i18n_domain='gites',
        )
    ),

    TextField(
        name='textTop',
        allowable_content_types=('text/plain', 'text/structured', 'text/html', 'application/msword'),
        widget=RichWidget(
            description="Texte d'introduction du produit",
            label='Description',
            label_msgid='GitesContent_label_description',
            description_msgid='GitesContent_help_description',
            i18n_domain='gites',
        ),
        default_output_type='text/html'
    ),

    TextField(
        name='text',
        allowable_content_types=('text/plain', 'text/structured', 'text/html', 'application/msword'),
        widget=RichWidget(
            description="Texte du produit",
            label='Text',
            label_msgid='GitesContent_label_text',
            description_msgid='GitesContent_help_text',
            i18n_domain='gites',
        ),
        default_output_type='text/html'
    ),

    BooleanField(
        name='showInCarousel',
        languageIndependent=True,
        default=False,
        widget=BooleanWidget(
            label='Afficher dans le Carousel',
            description="Afficher le produit dans le Carousel de la page d'accueil",
        ),
    ),

    ImageField(
        name='largePhoto',
        widget=ImageWidget(
            label='Photo large (1100 x 333 px)',
            description="Photo utilisée dans le descriptif du produit et pour le Carousel de la page d'accueil",
        ),
    ),

    DateTimeField(
        name='startDate',
        languageIndependent=True,
        required=0,
        widget=CalendarWidget(
            label="Date de début de l'évenement",
            description="Date de début servant de filtre pour les disponibilités des hébergements",
        ),
    ),

    DateTimeField(
        name='endDate',
        languageIndependent=True,
        required=0,
        widget=CalendarWidget(
            label="Date de fin de l'évenement",
            description="Date de fin servant de filtre pour les disponibilités des hébergements",
        ),
    ),

    LinesField(
        name='criteria',
        schemata=u'Criteres',
        languageIndependent=True,
        vocabulary=CriteriaVocabularyFactory,
        widget=ChosenWidget(
            description="Critères du package",
            label='Criteria',
            label_msgid='gites_core_package_criteria_label',
            description_msgid='gites_core_package_criteria_description',
            i18n_domain='gites',
        )
    ),
    IntegerField(
        name='range',
        schemata='Geolocation',
        widget=IntegerWidget(
            description="Rayon de selection d'hebergement autour du point (en km)",
            label='Rayon',
            label_msgid='gites_core_package_range_label',
            description_msgid='gites_core_package_range_description',
            i18n_domain='gites'
        )),
    LinesField(
        name='userCriteria',
        multiValued=1,
        schemata=u'Criteres',
        languageIndependent=True,
        vocabulary=CriteriaVocabularyFactory,
        widget=ChosenWidget(
            description="""Critères à choisir par l'utilisateur""",
            label='User Criteria',
            label_msgid='gites_core_package_usercriteria_label',
            description_msgid='gites_core_packages_usercriteria_description',
            i18n_domain='gites',
        ))

),
)
Beispiel #17
0
            return "To many values, please choose max %s." % max_values
        return 1


validation.register(MaxValuesValidator('maxValues'))

schema = Schema((ThemesField(
    name='themes',
    schemata='categorization',
    validators=('maxValues', ),
    widget=InAndOutWidget(
        maxValues=3,
        label="Themes",
        description="Choose max 3 themes",
        label_msgid='EEAContentTypes_label_themes',
        description_msgid='EEAContentTypes_help_themes',
        i18n_domain='EEAContentTypes',
    ),
    languageIndependent=True,
    vocabulary='_getMergedThemes',
    index="KeywordIndex:brains",
    enforceVocabulary=1,
    default=[],
    accessor='getThemes',
    mutator='setThemes',
), ), )

ThemeTaggable_schema = schema.copy()


class ThemeTaggable(BaseContent):
    """ Theme Taggable Content-Type
from Products.PloneArticle.config import PROJECTNAME

schema = ATFolder.schema.copy() \
         + Schema((
    BooleanField(
        'viewTOCFirst',
        default=False,
        widget=BooleanWidget(
            label='View table of contents first',
            label_msgid='label_view_toc_first',
            i18n_domain='plonearticle',
            visible={'view' : 'invisible'},
        )
    ),
    BooleanField(
        'viewTOC',
        default=True,
        widget=BooleanWidget(
            label='Display table of contents in dropdown list',
            label_msgid='label_display_toc_dropdown',
            description='If you have checked properties to view TOC first, this property will not be applied.',
            description_msgid='description_display_toc_dropdown',
            i18n_domain='plonearticle',
            visible={'view' : 'invisible'},
        )
    ),
    ))


class PloneArticleMultiPage(ATFolder):
    """ A folder containing articles """
schema = Schema((
    ImageBlobField(
        'image',
        required=False,
        storage=AnnotationStorage(migrate=True),
        languageIndependent=True,
        swallowResizeExceptions=enable_exception,
        pil_quality=zconf.pil_config.quality,
        pil_resize_algo=zconf.pil_config.resize_algo,
        max_size=(1280, 1024),
        sizes=None,
        validators=(('isNonEmptyFile', V_REQUIRED), ('checkFileMaxSize',
                                                     V_REQUIRED)),
        widget=ImageWidget(
            description=("Will be shown in the news listing, and in the news "
                         "item itself. Image will be scaled to a sensible "
                         "size."),
            description_msgid="help_news_image",
            label="Image",
            label_msgid="label_news_image",
            i18n_domain="plone",
            show_content_type=False)),
    StringField(name='url',
                widget=StringWidget(
                    label='Url',
                    label_msgid='EEAContentTypes_label_url',
                    i18n_domain='EEAContentTypes',
                )),
))
Beispiel #20
0
from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.inbook import InbookReference
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import booktitleField, editorField, volumeField, numberField, \
           typeField, publisherField, addressField, \
           editionField, seriesField, chapterField, pagesField, isbnField

SourceSchema = Schema((
    booktitleField,
    editorField,
    volumeField,
    numberField,
    typeField,
    publisherField,
    addressField,
    editionField,
    seriesField,
    chapterField,
    pagesField,
    isbnField,
))

IncollectionSchema = HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() +  \
                     SourceSchema.copy() + TrailingSchema.copy()
IncollectionSchema.get('authors').required = 1
IncollectionSchema.get('publication_year').required = 1
IncollectionSchema.get('booktitle').required = 1
IncollectionSchema.get('publisher').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
Beispiel #21
0
AuthorSchema = Schema((
    FormattableNamesField(
        'authors',  # was 'publication_authors',
        searchable=1,
        required=0,
        minimalSize=2,
        subfields=('username', 'firstnames', 'lastname', 'homepage'),
        subfield_sizes={
            'firstnames': 20,
            'lastname': 20,
            'homepage': 15
        },
        subfield_labels={'username': '******'},
        subfield_vocabularies={'username': '******'},
        subfield_conditions={'username': '******'},
        subfield_maxlength={
            'homepage': 250,
        },
        is_duplicates_criterion=True,
        widget=FormattableNamesWidget(
            label="Authors",
            label_msgid="label_authors",
            macro_edit="authors_widget",
            helper_js=('authors_widget.js', ),
            description=
            "If possible, always fill in the complete authors' / editors' names.",
            description_msgid="help_authors",
            i18n_domain="cmfbibliographyat",
        ),
    ), ))
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.inbook import InbookReference
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import booktitleField, volumeField, numberField, \
           publisherField, organizationField, addressField, \
           seriesField, pagesField

SourceSchema = Schema((
    booktitleField,
    volumeField,
    numberField,
    seriesField,
    pagesField,
    addressField,
    organizationField,
    publisherField,
))

ConferenceSchema = HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() +  \
               SourceSchema.copy() + TrailingSchema.copy()
ConferenceSchema.get('authors').required = 1
ConferenceSchema.get('booktitle').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
ConferenceSchema.get('description').widget.visible = {
    'view': 'invisible',
    'edit': 'invisible',
}
Beispiel #23
0
from Products.ATContentTypes.content.base import registerATCT as registerType
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema

SourceSchema = Schema((StringField(
    'preprint_server',
    searchable=1,
    required=0,
    vocabulary="PreprintServers",
    widget=SelectionWidget(
        label="Preprint server",
        label_msgid="label_preprint_server",
        description=
        "If the preprint is available from one of the following preprint servers, you can indicate that here. Contact the site's admin if you want a server to be added to the list.",
        description_msgid="help_preprint_server",
        i18n_domain="cmfbibliographyat",
    ),
), ))

PreprintSchema = HeaderSchema.copy() + AuthorSchema.copy() + CoreSchema.copy() +  \
                 SourceSchema.copy() + TrailingSchema.copy()

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
PreprintSchema.get('description').widget.visible = {
    'view': 'invisible',
    'edit': 'invisible',
}
schema = Schema((
    ImageBlobField('image',
                   required=False,
                   storage=AnnotationStorage(migrate=True),
                   languageIndependent=True,
                   swallowResizeExceptions=enable_exception,
                   pil_quality=zconf.pil_config.quality,
                   pil_resize_algo=zconf.pil_config.resize_algo,
                   max_size=(1280, 1024),
                   sizes={'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),
                               ('checkFileMaxSize', V_REQUIRED)),
                   widget=ImageWidget(
                       description=(
                           "Will be shown in the news listing, and in the news "
                           "item itself. Image will be scaled to a sensible "
                           "size."),
                       description_msgid="help_news_image",
                       label="Image",
                       label_msgid="label_news_image",
                       i18n_domain="plone",
                       show_content_type=False)
                   ),
    StringField(
        name='url',
        widget=StringWidget(
            label='Url',
            label_msgid='EEAContentTypes_label_url',
            i18n_domain='EEAContentTypes',
        )
    ),

))
from Products.CMFBibliographyAT.content.book \
    import AuthorTrailingSchema

ThisAuthorTrailingSchema = AuthorTrailingSchema.copy()
ThisAuthorTrailingSchema['editor_flag'].default = 1
ThisAuthorTrailingSchema[
    'editor_flag'].widget.description = 'Leave this checked unless the people specified above are not the editors of this proceedings volume.'
ThisAuthorTrailingSchema[
    'editor_flag'].widget.description_msgid = 'help_editor_flag_checked'
ThisAuthorTrailingSchema['editor_flag'].mode = 'r'

SourceSchema = Schema((
    publisherField,
    addressField,
    volumeField,
    numberField,
    organizationField,
    seriesField,
    isbnField,
))

ProceedingsSchema = HeaderSchema.copy() + AuthorSchema.copy() + ThisAuthorTrailingSchema.copy() + \
                    CoreSchema.copy() + SourceSchema.copy() + TrailingSchema.copy()
ProceedingsSchema.get('authors').required = 0
ProceedingsSchema.get('publication_year').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
ProceedingsSchema.get('description').widget.visible = {
    'view': 'invisible',
    'edit': 'invisible',
}
    from Products.Archetypes.public import Schema
    from Products.Archetypes.public import StringField
    from Products.Archetypes.public import StringWidget

from Products.ATContentTypes.content.base import registerATCT as registerType
from Products.ATContentTypes.content.schemata import finalizeATCTSchema

from Products.CMFBibliographyAT.content.base import BaseEntry
from Products.CMFBibliographyAT.config import PROJECTNAME
from Products.CMFBibliographyAT.content.schemata \
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import publisherField, addressField, editionField, volumeField, \
           numberField, seriesField, editor_flagField, isbnField

AuthorTrailingSchema = Schema((editor_flagField, ))

SourceSchema = Schema((
    publisherField,
    addressField,
    editionField,
    volumeField,
    numberField,
    seriesField,
    isbnField,
))
BookSchema = HeaderSchema.copy() + AuthorSchema.copy() + AuthorTrailingSchema.copy() + \
             CoreSchema.copy() + SourceSchema.copy() + TrailingSchema.copy()
BookSchema.get('authors').required = 1
BookSchema.get('publication_year').required = 1
BookSchema.get('publisher').required = 1
    import publisherField, addressField, volumeField, numberField, \
           organizationField, seriesField, isbnField
from Products.CMFBibliographyAT.content.book \
    import AuthorTrailingSchema

ThisAuthorTrailingSchema = AuthorTrailingSchema.copy()
ThisAuthorTrailingSchema['editor_flag'].default=1
ThisAuthorTrailingSchema['editor_flag'].widget.description='Leave this checked unless the people specified above are not the editors of this proceedings volume.'
ThisAuthorTrailingSchema['editor_flag'].widget.description_msgid='help_editor_flag_checked'
ThisAuthorTrailingSchema['editor_flag'].mode='r'

SourceSchema = Schema((
    publisherField,
    addressField,
    volumeField,
    numberField,
    organizationField,
    seriesField,
    isbnField,
    ))

ProceedingsSchema = HeaderSchema.copy() + AuthorSchema.copy() + ThisAuthorTrailingSchema.copy() + \
                    CoreSchema.copy() + SourceSchema.copy() + TrailingSchema.copy()
ProceedingsSchema.get('authors').required = 0
ProceedingsSchema.get('publication_year').required = 1

# the default AT 'description' field shall be invisible, it is kept in sync with the 'abstract' field
ProceedingsSchema.get('description').widget.visible = {'view': 'invisible', 'edit': 'invisible', }

finalizeATCTSchema(ProceedingsSchema)
PloneArticleSchema = ATDocumentSchema.copy() + Schema((
    FileInnerContentField(
        'files',
        searchable=True,
        schemata='files',
        widget=FileInnerContentWidget(
            label='Files',
            label_msgid='label_files',
            i18n_domain='plonearticle',
        ),
    ),
    ImageInnerContentField(
        'images',
        searchable=True,
        schemata='images',
        widget=ImageInnerContentWidget(
            label='Images',
            label_msgid='label_images',
            i18n_domain='plonearticle',
        ),
    ),
    LinkInnerContentField(
        'links',
        searchable=True,
        schemata='links',
        widget=LinkInnerContentWidget(
            label='Links',
            label_msgid='label_links',
            i18n_domain='plonearticle',
        ),
    ),
), )