Example #1
0
    def _drawLogo(self, c, drawTitle = True):
        from indico.modules.events.util import create_event_logo_tmp_file
        logo = self._conf.as_event.logo
        imagePath = ""
        if logo:
            imagePath = create_event_logo_tmp_file(self._conf.as_event).name
        if imagePath:
            try:
                img = PILImage.open(imagePath)
                width, height = img.size

                # resize in case too big for page
                if width > self._PAGE_WIDTH / 2:
                    ratio =  float(height)/width
                    width = self._PAGE_WIDTH / 2
                    height = width * ratio
                startHeight = self._PAGE_HEIGHT

                if drawTitle:
                    startHeight = self._drawWrappedString(c, escape(self._conf.getTitle()), height=self._PAGE_HEIGHT - inch)

                # lower edge of the image
                startHeight = startHeight - inch / 2 - height

                # draw horizontally centered, with recalculated width and height
                c.drawImage(imagePath, self._PAGE_WIDTH/2.0 - width/2, startHeight, width, height, mask="auto")
                return startHeight
            except IOError:
                if drawTitle:
                    self._drawWrappedString(c, escape(self._conf.getTitle()), height=self._PAGE_HEIGHT - inch)
        return 0
Example #2
0
    def __init__(self, abstract, tz=None):
        super(AbstractToPDF, self).__init__()

        self._abstract = abstract
        event = abstract.event

        if tz is None:
            tz = event.timezone

        self._args.update({
            'doc_type':
            'abstract',
            'management':
            False,
            'abstract':
            abstract,
            'event':
            event,
            'tz':
            timezone(tz),
            'track_class':
            self._get_track_classification(abstract),
            'contrib_type':
            self._get_contrib_type(abstract),
        })
        self._args['logo_img'] = create_event_logo_tmp_file(
            event, self.source_dir) if event.logo else None
Example #3
0
    def __init__(self, contrib, tz=None):
        super().__init__()

        event = contrib.event
        affiliations, author_mapping, coauthor_mapping = extract_affiliations(
            contrib)

        self._args.update({
            'doc_type':
            'contribution',
            'affiliations':
            affiliations,
            'authors_affil':
            author_mapping,
            'coauthors_affil':
            coauthor_mapping,
            'contrib':
            contrib,
            'event':
            event,
            'tz':
            timezone(tz or event.timezone),
            'link_format':
            boa_settings.get(event, 'link_format'),
        })

        self._args['logo_img'] = create_event_logo_tmp_file(
            event, self.source_dir) if event.logo else None
Example #4
0
    def __init__(self, event, user, contribs=None, tz=None, sort_by=""):
        super().__init__()

        tz = tz or event.timezone
        contribs = sort_contribs(contribs or event.contributions, sort_by)
        affiliation_contribs = {}
        corresp_authors = {}

        for contrib in contribs:
            affiliations, author_mapping, coauthor_mapping = extract_affiliations(
                contrib)
            affiliation_contribs[contrib.id] = {
                'affiliations': affiliations,
                'authors_affil': author_mapping,
                'coauthors_affil': coauthor_mapping
            }

            # figure out "corresponding author(s)"
            if boa_settings.get(event, 'corresponding_author'
                                ) == BOACorrespondingAuthorType.submitter:
                corresp_authors[contrib.id] = [
                    pl.person.email for pl in contrib.person_links
                    if pl.is_submitter and pl.person.email
                ]
            if boa_settings.get(event, 'corresponding_author'
                                ) == BOACorrespondingAuthorType.speakers:
                corresp_authors[contrib.id] = [
                    speaker.person.email for speaker in contrib.speakers
                    if speaker.person.email
                ]

        self._args.update({
            'affiliation_contribs':
            affiliation_contribs,
            'corresp_authors':
            corresp_authors,
            'contribs':
            contribs,
            'event':
            event,
            'tz':
            timezone(tz or event.timezone),
            'url':
            event.url,
            'sorted_by':
            sort_by,
            'user':
            user,
            'boa_text':
            boa_settings.get(event, 'extra_text'),
            'boa_text_end':
            boa_settings.get(event, 'extra_text_end'),
            'min_lines_per_abstract':
            boa_settings.get(event, 'min_lines_per_abstract'),
            'link_format':
            boa_settings.get(event, 'link_format'),
        })

        self._args['logo_img'] = create_event_logo_tmp_file(
            event, self.source_dir) if event.logo else None
