Beispiel #1
0
def LanguageWidget(field, request):
    """ Create selector with languages vocab """

    widget = DropdownWidget(field, field.vocabulary, request)
    widget._messageNoValue = _(u"vocabulary-missing-single-value-for-edit",
                               u"Language neutral (site default)")
    return widget
Beispiel #2
0
def WysiwygEditorWidget(field, request):
    """ Create selector with available editors """

    widget = DropdownWidget(field, field.vocabulary, request)
    widget._messageNoValue = _(u"vocabulary-available-editor-novalue",
                               u"Use site default")
    return widget
def LanguageWidget(field, request):
    """ Create selector with languages vocab """

    widget = DropdownWidget(field, field.vocabulary, request)
    widget._messageNoValue = _(u"vocabulary-missing-single-value-for-edit",
                        u"Language neutral (site default)")
    return widget
def WysiwygEditorWidget(field, request):

    """ Create selector with available editors """

    widget = DropdownWidget(field, field.vocabulary, request)
    widget._messageNoValue = _(u"vocabulary-available-editor-novalue", u"Use site default")
    return widget
Beispiel #5
0
def WeekdayWidget(field, request):
    """A widget for the selection of weekdays."""
    weekdays = WEEKDAYS
    locale = None
    context = getattr(field, 'context', None)
    if context is not None:
        context = getattr(context, 'context', None)
        if context is not None:
            portal_state = getMultiAdapter((context, request),
                                           name=u'plone_portal_state')
            locale = portal_state.locale()
    if locale is not None:
        # We probably shouldn't assume a gregorian calendar here, but the rest
        # of our stack doesn't support anything else anyways for now.
        gregorian = locale.dates.calendars.get('gregorian')
        weekdays = tuple(zip(gregorian.getDayNames(), range(0, 8)))

    terms = [SimpleTerm(item[1], title=item[0]) for item in weekdays]
    return DropdownWidget(field, SimpleVocabulary(terms), request)
def TimezoneWidget(field, request):
    """ Timezone selection widget, vocabulary from plone.app.event"""
    widget = DropdownWidget(field, field.vocabulary, request)
    widget._messageNoValue = _(u'vocabulary-avilable-editor-novalue',
                               u'Use site default')
    return widget
Beispiel #7
0
def BooleanDropdownWidget(field, request, true=_('on'), false=_('off')):
    vocabulary = SimpleVocabulary.fromItems( ((true, True), (false, False)) )
    widget = DropdownWidget(field, vocabulary, request)
    widget.required = False
    return widget
Beispiel #8
0
def BooleanDropdownWidget(field, request, true=_('on'), false=_('off')):
    vocabulary = SimpleVocabulary.fromItems(((true, True), (false, False)))
    widget = DropdownWidget(field, vocabulary, request)
    widget.required = False
    return widget
Beispiel #9
0
def TimezoneWidget(field, request):
    """ Timezone selection widget, vocabulary from plone.app.event"""
    widget = DropdownWidget(field, field.vocabulary, request)
    widget._messageNoValue = _(u'vocabulary-avilable-editor-novalue',
                               u'Use site default')
    return widget