Ejemplo n.º 1
0
class IUpdateMetadata(Schema):

    title = schema.TextLine(title=_(u'label_title', default=u'Title'),
                            description=_('help_title', default=u''),
                            required=True)

    issuer = schema.Choice(title=_(u"label_issuer", default=u"Issuer"),
                           source=UsersContactsInboxesSourceBinder(),
                           required=True)

    deadline = schema.Date(title=_(u"label_deadline", default=u"Deadline"),
                           description=_(u"help_deadline", default=u""),
                           required=True)

    text = schema.Text(title=_(u"label_text", default=u"Text"),
                       description=_(u"help_text", default=u""),
                       required=False)
Ejemplo n.º 2
0
class IParticipation(form.Schema):
    """ Participation Form schema
    """

    contact = schema.Choice(
        title=_(u'label_contact', default=u'Contact'),
        description=_(u'help_contact', default=u''),
        source=UsersContactsInboxesSourceBinder(),
        required=True,
    )

    roles = schema.List(
        title=_(u'label_roles', default=u'Roles'),
        value_type=schema.Choice(source=wrap_vocabulary(
            'opengever.dossier.participation_roles',
            visible_terms_from_registry='opengever.dossier'
            '.interfaces.IDossierParticipants.roles'), ),
        required=True,
        missing_value=[],
        default=[],
    )
