How to use the indico.util.i18n._ function in indico

To help you get started, weโ€™ve selected a few indico examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github indico / indico / indico / modules / events / management / controllers / posters.py View on Github external
def _process(self):
        self.commit = False
        form = PosterPrintingForm(self.event, template=self.template_id)
        if form.validate_on_submit():
            data = dict(form.data)
            template_id = data.pop('template')
            key = unicode(uuid.uuid4())
            poster_cache.set(key, data, time=1800)
            download_url = url_for('.print_poster', self.event, template_id=template_id, uuid=key)
            return jsonify_data(flash=False, redirect=download_url, redirect_no_loading=True)
        return jsonify_form(form, disabled_until_change=False, back=_('Cancel'), submit=_('Download PDF'))
github indico / indico / indico / modules / events / registration / controllers / management / regforms.py View on Github external
def _process(self):
        form = RegistrationFormForm()
        if form.validate_on_submit():
            regform = RegistrationForm(event_new=self.event_new)
            create_personal_data_fields(regform)
            form.populate_obj(regform)
            db.session.add(regform)
            db.session.flush()
            flash(_('Registration form has been successfully created'), 'success')
            self.event.log(EventLogRealm.management, EventLogKind.positive, 'Registration',
                           'Registration form "{}" has been created'.format(regform.title), session.user)
            return redirect(url_for('.manage_regform', regform))
        return WPManageRegistration.render_template('management/regform_edit.html', self.event, event=self.event,
                                                    form=form)
github indico / indico / indico / web / forms / fields / markdown.py View on Github external
def __init__(self, *args, **kwargs):
        self.use_editor = kwargs.pop('editor', False)
        self.use_mathjax = kwargs.pop('mathjax', False)
        orig_id = kwargs['_prefix'] + kwargs['_name']
        if self.use_editor:
            # WMD relies on this awful ID :/
            kwargs['id'] = 'wmd-input-f_' + orig_id
        else:
            kwargs.setdefault('description', _(u"You can use Markdown or basic HTML formatting tags."))
        super(IndicoMarkdownField, self).__init__(*args, **kwargs)
        self.orig_id = orig_id
github indico / indico / indico / modules / events / management / __init__.py View on Github external
def _sidemenu_items(sender, event, **kwargs):
    if event.can_manage(session.user):
        yield SideMenuItem('settings', _('Settings'), url_for('event_management.settings', event), 100, icon='settings')
        yield SideMenuItem('protection', _('Protection'), url_for('event_management.protection', event),
                           60, icon='shield')
github indico / indico / indico / modules / events / timetable / forms.py View on Github external
shift_later = BooleanField(_('Shift down'), widget=SwitchWidget(),
                               description=_("Shift down everything else that starts after this"))

    def __init__(self, *args, **kwargs):
        self.entry = kwargs.pop('entry')
        self._entry_type = self.entry.type
        super(BaseEntryForm, self).__init__(*args, **kwargs)

    def validate_duration(self, field):
        super(BaseEntryForm, self).validate_duration(field)
        if self.entry.type == TimetableEntryType.SESSION_BLOCK and self.entry.children:
            SessionBlockEntryForm._validate_duration(self.entry, field, self.start_dt)


_DOCUMENT_SETTINGS_CHOICES = [('showCoverPage', _('Include cover page')),
                              ('showTableContents', _('Include table of contents')),
                              ('showSessionTOC', _('Show list of sessions in the table of contents'))]
_CONTRIBUTION_CHOICES = [('showContribId', _('Print the ID of each contribution')),
                         ('showAbstract', _('Print abstract content of all contributions')),
                         ('dontShowPosterAbstract', _('Do not print the abstract content for poster sessions')),
                         ('showLengthContribs', _('Include length of the contributions'))]
_SESSION_CHOICES = [('newPagePerSession', _('Print each session on a separate page')),
                    ('useSessionColorCodes', _('Use session color codes')),
                    ('showSessionDescription', _('Include session description')),
                    ('printDateCloseToSessions', _('Print the start date close to session title'))]
_VISIBLE_ENTRIES_CHOICES = [('showContribsAtConfLevel', _('Include top-level contributions')),
                            ('showBreaksAtConfLevel', _('Include top-level breaks'))]
_OTHER_CHOICES = [('showSpeakerTitle', _('Show speaker title')),
                  ('showSpeakerAffiliation', _('Show speaker affiliation'))]


class TimetablePDFExportForm(IndicoForm):
github indico / indico / indico / modules / events / registration / forms.py View on Github external
def is_submitted(self):
        return super(EmailRegistrantsForm, self).is_submitted() and 'submitted' in request.form


