ATNewsItemSchema = ATContentTypeSchema.copy() + Schema(
    (
        TextField(
            'text',
            required=False,
            searchable=True,
            primary=True,
            storage=AnnotationStorage(migrate=True),
            validators=('isTidyHtmlWithCleanup', ),
            #validators=('isTidyHtml',),
            default_output_type='text/x-html-safe',
            widget=RichWidget(
                description='',
                label=_(u'label_body_text', u'Body Text'),
                rows=25,
                allow_file_upload=zconf.ATDocument.allow_document_upload)),
        ImageField(
            'image',
            required=False,
            storage=AnnotationStorage(migrate=True),
            languageIndependent=True,
            max_size=zconf.ATNewsItem.max_image_dimension,
            sizes={
                'large': (768, 768),
                'preview': (400, 400),
                'mini': (200, 200),
                'thumb': (128, 128),
                'tile': (64, 64),
                '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())
Exemple #2
0
class ECQScaleAnswer(ECQMCAnswer):
    """An answer to a multiple-choice question that provides only some of the points."""
    
    schema = ECQMCAnswer.schema.copy() + Schema((
            FloatField(
                'score',
                accessor='getScorePrivate',
                mutator = 'setScore',
                edit_accessor = 'getScoreForEdit',
                default=0.0,
                searchable=False,
                validators=('percentage',),
                read_permission=permissions.PERMISSION_INTERROGATOR,
                widget=StringWidget(
                    label='Score',
                    label_msgid='partial_correct_label',
                    description='How many marks do you get for giving '
                    'this answer?  A higher value than the total for '
                    'this question will be reduced.',
                    description_msgid='partial_correct_tool_tip',
                    i18n_domain=config.I18N_DOMAIN,
                    size = 8,),
                ),),)
    
    # This type of question is always tutor-graded
    schema.delField('correct')
    
    # Use a custom page template for viewing.
    actions = (
        {
            'id': 'view',
            'action': 'string:${object_url}/ecq_scaleanswer_view',
        },
    )
    
    meta_type = 'ECQScaleAnswer'	# zope type name
    portal_type = meta_type		# plone type name
    archetype_name = 'Scale Answer'	# friendly type name

    # Use the portal_factory for this type.  The portal_factory tool
    # allows users to initiate the creation objects in a such a way
    # that if they do not complete an edit form, no object is created
    # in the ZODB.
    #
    # This attribute is evaluated by the Extensions/Install.py script.
    use_portal_factory = True

    security = ClassSecurityInfo()
    #security.declareProtected(PERMISSION_STUDENT, 'getId')
    #security.declareProtected(PERMISSION_STUDENT, 'getAnswer')

    #security.declareProtected(PERMISSION_GRADE, 'setScore')
    def setScore(self, input):
        """
        Mutator for the `score' field.  Allows the input of localized
        numbers.
        """
        #log("INPUT: %s (%s)" % (repr(input), repr(type(input))))
        if type(input) in (str, unicode):
            decimalSeparator = self.translate(msgid = 'fraction_delimiter',
                                              domain = config.I18N_DOMAIN,
                                              default = '.')
            # remove the `%' sign
            input = input[:-1]
            # de-localize the number
            score = input.replace(decimalSeparator, '.')
            score = float(score)
        else:
            score = input

        self.getField('score').set(self, score)

    #security.declareProtected(PERMISSION_STUDENT, 'getScoreForEdit')
    def getScoreForEdit(self):
        # no docstring prevents publishing
        #
        # Edit accessor for the `score' field. Converts the stored score
        # into a localized representation.
        #
        # FIXME: check permissions: only return something to
        # candidates if we're in resultView
        
        number   = self.getScorePrivate()
        mctool   = getToolByName(self, 'ecq_tool')
        for_edit = mctool.localizeNumber('%f', number)
        for_edit = for_edit.rstrip('0')
        # make sure it doesn't end with the decimal separator
        if not for_edit[-1].isdigit():
            for_edit = for_edit + '0'
        # appedn the percent sign
        for_edit += '%'
        return for_edit
    
    security.declareProtected(permissions.PERMISSION_STUDENT, 'getScore')
    def getScore(self, *args, **kwargs):
        # no docstring prevents publishing
        # FIXME: check permissions: only return something if we're in resultView
        return self.getScorePrivate(*args, **kwargs)
    + MetadataSchema(())
    + Schema(
        (
            TextField(
                "rich",
                required=False,
                searchable=True,
                default_output_type="text/x-html-safe",
                widget=RichWidget(description="", label=u"Rich Text"),
            ),
            TextField(
                "plain",
                required=False,
                searchable=True,
                widget=TextAreaWidget(description="", label=u"Plain Text"),
            ),
            StringField(
                "line",
                required=False,
                searchable=True,
                widget=StringWidget(description="", label=u"Text Line"),
            ),
            TextField(
                "unsearchable",
                required=False,
                searchable=False,
                default_output_type="text/x-html-safe",
                widget=RichWidget(description="", label=u"Unsearchable Text"),
            ),
        )
    )
)
Exemple #4
0
from eea.dataservice.interfaces import IDatafile
from plone.app.blob.field import BlobField
from zope.interface import implements

schema = Schema((
    BlobField('file',
              required=False,
              primary=True,
              validators=(('checkFileMaxSize', V_REQUIRED), ),
              widget=FileWidget(
                  description=("Select the file to be added by "
                               "clicking the 'Browse' button."),
                  description_msgid="help_file",
                  label="File",
                  label_msgid="label_file",
                  i18n_domain="plone",
                  show_content_type=False,
              )),
    StringField(name='shortId',
                widget=StringWidget(
                    label="Short ID",
                    visible=-1,
                    description=("Short ID description."),
                    label_msgid='dataservice_label_shortid',
                    description_msgid='dataservice_help_shortid',
                    i18n_domain='eea',
                )),
), )

Datafile_schema = ATFolderSchema.copy() + \
    schema.copy()
Exemple #5
0
schema = BikaFolderSchema.copy() + BikaSchema.copy() + Schema((
    ReferenceField(
        'InstrumentType',
        vocabulary='getInstrumentTypes',
        allowed_types=('InstrumentType', ),
        relationship='InstrumentInstrumentType',
        required=1,
        widget=SelectionWidget(format='select',
                               label=_("Instrument type"),
                               visible={
                                   'view': 'invisible',
                                   'edit': 'visible'
                               }),
    ),
    ReferenceField(
        'Manufacturer',
        vocabulary='getManufacturers',
        allowed_types=('Manufacturer', ),
        relationship='InstrumentManufacturer',
        required=1,
        widget=SelectionWidget(format='select',
                               label=_("Manufacturer"),
                               visible={
                                   'view': 'invisible',
                                   'edit': 'visible'
                               }),
    ),
    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(
            format='select',
            label=_("Method"),
            visible=False,
        ),
    ),
    ReferenceField(
        'Methods',
        vocabulary='_getAvailableMethods',
        allowed_types=('Method', ),
        relationship='InstrumentMethods',
        required=0,
        multiValued=1,
        widget=PicklistWidget(
            size=10,
            label=_("Methods"),
        ),
    ),
    BooleanField(
        'DisposeUntilNextCalibrationTest',
        default=False,
        widget=BooleanWidget(
            label=_("De-activate until next calibration test"),
            description=
            _("If checked, the instrument will be unavailable until the next valid "
              "calibration was performed. This checkbox will automatically be unchecked."
              ),
        ),
    ),

    # Procedures
    TextField(
        'InlabCalibrationProcedure',
        schemata='Procedures',
        default_content_type='text/plain',
        allowed_content_types=('text/plain', ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            label=_("In-lab calibration procedure"),
            description=
            _("Instructions for in-lab regular calibration routines intended for analysts"
              ),
        ),
    ),
    TextField(
        'PreventiveMaintenanceProcedure',
        schemata='Procedures',
        default_content_type='text/plain',
        allowed_content_types=('text/plain', ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            label=_("Preventive maintenance procedure"),
            description=
            _("Instructions for regular preventive and maintenance routines intended for analysts"
              ),
        ),
    ),
    StringField(
        'DataInterface',
        vocabulary="getExportDataInterfacesList",
        widget=SelectionWidget(
            checkbox_bound=0,
            label=_("Data Interface"),
            description=_("Select an Export interface for this instrument."),
            format='select',
            default='',
            visible=True,
        ),
    ),
    StringField(
        'ImportDataInterface',
        vocabulary="getImportDataInterfacesList",
        multiValued=1,
        widget=MultiSelectionWidget(
            checkbox_bound=0,
            label=_("Import Data Interface"),
            description=_("Select an Import interface for this instrument."),
            format='select',
            default='',
            visible=True,
        ),
    ),
    RecordsField(
        'ResultFilesFolder',
        subfields=('InterfaceName', 'Folder'),
        subfield_labels={
            'InterfaceName': _('Interface Code'),
            'Folder': _('Folder that results will be saved')
        },
        subfield_readonly={
            'InterfaceName': True,
            'Folder': False
        },
        widget=RecordsWidget(
            label=_("Result files folders"),
            description=_("For each interface of this instrument, \
                      you can define a folder where \
                      the system should look for the results files while \
                      automatically importing results. Having a folder \
                      for each Instrument and inside that folder creating \
                      different folders for each of its Interfaces \
                      can be a good approach. You can use Interface codes \
                      to be sure that folder names are unique."),
            visible=True,
        ),
    ),
    RecordsField(
        'DataInterfaceOptions',
        type='interfaceoptions',
        subfields=('Key', 'Value'),
        required_subfields=('Key', 'Value'),
        subfield_labels={
            'OptionValue': _('Key'),
            'OptionText': _('Value'),
        },
        widget=RecordsWidget(
            label=_("Data Interface Options"),
            description=
            _("Use this field to pass arbitrary parameters to the export/import modules."
              ),
            visible=False,
        ),
    ),

    # References to all analyses performed with this instrument.
    # Includes regular analyses, QC analyes and Calibration tests.
    UIDReferenceField(
        'Analyses',
        required=0,
        multiValued=1,
        allowed_types=('ReferenceAnalysis', 'DuplicateAnalysis', 'Analysis'),
        widget=ReferenceWidget(visible=False, ),
    ),

    # Private method. Use getLatestReferenceAnalyses() instead.
    # See getLatestReferenceAnalyses() method for further info.
    ReferenceField(
        '_LatestReferenceAnalyses',
        required=0,
        multiValued=1,
        allowed_types=('ReferenceAnalysis'),
        relationship='InstrumentLatestReferenceAnalyses',
        widget=ReferenceWidget(visible=False, ),
    ),
    ComputedField(
        'Valid',
        expression="'1' if context.isValid() else '0'",
        widget=ComputedWidget(visible=False, ),
    ),

    # Needed since InstrumentType is sorted by its own object, not by its name.
    ComputedField(
        'InstrumentTypeName',
        expression=
        'here.getInstrumentType().Title() if here.getInstrumentType() else ""',
        widget=ComputedWidget(
            label=_('Instrument Type'),
            visible=True,
        ),
    ),
    ComputedField(
        'InstrumentLocationName',
        expression=
        'here.getInstrumentLocation().Title() if here.getInstrumentLocation() else ""',
        widget=ComputedWidget(
            label=_("Instrument Location"),
            label_msgid="instrument_location",
            description=_(
                "The room and location where the instrument is installed"),
            description_msgid="help_instrument_location",
            visible=True,
        ),
    ),
    ComputedField(
        'ManufacturerName',
        expression=
        'here.getManufacturer().Title() if here.getManufacturer() else ""',
        widget=ComputedWidget(
            label=_('Manufacturer'),
            visible=True,
        ),
    ),
    ComputedField(
        'SupplierName',
        expression='here.getSupplier().Title() if here.getSupplier() else ""',
        widget=ComputedWidget(
            label=_('Supplier'),
            visible=True,
        ),
    ),
    StringField(
        'AssetNumber',
        widget=StringWidget(
            label=_("Asset Number"),
            description=_("The instrument's ID in the lab's asset register"),
        )),
    ReferenceField(
        'InstrumentLocation',
        schemata='Additional info.',
        vocabulary='getInstrumentLocations',
        allowed_types=('InstrumentLocation', ),
        relationship='InstrumentInstrumentLocation',
        required=0,
        widget=SelectionWidget(
            format='select',
            label=_("Instrument Location"),
            label_msgid="instrument_location",
            description=_(
                "The room and location where the instrument is installed"),
            description_msgid="help_instrument_location",
            visible={
                'view': 'invisible',
                'edit': 'visible'
            })),
    ImageField(
        'Photo',
        schemata='Additional info.',
        widget=ImageWidget(
            label=_("Photo image file"),
            description=_("Photo of the instrument"),
        ),
    ),
    DateTimeField('InstallationDate',
                  schemata='Additional info.',
                  widget=DateTimeWidget(
                      label=_("InstallationDate"),
                      description=_("The date the instrument was installed"),
                  )),
    BlobFileField('InstallationCertificate',
                  schemata='Additional info.',
                  widget=FileWidget(
                      label=_("Installation Certificate"),
                      description=_("Installation certificate upload"),
                  )),
))
Exemple #6
0
schema = Schema(
    (
        StringField(
            name="id",
            widget=StringWidget(
                visible={"edit": "invisible", "view": "invisible"},
                modes=("view",),
                label="Id",
                label_msgid="Poi_label_id",
                i18n_domain="Poi",
            ),
            mode="r",
        ),
        StringField(
            name="title",
            widget=StringWidget(
                label="Subject",
                description="""Enter a brief subject for this response, e.g. "Fixed" or "Will be fixed in next release".""",
                visible={"edit": "invisible", "view": "invisible"},
                modes=("view",),
                label_msgid="Poi_label_response_title",
                description_msgid="Poi_help_response_title",
                i18n_domain="Poi",
            ),
            accessor="Title",
            mode="r",
            searchable=True,
        ),
        TextField(
            name="response",
            allowable_content_types=ISSUE_MIME_TYPES,
            widget=RichWidget(
                label="Response",
                description="Please enter your response below",
                rows=15,
                allow_file_upload=False,
                label_msgid="Poi_label_response",
                description_msgid="Poi_help_response",
                i18n_domain="Poi",
            ),
            required=False,
            default_content_type=DEFAULT_ISSUE_MIME_TYPE,
            searchable=True,
            default_output_type="text/html",
        ),
        FileField(
            name="attachment",
            widget=FileWidget(
                label="Attachment",
                description="You may optionally upload a file attachment. Please do not upload unnecessarily large files.",
                label_msgid="Poi_label_attachment",
                description_msgid="Poi_help_attachment",
                i18n_domain="Poi",
            ),
            storage=AttributeStorage(),
            write_permission=permissions.UploadAttachment,
        ),
        StringField(
            name="issueTransition",
            mutator="setNewIssueState",
            widget=SelectionWidget(
                label="Change issue state",
                description="Select a change of state in the issue this response is for, if applicable",
                format="radio",
                label_msgid="Poi_label_issueTransition",
                description_msgid="Poi_help_issueTransition",
                i18n_domain="Poi",
            ),
            vocabulary="getAvailableIssueTransitions",
            default="",
            enforceVocabulary=False,
            accessor="getIssueTransition",
            write_permission=permissions.ModifyIssueState,
        ),
        StringField(
            name="newSeverity",
            mutator="setNewSeverity",
            widget=SelectionWidget(
                label="Change issue severity",
                description="Select the severity for this issue",
                format="radio",
                label_msgid="Poi_label_newSeverity",
                description_msgid="Poi_help_newSeverity",
                i18n_domain="Poi",
            ),
            vocabulary="getAvailableSeverities",
            default_method="getCurrentIssueSeverity",
            enforceVocabulary=True,
            accessor="getNewSeverity",
            write_permission=permissions.ModifyIssueSeverity,
        ),
        StringField(
            name="newTargetRelease",
            mutator="setNewTargetRelease",
            widget=SelectionWidget(
                label="Change target release",
                description="Set the target release for this issue",
                format="flex",
                condition="object/isUsingReleases",
                label_msgid="Poi_label_newTargetRelease",
                description_msgid="Poi_help_newTargetRelease",
                i18n_domain="Poi",
            ),
            vocabulary="getReleasesVocab",
            default_method="getCurrentTargetRelease",
            enforceVocabulary=True,
            accessor="getNewTargetRelease",
            write_permission=permissions.ModifyIssueTargetRelease,
        ),
        StringField(
            name="newResponsibleManager",
            mutator="setNewResponsibleManager",
            widget=SelectionWidget(
                label="Change responsible manager",
                description="Select the responsible manager for this issue",
                format="flex",
                label_msgid="Poi_label_newResponsibleManager",
                description_msgid="Poi_help_newResponsibleManager",
                i18n_domain="Poi",
            ),
            vocabulary="getManagersVocab",
            default_method="getCurrentResponsibleManager",
            enforceVocabulary=True,
            accessor="getNewResponsibleManager",
            write_permission=permissions.ModifyIssueAssignment,
        ),
    )
)

schema = Schema((

    TextField(
        name='text',
        allowable_content_types=('text/plain', 'text/structured', 'text/html', 'application/msword'),
        widget=RichWidget(
            label='Text',
            label_msgid='GitesContent_label_text',
            i18n_domain='gites',
        ),
        default_output_type='text/html',
        required=1
    ),

    ImageField(
        name='photo',
        widget=ImageWidget(
            label='Photo',
            label_msgid='GitesContent_label_photo',
            i18n_domain='gites',
        ),
        required=1,
        storage=AttributeStorage()
    ),

),
)

##code-section after-local-schema #fill in your manual code here
Exemple #8
0
ATDateCriteriaSchema = ATBaseCriterionSchema + Schema((
    IntegerField(
        'value',
        required=1,
        mode="rw",
        accessor="Value",
        mutator="setValue",
        write_permission=ChangeTopics,
        default=None,
        vocabulary=DateOptions,
        widget=SelectionWidget(
            label=_(u'label_date_criteria_value', default=u'Which day'),
            description=_(u'help_date_criteria_value',
                          default=u'Select the date criteria value.')),
    ),
    StringField(
        'dateRange',
        required=1,
        mode="rw",
        write_permission=ChangeTopics,
        default=None,
        vocabulary=RangeOperations,
        enforceVocabulary=1,
        widget=SelectionWidget(
            label=_(u'label_date_criteria_range',
                    default=u'In the past or future'),
            description=_(u'help_date_criteria_range',
                          default=u"Select the date criteria range. "
                          u"Ignore this if you selected 'Now' above."),
            format="select"),
    ),
    StringField(
        'operation',
        required=1,
        mode="rw",
        default=None,
        write_permission=ChangeTopics,
        vocabulary=CompareOperations,
        enforceVocabulary=1,
        widget=SelectionWidget(
            label=_(u'label_date_criteria_operation', default=u'More or less'),
            description=_(u'help_date_criteria_operation',
                          default=u'Select the date criteria operation.'),
            format="select"),
    ),
))
from Products.Archetypes.atapi import TextField
from Products.CMFCore.utils import ContentInit
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin

PROJECTNAME = 'collective.searchandreplace'

SampleTypeSchema = BaseSchema.copy() + MetadataSchema(()) + Schema((
    TextField('rich',
              required=False,
              searchable=True,
              default_output_type='text/x-html-safe',
              widget=RichWidget(description='', label=u'Rich Text')),
    TextField('plain',
              required=False,
              searchable=True,
              widget=TextAreaWidget(description='', label=u'Plain Text')),
    LinesField('line',
               required=False,
               searchable=True,
               widget=LinesWidget(description='', label=u'Text Line')),
    TextField('unsearchable',
              required=False,
              searchable=False,
              default_output_type='text/x-html-safe',
              widget=RichWidget(description='', label=u'Unsearchable Text')),
))


class SampleType(BaseContent, BrowserDefaultMixin):

    schema = SampleTypeSchema
    portal_type = 'SampleType'
from Products.ATContentTypes.criteria import registerCriterion
from Products.ATContentTypes.criteria import FIELD_INDICES
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.ATContentTypes import ATCTMessageFactory as _

ATBooleanCriterionSchema = ATBaseCriterionSchema + Schema((BooleanField(
    'bool',
    required=1,
    mode="rw",
    write_permission=ChangeTopics,
    default=None,
    widget=BooleanWidget(label=_(u'label_boolean_criteria_bool',
                                 default=u'Value'),
                         description=_(u'help_boolean_criteria_bool',
                                       default=u'True or false')),
), ))


class ATBooleanCriterion(ATBaseCriterion):
    """A boolean criterion"""

    implements(IATTopicSearchCriterion)

    security = ClassSecurityInfo()
    schema = ATBooleanCriterionSchema
    meta_type = 'ATBooleanCriterion'
Exemple #11
0
) + ConstrainTypesMixinSchema + Schema((
    TextField(
        'body',
        searchable=1,
        required=0,
        schemata="Introduction",
        default_content_type='text/html',
        default_output_type='text/html',
        allowable_content_types=(
            'text/plain',
            'text/structured',
            'text/html',
        ),
        widget=RichWidget(
            label=_('label_introduction', default=u"Introduction"),
            description=_('help_introduction',
                          default=u"Enter an introduction for the survey."),
            rows=5,
        ),
    ),
    TextField(
        'thankYouMessage',
        required=0,
        searchable=0,
        default_method="translateThankYouMessage",
        widget=TextAreaWidget(
            label=_("label_thank", default="'Thank you' message text"),
            description=_(
                'help_thankyou',
                default=u"This is the message that will be displayed to "
                u"the user when they complete the survey."),
        ),
    ),
    TextField(
        'savedMessage',
        required=0,
        searchable=0,
        default_method="translateSavedMessage",
        widget=TextAreaWidget(
            label=_('label_saved_text', default="'Saved' message text"),
            description=_(
                'help_saved_text',
                default=u"This is the message that will be displayed to the "
                u"user when they save the survey, "
                u"but don't submit it."),
        ),
    ),
    StringField(
        'exitUrl',
        required=0,
        searchable=0,
        widget=StringWidget(
            label=_("label_exit_url", default=u"Exit URL"),
            description=_(
                "help_exit_url",
                default=u'This is the URL that the user will be directed to '
                u'on completion of the survey.\n'
                u'Use "http://site.to.go.to/page" or "route/to/page" '
                u'for this portal'),
        ),
    ),
    BooleanField(
        'confidential',
        searchable=0,
        required=0,
        widget=BooleanWidget(
            label=_(u"label_confidential", default=u"Confidential"),
            description=_(
                "help_confidential",
                default=u"Prevent respondents usernames from appearing in "
                u"results"),
        ),
    ),
    BooleanField(
        'allowAnonymous',
        searchable=0,
        required=0,
        widget=BooleanWidget(
            label=_('label_allow_anonymous', default=u"Allow Anonymous"),
            description=_(
                'help_allow_anonymous',
                default=u"Anonymous user will be able to fill the survey"),
        ),
    ),
    BooleanField(
        'allowSave',
        searchable=0,
        required=0,
        widget=BooleanWidget(
            label=_("label_allow_save", default=u"Allow Save Functionality"),
            description=_(
                "help_allow_save",
                default=u"Allow logged in users to save survey for finishing "
                u"later."),
        ),
    ),
    StringField(
        'surveyNotificationEmail',
        required=0,
        searchable=0,
        widget=StringWidget(
            label=_("label_survey_notification_email",
                    default=u"Survey Notification Email Address"),
            description=_(
                "help_survey_notification_email",
                default=u"Enter an email address to receive notifications of "
                u"survey completions."),
        ),
    ),
    StringField(
        'surveyNotificationMethod',
        required=0,
        searchable=0,
        vocabulary=NOTIFICATION_METHOD,
        widget=SelectionWidget(
            label=_("label_survey_notification_method",
                    default=u"Survey Notification Method"),
            description=_(
                "help_survey_notification_method",
                default=u"Select a method to receive notification emails."),
        ),
    ),
    StringField(
        'completedFor',
        searchable=0,
        required=0,
        default=[],
        widget=StringWidget(visible=0, ),
    ),
    BooleanField(
        'showCaptcha',
        searchable=0,
        required=0,
        widget=BooleanWidget(label=_("label_show_captcha",
                                     default=u"Show Captcha"), ),
    ),
    TextField(
        'emailInvite',
        searchable=1,
        required=0,
        schemata="Email Invite",
        default_method="_get_emailInvite_default",
        default_content_type='text/html',
        default_output_type='text/html',
        allowable_content_types=(
            'text/plain',
            'text/structured',
            'text/html',
        ),
        widget=RichWidget(
            label=_('label_email_invite', default=u"Email Invite"),
            description=_(
                'help_email_invite',
                default=u"An email invite will be sent to loaded respondents, "
                u"use '**Name**' for the respondents name, "
                u"and '**Survey**' for the title of the survey as "
                u"a link to the survey.",
            )),
    ),
    StringField(
        'inviteFromName',
        schemata="Email Invite",
        required=0,
        searchable=0,
        widget=StringWidget(
            label=_("label_invite_from_name", default=u"Person Invite From"),
            description=_(
                "help_invite_from_name",
                default=u"Enter person's name that the survey invite email is "
                u"from."),
        ),
    ),
    StringField(
        'inviteFromEmail',
        schemata="Email Invite",
        required=0,
        searchable=0,
        widget=StringWidget(
            label=_("label_invite_from_email", default=u"Email Invite From"),
            description=_(
                "help_invite_from_email",
                default=u"Enter person's email address that the survey invite "
                u"email is from."),
        ),
    ),
))
Exemple #12
0
ATPathCriterionSchema = ATBaseCriterionSchema + Schema((
    ReferenceField('value',
                required=1,
                mode="rw",
                write_permission=ChangeTopics,
                accessor="Value",
                mutator="setValue",
                allowed_types_method="getNavTypes",
                multiValued=True,
                relationship="paths",
                widget=ReferenceBrowserWidget(
                    allow_search=1,
                    label=_(u'label_path_criteria_value', default=u'Folders'),
                    description=_(u'help_path_criteria_value',
                                  default=u'Folders to search in.'),
                    base_query={'is_folderish':True},
                    restrict_browse=True,
                    startup_directory='../')
                ),
    BooleanField('recurse',
                mode="rw",
                write_permission=ChangeTopics,
                accessor="Recurse",
                default=False,
                widget=BooleanWidget(
                    label=_(u'label_path_criteria_recurse', default=u'Search Sub-Folders'),
                    description='',
                    ),
                ),
    ))
from Products.Poi import permissions
from Products.Poi.config import PROJECTNAME
from Products.Poi.config import PSC_TRACKER_ID
from Products.Poi.content.PoiTracker import PoiTracker
from Products.Poi.content.PoiTracker import PoiTracker_schema
from Products.Poi.interfaces import ITracker

schema = Schema((

    StringField(
        name='id',
        widget=StringWidget(
            label="Short name",
            description=("Short name for the tracker - should be 'issues' "
                         "to comply with the standards."),
            label_msgid="Poi_label_psctracker_title",
            description_msgid="Poi_description_psctracker_title",
            i18n_domain='Poi',
        ),
        required=False,
        mode="r"
    ),

),
)

PoiPscTracker_schema = PoiTracker_schema.copy() + schema.copy()
PoiPscTracker_schema['title'].required = False
PoiPscTracker_schema['title'].widget.visible = {'edit': 'invisible',
                                                'view': 'visible'}
del PoiPscTracker_schema['availableReleases']
from Products.ATContentTypes.lib.constraintypes \
import ConstrainTypesMixinSchema


schema = Schema((
    ImageField(
        name='categoryimage',
        widget=ImageField._properties['widget'](
            label="Category image",
            description="Image which represents the category",
            label_msgid="classifieds_classifiedscategory_categoryimage",
            description_msgid=\
            "classifieds_classifiedscategory_categoryimage_description",
            i18n_domain='classifieds',
        ),
        storage=AttributeStorage(),
        max_size=(768, 768),
        sizes={'large': (768, 768),
                   'preview': (400, 400),
                   'mini': (200, 200),
                   'thumb': (128, 128),
                   'tile': (64, 64),
                   'icon': (32, 32),
                   'listing': (16, 16),
                  },
    ),
),
)

OrderedClassifiedsCategory_schema = document.ATDocumentSchema.copy()
OrderedClassifiedsCategory_schema += ConstrainTypesMixinSchema
OrderedClassifiedsCategory_schema += schemata.NextPreviousAwareSchema
schema = Schema((
    StringField(
        name='title',
        required_for_published=True,
        widget=StringField._properties['widget'](
            label='Title',
            label_msgid='indicators_label_title',
            i18n_domain='indicators',
        ),
        required=True,
        accessor="Title",
    ),
    TextField(
        name='description',
        required_for_published=True,
        widget=TextAreaWidget(
            label='Description',
            label_msgid='indicators_label_description',
            i18n_domain='indicators',
        ),
        description="True",
        searchable=True,
        required=True,
        accessor="getDescription",
    ),
    BlobField('file',
              required=False,
              primary=True,
              validators=(('isNonEmptyFile', V_REQUIRED),
                          ('checkFileMaxSize', V_REQUIRED)),
              widget=FileWidget(
                  description="Select the file to be added by "
                  "clicking the 'Browse' button.",
                  description_msgid="help_file",
                  label="File",
                  label_msgid="label_file",
                  i18n_domain="plone",
                  show_content_type=False,
              )),
), )
Exemple #16
0
PloneGlossaryDefinitionSchema = ATContentTypeSchema.copy() + Schema((
    StringField(
        'title',
        required=True,
        searchable=True,
        default='',
        accessor='Title',
        widget=StringWidget(
            label=_('label_glossary_term', default="Term"),
            description=_('help_glossary_term',
                          default="Enter the term to be defined."),
            visible={'view': 'invisible'}),
    ),
    LinesField(
        'variants',
        required=False,
        searchable=True,
        default=(),
        widget=LinesWidget(
            label=_('label_glossary_variants', default="Variants"),
            description=_(
                'help_glossary_variants',
                default="Enter the variants of the term, one per line."),
            visible={'view': 'invisible'}),
    ),
    TextField(
        'definition',
        required=True,
        searchable=True,
        default_content_type=zconf.ATDocument.default_content_type,
        default_output_type='text/x-html-safe',
        allowable_content_types=zconf.ATDocument.allowed_content_types,
        widget=RichWidget(
            label=_('label_glossary_definition_text', default="Body text"),
            description=_('help_glossary_definition_text',
                          default="Enter the body text."),
            rows=25),
    ),

))
schema = Schema((
    StringField(name='callForId',
                widget=StringWidget(
                    label='Reference ID',
                    label_msgid='EEAContentTypes_label_callForId',
                    description=_(u'E.g: EEA/NSV/14/004'),
                    i18n_domain='EEAContentTypes',
                ),
                required=1),
    DateTimeField(name='closeDate',
                  widget=CalendarWidget(
                      label='Close date',
                      label_msgid='EEAContentTypes_label_closeDate',
                      i18n_domain='EEAContentTypes',
                  ),
                  required=1),
    DateTimeField(name='openDate',
                  widget=CalendarWidget(
                      label='Open date',
                      label_msgid='EEAContentTypes_label_openDate',
                      i18n_domain='EEAContentTypes',
                  ),
                  required=1),
    DateTimeField(name='applicationDate',
                  widget=CalendarWidget(
                      label='Application date',
                      label_msgid='EEAContentTypes_label_applicationDate',
                      i18n_domain='EEAContentTypes',
                  ),
                  required=1),
), )
Exemple #18
0
schema = BikaFolderSchema.copy() + Schema((
    IntegerField(
        'PasswordLifetime',
        schemata="Security",
        required=1,
        default=0,
        widget=IntegerWidget(
            label=_("Password lifetime"),
            description=
            _("The number of days before a password expires. 0 disables password expiry"
              ),
        )),
    IntegerField(
        'AutoLogOff',
        schemata="Security",
        required=1,
        default=0,
        widget=IntegerWidget(
            label=_("Automatic log-off"),
            description=_(
                "The number of minutes before a user is automatically logged off. "
                "0 disables automatic log-off"),
        )),
    BooleanField(
        'AllowClerksToEditClients',
        schemata="Security",
        default=False,
        widget=BooleanWidget(
            label=_("Allow Lab Clerks to create and edit clients"), )),
    BooleanField(
        'RestrictWorksheetUsersAccess',
        schemata="Security",
        default=True,
        widget=BooleanWidget(
            label=_("Allow access to worksheets only to assigned analysts"),
            description=_(
                "If unchecked, analysts will have access to all worksheets."))
    ),
    BooleanField(
        'RestrictWorksheetManagement',
        schemata="Security",
        default=True,
        widget=BooleanWidget(
            label=_("Only lab managers can create and manage worksheets"),
            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(
        'ShowNewReleasesInfo',
        schemata="Notifications",
        default=True,
        widget=BooleanWidget(
            label=_("Display an alert on new releases of Bika LIMS"), )),
    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',
        )),
    FixedPointField(
        'MemberDiscount',
        schemata="Accounting",
        default='33.33',
        widget=DecimalWidget(
            label=_("Member discount %"),
            description=
            _("The discount percentage entered here, is applied to the prices for clients "
              "flagged as 'members', normally co-operative members or associates deserving "
              "of this discount"),
        )),
    FixedPointField(
        'VAT',
        schemata="Accounting",
        default='14.00',
        widget=DecimalWidget(
            label=_("VAT %"),
            description=_(
                "Enter percentage value eg. 14.0. This percentage is applied system wide "
                "but can be overwrittem on individual items"),
        )),
    StringField('DecimalMark',
                schemata="Results Reports",
                vocabulary=DECIMAL_MARKS,
                default=".",
                widget=SelectionWidget(
                    label=_("Default decimal mark"),
                    description=_("Preferred decimal mark for reports."),
                    format='select',
                )),
    StringField(
        'ScientificNotationReport',
        schemata="Results Reports",
        default='1',
        vocabulary=SCINOTATION_OPTIONS,
        widget=SelectionWidget(
            label=_("Default scientific notation format for reports"),
            description=_("Preferred scientific notation format for reports"),
            format='select',
        )),
    IntegerField(
        'MinimumResults',
        schemata="Results Reports",
        required=1,
        default=5,
        widget=IntegerWidget(
            label=_("Minimum number of results for QC stats calculations"),
            description=_(
                "Using too few data points does not make statistical sense. "
                "Set an acceptable minimum number of results before QC statistics "
                "will be calculated and plotted"),
        )),
    BooleanField(
        'IncludePreviousFromBatch',
        schemata="Results Reports",
        default=False,
        widget=BooleanWidget(
            label=_("Include Previous Results From Batch"),
            description=_(
                "If there are previous results for a service in the "
                "same batch of Analysis Requests, they will be displayed "
                "in the report."))),
    IntegerField(
        'BatchEmail',
        schemata="Results Reports",
        required=1,
        default=5,
        widget=IntegerWidget(
            label=_("Maximum columns per results email"),
            description=
            _("Set the maximum number of analysis requests per results email. "
              "Too many columns per email are difficult to read for some clients "
              "who prefer fewer results per email"),
        )),
    TextField(
        'ResultFooter',
        schemata="Results Reports",
        default_content_type='text/plain',
        allowed_content_types=('text/plain', ),
        default_output_type="text/plain",
        default="",
        widget=TextAreaWidget(
            label=_("Result Footer"),
            description=_("This text will be appended to results reports."),
            append_only=False,
        ),
    ),
    BooleanField(
        'CategoriseAnalysisServices',
        schemata="Analyses",
        default=False,
        widget=BooleanWidget(
            label=_("Categorise analysis services"),
            description=
            _("Group analysis services by category in the LIMS tables, helpful when the list is long"
              )),
    ),
    BooleanField(
        'EnableARSpecs',
        schemata="Analyses",
        default=True,
        widget=BooleanWidget(
            label=_("Enable AR Specifications"),
            description=_(
                "Analysis specifications which are edited directly on the "
                "Analysis Request."),
        ),
    ),
    IntegerField(
        'ExponentialFormatThreshold',
        schemata="Analyses",
        required=1,
        default=7,
        widget=IntegerWidget(
            label=_("Exponential format threshold"),
            description=_(
                "Result values with at least this number of significant "
                "digits are displayed in scientific notation using the "
                "letter 'e' to indicate the exponent.  The precision can be "
                "configured in individual Analysis Services."),
        )),
    BooleanField(
        'EnableAnalysisRemarks',
        schemata="Analyses",
        default=False,
        widget=BooleanWidget(
            label=_("Add a remarks field to all analyses"),
            description=_(
                "If enabled, a free text field will be displayed close to "
                "each analysis in results entry view")),
    ),
    BooleanField(
        'SelfVerificationEnabled',
        schemata="Analyses",
        default=False,
        widget=BooleanWidget(
            label=_("Allow self-verification of results"),
            description=_(
                "If enabled, a user who submitted a result will also be able "
                "to verify it. This setting only take effect for those users "
                "with a role assigned that allows them to verify results "
                "(by default, managers, labmanagers and verifiers)."
                "This setting can be overrided for a given Analysis in "
                "Analysis Service edit view. By default, disabled."),
        ),
    ),
    IntegerField(
        'NumberOfRequiredVerifications',
        schemata="Analyses",
        default=1,
        vocabulary="_getNumberOfRequiredVerificationsVocabulary",
        widget=SelectionWidget(
            format="select",
            label=_("Number of required verifications"),
            description=_(
                "Number of required verifications before a given result being "
                "considered as 'verified'. This setting can be overrided for "
                "any Analysis in Analysis Service edit view. By default, 1"),
        ),
    ),
    StringField(
        'TypeOfmultiVerification',
        schemata="Analyses",
        default='self_multi_enabled',
        vocabulary=MULTI_VERIFICATION_TYPE,
        widget=SelectionWidget(
            label=_("Multi Verification type"),
            description=_(
                "Choose type of multiple verification for the same user."
                "This setting can enable/disable verifying/consecutively verifying"
                "more than once for the same user."),
            format='select',
        )),
    LinesField(
        'ARImportOption',
        schemata="Analyses",
        vocabulary=ARIMPORT_OPTIONS,
        widget=MultiSelectionWidget(
            visible=False,
            label=_("AR Import options"),
            description=
            _("'Classic' indicates importing analysis requests per sample and "
              "analysis service selection. With 'Profiles', analysis profile keywords "
              "are used to select multiple analysis services together"),
        )),
    StringField(
        'ARAttachmentOption',
        schemata="Analyses",
        default='p',
        vocabulary=ATTACHMENT_OPTIONS,
        widget=SelectionWidget(
            format='select',
            label=_("AR Attachment Option"),
            description=_(
                "The system wide default configuration to indicate "
                "whether file attachments are required, permitted or not "
                "per analysis request"),
        )),
    StringField(
        'AnalysisAttachmentOption',
        schemata="Analyses",
        default='p',
        vocabulary=ATTACHMENT_OPTIONS,
        widget=SelectionWidget(
            format='select',
            label=_("Analysis Attachment Option"),
            description=_(
                "Same as the above, but sets the default on analysis services. "
                "This setting can be set per individual analysis on its "
                "own configuration"),
        )),
    StringField('ResultsDecimalMark',
                schemata="Analyses",
                vocabulary=DECIMAL_MARKS,
                default=".",
                widget=SelectionWidget(
                    label=_("Default decimal mark"),
                    description=_("Preferred decimal mark for results"),
                    format='select',
                )),
    StringField(
        'ScientificNotationResults',
        schemata="Analyses",
        default='1',
        vocabulary=SCINOTATION_OPTIONS,
        widget=SelectionWidget(
            label=_("Default scientific notation format for results"),
            description=_("Preferred scientific notation format for results"),
            format='select',
        )),
    IntegerField(
        'AutoImportInterval',
        schemata="Sampling and COC",
        default="0",
        widget=IntegerWidget(
            label=_("Interval of Auto-Importing Files in minutes"),
            description=_("System will upload result files of different \
                          instruments/interfaces periodically in the interval \
                          of this value (Minutes). Any value below 10, will \
                          disable Auto-Importing."))),
    StringField('WorksheetLayout',
                schemata="Appearance",
                default='1',
                vocabulary=WORKSHEET_LAYOUT_OPTIONS,
                widget=SelectionWidget(
                    label=_("Default layout in worksheet view"),
                    description=_(
                        "Preferred layout of the results entry table "
                        "in the Worksheet view. Classic layout displays "
                        "the Analysis Requests in rows and the analyses "
                        "in columns. Transposed layout displays the "
                        "Analysis Requests in columns and the analyses "
                        "in rows."),
                    format='select',
                )),
    BooleanField(
        'DashboardByDefault',
        schemata="Appearance",
        default=True,
        widget=BooleanWidget(
            label=_("Use Dashboard as default front page"),
            description=_(
                "Select this to activate the dashboard as a default front page."
            )),
    ),
    ReferenceField(
        'LandingPage',
        schemata="Appearance",
        multiValued=0,
        allowed_types=('Document', ),
        relationship='SetupLandingPage',
        widget=ReferenceBrowserWidget(
            label=_("Landing Page"),
            description=
            _("The selected landing page is displayed for non-authenticated users "
              "and if the Dashboard is not selected as the default front page. "
              "If no landing page is selected, the default Bika frontpage is displayed."
              ),
            allow_search=1,
            allow_browse=1,
            startup_directory='/',
            force_close_on_insert=1,
            default_search_index='SearchableText',
            base_query={'review_state': 'published'},
        ),
    ),
    BooleanField(
        'PrintingWorkflowEnabled',
        schemata="Sampling and COC",
        default=False,
        widget=BooleanWidget(
            label=_("Enable the Results Report Printing workflow"),
            description=_("Select this to allow the user to set an "
                          "additional 'Printed' status to those Analysis "
                          "Requests tha have been Published. "
                          "Disabled by default.")),
    ),
    BooleanField(
        'SamplingWorkflowEnabled',
        schemata="Sampling and COC",
        default=False,
        widget=BooleanWidget(
            label=_("Enable Sampling"),
            description=_(
                "Select this to activate the sample collection workflow steps."
            )),
    ),
    BooleanField(
        'ScheduleSamplingEnabled',
        schemata="Sampling and COC",
        default=False,
        widget=BooleanWidget(
            label=_("Enable Sampling Scheduling"),
            description=_(
                "Select this to allow a Sampling Coordinator to" +
                " schedule a sampling. This functionality only takes effect" +
                " when 'Sampling workflow' is active")),
    ),
    BooleanField(
        'ShowPartitions',
        schemata="Sampling and COC",
        default=True,
        widget=BooleanWidget(
            label=_("Display individual sample partitions "),
            description=_(
                "Turn this on if you want to work with sample partitions")),
    ),
    BooleanField(
        'SamplePreservationEnabled',
        schemata="Sampling and COC",
        default=False,
        widget=BooleanWidget(label=_("Enable Sample Preservation"),
                             description=_("")),
    ),
    DurationField(
        'DefaultTurnaroundTime',
        schemata="Sampling and COC",
        required=1,
        default={
            "days": 5,
            "hours": 0,
            "minutes": 0
        },
        widget=DurationWidget(
            label=_("Default turnaround time for analyses."),
            description=_(
                "This is the default maximum time allowed for performing "
                "analyses.  It is only used for analyses where the analysis "
                "service does not specify a turnaround time."),
        )),
    DurationField(
        'DefaultSampleLifetime',
        schemata="Sampling and COC",
        required=1,
        default={
            "days": 30,
            "hours": 0,
            "minutes": 0
        },
        widget=DurationWidget(
            label=_("Default sample retention period"),
            description=
            _("The number of days before a sample expires and cannot be analysed "
              "any more. This setting can be overwritten per individual sample type "
              "in the sample types setup"),
        )),
    RecordsField(
        'RejectionReasons',
        schemata="Sampling and COC",
        widget=RejectionSetupWidget(
            label=_("Enable sampling rejection"),
            description=_("Select this to activate the rejection workflow "
                          "for Samples and Analysis Requests. A 'Reject' "
                          "option will be displayed in the actions menu for "
                          "these objects.")),
    ),
    BooleanField(
        'NotifyOnRejection',
        schemata="Notifications",
        default=False,
        widget=BooleanWidget(
            label=_("Sample rejection email notification"),
            description=_("Select this to activate automatic notifications "
                          "via email to the Client when a Sample or Analysis "
                          "Request is rejected.")),
    ),
    BooleanField(
        'NotifyOnARRetract',
        schemata="Notifications",
        default=True,
        widget=BooleanWidget(
            label=_("Email notification on AR invalidation"),
            description=_(
                "Select this to activate automatic notifications "
                "via email to the Client and Lab Managers when an Analysis "
                "Request is invalidated.")),
    ),
    TextField('COCAttestationStatement',
              schemata="Sampling and COC",
              widget=TextAreaWidget(label=_("COC Attestation Statement"), )),
    StringField('COCFooter',
                schemata="Sampling and COC",
                widget=StringWidget(label=_("COC Footer"), )),
    StringField(
        'AutoPrintStickers',
        schemata="Sticker",
        vocabulary=STICKER_AUTO_OPTIONS,
        widget=SelectionWidget(
            format='select',
            label=_("Automatic sticker printing"),
            description=
            _("Select 'Register' if you want stickers to be automatically printed when "
              "new ARs or sample records are created. Select 'Receive' to print stickers "
              "when ARs or Samples are received. Select 'None' to disable automatic printing"
              ),
        )),
    StringField(
        'AutoStickerTemplate',
        schemata="Sticker",
        vocabulary="getStickerTemplates",
        widget=SelectionWidget(
            format='select',
            label=_("Sticker templates"),
            description=
            _("Select which sticker to print when automatic sticker printing is enabled"
              ),
        )),
    StringField(
        'SmallStickerTemplate',
        schemata="Sticker",
        vocabulary="getStickerTemplates",
        default="Code_128_1x48mm.pt",
        widget=SelectionWidget(
            format='select',
            label=_("Small sticker"),
            description=
            _("Select which sticker should be used as the 'small' sticker by default"
              ))),
    StringField(
        'LargeStickerTemplate',
        schemata="Sticker",
        vocabulary="getStickerTemplates",
        default="Code_128_1x72mm.pt",
        widget=SelectionWidget(
            format='select',
            label=_("Large sticker"),
            description=
            _("Select which sticker should be used as the 'large' sticker by default"
              ))),
    IntegerField(
        'DefaultNumberOfCopies',
        schemata="Sticker",
        required="1",
        default="1",
        widget=IntegerWidget(
            label=_("Number of copies"),
            description=
            _("Set the default number of copies to be printed for each sticker"
              ))),
    IDFormattingField(
        'IDFormatting',
        schemata="ID Server",
        default=[{
            'form': 'AI-{seq:03d}',
            'portal_type': 'ARImport',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'form': 'B-{seq:03d}',
            'portal_type': 'Batch',
            'prefix': 'batch',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'form': 'D-{seq:03d}',
            'portal_type': 'DuplicateAnalysis',
            'prefix': 'duplicate',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'form': 'I-{seq:03d}',
            'portal_type': 'Invoice',
            'prefix': 'invoice',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'form': 'QC-{seq:03d}',
            'portal_type': 'ReferenceSample',
            'prefix': 'refsample',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'form': 'SA-{seq:03d}',
            'portal_type': 'ReferenceAnalysis',
            'prefix': 'refanalysis',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'form': 'WS-{seq:03d}',
            'portal_type': 'Worksheet',
            'prefix': 'worksheet',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'form': '{sampleType}-{seq:04d}',
            'portal_type': 'Sample',
            'prefix': 'sample',
            'sequence_type': 'generated',
            'split_length': 1
        }, {
            'context': 'sample',
            'counter_reference': 'AnalysisRequestSample',
            'counter_type': 'backreference',
            'form': '{sampleId}-R{seq:02d}',
            'portal_type': 'AnalysisRequest',
            'sequence_type': 'counter'
        }, {
            'context': 'sample',
            'counter_reference': 'SamplePartition',
            'counter_type': 'contained',
            'form': '{sampleId}-P{seq:d}',
            'portal_type': 'SamplePartition',
            'sequence_type': 'counter'
        }],
        widget=RecordsWidget(
            label=_("Formatting Configuration"),
            allowDelete=True,
            description=_(
                " <p>The Bika LIMS ID Server provides unique sequential IDs "
                "for objects such as Samples and Worksheets etc, based on a "
                "format specified for each content type.</p>"
                "<p>The format is constructed similarly to the Python format"
                " syntax, using predefined variables per content type, and"
                " advancing the IDs through a sequence number, 'seq' and its"
                " padding as a number of digits, e.g. '03d' for a sequence of"
                " IDs from 001 to 999.</p>"
                "<p>Alphanumeric prefixes for IDs are included as is in the"
                " formats, e.g. WS for Worksheet in WS-{seq:03d} produces"
                " sequential Worksheet IDs: WS-001, WS-002, WS-003 etc.</p>"
                "<p>For dynamic generation of alphanumeric and sequential IDs,"
                " the wildcard {alpha} can be used. E.g WS-{alpha:2a3d}"
                " produces WS-AA001, WS-AA002, WS-AB034, etc.</p>"
                "<p>Variables that can be used include:"
                "<table>"
                "<tr>"
                "<th style='width:150px'>Content Type</th><th>Variables</th>"
                "</tr>"
                "<tr><td>Client</td><td>{client}</td></tr>"
                "<tr><td>Year</td><td>{year}</td></tr>"
                "<tr><td>Sample ID</td><td>{sampleId}</td></tr>"
                "<tr><td>Sample Type</td><td>{sampleType}</td></tr>"
                "<tr><td>Sampling Date</td><td>{samplingDate}</td></tr>"
                "<tr><td>Date Sampled</td><td>{dateSampled}</td></tr>"
                "</table>"
                "</p>"
                "<p>Configuration Settings:"
                "<ul>"
                "<li>format:"
                "<ul><li>a python format string constructed from predefined"
                " variables like sampleId, client, sampleType.</li>"
                "<li>special variable 'seq' must be positioned last in the"
                "format string</li></ul></li>"
                "<li>sequence type: [generated|counter]</li>"
                "<li>context: if type counter, provides context the counting"
                " function</li>"
                "<li>counter type: [backreference|contained]</li>"
                "<li>counter reference: a parameter to the counting"
                " function</li>"
                "<li>prefix: default prefix if none provided in format"
                " string</li>"
                "<li>split length: the number of parts to be included in the"
                " prefix</li>"
                "</ul></p>"))),
    BooleanField(
        'ExternalIDServer',
        schemata="ID Server",
        default=False,
        widget=BooleanWidget(
            label=_("Use external ID server"),
            description=_(
                "Check this if you want to use a separate ID server. "
                "Prefixes are configurable separately in each Bika site")),
    ),
    StringField(
        'IDServerURL',
        schemata="ID Server",
        widget=StringWidget(
            label=_("ID Server URL"),
            description=_("The full URL: http://URL/path:port")),
    ),
    StringField(
        'IDServerValues',
        schemata="ID Server",
        accessor="getIDServerValuesHTML",
        readonly=True,
        widget=TextAreaWidget(
            label=_("ID Server Values"),
            cols=30,
            rows=30,
        ),
    ),
    RecordsField(
        'RejectionReasons',
        schemata="Analyses",
        widget=RejectionSetupWidget(
            label=_("Enable the rejection workflow"),
            description=_("Select this to activate the rejection workflow "
                          "for Samples and Analysis Requests. A 'Reject' "
                          "option will be displayed in the actions menu for "
                          "these objects.")),
    ),
    BooleanField(
        'NotifyOnRejection',
        schemata="Analyses",
        default=False,
        widget=BooleanWidget(
            label=_("Email notification on rejection"),
            description=_("Select this to activate automatic notifications "
                          "via email to the Client when a Sample or Analysis "
                          "Request is rejected.")),
    ),
    BooleanField('AllowDepartmentFiltering',
                 schemata="Security",
                 default=False,
                 widget=BooleanWidget(
                     label=_("Enable filtering by department"),
                     description=_(
                         "When enabled, only those items belonging to the "
                         "same department as the logged user will be "
                         "displayed. Since a user can belong to more than "
                         "one department, a department filtering portlet "
                         "will be displayed too. By default, disabled."))),
    BooleanField(
        'DisplayAdvancedFilterBarForAnalysisRequests',
        schemata="Analyses",
        default=False,
        widget=BooleanWidget(
            label=_(
                "Display an advanced filter bar in Analysis Requests lists"),
            description=_(
                "If enabled, the Analysis Requests Lists will"
                " display an additional filter bar which allows the user "
                "to filter the listed items by some several criteria."
                "Warning: This may affect the listing performance."),
        ),
    ),
    BooleanField(
        'DisplayAdvancedFilterBarForSamples',
        schemata="Analyses",
        default=False,
        widget=BooleanWidget(
            label=_("Display an advanced filter bar in Samples lists"),
            description=_(
                "If enabled, the Samples Lists will"
                " display an additional filter bar which allows the user "
                "to filter the listed items by some several criteria."
                "Warning: This may affect the listing performance."),
        ),
    ),
    BooleanField(
        'DisplayAdvancedFilterBarForAnalyses',
        schemata="Analyses",
        default=False,
        widget=BooleanWidget(
            label=_("Display an advanced filter bar in Analyses lists"),
            description=_(
                "If enabled, the Analyses Lists will"
                " display an additional filter bar which allows the user "
                "to filter the listed items by some several criteria."
                "Warning: This may affect the listing performance."),
        ),
    ),
    IntegerField(
        'DefaultNumberOfARsToAdd',
        schemata="Analyses",
        required=0,
        default=4,
        widget=IntegerWidget(
            label=_("Default count of AR to add."),
            description=
            _("Default value of the 'AR count' when users click 'ADD' button to create new Analysis Requests"
              ),
        )),
    TextField('COCAttestationStatement',
              schemata="Analyses",
              widget=TextAreaWidget(label=_("COC Attestation Statement"), )),
    StringField('COCFooter',
                schemata="Analyses",
                widget=StringWidget(label=_("COC Footer"), )),
))
Exemple #19
0
SCHEMA = Schema((
    DavizReferenceField('relatedItems',
        schemata="data input",
        relationship='relatesTo',
        multiValued=True,
        widget=EEAReferenceBrowserWidget(
            label=_("Find and reuse existing data"),
            description=_(u"Look for compatible datasets in catalogue"
                " (e.g. visualization data, .tsv, .csv, SPARQL, etc)"
            ),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )),
    StringField('quickUpload',
        schemata='data input',
        widget=QuickUploadWidget(
            label=_('Upload CSV/TSV data files from your computer'),
            description=_(u"upload-csv-description", default=(
                "Drag and drop '.tsv, .csv files' in the area below, see "
                '<a target="_blank" href="http://www.eea.europa.eu/'
                'data-and-maps/daviz/learn-more/examples">data examples</a> '
                'or read '
                '<a target="_blank" href="http://www.eea.europa.eu/'
                'data-and-maps/daviz/learn-more/prepare-data">'
                'how to prepare data</a> '
                #temporarily hide the link to tutorials
                '<div style="display:none">'
                'or watch the '
                '<a target="_blank" href="daviz-tutorials.html#create">'
                '<span class="eea-icon eea-icon-youtube-square"></span>'
                'video tutorials</a>'
                '</div>'
              )
            ),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    DavizStringField('spreadsheet',
        schemata='data input',
        validators=('csvfile',),
        widget=TextAreaWidget(
            label=_('Copy and paste a data table from a file/webpage'),
            description=_(u"copy-paste-description", default=(
                "<div style='float:left'>Check these "
                '<a target="_blank" href="http://www.eea.europa.eu/'
                'data-and-maps/daviz/learn-more/examples">data examples</a> '
                'or read '
                '<a target="_blank" href="http://www.eea.europa.eu/'
                'data-and-maps/daviz/learn-more/prepare-data">'
                'how to prepare data</a> '
                'or '
                '</div>'
                '<span class="eea-tutorial" tutorial="create"></span>'
                "<div style='clear:both'></div>"
              )
            ),
        i18n_domain="eea",
        helper_js=(
            '++resource++eea.daviz.common.js',
            '++resource++eea.daviz.spreadsheet.js',),
        helper_css=(
            '++resource++eea.daviz.common.css',
            '++resource++eea.daviz.spreadsheet.css',),
        visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    DavizUrlField('external',
        schemata="data input",
        validators=('externalURL',),
        widget=StringWidget(
            label=_(u"Add data from URL"),
            description=_(u"Add a data URL which returns CSV/TSV, "
                          "standard JSON, Exhibit JSON or Google Spreadsheet")
        ),
        i18n_domain="eea",
        visible={'edit': 'visible', 'view': 'invisible'}
    ),
    StringField('dataWarning',
        schemata='data input',
        widget=LabelWidget(
            label=_('Warning'),
            description=_(u"<b>Changing data sources may break existing "
                    "visualizations.</b><br/>"
                    "If you want to upload new data you "
                    "must make sure that the data columns are exactly the same "
                    "and in the same order, otherwise the existing charts will "
                    "break. Changing settings here requires data knowledge "
                    "skills. <br/>"
                    "If you want to know more contact your web admin."
            ),
            i18n_domain="eea",
            helper_js=('++resource++eea.daviz.warnings.js',),
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    DavizDataField('dataTitle', alias="title",
        schemata='default',
        widget=StringWidget(
            label=_("Data source title"),
            description=_("Specify data source"),
            i18n_domain="eea",
            visible={'edit': 'invisible', 'view': 'invisible'}
        ),
    ),
    DavizDataField('dataLink', alias="link",
        schemata='default',
        widget=StringWidget(
            label=_("Data source link"),
            description=_("Specify data source link"),
            i18n_domain="eea",
            visible={'edit': 'invisible', 'view': 'invisible'}
        )
    ),
    DavizDataField('dataOwner', alias="owner",
        schemata='default',
        vocabulary_factory=OrganisationsVocabulary,
        widget=OrganisationsWidget(
            label=_("Data source Organisation"),
            description=_("Specify data source Organisation"),
            i18n_domain="eea",
            visible={'edit': 'invisible', 'view': 'invisible'}
        )
    ),

))
schema = Schema((

    TextField(
        'directions',
        allowable_content_types = config.ALLOWED_CONTENT_TYPES, 
        default_content_type = config.DEFAULT_CONTENT_TYPE, 
        default_output_type = config.DEFAULT_OUTPUT_TYPE,
        widget = RichWidget(
            label = 'Directions',
            label_msgid = 'label_directions',
            description = 'Instructions/directions that all assignment boxes in this folder refer to',
            description_msgid = 'help_directions',
            i18n_domain = config.I18N_DOMAIN,
            allow_file_upload = False,
            rows = 8,
        ),
    ),

    LinesField(
        'completedStates',
        searchable = False,
        vocabulary = 'getCompletedStatesVocab',
        multiValued = True,
        widget = MultiSelectionWidget(
            label = "Completed States",
            label_msgid = "label_completed_states",
            description = "States considered as completed",
            description_msgid = "help_completed_states",
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    IntegerField(
        'projectedAssignments',
        searchable = False,
        required = True,
        default = 0,
        validators = ('isInt', validators.POSITIVE_NUMBER_VALIDATOR_NAME),
        widget = IntegerWidget(
            label = "Projected Number of Assignments",
            label_msgid = "label_projected_assignments",
            description = "Projected number of assignments, 0 means undefined",
            description_msgid = "help_projected_assignments",
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

),
)
DefaultSchema = Schema((
    FloatField(
        name='budgetHours',
        write_permission="eXtremeManagement: Edit budgetHours",
        validators=('isDecimal', ),
        widget=DecimalWidget(
            description="Enter the budget of the project in hours.",
            label='Budget (hours)',
            label_msgid='label_budgetHours',
            description_msgid='help_budgetHours',
            i18n_domain='eXtremeManagement'),
    ),
    BooleanField('includeGlobalMembers',
                 default=True,
                 languageIndependent=True,
                 widget=BooleanWidget(
                     description="If selected, Members with a global role 'Employee' "
                     " will appear in the assignees list of a Task.",
                     description_msgid="help_include_global_members",
                     label="Include global Employees",
                     label_msgid="label_include_global_members",
                     i18n_domain="eXtremeManagement"),
                 ),
    BooleanField(
        name='billableProject',
        default="True",
        widget=BooleanWidget(
            label='Billable',
            label_msgid='eXtremeManagement_label_billable',
            i18n_domain='eXtremeManagement')
    ),
), )
Exemple #22
0
ATTopicSchema = ATContentTypeSchema.copy() + Schema((
    TextField(
        'text',
        required=False,
        searchable=True,
        primary=True,
        storage=AnnotationStorage(migrate=True),
        validators=('isTidyHtmlWithCleanup', ),
        #validators = ('isTidyHtml',),
        default_output_type='text/x-html-safe',
        widget=RichWidget(
            description='',
            label=_(u'label_body_text', default=u'Body Text'),
            rows=25,
            allow_file_upload=zconf.ATDocument.allow_document_upload),
    ),
    BooleanField(
        'acquireCriteria',
        required=False,
        mode="rw",
        default=False,
        write_permission=ChangeTopics,
        widget=BooleanWidget(
            label=_(u'label_inherit_criteria', default=u'Inherit Criteria'),
            description=_(
                u'help_inherit_collection_criteria',
                default=
                u"Narrow down the search results from the parent Collection(s) "
                "by using the criteria from this Collection."),
            # Only show when the parent object is a Topic also,
            condition="python:object.aq_parent.portal_type == 'Topic'"),
    ),
    BooleanField(
        'limitNumber',
        required=False,
        mode="rw",
        default=False,
        write_permission=ChangeTopics,
        widget=BooleanWidget(
            label=_(u'label_limit_number', default=u'Limit Search Results'),
            description=_(u'help_limit_number',
                          default=u"If selected, only the 'Number of Items' "
                          "indicated below will be displayed.")),
    ),
    IntegerField(
        'itemCount',
        required=False,
        mode="rw",
        default=0,
        write_permission=ChangeTopics,
        widget=IntegerWidget(label=_(u'label_item_count',
                                     default=u'Number of Items'),
                             description=''),
    ),
    BooleanField(
        'customView',
        required=False,
        mode="rw",
        default=False,
        write_permission=ChangeTopics,
        widget=BooleanWidget(
            label=_(u'label_custom_view', default=u'Display as Table'),
            description=_(u'help_custom_view',
                          default=u"Columns in the table are controlled "
                          "by 'Table Columns' below.")),
    ),
    LinesField(
        'customViewFields',
        required=False,
        mode="rw",
        default=('Title', ),
        vocabulary='listMetaDataFields',
        enforceVocabulary=True,
        write_permission=ChangeTopics,
        widget=InAndOutWidget(
            label=_(u'label_custom_view_fields', default=u'Table Columns'),
            description=_(u'help_custom_view_fields',
                          default=u"Select which fields to display when "
                          "'Display as Table' is checked.")),
    ),
))
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 IATLink

from Products.ATContentTypes import ATCTMessageFactory as _

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)


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

    schema = ATLinkSchema

    portal_type = 'Link'
Exemple #24
0
schema = Schema((

    StringField(
        name='feedItemAuthor',
        widget=StringWidget(
            label=_('feedfeeder_label_feedItemAuthor', default='Feeditemauthor'),
        )
    ),

    DateTimeField(
        name='feedItemUpdated',
        default=DateTime('2000/01/01'),
        widget=CalendarWidget(
            label=_('feedfeeder_label_feedItemUpdated', 'Feeditemupdated'),
        )
    ),

    copied_fields['text'],
    StringField(
        name='link',
        widget=StringWidget(
            label=_('feedfeeder_label_link', default='Link'),
        )
    ),

    ComputedField(
        name='objectids',
        widget=ComputedWidget(
            label=_('feedfeeder_label_objectids', default='Object Ids'),
        )
    ),

    ComputedField(
        name='hasBody',
        widget=ComputedWidget(
            label=_('feedfeeder_label_hasbody', default='Has body text'),
        )
    ),

    StringField(
        name='feedTitle',
        widget=StringWidget(
            label=_('feedfeeder_label_feedTitle', default='Feed Title'),
        )
    ),
    ObjectField(
        name='objectInfo',
#        read_permission=ManagePortal,
#        write_permission=ManagePortal,
        widget=StringWidget(
            visible={'view': 'invisible',
                     'edit': 'invisible'},
        ),
        default={},
    ),

),
)
Exemple #25
0
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
    BooleanField('Internal',
                 default=False,
                 widget=BooleanWidget(
                     label=_("Internal Certificate"),
                     description=_(
                         "Select if is an in-house calibration certificate"))),
    StringField(
        'Agency',
        widget=StringWidget(
            label=_("Agency"),
            description=
            _("Organization responsible of granting the calibration certificate"
              )),
    ),
    DateTimeField(
        'Date',
        widget=DateTimeWidget(
            label=_("Date"),
            description=_("Date when the calibration certificate was granted"),
        ),
    ),
    StringField(
        'ExpirationInterval',
        vocabulary="getInterval",
        widget=ComboBoxWidget(
            label=_("Interval"),
            description=_("The interval is calculated from the 'From' field "
                          "and defines when the certificate expires in days. "
                          "Setting this inverval overwrites the 'To' field "
                          "on save."),
            default="",
            # configures the HTML input attributes for the additional field
            field_config={
                "type": "number",
                "step": "1",
                "max": "99999"
            },
            field_regex="\d+")),
    DateTimeField(
        'ValidFrom',
        with_time=1,
        with_date=1,
        required=1,
        widget=DateTimeWidget(
            label=_("From"),
            description=_(
                "Date from which the calibration certificate is valid"),
        ),
    ),
    DateTimeField(
        'ValidTo',
        with_time=1,
        with_date=1,
        required=1,
        widget=DateTimeWidget(
            label=_("To"),
            description=_("Date until the certificate is valid"),
        ),
    ),
    ReferenceField(
        'Preparator',
        vocabulary='getLabContacts',
        allowed_types=('LabContact', ),
        relationship='LabContactInstrumentCertificatePreparator',
        widget=ReferenceWidget(
            checkbox_bound=0,
            label=_("Prepared by"),
            description=_(
                "The person at the supplier who prepared the certificate"),
            size=30,
            base_query={'is_active': True},
            showOn=True,
            colModel=[{
                'columnName': 'UID',
                'hidden': True
            }, {
                'columnName': 'JobTitle',
                'width': '20',
                'label': _('Job Title')
            }, {
                'columnName': 'Title',
                'width': '80',
                'label': _('Name')
            }],
        ),
    ),
    ReferenceField(
        'Validator',
        vocabulary='getLabContacts',
        allowed_types=('LabContact', ),
        relationship='LabContactInstrumentCertificateValidator',
        widget=ReferenceWidget(
            checkbox_bound=0,
            label=_("Approved by"),
            description=_(
                "The person at the supplier who approved the certificate"),
            size=30,
            base_query={'is_active': True},
            showOn=True,
            colModel=[{
                'columnName': 'UID',
                'hidden': True
            }, {
                'columnName': 'JobTitle',
                'width': '20',
                'label': _('Job Title')
            }, {
                'columnName': 'Title',
                'width': '80',
                'label': _('Name')
            }],
        ),
    ),
    BlobFileField('Document',
                  widget=FileWidget(
                      label=_("Report upload"),
                      description=_("Load the certificate document here"),
                  )),
    RemarksField(
        'Remarks',
        searchable=True,
        widget=RemarksWidget(label=_("Remarks"), ),
    ),
))
Exemple #26
0
schema = BikaSchema.copy() + Schema((
    InterimFieldsField(
        'InterimFields',
        widget=BikaRecordsWidget(
            label=_("Calculation Interim Fields"),
            description=_(
                "Define interim fields such as vessel mass, dilution factors, "
                "should your calculation require them. The field title "
                "specified here will be used as column headers and field "
                "descriptors where the interim fields are displayed. If "
                "'Apply wide' is enabled the field will be shown in a "
                "selection box on the top of the worksheet, allowing to apply "
                "a specific value to all the corresponding fields on the "
                "sheet."),
        )),
    UIDReferenceField(
        'DependentServices',
        required=1,
        multiValued=1,
        allowed_types=('AnalysisService', ),
        widget=ReferenceWidget(
            checkbox_bound=0,
            visible=False,
            label=_("Dependent Analyses"),
        ),
    ),
    RecordsField(
        'PythonImports',
        required=False,
        subfields=('module', 'function'),
        subfield_labels={
            'module': _('Module'),
            'function': _('Function')
        },
        subfield_readonly={
            'module': False,
            'function': False
        },
        subfield_types={
            'module': 'string',
            'function': 'string'
        },
        default=[
            {
                'module': 'math',
                'function': 'ceil'
            },
            {
                'module': 'math',
                'function': 'floor'
            },
        ],
        subfield_validators={
            'module': 'importvalidator',
        },
        widget=BikaRecordsWidget(
            label=_("Additional Python Libraries"),
            description=_(
                "If your formula needs a special function from an external "
                "Python library, you can import it here. E.g. if you want to "
                "use the 'floor' function from the Python 'math' module, "
                "you add 'math' to the Module field and 'floor' to the "
                "function field. The equivalent in Python would be 'from math "
                "import floor'. In your calculation you could use then "
                "'floor([Ca] + [Mg])'. "),
            allowDelete=True,
        ),
    ),
    TextField(
        'Formula',
        required=True,
        validators=('formulavalidator', ),
        default_content_type='text/plain',
        allowable_content_types=('text/plain', ),
        widget=TextAreaWidget(
            label=_("Calculation Formula"),
            description=_(
                "<p>The formula you type here will be dynamically calculated "
                "when an analysis using this calculation is displayed.</p>"
                "<p>To enter a Calculation, use standard maths operators,  "
                "+ - * / ( ), and all keywords available, both from other "
                "Analysis Services and the Interim Fields specified here, "
                "as variables. Enclose them in square brackets [ ].</p>"
                "<p>E.g, the calculation for Total Hardness, the total of "
                "Calcium (ppm) and Magnesium (ppm) ions in water, is entered "
                "as [Ca] + [Mg], where Ca and MG are the keywords for those "
                "two Analysis Services.</p>"),
        )),
    RecordsField(
        'TestParameters',
        required=False,
        subfields=('keyword', 'value'),
        subfield_labels={
            'keyword': _('Keyword'),
            'value': _('Value')
        },
        subfield_readonly={
            'keyword': True,
            'value': False
        },
        subfield_types={
            'keyword': 'string',
            'value': 'float'
        },
        default=[{
            'keyword': '',
            'value': 0
        }],
        widget=BikaRecordsWidget(
            label=_("Test Parameters"),
            description=_("To test the calculation, enter values here for all "
                          "calculation parameters.  This includes Interim "
                          "fields defined above, as well as any services that "
                          "this calculation depends on to calculate results."),
            allowDelete=False,
        ),
    ),
    TextField('TestResult',
              default_content_type='text/plain',
              allowable_content_types=('text/plain', ),
              widget=TextAreaWidget(
                  label=_('Test Result'),
                  description=_(
                      "The result after the calculation has taken place "
                      "with test values.  You will need to save the "
                      "calculation before this value will be calculated."),
              )),
))
Exemple #27
0
    MaxSizeValidator('checkImageMaxSize', maxsize=zconf.ATImage.max_file_size))

ATImageSchema = ATContentTypeSchema.copy() + Schema(
    (ImageField(
        'image',
        required=True,
        primary=True,
        languageIndependent=True,
        storage=AnnotationStorage(migrate=True),
        swallowResizeExceptions=zconf.swallowImageResizeExceptions.enable,
        pil_quality=zconf.pil_config.quality,
        pil_resize_algo=zconf.pil_config.resize_algo,
        max_size=zconf.ATImage.max_image_dimension,
        sizes={
            'large': (768, 768),
            'preview': (400, 400),
            'mini': (200, 200),
            'thumb': (128, 128),
            'tile': (64, 64),
            'icon': (32, 32),
            'listing': (16, 16),
        },
        validators=(('isNonEmptyFile', V_REQUIRED),
                    ('checkImageMaxSize', V_REQUIRED)),
        widget=ImageWidget(
            description='',
            label=_(u'label_image', default=u'Image'),
            show_content_type=False,
        )), ),
    marshall=PrimaryFieldMarshaller())

# Title is pulled from the file name if we don't specify anything,
Exemple #28
0
from Products.urban.content.licence.GenericLicence import GenericLicence
from Products.urban.content.licence.Inspection import Inspection
from Products.urban.content.licence.IntegratedLicence import IntegratedLicence
from Products.urban.content.licence.MiscDemand import MiscDemand
from Products.urban.content.licence.ParcelOutLicence import ParcelOutLicence
from Products.urban.content.licence.PatrimonyCertificate import PatrimonyCertificate
from Products.urban.content.licence.RoadDecree import RoadDecree
from Products.urban.content.licence.Ticket import Ticket
from Products.urban.content.licence.UniqueLicence import UniqueLicence
from Products.urban.content.licence.UrbanCertificateBase import UrbanCertificateBase
from Products.urban.content.licence.UrbanCertificateTwo import UrbanCertificateTwo

from zope.i18n import translate
from zope.component import queryAdapter

specificSchema = Schema((), )


def update_item_schema(baseSchema):

    LicenceSchema = baseSchema + specificSchema.copy()

    # some fields are edit only
    LicenceSchema['missingPartsDetails'].widget.visible = {
        'edit': 'visible',
        'view': 'invisible'
    }
    LicenceSchema['protectedBuildingDetails'].widget.visible = {
        'edit': 'visible',
        'view': 'invisible'
    }
Exemple #29
0
schema = Schema((

    StringField('courseType',
        required = False,
        widget = StringWidget(
            label = "Course type",
            description = "Enter the type of this course (e.g., Lecture or Lab Exercise)",
            label_msgid = 'label_course_type',
            description_msgid = 'help_course_type',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    LinesField('instructors',
        required = True,
        languageIndependent = True,
        searchable = True,
        widget = LinesWidget(
            label = "Instructors",
            description = "User names or names of instructors, one per line",
            label_msgid = 'label_instructors',
            description_msgid = 'help_instructors',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    TimePeriodField('timePeriod',
        accessor = 'getTimePeriod',
        edit_accessor = 'getTimePeriodForEdit',
        required = True,
        default = ['11:00', '13:00'],
        widget = StringWidget(
            macro = 'time_period',
            size = 5,
            maxlength = 5,
            label = "Time period",
            description = "Start and end times of this course",
            label_msgid = 'label_time_period',
            description_msgid = 'help_time_period',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    DateTimeField('startDate',
        required = True,
        widget = CalendarWidget(
            label = "Start date",
            description = "First regular date",
            label_msgid = 'label_start_date',
            description_msgid = 'help_start_date',
            show_hm = False, 
            #show_ymd = True,
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),
    
    DateTimeField('endDate',
        required = True,
        widget = CalendarWidget(
            label = "End date",
            description = "Last regular date",
            label_msgid = 'label_end_date',
            description_msgid = 'help_end_date',
            show_hm = False, 
            #show_ymd = True,
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),
                                                   
    StringField('recurrence',
        required = True,
        vocabulary = 'getRecurrenceDisplayList',
        default = WEEKLY,
        widget = SelectionWidget(
            format = "radio", # possible values: flex, select, radio
            label = "Recurrence",
            description = "How often this course takes place",
            label_msgid = 'label_recurrence',
            description_msgid = 'help_recurrence',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),
                                                   
    DateTimeField('firstSession',
        widget = CalendarWidget(
            label = "First session",
            description = "Date for the first session for this course",
            label_msgid = 'label_first_session',
            description_msgid = 'help_first_session',
            #show_hm = False, 
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    StringField('location',
        required = True,
        widget = StringWidget(
            label = "Location",
            description = "Location for this course",
            label_msgid = 'label_location',
            description_msgid = 'help_location',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    StringField('courseLanguage',
        vocabulary = 'getLanguagesDL',
        widget = SelectionWidget(
            label = 'Language of instruction',
            description = 'The language used for teaching this course',
            label_msgid = 'label_course_language',
            description_msgid = 'help_course_language',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    StringField('credits',
        required = False,
        widget = StringWidget(
            label = "Credits",
            description = "Credits which can be gained in this course",
            label_msgid = 'label_credits',
            description_msgid = 'help_credits',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    TextField('prereq',
        required = False,
        default_content_type = config.DEFAULT_CONTENT_TYPE,
        default_output_type = config.DEFAULT_OUTPUT_TYPE,
        allowable_content_types = config.ALLOWED_CONTENT_TYPES,
        widget = TextAreaWidget(
            label = "Prerequisites",
            description = "Describe which prerequisites are required for this course",
            label_msgid = 'label_prereq',
            description_msgid = 'help_prereq',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    TextField('target',
        required = False,
        default_content_type = config.DEFAULT_CONTENT_TYPE,
        default_output_type = config.DEFAULT_OUTPUT_TYPE,
        allowable_content_types = config.ALLOWED_CONTENT_TYPES,
        widget = TextAreaWidget(
            label = "Target group",
            description = "Describe for which audience this course is intended",
            label_msgid = 'label_target',
            description_msgid = 'help_target',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    IntegerField('maxParticipants',
        required = False,
        widget = StringWidget(
            label = "Maximum number of participants",
            size = 4,
            description = "If there is an enrollment limit, specify the maximum number of participants",
            label_msgid = 'label_max_participants',
            description_msgid = 'help_max_participants',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    StringField('joinURL',
        required = False,
        widget = StringWidget(
            label = "Registration link",
            description = "Link to the registration for this course. Use 'ecl_register' to let ECLecture handle enrollments for this course.",
            label_msgid = 'label_join_url',
            description_msgid = 'help_join_url',
            size = 65,
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    StringField('directoryEntry',
        required = False,
        widget = StringWidget(
            label = "Directory entry",
            description = "Link to the directory entry for this course.",
            label_msgid = 'label_directory_entry',
            description_msgid = 'help_directory_entry',
            size = 65,
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    StringField('associatedGroup',
        required = False,
        vocabulary = 'getGroupsDisplayList',
        default = NO_GROUP,
        widget = SelectionWidget(
            format = "select", # possible values: flex, select, radio
            label = "Associated group",
            description = """You can associate a group with this course to 
represent its participants; necessary if 'ecl_register' is used for enrollment 
management.""",
            label_msgid = 'label_associated_group',
            description_msgid = 'help_associated_group',
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    DataGridField('availableResources',
        searchable = True,
        #default_method = 'getDefaultResources',
        #required = True,
        columns = ('title', 'url'),
        allow_empty_rows = False,
        widget = DataGridWidget(
            label_msgid = 'label_available_resourcess',
            label = "Available resources",
            description_msgid = 'help_available_resources',
            description = """Enter available resources for this course. Title 
is the name of a resource as shown to the user, URL must be a path inside
this site or an URL to an external source. Please remember that published 
items inside this course are added by default.""",
            column_names = ('Title', 'URL',),
            i18n_domain =  config.I18N_DOMAIN,
        ),
    ),

    TextField('text',
        #required=True,
        searchable=True,
        primary=True,
        #storage = AnnotationStorage(migrate=True),
        validators = ('isTidyHtmlWithCleanup',),
        #validators = ('isTidyHtml',),
        default_content_type = config.DEFAULT_CONTENT_TYPE,
        default_output_type = config.DEFAULT_OUTPUT_TYPE,
        allowable_content_types = config.ALLOWED_CONTENT_TYPES,
        widget = RichWidget(
            label = "Body Text",
            label_msgid = "label_body_text",
            description = "Enter course information",
            description_msgid = "help_body_text",
            rows = 18,
            i18n_domain = config.I18N_DOMAIN,
            allow_file_upload = config.ALLOW_DOCUMENT_UPLOAD,

        )
    ),

),
)
from Products.CMFCore.permissions import ManagePortal
from Products.PloneTemplates.config import TEMPLATE_INHERIT_MODE

PloneTemplatesMixinSchema = Schema(
    (ReferenceField('templates',
                    multiValued=True,
                    write_permission=ManagePortal,
                    allowed_types=('Template', ),
                    schemata='Templates',
                    relationship='EnablesTemplate',
                    widget=ReferenceBrowserWidget(
                        label_msgid="label_templates",
                        description_msgid="help_templates",
                        i18n_domain="PloneTemplates",
                        force_close_on_insert=True,
                        label="",
                        populate=1,
                        description="")),
     StringField('inheritTemplates',
                 vocabulary=TEMPLATE_INHERIT_MODE,
                 default='1',
                 write_permission=ManagePortal,
                 enforceVocabulary=True,
                 schemata='Templates',
                 widget=SelectionWidget(
                     label_msgid="label_inheritTemplates",
                     description_msgid="help_inheritTemplates",
                     i18n_domain="PloneTemplates",
                     label="",
                     description=""))))
from Products.Archetypes.tests.test_classgen import Dummy
from Products.Archetypes.tests.test_classgen import gen_class
from Products.Archetypes.tests.test_classgen import gen_dummy
from Acquisition import aq_base


class AnnDummy(Dummy):
    pass


annschema = BaseSchema + Schema((
    StringField(
        'string',
        default=u'stringdefault',
        storage=AnnotationStorage(),
    ),
    StringField(
        'meta',
        default='metadefault',
        storage=MetadataAnnotationStorage(),
    ),
))


def gen_anndummy():
    gen_class(AnnDummy, annschema)


class AnnotationTest(ATSiteTestCase):
    def afterSetUp(self):
        gen_dummy()
        dummy = Dummy(oid='dummy')
Exemple #32
0
ConstrainTypesMixinSchema = Schema((
    IntegerField(
        'constrainTypesMode',
        required=False,
        default_method="_ct_defaultConstrainTypesMode",
        vocabulary=enableDisplayList,
        languageIndependent=True,
        write_permission=ATCTPermissions.ModifyConstrainTypes,
        widget=SelectionWidget(
            label=_(u'label_contrain_types_mode',
                    default=u'Constrain types mode'),
            description=_(
                u'description_constrain_types_mode',
                default=u'Select the constraint type mode for this folder.'),
            visible={
                'view': 'invisible',
                'edit': 'invisible'
            },
        ),
    ),
    LinesField(
        'locallyAllowedTypes',
        vocabulary='_ct_vocabularyPossibleTypes',
        enforceVocabulary=False,
        languageIndependent=True,
        default_method='_ct_defaultAddableTypeIds',
        accessor='getLocallyAllowedTypes',  # Respects ENABLE/DISABLE/ACQUIRE
        write_permission=ATCTPermissions.ModifyConstrainTypes,
        multiValued=True,
        widget=MultiSelectionWidget(
            size=10,
            label=_(u'label_constrain_allowed_types',
                    default=u'Permitted types'),
            description=_(u'description_constrain_allowed_types',
                          default=u'Select the types which will be addable '
                          u'inside this folder.'),
            visible={
                'view': 'invisible',
                'edit': 'invisible'
            },
        ),
    ),
    LinesField(
        'immediatelyAddableTypes',
        vocabulary='_ct_vocabularyPossibleTypes',
        enforceVocabulary=False,
        languageIndependent=True,
        default_method='_ct_defaultAddableTypeIds',
        # Respects ENABLE/DISABLE/ACQUIRE:
        accessor='getImmediatelyAddableTypes',
        write_permission=ATCTPermissions.ModifyConstrainTypes,
        multiValued=True,
        widget=MultiSelectionWidget(
            size=10,
            label=_(u'label_constrain_preferred_types', u'Preferred types'),
            description=_(u'description_constrain_preferred_types',
                          default=u'Select the types which will be addable '
                          u'from the "Add new item" menu. Any '
                          u'additional types set in the list above '
                          u'will be addable from a separate form.'),
            visible={
                'view': 'invisible',
                'edit': 'invisible'
            },
        ),
    ),
))
Exemple #33
0
ATDateRangeCriterionSchema = ATBaseCriterionSchema + Schema((
    DateTimeField(
        'start',
        required=1,
        mode="rw",
        write_permission=ChangeTopics,
        default=None,
        widget=CalendarWidget(
            label=_(u'label_date_range_criteria_start',
                    default=u'Start Date'),
            description=_(
                u'help_date_range_criteria_start',
                default=u'The beginning of the date range to search')
        ),
    ),

    DateTimeField(
        'end',
        required=1,
        mode="rw",
        write_permission=ChangeTopics,
        default=None,
        widget=CalendarWidget(
            label=_(u'label_date_range_criteria_end',
                    default=u'End Date'),
            description=_(
                u'help_date_range_criteria_end',
                default=u'The ending of the date range to search.')

        ),
    ),
))
Exemple #34
0
PRODUCT_SCHEMA = Schema((
    # 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",
    ),
    LinesField(
        name='fileCategories',
        languageIndependent=True,
        required=False,
        multiValued=1,
        default=[],
        schemata='default',
        widget=LinesWidget(
            size=15,
            label="Categories for Download Files",
            description=("One category per line. This is an important field "
                         "used to manage possible columns in Download tab."),
            i18n_domain='eea',
        )
    ),
    # METADATA ================================================================
    StringField(
        name='sectionTitleData',  # ===========================================
        schemata='metadata',
        widget=LabelWidget(
            label=('DATA IDENTIFICATION'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    StringField(
        name='dataResourceTitle',
        widget=StringWidget(
            label="Resource title",
            description="Name by which the cited resource is known",
            i18n_domain='eea',
        ),
        default="",
        searchable=True,
        schemata="metadata",
    ),
    TextField(
        name='dataResourceAbstract',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Resource abstract",
            description=(
                "Brief narrative summary of the content of the "
                "resource(s) with coverage, main attributes, data sources, "
                "important of the work, etc."),
            label_msgid='eea_data_resource_abstract',
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    StringField(
        name='dataResourceType',
        widget=StringWidget(
            label="Resource type",
            description="Scope to which metadata applies.",
            i18n_domain='eea',
        ),
        default="Dataset",
        searchable=True,
        schemata="metadata",
    ),
    StringField(
        name='dataResourceLocator',
        widget=StringWidget(
            label="Resource Locator",
            description="URL address to locate the data",
            i18n_domain='eea',
        ),
        default="",
        searchable=True,
        schemata="metadata",
    ),
    StringField(
        name='sectionTitleClassification',  # =================================
        schemata='metadata',
        widget=LabelWidget(
            label=('CLASSIFICATION OF SPATIAL DATA'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    LinesField(
        name='classificationTopicCategory',
        languageIndependent=True,
        required=False,
        multiValued=1,
        default=[],
        vocabulary=TOPIC_CATEGORY_VOCAB,
        schemata='metadata',
        widget=MultiSelectionWidget(
            size=17,
            label="Topic of category",
            description=("Main theme(s) of the dataset"),
            label_msgid='topic_of_category',
            description_msgid='description_topic_of_category',
            i18n_domain='eea',
        )
    ),
    StringField(
        name='sectionTitleGeographic',  # =====================================
        schemata='metadata',
        widget=LabelWidget(
            label=('GEOGRAPHIC REFERENCE'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    GeographicBoundingBoxField(
        name='geographicBoundingBox',
        languageIndependent=True,
        required=False,
        validators=('isGeographicBoundingBoxValid',),
        multiValued=1,
        default=[],
        schemata='metadata',
        widget=GeographicBoundingBoxWidget(
            # Keep updated label and description in
            # geographic_bounding_box_widget.pt too.
            label="Bounding Box",
            description=("Coordinates of the four (West, East, North, South) "
                         "foremost corners of the dataset"),
            label_msgid='eea_geographic_bounding_box',
            i18n_domain='eea',
        )
    ),
    GeographicBoundingBoxField(
        name='geographicBoundingBox2',
        languageIndependent=True,
        required=False,
        validators=('isGeographicBoundingBoxValid',),
        multiValued=1,
        default=[],
        schemata='metadata',
        widget=GeographicBoundingBoxWidget(
            # Keep updated label and description in
            # geographic_bounding_box_widget.pt too.
            label="Bounding Box 2",
            description=("Coordinates of the four (West, East, North, South) "
                         "foremost corners of the dataset"),
            label_msgid='eea_geographic_bounding_box2',
            i18n_domain='eea',
        )
    ),
    GeographicBoundingBoxField(
        name='geographicBoundingBox3',
        languageIndependent=True,
        required=False,
        validators=('isGeographicBoundingBoxValid',),
        multiValued=1,
        default=[],
        schemata='metadata',
        widget=GeographicBoundingBoxWidget(
            # Keep updated label and description in
            # geographic_bounding_box_widget.pt too.
            label="Bounding Box 3",
            description=("Coordinates of the four (West, East, North, South) "
                         "foremost corners of the dataset"),
            label_msgid='eea_geographic_bounding_box3',
            i18n_domain='eea',
        )
    ),
    GeographicBoundingBoxField(
        name='geographicBoundingBox4',
        languageIndependent=True,
        required=False,
        validators=('isGeographicBoundingBoxValid',),
        multiValued=1,
        default=[],
        schemata='metadata',
        widget=GeographicBoundingBoxWidget(
            # Keep updated label and description in
            # geographic_bounding_box_widget.pt too.
            label="Bounding Box 4",
            description=("Coordinates of the four (West, East, North, South) "
                         "foremost corners of the dataset"),
            label_msgid='eea_geographic_bounding_box4',
            i18n_domain='eea',
        )
    ),
    GeographicBoundingBoxField(
        name='geographicBoundingBox5',
        languageIndependent=True,
        required=False,
        validators=('isGeographicBoundingBoxValid',),
        multiValued=1,
        default=[],
        schemata='metadata',
        widget=GeographicBoundingBoxWidget(
            # Keep updated label and description in
            # geographic_bounding_box_widget.pt too.
            label="Bounding Box 5",
            description=("Coordinates of the four (West, East, North, South) "
                         "foremost corners of the dataset"),
            label_msgid='eea_geographic_bounding_box5',
            i18n_domain='eea',
        )
    ),
    GeographicBoundingBoxField(
        name='geographicBoundingBox6',
        languageIndependent=True,
        required=False,
        validators=('isGeographicBoundingBoxValid',),
        multiValued=1,
        default=[],
        schemata='metadata',
        widget=GeographicBoundingBoxWidget(
            # Keep updated label and description in
            # geographic_bounding_box_widget.pt too.
            label="Bounding Box 6",
            description=("Coordinates of the four (West, East, North, South) "
                         "foremost corners of the dataset"),
            label_msgid='eea_geographic_bounding_box6',
            i18n_domain='eea',
        )
    ),
    GeographicBoundingBoxField(
        name='geographicBoundingBox7',
        languageIndependent=True,
        required=False,
        validators=('isGeographicBoundingBoxValid',),
        multiValued=1,
        default=[],
        schemata='metadata',
        widget=GeographicBoundingBoxWidget(
            # Keep updated label and description in
            # geographic_bounding_box_widget.pt too.
            label="Bounding Box 7",
            description=("Coordinates of the four (West, East, North, South) "
                         "foremost corners of the dataset"),
            label_msgid='eea_geographic_bounding_box7',
            i18n_domain='eea',
        )
    ),
    LinesField(
        name='geographicCoverage',
        languageIndependent=True,
        required=False,
        multiValued=1,
        default=[],
        vocabulary=NamedVocabulary(COUNTRIES_DICTIONARY_ID),
        schemata='metadata',
        widget=MultiSelectionWidget(
            macro="countries_widget",
            helper_js=("countries_widget.js",),
            helper_css=("countries_widget.css",),
            size=15,
            label="Coverage",
            description=("Countries that are covered by the resource"),
            label_msgid='dataservice_label_geographic',
            description_msgid='dataservice_help_geographic',
            i18n_domain='eea',
        )
    ),

    StringField(
        name='coordinateReferenceSystem',
        widget=StringWidget(
            label="Coordinate Reference System",
            description="CRS of the resource",
            i18n_domain='eea',
        ),
        default="EPSG:3035 (ETRS89, LAEA)",
        searchable=True,
        schemata="metadata",
    ),
    StringField(
        name='sectionTitleTemporal',  # =======================================
        schemata='metadata',
        widget=LabelWidget(
            label=('TEMPORAL REFERENCE'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    TemporalLinesField(
        name='temporalCoverage',
        languageIndependent=True,
        schemata='metadata',
        required=False,
        multiValued=1,
        widget=TemporalMultiSelectionWidget(
            macro="temporal_widget",
            helper_js=("temporal_widget.js",),
            size=15,
            label="Temporal Extent",
            description=(
                "The time period covered by the content of the resource"),
            label_msgid='dataservice_label_coverage',
            description_msgid='dataservice_help_coverage',
            i18n_domain='eea',
        )
    ),
    DateTimeField(
        name='lastUpload',
        languageIndependent=True,
        required=False,
        default=DateTime(),
        schemata="metadata",
        imports="from DateTime import DateTime",
        widget=CalendarWidget(
            show_hm=False,
            label="Date of publication",
            description=("The date of the resource when available"),
            label_msgid='dataservice_label_last_upload',
            description_msgid='dataservice_help_last_upload',
            i18n_domain='eea',
        ),
    ),
    DateTimeField(
        name='revisionDate',
        languageIndependent=True,
        required=False,
        schemata="metadata",
        widget=CalendarWidget(
            show_hm=False,
            label="Revision date",
            description=("The date of revision"),
            label_msgid='dataservice_label_revision_date',
            description_msgid='dataservice_help_revision_date',
            i18n_domain='eea',
        ),
    ),
    StringField(
        name='sectionTitleQuality',  # ========================================
        schemata='metadata',
        widget=LabelWidget(
            label=('QUALITY AND VALIDITY'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    TextField(
        name='qualityLineage',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Lineage",
            description=(
                "General explanation of the data produce knowledge's about "
                "the lineage of a dataset"),
            label_msgid='eea_quality_lineage',
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    TextField(
        name='qualitySpatialResolution',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Spatial resolution",
            description=(
                "A set of zero to many resolution distances (typically for "
                "gridded data and imagery-derived products) or equivalent "
                "scales (typically for maps or map-derived products)"),
            label_msgid='eea_quality_spatial_resolution',
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    StringField(
        name='sectionTitleConformity',  # =====================================
        schemata='metadata',
        widget=LabelWidget(
            label=('CONFORMITY'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    TextField(
        name='conformitySpecification',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Specification",
            description=(
                "A citation of the implementing rules adopted under "
                "Article 7(1) of Directive 2007/2/EC or other specification "
                "to which a particular resource conforms"),
            label_msgid='eea_conformity_specification',
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    StringField(
        name='conformityDegree',
        vocabulary=CONFORMITY_DEGREE_VOCAB,
        widget=SelectionWidget(
            label="Degree",
            description=(
                "The degree of conformant  with cited specification "
                "(true - if conformant, false - if not conformant, "
                "or null - if not evaluated)"),
            i18n_domain='eea',
        ),
        default="",
        searchable=False,
        schemata="default",
    ),
    StringField(
        name='sectionTitleAccess',  # =========================================
        schemata='metadata',
        widget=LabelWidget(
            label=('CONSTRAINTS RELATED TO ACCESS AND USE'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    TextField(
        name='accessAndUseConstraints',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Conditions applying to access and use",
            description=("Restriction on the access and use of a "
                         "resource or metadata"),
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    TextField(
        name='accessAndUseLimitationPublic',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Limitation of public access",
            description=("Limitation and other reason for public access"),
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    StringField(
        name='sectionTitleResponsible',  # ====================================
        schemata='metadata',
        widget=LabelWidget(
            label=('RESPONSIBLE ORGANISATION'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    TextField(
        name='owners',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Responsible party",
            description=(
                "Organisation associated with the resource. Organisation "
                "name, contact information (email)."),
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    TextField(
        name='responsiblePartyRole',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Responsible party role",
            description=("Function performed by the party"),
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    StringField(
        name='sectionTitleOther',  # ==========================================
        schemata='metadata',
        widget=LabelWidget(
            label=('OTHER FIELDS'),
            i18n_domain="eea",
            visible={'edit': 'visible', 'view': 'invisible'}
        )
    ),
    TextField(
        name='geographicAccuracy',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Geographic Accuracy",
            description=("Information about how accurate is data."),
            label_msgid='eea_geographic_accuracy',
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    TextField(
        name='dataSources',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Data sources",
            description=(
                "A reference to a resource from which the present "
                "resource is derived. Details such exact body "
                "or department, date of delivery, original database, "
                "table or GIS layer, scientific literature ..."),
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    TextField(
        name='dataCustodians',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Data Custodians",
            description=("Who keeps the data up to date?"),
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    TextField(
        name='descriptionDetailedMetadata',
        allowable_content_types=('text/plain', 'text/structured', 'text/html',
                                 'application/msword',),
        widget=RichWidget(
            label="Description",
            description=("Description for Detailed metadata"),
            i18n_domain='eea',
        ),
        default_content_type="text/html",
        searchable=True,
        schemata="metadata",
        default_output_type="text/x-html-safe",
    ),
    # CATEGORIZATION ==========================================================
    GeotagsLinesField(
        'geographicCoverageGT',
        schemata='categorization',
        required=False,
        widget=GeotagsWidget(
            label='Geographic coverage',
            description="The exact geographic names/places "\
            "that are covered by the data. "\
            "Example of locations/places are lakes, rivers, cities, "\
            "marine areas, glaciers, bioregions like alpine region etc."
        )
    ),
))
Exemple #35
0
from Testing import ZopeTestCase

from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase
from Products.Archetypes.tests.utils import mkDummyInContext
from Products.Archetypes.atapi import TextField, BaseSchema, Schema, BaseContent

from Products.Archetypes.ArchetypeTool import registerType

textfield1 = TextField('TEXTFIELD1', required=True, default='A')

textfield1b = TextField('TEXTFIELD1', required=False, default='A')

textfield2 = TextField('TEXTFIELD2', default='B')

schema1 = BaseSchema + Schema((
        textfield1,
        ))

schema2 = BaseSchema + Schema((
        textfield1b,
        textfield2,
        ))


class Dummy1(BaseContent):
    pass


class Dummy2(BaseContent):
    pass
schema = Schema((
    StringField(
        name='fullname',
        required=1,
        widget=StringWidget(
            description="Enter a name, eg. John Smith.",
            label='Full name',
            label_msgid='eXtremeManagement_label_fullname',
            description_msgid='eXtremeManagement_help_fullname',
            i18n_domain='eXtremeManagement'),
    ),
    StringField(
        name='phone',
        required=1,
        widget=IntegerWidget(
            size="30",
            description="Enter your phone number.",
            label='Phone',
            label_msgid='eXtremeManagement_label_phone',
            description_msgid='eXtremeManagement_help_phone',
            i18n_domain='eXtremeManagement'),
    ),
    StringField(
        name='email',
        widget=StringWidget(
            description="Enter your email address.",
            label='Email',
            label_msgid='eXtremeManagement_label_email',
            description_msgid='eXtremeManagement_help_email',
            i18n_domain='eXtremeManagement')
    ),
), )
Exemple #37
0
schema = Schema(
    (
        StringField(
            name="id",
            widget=StringWidget(
                visible={"view": "invisible", "edit": "visible"},
                modes=("view",),
                label=_(u"Poi_label_issue_id", default=u"Id"),
            ),
            mode="r",
        ),
        StringField(
            name="title",
            widget=StringWidget(
                label=_(u"Poi_label_issue_title", default=u"Title"),
                description=_(
                    u"Poi_help_issue_title",
                    default=(
                        u"Enter a short, descriptive title for the issue. "
                        u"A good title will make it easier for project "
                        u"managers to identify and respond to the issue."
                    ),
                ),
            ),
            required=True,
            accessor="Title",
            searchable=True,
        ),
        StringField(
            name="release",
            default="(UNASSIGNED)",
            widget=SelectionWidget(
                label=_(u"Poi_label_release", default=u"Version"),
                description=_(u"Poi_help_release", default=(u"Select the version the issue was found in.")),
                condition="object/isUsingReleases",
            ),
            required=True,
            vocabulary="getReleasesVocab",
        ),
        TextField(
            name="details",
            allowable_content_types=ISSUE_MIME_TYPES,
            widget=RichWidget(
                label=_(u"Poi_label_details", default=u"Details"),
                description=_(u"Poi_help_details", default=u"Please provide further details"),
                rows=15,
                allow_file_upload=False,
            ),
            required=True,
            default_content_type=DEFAULT_ISSUE_MIME_TYPE,
            searchable=True,
            default_output_type="text/html",
        ),
        TextField(
            name="steps",
            allowable_content_types=ISSUE_MIME_TYPES,
            widget=RichWidget(
                label=_(u"Poi_label_steps", default=u"Steps to reproduce"),
                description=_(
                    u"Poi_help_steps",
                    default=(
                        u"If applicable, please provide the steps to "
                        u"reproduce the error or identify the issue, one per "
                        u"line."
                    ),
                ),
                rows=6,
                allow_file_upload=False,
            ),
            default_output_type="text/html",
            default_content_type=DEFAULT_ISSUE_MIME_TYPE,
            searchable=True,
        ),
        FileField(
            name="attachment",
            widget=FileWidget(
                label=_(u"Poi_label_attachment", default=u"Attachment"),
                description=_(
                    u"Poi_help_attachment",
                    default=(
                        u"You may optionally upload a file attachment. Please "
                        u"do not upload unnecessarily large files."
                    ),
                ),
            ),
            storage=AttributeStorage(),
            write_permission=permissions.UploadAttachment,
        ),
        StringField(
            name="area",
            widget=SelectionWidget(
                label=_(u"Poi_label_area", default=u"Area"),
                description=_(u"Poi_help_area", default=u"Select the area this issue is relevant to."),
            ),
            enforceVocabulary=True,
            default_method="getDefaultArea",
            vocabulary="getAreasVocab",
            required=True,
        ),
        StringField(
            name="issueType",
            widget=SelectionWidget(
                label=_(u"Poi_label_issueType", default=u"Issue type"),
                description=_(u"Poi_help_issueType", default=u"Select the type of issue."),
            ),
            enforceVocabulary=True,
            default_method="getDefaultIssueType",
            vocabulary="getIssueTypesVocab",
            required=True,
        ),
        StringField(
            name="severity",
            widget=SelectionWidget(
                label=_(u"Poi_label_severity", default=u"Severity"),
                description=_(u"Poi_help_severity", default=u"Select the severity of this issue."),
                format="radio",
            ),
            vocabulary="getAvailableSeverities",
            default_method="getDefaultSeverity",
            required=True,
            write_permission=permissions.ModifyIssueSeverity,
        ),
        StringField(
            name="targetRelease",
            widget=SelectionWidget(
                label=_(u"Poi_label_targetRelease", default=u"Target release"),
                description=_(u"Poi_help_targetRelease", default=u"Release this issue is targetted to be fixed in"),
                condition="object/isUsingReleases",
            ),
            vocabulary="getReleasesVocab",
            default="(UNASSIGNED)",
            required=True,
            write_permission=permissions.ModifyIssueTargetRelease,
        ),
        StringField(
            name="responsibleManager",
            widget=SelectionWidget(
                label=_(u"Poi_label_responsibleManager", default=u"Responsible"),
                description=_(
                    u"Poi_help_responsibleManager",
                    default=(u"Select which manager, if any, is responsible for " u"this issue."),
                ),
            ),
            vocabulary="getManagersVocab",
            default="(UNASSIGNED)",
            required=True,
            write_permission=permissions.ModifyIssueAssignment,
        ),
        StringField(
            name="contactEmail",
            validators=("isEmail",),
            widget=StringWidget(
                label=_(u"Poi_label_contactEmail", default=u"Contact email address"),
                description=_(
                    u"Poi_help_contactEmail",
                    default=(
                        u"Please provide an email address where you can be "
                        u"contacted for further information or when a "
                        u"resolution is available. Note that your email "
                        u"address will not be displayed to others."
                    ),
                ),
            ),
            required=False,
            default_method="getDefaultContactEmail",
        ),
        LinesField(
            name="watchers",
            widget=LinesWidget(
                label=_(u"Poi_label_watchers", default=u"Issue watchers"),
                description=_(
                    u"Poi_help_watchers",
                    default=(
                        u"Enter the user names of members who are watching "
                        u"this issue, one per line. These members will "
                        u"receive an email when a response is added to the "
                        u"issue. Members can also add themselves as "
                        u"watchers."
                    ),
                ),
            ),
            write_permission=permissions.ModifyIssueWatchers,
        ),
        LinesField(
            name="subject",
            widget=AddRemoveWidget(
                label=_(u"Poi_label_subject", default=u"Tags"),
                description=_(
                    u"Poi_help_subject",
                    default=(
                        u"Tags can be used to add arbitrary categorisation to "
                        u"issues. The list below shows existing tags which "
                        u"you can select, or you can add new ones."
                    ),
                ),
            ),
            searchable=True,
            vocabulary="getTagsVocab",
            enforceVocabulary=False,
            write_permission=permissions.ModifyIssueTags,
            accessor="Subject",
        ),
    )
)
schema = BikaSchema.copy() + Schema((
    ReferenceField('Instrument',
                   allowed_types=('Instrument', ),
                   relationship='InstrumentCalibrationInstrument',
                   widget=StringWidget(visible=False, )),
    ComputedField(
        'InstrumentUID',
        expression=
        'context.getInstrument() and context.getInstrument().UID() or None',
        widget=ComputedWidget(visible=False, ),
    ),
    DateTimeField(
        'DateIssued',
        with_time=1,
        with_date=1,
        widget=DateTimeWidget(
            label=_("Report Date"),
            description=_("Calibration report date"),
        ),
    ),
    DateTimeField(
        'DownFrom',
        with_time=1,
        with_date=1,
        widget=DateTimeWidget(
            label=_("From"),
            description=_(
                "Date from which the instrument is under calibration"),
        ),
    ),
    DateTimeField(
        'DownTo',
        with_time=1,
        with_date=1,
        widget=DateTimeWidget(
            label=_("To"),
            description=_("Date until the instrument will not be available"),
        ),
    ),
    StringField('Calibrator',
                widget=StringWidget(
                    label=_("Calibrator"),
                    description=_(
                        "The analyst or agent responsible of the calibration"),
                )),
    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 calibration"),
        ),
    ),
    TextField(
        'WorkPerformed',
        default_content_type='text/plain',
        allowed_content_types=('text/plain', ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            label=_("Work Performed"),
            description=_(
                "Description of the actions made during the calibration"),
        ),
    ),
    ReferenceField(
        'Worker',
        vocabulary='getLabContacts',
        allowed_types=('LabContact', ),
        relationship='LabContactInstrumentCalibration',
        widget=ReferenceWidget(
            checkbox_bound=0,
            label=_("Performed by"),
            description=_("The person at the supplier who performed the task"),
            size=30,
            base_query={'inactive_state': 'active'},
            showOn=True,
            colModel=[{
                'columnName': 'UID',
                'hidden': True
            }, {
                'columnName': 'JobTitle',
                'width': '20',
                'label': _('Job Title')
            }, {
                'columnName': 'Title',
                'width': '80',
                'label': _('Name')
            }],
        ),
    ),
    StringField('ReportID',
                widget=StringWidget(
                    label=_("Report ID"),
                    description=_("Report identification number"),
                )),
    TextField(
        'Remarks',
        default_content_type='text/plain',
        allowed_content_types=('text/plain', ),
        default_output_type="text/plain",
        widget=TextAreaWidget(label=_("Remarks"), ),
    ),
))
""" Requestor folder
"""
from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import registerType, Schema
from Products.ATContentTypes.content.folder import ATBTreeFolder
from Products.EEAEnquiry.config import PROJECTNAME
from Products.CMFCore.permissions import ModifyPortalContent

schema = Schema((

),
)

EnquiryRequestorFolder_schema = getattr(
    ATBTreeFolder, 'schema', Schema(())).copy() + schema.copy()

class EnquiryRequestorFolder(ATBTreeFolder):
    """ Enquiry Requestor Folder
    """
    security = ClassSecurityInfo()

    # This name appears in the 'add' box
    archetype_name = 'EnquiryRequestorFolder'
    meta_type = 'EnquiryRequestorFolder'
    portal_type = 'EnquiryRequestorFolder'
    allowed_content_types = ['EnquiryRequestor'] + list(
        getattr(ATBTreeFolder, 'allowed_content_types', []))
    filter_content_types = 1
    global_allow = 0
    immediate_view = 'base_view'
    default_view = 'base_view'
Exemple #40
0
schema = Schema((
    ImageField('image',
               required=False,
               storage=public.AnnotationStorage(migrate=True),
               languageIndependent=True,
               widget=ImageWidget(
                   label='Image',
                   label_msgid='EEAContentTypes_label_image',
                   description_msgid='EEAContentTypes_help_image',
                   i18n_domain='eea',
                   show_content_type=False)),
    TextField('cloudUrl',
              languageIndependent=True,
              required=True,
              schemata='default',
              storage=AnnotationStorage(migrate=True),
              default_content_type='text/plain',
              validators=('videoCloudUrlValidator', ),
              allowable_content_types=('text/plain', ),
              default_output_type='text/plain',
              widget=TextAreaWidget(
                  description='The embedding code for the video from'
                  ' external sites eg. Vimeo or Youtube',
                  description_msgid="EEAContentTypes_help_quotationtext",
                  label="Cloud Url",
                  label_msgid="EEAContentTypes_label_cloud_url")),
    TextField(
        name='text',
        widget=RichWidget(
            label="Rich Text Description",
            label_msgid="EEAContentTypes_label_rich_description",
            i18n_domain="eea",
            rows=10,
        ),
    ),
    ManagementPlanField(
        name='eeaManagementPlan',
        languageIndependent=True,
        required=True,
        default=(datetime.now().year, ''),
        validators=('management_plan_code_validator', ),
        vocabulary_factory="Temporal coverage",
        storage=AnnotationStorage(migrate=True),
        widget=ManagementPlanWidget(
            format="select",
            label="EEA Management Plan",
            description=("EEA Management plan code."),
            label_msgid='dataservice_label_eea_mp',
            description_msgid='dataservice_help_eea_mp',
            i18n_domain='eea.dataservice',
        ),
    ),
), )
from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import Schema, BaseSchema, BaseContent, DisplayList, registerType 
#from Products.Archetypes.utils import shasattr

from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin
from Products.CMFCore.utils import UniqueObject
from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION

#from zLOG import LOG, INFO, ERROR
from Products.ECAssignmentBox.tool.Statistics import Statistics
from Products.ECAssignmentBox.tool.interfaces import IECABTool
from Products.ECAssignmentBox import config
from Products.ECAssignmentBox import LOG

schema = Schema((
),
)

ECABTool_schema = BaseSchema.copy() + schema.copy()

class ECABTool(UniqueObject, BaseContent, BrowserDefaultMixin):
    """
    """
    security = ClassSecurityInfo()
    implements(IECABTool)
    meta_type = 'ECABTool'
    plone_tool = True
    _at_rename_after_creation = True

    schema = ECABTool_schema
Exemple #42
0
schema = Schema((

    TextField(
        name='assessment',
        widget=RichWidget(
            label='Assessment',
            description='Assessment',
            label_msgid='indicators_label_assessment',
            i18n_domain='indicators',
        ),
        default_content_type="text/html",
        searchable=True,
        required=True,
        required_for_published=True,
        allowable_content_types=('text/html',),
        default_output_type="text/x-html-safe",
    ),
    StringField(
        name='title',
        widget=StringField._properties['widget'](
            visible={'view': 'invisible', 'edit': 'invisible'},
            label='Title',
            description='Title',
            label_msgid='indicators_label_title',
            i18n_domain='indicators',
        ),
        required=False,
        accessor="Title",
    ),
    TextField(
        name='description',
        default="",
        widget=TextAreaWidget(
            visible={'edit': 'invisible', 'view': 'invisible'},
            label='Description',
            description='Description',
            label_msgid='indicators_label_description',
            i18n_domain='indicators',
        ),
        accessor="Description",
        searchable=True,
    ),
    EEAReferenceField(
        name="relatedItems",
        multiValued=True,
        relationship='relatesTo',
        required=True,
        validators=('one_assessment_per_question',),
        # referencesSortable=True,
        keepReferencesOnCopy=True,
        accessor="get_related_items",
        edit_accessor="get_raw_related_items",
        mutator="set_related_items",
        widget=EEAReferenceBrowserWidget(
            label="Answers to policy question and related EEAFigures",
            description='Answers to policy question and related EEAFigures',
            label_msgid='indicators_label_question_answered',
            i18n_domain='indicators',
            macro="assessmentpart_relationwidget",
        )
    ),
))