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)
A descriptor that presents a read/write view of an object attribute.
ACLs for page visibility
Allow speakers in the ProtectionMixin
The children menu entries and parent backref
The Event containing the menu entry
The ID of the event which contains the menu
The ID of the menu entry
Whether the entry is visible in the event’s menu
The target URL of a custom link
The name of the menu entry (to uniquely identify a default entry for a given event)
Whether the menu entry should be opened in a new tab or window
The page of the menu entry
The page ID if the entry is a page
The ID of the parent menu entry (NULL if root menu entry)
The name of the plugin from which the entry comes from (NULL if the entry does not come from a plugin)
The relative position of the entry in the menu
The parent object to consult for ProtectionMode.inheriting.
The title of the menu entry (to be displayed to the user)
The type of the menu entry
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
Utilities
- class indico.modules.events.layout.util.ConferenceTheme(name: str, css_path: str, title: str, js_path: str = 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 bestored when the theme is selected in an event.
css_path
– string indicating the relative location of the CSS filetitle
– 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
- 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)
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_plugin_conference_themes()
Check whether the MenuEntry is enabled.