【问题标题】:How to create the custom buttons horizontally one below the other in ribbon of Tridion如何在 Tridion 的功能区中水平创建自定义按钮
【发布时间】:2012-07-25 19:56:28
【问题描述】:

如何在 tridion 功能区中水平放置多个自定义按钮 - 一个在另一个下方。

就像我们有签入、签出、撤消签出按钮一样。

我尝试通过将它们放在一个组中来创建多个自定义按钮,但默认情况下它们会并排对齐,但不是一个在另一个下方。

【问题讨论】:

标签: tridion tridion-2011


【解决方案1】:

在one of my articles on Tridion Developer 中,我解释了如何使用功能区项目组,这可以将小按钮放在彼此下方,这样您就可以在 2 个大按钮(彼此相邻)的空间中放置 3 个按钮。

RibbonItemGroup 不是您可以在 UI 扩展的配置文件中定义的东西,它是您需要指定的 Tridion 用户控件 (.ascx)。

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewItemsGroup.ascx.cs" Inherits="SDL.Examples.UI.Controls.ViewItemsGroup" %>
<%@ Import Namespace="Tridion.Web.UI" %>
<c:RibbonItemsGroup runat="server" ID="RibbonItemsGroup">
  <c:RibbonButton runat="server" CommandName="ViewStaging" Title="View in Staging" Label="View In Staging" IsSmallButton="true" ID="ViewStagingBtn" />
  <c:RibbonButton runat="server" CommandName="ViewLive" Title="View in Live" Label="View in Live" IsSmallButton="true" ID="ViewLiveBtn" />
</c:RibbonItemsGroup>

文件后面的代码扩展了 Tridion.Web.UI.Controls.TridionUserControl,不需要任何特定代码。要将其包含在功能区工具栏中,请使用配置文件中的以下 XML 将功能区项目组指定为扩展:

<ext:extension assignid="ViewItemsGroup" groupid="EditGroup" name="View" pageid="HomePage" insertbefore="PublishGroup">
  <ext:group>~/Controls/ViewItemsGroup.ascx</ext:group>
  <ext:dependencies>
    <cfg:dependency>My.Theme</cfg:dependency>
    <cfg:dependency>My.Commands</cfg:dependency>
  </ext:dependencies>
  <ext:apply>
    <ext:view name="DashboardView">
      <ext:control id="DashboardToolbar" />
    </ext:view>
    <ext:view name="PageView">
      <ext:control id="ItemToolbar" />
    </ext:view>
  </ext:apply>
</ext:extension>

【讨论】:

  • 嗨,巴特非常感谢您提供的信息。您的意思是我们需要专门为我们的按钮创建一个新的 Tridion User Control.ascx,否则我们将需要更新现有文件。
  • 您确实需要在您的扩展项目中创建自己的 Tridion 用户控件,您可以将其命名为 WhatEverYouLike.ascx
  • 嗨,巴特,我已经创建了用户控件,然后制作了配置文件。现在我可以看到功能区上的标签了。但他们始终处于禁用模式。请让我知道如何使它们启用,以便可以在它们上添加功能。请建议我。
  • 它们像任何其他按钮一样通过 _isAvailable 和 _isEnabled 函数启用。
  • 是的,我的 js 文件中有 isAvailable 和 isEnabled 函数。
猜你喜欢
  • 2012-07-18
  • 1970-01-01
  • 2021-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多