Example #1
0
    def __call__(self, context):
        acl_users = getToolByName(context, 'acl_users')
        try:
            miColeccion=context.coleccionR[0].to_object
            idGAsign=IColecGroupName(miColeccion).groupName
        except:
            print "No se puedo asignar IColectGroupName"
            return SimpleVocabulary([SimpleVocabulary.createTerm("", str(""), "")])
        idGPot=idGAsign.replace("_g",PREFIJO_COOR_POTENCIAL)

        grupoPot= acl_users.getGroupById(idGPot)
        grupoAsignado=acl_users.getGroupById(idGAsign)

        terms = []
        listIds=[]
        if grupoPot is not None:
            for member_id in grupoPot.getMemberIds()+grupoAsignado.getMemberIds():
                if member_id not in listIds:
                    user = acl_users.getUserById(member_id)
                    if user is not None:
                        member_name = user.getProperty('fullname') or member_id
                        listIds.append(member_id)
                        terms.append(SimpleVocabulary.createTerm(member_id, str(member_id), member_name))

            return SimpleVocabulary(terms)
            
        #devulve un registro vacio
        return SimpleVocabulary([SimpleVocabulary.createTerm("", str(""), "")])
class KeywordSource(object):
    implements(IQuerySource)

    def __init__(self, context):
        self.context = context
        self.vocab = SimpleVocabulary(
            [SimpleVocabulary.createTerm(DATA[x], x, DATA[x])
             for x in DATA]
        )

    def __contains__(self, term):
        return self.vocab.__contains__(term)

    def __iter__(self):
        return self.vocab.__iter__()

    def __len__(self):
        return self.vocab.__len__()

    def getTerm(self, value):
        return self.vocab.getTerm(value)

    def getTermByToken(self, value):
        return self.vocab.getTermByToken(value)

    def search(self, query_string):
        q = query_string.lower()
        return [kw
                for kw in self.vocab._terms
                if q.lower() in kw.value]
Example #3
0
    def __call__(self, context):
        terms = []
        terms.append(SimpleVocabulary.createTerm(u'Català', 'ca', _(u'Català')))
        terms.append(SimpleVocabulary.createTerm(u'Castellà', 'es', _(u'Español')))
        terms.append(SimpleVocabulary.createTerm(u'English', 'en', _(u'English')))

        return SimpleVocabulary(terms)
Example #4
0
def list_templates(context):
    """Return a list available templates."""
    templates = get_oneoffixx_templates()
    template_group = context.REQUEST.form.get('form.widgets.template_group')
    terms = []

    for template in templates:
        terms.append(SimpleVocabulary.createTerm(
            template, template.template_id, template.title))

    # We filter templates when template_group has been selected
    if template_group is not None:
        favorites = get_oneoffixx_favorites()
        # Favorites are a special case
        if favorites and template_group[0] == favorites.get('id'):
            terms = [
                SimpleVocabulary.createTerm(
                    OneOffixxTemplate(
                        template, favorites.get('localizedName', '')),
                    template.get('id'),
                    template.get('localizedName'),
                )
                for template in favorites.get('templates')
            ]
        elif template_group[0] != '--NOVALUE--':
            terms = [term for term in terms if term.value.group == template_group[0]]

    return MutableObjectVocabulary(terms)
class KeywordSource(object):
    interface.implements(IQuerySource)

    def __init__(self, context):
        self.context = context
        catalog = getToolByName(context, 'portal_catalog')
        self.keywords = catalog.uniqueValuesFor('Subject')
        terms = []
        for x in self.keywords:
            terms.append(SimpleTerm(x, x, unicode(x)))
        self.vocab = SimpleVocabulary(terms)

    def __contains__(self, term):
        return self.vocab.__contains__(term)

    def __iter__(self):
        return self.vocab.__iter__()

    def __len__(self):
        return self.vocab.__len__()

    def getTerm(self, value):
        return self.vocab.getTerm(value)

    def getTermByToken(self, value):
        return self.vocab.getTermByToken(value)

    def search(self, query_string):
        q = query_string.lower()
        return [self.getTerm(kw) for kw in self.keywords if q in kw.lower()]
def availableDonationForms(context):
    terms = []
    settings = get_settings()
    default = settings.default_donation_form
    terms.append(SimpleVocabulary.createTerm(default, default,
                                             'Stripe Donation Form'))

    try:
        campaign_getter = context.get_fundraising_campaign

    except AttributeError:
        # The campaign hasn't been created yet, so there are no
        # available campaign-specific donation forms yet.
        pass

    else:
        campaign = campaign_getter()
        query = {
            "portal_type": "collective.salesforce.fundraising.productform",
            "path": '/'.join(campaign.getPhysicalPath()),
        }

        pc = getToolByName(context, 'portal_catalog')
        res = pc.searchResults(**query)
        for form in res:
            form_id = form.id + '/donation_form_stripe'
            terms.append(
                SimpleVocabulary.createTerm(form_id, form_id,
                                            'Product Form: ' + form.Title))

    return SimpleVocabulary(terms)
Example #7
0
 def __call__(self,context):
     acl_users = getToolByName(context, 'acl_users')
     group_list = acl_users.source_groups.getGroups()
     terms = [SimpleVocabulary.createTerm('Authenticated Users', 'Authenticated Users', 'Authenticated Users')]
     for group in group_list:
         terms.append(SimpleVocabulary.createTerm(group.getName(), group.getName() ,group.title or  group.getName()))
     return SimpleVocabulary(terms)
def MetadataVocabulary(context):
    """
    Metadata name is stored in registry. Format for default name is "fieldname:"
    and format for custom name is ":customname"
    """
    terms = []
    portal = getSite()
    metadataDisplay = getToolByName(portal, 'portal_atct').getMetadataDisplay()
    for name, display_name in metadataDisplay.items():
        if name in ['end', 'EffectiveDate', 'start', 'ExpirationDate', 'ModificationDate', 'CreationDate']:
            for format,format_name in [('localshort', 'Date'),('locallong','Date & Time')]:
                terms.append(SimpleVocabulary.createTerm("%s:%s"% (name, format), None,
                                                         "%s (%s)"%(display_name, format_name)))
        elif name in ['Title', 'getId']:
            terms.append(SimpleVocabulary.createTerm(name + ":", None, display_name))
            for format,format_name in [('tolink', 'Link')]:
                terms.append(SimpleVocabulary.createTerm("%s:%s"% (name, format), None,
                                                         "%s (%s)"%(display_name, format_name)))
        else:
            terms.append(SimpleVocabulary.createTerm(name + ":", None, display_name))

    # custom field
    reg = queryUtility(IRegistry)
    if reg is not None:
        proxy = ComplexRecordsProxy(reg, IListingCustomFieldControlPanel,
                                    prefix='collective.listingviews.customfield',
                                   key_names={'fields': 'id'})
        for field in proxy.fields:
            terms.append(SimpleVocabulary.createTerm(':' + field.id, None,
                                                     "%s (Custom)" % field.name))
    return SimpleVocabulary(terms)