Ejemplo n.º 3
0
class ITask(model.Schema):
    """Define the task schema."""

    model.fieldset(
        u'common',
        label=_(u'fieldset_common', default=u'Common'),
        fields=[
            u'title',
            u'issuer',
            u'task_type',
            u'responsible_client',
            u'responsible',
            u'is_private',
            u'revoke_permissions',
            u'deadline',
            u'text',
            u'relatedItems',
            ],
        )

    model.fieldset(
        u'additional',
        label=_(u'fieldset_additional', u'Additional'),
        fields=[
            u'expectedStartOfWork',
            u'expectedDuration',
            u'expectedCost',
            u'effectiveDuration',
            u'effectiveCost',
            u'date_of_completion',
            ],
        )

    dexteritytextindexer.searchable('title')

    title = schema.TextLine(
        title=_(u"label_title", default=u"Title"),
        description=_('help_title', default=u""),
        required=True,
        max_length=256,
        )

    form.widget('issuer', KeywordFieldWidget, async=True)

    issuer = schema.Choice(
        title=_(u"label_issuer", default=u"Issuer"),
        source=UsersContactsInboxesSourceBinder(),
        required=True,
        )

    form.widget(task_type='z3c.form.browser.radio.RadioFieldWidget')

    task_type = schema.Choice(
        title=_(u'label_task_type', default=u'Task Type'),
        description=_('help_task_type', default=u''),
        required=True,
        readonly=False,
        default=None,
        missing_value=None,
        source=util.getTaskTypeVocabulary,
        )

    form.mode(responsible_client='hidden')

    responsible_client = schema.Choice(
        title=_(
            u'label_resonsible_client',
            default=u'Responsible Client',
            ),
        description=_(
            u'help_responsible_client',
            default=u'',
            ),
        vocabulary='opengever.ogds.base.OrgUnitsVocabularyFactory',
        required=True,
        )

    form.widget('responsible', KeywordFieldWidget, async=True)

    responsible = schema.Choice(
        title=_(u"label_responsible", default=u"Responsible"),
        description=_(u"help_responsible", default=""),
        source=AllUsersInboxesAndTeamsSourceBinder(include_teams=True),
        required=True,
        )

    form.widget(deadline=DatePickerFieldWidget)

    is_private = schema.Bool(
        title=_(u"label_is_private", default=u"Private task"),
        description=_(u"help_is_private",
                      default="Deactivates the inbox-group permission."),
        default=False,
        )

    form.mode(IEditForm, is_private=HIDDEN_MODE)

    revoke_permissions = schema.Bool(
        title=_(u"label_revoke_permissions",
                default=u"Revoke permissions."),
        description=_(u"help_revoke_permissions",
                      default="Revoke permissions when closing or reassigning task."),
        default=True,
        required=False,
        )

    deadline = schema.Date(
        title=_(u"label_deadline", default=u"Deadline"),
        description=_(u"help_deadline", default=u""),
        required=True,
        defaultFactory=deadline_default,
        )

    form.widget(date_of_completion=DatePickerFieldWidget)
    form.mode(IAddForm, date_of_completion=HIDDEN_MODE)

    date_of_completion = schema.Date(
        title=_(u"label_date_of_completion", default=u"Date of completion"),
        description=_(u"help_date_of_completion", default=u""),
        required=False,
        )

    dexteritytextindexer.searchable('text')
    text = schema.Text(
        title=_(u"label_text", default=u"Text"),
        description=_(u"help_text", default=u""),
        required=False,
        )

    relatedItems = RelationList(
        title=_(u'label_related_items', default=u'Related Items'),
        default=[],
        missing_value=[],
        value_type=RelationChoice(
            title=u"Related",
            source=DossierPathSourceBinder(
                portal_type=("opengever.document.document", "ftw.mail.mail"),
                navigation_tree_query={
                    'review_state': {'not': 'document-state-shadow'},
                    'object_provides': [
                        'opengever.dossier.behaviors.dossier.IDossierMarker',
                        'opengever.document.document.IDocumentSchema',
                        'opengever.task.task.ITask',
                        'ftw.mail.mail.IMail',
                        'opengever.meeting.proposal.IProposal',
                        ],
                    },
                ),
            ),
        required=False,
        )

    form.widget(expectedStartOfWork=DatePickerFieldWidget)

    expectedStartOfWork = schema.Date(
        title=_(u"label_expectedStartOfWork", default="Start with work"),
        required=False,
        )

    expectedDuration = schema.Float(
        title=_(u"label_expectedDuration", default="Expected duration", ),
        description=_(u"help_expectedDuration", default="Duration in h"),
        required=False,
        )

    expectedCost = schema.Float(
        title=_(u"label_expectedCost", default="expected cost"),
        description=_(u"help_expectedCost", default="Cost in CHF"),
        required=False,
        )

    effectiveDuration = schema.Float(
        title=_(u"label_effectiveDuration", default="effective duration"),
        description=_(u"help_effectiveDuration", default="Duration in h"),
        required=False,
        )

    effectiveCost = schema.Float(
        title=_(u"label_effectiveCost", default="effective cost"),
        description=_(u"help_effectiveCost", default="Cost in CHF"),
        required=False,
        )

    form.omitted('predecessor')
    predecessor = schema.TextLine(
        title=_(u'label_predecessor', default=u'Predecessor'),
        required=False)

    @invariant
    def private_task_is_not_changed_when_disabled(data):
        if not is_private_task_feature_enabled() and data.is_private:

            # Because the z3c.form.validator.Data object has implemented a
            # getattr fallback, which fetches the value from the context, we
            # need to check if the is_private value was part of the input-data.
            if 'is_private' in data._Data_data___:
                raise Invalid(_(u'error_private_task_feature_is_disabled',
                                default=u'The private task feature is disabled'))

    @invariant
    def revoke_permissions_is_not_changed_when_disabled(data):
        if not is_optional_task_permissions_revoking_enabled():
            # Because the z3c.form.validator.Data object has implemented a
            # getattr fallback, which fetches the value from the context, we
            # need to check if the revoke_permissions value was part of the input-data.
            if 'revoke_permissions' in data._Data_data___ and not data.revoke_permissions:
                raise Invalid(_(u'error_revoke_permissions_feature_is_disabled',
                                default=u'The revoke permissions feature is disabled'))
