示例#1
1
        public IEnumerable<SelectListItem> GetSelectListItems(System.Web.Routing.RequestContext requestContext, string filter = null)
        {
            var siteName = requestContext.GetRequestValue("siteName");

            var site = new Site(siteName).AsActual();

            IEnumerable<Page> pageList = new List<Page>();

            var rootPages = Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.All(site, null);

            pageList = rootPages.ToList();

            foreach (var r in rootPages)
            {
                this.GenerateList(site, r, ref pageList);
            }

            if (filter == null)
            {
                return null;
            }

            var result = pageList.Where(o => o.VirtualPath.StartsWith(filter, StringComparison.OrdinalIgnoreCase)).Select(o => new SelectListItem { Text = o.VirtualPath, Value = o.VirtualPath });

            return result;
        }
示例#2
0
        public IEnumerable<SelectListItem> GetSelectListItems(System.Web.Routing.RequestContext requestContext, string filter = null)
        {
            List<SelectListItem> items = new List<SelectListItem>();

            var type = requestContext.GetRequestValue("type").ToLower();

            var fileManager = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve<FileManager>(type);
            items.Add(new SelectListItem() { Text = "*.*", Value = "" });
            if (fileManager is ThemeManager)
            {
                items.Add(new SelectListItem() { Text = ".css", Value = ".css" });
                items.Add(new SelectListItem() { Text = ".rule", Value = ".rule" });
                AddDynamicClientResourceTypes(items, ResourceType.Stylesheet);

            }
            if (fileManager is ScriptManager)
            {
                items.Add(new SelectListItem() { Text = ".js", Value = ".js" });
                AddDynamicClientResourceTypes(items, ResourceType.Javascript);
            }
            if (fileManager is CustomFileManager)
            {
                items.Add(new SelectListItem() { Text = ".js", Value = ".js" });
                items.Add(new SelectListItem() { Text = ".css", Value = ".css" });
                items.Add(new SelectListItem() { Text = ".txt", Value = ".txt" });

                AddDynamicClientResourceTypes(items, ResourceType.Unspecified);
            }

            return items;
        }
示例#3
0
 protected override bool AuthorizeCore(System.Web.Routing.RequestContext requestContext)
 {
     if (requestContext.GetRequestValue("Action").ToLower() == "largefile")
     {
         return true;
     }
     return base.AuthorizeCore(requestContext);
 }
示例#4
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            Site.Current = null;
            Repository.Current = null;

            var siteName = requestContext.GetRequestValue("siteName");
            if (siteName != null)
            {
                var name = siteName.ToString();
                if (!string.IsNullOrEmpty(name))
                {
                    Site.Current = (SiteHelper.Parse(siteName)).AsActual();
                    if (Site.Current != null)
                    {
                        SetThreadCulture(Site.Current);
                        if (Site.Current.GetRepository() != null)
                        {
                            Repository.Current = Site.Current.GetRepository().AsActual();
                        }
                    }
                }
            }


            var repository = requestContext.GetRequestValue("repositoryName");
            if (!string.IsNullOrEmpty(repository))
            {
                var name = repository.ToString();
                if (!string.IsNullOrEmpty(name))
                {
                    Repository.Current = (new Repository(name)).AsActual();
                }
            }
            if (User.Identity.IsAuthenticated == true)
            {
                SetUICulture();
            }
        }
示例#5
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            Site.Current = null;
            Repository.Current = null;

            var siteName = requestContext.GetRequestValue("siteName");
            if (siteName != null)
            {
                var name = siteName.ToString();
                if (!string.IsNullOrEmpty(name))
                {
                    Site.Current = Kooboo.CMS.Sites.Models.IPersistableExtensions.AsActual(SiteHelper.Parse(siteName));
                    if (Site.Current != null)
                    {
                        SetThreadCulture(Site.Current);
                        if (Site.Current.GetRepository() != null)
                        {
                            Repository.Current = Site.Current.GetRepository().AsActual();
                        }
                    }
                }
            }

            var repository = requestContext.GetRequestValue("repositoryName");
            if (!string.IsNullOrEmpty(repository))
            {
                var name = repository.ToString();
                if (!string.IsNullOrEmpty(name))
                {
                    Repository.Current = Kooboo.CMS.Content.Models.IPersistableExtensions.AsActual(new Repository(name));
                }
            }

            SetUICulture();
        }
        public IEnumerable<SelectListItem> GetSelectListItems(System.Web.Routing.RequestContext requestContext, string filter = null)
        {
            var siteName = requestContext.GetRequestValue("siteName");

            var site = new Site(siteName).AsActual();

            IEnumerable<Page> pageList = new List<Page>();

            var rootPages = Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.All(site, null);

            pageList = rootPages.ToList();

            foreach (var r in rootPages)
            {
                this.GenerateList(site, r, ref pageList);
            }

            if (string.IsNullOrEmpty(filter))
            {
                return null;
            }
            var prefix = "";
            var slashIndex = filter.IndexOf('/');
            if (slashIndex != -1)
            {
                if (slashIndex == filter.Length - 1)
                {
                    prefix = filter.Substring(0, slashIndex + 1);
                    filter = "";
                }
                else
                {
                    prefix = filter.Substring(0, slashIndex + 1);
                    filter = filter.Substring(slashIndex + 1);
                }
            }
            if (string.IsNullOrEmpty(prefix))
            {
                prefix = "~/";
            }

            var result = pageList.Where(o => o.VirtualPath.Contains(filter, StringComparison.OrdinalIgnoreCase))
                .Select(o => new SelectListItem { Text = prefix + o.VirtualPath.TrimStart('/'), Value = prefix + o.VirtualPath.TrimStart('/') });

            return result;
        }
示例#7
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);

            Site.Current = null;
            Repository.Current = null;

            var siteName = requestContext.GetRequestValue("siteName");
            if (siteName != null)
            {
                var name = siteName.ToString();
                if (!string.IsNullOrEmpty(name))
                {
                    Site.Current = (SiteHelper.Parse(siteName)).AsActual();
                    if (Site.Current != null)
                    {
                        if (Site.Current.GetRepository() != null)
                        {
                            Repository.Current = Site.Current.GetRepository().AsActual();
                        }
                    }
                }
            }
        }
示例#8
0
 public IEnumerable<System.Web.Mvc.SelectListItem> GetSelectListItems(System.Web.Routing.RequestContext requestContext, string filter = null)
 {
     var membershipGroupManager = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve<MembershipGroupManager>();
     var membership = new Kooboo.CMS.Membership.Models.Membership(requestContext.GetRequestValue("membershipName"));
     return membershipGroupManager.All(membership, "").Select(it => new SelectListItem() { Text = it.Name, Value = it.Name });
 }