예제 #1
0
 def _process_POST(self):
     self.serializer = TimetableSerializer(self.event, management=True)
     with track_time_changes(auto_extend=True, user=session.user) as changes:
         entry_data = self._move_entry(request.json)
     rv = serialize_entry_update(self.entry) | entry_data
     notifications = get_time_changes_notifications(changes, tzinfo=self.event.tzinfo, entry=self.entry)
     return jsonify_data(flash=False, entry=rv, notifications=notifications)
예제 #2
0
파일: api.py 프로젝트: stomanin/indico
 def export_timetable(self, aw):
     serializer = TimetableSerializer(management=False)
     events = Event.find_all(Event.id.in_(map(int, self._idList)),
                             ~Event.is_deleted)
     return {
         event.id: serializer.serialize_timetable(event)
         for event in events
     }
예제 #3
0
 def _process(self):
     new_start_dt = (self.event_new.tzinfo.localize(dateutil.parser.parse(request.form.get('startDate')))
                     .astimezone(utc))
     shift = new_start_dt - self.entry.start_dt
     with track_time_changes(auto_extend=True, user=session.user) as changes:
         shift_following_entries(self.entry, shift, session_=self.session)
         self.entry.move(new_start_dt)
     serializer = TimetableSerializer(management=True)
     if self.session:
         timetable = serializer.serialize_session_timetable(self.session)
     else:
         timetable = serializer.serialize_timetable(self.event_new)
     notifications = get_time_changes_notifications(changes, tzinfo=self.event_new.tzinfo, entry=self.entry)
     return jsonify_data(flash=False, entry=serialize_entry_update(self.entry), timetable=timetable,
                         notifications=notifications)
예제 #4
0
 def _process_POST(self):
     self.serializer = TimetableSerializer(True)
     with track_time_changes(auto_extend=True, user=session.user) as changes:
         entry_data = self._move_entry(request.json)
     rv = dict(serialize_entry_update(self.entry), **entry_data)
     notifications = get_time_changes_notifications(changes, tzinfo=self.event_new.tzinfo, entry=self.entry)
     return jsonify_data(flash=False, entry=rv, notifications=notifications)
예제 #5
0
파일: api.py 프로젝트: innovexa/IDC-Events
 def export_timetable(self, user):
     events = Event.find_all(Event.id.in_(map(int, self._idList)),
                             ~Event.is_deleted)
     return {
         event.id: TimetableSerializer(event, management=False,
                                       user=user).serialize_timetable()
         for event in events
     }
예제 #6
0
파일: manage.py 프로젝트: ipaste/indico
 def _process(self):
     event_info = serialize_event_info(self.event)
     timetable_data = TimetableSerializer(
         self.event, management=True).serialize_timetable()
     return WPManageTimetable.render_template('management.html',
                                              self.event,
                                              event_info=event_info,
                                              timetable_data=timetable_data)
예제 #7
0
파일: util.py 프로젝트: vireshbackup/indico
def render_session_timetable(session, timetable_layout=None, management=False):
    if not session.start_dt:
        # no scheduled sessions present
        return ''
    timetable_data = TimetableSerializer().serialize_session_timetable(session, without_blocks=True,
                                                                       strip_empty_days=True)
    event_info = serialize_event_info(session.event_new)
    tpl = get_template_module('events/timetable/_timetable.html')
    return tpl.render_timetable(timetable_data, event_info, timetable_layout=timetable_layout, management=management)
예제 #8
0
class RHLegacyTimetableMoveEntry(RHManageTimetableEntryBase):
    """Moves a TimetableEntry into a Session or top-level timetable"""
    def _process_GET(self):
        current_day = dateutil.parser.parse(request.args.get('day')).date()
        return jsonify_template(
            'events/timetable/move_entry.html',
            event=self.event_new,
            top_level_entries=self._get_session_timetable_entries(),
            current_day=current_day,
            timetable_entry=self.entry,
            parent_entry=self.entry.parent)

    def _process_POST(self):
        self.serializer = TimetableSerializer(True)
        with track_time_changes(auto_extend=True,
                                user=session.user) as changes:
            entry_data = self._move_entry(request.json)
        rv = dict(serialize_entry_update(self.entry), **entry_data)
        notifications = get_time_changes_notifications(
            changes, tzinfo=self.event_new.tzinfo, entry=self.entry)
        return jsonify_data(flash=False, entry=rv, notifications=notifications)

    def _move_entry(self, data):
        rv = {}
        if data.get('parent_id'):
            rv['old'] = self.serializer.serialize_timetable_entry(self.entry)
            parent_timetable_entry = self.event_new.timetable_entries.filter_by(
                id=data['parent_id']).one()
            move_timetable_entry(self.entry, parent=parent_timetable_entry)
            rv['session'] = rv[
                'slotEntry'] = self.serializer.serialize_session_block_entry(
                    parent_timetable_entry)
        elif data.get('day'):
            rv['old'] = self.serializer.serialize_timetable_entry(self.entry)
            new_date = as_utc(dateutil.parser.parse(data['day']))
            move_timetable_entry(self.entry, day=new_date)
        return rv

    def _get_session_timetable_entries(self):
        entries = {}
        for day in iterdays(self.event_new.start_dt, self.event_new.end_dt):
            entries[day.date()] = get_session_block_entries(
                self.event_new, day)
        return entries