Example #9
0
def attachable_documents_vocabulary(context):
    terms = []

    user = AccessControl.getSecurityManager().getUser()
    if user == AccessControl.SpecialUsers.nobody:
        return SimpleVocabulary(terms)

    intids = getUtility(IIntIds)

    ids = []

    for doc in context.getFolderContents(
        full_objects=True,
        contentFilter={'portal_type': ['opengever.document.document',
                                       'ftw.mail.mail']}):

        key = str(intids.getId(doc))
        label = doc.Title()
        terms.append(SimpleVocabulary.createTerm(key, key, label))
        ids.append(key)

    for relation in getattr(context, 'relatedItems', []):
        key = str(relation.to_id)
        # check if the task doesn't contain the related document allready
        if key in ids:
            continue
        label = relation.to_object.Title()
        terms.append(SimpleVocabulary.createTerm(key, key, label))

    return SimpleVocabulary(terms)
def getProfiles(context):
    """
    Return list of Google Analytics profiles and corresponding
    account IDs (e.g. ga:30481).
    """
    
    analytics_tool = getToolByName(getSite(), 'portal_analytics')
    
    try:
        accounts = analytics_tool.getAccountsFeed()
    except error.BadAuthenticationError:
        choices = [('Please authorize with Google in the Google Analytics \
            control panel.', None)]
        return SimpleVocabulary.fromItems(choices)
    except error.RequestTimedOutError:
        choices = [('The request to Google Analytics timed out. Please try \
            again later.', None)]
        return SimpleVocabulary.fromItems(choices)
    if accounts:
        unique_choices = {}
        for entry in accounts.entry:
            unique_choices.update({entry.title.text : entry.tableId[0].text})
        choices = unique_choices.items()
    else:
        choices = [('No profiles available', None)]
    return SimpleVocabulary.fromItems(choices)
def tagging_vocabulary_factory(context):
    items = []
    items.append(('ttn', u'TagThe.Net'))
    items.append(('tpcom', u'text-processing.com'))
    try:
        registry = getUtility(IRegistry)
        settings = registry.forInterface(ITagHelperSettingsSchema)
        if settings.silcc_url:
            items.append(('silcc', u'SiLLC'))
        if settings.yahoo_api_key:
            items.append(('yahoo', u'Yahoo'))
        if settings.alchemy_api_key:
            items.append(('alchemy', u'AlchemyAPI'))
        if settings.calais_api_key:
            items.append(('calais', u'Open Calais'))
        if settings.zemanta_api_key:
            items.append(('zemanta', u'Zemanta'))
        if settings.openamplify_api_key:
            items.append(('openamplify', u'OpenAmplify'))
        if settings.evri_api_key:
            items.append(('evri', u'Evri'))

    except (KeyError, AttributeError):
        return SimpleVocabulary.fromItems(items)
    return SimpleVocabulary.fromItems(items)
Example #12
0
    def __call__(self, context):
        terms = []
        terms.append(SimpleVocabulary.createTerm(u'Darreres activitats', 'darreres_activitats', _(u'Darreres activitats')))
        terms.append(SimpleVocabulary.createTerm(u'Activitats mes valorades', 'activitats_mes_valorades', _(u'Activitats mes valorades')))
        terms.append(SimpleVocabulary.createTerm(u'Activitats destacades', 'activitats_destacades', _(u'Activitats destacades')))

        return SimpleVocabulary(terms)
Example #13
0
def getTransitionVocab(context):

    if AccessControl.getSecurityManager(
        ).getUser() == AccessControl.SpecialUsers.nobody:
        return SimpleVocabulary([])

    wftool = getToolByName(context, 'portal_workflow')
    transitions = []
    if opengever.task.task.ITask.providedBy(context) and \
            context.REQUEST.URL.find('++add++opengever.task.task') == -1:
        for tdef in wftool.getTransitionsFor(context):
            transitions.append(SimpleVocabulary.createTerm(
                    tdef['id'],
                    tdef['id'],
                    PMF(tdef['id'], default=tdef['title_or_id'])))
        return SimpleVocabulary(transitions)

    else:
        wf = wftool.get(wftool.getChainForPortalType('opengever.task.task')[0])
        state = wf.states.get(wf.initial_state)
        for tid in state.transitions:
            tdef = wf.transitions.get(tid, None)
            transitions.append(SimpleVocabulary.createTerm(
                    tdef.id,
                    tdef.id,
                    PMF(tdef.id, default=tdef.title_or_id)))
        return SimpleVocabulary(transitions)
Example #14
0
 def __call__(self, context):
     terms = []
     empty = 'Not defined (DEFAULT)'
     terms.append(SimpleVocabulary.createTerm(empty, str(empty), empty))
     extenders = [a[0] for a in getUtilitiesFor(ICatalogFactory) if a[0].startswith('user_properties') and a[0] != 'user_properties']
     for extender in extenders:
         terms.append(SimpleVocabulary.createTerm(extender, str(extender), extender))
     return SimpleVocabulary(terms)
Example #15
0
 def __call__(self, context):
     tmp = SimpleVocabulary([
         SimpleTerm('one', 'one', u'One'),
         SimpleTerm('two', 'two', u'Two'),
         SimpleTerm('three', 'three', u'Three'),
     ])
     tmp.test = 1
     return tmp
Example #16
0
def flattrLanguageVocab(context):
    portal = getToolByName(context, "portal_url").getPortalObject()
    flattr = getMultiAdapter((portal, context.REQUEST), name="collective_flattr")
    languages = flattr.getLanguages()
    terms = [SimpleVocabulary.createTerm("sysdefault", "sysdefault", _(u"System default"))]
    for lang in languages:
        terms.append(SimpleVocabulary.createTerm(lang["id"], lang["id"], lang["text"]))
    return SimpleVocabulary(terms)
def ViewletsTemplatesVocabFactory(context):
    """ Vocabulary for potential vielets renderers listing """
    terms = [
        SimpleVocabulary.createTerm(name, name, u'%s (%s)' % (name, adapter.title))
        for name, adapter in getAdapters((context, context.REQUEST), IViewletResultsRenderer)
    ]
    terms.insert(0, SimpleVocabulary.createTerm('', '', u'None'))
    return SimpleVocabulary(terms)
    def _subscription_field(self):
        subscription_terms = []
        self_subscribed = False
        is_really_muted = self.user_is_muted
        if is_really_muted:
            subscription_terms.insert(0, self._unmute_user_term)
        for person in self._subscribers_for_current_user:
            if person.id == self.user.id:
                if is_really_muted:
                    # We've already added the unmute option.
                    continue
                else:
                    if self.user_is_subscribed_directly:
                        subscription_terms.append(
                            self._update_subscription_term)
                    subscription_terms.insert(
                        0, self._unsubscribe_current_user_term)
                    self_subscribed = True
            else:
                subscription_terms.append(
                    SimpleTerm(
                        person, person.name,
                        structured(
                            'unsubscribe <a href="%s">%s</a> from this bug',
                            canonical_url(person),
                            person.displayname).escapedtext))
        if not self_subscribed:
            if not is_really_muted:
                subscription_terms.insert(0,
                    SimpleTerm(
                        self.user, self.user.name,
                        'subscribe me to this bug'))
            elif not self.user_is_subscribed_directly:
                subscription_terms.insert(0,
                    SimpleTerm(
                        'update-subscription', 'update-subscription',
                        'unmute bug mail from this bug and subscribe me to '
                        'this bug'))

        # Add punctuation to the list of terms.
        if len(subscription_terms) > 1:
            for term in subscription_terms[:-1]:
                term.title += ','
            subscription_terms[-2].title += ' or'
            subscription_terms[-1].title += '.'

        subscription_vocabulary = SimpleVocabulary(subscription_terms)
        if self.user_is_subscribed_directly or self.user_is_muted:
            default_subscription_value = self._update_subscription_term.value
        else:
            default_subscription_value = (
                subscription_vocabulary.getTermByToken(self.user.name).value)

        subscription_field = Choice(
            __name__='subscription', title=_("Subscription options"),
            vocabulary=subscription_vocabulary, required=True,
            default=default_subscription_value)
        return subscription_field
