Exemple #1
0
class NewsExtender(object):
    adapts(ATNewsItem)
    implements(ISchemaExtender)

    fields = [
        ALaUneField(name='isALaUneNews',
                    required=False,
                    languageIndependent=True,
                    default=False,
                    widget=BooleanWidget(
                        description=u"""Cochez cette case si l'actualite doit
                                                 apparaitre dans la rubrique 'A la une sur
                                                 la page' d'accueil.""",
                        label=u"Actualité 'A la Une'")),
        ValveProfField(name='isValveProfNews',
                       required=False,
                       languageIndependent=True,
                       default=False,
                       widget=BooleanWidget(
                           description=u"""Cochez cette case s'il s'agit
                                                 d'une actualite pour la valve prof.""",
                           label=u"Actualite 'Valve Prof'"))
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields
Exemple #2
0
class EEASchemaExtender(object):
    """ Schema extender for inline comment fields
    """
    implements(ISchemaExtender, IBrowserLayerAwareExtender)
    layer = ILayer

    fields = (EEADisableBooleanField(
        name='disableDisclaimer',
        schemata='settings',
        searchable=False,
        widget=BooleanWidget(
            label=_('Disable disclaimer'),
            description=_("Hide country disclaimer for this context"),
        )),
              EEABooleanField(
                  name='pdfShowEndnotes',
                  schemata='settings',
                  required=False,
                  default=False,
                  searchable=False,
                  languageIndependent=True,
                  widget=BooleanWidget(
                      label=_(u'PDF references and endnotes'),
                      description=_(
                          u"If enabled, references, endnotes, footnotes "
                          u"will show up when exporting content as PDF"))))

    def __init__(self, context):
        self.context = context

    def getFields(self):
        """ Returns fields
        """
        return self.fields
class ATFolderExtension(object):
    adapts(IATFolder)
    implements(ISchemaExtender)

    fields = [
        BooleanFieldExtension(
            "showDescription",
            widget=BooleanWidget(
                label="Show description of the folder?",
                description=
                "Check this box if you would like to show the description.")),
        TextFieldPreExtension(
            "prefixText",
            allowable_content_types=tuple(['text/html']),
            default_content_type='text/html',
            default_output_type='text/x-html-safe',
            widget=RichWidget(
                label="Folder Prefix",
                description=
                "This will be added before the folder contents.  With Folder Contents unchecked, this field can be used for the folder homepage.",
                rows=20)),
        BooleanFieldExtension(
            "hideFolderContents",
            widget=BooleanWidget(
                label="Hide folder contents?",
                description=
                "Check this box if you would like to hide the listing of folder contents."
            )),
        TextFieldSufExtension(
            "suffixText",
            allowable_content_types=tuple(['text/html']),
            default_content_type='text/html',
            default_output_type='text/x-html-safe',
            widget=RichWidget(
                label="Folder Suffix",
                description="This will be added after the folder contents.",
                rows=20)),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        try:
            from Products.PloneFormGen.interfaces.form import IPloneFormGenForm
            if IPloneFormGenForm.providedBy(self.context):
                return [
                ]  # This is to ignore PFG Folder which gets included for some reason.
        except:
            pass

        return self.fields
Exemple #4
0
class DanceFloorExtender(object):
    component.adapts(IDanceFloor)
    interface.implements(IOrderableSchemaExtender, IBrowserLayerAwareExtender)
    layer = IDanceFloorLayer

    fields = [
        InterfaceMarkerField(
            "dancefloor_enabled",
            schemata="settings",
            default=False,
            widget=BooleanWidget(
                label=_("Enable local newsletter functionality"))),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields

    def getOrder(self, schematas):
        """ Manipulate the order in which fields appear.
        @param schematas: Dictonary of schemata name -> field lists
        @return: Dictionary of reordered field lists per schemata.
        """

        return schematas
class ATDocumentExtension(object):
    adapts(IATDocument)
    implements(ISchemaExtender)

    fields = [BooleanFieldExtension("showDescription",
                                    widget = BooleanWidget(label="Show summary on page?",
                                                           description="Check this box if you would like to show the summary."
                                                           )),
              BooleanFieldExtension("showVideoIcon",
                                    widget = BooleanWidget(label="Show video icon?",
                                                           description="Check this box if this page contains a video.  A video icon will appear next to this page's link in the folder listing display."
                                                           )),
              ]
   
    def __init__(self, context):
        self.context = context
        
    def getFields(self):
        return self.fields
Exemple #6
0
class MultiDataProvenanceSchemaExtender(object):
    """ Schema extender for content types with data provenance
    """
    implements(ISchemaExtender, IBrowserLayerAwareExtender)

    layer = IDavizLayer

    fields = (
        DavizDataGridField(
            name='provenances',
            schemata='Data Provenance',
            searchable=False,
            widget=DataGridWidget(
                label="Data Provenance",
                description="""List of Data Provenance""",
                columns={
                    'title': Column("Title", required=False),
                    'link': Column("Link", required=False),
                    'owner': OwnerColumn
                },
                auto_insert=False,
                i18n_domain='eea',
                helper_js=widget_helper_js,
                helper_css=('++resource++eea.daviz.datasource.css',
                            'datagridwidget.css')),
            columns=("title", "link", "owner"),
            required=False,
            required_for_published=True),
        DavizBooleanField(name='inheritedprovenance',
                          schemata='Data Provenance',
                          searchable=False,
                          widget=BooleanWidget(
                              label='Inherited Provenance',
                              description='Inherited Provenance',
                          )),
    )

    def __init__(self, context):
        self.context = context

    def getFields(self):
        """ Returns provenance list field
        """
        return self.fields
class DocumentExtender(object):
    """ PDF properties for ATDocument-ish types """

    adapts(IATDocument)
    implements(ISchemaExtender)

    fields = [
        MyBooleanField(
            'pdfShowTitle',
            default=True,
            widget=BooleanWidget(
                label="Show document title in PDF",
                label_msgid='label_show_document_title_in_pdf',
                i18n_domain='plone',
            ),
            schemata='PDF',
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields
Exemple #8
0
from eea.facetednavigation import EEAMessageFactory as _

BooleanEditSchema = Schema((
    StringField(
        'index',
        schemata="default",
        required=True,
        vocabulary_factory='eea.faceted.vocabularies.SimpleFieldCatalogIndexes',
        widget=SelectionWidget(
            label=_(u'Catalog index'),
            description=_(u'Catalog index to use for search'),
            i18n_domain="eea")),
    BooleanField('default',
                 schemata="default",
                 widget=BooleanWidget(
                     label=_(u'Default value'),
                     description=_(u'Default items (one per line)'),
                     i18n_domain="eea")),
))

BooleanEditSchema = CountableWidget.edit_schema.copy() + BooleanEditSchema
del BooleanEditSchema['sortcountable']
del BooleanEditSchema['hidezerocount']


class Widget(CountableWidget):
    """ Widget
    """
    # Widget properties
    widget_type = 'boolean'
    widget_label = _('Boolean')
    view_js = '++resource++eea.facetednavigation.widgets.checkbox.view.js'
Exemple #9
0
        vocabulary='SampleTypesVocabulary',
        relationship='SamplePointSampleType',
        widget=BikaReferenceWidget(
            label=_("Sample Types"),
            description=_("The list of sample types that can be collected "
                          "at this sample point.  If no sample types are "
                          "selected, then all sample types are available."),
        ),
    ),
    BooleanField(
        'Composite',
        default=False,
        widget=BooleanWidget(
            label=_("Composite"),
            description=
            _("Check this box if the samples taken at this point are 'composite' "
              "and put together from more than one sub sample, e.g. several surface "
              "samples from a dam mixed together to be a representative sample for the dam. "
              "The default, unchecked, indicates 'grab' samples"),
        ),
    ),
    BlobFileField(
        'AttachmentFile',
        widget=FileWidget(label=_("Attachment"), ),
    ),
))

schema['description'].widget.visible = True
schema['description'].schemata = 'default'


class SamplePoint(BaseContent, HistoryAwareMixin):
Exemple #10
0
schema = Organisation.schema.copy() + Schema((
    StringField(
        "ClientID",
        required=1,
        searchable=True,
        validators=("uniquefieldvalidator", "standard_id_validator"),
        widget=StringWidget(
            label=_("Client ID"),
        ),
    ),

    BooleanField(
        "BulkDiscount",
        default=False,
        widget=BooleanWidget(
            label=_("Bulk discount applies"),
        ),
    ),

    BooleanField(
        "MemberDiscountApplies",
        default=False,
        widget=BooleanWidget(
            label=_("Member discount applies"),
        ),
    ),

    StringField(
        "CCEmails",
        schemata="Preferences",
        mode="rw",
Exemple #11
0
 ),
 IntegerField('ExponentialFormatPrecision',
              schemata="Analysis",
              default = 7,
              widget=IntegerWidget(
                  label=_("Exponential format precision"),
                  description=_(
                      "Define the precision when converting values to exponent "
                      "notation.  The default is 7."),
              ),
 ),
 BooleanField('ReportDryMatter',
              schemata="Analysis",
              default=False,
              widget=BooleanWidget(
                  label=_("Report as Dry Matter"),
                  description=_("These results can be reported as dry matter"),
              ),
 ),
 StringField('AttachmentOption',
             schemata="Analysis",
             default='p',
             vocabulary=ATTACHMENT_OPTIONS,
             widget=SelectionWidget(
                 label=_("Attachment Option"),
                 description=_(
                     "Indicates whether file attachments, e.g. microscope images, "
                     "are required for this analysis and whether file upload function "
                     "will be available for it on data capturing screens"),
                 format='select',
             ),
 ),
Exemple #12
0
        )
    ),
    StringField('catalog',
        schemata="default",
        vocabulary_factory='eea.faceted.vocabularies.UseCatalog',
        widget=SelectionWidget(
            format='select',
            label=_(u'Catalog'),
            description=_(u"Get unique values from catalog "
                        u"as an alternative for vocabulary"),
        )
    ),
    BooleanField('sortreversed',
        schemata="display",
        widget=BooleanWidget(
            label=_(u"Reverse options"),
            description=_(u"Sort options reversed"),
        )
    ),
    StringField('default',
        schemata="default",
        widget=StringWidget(
            size=25,
            label=_(u'Default value'),
            description=_(u'Default selected item'),
            i18n_domain="eea"
        )
    ),
))

