Exemplo n.º 1
0
def reccurencevocabulary(context):
    return SimpleVocabulary.fromTitleItems([(-1, -1, _('None')),
                             (YEARLY, YEARLY, _('Yearly')),
                             (MONTHLY, MONTHLY, _('Monthly')),
                             (WEEKLY, WEEKLY, _('Weekly')),
                             (DAILY, DAILY, _('Daily')),
                             ])
Exemplo n.º 2
0
 def __init__(self, context, request):
     super(SubjectInputWidget, self).__init__(context, request)
     self._widgets = {}
     self._widget_keys = (1, )
     self.vocabulary = ()
     context = getattr(self.context.context, 'context',
                       self.context.context)
     mdtool = getToolByName(context, 'portal_metadata')
     allowed_subjects = mdtool.listAllowedSubjects(context)
     if allowed_subjects:
         items = [(str(v), unicode(v), unicode(v))
                  for v in allowed_subjects]
         self.vocabulary = SimpleVocabulary.fromTitleItems(items)
         self._widget_keys = (0, 1)
Exemplo n.º 3
0
    def developers(self):
        """
        returns the developers assigned to this project as a titled vocabulary.
        """

        context = aq_inner(self.context)

        portalMembers = getToolByName(context, 'portal_membership')
        items = set([(id, id,
                      portalMembers.getMemberById(id).getProperty('fullname', id))
                     for id in context.getProjectDevelopers()])
        member = context.getCurrentMember()
        items.add((member.getId(), member.getId(),
                   member.getProperty('fullname', member.getId())))

        return SimpleVocabulary.fromTitleItems(items)
Exemplo n.º 4
0
class IMetadataSchema(Interface):
    """Schema for metadata views.
    """

    allow_discussion = Choice(
        title=_(u'Enable Discussion?'),
        required=False,
        vocabulary=SimpleVocabulary.fromTitleItems(available_settings))

    identifier = URI(title=_(u'Identifier'), readonly=True)

    title = TextLine(title=_(u'Title'), required=False, missing_value=u'')

    description = Text(title=_(u'Description'),
                       required=False,
                       missing_value=u'')

    subject = Set(title=_(u'Subject'),
                  required=False,
                  missing_value=set(),
                  value_type=TextLine())

    contributors = Tuple(title=_(u'Contributors'),
                         required=False,
                         missing_value=(),
                         value_type=TextLine())

    created = Datetime(title=_(u'Creation Date'), readonly=True)

    modified = Datetime(title=_(u'Last Modified Date'), readonly=True)

    effective = Datetime(title=_(u'Effective Date'), required=False)

    expires = Datetime(title=_(u'Expiration Date'), required=False)

    format = TextLine(title=_(u'Format'), required=False, missing_value=u'')

    language = TextLine(title=_(u'Language'),
                        required=False,
                        missing_value=u'')

    rights = TextLine(title=_(u'Rights'), required=False, missing_value=u'')
Exemplo n.º 5
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     mdtool = getUtility(IMetadataTool)
     items = [(str(v), unicode(v), _(v))
              for v in mdtool.listAllowedSubjects(context)]
     return SimpleVocabulary.fromTitleItems(items)
Exemplo n.º 6
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     mdtool = getToolByName(context, 'portal_metadata')
     items = [ (str(v), unicode(v), _(v))
               for v in mdtool.listAllowedSubjects(context) ]
     return SimpleVocabulary.fromTitleItems(items)
Exemplo n.º 7
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     mdtool = getUtility(IMetadataTool)
     items = [ (str(v), unicode(v), _(v))
               for v in mdtool.listAllowedSubjects(context) ]
     return SimpleVocabulary.fromTitleItems(items)
Exemplo n.º 8
0
class IPortalConfig(Interface):
    """Schema for portal configuration form.
    """

    email_from_name = TextLine(
        title=_(u"Portal 'From' name"),
        description=_(u"When the portal generates mail, it uses this name as "
                      u"its (apparent) sender."),
        required=False,
        missing_value=u'')

    email_from_address = TextLine(
        title=_(u"Portal 'From' address"),
        description=_(u"When the portal generates mail, it uses this address "
                      u"as its (apparent) return address."),
        required=False,
        missing_value=u'')

    smtp_server = TextLine(
        title=_(u"SMTP server"),
        description=_(u"This is the address of your local SMTP (out-going "
                      u"mail) server."),
        required=False,
        missing_value=u'')

    title = TextLine(
        title=_(u"Portal title"),
        description=_(u"This is the title which appears at the top of every "
                      u"portal page."),
        required=False,
        missing_value=u'')

    description = TextLine(
        title=_(u"Portal description"),
        description=_(u"This description is made available via syndicated "
                      u"content and elsewhere. It should be fairly brief."),
        required=False,
        missing_value=u'')

    validate_email = Choice(
        title=_(u"Password policy"),
        vocabulary=SimpleVocabulary.fromTitleItems(available_policies),
        default=False)

    default_charset = ASCIILine(
        title=_(u"Portal default encoding"),
        description=_(u"Charset used to decode portal content strings. If "
                      u"empty, 'ascii' is used."),
        required=False,
        constraint=check_encoding,
        default="utf-8")

    email_charset = ASCIILine(
        title=_(u"Portal email encoding"),
        description=_(u"Charset used to encode emails send by the portal. If "
                      u"empty, 'utf-8' is used if necessary."),
        required=False,
        constraint=check_encoding,
        default="utf-8")

    enable_actionicons = Bool(
        title=_(u"Show action icons"),
        description=_(u"Actions available to the user are shown as textual "
                      u"links. With this option enabled, they are also shown "
                      u"as icons if the action definition specifies one."),
        required=False)

    enable_permalink = Bool(
        title=_(u"Show permalinks"),
        description=_(u"If permalinks are enabled then a unique identifier is "
                      u"assigned to every item of content independent of it's "
                      u"id or position in a site. This requires the CMFUid "
                      u"tool to be installed."),
        required=False)
Exemplo n.º 9
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     langtool = getToolByName(context, 'portal_languages')
     items = [(k, k, v) for k, v in langtool.listSupportedLanguages()]
     return SimpleVocabulary.fromTitleItems(items)
Exemplo n.º 10
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     skintool = getToolByName(context, 'portal_skins')
     items = [(v, v, v) for v in skintool.getSkinSelections()]
     items = [(None, '', 'None')] + items
     return SimpleVocabulary.fromTitleItems(items)