Beispiel #1
0
    def download_webex(self, REQUEST=None, RESPONSE=None):
        """exports the participants listing in a Webex-compatible CSV file"""

        # This will be refactored to export to Skype, Webex will be shut
        # down. Right now this method is not used.

        header = [
            'UUID', 'Name', 'Email', 'Company', 'JobTitle', 'URL', 'OffCntry',
            'OffLocal', 'CellCntry', 'CellLocal', 'FaxCntry', 'FaxLocal',
            'Address1', 'Address2', 'City', 'State/Province', 'Zip/Postal',
            'Country', 'Time Zone', 'Language', 'Locale', 'UserName', 'Notes'
        ]
        rows = []
        participants = self.getAttendees()
        for participant in participants:
            part_info = self.getAttendeeInfo(participant)
            participant_info = [
                part_info['uid'], part_info['name'], part_info['email'],
                part_info['organization'], part_info['role'], '',
                part_info['phone'], '', '', '', '', '', '', '', '', '', '',
                country_from_country_code.get(part_info['country'], ''), '',
                '', '', part_info['uid'], ''
            ]
            rows.append(participant_info)

        filename = '%s_%s_%s.csv' % (self.getMeeting().getId(
        ), self.id, datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
        RESPONSE.setHeader('Content-Type', 'text/csv')
        RESPONSE.setHeader('Content-Disposition',
                           'attachment; filename=%s' % filename)
        return generate_csv(header, rows)
    def download_webex(self, REQUEST=None, RESPONSE=None):
        """exports the participants listing in a Webex-compatible CSV file"""

        # This will be refactored to export to Skype, Webex will be shut
        # down. Right now this method is not used.

        header = ['UUID', 'Name', 'Email', 'Company', 'JobTitle', 'URL',
                  'OffCntry', 'OffLocal', 'CellCntry', 'CellLocal', 'FaxCntry',
                  'FaxLocal', 'Address1', 'Address2', 'City', 'State/Province',
                  'Zip/Postal', 'Country', 'Time Zone', 'Language', 'Locale',
                  'UserName', 'Notes']
        rows = []
        participants = self.getAttendees()
        for participant in participants:
            part_info = self.getAttendeeInfo(participant)
            participant_info = [
                part_info['uid'], part_info['name'], part_info['email'],
                part_info['organization'], part_info['role'],
                '', part_info['phone'], '', '', '', '', '', '', '', '', '', '',
                country_from_country_code.get(part_info['country'], ''),
                '', '', '', part_info['uid'], '']
            rows.append(participant_info)

        filename = '%s_%s_%s.csv' % (self.getMeeting().getId(), self.id,
                                     datetime.now().strftime(
                                     "%Y-%m-%d_%H-%M-%S"))
        RESPONSE.setHeader('Content-Type', 'text/csv')
        RESPONSE.setHeader('Content-Disposition', 'attachment; filename=%s'
                           % filename)
        return generate_csv(header, rows)
    def download(self, REQUEST=None, RESPONSE=None):
        """exports the participants listing in an excel file"""
        assert self.rstk.we_provide('Excel export')

        header = ['Name', 'User ID', 'Email', 'Organisation',
                  'Represented country', 'Reimbursed participation', 'Phone',
                  'Status', 'Last modified by',
                  'Reason for modification (when saved by an administrator)']
        meeting = self.getMeeting()
        survey = self.get_survey()
        if meeting.survey_required and survey:
            survey_questions = []
            for question in self.get_survey_questions():
                survey_question = getattr(survey, question[0])
                if survey_question.meta_type == 'Naaya Radio Matrix Widget':
                    survey_questions.extend(survey_question.rows)
                else:
                    survey_questions.append(question[1])
            header.extend(survey_questions)
        rows = []
        participants = self.getAttendees()
        for participant in participants:
            part_info = self.getAttendeeInfo(participant)
            participant_info = [
                part_info['name'], part_info['uid'], part_info['email'],
                part_info['organization'],
                country_from_country_code.get(part_info['country'], ''),
                part_info['reimbursed'], part_info['phone'], part_info['role'],
                part_info['saved_by'], part_info['justification']]
            if meeting.survey_required and survey:
                survey_answers = []
                for question in self.get_survey_questions():
                    survey_question = getattr(survey, question[0])
                    survey_answer = self.get_survey_answer(part_info['uid'],
                                                           question[0])
                    if survey_answer is None:
                        survey_answer = '-'
                    if isinstance(survey_answer, basestring):
                        survey_answers.append(survey_answer)
                    else:
                        survey_answers.extend(survey_answer)
                participant_info.extend(survey_answers)
            rows.append(participant_info)

        filename = '%s_%s_%s.xls' % (self.getMeeting().getId(), self.id,
                                     datetime.now().strftime(
                                     "%Y-%m-%d_%H-%M-%S"))
        RESPONSE.setHeader('Content-Type', 'application/vnd.ms-excel')
        RESPONSE.setHeader('Content-Disposition', 'attachment; filename=%s'
                           % filename)
        return generate_excel(header, rows)
Beispiel #4
0
    def download(self, REQUEST=None, RESPONSE=None):
        """exports the participants listing in an excel file"""
        assert self.rstk.we_provide('Excel export')

        header = [
            'Name', 'User ID', 'Email', 'Organisation', 'Represented country',
            'Reimbursed participation', 'Phone', 'Status', 'Last modified by',
            'Reason for modification (when saved by an administrator)'
        ]
        meeting = self.getMeeting()
        if meeting.survey_required and self.get_survey():
            header.extend(
                [question[1] for question in self.get_survey_questions()])
        rows = []
        participants = self.getAttendees()
        for participant in participants:
            part_info = self.getAttendeeInfo(participant)
            participant_info = [
                part_info['name'], part_info['uid'], part_info['email'],
                part_info['organization'],
                country_from_country_code.get(part_info['country'], ''),
                part_info['reimbursed'], part_info['phone'], part_info['role'],
                part_info['saved_by'], part_info['justification']
            ]
            if meeting.survey_required and self.get_survey():
                survey_answers = [
                    self.get_survey_answer(part_info['uid'], question[0])
                    or '-' for question in self.get_survey_questions()
                ]
                participant_info.extend(survey_answers)
            rows.append(participant_info)

        filename = '%s_%s_%s.xls' % (self.getMeeting().getId(
        ), self.id, datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
        RESPONSE.setHeader('Content-Type', 'application/vnd.ms-excel')
        RESPONSE.setHeader('Content-Disposition',
                           'attachment; filename=%s' % filename)
        return generate_excel(header, rows)
 def get_country(self, country_code):
     """ """
     if country_code is None:
         return '-'
     return country_from_country_code.get(country_code, country_code)