예제 #1
0
        public virtual ActionResult Index()
        {
            var repositoryName = this.Request.RequestContext.GetRequestValue("repositoryName");//ControllerContext.RouteData.Values["repositoryName"];

            ContentMapModel mapModel = new ContentMapModel();

            if (string.IsNullOrEmpty(repositoryName))
            {
                mapModel.Repository = new ContentEditStep
                {
                    Status = ContentEditStatus.Enable,
                    ActionUrl = this.Url.Action("Create", "Repository")
                };
            }
            else
            {
                var allRequestValue = Request.RequestContext.AllRouteValues();

                var repository = ServiceFactory.RepositoryManager.Get(repositoryName);

                mapModel.Repository.Status = ContentEditStatus.Disable;

                if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_SchemaPermission))
                {
                    mapModel.ContentType.Status = ContentEditStatus.Done;

                    mapModel.ContentType.ActionUrl = this.Url.Action("Index", "Schema", allRequestValue);
                }
                else
                {
                    mapModel.ContentType.Status = ContentEditStatus.Disable;
                }

                if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_FolderPermission))
                {
                    mapModel.TextFolder.Status = ContentEditStatus.Enable;
                    mapModel.TextFolder.ActionUrl = this.Url.Action("Index", "TextFolder", allRequestValue);
                }
                else
                {
                    mapModel.ContentType.Status = ContentEditStatus.Disable;
                }

                var textFolder = ServiceFactory.TextFolderManager.All(repository, null);

                if (textFolder != null && textFolder.Count() > 0)
                {
                    if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_ContentPermission))
                    {
                        mapModel.TextFolder.Status = ContentEditStatus.Done;
                        mapModel.TextContent.Status = ContentEditStatus.Enable;

                        mapModel.TextContent.ActionUrl = Url.Action("Index", "TextFolder", allRequestValue);
                    }
                    else
                    {
                        mapModel.TextContent.Status = ContentEditStatus.Disable;
                    }
                }
                if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_ContentPermission))
                {
                    mapModel.MediaContent.Status = ContentEditStatus.Enable;
                    mapModel.MediaContent.ActionUrl = Url.Action("Index", "MediaContent", allRequestValue);
                }
                else
                {
                    mapModel.MediaContent.Status = ContentEditStatus.Disable;
                }
            }

            return View(mapModel);
        }
예제 #2
0
        public virtual ActionResult Index()
        {
            var repositoryName = this.Request.RequestContext.GetRequestValue("repositoryName");//ControllerContext.RouteData.Values["repositoryName"];

            ContentMapModel mapModel = new ContentMapModel();

            if (string.IsNullOrEmpty(repositoryName))
            {
                mapModel.Repository = new ContentEditStep
                {
                    Status    = ContentEditStatus.Enable,
                    ActionUrl = this.Url.Action("Create", "Repository")
                };
            }
            else
            {
                var allRequestValue = Request.RequestContext.AllRouteValues();

                var repository = ServiceFactory.RepositoryManager.Get(repositoryName);


                mapModel.Repository.Status = ContentEditStatus.Disable;

                if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_SchemaPermission))
                {
                    mapModel.ContentType.Status = ContentEditStatus.Done;

                    mapModel.ContentType.ActionUrl = this.Url.Action("Index", "Schema", allRequestValue);
                }
                else
                {
                    mapModel.ContentType.Status = ContentEditStatus.Disable;
                }

                if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_FolderPermission))
                {
                    mapModel.TextFolder.Status    = ContentEditStatus.Enable;
                    mapModel.TextFolder.ActionUrl = this.Url.Action("Index", "TextFolder", allRequestValue);
                }
                else
                {
                    mapModel.ContentType.Status = ContentEditStatus.Disable;
                }

                var textFolder = ServiceFactory.TextFolderManager.All(repository, null);

                if (textFolder != null && textFolder.Count() > 0)
                {
                    if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_ContentPermission))
                    {
                        mapModel.TextFolder.Status  = ContentEditStatus.Done;
                        mapModel.TextContent.Status = ContentEditStatus.Enable;

                        mapModel.TextContent.ActionUrl = Url.Action("Index", "TextFolder", allRequestValue);
                    }
                    else
                    {
                        mapModel.TextContent.Status = ContentEditStatus.Disable;
                    }
                }
                if (CMS.Sites.Services.ServiceFactory.UserManager.Authorize(CMS.Sites.Models.Site.Current, User.Identity.Name, CMS.Account.Models.Permission.Contents_ContentPermission))
                {
                    mapModel.MediaContent.Status    = ContentEditStatus.Enable;
                    mapModel.MediaContent.ActionUrl = Url.Action("Index", "MediaContent", allRequestValue);
                }
                else
                {
                    mapModel.MediaContent.Status = ContentEditStatus.Disable;
                }
            }



            return(View(mapModel));
        }