跳转到主要内容

主题切换器

项目描述

介绍

此插件提供浏览器视图@@themeswitcher,它应用于根目录,并允许您覆盖Plone所有主题技术使用的主题。

此插件面向集成商。

Plone主题堆栈

portal_skins

这是CMF中最古老的部分。

这一部分已被猴子补丁。

browser_layer

来自Zope3,这是创建和覆盖视图以及“viewpagetemplatefile”的现代方式。

这一部分已经被plone.theme在portal_skins上设置。

diazo

这是在页面渲染后发生的最后一种技术,它对Plone渲染的页面进行XSLT转换。

这一部分已被猴子补丁。

切换器

此插件已被设计为易于支持新的切换器。目前,唯一实现的是基于用户代理的“移动切换器”,该用户代理来自http://detectmobilebrowsers.com/(python版本)。

关于切换器的一些可行想法

  • 根据域名切换

  • 根据协议(http / https)切换

  • 根据角色切换

  • 根据路径切换

  • 根据设备(移动、平板、桌面)切换

  • 根据cookie值切换

如何使用

您只需在portal_registry中配置您想要使用的切换器并对其进行配置。

要使用特定的diazo主题,您必须将其设置复制到切换器注册表中。

例如,如果您只想为移动设备使用plonetheme.mobile,则必须添加一个包含以下内容的registry.xml:

<record name="collective.themeswitcher.theme.mobile">
  <field type="plone.registry.field.ASCIILine">
      <title>Mobile theme</title>
  </field>
  <value>plonetheme.mobile</value>
</record>
<record name="collective.themeswitcher.switcher">
  <field type="plone.registry.field.TextLine">
      <title>Theme switcher</title>
      <description>The named switcher that will be used</description>
  </field>
  <value>themeswitcher_mobile</value>
</record>
<record name="collective.themeswitcher.absolutePrefix" interface="plone.app.theming.interfaces.IThemeSettings" field="absolutePrefix">
  <field type="plone.registry.field.TextLine">
    <description>convert_relative_url</description>
    <required>False</required>
    <title>absolute_url_prefix</title>
  </field>
  <value>/++theme++plonetheme.mobile</value>
</record>
<record name="collective.themeswitcher.currentTheme" interface="plone.app.theming.interfaces.IThemeSettings" field="currentTheme">
  <field type="plone.registry.field.TextLine">
    <description>current_theme_description</description>
    <title>current_theme</title>
  </field>
  <value>plonetheme.mobile</value>
</record>
<record name="collective.themeswitcher.doctype" interface="plone.app.theming.interfaces.IThemeSettings" field="doctype">
  <field type="plone.registry.field.ASCIILine">
    <default></default>
    <description>doctype_description</description>
    <required>False</required>
    <title>doctype</title>
  </field>
  <value>&lt;!DOCTYPE html&gt;</value>
</record>
<record name="collective.themeswitcher.enabled" interface="plone.app.theming.interfaces.IThemeSettings" field="enabled">
  <field type="plone.registry.field.Bool">
    <default>False</default>
    <description>enable_theme_globally</description>
    <title>enabled</title>
  </field>
  <value>True</value>
</record>
<record name="collective.themeswitcher.hostnameBlacklist" interface="plone.app.theming.interfaces.IThemeSettings" field="hostnameBlacklist">
  <field type="plone.registry.field.List">
    <default>
      <element>127.0.0.1</element>
    </default>
    <description>hostname_blacklist_description</description>
    <required>False</required>
    <title>hostname_blacklist</title>
    <value_type type="plone.registry.field.TextLine"/>
  </field>
  <value>
    <element>127.0.0.1</element>
  </value>
</record>
<record name="collective.themeswitcher.parameterExpressions" interface="plone.app.theming.interfaces.IThemeSettings" field="parameterExpressions">
  <field type="plone.registry.field.Dict">
    <default/>
    <description>parameter_expressions_description</description>
    <key_type type="plone.registry.field.ASCIILine"/>
    <required>False</required>
    <title>parameter_expressions</title>
    <value_type type="plone.registry.field.ASCIILine"/>
  </field>
  <value>
    <element key="ajax_load">python: request.form.get('ajax_load')</element>
  </value>
</record>
<record name="collective.themeswitcher.readNetwork" interface="plone.app.theming.interfaces.IThemeSettings" field="readNetwork">
  <field type="plone.registry.field.Bool">
    <default>False</default>
    <description>network_urls_allowed</description>
    <title>readNetwork</title>
  </field>
  <value>False</value>
</record>
<record name="collective.themeswitcher.rules" interface="plone.app.theming.interfaces.IThemeSettings" field="rules">
  <field type="plone.registry.field.TextLine">
    <description>rules_file_path</description>
    <required>False</required>
    <title>rules_file</title>
  </field>
  <value>/++theme++plonetheme.mobile/rules.xml</value>
</record>

如何安装

https://secure.travis-ci.org/toutpt/collective.themeswitcher.png

此插件可以像其他插件一样安装。请遵循官方文档

致谢

公司

人员

变更日志

1.0a2 (2013-04-29)

  • 目前没有任何更改。

1.0a1 (2013-04-20)

  • 使用 templer 创建的包 [JeanMichel,别名 toutpt]

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

collective.themeswitcher-1.0a2.zip (27.7 kB 查看哈希值)

上传时间

由...