Layout

Todo

Docstrings (module, models, utilities)

Models

class indico.modules.events.layout.models.images.ImageFile(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

content_type

The MIME type of the file.

created_dt

The date/time when the file was uploaded.

event
event_id

The event the image belongs to

extension

The extension of the file.

filename

The name of the file.

id

The ID of the file

property locator
md5

An MD5 hash of the file.

Automatically assigned when save() is called.

size

The size of the file (in bytes).

Automatically assigned when save() is called.

storage_backend
storage_file_id
version_of = None

Name of attribute (backref) that will be made to point to the versioned resource (leave as None if you don’t want versioning)

class indico.modules.events.layout.models.menu.EventPage(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

event

The Event which contains the page

event_id

The ID of the event which contains the page

html

The rendered HTML of the page

id

The ID of the page

property is_default
property locator
query: IndicoBaseQuery

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

class indico.modules.events.layout.models.menu.MenuEntry(**kwargs)
access_key = None
acl

A descriptor that presents a read/write view of an object attribute.

acl_entries

ACLs for page visibility

allow_speakers = True

Allow speakers in the ProtectionMixin

children

The children menu entries and parent backref

event

The Event containing the menu entry

event_id

The ID of the event which contains the menu

static get_for_event(event)
id

The ID of the menu entry

insert(parent, position)
is_enabled

Whether the entry is visible in the event’s menu

property is_root

The target URL of a custom link

move(to)
name

The name of the menu entry (to uniquely identify a default entry for a given event)

new_tab

Whether the menu entry should be opened in a new tab or window

own_no_access_contact = None
page

The page of the menu entry

page_id

The page ID if the entry is a page

parent_id

The ID of the parent menu entry (NULL if root menu entry)

plugin

The name of the plugin from which the entry comes from (NULL if the entry does not come from a plugin)

position

The relative position of the entry in the menu

protection_mode
property protection_parent

The parent object to consult for ProtectionMode.inheriting.

speakers_can_access
title

The title of the menu entry (to be displayed to the user)

type

The type of the menu entry

class indico.modules.events.layout.models.menu.MenuEntryMixin(**kwargs)
property default_data
property event_ref
property is_orphaned
property is_page
property is_separator
property is_visible
property localized_title
property locator
property url
class indico.modules.events.layout.models.menu.MenuEntryType(value)

An enumeration.

page = 5
separator = 1
class indico.modules.events.layout.models.menu.TransientMenuEntry(event, is_enabled, name, position, children, new_tab=False)

Transient menu entries are used in case menu customization is disabled. They provide a lightweight alternative for the internal links that appear by default.

Parameters:
  • event – Event – The event reference the entry applies to

  • is_enabled – bool – True, if the entry is enabled

  • name – str – The name of the menu entry

  • position – int – The position in the menu the entry is at

  • children – list[MenuEntry] – The child entries of this menu entry

  • new_tab – bool – If the link/page should be opened in a new tab

can_access(user, allow_admin=True)
property id

Utilities

class indico.modules.events.layout.util.ConferenceTheme(name: str, css_path: str, title: str, js_path: str | None = None)

Holds the values of a given conference theme to be used by Indico.

Required: - name – string indicating the internal name used for the stylesheet which will be

stored when the theme is selected in an event.

  • css_path – string indicating the relative location of the CSS file

  • title – string indicating the title displayed to the user when selecting the theme.

Optional: - js_path – string indicating the relative location for a simple, static javascript file

css_path: str
js_path: str = None
name: str
title: str
class indico.modules.events.layout.util.MenuEntryData(title, name, endpoint=None, position=-1, is_enabled=True, visible=None, parent=None, static_site=False, url_kwargs=None, hide_if_restricted=True, new_tab=False)

Container to transmit menu entry-related data via signals.

The data contained is transmitted via the sidemenu signal and used to build the side menu of an event.

Parameters:
  • title – str – The title of the menu, displayed to the user. The title should be translated using the normal gettext function, i.e. _('...'), or the plugin’s bound gettext function.

  • name – str – Name used to refer to the entry internally. This is never shown to the user. The name must be unique, names from plugins are automatically prefixed with the plugin name and a colon and therefore have to be unique only within the plugin. To mark the entry as active, its name must be specified in the menu_entry_name class attribute of the WP class. For plugins, the plugin name must be specified via the menu_entry_plugin attribute as well.

  • endpoint – str – The endpoint the entry will point to.

  • position – int – The desired position of the menu entry. the position is indicative only, relative to the other entries and not the exact position. Entries with the same position will be sorted alphanumerically on their name. A position of -1 will append the entry at the end of the menu.

  • is_enabled – bool – Whether the entry should be enabled by default (Default: True).

  • visible – function – Determines if the entry should be visible. This is a simple function which takes only the event as parameter and returns a boolean to indicate if the entry is visible or not. It is called whenever the menu is displayed, so the current state of the event/user can be taken into account.

  • parent – str – The name of the parent entry (None for root entries).

  • static_site – bool or str – If True, this menu item should be shown in the menu of a static site. When set to a string, the string will be used instead of a mangled version of the endpoint’s URL.

  • url_kwargs – dict – Additional data passed to url_for when building the url the menu item points to.

property name
plugin = None
visible(event)
indico.modules.events.layout.util.build_menu_entry_name(name, plugin=None)

Build the proper name for a menu entry.

Given a menu entry’s name and optionally a plugin, returns the correct name of the menu entry.

Parameters:
  • name – str – The name of the menu entry.

  • plugin – IndicoPlugin or str – The plugin (or the name of the plugin) which created the entry.

indico.modules.events.layout.util.get_css_file_data(event)
indico.modules.events.layout.util.get_css_url(event, force_theme=None, for_preview=False)

Build the URL of a CSS resource.

Parameters:
  • event – The Event to get the CSS url for

  • force_theme – The ID of the theme to override the custom CSS resource only if it exists

  • for_preview – Whether the URL is used in the CSS preview page

Returns:

The URL to the CSS resource

indico.modules.events.layout.util.get_js_url(event, force_theme=None, for_preview=False)

Build the URL of a JS resource.

Parameters:
  • event – The Event to get the JS url for

  • force_theme – The ID of the theme to import the custom JS resource only if it exists

  • for_preview – Whether the URL is used in the JS preview page

Returns:

The URL to the JS resource

indico.modules.events.layout.util.get_logo_data(event)
indico.modules.events.layout.util.get_menu_entries_from_signal()
indico.modules.events.layout.util.get_menu_entry_by_name(name, event)
indico.modules.events.layout.util.get_plugin_conference_themes()
indico.modules.events.layout.util.is_menu_entry_enabled(entry_name, event)

Check whether the MenuEntry is enabled.

indico.modules.events.layout.util.menu_entries_for_event(event)