Exemplo n.º 1
0
class ContentExtender(object):
    adapts(ATEvent)
    implements(ISchemaExtender)

    fields = [
        ProfResponsableField(
            name='profResponsable',
            required=False,
            searchable=True,
            widget=StringWidget(description='',
                                label=u'Professeur responsable',
                                size=40)),
        ProfsAccompagnateursField(
            name='profsAccompagnateurs',
            required=False,
            searchabl=True,
            widget=TextAreaWidget(description='',
                                  label=u'Professeurs accompagnateurs',
                                  cols=40))]

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

    def getFields(self):
        return self.fields
Exemplo n.º 2
0
class ProfsAccompagnateursField(ExtensionField, TextField):
    """
    """
    TextField(
        name='profsAccompagnateurs',
        required=False,
        searchable=True,
        widget=TextAreaWidget(description='',
                              label=u'Professeurs accompagnateurs',
                              cols=40))
Exemplo n.º 3
0
class ECQSelectionAnswer(ECQBaseAnswer):
    """ A predefined answer that a candidate can select.
    """

    schema = ECQBaseAnswer.schema.copy() + Schema(
        (
            InlineTextField(
                'answer',  # See 'description' property of the widget.
                searchable=True,
                required=True,
                primary=True,
                allowable_content_types=(
                    'text/plain',
                    'text/structured',
                    'text/restructured',
                    'text/html',
                ),
                default_output_type='text/html',
                widget=TextAreaWidget(
                    label='Answer',
                    label_msgid='answer_label',
                    description=
                    'The answer text. This is what the candidate will see.',
                    description_msgid='answer_tool_tip',
                    i18n_domain=config.I18N_DOMAIN),
                validators=('isXML', ),
                read_permission=permissions.PERMISSION_STUDENT,
            ), ), )

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

    meta_type = 'ECQSelectionAnswer'  # zope type name
    portal_type = meta_type  # plone type name
    archetype_name = 'Selection Answer'  # friendly type name
Exemplo n.º 4
0
class Sponsor(base.ATCTContent):
    """A sponsor for a tutor-web site, Department or a Tutorial which could typically be viewed on a tutor-web site or
    on printed content belonging to tutor-web. Can contain a logo, url and additional text as well as a title.
    A sponsor is implemented as base contents and uses interface, ISponsor.
    """

    schema = schemata.ATContentTypeSchema.copy() + Schema((
        StringField(
            'title',
            required=True,
            searchable=0,
            default='tutor-web sponsor',
            widget=StringWidget(label='Title',
                                description='A title for the sponsor.',
                                i18n_domain='plone'),
        ),
        StringField(
            'sponsorurl',
            searchable=0,
            default='http://sponsor-url.com',
            widget=StringWidget(
                label='Specify the web address of the sponsor',
                description='url for sponsor',
            ),
        ),
        TextField(
            'sponsortext',
            searchable=0,
            default='',
            default_content_type='text/plain',
            allowable_content_types=('text/plain'),
            widget=TextAreaWidget(
                label=
                'Additional text, more detailed information about the sponsor.',
                description='additional sponsor text',
            ),
        ),
        ImageField(
            'sponsorlogo',
            #original_size=(600,600),
            max_size=(200, 200),
            #sizes={ 'mini' : (80,80),
            #        'normal' : (200,200),
            #         'big' : (100,100),
            #         'maxi' : (500,500),
            #        },
            widget=ImageWidget(
                label='Sponsor logo',
                description='logo',
            ),
        ),
    ))

    implements(ISponsor)
    global_allow = False
    meta_type = 'Sponsor'  # zope type name
    portal_type = meta_type  # plone type name
    archetype_name = 'Sponsor'  # friendly type name
    _at_rename_after_creation = True  #automatically create id
    security = ClassSecurityInfo()

    def initializeObject(self):
        """Called after the creatation of Sponsor
           publish sponsor so it becomes available for viewing for all users
        """
        self.tryWorkflowAction("publish", ignoreErrors=True)

    security.declarePrivate('tryWorkflowAction')

    def tryWorkflowAction(self, action, ignoreErrors=False, comment=None):
        """publish sponsor"""
        wtool = self.portal_workflow
        wf = wtool.getWorkflowsFor(self)[0]
        if wf.isActionSupported(self, action):
            if comment is None:
                #userId = getSecurityManager().getUser().getId()
                comment = 'State changed'
            wtool.doActionFor(self, action, comment=comment)
        elif not ignoreErrors:
            raise TypeError('Unsupported workflow action %s for object %s.' %
                            (repr(action), repr(self)))

    def publishAll(self, typeofobject=None, originalobj=None):
        """publish sponsor"""
        self.tryWorkflowAction("publish", ignoreErrors=True)

    def haveChanged(self):
        parent = aq_parent(self)
        parenttype = parent.Type()
        # should use interface instead FIXME
        # only letting tutorial know of changes not lecture as no sponsor info in lectures at the moment
        if (parenttype == 'Tutorial'):
            parent.editedObject()
        (10, _(u'10 kilobyte')),
        (100, _(u'100 kilobyte')),
        (1000, _(u'1 megabyte')),
        (10000, _(u'10 megabyte')),
        (-1, _(u'unlimited')),
   ))