Example #5
0
    def __init__(self, event, abstracts, tz=None):
        super().__init__()
        if tz is None:
            self._tz = event.timezone

        self._args.update({
            'event':
            event,
            'doc_type':
            'abstract',
            'management':
            False,
            'title':
            _("Report of Abstracts"),
            'get_track_classification':
            AbstractToPDF._get_track_classification,
            'get_contrib_type':
            AbstractToPDF._get_contrib_type,
            'items':
            abstracts,
            'url':
            event.short_external_url,
            'link_format':
            boa_settings.get(event, 'link_format'),
        })

        self._args['logo_img'] = create_event_logo_tmp_file(
            event, self.source_dir) if event.logo else None
Example #6
0
    def __init__(self, event, user, contribs=None, tz=None, sort_by=""):
        super(ContributionBook, self).__init__()

        tz = tz or event.timezone
        contribs = self._sort_contribs(contribs or event.contributions,
                                       sort_by)
        affiliation_contribs = {}
        corresp_authors = {}

        for contrib in contribs:
            affiliations, author_mapping, coauthor_mapping = extract_affiliations(
                contrib)
            affiliation_contribs[contrib.id] = {
                'affiliations': affiliations,
                'authors_affil': author_mapping,
                'coauthors_affil': coauthor_mapping
            }

            # figure out "corresponding author(s)"
            if boa_settings.get(event, 'corresponding_author'
                                ) == BOACorrespondingAuthorType.submitter:
                corresp_authors[contrib.id] = [
                    pl.person.email for pl in contrib.person_links
                    if pl.is_submitter
                ]
            if boa_settings.get(event, 'corresponding_author'
                                ) == BOACorrespondingAuthorType.speakers:
                corresp_authors[contrib.id] = [
                    speaker.person.email for speaker in contrib.speakers
                ]

        self._args.update({
            'affiliation_contribs':
            affiliation_contribs,
            'corresp_authors':
            corresp_authors,
            'contribs':
            contribs,
            'event':
            event,
            'tz':
            timezone(tz or event.timezone),
            'url':
            event.url,
            'fields': [f for f in event.contribution_fields if f.is_active],
            'sorted_by':
            sort_by,
            'user':
            user,
            'boa_text':
            boa_settings.get(event, 'extra_text')
        })

        self._args['logo_img'] = create_event_logo_tmp_file(
            event).name if event.logo else None
Example #7
0
    def __init__(self, event, contribs, tz=None):
        super(ContribsToPDF, self).__init__()

        self._args.update({
            'doc_type': 'contribution',
            'title': _("Report of Contributions"),
            'event': event,
            'items': contribs,
            'url': event.short_external_url,
            'tz': timezone(tz or event.timezone)
        })

        self._args['logo_img'] = create_event_logo_tmp_file(event).name if event.logo else None
Example #8
0
    def __init__(self, event, contribs, tz=None):
        super(ContribsToPDF, self).__init__()

        self._args.update({
            'doc_type': 'contribution',
            'title': _("Report of Contributions"),
            'event': event,
            'items': contribs,
            'url': event.short_external_url,
            'tz': timezone(tz or event.timezone)
        })

        self._args['logo_img'] = create_event_logo_tmp_file(
            event, self.source_dir) if event.logo else None
Example #9
0
    def __init__(self, event, contribs, tz=None):
        super().__init__()

        self._args.update({
            'doc_type': 'contribution',
            'title': _('Report of Contributions'),
            'event': event,
            'items': contribs,
            'url': event.short_external_url,
            'tz': timezone(tz or event.timezone),
            'link_format': boa_settings.get(event, 'link_format'),
        })

        self._args['logo_img'] = create_event_logo_tmp_file(event, self.source_dir) if event.logo else None
