在Sitecore中,如何通过右键单击内容项打开自定义Sitecore应用程序?

在Sitecore中,如何通过右键单击内容项打开自定义Sitecore应用程序?,sitecore,sitecore6,Sitecore,Sitecore6,我希望能够右键单击Sitecore中的内容项,然后在上下文菜单中选择类似“运行我的应用程序”的内容。然后在运行的应用程序中,我需要能够引用右键单击的内容项。这可能吗?是的,你可以做到,这并不像听起来那么难 您希望进入核心数据库并打开内容编辑器。右键单击菜单在sitecore/content/Applications/content Editor/Context menu/Default中定义 该文件夹中的项目是您在树中的项目上单击鼠标右键时看到的项目。因此,您可以使用菜单项的模板添加一个新项 如

我希望能够右键单击Sitecore中的内容项,然后在上下文菜单中选择类似“运行我的应用程序”的内容。然后在运行的应用程序中,我需要能够引用右键单击的内容项。这可能吗?

是的,你可以做到,这并不像听起来那么难

您希望进入核心数据库并打开内容编辑器。右键单击菜单在sitecore/content/Applications/content Editor/Context menu/Default中定义

该文件夹中的项目是您在树中的项目上单击鼠标右键时看到的项目。因此,您可以使用菜单项的模板添加一个新项

如果查看现有的站点,大多数站点都会向Sitecore桌面发送消息。这些消息是在/App_Config/commands.Config中定义的命令。我在那里看不到任何只会启动另一个Sitecore应用程序的内容,因此您需要创建一个新命令来执行此操作。要创建一个,只需从
Sitecore.Shell.Framework.Commands.Command
类继承即可。它在一个
CommandContext
中传递,该上下文将保存一组项

    public class DemoCommand: Command
{
    #region Overrides of Command

    /// <summary>
    /// Executes the command in the specified context.
    /// </summary>
    /// <param name="context">The context.</param>
    public override void Execute(CommandContext context)
    {
        Assert.ArgumentNotNull(context, "context");

        var parameters = new NameValueCollection();
        if (context.Items != null && context.Items.Length == 1)
        {
            var item = context.Items[0];
            parameters["id"] = item.ID.ToString();
        }
        Context.ClientPage.Start(this, "Run", parameters);
    }

    #endregion

    public CommandState QueryStat(CommandContext context)
    {
        Assert.ArgumentNotNull(context, "context");
        return CommandState.Enabled;
    }

    protected static void Run(ClientPipelineArgs args)
    {
        Assert.ArgumentNotNull(args, "args");

        SheerResponse.CheckModified(false);
        SheerResponse.Broadcast(
                        SheerResponse.ShowModalDialog(
                            "[Path to your application here]"
                        ),
                        "Shell");
    }
}
希望这是有道理的:)

item:runMyApplication(id=$Target)