gpt4 book ai didi

tridion - 如何在 SDL Tridion 2011 SP1 中扩展 "CheckOut"命令?

转载 作者:行者123 更新时间:2023-12-02 11:23:55 27 4
gpt4 key购买 nike

我正在尝试扩展 Tridion 的“CheckOut”命令,目前我正在尝试显示自己的消息,并期望当我从功能区工具中单击“CheckOut”选项时需要执行 OOTB CheckOut 操作酒吧。

我已经创建了如下所示的配置文件和 .js 文件,我还在 System.config 中进行了更改,并创建了虚拟目录。但是我的 .js 没有被触发并且没有显示我的自定义消息。

config.xml

<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge" xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration" xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions" xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
<resources cache="true">
<cfg:filters/>
<cfg:groups>
<cfg:group name="CommandsExtensions.Commandset" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" merge="always">
<cfg:fileset>
<cfg:file type="script">/js/ExtendCheckOut.js</cfg:file>
<cfg:file type="reference">CommandsExtensions.Interface</cfg:file>
</cfg:fileset>
<cfg:dependencies>
<cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
<cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
</cfg:dependencies>
</cfg:group>
</cfg:groups>
</resources>
<definitionfiles/>
<extensions>
<ext:editorextensions>
<ext:editorextension target="CME">
<ext:editurls/>
<ext:listdefinitions/>
<ext:taskbars/>
<ext:commands/>
<ext:commandextensions>
<ext:commands>
<ext:command name="CheckOut" extendingcommand="ExtendCheckOut" />
</ext:commands>
<ext:dependencies>
<cfg:dependency>CommandsExtensions.Commandset</cfg:dependency>
</ext:dependencies>
</ext:commandextensions>
<ext:contextmenus/>
<ext:lists/>
<ext:tabpages/>
<ext:toolbars/>
<ext:ribbontoolbars/>
</ext:editorextension>
</ext:editorextensions>
<ext:dataextenders/>
</extensions>
<commands>
<cfg:commandset id="CommandsExtensions.Interface">
<cfg:command name="ExtendCheckOut" implementation="CommandsExtensions.ExtendCheckOut"/>
</cfg:commandset>
</commands>
<contextmenus/>
<localization/>
<settings>
<defaultpage>/Views/Default.aspx</defaultpage>
<navigatorurl>/Views/Default.aspx</navigatorurl>
<editurls/>
<listdefinitions/>
<itemicons/>
<theme>
<path>css</path>
</theme>
<customconfiguration/>
</settings>

.js 文件

Type.registerNamespace("Extensions");

Extensions.ExtendCheckOut = function Extensions.ExtendCheckOut() {
Type.enableInterface(this, "Extensions.ExtendCheckOut");
this.addInterface("Tridion.Cme.Command", ["ExtendCheckOut"]);
};

Extensions.ExtendCheckOut.prototype.isAvailable = function ExtendCheckOut$isAvailable(selection) {
return true;
}

Extensions.ExtendCheckOut.prototype.isEnabled = function ExtendCheckOut$isEnabled(selection) {
return true;
}

Extensions.ExtendCheckOut.prototype._execute = function ExtendCheckOut$_execute(selection) {
$messages.registerWarning("This is Extended CheckOut");
}

最佳答案

这就是我所做的,扩展“保存”按钮:

<cfg:groups>
<cfg:group name="ValidateTitleField.CommandSet">
<cfg:fileset>
<cfg:file type="script">/Commands/ValidateTitleFieldCommand.js</cfg:file>
<cfg:file type="reference">ValidateTitleField.Interface</cfg:file>
</cfg:fileset>
<cfg:dependencies>
<cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
<cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
</cfg:dependencies>
</cfg:group>
<cfg:group name="ValidateTitleField.Views.ValidateTitleFieldPopup">
<cfg:fileset>
<cfg:file type="script">/Views/ValidateTitleFieldPopup.js</cfg:file>
<cfg:file type="style">/Views/ValidateTitleFieldPopup.css</cfg:file>
</cfg:fileset>
<cfg:dependencies>
<cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
<cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
</cfg:dependencies>
</cfg:group>
</cfg:groups>

[...]

  <ext:editorextension target="CME">
<ext:editurls />
<ext:listdefinitions />
<ext:taskbars />
<ext:commands />
<ext:commandextensions>
<ext:commands>
<ext:command name="Save" extendingcommand="ValidateTitleField"/>
</ext:commands>
<ext:dependencies>
<cfg:dependency>ValidateTitleField.CommandSet</cfg:dependency>
</ext:dependencies>
</ext:commandextensions>
<ext:contextmenus />
<ext:lists />
<ext:tabpages />
<ext:toolbars />
<ext:ribbontoolbars />
</ext:editorextension>

[...]

<commands>
<cfg:commandset id="ValidateTitleField.Interface">
<cfg:command name="ValidateTitleField" implementation="Company.Extensions.ValidateTitleFieldCommand"/>
</cfg:commandset>
</commands>

然后在我的命令实现(JS)中,我使用以下代码来调用“原始”方法:

Company.Extensions.ValidateTitleFieldCommand.prototype._isAvailable = function ValidateTitleFieldCommand$_isAvailable(selection) {
console.debug("Is Available called");
return $cme.getCommand("Save")._isAvailable(selection);
};

最后,在 _execute 方法深处的某个地方:

if (!failed)
return $cme.getCommand("Save")._execute(selection, pipeline);
else {
this.loadPopup();
}

希望这有帮助,

N

关于tridion - 如何在 SDL Tridion 2011 SP1 中扩展 "CheckOut"命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12457823/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com