def _process(self): form = build_review_form(review=self.review) if form.validate_on_submit(): update_review(self.review, **form.split_data) return jsonify_data(flash=False, html=render_paper_page(self.paper)) tpl = get_template_module('events/reviews/forms.html') return jsonify(html=tpl.render_review_form(form, review=self.review), js=_pop_injected_js())
def _process(self): form = build_review_form(self.abstract, self.track) if form.validate_on_submit(): create_abstract_review(self.abstract, self.track, session.user, **form.split_data) return jsonify_data(flash=False, html=render_abstract_page(self.abstract, management=self.management)) tpl = get_template_module('events/reviews/forms.html') return jsonify(html=tpl.render_review_form(form, proposal=self.abstract, group=self.track), js=_pop_injected_js())
def _process(self): if not self.plugin.can_manage_vc_rooms(session.user, self.event_new): flash( _("You are not allowed to modify {} rooms for this event.").format(self.plugin.friendly_name), "error" ) return redirect(url_for(".manage_vc_rooms", self.event_new)) form = self.plugin.create_form( self.event_new, existing_vc_room=self.vc_room, existing_event_vc_room=self.event_vc_room ) if form.validate_on_submit(): self.plugin.update_data_vc_room(self.vc_room, form.data) event_vc_room = process_vc_room_association( self.plugin, self.event_new, self.vc_room, form, event_vc_room=self.event_vc_room, allow_same_room=True ) if not event_vc_room: return redirect(url_for(".manage_vc_rooms", self.event_new)) self.vc_room.modified_dt = now_utc() try: self.plugin.update_room(self.vc_room, self.event_new) except VCRoomNotFoundError as err: Logger.get("modules.vc").warning("VC room {} not found. Setting it as deleted.".format(self.vc_room)) self.vc_room.status = VCRoomStatus.deleted flash(err.message, "error") return redirect(url_for(".manage_vc_rooms", self.event_new)) except VCRoomError as err: if err.field is None: raise field = getattr(form, err.field) field.errors.append(err.message) transaction.abort() else: # TODO # notify_modified(self.vc_room, self.event_new, session.user) flash( _("{plugin_name} room '{room.name}' updated").format( plugin_name=self.plugin.friendly_name, room=self.vc_room ), "success", ) return jsonify_data(flash=False) form_html = self.plugin.render_form( plugin=self.plugin, event=self.event_new, form=form, existing_vc_room=self.vc_room, skip_fields=form.skip_fields | {"name"}, ) return jsonify(html=form_html, js=_pop_injected_js())
def _process(self): if not self.plugin.can_manage_vc_rooms(session.user, self.event_new): flash( _("You are not allowed to create {plugin_name} rooms for this event.").format( plugin_name=self.plugin.friendly_name ), "error", ) return redirect(url_for(".manage_vc_rooms", self.event_new)) form = self.plugin.create_form(event=self.event_new) if form.validate_on_submit(): vc_room = VCRoom(created_by_user=session.user) vc_room.type = self.plugin.service_name vc_room.status = VCRoomStatus.created event_vc_room = process_vc_room_association(self.plugin, self.event_new, vc_room, form) if not event_vc_room: return redirect(url_for(".manage_vc_rooms", self.event_new)) with db.session.no_autoflush: self.plugin.update_data_vc_room(vc_room, form.data) try: # avoid flushing the incomplete vc room to the database with db.session.no_autoflush: self.plugin.create_room(vc_room, self.event_new) notify_created(self.plugin, vc_room, event_vc_room, self.event_new, session.user) except VCRoomError as err: if err.field is None: raise field = getattr(form, err.field) field.errors.append(err.message) transaction.abort() # otherwise the incomplete vc room would be added to the db! else: db.session.add(vc_room) # TODO: notify_created(vc_room, self.event_new, session.user) flash( _("{plugin_name} room '{room.name}' created").format( plugin_name=self.plugin.friendly_name, room=vc_room ), "success", ) return jsonify_data(flash=False) form_html = self.plugin.render_form( plugin=self.plugin, event=self.event_new, form=form, skip_fields=form.skip_fields | {"name"} ) return jsonify(html=form_html, js=_pop_injected_js())
def _process(self): form = build_review_form(self.abstract, self.track) if form.validate_on_submit(): create_abstract_review(self.abstract, self.track, session.user, **form.split_data) return jsonify_data(flash=False, html=render_abstract_page( self.abstract, management=self.management)) tpl = get_template_module('events/reviews/forms.html') return jsonify(html=tpl.render_review_form(form, proposal=self.abstract, group=self.track), js=_pop_injected_js())
def _process(self): if not self.plugin.can_manage_vc_rooms(session.user, self.event): flash( _('You are not allowed to create {plugin_name} rooms for this event.' ).format(plugin_name=self.plugin.friendly_name), 'error') raise Forbidden form = self.plugin.create_form(event=self.event) if form.validate_on_submit(): vc_room = VCRoom(created_by_user=session.user) vc_room.type = self.plugin.service_name vc_room.status = VCRoomStatus.created event_vc_room = process_vc_room_association( self.plugin, self.event, vc_room, form) if not event_vc_room: return jsonify_data(flash=False) with db.session.no_autoflush: self.plugin.update_data_vc_room(vc_room, form.data) try: # avoid flushing the incomplete vc room to the database with db.session.no_autoflush: self.plugin.create_room(vc_room, self.event) notify_created(self.plugin, vc_room, event_vc_room, self.event, session.user) except VCRoomError as err: if err.field is None: raise field = getattr(form, err.field) field.errors.append(err.message) db.session.rollback( ) # otherwise the incomplete vc room would be added to the db! else: db.session.add(vc_room) flash( _("{plugin_name} room '{room.name}' created").format( plugin_name=self.plugin.friendly_name, room=vc_room), 'success') return jsonify_data(flash=False) form_html = self.plugin.render_form(plugin=self.plugin, event=self.event, form=form, skip_fields=form.skip_fields | {'name'}) return jsonify(html=form_html, js=_pop_injected_js())
def _process(self): if not self.plugin.can_manage_vc_rooms(session.user, self.event): flash(_('You are not allowed to modify {} rooms for this event.').format(self.plugin.friendly_name), 'error') raise Forbidden form = self.plugin.create_form(self.event, existing_vc_room=self.vc_room, existing_event_vc_room=self.event_vc_room) if form.validate_on_submit(): self.plugin.update_data_vc_room(self.vc_room, form.data) event_vc_room = process_vc_room_association( self.plugin, self.event, self.vc_room, form, event_vc_room=self.event_vc_room, allow_same_room=True) if not event_vc_room: return jsonify_data(flash=False) self.vc_room.modified_dt = now_utc() try: self.plugin.update_room(self.vc_room, self.event) except VCRoomNotFoundError as err: Logger.get('modules.vc').warning('Videoconference %r not found. Setting it as deleted.', self.vc_room) self.vc_room.status = VCRoomStatus.deleted flash(str(err), 'error') return jsonify_data(flash=False) except VCRoomError as err: if err.field is None: raise field = getattr(form, err.field) field.errors.append(str(err)) db.session.rollback() else: # TODO # notify_modified(self.vc_room, self.event, session.user) flash(_("{plugin_name} room '{room.name}' updated").format( plugin_name=self.plugin.friendly_name, room=self.vc_room), 'success') return jsonify_data(flash=False) form_html = self.plugin.render_form(plugin=self.plugin, event=self.event, form=form, existing_vc_room=self.vc_room, skip_fields=form.skip_fields | {'name'}) return jsonify(html=form_html, js=_pop_injected_js())
def _process(self): form = _make_theme_settings_form(self.event, request.args['theme']) if not form: return jsonify() tpl = get_template_module('forms/_form.html') return jsonify(html=tpl.form_rows(form), js=_pop_injected_js())
def _process(self): form = build_review_form(self.paper.last_revision, self.type) if form.validate_on_submit(): create_review(self.paper, self.type, session.user, **form.split_data) return jsonify_data(flash=False, html=render_paper_page(self.paper)) tpl = get_template_module('events/reviews/forms.html') return jsonify(html=tpl.render_review_form(form, proposal=self.paper, group=self.type), js=_pop_injected_js())