schema = BaseBTreeFolderSchema + Schema((
    TextField('description',
        searchable=1,
        default_content_type='text/html',
        default_output_type='text/plain',
        widget=TextAreaWidget(
            description="Brief description of the forum topic.",
            description_msgid="help_description_forum",
            label="Description",
            label_msgid="label_description_forum",
            i18n_domain="ploneboard",
            rows=5
        )
    ),
    LinesField('category',
         write_permission=ManageForum,
         vocabulary='getCategories',
         widget=MultiSelectionWidget(
            description="Select which category the forum should be listed "
                        "under. A forum can exist in multiple categories, "
                        "although using only one category is recommended.",
            description_msgid="help_category",
            condition="object/getCategories",
            label="Category",
            label_msgid="label_category",
Exemplo n.º 6
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)
Exemplo n.º 7
0
                     visible={
                         'add': 'edit',
                     },
                 )),
 ExtTextField(
     "OtherInformation",
     mode="rw",
     read_permission=View,
     write_permission=ModifyPortalContent,
     default_content_type="text/plain",
     allowable_content_types=("text/plain", ),
     default_output_type="text/plain",
     widget=TextAreaWidget(
         label=_("Other relevant clinical information"),
         render_own_label=True,
         visible={
             'add': 'edit',
         },
     ),
 ),
 ExtReferenceField(
     "Courier",
     required=0,
     allowed_types=('Courier', 'ClientCourier'),
     relationship='AnalysisRequestCourier',
     mode="rw",
     read_permission=View,
     write_permission=ModifyPortalContent,
     widget=ReferenceWidget(
         label=_("Courier"),
         description=_("The person who delivered the sample"),
Exemplo n.º 8
0
from Products.Archetypes.public import registerType
from zope.interface import implements

from bika.lims import bikaMessageFactory as _
from bika.lims.config import PROJECTNAME
from bika.lims.content.organisation import Organisation
from bika.lims.interfaces import IDeactivable
from bika.lims.interfaces import ISupplier

schema = Organisation.schema.copy() + ManagedSchema((

    TextField(
        "Remarks",
        allowable_content_types=("text/plain",),
        widget=TextAreaWidget(
            label=_("Remarks"),
        )
    ),

    StringField(
        "Website",
        searchable=1,
        required=0,
        widget=StringWidget(
            visible={"view": "visible", "edit": "visible"},
            label=_("Website."),
        ),
    ),

    StringField(
        "NIB",
Exemplo n.º 9
0
                "view": "visible",
                "edit": "visible"
            },
            label=_("Method ID"),
            description=_("Define an identifier code for the method. "
                          "It must be unique."),
        ),
    ),
    TextField(
        "Instructions",
        default_content_type="text/plain",
        allowed_content_types=("text/plain", ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            label=_("Instructions"),
            description=_("Technical description and instructions "
                          "intended for analysts"),
        ),
    ),
    BlobFileField(
        "MethodDocument",  # XXX Multiple Method documents please
        widget=FileWidget(
            label=_("Method Document"),
            description=_("Load documents describing the method here"),
        )),

    # The instruments linked to this method. Don't use this
    # method, use getInstrumentUIDs() or getInstruments() instead
    LinesField(
        "_Instruments",
        vocabulary="getInstrumentsDisplayList",
        widget=StringWidget(
            label='Registry Email',
            description=
            'Notice is sent to this address each time a person registers for an event.  (No notice is sent if left blank.)'
        ),
    ),
    TextField(
        'confirmation_email_body',
        schemata='Registration',
        default_method='getDefaultMessageToRegistrant',
        searchable=False,
        required=True,
        widget=TextAreaWidget(
            label='Message to registrant',
            label_msgid='label_event_confirmation_email_body',
            description=
            'Body of email message sent to each person who registers',
            description_msgid='help_event_confirmation_email_body',
        ),
    ),
),
                                       marshall=RFC822Marshaller())
finalizeATCTSchema(RegisterableEventSchema)


class RegisterableEvent(base.ATCTBTreeFolder):
    """Information about an upcoming event, which can be displayed in the calendar."""
    def shortDayFormat(self):
        return getPropSheet(self).short_day_format

    def longDayFormat(self):
Exemplo n.º 11
0
class ECQBaseQuestion(ECQFolder):
    """ A very basic question type without any evaluation functions.
    
        A question is basically a question text and a set of possible
        answers to this question or, in Plone terms, a folder with
        some additional properties such as the question text.
    """

    schema = ECQFolder.schema.copy() + Schema(
        (
            StringField(
                'title',
                required=False,
                searchable=True,
                default='Question',
                widget=StringWidget(label_msgid='label_title',
                                    description_msgid='title',
                                    i18n_domain='plone'),
                read_permission=PERMISSION_STUDENT,
            ),
            InlineTextField(
                'question',  # See 'description' property
                # of the widget.
                searchable=True,
                required=True,
                primary=True,
                allowable_content_types=(
                    'text/plain',
                    'text/structured',
                    'text/restructured',
                    'text/html',
                ),
                default_output_type='text/html',
                widget=TextAreaWidget(
                    label='Question',
                    label_msgid='question_label',
                    description='The question text. This is what the '
                    'candidate will see.',
                    description_msgid='question_tool_tip',
                    i18n_domain=I18N_DOMAIN,
                    rows=10,
                ),
                validators=('isXML', ),
                read_permission=PERMISSION_STUDENT,
            ),
        ), )

    security = ClassSecurityInfo()

    #security.declareProtected(PERMISSION_INTERROGATOR, 'contentValues')
    #security.declareProtected(PERMISSION_INTERROGATOR, 'listFolderContents')

    # Declaring "folderlistingFolderContents" as protected prevents
    # the answers from being listed if someone without
    # PERMISSION_INTERROGATOR tries to call the "base_view" template
    # for a question.
    security.declareProtected(PERMISSION_INTERROGATOR,
                              'folderlistingFolderContents')

    security.declareProtected(PERMISSION_STUDENT, 'UID')

    security.declarePrivate('makeNewTest')

    def makeNewTest(self, candidateResult, suMode):
        """generate a new quiz"""
        # This is just to register the question with result object
        candidateResult.setSuggestedAnswer(self, None)

    security.declareProtected(PERMISSION_STUDENT, 'haveCandidateAnswer')

    def haveCandidateAnswer(self, result):
        """
        @param result A Result object
        """
        return result.haveCandidateAnswer(self)
Exemplo n.º 12
0
 #Trackbacks
 ReferenceField(
     'entry_trackbacks',
     multivalued=True,
     relationship=trackback_rel_id,
     allowed_types=(coreblogtrackback_meta_type, ),
 ),
 TextField(
     'trackback_url',
     searchable=0,
     default_output_type='text/plain',
     widget=TextAreaWidget(
         label='Trackback',
         description='',
         label_msgid='label_trackback',
         description_msgid='help_trackback',
         i18n_domain='plone',
         allow_file_upload=False,
         #visible={'view':'invisible','edit':'hidden'},
         cols=40,
         rows=3),
 ),
 TextField(
     'sent_trackback_url',
     searchable=False,
     default_output_type='text/plain',
 ),
 IntegerField(
     'allow_comment',
     searchable=0,
     default=2,
     widget=SelectionWidget(
Exemplo n.º 13
0
class ECQExtendedTextQuestion(ECQPointsQuestion):
    """A question that allows the candidate to write a text answer."""

    schema = ECQPointsQuestion.schema.copy() + Schema((
        TextField(
            'answerTemplate', # See 'description' property
                              # of the widget.
            searchable=True,
            required=False,
            allowable_content_types=('text/plain',
                                     #'text/structured',
                                     #'text/restructured',
                                     #'text/html',
                                     ),
            default_output_type='text/plain',
            widget=TextAreaWidget(
                label='Answer Template',
                label_msgid='answer_template_label',
                description="You can provide a template for the "
                "candidate's answer.",
                description_msgid='answer_template_tool_tip',
                i18n_domain=I18N_DOMAIN,
                rows=10,
                ),
            validators=('isXML',),
            read_permission=PERMISSION_STUDENT,
            ),
        
        IntegerField('expectedLength',
                required=False,
                default=50,
                validators=('isPositiveInt',),
                widget=IntegerWidget(
                    label='Expected Length',
                    label_msgid='expected_length_label',
                    description="You can set the number of words you "
                    "expect the candidate's answer to have.",
                    description_msgid='expected_length_tool_tip',
                    i18n_domain=I18N_DOMAIN),
                read_permission=PERMISSION_STUDENT,
            ),
        ),)
    # This type of question is always tutor-graded
    schema.delField('tutorGraded')
    # Make "points" appear *after* the "answerTemplate"
    schema.moveField('points', 1)
    schema.moveField('points', 1)
        
    allowed_content_types = ()
    filter_content_types = True # Otherwise allowed_content_types == ()
                                # means 'allow everything'
    
    meta_type = 'ECQExtendedTextQuestion'     # zope type name
    portal_type = meta_type                   # plone type name
    archetype_name = 'Extended Text Question' # 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

    typeDescription = "A question that allows the candidate to write " \
                      "a text answer."
    typeDescMsgId = 'description_edit_extextquestion'

    security = ClassSecurityInfo()

    security.declarePublic('isTutorGraded')
    def isTutorGraded(self, *args, **kwargs):
        return True
Exemplo n.º 14
0
        vocabulary="BatchLabelVocabulary",
        accessor="getLabelNames",
        widget=MultiSelectionWidget(
            label=_("Batch Labels"),
            format="checkbox",
        )
    ),

    TextField(
        'Remarks',
        default_content_type='text/x-web-intelligent',
        allowable_content_types=('text/plain', ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            macro="bika_widgets/remarks",
            label=_('Remarks'),
            append_only=True,
        )
    ),

    ReferenceField(
        'InheritedObjects',
        required=0,
        multiValued=True,
        allowed_types=('AnalysisRequest'),  # batches are expanded on save
        referenceClass=HoldingReference,
        relationship='BatchInheritedObjects',
        widget=ReferenceWidget(
            visible=False,
        ),
    ),
Exemplo n.º 15
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender)

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

    fields = [
        ExtProxyField("ParticipantID",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Participant ID"),
                          maxlength=22,
                          size=22,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("OtherParticipantReference",
                      proxy="context.getSample()",
                      mode="rw",
                      required=0,
                      widget=StringWidget(
                          label=_("Other Participant Ref"),
                          maxlength=12,
                          size=12,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("ParticipantInitials",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Participant Initials"),
                          maxlength=3,
                          size=2,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("Gender",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      vocabulary=GENDERS,
                      widget=SelectionWidget(
                          format="radio",
                          label=_("Gender"),
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("Visit",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Visit Number"),
                          maxlength=4,
                          size=4,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField(
            "Fasting",
            proxy="context.getSample()",
            mode="rw",
            required=0,
            default=False,
            widget=BooleanWidget(
                format="radio",
                label=_("Fasting"),
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField(
            'DateOfBirth',
            proxy="context.getSample()",
            mode="rw",
            required=1,
            widget=DateTimeWidget(
                label=_('Date of Birth'),
                datepicker_nofuture=1,
                show_time=False,
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField("Volume",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Estimated Sample Volume"),
                          maxlength=8,
                          size=8,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField(
            "OtherInformation",
            proxy="context.getSample()",
            mode="rw",
            default_content_type="text/plain",
            allowable_content_types=("text/plain", ),
            default_output_type="text/plain",
            widget=TextAreaWidget(
                label=_("Other relevant clinical information"),
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField(
            "Courier",
            proxy="context.getSample()",
            required=0,
            allowed_types='Courier',
            relationship='AnalysisRequestCourier',
            mode="rw",
            read_permission=View,
            write_permission=ModifyPortalContent,
            widget=ReferenceWidget(
                label=_("Courier"),
                description=_("The person who delivered the sample"),
                render_own_label=True,
                visible={
                    'view': 'visible',
                    'edit': 'visible',
                    'add': 'invisible',
                    'header_table': 'visible',
                    'secondary': 'disabled',
                    'sample_registered': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'to_be_sampled': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'scheduled_sampling': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'to_be_preserved': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sample_ordered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_prep': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'attachment_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'published': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'invalid': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'rejected': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                catalog_name='bika_setup_catalog',
                base_query={'review_state': 'active'},
                showOn=True,
            ),
        ),

        # This Analysis Request is only for internal use?
        # This field is useful when we create Partitions (AR-like), so we don't
        # want the client to see Analysis Requests / Samples that are meant to
        # be used in the lab.
        ExtProxyField(
            "InternalUse",
            proxy="context.getSample()",
            mode="rw",
            required=0,
            default=False,
            widget=BooleanWidget(
                format="radio",
                label=_("Internal use"),
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField(
            "PrimarySample",
            proxy="context.getSample()",
            required=0,
            allowed_types=('Sample'),
            relationship='SamplePrimarySample',
            mode="rw",
            read_permission=View,
            write_permission=ModifyPortalContent,
            widget=ReferenceWidget(
                label=_("Primary Sample"),
                description=_("The sample this is originated from"),
                size=20,
                render_own_label=True,
                visible={
                    'view': 'visible',
                    'edit': 'invisible',
                    'add': 'invisible',
                    'header_table': 'visible',
                    'secondary': 'disabled',
                },
                catalog_name='bika_catalog',
                base_query={'review_state': 'active'},
                showOn=False,
            ),
        ),
        ExtReferenceField(
            'PrimaryAnalysisRequest',
            allowed_types=('AnalysisRequest', ),
            relationship='AnalysisRequestPrimaryAnalysisRequest',
            referenceClass=HoldingReference,
            mode="rw",
            read_permission=View,
            write_permission=ModifyPortalContent,
            widget=ReferenceWidget(visible=False, ),
        ),
        ExtBooleanField(
            "PanicEmailAlertSent",
            default=False,
            widget=BooleanWidget(visible={
                'edit': 'invisible',
                'view': 'invisible',
                'add': 'invisible'
            }, ),
        )
    ]

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
Exemplo n.º 16
0
     '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=
             ("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>')),
         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",
Exemplo n.º 17
0
#        weblog.invokeFactory('Folder', id='topic_images', title='Topic Images')

WeblogSchema = BaseFolderSchema.copy() + Schema(
    (

        # This is sort of cheating.  We are stealing the Dublin Core 'description'
        # field for our purposes, but then I don't seen any reason to duplicate the
        # information.
        TextField(
            'description',
            searchable=1,
            accessor='Description',
            widget=TextAreaWidget(
                label=_('label_weblog_description', default='Description'),
                description=_(
                    'help_weblog_description',
                    default=
                    'A brief description of this weblog. This text will be displayed at the top of the page before any weblog entries.'
                ),
            ),
        ), ),
    marshall=PrimaryFieldMarshaller(),
)

# The subject is not language-specific
WeblogSchema['subject'].languageIndependent = True


def createSpecialFolders(blog, event):
    """Create folders for uploads and topic images. Supposed to be triggered
    on Weblog creation.
    
class NewsletterReference(BaseContent, PropertyManager):

    portal_type = meta_type = 'NewsletterReference'
    archetype_name = 'Newsletter Reference'   #this name appears in the 'add' box

    security = ClassSecurityInfo()

    schema=BaseSchema  + Schema((
        TextField('description',
                  default='',
                  searchable=1,
                  isMetadata=1,
                  accessor="Description",
                  widget=TextAreaWidget(label='Description',
                                        description='An administrative summary of the content',
                                        label_msgid='label_description',
                                        description_msgid='help_description',
                                        i18n_domain="plone")
                  ),
    ReferenceField('references',
                    languageIndependent=1,
                    required=0,
                    allowed_types=(),
                    multiValued=1,
                    relationship='references',
                    widget=ReferenceBrowserWidget(label='References',
                                                  description='Select one or more remote objects',
                                                  label_msgid='label_references',
                                                  description_msgid='help_references',
                                                  i18n_domain='plonegazette',
                                                  allow_search=1,
                                                  allow_browse=1,
                                                  show_indexes=0,
                                                  ),
                ),
    ))

    # Make sure we get title-to-id generation when an object is created
    _at_rename_after_creation = True

    security.declarePublic('getObjects')
    def getObjects(self):
        """
        """
        return self.getReferences()

    # uncommant lines below when you need
    factory_type_information={
        'allowed_content_types':[],
        'global_allow' : 0,
        'content_icon':'NewsletterReference.gif',
        'immediate_view':'newsletterreference_view',
        'filter_content_types' : 0
        }

    actions=({
        'id' : 'view',
        'name' : 'View',
        'category' : 'object',
        'action' : 'string:${object_url}/NewsletterReference_view',
        'permissions' : ('View',)
        },)
Exemplo n.º 19
0
                         description="User's Full name."),
 ),
 StringField(
     'email',
     languageIndependent=1,
     required=True,
     user_property=True,
     widget=StringWidget(label="Email Address",
                         description="User's Email Address."),
 ),
 TextField(
     'description',
     user_property=True,
     widget=TextAreaWidget(
         label="Biography",
         description=
         "A short overview of who you are and what you do. Will be displayed on the your author page, linked from the items you create."
     ),
 ),
 StringField(
     'location',
     languageIndependent=1,
     user_property=True,
     widget=StringWidget(label="Location", description="User's Location."),
 ),
 LinesField(
     'sites',
     languageIndependent=1,
     user_property=True,
     widget=LinesWidget(
         label="Sites",
Exemplo n.º 20
0
        searchable=False,
        widget=StringWidget(label='Website'),
    ),
    StringField(
        'heard_about',
        required=False,
        searchable=False,
        widget=StringWidget(label='How did you hear about this event?'),
    ),
    StringField(
        'comments',
        required=False,
        searchable=False,
        widget=TextAreaWidget(
            label=
            'Comments  (Please do not sign up other participants.  Each person must register individually.)',
            rows=10,
            cols=72,
        ),
    ),
    BooleanField(
        'newsletter',
        default=False,
        widget=BooleanWidget(
            label='Yes, I would like to receive a newsletter'),
    ),
))


class IEventRegistrant(Interface):
    """
    This object is an event registrant
Exemplo n.º 21
0
            label_msgid="label_file",
            i18n_domain="plone",
            show_content_type=False,
        )),
    ImageField('image',
               required=False,
               sizes={
                   'mini': (40, 40),
                   'thumb': (80, 80),
               },
               storage=FileSystemStorage(),
               widget=ImageWidget()),
    TextField('text',
              required=False,
              storage=FileSystemStorage(),
              widget=TextAreaWidget()),
),
                       marshall=PrimaryFieldMarshaller())

FSSItemSchema = BaseSchema.copy() + BaseItemShema.copy()
ATFSSItemSchema = ATContentTypeSchema.copy() + BaseItemShema.copy()


class FSSItem(BaseContent):
    """A simple item using FileSystemStorage"""
    archetypes_name = portal_type = meta_type = 'FSSItem'
    schema = FSSItemSchema
    _at_rename_after_creation = True


registerType(FSSItem, PROJECTNAME)
Exemplo n.º 22
0
        ),
    ),
    RecordsField(
        "ScheduleCriteria",
        required=1,
        type="schedulecriteria",
        widget=ScheduleInputWidget(label=_("Criteria"), ),
    ),
    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 performing the "
                          "task"),
        ),
    ),
))

IdField = schema['id']
schema['description'].required = False
schema['description'].widget.visible = True
schema['description'].schemata = 'default'
schema.moveField('description', before='Considerations')

# Title is not needed to be unique
schema['title'].validators = ()
schema['title']._validationLayer()
Exemplo n.º 23
0
from Products.Archetypes.public import LinesWidget, TextAreaWidget, IdWidget, StringWidget
from Products.Archetypes.public import BaseFolder, registerType
from Products.CMFCore import permissions

from Products.ATContentTypes.content.base import ATCTFolder

import Products.SimpleBlog.Permissions

schema = ATCTFolder.schema.copy() + Schema((
    StringField(
        'description',
        isMetadata=1,
        accessor='Description',
        widget=TextAreaWidget(
            label='Description',
            label_msgid="label_blogfolder_description",
            description_msgid="help_blogfolder_description",
            i18n_domain="SimpleBlog",
            description='Breve descripción para este folder.'),
    ),
    ComputedField('existingCats',
                  expression='here.getInheritedCategories()',
                  widget=ComputedWidget(
                      label='Existing categories.',
                      label_msgid="label_blogfolder_existing_cats",
                      i18n_domain="SimpleBlog",
                  )),
    LinesField(
        'categories',
        widget=LinesWidget(
            label='Additional categories',
            label_msgid="label_additional_categories",
Exemplo n.º 24
0
__version__ = open(os.path.join(COREBLOG2_DIR,'version.txt')).read().strip()
__product_version__ = "COREBlog2 " + __version__

__author__  = 'Atsushi Shibata <*****@*****.**>'
__docformat__ = 'plaintext'

COREBlog2Schema = ATBTreeFolder.schema.copy() +  Schema((

    #Basic settings
    TextField('long_description',
        searchable=1,
        default='',
        allowable_content_types = ('text/plain', ),
        widget=TextAreaWidget(label='Long description',
                    description='',
                    label_msgid='label_long_description',
                    description_msgid='help_long_description',
                    i18n_domain='plone',
                    cols=60,rows=5),
        ),

    #Entry listing
    IntegerField('top_entry_count_setting',
        searchable=0,
        default=1,
        widget=SelectionWidget(label='Entries per page',
                    description='',
                    label_msgid='label_top_entry_count_setting',
                    description_msgid='help_top_entry_count_setting',
                    i18n_domain='plone',
                    ),
        vocabulary=IntDisplayList((
PBConversationBaseBTreeFolderSchema = BaseBTreeFolderSchema.copy()
PBConversationBaseBTreeFolderSchema['title'].read_permission = ViewBoard
PBConversationBaseBTreeFolderSchema['title'].write_permission = EditComment

schema = PBConversationBaseBTreeFolderSchema + Schema((
    TextField(
            'description',
            searchable=1,
            read_permission=ViewBoard,
            write_permission=EditComment,
            default_content_type='text/plain',
            default_output_type='text/plain',
            widget=TextAreaWidget(
                description="Enter a brief description of the conversation.",
                description_msgid="help_description_conversation",
                label="Description",
                label_msgid="label_description_conversation",
                i18n_domain="ploneboard",
                rows=5)
        ),
    ))
utils.finalizeSchema(schema)


class PloneboardConversation(BrowserDefaultMixin, BaseBTreeFolder):
    """Conversation contains comments."""

    implements(IConversation, INonStructuralFolder)
    meta_type = 'PloneboardConversation'
    schema = schema
    _at_rename_after_creation = True
            label='Price',
            description='Price for your item -- do NOT include currency symbols!',
            label_msgid='label_price',
            description_msgid='help_price',
            i18n_domain='simplecartitem',
        ),
        validator='isDecimal',
    ),

    TextField(
        name = 'description',
        searchable = True,
        widget = TextAreaWidget(
            label='Basic Description',
            description='Short description of the item; it will show up in listing views.',
            allow_file_upload = False,
            label_msgid='label_description',
            description_msgid='help_description',
            i18n_domain='simplecartitem',
        ),
        isMetadata=True,
        accessor='Description', 
        default_output_type='text/plain',
        allowable_content_types=('text/plain',),
    ),

    TextField(
        name = 'short_description',
        searchable = True,
        widget=RichWidget(
            label='Extended Description',
            description='Detailed description of the item.',
Exemplo n.º 27
0
        schemata="Accreditation",
        widget=ImageWidget(
            label=_("Accreditation Logo"),
            description=_(
                "Please upload the logo you are authorised to use on your "
                "website and results reports by your accreditation body. "
                "Maximum size is 175 x 175 pixels.")),
    ),
    TextField(
        "AccreditationPageHeader",
        schemata="Accreditation",
        default=DEFAULT_ACCREDITATION_PAGE_HEADER,
        widget=TextAreaWidget(
            label=_("Accreditation page header"),
            description=_(
                "Enter the details of your lab's service accreditations here. "
                "The following fields are available:  lab_is_accredited, "
                "lab_name, lab_country, confidence, accreditation_body_name, "
                "accreditation_standard, accreditation_reference<br/>"),
            rows=10),
    ),
))

IdField = schema["id"]
IdField.widget.visible = {"edit": "hidden", "view": "invisible"}

schema["Name"].validators = ()
# Update the validation layer after change the validator in runtime
schema["Name"]._validationLayer()


class Laboratory(UniqueObject, Organisation):
Exemplo n.º 28
0
from Products.Archetypes.public import TextField
from Products.Archetypes.public import registerType
from Products.OrderableReferenceField import OrderableReferenceField
from Products.PloneGazette.config import PROJECTNAME
from archetypes.referencebrowserwidget import ReferenceBrowserWidget

NewsletterReferenceSchema = BaseSchema.copy() + Schema((
    TextField('description',
              default='',
              searchable=1,
              isMetadata=1,
              accessor="Description",
              widget=TextAreaWidget(
                  description='An administrative summary of the content',
                  description_msgid='help_description',
                  i18n_domain="plone",
                  label='Description',
                  label_msgid='label_description',
              )),
    OrderableReferenceField(
        'references',
        languageIndependent=1,
        required=0,
        allowed_types=(),
        multiValued=1,
        relationship='references',
        widget=ReferenceBrowserWidget(
            allow_browse=1,
            allow_search=1,
            allow_sorting=1,
            description='Select one or more remote objects',
Exemplo n.º 29
0
                 label="Occupation",
                 description="What is your occupation?",
             )),
 StringField('referrer',
             vocabulary=REFERRERS,
             widget=SelectionWidget(
                 label="Referrer",
                 description="How did you hear about Connexions?",
             )),
 TextField(
     'description',
     required=1,
     default_content_type='text/html',
     default_output_type='text/html',
     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?",
            description='',
            label_msgid="label_coreblog_comment_url",
            description_msgid="help_coreblog_comment_url",
            i18n_domain="plone",
            size=60),
        ),

    TextField('body',
        searchable=True,
        primary=True,
        index='TextIndex',
        default_output_type='text/html',
        default_content_type='text/plain',
        widget=TextAreaWidget(label='Body',
            description='',
            label_msgid="label_coreblog_comment_body",
            description_msgid="help_coreblog_comment_body",
            i18n_domain="plone",
            cols=40,rows=5),
        ),

    StringField('post_ip',
        searchable=True,
        index='FieldIndex',
        widget=StringWidget(label='IP',
            description='',
            label_msgid="label_coreblog_comment_post_ip",
            description_msgid="help_coreblog_comment_post_ip",
            i18n_domain="plone",
            size=60),
        ),