def _add_account_subscription(self, uid): """ """ site = self.getSite() meeting = self.getMeeting() name = getUserFullName(site, uid) email = getUserEmail(site, uid) organization = getUserOrganization(site, uid) if not organization: organization = self.get_survey_answer(uid, 'w_organization') if not organization: organization = self.get_survey_answer(uid, 'w_organisation') phone = getUserPhoneNumber(site, uid) if not phone: phone = self.get_survey_answer(uid, 'w_telephone') if not phone: phone = self.get_survey_answer(uid, 'w_phone') account_subscription = AccountSubscription(uid, name, email, organization, phone) self._account_subscriptions.insert(uid, account_subscription) if meeting.auto_register: self._accept_account_subscription(uid) email_sender = self.getMeeting().getEmailSender() email_sender.send_account_subscription_email(account_subscription)
def getAttendeeInfo(self, uid): """ """ subscriptions = self.getSubscriptions() if subscriptions._is_signup(uid): user = subscriptions.getSignup(uid) name = user.name email = user.email organization = user.organization phone = user.phone else: site = self.getSite() name = getUserFullName(site, uid) email = getUserEmail(site, uid) organization = getUserOrganization(site, uid) phone = getUserPhoneNumber(site, uid) if not organization: organization = self.get_survey_answer(uid, 'w_organization') if not organization: organization = self.get_survey_answer(uid, 'w_organisation') if not phone: phone = self.get_survey_answer(uid, 'w_telephone') if not phone: phone = self.get_survey_answer(uid, 'w_phone') attendees = self._get_attendees() role = attendees[uid] ret = {'uid': uid, 'name': name, 'email': email, 'organization': organization, 'phone': phone, 'role': role} for k, v in ret.items(): if not isinstance(v, basestring): ret[k] = u'' return ret
def getParticipantInfo(self, uid): """ """ site = self.getSite() name = getUserFullName(site, uid) email = getUserEmail(site, uid) organisation = getUserOrganisation(site, uid) phone = getUserPhoneNumber(site, uid) return {'uid': uid, 'name': name, 'email': email, 'organisation': organisation, 'phone': phone}
def update_account_subscription(self, uid): """ """ site = self.getSite() name = getUserFullName(site, uid) email = getUserEmail(site, uid) organization = getUserOrganization(site, uid) phone = getUserPhoneNumber(site, uid) account_subscription = AccountSubscription(uid, name, email, organization, phone) self._account_subscriptions.update({uid: account_subscription})
def jstree_organisations(self): """ """ jstree, organisations = [], {} site = self.getSite() meeting_config = meeting_module.get_config() meeting_obs = site.getCatalogedObjectsCheckView(meta_type=meeting_config['meta_type'], approved=1) for i, meeting in enumerate(meeting_obs): for uid in meeting.participants.uids: organisation = getUserOrganisation(site, uid) if organisation not in organisations: organisations[organisation] = {} if i not in organisations[organisation]: organisations[organisation][i] = [] organisations[organisation][i].append(uid) for organisation, values in organisations.iteritems(): meeting_nodes = [] for i, uids in values.iteritems(): meeting = meeting_obs[i] user_nodes = [] for uid in uids: name = getUserFullName(site, uid) user_node = {'data': {'title': name, 'icon': self.participant_icon, 'attributes': {'href': ''} }} email = getUserEmail(site, uid) if email is not None: href = 'mailto:' + email user_node['data']['attributes']['href'] = href user_nodes.append(user_node) title = meeting.title_or_id() href = meeting.absolute_url() meeting_nodes.append({'data': {'title': title, 'icon': meeting.icon, 'attributes': {'href': href}}, 'children': user_nodes}) jstree.append({'data': {'title': organisation, 'icon': self.organisation_icon }, 'children': meeting_nodes }) return json.dumps(jstree)
def send_email(self, from_email, subject, body_text, REQUEST, to_uids=None): """ """ result = 0 if to_uids is not None: assert isinstance(to_uids, list) to_emails = [getUserEmail(self.getSite(), uid) for uid in to_uids] result = self._send_email(from_email, to_emails, subject, body_text) return self.getFormsTool().getContent({'here': self, 'meeting': self.getMeeting(), 'result': result}, 'naaya.content.meeting.email_sendstatus')
def getParticipants(self, sort_on=''): """ """ site = self.getSite() key = None if sort_on == 'o': key = lambda x: getUserOrganisation(site, x) elif sort_on == 'name': key = lambda x: getUserFullName(site, x) elif sort_on == 'email': key = lambda x: getUserEmail(site, x) elif sort_on == 'uid': key = lambda x: x if key is None: return self.uids return sorted(self.uids, key=key)
def jstree_participants(self): """ """ jstree, participants = [], {} site = self.getSite() meeting_config = meeting_module.get_config() meeting_obs = site.getCatalogedObjectsCheckView(meta_type=meeting_config['meta_type'], approved=1) for meeting_ob in meeting_obs: for uid in meeting_ob.participants.uids: if uid not in participants: participants[uid] = [] participants[uid].append(meeting_ob) for uid, meetings_part in participants.iteritems(): meeting_nodes = [] for meeting_ob in meetings_part: title = meeting_ob.title_or_id() icon = meeting_ob.icon href = meeting_ob.absolute_url() meeting_nodes.append({'data': {'title': title, 'icon': icon, 'attributes': {'href': href} }}) name = getUserFullName(site, uid) icon = self.participant_icon user_node = {'data': {'title': name, 'icon': icon, 'attributes': {'href': ''} }, 'children': meeting_nodes} email = getUserEmail(site, uid) if email is not None: href = 'mailto:' + email user_node['data']['attributes'] = {'href': href} jstree.append(user_node) return json.dumps(jstree)
def getAttendees(self, sort_on=''): """ """ attendees = self._get_attendees() site = self.getSite() if sort_on == 'o': key = lambda x: getUserOrganization(site, x) elif sort_on == 'name': key = lambda x: getUserFullName(site, x) elif sort_on == 'email': key = lambda x: getUserEmail(site, x) elif sort_on == 'uid': key = lambda x: x elif sort_on == 'role': key = lambda x: attendees[x] else: key = None attendee_uids = attendees.keys() if key is not None: attendee_uids.sort(key=key) return attendee_uids