public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                this.GetType().Namespace + "_" + ModuleName + "_default",
                ModuleName + "/{controller}/{action}",
                new { controller = "Admin", action = "Index" }
                , null
                , new[] { "KoobooModule.Areas.KoobooModule.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );
            var areaPath = AreaHelpers.CombineAreaFilePhysicalPath(AreaName);

            if (Directory.Exists(areaPath))
            {
                var menuFile = AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "CMSMenu.config");
                if (File.Exists(menuFile))
                {
                    Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, menuFile);
                }

                var globalMenuFile = AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "GlobalMenu.config");
                if (File.Exists(globalMenuFile))
                {
                    Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(Kooboo.CMS.Sites.Extension.UI.GlobalSidebarMenu.ModuleGlobalSidebarMenuItemProvider.GetGlobalSidebarMenuTemplateName(AreaName), globalMenuFile);
                }
                var resourceFile = Path.Combine(Settings.BaseDirectory, "Areas", AreaName, "WebResources.config");
                if (File.Exists(resourceFile))
                {
                    Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, resourceFile);
                }
            }
        }
Example #2
0
        private string GetPath(ControllerContext controllerContext, string[] locations, string[] areaLocations, string locationsPropertyName, string name, string controllerName, string cacheKeyPrefix, bool useCache, out string[] searchedLocations, string ThemeName)
        {
            searchedLocations = _emptyLocations;

            if (String.IsNullOrEmpty(name))
            {
                return(String.Empty);
            }

            string areaName   = AreaHelpers.GetAreaName(controllerContext.RouteData);
            bool   usingAreas = !String.IsNullOrEmpty(areaName);
            List <ViewLocation> viewLocations = GetViewLocations(locations, (usingAreas) ? areaLocations : null);

            if (viewLocations.Count == 0)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                                                                  "属性不能为空", locationsPropertyName));
            }

            bool   nameRepresentsPath = IsSpecificPath(name);
            string cacheKey           = CreateCacheKey(cacheKeyPrefix, name, (nameRepresentsPath) ? String.Empty : controllerName, areaName, ThemeName);

            if (useCache)
            {
                return(ViewLocationCache.GetViewLocation(controllerContext.HttpContext, cacheKey));
            }

            return((nameRepresentsPath) ?
                   GetPathFromSpecificName(controllerContext, name, cacheKey, ref searchedLocations) :
                   GetPathFromGeneralName(controllerContext, viewLocations, name, controllerName, areaName, cacheKey, ref searchedLocations, ThemeName));
        }
        public override void RegisterArea(AreaRegistrationContext context)
        {
            //var metaweblogRoute = new Route("Contents/metaweblog", null, null, new MetaWeblogRouteHandler());
            //context.Routes.Add(metaweblogRoute);

            context.MapRoute(
                "Contents_default",
                "Contents/{controller}/{action}",///{repositoryName}/{name}
                new { action = "Index" }
                , null
                , new[] { "Kooboo.CMS.Web.Areas.Contents.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "Menu.config"));
            Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "WebResources.config"));

            #region RegisterPermissions
            var roleManager = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <RoleManager>();
            roleManager.AddPermission(Permission.Contents_SettingPermission);
            roleManager.AddPermission(Permission.Contents_SchemaPermission);
            roleManager.AddPermission(Permission.Contents_FolderPermission);
            roleManager.AddPermission(Permission.Contents_ContentPermission);
            roleManager.AddPermission(Permission.Contents_BroadcastingPermission);
            roleManager.AddPermission(Permission.Contents_WorkflowPermission);
            roleManager.AddPermission(Permission.Contents_SearchSettingPermission);
            roleManager.AddPermission(Permission.Contents_HtmlBlockPermission);

            #endregion

            base.RegisterArea(context);
        }
        public override void RegisterArea(AreaRegistrationContext context)
        {
            /*
             * context.MapRoute(
             *  "Commerce_default",
             *  "Commerce/{controller}/{action}/{id}",
             *  new { action = "Index", id = UrlParameter.Optional }
             * );*/
            context.MapRoute(
                AreaName + "_default",
                AreaName + "/{controller}/{action}",
                new { controller = "Home", action = "Index" }
                , null
                , new[] { "Kooboo.Commerce.Web.Controllers", "Kooboo.Commerce.Web.Areas.Commerce.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            var menuFile = AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "Menu.config");

            if (File.Exists(menuFile))
            {
                Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, menuFile);
            }
            var resourceFile = Path.Combine(Settings.BaseDirectory, "Areas", AreaName, "WebResources.config");

            if (File.Exists(resourceFile))
            {
                Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, resourceFile);
            }
        }
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Membership_default",
                "Membership/{controller}/{action}",
                new { controller = "Membership", action = "Index" }
                , new[] { "Kooboo.CMS.Web.Areas.Membership.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "Menu.config"));
            Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "WebResources.config"));

            #region RegisterPermissions
            var roleManager = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <RoleManager>();
            roleManager.AddPermission(new Permission()
            {
                AreaName = "Membership", Group = "", Name = "Setting"
            });
            roleManager.AddPermission(new Permission()
            {
                AreaName = "Membership", Group = "", Name = "Group"
            });
            roleManager.AddPermission(new Permission()
            {
                AreaName = "Membership", Group = "", Name = "Member"
            });
            roleManager.AddPermission(new Permission()
            {
                AreaName = "Membership", Group = "", Name = "Connect"
            });
            #endregion

            base.RegisterArea(context);
        }