Example #10
0
    def __init__(self, contrib, tz=None):
        super(ContribToPDF, self).__init__()

        event = contrib.event
        affiliations, author_mapping, coauthor_mapping = extract_affiliations(contrib)

        self._args.update({
            'doc_type': 'contribution',
            'affiliations': affiliations,
            'authors_affil': author_mapping,
            'coauthors_affil': coauthor_mapping,
            'contrib': contrib,
            'event': event,
            'tz': timezone(tz or event.timezone),
        })

        self._args['logo_img'] = create_event_logo_tmp_file(event).name if event.logo else None
Example #11
0
    def __init__(self, event, abstracts, tz=None):
        super(AbstractsToPDF, self).__init__()
        if tz is None:
            self._tz = event.timezone

        self._args.update({
            'event': event,
            'doc_type': 'abstract',
            'management': False,
            'title': _("Report of Abstracts"),
            'get_track_classification': AbstractToPDF._get_track_classification,
            'get_contrib_type': AbstractToPDF._get_contrib_type,
            'items': abstracts,
            'url': event.short_external_url,
        })

        self._args['logo_img'] = create_event_logo_tmp_file(event).name if event.logo else None
Example #12
0
    def __init__(self, contrib, tz=None):
        super(ContribToPDF, self).__init__()

        event = contrib.event
        affiliations, author_mapping, coauthor_mapping = extract_affiliations(
            contrib)

        self._args.update({
            'doc_type': 'contribution',
            'affiliations': affiliations,
            'authors_affil': author_mapping,
            'coauthors_affil': coauthor_mapping,
            'contrib': contrib,
            'event': event,
            'tz': timezone(tz or event.timezone),
        })

        self._args['logo_img'] = create_event_logo_tmp_file(
            event).name if event.logo else None
Example #13
0
    def __init__(self, abstract, tz=None):
        super(AbstractToPDF, self).__init__()

        self._abstract = abstract
        event = abstract.event

        if tz is None:
            tz = event.timezone

        self._args.update({
            'doc_type': 'abstract',
            'management': False,
            'abstract': abstract,
            'event': event,
            'tz': timezone(tz),
            'track_class': self._get_track_classification(abstract),
            'contrib_type': self._get_contrib_type(abstract),
        })
        self._args['logo_img'] = create_event_logo_tmp_file(event).name if event.logo else None
Example #14
0
    def __init__(self, event, user, contribs=None, tz=None, sort_by=""):
        super(ContributionBook, self).__init__()

        tz = tz or event.timezone
        contribs = self._sort_contribs(contribs or event.contributions, sort_by)
        affiliation_contribs = {}
        corresp_authors = {}

        for contrib in contribs:
            affiliations, author_mapping, coauthor_mapping = extract_affiliations(contrib)
            affiliation_contribs[contrib.id] = {
                'affiliations': affiliations,
                'authors_affil': author_mapping,
                'coauthors_affil': coauthor_mapping
            }

            # figure out "corresponding author(s)"
            if boa_settings.get(event, 'corresponding_author') == BOACorrespondingAuthorType.submitter:
                corresp_authors[contrib.id] = [pl.person.email for pl in contrib.person_links if pl.is_submitter]
            if boa_settings.get(event, 'corresponding_author') == BOACorrespondingAuthorType.speakers:
                corresp_authors[contrib.id] = [speaker.person.email for speaker in contrib.speakers]

        self._args.update({
            'affiliation_contribs': affiliation_contribs,
            'corresp_authors': corresp_authors,
            'contribs': contribs,
            'event': event,
            'tz': timezone(tz or event.timezone),
            'url': event.url,
            'fields': [f for f in event.contribution_fields if f.is_active],
            'sorted_by': sort_by,
            'user': user,
            'boa_text': boa_settings.get(event, 'extra_text')
        })

        self._args['logo_img'] = create_event_logo_tmp_file(event).name if event.logo else None