class IRepositoryRoot(model.Schema): """ Repository root marker / schema interface """ model.fieldset( u'common', label=bmf(u'fieldset_common', default=u'Common'), fields=[ 'valid_from', 'valid_until', 'version', ], ) valid_from = schema.Date( title=_(u'label_valid_from', default=u'Valid from'), required=False, ) valid_until = schema.Date( title=_(u'label_valid_until', default=u'Valid until'), required=False, ) version = schema.TextLine( title=_(u'label_version', default=u'Version'), required=False, )
class RepositoryRootTabbedView(GeverTabbedView): """Define the tabs available on a Repository Root.""" overview_tab = { 'id': 'overview', 'title': _(u'label_overview', default=u'Overview'), } dossiers_tab = { 'id': 'dossiers', 'title': _(u'label_dossiers', default=u'Dossiers'), } info_tab = { 'id': 'sharing', 'title': _(u'label_info', default=u'Info'), } @property def dispositions_tab(self): if api.user.has_permission('opengever.disposition: Add disposition', obj=self.context): return { 'id': 'dispositions', 'title': _(u'label_dispositions', default=u'Dispositions'), } return None @property def journal_tab(self): if api.user.has_permission('Sharing page: Delegate roles', obj=self.context): return { 'id': 'journal', 'title': _(u'label_journal', default=u'Journal'), } return None @property def blocked_local_roles_tab(self): if api.user.has_permission('opengever.sharing: List Protected Objects', obj=self.context): return { 'id': 'blocked-local-roles', 'title': _(u'label_blocked_local_roles', default=u'Protected Objects'), } return None def _get_tabs(self): return filter(None, [ self.overview_tab, self.dossiers_tab, self.dispositions_tab, self.info_tab, self.blocked_local_roles_tab, self.journal_tab, ])
def bool_label(value): translater = StringTranslater(api.portal.get().REQUEST, 'opengever.repository').translate return ( translater(_(u'label_true', default='Yes')) if value else translater(_(u'label_false', default='No')) )
class RepositoryFolderTabbedView(GeverTabbedView): """Define the tabs available on a Repository Root.""" dossiers_tab = { 'id': 'dossiers', 'title': _(u'label_dossiers', default=u'Dossiers'), } info_tab = { 'id': 'sharing', 'title': _(u'label_info', default=u'Info'), } @property def blocked_local_roles_tab(self): if api.user.has_permission('opengever.sharing: List Protected Objects', obj=self.context): return { 'id': 'blocked-local-roles', 'title': _(u'label_blocked_local_roles', default=u'Protected Objects'), } return None @property def documents_tab(self): settings = getUtility(IRegistry).forInterface(IRepositoryFolderRecords) if not getattr(settings, 'show_documents_tab', False): return return { 'id': 'documents-proxy', 'title': _(u'label_documents', default=u'Documents'), } @property def tasks_tab(self): settings = getUtility(IRegistry).forInterface(IRepositoryFolderRecords) if not getattr(settings, 'show_tasks_tab', False): return return { 'id': 'tasks', 'title': _(u'label_tasks', default=u'Tasks'), } def _get_tabs(self): return filter(None, [ self.dossiers_tab, self.documents_tab, self.tasks_tab, self.info_tab, self.blocked_local_roles_tab, ])
class IResponsibleOrgUnit(form.Schema): form.fieldset( u'common', label=_(u'fieldset_common', default=u'Common'), fields=['responsible_org_unit'], ) responsible_org_unit = schema.TextLine( title=_( u'responsible_org_unit', default=u'Responsible organisation unit'), description=u'', required=False, )
class IResponsibleOrgUnit(model.Schema): model.fieldset( u'common', label=_(u'fieldset_common', default=u'Common'), fields=['responsible_org_unit'], ) responsible_org_unit = schema.TextLine( title=_(u'responsible_org_unit', default=u'Responsible organisation unit'), description=u'', max_length=UNIT_ID_LENGTH, required=False, )
class IReferenceNumberPrefix(form.Schema): form.fieldset( u'common', label=_(u'fieldset_common', default=u'Common'), fields=[ u'reference_number_prefix', ], ) reference_number_prefix = schema.TextLine( title=_(u'label_reference_number_prefix', default=u'Reference Prefix'), required=False, defaultFactory=reference_number_prefix_default, )
def blocked_local_roles_tab(self): if api.user.has_permission('opengever.sharing: List Protected Objects', obj=self.context): return { 'id': 'blocked-local-roles', 'title': _(u'label_blocked_local_roles', default=u'Protected Objects'), } return None
def journal_tab(self): if api.user.has_permission('Sharing page: Delegate roles', obj=self.context): return { 'id': 'journal', 'title': _(u'label_journal', default=u'Journal'), } return None
def get_items(self): return [ { 'class': 'review_state', 'label': _('label_workflow_state', default='State'), 'content': self.workflow_state(), 'replace': False }, { 'class': 'privacy_layer', 'label': base_messagefactory(u'label_privacy_layer', default=u'Privacy layer'), 'content': self.privacy_layer(), 'replace': False }, { 'class': 'archival_value', 'label': base_messagefactory(u'label_archival_value', default=u'Archival value'), 'content': self.archival_value(), 'replace': False }, ]
def dispositions_tab(self): if api.user.has_permission('opengever.disposition: Add disposition', obj=self.context): return { 'id': 'dispositions', 'title': _(u'label_dispositions', default=u'Dispositions'), } return None
def documents_tab(self): settings = getUtility(IRegistry).forInterface(IRepositoryFolderRecords) if getattr(settings, 'show_documents_tab', False): return { 'id': 'documents-proxy', 'title': _(u'label_documents', default=u'Documents'), } return None
def tasks_tab(self): settings = getUtility(IRegistry).forInterface(IRepositoryFolderRecords) if getattr(settings, 'show_tasks_tab', False): return { 'id': 'tasks', 'title': _(u'label_tasks', default=u'Tasks'), } return None
def free_reference_prefix(self, prefix_num): refs = ReferenceNumberPrefixAdpater(self.context) refs.free_number(prefix_num) notify(RepositoryPrefixUnlocked(self.context, prefix_num)) messages = IStatusMessage(self.request) messages.add(_("statmsg_prefix_unlocked", default=u"Reference prefix has been unlocked."), type=u"info")
def free_reference_prefix(self, prefix_num): refs = ReferenceNumberPrefixAdpater(self.context) if refs.is_prefix_used(prefix_num): api.portal.show_message( _(u'statmsg_prefix_unlock_failure', default='The reference you try to unlock is still in use.'), request=self.request, type="error") return refs.free_number(prefix_num) notify(RepositoryPrefixUnlocked(self.context, prefix_num)) api.portal.show_message( _("statmsg_prefix_unlocked", default=u"Reference prefix has been unlocked."), request=self.request, type="info")
class IRepositoryRoot(form.Schema): """ Repository root marker / schema interface """ valid_from = schema.Date( title=_(u'label_valid_from', default=u'Valid from'), required=False, ) valid_until = schema.Date( title=_(u'label_valid_until', default=u'Valid until'), required=False, ) version = schema.TextLine( title=_(u'label_version', default=u'Version'), required=False, )
def __call__(self): data = generate_report(self.request, self.context) if not data: msg = StringTranslater(self.request, 'opengever.repository').translate(_(u'Could not generate the report.')) IStatusMessage(self.request).addStatusMessage(msg, type='error') return self.request.RESPONSE.redirect(self.context.absolute_url()) response = self.request.RESPONSE response.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') set_attachment_content_disposition(self.request, "repository_report.xlsx") return data
def proposals_tab(self): meeting_settings = getUtility(IRegistry).forInterface(IMeetingSettings) meeting_enabled = getattr(meeting_settings, 'is_feature_enabled', False) repository_settings = getUtility(IRegistry).forInterface(IRepositoryFolderRecords) proposals_tab_enabled = getattr(repository_settings, 'show_proposals_tab', False) if meeting_enabled and proposals_tab_enabled: return { 'id': 'proposals', 'title': _(u'label_proposals', default=u'Proposals'), } return None
def render(self): if self.contains_dossiers(): msg = _('msg_leafnode_warning', default=u'You are adding a repositoryfolder to a leafnode ' 'which already contains dossiers. This is only ' 'temporarily allowed and all dossiers must be moved into ' 'a new leafnode afterwards.') api.portal.show_message(msg, request=self.request, type='warning') return super(AddForm, self).render()
def render(self): if self.contains_dossiers(): msg = _('msg_leafnode_warning', default=u'You are adding a repositoryfolder to a leafnode ' 'which already contains dossiers. This is only ' 'temporarily allowed and all dossiers must be moved into ' 'a new leafnode afterwards.') api.portal.show_message( msg, request=self.request, type='warning') return super(AddForm, self).render()
def get_items(self): return [ {'class': 'review_state', 'label': _('label_workflow_state', default='State'), 'content': self.workflow_state(), 'replace': False}, {'class': 'privacy_layer', 'label': base_messagefactory(u'label_privacy_layer', default=u'Privacy layer'), 'content': self.privacy_layer(), 'replace': False}, ]
def proposals_tab(self): meeting_settings = getUtility(IRegistry).forInterface(IMeetingSettings) meeting_enabled = getattr(meeting_settings, 'is_feature_enabled', False) repository_settings = getUtility(IRegistry).forInterface( IRepositoryFolderRecords) proposals_tab_enabled = getattr(repository_settings, 'show_proposals_tab', False) if meeting_enabled and proposals_tab_enabled: return { 'id': 'proposals', 'title': _(u'label_proposals', default=u'Proposals'), } return None
def __call__(self): data = generate_report(self.request, self.context) if not data: msg = StringTranslater(self.request, 'opengever.repository').translate( _(u'Could not generate the report.')) IStatusMessage(self.request).addStatusMessage(msg, type='error') return self.request.RESPONSE.redirect(self.context.absolute_url()) response = self.request.RESPONSE response.setHeader( 'Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) set_attachment_content_disposition(self.request, "repository_report.xlsx") return data
def get_items(self): return [ {'class': 'review_state', 'label': _('label_workflow_state', default='State'), 'content': self.workflow_state(), 'replace': False}, {'class': 'privacy_layer', 'label': base_messagefactory(u'label_privacy_layer', default=u'Privacy layer'), 'content': self.privacy_layer(), 'replace': False}, {'class': 'public_trial', 'label': base_messagefactory(u'label_public_trial', default=u'Public Trial'), 'content': self.public_trial(), 'replace': False}, ]
def get_items(self): return [ { "class": "review_state", "label": _("label_workflow_state", default="State"), "content": self.workflow_state(), "replace": False, }, { "class": "privacy_layer", "label": base_messagefactory(u"label_privacy_layer", default=u"Privacy layer"), "content": self.privacy_layer(), "replace": False, }, { "class": "public_trial", "label": base_messagefactory(u"label_public_trial", default=u"Public Trial"), "content": self.public_trial(), "replace": False, }, ]
def __call__(self): self.parent = aq_parent(aq_inner(self.context)) deleter = RepositoryDeleter(self.context) if not deleter.is_deletion_allowed(): raise Unauthorized if self.request.get("form.buttons.cancel"): return self.redirect_back() elif self.request.get("form.buttons.delete"): # Made form CSRF save if not self.request.method.lower() == "post": raise Unauthorized deleter.delete() msg = _(u"label_successfully_deleted", default=u"The repository have been successfully deleted.") IStatusMessage(self.request).addStatusMessage(msg, type="info") return self.redirect_to_parent() return super(RepositoryDeletionView, self).__call__()
def __call__(self): self.parent = aq_parent(aq_inner(self.context)) deleter = RepositoryDeleter(self.context) if not deleter.is_deletion_allowed(): raise Unauthorized if self.request.get('form.buttons.cancel'): return self.redirect_back() elif self.request.get('form.buttons.delete'): # Made form CSRF save if not self.request.method.lower() == 'post': raise Unauthorized deleter.delete() msg = _(u'label_successfully_deleted', default=u'The repository have been successfully deleted.') IStatusMessage(self.request).addStatusMessage(msg, type='info') return self.redirect_to_parent() return super(RepositoryDeletionView, self).__call__()
def generate_report(request, context): # Translations from opengever.base base_translater = StringTranslater(request, 'opengever.base').translate label_classification = base_translater(u'label_classification') label_privacy_layer = base_translater(u'label_privacy_layer') label_public_trial = base_translater(u'label_public_trial') label_retention_period = base_translater(u'label_retention_period') label_retention_period_annotation = base_translater( u'label_retention_period_annotation') label_archival_value = base_translater(u'label_archival_value') label_archival_value_annotation = base_translater( u'label_archival_value_annotation') label_custody_period = base_translater(u'label_custody_period') # Translations local to opengever.repository repository_translater = StringTranslater(request, 'opengever.repository').translate label_valid_from = repository_translater(u'label_valid_from') label_valid_until = repository_translater(u'label_valid_until') # Translations defined here for opengever.repository label_repository_number = repository_translater( _( u'label_repository_number', default=u'Repository number', )) label_repositoryfolder_title_de = repository_translater( _( u'label_repositoryfolder_title_de', default=u'Repositoryfolder title (German)', )) label_repositoryfolder_title_fr = repository_translater( _( u'label_repositoryfolder_title_fr', default=u'Repositoryfolder title (French)', )) label_repositoryfolder_description = repository_translater( _( u'label_repositoryfolder_description', default=u'Repositoryfolder description', )) label_blocked_inheritance = repository_translater( _( u'label_blocked_inheritance', default=u'Blocked inheritance', )) label_groupnames_with_reader_role = repository_translater( _( u'label_groupnames_with_reader_role', default=u'Read dossiers', )) label_groupnames_with_contributor_role = repository_translater( _( u'label_groupnames_with_contributor_role', default=u'Create dossiers', )) label_groupnames_with_editor_role = repository_translater( _( u'label_groupnames_with_editor_role', default=u'Edit dossiers', )) label_groupnames_with_reviewer_role = repository_translater( _( u'label_groupnames_with_reviewer_role', default=u'Close dossiers', )) label_groupnames_with_publisher_role = repository_translater( _( u'label_groupnames_with_publisher_role', default=u'Reactivate dossiers', )) label_groupnames_with_manager_role = repository_translater( _( u'label_groupnames_with_manager_role', default=u'Manage dossiers', )) column_map = ( { 'id': 'get_repository_number', 'title': label_repository_number, 'fold_by_method': repository_number_to_outine_level, 'callable': True }, # noqa { 'id': 'title_de', 'title': label_repositoryfolder_title_de }, { 'id': 'title_fr', 'title': label_repositoryfolder_title_fr }, { 'id': 'description', 'title': label_repositoryfolder_description }, { 'id': 'classification', 'title': label_classification, 'transform': base_translater, 'default': u'' }, { 'id': 'privacy_layer', 'title': label_privacy_layer, 'transform': base_translater, 'default': u'' }, { 'id': 'public_trial', 'title': label_public_trial, 'transform': base_translater, 'default': u'' }, { 'id': 'get_retention_period', 'title': label_retention_period, 'callable': True, 'default': u'' }, { 'id': 'get_retention_period_annotation', 'title': label_retention_period_annotation, 'callable': True, 'default': u'' }, # noqa { 'id': 'get_archival_value', 'title': label_archival_value, 'transform': base_translater, 'callable': True, 'default': u'' }, # noqa { 'id': 'get_archival_value_annotation', 'title': label_archival_value_annotation, 'callable': True, 'default': u'' }, { 'id': 'get_custody_period', 'title': label_custody_period, 'callable': True, 'default': u'' }, { 'id': 'valid_from', 'title': label_valid_from }, { 'id': 'valid_until', 'title': label_valid_until }, { 'id': '__ac_local_roles_block__', 'title': label_blocked_inheritance, 'transform': bool_label, 'default': False }, { 'id': 'get_groupnames_with_reader_role', 'title': label_groupnames_with_reader_role, 'callable': True }, { 'id': 'get_groupnames_with_contributor_role', 'title': label_groupnames_with_contributor_role, 'callable': True }, { 'id': 'get_groupnames_with_editor_role', 'title': label_groupnames_with_editor_role, 'callable': True }, { 'id': 'get_groupnames_with_reviewer_role', 'title': label_groupnames_with_reviewer_role, 'callable': True }, { 'id': 'get_groupnames_with_publisher_role', 'title': label_groupnames_with_publisher_role, 'callable': True }, { 'id': 'get_groupnames_with_manager_role', 'title': label_groupnames_with_manager_role, 'callable': True }, ) # We sort these by reference number to preserve user experienced ordering active_formatter = api.portal.get_registry_record( name='formatter', interface=IReferenceNumberSettings) formatter = queryAdapter(api.portal.get(), IReferenceNumberFormatter, name=active_formatter) repository_brains = sorted( api.content.find(context, object_provides=IRepositoryFolder.__identifier__), key=formatter.sorter, ) repository_folders = [context] + [ brain.getObject() for brain in repository_brains ] # XXX - the excel importer expects 4 non-meaningful rows return XLSReporter( request, column_map, repository_folders, sheet_title=repository_translater(u'RepositoryRoot'), blank_header_rows=4, )()
if IAddForm.providedBy(self.view.parentForm): if not PrefixAdapter(self.context).is_valid_number(value): raise schema.interfaces.ConstraintNotSatisfied() else: parent = aq_parent(aq_inner(self.context)) if not PrefixAdapter(parent).is_valid_number(value, self.context): raise schema.interfaces.ConstraintNotSatisfied() validator.WidgetValidatorDiscriminators( ReferenceNumberPrefixValidator, field=IReferenceNumberPrefix['reference_number_prefix'], ) ReferenceNumberPrefixErrorMessage = error.ErrorViewMessage( _('error_sibling_reference_number_existing', default=u'A Sibling with the same reference number is existing.'), error=schema.interfaces.ConstraintNotSatisfied, field=IReferenceNumberPrefix['reference_number_prefix'], ) class IReferenceNumberPrefixMarker(Interface): """ Marker Interface for the ReferenceNumber-Prefix Behavior """ def saveReferenceNumberPrefix(obj, event): """When an object providing IReferenceNumberPrefixMarker (repository folders) gets added or has been modified, make sure it has a unique reference number prefix.
raise schema.interfaces.ConstraintNotSatisfied() else: parent = aq_parent(aq_inner(self.context)) if not PrefixAdapter(parent).is_valid_number(value, self.context): raise schema.interfaces.ConstraintNotSatisfied() validator.WidgetValidatorDiscriminators( ReferenceNumberPrefixValidator, field=IReferenceNumberPrefix['reference_number_prefix'], ) provideAdapter(ReferenceNumberPrefixValidator) provideAdapter(error.ErrorViewMessage( _('error_sibling_reference_number_existing', default=u'A Sibling with the same reference number is existing'), error=schema.interfaces.ConstraintNotSatisfied, field=IReferenceNumberPrefix['reference_number_prefix'], ), name='message' ) class IReferenceNumberPrefixMarker(Interface): """ Marker Interface for the ReferenceNumber-Prefix Behavior """ @grok.subscribe(IReferenceNumberPrefixMarker, IObjectAddedEvent) @grok.subscribe(IReferenceNumberPrefixMarker, IObjectModifiedEvent)
class IRepositoryFolderSchema(form.Schema): """ A Repository Folder """ form.fieldset( u'common', label=_(u'fieldset_common', default=u'Common'), fields=[ u'effective_title', u'description', u'valid_from', u'valid_until', u'location', u'referenced_activity', u'former_reference', ], ) #form.omitted('title') form.order_before(effective_title='*') effective_title = schema.TextLine( title=_(u'Title'), required=True, ) description = schema.Text( title=_(u'label_description', default=u'Description'), description=_( u'help_description', default=u'A short summary of the content.'), required=False, ) valid_from = schema.Date( title=_(u'label_valid_from', default=u'Valid from'), description=_(u'help_valid_from', default=u''), required=False, ) valid_until = schema.Date( title=_(u'label_valid_until', default=u'Valid until'), description=_(u'help_valid_until', default=u''), required=False, ) location = schema.TextLine( title=_(u'label_location', default=u'Location'), description=_(u'help_location', default=u''), required=False, ) referenced_activity = schema.TextLine( title=_( u'label_referenced_activity', default=u'Referenced activity'), description=_(u'help_referenced_activity', default=u''), required=False, ) former_reference = schema.TextLine( title=_(u'label_former_reference', default=u'Former reference'), description=_(u'help_former_reference', default=u''), required=False, ) addable_dossier_types = schema.List( title=_(u'label_addable_dossier_types', default=u'Addable dossier types'), description=_(u'help_addable_dossier_types', default=u'Select all additional dossier types which ' 'should be addable in this repository folder.'), value_type=schema.Choice(vocabulary=u'opengever.repository.' u'RestrictedAddableDossiersVocabulary'), required=False)
def generate_report(request, context): # Translations from opengever.base base_translater = StringTranslater(request, 'opengever.base').translate label_classification = base_translater(u'label_classification') label_privacy_layer = base_translater(u'label_privacy_layer') label_public_trial = base_translater(u'label_public_trial') label_retention_period = base_translater(u'label_retention_period') label_retention_period_annotation = base_translater(u'label_retention_period_annotation') label_archival_value = base_translater(u'label_archival_value') label_archival_value_annotation = base_translater(u'label_archival_value_annotation') label_custody_period = base_translater(u'label_custody_period') # Translations local to opengever.repository repository_translater = StringTranslater(request, 'opengever.repository').translate label_valid_from = repository_translater(u'label_valid_from') label_valid_until = repository_translater(u'label_valid_until') # Translations defined here for opengever.repository label_repository_number = repository_translater(_( u'label_repository_number', default=u'Repository number', )) label_repositoryfolder_title_de = repository_translater(_( u'label_repositoryfolder_title_de', default=u'Repositoryfolder title (German)', )) label_repositoryfolder_title_fr = repository_translater(_( u'label_repositoryfolder_title_fr', default=u'Repositoryfolder title (French)', )) label_repositoryfolder_description = repository_translater(_( u'label_repositoryfolder_description', default=u'Repositoryfolder description', )) label_blocked_inheritance = repository_translater(_( u'label_blocked_inheritance', default=u'Blocked inheritance', )) label_groupnames_with_reader_role = repository_translater(_( u'label_groupnames_with_reader_role', default=u'Read dossiers', )) label_groupnames_with_contributor_role = repository_translater(_( u'label_groupnames_with_contributor_role', default=u'Create dossiers', )) label_groupnames_with_editor_role = repository_translater(_( u'label_groupnames_with_editor_role', default=u'Edit dossiers', )) label_groupnames_with_reviewer_role = repository_translater(_( u'label_groupnames_with_reviewer_role', default=u'Close dossiers', )) label_groupnames_with_publisher_role = repository_translater(_( u'label_groupnames_with_publisher_role', default=u'Reactivate dossiers', )) label_groupnames_with_manager_role = repository_translater(_( u'label_groupnames_with_manager_role', default=u'Manage dossiers', )) column_map = ( {'id': 'get_repository_number', 'title': label_repository_number, 'fold_by_method': repository_number_to_outine_level, 'callable': True}, # noqa {'id': 'title_de', 'title': label_repositoryfolder_title_de}, {'id': 'title_fr', 'title': label_repositoryfolder_title_fr}, {'id': 'description', 'title': label_repositoryfolder_description}, {'id': 'classification', 'title': label_classification, 'transform': base_translater, 'default': u''}, {'id': 'privacy_layer', 'title': label_privacy_layer, 'transform': base_translater, 'default': u''}, {'id': 'public_trial', 'title': label_public_trial, 'transform': base_translater, 'default': u''}, {'id': 'get_retention_period', 'title': label_retention_period, 'callable': True, 'default': u''}, {'id': 'get_retention_period_annotation', 'title': label_retention_period_annotation, 'callable': True, 'default': u''}, # noqa {'id': 'get_archival_value', 'title': label_archival_value, 'transform': base_translater, 'callable': True, 'default': u''}, # noqa {'id': 'get_archival_value_annotation', 'title': label_archival_value_annotation, 'callable': True, 'default': u''}, {'id': 'get_custody_period', 'title': label_custody_period, 'callable': True, 'default': u''}, {'id': 'valid_from', 'title': label_valid_from}, {'id': 'valid_until', 'title': label_valid_until}, {'id': '__ac_local_roles_block__', 'title': label_blocked_inheritance, 'transform': bool_label, 'default': False}, {'id': 'get_groupnames_with_reader_role', 'title': label_groupnames_with_reader_role, 'callable': True}, {'id': 'get_groupnames_with_contributor_role', 'title': label_groupnames_with_contributor_role, 'callable': True}, {'id': 'get_groupnames_with_editor_role', 'title': label_groupnames_with_editor_role, 'callable': True}, {'id': 'get_groupnames_with_reviewer_role', 'title': label_groupnames_with_reviewer_role, 'callable': True}, {'id': 'get_groupnames_with_publisher_role', 'title': label_groupnames_with_publisher_role, 'callable': True}, {'id': 'get_groupnames_with_manager_role', 'title': label_groupnames_with_manager_role, 'callable': True}, ) # We sort these by reference number to preserve user experienced ordering active_formatter = api.portal.get_registry_record(name='formatter', interface=IReferenceNumberSettings) formatter = queryAdapter(api.portal.get(), IReferenceNumberFormatter, name=active_formatter) repository_brains = sorted( api.content.find(context, object_provides=IRepositoryFolder.__identifier__), key=formatter.sorter, ) repository_folders = [context] + [brain.getObject() for brain in repository_brains] # XXX - the excel importer expects 4 non-meaningful rows return XLSReporter( request, column_map, repository_folders, sheet_title=repository_translater(u'RepositoryRoot'), blank_header_rows=4, )()
class IRepositoryFolderSchema(form.Schema): """ A Repository Folder """ form.fieldset( u'common', label=_(u'fieldset_common', default=u'Common'), fields=[ u'description', u'valid_from', u'valid_until', u'location', u'referenced_activity', u'former_reference', ], ) description = schema.Text( title=_(u'label_description', default=u'Description'), description=_(u'help_description', default=u'A short summary of the content.'), required=False, missing_value=u'', ) valid_from = schema.Date( title=_(u'label_valid_from', default=u'Valid from'), required=False, ) valid_until = schema.Date( title=_(u'label_valid_until', default=u'Valid until'), required=False, ) location = schema.TextLine( title=_(u'label_location', default=u'Location'), required=False, ) referenced_activity = schema.TextLine( title=_(u'label_referenced_activity', default=u'Referenced activity'), required=False, ) former_reference = schema.TextLine( title=_(u'label_former_reference', default=u'Former reference'), required=False, ) form.widget(addable_dossier_types=CheckBoxFieldWidget) addable_dossier_types = schema.List( title=_(u'label_addable_dossier_types', default=u'Addable dossier types'), description=_(u'help_addable_dossier_types', default=u'Select all additional dossier types which ' 'should be addable in this repository folder.'), value_type=schema.Choice( vocabulary= u'opengever.repository.RestrictedAddableDossiersVocabulary'), required=False) allow_add_businesscase_dossier = schema.Bool( title=_(u'allow_add_businesscase_dossier', default=u'Allow add businesscase dossier'), description=_(u'description_allow_add_businesscase_dossier', default=u'Choose if the user is allowed to add ' u'businesscase dossiers or only dossiers from a ' u' dossiertemplate.'), required=False, missing_value=True, default=True, )
def bool_label(value): translater = StringTranslater(api.portal.get().REQUEST, 'opengever.repository').translate return (translater(_(u'label_true', default='Yes')) if value else translater(_(u'label_false', default='No')))