Example #6
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                ModuleName + "_default",
                ModuleName + "/{controller}/{action}",
                new { controller = "Admin", action = "Index" }
                , null
                , new[] { "Kooboo.CMS.ExtensionTemplate.Areas.ProductModule.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );
            var areaPath = AreaHelpers.CombineAreaFilePhysicalPath(AreaName);

            if (Directory.Exists(areaPath))
            {
                var menuFile = AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "CMSMenu.config");
                if (File.Exists(menuFile))
                {
                    Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, menuFile);
                }
                var resourceFile = Path.Combine(Settings.BaseDirectory, "Areas", AreaName, "WebResources.config");
                if (File.Exists(resourceFile))
                {
                    Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, resourceFile);
                }
            }
        }
Example #7
0
        private static bool MatchProvider(MvcRoute applyTo, RequestContext requestContext)
        {
            var area       = AreaHelpers.GetAreaName(requestContext.RouteData);
            var controller = requestContext.GetRequestValue("controller");
            var action     = requestContext.GetRequestValue("action");


            var matched = applyTo.Area.EqualsOrNullEmpty(area, StringComparison.OrdinalIgnoreCase) &&
                          applyTo.Controller.Equals(controller, StringComparison.OrdinalIgnoreCase) &&
                          applyTo.Action.EqualsOrNullEmpty(action, StringComparison.OrdinalIgnoreCase);

            if (matched && applyTo.RouteValues != null)
            {
                foreach (var item in applyTo.RouteValues)
                {
                    if (item.Value == null)
                    {
                        continue;
                    }
                    var routeValue = requestContext.GetRequestValue(item.Key);
                    if (routeValue == null)
                    {
                        matched = false;
                        break;
                    }
                    if (!item.Value.ToString().EqualsOrNullEmpty(routeValue.ToString(), StringComparison.OrdinalIgnoreCase))
                    {
                        matched = false;
                        break;
                    }
                }
            }

            return(matched);
        }
