简体   繁体   English

默认情况下,如何使N2CMS在管理界面中显示编辑页面?

[英]How can I make N2CMS show edit page in admin interface by default?

When I am in the N2 management / admin interface, if I click on a node in the tree, by default it shows the output of that page. 当我进入N2管理/管理界面时,如果单击树中的某个节点,则默认情况下它将显示该页面的输出。 I can show the edit screen for that node by right clicking the node and clicking 'Edit'. 我可以通过右键单击该节点并单击“编辑”来显示该节点的编辑屏幕。 Can I get it to show the edit screen for that node by just clicking the node? 我可以通过单击该节点来显示该节点的编辑屏幕吗? Is there some setting I can change in web.config? 我可以在web.config中更改某些设置吗?

So the comment that I left on the question above doesn't really answer the question (it works only for the root node). 因此,我在上述问题上留下的评论并没有真正回答问题(仅适用于根节点)。 However, pretty much everything in N2 is pluggable, so you can use the dependency injection framework to replace the code that generates URLs in the edit interface with your own code as follows: 但是,N2中的几乎所有内容都是可插入的,因此您可以使用依赖项注入框架,用您自己的代码替换在编辑界面中生成URL的代码,如下所示:

using N2.Configuration;
using N2.Edit;
using N2.Engine;
using N2.Web;

namespace MyWebsite
{
    [Service(typeof(IEditUrlManager), Replaces = typeof(EditUrlManager))]
    public class MyEditUrlManager : EditUrlManager
    {
        public MyEditUrlManager(IUrlParser parser, EditSection config)
            : base(parser, config)
        {

        }

        public override string GetPreviewUrl(N2.ContentItem selectedItem)
        {
            return GetEditExistingItemUrl(selectedItem);
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM