예제 #1
0
class Proposals(ProposalListingTab):
    """Recursively list proposals."""

    grok.name('tabbedview_view-proposals')
    grok.context(IDossierMarker)

    enabled_actions = []
    major_actions = []
    sort_on = 'title'
    show_selects = False

    template = ViewPageTemplateFile("generic_with_filters.pt")

    model = Proposal

    filterlist_name = 'proposal_state_filter'
    filterlist_available = True

    filterlist = FilterList(
        Filter('filter_all', _('label_tabbedview_filter_all')),
        ActiveProposalFilter('filter_active', _('Active'), default=True))

    def get_base_query(self):
        return Proposal.query.by_container(self.context,
                                           get_current_admin_unit())
예제 #2
0
def linked_version_preview(item, value):
    url = "{}/@@bumblebee-overlay-listing?version_id={}".format(
        item.url, item.version)

    showroom_title = translate(
        _('label_showroom_version_title',
            default='Version ${version} of ${timestamp}',
            mapping={'version': item.version, 'timestamp': item.timestamp}),
        context=getRequest()).encode('utf-8')

    data = {
        'url': url,
        'showroom_url': url,
        'showroom_title': showroom_title,
        'title': translate(
            _('label_preview', default='Preview'),
            context=getRequest()).encode('utf-8')
    }

    return """
    <div>
        <a class="showroom-item function-preview-pdf"
           href="{%(url)s}"
           data-showroom-target="%(showroom_url)s"
           data-showroom-title="%(showroom_title)s">%(title)s</a>
    </div>
    """ % data
예제 #3
0
def linked_version_preview(item, value):
    url = "{}/@@bumblebee-overlay-listing?version_id={}".format(
        item.url, item.version)

    showroom_title = translate(_('label_showroom_version_title',
                                 default='Version ${version} of ${timestamp}',
                                 mapping={
                                     'version': item.version,
                                     'timestamp': item.timestamp
                                 }),
                               context=getRequest()).encode('utf-8')

    data = {
        'url':
        url,
        'showroom_url':
        url,
        'showroom_title':
        showroom_title,
        'title':
        translate(_('label_preview', default='Preview'),
                  context=getRequest()).encode('utf-8')
    }

    return """
    <div>
        <a class="showroom-item function-preview-pdf"
           href="{%(url)s}"
           data-showroom-target="%(showroom_url)s"
           data-showroom-title="%(showroom_title)s">%(title)s</a>
    </div>
    """ % data
class MyTasks(GlobalTaskListingTab):
    """A listing view, which lists all tasks where the given
    user is responsible. It queries all admin units.

    This listing is based on opengever.globalindex (sqlalchemy) and respects
    the basic features of tabbedview such as searching and batching.
    """

    filterlist = FilterList(
        Filter('filter_all', _('label_tabbedview_filter_all')),
        PendingMinusResolvedTasksFilter('filter_pending',
                                        _('label_pending', 'Pending'),
                                        default=True),
    )

    enabled_actions = [
        'pdf_taskslisting',
        'export_tasks',
    ]

    major_actions = [
        'pdf_taskslisting',
    ]

    def get_base_query(self):
        userid = api.user.get_current().getId()
        responsibles = [
            team.actor_id()
            for team in Team.query.join(Group).join(groups_users).filter_by(
                userid=userid)
        ]
        responsibles.append(userid)

        return Task.query.by_responsibles(responsibles)
예제 #5
0
class Tasks(GlobalTaskListingTab):
    """Recursively list tasks."""

    grok.name('tabbedview_view-tasks')
    grok.context(IDossierMarker)

    columns = GlobalTaskListingTab.columns + (
        {
            'column': 'containing_subdossier',
            'column_title': _('label_subdossier', default="Subdossier"),
        }, )

    enabled_actions = [
        'change_state',
        'pdf_taskslisting',
        'move_items',
        'export_tasks',
    ]

    major_actions = [
        'change_state',
    ]

    def get_base_query(self):
        return Task.query.by_container(self.context, get_current_admin_unit())
예제 #6
0
    def meeting_tabs(self):
        tabs = []
        if is_meeting_feature_enabled():
            tabs.append(
                {'id': 'myproposals',
                 'title': _('label_my_proposals', default=u'My proposals'),
                 'icon': None, 'url': '#', 'class': None})

        return tabs
