示例#1
0
    def view_themes_previewer(self, params=None):
        if not configuration.theme_preview_enabled(): return ''

        combined_themes = get_local_theme_namespaces(
        ) + get_custom_theme_namespaces()
        if self.section.handler and self.section.handler.request.get(
                'submit_themes_previewer'):
            selected_theme = self.section.handler.request.get(
                'TEMPLATE_OVERRIDE_THEME')
        elif self.section.theme:
            selected_theme = self.section.theme
        else:
            selected_theme = configuration.default_theme()
            if not selected_theme:
                selected_theme = template.DEFAULT_LOCAL_THEME_TEMPLATE

        f = form(self.section, self.section.full_path)
        f.add_control(
            selectcontrol(self.section, 'TEMPLATE_OVERRIDE_THEME',
                          combined_themes, selected_theme))
        f.add_control(
            control(self.section, 'submit', 'submit_themes_previewer',
                    'Preview theme'))

        self.section.css.append('themes-previewer.css')
        return '<div class="content themes-previewer">%s</div>' % unicode(f)
示例#2
0
    def get_theme_namespace_template(self):
        TEMPLATE_OVERRIDE_THEME = self.handler.request.get('TEMPLATE_OVERRIDE_THEME') if self.handler and self.handler.request.get('TEMPLATE_OVERRIDE_THEME') else None 
        DEFAULT_THEME = configuration.default_theme()

        if TEMPLATE_OVERRIDE_THEME and configuration.theme_preview_enabled():
            theme_namespace_template = TEMPLATE_OVERRIDE_THEME
        elif not self.theme and not DEFAULT_THEME:
            theme_namespace_template = DEFAULT_LOCAL_THEME_TEMPLATE
        elif not self.theme:
            theme_namespace_template = DEFAULT_THEME
        else:
            theme_namespace_template = self.theme
        return theme_namespace_template
示例#3
0
    def view_themes_previewer(self, params=None):
        if not configuration.theme_preview_enabled(): return ''

        combined_themes = get_local_theme_namespaces() + get_custom_theme_namespaces()
        if self.section.handler and self.section.handler.request.get('submit_themes_previewer'):
            selected_theme = self.section.handler.request.get('TEMPLATE_OVERRIDE_THEME')
        elif self.section.theme:
            selected_theme = self.section.theme
        else:
            selected_theme = configuration.default_theme()
            if not selected_theme: selected_theme = template.DEFAULT_LOCAL_THEME_TEMPLATE

        f = form(self.section, self.section.full_path)
        f.add_control(selectcontrol(self.section, 'TEMPLATE_OVERRIDE_THEME', combined_themes, selected_theme))
        f.add_control(control(self.section, 'submit', 'submit_themes_previewer', 'Preview theme'))

        self.section.css.append('themes-previewer.css')
        return '<div class="content themes-previewer">%s</div>' % unicode(f)