Example #1
0
 def testReplaceField(self):
     f1 = StringField('f1')
     f2 = StringField('f2')
     f3 = StringField('f3')
     self.schema.replaceField('a', f1)
     self.schema.replaceField('e', f2)
     self.schema.replaceField('z', f3)
     self.assertEqual(self.fields2names(self.schema.fields()),
                      ['f1', 'd', 'x', 'b', 'f2', 'y', 'c', 'f', 'f3'])
Example #2
0
 def testBasic(self):
     self.assertEqual(self.fields2names(self.schema.fields()),
                      ['a', 'd', 'x', 'b', 'e', 'y', 'c', 'f', 'z'])
     self.assertEqual(self.schema.getSchemataNames(),
                      ['waldi', 'nasbaer', 'edgar'])
     self.schema.addField(StringField('p', schemata='waldi'))
     self.schema.addField(StringField('hello_world', schemata='helloworld'))
     self.schema.addField(
         StringField('hello_world1', schemata='helloworld1'))
     self.assertEqual(
         self.schema.getSchemataNames(),
         ['waldi', 'nasbaer', 'edgar', 'helloworld', 'helloworld1'])
Example #3
0
 def test_DocumentEmptyLayoutBug(self):
     # add a text field to dyndocument which is not present
     # but needed for the standard view
     self.dyndocument.Schema().addField(StringField('text'))
     response = self.publish(self.dyndocument_path + '/view',
                             basic=self.basic)
     self.assertEqual(response.getStatus(), 200)
Example #4
0
 def testDelField(self):
     self.schema.delField('x')
     self.schema.delField('b')
     self.schema.delField('z')
     self.assertEqual(self.fields2names(self.schema.fields()),
                      ['a', 'd', 'e', 'y', 'c', 'f'])
     self.schema.addField(StringField('z'))
     self.schema.addField(StringField('b'))
     self.schema.addField(StringField('x'))
     self.assertEqual(self.fields2names(self.schema.fields()),
                      ['a', 'd', 'e', 'y', 'c', 'f', 'z', 'b', 'x'])
     self.schema.delField('b')
     self.schema.delField('z')
     self.schema.delField('x')
     self.assertEqual(self.fields2names(self.schema.fields()),
                      ['a', 'd', 'e', 'y', 'c', 'f'])
Example #5
0
 def afterSetUp(self):
     self.schema = ManagedSchema(
         (StringField('a',
                      schemata='waldi'), StringField('d',
                                                     schemata='nasbaer'),
          StringField('x',
                      schemata='edgar'), StringField('b', schemata='waldi'),
          StringField('e',
                      schemata='nasbaer'), StringField('y',
                                                       schemata='edgar'),
          StringField('c',
                      schemata='waldi'), StringField('f',
                                                     schemata='nasbaer'),
          StringField('z', schemata='edgar')))
Example #6
0
        class TestAT(BaseContent):

            schema = BaseContent.schema.copy() + Schema(
                (StringField(
                    'allowed_field',
                    vocabulary_factory='plone.app.vocabularies.PortalTypes',
                    write_permission='View'),
                 StringField(
                     'disallowed_field',
                     vocabulary_factory='plone.app.vocabularies.PortalTypes',
                     write_permission='View management screens'),
                 StringField(
                     'default_field',
                     vocabulary_factory='plone.app.vocabularies.PortalTypes'),
                 StringField(
                     'allowed_widget_vocab',
                     write_permission='View',
                     widget=AjaxSelectWidget(
                         vocabulary='plone.app.vocabularies.PortalTypes'),
                 )))
Example #7
0
    def __init__(self, oid, **kwargs):
        """ initialize class """
        BaseFormField.__init__(self, oid, **kwargs)

        # set a preconfigured field as an instance attribute
        self.fgField = StringField('fg_string_field',
            searchable=0,
            required=1,
            write_permission=View,
            #validators=('isNorobotsCorrect',),
            widget=NorobotsWidget(),
            )