def getWebProperties(context):
    """
    Return list of Google Analytics profiles and web property
    IDs (e.g. UA-30481-22).
    """

    analytics_tool = getToolByName(getSite(), "portal_analytics")
    # short circuit if user hasn't authorized yet
    if not analytics_tool.auth_token:
        return SimpleVocabulary([])

    try:
        accounts = analytics_tool.getAccountsFeed("accounts/~all/webproperties/~all/profiles")
    except error.BadAuthenticationError:
        choices = [
            (
                "Please authorize with Google in the Google Analytics \
            control panel.",
                None,
            )
        ]
        return SimpleVocabulary.fromItems(choices)
    except error.RequestTimedOutError:
        choices = [
            (
                "The request to Google Analytics timed out. Please try \
            again later.",
                None,
            )
        ]
        return SimpleVocabulary.fromItems(choices)
    if accounts:
        unique_choices = {}
        # In vocabularies, both the terms and the values must be unique. Since
        # there can be more than one profile for a given web property, we create a list
        # of all the profiles for each property. (Ideally we would use the URL for the
        # web property, but Google doesn't expose it through the Analytics API.)
        for entry in accounts.entry:
            for prop in entry.property:
                if prop.name == "ga:profileName":
                    title = prop.value
                    if not isinstance(title, unicode):
                        title = unicode(title, "utf-8")
                if prop.name == "ga:webPropertyId":
                    webPropertyId = prop.value
            if not webPropertyId in unique_choices.keys():
                unique_choices.update({webPropertyId: title})
            else:
                unique_choices[webPropertyId] += ", " + title
        # After we reverse the terms so that the profile name(s) is now the key, we need
        # to ensure that these keys are unique. So, we pass the resulting list through
        # dict() and then output a list of items.
        choices = dict([(title, property_id) for (property_id, title) in unique_choices.items()]).items()
    else:
        choices = [("No profiles available", None)]
    return SimpleVocabulary([SimpleTerm(c[1], c[1], c[0]) for c in choices])
Example #20
0
 def __call__(self, context, query=None):
     items = [u'One', u'Two', u'Three']
     tmp = SimpleVocabulary([
         SimpleTerm(it.lower(), it.lower(), it)
         for it in items
         if query is None or
         query.lower() in it.lower()
     ])
     tmp.test = 1
     return tmp
def if_not_found_list(context):
    terms = [SimpleVocabulary.createTerm('__ignore__', '__ignore__', 'Skip'),
             SimpleVocabulary.createTerm('__stop__', '__stop__', 'Stop')]


    for fti in get_allowed_types(context):
        portal_type = fti.getId()
        terms.append(SimpleVocabulary.createTerm(portal_type, portal_type,
                                                 "Create %s" % fti.title))
    return SimpleVocabulary(terms)
Example #22
0
 def __call__(self, context):
     tracker = aq_parent(context)
     myField = tracker.getField(self.field)
     result = []
     for item in myField.get(tracker):
         result.append(SimpleVocabulary.createTerm(
                 item['id'], item['id'], item['title']))
     if result == []:
         result.append(SimpleVocabulary.createTerm(
                 '', '', '-'))
     return result
    def __call__(self, context):
        site = getSite()
        if site is None:
            return SimpleVocabulary.fromValues([])

        ttool = getToolByName(site, 'portal_types', None)
        if ttool is None:
            return SimpleVocabulary.fromValues([])

        items = [(ttool[t].Title(), t) for t in ttool.listContentTypes()]
        items.sort()
        return SimpleVocabulary([SimpleTerm(i[1], i[1], i[0]) for i in items])
Example #24
0
 def __call__(self, context):
     if self.vocab is not None:
         return self.vocab
     util = queryUtility(IExternalVocabConfig, name=self.name)
     if util is None:
         return SimpleVocabulary.fromValues([])
     path = util.get('path', None)
     if not path or not os.path.isfile(path):
         return SimpleVocabulary.fromValues([])
     self.vocab = SimpleVocabulary(
         make_terms([line.strip() for line in open(path, 'r')]))
     return self.vocab
 def __call__(self, context):
     """Retrieve available themes inside persistent resource and add
     sunburst and collective.js.jqueryui themes"""
     tm = self.getThemeManager()
     try:
         ids = tm.getThemeIds()
         ids.sort()
         items = [(id, id) for id in ids if id]
         return SimpleVocabulary.fromItems(items)
     except TypeError:
         logger.info('kss inline validation ... getSite doesn t return Plone site')
         return SimpleVocabulary.fromItems([('sunburst','sunburst')])
Example #26
0
    def __call__(self,context):
        contexto=getSite()
        catalogo= getToolByName(contexto, 'portal_catalog')
        results=catalogo.unrestrictedSearchResults({'object_provides': IColeccion.__identifier__,'review_state':('SetUp','Publicado')})
        terms = []
        if len(results)>0:
            for colec in results:
                terms.append(SimpleVocabulary.createTerm(colec.id, str(colec.id), colec.Title))
        else:
            terms.append(SimpleVocabulary.createTerm("", "", ""))

        return SimpleVocabulary(terms)
class KeywordSource(object):
    implements(IQuerySource)

    def __init__(self, context):
        self.context = context
        catalog = getToolByName(context, 'portal_catalog')
        self.keywords = catalog.uniqueValuesFor('Subject')

        def safe_str(s):
            if type(s) == unicode:
                return s.encode("utf-8", "replace")
            else:
                return s

        def safe_unicode(s):
            if type(s) == str:
                return unicode(s, "utf-8", "replace")
            else:
                return s

        # XXX: plone.z3cform monkeypatches z3c.forms to decode
        # all form values in query to unicode; in short, one cannot
        # use non-ascii characters in tokens (z3c.form expects tokens
        # to be encoded strings, but plone.z3cform breaks this)

        self.vocab = SimpleVocabulary([
            SimpleTerm(safe_unicode(x), quote(safe_str(x)), safe_unicode(x))
            for x in self.keywords])

    def __contains__(self, term):
        return self.vocab.__contains__(term)

    def __iter__(self):
        return self.vocab.__iter__()

    def __len__(self):
        return self.vocab.__len__()

    def getTerm(self, value):
        def safe_unicode(s):
            if type(s) == str:
                return unicode(s, "utf-8", "replace")
            else:
                return s
        return self.vocab.getTerm(safe_unicode(value))

    def getTermByToken(self, value):
        return self.vocab.getTermByToken(value)

    def search(self, query_string):
        q = query_string.lower()
        return [self.getTerm(kw) for kw in self.keywords if q in kw.lower()]