Example #8
0
        private string GetPath(ControllerContext controllerContext, string[] locations, string[] areaLocations,
                               string locationsPropertyName, string name, string controllerName, string cacheKeyPrefix, bool useCache,
                               out string[] searchedLocations)
        {
            searchedLocations = _emptyLocations;

            if (string.IsNullOrEmpty(name))
            {
                return(string.Empty);
            }

            var areaName      = AreaHelpers.GetAreaName(controllerContext.RouteData);
            var usingAreas    = !string.IsNullOrEmpty(areaName);
            var viewLocations = GetViewLocations(locations, usingAreas ? areaLocations : null);

            if (viewLocations.Count == 0)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
                                                                  HotcakesResources.Common_PropertyCannotBeNullOrEmpty, locationsPropertyName));
            }

            var nameRepresentsPath = IsSpecificPath(name);
            var rootFolder         = HotcakesApplication.Current.ViewsVirtualPath;
            var cacheKey           = CreateCacheKey(cacheKeyPrefix, name, nameRepresentsPath ? string.Empty : controllerName,
                                                    areaName, rootFolder);

            if (useCache)
            {
                // Only look at cached display modes that can handle the context.
                var possibleDisplayModes =
                    DisplayModeProvider.GetAvailableDisplayModesForContext(controllerContext.HttpContext,
                                                                           controllerContext.DisplayMode);
                foreach (var displayMode in possibleDisplayModes)
                {
                    var cachedLocation = ViewLocationCache.GetViewLocation(controllerContext.HttpContext,
                                                                           AppendDisplayModeToCacheKey(cacheKey, displayMode.DisplayModeId));

                    if (cachedLocation != null)
                    {
                        if (controllerContext.DisplayMode == null)
                        {
                            controllerContext.DisplayMode = displayMode;
                        }

                        return(cachedLocation);
                    }
                }

                // GetPath is called again without using the cache.
                return(null);
            }
            return(nameRepresentsPath
                ? GetPathFromSpecificName(controllerContext, name, rootFolder, cacheKey, ref searchedLocations)
                : GetPathFromGeneralName(controllerContext, viewLocations, name, controllerName, areaName, rootFolder,
                                         cacheKey, ref searchedLocations));
        }
Example #9
0
        public virtual MenuItem Initialize(MenuItem menuItem, ControllerContext controllerContext)
        {
            var areaName = AreaHelpers.GetAreaName(controllerContext.RouteData);

            if (!string.IsNullOrEmpty(areaName) && menuItem.RouteValues != null)
            {
                menuItem.RouteValues["area"] = areaName;
            }
            if (!string.IsNullOrEmpty(menuItem.Area) && menuItem.RouteValues != null)
            {
                menuItem.RouteValues["area"] = menuItem.Area;
            }


            var isActive =
                GetIsActive(menuItem, controllerContext);

            menuItem.IsCurrent = isActive;

            foreach (var sub in menuItem.Items)
            {
                sub.Initialize(controllerContext);
                if (sub.IsActive)
                {
                    menuItem.IsCurrent = false;
                }
                isActive = isActive || sub.IsActive;
            }

            menuItem.IsActive = isActive;

            //if (!this.IsActive)
            //{
            //    this.IsActive = DefaultActive(controllerContext);
            //}


            if (menuItem.Visible != false)
            {
                var isVisible =
                    GetIsVisible(menuItem, controllerContext);

                if (string.IsNullOrEmpty(menuItem.Action) && menuItem.Items.Where(it => it.Visible == true).Count() == 0)
                {
                    isVisible = false;
                }

                menuItem.Visible = isVisible;
            }


            menuItem.Initialized = true;

            return(menuItem);
        }
Example #10
0
        private static IEnumerable <IToolbarProvider> MatchProviders(IEnumerable <IToolbarProvider> tabProviders, RouteData route)
        {
            var area       = AreaHelpers.GetAreaName(route);
            var controller = route.Values["controller"].ToString();
            var action     = route.Values["action"].ToString();

            return(tabProviders.Where(it => it.ApplyTo == null ||
                                      it.ApplyTo.Any(at => at.Area.EqualsOrNullEmpty(area, StringComparison.OrdinalIgnoreCase) &&
                                                     at.Controller.Equals(controller, StringComparison.OrdinalIgnoreCase) &&
                                                     at.Action.EqualsOrNullEmpty(action, StringComparison.OrdinalIgnoreCase))));
        }
Example #11
0
 protected virtual bool GetIsActive(MenuItem menuItem, ControllerContext controllerContext)
 {
     if (!string.IsNullOrEmpty(menuItem.Area))
     {
         if (string.Compare(menuItem.Area, AreaHelpers.GetAreaName(controllerContext.RouteData)) != 0)
         {
             return(false);
         }
     }
     return(string.Compare(controllerContext.RouteData.Values["controller"].ToString(), menuItem.Controller, true) == 0);
 }
