Esempio n. 1
0
"""Common components shared by content types
"""

from Products.Archetypes import atapi
from Products.ATExtensions import ateapi

CommonFields = atapi.Schema((
    atapi.ComputedField('uid',
                        expression="here.UID()",
                        ),
    atapi.ComputedField('pid',
                        expression="here.PID()",
                        ),
    ateapi.RecordsField('identifiers',
                        searchable=1,
                        index_method='ids',
                        required=0,
                        subfields = ('type', 'value'),
                        subfield_labels ={'type':'Identifier'},
                        subfield_vocabularies = {'type':'identifierTypes'},
                        innerJoin = ': ',
                        outerJoin = '<br />',
                        widget=ateapi.RecordsWidget(
                            description = "Other identifiers used to refer "\
                            "to this information.",
                            label = u"Identifiers",
                            ),
    ),
    ateapi.RecordsField('additional',
                        subfields = ('key', 'value'),
                        minimalSize=3,
Esempio n. 2
0
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from rendereasy.cnawhatsapp import cnawhatsappMessageFactory as _

from rendereasy.cnawhatsapp.interfaces import IGrupo
from rendereasy.cnawhatsapp.config import PROJECTNAME

GrupoSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.ComputedField(
        'quantidade',
        storage=atapi.AnnotationStorage(),
        widget=atapi.ComputedWidget(
            label=_(u"Quantidade"),
            description=_(u"Quantidade de telefones cadastrados."),
        ),
        expression="context.numTelefones()"),
    atapi.LinesField(
        'telefones',
        storage=atapi.AnnotationStorage(),
        widget=atapi.LinesWidget(
            label=_(u"Telefones"),
            description=_(u"Um por linha, no formato 6199999999."),
        ),
    ),
))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.
Esempio n. 3
0
from DateTime.DateTime import DateTime
from incf.countryutils.datatypes import Country
from Products.Archetypes import atapi
from Products.ATExtensions import ateapi
from Products.ATVocabularyManager import NamedVocabulary

from Products.ATBackRef import BackReferenceField
from Products.ATBackRef import BackReferenceWidget

from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget

CommonFields = atapi.Schema((
    atapi.ComputedField(
        'uid',
        read_permission='View internals',
        expression="here.UID()",
        widget=atapi.StringWidget(
            condition="python:here.stateNotIn(['considered'])"),
    ),
    atapi.ComputedField(
        'pid',
        read_permission='View internals',
        expression="here.PID()",
        widget=atapi.StringWidget(
            condition="python:here.stateNotIn(['considered'])"),
    ),
    ateapi.RecordsField(
        'identifiers',
        schemata='details',
        read_permission='View internals',
        write_permission='Modify internals',
Esempio n. 4
0
        required=True,
        searchable=1,
        storage=atapi.AnnotationStorage(),
        vocabulary='listArticleTypes',
        enforceVocabulary=True,
        widget=SelectDescriptionWidget(
            label="Type",
            description="Choose the type of article that best fits your piece",
            label_msgid="gcommons_article_type",
            description_msgid="gcommons_help_article_type",
        ),
    ),

    # -*- Your Archetypes field definitions here ... -*-
    atapi.ComputedField('bibreference',
                        searchable=1,
                        expression='context._compute_bibreference()',
                        accessor='BibReference'),
    atapi.StringField(
        name='pages',
        required=False,
        searchable=1,
        #default='',
        storage=atapi.AnnotationStorage(),
        schemata='bibdata',
        widget=atapi.StringWidget(
            label=_(u"Pages"),
            description=_(u"Page range of published article"),
        ),
    ),
    atapi.StringField(
        name='doi',
Esempio n. 5
0
        widget=DataGridWidget(
            label="Veiculação",
            columns={
                'descricao': Column("Descricao"),
                'entrada':  Column("Entrada"),
                'saida':  Column("Saida"),
            },
        ),
        required=True,
    ),

    atapi.ComputedField(
        'duracao',
        expression='context.duracaoTotal()',
        storage=atapi.AnnotationStorage(),
        widget=atapi.ComputedWidget(
            label="Duração da transmissão",
            modes=('view')
        ),
    ),

    atapi.TextField(
        'ocorrencias',
        storage=atapi.AnnotationStorage(),
        widget=atapi.TextAreaWidget(
            label="Ocorrências",
        ),
        allowable_content_types="('text/html')",
        default_output_type="text/html",
        searchable=1,
    ),
Esempio n. 6
0
     storage=atapi.AttributeStorage(),
     original_size=(400, 500),
     sizes={
         'thumb': (100, 125),
         'normal': (200, 250)
     },
     default_output_type='image/jpeg',
     allowable_content_types=('image/gif', 'image/jpeg', 'image/png'),
 ),
 atapi.ComputedField(name='title',
                     widget=atapi.ComputedWidget(
                         label=_(u"FacultyStaffDirectory_label_fullName",
                                 default=u"Full Name"),
                         visible={
                             'edit': 'invisible',
                             'view': 'visible'
                         },
                         i18n_domain='FacultyStaffDirectory',
                     ),
                     schemata="Basic Information",
                     accessor="Title",
                     user_property='fullname',
                     searchable=True),
 atapi.StringField(
     name='id',
     widget=atapi.StringWidget(
         label=_(u"gcUser_label_id", default=u"Access Account ID"),
         i18n_domain='gcommons.User',
         description=_(u"gcUser_description_id",
                       default=u"Example: abc123"),
     ),
     required=True,
Esempio n. 7
0
from zope.interface import implements, directlyProvides
from Acquisition import aq_inner, aq_parent

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata
from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget

from gcommons.Core import CoreMessageFactory as _
from gcommons.Core.interfaces import IComment
from gcommons.Core.config import PROJECTNAME

CommentSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
    atapi.ComputedField('title',
                        searchable=1,
                        expression='context._compute_title()',
                        accessor='Title'),
    atapi.StringField(
        'commentType',
        widget=atapi.SelectionWidget(
            label="Type",
            description=
            "Describe correctly the type of comment. Different types will be visible for different users.",
            label_msgid="gcommons_comment_type",
            description_msgid="gcommons_help_comment_type",
        ),
        required=True,
        vocabulary="getCommentTypesVocabulary",
        searchable=True),
    atapi.ReferenceField('refDraft',
                         relationship='refDraft',
Esempio n. 8
0
         'unit': 'informationUnits',
         'storage class': 'storageTypes'
     },
     widget=ateapi.RecordWidget(
         label='Size',
         description='Maximal size and type of this '
         'storage resource',
         visible={
             'view': 'invisible',
             'edit': 'visible'
         },
     ),
 ),
 atapi.ComputedField(
     'usage',
     expression=
     'here.renderMemoryValue(here.getUsedMemory() and here.getUsedMemory()["core"])',
     widget=atapi.ComputedWidget(label='Current usage'),
 ),
 atapi.ComputedField(
     'number',
     expression='here.getNumberOfRegisteredObjects()',
     widget=atapi.ComputedWidget(label='Registered objects'),
 ),
 atapi.ComputedField(
     'allocated',
     expression='here.renderMemoryValue(here.getAllocatedMemory())',
     widget=atapi.ComputedWidget(label='Allocated storage'),
 ),
 atapi.ComputedField(
     'storage_class',
     expression='here.getStorageClass()',
Esempio n. 9
0
 ),
 atapi.DateTimeField(
     'endDate',
     required=True,
     searchable=False,
     accessor='end',
     #TODO
     #        write_permission = ChangeEvents,
     default_method=DateTime,
     languageIndependent=True,
     widget=atapi.CalendarWidget(
         description='', label=_(u'label_call_end', default=u'Call Ends')),
 ),
 atapi.ComputedField(
     'start_date',
     searchable=1,
     expression='context._start_date()',
 ),
 atapi.ComputedField(
     'end_date',
     searchable=1,
     expression='context._end_date()',
 ),
 atapi.ComputedField(
     'duration_total_days',
     searchable=1,
     expression='context._duration_total_days()',
     accessor='total_days',
 ),
 atapi.ComputedField(
     'duration_months',
Esempio n. 10
0
        'indicatedBodySystems',
        storage=atapi.AnnotationStorage(),

        multiValued=True,
        searchable=True,
        widget=atapi.LinesWidget(
            label=_(u'Indicated Organs'),

            visible={'view': 'invisible', 'edit': 'invisible'},
        ),
    ),
    atapi.ComputedField(
        'biomarkerKind',
        searchable=True,

        expression='u"Biomarker"',
        modes=('view',),
        widget=atapi.ComputedWidget(
            visible={'edit': 'invisible', 'view': 'invisible'},
        ),
    ),
    atapi.LinesField(
        'accessGroups',
        storage=atapi.AnnotationStorage(),
        required=False,
        multiValued=True,
        widget=atapi.LinesWidget(
            label=_(u'Access Groups'),
            description=_(u'URIs identifying groups that may access this biomarker.'),
        ),
    ),
    atapi.StringField(
Esempio n. 11
0
            description='If applicable, please mention the '
            'scientific field(s) this customer '
            'is focussing on.'),
    ),
    BackReferenceField(
        'resources',
        relationship='customer',
        multiValued=True,
        widget=BackReferenceWidget(
            label='Customer\'s Resources',
            visible={'edit': 'invisible'},
        ),
    ),
    atapi.ComputedField(
        'usage_summary',
        expression='here.getResourceUsageSummary(here.getResources())',
        widget=atapi.ComputedWidget(label='Usage'),
    ),
    atapi.ComputedField(
        'resource_usage',
        expression='here.listResourceUsage(here.getResources())',
        widget=atapi.ComputedWidget(label='Resource Usage'),
    ),
)) + CommonFields.copy()