Example #28
0
 def __call__(self, context):
     acl_users = getToolByName(context, 'acl_users')
     group = acl_users.getGroupById(self.group_name)
     terms = []
     terms.append(SimpleVocabulary.createTerm('', str(''), ''))
     if group is not None:
         for member_id in group.getMemberIds():
             user = acl_users.getUserById(member_id)
             if user is not None:
                 member_name = user.getProperty('fullname') or member_id
                 terms.append(SimpleVocabulary.createTerm(member_id, str(member_id), member_name))
         
     return SimpleVocabulary(terms)    
Example #29
0
def possibleSeverities(context):
    """
    Get the available severities as a Vocabulary.
    """
    if ITracker.providedBy(context):
        tracker = context
    elif hasattr(context, 'getTracker'):
        tracker = context.getTracker()
    elif hasattr(context, 'context'):
        tracker = context.context.getTracker()
    else:
        return SimpleVocabulary.fromValues(DEFAULT_SEVERITIES)
    return SimpleVocabulary.fromValues(tracker.available_severities)
Example #30
0
def possibleTargetReleases(context):
    """
    Get the available target release as a Vocabulary.
    """
    if ITracker.providedBy(context):
        tracker = context
    elif hasattr(context, 'getTracker'):
        tracker = context.getTracker()
    else:
        return SimpleVocabulary.fromValues([])
    if tracker.available_releases:
        return SimpleVocabulary.fromValues(tracker.available_releases)
    return SimpleVocabulary([])
Example #31
0
    'RecyclingCenter', 'SelfStorage', 'ShoppingCenter',
    'SportsActivityLocation', 'Store', 'TelevisionStation',
    'TouristInformationCenter', 'TravelAgency', 'Airline', 'Corporation',
    'EducationalOrganization', 'GovernmentOrganization', 'LocalBusiness',
    'NGO', 'PerformingGroup', 'SportsOrganization', 'AutoPartsStore',
    'BikeStore', 'BookStore', 'ClothingStore', 'ComputerStore',
    'ConvenienceStore', 'DepartmentStore', 'ElectronicsStore', 'Florist',
    'FurnitureStore', 'GardenStore', 'GroceryStore', 'HardwareStore',
    'HobbyShop', 'HomeGoodsStore', 'JewelryStore', 'LiquorStore',
    'MensClothingStore', 'MobilePhoneStore', 'MovieRentalStore', 'MusicStore',
    'OfficeEquipmentStore', 'OutletStore', 'PawnShop', 'PetStore', 'ShoeStore',
    'SportingGoodsStore', 'TireShop', 'ToyStore', 'WholesaleStore'
]
BUSINES_TYPES.sort()
BusinessTypesVocabulary = SimpleVocabulary([
    SimpleVocabulary.createTerm('', '', 'n/a'),
] + [SimpleVocabulary.createTerm(name, name, name) for name in BUSINES_TYPES])
del BUSINES_TYPES

BAD_TYPES = ("ATBooleanCriterion", "ATDateCriteria", "ATDateRangeCriterion",
             "ATListCriterion", "ATPortalTypeCriterion",
             "ATReferenceCriterion", "ATSelectionCriterion",
             "ATSimpleIntCriterion", "Plone Site", "ATSimpleStringCriterion",
             "ATSortCriterion", "TempFolder", "ATCurrentAuthorCriterion",
             "ATPathCriterion", "ATRelativePathCriterion", "Pad", 'Comment',
             'Link')


class ReallyUserFriendlyTypesVocabulary(object):
    implements(IVocabularyFactory)
Example #32
0
    },
)

# A vocabulary to assign functions (toolkits) to experiment types
experiment_type_vocabulary = SimpleVocabulary([
    SimpleTerm("org.bccvl.content.sdmexperiment",
               "org.bccvl.content.sdmexperiment",
               u"Species Distribution Modelling Experiment"),
    SimpleTerm("org.bccvl.content.msdmexperiment",
               "org.bccvl.content.msdmexperiment",
               u"Multi-species Distribution Modelling Experiment"),
    SimpleTerm("org.bccvl.content.mmexperiment",
               "org.bccvl.content.mmexperiment",
               u"Migratory Modelling Experiment"),
    SimpleTerm("org.bccvl.content.projectionexperiment",
               "org.bccvl.content.projectionexperiment",
               u"Climate Change Experiment"),
    SimpleTerm("org.bccvl.content.biodiverseexperiment",
               "org.bccvl.content.biodiverseexperiment",
               u"Biodiverse Experiment"),
    SimpleTerm("org.bccvl.content.speciestraitsexperiment",
               "org.bccvl.content.speciestraitsexperiment",
               u"Species Trait Modelling Experiment"),
    SimpleTerm("org.bccvl.content.ensemble", "org.bccvl.content.ensemble",
               u"Ensemble Analysis"),
    SimpleTerm(None, "None", u"Unknown")
])


@provider(IVocabularyFactory)
def experiment_type_source(context):
Example #33
0
class IBusinessData(Interface):
    business_type = schema.Choice(
        title=u'Business Type',
        vocabulary=BusinessTypesVocabulary,
        default=None,
        required=False
    )

    business_name = schema.TextLine(
        title=u'Business Name',
        required=False)

    business_address = schema.TextLine(
        title=u'Address',
        required=False)

    business_city = schema.TextLine(
        title=u'City',
        required=False)

    business_state = schema.TextLine(
        title=u'State',
        required=False)

    business_postal_code = schema.TextLine(
        title=u'Postal Code',
        required=False)

    business_country = schema.TextLine(
        title=u'Country',
        required=False,
        default=u'US')

    business_coordinates = schema.Text(
        title=u'Coordinates',
        description=u'Search for address to get the coordinates of business address',
        default=u'{}',
        required=False,
        constraint=validate_json
    )

    business_telephone = schema.TextLine(
        title=u'Telephone',
        required=False)

    business_days_of_week = schema.List(
        title=u'Days open',
        required=False,
        default=[],
        value_type=schema.Choice(
            vocabulary=SimpleVocabulary([
                SimpleVocabulary.createTerm('Monday', 'Monday', 'Monday'),
                SimpleVocabulary.createTerm('Tuesday', 'Tuesday', 'Tuesday'),
                SimpleVocabulary.createTerm('Wednesday', 'Wednesday', 'Wednesday'),
                SimpleVocabulary.createTerm('Thursday', 'Thursday', 'Thursday'),
                SimpleVocabulary.createTerm('Friday', 'Friday', 'Friday'),
                SimpleVocabulary.createTerm('Saturday', 'Saturday', 'Saturday'),
                SimpleVocabulary.createTerm('Sunday', 'Sunday', 'Sunday')
            ])
        )
    )

    business_opens = schema.TextLine(
        title=u'Opens',
        description=u'In the format of 08:00',
        required=False)

    business_closes = schema.TextLine(
        title=u'Closes',
        description=u'In the format of 08:00',
        required=False)

    business_special_hours = schema.List(
        title=u'Special hours',
        description=u'In the format Day|Opens|Closes. Example: Saturday|08:00|12:00',
        value_type=schema.TextLine(),
        default=[],
        required=False)

    business_menu_link = schema.TextLine(
        title=u'Menu link',
        description=u'If your business has a menu, provide link here',
        required=False)

    business_accepts_reservations = schema.Bool(
        title=u'Accepts Reservations',
        default=False)

    business_additional_configuration = schema.Text(
        title=u'Additional Configuration',
        description=u'See https://developers.google.com/structured-data/local-businesses/ '
                    u'for details on how to configuration business search data',
        constraint=validate_json,
        required=False)