Example #8
0
     'AttachmentFile',
     widget=FileWidget(label=_("Attachment"), ),
 ),
 ReferenceField(
     'AttachmentType',
     required=0,
     allowed_types=('AttachmentType', ),
     relationship='AttachmentAttachmentType',
     widget=ReferenceWidget(label=_("Attachment Type"), ),
 ),
 StringField(
     'ReportOption',
     searchable=True,
     vocabulary="ATTACHMENT_REPORT_OPTIONS",
     widget=SelectionWidget(
         label=_("Report Options"),
         checkbox_bound=0,
         format='select',
         visible=True,
         default='a',
     ),
 ),
 StringField(
     'AttachmentKeys',
     searchable=True,
     widget=StringWidget(label=_("Attachment Keys"), ),
 ),
 DateTimeField(
     'DateLoaded',
     required=1,
     default_method='current_date',
     widget=DateTimeWidget(label=_("Date Loaded"), ),
Example #9
0
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
################################################################################

from Products.Archetypes.tests.attestcase import ATTestCase
from Products.Archetypes.atapi import BaseSchema, BaseContent, Schema, \
    StringField, registerType, process_types, listTypes
from Products.Archetypes.config import PKG_NAME
from Products.Archetypes.VariableSchemaSupport import VariableSchemaSupport

schema = BaseSchema
schema1 = BaseSchema + Schema((StringField('additionalField'), ))


class Dummy(VariableSchemaSupport, BaseContent):
    schema = schema


class VarSchemataTest(ATTestCase):
    def afterSetUp(self):
        registerType(Dummy, 'Archetypes')
        content_types, constructors, ftis = process_types(
            listTypes(), PKG_NAME)

    def test_variableschema(self):
        self.folder.dummy = Dummy(oid='dummy')
        dummy = self.folder.dummy
Example #10
0
                                       ReferenceField, ReferenceWidget,
                                       BaseSchema, BaseContent, registerType,
                                       StringWidget)
import transaction
import zope.interface

