Layout

Todo

Docstrings (module, models, utilities)

Models

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

Bases: indico.core.storage.models.StoredFileMixin, sqlalchemy.ext.declarative.api.Model

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

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
class indico.modules.events.layout.models.menu.EventPage(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Model

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

is_default
locator
class indico.modules.events.layout.models.menu.MenuEntry(**kwargs)

Bases: indico.modules.events.layout.models.menu.MenuEntryMixin, sqlalchemy.ext.declarative.api.Model

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

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

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

registered_only

Whether the menu entry should be viewable only by registered users

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)

Bases: object

default_data
event_ref
is_orphaned
is_page
is_separator
is_visible
localized_title
locator
url
class indico.modules.events.layout.models.menu.MenuEntryType

Bases: indico.util.struct.enum.RichIntEnum

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

Bases: indico.modules.events.layout.models.menu.MenuEntryMixin

id

Utilities

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)

Bases: object

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.
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_logo_data(event)
indico.modules.events.layout.util.get_menu_entries_from_signal(*args, **kwargs)
indico.modules.events.layout.util.get_menu_entry_by_name(*args, **kwargs)
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(*args, **kwargs)