def _process(self): if not retrieve_logs(self.chatroom): flash(_('There are no logs available for this room.'), 'warning') return redirect(url_for_plugin('.manage_rooms', self.event)) return WPChatEventMgmt.render_template('manage_event_logs.html', self._conf, event_chatroom=self.event_chatroom, start_date=self.event.getAdjustedStartDate(), end_date=self.event.getAdjustedEndDate())
def _process(self): chatrooms = ChatroomEventAssociation.find_for_event(self.event, include_hidden=True, _eager='chatroom.events').all() logs_enabled = current_plugin.settings.get('log_url') attach_form = self._get_attach_form() if not attach_form.chatroom._get_object_list(): attach_form = None return WPChatEventMgmt.render_template('manage_event.html', self.event, event_chatrooms=chatrooms, chat_links=current_plugin.settings.get('chat_links'), logs_enabled=logs_enabled, attach_form=attach_form)
def _process(self): defaults = FormDefaults(self.chatroom) for name in EditChatroomForm.event_specific_fields: defaults[name] = getattr(self.event_chatroom, name) form = EditChatroomForm(obj=defaults) if form.validate_on_submit(): form.populate_obj(self.event_chatroom, fields=form.event_specific_fields) form.populate_obj(self.chatroom, skip=form.event_specific_fields) self.chatroom.modified_dt = now_utc() if attrs_changed(self.chatroom, 'name', 'description', 'password'): update_room(self.chatroom) notify_modified(self.chatroom, self.event, session.user) flash(_('Chatroom updated'), 'success') self.event.log(EventLogRealm.management, EventLogKind.change, 'Chat', 'Chatroom updated: {}'.format(self.chatroom.name), session.user) return redirect(url_for_plugin('.manage_rooms', self.event)) return WPChatEventMgmt.render_template('manage_event_edit.html', self._conf, form=form, event_chatroom=self.event_chatroom, event=self.event)
def _process(self): form = AddChatroomForm(obj=FormDefaults(name=to_unicode(self.event.title)), date=self.event.getAdjustedStartDate()) if form.validate_on_submit(): chatroom = Chatroom(created_by_user=session.user) event_chatroom = ChatroomEventAssociation(event_id=self.event_id, chatroom=chatroom) form.populate_obj(event_chatroom, fields=form.event_specific_fields) form.populate_obj(chatroom, skip=form.event_specific_fields) chatroom.jid_node = form.jid_node.data db.session.add_all((chatroom, event_chatroom)) db.session.flush() create_room(chatroom) notify_created(chatroom, self.event, session.user) self.event.log(EventLogRealm.management, EventLogKind.positive, 'Chat', 'Chatroom created: {}'.format(chatroom.name), session.user) flash(_('Chatroom created'), 'success') return redirect(url_for_plugin('.manage_rooms', self.event)) return WPChatEventMgmt.render_template('manage_event_edit.html', self._conf, form=form, event=self.event)