예제 #7
0
    def notification_tabs(self):
        tabs = []
        if is_activity_feature_enabled():
            tabs.append(
                {'id': 'mynotifications',
                 'title': _('label_my_notifications', default=u'My notifications'),
                 'icon': None, 'url': '#', 'class': None})

        return tabs
예제 #8
0
    def personal_overview_title(self):
        current_user = ogds_service().fetch_current_user()
        if current_user:
            user_name = current_user.label(with_principal=False)
        else:
            user_name = api.user.get_current().getUserName()

        return _('personal_overview_title',
                 default='Personal Overview: ${user_name}',
                 mapping=dict(user_name=user_name))
예제 #9
0
    def personal_overview_title(self):
        current_user = ogds_service().fetch_current_user()
        if current_user:
            user_name = current_user.label(with_principal=False)
        else:
            user_name = api.user.get_current().getUserName()

        return _('personal_overview_title',
                 default='Personal Overview: ${user_name}',
                 mapping=dict(user_name=user_name))
예제 #10
0
    def _widget(self):
        field = schema.List(
            value_type=schema.Choice(source=self._keywords_vocabulary()),
            required=False,
        )
        widget = KeywordFieldWidget(field, self.request)
        widget.value = self._subject_terms_from_request()
        widget.promptMessage = _('placeholder_filter_by_subjects',
                                 default="Filter by subjects...")
        widget.update()

        return widget
예제 #11
0
    def _widget(self):
        field = schema.List(
            value_type=schema.Choice(source=self._keywords_vocabulary()),
            required=False,
        )
        widget = KeywordFieldWidget(field, self.request)
        widget.value = self._subject_terms_from_request()
        widget.promptMessage = _('placeholder_filter_by_subjects',
                                 default="Filter by subjects...")
        widget.update()

        return widget
예제 #12
0
class BaseDossiersTab(OpengeverCatalogListingTab):

    object_provides = 'opengever.dossier.behaviors.dossier.IDossierMarker'

    columns = (
        {
            'column': '',
            'column_title': '',
            'transform': helper.path_checkbox,
            'width': 30
        },
        {
            'column': 'reference',
            'column_title': _(u'label_reference', default=u'Reference Number')
        },
        {
            'column': 'Title',
            'column_title': _(u'label_title', default=u'Title'),
            'sort_index': 'sortable_title',
            'transform': linked
        },
        {
            'column': 'review_state',
            'column_title': _(u'label_review_state', default=u'Review state'),
            'transform': workflow_state
        },
        {
            'column': 'responsible',
            'column_title': _(u'label_dossier_responsible',
                              default=u"Responsible"),
            'transform': readable_ogds_author
        },
        {
            'column': 'start',
            'column_title': _(u'label_start', default=u'Start'),
            'transform': helper.readable_date
        },
        {
            'column': 'end',
            'column_title': _(u'label_end', default=u'End'),
            'transform': helper.readable_date
        },
    )

    search_options = {'is_subdossier': False}

    enabled_actions = [
        'change_state',
        'pdf_dossierlisting',
        'export_dossiers',
        'move_items',
        'copy_items',
    ]

    major_actions = [
        'change_state',
    ]
예제 #13
0
class Tasks(GlobalTaskListingTab):
    """Recursively list tasks."""

    columns = GlobalTaskListingTab.columns + (
        {
            'column': 'containing_subdossier',
            'column_title': _('label_subdossier', default="Subdossier"),
            'transform': linked_containing_subdossier
        }, )

    enabled_actions = [
        'change_state',
        'pdf_taskslisting',
        'move_items',
        'export_tasks',
    ]

    major_actions = [
        'change_state',
    ]

    def get_base_query(self):
        return Task.query.by_container(self.context, get_current_admin_unit())