Example #12
0
        public void GetAreaNameFromIAreaAssociatedItem()
        {
            // Arrange
            CustomRouteWithArea route = new CustomRouteWithArea();

            // Act
            string areaName = AreaHelpers.GetAreaName(route);

            // Assert
            Assert.Equal("area_name", areaName);
        }
Example #13
0
        public void GetAreaNameReturnsNullIfRouteNotAreaAware()
        {
            // Arrange
            Route route = new Route("the_url", new MvcRouteHandler());

            // Act
            string areaName = AreaHelpers.GetAreaName(route);

            // Assert
            Assert.Null(areaName);
        }
Example #14
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            // Register module menu
            string menuFilePath = AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "Menu.config");

            MenuFactory.RegisterAreaMenu(AreaName, menuFilePath);

            // Register module web resources
            string webResourcesFilePath = Path.Combine(Settings.BaseDirectory, "Areas", AreaName, "WebResources.config");

            ConfigurationManager.RegisterSection(AreaName, webResourcesFilePath);
        }
        private string GetPath(ControllerContext controllerContext, string[] areaLocations, string[] sharedLocations, string name, string controllerName, string cacheKeyPrefix, bool useCache, out string[] searchedLocations)
        {
            searchedLocations = _emptyLocations;

            if (String.IsNullOrEmpty(name))
            {
                return(String.Empty);
            }

            var areaName = AreaHelpers.GetAreaName(controllerContext.RouteData);
            List <ViewLocation> viewLocations = GetViewLocations(sharedLocations, areaLocations);

            bool   nameRepresentsPath = IsSpecificPath(name);
            string cacheKey           = CreateCacheKey(cacheKeyPrefix, name, (nameRepresentsPath) ? String.Empty : controllerName, areaName);

            if (useCache)
            {
                // Only look at cached display modes that can handle the context.
                IEnumerable <IDisplayMode> possibleDisplayModes = DisplayModeProvider.GetAvailableDisplayModesForContext(controllerContext.HttpContext, controllerContext.DisplayMode);
                foreach (IDisplayMode displayMode in possibleDisplayModes)
                {
                    string cachedLocation = ViewLocationCache.GetViewLocation(controllerContext.HttpContext, AppendDisplayModeToCacheKey(cacheKey, displayMode.DisplayModeId));

                    if (cachedLocation == null)
                    {
                        // If any matching display mode location is not in the cache, fall back to the uncached behavior, which will repopulate all of our caches.
                        return(null);
                    }

                    // A non-empty cachedLocation indicates that we have a matching file on disk. Return that result.
                    if (cachedLocation.Length > 0)
                    {
                        if (controllerContext.DisplayMode == null)
                        {
                            controllerContext.DisplayMode = displayMode;
                        }

                        return(cachedLocation);
                    }
                    // An empty cachedLocation value indicates that we don't have a matching file on disk. Keep going down the list of possible display modes.
                }

                // GetPath is called again without using the cache.
                return(null);
            }
            else
            {
                return(nameRepresentsPath
                    ? GetPathFromSpecificName(controllerContext, name, cacheKey, ref searchedLocations)
                    : GetPathFromGeneralName(controllerContext, viewLocations, name, controllerName, areaName, cacheKey, ref searchedLocations));
            }
        }
Example #16
0
        public void GetAreaNameFromRouteData()
        {
            // Arrange
            RouteData routeData = new RouteData();

            routeData.DataTokens["area"] = "area_name";

            // Act
            string areaName = AreaHelpers.GetAreaName(routeData);

            // Assert
            Assert.Equal("area_name", areaName);
        }
Example #17
0
        public void GetAreaNameFromAreaRouteCollectionRoute()
        {
            // Arrange
            RouteCollection         routes  = new RouteCollection();
            AreaRegistrationContext context = new AreaRegistrationContext("area_name", routes);
            Route route = context.MapRoute(null, "the_url");

            // Act
            string areaName = AreaHelpers.GetAreaName(route);

            // Assert
            Assert.Equal("area_name", areaName);
        }
