Пример #1
0
class PresentationSchemaExtender(object):
    implements(ISchemaExtender, IBrowserLayerAwareExtender)
    layer = IS5SlideshowLayer

    fields = [
        ExtensionBooleanField(
            'presentation',
            schemata='settings',
            required=False,
            languageIndependent=True,
            widget=atapi.BooleanWidget(
                label=_(u'help_enable_presentation',
                        default=u'Presentation mode'),
                description=_(
                    u'help_enable_presentation_description',
                    default=u'If selected, this will give users the ability '
                    u'to view the contents as presentation slides.')),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields
Пример #2
0
 class TestSchemaExtender(Extender):
     adapts(ATDocument)
     fields = [
         HighlightedField(
             'schemaextender_test',
             schemata='settings',
             widget=atapi.BooleanWidget(label="Extended",
                                        description=""),
         ),
     ]
Пример #3
0
class PfgFieldSoupExtender(object):
    """Schema extender for PfgFields adding storage specific settings.
    """

    fields = [
        BooleanExtensionField(
            'pfgsoup_show',
            schemata='soupsettings',
            default=True,
            mode="w",
            required=False,
            widget=atapi.BooleanWidget(
                label=u"Show in Table",
                description=u"Show column with data of field in data table",
            )),
        BooleanExtensionField(
            'pfgsoup_export',
            schemata='soupsettings',
            default=True,
            mode="w",
            required=False,
            widget=atapi.BooleanWidget(
                label=u"Export",
                description=u"Export column with data of field in csv",
            )),
    ]

    implements(IOrderableSchemaExtender, IBrowserLayerAwareExtender)

    layer = IPfgSoupLayer

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields

    def getOrder(self, original):
        neworder = OrderedDict()
        for schemata in original.keys():
            neworder[schemata] = original[schemata]
        return neworder
Пример #4
0
 def fiddle(self, schema):
     schema['auto_cover'] = BooleanField(
         "auto_cover",
         schemata="default",
         widget=atapi.BooleanWidget(
             label=_("Generate cover automatically."),
             description=_("Select this to create a cover image based "
                           "on the uploaded file. Only available for "
                           "PDF files.")))
     if not schema.get('image'):
         schema['image'] = ImageField(
             "image",
             schemata="default",
             sizes=None,
             widget=atapi.ImageWidget(
                 label=_("Cover"), description=_("Cover for Publication")))
Пример #5
0
class PHSchemaExtender(object):
    implements(ISchemaExtender)
    adapts(IPigeonholeAware)

    _fields = [
        CheckboxField(
            'relatable',
            schemata='categorization',
            widget=atapi.BooleanWidget(
                label=
                'Should this page be a candidate to show up in other pages\' "related" portlets?',
                description=
                """Uncheck this box if this page is a section homepage, or any other content that you wouldn't want to see in as "related" content.""",
            ),
            default=True,
        ),
    ]

    # Pigeonhole has *4* fields, for the time being
    for x in range(1, 5):
        _fields.append(
            TagsField(
                'ph_field_%s' % x,
                field_num=x,  # this is a TagsField special field
                schemata='categorization',
                enforceVocabulary=True,
                widget=PHMultiSelectionWidget(
                    field_num=
                    x,  # likewise, a PHMultiSelectionWidget special field
                    label="PH Field %s" % x,
                    description=" ",
                    format="checkbox",
                    visible={
                        'edit': 'dynamic',  # 'dynamic' is a custom value
                        'view': 'invisible'
                    },
                ),
            ), )

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self._fields
Пример #6
0
class StickyBaseSchemaExtender(object):
    implements(ISchemaExtender, IBrowserLayerAwareExtender)

    layer = IBrowserLayer

    def __init__(self, context):
        pass

    _fields = [
        CheckboxField(
            'sticky',
            schemata='categorization',
            widget=atapi.BooleanWidget(label=_(
                'Should this page be "sticky" and appear at the top of sticky-aware collections?'
            ), ),
            default=False,
        )
    ]

    def getFields(self):
        return self._fields
Пример #7
0
class Extender(object):
    """ Extender
    """
    implements(ISchemaExtender)

    fields = [
        BooleanField(
            "frozen",
            schemata="default",
            widget=atapi.BooleanWidget(
                label=_("Freze this item"),
                description=_("Freeze this item and make it unclickable"))),
        ImageField("image",
                   schemata="default",
                   sizes=None,
                   widget=atapi.ImageWidget(
                       label=_("Thumbnail"),
                       description=_("Image for thumbnail"))),
        StringField("url",
                    schemata="default",
                    widget=atapi.StringWidget(
                        label=_("More details URL"),
                        description=_("Provide an external link, if any"))),
        TextField("text",
                  schemata="default",
                  primary=True,
                  allowable_content_types=('text/html', ),
                  default_content_type='text/html',
                  default_output_type='text/html',
                  widget=atapi.RichWidget(
                      label=_("Rich text"),
                      description=_("Detailed body for this item"))),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields
Пример #8
0
        widget=atapi.StringWidget(
            label=u"ID for soup to use as storeage",
            description=u"Enter an existing or new ID to identify "
            u"the target soup.",
        )))

atfields.append(
    atapi.BooleanField(
        'reedit',
        schemata='default',
        default=False,
        mode="w",
        required=False,
        widget=atapi.BooleanWidget(
            label=u"Auto re-edit own form data",
            description=u"Users  are shown their own form data on subsequent "
            u"visits in order to change/edit it.",
        )))

for aid in AUTOFIELDS:
    atfields.append(
        atapi.BooleanField(
            'show_%s' % aid,
            schemata='default',
            default=False,
            mode="w",
            required=False,
            widget=atapi.BooleanWidget(
                label=u"Show %s" % aid.replace('_', ' ').title(),
                description=u"Show data column in table or not?",
            )), )
Пример #9
0

schema = Person.schema.copy() + atapi.Schema((
    atapi.LinesField('PublicationPreference',
                     vocabulary_factory='bika.lims.vocabularies.CustomPubPrefVocabularyFactory',
                     schemata='Publication preference',
                     widget=atapi.MultiSelectionWidget(
                         label=_("Publication preference"),
                     )),
    atapi.BooleanField('AttachmentsPermitted',
                       default=False,
                       schemata='Publication preference',
                       widget=atapi.BooleanWidget(
                           label=_("Results attachments permitted"),
                           description=_(
                               "File attachments to results, e.g. microscope "
                               "photos, will be included in emails to recipients "
                               "if this option is enabled")
                       )),
    atapi.ReferenceField('CCContact',
                         schemata='Publication preference',
                         vocabulary='getContacts',
                         multiValued=1,
                         allowed_types=('Contact',),
                         relationship='ContactContact',
                         widget=atapi.ReferenceWidget(
                             checkbox_bound=0,
                             label=_("Contacts to CC"),
                         )),
))
            format="select",
            condition="python:'FSDPerson' in modules['Products.CMFCore.utils'].getToolByName(here, 'facultystaffdirectory_tool').getEnableMembraneTypes()"  # noqa
        ),
        write_permission=SetOwnProperties,
        schemata="User Settings",
        vocabulary="_availableEditors",
        user_property='wysiwyg_editor',
    ),

    atapi.BooleanField('userpref_ext_editor',
        widget=atapi.BooleanWidget(
            label=_(u"label_ext_editor", default=u"Enable external editing"),
            description=_(u"help_content_ext_editor",
                          default=u"When checked, an icon will be made visible on each page "
                                  u"which allows you to edit content with your favorite editor "
                                  u"instead of using browser-based editors. This requires an "
                                  u"additional application called ExternalEditor installed "
                                  u"client-side. Ask your administrator for more information if "
                                  u"needed."),
            i18n_domain='plone',
            condition="python:'FSDPerson' in modules['Products.CMFCore.utils'].getToolByName(here, 'facultystaffdirectory_tool').getEnableMembraneTypes()",  # noqa
            ),
        write_permission=SetOwnProperties,
        schemata="User Settings",
        user_property='ext_editor',
        default=False,
    ),

    atapi.StringField('userpref_portal_skin',
        widget=atapi.SelectionWidget(
            label=_(u"label_look", default=u"Look"),
            description=_(u"help_look", default=u"Appearance of the site."),
Пример #11
0
from uwosh.timeslot import timeslotMessageFactory as _
from uwosh.timeslot.interfaces import ISignupSheet
from uwosh.timeslot.config import PROJECTNAME
from uwosh.timeslot.utilities import getAllExtraFields

import csv
from StringIO import StringIO
from DateTime import DateTime

SignupSheetSchema = folder.ATFolderSchema.copy() + atapi.Schema((
    atapi.BooleanField(
        'allowSignupForMultipleSlots',
        storage=atapi.AnnotationStorage(),
        widget=atapi.BooleanWidget(
            label=_(u'Allow Signup For Multiple Slots'),
            description=_(
                u'Allow the user to signup for more than one slot.'))),
    atapi.StringField(
        'showSlotNames',
        storage=atapi.AnnotationStorage(),
        widget=atapi.BooleanWidget(
            label=_(u'Show Individual Time Slot Names'),
            description=_(u'Whether or not to show individual slot names.'))),
    atapi.LinesField(
        'extraFields',
        storage=atapi.AnnotationStorage(),
        vocabulary="getExtraFieldsVocabulary",
        widget=atapi.MultiSelectionWidget(
            label=_(u'Extra Fields'),
            description=_(u'Information you want to collect from users besides'
                          ' just name and email.'),
Пример #12
0
                    for new issues. You can use the placeholders \
                    {{SUBSCRIBER_SALUTATION}} and {{UNSUBSCRIBE}} here.'),
            i18n_domain='EasyNewsletter',
        ),
    ),

    atapi.BooleanField(
        'excludeAllSubscribers',
        default=False,
        schemata='recipients',
        widget=atapi.BooleanWidget(
            label=_(
                u'label_excludeAllSubscribers',
                default=u'Exclude all subscribers'),
            description=_(
                u'help_excludeAllSubscribers',
                default=u'If checked, the newsletter/mailing will not be send  \
                   to all subscribers inside the newsletter. Changing this \
                   setting does not affect already existing issues.'),
            i18n_domain='EasyNewsletter',
        )
    ),

    atapi.BooleanField(
        'sendToAllPloneMembers',
        default=False,
        schemata='recipients',
        widget=atapi.BooleanWidget(
            label=_(
                u'label_sendToAllPloneMembers',
                default=u'Send to all Plone members'),
Пример #13
0
         'Tip:  tal:condition="context/getIsDeptChatWidget"  tal:condition="not: context/getIsDeptChatWidget" <br /> \n '
         +
         'Visible ONLY for Portlet? Add this class "library_staff_port" <br /> \n '
         +
         'Visible ONLY for Staff Page? Add this class "library_staff_page" ',
         label=_(u'Ignore this area', default=u'Ignore this area'),
     )),
 atapi.BooleanField(
     'isDeptChatWidget',
     required=False,
     searchable=False,
     default=True,
     validators=(),
     widget=atapi.BooleanWidget(
         description=
         'If the chat widget is for the deparment check this box, if this is a one-on-one chat widget place uncheck.',
         label=_(u'Is this a Department Chat Widget?',
                 default=u'Is this a Department Chat Widget?'),
     )),
 atapi.BooleanField(
     'isTop',
     required=False,
     searchable=False,
     default=False,
     validators=(),
     widget=atapi.BooleanWidget(
         description=
         'This will force this profile to the top of the staff directories.',
         label=_(u'Is this person the Director?',
                 default=u'Is this person the Director?'),
     )),
 atapi.ImageField(
Пример #14
0
class LaTeXCodeInjectionExtender(object):
    adapts(ILaTeXCodeInjectionEnabled)
    implements(IOrderableSchemaExtender)

    _fields = []

    add_field(LaTeXCodeField(
            name='preLatexCode',
            schemata='LaTeX',
            default_content_type='text/plain',
            allowable_content_types='text/plain',
            write_permission=ModifyLaTeXInjection,

            widget=atapi.TextAreaWidget(
                label=_(u'pre_latex_code_label',
                        default=u'LaTeX code above content'),
                description=_(u'pre_latex_code_help',
                              default=u''))))

    add_field(LaTeXCodeField(
            name='postLatexCode',
            schemata='LaTeX',
            default_content_type='text/plain',
            allowable_content_types='text/plain',
            write_permission=ModifyLaTeXInjection,

            widget=atapi.TextAreaWidget(
                label=_(u'post_latex_code_label',
                        default=u'LaTeX code beneath content'),
                description=_(u'post_latex_code_help',
                              default=u''))))

    add_field(ExtensionStringField(
            name='preferredColumnLayout',
            schemata='LaTeX',
            default=NO_PREFERRED_LAYOUT,
            write_permission=ModifyLaTeXInjection,
            vocabulary=((NO_PREFERRED_LAYOUT,
                         _('injection_label_no_preferred_column_layout',
                           default='No preferred column layout')),

                        (ONECOLUMN_LAYOUT,
                         _('injection_label_one_column_layout',
                           default='One column layout')),

                        (TWOCOLUMN_LAYOUT,
                         _('injection_label_two_column_layout',
                           default='Two column layout'))),

            widget=atapi.SelectionWidget(
                label=_(u'injection_label_preferred_column_layout',
                        default=u'Preferred layout'),
                description=_(
                    u'injection_help_preferred_column_layout',
                    default=u'When choosing a one or two column layout, the '
                    u'layout will switched for this content and all '
                    u'subsequent contents in the PDF, if necessary. '
                    u'If "no preferred layout" is selected the currently '
                    u'active layout is kept.'))))

    add_field(
        interfaces=[IChapter, ISimpleLayoutBlock],
        field=ExtensionBooleanField(
            name='latexLandscape',
            schemata='LaTeX',
            default=False,
            write_permission=ModifyLaTeXInjection,

            widget=atapi.BooleanWidget(
                label=_(u'injection_label_landscape',
                        default=u'Use landscape'))))

    add_field(
        interfaces=[IChapter, ISimpleLayoutBlock],
        field=ExtensionBooleanField(
            name='preLatexClearpage',
            schemata='LaTeX',
            default=False,
            write_permission=ModifyLaTeXInjection,

            widget=atapi.BooleanWidget(
                label=_(u'injection_label_insert_clearpage_before_content',
                        default=u'Insert page break before this content'))))

    add_field(
        interfaces=[IChapter, ISimpleLayoutBlock],
        field=ExtensionBooleanField(
            name='postLatexClearpage',
            schemata='LaTeX',
            default=False,
            write_permission=ModifyLaTeXInjection,

            widget=atapi.BooleanWidget(
                label=_(u'injection_label_insert_clearpage_after_content',
                        default=u'Insert page break after this content'))))

    add_field(
        interfaces=[IChapter, ISimpleLayoutBlock],
        field=ExtensionBooleanField(
            name='preLatexNewpage',
            schemata='LaTeX',
            default=False,
            write_permission=ModifyLaTeXInjection,

            widget=atapi.BooleanWidget(
                label=_(u'injection_label_insert_newpage_before_content',
                        default=u'Insert column break before this content'),
                description=_(u'This option inserts a column break when '
                              u'two column layout is active.'))))

    add_field(
        # hideFromTOC is only useful when we have a showTitle checkbox too
        condition=hide_from_toc_condition,
        insert_after='showTitle',
        field=ExtensionBooleanField(
            name='hideFromTOC',
            default=False,
            required=False,

            widget=atapi.BooleanWidget(
                label=_(u'injection_label_hide_from_toc',
                        default=u'Hide from table of contents'),
                description=_(u'injection_help_hide_from_toc',
                              default=u'Hides the title from the table of '
                              u'contents and does not number the heading.'))))

    def __init__(self, context):
        self.context = context

    def getFields(self):
        if not self._context_is_within_book():
            return []

        fields = []

        for item in self._fields:
            condition = item.get('condition')
            if condition and not condition(self.context):
                continue

            interfaces = item.get('interfaces')
            if interfaces:
                provided = [iface for iface in interfaces
                            if iface.providedBy(self.context)]
                if len(provided) == 0:
                    continue

            fields.append(item.get('field'))

        return fields

    def getOrder(self, schematas):
        for item in self._fields:
            insert_after = item.get('insert_after')
            if not insert_after:
                continue

            field = item.get('field')
            if field.schemata not in schematas:
                continue

            schemata = schematas[field.schemata]
            if insert_after not in schemata or field.__name__ not in schemata:
                continue

            schemata.remove(field.__name__)
            schemata.insert(schemata.index(insert_after) + 1, field.__name__)

        return schematas

    def _context_is_within_book(self):
        # In some cases REQUEST is no available.
        if not hasattr(self.context, 'REQUEST'):
            return False

        if IWithinBookLayer.providedBy(self.context.REQUEST):
            return True
        return False
Пример #15
0
    atapi.LinesField(
        name='feeds',
        widget=atapi.LinesWidget(description=_(
            "help_feeds",
            default="List of rss feeds. You can prefix feed link titles "
            "using | separator. It is probably a good idea to add a colon "
            "or dash at the end of the prefix "
            "('My place: |http://myplace/feed')."),
                                 label=_('feedfeeder_label_feeds',
                                         default='Feeds'))),
    atapi.BooleanField(
        name='redirect',
        widget=atapi.BooleanWidget(
            description=_(
                "help_redirect",
                default="If checked the feed item will be automatically "
                "redirected if you don't have the edit permission."),
            label=_('label_redirect',
                    default='Automatic redirect of feed items'))),
    atapi.StringField(
        name='defaultTransition',
        vocabulary='getAvailableTransitions',
        widget=atapi.SelectionWidget(
            format='select',
            description=_(
                'help_default_transition',
                default="When updating this feed's item the transition "
                "selected below will be performed."),
            label=_('label_default_transition', default='Default transition'),
        )),
), )
Пример #16
0
 ),
 atapi.DateTimeField(
     'nextMeetingDateTime',
     storage=atapi.AnnotationStorage(),
     widget=atapi.CalendarWidget(
         label=_(u"Next Meeting Date and Time"),
         description=_(u"Field description"),
     ),
     validators=('isValidDate'),
 ),
 atapi.BooleanField(
     'attendeesCanEdit',
     storage=atapi.AnnotationStorage(),
     widget=atapi.BooleanWidget(
         label=_(u"Allow Attendees to Edit?"),
         description=
         _(u"If checked, allows listed attendees to edit this Meeting object and add/edit contained items"
           ),
     ),
     default=True,
 ),
 atapi.StringField(
     'notifyAttendeesByEmail',
     storage=atapi.AnnotationStorage(),
     widget=atapi.SelectionWidget(
         label=_(u"Notify Attendees by Email?"),
         description=
         _(u"Select which type of email notification to send to listed attendees"
           ),
     ),
     required=True,
     default=_(u"None"),
Пример #17
0
        searchable=1,
        #default='',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            visible = {'edit' : 'invisible', 'view' : 'invisible' },
            label=_(u"Part of Proposed Panel"),
            description=_(u"Is your paper part of a panel proposal? Fill in only if you or a colleage are submitting a panel as well, leave blank otherwise."),
        ),
    ),

    atapi.BooleanField('isPanel',
    	required = False,
    	languageIndependent = True,
    	widget = atapi.BooleanWidget(
                visible = {'edit' : 'invisible', 'view' : 'invisible' },
    	        label= _(u"Is this a panel?"),
    	        description = _(u"Consider this proposal a panel rather than a paper."),
    	),
    ),
))