예제 #14
0
class UsersListing(grok.View, OpengeverTab, ListingView):
    """Tab registered on contacts folder (see opengever.contact) listing all
    users.
    """

    implements(IUsersListingTableSourceConfig)

    grok.name('tabbedview_view-users')
    grok.context(Interface)
    grok.require('zope2.View')

    sort_on = 'lastname'
    sort_order = ''
    #lazy must be false otherwise there will be no correct batching
    lazy = False

    # the model attributes is used for a dynamic textfiltering functionality
    model = User
    show_selects = False
    enabled_actions = []
    major_actions = []
    selection = ViewPageTemplateFile("no_selection_amount.pt")

    columns = (
        {
            'column': 'lastname',
            'column_title': _(u'label_userstab_lastname', default=u'Lastname'),
            'transform': linked_value_helper
        },
        {
            'column': 'firstname',
            'column_title': _(u'label_userstab_firstname',
                              default=u'Firstname'),
            'transform': linked_value_helper
        },
        {
            'column': 'userid',
            'column_title': _(u'label_userstab_userid', default=u'Userid'),
            'transform': linked_value_helper
        },
        {
            'column': 'email',
            'column_title': _(u'label_userstab_email', default=u'Email'),
            'transform': email_helper
        },
        {
            'column':
            'phone_office',
            'column_title':
            _(u'label_userstab_phone_office', default=u'Office Phone')
        },
        {
            'column': 'department',
            'column_title': _(u'label_department_user', default=u'Department')
        },
        {
            'column': 'directorate',
            'column_title': _(u'label_directorate_user',
                              default=u'Directorate')
        },
        {
            'column': 'active',
            'column_title': _(u'label_active', default=u'Active'),
            'transform': boolean_helper
        },
    )

    __call__ = ListingView.__call__
    update = ListingView.update
    render = __call__

    def get_base_query(self):
        """Returns the base search query (sqlalchemy)
        """
        info = getUtility(IContactInformation)
        return info._users_query()
예제 #15
0
class Documents(BaseCatalogListingTab):
    """List all documents recursively. Working copies are not listed.
    """

    subject_filter_available = True

    types = ['opengever.document.document', 'ftw.mail.mail']

    # XXX Can be set back to 'columns' once the changed metadata has been filled on all deployments
    # https://github.com/4teamwork/opengever.core/issues/4988
    _columns = (
        {
            'column': '',
            'column_title': '',
            'transform': helper.path_checkbox,
            'sortable': False,
            'groupable': False,
            'width': 30
        },
        {
            'column':
            'sequence_number',
            'column_title':
            _(u'document_sequence_number', default=u'Sequence Number'),
            'sort_index':
            'sequence_number'
        },
        {
            'column': 'Title',
            'column_title': _(u'label_title', default=u'Title'),
            'sort_index': 'sortable_title',
            'transform': linked_document
        },
        {
            'column': 'document_author',
            'column_title': _('label_document_author',
                              default="Document Author"),
            'sort_index': 'sortable_author',
            'transform': escape_html_transform
        },
        {
            'column': 'document_date',
            'column_title': _('label_document_date', default="Document Date"),
            'transform': readable_date
        },

        # XXX transform should be set to readable_date once the changed metadata has been filled on all deployments
        # https://github.com/4teamwork/opengever.core/issues/4988
        {
            'column': 'changed',
            'column_title': _('label_modified_date',
                              default="Modification Date"),
            'hidden': True,
            'transform': readable_changed_date
        },
        {
            'column': 'created',
            'column_title': _('label_created_date', default="Creation Date"),
            'hidden': True,
            'transform': readable_date
        },
        {
            'column': 'receipt_date',
            'column_title': _('label_receipt_date', default="Receipt Date"),
            'transform': readable_date
        },
        {
            'column': 'delivery_date',
            'column_title': _('label_delivery_date', default="Delivery Date"),
            'transform': readable_date
        },
        {
            'column': 'checked_out',
            'column_title': _('label_checked_out', default="Checked out by"),
            'transform': readable_ogds_user
        },
        {
            'column': 'containing_subdossier',
            'column_title': _('label_subdossier', default="Subdossier"),
            'transform': linked_containing_subdossier
        },
        {
            'column': 'public_trial',
            'column_title': _('label_public_trial', default="Public Trial"),
            'transform': translate_public_trial_options
        },
        {
            'column':
            'reference',
            'column_title':
            _(u'label_document_reference', default=u'Reference Number')
        },
        {
            'column':
            'file_extension',
            'column_title':
            _(u'label_document_file_extension', default=u'File extension')
        },
        {
            'column': 'Subject',
            'column_title': _(u'label_keywords', default=u'Keywords'),
            'transform': linked_subjects,
            'sortable': False
        },
    )

    major_actions = [
        'create_task',
        'create_proposal',
    ]

    bumblebee_template = ViewPageTemplateFile(
        'generic_with_bumblebee_viewchooser.pt')

    # XXX Can be deleted once the changed metadata has been filled on all deployments
    # https://github.com/4teamwork/opengever.core/issues/4988
    @property
    def columns(self):
        if (api.portal.get_registry_record('use_solr',
                                           interface=ISearchSettings)
                and not has_metadata_changed_been_filled()):
            return tuple([
                column for column in self._columns
                if not column.get("column") == "changed"
            ])
        return self._columns

    def __call__(self, *args, **kwargs):
        if is_bumblebee_feature_enabled():
            set_preferred_listing_view('list')
            self.template = BoundPageTemplate(self.bumblebee_template, self)

        return super(Documents, self).__call__(self, *args, **kwargs)

    @property
    def gallery_view_name(self):
        return '{}-gallery'.format(self.view_name)

    @property
    def enabled_actions(self):
        actions = [
            'send_as_email',
            'checkout',
            'checkin_with_comment',
            'checkin_without_comment',
            'cancel',
            'create_task',
            'create_proposal',
            'submit_additional_documents',
            'trashed',
            'move_items',
            'copy_items',
            'zip_selected',
            'export_documents',
        ]

        if is_officeconnector_attach_feature_enabled():
            actions.append('attach_documents')
            actions.remove('send_as_email')

        return actions