Ejemplo n.º 4
0
class IAdvancedSearch(directives_form.Schema):

    searchableText = schema.TextLine(
        title=_('label_searchable_text', default='Text'),
        description=_('help_searchable_text', default=''),
        required=False,
    )

    object_provides = schema.Choice(
        title=_('label_portal_type', default="Type"),
        description=_('help_portal_type',
                      default='Select the contenttype to be searched for.'),
        source=get_types,
        required=True,
    )

    # Dossier
    start_1 = schema.Date(
        title=_('label_start', default='Start date'),
        description=_('label_from', default='From'),
        required=False,
    )

    start_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    end_1 = schema.Date(
        title=_('label_end', default='End date'),
        description=_('label_from', default='From'),
        required=False,
    )

    end_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    reference = schema.TextLine(
        title=_('label_reference_number', default='Reference number'),
        description=_('help_reference_number', default=''),
        required=False,
    )

    sequence_number = schema.Int(
        title=_('label_sequence_number', default='Sequence number'),
        description=_('help_sequence_number', default=''),
        required=False,
    )

    responsible = schema.Choice(
        title=_('label_reponsible', default='Responsible'),
        source=AllUsersSourceBinder(),
        required=False,
    )

    dossier_review_state = schema.List(
        title=_('label_review_state', default='State'),
        value_type=schema.Choice(source=get_possible_dossier_states, ),
        required=False,
    )

    # Document
    receipt_date_1 = schema.Date(
        title=_('label_receipt_date', default='Receipt date'),
        description=_('label_from', default='From'),
        required=False,
    )

    receipt_date_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    delivery_date_1 = schema.Date(
        title=_('label_delivery_date', default='delivery date'),
        description=_('label_from', default='From'),
        required=False,
    )

    delivery_date_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    document_date_1 = schema.Date(
        title=_('label_document_date', default='Document Date'),
        description=_('label_from', default='From'),
        required=False,
    )

    document_date_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    document_author = schema.TextLine(
        title=_('label_document_author', default='Document author'),
        required=False,
    )

    checked_out = schema.Choice(
        title=_('label_checked_out', default='Checked out by'),
        source=AllUsersSourceBinder(),
        required=False,
    )

    trashed = schema.Bool(
        title=_('label_trashed', default='Also search in the recycle bin'),
        required=False,
    )

    # Task
    issuer = schema.Choice(
        title=_(u"label_issuer", default=u"Issuer"),
        description=_('help_issuer', default=u""),
        source=UsersContactsInboxesSourceBinder(),
        required=False,
    )

    deadline_1 = schema.Date(
        title=_('label_deadline', default='Deadline'),
        description=_('label_from', default='From'),
        required=False,
    )

    deadline_2 = schema.Date(
        title=u'',
        description=_('label_to', default='To'),
        required=False,
    )

    task_type = schema.Choice(
        title=_('label_tasktype', default=''),
        source=getTaskTypeVocabulary,
        required=False,
    )
    task_review_state = schema.List(
        title=_('label_review_state', default='State'),
        value_type=schema.Choice(source=get_possible_task_states, ),
        required=False,
    )