schemata.finalizeATCTSchema(CommunitySchema,
                            folderish=True,
                            moveDiscussion=False)


class Community(folder.ATFolder, CommonUtilities):
Esempio n. 12
0
                             'Jahreszahl ist unrealistisch!'),
     ),
     widget=atapi.StringWidget(
         visible={
             'edit': 'visible',
             'view': 'invisible'
         },
         size=5,
         maxlength=4,
         label=config.LABEL_GRADUATE_YEAR,
     ),
 ),
 atapi.ComputedField(
     'graduateGroup',
     languageIndependent=True,
     searchable=True,
     #required = True,
     widget=atapi.ComputedWidget(label=config.LABEL_GRADUATE_GROUP, ),
     expression="context.computeGroupID()",
 ),
 atapi.StringField('eventType',
                   languageIndependent=True,
                   required=True,
                   searchable=True,
                   vocabulary=config.EVENT_TYPES,
                   write_permission=ChangeEvents,
                   widget=atapi.SelectionWidget(
                       format='radio',
                       description=config.DESCR_TYPE,
                       label=config.LABEL_TYPE,
                   )),
 atapi.StringField(
Esempio n. 13
0
                'institution':
                Column(_('Institution')),
                'email':
                Column(_('email')),
            },
        ),
        allow_empty_rows=False,
        required=False,
        columns=('relationship', 'name', 'institution', 'email')),

    #
    # Overrride default fields creators and contributors
    atapi.ComputedField(
        name='creators',
        accessor='Creators',
        expression='context._compute_creators()',
        storage=atapi.AnnotationStorage(),
        searchable=True,
    ),
    atapi.ComputedField(
        name='contributors',
        accessor='Contributors',
        expression='context._compute_contributors()',
        storage=atapi.AnnotationStorage(),
        searchable=True,
    ),
))