예제 #16
0
class Dossiers(BaseCatalogListingTab):
    """List all dossiers recursively."""

    template = ViewPageTemplateFile("generic_with_filters.pt")
    subject_filter_available = True

    object_provides = 'opengever.dossier.behaviors.dossier.IDossierMarker'

    columns = (
        {
            'column': '',
            'column_title': '',
            'transform': helper.path_checkbox,
            'sortable': False,
            'groupable': False,
            'width': 30
        },
        {
            'column': 'reference',
            'column_title': _(u'label_reference', default=u'Reference Number')
        },
        {
            'column': 'Title',
            'column_title': _(u'label_title', default=u'Title'),
            'sort_index': 'sortable_title',
            'transform': linked
        },
        {
            'column': 'review_state',
            'column_title': _(u'label_review_state', default=u'Review state'),
            'transform': workflow_state
        },
        {
            'column': 'responsible',
            'column_title': _(u'label_dossier_responsible',
                              default=u"Responsible"),
            'transform': readable_ogds_author
        },
        {
            'column': 'start',
            'column_title': _(u'label_start', default=u'Start'),
            'transform': readable_date
        },
        {
            'column': 'end',
            'column_title': _(u'label_end', default=u'End'),
            'transform': readable_date
        },
        {
            'column': 'Subject',
            'column_title': _(u'label_keywords', default=u'Keywords'),
            'transform': linked_subjects,
            'sortable': False
        },
    )

    search_options = {'is_subdossier': False}

    enabled_actions = [
        'change_state',
        'pdf_dossierlisting',
        'export_dossiers',
        'move_items',
        'copy_items',
        'create_disposition',
        'ech0147_export',
    ]

    major_actions = [
        'change_state',
    ]

    all_filter = Filter('filter_all', _('label_tabbedview_filter_all'))
    active_filter = CatalogQueryFilter(
        'filter_active',
        _('Active'),
        default=True,
        query_extension={'review_state': DOSSIER_STATES_OPEN})
    expired_filter = CatalogQueryFilter('filter_retention_expired',
                                        _('expired'),
                                        query_extension={
                                            'review_state':
                                            DOSSIER_STATES_CLOSED,
                                            'retention_expiration': {
                                                'query': date.today(),
                                                'range': 'max'
                                            }
                                        })
    overdue_filter = CatalogQueryFilter(
        'filter_overdue',
        _('overdue'),
        query_extension={
            'review_state': DOSSIER_STATES_OPEN,
            'end': {
                'query': date.today() - timedelta(days=1),
                'range': 'max'
            }
        })

    filterlist_name = 'dossier_state_filter'
    filterlist_available = True

    @property
    def filterlist(self):
        filters = [self.all_filter, self.active_filter]

        if api.user.has_permission('opengever.disposition: Add disposition'):
            filters.append(self.expired_filter)

        filters.append(self.overdue_filter)

        return FilterList(*filters)
