def handle_wf_transition_partners(obj, event): if not event.transition: return if event.transition.id == "submit": parent = aq_parent(obj) if IOrganisation.providedBy(parent) or IFocalPoint.providedBy(parent) or IMediaPartner.providedBy(parent): utils._send_notification(obj, 'mail_content_submitted', parent)
def handle_wf_transition_partners(obj, event): if not event.transition: return if event.transition.id == "submit": parent = aq_parent(obj) if IOrganisation.providedBy(parent) or IFocalPoint.providedBy( parent) or IMediaPartner.providedBy(parent): utils._send_notification(obj, 'mail_content_submitted', parent)
def add_user_and_send_notifications(obj, groupname, template_name): current_user = api.user.get_current() portal = api.portal.get() grant_roles = False if 'Reviewer' not in portal.get_local_roles_for_userid( current_user.getId()): api.user.grant_roles(user=current_user, obj=portal, roles=[u'Reviewer']) grant_roles = True username, created = utils.create_key_user_if_not_exists(obj) group = utils.create_group_if_not_exists(groupname) group.addMember(username) if grant_roles: api.user.revoke_roles(user=current_user, obj=portal, roles=[u'Reviewer']) utils._send_notification(obj, template_name, username, created)
def render(self): """ We need to delete the current profile without shooting ourselves in the foot. Therefore, use a low-level method for deletion and make sure the necessary events get triggered. """ msg = 'The organisation profile "{0}" has been rejected'.format( self.context.Title()) api.portal.show_message(message=msg, request=self.request) _send_notification(self.context, "mail_organisation_rejected") id = self.context.id container = aq_parent(self.context) url = container.absolute_url() ob = container._getOb(id) obj_path = '/'.join(ob.getPhysicalPath()) catalog = getToolByName(container, "portal_catalog") container._delObject(id=id, suppress_events=True) notify(ObjectRemovedEvent(ob, container, id)) catalog.uncatalog_object(obj_path) self.request.response.redirect(url)
def handle_wf_transition(obj, event): if not event.transition: return if event.transition.id == 'approve_phase_1': add_user_and_send_notifications(obj, OCP_GROUP_NAME, 'mail_approve_phase_1') elif event.transition.id == 'submit': utils._send_notification(obj, "mail_organisation_submitted_creator") utils._send_notification(obj, "mail_organisation_submitted_siteowner") elif event.transition.id == 'publish': utils._send_notification(obj, 'mail_organisation_published_creator')
def handle_mediapartner_added(obj, event): utils._send_notification(obj, "mail_mediapartner_created_creator") utils._send_notification(obj, "mail_mediapartner_created_siteowner")
def handle_organisation_created(obj, event): utils._send_notification(obj, "mail_organisation_created_creator") utils._send_notification(obj, "mail_organisation_created_siteowner")
def handle_mediapartner_added(obj, event): utils._send_notification(obj, "mail_mediapartner_created_siteowner")
def add_user_and_send_notifications(obj, groupname, template_name): username, created = utils.create_key_user_if_not_exists(obj) group = utils.create_group_if_not_exists(groupname) group.addMember(username) utils._send_notification(obj, template_name, username, created)