def getVars(self): vars = wcomponents.WTemplated.getVars( self ) vars["logo"] = "" if self.event.has_logo: vars["logoURL"] = self.event.logo_url vars["logo"] = '<img src="{}" alt="{}" border="0" class="confLogo">'.format( vars["logoURL"], escape_html(self.event.title.encode('utf-8'), escape_quotes=True)) vars["confTitle"] = self.event.title.encode('utf-8') vars["displayURL"] = self.event.url start_dt_local = self.event.start_dt_display.astimezone(self.event.display_tzinfo) end_dt_local = self.event.end_dt_display.astimezone(self.event.display_tzinfo) vars["timezone"] = self.event.display_tzinfo.zone vars["confDateInterval"] = _("from {start} to {end}").format(start=format_date(start_dt_local, format='long'), end=format_date(end_dt_local, format='long')) if start_dt_local.strftime("%d%B%Y") == end_dt_local.strftime("%d%B%Y"): vars["confDateInterval"] = format_date(start_dt_local, format='long') elif start_dt_local.strftime("%B%Y") == end_dt_local.strftime("%B%Y"): vars["confDateInterval"] = "%s-%s %s" % (start_dt_local.day, end_dt_local.day, format_date(start_dt_local, format='MMMM yyyy')) vars["confLocation"] = self.event.venue_name vars["body"] = self._body vars['menu'] = menu_entries_for_event(self.event) vars["bgColorCode"] = layout_settings.get(self._conf, 'header_background_color').replace("#", "") vars["textColorCode"] = layout_settings.get(self._conf, 'header_text_color').replace("#", "") vars["confId"] = self._conf.id vars["conf"] = self._conf return vars
def _get_menu_items(self): entries = menu_entries_for_event(self.event) visible_entries = [e for e in itertools.chain(entries, *(e.children for e in entries)) if e.is_visible] for entry in visible_entries: if entry.type == MenuEntryType.page: self._get_custom_page(entry.page) elif entry.type == MenuEntryType.internal_link: self._get_builtin_page(entry)
def _get_menu_items(self): entries = menu_entries_for_event(self._conf) visible_entries = [e for e in itertools.chain(entries, *(e.children for e in entries)) if e.is_visible] for entry in visible_entries: if entry.type == MenuEntryType.page: self._get_custom_page(entry.page) elif entry.type == MenuEntryType.internal_link: self._get_builtin_page(entry)
def _process(self): custom_menu_enabled = layout_settings.get(self.event, 'use_custom_menu') menu = menu_entries_for_event( self.event) if custom_menu_enabled else None return WPMenuEdit.render_template( 'menu_edit.html', self.event, menu=menu, custom_menu_enabled=custom_menu_enabled)
def _get_layout_params(self): bg_color = layout_settings.get(self.event, 'header_background_color').replace('#', '').lower() text_color = layout_settings.get(self.event, 'header_text_color').replace('#', '').lower() announcement = '' if layout_settings.get(self.event, 'show_announcement'): announcement = layout_settings.get(self.event, 'announcement') return { 'menu': menu_entries_for_event(self.event), 'active_menu_item': self.sidemenu_option, 'bg_color_css': 'background: #{0}; border-color: #{0};'.format(bg_color) if bg_color else '', 'text_color_css': 'color: #{};'.format(text_color) if text_color else '', 'announcement': announcement }
def _render_menu_entries(event, connect_menu=False): tpl = get_template_module('events/layout/_menu.html') return tpl.menu_entries(menu_entries_for_event(event), connect_menu=connect_menu)
def _process(self): custom_menu_enabled = layout_settings.get(self._conf, 'use_custom_menu') menu = menu_entries_for_event(self._conf) if custom_menu_enabled else None return WPMenuEdit.render_template('menu_edit.html', self._conf, event=self._conf, MenuEntryType=MenuEntryType, menu=menu, custom_menu_enabled=custom_menu_enabled)