예제 #17
0
class GlobalTaskListingTab(BaseListingTab):
    """A tabbed view mixin which brings support for listing tasks from
    the SQL (globally over all clients).

    There is support for searching, batching and ordering.
    """

    implements(IGlobalTaskTableSourceConfig)

    template = ViewPageTemplateFile("generic_with_filters.pt")

    sort_on = 'modified'
    sort_reverse = False
    #lazy must be false otherwise there will be no correct batching
    lazy = False

    # the model attribute is used for a dynamic textfiltering functionality
    model = Task
    enabled_actions = []
    major_actions = []

    select_all_template = ViewPageTemplateFile('select_all_globaltasks.pt')

    filterlist_name = 'task_state_filter'
    filterlist_available = True

    filterlist = FilterList(
        Filter('filter_all', _('label_tabbedview_filter_all')),
        PendingTasksFilter('filter_pending',
                           _('label_pending', 'Pending'),
                           default=True),
    )

    columns = (
        {
            'column': '',
            'sortable': False,
            'transform': task_id_checkbox_helper,
            'width': 30
        },
        {
            'column': 'review_state',
            'column_title': _(u'column_review_state', default=u'Review state'),
            'transform': workflow_state
        },
        {
            'column': 'title',
            'column_title': _(u'column_title', default=u'Title'),
            'transform': indexed_task_link_helper
        },
        {
            'column': 'task_type',
            'column_title': _(u'column_task_type', default=u'Task type'),
            'transform': task_type_helper
        },
        {
            'column': 'deadline',
            'column_title': _(u'column_deadline', default=u'Deadline'),
            'transform': lambda task, deadline: task.get_deadline_label()
        },
        {
            'column':
            'completed',
            'column_title':
            _(u'column_date_of_completion', default=u'Date of completion'),
            'transform':
            readable_date_set_invisibles
        },
        {
            'column': 'responsible',
            'column_title': _(u'label_responsible_task',
                              default=u'Responsible'),
            'transform': readable_ogds_author
        },
        {
            'column': 'issuer',
            'column_title': _(u'label_issuer', default=u'Issuer'),
            'transform': readable_ogds_author
        },
        {
            'column': 'created',
            'column_title': _(u'column_issued_at', default=u'Issued at'),
            'transform': helper.readable_date
        },
        {
            'column': 'containing_dossier',
            'column_title': _('containing_dossier', 'Dossier'),
            'transform': linked_containing_maindossier
        },
        {
            'column':
            'issuing_org_unit',
            'column_title':
            _('column_issuing_org_unit', default=u'Organisational Unit'),
            'transform':
            org_unit_title_helper,
            'condition':
            display_org_unit_title_condition
        },
        {
            'column':
            'sequence_number',
            'column_title':
            _(u'column_sequence_number', default=u'Sequence number')
        },
    )
예제 #18
0
class UsersListing(BaseListingTab):
    """Tab registered on contacts folder (see opengever.contact) listing all
    users.
    """
    implements(IUsersListingTableSourceConfig)

    sort_on = 'lastname'
    sort_order = ''

    # the model attributes is used for a dynamic textfiltering functionality
    model = User
    show_selects = False

    filterlist_name = 'user_state_filter'
    filterlist_available = True
    filterlist = FilterList(
        Filter('filter_all', _('label_tabbedview_filter_all')),
        ActiveOnlyFilter('filter_active', _('Active'), default=True))

    columns = (
        {
            'column': 'lastname',
            'column_title': _(u'label_userstab_lastname', default=u'Lastname'),
            'transform': linked_user_helper
        },
        {
            'column': 'firstname',
            'column_title': _(u'label_userstab_firstname',
                              default=u'Firstname'),
            'transform': linked_user_helper
        },
        {
            'column': 'userid',
            'column_title': _(u'label_userstab_userid', default=u'Userid'),
            'transform': linked_user_helper
        },
        {
            'column': 'email',
            'column_title': _(u'label_userstab_email', default=u'Email'),
            'transform': email_helper
        },
        {
            'column':
            'phone_office',
            'column_title':
            _(u'label_userstab_phone_office', default=u'Office Phone')
        },
        {
            'column': 'department',
            'column_title': _(u'label_department_user', default=u'Department')
        },
        {
            'column': 'directorate',
            'column_title': _(u'label_directorate_user',
                              default=u'Directorate')
        },
        {
            'column': 'active',
            'column_title': _(u'label_active', default=u'Active'),
            'transform': boolean_helper
        },
    )

    def get_base_query(self):
        """Returns the base search query (sqlalchemy)
        """
        session = create_session()
        return session.query(User)
