Example #1
0
    def links(self, frame=None):

        # global links
        if not frame:
            baseurl = self.context.absolute_url()
            return [(_(u'Add timeframe'),
                    baseurl + '/++add++seantis.reservation.timeframe')]

        # frame specific links
        links = []

        action_tool = getToolByName(frame, 'portal_actions')
        actions = action_tool.listFilteredActionsFor(frame)['workflow']

        for action in actions:
            if action['visible'] and action['available']:
                action['title'] = utils.translate_workflow(
                    self.context, self.request, action['title']
                )
                links.append((action['title'], action['url']))

        baseurl = frame.absolute_url()
        links.append((_(u'Edit'), baseurl + '/edit'))
        links.append((_(u'Delete'), baseurl + '/delete_confirmation'))

        return links
Example #2
0
 def state(self, timeframe):
     state = self.workflowTool.getStatusOf(
         "timeframe_workflow", timeframe
     )['review_state']
     title = self.titles[state]
     return state, utils.translate_workflow(
         self.context, self.request, title
     )