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 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_organizations(self): """ """ jstree, organizations = [], {} 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.getParticipants(): organization = getUserOrganization(site, uid) if organization not in organizations: organizations[organization] = {} if i not in organizations[organization]: organizations[organization][i] = [] organizations[organization][i].append(uid) for organization, values in organizations.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': organization, 'icon': self.organization_icon }, 'children': meeting_nodes }) 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