예제 #19
0
class Documents(OpengeverCatalogListingTab):
    """List all documents recursively. Working copies are not listed.
    """

    grok.name('tabbedview_view-documents')

    types = ['opengever.document.document', 'ftw.mail.mail']

    columns = (
        {
            'column': '',
            'column_title': '',
            'transform': helper.path_checkbox,
            'width': 30
        },
        {
            'column':
            'sequence_number',
            'column_title':
            _(u'document_sequence_number', default=u'Sequence Number'),
            'sort_index':
            'sequence_number'
        },
        {
            'column': 'Title',
            'column_title': _(u'label_title', default=u'Title'),
            'sort_index': 'sortable_title',
            'transform': linked_document_with_tooltip
        },
        {
            'column': 'document_author',
            'column_title': _('label_document_author',
                              default="Document Author"),
            'sort_index': 'sortable_author'
        },
        {
            'column': 'document_date',
            'column_title': _('label_document_date', default="Document Date"),
            'transform': helper.readable_date
        },
        {
            'column': 'receipt_date',
            'column_title': _('label_receipt_date', default="Receipt Date"),
            'transform': helper.readable_date
        },
        {
            'column': 'delivery_date',
            'column_title': _('label_delivery_date', default="Delivery Date"),
            'transform': helper.readable_date
        },
        {
            'column': 'checked_out',
            'column_title': _('label_checked_out', default="Checked out by"),
            'transform': readable_ogds_user
        },
        {
            'column': 'containing_subdossier',
            'column_title': _('label_subdossier', default="Subdossier"),
        },
    )

    enabled_actions = [
        'send_as_email',
        'checkout',
        'checkin',
        'cancel',
        'create_task',
        'trashed',
        'move_items',
        'copy_items',
        'zip_selected',
    ]

    major_actions = [
        'create_task',
    ]
예제 #20
0
from five import grok
from opengever.dossier.filing.interfaces import IFilingNumberActivatedLayer
from opengever.tabbedview import _
from opengever.tabbedview.browser.tabs import Dossiers
from opengever.tabbedview.browser.tabs import SubDossiers

FILING_NO_COLUMN = {
    'column': 'filing_no',
    'column_title': _(u'filing_number', default=u'Filing Number')
}


class DossiersFilingNumberIncluded(Dossiers):
    grok.layer(IFilingNumberActivatedLayer)

    @property
    def columns(self):
        """Append the filing number column.
        """
        columns = super(DossiersFilingNumberIncluded, self).columns

        return columns + (FILING_NO_COLUMN, )


class SubDossiersFilingNumberIncluded(SubDossiers):
    grok.layer(IFilingNumberActivatedLayer)

    @property
    def columns(self):
        """Append the filing number column.
        """
예제 #21
0
class Tasks(OpengeverCatalogListingTab):

    implements(IStateFilterTableSourceConfig)

    grok.name('tabbedview_view-tasks')

    template = ViewPageTemplateFile("generic_task.pt")

    selection = ViewPageTemplateFile("selection_tasks.pt")

    open_states = [
        'task-state-open',
        'task-state-in-progress',
        'task-state-resolved',
        'task-state-rejected',
        'forwarding-state-open',
        'forwarding-state-refused',
    ]

    state_filter_name = 'task_state_filter'

    columns = (
        {
            'column': '',
            'column_title': '',
            'transform': helper.path_checkbox,
            'width': 30
        },
        {
            'column': 'review_state',
            'column_title': _(u'label_review_state', default=u'Review state'),
            'transform': workflow_state
        },
        {
            'column': 'Title',
            'column_title': _(u'label_title', default=u'Title'),
            'sort_index': 'sortable_title',
            'transform': linked
        },
        {
            'column': 'task_type',
            'column_title': _(u'label_task_type', 'Task Type'),
            'transform': task_type_helper
        },
        {
            'column': 'deadline',
            'column_title': _(u'label_deadline', 'Deadline'),
            'transform': overdue_date_helper
        },
        {
            'column': 'date_of_completion',
            'column_title': _(u'label_date_of_completion',
                              'Date of Completion'),
            'transform': readable_date_set_invisibles
        },
        {
            'column': 'responsible',
            'column_title': _(u'label_responsible_task', 'Responsible'),
            'transform': readable_ogds_author
        },
        {
            'column': 'issuer',
            'column_title': _(u'label_issuer', 'Issuer'),
            'transform': readable_ogds_author
        },
        {
            'column': 'created',
            'column_title': _(u'label_issued_date', 'issued at'),
            'transform': helper.readable_date
        },
        {
            'column': 'client_id',
            'column_title': _('client_id', 'Client'),
            'transform': client_title_helper,
            'condition': display_client_title_condition
        },
        {
            'column': 'containing_dossier',
            'column_title': _('containing_dossier', 'Dossier'),
        },
        {
            'column': 'sequence_number',
            'column_title': _(u'task_sequence_number', "Sequence Number"),
        },
        {
            'column': 'containing_subdossier',
            'column_title': _('label_subdossier', default="Subdossier"),
        },
    )

    types = [
        'opengever.task.task',
    ]

    enabled_actions = [
        'change_state',
        'pdf_taskslisting',
        'move_items',
        'copy_items',
        'export_dossiers',
    ]

    major_actions = [
        'change_state',
    ]
