【问题标题】:How to configure a GUI extension如何配置 GUI 扩展
【发布时间】:2012-10-11 11:18:32
【问题描述】:

我想通过配置文件使我的数据扩展器可配置。我发现编辑器配置文件中有一个节点“customconfiguration”。我猜这可以用来配置扩展的行为。有没有办法从 C# 访问该自定义配置节点?

【问题讨论】:

    标签: tridion


    【解决方案1】:

    我不知道它是否适用于数据扩展器,但我使用以下代码从模型配置中读取自定义配置:

    using System.Xml;
    using Tridion.Web.UI;
    using Tridion.Web.UI.Core;
    
    namespace Custom.Model
    {
        public class Configuration
        {
            public static string GetConfigString(string configItem) {
                XmlDocument customConfiguration = ConfigurationManager.Models["Custom.Model"].CustomXml;
                XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
                ns.AddNamespace("c", Constants.EDITOR_CONFIG_NAMESPACE);
                XmlNode node = customConfiguration.SelectSingleNode("//c:customconfiguration/c:clientconfiguration/c:" + configItem, ns);
                string configValue = node != null ? node.InnerText : "";
    
                return configValue;
            }
        }
    }
    

    您可以使用 ConfigurationManager.Editors 来访问您的编辑器配置,而不是使用 ConfigurationManager.Models。您通过启用扩展的 System.config 中指定的名称引用模型或编辑器,例如如下例中定义的 CME。

    <editor name="CME">
      <installpath>C:\Program Files (x86)\Tridion\web\WebUI\Editors\CME\</installpath>
      <configuration>Configuration\CME.config</configuration>
      <vdir>CME</vdir>
    </editor>
    

    【讨论】:

      【解决方案2】:

      WebRoot/Configuration文件夹中的配置文件是CME应用的通用配置文件,“Core”配置文件。除此之外,CME 应用程序中的每个编辑器和模型都有配置文件。这些配置文件具有“customconfiguration”部分,可从 ConfigurationManager 访问。

      当您创建 DataExtenderr 时,您需要创建新的扩展模型。以及该模型的配置文件,您可以在其中填写自定义配置部分所需的信息。

      【讨论】:

        猜你喜欢
        • 2012-11-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-01-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多