Layout¶
Todo
Docstrings (module, models, utilities)
Models¶
-
class
indico.modules.events.layout.models.images.
ImageFile
(**kwargs)¶ Bases:
indico.core.storage.models.StoredFileMixin
,sqlalchemy.orm.decl_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¶
-
Bases:
sqlalchemy.orm.decl_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.
The Event which contains the page
The ID of the event which contains the page
The rendered HTML of the page
The ID of the page
Bases:
indico.modules.events.layout.models.menu.MenuEntryMixin
,sqlalchemy.orm.decl_api.Model
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
Whether the menu entry should be viewable only by registered users
The title of the menu entry (to be displayed to the user)
The type of the menu entry
Bases:
object
Bases:
indico.util.enum.RichIntEnum
An enumeration.
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, new_tab=False)¶ 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)¶
- title – str – The title of the menu, displayed to the user.
The title should be translated using the normal gettext
function, i.e.
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_plugin_conference_themes
()¶
Check whether the MenuEntry is enabled.