Ejemplo n.º 5
0
class ITask(model.Schema):
    """Define the task schema."""

    model.fieldset(
        u'common',
        label=_(u'fieldset_common', default=u'Common'),
        fields=[
            u'title',
            u'issuer',
            u'task_type',
            u'responsible_client',
            u'responsible',
            u'deadline',
            u'text',
            u'relatedItems',
        ],
    )

    model.fieldset(
        u'additional',
        label=_(u'fieldset_additional', u'Additional'),
        fields=[
            u'expectedStartOfWork',
            u'expectedDuration',
            u'expectedCost',
            u'effectiveDuration',
            u'effectiveCost',
            u'date_of_completion',
        ],
    )

    dexteritytextindexer.searchable('title')

    title = schema.TextLine(
        title=_(u"label_title", default=u"Title"),
        description=_('help_title', default=u""),
        required=True,
        max_length=256,
    )

    form.widget('issuer', KeywordFieldWidget, async=True)

    issuer = schema.Choice(
        title=_(u"label_issuer", default=u"Issuer"),
        source=UsersContactsInboxesSourceBinder(),
        required=True,
    )

    form.widget(task_type='z3c.form.browser.radio.RadioFieldWidget')

    task_type = schema.Choice(
        title=_(u'label_task_type', default=u'Task Type'),
        description=_('help_task_type', default=u''),
        required=True,
        readonly=False,
        default=None,
        missing_value=None,
        source=util.getTaskTypeVocabulary,
    )

    form.mode(responsible_client='hidden')

    responsible_client = schema.Choice(
        title=_(
            u'label_resonsible_client',
            default=u'Responsible Client',
        ),
        description=_(
            u'help_responsible_client',
            default=u'',
        ),
        vocabulary='opengever.ogds.base.OrgUnitsVocabularyFactory',
        required=True,
    )

    form.widget('responsible', KeywordFieldWidget, async=True)

    responsible = schema.Choice(
        title=_(u"label_responsible", default=u"Responsible"),
        description=_(u"help_responsible", default=""),
        source=AllUsersInboxesAndTeamsSourceBinder(include_teams=True),
        required=True,
    )

    form.widget(deadline=DatePickerFieldWidget)

    deadline = schema.Date(
        title=_(u"label_deadline", default=u"Deadline"),
        description=_(u"help_deadline", default=u""),
        required=True,
        defaultFactory=deadline_default,
    )

    form.widget(date_of_completion=DatePickerFieldWidget)
    form.mode(IAddForm, date_of_completion=HIDDEN_MODE)

    date_of_completion = schema.Date(
        title=_(u"label_date_of_completion", default=u"Date of completion"),
        description=_(u"help_date_of_completion", default=u""),
        required=False,
    )

    dexteritytextindexer.searchable('text')
    model.primary('text')

    text = schema.Text(
        title=_(u"label_text", default=u"Text"),
        description=_(u"help_text", default=u""),
        required=False,
    )

    relatedItems = RelationList(
        title=_(u'label_related_items', default=u'Related Items'),
        default=[],
        missing_value=[],
        value_type=RelationChoice(
            title=u"Related",
            source=DossierPathSourceBinder(
                portal_type=("opengever.document.document", "ftw.mail.mail"),
                navigation_tree_query={
                    'object_provides': [
                        'opengever.dossier.behaviors.dossier.IDossierMarker',
                        'opengever.document.document.IDocumentSchema',
                        'opengever.task.task.ITask',
                        'ftw.mail.mail.IMail',
                        'opengever.meeting.proposal.IProposal',
                    ],
                },
            ),
        ),
        required=False,
    )

    form.widget(expectedStartOfWork=DatePickerFieldWidget)

    expectedStartOfWork = schema.Date(
        title=_(u"label_expectedStartOfWork", default="Start with work"),
        required=False,
    )

    expectedDuration = schema.Float(
        title=_(
            u"label_expectedDuration",
            default="Expected duration",
        ),
        description=_(u"help_expectedDuration", default="Duration in h"),
        required=False,
    )

    expectedCost = schema.Float(
        title=_(u"label_expectedCost", default="expected cost"),
        description=_(u"help_expectedCost", default="Cost in CHF"),
        required=False,
    )

    effectiveDuration = schema.Float(
        title=_(u"label_effectiveDuration", default="effective duration"),
        description=_(u"help_effectiveDuration", default="Duration in h"),
        required=False,
    )

    effectiveCost = schema.Float(
        title=_(u"label_effectiveCost", default="effective cost"),
        description=_(u"help_effectiveCost", default="Cost in CHF"),
        required=False,
    )

    form.omitted('predecessor')
    predecessor = schema.TextLine(title=_(u'label_predecessor',
                                          default=u'Predecessor'),
                                  required=False)