如何配置GUI扩展

时间:2012-10-11 11:18:32

标签: tridion

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

2 个答案:

答案 0 :(得分:4)

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

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>

答案 1 :(得分:2)

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

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