def finalizeAuthorsSchema(schema):
    """
Esempio n. 14
0
from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget

from pcp.contenttypes.interfaces import IProvider
from pcp.contenttypes.config import PROJECTNAME
from pcp.contenttypes.content.common import CommonFields
from pcp.contenttypes.content.common import CommonUtilities

ProviderSchema = folder.ATFolderSchema.copy() + atapi.Schema((
    ateapi.UrlField(
        'url',
        searchable=1,
    ),
    atapi.ComputedField(
        'link2offers',
        expression="here.getOffersURL()",
        widget=atapi.ComputedWidget(label="Resource offers"),
    ),
    atapi.StringField(
        'provider_type',
        searchable=1,
        vocabulary='provider_types',
        default='generic',
        widget=atapi.SelectionWidget(label='Provider type', ),
    ),
    atapi.StringField(
        'provider_userid',
        required=True,
        searchable=0,
        default='',
        widget=atapi.StringWidget(
Esempio n. 15
0
              vocabulary='getCSSClassesVocabulary',
              default=["listing"],
              widget=atapi.MultiSelectionWidget(
                        label=_(u'CSS classes'),
                        description=_(u'CSS classes to be applied to the table.\n'
                                      u'This list is taken from available TinyMCE style for tables.'),
                        format="checkbox",
                        visible={'view': 'invisible', 'edit': 'visible'},
                        condition="object/getCSSClassesVocabulary",
            ),
    ),

    atapi.ComputedField('text',
        expression="object/getText",
        searchable=True,
        widget=atapi.ComputedWidget(
            label=ATDocumentSchema['text'].widget.label,
            description=ATDocumentSchema['text'].widget.description,
        )
    ),

    atapi.TextField('textAfter',
              required=False,
              searchable=True,
              storage=atapi.AnnotationStorage(migrate=True),
              validators=('isTidyHtmlWithCleanup',),
              default_output_type='text/x-html-safe',
              widget=atapi.RichWidget(
                        label=_(u'label_text_after', default=u'Text after the table'),
                        visible={'view': 'invisible', 'edit': 'visible'},
                        rows=25,
                        allow_file_upload=zconf.ATDocument.allow_document_upload),
Esempio n. 16
0
                         ),
    atapi.ReferenceField('registered_services_used',
                         read_permission='View internals',
                         write_permission='Modify internals',
                         relationship='using',
                         multiValued=1,
                         allowed_types=('RegisteredService',),
                         widget=ReferenceBrowserWidget(label='Registered services used',
                                                       description="Select all registered services the project requires",
                                                       allow_browse=1,
                                                       startup_directory='/operations',
                                                       condition='python:here.stateIn(["enabling","pre_production","production","terminated"])'),

                         ),
    atapi.ComputedField('allocated_new',
                        expression='here.renderMemoryValue(here.convert(here.getStorageResourcesSizeSummary(here.getResources())))',
                        widget=atapi.ComputedWidget(label='Allocated'),
                       ),
    atapi.ComputedField('used_new',
                        expression='here.renderMemoryValue(here.convert(here.getStorageResourcesUsedSummary(here.getResources())))',
                        widget=atapi.ComputedWidget(label='Used'),
                        ),
    atapi.ReferenceField('general_provider',
                         relationship='general_provider',
                         allowed_types=('Provider',),
                         widget=ReferenceBrowserWidget(label='General provider',
                                                       description='General provider for this project (chose EUDAT Ltd if in doubt)',
                                                       allow_browse=1,
                                                       startup_directory='/providers',
                                                       ),
                         ),
    atapi.ReferenceField('project_enabler',
Esempio n. 17
0
     required=0,
     vocabulary_display_path_bound=sys.maxint,
     allowed_types=('Department', ),
     relationship='LabContactDepartment',
     vocabulary='getDepartments',
     referenceClass=HoldingReference,
     widget=atapi.ReferenceWidget(
         visible=False,
         checkbox_bound=0,
         label=_("Department"),
         description=_("The laboratory department"),
     ),
 ),
 atapi.ComputedField(
     'DepartmentTitle',
     expression=
     "context.getDepartment() and context.getDepartment().Title() or ''",
     widget=atapi.ComputedWidget(visible=False, )),
 atapi.ReferenceField(
     'Departments',
     required=0,
     vocabulary_display_path_bound=sys.maxint,
     allowed_types=('Department', ),
     relationship='LabContactDepartment',
     vocabulary='_departmentsVoc',
     referenceClass=HoldingReference,
     multiValued=1,
     widget=atapi.ReferenceWidget(
         checkbox_bound=0,
         label=_("Departments"),
         description=_("The laboratory departments"),
         label='Service URL',
         description='[http|https|irods|gsiftp|ssh]://URL:port',
     ),
 ),
 BackReferenceField(
     'parent_services',
     relationship='service_components',
     multiValued=True,
     widget=BackReferenceWidget(
         visible={'edit': 'invisible'},
         label='Part of these registered services',
     ),
 ),
 atapi.ComputedField(
     'scopes',
     expression='here.getScopeValues(asString = 1)',
     widget=atapi.ComputedWidget(label='Project Scopes'),
 ),
 atapi.StringField(
     'host_name',
     searchable=1,
     widget=atapi.StringWidget(
         label='Host name',
         description='In valid FQDN format (fully qualified domain name)',
     ),
 ),
 atapi.StringField(
     'host_ip4',
     widget=atapi.StringWidget(
         label="IP4 address",
         description="Host's IP4 address (a.b.c.d)",
            description=_(u"help_services_email",
                          default=u"Enter the email for contacts."),
            i18n_domain='ploneservicescenter',
        ),
        required=0,
        searchable=1,
        index=('KeywordIndex:schema', ),
    ),
    atapi.ComputedField(
        'sortExpression',
        expression='''\
str(context.getRating()) + " " + str(context.Title()).lower()''',
        mode='r',
        index=('FieldIndex', ),
        widget=atapi.StringWidget(
            label=_(u"", default=u"Sort Expression"),
            #            description=_(u"", default=u""),
            visible={
                'edit': 'invisible',
                'view': 'invisible'
            },
        ),
    ),
))


class BaseServicesContent(base.ATCTContent):

    _getPossibleRatings = lambda x: range(1, 4)

    global_allow = 0
Esempio n. 20
0
         },
         size=1,
         label=_('UF'),
         description=_('Informe o seu estado.'),
     ),
     required=True,
     schemata="Address",
     vocabulary_factory='brasil.estados',
     enforceVocabulary=True,
 ),
 atapi.ComputedField(name='Endereco',
                     expression='context.fmt_endereco()',
                     widget=atapi.ComputedWidget(
                         visible={
                             'view': 'visible',
                             'edit': 'invisible'
                         },
                         label=_('Endereço'),
                     ),
                     default_output_type='text/x-html-safe',
                     schemata="Address",
                     searchable=True),
 atapi.TextField(name='referencia',
                 allowable_content_types=('text/html', ),
                 widget=atapi.RichWidget(
                     visible={
                         'view': 'invisible',
                         'edit': 'invisible'
                     },
                     label=_('Referência'),
                     description=_('Informe pontos de referência.'),
                 ),
Esempio n. 21
0
    atapi.DateTimeField(
        name='startDate',                  
        required=True,                  
        searchable=False,                  
        accessor='start',                  
#TODO                  write_permission = ChangeEvents,                  
        default_method=DateTime,                  
        languageIndependent=True,                  
        widget = atapi.CalendarWidget(                        
                  description= '',                        
                  label=_(u'label_event_start', 
                          default=u'Event Starts')          
        ),
    ),    
    atapi.ComputedField('start_date',        
        searchable=1,        
        expression='context._start_date()',       
    ),
    atapi.ComputedField('end_date',        
        searchable=1,        
        expression='context._end_date()',       
    ),
    atapi.ComputedField('duration',
        searchable=1,        
        expression='context._duration()',       
    ),


    atapi.LinesField(
        name='agenda',
        widget = atapi.LinesWidget(
            label="Agenda topics",
Esempio n. 22
0
# Maximum number of protocols that we'll allow to all have the same title.
MAX_PROTOCOL_INDEX = 100

# To support CA-586, we'll make "description" a computed field whose value comes from
# the abstract, objectives, aims, or results outcome.
ProtocolSchema = knowledgeobject.KnowledgeObjectSchema.copy(
) + ConstrainTypesMixinSchema.copy() + NextPreviousAwareSchema.copy()
del ProtocolSchema['description']
ProtocolSchema += atapi.Schema((
    atapi.ComputedField(
        'description',
        accessor='Description',
        allowable_content_types=('text/plain', ),
        default=u'',
        default_content_type='text/plain',
        expression='context._computeDescription()',
        searchable=True,
        widget=atapi.ComputedWidget(visible={
            'edit': 'invisible',
            'view': 'invisible'
        }, ),
    ),
    atapi.TextField(
        'abstract',
        storage=atapi.AnnotationStorage(),
        required=False,
        searchable=True,
        widget=atapi.TextAreaWidget(
            label=_(u'Abstract'),
            description=_(u'A not-quite-as-brief summary.'),
        ),