# Set storage on fields copied from ATFolderSchema, making sure
# they work well with the python bridge properties.
def finalizeConferenceSchema(schema):
    schema['title'].storage = atapi.AnnotationStorage()
    schema['description'].storage = atapi.AnnotationStorage()
    schema['description'].required = True
    schema['description'].widget.label = _('Abstract')
    schema['description'].widget.description = _('A short summary of your article.')
    schema['subject'].storage = atapi.AnnotationStorage()
    schema['subject'].widget.label = _('Keywords')
Пример #18
0
                                                                u"attachment-like columns (if any).\n"
                                                                u"Users must be able to add new contents on that folder; if not, they "
                                                                u"will be only able to select existings items.\n"
                                                                u"If not provided, the folder containing this document will be used."),
                                          force_close_on_insert=True,
                                          visible={'view': 'invisible', 'edit': 'visible'},
                                          ),
    ),

    atapi.BooleanField('downloadEnabled',
              required=False,
              searchable=False,
              schemata="settings",
              widget=atapi.BooleanWidget(
                        label=_(u'Show download link for data'),
                        description=_('help_download_enabled',
                                      default=u'Display a download link for data inside the table in CSV format'),
            ),
    ),

    atapi.StringField('showHeaders',
              searchable=False,
              schemata="settings",
              default="always",
              vocabulary="showHeadersVocabulary",
              enforceVocabulary=True,
              widget=atapi.SelectionWidget(
                        label=_(u'Show headers'),
                        description=_(u'Show table headers when...'),
            ),
    ),
