def render_session_bar(protected_object=None, local_tz=None, force_local_tz=False): protection_disclaimers = { 'network': legal_settings.get('network_protected_disclaimer'), 'restricted': legal_settings.get('restricted_disclaimer') } default_tz = config.DEFAULT_TIMEZONE if session.user: user_tz = session.user.settings.get('timezone', default_tz) if session.timezone == 'LOCAL': tz_mode = 'local' elif session.timezone == user_tz: tz_mode = 'user' else: tz_mode = 'custom' else: user_tz = None tz_mode = 'local' if session.timezone == 'LOCAL' else 'custom' active_tz = _get_timezone_display(local_tz, session.timezone, force_local_tz) timezones = common_timezones if active_tz not in common_timezones_set: timezones = list(common_timezones) + [active_tz] timezone_data = { 'disabled': force_local_tz, 'user_tz': user_tz, 'active_tz': active_tz, 'tz_mode': tz_mode, 'timezones': timezones, } tpl = get_template_module('_session_bar.html') rv = tpl.render_session_bar(protected_object=protected_object, protection_disclaimers=protection_disclaimers, timezone_data=timezone_data, languages=get_all_locales()) return Markup(rv)
def getVars(self): vars = WTemplated.getVars(self) vars["currentUser"] = self._currentuser config = Config.getInstance() imgLogin = config.getSystemIconURL("login") vars["imgLogin"] = imgLogin vars["isFrontPage"] = self._isFrontPage vars["currentCategory"] = self.__currentCategory vars['prot_obj'] = self._prot_obj current_locale = get_current_locale() vars["ActiveTimezone"] = session.timezone """ Get the timezone for displaying on top of the page. 1. If the user has "LOCAL" timezone then show the timezone of the event/category. If that's not possible just show the standard timezone. 2. If the user has a custom timezone display that one. """ vars["ActiveTimezoneDisplay"] = self._getTimezoneDisplay( vars["ActiveTimezone"]) vars["SelectedLanguage"] = str(current_locale) vars["SelectedLanguageName"] = current_locale.language_name vars["Languages"] = get_all_locales() if DBMgr.getInstance().isConnected(): vars["title"] = info.HelperMaKaCInfo.getMaKaCInfoInstance( ).getTitle() vars["organization"] = info.HelperMaKaCInfo.getMaKaCInfoInstance( ).getOrganisation() else: vars["title"] = "Indico" vars["organization"] = "" vars['roomBooking'] = Config.getInstance().getIsRoomBookingActive() vars['protectionDisclaimerProtected'] = legal_settings.get( 'network_protected_disclaimer') vars['protectionDisclaimerRestricted'] = legal_settings.get( 'restricted_disclaimer') #Build a list of items for the administration menu adminItemList = [] if session.user and session.user.is_admin: adminItemList.append({ 'id': 'serverAdmin', 'url': urlHandlers.UHAdminArea.getURL(), 'text': _("Server admin") }) vars["adminItemList"] = adminItemList vars['extra_items'] = HeaderMenuEntry.group( values_from_signal(signals.indico_menu.send())) vars["getProtection"] = self._getProtection vars["show_contact"] = config.getPublicSupportEmail() is not None return vars
def render_session_bar(protected_object=None, local_tz=None, force_local_tz=False): protection_disclaimers = { 'network': legal_settings.get('network_protected_disclaimer'), 'restricted': legal_settings.get('restricted_disclaimer') } timezone_data = { 'active_tz': session.timezone, 'active_tz_display': _get_timezone_display(local_tz, session.timezone, force_local_tz), 'user_tz': session.avatar.getTimezone() if session.user else None, 'user_tz_display_mode': session.avatar.getDisplayTZMode() if session.user else None, 'disabled': force_local_tz } tpl = get_template_module('_session_bar.html') rv = tpl.render_session_bar(protected_object=protected_object, protection_disclaimers=protection_disclaimers, timezone_data=timezone_data, languages=get_all_locales()) return Markup(rv)
def getVars( self ): vars = WTemplated.getVars(self) vars["currentUser"] = self._currentuser config = Config.getInstance() imgLogin = config.getSystemIconURL("login") vars["imgLogin"] = imgLogin vars["isFrontPage"] = self._isFrontPage vars["currentCategory"] = self.__currentCategory vars['prot_obj'] = self._prot_obj current_locale = get_current_locale() vars["ActiveTimezone"] = session.timezone """ Get the timezone for displaying on top of the page. 1. If the user has "LOCAL" timezone then show the timezone of the event/category. If that's not possible just show the standard timezone. 2. If the user has a custom timezone display that one. """ vars["ActiveTimezoneDisplay"] = self._getTimezoneDisplay(vars["ActiveTimezone"]) vars["SelectedLanguage"] = str(current_locale) vars["SelectedLanguageName"] = current_locale.language_name vars["Languages"] = get_all_locales() if DBMgr.getInstance().isConnected(): vars["title"] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getTitle() vars["organization"] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getOrganisation() else: vars["title"] = "Indico" vars["organization"] = "" vars['roomBooking'] = Config.getInstance().getIsRoomBookingActive() vars['protectionDisclaimerProtected'] = legal_settings.get('network_protected_disclaimer') vars['protectionDisclaimerRestricted'] = legal_settings.get('restricted_disclaimer') #Build a list of items for the administration menu adminItemList = [] if session.user and session.user.is_admin: adminItemList.append({'id': 'serverAdmin', 'url': urlHandlers.UHAdminArea.getURL(), 'text': _("Server admin")}) vars["adminItemList"] = adminItemList vars['extra_items'] = HeaderMenuEntry.group(values_from_signal(signals.indico_menu.send())) vars["getProtection"] = self._getProtection vars["show_contact"] = config.getPublicSupportEmail() is not None return vars
def _process(self): tos_url = legal_settings.get('tos_url') tos_html = sanitize_html(legal_settings.get('tos')) or None privacy_policy_url = legal_settings.get('privacy_policy_url') privacy_policy_html = sanitize_html(legal_settings.get('privacy_policy')) or None if tos_url: tos_html = None if privacy_policy_url: privacy_policy_html = None return jsonify(help_url=config.HELP_URL, contact_email=config.PUBLIC_SUPPORT_EMAIL, has_tos=bool(tos_url or tos_html), tos_html=tos_html, tos_url=tos_url, has_privacy_policy=bool(privacy_policy_url or privacy_policy_html), privacy_policy_html=privacy_policy_html, privacy_policy_url=privacy_policy_url)
def _process(self): tos_url = legal_settings.get('tos_url') tos_html = sanitize_html(legal_settings.get('tos')) or None privacy_policy_url = legal_settings.get('privacy_policy_url') privacy_policy_html = sanitize_html(legal_settings.get('privacy_policy')) or None if tos_url: tos_html = None if privacy_policy_url: privacy_policy_html = None return jsonify(rooms_sprite_token=unicode(_cache.get('rooms-sprite-token', '')), languages=get_all_locales(), tileserver_url=rb_settings.get('tileserver_url'), grace_period=rb_settings.get('grace_period'), managers_edit_rooms=rb_settings.get('managers_edit_rooms'), help_url=config.HELP_URL, contact_email=config.PUBLIC_SUPPORT_EMAIL, has_tos=bool(tos_url or tos_html), tos_html=tos_html, has_privacy_policy=bool(privacy_policy_url or privacy_policy_html), privacy_policy_html=privacy_policy_html)
def _process(self): return WPDisplayLegalMessages.render_template('tos.html', tos=legal_settings.get('tos'))
def _process(self): url = legal_settings.get('privacy_policy_url') if url: return redirect(url) return WPDisplayPrivacyPolicy.render_template( 'privacy.html', content=legal_settings.get('privacy_policy'))
def _process(self): url = legal_settings.get('tos_url') if url: return redirect(url) return WPDisplayTOS.render_template('tos.html', tos=legal_settings.get('tos'))
def _process(self): url = legal_settings.get('privacy_policy_url') if url: return redirect(url) return WPDisplayPrivacyPolicy.render_template('privacy.html', content=legal_settings.get('privacy_policy'))