schema = Schema((
    StringField(
        name='occupation',
        validators=(
            ExpressionValidator('''python:value != "Please select"'''), ),
        widget=SelectionWidget(
            label='Occupation',
            label_msgid='EEAEnquiry_label_occupation',
            i18n_domain='EEAEnquiry',
        ),
        required=True,
        vocabulary=[
            'Please select', 'Company',
            'Government official / international organisation',
            'Information centre / library / bookstore', 'Journalist', 'Media',
            'Interest Group/NGO', 'Politician', 'Researcher', 'Student',
            'Citizen', 'Teacher (primary, secondary and tertiary)', 'N/A'
        ]),
    StringField(
        name='purpuse',
        validators=(
            ExpressionValidator('''python:value != "Please select"'''), ),
        widget=SelectionWidget(
            label="Purpose",
            label_msgid='EEAEnquiry_label_purpuse',
from Products.ATContentTypes.configuration import zconf
from Products.ATContentTypes.config import PROJECTNAME
from Products.ATContentTypes.content.base import registerATCT
from Products.ATContentTypes.content.base import ATCTContent
from Products.ATContentTypes.content.schemata import ATContentTypeSchema
from Products.ATContentTypes.content.schemata import finalizeATCTSchema
from Products.ATContentTypes.interfaces import IATEvent
from Products.ATContentTypes.lib.calendarsupport import CalendarSupportMixin
from Products.ATContentTypes.lib.historyaware import HistoryAwareMixin

from Products.ATContentTypes import ATCTMessageFactory as _

ATEventSchema = ATContentTypeSchema.copy() + Schema((
    StringField('location',
                searchable=True,
                write_permission=ModifyPortalContent,
                widget=StringWidget(description='',
                                    label=_(u'label_event_location',
                                            default=u'Event Location'))),
    DateTimeField('startDate',
                  required=True,
                  searchable=False,
                  accessor='start',
                  write_permission=ModifyPortalContent,
                  default_method=DateTime,
                  languageIndependent=True,
                  widget=CalendarWidget(description='',
                                        label=_(u'label_event_start',
                                                default=u'Event Starts'))),
    DateTimeField('endDate',
                  required=True,
                  searchable=False,
                'icon': (32, 32),
                'listing': (16, 16),
            },
            validators=(('isNonEmptyFile', V_REQUIRED),
                        ('checkNewsImageMaxSize', V_REQUIRED)),
            widget=ImageWidget(description=_(
                u'help_news_image',
                default=
                u'Will be shown in the news listing, and in the news item itself. Image will be scaled to a sensible size.'
            ),
                               label=_(u'label_news_image', default=u'Image'),
                               show_content_type=False)),
        StringField('imageCaption',
                    required=False,
                    searchable=True,
                    widget=StringWidget(description='',
                                        label=_(u'label_image_caption',
                                                default=u'Image Caption'),
                                        size=40)),
    ),
    marshall=RFC822Marshaller())

ATNewsItemSchema['description'].widget.label = \
    _(u'label_summary', default=u'Summary')

finalizeATCTSchema(ATNewsItemSchema)


class ATNewsItem(ATDocumentBase, ATCTImageTransform):
    """An announcement that will show up on the news portlet and in the news listing."""
Example #13
0
 # DEFAULT =================================================================
 BooleanField(
     name='isValidatedDataset',
     schemata="default",
     widget=BooleanWidget(
         label=("Is Validated Dataset"),
         description=("Check this only if dataset is validated.")
     ),
 ),
 StringField(
     name='notValidatedCustomText',
     widget=StringWidget(
         label="Custom text for not validated",
         description=(
             "If this dataset is not validated you can set a "
             "custom label text here."),
         i18n_domain='eea',
     ),
     default="",
     searchable=False,
     schemata="default",
 ),
 # METADATA ================================================================
 StringField(
     name='sectionTitleData',  # ===========================================
     schemata='metadata',
     widget=LabelWidget(
         label=('DATA IDENTIFICATION'),
         i18n_domain="eea",
         visible={'edit': 'visible', 'view': 'invisible'}
     )
Example #14
0
     "AttachmentFile",
     widget=FileWidget(label=_("Attachment"), ),
 ),
 ReferenceField(
     "AttachmentType",
     required=0,
     allowed_types=("AttachmentType", ),
     relationship="AttachmentAttachmentType",
     widget=ReferenceWidget(label=_("Attachment Type"), ),
 ),
 StringField(
     "ReportOption",
     searchable=True,
     vocabulary=ATTACHMENT_REPORT_OPTIONS,
     widget=SelectionWidget(
         label=_("Report Options"),
         checkbox_bound=0,
         format="select",
         visible=True,
         default="r",
     ),
 ),
 StringField(
     "AttachmentKeys",
     searchable=True,
     widget=StringWidget(label=_("Attachment Keys"), ),
 ),
 DateTimeField(
     "DateLoaded",
     required=1,
     default_method="current_date",
     widget=DateTimeWidget(label=_("Date Loaded"), ),
Example #15
0
         description=_("If unchecked, analysts and lab clerks will "
                       "be able to manage Worksheets, too. If the "
                       "users have restricted access only to those "
                       "worksheets for which they are assigned, "
                       "this option will be checked and readonly."))),
 BooleanField('ShowPrices',
              schemata="Accounting",
              default=True,
              widget=BooleanWidget(
                  label=_("Include and display pricing information"), )),
 StringField(
     'Currency',
     schemata="Accounting",
     required=1,
     vocabulary=CURRENCIES,
     default='ZAR',
     widget=SelectionWidget(
         label=_("Currency"),
         description=_(
             "Select the currency the site will use to display prices."),
         format='select',
     )),
 StringField(
     'DefaultCountry',
     schemata="Accounting",
     required=1,
     vocabulary='getCountries',
     default='',
     widget=SelectionWidget(
         label=_("Country"),
         description=_("Select the country the site will show by default"),
         format='select',
Example #16
0
from liege.urban import UrbanMessage as _
from liege.urban import interfaces

from Products.Archetypes.atapi import Schema
from Products.Archetypes.atapi import StringField

from Products.urban.content.licence.Inspection import Inspection

from plone import api

specific_schema = Schema((StringField(
    name='formal_notice_old_reference',
    widget=StringField._properties['widget'](
        size=60,
        label=_('urban_label_formal_notice_old_reference',
                default='Formal_notice_old_reference'),
    ),
    schemata='urban_description',
), ), )


def update_item_schema(baseSchema):
    LicenceSchema = baseSchema + specific_schema.copy()

    # move some fields
    LicenceSchema.moveField('formal_notice_old_reference',
                            after='referenceDGATLP')
    return LicenceSchema

Example #17
0
from eea.versions import versions
from eea.versions.interfaces import IVersionEnhanced, IGetVersions
from eea.sparql. async import IAsyncService
from plone.app.blob.field import BlobField
from eea.sparql.converter.sparql2json import sparql2json
logger = logging.getLogger("eea.sparql")

RESULTS_TYPES = {
    'xml': "application/sparql-results+xml",
    'xmlschema': "application/x-ms-access-export+xml",
    'json': "application/sparql-results+json"
}

SparqlBaseSchema = atapi.Schema((
    StringField(name='endpoint_url',
                widget=StringWidget(label="Sparql endpoint URL", ),
                validators=('isURL', ),
                required=1),
    IntegerField(name='timeout',
                 widget=SelectionWidget(label="Timeout (seconds)", ),
                 default=10,
                 required=1,
                 vocabulary=['10', '20', '30', '40', '50', '60', '300', '600'],
                 accessor='getTimeout',
                 edit_accessor='getTimeout',
                 mutator='setTimeout'),
    DataGridField(
        name='arg_spec',
        widget=DataGridWidget(
            label="Arguments",
            description="""Provide names, types and queries for the arguments.
                    Names and types are mandatory, but you can leave the
Example #18
0
from Products.ATContentTypes.interfaces import IATLink
from Products.CMFCore.permissions import ModifyPortalContent
from Products.CMFCore.permissions import View
from urllib import quote
from zope.interface import implementer

import urlparse

ATLinkSchema = ATContentTypeSchema.copy() + Schema((
    StringField(
        'remoteUrl',
        required=True,
        searchable=True,
        primary=True,
        default="http://",
        # either mailto, absolute url or relative url
        validators=(),
        widget=StringWidget(
            description='',
            label=_(u'label_url', default=u'URL'),
            maxlength='511',
        )), ))
finalizeATCTSchema(ATLinkSchema)


@implementer(IATLink)
class ATLink(ATCTContent):
    """A link to an internal or external resource."""

    schema = ATLinkSchema
Example #19
0
from Products.ATContentTypes.criteria.base import ATBaseCriterion
from Products.ATContentTypes.criteria.schemata import ATBaseCriterionSchema
from Products.ATContentTypes.interfaces import IATTopicSearchCriterion
from Products.ATContentTypes.permission import ChangeTopics
from Products.CMFCore.permissions import View
from Products.CMFCore.utils import getToolByName
from zope.interface import implementer


ATRelativePathCriterionSchema = ATBaseCriterionSchema + Schema((
    StringField(
        'relativePath',
        default='..',
        widget=StringWidget(
            label='Relative path',
            label_msgid="label_relativepath_criteria_customrelativepath",
            description_msgid="help_relativepath_criteria_customrelativepath",
            i18n_domain="plone",
            description=u"Enter a relative path e.g.: <br /> '..' for the "
            u"parent folder <br /> '../..' for the parent's parent <br />"
            u"'../somefolder' for a sibling folder")
    ),

    BooleanField(
        'recurse',
        mode="rw",
        write_permission=ChangeTopics,
        accessor="Recurse",
        default=False,
        widget=BooleanWidget(
            label="Search Sub-Folders",
            label_msgid="label_path_criteria_recurse",
Example #20
0
def update_item_schema(baseSchema):
    specificSchema = Schema((
        StringField(
            name='refdoc',
            default_method="getDocReference",
            widget=StringWidget(
                size=100,
                label='Refdoc',
                label_msgid='MeetingAndenne_label_refDoc',
                i18n_domain='PloneMeeting',
            ),
            searchable=True,
        ),
        StringField(
            name='verifUser',
            default_method="Creator",
            widget=StringWidget(
                visible=False,
                format="select",
                label='Verifuser',
                label_msgid='MeetingAndenne_label_verifUser',
                i18n_domain='PloneMeeting',
            ),
            searchable=True,
        ),
        StringField(name='yourrefdoc',
                    widget=StringWidget(
                        size=100,
                        label='yourRefdoc',
                        label_msgid='MeetingAndenne_label_yourrefDoc',
                        i18n_domain='PloneMeeting',
                    ),
                    searchable=True),
        StringField(
            name='treatUser',
            default_method="Creator",
            widget=SelectionWidget(
                format="select",
                label='Treatuser',
                label_msgid='MeetingAndenne_label_treatUser',
                i18n_domain='PloneMeeting',
            ),
            vocabulary='listTreatUsers',
            searchable=True,
        ),
        TextField(name='projetpv',
                  widget=RichWidget(
                      rows=15,
                      label='Projetpv',
                      label_msgid='MeetingAndenne_label_projetpv',
                      i18n_domain='PloneMeeting',
                  ),
                  read_permission="PloneMeeting: Read decision",
                  default_content_type="text/html",
                  searchable=True,
                  write_permission="PloneMeeting: Write decision",
                  allowable_content_types=('text/html', ),
                  default_output_type="text/html"),
        TextField(name='pv',
                  widget=RichWidget(
                      rows=15,
                      label='Pv',
                      label_msgid='MeetingAndenne_label_pv',
                      i18n_domain='PloneMeeting',
                  ),
                  read_permission="MeetingAndenne: Read pv",
                  default_content_type="text/html",
                  searchable=True,
                  write_permission="MeetingAndenne: Write pv",
                  allowable_content_types=('text/html', ),
                  default_output_type="text/html"),
        TextField(name='textpv',
                  widget=RichWidget(
                      rows=15,
                      label='Textpv',
                      label_msgid='MeetingAndenne_label_textpv',
                      i18n_domain='PloneMeeting',
                  ),
                  read_permission="MeetingAndenne: Read pv",
                  default_content_type="text/html",
                  searchable=True,
                  write_permission="MeetingAndenne: Write pv",
                  allowable_content_types=('text/html', ),
                  default_output_type="text/html"),
        BooleanField(name='isconfidential',
                     widget=BooleanWidget(
                         label='IsConfidential',
                         label_msgid='MeetingAndenne_label_isConfidential',
                         i18n_domain='PloneMeeting',
                     ),
                     searchable=True,
                     default=False),
        LinesField(
            name='itemPresents',
            widget=MultiSelectionWidget(
                visible=False,
                format="checkbox",
                label='Itempresents',
                label_msgid='MeetingAndenne_label_itemPresents',
                i18n_domain='PloneMeeting',
            ),
            multiValued=1,
        ),
    ), )

    completeItemSchema = baseSchema + specificSchema.copy()
    completeItemSchema[
        'title'].widget.condition = "python: not hasattr(here, 'template') or not here.queryState()=='itemcreated' or here.portal_membership.getAuthenticatedMember().has_role('Manager')"

    completeItemSchema[
        'copyGroups'].write_permission = "MeetingAndenne: Write copygroup"
    completeItemSchema[
        'description'].widget.label_method = 'getLabelForDescription'
    completeItemSchema['budgetInfos'].widget.rows = 12
    completeItemSchema['itemSignatories'].optional = True
    completeItemSchema[
        'proposingGroup'].default_method = "getDefaultProposingGroup"
    completeItemSchema[
        'notes'].read_permission = "PloneMeeting: Read item observations"
    completeItemSchema[
        'notes'].write_permission = "PloneMeeting: Write item observations"
    completeItemSchema['votesAreSecret'].default = True

    completeItemSchema['category'].widget = DynatreeWidget(
        condition="python: here.showCategory()",
        description="Category",
        description_msgid="item_category_descr",
        label='Category',
        label_msgid='PloneMeeting_label_category',
        i18n_domain='PloneMeeting',
        leafsOnly=True,
        rootVisible=True,
        selectMode=1,
        sparse=False,
    )
    completeItemSchema['category'].vocabulary = SubCategoriesVocabulary()

    completeItemSchema.moveField('refdoc', pos='top')
    completeItemSchema.moveField('yourrefdoc', pos=2)
    completeItemSchema.moveField('treatUser', pos=8)
    completeItemSchema.moveField('projetpv', pos=25)
    completeItemSchema.moveField('pv', pos=25)
    completeItemSchema.moveField('textpv', pos=24)
    completeItemSchema.moveField('isconfidential', pos='top')

    return completeItemSchema
Example #21
0
from eea.indicators.content.IndicatorMixin import IndicatorMixin
from eea.indicators.content.base import ModalFieldEditableAware
from eea.indicators.content.utils import get_dgf_value
from eea.relations.field import EEAReferenceField
from eea.relations.widget import EEAReferenceBrowserWidget
from eea.workflow.interfaces import IHasMandatoryWorkflowFields
from zope.interface import implements

schema = Schema(
    (
        StringField(
            name='title',
            widget=StringField._properties['widget'](
                label="Title",
                label_msgid='indicators_label_title',
                i18n_domain='indicators',
            ),
            schemata="default",
            searchable=True,
            required=True,
            accessor="Title",
        ),
        TextField(
            name='description',
            widget=TextAreaWidget(
                label="Description",
                label_msgid='indicators_label_description',
                i18n_domain='indicators',
            ),
        ),
        TextField(
            name='assessment',
Example #22
0
 ReferenceField(
     'Supplier',
     vocabulary='getSuppliers',
     allowed_types=('Supplier', ),
     relationship='InstrumentSupplier',
     required=1,
     widget=SelectionWidget(format='select',
                            label=_("Supplier"),
                            visible={
                                'view': 'invisible',
                                'edit': 'visible'
                            }),
 ),
 StringField('Model',
             widget=StringWidget(
                 label=_("Model"),
                 description=_("The instrument's model number"),
             )),
 StringField(
     'SerialNo',
     widget=StringWidget(
         label=_("Serial No"),
         description=_(
             "The serial number that uniquely identifies the instrument"),
     )),
 UIDReferenceField(
     'Method',
     vocabulary='_getAvailableMethods',
     allowed_types=('Method', ),
     required=0,
     widget=SelectionWidget(
                                       Title=value)
        if requestors and requestors[0].getObject().UID() != instance.UID():
            return ("Your email already exists, please go 2 steps back in "
                    "your browser and request your password.")
        return 1


validation.register(UniqueRequestorValidator('isUnique'))

schema = Schema((
    StringField(name='title',
                widget=StringWidget(
                    label="Email address",
                    label_msgid='EEAEnquiry_label_title',
                    i18n_domain='EEAEnquiry',
                ),
                required=True,
                accessor="Title",
                validators=(
                    'isEmail',
                    'isUnique',
                )),
    StringField(name='password',
                widget=PasswordWidget(
                    visible={'view': 'invisible'},
                    description=("Please enter a password if you want to save "
                                 "the information for future enquiries."),
                    label='Password',
                    label_msgid='EEAEnquiry_label_password',
                    description_msgid='EEAEnquiry_help_password',
                    i18n_domain='EEAEnquiry',
                ),
Example #24
0
     )
 ),
 BooleanField(
     'ShowPrices',
     schemata="Accounting",
     default=True,
     widget=BooleanWidget(
         label=_("Include and display pricing information"),
     )
 ),
 StringField(
     'Currency',
     schemata="Accounting",
     required=1,
     vocabulary=CURRENCIES,
     default='ZAR',
     widget=SelectionWidget(
         label=_("Currency"),
         description=_("Select the currency the site will use to display prices."),
         format='select',
     )
 ),
 StringField(
     'DefaultCountry',
     schemata="Accounting",
     required=1,
     vocabulary='getCountries',
     default='',
     widget=SelectionWidget(
         label=_("Country"),
         description=_("Select the country the site will show by default"),
         format='select',
Example #25
0
        default=None,
        widget=IntegerWidget(
            label=_(u'label_int_criteria_value2', default=u'Second Value'),
            description=_(
                u'help_int_criteria_value2',
                default=u'An integer number used as the maximum value if '
                u'the between direction is selected.')),
    ),
    StringField(
        'direction',
        required=0,
        mode="rw",
        write_permission=ChangeTopics,
        default='',
        vocabulary=DirectionOperations,
        enforceVocabulary=1,
        widget=SelectionWidget(
            label=_(u'label_int_criteria_direction', default=u'Direction'),
            description=_(
                u'help_int_criteria_direction',
                default=u'Specify whether you want to find values lesser '
                u'than, greater than, equal to, or between the chosen '
                u'value(s).')),
    ),
))


@implementer(IATTopicSearchCriterion)
class ATSimpleIntCriterion(ATBaseCriterion):
    """A simple int criterion"""

    security = ClassSecurityInfo()
Example #26
0
from Products.Archetypes.atapi import StringWidget
from Products.ATContentTypes import ATCTMessageFactory as _
from Products.ATContentTypes.permission import ChangeTopics

###
# AT Base Criterion
###

ATBaseCriterionSchema = Schema((
    StringField(
        'id',
        required=1,
        mode="r",
        default=None,
        write_permission=ChangeTopics,
        widget=IdWidget(
            label=_(u'label_short_name', default=u'Short Name'),
            description=_(
                u'help_shortname',
                default=u"Should not contain spaces, underscores or mixed "
                u"case. Short Name is part of the item's web address."),
            visible={'view': 'invisible'}),
    ),
    StringField(
        'field',
        required=1,
        mode="r",
        accessor="Field",
        write_permission=ChangeTopics,
        default=None,
        widget=StringWidget(
            label=_(u'label_criteria_field_name', default=u'Field name'),
            label=_(u"Search terms"),
            description=_(u"Define the search terms for the items you want to "
                          u"list by choosing what to match on. "
                          u"The list of results will be dynamically updated."),
            registry_prefix='bika.lims.analysisrequestquery',
            catalog_name='bika_catalog',
        ),
        validators=('javascriptDisabled', )
    ),

    StringField(
        name='sort_on',
        required=False,
        mode='rw',
        default='sortable_title',
        widget=StringWidget(
            label=_(u'Sort the collection on this index'),
            description='',
            visible=False,
        ),
    ),

    BooleanField(
        name='sort_reversed',
        required=False,
        mode='rw',
        default=False,
        widget=BooleanWidget(
            label=_(u'Sort the results in reversed order'),
            description='',
            visible=False,
Example #28
0
from bika.lims.browser.fields.remarksfield import RemarksField
from bika.lims.browser.widgets import ComboBoxWidget
from bika.lims.browser.widgets import RemarksWidget
from bika.lims.browser.widgets import DateTimeWidget
from bika.lims.browser.widgets import ReferenceWidget
from bika.lims import logger
from bika.lims.config import PROJECTNAME
from bika.lims.content.bikaschema import BikaSchema
from bika.lims.interfaces import IInstrumentCertification
from plone.app.blob.field import FileField as BlobFileField
from zope.interface import implements

schema = BikaSchema.copy() + Schema((
    StringField(
        'TaskID',
        widget=StringWidget(
            label=_("Task ID"),
            description=_("The instrument's ID in the lab's asset register"),
        )),
    ReferenceField('Instrument',
                   allowed_types=('Instrument', ),
                   relationship='InstrumentCertificationInstrument',
                   widget=StringWidget(visible=False, )),
    ComputedField(
        'InstrumentUID',
        expression=
        'context.getInstrument() and context.getInstrument().UID() or None',
        widget=ComputedWidget(visible=False, ),
    ),

    # Set the Certificate as Internal
    # When selected, the 'Agency' field is hidden
Example #29
0
         description=_(
             "Date from which the instrument is under validation"),
     ),
 ),
 DateTimeField(
     'DownTo',
     with_time=1,
     with_date=1,
     widget=DateTimeWidget(
         label=_("To"),
         description=_("Date until the instrument will not be available"),
     ),
 ),
 StringField('Validator',
             widget=StringWidget(
                 label=_("Validator"),
                 description=_("The analyst responsible of the validation"),
             )),
 TextField(
     'Considerations',
     default_content_type='text/plain',
     allowed_content_types=('text/plain', ),
     default_output_type="text/plain",
     widget=TextAreaWidget(
         label=_("Considerations"),
         description=_("Remarks to take into account before validation"),
     ),
 ),
 TextField(
     'WorkPerformed',
     default_content_type='text/plain',
Example #30
0
from Products.Archetypes.atapi import TextField
from Products.Archetypes.atapi import RichWidget
from Products.Archetypes.atapi import BooleanField
from Products.Archetypes.atapi import BooleanWidget
from Products.Archetypes.atapi import registerType
from Products.CMFCore.permissions import View

from Products.ATContentTypes.content.base import ATCTOrderedFolder
from Products.ATContentTypes.content.document import finalizeATCTSchema

from Products.ATContentTypes.lib.constraintypes import ConstrainTypesMixinSchema

schema = ATCTOrderedFolder.schema.copy() + ConstrainTypesMixinSchema + Schema((
    StringField('description',
                isMetadata=1,
                accessor='Description',
                searchable=1,                
                widget=TextAreaWidget(label='Description', description='Give a short description for this template.'),),
    BooleanField('showUsage',
                 default = False,
                 widget=BooleanWidget(label='Show template description and instructions', 
                                      description='When checked, a page with instructions for this template will be displayed before the actual template items are created.')),                
    TextField('usage',
                searchable=1,
                required=0,
                primary=1,
                default_output_type = 'text/x-html-safe',
                allowable_content_types=('text/html',),
                widget=RichWidget(allow_file_upload=0, label='Instructions for the user', 
                                  allow_format_edit=0,
                                  description="")),