Exemple #1
0
 def _process(self):
     person_ids = request.form.getlist('person_id')
     user_ids = request.form.getlist('user_id')
     recipients = set(
         self._find_event_persons(
             person_ids,
             request.args.get('not_invited_only') == '1'))
     recipients |= set(self._find_users(user_ids))
     if self.no_account:
         tpl = get_template_module('events/persons/emails/invitation.html',
                                   event=self.event_new)
         disabled_until_change = False
     else:
         tpl = get_template_module('events/persons/emails/generic.html',
                                   event=self.event_new)
         disabled_until_change = True
     form = EmailEventPersonsForm(person_id=person_ids,
                                  user_id=user_ids,
                                  recipients=[x.email for x in recipients],
                                  body=tpl.get_html_body(),
                                  subject=tpl.get_subject(),
                                  register_link=self.no_account)
     if form.validate_on_submit():
         self._send_emails(form, recipients)
         num = len(recipients)
         flash(
             ngettext('Your email has been sent.',
                      '{} emails have been sent.', num).format(num))
         return jsonify_data()
     return jsonify_template('events/persons/email_dialog.html',
                             form=form,
                             disabled_until_change=disabled_until_change)
Exemple #2
0
 def _process(self):
     form = EventPersonForm(obj=FormDefaults(self.person, skip_attrs={'title'}, title=self.person._title))
     if form.validate_on_submit():
         update_person(self.person, form.data)
         person_data = self.get_persons()[self.person.email or self.person.id]
         tpl = get_template_module('events/persons/management/_person_list_row.html')
         return jsonify_data(html=tpl.render_person_row(person_data))
     return jsonify_form(form)
Exemple #3
0
 def _process(self):
     form = EventPersonForm(obj=FormDefaults(self.person, skip_attrs={'title'}, title=self.person._title))
     if form.validate_on_submit():
         update_person(self.person, form.data)
         person_data = self.get_persons()[self.person.email]
         tpl = get_template_module('events/persons/management/_person_list_row.html')
         return jsonify_data(html=tpl.render_person_row(person_data))
     return jsonify_form(form)
Exemple #4
0
 def _process(self):
     if self.person.has_links:
         raise Forbidden(
             _('Only users with no ties to the event can be deleted.'))
     db.session.delete(self.person)
     logger.info('EventPerson deleted from event %r: %r', self.event,
                 self.person)
     return jsonify_data()
Exemple #5
0
    def _process_POST(self):
        category = self._conf.getOwner()
        self._conf.delete(session.user)
        flash(_('Event "{}" successfully deleted.').format(self._conf.title), 'success')

        if category:
            redirect_url = url_for('category_mgmt.categoryModification', category)
        else:
            redirect_url = url_for('misc.index')

        return jsonify_data(url=redirect_url, flash=False)
Exemple #6
0
 def _process(self):
     person_ids = request.form.getlist('person_id')
     recipients = {p.email for p in self._find_event_persons(person_ids) if p.email}
     form = EmailEventPersonsForm(person_id=person_ids, recipients=', '.join(recipients))
     if form.validate_on_submit():
         for recipient in recipients:
             email = make_email(to_list=recipient, from_address=form.from_address.data,
                                subject=form.subject.data, body=form.body.data, html=True)
             send_email(email, self.event_new, 'Event Persons')
         num = len(recipients)
         flash(ngettext('Your email has been sent.', '{} emails have been sent.', num).format(num))
         return jsonify_data()
     return jsonify_form(form, submit=_('Send'))
Exemple #7
0
 def _process(self):
     person_ids = request.form.getlist('person_id')
     recipients = {p.email for p in self._find_event_persons(person_ids) if p.email}
     form = EmailEventPersonsForm(person_id=person_ids, recipients=', '.join(recipients))
     if form.validate_on_submit():
         for recipient in recipients:
             email = make_email(to_list=recipient, from_address=form.from_address.data,
                                subject=form.subject.data, body=form.body.data, html=True)
             send_email(email, self.event_new, 'Event Persons')
         num = len(recipients)
         flash(ngettext('Your email has been sent.', '{} emails have been sent.', num).format(num))
         return jsonify_data()
     return jsonify_form(form, submit=_('Send'))
Exemple #8
0
    def _process_POST(self):
        category = self._conf.getOwner()
        self._conf.delete(session.user)
        flash(
            _('Event "{}" successfully deleted.').format(self._conf.title),
            'success')

        if category:
            redirect_url = url_for('category_mgmt.categoryModification',
                                   category)
        else:
            redirect_url = url_for('misc.index')

        return jsonify_data(url=redirect_url, flash=False)
Exemple #9
0
 def _process(self):
     person_ids = request.form.getlist('person_id')
     user_ids = request.form.getlist('user_id')
     recipients = set(self._find_event_persons(person_ids, request.args.get('not_invited_only') == '1'))
     recipients |= set(self._find_users(user_ids))
     if self.no_account:
         tpl = get_template_module('events/persons/emails/invitation.html', event=self.event)
         disabled_until_change = False
     else:
         tpl = get_template_module('events/persons/emails/generic.html', event=self.event)
         disabled_until_change = True
     form = EmailEventPersonsForm(person_id=person_ids, user_id=user_ids,
                                  recipients=[x.email for x in recipients], body=tpl.get_html_body(),
                                  subject=tpl.get_subject(), register_link=self.no_account, event=self.event)
     if form.validate_on_submit():
         self._send_emails(form, recipients)
         num = len(recipients)
         flash(ngettext('Your email has been sent.', '{} emails have been sent.', num).format(num))
         return jsonify_data()
     return jsonify_template('events/persons/email_dialog.html', form=form,
                             disabled_until_change=disabled_until_change)
Exemple #10
0
 def _process_POST(self):
     self.list_generator.store_configuration()
     return jsonify_data(**self.list_generator.render_contribution_list())
Exemple #11
0
 def _process_POST(self):
     self._conf.setClosed(True)
     flash(_('The event is now locked.'), 'success')
     return jsonify_data(url=url_for('event_mgmt.conferenceModification', self._conf), flash=False)
Exemple #12
0
 def _process_POST(self):
     self.list_generator.store_configuration()
     return jsonify_data(**self.list_generator.render_contribution_list())
Exemple #13
0
 def _process_POST(self):
     self.reporter.store_filters()
     return jsonify_data(**self.reporter.render_contribution_list())
Exemple #14
0
 def _process_POST(self):
     self._conf.setClosed(True)
     flash(_('The event is now locked.'), 'success')
     return jsonify_data(url=url_for('event_mgmt.conferenceModification',
                                     self._conf),
                         flash=False)
Exemple #15
0
 def _process_POST(self):
     self.reporter.store_filters()
     return jsonify_data(**self.reporter.render_contribution_list())