示例#1
0
HeaderSchema['id'].widget.macro_edit = "widgets/string"
# XXX ugly hack as long as IdWidget subclasses TypesWidget
HeaderSchema['id'].widget.size = 40
HeaderSchema['id'].widget.maxlength = 255
HeaderSchema[
    'id'].widget.condition = 'python: object.visibleIdsEnabled() and not object.getBibFolder().getCookIdsAfterBibRefEdit()'

CookIdWarningField = StringField(
    'shortname_cookid_warning',
    schemata="default",
    mode="rw",
    accessor="getCookIdWarning",
    widget=StringWidget(
        label="Short Name",
        label_msgid="label_shortname_cookid_warning",
        description=
        "There is ID re-cooking (after every edit / paste action) enabled on this item's parent bibliography folder. You cannot manually edit this item's short name. Modifications in this field will be ignored.",
        description_msgid="help_shortname_cookid_warning",
        i18n_domain="cmfbibliographyat",
        modes=('view', 'edit'),
        condition=
        'python: object.getBibFolder().getCookIdsAfterBibRefEdit() and object.portal_membership.getAuthenticatedMember().getProperty("visible_ids", object.portal_memberdata.getProperty("visible_ids"))',
    ),
)

HeaderSchema.addField(CookIdWarningField)

tmp_title = HeaderSchema['title']
tmp_title.is_duplicates_criterion = True
del HeaderSchema['title']
示例#2
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',
}
示例#3
0
        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',
                )),
))

Promotion_schema = getattr(ATNewsItem, 'schema', Schema(())).copy() + \
                   getattr(ThemeTaggable, 'schema', Schema(())).copy() + \
                   schema.copy()

Promotion_schema['allowDiscussion'].schemata = 'metadata'
Promotion_schema['relatedItems'].schemata = 'metadata'
Promotion_schema['text'].schemata = 'metadata'


class Promotion(ATNewsItem, ThemeTaggable):
    """ Promotion
示例#4
0
from Products.CMFBibliographyAT.config import CMFBAT_USES_LINGUAPLONE
if CMFBAT_USES_LINGUAPLONE:
    from Products.LinguaPlone.public import StringField, StringWidget
    from Products.LinguaPlone.public import BooleanField, BooleanWidget
else:
    from Products.Archetypes.public import StringField, StringWidget
    from Products.Archetypes.public import BooleanField, BooleanWidget


journalField = StringField('journal',
                searchable=1,
                required=0,
                default='',
                is_duplicates_criterion=True,
                widget=StringWidget(label="Journal",
                    label_msgid="label_journal",
                    description="A journal name (should be the full journal name).",
                    description_msgid="help_journal",
                    i18n_domain="cmfbibliographyat",),
                )

volumeField = StringField('volume',
                searchable=1,
                required=0,
                default='',
                is_duplicates_criterion=True,
                widget=StringWidget(label="Volume",
                    label_msgid="label_volume",
                    description="The volume of a journal, multivolume book work etc. In most cases it should suffice to use a simple number as the volume identifier.",
                    description_msgid="help_volume",
                    i18n_domain="cmfbibliographyat",),
# 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'
    import HeaderSchema, AuthorSchema, CoreSchema, TrailingSchema
from Products.CMFBibliographyAT.content.fields \
    import journalField, volumeField, numberField, pagesField

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",
示例#7
0
     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,