Beispiel #1
0
def create(schedule_container, event):
    """
    """
    collection_id = 'dashboard_collection'
    title = IScheduleConfig.providedBy(schedule_container) and _('All') or schedule_container.Title()

    if collection_id not in schedule_container.objectIds():
        factory_args = {
            'id': 'dashboard_collection',
            'title': title,
            'query': [
                {
                    'i': 'CompoundCriterion',
                    'o': 'plone.app.querystring.operation.compound.is',
                    'v': schedule_container.UID()
                },
                {
                    'i': 'review_state',
                    'o': 'plone.app.querystring.operation.selection.is',
                    'v': ['to_do']
                }
            ],
            'customViewFields': (
                u'assigned_user_column',
                u'status',
                u'due_date'
            ),
            'sort_on': u'due_date',
            'sort_reversed': True,
            'b_size': 30
        }

        if IScheduleConfig.providedBy(schedule_container):
            factory_args['customViewFields'] = (
                u'pretty_link',
                u'sortable_title',
                u'assigned_user_column',
                u'status',
                u'due_date'
            )

        kwargs = {}
        additional_queries = kwargs.pop('query', [])
        for query in additional_queries:
            factory_args['query'].append(query)
        factory_args.update(kwargs)

        portal_types = api.portal.get_tool('portal_types')
        type_info = portal_types.getTypeInfo('DashboardCollection')
        collection = type_info._constructInstance(schedule_container, **factory_args)
        # mark the collection with an interface to to customize the render
        # term view of collection widget
        alsoProvides(collection, IScheduleCollection)
Beispiel #2
0
def update_title(schedule_container, event):
    """
    Dashboard Collection title should always be the title of the parent task.
    """
    collection = getattr(schedule_container, 'dashboard_collection', None)
    if collection:
        title = IScheduleConfig.providedBy(schedule_container) and _('All') or schedule_container.Title()
        collection.title = title
        collection.reindexObject(idxs=('Title', 'sortable_title'))
Beispiel #3
0
    def get_schedule_config(self):
        """
        Return the parent ScheduleConfig.
        """
        from imio.schedule.content.schedule_config import IScheduleConfig

        context = self
        while(not IScheduleConfig.providedBy(context)):
            context = context.getParentNode()

        return context
Beispiel #4
0
    def get_schedule_config(self):
        """
        Return the parent ScheduleConfig.
        """
        from imio.schedule.content.schedule_config import IScheduleConfig

        context = self
        while (not IScheduleConfig.providedBy(context)):
            context = context.getParentNode()

        return context
def create(schedule_container, event):
    """
    """
    collection_id = 'dashboard_collection'
    title = IScheduleConfig.providedBy(schedule_container) and _('All') or schedule_container.Title()

    if collection_id not in schedule_container.objectIds():
        factory_args = {
            'id': 'dashboard_collection',
            'title': title,
            'query': [
                {
                    'i': 'CompoundCriterion',
                    'o': 'plone.app.querystring.operation.compound.is',
                    'v': schedule_container.UID()
                },
                {
                    'i': 'review_state',
                    'o': 'plone.app.querystring.operation.selection.is',
                    'v': ['to_do']
                }
            ],
            'customViewFields': (
                u'assigned_user_column',
                u'status',
                u'due_date'
            ),
            'sort_on': u'due_date',
            'sort_reversed': True,
            'b_size': 30
        }

        kwargs = {}
        additional_queries = kwargs.pop('query', [])
        for query in additional_queries:
            factory_args['query'].append(query)
        factory_args.update(kwargs)

        portal_types = api.portal.get_tool('portal_types')
        type_info = portal_types.getTypeInfo('DashboardCollection')
        collection = type_info._constructInstance(schedule_container, **factory_args)
        # mark the collection with an interface to to customize the render
        # term view of collection widget
        alsoProvides(collection, IScheduleCollection)