class TicketsForm(IndicoForm):
    tickets_enabled = BooleanField(_('Enable Tickets'), widget=SwitchWidget(),
                                   description=_('Create tickets for registrations using this registration form.'))
    ticket_on_email = BooleanField(_('Send with an e-mail'), [HiddenUnless('tickets_enabled',
                                                                           preserve_data=True)],
                                   widget=SwitchWidget(),
                                   description=_('Attach PDF ticket to the email sent to a user after completing '
                                                 'their registration.'))
    ticket_on_event_page = BooleanField(_('Download from event homepage'), [HiddenUnless('tickets_enabled',
                                                                                         preserve_data=True)],
                                        widget=SwitchWidget(),
                                        description=_('Allow users to download their ticket from the '
                                                      'conference homepage.'))
    ticket_on_summary_page = BooleanField(_('Download from summary page'), [HiddenUnless('tickets_enabled',
                                                                                         preserve_data=True)],
                                          widget=SwitchWidget(),
                                          description=_('Allow users to download their ticket from the registration '
                                                        'summary page.'))

    ticket_template_id = SelectField(_('Ticket template'), [HiddenUnless('tickets_enabled', preserve_data=True),
                                                            Optional()], coerce=int)

    def __init__(self, *args, **kwargs):
        event = kwargs.pop('event')
        super(TicketsForm, self).__init__(*args, **kwargs)
        default_tpl = get_default_template_on_category(event.category)
        all_templates = set(event.designer_templates) | get_inherited_templates(event)
        badge_templates = [(tpl.id, tpl.title) for tpl in all_templates
github indico / indico / indico / modules / events / surveys / controllers / management / questionnaire.py View on Github external
def _process(self):
        db.session.delete(self.text)
        db.session.flush()
        flash(_('Text item deleted'), 'success')
        logger.info('Survey question %s deleted by %s', self.text, session.user)
        return jsonify_data(questionnaire=_render_questionnaire_preview(self.text.survey))
github indico / indico / indico / modules / events / abstracts / placeholders.py View on Github external
return abstract.submitter.last_name


class SubmitterTitlePlaceholder(Placeholder):
    name = 'submitter_title'
    description = _('The title of the submitter (Dr, Prof., etc...)')

    @classmethod
    def render(cls, abstract):
        return orig_string(abstract.submitter.title)


class ContributionURLPlaceholder(Placeholder):
    advanced = True
    name = 'contribution_url'
    description = _('Contribution URL')

    @classmethod
    def render(cls, abstract):
        if abstract.contribution:
            return url_for('contributions.display_contribution', abstract.contribution, _external=True)
        return ''


class TargetAbstractIDPlaceholder(Placeholder):
    name = 'target_abstract_id'
    description = _("The ID of the target abstract (merge or duplicate)")

    @classmethod
    def render(cls, abstract):
        target = abstract.merged_into or abstract.duplicate_of
        return unicode(target.friendly_id) if target else ''
github indico / indico / indico / modules / rb / controllers / forms.py View on Github external
def validate_start(self, field):
        if self.start.data and self.end.data and self.start.data >= self.end.data:
            raise ValidationError('The start date must be earlier than the end date.')

    validate_end = validate_start


class RoomForm(IndicoForm):
    name = StringField(_('Name'))
    site = StringField(_('Site'))
    building = StringField(_('Building'), [DataRequired()])
    floor = StringField(_('Floor'), [DataRequired()])
    number = StringField(_('Number'), [DataRequired()])
    longitude = FloatField(_('Longitude'), [Optional(), NumberRange(min=0)])
    latitude = FloatField(_('Latitude'), [Optional(), NumberRange(min=0)])
    is_active = BooleanField(_('Active'))
    is_reservable = BooleanField(_('Public'))
    reservations_need_confirmation = BooleanField(_('Confirmations'))
    notification_for_assistance = BooleanField(_('Assistance'))
    notification_for_start = IntegerField(_('Notification on booking start - X days before'),
                                          [Optional(), NumberRange(min=0, max=9)])
    notification_for_end = BooleanField(_('Notification on booking end'))
    notification_for_responsible = BooleanField(_('Notification to responsible, too'))
    owner_id = HiddenField(_('Responsible user'), [DataRequired()])
    key_location = StringField(_('Where is key?'))
    telephone = StringField(_('Telephone'))
    capacity = IntegerField(_('Capacity'), [DataRequired(), NumberRange(min=1)])
    division = StringField(_('Department'))
    surface_area = IntegerField(_('Surface area'), [NumberRange(min=0)])
    max_advance_days = IntegerField(_('Maximum advance time for bookings'), [NumberRange(min=1)])
    comments = TextAreaField(_('Comments'))
    delete_photos = BooleanField(_('Delete photos'))
github indico / indico / indico / MaKaC / services / implementation / admin.py View on Github external
def _getAnswer(self):
        try:
            entry = session.pop('login_as_orig_user')
        except KeyError:
            raise NoReportError(_('No login-as history entry found'))

        session.user = User.get(entry['user_id'])
        session.update(entry['session_data'])
        return True