Пример #19
0
     'price',
     default="0.00",
     required=0,
     languageIndependent=True,
     widget=atapi.DecimalWidget(
         label=_(u"label_price", default=u"Price"),
         description=_(u"desc_price", default=u""),
         size=8,
     ),
 ),
 atapi.BooleanField(
     'showPrice',
     default=False,
     languageIndependent=True,
     widget=atapi.BooleanWidget(
         label=_(u"label_show_price", default=u"Show price"),
         description=_(u"desc_show_price", default=u""),
     ),
 ),
 atapi.StringField(
     'skuCode',
     required=0,
     languageIndependent=True,
     widget=atapi.StringWidget(
         label=_(u"label_sku_code", default=u"SKU code"),
         description=_(u"desc_sku_code", default=u""),
     ),
 ),
 atapi.TextField(
     name='unit',
     searchable=True,
     widget=atapi.StringWidget(
Пример #20
0
    ),

    atapi.LinesField(
        name='turno',
        widget=atapi.MultiSelectionWidget(
            label='Turno',
            format='checkbox',
        ),
        enforceVocabulary=True,
        vocabulary=['Manhã','Tarde','Noite'],
    ),

    atapi.BooleanField(
        name='nota',
        widget=atapi.BooleanWidget(
            label='Nota',
        ),
    ),


    atapi.BooleanField(
        name='monitorar',
        widget=atapi.BooleanWidget(
            label='Monitorar',
        ),
    ),

    atapi.LinesField(
        name='vcg',
        widget=atapi.SelectionWidget(
            label="Vocabulário Controlado",
              default=
              (u"Browse to find the internal page to which you wish to link. "
               u"If this field is used, then any entry in the external link field will be ignored. "
               u"You cannot have both an internal and external link.")),
            force_close_on_insert=True,
        )),
    atapi.BooleanField(
        'internalProxy',
        required=False,
        searchable=False,
        default=False,
        widget=atapi.BooleanWidget(
            label=_(u'label_internalProxy',
                    default=u"Use referenced content's data"),
            description=_(
                u'help_internalProxy',
                default=
                (u'When active and an internal link is used, '
                 u'the Link content will use title and description from the referenced content.'
                 )),
            condition='object/proxy_enabled')),

    # ******* Advanced tab *******
    atapi.StringField(
        'anchor',
        required=False,
        searchable=False,
        default='',
        schemata="Advanced",
        widget=atapi.StringWidget(
            label=_(u'label_image_anchor', default=u'Internal anchor'),
            description=_(
Пример #22
0
class SchemaExtender(object):
    """ Extend a file to get more publication related fields """
    implements(IOrderableSchemaExtender)

    _fields = [
        # Override relatedItems make it langauge independent and override
        # the accessor to return langage dependent references.
        ExtendedReferenceField(
            'relatedItems',
            relationship='relatesTo',
            multiValued=True,
            isMetadata=True,
            languageIndependent=True,
            accessor='getRelatedItems',
            mutator='setRelatedItems',
            index='KeywordIndex',
            write_permission=permissions.ModifyPortalContent,
            widget=ReferenceBrowserWidget(allow_search=True,
                                          allow_browse=True,
                                          show_indexes=False,
                                          force_close_on_insert=True,
                                          label=_(u"Related Items"),
                                          description='',
                                          visible={
                                              'edit': 'visible',
                                              'view': 'invisible'
                                          }),
        ),
        ExtendedImageField(
            'cover_image',
            schemata='publication',
            sizes={'cover': (70, 100)},
            languageIndependent=True,
            accessor='getCover_image',
            mutator='setCover_image',
            widget=atapi.ImageWidget(
                label=_(u'label_cover_image', default=u'Cover Image'),
                description=_(
                    u'description_cover_image',
                    default=
                    u'Upload a cover image. Leave empty to have the system autogenerate one for you.'
                ),
            ),
        ),
        ExtendedStringField(
            'author',
            schemata='publication',
            languageIndependent=True,
            accessor='getAuthor',
            mutator='setAuthor',
            widget=atapi.StringWidget(
                label=_(u'label_author', default=u'Author'),
                description=_(
                    u'description_author',
                    default=
                    u'Fill in the Name of the Author of this Publication.'),
            ),
        ),
        ExtendedStringField(
            'isbn',
            schemata='publication',
            languageIndependent=False,
            widget=atapi.StringWidget(
                label=_(u'label_isbn', default=u'ISBN'),
                description=_(
                    u'description_isbn',
                    default=u'Fill in the ISBN Number of this Publication.'),
            ),
        ),
        ExtendedStringField(
            'order_id',
            schemata='publication',
            languageIndependent=False,
            widget=atapi.StringWidget(
                label=_(u'label_order_id', default=u'Order ID'),
                description=_(
                    u'description_order_id',
                    default=u'Fill in the Order ID of this Publication.'),
            ),
        ),
        ExtendedBooleanField(
            'for_sale',
            schemata='publication',
            languageIndependent=True,
            accessor='getFor_sale',
            mutator='setFor_sale',
            widget=atapi.BooleanWidget(
                label=_(u'label_for_sale', default=u'For sale?'),
                description=_(u'description_for_sale',
                              default=u'Is this Publication for sale?'),
            ),
        ),
        ExtendedLinesField(
            'chapters',
            schemata='publication',
            languageIndependent=True,
            accessor='getChapters',
            mutator='setChapters',
            widget=atapi.LinesWidget(
                label=_(u'label_chapters', default=u'Chapters'),
                description=_(
                    u'description_chapters',
                    default=
                    u'Chapters of this Publication. Specify the Link targets defined in your pdf file, one per line.'
                ),
            ),
        ),
        ExtendedFileField(
            'metadata_upload',
            schemata='publication',
            languageIndependent=True,
            accessor='getMetadata_upload',
            mutator='setMetadata_upload',
            widget=atapi.FileWidget(
                label=_(u'label_metadata_upload',
                        default=u'Metadata INI upload'),
                description=_(u'description_metadata_upload',
                              default=u'Upload Metadata in INI style format.'),
            ),
        ),
        ExtendedStringField(
            'owner_password',
            schemata='publication',
            languageIndependent=False,
            widget=atapi.StringWidget(
                label=_(u'label_owner_password', default=u'Owner Password'),
                description=_(
                    u'description_owner_password',
                    default=
                    u'If this publication is protected, speciy the pdf owner password if you want to parse the file.'
                ),
            ),
        ),
        ExtendedStringField(
            'user_password',
            schemata='publication',
            languageIndependent=False,
            widget=atapi.StringWidget(
                label=_(u'label_user_password', default=u'User Password'),
                description=_(
                    u'description_user_password',
                    default=
                    u'If this publication is protected, speciy the pdf user password if you want to parse the file.'
                ),
            ),
        ),
    ]

    def __init__(self, context):
        """ init """
        self.context = context
        klass = context.__class__
        if HAVE_LINGUAPLONE and not getattr(
                klass, LANGUAGE_INDEPENDENT_INITIALIZED, False):
            fields = [
                field for field in self._fields if field.languageIndependent
            ]
            generateMethods(klass, fields)
            setattr(klass, LANGUAGE_INDEPENDENT_INITIALIZED, True)

    def getFields(self):
        """ get fields """
        return self._fields

    def getOrder(self, original):
        """ new order """
        publication = original.get('publication', [])

        publication.insert(0, 'author')
        publication.insert(1, 'isbn')
        publication.insert(2, 'order_id')
        publication.insert(3, 'for_sale')
        publication.insert(4, 'chapters')
        publication.insert(5, 'cover_image')
        publication.insert(6, 'metadata_upload')
        publication.insert(7, 'owner_password')
        publication.insert(8, 'user_password')

        original['publication'] = publication

        return original
        enforceVocabulary=True,
        vocabulary_display_path_bound=-1,
        vocabulary_factory=u'edrnsite.funding.OpportunityTypeVocabulary',
        storage=atapi.AnnotationStorage(),
        widget=atapi.SelectionWidget(
            label=_(u'Opportunity Type'),
            description=_(u'The kind of opportunity being made available'),
        ),
    ),
    atapi.BooleanField(
        'reissuable',
        required=False,
        storage=atapi.AnnotationStorage(),
        widget=atapi.BooleanWidget(
            label=_(u'Reissuable'),
            description=
            _(u'True if this funding opportunity may be reissued, false otherwise.'
              ),
        ),
    ),
))
FundingOpportunitySchema['title'].storage = atapi.AnnotationStorage()
FundingOpportunitySchema['description'].storage = atapi.AnnotationStorage()