예제 #22
0
class ClientsListing(grok.View, OpengeverTab, ListingView):
    """A clients listing tab.
    """

    implements(IClientsTableSourceConfig)

    grok.context(Interface)
    grok.name('tabbedview_view-ogds-cp-clients')
    grok.require('cmf.ManagePortal')

    sort_on = 'client_id'
    sort_reverse = False

    show_selects = False
    enabled_actions = []
    major_actions = []
    selection = ViewPageTemplateFile("no_selection_amount.pt")

    columns = (
        {
            'column': 'client_id',
            'column_title': _(u'column_client_id', default=u'Client ID')
        },
        {
            'column': 'title',
            'column_title': _(u'column_title', default=u'Title')
        },
        {
            'column': 'enabled',
            'column_title': _(u'column_enabled', default=u'Enabled')
        },
        {
            'column': 'ip_address',
            'column_title': _(u'column_ip_address', default=u'IP address')
        },
        {
            'column':
            'site_url',
            'column_title':
            _(u'column_interal_site_url', default=u'Internal site URL')
        },
        {
            'column': 'public_url',
            'column_title': _(u'column_public_url', default=u'Public URL'),
            'transform': linked_url_helper
        },
        {
            'column': 'group',
            'column_title': _(u'column_group', default=u'Users group'),
            'transform': readable_user_group
        },
        {
            'column': 'inbox_group',
            'column_title': _(u'column_inbox_group',
                              default=u'Inbox user group'),
            'transform': readable_inbox_group
        },
    )

    __call__ = ListingView.__call__
    update = ListingView.update
    render = __call__

    def get_base_query(self):
        """Returns the base search query (sqlalchemy)
        """
        return create_session().query(Client)
예제 #23
0
class Documents(BaseCatalogListingTab):
    """List all documents recursively. Working copies are not listed.
    """

    types = ['opengever.document.document', 'ftw.mail.mail']

    columns = (

        {'column': '',
         'column_title': '',
         'transform': helper.path_checkbox,
         'sortable': False,
         'groupable': False,
         'width': 30},

        {'column': 'sequence_number',
         'column_title': _(u'document_sequence_number',
                           default=u'Sequence Number'),
         'sort_index': 'sequence_number'},

        {'column': 'Title',
         'column_title': _(u'label_title', default=u'Title'),
         'sort_index': 'sortable_title',
         'transform': linked_document},

        {'column': 'document_author',
         'column_title': _('label_document_author', default="Document Author"),
         'sort_index': 'sortable_author',
         'transform': escape_html_transform},

        {'column': 'document_date',
         'column_title': _('label_document_date', default="Document Date"),
         'transform': helper.readable_date},

        {'column': 'receipt_date',
         'column_title': _('label_receipt_date', default="Receipt Date"),
         'transform': helper.readable_date},

        {'column': 'delivery_date',
         'column_title': _('label_delivery_date', default="Delivery Date"),
         'transform': helper.readable_date},

        {'column': 'checked_out',
         'column_title': _('label_checked_out', default="Checked out by"),
         'transform': readable_ogds_user},

        {'column': 'containing_subdossier',
         'column_title': _('label_subdossier', default="Subdossier"),
         'transform': linked_containing_subdossier},

        {'column': 'public_trial',
         'column_title': _('label_public_trial', default="Public Trial"),
         'transform': translate_public_trial_options},

        {'column': 'reference',
         'column_title': _(u'label_document_reference',
                           default=u'Reference Number')},
        )

    major_actions = [
        'create_task',
        ]

    bumblebee_template = ViewPageTemplateFile(
        'generic_with_bumblebee_viewchooser.pt')

    def __call__(self, *args, **kwargs):
        if is_bumblebee_feature_enabled():
            set_preferred_listing_view('list')
            self.template = BoundPageTemplate(self.bumblebee_template, self)

        return super(Documents, self).__call__(self, *args, **kwargs)

    @property
    def gallery_view_name(self):
        return '{}-gallery'.format(self.view_name)

    @property
    def enabled_actions(self):
        actions = [
            'send_as_email',
            'checkout',
            'checkin_with_comment',
            'checkin_without_comment',
            'cancel',
            'create_task',
            'submit_additional_documents',
            'trashed',
            'move_items',
            'copy_items',
            'zip_selected',
            'export_documents',
        ]

        if is_officeconnector_attach_feature_enabled():
            actions.append('attach_documents')
            actions.remove('send_as_email')

        return actions