Example #18
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Account_default",
                "Account/{controller}/{action}/{id}",
                new { controller = "LogOn", action = "Index", id = UrlParameter.Optional }
                , null
                , new[] { "Kooboo.CMS.Web.Areas.Account.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "Menu.config"));
            Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, Path.Combine(Settings.BaseDirectory, "Areas", AreaName, "WebResources.config"));
        }
Example #19
0
        public void GetAreaNameFromRouteDataFallsBackToRoute()
        {
            // Arrange
            RouteCollection         routes  = new RouteCollection();
            AreaRegistrationContext context = new AreaRegistrationContext("area_name", routes);
            Route     route     = context.MapRoute(null, "the_url");
            RouteData routeData = new RouteData(route, new MvcRouteHandler());

            // Act
            string areaName = AreaHelpers.GetAreaName(routeData);

            // Assert
            Assert.Equal("area_name", areaName);
        }
        protected override bool GetIsActive(MenuItem menuItem, ControllerContext controllerContext)
        {
            string areaName       = AreaHelpers.GetAreaName(controllerContext.RouteData);
            string controllerName = controllerContext.RouteData.Values.GetString("controller");
            string actionName     = controllerContext.RouteData.Values.GetString("action");

            if (menuItem.Area.Equals(areaName, StringComparison.OrdinalIgnoreCase) &&
                menuItem.Controller.Equals(controllerName, StringComparison.OrdinalIgnoreCase) &&
                menuItem.Action.Equals(actionName, StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }

            return(false);
        }
Example #21
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            //var metaweblogRoute = new Route("Contents/metaweblog", null, null, new MetaWeblogRouteHandler());
            //context.Routes.Add(metaweblogRoute);

            context.MapRoute(
                "Contents_default",
                "Contents/{controller}/{action}",///{repositoryName}/{name}
                new { action = "Index" }
                , null
                , new[] { "Kooboo.CMS.Web.Areas.Contents.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "Menu.config"));
            Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "WebResources.config"));
        }
        public IEnumerable <T> Match <T>(IEnumerable <T> applyToItems, System.Web.Routing.RouteData route, string position = null)
            where T : IApplyTo
        {
            if (applyToItems == null)
            {
                return(new T[0]);
            }
            var area       = AreaHelpers.GetAreaName(route);
            var controller = route.Values["controller"].ToString();
            var action     = route.Values["action"].ToString();

            return(applyToItems.Where(it => ((string.IsNullOrEmpty(position) && string.IsNullOrEmpty(it.Position)) || position.EqualsOrNullEmpty(it.Position, StringComparison.OrdinalIgnoreCase)) &&
                                      (it.ApplyTo == null ||
                                       it.ApplyTo.Any(at => at.Area.EqualsOrNullEmpty(area, StringComparison.OrdinalIgnoreCase) &&
                                                      at.Controller.Equals(controller, StringComparison.OrdinalIgnoreCase) &&
                                                      at.Action.EqualsOrNullEmpty(action, StringComparison.OrdinalIgnoreCase)))).ToArray());
        }
