Ejemplo n.º 1
0
        public virtual ActionResult Index()
        {
            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                                     {
                                                         new GridColumnViewModel {
                                                                 Name = Translate("Models.PageLocale.Title"),
                                                                 Index = "Title"
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = Translate("Models.PageLocale.Url"),
                                                                 Index = "page.Url"
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = Translate("Models.PageLocale.InMainMenu"),
                                                                 Index = "page.HideInMainMenu"
                                                             },
                                                        new GridColumnViewModel
                                                             {
                                                                 Name = Translate("Models.PageLocale.Template"),
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = Translate("Actions.Actions"),
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {Name = "Id", Sortable = false, Hidden = true}
                                                     };
            var model = new GridViewModel
            {
                DataUrl = Url.Action(MVC.Admin.Page.DynamicGridData()),
                DefaultOrderColumn = "Title",
                GridTitle = Translate(".Pages"),
                Columns = columns
            };

            return View(model);
        }
        public virtual ActionResult ShowAll()
        {
            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                                     {
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Title", ResourceHelper.GetControllerScope(this)), 
                                                                 Index = "Title",
                                                                 Width = 400
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Actions", ResourceHelper.GetControllerScope(this)),
                                                                 Width = 30,
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = "Id", 
                                                                 Sortable = false, 
                                                                 Hidden = true
                                                             }
                                                     };
            var model = new GridViewModel
            {
                DataUrl = Url.Action("DynamicGridData", "Forms"),
                DefaultOrderColumn = "Id",
                GridTitle = HttpContext.Translate("Forms", ResourceHelper.GetControllerScope(this)),
                Columns = columns,
                IsRowNotClickable = true
            };

            return View("FormsList", model);
        }
        public virtual ActionResult ShowFormElements(long formId)
        {
            var form = formsService.Find(formId);

            if (form == null || !permissionService.IsAllowed((Int32)FormOperations.View, this.CorePrincipal(), typeof(Form), form.Id, IsFormOwner(form), PermissionOperationLevel.Object))
            {
                throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this)));
            }

            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                                     {
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Title", ResourceHelper.GetControllerScope(this)), 
                                                                 Sortable = false,
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Type", ResourceHelper.GetControllerScope(this)), 
                                                                 Sortable = false,
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Required", ResourceHelper.GetControllerScope(this)), 
                                                                 Sortable = false,
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Width = 50,
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Width = 10,
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = "Id", 
                                                                 Sortable = false, 
                                                                 Hidden = true
                                                             }
                                                     };
            var model = new GridViewModel
            {
                DataUrl = Url.Action("FormElementsDynamicGridData", "Forms", new { formId = form.Id}),
                DefaultOrderColumn = "Title",
                GridTitle = HttpContext.Translate("GridTitle", ResourceHelper.GetControllerScope(this)),//"Form Elements",
                Columns = columns,
                IsRowNotClickable = true
            };
            
            bool allowManage = permissionService.IsAllowed((Int32) FormOperations.Manage, this.CorePrincipal(),
                                                            typeof (Form), form.Id, IsFormOwner(form),
                                                            PermissionOperationLevel.Object);

            ViewData["Form"] = new FormViewModel {Id = form.Id, AllowManage = allowManage};

            return View("FormElements", model);
        }
        private GridViewModel BuildProfileTypesGrid()
        {
            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                                     {
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Title", ResourceHelper.GetControllerScope(this)), 
                                                                 Index = "Title",
                                                                 Width = 400
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Actions", ResourceHelper.GetControllerScope(this)),
                                                                 Width = 30,
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = "Id", 
                                                                 Sortable = false, 
                                                                 Hidden = true
                                                             }
                                                     };
            var model = new GridViewModel
            {
                DataUrl = Url.Action("LoadData", "ProfileType"),
                DefaultOrderColumn = "Id",
                GridTitle = HttpContext.Translate("Titles.ProfileTypes", String.Empty),
                Columns = columns,
                IsRowNotClickable = true
            };

            return model;
        }
        public virtual ActionResult ShowAll()
        {
            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>();
            columns.Add(new GridColumnViewModel { Name = HttpContext.Translate("Form", ResourceHelper.GetControllerScope(this)), Index = "Title" });
            columns.Add(new GridColumnViewModel { Name = HttpContext.Translate("Answers", ResourceHelper.GetControllerScope(this)), Width = 50 });
            columns.Add(new GridColumnViewModel { Name = "Id", Sortable = false, Hidden = true });
            var model = new GridViewModel
                            {
                                DataUrl = Url.Action("FormAnswersDynamicGridData"),
                                DetailsUrl ="form-answers/",
                                DefaultOrderColumn = "Title",
                                GridTitle = HttpContext.Translate("GridTitle", ResourceHelper.GetControllerScope(this)),
                                Columns = columns
                            };

            return View("FormsAnswersList", model);
        }
        public virtual ActionResult ShowAnswers(long formWidgetId)
        {
            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>();
            columns.Add(new GridColumnViewModel { Name = HttpContext.Translate("User", ResourceHelper.GetControllerScope(this)), Index = "User" });
            columns.Add(new GridColumnViewModel { Name = HttpContext.Translate("Date", ResourceHelper.GetControllerScope(this)), Width = 150, Index = "CreateDate"});
            columns.Add(new GridColumnViewModel { Name = HttpContext.Translate("Title", ResourceHelper.GetControllerScope(this))});
            columns.Add(new GridColumnViewModel { Name = "Id", Sortable = false, Hidden = true });
            GridViewModel model = new GridViewModel
            {
                DataUrl = Url.Action("ShowAnswers"),
                DetailsUrl = ApplicationUtility.Path + "admin/forms-answer-details/",
                DefaultOrderColumn = "Title",
                GridTitle = HttpContext.Translate("GridTitle", ResourceHelper.GetControllerScope(this)),
                Columns = columns,
                SearchEnable = false
            };

            return View("FormAnswers", model);
        }
        public GridViewModel BuildCategoriesGrid()
        {
            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                                     {
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Title", ResourceHelper.GetControllerScope(this)), 
                                                                 Index = "Title",
                                                                 Width = 400
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Section", ResourceHelper.GetControllerScope(this)), 
                                                                 Index = "Section.CurrentLocale.Title",
                                                                 Width = 400
                                                             },
                                                         new GridColumnViewModel
                                                            {
                                                                Name = HttpContext.Translate("Status", ResourceHelper.GetControllerScope(this)), 
                                                                Index = "Status",
                                                                Width = 400
                                                            },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Actions", ResourceHelper.GetControllerScope(this)),
                                                                 Width = 30,
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = "Id", 
                                                                 Sortable = false, 
                                                                 Hidden = true
                                                             }
                                                     };
            var model = new GridViewModel
            {
                DataUrl = Url.Action("LoadData", "WebContentCategory"),
                DefaultOrderColumn = "Id",
                GridTitle = HttpContext.Translate("Titles.Categories", String.Empty),
                Columns = columns,
                IsRowNotClickable = true
            };

            return model;
        }
        public virtual ActionResult ShowFiles(long articleId)
        {
            var article = articleService.Find(articleId);

            if (article == null || !permissionService.IsAllowed((Int32)ArticleOperations.View, this.CorePrincipal(), typeof(Article), article.Id, IsArticleOwner(article), PermissionOperationLevel.Object))
            {
                throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this)));
            }

            IList<GridColumnViewModel> columns = new List<GridColumnViewModel>
                                                     {
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = HttpContext.Translate("Title", ResourceHelper.GetControllerScope(this)), 
                                                                 Sortable = false,
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Width = 10,
                                                                 Sortable = false
                                                             },
                                                         new GridColumnViewModel
                                                             {
                                                                 Name = "Id", 
                                                                 Sortable = false, 
                                                                 Hidden = true
                                                             }
                                                     };
            var model = new GridViewModel
            {
                DataUrl = Url.Action("LoadFilesData", "Article", new { articleId = article.Id }),
                DefaultOrderColumn = "Title",
                GridTitle = HttpContext.Translate("Titles.ArticleFiles", ResourceHelper.GetControllerScope(this)),
                Columns = columns,
                IsRowNotClickable = true
            };

            bool allowManage = permissionService.IsAllowed((Int32)ArticleOperations.Manage, this.CorePrincipal(),
                                                            typeof(Article), article.Id, IsArticleOwner(article),
                                                            PermissionOperationLevel.Object);

            ViewData["Article"] = new ArticleViewModel { Id = article.Id, AllowManage = allowManage };

            return View("ArticleFiles", model);
        }