Example #34
0
class ITinyMCELayout(Interface):
    """This interface defines the layout properties."""

    resizing = schema.Bool(
        title=_(u"Enable resizing the editor window."),
        description=
        _(u"This option gives you the ability to enable/disable resizing the editor window. If the editor width is set to a percentage only vertical resizing is enabled."
          ),
        required=False)

    autoresize = schema.Bool(
        title=_(u"Enable auto resizing of the editor window."),
        description=
        _(u"This option gives you the ability to enable/disable auto resizing the editor window depending on the content."
          ),
        required=False)

    editor_width = schema.TextLine(
        title=_(u"Editor width"),
        description=
        _(u"This option gives you the ability to specify the width of the editor in pixels or percent."
          ),
        required=False)

    editor_height = schema.TextLine(
        title=_(u"Editor height"),
        description=
        _(u"This option gives you the ability to specify the height of the editor in pixels. If auto resize is enabled this value is used as minimum height."
          ),
        required=False)

    directionality = schema.Choice(
        title=_(u"Writing direction"),
        description=
        _(u"This option specifies the default writing direction, some languages (Like Hebrew, Arabic, Urdu...) write from right to left instead of left to right."
          ),
        missing_value=set(),
        vocabulary=SimpleVocabulary([
            SimpleTerm('auto', 'auto',
                       _(u'Auto detect from content language')),
            SimpleTerm('ltr', 'ltr', _(u"Left to right")),
            SimpleTerm('rtl', 'rtl', _(u"Right to left"))
        ]),
        required=False)

    contextmenu = schema.Bool(
        title=_(u"Enable contextmenu."),
        description=
        _(u"This option gives you the ability to enable/disable the use of the contextmenu."
          ),
        required=False)

    content_css = schema.TextLine(
        title=_(u"Choose the CSS used in WYSIWYG Editor Area"),
        description=
        _(u"This option enables you to specify a custom CSS file that replaces the theme content CSS. This CSS file is the one used within the editor (the editable area)."
          ),
        required=False)

    styles = schema.Text(
        title=_(u"Styles"),
        description=
        _(u"Enter a list of styles to appear in the style pulldown. Format is title|tag or title|tag|className, one per line."
          ),
        required=False)

    tablestyles = schema.Text(
        title=_(u"Table styles"),
        description=
        _(u"Enter a list of styles to appear in the table style pulldown. Format is title|class, one per line."
          ),
        required=False)
Example #35
0
 def __call__(self, context):
     return SimpleVocabulary.fromItems([("title1", 1), ("t2", 2)])
 def __call__(self, context):
     items = [
         SimpleTerm(value=name, title=grid.title)
         for (name, grid) in getUtilitiesFor(IGridSystem)
     ]
     return SimpleVocabulary(items)
Example #37
0
 def __call__(self, context):
     """"""
     years = getProjectSpace(None).budget_years or []
     return SimpleVocabulary([SimpleTerm(y) for y in years])
Example #38
0
class IGlobalDocumentViewerSettings(Interface):
    large_size = schema.Int(title=_("Large Image Size"), default=1000)
    normal_size = schema.Int(title=_("Normal Image Size"), default=700)
    thumb_size = schema.Int(title=_("Thumb Image Size"), default=180)
    storage_type = schema.Choice(
        title=_("Storage Type"),
        description=_("Blob storage using the normal ZODB blob mechanism. "
                      "File storage is for just storage the files on the "
                      "file system with no hard reference on write to the "
                      "ZODB. This allows you to easily push the files to "
                      "be served off-site."),
        default='Blob',
        vocabulary=SimpleVocabulary.fromValues(['Blob', 'File']))
    storage_location = schema.TextLine(
        title=_("Storage location"),
        description=_('Only for file storage not with zodb. '
                      'Plone client must have write access to directory.'),
        default=u"/opt/dvpdffiles")
    storage_obfuscate = schema.Bool(
        title=_("Obfuscate private file paths"),
        description=_(
            "*experimental* If you're serving files straight from "
            "a web server, there is no way to do permission checks "
            "on them. This provides a bit more security as the path "
            "to the resources will be more difficult to guess and "
            "never publisized. Of course, do not have your web "
            "server list directory contents. *If you don't know what "
            "this does, you probably do NOT want to enable it*"),
        default=False)
    pdf_image_format = schema.Choice(title=_("Image Format"),
                                     default=u"gif",
                                     vocabulary=SimpleVocabulary.fromValues(
                                         ['gif', 'png', 'jpg']))
    enable_indexation = schema.Bool(
        title=_("Make searchable"),
        description=_(
            "If this is enabled, the text will be extracted from "
            "the PDF and will be searchable using the search widget and "
            "with the Plone search. "
            "If this is disabled, the two following parameters 'OCR' "
            "and 'Detect text' are not taken into account.  Take care "
            "that this will not make already converted elements searchable/"
            "not searchable, you will have to convert existing element yourself."
        ),
        default=True)
    ocr = schema.Bool(
        title=_("OCR"),
        description=_("Extract the text from the PDF using OCR technology."),
        default=False)
    detect_text = schema.Bool(
        title=_("Detect text"),
        description=_("Detect if pdf has text before performing OCR on it. "
                      "If text is found, ocr will be skipped. "
                      "If OCR is disabled, text will always try to be "
                      "retrieved from the PDF file anyways."),
        default=True)
    auto_select_layout = schema.Bool(title=_("Auto select layout"),
                                     description=_("For pdf files."),
                                     default=True)
    auto_layout_file_types = schema.List(
        title=_("Auto layout file types"),
        description=_("Extra types only work with "
                      "openoffice/libreoffice installed."),
        default=['pdf'],
        value_type=schema.Choice(
            vocabulary=SimpleVocabulary(FILE_TYPES_VOCAB)))
    auto_convert = schema.Bool(title=_("Auto Convert"),
                               description=_(
                                   "Automatically convert files on creation "
                                   "and modification."),
                               default=True)
    override_contributor = schema.TextLine(
        title=_("Override Contributor"),
        description=_("What to override the contributor field on viewer with."
                      "Leave blank to use document owner."),
        default=None,
        required=False)
    override_organization = schema.TextLine(
        title=_("Override Contributor Organization"),
        description=_("What to override the organization field on viewer with."
                      "Leave blank to use site title."),
        default=None,
        required=False)
    override_base_resource_url = schema.URI(
        title=_("Override Base Resource URL"),
        description=_("If you're syncing your storage to another server you "
                      "would like to serve the pdf resources from, please "
                      "specify the base url path."),
        default=None,
        required=False)
    width = schema.Int(title=_("Viewer Width"),
                       description=_("Leave blank to take full width."),
                       default=None,
                       required=False)
    height = schema.Int(title=_("Viewer Height"),
                        description=_(
                            "Default height to use for viewer (only for "
                            "non-fullscreen mode)."),
                        default=700)
    show_sidebar = schema.Bool(
        title=_("Show sidebar"),
        description=_("Default to show sidebar on Document Viewer."),
        default=True)
    show_search = schema.Bool(title=_("Show search box"),
                              description=_("On Document Viewer."),
                              default=True)
    show_search_on_group_view = schema.Bool(
        title=_("Show search on group view"),
        description=_("Enable search on group view."),
        default=True)
    group_view_batch_size = schema.Int(
        title=_("Group View Batch Size"),
        description=_("For folders. Does not apply to topics."),
        default=20)
    async_quota_size = schema.Int(
        title=_("Async Quota Size"),
        description=_("Number of conversions to run at a time. "
                      "The quota name assigned is `dv`."),
        default=3)
