예제 #1
0
        private void BuildMenu(NavigationItemBuilder menu)
        {
            menu.LinkToFirstChild(false); // See: http://orchard.codeplex.com/workitem/18807
            menu.Action("GlobalSettings", "Admin", new { area = "Onestop.Seo" }).Permission(Permissions.ManageSeo);


            var seoContentTypes = _seoService.ListSeoContentTypes();


            RunThroughRewriters(menu, (rewriter, builder) => {
                int l = 1;
                if (seoContentTypes.Any())
                {
                    foreach (var contentType in seoContentTypes)
                    {
                        if (l == 1)
                        {
                            builder.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name });
                        }

                        builder
                        .Add(T(contentType.DisplayName), l.ToString(), tab => tab.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name })
                             .LocalNav()
                             .Permission(Permissions.ManageSeo));

                        l++;
                    }
                }

                builder
                .Add(T("Dynamic pages"), l.ToString(), tab => tab.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = "Dynamic" })
                     .LocalNav()
                     .Permission(Permissions.ManageSeo));
            });
        }
예제 #2
0
 static NavigationItemBuilder Describe(NavigationItemBuilder item, string actionName, string controllerName, bool localNav)
 {
     item = item.Action(actionName, controllerName, new { area = "Orchard.Packaging" }).Permission(StandardPermissions.SiteOwner);
     if (localNav)
     {
         item = item.LocalNav();
     }
     return(item);
 }
예제 #3
0
 static NavigationItemBuilder Describe(NavigationItemBuilder item, string actionName, string controllerName, bool localNav)
 {
     item = item.Action(actionName, controllerName, new { area = "Om.Orchard.SocialMetaTags" }).Permission(Permissions.ManageSocialMetaTagsSettings);
     if (localNav)
     {
         item = item.LocalNav();
     }
     return(item);
 }
        private void BuildMenu(NavigationItemBuilder menu)
        {
            menu.LinkToFirstChild(false); // See: http://orchard.codeplex.com/workitem/18807
            menu.Action("GlobalSettings", "Admin", new { area = "Onestop.Seo" }).Permission(Permissions.ManageSeo);


            var seoContentTypes = _seoService.ListSeoContentTypes();

            if (seoContentTypes.Count() != 0)
            {
                var rewriters = new List <Rewriter> {
                    new Rewriter {
                        DisplayName = T("Title Tag Rewriter"), Type = "TitleRewriter"
                    },
                    new Rewriter {
                        DisplayName = T("Description Tag Rewriter"), Type = "DescriptionRewriter"
                    },
                    new Rewriter {
                        DisplayName = T("Keywords Tag Rewriter"), Type = "KeywordsRewriter"
                    }
                };

                int i = 1;
                foreach (var rewriter in rewriters)
                {
                    menu.Add(rewriter.DisplayName, i.ToString(),
                             item => {
                        int l = 1;
                        foreach (var contentType in seoContentTypes)
                        {
                            if (l == 1)
                            {
                                item.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name });
                            }

                            item
                            .Add(T(contentType.DisplayName), l.ToString(), tab => tab.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name })
                                 .LocalNav()
                                 .Permission(Permissions.ManageSeo));

                            l++;
                        }
                    });

                    i++;
                }
            }
        }
        public static NavigationItemBuilder <TItem, TBuilder> ActionIf <TItem, TBuilder>(this NavigationItemBuilder <TItem, TBuilder> item, ActionDetails[] actionDetails)
            where TItem : NavigationItem <TItem>
            where TBuilder : NavigationItemBuilder <TItem, TBuilder>, IHideObjectMembers
        {
            SmartPrincipal user = item.ViewContext.HttpContext.User as SmartPrincipal;

            if ((actionDetails != null) && (actionDetails.Length > 0))
            {
                foreach (ActionDetails actionDetail in actionDetails)
                {
                    if (user.IsInFeature(actionDetail.Feature))
                    {
                        return(item.Action(actionDetail.Action, actionDetail.Controller));
                    }
                }
            }

            item.Visible(true);
            return(item);
        }