主题切换程序
collective.themeswitcher的Python项目详细描述
简介
此加载项提供了一个浏览器视图@@Themeswitcher,它应用于根目录 让您重写plone所有主题技术上使用的主题。
这个插件是为集成商设计的。
plone主题堆栈
门户皮肤
这是CMF最古老的作品。
这件是蒙克斯派克的。
浏览器层
在zope3中,这是创建和覆盖视图的现代方式,因此 “ViewPageTemplateFile”。
这个已经由门户皮肤上的plone.theme设置。
重氮
最后一种技术是在呈现页面之后生成xslt 在plone呈现的页面上进行转换。
这件是蒙克斯派克的。
切换器
这个插件的设计很容易支持新的切换器。目前 唯一实现的切换器是“移动切换器” 基于来自http://detectmobilebrowsers.com/(python版本)的用户代理。
关于切换器的一些想法可以很容易做到:
- 打开域
- 打开协议(http/https)
- 打开角色
- 打开路径
- 打开设备(移动、平板电脑、桌面)
- 打开cookie值
如何使用
您只需在portal_注册表中配置要使用的切换器 并对其进行配置。
要使用特定的重氮主题,你必须将它的设置复制到switcher 登记处。
例如,假设您只想将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><!DOCTYPE html></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>
更改日志
1.0a2(2013-04-29)
- 什么都没变。
1.0a1(2013-04-20)
- 使用templer创建的包 [jeanmichel aka toutpt]