class IAddTaskSchema(ITask): """Define a schema for adding tasks.""" form.widget('responsible', KeywordFieldWidget, async=True) model.fieldset( u'additional', fields=[u'tasktemplate_position'], ) form.widget( 'responsible', KeywordFieldWidget, async=True, template_selection='usersAndGroups', template_result='usersAndGroups', ) responsible = schema.List( title=_(u"label_responsible", default=u"Responsible"), description=_(u"help_responsible", default=""), value_type=schema.Choice( source=AllUsersInboxesAndTeamsSourceBinder(include_teams=True), ), required=True, missing_value=[], default=[] ) tasktemplate_position = schema.Int( title=_(u"label_tasktemplate_position", default=u"Tasktemplate Position"), required=False, )
class IForwardingAssignSchema(IAssignSchema): responsible = schema.Choice( title=task_mf(u"label_responsible", default=u"Responsible"), description=task_mf(u"help_responsible", default=""), source=AllUsersInboxesAndTeamsSourceBinder(), required=True, )
class IAddTaskSchema(ITask): form.widget('responsible', KeywordFieldWidget, async=True) responsible = schema.List( title=_(u"label_responsible", default=u"Responsible"), description=_(u"help_responsible_multiple", default=""), value_type=schema.Choice(source=AllUsersInboxesAndTeamsSourceBinder( include_teams=True)), required=True, missing_value=[], default=[])
class INewForwardingResponsibleSchema(Schema): responsible = schema.Choice( title=task_mf(u"label_responsible", default=u"Responsible"), description=task_mf(u"help_responsible", default=""), source=AllUsersInboxesAndTeamsSourceBinder(include_teams=True), required=True, ) responsible_client = schema.Choice( title=task_mf(u'label_resonsible_client', default=u'Responsible Client'), description=task_mf(u'help_responsible_client', default=u''), vocabulary='opengever.ogds.base.OrgUnitsVocabularyFactory', required=True)
class INewResponsibleSchema(Schema): responsible = schema.Choice( title=_(u"label_responsible", default=u"Responsible"), description=_(u"help_responsible", default=""), source=AllUsersInboxesAndTeamsSourceBinder( only_current_inbox=True, only_current_orgunit=True, include_teams=True), required=True) 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)
class ISelectRecipientsSchema(Schema): form.widget('responsibles', KeywordFieldWidget, async=True) responsibles = schema.List( title=_(u'delegate_label_responsibles', default=u'Responsibles'), description=_( u'delegate_help_responsible', default=u'Select one or more responsibles. For each selected ' u'responsible a subtask will be created and assigned.'), required=True, missing_value=[], value_type=schema.Choice(source=AllUsersInboxesAndTeamsSourceBinder())) documents = schema.List( title=_(u'delegate_label_documents', default=u'Attach documents'), description=_(u'Select the related documents you wish to attach ' u'to the new subtasks.'), required=False, value_type=schema.Choice( source=vocabulary.attachable_documents_vocabulary))
class IForwarding(ITask): """Schema interface for forwardings. """ # common fieldset form.omitted('task_type') # only hide relatedItems - we need it for remembering which documents # should be moved after creation when creating forwarding from tabbed view. form.mode(relatedItems=HIDDEN_MODE) # additional fieldset form.omitted('expectedStartOfWork') form.omitted('expectedDuration') form.omitted('expectedCost') form.omitted('effectiveDuration') form.omitted('effectiveCost') # only hide date_of_completion, it's used form.mode(date_of_completion=HIDDEN_MODE) # make sure hidden field is not rendered in its own empty fieldset by # moving it to the form's first position before title form.order_before(date_of_completion='title') # deadline is not required deadline = schema.Date( title=task_mf(u"label_deadline", default=u"Deadline"), description=task_mf(u"help_deadline", default=u""), required=False, ) form.widget('responsible', KeywordFieldWidget, async=True) responsible = schema.Choice( title=_(u"label_responsible", default=u"Responsible"), description=_(u"help_responsible", default=""), source=AllUsersInboxesAndTeamsSourceBinder( only_current_orgunit=True, include_teams=True), required=True, )
class IAssignSchema(form.Schema): """ Form schema interface for assign wizard which makes it possible to a task to another person. """ # hidden transition = schema.Choice( title=_("label_transition", default="Transition"), source=getTransitionVocab, required=True, ) responsible = schema.Choice( title=_(u"label_responsible", default=u"Responsible"), description=_(u"help_responsible_single_client_setup", default=""), source=AllUsersInboxesAndTeamsSourceBinder(only_current_inbox=True, only_current_orgunit=True), required=True, ) text = schema.Text( title=_('label_response', default="Response"), required=False, )
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'))
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)