class Workspaces(BaseCatalogListingTab): types = ['opengever.workspace.workspace'] columns = ({ 'column': 'Title', 'column_title': _(u'label_title', default=u'Title'), 'sort_index': 'sortable_title', 'transform': linked, 'width': 500 }, { 'column': 'Description', 'column_title': _(u'label_description', default=u"Description"), 'width': 400 })
class WorkspaceRootTabbedView(GeverTabbedView): workspaces_tab = { 'id': 'workspaces', 'title': _(u'label_workspaces', default=u'Workspaces'), } def _get_tabs(self): return filter(None, [ self.workspaces_tab, ])
class IToDoSchema(model.Schema): dexteritytextindexer.searchable('title') title = schema.TextLine(title=_(u'label_title', default='Title'), required=True) dexteritytextindexer.searchable('text') text = schema.Text(title=_(u'label_text', default='Text'), required=False) form.widget('responsible', KeywordFieldWidget, async=True) responsible = schema.Choice( title=_('label_responsible', default='Responsible'), source=ActualWorkspaceMembersSourceBinder(), required=False, ) deadline = schema.Date(title=_(u'label_deadline', default='Deadline'), required=False) completed = schema.Bool(title=_(u'label_completed', default='Completed'), default=False, required=False)
class WorkspaceTabbedView(GeverTabbedView): """Define the tabs available on a Workspace.""" overview_tab = { 'id': 'overview', 'title': _(u'label_overview', default=u'Overview'), } documents_tab = { 'id': 'documents-proxy', 'title': _(u'label_documents', default=u'Documents'), } tasks_tab = { 'id': 'tasks', 'title': _(u'label_tasks', default=u'Tasks'), } trash_tab = { 'id': 'trash', 'title': _(u'label_trash', default=u'Trash'), } journal_tab = { 'id': 'journal', 'title': _(u'label_journal', default=u'Journal'), } def _get_tabs(self): return filter(None, [ self.overview_tab, self.documents_tab, self.tasks_tab, self.trash_tab, self.journal_tab, ])
class WorkspaceTabbedView(GeverTabbedView): """Define the tabs available on a Workspace.""" folders_tab = { 'id': 'folders', 'title': _(u'label_folders', default=u'Folders'), } documents_tab = { 'id': 'documents-proxy', 'title': _(u'label_documents', default=u'Documents'), } todo_tab = { 'id': 'todos', 'title': _(u'label_todo', default=u'ToDo'), } trash_tab = { 'id': 'trash', 'title': _(u'label_trash', default=u'Trash'), } journal_tab = { 'id': 'journal', 'title': _(u'label_journal', default=u'Journal'), } def _get_tabs(self): return filter(None, [ self.folders_tab, self.documents_tab, self.todo_tab, self.trash_tab, self.journal_tab, ])
class Workspaces(Dossiers): filterlist_available = False major_actions = [] enabled_actions = [] columns = ( {'column': 'reference', 'column_title': _(u'label_reference', default=u'Reference Number'), 'width': 120}, {'column': 'Title', 'column_title': _(u'label_title', default=u'Title'), 'sort_index': 'sortable_title', 'transform': linked, 'width': 500}, {'column': 'responsible', 'column_title': _(u'label_dossier_responsible', default=u"Responsible"), 'transform': readable_ogds_author, 'width': 300} )
def get_invitations(self): userid = api.user.get_current().getId() target_title = _(u'Deleted Workspace') entries = list(self.storage().iter_invitions_for_recipient(userid)) entries.sort(key=lambda item: item['created']) for entry in entries: with elevated_privileges(): target = uuidToObject(entry['target_uuid']) if target: target_title = target.Title() if target: inviter = PloneUserActor(entry['inviter'], user=api.user.get(entry['inviter'])) yield {'inviter': inviter.get_label(), 'target_title': target_title, 'iid': entry['iid']}
def get_invitations(self): userid = api.user.get_current().getId() target_title = _(u'Deleted Workspace') entries = list(self.storage().iter_invitions_for_recipient(userid)) entries.sort(key=lambda item: item['created']) for entry in entries: with elevated_privileges(): target = uuidToObject(entry['target_uuid']) if target: target_title = target.Title() if target: inviter = PloneUserActor(entry['inviter'], user=api.user.get(entry['inviter'])) yield { 'inviter': inviter.get_label(), 'target_title': target_title, 'iid': entry['iid'] }
def translations(self): return json.dumps({ 'label_placeholder': translate(_('Select a user ...'), context=self.request), 'label_no_result': translate(KWMF('No result found'), context=self.request), 'label_searching': translate(KWMF(u'Searching...'), context=self.request), 'label_loading_more': translate(KWMF('Load more results...'), context=self.request), 'label_tooshort_prefix': translate(KWMF('Please enter '), context=self.request), 'label_tooshort_postfix': translate(KWMF(' or more characters'), context=self.request), 'workspaceguest': translate(_('WorkspaceGuest'), context=self.request), 'workspacemember': translate(_('WorkspaceMember'), context=self.request), 'workspaceadmin': translate(_('WorkspaceAdmin'), context=self.request), 'workspaceowner': translate(_('WorkspaceOwner'), context=self.request), 'user': translate(_('User'), context=self.request), 'type': translate(_('Type'), context=self.request), 'role': translate(_('Rolle'), context=self.request), 'action': translate(_('Action'), context=self.request), 'delete_action': translate(_('Delete'), context=self.request), 'type_invitation': translate(_('Invitation'), context=self.request), 'type_user': translate(_('User'), context=self.request), 'invite': translate(_('Invite'), context=self.request), 'invited_by': translate(_('Invited by:'), context=self.request), 'message_updated': translate(_('Role updated'), context=self.request), 'message_invited': translate(_('Participant invited'), context=self.request), 'message_deleted': translate(_('Participant deleted'), context=self.request), })
class IToDoListSchema(model.Schema): dexteritytextindexer.searchable('title') title = schema.TextLine(title=_(u'label_title', default='Title'), required=True)
from zope.i18n import translate from opengever.workspace import _ class ParticipationRole(object): def __init__(self, id_, title, managed): self.id = id_ self.title = title self.managed = managed def translated_title(self, request): return translate(self.title, context=request) WORKSPCAE_GUEST = ParticipationRole('WorkspaceGuest', _('WorkspaceGuest', default="Guest"), True) WORKSPCAE_MEMBER = ParticipationRole('WorkspaceMember', _('WorkspaceMember', default="Member"), True) WORKSPCAE_ADMIN = ParticipationRole('WorkspaceAdmin', _('WorkspaceAdmin', default="Admin"), True) WORKSPCAE_OWNER = ParticipationRole('WorkspaceOwner', _('WorkspaceOwner', default="Owner"), False) PARTICIPATION_ROLES = { WORKSPCAE_GUEST.id: WORKSPCAE_GUEST, WORKSPCAE_OWNER.id: WORKSPCAE_OWNER, WORKSPCAE_ADMIN.id: WORKSPCAE_ADMIN, WORKSPCAE_MEMBER.id: WORKSPCAE_MEMBER }