跳转到主要内容

添加用于嵌入如社交按钮等代码的viewlet,用于Plone。

项目描述

此包提供用于嵌入到Plone站点的社交按钮的viewlet。此viewlet可以通过Web分配到任何viewlet管理器。由于未设置嵌入代码的限制,您需要小心处理嵌入代码的安全性风险。

进一步文档URL

http://packages.python.org/hexagonit.socialbutton/

仓库URL

https://github.com/hexagonit/hexagonit.socialbutton/

配置

通过“站点设置”中的“附加组件”安装此包后,在“附加组件配置”部分会出现“社交按钮代码设置”和“社交按钮配置”链接。

要开始配置,请首先转到“社交按钮代码设置”以设置嵌入代码。

社交按钮代码设置

ID

该ID将用于进一步的配置和样式。

代码

要嵌入到viewlet中的代码。

从文件系统代码设置值的示例

registry = getUtility(IRegistry)
registry['hexagonit.socialbutton.codes'] = {
    u'facebook': {
        u'code_text': u'<FACEBOOK>${title} <img src="${portal_url}/++resource++hexagonit.socialbutton/facebook.gif" /></FACEBOOK>',
    }
}

通过registry.xml注册的示例

<record name="hexagonit.socialbutton.codes">
  <field type="plone.registry.field.Dict">
    <title>Codes for Social Buttons</title>
    <key_type type="plone.registry.field.TextLine" />
    <value_type type="plone.registry.field.Dict">
      <title>Value list</title>
      <key_type type="plone.registry.field.TextLine" />
      <value_type type="plone.registry.field.Text">
        <title>Values</title>
      </value_type>
    </value_type>
  </field>
  <value>
    <element key="facebook">
      <element key="code_text">&lt;FACEBOOK&gt;${title} &lt;img src="${portal_url}/++resource++hexagonit.socialbutton/facebook.gif" /&gt;&lt;/FACEBOOK&gt;s</element>
    </element>
  </value>
</record>

代码变量

${title}

上下文标题。

${description}

上下文描述。

${url}

上下文的URL

${lang}

使用的语言,如en。

${lang_country}

包括国家代码的本地化,如en_US。

${portal_url}

Plone站点根URL。

一旦设置了 社交按钮代码设置,您可以前往 社交按钮配置 进行进一步配置。

社交按钮配置

ID

社交按钮代码设置 中设置的 ID。

内容类型

视图小部件将被应用到的内容类型。

视图小部件管理器

逐行添加视图小部件将应用到的视图小部件管理器的名称。

视图模型

添加视图小部件将应用到的视图的名称。对于所有视图,使用 *

仅视图权限

如果勾选,则视图小部件仅适用于对匿名用户可用的视图,如大多数情况下的发布内容。

启用

当禁用视图小部件中的代码时,取消选中此选项。

从文件系统代码设置值的示例

registry = getUtility(IRegistry)
registry['hexagonit.socialbutton.config'] = {
    u'facebook': {
        u'content_types': u'Page,News Item',
        u'viewlet_manager': u'plone.abovecontent\nplone.belowcontent',
        u'view_models': u'*',
        u'view_permission_only': 'True',
        u'enabled': 'True',
    }
}

通过registry.xml注册的示例

  <record name="hexagonit.socialbutton.config">
    <field type="plone.registry.field.Dict">
      <title>Configuration for Social Buttons</title>
      <key_type type="plone.registry.field.TextLine" />
      <value_type type="plone.registry.field.Dict">
        <title>Value list</title>
        <key_type type="plone.registry.field.TextLine" />
        <value_type type="plone.registry.field.Text">
          <title>Values</title>
        </value_type>
      </value_type>
    </field>
    <value>
      <element key="facebook">
        <element key="content_types">Page,News Item</element>
        <element key="viewlet_manager">plone.abovecontent
plone.belowcontent</element>
        <element key="view_models">*</element>
        <element key="view_permission_only">True</element>
        <element key="enabled">True</element>
      </element>
    </value>
  </record>

变更日志

0.11 (2014-05-13)

  • 删除 portal_url。[taito]

  • 需要 plone.stringinterp>=1.0.11。[taito]

0.10.2 (2013-11-12)

  • 修复没有类型信息的上下文的错误。[taito]

0.10.1 (2013-08-08)

  • 修复测试。[taito]

0.10 (2013-05-01)

  • 从 five.grok 中删除依赖。[taito]

  • 集成 Travis CI。[taito]

  • 将测试包移动到 extras_require。[taito]

0.9 (2012-11-13)

  • 添加权限: hexagonit.socialbutton: Manage Social Button 以管理社交按钮。[taito]

0.8.1 (2012-09-28)

  • 修复多行代码的错误。[rnd, taito]

0.8 (2012-09-20)

  • 添加对 Plone>=4.2.1 的依赖,并删除对 plone.stringinterp>=1.0.7 的依赖,因为 Plone-4.2.1 包含它。[taito]

0.7 (2012-08-22)

  • 添加对 plone.stringinterp>=1.0.7 的依赖,以便在 Plone 站点根上下文中可用字符串插值。[taito]

0.6 (2012-08-21)

  • 在升级步骤中添加对 None 的情况的防护。[rnd]

0.5 (2012-08-17)

  • 更新 registry.xml 以启用导入和导出。[taito]

  • 切换到使用 plone.stringinterp 而不是格式方法进行嵌入代码中的字符串插值。[taito]

0.4 (2012-08-13)

  • 修复拼写错误。初始化 Po 文件。一些翻译。[rnd]

  • 修复一些视图的问题:保护视图小部件。[rnd]

  • 添加 google-plus 图像。[taito]

0.3 (2012-08-08)

  • 为视图小部件管理器添加类以进行样式化。[rnd]

0.2 (2012-08-02)

  • 卸载配置文件以删除添加的注册记录。[taito]

  • 修复视图的上下文标题和描述的 UnicodeDecodeError。[taito]

  • 将“Plone 站点”添加到可配置的内容类型。[taito]

0.1 (2012-07-31)

  • 首次发布供使用。[taito]

0.0 (2012-07-24)

  • 首次发布。[taito]

贡献者

  • Kai Lautaportti <kai.lautaportti at hexagonit.fi>

  • Roman Susi <roman.susi at hexagonit.fi>

  • Taito Horiuchi <taito.horiuchi at gmail.com>

项目详情


下载文件

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

源分布

hexagonit.socialbutton-0.11.zip (55.9 kB 查看哈希)

上传时间

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面