finalizeATCTSchema(FundingOpportunitySchema,
                   folderish=True,
                   moveDiscussion=False)


class FundingOpportunity(folder.ATFolder):
    '''Funding Opportunity.'''
    implements(IFundingOpportunity)
Пример #24
0
import sys
from bika.lims.workflow import getCurrentState, StateFlow, InactiveState

schema = Organisation.schema.copy() + atapi.Schema((
    atapi.StringField(
        'ClientID',
        required=1,
        searchable=True,
        validators=('uniquefieldvalidator', 'standard_id_validator'),
        widget=atapi.StringWidget(label=_("Client ID"), ),
    ),
    atapi.BooleanField(
        'BulkDiscount',
        default=False,
        write_permission=ManageClients,
        widget=atapi.BooleanWidget(label=_("Bulk discount applies"), ),
    ),
    atapi.BooleanField(
        'MemberDiscountApplies',
        default=False,
        write_permission=ManageClients,
        widget=atapi.BooleanWidget(label=_("Member discount applies"), ),
    ),
    atapi.LinesField(
        'EmailSubject',
        schemata='Preferences',
        default=[
            'ar',
        ],
        vocabulary=EMAIL_SUBJECT_OPTIONS,
        widget=atapi.MultiSelectionWidget(
Пример #25
0
                       description=_(u"Complexidade"),
                   )),
 atapi.FloatField(name='multiplicador',
                  required=True,
                  searchable=True,
                  default=1.0,
                  widget=atapi.StringWidget(
                      label=_(u"Multiplicador"),
                      description=_(u"Multiplicador"),
                      size=10,
                  )),
 atapi.BooleanField(name='deflator',
                    required=False,
                    searchable=True,
                    widget=atapi.BooleanWidget(
                        label=_(u"Deflator"),
                        description=_(u"Aplicar deflator"),
                    )),
 atapi.FloatField(name='valor_deflator',
                  required=False,
                  searchable=True,
                  widget=atapi.StringWidget(
                      label=_(u"Valor do deflator"),
                      description=_(u"Valor do deflator"),
                      size=10,
                  )),
 atapi.StringField(name='chamado',
                   required=False,
                   searchable=True,
                   widget=atapi.StringWidget(
                       label=_(u"Chamado"),
                       description=_(u"Número do chamado"),
Пример #26
0
     accessor="Description",
     widget=atapi.TextAreaWidget(
         label='Description',
         description="A short summary of the content",
         label_msgid="label_description",
         description_msgid="help_description",
         i18n_domain="plone"
     )
 ),
 atapi.BooleanField('required',
     schemata='default',
     default=False,
     widget=atapi.BooleanWidget(
         label='Required',
         label_msgid='widget_required_title',
         description=('Select this if you want to make this relation '
                      'mandatory (action: edit)'),
         description_msgid='widget_required_description',
         i18n_domain="eea"
     )
 ),
 atapi.LinesField('required_for',
     schemata='default',
     vocabulary_factory='eea.relations.voc.workflowstates',
     widget=atapi.MultiSelectionWidget(
         format='checkbox',
         label='Required for',
         label_msgid='widget_required_for_title',
         description=('Select workflow states that will require this '
                      'relation before setup (action: change state). '
                      'You will also have to update workflow '
                      'transitions accordingly'),
         description=_(
             u'description_text_footer',
             default=u'The default footer text. This is used as a default \
                 for new issues. You can use the placeholders \
                 [[SUBSCRIBER_SALUTATION]] and [[UNSUBSCRIBE]] here.'),
         i18n_domain='EasyNewsletter',
     ),
 ),
 atapi.BooleanField(
     'sendToAllPloneMembers',
     default=False,
     widget=atapi.BooleanWidget(
         label=_(u'label_sendToAllPloneMembers',
                 default=u'Send to all Plone members'),
         description=_(
             u'help_sendToAllPloneMembers',
             default=u'If checked, the newsletter/mailing is send to all \
                 plone members. If there are subscribers inside the \
                 newsletter, they get the letter anyway.'),
         i18n_domain='EasyNewsletter',
     )),
 atapi.LinesField(
     'ploneReceiverMembers',
     vocabulary="get_plone_members",
     widget=atapi.MultiSelectionWidget(
         label=_(u"EasyNewsletter_label_ploneReceiverMembers",
                 default=u"Plone Members to receive the newsletter"),
         description=_(
             u"EasyNewsletter_help_ploneReceiverMembers",
             default=
             u"Choose Plone Members which should receive the newsletter."),
         i18n_domain='EasyNewsletter',
Пример #28
0
    ReferenceBrowserWidget

###########################################################
# Quiz
###########################################################
quiz_schema = atapi.Schema((
    atapi.BooleanField(
        "randomOrder",
        accessor='isRandomOrder',
        required=False,
        default=True,
        storage=atapi.AnnotationStorage(),
        widget=atapi.BooleanWidget(
            label=_(u'Randomize Question Order'),
            description=_(
                u'Check this box if you want the questions '
                u'in this container to appear in a different, random '
                u'order for each candidate. Otherwise the same order '
                u'as in the &quot;contents&quot;-view will be used.'),
        ),
    ),
    atapi.IntegerField(
        "numberOfRandomQuestions",
        required=False,
        default=-1,
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u'Number of Random Questions'),
            description=_(u'The number of questions which are randomly '
                          u'selected when a new quiz is '
                          u'generated for a student. (This only works if '
                          u'&quot;Randomize Question Order&quot; '
Пример #29
0
from zope.interface import implements
from zope.interface.declarations import alsoProvides
import json
import sys

schema = Organisation.schema.copy() + atapi.Schema((
    atapi.StringField(
        'ClientID',
        searchable=True,
        widget=atapi.StringWidget(label=_("Client ID"), ),
    ),
    atapi.BooleanField(
        'MemberDiscountApplies',
        default=False,
        write_permission=ManageClients,
        widget=atapi.BooleanWidget(label=_("Member discount applies"), ),
    ),
    atapi.StringField(
        'ClientType',
        required=1,
        default='noncorporate',
        write_permission=ManageClients,
        vocabulary=CLIENT_TYPES,
        widget=atapi.SelectionWidget(label=_("Client Type"), ),
    ),
    atapi.LinesField(
        'EmailSubject',
        schemata=PMF('Preferences'),
        default=[
            'ar',
        ],
Пример #30
0
class ProductSchemaExtender(object):

    _fields = [
        ExtendedStringField(
            schemata='shop',
            name='product_category',
            required=False,
            enforceVocabulary=True,
            vocabulary_factory='jazkarta.shop.product_categories',
            widget=atapi.SelectionWidget(
                label="Product Category",
                description="Select a product category",
                description_msgid='help_product_category',
            )),
        ExtendedFixedPointField(
            schemata='shop',
            name='price',
            default="0.00",
            #        min=Decimal("0.00"),
            widget=atapi.DecimalWidget(
                label="Unit Price",
                description="",
                description_msgid='help_price',
            )),
        ExtendedIntegerField(
            schemata='shop',
            name='stock_level',
            required=False,
            #            min=0,
            widget=atapi.IntegerWidget(
                label="Stock Level",
                description=
                "Number of items remaining in warehouse. Leave blank for no limit.",
                description_msgid='help_stock_level',
            )),
        ExtendedBooleanField(
            schemata='shop',
            name='taxable',
            widget=atapi.BooleanWidget(
                label="Taxable?",
                description=
                "Mark the box if this product is subject to sales tax.",
                description_msgid='help_taxable',
            ),
            default=True,
        ),
        ExtendedFloatField(schemata='shop',
                           name='weight',
                           required=False,
                           widget=atapi.StringWidget(
                               label="Weight (lbs)",
                               description="Used to calculate shipping.",
                               description_msgid='help_weight',
                           ))
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self._fields