Example #39
0
    def get_subforms(self):
        """ Build a form of options from a tree of options

        TODO: this method does too much, should be refactored
        """
        assessment_data = {}

        if hasattr(self.context, 'saved_assessment_data'):
            assessment_data = self.context.saved_assessment_data.last()

        assess_date = '-'
        forms = []

        for question in self.questions:
            phase = [
                k

                for k, v in PHASES.items()

                if question.klass in v
            ][0]

            elements = question.get_assessed_elements(
                self.descriptor_obj, muids=[]
            )

            form = EmbeddedForm(self, self.request)
            form.title = question.definition
            last_upd = '{}_{}_Last_update'.format(self.article, question.id)
            form._last_update = assessment_data.get(last_upd, assess_date)
            form._assessor = assessment_data.get('assessor', '-')
            form._question_type = question.klass
            form._question_phase = phase
            form._question = question
            form._elements = elements
            form._disabled = self.is_disabled(question)

            fields = []

            if not elements:  # and question.use_criteria == 'none'
                field_title = u'All criteria'
                field_name = '{}_{}'.format(self.article, question.id)
                choices = question.answers

                terms = [SimpleTerm(token=i, value=i, title=c)
                         for i, c in enumerate(choices)]

                # Add 'Not relevant' to choices list
                # terms.extend([
                #     SimpleTerm(token=len(terms) + 1,
                #                value=None,
                #                title=u'Not relevant')
                # ])

                default = assessment_data.get(field_name, None)
                field = Choice(
                    title=field_title,
                    __name__=field_name,
                    vocabulary=SimpleVocabulary(terms),
                    required=False,
                    default=default,
                )
                # field._criteria = criteria
                fields.append(field)

            for element in elements:
                field_title = element.title
                field_name = '{}_{}_{}'.format(
                    self.article, question.id, element.id
                )
                choices = question.answers
                terms = [SimpleTerm(token=i, value=i, title=c)
                         for i, c in enumerate(choices)]

                default = assessment_data.get(field_name, None)
                field = Choice(
                    title=unicode(field_title),
                    __name__=field_name,
                    vocabulary=SimpleVocabulary(terms),
                    required=False,
                    default=default,
                )
                field._element = element
                fields.append(field)

            for name, title in additional_fields.items():
                _name = '{}_{}_{}'.format(self.article, question.id, name)

                default = assessment_data.get(_name, None)
                _field = Text(title=title,
                              __name__=_name, required=False, default=default)

                fields.append(_field)

            form.fields = Fields(*fields)
            forms.append(form)

        assessment_summary_form = EmbeddedForm(self, self.request)
        assessment_summary_form.title = u"Assessment summary"
        last_upd = '{}_assess_summary_last_upd'.format(self.article)
        assessment_summary_form._last_update = assessment_data.get(
            last_upd, assess_date
        )
        assessment_summary_form._assessor = assessment_data.get(
            'assessor', '-'
        )
        assessment_summary_form.subtitle = u''
        assessment_summary_form._disabled = self.read_only_access
        asf_fields = []

        for name, title in reg_summary_fields:
            _name = '{}_{}'.format(
                self.article, name
            )

            default = assessment_data.get(_name, None)
            _field = Text(title=title,
                          __name__=_name, required=False, default=default)
            asf_fields.append(_field)

        assessment_summary_form.fields = Fields(*asf_fields)

        forms.append(assessment_summary_form)

        return forms
Example #40
0
class IBundleRegistry(zope.interface.Interface):

    jscompilation = schema.ASCIILine(
        title=_("URL of the last js compilation"),
        required=False)

    csscompilation = schema.ASCIILine(
        title=_("URL of the last css compilation"),
        required=False)

    last_compilation = schema.Datetime(
        title=_("Last compiled date"),
        description=_("Date time of the last compilation of this bundle"),
        required=False)

    expression = schema.ASCIILine(
        title=_("Expression to render"),
        description=_(
            "In case its a bundle we can have a condition to render it (it "
            "does not apply if the bundle is merged)."),
        required=False)

    conditionalcomment = schema.ASCIILine(
        title=_("Conditional comment"),
        description=_(
            "In case you want to render this resource on conditional comment "
            "(it does not apply if the bundle is merged)."),
        required=False)

    resources = schema.List(
        title=_("Loaded resources"),
        description=_(
            "The resources that are going to be loaded on this bundle in order"),
        value_type=schema.ASCIILine(title=_("Resource name")),
        required=False)

    enabled = schema.Bool(
        title=_("It's enabled?"),
        default=True,
        required=False)

    compile = schema.Bool(
        title=_("Does your bundle contains any RequireJS or LESS file?"),
        description=_(
            "If its true and you modify this bundle you need to build it before production"),
        default=True,
        required=False)

    depends = schema.ASCIILine(
        title=_("Depends on another bundle"),
        description=_(
            "In case you want to be the last: *, in case its the first should be empty"),
        required=False)

    develop_javascript = schema.Bool(
        title=_('Develop JavaScript'),
        default=False)

    develop_css = schema.Bool(
        title=_('Develop CSS'),
        default=False)

    stub_js_modules = schema.List(
        title=_('Stub JavaScript modules'),
        description=_('Define list of modules that will be defined empty '
                      'on RequireJS build steps to prevent loading modules multiple times.'),
        value_type=schema.ASCIILine(title=_("Resource name")),
        required=False,
        missing_value=[],
        default=[])

    merge_with = schema.Choice(
        title=_("Merge with"),
        description=_(
            "In production mode, bundles are merged together to reduce the "
            "quantity of JS and CSS resources loaded by the browser. Choose "
            "'default' if this bundle must be available for all the visitors, "
            "choose 'logged-in' if it must be available for logged-in users "
            "only, or leave it empty if it must not be merged."),
        vocabulary=SimpleVocabulary(
            [SimpleTerm('', '', _("")),
             SimpleTerm('default', 'default', 'default'),
             SimpleTerm('logged-in', 'logged-in', 'logged-in')]),
        default="",
        required=False)

    load_async = schema.Bool(
        title=_("Load asynchronously"),
        description=_("Load the JavaScript files asynchronously by adding an ``async`` attribute to the script tag."),
        default=False,
        required=False)

    load_defer = schema.Bool(
        title=_("Load deferred"),
        description=_("Load the JavaScript files deferred after the document has been parsed but before ``DOMContentLoaded`` by adding a ``defer`` attribute to the script tag."),
        default=False,
        required=False)
Example #41
0
def EngineVocabulary(context):
    utility = getUtility(IEngineVocabularyUtility)
    return SimpleVocabulary.fromValues(utility.engines)
Example #42
0
 def __call__(self, context):
     return SimpleVocabulary([])
Example #43
0
    read_tal_condition = schema.TextLine(
        title=_("Read TAL condition"),
        required=False,
    )

    write_tal_condition = schema.TextLine(
        title=_("Write TAL condition"),
        required=False,
    )


