def getMenuItems(self, context, request): items = super(WorkflowMenu, self).getMenuItems(context, request) notification = INotificationEnabled(context, None) if notification is None: return items transitions = notification.transitions() for item in items: if item['extra']['id'][20:] in transitions: item['extra']['class'] = '%s workflownotification' % item['extra']['class'] item['action'] = item['action'].replace('content_status_modify', '@@workflownotification_form') return items
def getEnabledTransitionsFor(self, objs): """ returns all transitions which have notifications enabled for the given objects """ portal = getToolByName(self.context, 'portal_url').getPortalObject() if not type(objs) is type([]): objs = [objs,] transitions = [] for obj in objs: if type(obj) is type(''): obj = portal.restrictedTraverse(obj) enabler = INotificationEnabled(obj, None) if enabler: transitions.extend(enabler.transitions()) return transitions