예제 #24
0
class GlobalTaskListingTab(grok.View, OpengeverTab, ListingView):
    """A tabbed view mixing which brings support for listing tasks from
    the SQL (globally over all clients).

    There is support for searching, batching and ordering.
    """

    implements(IGlobalTaskTableSourceConfig)

    grok.context(IJournalizable)
    grok.require('zope2.View')

    template = ViewPageTemplateFile("generic_task.pt")

    sort_on = 'modified'
    sort_reverse = False
    #lazy must be false otherwise there will be no correct batching
    lazy = False

    # the model attributes is used for a dynamic textfiltering functionality
    model = Task
    enabled_actions = []
    major_actions = []

    select_all_template = ViewPageTemplateFile('select_all_globaltasks.pt')
    selection = ViewPageTemplateFile("selection_tasks.pt")

    open_states = [
        'task-state-open',
        'task-state-in-progress',
        'task-state-resolved',
        'task-state-rejected',
        'forwarding-state-open',
        'forwarding-state-refused',
    ]

    state_filter_name = 'task_state_filter'

    columns = (
        ('', task_id_checkbox_helper),
        {
            'column': 'review_state',
            'column_title': _(u'column_review_state', default=u'Review state'),
            'transform': workflow_state
        },
        {
            'column': 'title',
            'column_title': _(u'column_title', default=u'Title'),
            'transform': indexed_task_link_helper
        },
        {
            'column': 'task_type',
            'column_title': _(u'column_task_type', default=u'Task type'),
            'transform': task_type_helper
        },
        {
            'column': 'deadline',
            'column_title': _(u'column_deadline', default=u'Deadline'),
            'transform': overdue_date_helper
        },
        {
            'column':
            'completed',
            'column_title':
            _(u'column_date_of_completion', default=u'Date of completion'),
            'transform':
            readable_date_set_invisibles
        },
        {
            'column': 'responsible',
            'column_title': _(u'label_responsible_task',
                              default=u'Responsible'),
            'transform': readable_ogds_author
        },
        {
            'column': 'issuer',
            'column_title': _(u'label_issuer', default=u'Issuer'),
            'transform': readable_ogds_author
        },
        {
            'column': 'created',
            'column_title': _(u'column_issued_at', default=u'Issued at'),
            'transform': helper.readable_date
        },
        {
            'column': 'containing_dossier',
            'column_title': _('containing_dossier', 'Dossier'),
        },
        {
            'column': 'client_id',
            'column_title': _('column_client', default=u'Client'),
            'transform': client_title_helper,
            'condition': display_client_title_condition
        },
        {
            'column':
            'sequence_number',
            'column_title':
            _(u'column_sequence_number', default=u'Sequence number')
        },
    )

    __call__ = ListingView.__call__
    update = ListingView.update
    render = __call__
예제 #25
0
from five import grok
from opengever.dossier.filing.interfaces import IFilingNumberActivatedLayer
from opengever.tabbedview import _
from opengever.tabbedview.browser.tabs import Dossiers
from opengever.tabbedview.browser.tabs import SubDossiers


FILING_NO_COLUMN = {
    'column': 'filing_no',
    'column_title': _(u'filing_number', default=u'Filing Number')}


class DossiersFilingNumberIncluded(Dossiers):
    grok.layer(IFilingNumberActivatedLayer)

    @property
    def columns(self):
        """Append the filing number column.
        """
        columns = super(DossiersFilingNumberIncluded, self).columns

        return columns + (FILING_NO_COLUMN, )


class SubDossiersFilingNumberIncluded(SubDossiers):
    grok.layer(IFilingNumberActivatedLayer)

    @property
    def columns(self):
        """Append the filing number column.
        """