class Widget(CountableWidget):
    """ Widget
Exemple #13
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender, IBrowserLayerAwareExtender)
    layer = INalLimsLayer

    fields = [
        ExtStringField(
            'PlantType',
            widget=StringWidget(
                label="Plant Type (Sap Samples)",
                description="The Plant Species or Crop the sample was taken from",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'Variety',
            widget=StringWidget(
                label="Variety (Sap Samples)",
                description="The Plant Variety or Cultivar the sample was taken from",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'GrowthStage',
            widget=StringWidget(
                label="Growth Stage (Sap Samples)",
                description="The development stage of the plant the sample was taken from",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtBooleanField(
            'NewLeaf',
            widget=BooleanWidget(
                label="New Leaf (Sap Samples)",
                description="The sample is from the new growth of a plant",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'InternalLabID',
            widget=StringWidget(
                label="Internal Lab Sample ID",
                description="The Lab ID from a printed COC (Ex. '001')",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtDateTimeField(
            'DateOfSampling',
            required=1,
            widget=DateTimeWidget(
                label="Date Sampled",
                description="The Date the sample was taken",
                render_own_label=True,
                show_time=False,
                datepicker_nofuture=1,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'TimeOfSampling',
            widget=StringWidget(
                label="Time Sampled",
                description="The time of day the sample was taken",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
Exemple #14
0
         catalog_name="bika_setup_catalog",
         base_query={"is_active": True},
         showOn=True,
     ),
 ),
 ComputedField(
     "SampleTypeUID",
     expression=
     "context.Schema()['SampleType'].get(context) and context.Schema()['SampleType'].get(context).UID() or ''",
     widget=ComputedWidget(visible=False, ),
 ),
 BooleanField(
     "Composite",
     default=False,
     widget=BooleanWidget(
         label=_("Composite sample"),
         description=_("The sample is a mix of sub samples"),
     ),
 ),
 BooleanField(
     "SamplingRequired",
     default_method='getSamplingRequiredDefaultValue',
     widget=BooleanWidget(
         label=_("Sample collected by the laboratory"),
         description=_("Enable sampling workflow for the created sample")),
 ),
 RemarksField(
     "Remarks",
     searchable=True,
     widget=RemarksWidget(label=_("Remarks"), ),
 ),
 RecordsField(
Exemple #15
0
class ECQPointsQuestion(ECQBaseQuestion):
    """ A question that can in some way be graded. The candidate's points 
        or the rating he/she gave, can be retieved via the 
        'getCandidatePoints()' method.
    """

    schema = ECQBaseQuestion.schema.copy() + Schema(
        (
            IntegerField(
                'points',  # See 'description' property of the widget.
                accessor='getPointsPrivate',
                required=True,
                validators=(
                    'isPositiveInt',
                    'clearPointsCache',
                ),
                read_permission=PERMISSION_INTERROGATOR,
                widget=IntegerWidget(
                    label='Points',
                    label_msgid='points_label',
                    description=
                    'The number of points assigned to this question.',
                    description_msgid='points_tool_tip',
                    i18n_domain=I18N_DOMAIN),
                #read_permission=PERMISSION_STUDENT,
                #languageIndependent=True,
            ),
            BooleanField(
                'tutorGraded',
                accessor='isTutorGraded',
                default=False,
                #searchable=False,
                widget=BooleanWidget(
                    label='Tutor-Graded',
                    label_msgid='tutor_graded_label',
                    description=
                    'If answers to this question are graded manually, mark this checkbox.',
                    description_msgid='tutor_graded_tool_tip',
                    i18n_domain=I18N_DOMAIN),
                read_permission=PERMISSION_STUDENT,
                validators=('clearPointsCache', ),
                languageIndependent=True,
            ),
        ), )

    security = ClassSecurityInfo()

    security.declareProtected(PERMISSION_STUDENT, 'getPoints')

    def getPoints(self, *args, **kwargs):
        return self.getPointsPrivate(*args, **kwargs)

    security.declarePrivate('computeCandidatePoints')

    def computeCandidatePoints(self, result):
        """ Return how many points the candidate got for this question.

            @param result The result object of the candidate whose
            points you want to know.

            If a custom evaluation script has been uploaded it will be
            invoked. Otherwise a default method will be used.
        """
        parent = getParent(self)
        customScript = parent.getEvaluationScript(self.portal_type)
        answer = self.getCandidateAnswer(result)
        if not customScript:  # default
            return None
        else:  # use custom script
            return evalFunString(customScript, CUSTOM_EVALUATION_FUNCTION_NAME,
                                 [self, result, answer])

    def getCandidatePoints(self, result):
        if self.isTutorGraded():
            return result.getTutorPoints(self)
        else:
            # Check if we have a tutor-given or a cached value
            retVal = result.getCachedQuestionPoints(self)
            if retVal is None:
                retVal = self.computeCandidatePoints(result)
                result.setCachedQuestionPoints(self, retVal)
            return retVal
                    format='select',
                    label=_(u'Position'),
                    description=_(u"Widget position in page"),
                )),
    StringField('section',
                schemata="layout",
                vocabulary_factory="eea.faceted.vocabularies.WidgetSections",
                widget=SelectionWidget(
                    format='select',
                    label=_(u"Section"),
                    description=_("Display widget in section"),
                )),
    BooleanField('hidden',
                 schemata="layout",
                 widget=BooleanWidget(
                     label=_(u'Hidden'),
                     description=_(u"Hide widget"),
                 )),
))


class SimpleATAccessor(object):
    """ Simple AT Accessor
    """
    def __init__(self, widget, key):
        self.widget = widget
        self.data = widget.data
        self.key = key

    def __call__(self):
        value = self.data.get(self.key, None)
        if value is not None:
Exemple #17
0
             schemata='default',
             required=True,
             vocabulary=DisplayList([('or', 'OR'), ('and', 'AND')]),
             default='or',
             widget=SelectionWidget(
                 format='select',
                 label=_(u'Default operator'),
                 description=_(u'Search with AND/OR between elements'),
                 i18n_domain="eea")),
 BooleanField('operator_visible',
              schemata='default',
              required=False,
              default=False,
              widget=BooleanWidget(
                  label=_(u"Operator visible"),
                  description=_(u"Let the end-user choose to search with "
                                "AND or OR between elements"),
              )),
 StringField(
     'vocabulary',
     schemata="default",
     vocabulary_factory='eea.faceted.vocabularies.PortalVocabularies',
     widget=SelectionWidget(
         label=_(u"Vocabulary"),
         description=_(u'Vocabulary to use to render widget items'),
     )),
 StringField('catalog',
             schemata="default",
             vocabulary_factory='eea.faceted.vocabularies.UseCatalog',
             widget=SelectionWidget(
                 format='select',
                 description='Tagscloud minimum color',
                 description_msgid='help_faceted_criteria_colormin',
                 i18n_domain="eea")),
 StringField('colormax',
             schemata="display",
             default="95B229",
             widget=StringWidget(
                 label='Maximum color',
                 label_msgid='faceted_criteria_colormax',
                 description='Tagscloud max color',
                 description_msgid='help_faceted_criteria_colormax',
                 i18n_domain="eea")),
 BooleanField('sortreversed',
              schemata="display",
              widget=BooleanWidget(label=_(u'Reverse options'),
                                   description=_(u'Sort options reversed'),
                                   i18n_domain="eea")),
 StringField('cloud',
             schemata="geometry",
             vocabulary=TagsCloudTypes,
             widget=SelectionWidget(format='select',
                                    label=_('Cloud type'),
                                    description=_(u'Type of the cloud'),
                                    i18n_domain="eea")),
 IntegerField('sizemin',
              schemata="geometry",
              default=10,
              widget=IntegerWidget(label=_(u'Minimum size'),
                                   description=_(u'Minimum font-size (px)'),
                                   i18n_domain="eea")),
 IntegerField('sizemax',

registerField(PartitionSetupField, title="", description="")


# If this flag is true, then analyses created from this service will be linked
# to their own Sample Partition, and no other analyses will be linked to that
# partition.
Separate = BooleanField(
    'Separate',
    schemata='Container and Preservation',
    default=False,
    required=0,
    widget=BooleanWidget(
        label=_("Separate Container"),
        description=_("Check this box to ensure a separate sample container is "
                      "used for this analysis service"),
    )
)

# The preservation for this service; If multiple services share the same
# preservation, then it's possible that they can be performed on the same
# sample partition.
Preservation = UIDReferenceField(
    'Preservation',
    schemata='Container and Preservation',
    allowed_types=('Preservation',),
    vocabulary='getPreservations',
    required=0,
    multiValued=0,
    widget=ReferenceWidget(
         catalog_name="bika_setup_catalog",
         base_query={"inactive_state": "active"},
         showOn=True,
     ),
 ),
 ComputedField(
     "SampleTypeUID",
     expression=
     "context.Schema()['SampleType'].get(context) and context.Schema()['SampleType'].get(context).UID() or ''",
     widget=ComputedWidget(visible=False, ),
 ),
 BooleanField(
     "Composite",
     default=False,
     widget=BooleanWidget(
         label=_("Composite"),
         description=_("Composite sample"),
     ),
 ),
 RemarksField(
     "Remarks",
     searchable=True,
     widget=RemarksWidget(label=_("Remarks"), ),
 ),
 RecordsField(
     "Partitions",
     schemata="Sample Partitions",
     required=0,
     type="artemplate_parts",
     subfields=("part_id", "Container", "Preservation", "SampleType",
                "container_uid", "preservation_uid", "sampletype_uid"),
     subfield_labels={
     widget=SelectionWidget(
          description="Select the maximum size for attachments.",
          description_msgid="help_maxattachmentsize",
          label="Maximum attachment size",
          label_msgid="label_maxattachmentsize",
          i18n_domain="ploneboard",
     )
 ),
 BooleanField('allowEditComment',
     default=False,
     languageIndependent=0,
     widget=BooleanWidget(
         label=u'Allow users to edit their comments',
         description=u'If selected, this will give users the ability to '
                     u'edit their own comments.',
         label_msgid='label_allow_edit_comment',
         description_msgid='help_allow_edit_comment',
         # Only show when no conversations exist
         condition="not:object/getNumberOfConversations|nothing",
         ),
 ),
 BooleanField(
     'showCaptcha',
     write_permission=ManageForum,
     default=False,
     widget=BooleanWidget(
         description=_(
             u'help_showcaptcha',
             default=u'Select if show or not captcha for anonymous (if '
                     u'recaptcha installed and configured).'),
         label=_(u'label_show_captcha', default=u"Show Captcha"),
Exemple #22
0
        "BulkDiscount",
        default=False,
        widget=SelectionWidget(label=_("Bulk discount applies"), ),
    ),
    FixedPointField(
        "BulkPrice",
        widget=DecimalWidget(
            label=_("Discount %"),
            description=_("Enter discount percentage value"),
        ),
    ),
    BooleanField(
        "Descriptions",
        default=False,
        widget=BooleanWidget(
            label=_("Include descriptions"),
            description=_("Select if the descriptions should be included"),
        ),
    ),
    TextField("Remarks",
              allowable_content_types=("text/plain", ),
              widget=TextAreaWidget(label=_("Remarks"), )),
))

Field = schema["title"]
Field.required = 1
Field.widget.visible = True

Field = schema["effectiveDate"]
Field.schemata = "default"
# If no date is selected the item will be publishedimmediately.
Field.required = 0
Exemple #23
0
 IntegerField(
     "Confidence",
     schemata="Accreditation",
     widget=IntegerWidget(
         label=_("Confidence Level %"),
         description=_("This value is reported at the bottom of all "
                       "published results"),
     ),
 ),
 BooleanField(
     "LaboratoryAccredited",
     default=False,
     schemata="Accreditation",
     write_permission=ManageBika,
     widget=BooleanWidget(
         label=_("Laboratory Accredited"),
         description=_("Check this box if your laboratory is accredited"),
     ),
 ),
 StringField(
     "AccreditationBody",
     schemata="Accreditation",
     write_permission=ManageBika,
     widget=StringWidget(
         label=_("Accreditation Body Abbreviation"),
         description=_("E.g. SANAS, APLAC, etc."),
     ),
 ),
 StringField(
     "AccreditationBodyURL",
     schemata="Accreditation",
     write_permission=ManageBika,
Exemple #24
0
    # All the instruments available in the system. Don't use this
    # method to retrieve the instruments linked to this method, use
    # getInstruments() or getInstrumentUIDs() instead.
    LinesField("_AvailableInstruments",
               vocabulary="_getAvailableInstrumentsDisplayList",
               widget=MultiSelectionWidget(modes=("edit"), )),

    # If no instrument selected, always True. Otherwise, the user will
    # be able to set or unset the value. The behavior for this field
    # is controlled with javascript.
    BooleanField("ManualEntryOfResults",
                 default=False,
                 widget=BooleanWidget(
                     label=_("Manual entry of results"),
                     description=_(
                         "The results for the Analysis Services that use "
                         "this method can be set manually"),
                     modes=("edit"),
                 )),

    # Only shown in readonly view. Not in edit view
    ComputedField(
        "ManualEntryOfResultsViewField",
        expression="context.isManualEntryOfResults()",
        widget=BooleanWidget(
            label=_("Manual entry of results"),
            description=_("The results for the Analysis Services that use "
                          "this method can be set manually"),
            modes=("view"),
        ),
    ),
Exemple #25
0
        searchable=0,
        default = COREBlogEntry.trackback_open,
        widget=SelectionWidget(label='Default trackback status',
            label_msgid='label_receive_trackback_default',
            i18n_domain='plone',),
        vocabulary=IntDisplayList(trackback_status),
        schemata='cbsettings_entry',
        ),

    BooleanField('dont_send_ping',
        searchable=1,
        default=zconf.coreblog2.dont_send_ping_default,
        widget=BooleanWidget(\
                    label='Don\'t send PING/Trackback when entry added.',
                    description='',
                    label_msgid='label_dont_send_ping',
                    description_msgid='help_dont_send_ping',
                    i18n_domain='plone',
                    ),
        schemata='cbsettings_entry',
        ),

    #Comment validation
    BooleanField('comment_require_author',
        searchable=1,
        default=True,
        widget=BooleanWidget(label='Require author',
                    description='',
                    label_msgid='label_comment_require_author',
                    description_msgid='help_comment_require_author',
                    i18n_domain='plone',
            label='Relative path',
            label_msgid="label_relativepath_criteria_customrelativepath",
            description_msgid="help_relativepath_criteria_customrelativepath",
            i18n_domain="plone",
            description=
            "Enter a relative path e.g.: <br /> '..' for the parent folder <br /> '../..' for the parent's parent <br />'../somefolder' for a sibling folder"
        )),
    BooleanField(
        'recurse',
        mode="rw",
        write_permission=ChangeTopics,
        accessor="Recurse",
        default=False,
        widget=BooleanWidget(label="Search Sub-Folders",
                             label_msgid="label_path_criteria_recurse",
                             description="",
                             description_msgid="help_path_criteria_recurse",
                             i18n_domain="plone"),
    ),
))


class ATRelativePathCriterion(ATBaseCriterion):
    """A path criterion"""

    implements(IATTopicSearchCriterion)

    security = ClassSecurityInfo()
    schema = ATRelativePathCriterionSchema
    meta_type = 'ATRelativePathCriterion'
    archetype_name = 'Relative Path Criterion'
Exemple #27
0
class BatchSchemaExtender(object):
    adapts(IBatch)
    implements(IOrderableSchemaExtender)

    fields = [
        # ExtComputedField('ClientID',
        #     expression="context.Schema()['Client'].get(context) and context.Schema()['Client'].get(context).ID() or None",
        # ),
        # ExtComputedField('ClientUID',
        #     expression="context.Schema()['Client'].get(context) and context.Schema()['Client'].get(context).UID() or None",
        # ),
        # ExtComputedField('ClientTitle',
        #     expression="context.Schema()['Client'].get(context) and context.Schema()['Client'].get(context).Title() or None",
        # ),
        ExtReferenceField(
            'Doctor',
            required=1,
            multiValued=0,
            allowed_types=('Doctor', ),
            referenceClass=HoldingReference,
            relationship='BatchDoctor',
            widget=ReferenceWidget(
                label=_("Doctor"),
                description="",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible'
                },
                base_query={'inactive_state': 'active'},
                catalog_name='portal_catalog',
                showOn=True,
                colModel=[
                    {
                        'columnName': 'DoctorID',
                        'width': '20',
                        'label': _('Doctor ID')
                    },
                    {
                        'columnName': 'Title',
                        'width': '80',
                        'label': _('Full Name')
                    },
                ],
                add_button={
                    'visible': True,
                    'url': 'doctors/portal_factory/Doctor/new/edit',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#doctor-base-edit',
                    ],
                    'overlay_handler': 'HealthDoctorOverlayHandler',
                },
                edit_button={
                    'visible': True,
                    # url with the root to create/edit a object.
                    'url': 'doctors/portal_factory/Doctor',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#doctor-base-edit',
                    ],
                    'overlay_handler': 'HealthDoctorOverlayHandler',
                }),
        ),
        # ExtComputedField('DoctorID',
        #     expression="context.Schema()['Doctor'].get(context) and context.Schema()['Doctor'].get(context).ID() or None",
        # ),
        # ExtComputedField('DoctorUID',
        #     expression="context.Schema()['Doctor'].get(context) and context.Schema()['Doctor'].get(context).UID() or None",
        # ),
        # ExtComputedField('DoctorTitle',
        #     expression="context.Schema()['Doctor'].get(context) and context.Schema()['Doctor'].get(context).Title() or None",
        # ),
        ExtReferenceField(
            'Patient',
            required=1,
            multiValued=0,
            allowed_types=('Patient', ),
            referenceClass=HoldingReference,
            relationship='BatchPatient',
            widget=ReferenceWidget(
                label=_("Patient"),
                description="",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible'
                },
                base_query={'inactive_state': 'active'},
                catalog_name='bika_patient_catalog',
                showOn=True,
                colModel=[{
                    'columnName': 'getPatientID',
                    'width': '20',
                    'label': _('Patient ID')
                }, {
                    'columnName': 'Title',
                    'width': '40',
                    'label': _('Full Name')
                }, {
                    'columnName': 'PatientIdentifiers',
                    'width': '40',
                    'label': _('Additional Identifiers')
                }],
                add_button={
                    'visible': True,
                    'url': 'patients/portal_factory/Patient/new/edit',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#patient-base-edit',
                    ],
                    'overlay_handler': 'HealthPatientOverlayHandler',
                },
                edit_button={
                    'visible': True,
                    # url with the root to create/edit a object.
                    'url': 'patients/portal_factory/Patient',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#patient-base-edit',
                    ],
                    'overlay_handler': 'HealthPatientOverlayHandler',
                }),
        ),
        # ExtComputedField('PatientID',
        #     expression="context.Schema()['Patient'].get(context) and context.Schema()['Patient'].get(context).ID() or None",
        # ),
        # ExtComputedField('PatientUID',
        #     expression="context.Schema()['Patient'].get(context) and context.Schema()['Patient'].get(context).UID() or None",
        # ),
        # ExtComputedField('PatientTitle',
        #     expression="context.Schema()['Patient'].get(context) and context.Schema()['Patient'].get(context).Title() or None",
        # ),
        ExtDateTimeField(
            'OnsetDate',
            widget=DateTimeWidget(label=_('Onset Date'), ),
        ),
        ExtStringField(
            'PatientBirthDate',
            widget=StringWidget(visible=False, ),
        ),
        ExtRecordsField(
            'PatientAgeAtCaseOnsetDate',
            widget=SplittedDateWidget(
                label=_('Patient Age at Case Onset Date'), ),
        ),
        ExtBooleanField(
            'OnsetDateEstimated',
            default=False,
            widget=BooleanWidget(label=_("Onset Date Estimated"), ),
        ),
        ExtRecordsField(
            'ProvisionalDiagnosis',
            type='provisionaldiagnosis',
            subfields=('Code', 'Title', 'Description', 'Onset'),
            # Temporary fix: https://github.com/bikalabs/bika.health/issues/89
            #required_subfields=('Title'),
            subfield_sizes={
                'Code': 7,
                'Title': 20,
                'Description': 35,
                'Onset': 10
            },
            subfield_labels={
                'Code': _('Code'),
                'Title': _('Provisional diagnosis'),
                'Description': _('Description'),
                'Onset': _('Onset')
            },
            subfield_types={'Onset': 'datepicker_nofuture'},
            widget=RecordsWidget(
                label='Provisional diagnosis',
                combogrid_options={
                    'Title': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbytitle',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                    'Code': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbycode',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                    'Description': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbydesc',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                },
            ),
        ),
        ExtTextField(
            'AdditionalNotes',
            default_content_type='text/plain',
            allowable_content_types=('text/plain', ),
            default_output_type="text/plain",
            widget=TextAreaWidget(label=_('Additional notes'), ),
        ),
        ExtLinesField(
            'CaseStatus',
            vocabulary=getCaseStatus(),
            widget=MultiSelectionWidget(format='checkbox',
                                        label=_("Case status")),
        ),
        ExtLinesField(
            'CaseOutcome',
            vocabulary=getCaseOutcome(),
            widget=MultiSelectionWidget(format='checkbox',
                                        label=_("Case outcome")),
        ),
        ExtRecordsField(
            'Symptoms',
            type='symptoms',
            subfields=('UID', 'Title', 'Description', 'Severity'),
            widget=CaseSymptomsWidget(label='Symptoms', ),
        ),
        ExtRecordsField(
            'AetiologicAgents',
            type='aetiologicagents',
            subfields=('Title', 'Description', 'Subtype'),
            subfield_sizes={
                'Title': 15,
                'Description': 25,
                'Subtype': 10
            },
            subfield_labels={
                'Title': _('Aetiologic agent'),
                'Description': _b('Description'),
                'Subtype': _('Subtype')
            },
            # Temporary fix: https://github.com/bikalabs/bika.health/issues/89
            # required_subfields=('Title'),
            widget=RecordsWidget(
                label='Aetiologic agents',
                combogrid_options={
                    'Title': {
                        'colModel': [{
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Aetiologic agent')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _b('Description')
                        }, {
                            'columnName': 'Subtype',
                            'width': '30',
                            'label': _('Subtype')
                        }],
                        'url':
                        'getaetiologicagents',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                },
            ),
        ),
        ExtIntegerField(
            'HoursFasting',
            required=0,
            widget=IntegerWidget(label=_('Hours fasting'), ),
        ),
        ExtRecordsField(
            'PatientCondition',
            widget=CasePatientConditionWidget(label='Patient condition', ),
        ),
        ExtRecordsField(
            'MenstrualStatus',
            widget=CaseMenstrualStatusWidget(label='Menstrual status', ),
        ),
        ExtRecordsField(
            'BasalBodyTemperature',
            widget=CaseBasalBodyTempWidget(label='Basal body temperature', ),
        ),
        ExtStringField(
            'ClientPatientID',
            searchable=True,
            required=0,
            widget=ReferenceWidget(
                label=_b("Client Patient ID"),
                size=12,
                colModel=[
                    {
                        'columnName': 'id',
                        'width': '20',
                        'label': _('Patient ID'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'ClientPatientID',
                        'width': '20',
                        'label': _('Client PID'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'Title',
                        'width': '60',
                        'label': _('Fullname'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'UID',
                        'hidden': True
                    },
                ],
                ui_item='ClientPatientID',
                search_query='',
                discard_empty=('ClientPatientID', ),
                search_fields=('ClientPatientID', ),
                portal_types=('Patient', ),
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'visible'
                },
                catalog_name='bika_patient_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        schematas['default'] = [
            'id',
            'title',
            'description',
            'BatchID',
            'ClientPatientID',
            'Patient',
            # 'PatientID',
            # 'PatientUID',
            # 'PatientTitle',
            'Client',
            # 'ClientID',
            # 'ClientUID',
            # 'ClientTitle',
            'ClientBatchID',
            'Doctor',
            # 'DoctorID',
            # 'DoctorUID',
            # 'DoctorTitle',
            'BatchDate',
            'OnsetDate',
            'PatientAgeAtCaseOnsetDate',
            'OnsetDateEstimated',
            'HoursFasting',
            'PatientCondition',
            'BasalBodyTemperature',
            'MenstrualStatus',
            'Symptoms',
            'ProvisionalDiagnosis',
            'CaseStatus',
            'CaseOutcome',
            'AetiologicAgents',
            'AdditionalNotes',
            'Remarks',
            'PatientBirthDate',
            'BatchLabels',
            'InheritedObjects',
            'InheritedObjectsUI',
        ]
        return schematas

    def getFields(self):
        return self.fields
Exemple #28
0
class ECQCorrectAnswer(ECQSelectionAnswer):
    """ An answer that can be either a right or wrong (in the context of
        a question that contains this answer).
    """

    schema = ECQSelectionAnswer.schema.copy() + Schema((
        InlineTextField(
            'comment',
            accessor='getCommentPrivate',
            searchable=True,
            required=False,
            read_permission=permissions.PERMISSION_INTERROGATOR,
            allowable_content_types=(
                'text/plain',
                'text/structured',
                'text/restructured',
                'text/html',
            ),
            default_output_type='text/html',
            widget=TextAreaWidget(
                label='Comment',
                label_msgid='answer_comment_label',
                description='A comment on the answer. If the quiz '
                'is set to "instant feedback", '
                'the candidate will see this text in case his/her '
                'answer was wrong.',
                description_msgid='answer_comment_tool_tip',
                i18n_domain=config.I18N_DOMAIN),
            validators=('isXML', ),
        ),
        BooleanField(
            'correct',
            accessor='isCorrectPrivate',
            default=0,
            searchable=False,
            read_permission=permissions.PERMISSION_INTERROGATOR,
            widget=BooleanWidget(
                label='Correct',
                label_msgid='correct_label',
                description='The checkbox should be marked if this '
                'is a correct answer.',
                description_msgid='correct_tool_tip',
                i18n_domain=config.I18N_DOMAIN),
            languageIndependent=True,
        ),
    ), )

    # Use a custom page template for viewing.
    actions = ({
        'id': 'view',
        'action': 'string:${object_url}/ecq_correctanswer_view',
    }, )

    meta_type = 'ECQCorrectAnswer'  # zope type name
    portal_type = meta_type  # plone type name
    archetype_name = 'Correct Answer'  # friendly type name

    security = ClassSecurityInfo()
    security.declareProtected(permissions.PERMISSION_STUDENT, 'isCorrect')

    def isCorrect(self, *args, **kwargs):
        # no docstring prevents publishing
        #FIXME: check permssions: only return something if we're in resultView
        return self.isCorrectPrivate(*args, **kwargs)

    security.declareProtected(permissions.PERMISSION_STUDENT, 'getComment')

    def getComment(self, *args, **kwargs):
        # no docstring prevents publishing
        #FIXME: check permssions: only return something if we're in resultView
        return self.getCommentPrivate(*args, **kwargs)
     widget=TextAreaWidget(
         label="Comment",
         description='Your feedback about Connexions (html is allowed)',
     )),
 ImageField(
     'portrait',
     widget=ImageWidget(
         label="Portrait",
         description='Feel free to include a small portrait of yourself',
     )),
 BooleanField(
     'quote_permission',
     default=1,
     widget=BooleanWidget(
         label=
         "Will you allow Connexions to display a quote from your feedback on the Web site?",
         description=
         "Allow Connexions to display a quote from their feedback on the Web site?",
     )),
 BooleanField(
     'name_permission',
     default=1,
     widget=BooleanWidget(
         label=
         "Will you allow Connexions to display your name alongside your feedback?",
         description=
         "Allow Connexions to use your name along with your feedback?",
     )),
 BooleanField(
     'image_permission',
     default=1,
     widget=BooleanWidget(
Exemple #30
0
        relationship="WorksheetTemplateInstrument",
        referenceClass=HoldingReference,
        widget=ReferenceWidget(
            checkbox_bound=0,
            label=_("Instrument"),
            description=_("Select the preferred instrument"),
        ),
    ),
    StringField("InstrumentTitle", widget=StringWidget(visible=False)),
    BooleanField(
        "EnableMultipleUseOfInstrument",
        default=True,
        schemata="Description",
        widget=BooleanWidget(
            label=_("Enable Multiple Use of Instrument in Worksheets."),
            description=_(
                "If unchecked, Lab Managers won't be able to assign the same "
                "Instrument more than one Analyses while creating a Worksheet."
            ))),
))

schema["title"].schemata = "Description"
schema["title"].widget.visible = True

schema["description"].schemata = "Description"
schema["description"].widget.visible = True


class WorksheetTemplate(BaseContent):
    """Worksheet Templates
    """
    security = ClassSecurityInfo()