Example #1
0
    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 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.get_participants():
                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)
Example #4
0
 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')
     attendee = self._get_attendees()[uid]
     role = attendee['role']
     country = attendee['country']
     reimbursed = attendee['reimbursed']
     saved_by = attendee['saved_by']
     justification = attendee['justification']
     ret = {
         'uid': uid,
         'name': name,
         'email': email,
         'organization': organization,
         'phone': phone,
         'role': role,
         'country': country,
         'reimbursed': reimbursed,
         'saved_by': saved_by,
         'justification': justification
     }
     for k, v in ret.items():
         if not isinstance(v, basestring):
             ret[k] = u''
     return ret
    def _add_account_subscription(self, uid, accept=False):
        """ """
        # If the subscription already exists or the user is alread signed up
        # skip the whole thing
        if self._is_account_subscription(uid):
            return
        key = uid.replace('signup:', '')
        if self._is_signup(key):
            return
        site = self.getSite()
        meeting = self.getMeeting()
        name = getUserFullName(site, uid)
        # If for any reason we still don't have a name, at least use UID
        if not name:
            name = 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 or accept:
            self._accept_account_subscription(uid)

        email_sender = self.getMeeting().getEmailSender()
        email_sender.send_account_subscription_email(account_subscription)
Example #6
0
    def _add_account_subscription(self, uid, accept=False):
        """ """
        # If the subscription already exists or the user is alread signed up
        # skip the whole thing
        if self._is_account_subscription(uid):
            return
        key = uid.replace('signup:', '')
        if self._is_signup(key):
            return
        site = self.getSite()
        meeting = self.getMeeting()
        name = getUserFullName(site, uid)
        # If for any reason we still don't have a name, at least use UID
        if not name:
            name = 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 or accept:
            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')
     attendee = self._get_attendees()[uid]
     role = attendee['role']
     country = attendee['country']
     reimbursed = attendee['reimbursed']
     saved_by = attendee['saved_by'].encode('utf-8')
     justification = attendee['justification']
     ret = {'uid': uid, 'name': name, 'email': email,
            'organization': organization, 'phone': phone, 'role': role,
            'country': country, 'reimbursed': reimbursed,
            'saved_by': saved_by, 'justification': justification}
     for k, v in ret.items():
         if not isinstance(v, basestring):
             ret[k] = u''
     return ret
Example #8
0
    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.get_participants():
                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)