def event_settings(cls): """:class:`EventSettingsProxy` for the plugin's event-specific settings""" if cls.name is None: raise RuntimeError('Plugin has not been loaded yet') instance = cls.instance with instance.plugin_context(): # in case the default settings come from a property return EventSettingsProxy('plugin_{}'.format(cls.name), instance.default_event_settings, cls.strict_settings, acls=cls.acl_event_settings, converters=cls.event_settings_converters)
payment_settings = SettingsProxy( 'payment', { 'currencies': [{ 'code': 'EUR', 'name': 'Euro' }, { 'code': 'USD', 'name': 'US Dollar' }], 'currency': 'EUR', 'conditions': CONDITIONS }) payment_event_settings = EventSettingsProxy('payment', {'conditions': None}) @signals.menu.items.connect_via('admin-sidemenu') def _extend_admin_menu(sender, **kwargs): if session.user.is_admin: return SideMenuItem('payment', _("Payment"), url_for('payment.admin_settings'), section='customization') @signals.menu.items.connect_via('event-management-sidemenu') def _extend_event_management_menu(sender, event, **kwargs): if not event.has_feature('payment') or not event.can_manage( session.user, 'registration'):
paper_reviewing_settings = EventSettingsProxy( 'paper_reviewing', { 'start_dt': None, 'end_dt': None, 'content_reviewing_enabled': True, 'layout_reviewing_enabled': False, 'judge_deadline': None, 'layout_reviewer_deadline': None, 'content_reviewer_deadline': None, 'enforce_judge_deadline': False, 'enforce_layout_reviewer_deadline': False, 'enforce_content_reviewer_deadline': False, 'announcement': '', 'scale_lower': -3, 'scale_upper': 3, # Notifications 'notify_on_added_to_event': set(), 'notify_on_assigned_contrib': set(), 'notify_on_paper_submission': { PaperReviewingRole.layout_reviewer, PaperReviewingRole.content_reviewer }, 'notify_judge_on_review': True, 'notify_author_on_judgment': True }, converters={ 'start_dt': DatetimeConverter, 'end_dt': DatetimeConverter, 'judge_deadline': DatetimeConverter, 'layout_reviewer_deadline': DatetimeConverter, 'content_reviewer_deadline': DatetimeConverter, 'notify_on_added_to_event': RoleConverter, 'notify_on_assigned_contrib': RoleConverter, 'notify_on_paper_submission': RoleConverter })
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.modules.events.settings import EventSettingsProxy program_codes_settings = EventSettingsProxy( 'program_codes', { 'session_template': '', 'session_block_template': '', 'contribution_template': '', 'subcontribution_template': '', })
return has_contributions_with_user_as_submitter(event, session.user) def _visible_list_of_contributions(event): published = contribution_settings.get(event, 'published') can_manage = event.can_manage(session.user) return (published or can_manage) and Contribution.query.filter(Contribution.event == event).has_rows() yield MenuEntryData(title=_('My Contributions'), name='my_contributions', visible=_visible_my_contributions, endpoint='contributions.my_contributions', position=2, parent='my_conference') yield MenuEntryData(title=_('Contribution List'), name='contributions', endpoint='contributions.contribution_list', position=4, static_site=True, visible=_visible_list_of_contributions) yield MenuEntryData(title=_('Author List'), name='author_index', endpoint='contributions.author_list', position=5, is_enabled=False, static_site=True) yield MenuEntryData(title=_('Speaker List'), name='speaker_index', endpoint='contributions.speaker_list', position=6, is_enabled=False, static_site=True) @signals.event.created.connect def _event_created(event, **kwargs): if event.type_ == EventType.conference: contribution_settings.set(event, 'published', False) contribution_settings = EventSettingsProxy('contributions', { 'default_duration': timedelta(minutes=20), 'submitters_can_edit': False, 'published': True }, converters={ 'default_duration': TimedeltaConverter })
# You should have received a copy of the GNU General Public License # along with Indico; if not, see <http://www.gnu.org/licenses/>. from __future__ import unicode_literals from flask import flash, session, request from indico.core import signals from indico.core.logger import Logger from indico.modules.events.settings import EventSettingsProxy from indico.util.i18n import ngettext from indico.web.flask.util import url_for from indico.web.menu import SideMenuItem logger = Logger.get('events.features') features_event_settings = EventSettingsProxy('features', {'enabled': None}) @signals.menu.items.connect_via('event-management-sidemenu') def _extend_event_management_menu(sender, event, **kwargs): if not event.can_manage(session.user): return return SideMenuItem('features', 'Features', url_for('event_features.index', event), section='advanced') @signals.app_created.connect def _check_feature_definitions(app, **kwargs): # This will raise RuntimeError if the feature names are not unique
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.core.db.sqlalchemy.descriptions import RenderMode from indico.core.settings.converters import EnumConverter from indico.modules.events.settings import EventSettingsProxy track_settings = EventSettingsProxy( 'tracks', { 'program': '', 'program_render_mode': RenderMode.markdown }, converters={'program_render_mode': EnumConverter(RenderMode)})
] def set_participant_list_columns(self, event, columns, form=None): if form is None: if columns: self.set(event, 'participant_list_columns', columns) else: self.delete(event, 'participant_list_columns') else: form_columns = self.get(event, 'participant_list_form_columns') if columns: # The int values are automatically converted to unicode when saved # as JSON. Do it explicitely so that it keeps working if the # behavior changes and makes sense with the code above. form_columns[unicode(form.id)] = columns else: form_columns.pop(unicode(form.id), None) self.set(event, 'participant_list_form_columns', form_columns) def get_participant_list_form_ids(self, event): # Int values are converted to str when saved as JSON return map(int, self.get(event, 'participant_list_forms')) def set_participant_list_form_ids(self, event, form_ids): self.set(event, 'participant_list_forms', form_ids) event_badge_settings = EventSettingsProxy('badge', DEFAULT_BADGE_SETTINGS, converters=BADGE_SETTING_CONVERTERS)
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.modules.events.settings import EventSettingsProxy program_codes_settings = EventSettingsProxy( 'program_codes', { 'session_template': '', 'session_block_template': '', 'contribution_template': '', 'subcontribution_template': '', }) privacy_settings = EventSettingsProxy( 'privacy', { 'data_controller_name': '', 'data_controller_email': '', 'privacy_policy_urls': [], 'privacy_policy': '', })
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from collections import OrderedDict from indico.core.settings.converters import OrderedDictConverter from indico.modules.events.settings import EventSettingsProxy editing_settings = EventSettingsProxy( 'editing', {'review_conditions': OrderedDict()}, converters={'review_conditions': OrderedDictConverter})
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from indico.modules.events.editing.models.editable import EditableType from indico.modules.events.settings import EventSettingsProxy editing_settings = EventSettingsProxy( 'editing', { 'service_event_identifier': None, 'service_url': None, 'service_token': None, 'editable_types': ['paper'], }) _defaults = {'self_assign_allowed': False} editable_type_settings = { EditableType.paper: EventSettingsProxy('editing_paper', _defaults), EditableType.poster: EventSettingsProxy('editing_poster', _defaults), EditableType.slides: EventSettingsProxy('editing_slides', _defaults) }
def event_settings(cls): return EventSettingsProxy(f'agreement_{cls.name}', cls.default_event_settings)
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # Indico is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Indico; if not, see <http://www.gnu.org/licenses/>. from indico.modules.events.settings import EventSettingsProxy abstracts_settings = EventSettingsProxy('abstracts', { 'description_settings': { 'is_active': True, 'is_required': True, 'max_length': None, 'max_words': None } }, preload=True)
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from collections import OrderedDict from indico.core.settings.converters import OrderedDictConverter from indico.modules.events.settings import EventSettingsProxy editing_settings = EventSettingsProxy('editing', { 'paper_review_conditions': OrderedDict(), 'slides_review_conditions': OrderedDict(), 'poster_review_conditions': OrderedDict(), 'editable_types': ['paper'], }, converters={ 'paper_review_conditions': OrderedDictConverter, 'slides_review_conditions': OrderedDictConverter, 'poster_review_conditions': OrderedDictConverter })
from indico.modules.events.models.events import EventType from indico.modules.events.settings import EventSettingsProxy, ThemeSettingsProxy from indico.util.i18n import _ from indico.web.flask.util import url_for from indico.web.menu import SideMenuItem logger = Logger.get('events.layout') layout_settings = EventSettingsProxy( 'layout', { 'is_searchable': True, 'show_nav_bar': True, 'show_social_badges': True, 'show_banner': False, 'header_text_color': '', 'header_background_color': '', 'announcement': None, 'show_announcement': False, 'use_custom_css': False, 'theme': None, 'timetable_theme': None, 'timetable_theme_settings': {}, 'use_custom_menu': False, 'timetable_by_room': False, 'timetable_detailed': False, }) theme_settings = ThemeSettingsProxy() @signals.event.created.connect def _event_created(event, **kwargs): defaults = event.category.default_event_themes
} abstracts_settings = EventSettingsProxy('abstracts', { 'description_settings': { 'is_active': True, 'is_required': True, 'max_length': None, 'max_words': None }, 'start_dt': None, 'end_dt': None, 'modification_end_dt': None, 'announcement': '', 'announcement_render_mode': RenderMode.markdown, 'allow_multiple_tracks': True, 'tracks_required': False, 'allow_attachments': False, 'allow_speakers': True, 'speakers_required': True, 'contrib_type_required': False, 'submission_instructions': '' }, acls={ 'authorized_submitters' }, converters={ 'start_dt': DatetimeConverter, 'end_dt': DatetimeConverter, 'modification_end_dt': DatetimeConverter }) abstracts_reviewing_settings = EventSettingsProxy('abstracts_reviewing', {
from indico.core import signals from indico.core.logger import Logger from indico.core.permissions import ManagementPermission, check_permissions from indico.modules.events.sessions.models.sessions import Session from indico.modules.events.sessions.util import has_sessions_for_user from indico.modules.events.settings import EventSettingsProxy from indico.util.i18n import _, ngettext from indico.web.flask.util import url_for from indico.web.menu import SideMenuItem logger = Logger.get('events.sessions') session_settings = EventSettingsProxy('sessions', { # Whether session coordinators can manage contributions inside their sessions 'coordinators_manage_contributions': False, # Whether session coordinators can manage their session blocks 'coordinators_manage_blocks': False }) COORDINATOR_PRIV_SETTINGS = {'manage-contributions': 'coordinators_manage_contributions', 'manage-blocks': 'coordinators_manage_blocks'} COORDINATOR_PRIV_TITLES = {'manage-contributions': _('Contributions'), 'manage-blocks': _('Session blocks')} COORDINATOR_PRIV_DESCS = {'manage-contributions': _('Allows coordinators to modify contributions in their sessions.'), 'manage-blocks': _('Allows coordinators to manage/reschedule session blocks of their ' 'sessions. This includes creating new session blocks..')} @signals.users.merged.connect def _merge_users(target, source, **kwargs):
# along with Indico; if not, see <http://www.gnu.org/licenses/>. from __future__ import unicode_literals from indico.modules.events.settings import EventSettingsProxy from indico.util.i18n import make_bound_gettext from indico.core import signals from indico.modules.events.features.base import EventFeature _ = make_bound_gettext('print_checkin') print_checkin_event_settings = EventSettingsProxy('print_checkin', { 'webhookurl': None, 'ticket_template_id': None, 'ticket_template': None, 'send_json': False, }) @signals.event.get_feature_definitions.connect def _get_feature_definitions(sender, **kwargs): return PrintCheckinFeature class PrintCheckinFeature(EventFeature): name = 'print_checkin' friendly_name = _('Print on Checkin') requires = {'registration'} description = _('Gives event managers the opportunity to print tickets on checkin.')
# Legacy URLs _compat_bp = IndicoBlueprint('compat_events', __name__) _compat_bp.add_url_rule('/conferenceDisplay.py', 'display_modpython', make_compat_redirect_func(_bp, 'display')) _compat_bp.add_url_rule('/conferenceOtherViews.py', 'display_other_modpython', make_compat_redirect_func(_bp, 'display_other')) _compat_bp.add_url_rule('/conferenceDisplay.py/overview', 'display_overview_modpython', make_compat_redirect_func(_bp, 'display_overview')) _compat_bp.add_url_rule('/event/<int:event_id>/my-conference/', 'display_mystuff', make_compat_redirect_func(_bp, 'display')) _compat_bp.add_url_rule('/myconference.py', 'display_mystuff_modpython', make_compat_redirect_func(_bp, 'display')) solid_comments = EventSettingsProxy('solid_comments', { 'comment_ids': [], }) class RHEventSolidComments(RHDisplayEventBase): def _check_access(self): RHDisplayEventBase._check_access(self) print(session.user) if not session.user and request.method != 'GET': raise Forbidden def _process_GET(self): print(session.user) return jsonify(solid_comments.get(self.event, 'comment_ids')) @use_kwargs({
'code': 'EUR', 'name': 'Euro' }, { 'code': 'USD', 'name': 'US Dollar' }], 'currency': 'EUR', 'conditions': CONDITIONS, 'checkout_session_timeout': 10 }) event_settings = EventSettingsProxy('payment', { 'currency': None, 'conditions': None, }) @signals.menu.items.connect_via('admin-sidemenu') def _extend_admin_menu(sender, **kwargs): return SideMenuItem('payment', _("Payment"), url_for('payment.admin_settings'), section='customization') @signals.menu.items.connect_via('event-management-sidemenu') def _extend_event_management_menu(sender, event, **kwargs): if not event.has_feature('payment') or not event.can_manage( session.user, 'registration', allow_key=True):
def event_settings(cls): return EventSettingsProxy('agreement_{}'.format(cls.name), cls.default_event_settings)
yield MenuEntryData(title=_("My Contributions"), name='my_contributions', visible=_visible_my_contributions, endpoint='contributions.my_contributions', position=2, parent='my_conference') yield MenuEntryData(title=_("Contribution List"), name='contributions', endpoint='contributions.contribution_list', position=4, static_site=True, visible=_visible_list_of_contributions) yield MenuEntryData(title=_("Author List"), name='author_index', endpoint='contributions.author_list', position=5, is_enabled=False, static_site=True) yield MenuEntryData(title=_("Speaker List"), name='speaker_index', endpoint='contributions.speaker_list', position=6, is_enabled=False, static_site=True) contribution_settings = EventSettingsProxy( 'contributions', {'default_duration': timedelta(minutes=20)}, converters={'default_duration': TimedeltaConverter})
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from indico.modules.events.settings import EventSettingsProxy editing_settings = EventSettingsProxy('editing', { 'editable_types': ['paper'], })