Example #23
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                ModuleName + "_default",
                ModuleName + "/{controller}/{action}",
                new { action = "Index" }
                , null
                , new[] { "Kooboo.CMS.ExtensionTemplate.Areas.BlogModule.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            var areaPath = AreaHelpers.CombineAreaFilePhysicalPath(AreaName);

            if (Directory.Exists(areaPath))
            {
                var menuFile = AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "CMSMenu.config");
                if (File.Exists(menuFile))
                {
                    Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, menuFile);
                }
                var resourceFile = Path.Combine(Settings.BaseDirectory, "Areas", AreaName, "WebResources.config");
                if (File.Exists(resourceFile))
                {
                    Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, resourceFile);
                }

                ModuleInfo moduleInfo = ModuleInfo.Get(ModuleAreaRegistration.ModuleName);
                if (moduleInfo.DefaultSettings.CustomSettings.ContainsKey("ConnectionString"))
                {
                    BlogDbContext.DefaultConnectionString = moduleInfo.DefaultSettings.CustomSettings["ConnectionString"];
                }

                #region RegisterPermissions
                var roleManager = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <RoleManager>();
                roleManager.AddPermission(new Permission()
                {
                    AreaName = "Blog", Group = "", Name = "Blog"
                });
                roleManager.AddPermission(new Permission()
                {
                    AreaName = "Blog", Group = "", Name = "Category"
                });
                #endregion
            }
        }
        protected virtual bool GetIsActive(MenuItem menuItem, ControllerContext controllerContext)
        {
            if (!string.IsNullOrEmpty(menuItem.Area))
            {
                if (string.Compare(menuItem.Area, AreaHelpers.GetAreaName(controllerContext.RouteData)) != 0)
                {
                    return(false);
                }
            }
            var active = string.Compare(controllerContext.RouteData.Values["controller"].ToString(), menuItem.Controller, true) == 0;

            if (active && menuItem.ReadOnlyProperties != null)
            {
                var activeByAction = menuItem.ReadOnlyProperties["activeByAction"];
                if (!string.IsNullOrEmpty(activeByAction) && activeByAction.ToLower() == "true")
                {
                    active = string.Compare(controllerContext.RouteData.Values["action"].ToString(), menuItem.Action, true) == 0;
                }
            }
            return(active);
        }
Example #25
0
 /// <summary>
 /// Gets the name of the area.
 /// </summary>
 /// <param name="routeData">The route data.</param>
 /// <returns>Area name.</returns>
 public static string GetAreaName(this RouteData routeData)
 {
     return(AreaHelpers.GetAreaName(routeData));
 }
Example #26
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Publishing_default",
                "Publishing/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional },
                new[] { "Kooboo.CMS.Modules.Publishing.Web.Areas.Publishing.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );


            Kooboo.Web.Mvc.Menu.MenuFactory.RegisterAreaMenu(AreaName, Path.Combine(Settings.BaseDirectory, "Areas", AreaName, "Menu.config"));
            Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "WebResources.config"));

            base.RegisterArea(context);

            #region RegisterPermissions

            var roleManager = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <RoleManager>();


            roleManager.AddPermission(Publishing_Local_Queue);
            roleManager.AddPermission(Publishing_Remote_RemoteSites);
            roleManager.AddPermission(Publishing_Remote_TextFolderMapping);
            roleManager.AddPermission(Publishing_Remote_Queue);
            roleManager.AddPermission(Publishing_Remote_Incoming);
            //roleManager.AddPermission(Permission.Publishing_Remote_Cmis);
            roleManager.AddPermission(Publishing_Local_Logs);
            #endregion
        }
Example #27
0
 private string GetView(string viewName)
 {
     return(AreaHelpers.CombineAreaFileVirtualPath(SitesAreaRegistration.SiteAreaName, "views", "FileManager", viewName));
 }
        public override void RegisterArea(AddinAreaRegistrationContext context)
        {
            context.MapRoute(
                name: AreaName + "_default",
                url: AreaName + "/{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "Kooboo.Commerce.Multilingual.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "WebResources.config"));

            MapperConfiguration.Configure();
            SqlceConfiguration.Configure();
        }
Example #29
0
        public override void RegisterArea(System.Web.Mvc.AreaRegistrationContext context)
        {
            context.MapRoute(
                name: AreaName + "_default",
                url: AreaName + "/{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "Kooboo.Commerce.Shipping.ByWeight.Controllers", "Kooboo.Web.Mvc", "Kooboo.Web.Mvc.WebResourceLoader" }
                );

            Kooboo.Web.Mvc.WebResourceLoader.ConfigurationManager.RegisterSection(AreaName, AreaHelpers.CombineAreaFilePhysicalPath(AreaName, "WebResources.config"));

            base.RegisterArea(context);
        }
Example #30
0
 public static MvcHtmlString ModularActionLink(this HtmlHelper helper, string linkText, string actionName, string controllerName, string areaName, object arguments, object htmlAttributes)
 {
     return(helper.ActionLink(linkText, actionName, controllerName, AreaHelpers.GetRouteViewDictionary(areaName, AreaHelpers.GetModuleName(helper.ViewContext.RouteData), arguments), GetHtmlAttributes(htmlAttributes)));
 }