assigned_user_check_levels = SimpleVocabulary([
    SimpleTerm(value=u'no_check', title=_(u'No check')),
    SimpleTerm(
        value=u'n_plus_1',
        title=_(u'Assigned user mandatory only if there is a n+1 validation')),
    SimpleTerm(value=u'mandatory', title=_(u'Assigned user always mandatory'))
])

fullname_forms = SimpleVocabulary([
    SimpleTerm(value=u'firstname', title=_(u'Firstname Lastname')),
    SimpleTerm(value=u'lastname', title=_(u'Lastname Firstname'))
])

iemail_manual_forward_transitions = SimpleVocabulary([
    SimpleTerm(value=u'created',
               title=_(u'A user forwarded email will stay at creation level')),
    SimpleTerm(value=u'manager',
               title=_(u'A user forwarded email will go to manager level')),
    SimpleTerm(value=u'n_plus_h',
Example #44
0
def create_term(val, label):
    return SimpleVocabulary.createTerm(val, val, label)
from datetime import datetime
from Products.Archetypes.Widget import LinesWidget
from collective.cover import _
from collective.cover.tiles.base import IPersistentCoverTile, PersistentCoverTile
from zope import schema
from zope.component import queryUtility
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm

from mpdg.govbr.biblioteca.content.arquivo_biblioteca import ArquivoBiblioteca
from mpdg.govbr.observatorio.content.boapratica import BoaPratica

FILE_CONTENT_TYPES = ArquivoBiblioteca.dict_file_content_types

portal_types = SimpleVocabulary([
    SimpleTerm(value=u'ArquivoBiblioteca', title=_(u'Arquivos Biblioteca')),
    SimpleTerm(value=u'BoaPratica', title=_(u'Boas Práticas')),
])


class ISearchContentsTile(IPersistentCoverTile):
    """
    """

    search_on_context = schema.Bool(
        title=_(u'Buscar objetos no contexto'),
        description=
        _(u'Se marcado a busca de objetos será apenas no contexto do tile, caso contrário em todo portal'
          ),
        default=True,
    )
Example #46
0
class ITG(Interface):
    """Abstract representation of a Translation Group (TG).

    Adapt an object to this interface to obtain its UUID. Adaptation will
    fail if the object does not have a TG (yet).
    """


class IPloneAppMultilingualInstalled(Interface):
    """ layer """


selector_policies = SimpleVocabulary([
    SimpleTerm(value=u'closest',
               title=_(u'Search for closest translation in parent\'s content '
                       u'chain.')),
    SimpleTerm(value=u'dialog',
               title=_(u'Show user dialog with information about the '
                       u'available translations.'))
])


class IMultiLanguageExtraOptionsSchema(ILanguageSchema):
    """ Interface for language extra options - control panel fieldset
    """

    model.fieldset(
        'multilingual',
        label=_(u'Multilingual', default=u'Multilingual'),
        fields=[
            'filter_content', 'redirect_babel_view',
            'bypass_languageindependent_field_permission_check',
 def __call__(self, context):
     items = super(AvailableContentTypesVocabulary, self).__call__(context)
     items = [i for i in items if i.token != 'collective.cover.content']
     return SimpleVocabulary(items)
Example #48
0
def kk(context):
    terms = []
    for gwz in range(5):
        terms.append(SimpleTerm(gwz, gwz, gwz))
    return SimpleVocabulary(terms)
Example #49
0
    def __call__(self, context):

        return SimpleVocabulary(
            [SimpleTerm(value=cat[2][0][0], title=cat[2][0][1]) for
                cat in CATEGORIES])
Example #50
0
    'Any',
    'Contains',
    'DoesNotContain',
    'Eq',
    'Ge',
    'Gt',
    'InRange',
    'Le',
    'Lt',
    'NotEq',
    'NotInRange',
    'NotAny',
    'NotAll',
    )
COMPARATOR_VOCABULARY = SimpleVocabulary(
    [SimpleTerm(k) for k in COMPARATORS]
    )


class ISearchAPICapability(IPublishTraverse):
    """
    Interface for an API capability that is an object-published
    component.
    """

    def __call__(*args, **kwargs):
        """
        return simple Python data structure such as dict,
        list, or if necessary a specific component for the
        capability.
        """
Example #51
0
                )
                result.append(r)

        return result


sortby_def = {
    "MODIFIED": "Last Modified",
    "EFFECTIVE": "Last Published",
    "NAME": "Alphabetical sorting",
}

sortbyterms = [
    SimpleTerm(value=k, token=k, title=v) for k, v in sortby_def.items()
]
sortby_vocabulary = SimpleVocabulary(sortbyterms)


class IRelevantAceContentItemsTile(ISearchAceContentTile):

    show_share_btn = Bool(
        title=_(u"Show the share button"),
        default=False,
    )

    combine_results = Bool(
        title=_(u"Show listing results, in addition to assigned items"),
        default=False,
    )

    uuids = Dict(
Example #52
0
 def __call__(self, context):
     items = []
     for country in pycountry.countries:
         items.append(
             SimpleTerm(country.alpha2, country.alpha2, country.name))
     return SimpleVocabulary(items)
Example #53
0
class ITinyMCEResourceTypes(Interface):
    """This interface defines the resource types properties."""

    link_using_uids = schema.Bool(
        title=_(u"Link using UIDs"),
        description=
        _(u"Links to objects on this site can use unique object ids so that the links remain valid even if the target object is renamed or moved elsewhere on the site."
          ),
        required=False)

    allow_captioned_images = schema.Bool(
        title=_(u"Allow captioned images"),
        description=_(u"Images will be automatically captioned."),
        required=False)

    rooted = schema.Bool(
        title=_(u"Rooted to current object"),
        description=
        _(u"When enabled the user will be rooted to the current object and can't add links and images from other parts of the site."
          ),
        required=False)

    containsobjects = schema.Text(
        title=_(u"Contains Objects"),
        description=
        _(u"Enter a list of content types which can contain other objects. Format is one contenttype per line."
          ),
        required=False)

    containsanchors = schema.Text(
        title=_(u"Contains Anchors"),
        description=
        _(u"Enter a list of content types which can contain anchors. Format is one contenttype per line."
          ),
        required=False)

    linkable = schema.Text(
        title=_(u"Linkable Objects"),
        description=
        _(u"Enter a list of content types which can be linked. Format is one contenttype per line."
          ),
        required=False)

    imageobjects = schema.Text(
        title=_(u"Image Objects"),
        description=
        _(u"Enter a list of content types which can be used as images. Format is one contenttype per line."
          ),
        required=False)

    customplugins = schema.Text(
        title=_(u"Custom Plugins"),
        description=
        _(u"Enter a list of custom plugins which will be loaded in the editor. Format is pluginname or pluginname|location, one per line."
          ),
        required=False)

    entity_encoding = schema.Choice(
        title=_(u"Entity encoding"),
        description=
        _(u"This option controls how entities/characters get processed. Named: Characters will be converted into named entities based on the entities option. Numeric: Characters will be converted into numeric entities. Raw: All characters will be stored in non-entity form except these XML default entities: amp lt gt quot"
          ),
        missing_value=set(),
        vocabulary=SimpleVocabulary([
            SimpleTerm('named', 'named', _(u"Named")),
            SimpleTerm('numeric', 'numeric', _(u"Numeric")),
            SimpleTerm('raw', 'raw', _(u"Raw"))
        ]),
        required=False)
 def getTermByToken(self, token):
     try:
         return SimpleVocabulary.getTermByToken(self, token)
     except LookupError:
         return self.createTerm(token)
Example #55
0
 def __call__(self, context):
     return SimpleVocabulary.fromItems([("title1", "value1"), ("t2", "v2")])
def public_trial_vocabulary_factory(context):
    return SimpleVocabulary(
        [SimpleTerm(msgid, title=_(msgid)) for msgid in PUBLIC_TRIAL_CHOICES])
Example #57
0
    }
    return synoptypes.get(op)


possibleParams = SimpleVocabulary([
    SimpleTerm(value=u"heute", token=u"heute", title=u"heute"),
    SimpleTerm(value=u"unb_4", token=u"unb_4", title=u"Erstellungsdatum"),    
    SimpleTerm(value=u"unh_2", token=u"unh_2", title=u"Dokumentart"),
    SimpleTerm(value=u"uvt_4", token=u"uvt_4", title=u"Unfalltag"),
    SimpleTerm(value=u"uvt_5", token=u"uvt_5", title=u"Aktenzeichen"),
    SimpleTerm(value=u"vin_4", token=u"vin_4", title=u"Geschlecht Versicherter"),
    SimpleTerm(value=u"vin_5", token=u"vin_5", title=u"PLZ Versicherter"),
    SimpleTerm(value=u"vin_9", token=u"vin_9", title=u"Geburtstag Versicherter"),
    SimpleTerm(value=u"ufb_3", token=u"ufb_3", title=u"PLZ Betrieb"),
    SimpleTerm(value=u"ufb_6", token=u"ufb_6", title=u"Beschäftigt als"),
    SimpleTerm(value=u"ufb_7", token=u"ufb_7", title=u"Beschäftigt seit"),
    SimpleTerm(value=u"ufd_1", token=u"ufd_1", title=u"Unfallzeit"),
    SimpleTerm(value=u"ufd_2", token=u"ufd_2", title=u"Arbeitszeit Beginn"),
    SimpleTerm(value=u"ufd_3", token=u"ufd_3", title=u"Arbeitszeit Ende"),
    SimpleTerm(value=u"dis_1", token=u"dis_1", title=u"Diagnose Text"),
    SimpleTerm(value=u"dis_4", token=u"dis_4", title=u"Diagnoseschlüssel"),
    SimpleTerm(value=u"dis_3", token=u"dis_3", title=u"Diagnosecode"),
    SimpleTerm(value=u"afb_1", token=u"afb_1", title=u"Arbeitsunfähigkeit"),
    SimpleTerm(value=u"afb_4", token=u"afb_4", title=u"AU ab (Datum)"),
    SimpleTerm(value=u"afb_7", token=u"afb_7", title=u"vorauss. Ende AU (Datum)"),
    SimpleTerm(value=u"uaz_4", token=u"uaz_4", title=u"Tödlicher Unfall"),
    ])


getOperanden = SimpleVocabulary([
    SimpleTerm(value='true', token='true', title=u"ja (wahr)"),
Example #58
0
class IFabOrder(form.Schema):
    """Fritzing Fab order details
    """
    
    shipTo = Choice(
        title = _(u"Shipping Area"),
        description = _(u"Where you are located"),
        vocabulary = SimpleVocabulary([
            SimpleTerm(value = u'germany', title = _(u'Germany')),
            SimpleTerm(value = u'eu', title = _(u'European Union (EU)')),
            SimpleTerm(value = u'world', title = _(u'Worldwide'))
        ]))
    
    email = TextLine(
        title = _(u"E-Mail"),
        description = _(u"Your e-mail address"),
        constraint = checkEMail)
    
    form.omitted(
        'telephone',
        'area', 
        'pricePerSquareCm', 
        'priceNetto', 
        'priceShipping', 
        'numberOfQualityChecks', 
        'priceQualityChecksNetto', 
        'taxesPercent', 
        'taxes', 
        'priceTotalNetto', 
        'priceTotalBrutto',
        'trackingNumber')
    
    telephone = ASCIILine(
        title = _(u"Telephone number"),
        description = _(u"We prefer a mobile number"))
    
    area = Float(
        title = _(u"Area"),
        description = _(u"The total area of all sketches in cm^2"),
        min = 0.0,
        default = 0.0)
    
    pricePerSquareCm = Float(
        title = _(u"Price per cm^2"),
        description = _(u"The price per cm^2 in Euro"),
        min = 0.0,
        default = 0.0)
    
    priceNetto = Float(
        title = _(u"Netto price"),
        description = _(u"The netto price without shipping in Euro"),
        min = 0.0,
        default = 0.0)
    
    priceShipping = Float(
        title = _(u"Shipping costs"),
        description = _(u"The shipping costs in Euro"),
        min = 0.0,
        default = 0.0)
    
    numberOfQualityChecks = Int(
        title = _(u"Number of quality checks"),
        description = _(u"Number of quality checks"),
        min = 0,
        default = 0)
    
    priceQualityChecksNetto = Float(
        title = _(u"Costs for quality checks"),
        description = _(u"The costs for quality checks in Euro"),
        min = 0.0,
        default = 0.0)
    
    taxesPercent = Float(
        title = _(u"Percent Taxes"),
        description = _(u"Taxes like VAT in Percent"),
        min = 0.0,
        default = 0.0)
    
    taxes = Float(
        title = _(u"Taxes"),
        description = _(u"Taxes like VAT"),
        min = 0.0,
        default = 0.0)
    
    priceTotalNetto = Float(
        title = _(u"Total Netto"),
        description = _(u"The netto price costs in Euro"),
        min = 0.0,
        default = 0.0)
    
    priceTotalBrutto = Float(
        title = _(u"Total"),
        description = _(u"The price including shipping costs and taxes in Euro"),
        min = 0.0,
        default = 0.0)
    
    trackingNumber = TextLine(
        title = _(u"Tracking Number"),
        description = _(u"The tracking number assigned by the parcel service"))
Example #59
0
    label = _(u'Edit')
    ignoreContent = False
    dataManager = silvaforms.SilvaDataManager

    fields = silvaforms.Fields(IImageAddFields).omit('id')
    fields['image'].fileSetLabel = _(
        u"Click the Upload button to replace the current image with a new image."
    )
    actions = silvaforms.Actions(silvaforms.CancelEditAction(),
                                 silvaforms.EditAction())


image_formats = SimpleVocabulary([
    SimpleTerm(title=u'jpg', value='JPEG'),
    SimpleTerm(title=u'png', value='PNG'),
    SimpleTerm(title=u'gif', value='GIF')
])


class IFormatAndScalingFields(Interface):
    web_format = schema.Choice(source=image_formats,
                               title=_(u"Web format"),
                               description=_(u"Image format for web."))
    web_scale = schema.TextLine(
        title=_(u"Scaling"),
        description=_(u'Image scaling for web: use width x  '
                      u'height in pixels, or one axis length, '
                      u'or a percentage (100x200, 100x*, *x200, 40%).'
                      u'Use 100% to scale back to the orginal format.'),
        required=False)
Example #60
0
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm

from ploneintranet.core import ploneintranetCoreMessageFactory as _  # noqa


todo_priority = SimpleVocabulary(
    [SimpleTerm(value=0, title=_(u'Low')),
     SimpleTerm(value=1, title=_(u'Normal')),
     SimpleTerm(value=2, title=_(u'High'))]
)