예제 #9
0
파일: display.py 프로젝트: pandey623/indico
 def _process(self):
     self.event_new.preload_all_acl_entries()
     if self.theme is None:
         event_info = serialize_event_info(self.event_new)
         timetable_data = TimetableSerializer().serialize_timetable(self.event_new, strip_empty_days=True)
         return self.view_class.render_template('display.html', self._conf, event_info=event_info,
                                                timetable_data=timetable_data,
                                                timetable_layout=self.timetable_layout)
     else:
         return self.view_class_simple(self, self._conf, self.theme, self.theme_override).display()
예제 #10
0
 def _process(self):
     new_start_dt = (self.event_new.tzinfo.localize(
         dateutil.parser.parse(
             request.form.get('startDate'))).astimezone(utc))
     shift = new_start_dt - self.entry.start_dt
     with track_time_changes(auto_extend=True,
                             user=session.user) as changes:
         shift_following_entries(self.entry, shift, session_=self.session)
         self.entry.move(new_start_dt)
     serializer = TimetableSerializer(management=True)
     if self.session:
         timetable = serializer.serialize_session_timetable(self.session)
     else:
         timetable = serializer.serialize_timetable(self.event_new)
     notifications = get_time_changes_notifications(
         changes, tzinfo=self.event_new.tzinfo, entry=self.entry)
     return jsonify_data(flash=False,
                         entry=serialize_entry_update(self.entry),
                         timetable=timetable,
                         notifications=notifications)
예제 #11
0
 def _process(self):
     self.event.preload_all_acl_entries()
     if self.theme is None:
         event_info = serialize_event_info(self.event)
         timetable_data = TimetableSerializer(self.event).serialize_timetable(strip_empty_days=True)
         timetable_settings = layout_settings.get(self.event, 'timetable_theme_settings')
         return self.view_class.render_template('display.html', self.event, event_info=event_info,
                                                timetable_data=timetable_data, timetable_settings=timetable_settings,
                                                timetable_layout=self.timetable_layout)
     else:
         return self.view_class_simple(self, self.event, self.theme, self.theme_override).display()
예제 #12
0
파일: manage.py 프로젝트: wtakase/indico
 def _process(self):
     event_info = serialize_event_info(self.event_new)
     event_info['timetableSession'] = serialize_session(self.session)
     timetable_data = TimetableSerializer(management=True).serialize_session_timetable(self.session)
     management_rights = {
         'can_manage_event': self.event_new.can_manage(session.user),
         'can_manage_session': self.session.can_manage(session.user),
         'can_manage_blocks': self.session.can_manage_blocks(session.user),
         'can_manage_contributions': self.session.can_manage_contributions(session.user)
     }
     return WPManageTimetable.render_template('session_management.html', self._conf, event_info=event_info,
                                              timetable_data=timetable_data, session_=self.session,
                                              **management_rights)
예제 #13
0
class RHLegacyTimetableMoveEntry(RHManageTimetableEntryBase):
    """Moves a TimetableEntry into a Session or top-level timetable"""

    def _process_GET(self):
        current_day = dateutil.parser.parse(request.args.get('day')).date()
        return jsonify_template('events/timetable/move_entry.html', event=self.event_new,
                                top_level_entries=self._get_session_timetable_entries(),
                                current_day=current_day, timetable_entry=self.entry,
                                parent_entry=self.entry.parent)

    def _process_POST(self):
        self.serializer = TimetableSerializer(True)
        with track_time_changes(auto_extend=True, user=session.user) as changes:
            entry_data = self._move_entry(request.json)
        rv = dict(serialize_entry_update(self.entry), **entry_data)
        notifications = get_time_changes_notifications(changes, tzinfo=self.event_new.tzinfo, entry=self.entry)
        return jsonify_data(flash=False, entry=rv, notifications=notifications)

    def _move_entry(self, data):
        rv = {}
        if data.get('parent_id'):
            rv['old'] = self.serializer.serialize_timetable_entry(self.entry)
            parent_timetable_entry = self.event_new.timetable_entries.filter_by(id=data['parent_id']).one()
            move_timetable_entry(self.entry, parent=parent_timetable_entry)
            rv['session'] = rv['slotEntry'] = self.serializer.serialize_session_block_entry(parent_timetable_entry)
        elif data.get('day'):
            rv['old'] = self.serializer.serialize_timetable_entry(self.entry)
            new_date = as_utc(dateutil.parser.parse(data['day']))
            move_timetable_entry(self.entry, day=new_date)
        return rv

    def _get_session_timetable_entries(self):
        entries = {}
        for day in iterdays(self.event_new.start_dt, self.event_new.end_dt):
            entries[day.date()] = get_session_block_entries(self.event_new, day)
        return entries
예제 #14
0
 def _process(self):
     if self.event_new.theme == 'static':
         event_info = serialize_event_info(self.event_new)
         timetable_data = TimetableSerializer().serialize_timetable(
             self.event_new, hide_empty_days=True)
         return self.view_class.render_template(
             'display.html',
             self._conf,
             event_info=event_info,
             timetable_data=timetable_data,
             timetable_layout=self.layout)
     else:
         page = WPTPLConferenceDisplay(self,
                                       self._conf,
                                       view=self.event_new.theme,
                                       type='meeting',
                                       params={})
         return page.display()
예제 #15
0
 def export_timetable(self, aw):
     serializer = TimetableSerializer(management=False)
     events = Event.find_all(Event.id.in_(map(int, self._idList)), ~Event.is_deleted)
     return {event.id: serializer.serialize_timetable(event) for event in events}
예제 #16
0
파일: api.py 프로젝트: vintas/indico
 def _serialize_timetable(self, event, user):
     if not contribution_settings.get(
             event, 'published') and not event.can_manage(user):
         return {}
     return TimetableSerializer(event, management=False,
                                user=user).serialize_timetable()