private void TreeControllerBaseOnMenuRendering(TreeControllerBase sender, MenuRenderingEventArgs eventArgs)
        {
            var context = new HttpContextWrapper(HttpContext.Current);
            var urlHelper = new UrlHelper(new RequestContext(context, new RouteData()));
            var treeNodeType = new TreeNodeType(sender.TreeAlias ?? eventArgs.QueryStrings.Get("section"), eventArgs.QueryStrings.Get("treeType"));
            var objectType = Mappings.TreeNodeObjectTypes.ContainsKey(treeNodeType) ?
                Mappings.TreeNodeObjectTypes[treeNodeType] :
                UmbracoObjectTypes.Unknown;
            if (objectType != UmbracoObjectTypes.Unknown && Convert.ToInt32(eventArgs.NodeId) > 0)
            {
                var type = Mappings.TreeNodeObjectTypes[treeNodeType];
                var id = Convert.ToInt32(eventArgs.NodeId);
                var alias = EntityHelper.FindAlias(type, id);

                AddEditRelations(eventArgs, type, alias, urlHelper);
                AddEnableRelations(eventArgs, objectType, urlHelper);
            }
        }
Esempio n. 2
0
        private void TreeControllerBaseOnMenuRendering(TreeControllerBase sender, MenuRenderingEventArgs eventArgs)
        {
            var context      = new HttpContextWrapper(HttpContext.Current);
            var urlHelper    = new UrlHelper(new RequestContext(context, new RouteData()));
            var treeNodeType = new TreeNodeType(sender.TreeAlias ?? eventArgs.QueryStrings.Get("section"), eventArgs.QueryStrings.Get("treeType"));
            var objectType   = Mappings.TreeNodeObjectTypes.ContainsKey(treeNodeType) ?
                               Mappings.TreeNodeObjectTypes[treeNodeType] :
                               UmbracoObjectTypes.Unknown;

            if (objectType != UmbracoObjectTypes.Unknown && Convert.ToInt32(eventArgs.NodeId) > 0)
            {
                var type  = Mappings.TreeNodeObjectTypes[treeNodeType];
                var id    = Convert.ToInt32(eventArgs.NodeId);
                var alias = EntityHelper.FindAlias(type, id);

                AddEditRelations(eventArgs, type, alias, urlHelper);
                AddEnableRelations(eventArgs, objectType, urlHelper);
            }
        }